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

RpcEpRegisterNoReplaceW

関数
既存の登録を置き換えずにエンドポイントマッパーへRPCエンドポイントを登録する(Unicode版)。
DLLRPCRT4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcEpRegisterNoReplaceW(
    void* IfSpec,
    RPC_BINDING_VECTOR* BindingVector,
    UUID_VECTOR* UuidVector,   // optional
    LPWSTR Annotation   // optional
);

パラメーター

名前方向
IfSpecvoid*in
BindingVectorRPC_BINDING_VECTOR*in
UuidVectorUUID_VECTOR*inoptional
AnnotationLPWSTRinoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcEpRegisterNoReplaceW(
    void* IfSpec,
    RPC_BINDING_VECTOR* BindingVector,
    UUID_VECTOR* UuidVector,   // optional
    LPWSTR Annotation   // optional
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcEpRegisterNoReplaceW(
    IntPtr IfSpec,   // void*
    IntPtr BindingVector,   // RPC_BINDING_VECTOR*
    IntPtr UuidVector,   // UUID_VECTOR* optional
    [MarshalAs(UnmanagedType.LPWStr)] string Annotation   // LPWSTR optional
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcEpRegisterNoReplaceW(
    IfSpec As IntPtr,   ' void*
    BindingVector As IntPtr,   ' RPC_BINDING_VECTOR*
    UuidVector As IntPtr,   ' UUID_VECTOR* optional
    <MarshalAs(UnmanagedType.LPWStr)> Annotation As String   ' LPWSTR optional
) As Integer
End Function
' IfSpec : void*
' BindingVector : RPC_BINDING_VECTOR*
' UuidVector : UUID_VECTOR* optional
' Annotation : LPWSTR optional
Declare PtrSafe Function RpcEpRegisterNoReplaceW Lib "rpcrt4" ( _
    ByVal IfSpec As LongPtr, _
    ByVal BindingVector As LongPtr, _
    ByVal UuidVector As LongPtr, _
    ByVal Annotation 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

RpcEpRegisterNoReplaceW = ctypes.windll.rpcrt4.RpcEpRegisterNoReplaceW
RpcEpRegisterNoReplaceW.restype = ctypes.c_int
RpcEpRegisterNoReplaceW.argtypes = [
    ctypes.POINTER(None),  # IfSpec : void*
    ctypes.c_void_p,  # BindingVector : RPC_BINDING_VECTOR*
    ctypes.c_void_p,  # UuidVector : UUID_VECTOR* optional
    wintypes.LPCWSTR,  # Annotation : LPWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcEpRegisterNoReplaceW = rpcrt4.NewProc("RpcEpRegisterNoReplaceW")
)

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