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
);

パラメーター

名前方向
LsaHandleHANDLEin
AuthenticationPackageDWORDin
ProtocolSubmitBuffervoid*in
SubmitBufferLengthDWORDin
ProtocolReturnBuffervoid**outoptional
ReturnBufferLengthDWORD*outoptional
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)。