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)。
const std = @import("std");

extern "rpcrt4" fn RpcBindingInqOption(
    hBinding: ?*anyopaque, // void*
    option: u32, // DWORD
    pOptionValue: [*c]usize // UINT_PTR* out
) callconv(std.os.windows.WINAPI) i32;
proc RpcBindingInqOption(
    hBinding: pointer,  # void*
    option: uint32,  # DWORD
    pOptionValue: ptr uint  # UINT_PTR* out
): int32 {.importc: "RpcBindingInqOption", stdcall, dynlib: "RPCRT4.dll".}
pragma(lib, "rpcrt4");
extern(Windows)
int RpcBindingInqOption(
    void* hBinding,   // void*
    uint option,   // DWORD
    size_t* pOptionValue   // UINT_PTR* out
);
ccall((:RpcBindingInqOption, "RPCRT4.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Ptr{Csize_t}),
      hBinding, option, pOptionValue)
# hBinding : void* -> Ptr{Cvoid}
# option : DWORD -> UInt32
# pOptionValue : UINT_PTR* out -> Ptr{Csize_t}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcBindingInqOption(
    void* hBinding,
    uint32_t option,
    uintptr_t* pOptionValue);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcBindingInqOption(hBinding, option, pOptionValue)
-- hBinding : void*
-- option : DWORD
-- pOptionValue : UINT_PTR* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcBindingInqOption = lib.func('__stdcall', 'RpcBindingInqOption', 'int32_t', ['void *', 'uint32_t', 'uintptr_t *']);
// RpcBindingInqOption(hBinding, option, pOptionValue)
// hBinding : void* -> 'void *'
// option : DWORD -> 'uint32_t'
// pOptionValue : UINT_PTR* out -> 'uintptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCRT4.dll", {
  RpcBindingInqOption: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RpcBindingInqOption(hBinding, option, pOptionValue)
// hBinding : void* -> "pointer"
// option : DWORD -> "u32"
// pOptionValue : UINT_PTR* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcBindingInqOption(
    void* hBinding,
    uint32_t option,
    size_t* pOptionValue);
C, "RPCRT4.dll");
// $ffi->RpcBindingInqOption(hBinding, option, pOptionValue);
// hBinding : void*
// option : DWORD
// pOptionValue : UINT_PTR* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Rpcrt4 extends StdCallLibrary {
    Rpcrt4 INSTANCE = Native.load("rpcrt4", Rpcrt4.class);
    int RpcBindingInqOption(
        Pointer hBinding,   // void*
        int option,   // DWORD
        LongByReference pOptionValue   // UINT_PTR* out
    );
}
@[Link("rpcrt4")]
lib LibRPCRT4
  fun RpcBindingInqOption = RpcBindingInqOption(
    hBinding : Void*,   # void*
    option : UInt32,   # DWORD
    pOptionValue : LibC::SizeT*   # UINT_PTR* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RpcBindingInqOptionNative = Int32 Function(Pointer<Void>, Uint32, Pointer<UintPtr>);
typedef RpcBindingInqOptionDart = int Function(Pointer<Void>, int, Pointer<UintPtr>);
final RpcBindingInqOption = DynamicLibrary.open('RPCRT4.dll')
    .lookupFunction<RpcBindingInqOptionNative, RpcBindingInqOptionDart>('RpcBindingInqOption');
// hBinding : void* -> Pointer<Void>
// option : DWORD -> Uint32
// pOptionValue : UINT_PTR* out -> Pointer<UintPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RpcBindingInqOption(
  hBinding: Pointer;   // void*
  option: DWORD;   // DWORD
  pOptionValue: Pointer   // UINT_PTR* out
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcBindingInqOption';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcBindingInqOption"
  c_RpcBindingInqOption :: Ptr () -> Word32 -> Ptr CUIntPtr -> IO Int32
-- hBinding : void* -> Ptr ()
-- option : DWORD -> Word32
-- pOptionValue : UINT_PTR* out -> Ptr CUIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rpcbindinginqoption =
  foreign "RpcBindingInqOption"
    ((ptr void) @-> uint32_t @-> (ptr size_t) @-> returning int32_t)
(* hBinding : void* -> (ptr void) *)
(* option : DWORD -> uint32_t *)
(* pOptionValue : UINT_PTR* out -> (ptr size_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)

(cffi:defcfun ("RpcBindingInqOption" rpc-binding-inq-option :convention :stdcall) :int32
  (h-binding :pointer)   ; void*
  (option :uint32)   ; DWORD
  (p-option-value :pointer))   ; UINT_PTR* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcBindingInqOption = Win32::API::More->new('RPCRT4',
    'int RpcBindingInqOption(LPVOID hBinding, DWORD option, LPVOID pOptionValue)');
# my $ret = $RpcBindingInqOption->Call($hBinding, $option, $pOptionValue);
# hBinding : void* -> LPVOID
# option : DWORD -> DWORD
# pOptionValue : UINT_PTR* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型