ホーム › 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 | オブジェクトUUIDを示す文字列(ワイド)。NULL 可。 |
| ProtSeq | LPWSTR | inoptional | プロトコルシーケンスを示す文字列(ワイド)。NULL 可。 |
| NetworkAddr | LPWSTR | inoptional | ネットワークアドレスを示す文字列(ワイド)。NULL 可。 |
| Endpoint | LPWSTR | inoptional | エンドポイントを示す文字列(ワイド)。NULL 可。 |
| Options | LPWSTR | inoptional | ネットワークオプションを示す文字列(ワイド)。NULL 可。 |
| 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 版の利用を推奨。const std = @import("std");
extern "rpcrt4" fn RpcStringBindingComposeW(
ObjUuid: [*c]const u16, // LPWSTR optional
ProtSeq: [*c]const u16, // LPWSTR optional
NetworkAddr: [*c]const u16, // LPWSTR optional
Endpoint: [*c]const u16, // LPWSTR optional
Options: [*c]const u16, // LPWSTR optional
StringBinding: [*c][*c]u16 // LPWSTR* optional, out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc RpcStringBindingComposeW(
ObjUuid: WideCString, # LPWSTR optional
ProtSeq: WideCString, # LPWSTR optional
NetworkAddr: WideCString, # LPWSTR optional
Endpoint: WideCString, # LPWSTR optional
Options: WideCString, # LPWSTR optional
StringBinding: ptr WideCString # LPWSTR* optional, out
): int32 {.importc: "RpcStringBindingComposeW", stdcall, dynlib: "RPCRT4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "rpcrt4");
extern(Windows)
int RpcStringBindingComposeW(
const(wchar)* ObjUuid, // LPWSTR optional
const(wchar)* ProtSeq, // LPWSTR optional
const(wchar)* NetworkAddr, // LPWSTR optional
const(wchar)* Endpoint, // LPWSTR optional
const(wchar)* Options, // LPWSTR optional
wchar** StringBinding // LPWSTR* optional, out
);ccall((:RpcStringBindingComposeW, "RPCRT4.dll"), stdcall, Int32,
(Cwstring, Cwstring, Cwstring, Cwstring, Cwstring, Ptr{Ptr{UInt16}}),
ObjUuid, ProtSeq, NetworkAddr, Endpoint, Options, StringBinding)
# ObjUuid : LPWSTR optional -> Cwstring
# ProtSeq : LPWSTR optional -> Cwstring
# NetworkAddr : LPWSTR optional -> Cwstring
# Endpoint : LPWSTR optional -> Cwstring
# Options : LPWSTR optional -> Cwstring
# StringBinding : LPWSTR* optional, out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcStringBindingComposeW(
const uint16_t* ObjUuid,
const uint16_t* ProtSeq,
const uint16_t* NetworkAddr,
const uint16_t* Endpoint,
const uint16_t* Options,
uint16_t** StringBinding);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcStringBindingComposeW(ObjUuid, ProtSeq, NetworkAddr, Endpoint, Options, StringBinding)
-- ObjUuid : LPWSTR optional
-- ProtSeq : LPWSTR optional
-- NetworkAddr : LPWSTR optional
-- Endpoint : LPWSTR optional
-- Options : LPWSTR optional
-- StringBinding : LPWSTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcStringBindingComposeW = lib.func('__stdcall', 'RpcStringBindingComposeW', 'int32_t', ['str16', 'str16', 'str16', 'str16', 'str16', 'void *']);
// RpcStringBindingComposeW(ObjUuid, ProtSeq, NetworkAddr, Endpoint, Options, StringBinding)
// ObjUuid : LPWSTR optional -> 'str16'
// ProtSeq : LPWSTR optional -> 'str16'
// NetworkAddr : LPWSTR optional -> 'str16'
// Endpoint : LPWSTR optional -> 'str16'
// Options : LPWSTR optional -> 'str16'
// StringBinding : LPWSTR* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
RpcStringBindingComposeW: { parameters: ["buffer", "buffer", "buffer", "buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.RpcStringBindingComposeW(ObjUuid, ProtSeq, NetworkAddr, Endpoint, Options, StringBinding)
// ObjUuid : LPWSTR optional -> "buffer"
// ProtSeq : LPWSTR optional -> "buffer"
// NetworkAddr : LPWSTR optional -> "buffer"
// Endpoint : LPWSTR optional -> "buffer"
// Options : LPWSTR optional -> "buffer"
// StringBinding : LPWSTR* optional, out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcStringBindingComposeW(
const uint16_t* ObjUuid,
const uint16_t* ProtSeq,
const uint16_t* NetworkAddr,
const uint16_t* Endpoint,
const uint16_t* Options,
uint16_t** StringBinding);
C, "RPCRT4.dll");
// $ffi->RpcStringBindingComposeW(ObjUuid, ProtSeq, NetworkAddr, Endpoint, Options, StringBinding);
// ObjUuid : LPWSTR optional
// ProtSeq : LPWSTR optional
// NetworkAddr : LPWSTR optional
// Endpoint : LPWSTR optional
// Options : LPWSTR optional
// StringBinding : LPWSTR* optional, 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, W32APIOptions.UNICODE_OPTIONS);
int RpcStringBindingComposeW(
WString ObjUuid, // LPWSTR optional
WString ProtSeq, // LPWSTR optional
WString NetworkAddr, // LPWSTR optional
WString Endpoint, // LPWSTR optional
WString Options, // LPWSTR optional
PointerByReference StringBinding // LPWSTR* optional, out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("rpcrt4")]
lib LibRPCRT4
fun RpcStringBindingComposeW = RpcStringBindingComposeW(
ObjUuid : UInt16*, # LPWSTR optional
ProtSeq : UInt16*, # LPWSTR optional
NetworkAddr : UInt16*, # LPWSTR optional
Endpoint : UInt16*, # LPWSTR optional
Options : UInt16*, # LPWSTR optional
StringBinding : UInt16** # LPWSTR* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcStringBindingComposeWNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Pointer<Utf16>>);
typedef RpcStringBindingComposeWDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Pointer<Utf16>>);
final RpcStringBindingComposeW = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<RpcStringBindingComposeWNative, RpcStringBindingComposeWDart>('RpcStringBindingComposeW');
// ObjUuid : LPWSTR optional -> Pointer<Utf16>
// ProtSeq : LPWSTR optional -> Pointer<Utf16>
// NetworkAddr : LPWSTR optional -> Pointer<Utf16>
// Endpoint : LPWSTR optional -> Pointer<Utf16>
// Options : LPWSTR optional -> Pointer<Utf16>
// StringBinding : LPWSTR* optional, out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function 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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcStringBindingComposeW"
c_RpcStringBindingComposeW :: CWString -> CWString -> CWString -> CWString -> CWString -> Ptr CWString -> IO Int32
-- ObjUuid : LPWSTR optional -> CWString
-- ProtSeq : LPWSTR optional -> CWString
-- NetworkAddr : LPWSTR optional -> CWString
-- Endpoint : LPWSTR optional -> CWString
-- Options : LPWSTR optional -> CWString
-- StringBinding : LPWSTR* optional, out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcstringbindingcomposew =
foreign "RpcStringBindingComposeW"
((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* ObjUuid : LPWSTR optional -> (ptr uint16_t) *)
(* ProtSeq : LPWSTR optional -> (ptr uint16_t) *)
(* NetworkAddr : LPWSTR optional -> (ptr uint16_t) *)
(* Endpoint : LPWSTR optional -> (ptr uint16_t) *)
(* Options : LPWSTR optional -> (ptr uint16_t) *)
(* StringBinding : LPWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("RpcStringBindingComposeW" rpc-string-binding-compose-w :convention :stdcall) :int32
(obj-uuid (:string :encoding :utf-16le)) ; LPWSTR optional
(prot-seq (:string :encoding :utf-16le)) ; LPWSTR optional
(network-addr (:string :encoding :utf-16le)) ; LPWSTR optional
(endpoint (:string :encoding :utf-16le)) ; LPWSTR optional
(options (:string :encoding :utf-16le)) ; LPWSTR optional
(string-binding :pointer)) ; LPWSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcStringBindingComposeW = Win32::API::More->new('RPCRT4',
'int RpcStringBindingComposeW(LPCWSTR ObjUuid, LPCWSTR ProtSeq, LPCWSTR NetworkAddr, LPCWSTR Endpoint, LPCWSTR Options, LPVOID StringBinding)');
# my $ret = $RpcStringBindingComposeW->Call($ObjUuid, $ProtSeq, $NetworkAddr, $Endpoint, $Options, $StringBinding);
# ObjUuid : LPWSTR optional -> LPCWSTR
# ProtSeq : LPWSTR optional -> LPCWSTR
# NetworkAddr : LPWSTR optional -> LPCWSTR
# Endpoint : LPWSTR optional -> LPCWSTR
# Options : LPWSTR optional -> LPCWSTR
# StringBinding : LPWSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f RpcStringBindingComposeA (ANSI版) — 各要素から文字列バインディングを合成する(ANSI版)。
使用する型