ホーム › System.Rpc › NdrServerContextMarshall
NdrServerContextMarshall
関数NDRでサーバー側コンテキストハンドルをマーシャリングする。
シグネチャ
// RPCRT4.dll
#include <windows.h>
void NdrServerContextMarshall(
MIDL_STUB_MESSAGE* pStubMsg,
NDR_SCONTEXT* ContextHandle,
NDR_RUNDOWN RundownRoutine
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pStubMsg | MIDL_STUB_MESSAGE* | inout |
| ContextHandle | NDR_SCONTEXT* | inout |
| RundownRoutine | NDR_RUNDOWN | in |
戻り値の型: void
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
void NdrServerContextMarshall(
MIDL_STUB_MESSAGE* pStubMsg,
NDR_SCONTEXT* ContextHandle,
NDR_RUNDOWN RundownRoutine
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void NdrServerContextMarshall(
IntPtr pStubMsg, // MIDL_STUB_MESSAGE* in/out
IntPtr ContextHandle, // NDR_SCONTEXT* in/out
IntPtr RundownRoutine // NDR_RUNDOWN
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub NdrServerContextMarshall(
pStubMsg As IntPtr, ' MIDL_STUB_MESSAGE* in/out
ContextHandle As IntPtr, ' NDR_SCONTEXT* in/out
RundownRoutine As IntPtr ' NDR_RUNDOWN
)
End Sub' pStubMsg : MIDL_STUB_MESSAGE* in/out
' ContextHandle : NDR_SCONTEXT* in/out
' RundownRoutine : NDR_RUNDOWN
Declare PtrSafe Sub NdrServerContextMarshall Lib "rpcrt4" ( _
ByVal pStubMsg As LongPtr, _
ByVal ContextHandle As LongPtr, _
ByVal RundownRoutine As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NdrServerContextMarshall = ctypes.windll.rpcrt4.NdrServerContextMarshall
NdrServerContextMarshall.restype = None
NdrServerContextMarshall.argtypes = [
ctypes.c_void_p, # pStubMsg : MIDL_STUB_MESSAGE* in/out
ctypes.c_void_p, # ContextHandle : NDR_SCONTEXT* in/out
ctypes.c_void_p, # RundownRoutine : NDR_RUNDOWN
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
NdrServerContextMarshall = Fiddle::Function.new(
lib['NdrServerContextMarshall'],
[
Fiddle::TYPE_VOIDP, # pStubMsg : MIDL_STUB_MESSAGE* in/out
Fiddle::TYPE_VOIDP, # ContextHandle : NDR_SCONTEXT* in/out
Fiddle::TYPE_VOIDP, # RundownRoutine : NDR_RUNDOWN
],
Fiddle::TYPE_VOID)#[link(name = "rpcrt4")]
extern "system" {
fn NdrServerContextMarshall(
pStubMsg: *mut MIDL_STUB_MESSAGE, // MIDL_STUB_MESSAGE* in/out
ContextHandle: *mut NDR_SCONTEXT, // NDR_SCONTEXT* in/out
RundownRoutine: *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 NdrServerContextMarshall(IntPtr pStubMsg, IntPtr ContextHandle, IntPtr RundownRoutine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrServerContextMarshall' -Namespace Win32 -PassThru
# $api::NdrServerContextMarshall(pStubMsg, ContextHandle, RundownRoutine)#uselib "RPCRT4.dll"
#func global NdrServerContextMarshall "NdrServerContextMarshall" sptr, sptr, sptr
; NdrServerContextMarshall varptr(pStubMsg), varptr(ContextHandle), RundownRoutine
; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "sptr"
; ContextHandle : NDR_SCONTEXT* in/out -> "sptr"
; RundownRoutine : NDR_RUNDOWN -> "sptr"出力引数:
#uselib "RPCRT4.dll" #func global NdrServerContextMarshall "NdrServerContextMarshall" var, var, sptr ; NdrServerContextMarshall pStubMsg, ContextHandle, RundownRoutine ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var" ; ContextHandle : NDR_SCONTEXT* in/out -> "var" ; RundownRoutine : NDR_RUNDOWN -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #func global NdrServerContextMarshall "NdrServerContextMarshall" sptr, sptr, sptr ; NdrServerContextMarshall varptr(pStubMsg), varptr(ContextHandle), RundownRoutine ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "sptr" ; ContextHandle : NDR_SCONTEXT* in/out -> "sptr" ; RundownRoutine : NDR_RUNDOWN -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void NdrServerContextMarshall(MIDL_STUB_MESSAGE* pStubMsg, NDR_SCONTEXT* ContextHandle, NDR_RUNDOWN RundownRoutine) #uselib "RPCRT4.dll" #func global NdrServerContextMarshall "NdrServerContextMarshall" var, var, intptr ; NdrServerContextMarshall pStubMsg, ContextHandle, RundownRoutine ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var" ; ContextHandle : NDR_SCONTEXT* in/out -> "var" ; RundownRoutine : NDR_RUNDOWN -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void NdrServerContextMarshall(MIDL_STUB_MESSAGE* pStubMsg, NDR_SCONTEXT* ContextHandle, NDR_RUNDOWN RundownRoutine) #uselib "RPCRT4.dll" #func global NdrServerContextMarshall "NdrServerContextMarshall" intptr, intptr, intptr ; NdrServerContextMarshall varptr(pStubMsg), varptr(ContextHandle), RundownRoutine ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "intptr" ; ContextHandle : NDR_SCONTEXT* in/out -> "intptr" ; RundownRoutine : NDR_RUNDOWN -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procNdrServerContextMarshall = rpcrt4.NewProc("NdrServerContextMarshall")
)
// pStubMsg (MIDL_STUB_MESSAGE* in/out), ContextHandle (NDR_SCONTEXT* in/out), RundownRoutine (NDR_RUNDOWN)
r1, _, err := procNdrServerContextMarshall.Call(
uintptr(pStubMsg),
uintptr(ContextHandle),
uintptr(RundownRoutine),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure NdrServerContextMarshall(
pStubMsg: Pointer; // MIDL_STUB_MESSAGE* in/out
ContextHandle: Pointer; // NDR_SCONTEXT* in/out
RundownRoutine: Pointer // NDR_RUNDOWN
); stdcall;
external 'RPCRT4.dll' name 'NdrServerContextMarshall';result := DllCall("RPCRT4\NdrServerContextMarshall"
, "Ptr", pStubMsg ; MIDL_STUB_MESSAGE* in/out
, "Ptr", ContextHandle ; NDR_SCONTEXT* in/out
, "Ptr", RundownRoutine ; NDR_RUNDOWN
, "Int") ; return: void●NdrServerContextMarshall(pStubMsg, ContextHandle, RundownRoutine) = DLL("RPCRT4.dll", "int NdrServerContextMarshall(void*, void*, void*)")
# 呼び出し: NdrServerContextMarshall(pStubMsg, ContextHandle, RundownRoutine)
# pStubMsg : MIDL_STUB_MESSAGE* in/out -> "void*"
# ContextHandle : NDR_SCONTEXT* in/out -> "void*"
# RundownRoutine : NDR_RUNDOWN -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。