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