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

KERB_INTERACTIVE_UNLOCK_LOGON

構造体
サイズx64: 64 バイト / x86: 36 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
LogonKERB_INTERACTIVE_LOGON56/28+0+0対話ログオン情報(KERB_INTERACTIVE_LOGON)。
LogonIdLUID8+56+28ロック解除対象のログオンセッションLUID。

各言語での定義

#include <windows.h>

// LSA_UNICODE_STRING  (x64 16 / x86 8 バイト)
typedef struct LSA_UNICODE_STRING {
    WORD Length;
    WORD MaximumLength;
    LPWSTR Buffer;
} LSA_UNICODE_STRING;

// KERB_INTERACTIVE_LOGON  (x64 56 / x86 28 バイト)
typedef struct KERB_INTERACTIVE_LOGON {
    KERB_LOGON_SUBMIT_TYPE MessageType;
    LSA_UNICODE_STRING LogonDomainName;
    LSA_UNICODE_STRING UserName;
    LSA_UNICODE_STRING Password;
} KERB_INTERACTIVE_LOGON;

// LUID  (x64 8 / x86 8 バイト)
typedef struct LUID {
    DWORD LowPart;
    INT HighPart;
} LUID;

// KERB_INTERACTIVE_UNLOCK_LOGON  (x64 64 / x86 36 バイト)
typedef struct KERB_INTERACTIVE_UNLOCK_LOGON {
    KERB_INTERACTIVE_LOGON Logon;
    LUID LogonId;
} KERB_INTERACTIVE_UNLOCK_LOGON;
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 KERB_INTERACTIVE_LOGON
{
    public int MessageType;
    public LSA_UNICODE_STRING LogonDomainName;
    public LSA_UNICODE_STRING UserName;
    public LSA_UNICODE_STRING Password;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LUID
{
    public uint LowPart;
    public int HighPart;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KERB_INTERACTIVE_UNLOCK_LOGON
{
    public KERB_INTERACTIVE_LOGON Logon;
    public LUID LogonId;
}
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 KERB_INTERACTIVE_LOGON
    Public MessageType As Integer
    Public LogonDomainName As LSA_UNICODE_STRING
    Public UserName As LSA_UNICODE_STRING
    Public Password As LSA_UNICODE_STRING
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LUID
    Public LowPart As UInteger
    Public HighPart As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KERB_INTERACTIVE_UNLOCK_LOGON
    Public Logon As KERB_INTERACTIVE_LOGON
    Public LogonId As LUID
End Structure
import 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 KERB_INTERACTIVE_LOGON(ctypes.Structure):
    _fields_ = [
        ("MessageType", ctypes.c_int),
        ("LogonDomainName", LSA_UNICODE_STRING),
        ("UserName", LSA_UNICODE_STRING),
        ("Password", LSA_UNICODE_STRING),
    ]

class LUID(ctypes.Structure):
    _fields_ = [
        ("LowPart", wintypes.DWORD),
        ("HighPart", ctypes.c_int),
    ]

class KERB_INTERACTIVE_UNLOCK_LOGON(ctypes.Structure):
    _fields_ = [
        ("Logon", KERB_INTERACTIVE_LOGON),
        ("LogonId", LUID),
    ]
#[repr(C)]
pub struct LSA_UNICODE_STRING {
    pub Length: u16,
    pub MaximumLength: u16,
    pub Buffer: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct KERB_INTERACTIVE_LOGON {
    pub MessageType: i32,
    pub LogonDomainName: LSA_UNICODE_STRING,
    pub UserName: LSA_UNICODE_STRING,
    pub Password: LSA_UNICODE_STRING,
}

#[repr(C)]
pub struct LUID {
    pub LowPart: u32,
    pub HighPart: i32,
}

#[repr(C)]
pub struct KERB_INTERACTIVE_UNLOCK_LOGON {
    pub Logon: KERB_INTERACTIVE_LOGON,
    pub LogonId: LUID,
}
import "golang.org/x/sys/windows"

type LSA_UNICODE_STRING struct {
	Length uint16
	MaximumLength uint16
	Buffer uintptr
}

type KERB_INTERACTIVE_LOGON struct {
	MessageType int32
	LogonDomainName LSA_UNICODE_STRING
	UserName LSA_UNICODE_STRING
	Password LSA_UNICODE_STRING
}

type LUID struct {
	LowPart uint32
	HighPart int32
}

type KERB_INTERACTIVE_UNLOCK_LOGON struct {
	Logon KERB_INTERACTIVE_LOGON
	LogonId LUID
}
type
  LSA_UNICODE_STRING = record
    Length: Word;
    MaximumLength: Word;
    Buffer: Pointer;
  end;

  KERB_INTERACTIVE_LOGON = record
    MessageType: Integer;
    LogonDomainName: LSA_UNICODE_STRING;
    UserName: LSA_UNICODE_STRING;
    Password: LSA_UNICODE_STRING;
  end;

  LUID = record
    LowPart: DWORD;
    HighPart: Integer;
  end;

  KERB_INTERACTIVE_UNLOCK_LOGON = record
    Logon: KERB_INTERACTIVE_LOGON;
    LogonId: LUID;
  end;
const LSA_UNICODE_STRING = extern struct {
    Length: u16,
    MaximumLength: u16,
    Buffer: ?*anyopaque,
};

const KERB_INTERACTIVE_LOGON = extern struct {
    MessageType: i32,
    LogonDomainName: LSA_UNICODE_STRING,
    UserName: LSA_UNICODE_STRING,
    Password: LSA_UNICODE_STRING,
};

const LUID = extern struct {
    LowPart: u32,
    HighPart: i32,
};

const KERB_INTERACTIVE_UNLOCK_LOGON = extern struct {
    Logon: KERB_INTERACTIVE_LOGON,
    LogonId: LUID,
};
type
  LSA_UNICODE_STRING {.bycopy.} = object
    Length: uint16
    MaximumLength: uint16
    Buffer: pointer

  KERB_INTERACTIVE_LOGON {.bycopy.} = object
    MessageType: int32
    LogonDomainName: LSA_UNICODE_STRING
    UserName: LSA_UNICODE_STRING
    Password: LSA_UNICODE_STRING

  LUID {.bycopy.} = object
    LowPart: uint32
    HighPart: int32

  KERB_INTERACTIVE_UNLOCK_LOGON {.bycopy.} = object
    Logon: KERB_INTERACTIVE_LOGON
    LogonId: LUID
struct LSA_UNICODE_STRING
{
    ushort Length;
    ushort MaximumLength;
    void* Buffer;
}

struct KERB_INTERACTIVE_LOGON
{
    int MessageType;
    LSA_UNICODE_STRING LogonDomainName;
    LSA_UNICODE_STRING UserName;
    LSA_UNICODE_STRING Password;
}

struct LUID
{
    uint LowPart;
    int HighPart;
}

struct KERB_INTERACTIVE_UNLOCK_LOGON
{
    KERB_INTERACTIVE_LOGON Logon;
    LUID LogonId;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KERB_INTERACTIVE_UNLOCK_LOGON サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; Logon : KERB_INTERACTIVE_LOGON (+0, 28byte)  varptr(st)+0 を基点に操作(28byte:入れ子/配列)
; LogonId : LUID (+28, 8byte)  varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KERB_INTERACTIVE_UNLOCK_LOGON サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; Logon : KERB_INTERACTIVE_LOGON (+0, 56byte)  varptr(st)+0 を基点に操作(56byte:入れ子/配列)
; LogonId : LUID (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※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 KERB_INTERACTIVE_LOGON
    #field int MessageType
    #field LSA_UNICODE_STRING LogonDomainName
    #field LSA_UNICODE_STRING UserName
    #field LSA_UNICODE_STRING Password
#endstruct

#defstruct global LUID
    #field int LowPart
    #field int HighPart
#endstruct

#defstruct global KERB_INTERACTIVE_UNLOCK_LOGON
    #field KERB_INTERACTIVE_LOGON Logon
    #field LUID LogonId
#endstruct

stdim st, KERB_INTERACTIVE_UNLOCK_LOGON        ; NSTRUCT 変数を確保