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