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

RpcNsBindingLookupBeginA

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

シグネチャ

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

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

パラメーター

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

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcNsBindingLookupBeginA = ctypes.windll.rpcns4.RpcNsBindingLookupBeginA
RpcNsBindingLookupBeginA.restype = ctypes.c_int
RpcNsBindingLookupBeginA.argtypes = [
    wintypes.DWORD,  # EntryNameSyntax : DWORD
    wintypes.LPCSTR,  # EntryName : LPSTR 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')
RpcNsBindingLookupBeginA = Fiddle::Function.new(
  lib['RpcNsBindingLookupBeginA'],
  [
    -Fiddle::TYPE_INT,  # EntryNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # EntryName : LPSTR 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)
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsBindingLookupBeginA(
        EntryNameSyntax: u32,  // DWORD
        EntryName: *mut u8,  // LPSTR 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.Ansi)]
public static extern int RpcNsBindingLookupBeginA(uint EntryNameSyntax, [MarshalAs(UnmanagedType.LPStr)] string EntryName, IntPtr IfSpec, IntPtr ObjUuid, uint BindingMaxCount, IntPtr LookupContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsBindingLookupBeginA' -Namespace Win32 -PassThru
# $api::RpcNsBindingLookupBeginA(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
#uselib "RPCNS4.dll"
#func global RpcNsBindingLookupBeginA "RpcNsBindingLookupBeginA" sptr, sptr, sptr, sptr, sptr, sptr
; RpcNsBindingLookupBeginA EntryNameSyntax, EntryName, IfSpec, varptr(ObjUuid), BindingMaxCount, LookupContext   ; 戻り値は stat
; EntryNameSyntax : DWORD -> "sptr"
; EntryName : LPSTR optional -> "sptr"
; IfSpec : void* optional -> "sptr"
; ObjUuid : GUID* optional -> "sptr"
; BindingMaxCount : DWORD -> "sptr"
; LookupContext : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingLookupBeginA "RpcNsBindingLookupBeginA" int, str, sptr, var, int, sptr
; res = RpcNsBindingLookupBeginA(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPSTR optional -> "str"
; IfSpec : void* optional -> "sptr"
; ObjUuid : GUID* optional -> "var"
; BindingMaxCount : DWORD -> "int"
; LookupContext : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcNsBindingLookupBeginA(DWORD EntryNameSyntax, LPSTR EntryName, void* IfSpec, GUID* ObjUuid, DWORD BindingMaxCount, void** LookupContext)
#uselib "RPCNS4.dll"
#cfunc global RpcNsBindingLookupBeginA "RpcNsBindingLookupBeginA" int, str, intptr, var, int, intptr
; res = RpcNsBindingLookupBeginA(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPSTR optional -> "str"
; 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")
	procRpcNsBindingLookupBeginA = rpcns4.NewProc("RpcNsBindingLookupBeginA")
)

// EntryNameSyntax (DWORD), EntryName (LPSTR optional), IfSpec (void* optional), ObjUuid (GUID* optional), BindingMaxCount (DWORD), LookupContext (void** out)
r1, _, err := procRpcNsBindingLookupBeginA.Call(
	uintptr(EntryNameSyntax),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(EntryName))),
	uintptr(IfSpec),
	uintptr(ObjUuid),
	uintptr(BindingMaxCount),
	uintptr(LookupContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsBindingLookupBeginA(
  EntryNameSyntax: DWORD;   // DWORD
  EntryName: PAnsiChar;   // LPSTR optional
  IfSpec: Pointer;   // void* optional
  ObjUuid: PGUID;   // GUID* optional
  BindingMaxCount: DWORD;   // DWORD
  LookupContext: Pointer   // void** out
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsBindingLookupBeginA';
result := DllCall("RPCNS4\RpcNsBindingLookupBeginA"
    , "UInt", EntryNameSyntax   ; DWORD
    , "AStr", EntryName   ; LPSTR optional
    , "Ptr", IfSpec   ; void* optional
    , "Ptr", ObjUuid   ; GUID* optional
    , "UInt", BindingMaxCount   ; DWORD
    , "Ptr", LookupContext   ; void** out
    , "Int")   ; return: RPC_STATUS
●RpcNsBindingLookupBeginA(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext) = DLL("RPCNS4.dll", "int RpcNsBindingLookupBeginA(dword, char*, void*, void*, dword, void*)")
# 呼び出し: RpcNsBindingLookupBeginA(EntryNameSyntax, EntryName, IfSpec, ObjUuid, BindingMaxCount, LookupContext)
# EntryNameSyntax : DWORD -> "dword"
# EntryName : LPSTR 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)。