ホーム › System.Rpc › I_RpcBindingCopy
I_RpcBindingCopy
関数ソースのバインディングハンドルを複製する内部関数。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS I_RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| SourceBinding | void* | inout | 複製元となるバインディングハンドル(内部API)。 |
| DestinationBinding | void** | inout | 複製されたバインディングハンドルを受け取る出力先。 |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS I_RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int I_RpcBindingCopy(
IntPtr SourceBinding, // void* in/out
IntPtr DestinationBinding // void** in/out
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function I_RpcBindingCopy(
SourceBinding As IntPtr, ' void* in/out
DestinationBinding As IntPtr ' void** in/out
) As Integer
End Function' SourceBinding : void* in/out
' DestinationBinding : void** in/out
Declare PtrSafe Function I_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
I_RpcBindingCopy = ctypes.windll.rpcrt4.I_RpcBindingCopy
I_RpcBindingCopy.restype = ctypes.c_int
I_RpcBindingCopy.argtypes = [
ctypes.POINTER(None), # SourceBinding : void* in/out
ctypes.c_void_p, # DestinationBinding : void** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
I_RpcBindingCopy = Fiddle::Function.new(
lib['I_RpcBindingCopy'],
[
Fiddle::TYPE_VOIDP, # SourceBinding : void* in/out
Fiddle::TYPE_VOIDP, # DestinationBinding : void** in/out
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn I_RpcBindingCopy(
SourceBinding: *mut (), // void* in/out
DestinationBinding: *mut *mut () // void** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int I_RpcBindingCopy(IntPtr SourceBinding, IntPtr DestinationBinding);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_I_RpcBindingCopy' -Namespace Win32 -PassThru
# $api::I_RpcBindingCopy(SourceBinding, DestinationBinding)#uselib "RPCRT4.dll"
#func global I_RpcBindingCopy "I_RpcBindingCopy" sptr, sptr
; I_RpcBindingCopy SourceBinding, DestinationBinding ; 戻り値は stat
; SourceBinding : void* in/out -> "sptr"
; DestinationBinding : void** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RPCRT4.dll"
#cfunc global I_RpcBindingCopy "I_RpcBindingCopy" sptr, sptr
; res = I_RpcBindingCopy(SourceBinding, DestinationBinding)
; SourceBinding : void* in/out -> "sptr"
; DestinationBinding : void** in/out -> "sptr"; RPC_STATUS I_RpcBindingCopy(void* SourceBinding, void** DestinationBinding)
#uselib "RPCRT4.dll"
#cfunc global I_RpcBindingCopy "I_RpcBindingCopy" intptr, intptr
; res = I_RpcBindingCopy(SourceBinding, DestinationBinding)
; SourceBinding : void* in/out -> "intptr"
; DestinationBinding : void** in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procI_RpcBindingCopy = rpcrt4.NewProc("I_RpcBindingCopy")
)
// SourceBinding (void* in/out), DestinationBinding (void** in/out)
r1, _, err := procI_RpcBindingCopy.Call(
uintptr(SourceBinding),
uintptr(DestinationBinding),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction I_RpcBindingCopy(
SourceBinding: Pointer; // void* in/out
DestinationBinding: Pointer // void** in/out
): Integer; stdcall;
external 'RPCRT4.dll' name 'I_RpcBindingCopy';result := DllCall("RPCRT4\I_RpcBindingCopy"
, "Ptr", SourceBinding ; void* in/out
, "Ptr", DestinationBinding ; void** in/out
, "Int") ; return: RPC_STATUS●I_RpcBindingCopy(SourceBinding, DestinationBinding) = DLL("RPCRT4.dll", "int I_RpcBindingCopy(void*, void*)")
# 呼び出し: I_RpcBindingCopy(SourceBinding, DestinationBinding)
# SourceBinding : void* in/out -> "void*"
# DestinationBinding : void** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rpcrt4" fn I_RpcBindingCopy(
SourceBinding: ?*anyopaque, // void* in/out
DestinationBinding: ?*anyopaque // void** in/out
) callconv(std.os.windows.WINAPI) i32;proc I_RpcBindingCopy(
SourceBinding: pointer, # void* in/out
DestinationBinding: pointer # void** in/out
): int32 {.importc: "I_RpcBindingCopy", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int I_RpcBindingCopy(
void* SourceBinding, // void* in/out
void** DestinationBinding // void** in/out
);ccall((:I_RpcBindingCopy, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}),
SourceBinding, DestinationBinding)
# SourceBinding : void* in/out -> Ptr{Cvoid}
# DestinationBinding : void** in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t I_RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.I_RpcBindingCopy(SourceBinding, DestinationBinding)
-- SourceBinding : void* in/out
-- DestinationBinding : void** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const I_RpcBindingCopy = lib.func('__stdcall', 'I_RpcBindingCopy', 'int32_t', ['void *', 'void *']);
// I_RpcBindingCopy(SourceBinding, DestinationBinding)
// SourceBinding : void* in/out -> 'void *'
// DestinationBinding : void** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
I_RpcBindingCopy: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.I_RpcBindingCopy(SourceBinding, DestinationBinding)
// SourceBinding : void* in/out -> "pointer"
// DestinationBinding : void** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t I_RpcBindingCopy(
void* SourceBinding,
void** DestinationBinding);
C, "RPCRT4.dll");
// $ffi->I_RpcBindingCopy(SourceBinding, DestinationBinding);
// SourceBinding : void* in/out
// DestinationBinding : void** in/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 I_RpcBindingCopy(
Pointer SourceBinding, // void* in/out
Pointer DestinationBinding // void** in/out
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun I_RpcBindingCopy = I_RpcBindingCopy(
SourceBinding : Void*, # void* in/out
DestinationBinding : Void** # void** in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef I_RpcBindingCopyNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef I_RpcBindingCopyDart = int Function(Pointer<Void>, Pointer<Void>);
final I_RpcBindingCopy = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<I_RpcBindingCopyNative, I_RpcBindingCopyDart>('I_RpcBindingCopy');
// SourceBinding : void* in/out -> Pointer<Void>
// DestinationBinding : void** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function I_RpcBindingCopy(
SourceBinding: Pointer; // void* in/out
DestinationBinding: Pointer // void** in/out
): Integer; stdcall;
external 'RPCRT4.dll' name 'I_RpcBindingCopy';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "I_RpcBindingCopy"
c_I_RpcBindingCopy :: Ptr () -> Ptr () -> IO Int32
-- SourceBinding : void* in/out -> Ptr ()
-- DestinationBinding : void** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let i_rpcbindingcopy =
foreign "I_RpcBindingCopy"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* SourceBinding : void* in/out -> (ptr void) *)
(* DestinationBinding : void** in/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 ("I_RpcBindingCopy" i-rpc-binding-copy :convention :stdcall) :int32
(source-binding :pointer) ; void* in/out
(destination-binding :pointer)) ; void** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $I_RpcBindingCopy = Win32::API::More->new('RPCRT4',
'int I_RpcBindingCopy(LPVOID SourceBinding, LPVOID DestinationBinding)');
# my $ret = $I_RpcBindingCopy->Call($SourceBinding, $DestinationBinding);
# SourceBinding : void* in/out -> LPVOID
# DestinationBinding : void** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型