ホーム › Security.Authentication.Identity › LsaGetLogonSessionData
LsaGetLogonSessionData
関数指定したログオンセッションの詳細データを取得する。
シグネチャ
// SECUR32.dll
#include <windows.h>
NTSTATUS LsaGetLogonSessionData(
LUID* LogonId,
SECURITY_LOGON_SESSION_DATA** ppLogonSessionData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| LogonId | LUID* | in |
| ppLogonSessionData | SECURITY_LOGON_SESSION_DATA** | out |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// SECUR32.dll
#include <windows.h>
NTSTATUS LsaGetLogonSessionData(
LUID* LogonId,
SECURITY_LOGON_SESSION_DATA** ppLogonSessionData
);[DllImport("SECUR32.dll", ExactSpelling = true)]
static extern int LsaGetLogonSessionData(
IntPtr LogonId, // LUID*
IntPtr ppLogonSessionData // SECURITY_LOGON_SESSION_DATA** out
);<DllImport("SECUR32.dll", ExactSpelling:=True)>
Public Shared Function LsaGetLogonSessionData(
LogonId As IntPtr, ' LUID*
ppLogonSessionData As IntPtr ' SECURITY_LOGON_SESSION_DATA** out
) As Integer
End Function' LogonId : LUID*
' ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out
Declare PtrSafe Function LsaGetLogonSessionData Lib "secur32" ( _
ByVal LogonId As LongPtr, _
ByVal ppLogonSessionData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
LsaGetLogonSessionData = ctypes.windll.secur32.LsaGetLogonSessionData
LsaGetLogonSessionData.restype = ctypes.c_int
LsaGetLogonSessionData.argtypes = [
ctypes.c_void_p, # LogonId : LUID*
ctypes.c_void_p, # ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SECUR32.dll')
LsaGetLogonSessionData = Fiddle::Function.new(
lib['LsaGetLogonSessionData'],
[
Fiddle::TYPE_VOIDP, # LogonId : LUID*
Fiddle::TYPE_VOIDP, # ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out
],
Fiddle::TYPE_INT)#[link(name = "secur32")]
extern "system" {
fn LsaGetLogonSessionData(
LogonId: *mut LUID, // LUID*
ppLogonSessionData: *mut *mut SECURITY_LOGON_SESSION_DATA // SECURITY_LOGON_SESSION_DATA** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SECUR32.dll")]
public static extern int LsaGetLogonSessionData(IntPtr LogonId, IntPtr ppLogonSessionData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SECUR32_LsaGetLogonSessionData' -Namespace Win32 -PassThru
# $api::LsaGetLogonSessionData(LogonId, ppLogonSessionData)#uselib "SECUR32.dll"
#func global LsaGetLogonSessionData "LsaGetLogonSessionData" sptr, sptr
; LsaGetLogonSessionData varptr(LogonId), varptr(ppLogonSessionData) ; 戻り値は stat
; LogonId : LUID* -> "sptr"
; ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SECUR32.dll" #cfunc global LsaGetLogonSessionData "LsaGetLogonSessionData" var, var ; res = LsaGetLogonSessionData(LogonId, ppLogonSessionData) ; LogonId : LUID* -> "var" ; ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SECUR32.dll" #cfunc global LsaGetLogonSessionData "LsaGetLogonSessionData" sptr, sptr ; res = LsaGetLogonSessionData(varptr(LogonId), varptr(ppLogonSessionData)) ; LogonId : LUID* -> "sptr" ; ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; NTSTATUS LsaGetLogonSessionData(LUID* LogonId, SECURITY_LOGON_SESSION_DATA** ppLogonSessionData) #uselib "SECUR32.dll" #cfunc global LsaGetLogonSessionData "LsaGetLogonSessionData" var, var ; res = LsaGetLogonSessionData(LogonId, ppLogonSessionData) ; LogonId : LUID* -> "var" ; ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; NTSTATUS LsaGetLogonSessionData(LUID* LogonId, SECURITY_LOGON_SESSION_DATA** ppLogonSessionData) #uselib "SECUR32.dll" #cfunc global LsaGetLogonSessionData "LsaGetLogonSessionData" intptr, intptr ; res = LsaGetLogonSessionData(varptr(LogonId), varptr(ppLogonSessionData)) ; LogonId : LUID* -> "intptr" ; ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
secur32 = windows.NewLazySystemDLL("SECUR32.dll")
procLsaGetLogonSessionData = secur32.NewProc("LsaGetLogonSessionData")
)
// LogonId (LUID*), ppLogonSessionData (SECURITY_LOGON_SESSION_DATA** out)
r1, _, err := procLsaGetLogonSessionData.Call(
uintptr(LogonId),
uintptr(ppLogonSessionData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction LsaGetLogonSessionData(
LogonId: Pointer; // LUID*
ppLogonSessionData: Pointer // SECURITY_LOGON_SESSION_DATA** out
): Integer; stdcall;
external 'SECUR32.dll' name 'LsaGetLogonSessionData';result := DllCall("SECUR32\LsaGetLogonSessionData"
, "Ptr", LogonId ; LUID*
, "Ptr", ppLogonSessionData ; SECURITY_LOGON_SESSION_DATA** out
, "Int") ; return: NTSTATUS●LsaGetLogonSessionData(LogonId, ppLogonSessionData) = DLL("SECUR32.dll", "int LsaGetLogonSessionData(void*, void*)")
# 呼び出し: LsaGetLogonSessionData(LogonId, ppLogonSessionData)
# LogonId : LUID* -> "void*"
# ppLogonSessionData : SECURITY_LOGON_SESSION_DATA** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。