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

RpcServerUseProtseqEpW

関数
エンドポイント指定でプロトコルシーケンスを登録する(Unicode版)。
DLLRPCRT4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcServerUseProtseqEpW(
    LPWSTR Protseq,
    DWORD MaxCalls,
    LPWSTR Endpoint,
    void* SecurityDescriptor   // optional
);

パラメーター

名前方向
ProtseqLPWSTRin
MaxCallsDWORDin
EndpointLPWSTRin
SecurityDescriptorvoid*inoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcServerUseProtseqEpW(
    LPWSTR Protseq,
    DWORD MaxCalls,
    LPWSTR Endpoint,
    void* SecurityDescriptor   // optional
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcServerUseProtseqEpW(
    [MarshalAs(UnmanagedType.LPWStr)] string Protseq,   // LPWSTR
    uint MaxCalls,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string Endpoint,   // LPWSTR
    IntPtr SecurityDescriptor   // void* optional
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcServerUseProtseqEpW(
    <MarshalAs(UnmanagedType.LPWStr)> Protseq As String,   ' LPWSTR
    MaxCalls As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> Endpoint As String,   ' LPWSTR
    SecurityDescriptor As IntPtr   ' void* optional
) As Integer
End Function
' Protseq : LPWSTR
' MaxCalls : DWORD
' Endpoint : LPWSTR
' SecurityDescriptor : void* optional
Declare PtrSafe Function RpcServerUseProtseqEpW Lib "rpcrt4" ( _
    ByVal Protseq As LongPtr, _
    ByVal MaxCalls As Long, _
    ByVal Endpoint As LongPtr, _
    ByVal SecurityDescriptor 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

RpcServerUseProtseqEpW = ctypes.windll.rpcrt4.RpcServerUseProtseqEpW
RpcServerUseProtseqEpW.restype = ctypes.c_int
RpcServerUseProtseqEpW.argtypes = [
    wintypes.LPCWSTR,  # Protseq : LPWSTR
    wintypes.DWORD,  # MaxCalls : DWORD
    wintypes.LPCWSTR,  # Endpoint : LPWSTR
    ctypes.POINTER(None),  # SecurityDescriptor : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcServerUseProtseqEpW = Fiddle::Function.new(
  lib['RpcServerUseProtseqEpW'],
  [
    Fiddle::TYPE_VOIDP,  # Protseq : LPWSTR
    -Fiddle::TYPE_INT,  # MaxCalls : DWORD
    Fiddle::TYPE_VOIDP,  # Endpoint : LPWSTR
    Fiddle::TYPE_VOIDP,  # SecurityDescriptor : void* optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcServerUseProtseqEpW(
        Protseq: *mut u16,  // LPWSTR
        MaxCalls: u32,  // DWORD
        Endpoint: *mut u16,  // LPWSTR
        SecurityDescriptor: *mut ()  // void* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcServerUseProtseqEpW([MarshalAs(UnmanagedType.LPWStr)] string Protseq, uint MaxCalls, [MarshalAs(UnmanagedType.LPWStr)] string Endpoint, IntPtr SecurityDescriptor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcServerUseProtseqEpW' -Namespace Win32 -PassThru
# $api::RpcServerUseProtseqEpW(Protseq, MaxCalls, Endpoint, SecurityDescriptor)
#uselib "RPCRT4.dll"
#func global RpcServerUseProtseqEpW "RpcServerUseProtseqEpW" wptr, wptr, wptr, wptr
; RpcServerUseProtseqEpW Protseq, MaxCalls, Endpoint, SecurityDescriptor   ; 戻り値は stat
; Protseq : LPWSTR -> "wptr"
; MaxCalls : DWORD -> "wptr"
; Endpoint : LPWSTR -> "wptr"
; SecurityDescriptor : void* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCRT4.dll"
#cfunc global RpcServerUseProtseqEpW "RpcServerUseProtseqEpW" wstr, int, wstr, sptr
; res = RpcServerUseProtseqEpW(Protseq, MaxCalls, Endpoint, SecurityDescriptor)
; Protseq : LPWSTR -> "wstr"
; MaxCalls : DWORD -> "int"
; Endpoint : LPWSTR -> "wstr"
; SecurityDescriptor : void* optional -> "sptr"
; RPC_STATUS RpcServerUseProtseqEpW(LPWSTR Protseq, DWORD MaxCalls, LPWSTR Endpoint, void* SecurityDescriptor)
#uselib "RPCRT4.dll"
#cfunc global RpcServerUseProtseqEpW "RpcServerUseProtseqEpW" wstr, int, wstr, intptr
; res = RpcServerUseProtseqEpW(Protseq, MaxCalls, Endpoint, SecurityDescriptor)
; Protseq : LPWSTR -> "wstr"
; MaxCalls : DWORD -> "int"
; Endpoint : LPWSTR -> "wstr"
; SecurityDescriptor : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcServerUseProtseqEpW = rpcrt4.NewProc("RpcServerUseProtseqEpW")
)

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