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

RpcBindingSetAuthInfoExW

関数
RPCバインディングハンドルに認証・認可情報とセキュリティQOSを設定する(Unicode版)。
DLLRPCRT4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCRT4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcBindingSetAuthInfoExW(
    void* Binding,
    LPWSTR ServerPrincName,   // optional
    DWORD AuthnLevel,
    DWORD AuthnSvc,
    void* AuthIdentity,   // optional
    DWORD AuthzSvc,
    RPC_SECURITY_QOS* SecurityQOS   // optional
);

パラメーター

名前方向説明
Bindingvoid*in認証情報を設定する対象のクライアントバインディングハンドル。
ServerPrincNameLPWSTRinoptional期待するサーバープリンシパル名(Unicode)。相互認証に使用。NULL可。
AuthnLevelDWORDin適用する認証レベル(RPC_C_AUTHN_LEVEL_*)を指定する。
AuthnSvcDWORDin使用する認証サービス(RPC_C_AUTHN_*)を指定する。
AuthIdentityvoid*inoptional認証に用いる資格情報構造体へのポインタ。NULLで現在のログオンコンテキスト。
AuthzSvcDWORDin使用する認可サービス(RPC_C_AUTHZ_*)を指定する。
SecurityQOSRPC_SECURITY_QOS*inoptional認証品質を指定するRPC_SECURITY_QOS構造体へのポインタ。

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCRT4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcBindingSetAuthInfoExW(
    void* Binding,
    LPWSTR ServerPrincName,   // optional
    DWORD AuthnLevel,
    DWORD AuthnSvc,
    void* AuthIdentity,   // optional
    DWORD AuthzSvc,
    RPC_SECURITY_QOS* SecurityQOS   // optional
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcBindingSetAuthInfoExW(
    IntPtr Binding,   // void*
    [MarshalAs(UnmanagedType.LPWStr)] string ServerPrincName,   // LPWSTR 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.Unicode, ExactSpelling:=True)>
Public Shared Function RpcBindingSetAuthInfoExW(
    Binding As IntPtr,   ' void*
    <MarshalAs(UnmanagedType.LPWStr)> ServerPrincName As String,   ' LPWSTR 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 : LPWSTR optional
' AuthnLevel : DWORD
' AuthnSvc : DWORD
' AuthIdentity : void* optional
' AuthzSvc : DWORD
' SecurityQOS : RPC_SECURITY_QOS* optional
Declare PtrSafe Function RpcBindingSetAuthInfoExW Lib "rpcrt4" ( _
    ByVal Binding As LongPtr, _
    ByVal ServerPrincName As LongPtr, _
    ByVal AuthnLevel As Long, _
    ByVal AuthnSvc As Long, _
    ByVal AuthIdentity As LongPtr, _
    ByVal AuthzSvc As Long, _
    ByVal SecurityQOS 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

RpcBindingSetAuthInfoExW = ctypes.windll.rpcrt4.RpcBindingSetAuthInfoExW
RpcBindingSetAuthInfoExW.restype = ctypes.c_int
RpcBindingSetAuthInfoExW.argtypes = [
    ctypes.POINTER(None),  # Binding : void*
    wintypes.LPCWSTR,  # ServerPrincName : LPWSTR 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')
RpcBindingSetAuthInfoExW = Fiddle::Function.new(
  lib['RpcBindingSetAuthInfoExW'],
  [
    Fiddle::TYPE_VOIDP,  # Binding : void*
    Fiddle::TYPE_VOIDP,  # ServerPrincName : LPWSTR 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)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcBindingSetAuthInfoExW(
        Binding: *mut (),  // void*
        ServerPrincName: *mut u16,  // LPWSTR 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.Unicode)]
public static extern int RpcBindingSetAuthInfoExW(IntPtr Binding, [MarshalAs(UnmanagedType.LPWStr)] string ServerPrincName, uint AuthnLevel, uint AuthnSvc, IntPtr AuthIdentity, uint AuthzSvc, IntPtr SecurityQOS);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcBindingSetAuthInfoExW' -Namespace Win32 -PassThru
# $api::RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
#uselib "RPCRT4.dll"
#func global RpcBindingSetAuthInfoExW "RpcBindingSetAuthInfoExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; RpcBindingSetAuthInfoExW Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, varptr(SecurityQOS)   ; 戻り値は stat
; Binding : void* -> "wptr"
; ServerPrincName : LPWSTR optional -> "wptr"
; AuthnLevel : DWORD -> "wptr"
; AuthnSvc : DWORD -> "wptr"
; AuthIdentity : void* optional -> "wptr"
; AuthzSvc : DWORD -> "wptr"
; SecurityQOS : RPC_SECURITY_QOS* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global RpcBindingSetAuthInfoExW "RpcBindingSetAuthInfoExW" sptr, wstr, int, int, sptr, int, var
; res = RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
; Binding : void* -> "sptr"
; ServerPrincName : LPWSTR optional -> "wstr"
; AuthnLevel : DWORD -> "int"
; AuthnSvc : DWORD -> "int"
; AuthIdentity : void* optional -> "sptr"
; AuthzSvc : DWORD -> "int"
; SecurityQOS : RPC_SECURITY_QOS* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcBindingSetAuthInfoExW(void* Binding, LPWSTR ServerPrincName, DWORD AuthnLevel, DWORD AuthnSvc, void* AuthIdentity, DWORD AuthzSvc, RPC_SECURITY_QOS* SecurityQOS)
#uselib "RPCRT4.dll"
#cfunc global RpcBindingSetAuthInfoExW "RpcBindingSetAuthInfoExW" intptr, wstr, int, int, intptr, int, var
; res = RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
; Binding : void* -> "intptr"
; ServerPrincName : LPWSTR optional -> "wstr"
; AuthnLevel : DWORD -> "int"
; AuthnSvc : DWORD -> "int"
; AuthIdentity : void* optional -> "intptr"
; AuthzSvc : DWORD -> "int"
; SecurityQOS : RPC_SECURITY_QOS* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcBindingSetAuthInfoExW = rpcrt4.NewProc("RpcBindingSetAuthInfoExW")
)

// Binding (void*), ServerPrincName (LPWSTR optional), AuthnLevel (DWORD), AuthnSvc (DWORD), AuthIdentity (void* optional), AuthzSvc (DWORD), SecurityQOS (RPC_SECURITY_QOS* optional)
r1, _, err := procRpcBindingSetAuthInfoExW.Call(
	uintptr(Binding),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ServerPrincName))),
	uintptr(AuthnLevel),
	uintptr(AuthnSvc),
	uintptr(AuthIdentity),
	uintptr(AuthzSvc),
	uintptr(SecurityQOS),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcBindingSetAuthInfoExW(
  Binding: Pointer;   // void*
  ServerPrincName: PWideChar;   // LPWSTR 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 'RpcBindingSetAuthInfoExW';
result := DllCall("RPCRT4\RpcBindingSetAuthInfoExW"
    , "Ptr", Binding   ; void*
    , "WStr", ServerPrincName   ; LPWSTR optional
    , "UInt", AuthnLevel   ; DWORD
    , "UInt", AuthnSvc   ; DWORD
    , "Ptr", AuthIdentity   ; void* optional
    , "UInt", AuthzSvc   ; DWORD
    , "Ptr", SecurityQOS   ; RPC_SECURITY_QOS* optional
    , "Int")   ; return: RPC_STATUS
●RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS) = DLL("RPCRT4.dll", "int RpcBindingSetAuthInfoExW(void*, char*, dword, dword, void*, dword, void*)")
# 呼び出し: RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
# Binding : void* -> "void*"
# ServerPrincName : LPWSTR 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)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "rpcrt4" fn RpcBindingSetAuthInfoExW(
    Binding: ?*anyopaque, // void*
    ServerPrincName: [*c]const u16, // LPWSTR 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;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RpcBindingSetAuthInfoExW(
    Binding: pointer,  # void*
    ServerPrincName: WideCString,  # LPWSTR 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: "RpcBindingSetAuthInfoExW", stdcall, dynlib: "RPCRT4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "rpcrt4");
extern(Windows)
int RpcBindingSetAuthInfoExW(
    void* Binding,   // void*
    const(wchar)* ServerPrincName,   // LPWSTR optional
    uint AuthnLevel,   // DWORD
    uint AuthnSvc,   // DWORD
    void* AuthIdentity,   // void* optional
    uint AuthzSvc,   // DWORD
    RPC_SECURITY_QOS* SecurityQOS   // RPC_SECURITY_QOS* optional
);
ccall((:RpcBindingSetAuthInfoExW, "RPCRT4.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Cwstring, UInt32, UInt32, Ptr{Cvoid}, UInt32, Ptr{RPC_SECURITY_QOS}),
      Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
# Binding : void* -> Ptr{Cvoid}
# ServerPrincName : LPWSTR optional -> Cwstring
# 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 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcBindingSetAuthInfoExW(
    void* Binding,
    const uint16_t* ServerPrincName,
    uint32_t AuthnLevel,
    uint32_t AuthnSvc,
    void* AuthIdentity,
    uint32_t AuthzSvc,
    void* SecurityQOS);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
-- Binding : void*
-- ServerPrincName : LPWSTR optional
-- AuthnLevel : DWORD
-- AuthnSvc : DWORD
-- AuthIdentity : void* optional
-- AuthzSvc : DWORD
-- SecurityQOS : RPC_SECURITY_QOS* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcBindingSetAuthInfoExW = lib.func('__stdcall', 'RpcBindingSetAuthInfoExW', 'int32_t', ['void *', 'str16', 'uint32_t', 'uint32_t', 'void *', 'uint32_t', 'void *']);
// RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
// Binding : void* -> 'void *'
// ServerPrincName : LPWSTR optional -> 'str16'
// 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", {
  RpcBindingSetAuthInfoExW: { parameters: ["pointer", "buffer", "u32", "u32", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS)
// Binding : void* -> "pointer"
// ServerPrincName : LPWSTR optional -> "buffer"
// AuthnLevel : DWORD -> "u32"
// AuthnSvc : DWORD -> "u32"
// AuthIdentity : void* optional -> "pointer"
// AuthzSvc : DWORD -> "u32"
// SecurityQOS : RPC_SECURITY_QOS* optional -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcBindingSetAuthInfoExW(
    void* Binding,
    const uint16_t* ServerPrincName,
    uint32_t AuthnLevel,
    uint32_t AuthnSvc,
    void* AuthIdentity,
    uint32_t AuthzSvc,
    void* SecurityQOS);
C, "RPCRT4.dll");
// $ffi->RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, SecurityQOS);
// Binding : void*
// ServerPrincName : LPWSTR 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.UNICODE_OPTIONS);
    int RpcBindingSetAuthInfoExW(
        Pointer Binding,   // void*
        WString ServerPrincName,   // LPWSTR optional
        int AuthnLevel,   // DWORD
        int AuthnSvc,   // DWORD
        Pointer AuthIdentity,   // void* optional
        int AuthzSvc,   // DWORD
        Pointer SecurityQOS   // RPC_SECURITY_QOS* optional
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("rpcrt4")]
lib LibRPCRT4
  fun RpcBindingSetAuthInfoExW = RpcBindingSetAuthInfoExW(
    Binding : Void*,   # void*
    ServerPrincName : UInt16*,   # LPWSTR 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 RpcBindingSetAuthInfoExWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Uint32, Uint32, Pointer<Void>, Uint32, Pointer<Void>);
typedef RpcBindingSetAuthInfoExWDart = int Function(Pointer<Void>, Pointer<Utf16>, int, int, Pointer<Void>, int, Pointer<Void>);
final RpcBindingSetAuthInfoExW = DynamicLibrary.open('RPCRT4.dll')
    .lookupFunction<RpcBindingSetAuthInfoExWNative, RpcBindingSetAuthInfoExWDart>('RpcBindingSetAuthInfoExW');
// Binding : void* -> Pointer<Void>
// ServerPrincName : LPWSTR optional -> Pointer<Utf16>
// 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 RpcBindingSetAuthInfoExW(
  Binding: Pointer;   // void*
  ServerPrincName: PWideChar;   // LPWSTR 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 'RpcBindingSetAuthInfoExW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcBindingSetAuthInfoExW"
  c_RpcBindingSetAuthInfoExW :: Ptr () -> CWString -> Word32 -> Word32 -> Ptr () -> Word32 -> Ptr () -> IO Int32
-- Binding : void* -> Ptr ()
-- ServerPrincName : LPWSTR optional -> CWString
-- 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 rpcbindingsetauthinfoexw =
  foreign "RpcBindingSetAuthInfoExW"
    ((ptr void) @-> (ptr uint16_t) @-> uint32_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* Binding : void* -> (ptr void) *)
(* ServerPrincName : LPWSTR optional -> (ptr uint16_t) *)
(* 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 ("RpcBindingSetAuthInfoExW" rpc-binding-set-auth-info-ex-w :convention :stdcall) :int32
  (binding :pointer)   ; void*
  (server-princ-name (:string :encoding :utf-16le))   ; LPWSTR 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 $RpcBindingSetAuthInfoExW = Win32::API::More->new('RPCRT4',
    'int RpcBindingSetAuthInfoExW(LPVOID Binding, LPCWSTR ServerPrincName, DWORD AuthnLevel, DWORD AuthnSvc, LPVOID AuthIdentity, DWORD AuthzSvc, LPVOID SecurityQOS)');
# my $ret = $RpcBindingSetAuthInfoExW->Call($Binding, $ServerPrincName, $AuthnLevel, $AuthnSvc, $AuthIdentity, $AuthzSvc, $SecurityQOS);
# Binding : void* -> LPVOID
# ServerPrincName : LPWSTR optional -> LPCWSTR
# AuthnLevel : DWORD -> DWORD
# AuthnSvc : DWORD -> DWORD
# AuthIdentity : void* optional -> LPVOID
# AuthzSvc : DWORD -> DWORD
# SecurityQOS : RPC_SECURITY_QOS* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
類似 API
使用する型