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

NdrDcomAsyncStubCall

関数
DCOMの非同期スタブ呼び出しをディスパッチする。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

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

INT NdrDcomAsyncStubCall(
    IRpcStubBuffer* pThis,
    IRpcChannelBuffer* pChannel,
    RPC_MESSAGE* pRpcMsg,
    DWORD* pdwStubPhase
);

パラメーター

名前方向
pThisIRpcStubBuffer*in
pChannelIRpcChannelBuffer*in
pRpcMsgRPC_MESSAGE*inout
pdwStubPhaseDWORD*inout

戻り値の型: INT

各言語での呼び出し定義

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

INT NdrDcomAsyncStubCall(
    IRpcStubBuffer* pThis,
    IRpcChannelBuffer* pChannel,
    RPC_MESSAGE* pRpcMsg,
    DWORD* pdwStubPhase
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int NdrDcomAsyncStubCall(
    IntPtr pThis,   // IRpcStubBuffer*
    IntPtr pChannel,   // IRpcChannelBuffer*
    IntPtr pRpcMsg,   // RPC_MESSAGE* in/out
    ref uint pdwStubPhase   // DWORD* in/out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function NdrDcomAsyncStubCall(
    pThis As IntPtr,   ' IRpcStubBuffer*
    pChannel As IntPtr,   ' IRpcChannelBuffer*
    pRpcMsg As IntPtr,   ' RPC_MESSAGE* in/out
    ByRef pdwStubPhase As UInteger   ' DWORD* in/out
) As Integer
End Function
' pThis : IRpcStubBuffer*
' pChannel : IRpcChannelBuffer*
' pRpcMsg : RPC_MESSAGE* in/out
' pdwStubPhase : DWORD* in/out
Declare PtrSafe Function NdrDcomAsyncStubCall 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

NdrDcomAsyncStubCall = ctypes.windll.rpcrt4.NdrDcomAsyncStubCall
NdrDcomAsyncStubCall.restype = ctypes.c_int
NdrDcomAsyncStubCall.argtypes = [
    ctypes.c_void_p,  # pThis : IRpcStubBuffer*
    ctypes.c_void_p,  # pChannel : IRpcChannelBuffer*
    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')
NdrDcomAsyncStubCall = Fiddle::Function.new(
  lib['NdrDcomAsyncStubCall'],
  [
    Fiddle::TYPE_VOIDP,  # pThis : IRpcStubBuffer*
    Fiddle::TYPE_VOIDP,  # pChannel : IRpcChannelBuffer*
    Fiddle::TYPE_VOIDP,  # pRpcMsg : RPC_MESSAGE* in/out
    Fiddle::TYPE_VOIDP,  # pdwStubPhase : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcrt4")]
extern "system" {
    fn NdrDcomAsyncStubCall(
        pThis: *mut core::ffi::c_void,  // IRpcStubBuffer*
        pChannel: *mut core::ffi::c_void,  // IRpcChannelBuffer*
        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 NdrDcomAsyncStubCall(IntPtr pThis, IntPtr pChannel, IntPtr pRpcMsg, ref uint pdwStubPhase);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrDcomAsyncStubCall' -Namespace Win32 -PassThru
# $api::NdrDcomAsyncStubCall(pThis, pChannel, pRpcMsg, pdwStubPhase)
#uselib "RPCRT4.dll"
#func global NdrDcomAsyncStubCall "NdrDcomAsyncStubCall" sptr, sptr, sptr, sptr
; NdrDcomAsyncStubCall pThis, pChannel, varptr(pRpcMsg), varptr(pdwStubPhase)   ; 戻り値は stat
; pThis : IRpcStubBuffer* -> "sptr"
; pChannel : IRpcChannelBuffer* -> "sptr"
; pRpcMsg : RPC_MESSAGE* in/out -> "sptr"
; pdwStubPhase : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global NdrDcomAsyncStubCall "NdrDcomAsyncStubCall" sptr, sptr, var, var
; res = NdrDcomAsyncStubCall(pThis, pChannel, pRpcMsg, pdwStubPhase)
; pThis : IRpcStubBuffer* -> "sptr"
; pChannel : IRpcChannelBuffer* -> "sptr"
; pRpcMsg : RPC_MESSAGE* in/out -> "var"
; pdwStubPhase : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT NdrDcomAsyncStubCall(IRpcStubBuffer* pThis, IRpcChannelBuffer* pChannel, RPC_MESSAGE* pRpcMsg, DWORD* pdwStubPhase)
#uselib "RPCRT4.dll"
#cfunc global NdrDcomAsyncStubCall "NdrDcomAsyncStubCall" intptr, intptr, var, var
; res = NdrDcomAsyncStubCall(pThis, pChannel, pRpcMsg, pdwStubPhase)
; pThis : IRpcStubBuffer* -> "intptr"
; pChannel : IRpcChannelBuffer* -> "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")
	procNdrDcomAsyncStubCall = rpcrt4.NewProc("NdrDcomAsyncStubCall")
)

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