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

RpcServerUseProtseqEpA

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

シグネチャ

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

RPC_STATUS RpcServerUseProtseqEpA(
    LPSTR Protseq,
    DWORD MaxCalls,
    LPSTR Endpoint,
    void* SecurityDescriptor   // optional
);

パラメーター

名前方向
ProtseqLPSTRin
MaxCallsDWORDin
EndpointLPSTRin
SecurityDescriptorvoid*inoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

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

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcServerUseProtseqEpA = rpcrt4.NewProc("RpcServerUseProtseqEpA")
)

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