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

I_RpcServerUseProtseq2A

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

シグネチャ

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

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

パラメーター

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

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS I_RpcServerUseProtseq2A(
    LPSTR NetworkAddress,   // optional
    LPSTR Protseq,
    DWORD MaxCalls,
    void* SecurityDescriptor,   // optional
    void* Policy
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int I_RpcServerUseProtseq2A(
    [MarshalAs(UnmanagedType.LPStr)] string NetworkAddress,   // LPSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string Protseq,   // LPSTR
    uint MaxCalls,   // DWORD
    IntPtr SecurityDescriptor,   // void* optional
    IntPtr Policy   // void*
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function I_RpcServerUseProtseq2A(
    <MarshalAs(UnmanagedType.LPStr)> NetworkAddress As String,   ' LPSTR optional
    <MarshalAs(UnmanagedType.LPStr)> Protseq As String,   ' LPSTR
    MaxCalls As UInteger,   ' DWORD
    SecurityDescriptor As IntPtr,   ' void* optional
    Policy As IntPtr   ' void*
) As Integer
End Function
' NetworkAddress : LPSTR optional
' Protseq : LPSTR
' MaxCalls : DWORD
' SecurityDescriptor : void* optional
' Policy : void*
Declare PtrSafe Function I_RpcServerUseProtseq2A Lib "rpcrt4" ( _
    ByVal NetworkAddress As String, _
    ByVal Protseq As String, _
    ByVal MaxCalls As Long, _
    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_RpcServerUseProtseq2A = ctypes.windll.rpcrt4.I_RpcServerUseProtseq2A
I_RpcServerUseProtseq2A.restype = ctypes.c_int
I_RpcServerUseProtseq2A.argtypes = [
    wintypes.LPCSTR,  # NetworkAddress : LPSTR optional
    wintypes.LPCSTR,  # Protseq : LPSTR
    wintypes.DWORD,  # MaxCalls : DWORD
    ctypes.POINTER(None),  # SecurityDescriptor : void* optional
    ctypes.POINTER(None),  # Policy : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
I_RpcServerUseProtseq2A = Fiddle::Function.new(
  lib['I_RpcServerUseProtseq2A'],
  [
    Fiddle::TYPE_VOIDP,  # NetworkAddress : LPSTR optional
    Fiddle::TYPE_VOIDP,  # Protseq : LPSTR
    -Fiddle::TYPE_INT,  # MaxCalls : DWORD
    Fiddle::TYPE_VOIDP,  # SecurityDescriptor : void* optional
    Fiddle::TYPE_VOIDP,  # Policy : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcrt4")]
extern "system" {
    fn I_RpcServerUseProtseq2A(
        NetworkAddress: *mut u8,  // LPSTR optional
        Protseq: *mut u8,  // LPSTR
        MaxCalls: u32,  // DWORD
        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_RpcServerUseProtseq2A([MarshalAs(UnmanagedType.LPStr)] string NetworkAddress, [MarshalAs(UnmanagedType.LPStr)] string Protseq, uint MaxCalls, IntPtr SecurityDescriptor, IntPtr Policy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_I_RpcServerUseProtseq2A' -Namespace Win32 -PassThru
# $api::I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
#uselib "RPCRT4.dll"
#func global I_RpcServerUseProtseq2A "I_RpcServerUseProtseq2A" sptr, sptr, sptr, sptr, sptr
; I_RpcServerUseProtseq2A NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy   ; 戻り値は stat
; NetworkAddress : LPSTR optional -> "sptr"
; Protseq : LPSTR -> "sptr"
; MaxCalls : DWORD -> "sptr"
; SecurityDescriptor : void* optional -> "sptr"
; Policy : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCRT4.dll"
#cfunc global I_RpcServerUseProtseq2A "I_RpcServerUseProtseq2A" str, str, int, sptr, sptr
; res = I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
; NetworkAddress : LPSTR optional -> "str"
; Protseq : LPSTR -> "str"
; MaxCalls : DWORD -> "int"
; SecurityDescriptor : void* optional -> "sptr"
; Policy : void* -> "sptr"
; RPC_STATUS I_RpcServerUseProtseq2A(LPSTR NetworkAddress, LPSTR Protseq, DWORD MaxCalls, void* SecurityDescriptor, void* Policy)
#uselib "RPCRT4.dll"
#cfunc global I_RpcServerUseProtseq2A "I_RpcServerUseProtseq2A" str, str, int, intptr, intptr
; res = I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
; NetworkAddress : LPSTR optional -> "str"
; Protseq : LPSTR -> "str"
; MaxCalls : DWORD -> "int"
; SecurityDescriptor : void* optional -> "intptr"
; Policy : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procI_RpcServerUseProtseq2A = rpcrt4.NewProc("I_RpcServerUseProtseq2A")
)

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