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

I_RpcBindingSetPrivateOption

関数
バインディングにプライベートオプションを設定する内部関数。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

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

RPC_STATUS I_RpcBindingSetPrivateOption(
    void* hBinding,
    DWORD option,
    UINT_PTR optionValue
);

パラメーター

名前方向
hBindingvoid*in
optionDWORDin
optionValueUINT_PTRin

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

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

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procI_RpcBindingSetPrivateOption = rpcrt4.NewProc("I_RpcBindingSetPrivateOption")
)

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