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

RpcNsBindingLookupBeginW

関数
ネームサービスからの互換バインディング検索を開始する(Unicode版)。
DLLRPCNS4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCNS4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNsBindingLookupBeginW(
    DWORD EntryNameSyntax,
    LPWSTR EntryName,   // optional
    void* IfSpec,   // optional
    GUID* ObjUuid,   // optional
    DWORD BindingMaxCount,
    void** LookupContext
);

パラメーター

名前方向
EntryNameSyntaxDWORDin
EntryNameLPWSTRinoptional
IfSpecvoid*inoptional
ObjUuidGUID*inoptional
BindingMaxCountDWORDin
LookupContextvoid**out

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCNS4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNsBindingLookupBeginW(
    DWORD EntryNameSyntax,
    LPWSTR EntryName,   // optional
    void* IfSpec,   // optional
    GUID* ObjUuid,   // optional
    DWORD BindingMaxCount,
    void** LookupContext
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsBindingLookupBeginW(
    uint EntryNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string EntryName,   // LPWSTR optional
    IntPtr IfSpec,   // void* optional
    IntPtr ObjUuid,   // GUID* optional
    uint BindingMaxCount,   // DWORD
    IntPtr LookupContext   // void** out
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsBindingLookupBeginW(
    EntryNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> EntryName As String,   ' LPWSTR optional
    IfSpec As IntPtr,   ' void* optional
    ObjUuid As IntPtr,   ' GUID* optional
    BindingMaxCount As UInteger,   ' DWORD
    LookupContext As IntPtr   ' void** out
) As Integer
End Function
' EntryNameSyntax : DWORD
' EntryName : LPWSTR optional
' IfSpec : void* optional
' ObjUuid : GUID* optional
' BindingMaxCount : DWORD
' LookupContext : void** out
Declare PtrSafe Function RpcNsBindingLookupBeginW Lib "rpcns4" ( _
    ByVal EntryNameSyntax As Long, _
    ByVal EntryName As LongPtr, _
    ByVal IfSpec As LongPtr, _
    ByVal ObjUuid As LongPtr, _
    ByVal BindingMaxCount As Long, _
    ByVal LookupContext 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

RpcNsBindingLookupBeginW = ctypes.windll.rpcns4.RpcNsBindingLookupBeginW
RpcNsBindingLookupBeginW.restype = ctypes.c_int
RpcNsBindingLookupBeginW.argtypes = [
    wintypes.DWORD,  # EntryNameSyntax : DWORD
    wintypes.LPCWSTR,  # EntryName : LPWSTR optional
    ctypes.POINTER(None),  # IfSpec : void* optional
    ctypes.c_void_p,  # ObjUuid : GUID* optional
    wintypes.DWORD,  # BindingMaxCount : DWORD
    ctypes.c_void_p,  # LookupContext : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsBindingLookupBeginW = Fiddle::Function.new(
  lib['RpcNsBindingLookupBeginW'],
  [
    -Fiddle::TYPE_INT,  # EntryNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # EntryName : LPWSTR optional
    Fiddle::TYPE_VOIDP,  # IfSpec : void* optional
    Fiddle::TYPE_VOIDP,  # ObjUuid : GUID* optional
    -Fiddle::TYPE_INT,  # BindingMaxCount : DWORD
    Fiddle::TYPE_VOIDP,  # LookupContext : void** out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsBindingLookupBeginW(
        EntryNameSyntax: u32,  // DWORD
        EntryName: *mut u16,  // LPWSTR optional
        IfSpec: *mut (),  // void* optional
        ObjUuid: *mut GUID,  // GUID* optional
        BindingMaxCount: u32,  // DWORD
        LookupContext: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcNsBindingLookupBeginW(uint EntryNameSyntax, [MarshalAs(UnmanagedType.LPWStr)] string EntryName, IntPtr IfSpec, IntPtr ObjUuid, uint BindingMaxCount, IntPtr LookupContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsBindingLookupBeginW' -Namespace Win32 -PassThru
# $api::RpcNsBindingLookupBeginW(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
#uselib "RPCNS4.dll"
#func global RpcNsBindingLookupBeginW "RpcNsBindingLookupBeginW" wptr, wptr, wptr, wptr, wptr, wptr
; RpcNsBindingLookupBeginW EntryNameSyntax, EntryName, IfSpec, varptr(ObjUuid), BindingMaxCount, LookupContext   ; 戻り値は stat
; EntryNameSyntax : DWORD -> "wptr"
; EntryName : LPWSTR optional -> "wptr"
; IfSpec : void* optional -> "wptr"
; ObjUuid : GUID* optional -> "wptr"
; BindingMaxCount : DWORD -> "wptr"
; LookupContext : void** out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingLookupBeginW "RpcNsBindingLookupBeginW" int, wstr, sptr, var, int, sptr
; res = RpcNsBindingLookupBeginW(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPWSTR optional -> "wstr"
; IfSpec : void* optional -> "sptr"
; ObjUuid : GUID* optional -> "var"
; BindingMaxCount : DWORD -> "int"
; LookupContext : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcNsBindingLookupBeginW(DWORD EntryNameSyntax, LPWSTR EntryName, void* IfSpec, GUID* ObjUuid, DWORD BindingMaxCount, void** LookupContext)
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingLookupBeginW "RpcNsBindingLookupBeginW" int, wstr, intptr, var, int, intptr
; res = RpcNsBindingLookupBeginW(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPWSTR optional -> "wstr"
; IfSpec : void* optional -> "intptr"
; ObjUuid : GUID* optional -> "var"
; BindingMaxCount : DWORD -> "int"
; LookupContext : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsBindingLookupBeginW = rpcns4.NewProc("RpcNsBindingLookupBeginW")
)

// EntryNameSyntax (DWORD), EntryName (LPWSTR optional), IfSpec (void* optional), ObjUuid (GUID* optional), BindingMaxCount (DWORD), LookupContext (void** out)
r1, _, err := procRpcNsBindingLookupBeginW.Call(
	uintptr(EntryNameSyntax),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(EntryName))),
	uintptr(IfSpec),
	uintptr(ObjUuid),
	uintptr(BindingMaxCount),
	uintptr(LookupContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsBindingLookupBeginW(
  EntryNameSyntax: DWORD;   // DWORD
  EntryName: PWideChar;   // LPWSTR optional
  IfSpec: Pointer;   // void* optional
  ObjUuid: PGUID;   // GUID* optional
  BindingMaxCount: DWORD;   // DWORD
  LookupContext: Pointer   // void** out
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsBindingLookupBeginW';
result := DllCall("RPCNS4\RpcNsBindingLookupBeginW"
    , "UInt", EntryNameSyntax   ; DWORD
    , "WStr", EntryName   ; LPWSTR optional
    , "Ptr", IfSpec   ; void* optional
    , "Ptr", ObjUuid   ; GUID* optional
    , "UInt", BindingMaxCount   ; DWORD
    , "Ptr", LookupContext   ; void** out
    , "Int")   ; return: RPC_STATUS
●RpcNsBindingLookupBeginW(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext) = DLL("RPCNS4.dll", "int RpcNsBindingLookupBeginW(dword, char*, void*, void*, dword, void*)")
# 呼び出し: RpcNsBindingLookupBeginW(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
# EntryNameSyntax : DWORD -> "dword"
# EntryName : LPWSTR optional -> "char*"
# IfSpec : void* optional -> "void*"
# ObjUuid : GUID* optional -> "void*"
# BindingMaxCount : DWORD -> "dword"
# LookupContext : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。