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