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

NdrCreateServerInterfaceFromStub

関数
スタブからRPCサーバーインターフェイス情報を生成する。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

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

RPC_STATUS NdrCreateServerInterfaceFromStub(
    IRpcStubBuffer* pStub,
    RPC_SERVER_INTERFACE* pServerIf
);

パラメーター

名前方向
pStubIRpcStubBuffer*in
pServerIfRPC_SERVER_INTERFACE*inout

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS NdrCreateServerInterfaceFromStub(
    IRpcStubBuffer* pStub,
    RPC_SERVER_INTERFACE* pServerIf
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int NdrCreateServerInterfaceFromStub(
    IntPtr pStub,   // IRpcStubBuffer*
    IntPtr pServerIf   // RPC_SERVER_INTERFACE* in/out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function NdrCreateServerInterfaceFromStub(
    pStub As IntPtr,   ' IRpcStubBuffer*
    pServerIf As IntPtr   ' RPC_SERVER_INTERFACE* in/out
) As Integer
End Function
' pStub : IRpcStubBuffer*
' pServerIf : RPC_SERVER_INTERFACE* in/out
Declare PtrSafe Function NdrCreateServerInterfaceFromStub Lib "rpcrt4" ( _
    ByVal pStub As LongPtr, _
    ByVal pServerIf As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NdrCreateServerInterfaceFromStub = ctypes.windll.rpcrt4.NdrCreateServerInterfaceFromStub
NdrCreateServerInterfaceFromStub.restype = ctypes.c_int
NdrCreateServerInterfaceFromStub.argtypes = [
    ctypes.c_void_p,  # pStub : IRpcStubBuffer*
    ctypes.c_void_p,  # pServerIf : RPC_SERVER_INTERFACE* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNdrCreateServerInterfaceFromStub = rpcrt4.NewProc("NdrCreateServerInterfaceFromStub")
)

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