ホーム › System.Rpc › RpcBindingCreateW
RpcBindingCreateW
関数テンプレートからバインディングを作成する(Unicode版)。
シグネチャ
// RPCRT4.dll (Unicode / -W)
#include <windows.h>
RPC_STATUS RpcBindingCreateW(
RPC_BINDING_HANDLE_TEMPLATE_V1_W* Template,
RPC_BINDING_HANDLE_SECURITY_V1_W* Security, // optional
RPC_BINDING_HANDLE_OPTIONS_V1* Options, // optional
void** Binding
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Template | RPC_BINDING_HANDLE_TEMPLATE_V1_W* | in |
| Security | RPC_BINDING_HANDLE_SECURITY_V1_W* | inoptional |
| Options | RPC_BINDING_HANDLE_OPTIONS_V1* | inoptional |
| Binding | void** | out |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll (Unicode / -W)
#include <windows.h>
RPC_STATUS RpcBindingCreateW(
RPC_BINDING_HANDLE_TEMPLATE_V1_W* Template,
RPC_BINDING_HANDLE_SECURITY_V1_W* Security, // optional
RPC_BINDING_HANDLE_OPTIONS_V1* Options, // optional
void** Binding
);[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcBindingCreateW(
IntPtr Template, // RPC_BINDING_HANDLE_TEMPLATE_V1_W*
IntPtr Security, // RPC_BINDING_HANDLE_SECURITY_V1_W* optional
IntPtr Options, // RPC_BINDING_HANDLE_OPTIONS_V1* optional
IntPtr Binding // void** out
);<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcBindingCreateW(
Template As IntPtr, ' RPC_BINDING_HANDLE_TEMPLATE_V1_W*
Security As IntPtr, ' RPC_BINDING_HANDLE_SECURITY_V1_W* optional
Options As IntPtr, ' RPC_BINDING_HANDLE_OPTIONS_V1* optional
Binding As IntPtr ' void** out
) As Integer
End Function' Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W*
' Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional
' Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional
' Binding : void** out
Declare PtrSafe Function RpcBindingCreateW Lib "rpcrt4" ( _
ByVal Template As LongPtr, _
ByVal Security As LongPtr, _
ByVal Options As LongPtr, _
ByVal Binding As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcBindingCreateW = ctypes.windll.rpcrt4.RpcBindingCreateW
RpcBindingCreateW.restype = ctypes.c_int
RpcBindingCreateW.argtypes = [
ctypes.c_void_p, # Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W*
ctypes.c_void_p, # Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional
ctypes.c_void_p, # Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional
ctypes.c_void_p, # Binding : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcBindingCreateW = Fiddle::Function.new(
lib['RpcBindingCreateW'],
[
Fiddle::TYPE_VOIDP, # Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W*
Fiddle::TYPE_VOIDP, # Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional
Fiddle::TYPE_VOIDP, # Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional
Fiddle::TYPE_VOIDP, # Binding : void** out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "rpcrt4")]
extern "system" {
fn RpcBindingCreateW(
Template: *mut RPC_BINDING_HANDLE_TEMPLATE_V1_W, // RPC_BINDING_HANDLE_TEMPLATE_V1_W*
Security: *mut RPC_BINDING_HANDLE_SECURITY_V1_W, // RPC_BINDING_HANDLE_SECURITY_V1_W* optional
Options: *mut RPC_BINDING_HANDLE_OPTIONS_V1, // RPC_BINDING_HANDLE_OPTIONS_V1* optional
Binding: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcBindingCreateW(IntPtr Template, IntPtr Security, IntPtr Options, IntPtr Binding);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcBindingCreateW' -Namespace Win32 -PassThru
# $api::RpcBindingCreateW(Template, Security, Options, Binding)#uselib "RPCRT4.dll"
#func global RpcBindingCreateW "RpcBindingCreateW" wptr, wptr, wptr, wptr
; RpcBindingCreateW varptr(Template), varptr(Security), varptr(Options), Binding ; 戻り値は stat
; Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "wptr"
; Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "wptr"
; Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "wptr"
; Binding : void** out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcBindingCreateW "RpcBindingCreateW" var, var, var, sptr ; res = RpcBindingCreateW(Template, Security, Options, Binding) ; Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "var" ; Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "var" ; Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "var" ; Binding : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcBindingCreateW "RpcBindingCreateW" sptr, sptr, sptr, sptr ; res = RpcBindingCreateW(varptr(Template), varptr(Security), varptr(Options), Binding) ; Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "sptr" ; Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "sptr" ; Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "sptr" ; Binding : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcBindingCreateW(RPC_BINDING_HANDLE_TEMPLATE_V1_W* Template, RPC_BINDING_HANDLE_SECURITY_V1_W* Security, RPC_BINDING_HANDLE_OPTIONS_V1* Options, void** Binding) #uselib "RPCRT4.dll" #cfunc global RpcBindingCreateW "RpcBindingCreateW" var, var, var, intptr ; res = RpcBindingCreateW(Template, Security, Options, Binding) ; Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "var" ; Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "var" ; Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "var" ; Binding : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcBindingCreateW(RPC_BINDING_HANDLE_TEMPLATE_V1_W* Template, RPC_BINDING_HANDLE_SECURITY_V1_W* Security, RPC_BINDING_HANDLE_OPTIONS_V1* Options, void** Binding) #uselib "RPCRT4.dll" #cfunc global RpcBindingCreateW "RpcBindingCreateW" intptr, intptr, intptr, intptr ; res = RpcBindingCreateW(varptr(Template), varptr(Security), varptr(Options), Binding) ; Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "intptr" ; Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "intptr" ; Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "intptr" ; Binding : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcBindingCreateW = rpcrt4.NewProc("RpcBindingCreateW")
)
// Template (RPC_BINDING_HANDLE_TEMPLATE_V1_W*), Security (RPC_BINDING_HANDLE_SECURITY_V1_W* optional), Options (RPC_BINDING_HANDLE_OPTIONS_V1* optional), Binding (void** out)
r1, _, err := procRpcBindingCreateW.Call(
uintptr(Template),
uintptr(Security),
uintptr(Options),
uintptr(Binding),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcBindingCreateW(
Template: Pointer; // RPC_BINDING_HANDLE_TEMPLATE_V1_W*
Security: Pointer; // RPC_BINDING_HANDLE_SECURITY_V1_W* optional
Options: Pointer; // RPC_BINDING_HANDLE_OPTIONS_V1* optional
Binding: Pointer // void** out
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcBindingCreateW';result := DllCall("RPCRT4\RpcBindingCreateW"
, "Ptr", Template ; RPC_BINDING_HANDLE_TEMPLATE_V1_W*
, "Ptr", Security ; RPC_BINDING_HANDLE_SECURITY_V1_W* optional
, "Ptr", Options ; RPC_BINDING_HANDLE_OPTIONS_V1* optional
, "Ptr", Binding ; void** out
, "Int") ; return: RPC_STATUS●RpcBindingCreateW(Template, Security, Options, Binding) = DLL("RPCRT4.dll", "int RpcBindingCreateW(void*, void*, void*, void*)")
# 呼び出し: RpcBindingCreateW(Template, Security, Options, Binding)
# Template : RPC_BINDING_HANDLE_TEMPLATE_V1_W* -> "void*"
# Security : RPC_BINDING_HANDLE_SECURITY_V1_W* optional -> "void*"
# Options : RPC_BINDING_HANDLE_OPTIONS_V1* optional -> "void*"
# Binding : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。