ホーム › Security.Authentication.Identity › MSV1_0_LM20_LOGON_PROFILE
MSV1_0_LM20_LOGON_PROFILE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MessageType | MSV1_0_PROFILE_BUFFER_TYPE | 4 | +0 | +0 | プロファイルバッファ種別を示す列挙値。 |
| KickOffTime | LONGLONG | 8 | +8 | +8 | 強制切断予定日時(100ナノ秒単位)。 |
| LogoffTime | LONGLONG | 8 | +16 | +16 | 強制ログオフ予定日時(100ナノ秒単位)。 |
| UserFlags | MSV_SUB_AUTHENTICATION_FILTER | 4 | +24 | +24 | ユーザーログオンに関するフラグ。 |
| UserSessionKey | BYTE | 16 | +28 | +28 | ユーザーセッションキー(16バイト)。 |
| LogonDomainName | LSA_UNICODE_STRING | 16/8 | +48 | +44 | ログオンドメイン名(LSA_UNICODE_STRING)。 |
| LanmanSessionKey | BYTE | 8 | +64 | +52 | LANMANセッションキー(8バイト)。 |
| LogonServer | LSA_UNICODE_STRING | 16/8 | +72 | +60 | 認証を行ったサーバー名(LSA_UNICODE_STRING)。 |
| UserParameters | LSA_UNICODE_STRING | 16/8 | +88 | +68 | ユーザーパラメータ文字列(LSA_UNICODE_STRING)。 |
各言語での定義
#include <windows.h>
// LSA_UNICODE_STRING (x64 16 / x86 8 バイト)
typedef struct LSA_UNICODE_STRING {
WORD Length;
WORD MaximumLength;
LPWSTR Buffer;
} LSA_UNICODE_STRING;
// MSV1_0_LM20_LOGON_PROFILE (x64 104 / x86 80 バイト)
typedef struct MSV1_0_LM20_LOGON_PROFILE {
MSV1_0_PROFILE_BUFFER_TYPE MessageType;
LONGLONG KickOffTime;
LONGLONG LogoffTime;
MSV_SUB_AUTHENTICATION_FILTER UserFlags;
BYTE UserSessionKey[16];
LSA_UNICODE_STRING LogonDomainName;
BYTE LanmanSessionKey[8];
LSA_UNICODE_STRING LogonServer;
LSA_UNICODE_STRING UserParameters;
} MSV1_0_LM20_LOGON_PROFILE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LSA_UNICODE_STRING
{
public ushort Length;
public ushort MaximumLength;
public IntPtr Buffer;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MSV1_0_LM20_LOGON_PROFILE
{
public int MessageType;
public long KickOffTime;
public long LogoffTime;
public uint UserFlags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] UserSessionKey;
public LSA_UNICODE_STRING LogonDomainName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] LanmanSessionKey;
public LSA_UNICODE_STRING LogonServer;
public LSA_UNICODE_STRING UserParameters;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LSA_UNICODE_STRING
Public Length As UShort
Public MaximumLength As UShort
Public Buffer As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MSV1_0_LM20_LOGON_PROFILE
Public MessageType As Integer
Public KickOffTime As Long
Public LogoffTime As Long
Public UserFlags As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public UserSessionKey() As Byte
Public LogonDomainName As LSA_UNICODE_STRING
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public LanmanSessionKey() As Byte
Public LogonServer As LSA_UNICODE_STRING
Public UserParameters As LSA_UNICODE_STRING
End Structureimport ctypes
from ctypes import wintypes
class LSA_UNICODE_STRING(ctypes.Structure):
_fields_ = [
("Length", ctypes.c_ushort),
("MaximumLength", ctypes.c_ushort),
("Buffer", ctypes.c_void_p),
]
class MSV1_0_LM20_LOGON_PROFILE(ctypes.Structure):
_fields_ = [
("MessageType", ctypes.c_int),
("KickOffTime", ctypes.c_longlong),
("LogoffTime", ctypes.c_longlong),
("UserFlags", wintypes.DWORD),
("UserSessionKey", ctypes.c_ubyte * 16),
("LogonDomainName", LSA_UNICODE_STRING),
("LanmanSessionKey", ctypes.c_ubyte * 8),
("LogonServer", LSA_UNICODE_STRING),
("UserParameters", LSA_UNICODE_STRING),
]#[repr(C)]
pub struct LSA_UNICODE_STRING {
pub Length: u16,
pub MaximumLength: u16,
pub Buffer: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct MSV1_0_LM20_LOGON_PROFILE {
pub MessageType: i32,
pub KickOffTime: i64,
pub LogoffTime: i64,
pub UserFlags: u32,
pub UserSessionKey: [u8; 16],
pub LogonDomainName: LSA_UNICODE_STRING,
pub LanmanSessionKey: [u8; 8],
pub LogonServer: LSA_UNICODE_STRING,
pub UserParameters: LSA_UNICODE_STRING,
}import "golang.org/x/sys/windows"
type LSA_UNICODE_STRING struct {
Length uint16
MaximumLength uint16
Buffer uintptr
}
type MSV1_0_LM20_LOGON_PROFILE struct {
MessageType int32
KickOffTime int64
LogoffTime int64
UserFlags uint32
UserSessionKey [16]byte
LogonDomainName LSA_UNICODE_STRING
LanmanSessionKey [8]byte
LogonServer LSA_UNICODE_STRING
UserParameters LSA_UNICODE_STRING
}type
LSA_UNICODE_STRING = record
Length: Word;
MaximumLength: Word;
Buffer: Pointer;
end;
MSV1_0_LM20_LOGON_PROFILE = record
MessageType: Integer;
KickOffTime: Int64;
LogoffTime: Int64;
UserFlags: DWORD;
UserSessionKey: array[0..15] of Byte;
LogonDomainName: LSA_UNICODE_STRING;
LanmanSessionKey: array[0..7] of Byte;
LogonServer: LSA_UNICODE_STRING;
UserParameters: LSA_UNICODE_STRING;
end;const LSA_UNICODE_STRING = extern struct {
Length: u16,
MaximumLength: u16,
Buffer: ?*anyopaque,
};
const MSV1_0_LM20_LOGON_PROFILE = extern struct {
MessageType: i32,
KickOffTime: i64,
LogoffTime: i64,
UserFlags: u32,
UserSessionKey: [16]u8,
LogonDomainName: LSA_UNICODE_STRING,
LanmanSessionKey: [8]u8,
LogonServer: LSA_UNICODE_STRING,
UserParameters: LSA_UNICODE_STRING,
};type
LSA_UNICODE_STRING {.bycopy.} = object
Length: uint16
MaximumLength: uint16
Buffer: pointer
MSV1_0_LM20_LOGON_PROFILE {.bycopy.} = object
MessageType: int32
KickOffTime: int64
LogoffTime: int64
UserFlags: uint32
UserSessionKey: array[16, uint8]
LogonDomainName: LSA_UNICODE_STRING
LanmanSessionKey: array[8, uint8]
LogonServer: LSA_UNICODE_STRING
UserParameters: LSA_UNICODE_STRINGstruct LSA_UNICODE_STRING
{
ushort Length;
ushort MaximumLength;
void* Buffer;
}
struct MSV1_0_LM20_LOGON_PROFILE
{
int MessageType;
long KickOffTime;
long LogoffTime;
uint UserFlags;
ubyte[16] UserSessionKey;
LSA_UNICODE_STRING LogonDomainName;
ubyte[8] LanmanSessionKey;
LSA_UNICODE_STRING LogonServer;
LSA_UNICODE_STRING UserParameters;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MSV1_0_LM20_LOGON_PROFILE サイズ: 80 バイト(x86)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; MessageType : MSV1_0_PROFILE_BUFFER_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; KickOffTime : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; LogoffTime : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; UserFlags : MSV_SUB_AUTHENTICATION_FILTER (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; UserSessionKey : BYTE (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; LogonDomainName : LSA_UNICODE_STRING (+44, 8byte) varptr(st)+44 を基点に操作(8byte:入れ子/配列)
; LanmanSessionKey : BYTE (+52, 8byte) varptr(st)+52 を基点に操作(8byte:入れ子/配列)
; LogonServer : LSA_UNICODE_STRING (+60, 8byte) varptr(st)+60 を基点に操作(8byte:入れ子/配列)
; UserParameters : LSA_UNICODE_STRING (+68, 8byte) varptr(st)+68 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MSV1_0_LM20_LOGON_PROFILE サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; MessageType : MSV1_0_PROFILE_BUFFER_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; KickOffTime : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; LogoffTime : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; UserFlags : MSV_SUB_AUTHENTICATION_FILTER (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; UserSessionKey : BYTE (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; LogonDomainName : LSA_UNICODE_STRING (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; LanmanSessionKey : BYTE (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; LogonServer : LSA_UNICODE_STRING (+72, 16byte) varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; UserParameters : LSA_UNICODE_STRING (+88, 16byte) varptr(st)+88 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LSA_UNICODE_STRING
#field short Length
#field short MaximumLength
#field intptr Buffer
#endstruct
#defstruct global MSV1_0_LM20_LOGON_PROFILE
#field int MessageType
#field int64 KickOffTime
#field int64 LogoffTime
#field int UserFlags
#field byte UserSessionKey 16
#field LSA_UNICODE_STRING LogonDomainName
#field byte LanmanSessionKey 8
#field LSA_UNICODE_STRING LogonServer
#field LSA_UNICODE_STRING UserParameters
#endstruct
stdim st, MSV1_0_LM20_LOGON_PROFILE ; NSTRUCT 変数を確保
st->MessageType = 100
mes "MessageType=" + st->MessageType