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

RpcIfInqId

関数
インターフェイス仕様からインターフェイスIDを取得する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcIfInqId(
    void* RpcIfHandle,
    RPC_IF_ID* RpcIfId
);

パラメーター

名前方向
RpcIfHandlevoid*in
RpcIfIdRPC_IF_ID*out

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcIfInqId = ctypes.windll.rpcrt4.RpcIfInqId
RpcIfInqId.restype = ctypes.c_int
RpcIfInqId.argtypes = [
    ctypes.POINTER(None),  # RpcIfHandle : void*
    ctypes.c_void_p,  # RpcIfId : RPC_IF_ID* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcIfInqId = rpcrt4.NewProc("RpcIfInqId")
)

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