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

RpcBindingCopy

関数
RPCバインディングハンドルを複製する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcBindingCopy(
    void* SourceBinding,
    void** DestinationBinding
);

パラメーター

名前方向
SourceBindingvoid*in
DestinationBindingvoid**out

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcBindingCopy = ctypes.windll.rpcrt4.RpcBindingCopy
RpcBindingCopy.restype = ctypes.c_int
RpcBindingCopy.argtypes = [
    ctypes.POINTER(None),  # SourceBinding : void*
    ctypes.c_void_p,  # DestinationBinding : void** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcBindingCopy = rpcrt4.NewProc("RpcBindingCopy")
)

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