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