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

RpcBindingInqAuthClientW

関数
クライアント呼び出しの認証情報を取得する(Unicode版)。
DLLRPCRT4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcBindingInqAuthClientW(
    void* ClientBinding,   // optional
    void** Privs,
    LPWSTR* ServerPrincName,   // optional
    DWORD* AuthnLevel,   // optional
    DWORD* AuthnSvc,   // optional
    DWORD* AuthzSvc   // optional
);

パラメーター

名前方向説明
ClientBindingvoid*inoptionalリモート プロシージャ コールを行ったクライアントのクライアント バインディング ハンドル。この値は 0 でもかまいません。「解説」を参照してください。
Privsvoid**out

ClientBinding バインディング ハンドルでリモート プロシージャ コールを行ったクライアント アプリケーションの特権情報へのハンドルを指すポインターを返します。ncalrpc の呼び出しの場合、Privs にはクライアントのプリンシパル名を含む文字列が格納されます。

このパラメーターが参照するデータは読み取り専用であり、サーバー アプリケーションが変更してはいけません。返されたデータを保持したい場合、サーバーはそのデータをサーバー側で割り当てたメモリにコピーする必要があります。

Privs パラメーターが指すデータは SSP から直接提供されます。そのため、データの形式は SSP に固有です。SSP の詳細については、 Security Support Providers (SSPs) を参照してください。

ServerPrincNameLPWSTR*outoptional

RpcServerRegisterAuthInfo 関数を呼び出したサーバー アプリケーションが指定したサーバー プリンシパル名へのポインターを指すポインターを返します。返される名前の内容とその構文は、使用されている認証サービスによって定義されます。SCHANNEL SSP の場合、プリンシパル名は Microsoft 標準 (msstd) 形式です。msstd 形式の詳細については、 Principal Names を参照してください。

RpcBindingInqAuthClientServerPrincName パラメーターを返さないようにするには、null 値を指定します。この場合、アプリケーションは RpcStringFree 関数を呼び出しません。

AuthnLevelDWORD*outoptional

ClientBinding バインディング ハンドルでリモート プロシージャ コールを行ったクライアント アプリケーションが要求した認証レベルが設定されたポインターを返します。

RpcBindingInqAuthClientAuthnLevel パラメーターを返さないようにするには、null 値を指定します。

AuthnSvcDWORD*outoptional

ClientBinding バインディング ハンドルでリモート プロシージャ コールを行ったクライアント アプリケーションが要求した認証サービスが設定されたポインターを返します。RPC でサポートされる認証レベルの一覧については、 Authentication-Level Constants を参照してください。

RpcBindingInqAuthClientAuthnSvc パラメーターを返さないようにするには、null 値を指定します。

AuthzSvcDWORD*outoptional

ClientBinding バインディング ハンドルでリモート プロシージャ コールを行ったクライアント アプリケーションが要求した承認サービスが設定されたポインターを返します。

RpcBindingInqAuthClientAuthzSvc パラメーターを返さないようにするには、null 値を指定します。このパラメーターは RPC_C_AUTHN_WINNT 認証サービスでは使用されません。返される値は常に RPC_C_AUTHZ_NONE になります。

戻り値の型: RPC_STATUS

公式ドキュメント

RpcBindingInqAuthClientW (Unicode) 関数 (rpcdce.h) は、リモート プロシージャ コールを行ったクライアントのプリンシパル名または特権属性を取得します。

戻り値

意味
RPC_S_OK
呼び出しに成功しました。
RPC_S_INVALID_BINDING
バインディング ハンドルが無効でした。
RPC_S_WRONG_KIND_OF_BINDING
この操作に対して不適切な種類のバインディングでした。
RPC_S_BINDING_HAS_NO_AUTH
バインディングに認証情報がありません。
注意 有効なエラー コードの一覧については、 RPC Return Values を参照してください。

解説(Remarks)

サーバー アプリケーションは、リモート プロシージャ コールを行った認証済みクライアントのプリンシパル名または特権属性を取得するために RpcBindingInqAuthClient 関数を呼び出します。さらに RpcBindingInqAuthClient は、クライアントが指定した認証サービス、認証レベル、およびサーバー プリンシパル名を返します。サーバーは、返されたデータを承認の目的で使用できます。

RPC ランタイム ライブラリは、返される ServerPrincName パラメーター用のメモリを割り当てます。アプリケーションは、返された引数の文字列に対して RpcStringFree 関数を呼び出す責任があります。

同期 RPC 呼び出しの場合、サーバー アプリケーションは ClientBinding パラメーターの値として 0 を使用できます。0 を使用すると、現在実行中のリモート プロシージャ コールから認証情報および承認情報が取得されます。

メモ

rpcdce.h ヘッダーは、UNICODE プリプロセッサ定数の定義に応じて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして RpcBindingInqAuthClient を定義しています。エンコードに依存しないエイリアスの使用と、エンコードに依存するコードを混在させると、不一致が生じてコンパイル エラーや実行時エラーの原因となることがあります。詳細については、「Conventions for Function Prototypes」を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

RPC_STATUS RpcBindingInqAuthClientW(
    void* ClientBinding,   // optional
    void** Privs,
    LPWSTR* ServerPrincName,   // optional
    DWORD* AuthnLevel,   // optional
    DWORD* AuthnSvc,   // optional
    DWORD* AuthzSvc   // optional
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcBindingInqAuthClientW(
    IntPtr ClientBinding,   // void* optional
    IntPtr Privs,   // void** out
    IntPtr ServerPrincName,   // LPWSTR* optional, out
    IntPtr AuthnLevel,   // DWORD* optional, out
    IntPtr AuthnSvc,   // DWORD* optional, out
    IntPtr AuthzSvc   // DWORD* optional, out
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcBindingInqAuthClientW(
    ClientBinding As IntPtr,   ' void* optional
    Privs As IntPtr,   ' void** out
    ServerPrincName As IntPtr,   ' LPWSTR* optional, out
    AuthnLevel As IntPtr,   ' DWORD* optional, out
    AuthnSvc As IntPtr,   ' DWORD* optional, out
    AuthzSvc As IntPtr   ' DWORD* optional, out
) As Integer
End Function
' ClientBinding : void* optional
' Privs : void** out
' ServerPrincName : LPWSTR* optional, out
' AuthnLevel : DWORD* optional, out
' AuthnSvc : DWORD* optional, out
' AuthzSvc : DWORD* optional, out
Declare PtrSafe Function RpcBindingInqAuthClientW Lib "rpcrt4" ( _
    ByVal ClientBinding As LongPtr, _
    ByVal Privs As LongPtr, _
    ByVal ServerPrincName As LongPtr, _
    ByVal AuthnLevel As LongPtr, _
    ByVal AuthnSvc As LongPtr, _
    ByVal AuthzSvc 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

RpcBindingInqAuthClientW = ctypes.windll.rpcrt4.RpcBindingInqAuthClientW
RpcBindingInqAuthClientW.restype = ctypes.c_int
RpcBindingInqAuthClientW.argtypes = [
    ctypes.POINTER(None),  # ClientBinding : void* optional
    ctypes.c_void_p,  # Privs : void** out
    ctypes.c_void_p,  # ServerPrincName : LPWSTR* optional, out
    ctypes.POINTER(wintypes.DWORD),  # AuthnLevel : DWORD* optional, out
    ctypes.POINTER(wintypes.DWORD),  # AuthnSvc : DWORD* optional, out
    ctypes.POINTER(wintypes.DWORD),  # AuthzSvc : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcBindingInqAuthClientW = Fiddle::Function.new(
  lib['RpcBindingInqAuthClientW'],
  [
    Fiddle::TYPE_VOIDP,  # ClientBinding : void* optional
    Fiddle::TYPE_VOIDP,  # Privs : void** out
    Fiddle::TYPE_VOIDP,  # ServerPrincName : LPWSTR* optional, out
    Fiddle::TYPE_VOIDP,  # AuthnLevel : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # AuthnSvc : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # AuthzSvc : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcBindingInqAuthClientW(
        ClientBinding: *mut (),  // void* optional
        Privs: *mut *mut (),  // void** out
        ServerPrincName: *mut *mut u16,  // LPWSTR* optional, out
        AuthnLevel: *mut u32,  // DWORD* optional, out
        AuthnSvc: *mut u32,  // DWORD* optional, out
        AuthzSvc: *mut u32  // DWORD* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcBindingInqAuthClientW(IntPtr ClientBinding, IntPtr Privs, IntPtr ServerPrincName, IntPtr AuthnLevel, IntPtr AuthnSvc, IntPtr AuthzSvc);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcBindingInqAuthClientW' -Namespace Win32 -PassThru
# $api::RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
#uselib "RPCRT4.dll"
#func global RpcBindingInqAuthClientW "RpcBindingInqAuthClientW" wptr, wptr, wptr, wptr, wptr, wptr
; RpcBindingInqAuthClientW ClientBinding, Privs, varptr(ServerPrincName), varptr(AuthnLevel), varptr(AuthnSvc), varptr(AuthzSvc)   ; 戻り値は stat
; ClientBinding : void* optional -> "wptr"
; Privs : void** out -> "wptr"
; ServerPrincName : LPWSTR* optional, out -> "wptr"
; AuthnLevel : DWORD* optional, out -> "wptr"
; AuthnSvc : DWORD* optional, out -> "wptr"
; AuthzSvc : DWORD* optional, out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global RpcBindingInqAuthClientW "RpcBindingInqAuthClientW" sptr, sptr, var, var, var, var
; res = RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
; ClientBinding : void* optional -> "sptr"
; Privs : void** out -> "sptr"
; ServerPrincName : LPWSTR* optional, out -> "var"
; AuthnLevel : DWORD* optional, out -> "var"
; AuthnSvc : DWORD* optional, out -> "var"
; AuthzSvc : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcBindingInqAuthClientW(void* ClientBinding, void** Privs, LPWSTR* ServerPrincName, DWORD* AuthnLevel, DWORD* AuthnSvc, DWORD* AuthzSvc)
#uselib "RPCRT4.dll"
#cfunc global RpcBindingInqAuthClientW "RpcBindingInqAuthClientW" intptr, intptr, var, var, var, var
; res = RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
; ClientBinding : void* optional -> "intptr"
; Privs : void** out -> "intptr"
; ServerPrincName : LPWSTR* optional, out -> "var"
; AuthnLevel : DWORD* optional, out -> "var"
; AuthnSvc : DWORD* optional, out -> "var"
; AuthzSvc : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcBindingInqAuthClientW = rpcrt4.NewProc("RpcBindingInqAuthClientW")
)

// ClientBinding (void* optional), Privs (void** out), ServerPrincName (LPWSTR* optional, out), AuthnLevel (DWORD* optional, out), AuthnSvc (DWORD* optional, out), AuthzSvc (DWORD* optional, out)
r1, _, err := procRpcBindingInqAuthClientW.Call(
	uintptr(ClientBinding),
	uintptr(Privs),
	uintptr(ServerPrincName),
	uintptr(AuthnLevel),
	uintptr(AuthnSvc),
	uintptr(AuthzSvc),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcBindingInqAuthClientW(
  ClientBinding: Pointer;   // void* optional
  Privs: Pointer;   // void** out
  ServerPrincName: PPWideChar;   // LPWSTR* optional, out
  AuthnLevel: Pointer;   // DWORD* optional, out
  AuthnSvc: Pointer;   // DWORD* optional, out
  AuthzSvc: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcBindingInqAuthClientW';
result := DllCall("RPCRT4\RpcBindingInqAuthClientW"
    , "Ptr", ClientBinding   ; void* optional
    , "Ptr", Privs   ; void** out
    , "Ptr", ServerPrincName   ; LPWSTR* optional, out
    , "Ptr", AuthnLevel   ; DWORD* optional, out
    , "Ptr", AuthnSvc   ; DWORD* optional, out
    , "Ptr", AuthzSvc   ; DWORD* optional, out
    , "Int")   ; return: RPC_STATUS
●RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc) = DLL("RPCRT4.dll", "int RpcBindingInqAuthClientW(void*, void*, void*, void*, void*, void*)")
# 呼び出し: RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
# ClientBinding : void* optional -> "void*"
# Privs : void** out -> "void*"
# ServerPrincName : LPWSTR* optional, out -> "void*"
# AuthnLevel : DWORD* optional, out -> "void*"
# AuthnSvc : DWORD* optional, out -> "void*"
# AuthzSvc : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "rpcrt4" fn RpcBindingInqAuthClientW(
    ClientBinding: ?*anyopaque, // void* optional
    Privs: ?*anyopaque, // void** out
    ServerPrincName: [*c][*c]u16, // LPWSTR* optional, out
    AuthnLevel: [*c]u32, // DWORD* optional, out
    AuthnSvc: [*c]u32, // DWORD* optional, out
    AuthzSvc: [*c]u32 // DWORD* optional, out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RpcBindingInqAuthClientW(
    ClientBinding: pointer,  # void* optional
    Privs: pointer,  # void** out
    ServerPrincName: ptr WideCString,  # LPWSTR* optional, out
    AuthnLevel: ptr uint32,  # DWORD* optional, out
    AuthnSvc: ptr uint32,  # DWORD* optional, out
    AuthzSvc: ptr uint32  # DWORD* optional, out
): int32 {.importc: "RpcBindingInqAuthClientW", stdcall, dynlib: "RPCRT4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "rpcrt4");
extern(Windows)
int RpcBindingInqAuthClientW(
    void* ClientBinding,   // void* optional
    void** Privs,   // void** out
    wchar** ServerPrincName,   // LPWSTR* optional, out
    uint* AuthnLevel,   // DWORD* optional, out
    uint* AuthnSvc,   // DWORD* optional, out
    uint* AuthzSvc   // DWORD* optional, out
);
ccall((:RpcBindingInqAuthClientW, "RPCRT4.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Ptr{UInt16}}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt32}),
      ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
# ClientBinding : void* optional -> Ptr{Cvoid}
# Privs : void** out -> Ptr{Cvoid}
# ServerPrincName : LPWSTR* optional, out -> Ptr{Ptr{UInt16}}
# AuthnLevel : DWORD* optional, out -> Ptr{UInt32}
# AuthnSvc : DWORD* optional, out -> Ptr{UInt32}
# AuthzSvc : DWORD* optional, out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcBindingInqAuthClientW(
    void* ClientBinding,
    void** Privs,
    uint16_t** ServerPrincName,
    uint32_t* AuthnLevel,
    uint32_t* AuthnSvc,
    uint32_t* AuthzSvc);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
-- ClientBinding : void* optional
-- Privs : void** out
-- ServerPrincName : LPWSTR* optional, out
-- AuthnLevel : DWORD* optional, out
-- AuthnSvc : DWORD* optional, out
-- AuthzSvc : DWORD* optional, out
-- 構造体/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 RpcBindingInqAuthClientW = lib.func('__stdcall', 'RpcBindingInqAuthClientW', 'int32_t', ['void *', 'void *', 'void *', 'uint32_t *', 'uint32_t *', 'uint32_t *']);
// RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
// ClientBinding : void* optional -> 'void *'
// Privs : void** out -> 'void *'
// ServerPrincName : LPWSTR* optional, out -> 'void *'
// AuthnLevel : DWORD* optional, out -> 'uint32_t *'
// AuthnSvc : DWORD* optional, out -> 'uint32_t *'
// AuthzSvc : DWORD* optional, out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCRT4.dll", {
  RpcBindingInqAuthClientW: { parameters: ["pointer", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc)
// ClientBinding : void* optional -> "pointer"
// Privs : void** out -> "pointer"
// ServerPrincName : LPWSTR* optional, out -> "pointer"
// AuthnLevel : DWORD* optional, out -> "pointer"
// AuthnSvc : DWORD* optional, out -> "pointer"
// AuthzSvc : DWORD* optional, out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcBindingInqAuthClientW(
    void* ClientBinding,
    void** Privs,
    uint16_t** ServerPrincName,
    uint32_t* AuthnLevel,
    uint32_t* AuthnSvc,
    uint32_t* AuthzSvc);
C, "RPCRT4.dll");
// $ffi->RpcBindingInqAuthClientW(ClientBinding, Privs, ServerPrincName, AuthnLevel, AuthnSvc, AuthzSvc);
// ClientBinding : void* optional
// Privs : void** out
// ServerPrincName : LPWSTR* optional, out
// AuthnLevel : DWORD* optional, out
// AuthnSvc : DWORD* optional, out
// AuthzSvc : DWORD* optional, out
// 構造体/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 RpcBindingInqAuthClientW(
        Pointer ClientBinding,   // void* optional
        Pointer Privs,   // void** out
        PointerByReference ServerPrincName,   // LPWSTR* optional, out
        IntByReference AuthnLevel,   // DWORD* optional, out
        IntByReference AuthnSvc,   // DWORD* optional, out
        IntByReference AuthzSvc   // DWORD* optional, out
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("rpcrt4")]
lib LibRPCRT4
  fun RpcBindingInqAuthClientW = RpcBindingInqAuthClientW(
    ClientBinding : Void*,   # void* optional
    Privs : Void**,   # void** out
    ServerPrincName : UInt16**,   # LPWSTR* optional, out
    AuthnLevel : UInt32*,   # DWORD* optional, out
    AuthnSvc : UInt32*,   # DWORD* optional, out
    AuthzSvc : UInt32*   # DWORD* optional, out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RpcBindingInqAuthClientWNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Pointer<Utf16>>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>);
typedef RpcBindingInqAuthClientWDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Pointer<Utf16>>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint32>);
final RpcBindingInqAuthClientW = DynamicLibrary.open('RPCRT4.dll')
    .lookupFunction<RpcBindingInqAuthClientWNative, RpcBindingInqAuthClientWDart>('RpcBindingInqAuthClientW');
// ClientBinding : void* optional -> Pointer<Void>
// Privs : void** out -> Pointer<Void>
// ServerPrincName : LPWSTR* optional, out -> Pointer<Pointer<Utf16>>
// AuthnLevel : DWORD* optional, out -> Pointer<Uint32>
// AuthnSvc : DWORD* optional, out -> Pointer<Uint32>
// AuthzSvc : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RpcBindingInqAuthClientW(
  ClientBinding: Pointer;   // void* optional
  Privs: Pointer;   // void** out
  ServerPrincName: PPWideChar;   // LPWSTR* optional, out
  AuthnLevel: Pointer;   // DWORD* optional, out
  AuthnSvc: Pointer;   // DWORD* optional, out
  AuthzSvc: Pointer   // DWORD* optional, out
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcBindingInqAuthClientW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcBindingInqAuthClientW"
  c_RpcBindingInqAuthClientW :: Ptr () -> Ptr () -> Ptr CWString -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> IO Int32
-- ClientBinding : void* optional -> Ptr ()
-- Privs : void** out -> Ptr ()
-- ServerPrincName : LPWSTR* optional, out -> Ptr CWString
-- AuthnLevel : DWORD* optional, out -> Ptr Word32
-- AuthnSvc : DWORD* optional, out -> Ptr Word32
-- AuthzSvc : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rpcbindinginqauthclientw =
  foreign "RpcBindingInqAuthClientW"
    ((ptr void) @-> (ptr void) @-> (ptr (ptr uint16_t)) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> returning int32_t)
(* ClientBinding : void* optional -> (ptr void) *)
(* Privs : void** out -> (ptr void) *)
(* ServerPrincName : LPWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* AuthnLevel : DWORD* optional, out -> (ptr uint32_t) *)
(* AuthnSvc : DWORD* optional, out -> (ptr uint32_t) *)
(* AuthzSvc : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)

(cffi:defcfun ("RpcBindingInqAuthClientW" rpc-binding-inq-auth-client-w :convention :stdcall) :int32
  (client-binding :pointer)   ; void* optional
  (privs :pointer)   ; void** out
  (server-princ-name :pointer)   ; LPWSTR* optional, out
  (authn-level :pointer)   ; DWORD* optional, out
  (authn-svc :pointer)   ; DWORD* optional, out
  (authz-svc :pointer))   ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcBindingInqAuthClientW = Win32::API::More->new('RPCRT4',
    'int RpcBindingInqAuthClientW(LPVOID ClientBinding, LPVOID Privs, LPVOID ServerPrincName, LPVOID AuthnLevel, LPVOID AuthnSvc, LPVOID AuthzSvc)');
# my $ret = $RpcBindingInqAuthClientW->Call($ClientBinding, $Privs, $ServerPrincName, $AuthnLevel, $AuthnSvc, $AuthzSvc);
# ClientBinding : void* optional -> LPVOID
# Privs : void** out -> LPVOID
# ServerPrincName : LPWSTR* optional, out -> LPVOID
# AuthnLevel : DWORD* optional, out -> LPVOID
# AuthnSvc : DWORD* optional, out -> LPVOID
# AuthzSvc : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

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