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