ホーム › System.Rpc › I_RpcServerUseProtseq2W
I_RpcServerUseProtseq2W
関数セキュリティとポリシーを指定してサーバーがプロトコルシーケンスを使用する内部関数(Unicode版)。
シグネチャ
// RPCRT4.dll (Unicode / -W)
#include <windows.h>
RPC_STATUS I_RpcServerUseProtseq2W(
LPWSTR NetworkAddress, // optional
LPWSTR Protseq,
DWORD MaxCalls,
void* SecurityDescriptor, // optional
void* Policy
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| NetworkAddress | LPWSTR | inoptional |
| Protseq | LPWSTR | in |
| MaxCalls | DWORD | in |
| SecurityDescriptor | void* | inoptional |
| Policy | void* | in |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll (Unicode / -W)
#include <windows.h>
RPC_STATUS I_RpcServerUseProtseq2W(
LPWSTR NetworkAddress, // optional
LPWSTR Protseq,
DWORD MaxCalls,
void* SecurityDescriptor, // optional
void* Policy
);[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int I_RpcServerUseProtseq2W(
[MarshalAs(UnmanagedType.LPWStr)] string NetworkAddress, // LPWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string Protseq, // LPWSTR
uint MaxCalls, // DWORD
IntPtr SecurityDescriptor, // void* optional
IntPtr Policy // void*
);<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function I_RpcServerUseProtseq2W(
<MarshalAs(UnmanagedType.LPWStr)> NetworkAddress As String, ' LPWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> Protseq As String, ' LPWSTR
MaxCalls As UInteger, ' DWORD
SecurityDescriptor As IntPtr, ' void* optional
Policy As IntPtr ' void*
) As Integer
End Function' NetworkAddress : LPWSTR optional
' Protseq : LPWSTR
' MaxCalls : DWORD
' SecurityDescriptor : void* optional
' Policy : void*
Declare PtrSafe Function I_RpcServerUseProtseq2W Lib "rpcrt4" ( _
ByVal NetworkAddress As LongPtr, _
ByVal Protseq As LongPtr, _
ByVal MaxCalls As Long, _
ByVal SecurityDescriptor As LongPtr, _
ByVal Policy 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
I_RpcServerUseProtseq2W = ctypes.windll.rpcrt4.I_RpcServerUseProtseq2W
I_RpcServerUseProtseq2W.restype = ctypes.c_int
I_RpcServerUseProtseq2W.argtypes = [
wintypes.LPCWSTR, # NetworkAddress : LPWSTR optional
wintypes.LPCWSTR, # Protseq : LPWSTR
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_RpcServerUseProtseq2W = Fiddle::Function.new(
lib['I_RpcServerUseProtseq2W'],
[
Fiddle::TYPE_VOIDP, # NetworkAddress : LPWSTR optional
Fiddle::TYPE_VOIDP, # Protseq : LPWSTR
-Fiddle::TYPE_INT, # MaxCalls : DWORD
Fiddle::TYPE_VOIDP, # SecurityDescriptor : void* optional
Fiddle::TYPE_VOIDP, # Policy : void*
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "rpcrt4")]
extern "system" {
fn I_RpcServerUseProtseq2W(
NetworkAddress: *mut u16, // LPWSTR optional
Protseq: *mut u16, // LPWSTR
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.Unicode)]
public static extern int I_RpcServerUseProtseq2W([MarshalAs(UnmanagedType.LPWStr)] string NetworkAddress, [MarshalAs(UnmanagedType.LPWStr)] string Protseq, uint MaxCalls, IntPtr SecurityDescriptor, IntPtr Policy);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_I_RpcServerUseProtseq2W' -Namespace Win32 -PassThru
# $api::I_RpcServerUseProtseq2W(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)#uselib "RPCRT4.dll"
#func global I_RpcServerUseProtseq2W "I_RpcServerUseProtseq2W" wptr, wptr, wptr, wptr, wptr
; I_RpcServerUseProtseq2W NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy ; 戻り値は stat
; NetworkAddress : LPWSTR optional -> "wptr"
; Protseq : LPWSTR -> "wptr"
; MaxCalls : DWORD -> "wptr"
; SecurityDescriptor : void* optional -> "wptr"
; Policy : void* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RPCRT4.dll"
#cfunc global I_RpcServerUseProtseq2W "I_RpcServerUseProtseq2W" wstr, wstr, int, sptr, sptr
; res = I_RpcServerUseProtseq2W(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
; NetworkAddress : LPWSTR optional -> "wstr"
; Protseq : LPWSTR -> "wstr"
; MaxCalls : DWORD -> "int"
; SecurityDescriptor : void* optional -> "sptr"
; Policy : void* -> "sptr"; RPC_STATUS I_RpcServerUseProtseq2W(LPWSTR NetworkAddress, LPWSTR Protseq, DWORD MaxCalls, void* SecurityDescriptor, void* Policy)
#uselib "RPCRT4.dll"
#cfunc global I_RpcServerUseProtseq2W "I_RpcServerUseProtseq2W" wstr, wstr, int, intptr, intptr
; res = I_RpcServerUseProtseq2W(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
; NetworkAddress : LPWSTR optional -> "wstr"
; Protseq : LPWSTR -> "wstr"
; MaxCalls : DWORD -> "int"
; SecurityDescriptor : void* optional -> "intptr"
; Policy : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procI_RpcServerUseProtseq2W = rpcrt4.NewProc("I_RpcServerUseProtseq2W")
)
// NetworkAddress (LPWSTR optional), Protseq (LPWSTR), MaxCalls (DWORD), SecurityDescriptor (void* optional), Policy (void*)
r1, _, err := procI_RpcServerUseProtseq2W.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(NetworkAddress))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Protseq))),
uintptr(MaxCalls),
uintptr(SecurityDescriptor),
uintptr(Policy),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction I_RpcServerUseProtseq2W(
NetworkAddress: PWideChar; // LPWSTR optional
Protseq: PWideChar; // LPWSTR
MaxCalls: DWORD; // DWORD
SecurityDescriptor: Pointer; // void* optional
Policy: Pointer // void*
): Integer; stdcall;
external 'RPCRT4.dll' name 'I_RpcServerUseProtseq2W';result := DllCall("RPCRT4\I_RpcServerUseProtseq2W"
, "WStr", NetworkAddress ; LPWSTR optional
, "WStr", Protseq ; LPWSTR
, "UInt", MaxCalls ; DWORD
, "Ptr", SecurityDescriptor ; void* optional
, "Ptr", Policy ; void*
, "Int") ; return: RPC_STATUS●I_RpcServerUseProtseq2W(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy) = DLL("RPCRT4.dll", "int I_RpcServerUseProtseq2W(char*, char*, dword, void*, void*)")
# 呼び出し: I_RpcServerUseProtseq2W(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
# NetworkAddress : LPWSTR optional -> "char*"
# Protseq : LPWSTR -> "char*"
# MaxCalls : DWORD -> "dword"
# SecurityDescriptor : void* optional -> "void*"
# Policy : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。