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

KERB_TICKET_UNLOCK_LOGON

構造体
サイズx64: 40 バイト / x86: 32 バイト

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

フィールド

フィールドサイズx64x86説明
LogonKERB_TICKET_LOGON32/24+0+0チケットログオン情報(KERB_TICKET_LOGON)。
LogonIdLUID8+32+24ロック解除対象のログオンセッションLUID。

各言語での定義

#include <windows.h>

// KERB_TICKET_LOGON  (x64 32 / x86 24 バイト)
typedef struct KERB_TICKET_LOGON {
    KERB_LOGON_SUBMIT_TYPE MessageType;
    DWORD Flags;
    DWORD ServiceTicketLength;
    DWORD TicketGrantingTicketLength;
    BYTE* ServiceTicket;
    BYTE* TicketGrantingTicket;
} KERB_TICKET_LOGON;

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

// KERB_TICKET_UNLOCK_LOGON  (x64 40 / x86 32 バイト)
typedef struct KERB_TICKET_UNLOCK_LOGON {
    KERB_TICKET_LOGON Logon;
    LUID LogonId;
} KERB_TICKET_UNLOCK_LOGON;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KERB_TICKET_LOGON
{
    public int MessageType;
    public uint Flags;
    public uint ServiceTicketLength;
    public uint TicketGrantingTicketLength;
    public IntPtr ServiceTicket;
    public IntPtr TicketGrantingTicket;
}

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KERB_TICKET_UNLOCK_LOGON
{
    public KERB_TICKET_LOGON Logon;
    public LUID LogonId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KERB_TICKET_LOGON
    Public MessageType As Integer
    Public Flags As UInteger
    Public ServiceTicketLength As UInteger
    Public TicketGrantingTicketLength As UInteger
    Public ServiceTicket As IntPtr
    Public TicketGrantingTicket As IntPtr
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_TICKET_UNLOCK_LOGON
    Public Logon As KERB_TICKET_LOGON
    Public LogonId As LUID
End Structure
import ctypes
from ctypes import wintypes

class KERB_TICKET_LOGON(ctypes.Structure):
    _fields_ = [
        ("MessageType", ctypes.c_int),
        ("Flags", wintypes.DWORD),
        ("ServiceTicketLength", wintypes.DWORD),
        ("TicketGrantingTicketLength", wintypes.DWORD),
        ("ServiceTicket", ctypes.c_void_p),
        ("TicketGrantingTicket", ctypes.c_void_p),
    ]

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

class KERB_TICKET_UNLOCK_LOGON(ctypes.Structure):
    _fields_ = [
        ("Logon", KERB_TICKET_LOGON),
        ("LogonId", LUID),
    ]
#[repr(C)]
pub struct KERB_TICKET_LOGON {
    pub MessageType: i32,
    pub Flags: u32,
    pub ServiceTicketLength: u32,
    pub TicketGrantingTicketLength: u32,
    pub ServiceTicket: *mut core::ffi::c_void,
    pub TicketGrantingTicket: *mut core::ffi::c_void,
}

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

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

type KERB_TICKET_LOGON struct {
	MessageType int32
	Flags uint32
	ServiceTicketLength uint32
	TicketGrantingTicketLength uint32
	ServiceTicket uintptr
	TicketGrantingTicket uintptr
}

type LUID struct {
	LowPart uint32
	HighPart int32
}

type KERB_TICKET_UNLOCK_LOGON struct {
	Logon KERB_TICKET_LOGON
	LogonId LUID
}
type
  KERB_TICKET_LOGON = record
    MessageType: Integer;
    Flags: DWORD;
    ServiceTicketLength: DWORD;
    TicketGrantingTicketLength: DWORD;
    ServiceTicket: Pointer;
    TicketGrantingTicket: Pointer;
  end;

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

  KERB_TICKET_UNLOCK_LOGON = record
    Logon: KERB_TICKET_LOGON;
    LogonId: LUID;
  end;
const KERB_TICKET_LOGON = extern struct {
    MessageType: i32,
    Flags: u32,
    ServiceTicketLength: u32,
    TicketGrantingTicketLength: u32,
    ServiceTicket: ?*anyopaque,
    TicketGrantingTicket: ?*anyopaque,
};

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

const KERB_TICKET_UNLOCK_LOGON = extern struct {
    Logon: KERB_TICKET_LOGON,
    LogonId: LUID,
};
type
  KERB_TICKET_LOGON {.bycopy.} = object
    MessageType: int32
    Flags: uint32
    ServiceTicketLength: uint32
    TicketGrantingTicketLength: uint32
    ServiceTicket: pointer
    TicketGrantingTicket: pointer

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

  KERB_TICKET_UNLOCK_LOGON {.bycopy.} = object
    Logon: KERB_TICKET_LOGON
    LogonId: LUID
struct KERB_TICKET_LOGON
{
    int MessageType;
    uint Flags;
    uint ServiceTicketLength;
    uint TicketGrantingTicketLength;
    void* ServiceTicket;
    void* TicketGrantingTicket;
}

struct LUID
{
    uint LowPart;
    int HighPart;
}

struct KERB_TICKET_UNLOCK_LOGON
{
    KERB_TICKET_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_TICKET_UNLOCK_LOGON サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Logon : KERB_TICKET_LOGON (+0, 24byte)  varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; LogonId : LUID (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KERB_TICKET_UNLOCK_LOGON サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Logon : KERB_TICKET_LOGON (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; LogonId : LUID (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global KERB_TICKET_LOGON
    #field int MessageType
    #field int Flags
    #field int ServiceTicketLength
    #field int TicketGrantingTicketLength
    #field intptr ServiceTicket
    #field intptr TicketGrantingTicket
#endstruct

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

#defstruct global KERB_TICKET_UNLOCK_LOGON
    #field KERB_TICKET_LOGON Logon
    #field LUID LogonId
#endstruct

stdim st, KERB_TICKET_UNLOCK_LOGON        ; NSTRUCT 変数を確保