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

I_RpcServerUseProtseqEp2A

関数
セキュリティとポリシーを指定してサーバーがプロトコルシーケンスとエンドポイントを使用する内部関数(ANSI版)。
DLLRPCRT4.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

RPC_STATUS I_RpcServerUseProtseqEp2A(
    LPSTR NetworkAddress,   // optional
    LPSTR Protseq,
    DWORD MaxCalls,
    LPSTR Endpoint,
    void* SecurityDescriptor,   // optional
    void* Policy
);

パラメーター

名前方向
NetworkAddressLPSTRinoptional
ProtseqLPSTRin
MaxCallsDWORDin
EndpointLPSTRin
SecurityDescriptorvoid*inoptional
Policyvoid*in

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

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

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procI_RpcServerUseProtseqEp2A = rpcrt4.NewProc("I_RpcServerUseProtseqEp2A")
)

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