ホーム › System.Rpc › RpcBindingSetAuthInfoExA
RpcBindingSetAuthInfoExA
関数RPCバインディングハンドルに認証・認可情報とセキュリティQOSを設定する(ANSI版)。
シグネチャ
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcBindingSetAuthInfoExA(
void* Binding,
LPSTR ServerPrincName, // optional
DWORD AuthnLevel,
DWORD AuthnSvc,
void* AuthIdentity, // optional
DWORD AuthzSvc,
RPC_SECURITY_QOS* SecurityQos // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Binding | void* | in | 認証情報を設定する対象のクライアントバインディングハンドル。 |
| ServerPrincName | LPSTR | inoptional | 期待するサーバープリンシパル名(ANSI)。相互認証に使用。NULL可。 |
| AuthnLevel | DWORD | in | 適用する認証レベル(RPC_C_AUTHN_LEVEL_*)を指定する。 |
| AuthnSvc | DWORD | in | 使用する認証サービス(RPC_C_AUTHN_*)を指定する。 |
| AuthIdentity | void* | inoptional | 認証に用いる資格情報構造体へのポインタ。NULLで現在のログオンコンテキスト。 |
| AuthzSvc | DWORD | in | 使用する認可サービス(RPC_C_AUTHZ_*)を指定する。 |
| SecurityQos | RPC_SECURITY_QOS* | inoptional | 認証品質(なりすまし可否や相互認証等)を指定するRPC_SECURITY_QOS構造体へのポインタ。 |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcBindingSetAuthInfoExA(
void* Binding,
LPSTR ServerPrincName, // optional
DWORD AuthnLevel,
DWORD AuthnSvc,
void* AuthIdentity, // optional
DWORD AuthzSvc,
RPC_SECURITY_QOS* SecurityQos // optional
);[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcBindingSetAuthInfoExA(
IntPtr Binding, // void*
[MarshalAs(UnmanagedType.LPStr)] string ServerPrincName, // LPSTR optional
uint AuthnLevel, // DWORD
uint AuthnSvc, // DWORD
IntPtr AuthIdentity, // void* optional
uint AuthzSvc, // DWORD
IntPtr SecurityQos // RPC_SECURITY_QOS* optional
);<DllImport("RPCRT4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcBindingSetAuthInfoExA(
Binding As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> ServerPrincName As String, ' LPSTR optional
AuthnLevel As UInteger, ' DWORD
AuthnSvc As UInteger, ' DWORD
AuthIdentity As IntPtr, ' void* optional
AuthzSvc As UInteger, ' DWORD
SecurityQos As IntPtr ' RPC_SECURITY_QOS* optional
) As Integer
End Function' Binding : void*
' ServerPrincName : LPSTR optional
' AuthnLevel : DWORD
' AuthnSvc : DWORD
' AuthIdentity : void* optional
' AuthzSvc : DWORD
' SecurityQos : RPC_SECURITY_QOS* optional
Declare PtrSafe Function RpcBindingSetAuthInfoExA Lib "rpcrt4" ( _
ByVal Binding As LongPtr, _
ByVal ServerPrincName As String, _
ByVal AuthnLevel As Long, _
ByVal AuthnSvc As Long, _
ByVal AuthIdentity As LongPtr, _
ByVal AuthzSvc As Long, _
ByVal SecurityQos As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcBindingSetAuthInfoExA = ctypes.windll.rpcrt4.RpcBindingSetAuthInfoExA
RpcBindingSetAuthInfoExA.restype = ctypes.c_int
RpcBindingSetAuthInfoExA.argtypes = [
ctypes.POINTER(None), # Binding : void*
wintypes.LPCSTR, # ServerPrincName : LPSTR optional
wintypes.DWORD, # AuthnLevel : DWORD
wintypes.DWORD, # AuthnSvc : DWORD
ctypes.POINTER(None), # AuthIdentity : void* optional
wintypes.DWORD, # AuthzSvc : DWORD
ctypes.c_void_p, # SecurityQos : RPC_SECURITY_QOS* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcBindingSetAuthInfoExA = Fiddle::Function.new(
lib['RpcBindingSetAuthInfoExA'],
[
Fiddle::TYPE_VOIDP, # Binding : void*
Fiddle::TYPE_VOIDP, # ServerPrincName : LPSTR optional
-Fiddle::TYPE_INT, # AuthnLevel : DWORD
-Fiddle::TYPE_INT, # AuthnSvc : DWORD
Fiddle::TYPE_VOIDP, # AuthIdentity : void* optional
-Fiddle::TYPE_INT, # AuthzSvc : DWORD
Fiddle::TYPE_VOIDP, # SecurityQos : RPC_SECURITY_QOS* optional
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcBindingSetAuthInfoExA(
Binding: *mut (), // void*
ServerPrincName: *mut u8, // LPSTR optional
AuthnLevel: u32, // DWORD
AuthnSvc: u32, // DWORD
AuthIdentity: *mut (), // void* optional
AuthzSvc: u32, // DWORD
SecurityQos: *mut RPC_SECURITY_QOS // RPC_SECURITY_QOS* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi)]
public static extern int RpcBindingSetAuthInfoExA(IntPtr Binding, [MarshalAs(UnmanagedType.LPStr)] string ServerPrincName, uint AuthnLevel, uint AuthnSvc, IntPtr AuthIdentity, uint AuthzSvc, IntPtr SecurityQos);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcBindingSetAuthInfoExA' -Namespace Win32 -PassThru
# $api::RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)#uselib "RPCRT4.dll"
#func global RpcBindingSetAuthInfoExA "RpcBindingSetAuthInfoExA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; RpcBindingSetAuthInfoExA Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, varptr(SecurityQos) ; 戻り値は stat
; Binding : void* -> "sptr"
; ServerPrincName : LPSTR optional -> "sptr"
; AuthnLevel : DWORD -> "sptr"
; AuthnSvc : DWORD -> "sptr"
; AuthIdentity : void* optional -> "sptr"
; AuthzSvc : DWORD -> "sptr"
; SecurityQos : RPC_SECURITY_QOS* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcBindingSetAuthInfoExA "RpcBindingSetAuthInfoExA" sptr, str, int, int, sptr, int, var ; res = RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos) ; Binding : void* -> "sptr" ; ServerPrincName : LPSTR optional -> "str" ; AuthnLevel : DWORD -> "int" ; AuthnSvc : DWORD -> "int" ; AuthIdentity : void* optional -> "sptr" ; AuthzSvc : DWORD -> "int" ; SecurityQos : RPC_SECURITY_QOS* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcBindingSetAuthInfoExA "RpcBindingSetAuthInfoExA" sptr, str, int, int, sptr, int, sptr ; res = RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, varptr(SecurityQos)) ; Binding : void* -> "sptr" ; ServerPrincName : LPSTR optional -> "str" ; AuthnLevel : DWORD -> "int" ; AuthnSvc : DWORD -> "int" ; AuthIdentity : void* optional -> "sptr" ; AuthzSvc : DWORD -> "int" ; SecurityQos : RPC_SECURITY_QOS* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcBindingSetAuthInfoExA(void* Binding, LPSTR ServerPrincName, DWORD AuthnLevel, DWORD AuthnSvc, void* AuthIdentity, DWORD AuthzSvc, RPC_SECURITY_QOS* SecurityQos) #uselib "RPCRT4.dll" #cfunc global RpcBindingSetAuthInfoExA "RpcBindingSetAuthInfoExA" intptr, str, int, int, intptr, int, var ; res = RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos) ; Binding : void* -> "intptr" ; ServerPrincName : LPSTR optional -> "str" ; AuthnLevel : DWORD -> "int" ; AuthnSvc : DWORD -> "int" ; AuthIdentity : void* optional -> "intptr" ; AuthzSvc : DWORD -> "int" ; SecurityQos : RPC_SECURITY_QOS* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcBindingSetAuthInfoExA(void* Binding, LPSTR ServerPrincName, DWORD AuthnLevel, DWORD AuthnSvc, void* AuthIdentity, DWORD AuthzSvc, RPC_SECURITY_QOS* SecurityQos) #uselib "RPCRT4.dll" #cfunc global RpcBindingSetAuthInfoExA "RpcBindingSetAuthInfoExA" intptr, str, int, int, intptr, int, intptr ; res = RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, varptr(SecurityQos)) ; Binding : void* -> "intptr" ; ServerPrincName : LPSTR optional -> "str" ; AuthnLevel : DWORD -> "int" ; AuthnSvc : DWORD -> "int" ; AuthIdentity : void* optional -> "intptr" ; AuthzSvc : DWORD -> "int" ; SecurityQos : RPC_SECURITY_QOS* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcBindingSetAuthInfoExA = rpcrt4.NewProc("RpcBindingSetAuthInfoExA")
)
// Binding (void*), ServerPrincName (LPSTR optional), AuthnLevel (DWORD), AuthnSvc (DWORD), AuthIdentity (void* optional), AuthzSvc (DWORD), SecurityQos (RPC_SECURITY_QOS* optional)
r1, _, err := procRpcBindingSetAuthInfoExA.Call(
uintptr(Binding),
uintptr(unsafe.Pointer(windows.BytePtrFromString(ServerPrincName))),
uintptr(AuthnLevel),
uintptr(AuthnSvc),
uintptr(AuthIdentity),
uintptr(AuthzSvc),
uintptr(SecurityQos),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcBindingSetAuthInfoExA(
Binding: Pointer; // void*
ServerPrincName: PAnsiChar; // LPSTR optional
AuthnLevel: DWORD; // DWORD
AuthnSvc: DWORD; // DWORD
AuthIdentity: Pointer; // void* optional
AuthzSvc: DWORD; // DWORD
SecurityQos: Pointer // RPC_SECURITY_QOS* optional
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcBindingSetAuthInfoExA';result := DllCall("RPCRT4\RpcBindingSetAuthInfoExA"
, "Ptr", Binding ; void*
, "AStr", ServerPrincName ; LPSTR optional
, "UInt", AuthnLevel ; DWORD
, "UInt", AuthnSvc ; DWORD
, "Ptr", AuthIdentity ; void* optional
, "UInt", AuthzSvc ; DWORD
, "Ptr", SecurityQos ; RPC_SECURITY_QOS* optional
, "Int") ; return: RPC_STATUS●RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos) = DLL("RPCRT4.dll", "int RpcBindingSetAuthInfoExA(void*, char*, dword, dword, void*, dword, void*)")
# 呼び出し: RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)
# Binding : void* -> "void*"
# ServerPrincName : LPSTR optional -> "char*"
# AuthnLevel : DWORD -> "dword"
# AuthnSvc : DWORD -> "dword"
# AuthIdentity : void* optional -> "void*"
# AuthzSvc : DWORD -> "dword"
# SecurityQos : RPC_SECURITY_QOS* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rpcrt4" fn RpcBindingSetAuthInfoExA(
Binding: ?*anyopaque, // void*
ServerPrincName: [*c]const u8, // LPSTR optional
AuthnLevel: u32, // DWORD
AuthnSvc: u32, // DWORD
AuthIdentity: ?*anyopaque, // void* optional
AuthzSvc: u32, // DWORD
SecurityQos: [*c]RPC_SECURITY_QOS // RPC_SECURITY_QOS* optional
) callconv(std.os.windows.WINAPI) i32;proc RpcBindingSetAuthInfoExA(
Binding: pointer, # void*
ServerPrincName: cstring, # LPSTR optional
AuthnLevel: uint32, # DWORD
AuthnSvc: uint32, # DWORD
AuthIdentity: pointer, # void* optional
AuthzSvc: uint32, # DWORD
SecurityQos: ptr RPC_SECURITY_QOS # RPC_SECURITY_QOS* optional
): int32 {.importc: "RpcBindingSetAuthInfoExA", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int RpcBindingSetAuthInfoExA(
void* Binding, // void*
const(char)* ServerPrincName, // LPSTR optional
uint AuthnLevel, // DWORD
uint AuthnSvc, // DWORD
void* AuthIdentity, // void* optional
uint AuthzSvc, // DWORD
RPC_SECURITY_QOS* SecurityQos // RPC_SECURITY_QOS* optional
);ccall((:RpcBindingSetAuthInfoExA, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cstring, UInt32, UInt32, Ptr{Cvoid}, UInt32, Ptr{RPC_SECURITY_QOS}),
Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)
# Binding : void* -> Ptr{Cvoid}
# ServerPrincName : LPSTR optional -> Cstring
# AuthnLevel : DWORD -> UInt32
# AuthnSvc : DWORD -> UInt32
# AuthIdentity : void* optional -> Ptr{Cvoid}
# AuthzSvc : DWORD -> UInt32
# SecurityQos : RPC_SECURITY_QOS* optional -> Ptr{RPC_SECURITY_QOS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcBindingSetAuthInfoExA(
void* Binding,
const char* ServerPrincName,
uint32_t AuthnLevel,
uint32_t AuthnSvc,
void* AuthIdentity,
uint32_t AuthzSvc,
void* SecurityQos);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)
-- Binding : void*
-- ServerPrincName : LPSTR optional
-- AuthnLevel : DWORD
-- AuthnSvc : DWORD
-- AuthIdentity : void* optional
-- AuthzSvc : DWORD
-- SecurityQos : RPC_SECURITY_QOS* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcBindingSetAuthInfoExA = lib.func('__stdcall', 'RpcBindingSetAuthInfoExA', 'int32_t', ['void *', 'str', 'uint32_t', 'uint32_t', 'void *', 'uint32_t', 'void *']);
// RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)
// Binding : void* -> 'void *'
// ServerPrincName : LPSTR optional -> 'str'
// AuthnLevel : DWORD -> 'uint32_t'
// AuthnSvc : DWORD -> 'uint32_t'
// AuthIdentity : void* optional -> 'void *'
// AuthzSvc : DWORD -> 'uint32_t'
// SecurityQos : RPC_SECURITY_QOS* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
RpcBindingSetAuthInfoExA: { parameters: ["pointer", "buffer", "u32", "u32", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos)
// Binding : void* -> "pointer"
// ServerPrincName : LPSTR optional -> "buffer"
// AuthnLevel : DWORD -> "u32"
// AuthnSvc : DWORD -> "u32"
// AuthIdentity : void* optional -> "pointer"
// AuthzSvc : DWORD -> "u32"
// SecurityQos : RPC_SECURITY_QOS* optional -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcBindingSetAuthInfoExA(
void* Binding,
const char* ServerPrincName,
uint32_t AuthnLevel,
uint32_t AuthnSvc,
void* AuthIdentity,
uint32_t AuthzSvc,
void* SecurityQos);
C, "RPCRT4.dll");
// $ffi->RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQos);
// Binding : void*
// ServerPrincName : LPSTR optional
// AuthnLevel : DWORD
// AuthnSvc : DWORD
// AuthIdentity : void* optional
// AuthzSvc : DWORD
// SecurityQos : RPC_SECURITY_QOS* optional
// 構造体/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 RpcBindingSetAuthInfoExA(
Pointer Binding, // void*
String ServerPrincName, // LPSTR optional
int AuthnLevel, // DWORD
int AuthnSvc, // DWORD
Pointer AuthIdentity, // void* optional
int AuthzSvc, // DWORD
Pointer SecurityQos // RPC_SECURITY_QOS* optional
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun RpcBindingSetAuthInfoExA = RpcBindingSetAuthInfoExA(
Binding : Void*, # void*
ServerPrincName : UInt8*, # LPSTR optional
AuthnLevel : UInt32, # DWORD
AuthnSvc : UInt32, # DWORD
AuthIdentity : Void*, # void* optional
AuthzSvc : UInt32, # DWORD
SecurityQos : RPC_SECURITY_QOS* # RPC_SECURITY_QOS* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcBindingSetAuthInfoExANative = Int32 Function(Pointer<Void>, Pointer<Utf8>, Uint32, Uint32, Pointer<Void>, Uint32, Pointer<Void>);
typedef RpcBindingSetAuthInfoExADart = int Function(Pointer<Void>, Pointer<Utf8>, int, int, Pointer<Void>, int, Pointer<Void>);
final RpcBindingSetAuthInfoExA = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<RpcBindingSetAuthInfoExANative, RpcBindingSetAuthInfoExADart>('RpcBindingSetAuthInfoExA');
// Binding : void* -> Pointer<Void>
// ServerPrincName : LPSTR optional -> Pointer<Utf8>
// AuthnLevel : DWORD -> Uint32
// AuthnSvc : DWORD -> Uint32
// AuthIdentity : void* optional -> Pointer<Void>
// AuthzSvc : DWORD -> Uint32
// SecurityQos : RPC_SECURITY_QOS* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RpcBindingSetAuthInfoExA(
Binding: Pointer; // void*
ServerPrincName: PAnsiChar; // LPSTR optional
AuthnLevel: DWORD; // DWORD
AuthnSvc: DWORD; // DWORD
AuthIdentity: Pointer; // void* optional
AuthzSvc: DWORD; // DWORD
SecurityQos: Pointer // RPC_SECURITY_QOS* optional
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcBindingSetAuthInfoExA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcBindingSetAuthInfoExA"
c_RpcBindingSetAuthInfoExA :: Ptr () -> CString -> Word32 -> Word32 -> Ptr () -> Word32 -> Ptr () -> IO Int32
-- Binding : void* -> Ptr ()
-- ServerPrincName : LPSTR optional -> CString
-- AuthnLevel : DWORD -> Word32
-- AuthnSvc : DWORD -> Word32
-- AuthIdentity : void* optional -> Ptr ()
-- AuthzSvc : DWORD -> Word32
-- SecurityQos : RPC_SECURITY_QOS* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcbindingsetauthinfoexa =
foreign "RpcBindingSetAuthInfoExA"
((ptr void) @-> string @-> uint32_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* Binding : void* -> (ptr void) *)
(* ServerPrincName : LPSTR optional -> string *)
(* AuthnLevel : DWORD -> uint32_t *)
(* AuthnSvc : DWORD -> uint32_t *)
(* AuthIdentity : void* optional -> (ptr void) *)
(* AuthzSvc : DWORD -> uint32_t *)
(* SecurityQos : RPC_SECURITY_QOS* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("RpcBindingSetAuthInfoExA" rpc-binding-set-auth-info-ex-a :convention :stdcall) :int32
(binding :pointer) ; void*
(server-princ-name :string) ; LPSTR optional
(authn-level :uint32) ; DWORD
(authn-svc :uint32) ; DWORD
(auth-identity :pointer) ; void* optional
(authz-svc :uint32) ; DWORD
(security-qos :pointer)) ; RPC_SECURITY_QOS* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcBindingSetAuthInfoExA = Win32::API::More->new('RPCRT4',
'int RpcBindingSetAuthInfoExA(LPVOID Binding, LPCSTR ServerPrincName, DWORD AuthnLevel, DWORD AuthnSvc, LPVOID AuthIdentity, DWORD AuthzSvc, LPVOID SecurityQos)');
# my $ret = $RpcBindingSetAuthInfoExA->Call($Binding, $ServerPrincName, $AuthnLevel, $AuthnSvc, $AuthIdentity, $AuthzSvc, $SecurityQos);
# Binding : void* -> LPVOID
# ServerPrincName : LPSTR optional -> LPCSTR
# AuthnLevel : DWORD -> DWORD
# AuthnSvc : DWORD -> DWORD
# AuthIdentity : void* optional -> LPVOID
# AuthzSvc : DWORD -> DWORD
# SecurityQos : RPC_SECURITY_QOS* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f RpcBindingSetAuthInfoExW (Unicode版) — RPCバインディングハンドルに認証・認可情報とセキュリティQOSを設定する(Unicode版)。
類似 API
- f RpcBindingSetAuthInfoA — バインディングに認証情報を設定する(ANSI版)。