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