ホーム › System.Rpc › RpcServerRegisterAuthInfoA
RpcServerRegisterAuthInfoA
関数RPCサーバーに認証サービスとプリンシパル名を登録する(ANSI版)。
シグネチャ
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcServerRegisterAuthInfoA(
LPSTR ServerPrincName, // optional
DWORD AuthnSvc,
RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, // optional
void* Arg // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ServerPrincName | LPSTR | inoptional |
| AuthnSvc | DWORD | in |
| GetKeyFn | RPC_AUTH_KEY_RETRIEVAL_FN | inoptional |
| Arg | void* | inoptional |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcServerRegisterAuthInfoA(
LPSTR ServerPrincName, // optional
DWORD AuthnSvc,
RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, // optional
void* Arg // optional
);[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcServerRegisterAuthInfoA(
[MarshalAs(UnmanagedType.LPStr)] string ServerPrincName, // LPSTR optional
uint AuthnSvc, // DWORD
IntPtr GetKeyFn, // RPC_AUTH_KEY_RETRIEVAL_FN optional
IntPtr Arg // void* optional
);<DllImport("RPCRT4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcServerRegisterAuthInfoA(
<MarshalAs(UnmanagedType.LPStr)> ServerPrincName As String, ' LPSTR optional
AuthnSvc As UInteger, ' DWORD
GetKeyFn As IntPtr, ' RPC_AUTH_KEY_RETRIEVAL_FN optional
Arg As IntPtr ' void* optional
) As Integer
End Function' ServerPrincName : LPSTR optional
' AuthnSvc : DWORD
' GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional
' Arg : void* optional
Declare PtrSafe Function RpcServerRegisterAuthInfoA Lib "rpcrt4" ( _
ByVal ServerPrincName As String, _
ByVal AuthnSvc As Long, _
ByVal GetKeyFn As LongPtr, _
ByVal Arg As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcServerRegisterAuthInfoA = ctypes.windll.rpcrt4.RpcServerRegisterAuthInfoA
RpcServerRegisterAuthInfoA.restype = ctypes.c_int
RpcServerRegisterAuthInfoA.argtypes = [
wintypes.LPCSTR, # ServerPrincName : LPSTR optional
wintypes.DWORD, # AuthnSvc : DWORD
ctypes.c_void_p, # GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional
ctypes.POINTER(None), # Arg : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcServerRegisterAuthInfoA = Fiddle::Function.new(
lib['RpcServerRegisterAuthInfoA'],
[
Fiddle::TYPE_VOIDP, # ServerPrincName : LPSTR optional
-Fiddle::TYPE_INT, # AuthnSvc : DWORD
Fiddle::TYPE_VOIDP, # GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional
Fiddle::TYPE_VOIDP, # Arg : void* optional
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcServerRegisterAuthInfoA(
ServerPrincName: *mut u8, // LPSTR optional
AuthnSvc: u32, // DWORD
GetKeyFn: *const core::ffi::c_void, // RPC_AUTH_KEY_RETRIEVAL_FN optional
Arg: *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 RpcServerRegisterAuthInfoA([MarshalAs(UnmanagedType.LPStr)] string ServerPrincName, uint AuthnSvc, IntPtr GetKeyFn, IntPtr Arg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcServerRegisterAuthInfoA' -Namespace Win32 -PassThru
# $api::RpcServerRegisterAuthInfoA(ServerPrincName, AuthnSvc, GetKeyFn, Arg)#uselib "RPCRT4.dll"
#func global RpcServerRegisterAuthInfoA "RpcServerRegisterAuthInfoA" sptr, sptr, sptr, sptr
; RpcServerRegisterAuthInfoA ServerPrincName, AuthnSvc, GetKeyFn, Arg ; 戻り値は stat
; ServerPrincName : LPSTR optional -> "sptr"
; AuthnSvc : DWORD -> "sptr"
; GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional -> "sptr"
; Arg : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RPCRT4.dll"
#cfunc global RpcServerRegisterAuthInfoA "RpcServerRegisterAuthInfoA" str, int, sptr, sptr
; res = RpcServerRegisterAuthInfoA(ServerPrincName, AuthnSvc, GetKeyFn, Arg)
; ServerPrincName : LPSTR optional -> "str"
; AuthnSvc : DWORD -> "int"
; GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional -> "sptr"
; Arg : void* optional -> "sptr"; RPC_STATUS RpcServerRegisterAuthInfoA(LPSTR ServerPrincName, DWORD AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
#uselib "RPCRT4.dll"
#cfunc global RpcServerRegisterAuthInfoA "RpcServerRegisterAuthInfoA" str, int, intptr, intptr
; res = RpcServerRegisterAuthInfoA(ServerPrincName, AuthnSvc, GetKeyFn, Arg)
; ServerPrincName : LPSTR optional -> "str"
; AuthnSvc : DWORD -> "int"
; GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional -> "intptr"
; Arg : void* optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcServerRegisterAuthInfoA = rpcrt4.NewProc("RpcServerRegisterAuthInfoA")
)
// ServerPrincName (LPSTR optional), AuthnSvc (DWORD), GetKeyFn (RPC_AUTH_KEY_RETRIEVAL_FN optional), Arg (void* optional)
r1, _, err := procRpcServerRegisterAuthInfoA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(ServerPrincName))),
uintptr(AuthnSvc),
uintptr(GetKeyFn),
uintptr(Arg),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcServerRegisterAuthInfoA(
ServerPrincName: PAnsiChar; // LPSTR optional
AuthnSvc: DWORD; // DWORD
GetKeyFn: Pointer; // RPC_AUTH_KEY_RETRIEVAL_FN optional
Arg: Pointer // void* optional
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcServerRegisterAuthInfoA';result := DllCall("RPCRT4\RpcServerRegisterAuthInfoA"
, "AStr", ServerPrincName ; LPSTR optional
, "UInt", AuthnSvc ; DWORD
, "Ptr", GetKeyFn ; RPC_AUTH_KEY_RETRIEVAL_FN optional
, "Ptr", Arg ; void* optional
, "Int") ; return: RPC_STATUS●RpcServerRegisterAuthInfoA(ServerPrincName, AuthnSvc, GetKeyFn, Arg) = DLL("RPCRT4.dll", "int RpcServerRegisterAuthInfoA(char*, dword, void*, void*)")
# 呼び出し: RpcServerRegisterAuthInfoA(ServerPrincName, AuthnSvc, GetKeyFn, Arg)
# ServerPrincName : LPSTR optional -> "char*"
# AuthnSvc : DWORD -> "dword"
# GetKeyFn : RPC_AUTH_KEY_RETRIEVAL_FN optional -> "void*"
# Arg : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。