Win32 API 日本語リファレンス
ホームSystem.Rpc › NDRSContextMarshallEx

NDRSContextMarshallEx

関数
バインディング指定でサーバーコンテキストをマーシャリングする拡張版。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

// RPCRT4.dll
#include <windows.h>

void NDRSContextMarshallEx(
    void* BindingHandle,
    NDR_SCONTEXT* CContext,
    void* pBuff,
    NDR_RUNDOWN userRunDownIn
);

パラメーター

名前方向
BindingHandlevoid*in
CContextNDR_SCONTEXT*in
pBuffvoid*out
userRunDownInNDR_RUNDOWNin

戻り値の型: void

各言語での呼び出し定義

// RPCRT4.dll
#include <windows.h>

void NDRSContextMarshallEx(
    void* BindingHandle,
    NDR_SCONTEXT* CContext,
    void* pBuff,
    NDR_RUNDOWN userRunDownIn
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void NDRSContextMarshallEx(
    IntPtr BindingHandle,   // void*
    IntPtr CContext,   // NDR_SCONTEXT*
    IntPtr pBuff,   // void* out
    IntPtr userRunDownIn   // NDR_RUNDOWN
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub NDRSContextMarshallEx(
    BindingHandle As IntPtr,   ' void*
    CContext As IntPtr,   ' NDR_SCONTEXT*
    pBuff As IntPtr,   ' void* out
    userRunDownIn As IntPtr   ' NDR_RUNDOWN
)
End Sub
' BindingHandle : void*
' CContext : NDR_SCONTEXT*
' pBuff : void* out
' userRunDownIn : NDR_RUNDOWN
Declare PtrSafe Sub NDRSContextMarshallEx Lib "rpcrt4" ( _
    ByVal BindingHandle As LongPtr, _
    ByVal CContext As LongPtr, _
    ByVal pBuff As LongPtr, _
    ByVal userRunDownIn As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NDRSContextMarshallEx = ctypes.windll.rpcrt4.NDRSContextMarshallEx
NDRSContextMarshallEx.restype = None
NDRSContextMarshallEx.argtypes = [
    ctypes.POINTER(None),  # BindingHandle : void*
    ctypes.c_void_p,  # CContext : NDR_SCONTEXT*
    ctypes.POINTER(None),  # pBuff : void* out
    ctypes.c_void_p,  # userRunDownIn : NDR_RUNDOWN
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NDRSContextMarshallEx = Fiddle::Function.new(
  lib['NDRSContextMarshallEx'],
  [
    Fiddle::TYPE_VOIDP,  # BindingHandle : void*
    Fiddle::TYPE_VOIDP,  # CContext : NDR_SCONTEXT*
    Fiddle::TYPE_VOIDP,  # pBuff : void* out
    Fiddle::TYPE_VOIDP,  # userRunDownIn : NDR_RUNDOWN
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn NDRSContextMarshallEx(
        BindingHandle: *mut (),  // void*
        CContext: *mut NDR_SCONTEXT,  // NDR_SCONTEXT*
        pBuff: *mut (),  // void* out
        userRunDownIn: *const core::ffi::c_void  // NDR_RUNDOWN
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void NDRSContextMarshallEx(IntPtr BindingHandle, IntPtr CContext, IntPtr pBuff, IntPtr userRunDownIn);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NDRSContextMarshallEx' -Namespace Win32 -PassThru
# $api::NDRSContextMarshallEx(BindingHandle, CContext, pBuff, userRunDownIn)
#uselib "RPCRT4.dll"
#func global NDRSContextMarshallEx "NDRSContextMarshallEx" sptr, sptr, sptr, sptr
; NDRSContextMarshallEx BindingHandle, varptr(CContext), pBuff, userRunDownIn
; BindingHandle : void* -> "sptr"
; CContext : NDR_SCONTEXT* -> "sptr"
; pBuff : void* out -> "sptr"
; userRunDownIn : NDR_RUNDOWN -> "sptr"
出力引数:
#uselib "RPCRT4.dll"
#func global NDRSContextMarshallEx "NDRSContextMarshallEx" sptr, var, sptr, sptr
; NDRSContextMarshallEx BindingHandle, CContext, pBuff, userRunDownIn
; BindingHandle : void* -> "sptr"
; CContext : NDR_SCONTEXT* -> "var"
; pBuff : void* out -> "sptr"
; userRunDownIn : NDR_RUNDOWN -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void NDRSContextMarshallEx(void* BindingHandle, NDR_SCONTEXT* CContext, void* pBuff, NDR_RUNDOWN userRunDownIn)
#uselib "RPCRT4.dll"
#func global NDRSContextMarshallEx "NDRSContextMarshallEx" intptr, var, intptr, intptr
; NDRSContextMarshallEx BindingHandle, CContext, pBuff, userRunDownIn
; BindingHandle : void* -> "intptr"
; CContext : NDR_SCONTEXT* -> "var"
; pBuff : void* out -> "intptr"
; userRunDownIn : NDR_RUNDOWN -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNDRSContextMarshallEx = rpcrt4.NewProc("NDRSContextMarshallEx")
)

// BindingHandle (void*), CContext (NDR_SCONTEXT*), pBuff (void* out), userRunDownIn (NDR_RUNDOWN)
r1, _, err := procNDRSContextMarshallEx.Call(
	uintptr(BindingHandle),
	uintptr(CContext),
	uintptr(pBuff),
	uintptr(userRunDownIn),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure NDRSContextMarshallEx(
  BindingHandle: Pointer;   // void*
  CContext: Pointer;   // NDR_SCONTEXT*
  pBuff: Pointer;   // void* out
  userRunDownIn: Pointer   // NDR_RUNDOWN
); stdcall;
  external 'RPCRT4.dll' name 'NDRSContextMarshallEx';
result := DllCall("RPCRT4\NDRSContextMarshallEx"
    , "Ptr", BindingHandle   ; void*
    , "Ptr", CContext   ; NDR_SCONTEXT*
    , "Ptr", pBuff   ; void* out
    , "Ptr", userRunDownIn   ; NDR_RUNDOWN
    , "Int")   ; return: void
●NDRSContextMarshallEx(BindingHandle, CContext, pBuff, userRunDownIn) = DLL("RPCRT4.dll", "int NDRSContextMarshallEx(void*, void*, void*, void*)")
# 呼び出し: NDRSContextMarshallEx(BindingHandle, CContext, pBuff, userRunDownIn)
# BindingHandle : void* -> "void*"
# CContext : NDR_SCONTEXT* -> "void*"
# pBuff : void* out -> "void*"
# userRunDownIn : NDR_RUNDOWN -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。