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

RpcBindingInqOption

関数
RPCバインディングのオプション値を取得する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcBindingInqOption(
    void* hBinding,
    DWORD option,
    UINT_PTR* pOptionValue
);

パラメーター

名前方向
hBindingvoid*in
optionDWORDin
pOptionValueUINT_PTR*out

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcBindingInqOption(
    void* hBinding,
    DWORD option,
    UINT_PTR* pOptionValue
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcBindingInqOption(
    IntPtr hBinding,   // void*
    uint option,   // DWORD
    out UIntPtr pOptionValue   // UINT_PTR* out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcBindingInqOption(
    hBinding As IntPtr,   ' void*
    [option] As UInteger,   ' DWORD
    <Out> ByRef pOptionValue As UIntPtr   ' UINT_PTR* out
) As Integer
End Function
' hBinding : void*
' option : DWORD
' pOptionValue : UINT_PTR* out
Declare PtrSafe Function RpcBindingInqOption Lib "rpcrt4" ( _
    ByVal hBinding As LongPtr, _
    ByVal option As Long, _
    ByRef pOptionValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcBindingInqOption = ctypes.windll.rpcrt4.RpcBindingInqOption
RpcBindingInqOption.restype = ctypes.c_int
RpcBindingInqOption.argtypes = [
    ctypes.POINTER(None),  # hBinding : void*
    wintypes.DWORD,  # option : DWORD
    ctypes.POINTER(ctypes.c_size_t),  # pOptionValue : UINT_PTR* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcBindingInqOption = rpcrt4.NewProc("RpcBindingInqOption")
)

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