Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › LsaCallAuthenticationPackage

LsaCallAuthenticationPackage

関数
認証パッケージに対しメッセージを送信して処理を要求する。
DLLSECUR32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

// SECUR32.dll
#include <windows.h>

NTSTATUS LsaCallAuthenticationPackage(
    HANDLE LsaHandle,
    DWORD AuthenticationPackage,
    void* ProtocolSubmitBuffer,
    DWORD SubmitBufferLength,
    void** ProtocolReturnBuffer,   // optional
    DWORD* ReturnBufferLength,   // optional
    INT* ProtocolStatus   // optional
);

パラメーター

名前方向説明
LsaHandleHANDLEinLSAへの接続ハンドル。
AuthenticationPackageDWORDin呼び出す認証パッケージの識別子。
ProtocolSubmitBuffervoid*in認証パッケージへ渡すパッケージ固有の入力バッファ。
SubmitBufferLengthDWORDinProtocolSubmitBufferのバイト数。
ProtocolReturnBuffervoid**outoptional認証パッケージが返す出力バッファを受け取るポインタ。LsaFreeReturnBufferで解放する。
ReturnBufferLengthDWORD*outoptionalProtocolReturnBufferのバイト数を受け取る出力先。
ProtocolStatusINT*outoptional認証パッケージ固有の処理ステータスを受け取る出力先。

戻り値の型: NTSTATUS

各言語での呼び出し定義

// SECUR32.dll
#include <windows.h>

NTSTATUS LsaCallAuthenticationPackage(
    HANDLE LsaHandle,
    DWORD AuthenticationPackage,
    void* ProtocolSubmitBuffer,
    DWORD SubmitBufferLength,
    void** ProtocolReturnBuffer,   // optional
    DWORD* ReturnBufferLength,   // optional
    INT* ProtocolStatus   // optional
);
[DllImport("SECUR32.dll", ExactSpelling = true)]
static extern int LsaCallAuthenticationPackage(
    IntPtr LsaHandle,   // HANDLE
    uint AuthenticationPackage,   // DWORD
    IntPtr ProtocolSubmitBuffer,   // void*
    uint SubmitBufferLength,   // DWORD
    IntPtr ProtocolReturnBuffer,   // void** optional, out
    IntPtr ReturnBufferLength,   // DWORD* optional, out
    IntPtr ProtocolStatus   // INT* optional, out
);
<DllImport("SECUR32.dll", ExactSpelling:=True)>
Public Shared Function LsaCallAuthenticationPackage(
    LsaHandle As IntPtr,   ' HANDLE
    AuthenticationPackage As UInteger,   ' DWORD
    ProtocolSubmitBuffer As IntPtr,   ' void*
    SubmitBufferLength As UInteger,   ' DWORD
    ProtocolReturnBuffer As IntPtr,   ' void** optional, out
    ReturnBufferLength As IntPtr,   ' DWORD* optional, out
    ProtocolStatus As IntPtr   ' INT* optional, out
) As Integer
End Function
' LsaHandle : HANDLE
' AuthenticationPackage : DWORD
' ProtocolSubmitBuffer : void*
' SubmitBufferLength : DWORD
' ProtocolReturnBuffer : void** optional, out
' ReturnBufferLength : DWORD* optional, out
' ProtocolStatus : INT* optional, out
Declare PtrSafe Function LsaCallAuthenticationPackage Lib "secur32" ( _
    ByVal LsaHandle As LongPtr, _
    ByVal AuthenticationPackage As Long, _
    ByVal ProtocolSubmitBuffer As LongPtr, _
    ByVal SubmitBufferLength As Long, _
    ByVal ProtocolReturnBuffer As LongPtr, _
    ByVal ReturnBufferLength As LongPtr, _
    ByVal ProtocolStatus As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

LsaCallAuthenticationPackage = ctypes.windll.secur32.LsaCallAuthenticationPackage
LsaCallAuthenticationPackage.restype = ctypes.c_int
LsaCallAuthenticationPackage.argtypes = [
    wintypes.HANDLE,  # LsaHandle : HANDLE
    wintypes.DWORD,  # AuthenticationPackage : DWORD
    ctypes.POINTER(None),  # ProtocolSubmitBuffer : void*
    wintypes.DWORD,  # SubmitBufferLength : DWORD
    ctypes.c_void_p,  # ProtocolReturnBuffer : void** optional, out
    ctypes.POINTER(wintypes.DWORD),  # ReturnBufferLength : DWORD* optional, out
    ctypes.POINTER(ctypes.c_int),  # ProtocolStatus : INT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SECUR32.dll')
LsaCallAuthenticationPackage = Fiddle::Function.new(
  lib['LsaCallAuthenticationPackage'],
  [
    Fiddle::TYPE_VOIDP,  # LsaHandle : HANDLE
    -Fiddle::TYPE_INT,  # AuthenticationPackage : DWORD
    Fiddle::TYPE_VOIDP,  # ProtocolSubmitBuffer : void*
    -Fiddle::TYPE_INT,  # SubmitBufferLength : DWORD
    Fiddle::TYPE_VOIDP,  # ProtocolReturnBuffer : void** optional, out
    Fiddle::TYPE_VOIDP,  # ReturnBufferLength : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # ProtocolStatus : INT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "secur32")]
extern "system" {
    fn LsaCallAuthenticationPackage(
        LsaHandle: *mut core::ffi::c_void,  // HANDLE
        AuthenticationPackage: u32,  // DWORD
        ProtocolSubmitBuffer: *mut (),  // void*
        SubmitBufferLength: u32,  // DWORD
        ProtocolReturnBuffer: *mut *mut (),  // void** optional, out
        ReturnBufferLength: *mut u32,  // DWORD* optional, out
        ProtocolStatus: *mut i32  // INT* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SECUR32.dll")]
public static extern int LsaCallAuthenticationPackage(IntPtr LsaHandle, uint AuthenticationPackage, IntPtr ProtocolSubmitBuffer, uint SubmitBufferLength, IntPtr ProtocolReturnBuffer, IntPtr ReturnBufferLength, IntPtr ProtocolStatus);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SECUR32_LsaCallAuthenticationPackage' -Namespace Win32 -PassThru
# $api::LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
#uselib "SECUR32.dll"
#func global LsaCallAuthenticationPackage "LsaCallAuthenticationPackage" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; LsaCallAuthenticationPackage LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, varptr(ReturnBufferLength), varptr(ProtocolStatus)   ; 戻り値は stat
; LsaHandle : HANDLE -> "sptr"
; AuthenticationPackage : DWORD -> "sptr"
; ProtocolSubmitBuffer : void* -> "sptr"
; SubmitBufferLength : DWORD -> "sptr"
; ProtocolReturnBuffer : void** optional, out -> "sptr"
; ReturnBufferLength : DWORD* optional, out -> "sptr"
; ProtocolStatus : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SECUR32.dll"
#cfunc global LsaCallAuthenticationPackage "LsaCallAuthenticationPackage" sptr, int, sptr, int, sptr, var, var
; res = LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
; LsaHandle : HANDLE -> "sptr"
; AuthenticationPackage : DWORD -> "int"
; ProtocolSubmitBuffer : void* -> "sptr"
; SubmitBufferLength : DWORD -> "int"
; ProtocolReturnBuffer : void** optional, out -> "sptr"
; ReturnBufferLength : DWORD* optional, out -> "var"
; ProtocolStatus : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; NTSTATUS LsaCallAuthenticationPackage(HANDLE LsaHandle, DWORD AuthenticationPackage, void* ProtocolSubmitBuffer, DWORD SubmitBufferLength, void** ProtocolReturnBuffer, DWORD* ReturnBufferLength, INT* ProtocolStatus)
#uselib "SECUR32.dll"
#cfunc global LsaCallAuthenticationPackage "LsaCallAuthenticationPackage" intptr, int, intptr, int, intptr, var, var
; res = LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
; LsaHandle : HANDLE -> "intptr"
; AuthenticationPackage : DWORD -> "int"
; ProtocolSubmitBuffer : void* -> "intptr"
; SubmitBufferLength : DWORD -> "int"
; ProtocolReturnBuffer : void** optional, out -> "intptr"
; ReturnBufferLength : DWORD* optional, out -> "var"
; ProtocolStatus : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	secur32 = windows.NewLazySystemDLL("SECUR32.dll")
	procLsaCallAuthenticationPackage = secur32.NewProc("LsaCallAuthenticationPackage")
)

// LsaHandle (HANDLE), AuthenticationPackage (DWORD), ProtocolSubmitBuffer (void*), SubmitBufferLength (DWORD), ProtocolReturnBuffer (void** optional, out), ReturnBufferLength (DWORD* optional, out), ProtocolStatus (INT* optional, out)
r1, _, err := procLsaCallAuthenticationPackage.Call(
	uintptr(LsaHandle),
	uintptr(AuthenticationPackage),
	uintptr(ProtocolSubmitBuffer),
	uintptr(SubmitBufferLength),
	uintptr(ProtocolReturnBuffer),
	uintptr(ReturnBufferLength),
	uintptr(ProtocolStatus),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // NTSTATUS
function LsaCallAuthenticationPackage(
  LsaHandle: THandle;   // HANDLE
  AuthenticationPackage: DWORD;   // DWORD
  ProtocolSubmitBuffer: Pointer;   // void*
  SubmitBufferLength: DWORD;   // DWORD
  ProtocolReturnBuffer: Pointer;   // void** optional, out
  ReturnBufferLength: Pointer;   // DWORD* optional, out
  ProtocolStatus: Pointer   // INT* optional, out
): Integer; stdcall;
  external 'SECUR32.dll' name 'LsaCallAuthenticationPackage';
result := DllCall("SECUR32\LsaCallAuthenticationPackage"
    , "Ptr", LsaHandle   ; HANDLE
    , "UInt", AuthenticationPackage   ; DWORD
    , "Ptr", ProtocolSubmitBuffer   ; void*
    , "UInt", SubmitBufferLength   ; DWORD
    , "Ptr", ProtocolReturnBuffer   ; void** optional, out
    , "Ptr", ReturnBufferLength   ; DWORD* optional, out
    , "Ptr", ProtocolStatus   ; INT* optional, out
    , "Int")   ; return: NTSTATUS
●LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus) = DLL("SECUR32.dll", "int LsaCallAuthenticationPackage(void*, dword, void*, dword, void*, void*, void*)")
# 呼び出し: LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
# LsaHandle : HANDLE -> "void*"
# AuthenticationPackage : DWORD -> "dword"
# ProtocolSubmitBuffer : void* -> "void*"
# SubmitBufferLength : DWORD -> "dword"
# ProtocolReturnBuffer : void** optional, out -> "void*"
# ReturnBufferLength : DWORD* optional, out -> "void*"
# ProtocolStatus : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "secur32" fn LsaCallAuthenticationPackage(
    LsaHandle: ?*anyopaque, // HANDLE
    AuthenticationPackage: u32, // DWORD
    ProtocolSubmitBuffer: ?*anyopaque, // void*
    SubmitBufferLength: u32, // DWORD
    ProtocolReturnBuffer: ?*anyopaque, // void** optional, out
    ReturnBufferLength: [*c]u32, // DWORD* optional, out
    ProtocolStatus: [*c]i32 // INT* optional, out
) callconv(std.os.windows.WINAPI) i32;
proc LsaCallAuthenticationPackage(
    LsaHandle: pointer,  # HANDLE
    AuthenticationPackage: uint32,  # DWORD
    ProtocolSubmitBuffer: pointer,  # void*
    SubmitBufferLength: uint32,  # DWORD
    ProtocolReturnBuffer: pointer,  # void** optional, out
    ReturnBufferLength: ptr uint32,  # DWORD* optional, out
    ProtocolStatus: ptr int32  # INT* optional, out
): int32 {.importc: "LsaCallAuthenticationPackage", stdcall, dynlib: "SECUR32.dll".}
pragma(lib, "secur32");
extern(Windows)
int LsaCallAuthenticationPackage(
    void* LsaHandle,   // HANDLE
    uint AuthenticationPackage,   // DWORD
    void* ProtocolSubmitBuffer,   // void*
    uint SubmitBufferLength,   // DWORD
    void** ProtocolReturnBuffer,   // void** optional, out
    uint* ReturnBufferLength,   // DWORD* optional, out
    int* ProtocolStatus   // INT* optional, out
);
ccall((:LsaCallAuthenticationPackage, "SECUR32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Ptr{Cvoid}, UInt32, Ptr{Cvoid}, Ptr{UInt32}, Ptr{Int32}),
      LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
# LsaHandle : HANDLE -> Ptr{Cvoid}
# AuthenticationPackage : DWORD -> UInt32
# ProtocolSubmitBuffer : void* -> Ptr{Cvoid}
# SubmitBufferLength : DWORD -> UInt32
# ProtocolReturnBuffer : void** optional, out -> Ptr{Cvoid}
# ReturnBufferLength : DWORD* optional, out -> Ptr{UInt32}
# ProtocolStatus : INT* optional, out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t LsaCallAuthenticationPackage(
    void* LsaHandle,
    uint32_t AuthenticationPackage,
    void* ProtocolSubmitBuffer,
    uint32_t SubmitBufferLength,
    void** ProtocolReturnBuffer,
    uint32_t* ReturnBufferLength,
    int32_t* ProtocolStatus);
]]
local secur32 = ffi.load("secur32")
-- secur32.LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
-- LsaHandle : HANDLE
-- AuthenticationPackage : DWORD
-- ProtocolSubmitBuffer : void*
-- SubmitBufferLength : DWORD
-- ProtocolReturnBuffer : void** optional, out
-- ReturnBufferLength : DWORD* optional, out
-- ProtocolStatus : INT* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SECUR32.dll');
const LsaCallAuthenticationPackage = lib.func('__stdcall', 'LsaCallAuthenticationPackage', 'int32_t', ['void *', 'uint32_t', 'void *', 'uint32_t', 'void *', 'uint32_t *', 'int32_t *']);
// LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
// LsaHandle : HANDLE -> 'void *'
// AuthenticationPackage : DWORD -> 'uint32_t'
// ProtocolSubmitBuffer : void* -> 'void *'
// SubmitBufferLength : DWORD -> 'uint32_t'
// ProtocolReturnBuffer : void** optional, out -> 'void *'
// ReturnBufferLength : DWORD* optional, out -> 'uint32_t *'
// ProtocolStatus : INT* optional, out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SECUR32.dll", {
  LsaCallAuthenticationPackage: { parameters: ["pointer", "u32", "pointer", "u32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus)
// LsaHandle : HANDLE -> "pointer"
// AuthenticationPackage : DWORD -> "u32"
// ProtocolSubmitBuffer : void* -> "pointer"
// SubmitBufferLength : DWORD -> "u32"
// ProtocolReturnBuffer : void** optional, out -> "pointer"
// ReturnBufferLength : DWORD* optional, out -> "pointer"
// ProtocolStatus : INT* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t LsaCallAuthenticationPackage(
    void* LsaHandle,
    uint32_t AuthenticationPackage,
    void* ProtocolSubmitBuffer,
    uint32_t SubmitBufferLength,
    void** ProtocolReturnBuffer,
    uint32_t* ReturnBufferLength,
    int32_t* ProtocolStatus);
C, "SECUR32.dll");
// $ffi->LsaCallAuthenticationPackage(LsaHandle, AuthenticationPackage, ProtocolSubmitBuffer, SubmitBufferLength, ProtocolReturnBuffer, ReturnBufferLength, ProtocolStatus);
// LsaHandle : HANDLE
// AuthenticationPackage : DWORD
// ProtocolSubmitBuffer : void*
// SubmitBufferLength : DWORD
// ProtocolReturnBuffer : void** optional, out
// ReturnBufferLength : DWORD* optional, out
// ProtocolStatus : INT* 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 Secur32 extends StdCallLibrary {
    Secur32 INSTANCE = Native.load("secur32", Secur32.class);
    int LsaCallAuthenticationPackage(
        Pointer LsaHandle,   // HANDLE
        int AuthenticationPackage,   // DWORD
        Pointer ProtocolSubmitBuffer,   // void*
        int SubmitBufferLength,   // DWORD
        Pointer ProtocolReturnBuffer,   // void** optional, out
        IntByReference ReturnBufferLength,   // DWORD* optional, out
        IntByReference ProtocolStatus   // INT* optional, out
    );
}
@[Link("secur32")]
lib LibSECUR32
  fun LsaCallAuthenticationPackage = LsaCallAuthenticationPackage(
    LsaHandle : Void*,   # HANDLE
    AuthenticationPackage : UInt32,   # DWORD
    ProtocolSubmitBuffer : Void*,   # void*
    SubmitBufferLength : UInt32,   # DWORD
    ProtocolReturnBuffer : Void**,   # void** optional, out
    ReturnBufferLength : UInt32*,   # DWORD* optional, out
    ProtocolStatus : Int32*   # INT* 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 LsaCallAuthenticationPackageNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Uint32, Pointer<Void>, Pointer<Uint32>, Pointer<Int32>);
typedef LsaCallAuthenticationPackageDart = int Function(Pointer<Void>, int, Pointer<Void>, int, Pointer<Void>, Pointer<Uint32>, Pointer<Int32>);
final LsaCallAuthenticationPackage = DynamicLibrary.open('SECUR32.dll')
    .lookupFunction<LsaCallAuthenticationPackageNative, LsaCallAuthenticationPackageDart>('LsaCallAuthenticationPackage');
// LsaHandle : HANDLE -> Pointer<Void>
// AuthenticationPackage : DWORD -> Uint32
// ProtocolSubmitBuffer : void* -> Pointer<Void>
// SubmitBufferLength : DWORD -> Uint32
// ProtocolReturnBuffer : void** optional, out -> Pointer<Void>
// ReturnBufferLength : DWORD* optional, out -> Pointer<Uint32>
// ProtocolStatus : INT* optional, out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function LsaCallAuthenticationPackage(
  LsaHandle: THandle;   // HANDLE
  AuthenticationPackage: DWORD;   // DWORD
  ProtocolSubmitBuffer: Pointer;   // void*
  SubmitBufferLength: DWORD;   // DWORD
  ProtocolReturnBuffer: Pointer;   // void** optional, out
  ReturnBufferLength: Pointer;   // DWORD* optional, out
  ProtocolStatus: Pointer   // INT* optional, out
): Integer; stdcall;
  external 'SECUR32.dll' name 'LsaCallAuthenticationPackage';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "LsaCallAuthenticationPackage"
  c_LsaCallAuthenticationPackage :: Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr () -> Ptr Word32 -> Ptr Int32 -> IO Int32
-- LsaHandle : HANDLE -> Ptr ()
-- AuthenticationPackage : DWORD -> Word32
-- ProtocolSubmitBuffer : void* -> Ptr ()
-- SubmitBufferLength : DWORD -> Word32
-- ProtocolReturnBuffer : void** optional, out -> Ptr ()
-- ReturnBufferLength : DWORD* optional, out -> Ptr Word32
-- ProtocolStatus : INT* optional, out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let lsacallauthenticationpackage =
  foreign "LsaCallAuthenticationPackage"
    ((ptr void) @-> uint32_t @-> (ptr void) @-> uint32_t @-> (ptr void) @-> (ptr uint32_t) @-> (ptr int32_t) @-> returning int32_t)
(* LsaHandle : HANDLE -> (ptr void) *)
(* AuthenticationPackage : DWORD -> uint32_t *)
(* ProtocolSubmitBuffer : void* -> (ptr void) *)
(* SubmitBufferLength : DWORD -> uint32_t *)
(* ProtocolReturnBuffer : void** optional, out -> (ptr void) *)
(* ReturnBufferLength : DWORD* optional, out -> (ptr uint32_t) *)
(* ProtocolStatus : INT* optional, out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library secur32 (t "SECUR32.dll"))
(cffi:use-foreign-library secur32)

(cffi:defcfun ("LsaCallAuthenticationPackage" lsa-call-authentication-package :convention :stdcall) :int32
  (lsa-handle :pointer)   ; HANDLE
  (authentication-package :uint32)   ; DWORD
  (protocol-submit-buffer :pointer)   ; void*
  (submit-buffer-length :uint32)   ; DWORD
  (protocol-return-buffer :pointer)   ; void** optional, out
  (return-buffer-length :pointer)   ; DWORD* optional, out
  (protocol-status :pointer))   ; INT* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $LsaCallAuthenticationPackage = Win32::API::More->new('SECUR32',
    'int LsaCallAuthenticationPackage(HANDLE LsaHandle, DWORD AuthenticationPackage, LPVOID ProtocolSubmitBuffer, DWORD SubmitBufferLength, LPVOID ProtocolReturnBuffer, LPVOID ReturnBufferLength, LPVOID ProtocolStatus)');
# my $ret = $LsaCallAuthenticationPackage->Call($LsaHandle, $AuthenticationPackage, $ProtocolSubmitBuffer, $SubmitBufferLength, $ProtocolReturnBuffer, $ReturnBufferLength, $ProtocolStatus);
# LsaHandle : HANDLE -> HANDLE
# AuthenticationPackage : DWORD -> DWORD
# ProtocolSubmitBuffer : void* -> LPVOID
# SubmitBufferLength : DWORD -> DWORD
# ProtocolReturnBuffer : void** optional, out -> LPVOID
# ReturnBufferLength : DWORD* optional, out -> LPVOID
# ProtocolStatus : INT* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。