ホーム › System.Rpc › RpcBindingCopy
RpcBindingCopy
関数RPCバインディングハンドルを複製する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| SourceBinding | void* | in | 複製元のサーバーバインディングハンドル。 |
| DestinationBinding | void** | 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_STATUSfunction 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)。const std = @import("std");
extern "rpcrt4" fn RpcBindingCopy(
SourceBinding: ?*anyopaque, // void*
DestinationBinding: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;proc RpcBindingCopy(
SourceBinding: pointer, # void*
DestinationBinding: pointer # void** out
): int32 {.importc: "RpcBindingCopy", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int RpcBindingCopy(
void* SourceBinding, // void*
void** DestinationBinding // void** out
);ccall((:RpcBindingCopy, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}),
SourceBinding, DestinationBinding)
# SourceBinding : void* -> Ptr{Cvoid}
# DestinationBinding : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcBindingCopy(SourceBinding, DestinationBinding)
-- SourceBinding : void*
-- DestinationBinding : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcBindingCopy = lib.func('__stdcall', 'RpcBindingCopy', 'int32_t', ['void *', 'void *']);
// RpcBindingCopy(SourceBinding, DestinationBinding)
// SourceBinding : void* -> 'void *'
// DestinationBinding : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
RpcBindingCopy: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.RpcBindingCopy(SourceBinding, DestinationBinding)
// SourceBinding : void* -> "pointer"
// DestinationBinding : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding);
C, "RPCRT4.dll");
// $ffi->RpcBindingCopy(SourceBinding, DestinationBinding);
// SourceBinding : void*
// DestinationBinding : void** 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 RpcBindingCopy(
Pointer SourceBinding, // void*
Pointer DestinationBinding // void** out
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun RpcBindingCopy = RpcBindingCopy(
SourceBinding : Void*, # void*
DestinationBinding : Void** # void** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcBindingCopyNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef RpcBindingCopyDart = int Function(Pointer<Void>, Pointer<Void>);
final RpcBindingCopy = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<RpcBindingCopyNative, RpcBindingCopyDart>('RpcBindingCopy');
// SourceBinding : void* -> Pointer<Void>
// DestinationBinding : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RpcBindingCopy(
SourceBinding: Pointer; // void*
DestinationBinding: Pointer // void** out
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcBindingCopy';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcBindingCopy"
c_RpcBindingCopy :: Ptr () -> Ptr () -> IO Int32
-- SourceBinding : void* -> Ptr ()
-- DestinationBinding : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcbindingcopy =
foreign "RpcBindingCopy"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* SourceBinding : void* -> (ptr void) *)
(* DestinationBinding : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("RpcBindingCopy" rpc-binding-copy :convention :stdcall) :int32
(source-binding :pointer) ; void*
(destination-binding :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcBindingCopy = Win32::API::More->new('RPCRT4',
'int RpcBindingCopy(LPVOID SourceBinding, LPVOID DestinationBinding)');
# my $ret = $RpcBindingCopy->Call($SourceBinding, $DestinationBinding);
# SourceBinding : void* -> LPVOID
# DestinationBinding : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型