ホーム › System.Rpc › I_RpcServerUseProtseq2A
I_RpcServerUseProtseq2A
関数セキュリティとポリシーを指定してサーバーがプロトコルシーケンスを使用する内部関数(ANSI版)。
シグネチャ
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS I_RpcServerUseProtseq2A(
LPSTR NetworkAddress, // optional
LPSTR Protseq,
DWORD MaxCalls,
void* SecurityDescriptor, // optional
void* Policy
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| NetworkAddress | LPSTR | inoptional | バインドするネットワークアドレス(ANSI)。NULL可(内部API)。 |
| Protseq | LPSTR | in | 使用するプロトコルシーケンス(ANSI)。 |
| MaxCalls | DWORD | in | 同時に処理可能な最大同時呼び出し数のヒント値。 |
| SecurityDescriptor | void* | inoptional | 適用するセキュリティ記述子へのポインタ。NULL可。 |
| Policy | void* | in | エンドポイント割り当て等のポリシー情報へのポインタ。NULL可。 |
戻り値の型: 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_STATUSfunction 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)。const std = @import("std");
extern "rpcrt4" fn I_RpcServerUseProtseq2A(
NetworkAddress: [*c]const u8, // LPSTR optional
Protseq: [*c]const u8, // LPSTR
MaxCalls: u32, // DWORD
SecurityDescriptor: ?*anyopaque, // void* optional
Policy: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;proc I_RpcServerUseProtseq2A(
NetworkAddress: cstring, # LPSTR optional
Protseq: cstring, # LPSTR
MaxCalls: uint32, # DWORD
SecurityDescriptor: pointer, # void* optional
Policy: pointer # void*
): int32 {.importc: "I_RpcServerUseProtseq2A", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int I_RpcServerUseProtseq2A(
const(char)* NetworkAddress, // LPSTR optional
const(char)* Protseq, // LPSTR
uint MaxCalls, // DWORD
void* SecurityDescriptor, // void* optional
void* Policy // void*
);ccall((:I_RpcServerUseProtseq2A, "RPCRT4.dll"), stdcall, Int32,
(Cstring, Cstring, UInt32, Ptr{Cvoid}, Ptr{Cvoid}),
NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
# NetworkAddress : LPSTR optional -> Cstring
# Protseq : LPSTR -> Cstring
# MaxCalls : DWORD -> UInt32
# SecurityDescriptor : void* optional -> Ptr{Cvoid}
# Policy : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t I_RpcServerUseProtseq2A(
const char* NetworkAddress,
const char* Protseq,
uint32_t MaxCalls,
void* SecurityDescriptor,
void* Policy);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
-- NetworkAddress : LPSTR optional
-- Protseq : LPSTR
-- MaxCalls : DWORD
-- SecurityDescriptor : void* optional
-- Policy : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const I_RpcServerUseProtseq2A = lib.func('__stdcall', 'I_RpcServerUseProtseq2A', 'int32_t', ['str', 'str', 'uint32_t', 'void *', 'void *']);
// I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
// NetworkAddress : LPSTR optional -> 'str'
// Protseq : LPSTR -> 'str'
// MaxCalls : DWORD -> 'uint32_t'
// SecurityDescriptor : void* optional -> 'void *'
// Policy : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
I_RpcServerUseProtseq2A: { parameters: ["buffer", "buffer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy)
// NetworkAddress : LPSTR optional -> "buffer"
// Protseq : LPSTR -> "buffer"
// MaxCalls : DWORD -> "u32"
// SecurityDescriptor : void* optional -> "pointer"
// Policy : void* -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t I_RpcServerUseProtseq2A(
const char* NetworkAddress,
const char* Protseq,
uint32_t MaxCalls,
void* SecurityDescriptor,
void* Policy);
C, "RPCRT4.dll");
// $ffi->I_RpcServerUseProtseq2A(NetworkAddress, Protseq, MaxCalls, SecurityDescriptor, Policy);
// NetworkAddress : LPSTR optional
// Protseq : LPSTR
// MaxCalls : DWORD
// SecurityDescriptor : void* optional
// Policy : void*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Rpcrt4 extends StdCallLibrary {
Rpcrt4 INSTANCE = Native.load("rpcrt4", Rpcrt4.class, W32APIOptions.ASCII_OPTIONS);
int I_RpcServerUseProtseq2A(
String NetworkAddress, // LPSTR optional
String Protseq, // LPSTR
int MaxCalls, // DWORD
Pointer SecurityDescriptor, // void* optional
Pointer Policy // void*
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun I_RpcServerUseProtseq2A = I_RpcServerUseProtseq2A(
NetworkAddress : UInt8*, # LPSTR optional
Protseq : UInt8*, # LPSTR
MaxCalls : UInt32, # DWORD
SecurityDescriptor : Void*, # void* optional
Policy : Void* # void*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef I_RpcServerUseProtseq2ANative = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Uint32, Pointer<Void>, Pointer<Void>);
typedef I_RpcServerUseProtseq2ADart = int Function(Pointer<Utf8>, Pointer<Utf8>, int, Pointer<Void>, Pointer<Void>);
final I_RpcServerUseProtseq2A = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<I_RpcServerUseProtseq2ANative, I_RpcServerUseProtseq2ADart>('I_RpcServerUseProtseq2A');
// NetworkAddress : LPSTR optional -> Pointer<Utf8>
// Protseq : LPSTR -> Pointer<Utf8>
// MaxCalls : DWORD -> Uint32
// SecurityDescriptor : void* optional -> Pointer<Void>
// Policy : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "I_RpcServerUseProtseq2A"
c_I_RpcServerUseProtseq2A :: CString -> CString -> Word32 -> Ptr () -> Ptr () -> IO Int32
-- NetworkAddress : LPSTR optional -> CString
-- Protseq : LPSTR -> CString
-- MaxCalls : DWORD -> Word32
-- SecurityDescriptor : void* optional -> Ptr ()
-- Policy : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let i_rpcserveruseprotseq2a =
foreign "I_RpcServerUseProtseq2A"
(string @-> string @-> uint32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* NetworkAddress : LPSTR optional -> string *)
(* Protseq : LPSTR -> string *)
(* MaxCalls : DWORD -> uint32_t *)
(* SecurityDescriptor : void* optional -> (ptr void) *)
(* Policy : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("I_RpcServerUseProtseq2A" i-rpc-server-use-protseq2-a :convention :stdcall) :int32
(network-address :string) ; LPSTR optional
(protseq :string) ; LPSTR
(max-calls :uint32) ; DWORD
(security-descriptor :pointer) ; void* optional
(policy :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $I_RpcServerUseProtseq2A = Win32::API::More->new('RPCRT4',
'int I_RpcServerUseProtseq2A(LPCSTR NetworkAddress, LPCSTR Protseq, DWORD MaxCalls, LPVOID SecurityDescriptor, LPVOID Policy)');
# my $ret = $I_RpcServerUseProtseq2A->Call($NetworkAddress, $Protseq, $MaxCalls, $SecurityDescriptor, $Policy);
# NetworkAddress : LPSTR optional -> LPCSTR
# Protseq : LPSTR -> LPCSTR
# MaxCalls : DWORD -> DWORD
# SecurityDescriptor : void* optional -> LPVOID
# Policy : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f I_RpcServerUseProtseq2W (Unicode版) — セキュリティとポリシーを指定してサーバーがプロトコルシーケンスを使用する内部関数(Unicode版)。
使用する型