Win32 API 日本語リファレンス
ホームSystem.Rpc › RpcNsBindingExportPnPA

RpcNsBindingExportPnPA

関数
プラグアンドプレイ対応でネームサービスにバインディングをエクスポートする(ANSI版)。
DLLRPCNS4.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNsBindingExportPnPA(
    DWORD EntryNameSyntax,
    LPSTR EntryName,   // optional
    void* IfSpec,   // optional
    UUID_VECTOR* ObjectVector   // optional
);

パラメーター

名前方向
EntryNameSyntaxDWORDin
EntryNameLPSTRinoptional
IfSpecvoid*inoptional
ObjectVectorUUID_VECTOR*inoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNsBindingExportPnPA(
    DWORD EntryNameSyntax,
    LPSTR EntryName,   // optional
    void* IfSpec,   // optional
    UUID_VECTOR* ObjectVector   // optional
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcNsBindingExportPnPA(
    uint EntryNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string EntryName,   // LPSTR optional
    IntPtr IfSpec,   // void* optional
    IntPtr ObjectVector   // UUID_VECTOR* optional
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcNsBindingExportPnPA(
    EntryNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> EntryName As String,   ' LPSTR optional
    IfSpec As IntPtr,   ' void* optional
    ObjectVector As IntPtr   ' UUID_VECTOR* optional
) As Integer
End Function
' EntryNameSyntax : DWORD
' EntryName : LPSTR optional
' IfSpec : void* optional
' ObjectVector : UUID_VECTOR* optional
Declare PtrSafe Function RpcNsBindingExportPnPA Lib "rpcns4" ( _
    ByVal EntryNameSyntax As Long, _
    ByVal EntryName As String, _
    ByVal IfSpec As LongPtr, _
    ByVal ObjectVector As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcNsBindingExportPnPA = ctypes.windll.rpcns4.RpcNsBindingExportPnPA
RpcNsBindingExportPnPA.restype = ctypes.c_int
RpcNsBindingExportPnPA.argtypes = [
    wintypes.DWORD,  # EntryNameSyntax : DWORD
    wintypes.LPCSTR,  # EntryName : LPSTR optional
    ctypes.POINTER(None),  # IfSpec : void* optional
    ctypes.c_void_p,  # ObjectVector : UUID_VECTOR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsBindingExportPnPA = Fiddle::Function.new(
  lib['RpcNsBindingExportPnPA'],
  [
    -Fiddle::TYPE_INT,  # EntryNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # EntryName : LPSTR optional
    Fiddle::TYPE_VOIDP,  # IfSpec : void* optional
    Fiddle::TYPE_VOIDP,  # ObjectVector : UUID_VECTOR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsBindingExportPnPA(
        EntryNameSyntax: u32,  // DWORD
        EntryName: *mut u8,  // LPSTR optional
        IfSpec: *mut (),  // void* optional
        ObjectVector: *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 RpcNsBindingExportPnPA(uint EntryNameSyntax, [MarshalAs(UnmanagedType.LPStr)] string EntryName, IntPtr IfSpec, IntPtr ObjectVector);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsBindingExportPnPA' -Namespace Win32 -PassThru
# $api::RpcNsBindingExportPnPA(EntryNameSyntax, EntryName, IfSpec, ObjectVector)
#uselib "RPCNS4.dll"
#func global RpcNsBindingExportPnPA "RpcNsBindingExportPnPA" sptr, sptr, sptr, sptr
; RpcNsBindingExportPnPA EntryNameSyntax, EntryName, IfSpec, varptr(ObjectVector)   ; 戻り値は stat
; EntryNameSyntax : DWORD -> "sptr"
; EntryName : LPSTR optional -> "sptr"
; IfSpec : void* optional -> "sptr"
; ObjectVector : UUID_VECTOR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingExportPnPA "RpcNsBindingExportPnPA" int, str, sptr, var
; res = RpcNsBindingExportPnPA(EntryNameSyntax, EntryName, IfSpec, ObjectVector)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPSTR optional -> "str"
; IfSpec : void* optional -> "sptr"
; ObjectVector : UUID_VECTOR* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcNsBindingExportPnPA(DWORD EntryNameSyntax, LPSTR EntryName, void* IfSpec, UUID_VECTOR* ObjectVector)
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingExportPnPA "RpcNsBindingExportPnPA" int, str, intptr, var
; res = RpcNsBindingExportPnPA(EntryNameSyntax, EntryName, IfSpec, ObjectVector)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPSTR optional -> "str"
; IfSpec : void* optional -> "intptr"
; ObjectVector : UUID_VECTOR* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsBindingExportPnPA = rpcns4.NewProc("RpcNsBindingExportPnPA")
)

// EntryNameSyntax (DWORD), EntryName (LPSTR optional), IfSpec (void* optional), ObjectVector (UUID_VECTOR* optional)
r1, _, err := procRpcNsBindingExportPnPA.Call(
	uintptr(EntryNameSyntax),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(EntryName))),
	uintptr(IfSpec),
	uintptr(ObjectVector),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsBindingExportPnPA(
  EntryNameSyntax: DWORD;   // DWORD
  EntryName: PAnsiChar;   // LPSTR optional
  IfSpec: Pointer;   // void* optional
  ObjectVector: Pointer   // UUID_VECTOR* optional
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsBindingExportPnPA';
result := DllCall("RPCNS4\RpcNsBindingExportPnPA"
    , "UInt", EntryNameSyntax   ; DWORD
    , "AStr", EntryName   ; LPSTR optional
    , "Ptr", IfSpec   ; void* optional
    , "Ptr", ObjectVector   ; UUID_VECTOR* optional
    , "Int")   ; return: RPC_STATUS
●RpcNsBindingExportPnPA(EntryNameSyntax, EntryName, IfSpec, ObjectVector) = DLL("RPCNS4.dll", "int RpcNsBindingExportPnPA(dword, char*, void*, void*)")
# 呼び出し: RpcNsBindingExportPnPA(EntryNameSyntax, EntryName, IfSpec, ObjectVector)
# EntryNameSyntax : DWORD -> "dword"
# EntryName : LPSTR optional -> "char*"
# IfSpec : void* optional -> "void*"
# ObjectVector : UUID_VECTOR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。