Win32 API 日本語リファレンス
ホームSystem.Rpc › NdrStubCall2

NdrStubCall2

関数
RPCサーバースタブ呼び出しを処理しディスパッチする。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCRT4.dll
#include <windows.h>

INT NdrStubCall2(
    void* pThis,
    void* pChannel,
    RPC_MESSAGE* pRpcMsg,
    DWORD* pdwStubPhase
);

パラメーター

名前方向
pThisvoid*inout
pChannelvoid*inout
pRpcMsgRPC_MESSAGE*inout
pdwStubPhaseDWORD*inout

戻り値の型: INT

各言語での呼び出し定義

// RPCRT4.dll
#include <windows.h>

INT NdrStubCall2(
    void* pThis,
    void* pChannel,
    RPC_MESSAGE* pRpcMsg,
    DWORD* pdwStubPhase
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int NdrStubCall2(
    IntPtr pThis,   // void* in/out
    IntPtr pChannel,   // void* in/out
    IntPtr pRpcMsg,   // RPC_MESSAGE* in/out
    ref uint pdwStubPhase   // DWORD* in/out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function NdrStubCall2(
    pThis As IntPtr,   ' void* in/out
    pChannel As IntPtr,   ' void* in/out
    pRpcMsg As IntPtr,   ' RPC_MESSAGE* in/out
    ByRef pdwStubPhase As UInteger   ' DWORD* in/out
) As Integer
End Function
' pThis : void* in/out
' pChannel : void* in/out
' pRpcMsg : RPC_MESSAGE* in/out
' pdwStubPhase : DWORD* in/out
Declare PtrSafe Function NdrStubCall2 Lib "rpcrt4" ( _
    ByVal pThis As LongPtr, _
    ByVal pChannel As LongPtr, _
    ByVal pRpcMsg As LongPtr, _
    ByRef pdwStubPhase As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NdrStubCall2 = ctypes.windll.rpcrt4.NdrStubCall2
NdrStubCall2.restype = ctypes.c_int
NdrStubCall2.argtypes = [
    ctypes.POINTER(None),  # pThis : void* in/out
    ctypes.POINTER(None),  # pChannel : void* in/out
    ctypes.c_void_p,  # pRpcMsg : RPC_MESSAGE* in/out
    ctypes.POINTER(wintypes.DWORD),  # pdwStubPhase : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NdrStubCall2 = Fiddle::Function.new(
  lib['NdrStubCall2'],
  [
    Fiddle::TYPE_VOIDP,  # pThis : void* in/out
    Fiddle::TYPE_VOIDP,  # pChannel : void* in/out
    Fiddle::TYPE_VOIDP,  # pRpcMsg : RPC_MESSAGE* in/out
    Fiddle::TYPE_VOIDP,  # pdwStubPhase : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcrt4")]
extern "system" {
    fn NdrStubCall2(
        pThis: *mut (),  // void* in/out
        pChannel: *mut (),  // void* in/out
        pRpcMsg: *mut RPC_MESSAGE,  // RPC_MESSAGE* in/out
        pdwStubPhase: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int NdrStubCall2(IntPtr pThis, IntPtr pChannel, IntPtr pRpcMsg, ref uint pdwStubPhase);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrStubCall2' -Namespace Win32 -PassThru
# $api::NdrStubCall2(pThis, pChannel, pRpcMsg, pdwStubPhase)
#uselib "RPCRT4.dll"
#func global NdrStubCall2 "NdrStubCall2" sptr, sptr, sptr, sptr
; NdrStubCall2 pThis, pChannel, varptr(pRpcMsg), varptr(pdwStubPhase)   ; 戻り値は stat
; pThis : void* in/out -> "sptr"
; pChannel : void* in/out -> "sptr"
; pRpcMsg : RPC_MESSAGE* in/out -> "sptr"
; pdwStubPhase : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global NdrStubCall2 "NdrStubCall2" sptr, sptr, var, var
; res = NdrStubCall2(pThis, pChannel, pRpcMsg, pdwStubPhase)
; pThis : void* in/out -> "sptr"
; pChannel : void* in/out -> "sptr"
; pRpcMsg : RPC_MESSAGE* in/out -> "var"
; pdwStubPhase : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT NdrStubCall2(void* pThis, void* pChannel, RPC_MESSAGE* pRpcMsg, DWORD* pdwStubPhase)
#uselib "RPCRT4.dll"
#cfunc global NdrStubCall2 "NdrStubCall2" intptr, intptr, var, var
; res = NdrStubCall2(pThis, pChannel, pRpcMsg, pdwStubPhase)
; pThis : void* in/out -> "intptr"
; pChannel : void* in/out -> "intptr"
; pRpcMsg : RPC_MESSAGE* in/out -> "var"
; pdwStubPhase : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNdrStubCall2 = rpcrt4.NewProc("NdrStubCall2")
)

// pThis (void* in/out), pChannel (void* in/out), pRpcMsg (RPC_MESSAGE* in/out), pdwStubPhase (DWORD* in/out)
r1, _, err := procNdrStubCall2.Call(
	uintptr(pThis),
	uintptr(pChannel),
	uintptr(pRpcMsg),
	uintptr(pdwStubPhase),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function NdrStubCall2(
  pThis: Pointer;   // void* in/out
  pChannel: Pointer;   // void* in/out
  pRpcMsg: Pointer;   // RPC_MESSAGE* in/out
  pdwStubPhase: Pointer   // DWORD* in/out
): Integer; stdcall;
  external 'RPCRT4.dll' name 'NdrStubCall2';
result := DllCall("RPCRT4\NdrStubCall2"
    , "Ptr", pThis   ; void* in/out
    , "Ptr", pChannel   ; void* in/out
    , "Ptr", pRpcMsg   ; RPC_MESSAGE* in/out
    , "Ptr", pdwStubPhase   ; DWORD* in/out
    , "Int")   ; return: INT
●NdrStubCall2(pThis, pChannel, pRpcMsg, pdwStubPhase) = DLL("RPCRT4.dll", "int NdrStubCall2(void*, void*, void*, void*)")
# 呼び出し: NdrStubCall2(pThis, pChannel, pRpcMsg, pdwStubPhase)
# pThis : void* in/out -> "void*"
# pChannel : void* in/out -> "void*"
# pRpcMsg : RPC_MESSAGE* in/out -> "void*"
# pdwStubPhase : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。