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

RpcMgmtInqComTimeout

関数
バインディングの通信タイムアウト値を取得する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcMgmtInqComTimeout(
    void* Binding,
    DWORD* Timeout
);

パラメーター

名前方向
Bindingvoid*in
TimeoutDWORD*out

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcMgmtInqComTimeout = ctypes.windll.rpcrt4.RpcMgmtInqComTimeout
RpcMgmtInqComTimeout.restype = ctypes.c_int
RpcMgmtInqComTimeout.argtypes = [
    ctypes.POINTER(None),  # Binding : void*
    ctypes.POINTER(wintypes.DWORD),  # Timeout : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcMgmtInqComTimeout = rpcrt4.NewProc("RpcMgmtInqComTimeout")
)

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