ホーム › System.Rpc › RpcNsBindingExportA
RpcNsBindingExportA
関数ネームサービスにインターフェイスのバインディングをエクスポートする(ANSI版)。
シグネチャ
// RPCNS4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcNsBindingExportA(
DWORD EntryNameSyntax,
LPSTR EntryName, // optional
void* IfSpec, // optional
RPC_BINDING_VECTOR* BindingVec, // optional
UUID_VECTOR* ObjectUuidVec // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| EntryNameSyntax | DWORD | in |
| EntryName | LPSTR | inoptional |
| IfSpec | void* | inoptional |
| BindingVec | RPC_BINDING_VECTOR* | inoptional |
| ObjectUuidVec | UUID_VECTOR* | inoptional |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCNS4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcNsBindingExportA(
DWORD EntryNameSyntax,
LPSTR EntryName, // optional
void* IfSpec, // optional
RPC_BINDING_VECTOR* BindingVec, // optional
UUID_VECTOR* ObjectUuidVec // optional
);[DllImport("RPCNS4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcNsBindingExportA(
uint EntryNameSyntax, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string EntryName, // LPSTR optional
IntPtr IfSpec, // void* optional
IntPtr BindingVec, // RPC_BINDING_VECTOR* optional
IntPtr ObjectUuidVec // UUID_VECTOR* optional
);<DllImport("RPCNS4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcNsBindingExportA(
EntryNameSyntax As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> EntryName As String, ' LPSTR 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 : LPSTR optional
' IfSpec : void* optional
' BindingVec : RPC_BINDING_VECTOR* optional
' ObjectUuidVec : UUID_VECTOR* optional
Declare PtrSafe Function RpcNsBindingExportA Lib "rpcns4" ( _
ByVal EntryNameSyntax As Long, _
ByVal EntryName As String, _
ByVal IfSpec As LongPtr, _
ByVal BindingVec As LongPtr, _
ByVal ObjectUuidVec As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcNsBindingExportA = ctypes.windll.rpcns4.RpcNsBindingExportA
RpcNsBindingExportA.restype = ctypes.c_int
RpcNsBindingExportA.argtypes = [
wintypes.DWORD, # EntryNameSyntax : DWORD
wintypes.LPCSTR, # EntryName : LPSTR 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')
RpcNsBindingExportA = Fiddle::Function.new(
lib['RpcNsBindingExportA'],
[
-Fiddle::TYPE_INT, # EntryNameSyntax : DWORD
Fiddle::TYPE_VOIDP, # EntryName : LPSTR 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)#[link(name = "rpcns4")]
extern "system" {
fn RpcNsBindingExportA(
EntryNameSyntax: u32, // DWORD
EntryName: *mut u8, // LPSTR 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.Ansi)]
public static extern int RpcNsBindingExportA(uint EntryNameSyntax, [MarshalAs(UnmanagedType.LPStr)] string EntryName, IntPtr IfSpec, IntPtr BindingVec, IntPtr ObjectUuidVec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsBindingExportA' -Namespace Win32 -PassThru
# $api::RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, BindingVec, ObjectUuidVec)#uselib "RPCNS4.dll"
#func global RpcNsBindingExportA "RpcNsBindingExportA" sptr, sptr, sptr, sptr, sptr
; RpcNsBindingExportA EntryNameSyntax, EntryName, IfSpec, varptr(BindingVec), varptr(ObjectUuidVec) ; 戻り値は stat
; EntryNameSyntax : DWORD -> "sptr"
; EntryName : LPSTR optional -> "sptr"
; IfSpec : void* optional -> "sptr"
; BindingVec : RPC_BINDING_VECTOR* optional -> "sptr"
; ObjectUuidVec : UUID_VECTOR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCNS4.dll" #cfunc global RpcNsBindingExportA "RpcNsBindingExportA" int, str, sptr, var, var ; res = RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, BindingVec, ObjectUuidVec) ; EntryNameSyntax : DWORD -> "int" ; EntryName : LPSTR optional -> "str" ; IfSpec : void* optional -> "sptr" ; BindingVec : RPC_BINDING_VECTOR* optional -> "var" ; ObjectUuidVec : UUID_VECTOR* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCNS4.dll" #cfunc global RpcNsBindingExportA "RpcNsBindingExportA" int, str, sptr, sptr, sptr ; res = RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, varptr(BindingVec), varptr(ObjectUuidVec)) ; EntryNameSyntax : DWORD -> "int" ; EntryName : LPSTR optional -> "str" ; IfSpec : void* optional -> "sptr" ; BindingVec : RPC_BINDING_VECTOR* optional -> "sptr" ; ObjectUuidVec : UUID_VECTOR* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcNsBindingExportA(DWORD EntryNameSyntax, LPSTR EntryName, void* IfSpec, RPC_BINDING_VECTOR* BindingVec, UUID_VECTOR* ObjectUuidVec) #uselib "RPCNS4.dll" #cfunc global RpcNsBindingExportA "RpcNsBindingExportA" int, str, intptr, var, var ; res = RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, BindingVec, ObjectUuidVec) ; EntryNameSyntax : DWORD -> "int" ; EntryName : LPSTR optional -> "str" ; IfSpec : void* optional -> "intptr" ; BindingVec : RPC_BINDING_VECTOR* optional -> "var" ; ObjectUuidVec : UUID_VECTOR* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcNsBindingExportA(DWORD EntryNameSyntax, LPSTR EntryName, void* IfSpec, RPC_BINDING_VECTOR* BindingVec, UUID_VECTOR* ObjectUuidVec) #uselib "RPCNS4.dll" #cfunc global RpcNsBindingExportA "RpcNsBindingExportA" int, str, intptr, intptr, intptr ; res = RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, varptr(BindingVec), varptr(ObjectUuidVec)) ; EntryNameSyntax : DWORD -> "int" ; EntryName : LPSTR optional -> "str" ; 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")
procRpcNsBindingExportA = rpcns4.NewProc("RpcNsBindingExportA")
)
// EntryNameSyntax (DWORD), EntryName (LPSTR optional), IfSpec (void* optional), BindingVec (RPC_BINDING_VECTOR* optional), ObjectUuidVec (UUID_VECTOR* optional)
r1, _, err := procRpcNsBindingExportA.Call(
uintptr(EntryNameSyntax),
uintptr(unsafe.Pointer(windows.BytePtrFromString(EntryName))),
uintptr(IfSpec),
uintptr(BindingVec),
uintptr(ObjectUuidVec),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcNsBindingExportA(
EntryNameSyntax: DWORD; // DWORD
EntryName: PAnsiChar; // LPSTR optional
IfSpec: Pointer; // void* optional
BindingVec: Pointer; // RPC_BINDING_VECTOR* optional
ObjectUuidVec: Pointer // UUID_VECTOR* optional
): Integer; stdcall;
external 'RPCNS4.dll' name 'RpcNsBindingExportA';result := DllCall("RPCNS4\RpcNsBindingExportA"
, "UInt", EntryNameSyntax ; DWORD
, "AStr", EntryName ; LPSTR optional
, "Ptr", IfSpec ; void* optional
, "Ptr", BindingVec ; RPC_BINDING_VECTOR* optional
, "Ptr", ObjectUuidVec ; UUID_VECTOR* optional
, "Int") ; return: RPC_STATUS●RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, BindingVec, ObjectUuidVec) = DLL("RPCNS4.dll", "int RpcNsBindingExportA(dword, char*, void*, void*, void*)")
# 呼び出し: RpcNsBindingExportA(EntryNameSyntax, EntryName, IfSpec, BindingVec, ObjectUuidVec)
# EntryNameSyntax : DWORD -> "dword"
# EntryName : LPSTR 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)。