ホーム › Security.Authentication.Identity › KERB_SETPASSWORD_EX_REQUEST
KERB_SETPASSWORD_EX_REQUEST
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MessageType | KERB_PROTOCOL_MESSAGE_TYPE | 4 | +0 | +0 | Kerberos要求種別を示す値で、KerbSetPasswordExMessage を指定する。 |
| LogonId | LUID | 8 | +4 | +4 | 対象ログオンセッションを識別するLUID。現在のセッションはゼロを指定する。 |
| CredentialsHandle | SecHandle | 16/8 | +16 | +12 | パスワード変更に用いる資格情報を参照するSecHandle。 |
| Flags | DWORD | 4 | +32 | +20 | 操作挙動を制御するビットフラグ。通常はゼロで予約されている。 |
| AccountRealm | LSA_UNICODE_STRING | 16/8 | +40 | +24 | 対象アカウントが属するKerberosレルム名を保持するUnicode文字列。 |
| AccountName | LSA_UNICODE_STRING | 16/8 | +56 | +32 | パスワードを設定する対象アカウント名を保持するUnicode文字列。 |
| Password | LSA_UNICODE_STRING | 16/8 | +72 | +40 | 設定する新しい平文パスワードを保持するUnicode文字列。 |
| ClientRealm | LSA_UNICODE_STRING | 16/8 | +88 | +48 | 要求元クライアントが属するレルム名を保持するUnicode文字列。 |
| ClientName | LSA_UNICODE_STRING | 16/8 | +104 | +56 | 要求元クライアントのプリンシパル名を保持するUnicode文字列。 |
| Impersonating | BOOLEAN | 1 | +120 | +64 | 呼び出しスレッドが他者になりすまし中かを示す真偽値。TRUEで偽装中を表す。 |
| KdcAddress | LSA_UNICODE_STRING | 16/8 | +128 | +68 | 対象レルムのKDCアドレスを保持するUnicode文字列。 |
| KdcAddressType | DWORD | 4 | +144 | +76 | KdcAddressのアドレス種別を示す値。DS_INET_ADDRESS等を指定する。 |
各言語での定義
#include <windows.h>
// LUID (x64 8 / x86 8 バイト)
typedef struct LUID {
DWORD LowPart;
INT HighPart;
} LUID;
// SecHandle (x64 16 / x86 8 バイト)
typedef struct SecHandle {
UINT_PTR dwLower;
UINT_PTR dwUpper;
} SecHandle;
// LSA_UNICODE_STRING (x64 16 / x86 8 バイト)
typedef struct LSA_UNICODE_STRING {
WORD Length;
WORD MaximumLength;
LPWSTR Buffer;
} LSA_UNICODE_STRING;
// KERB_SETPASSWORD_EX_REQUEST (x64 152 / x86 80 バイト)
typedef struct KERB_SETPASSWORD_EX_REQUEST {
KERB_PROTOCOL_MESSAGE_TYPE MessageType;
LUID LogonId;
SecHandle CredentialsHandle;
DWORD Flags;
LSA_UNICODE_STRING AccountRealm;
LSA_UNICODE_STRING AccountName;
LSA_UNICODE_STRING Password;
LSA_UNICODE_STRING ClientRealm;
LSA_UNICODE_STRING ClientName;
BOOLEAN Impersonating;
LSA_UNICODE_STRING KdcAddress;
DWORD KdcAddressType;
} KERB_SETPASSWORD_EX_REQUEST;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LUID
{
public uint LowPart;
public int HighPart;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecHandle
{
public UIntPtr dwLower;
public UIntPtr dwUpper;
}
[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_SETPASSWORD_EX_REQUEST
{
public int MessageType;
public LUID LogonId;
public SecHandle CredentialsHandle;
public uint Flags;
public LSA_UNICODE_STRING AccountRealm;
public LSA_UNICODE_STRING AccountName;
public LSA_UNICODE_STRING Password;
public LSA_UNICODE_STRING ClientRealm;
public LSA_UNICODE_STRING ClientName;
[MarshalAs(UnmanagedType.U1)] public bool Impersonating;
public LSA_UNICODE_STRING KdcAddress;
public uint KdcAddressType;
}Imports System.Runtime.InteropServices
<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 SecHandle
Public dwLower As UIntPtr
Public dwUpper As UIntPtr
End Structure
<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_SETPASSWORD_EX_REQUEST
Public MessageType As Integer
Public LogonId As LUID
Public CredentialsHandle As SecHandle
Public Flags As UInteger
Public AccountRealm As LSA_UNICODE_STRING
Public AccountName As LSA_UNICODE_STRING
Public Password As LSA_UNICODE_STRING
Public ClientRealm As LSA_UNICODE_STRING
Public ClientName As LSA_UNICODE_STRING
<MarshalAs(UnmanagedType.U1)> Public Impersonating As Boolean
Public KdcAddress As LSA_UNICODE_STRING
Public KdcAddressType As UInteger
End Structureimport ctypes
from ctypes import wintypes
class LUID(ctypes.Structure):
_fields_ = [
("LowPart", wintypes.DWORD),
("HighPart", ctypes.c_int),
]
class SecHandle(ctypes.Structure):
_fields_ = [
("dwLower", ctypes.c_size_t),
("dwUpper", ctypes.c_size_t),
]
class LSA_UNICODE_STRING(ctypes.Structure):
_fields_ = [
("Length", ctypes.c_ushort),
("MaximumLength", ctypes.c_ushort),
("Buffer", ctypes.c_void_p),
]
class KERB_SETPASSWORD_EX_REQUEST(ctypes.Structure):
_fields_ = [
("MessageType", ctypes.c_int),
("LogonId", LUID),
("CredentialsHandle", SecHandle),
("Flags", wintypes.DWORD),
("AccountRealm", LSA_UNICODE_STRING),
("AccountName", LSA_UNICODE_STRING),
("Password", LSA_UNICODE_STRING),
("ClientRealm", LSA_UNICODE_STRING),
("ClientName", LSA_UNICODE_STRING),
("Impersonating", ctypes.c_byte),
("KdcAddress", LSA_UNICODE_STRING),
("KdcAddressType", wintypes.DWORD),
]#[repr(C)]
pub struct LUID {
pub LowPart: u32,
pub HighPart: i32,
}
#[repr(C)]
pub struct SecHandle {
pub dwLower: usize,
pub dwUpper: usize,
}
#[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_SETPASSWORD_EX_REQUEST {
pub MessageType: i32,
pub LogonId: LUID,
pub CredentialsHandle: SecHandle,
pub Flags: u32,
pub AccountRealm: LSA_UNICODE_STRING,
pub AccountName: LSA_UNICODE_STRING,
pub Password: LSA_UNICODE_STRING,
pub ClientRealm: LSA_UNICODE_STRING,
pub ClientName: LSA_UNICODE_STRING,
pub Impersonating: u8,
pub KdcAddress: LSA_UNICODE_STRING,
pub KdcAddressType: u32,
}import "golang.org/x/sys/windows"
type LUID struct {
LowPart uint32
HighPart int32
}
type SecHandle struct {
dwLower uintptr
dwUpper uintptr
}
type LSA_UNICODE_STRING struct {
Length uint16
MaximumLength uint16
Buffer uintptr
}
type KERB_SETPASSWORD_EX_REQUEST struct {
MessageType int32
LogonId LUID
CredentialsHandle SecHandle
Flags uint32
AccountRealm LSA_UNICODE_STRING
AccountName LSA_UNICODE_STRING
Password LSA_UNICODE_STRING
ClientRealm LSA_UNICODE_STRING
ClientName LSA_UNICODE_STRING
Impersonating byte
KdcAddress LSA_UNICODE_STRING
KdcAddressType uint32
}type
LUID = record
LowPart: DWORD;
HighPart: Integer;
end;
SecHandle = record
dwLower: NativeUInt;
dwUpper: NativeUInt;
end;
LSA_UNICODE_STRING = record
Length: Word;
MaximumLength: Word;
Buffer: Pointer;
end;
KERB_SETPASSWORD_EX_REQUEST = record
MessageType: Integer;
LogonId: LUID;
CredentialsHandle: SecHandle;
Flags: DWORD;
AccountRealm: LSA_UNICODE_STRING;
AccountName: LSA_UNICODE_STRING;
Password: LSA_UNICODE_STRING;
ClientRealm: LSA_UNICODE_STRING;
ClientName: LSA_UNICODE_STRING;
Impersonating: ByteBool;
KdcAddress: LSA_UNICODE_STRING;
KdcAddressType: DWORD;
end;const LUID = extern struct {
LowPart: u32,
HighPart: i32,
};
const SecHandle = extern struct {
dwLower: usize,
dwUpper: usize,
};
const LSA_UNICODE_STRING = extern struct {
Length: u16,
MaximumLength: u16,
Buffer: ?*anyopaque,
};
const KERB_SETPASSWORD_EX_REQUEST = extern struct {
MessageType: i32,
LogonId: LUID,
CredentialsHandle: SecHandle,
Flags: u32,
AccountRealm: LSA_UNICODE_STRING,
AccountName: LSA_UNICODE_STRING,
Password: LSA_UNICODE_STRING,
ClientRealm: LSA_UNICODE_STRING,
ClientName: LSA_UNICODE_STRING,
Impersonating: u8,
KdcAddress: LSA_UNICODE_STRING,
KdcAddressType: u32,
};type
LUID {.bycopy.} = object
LowPart: uint32
HighPart: int32
SecHandle {.bycopy.} = object
dwLower: uint
dwUpper: uint
LSA_UNICODE_STRING {.bycopy.} = object
Length: uint16
MaximumLength: uint16
Buffer: pointer
KERB_SETPASSWORD_EX_REQUEST {.bycopy.} = object
MessageType: int32
LogonId: LUID
CredentialsHandle: SecHandle
Flags: uint32
AccountRealm: LSA_UNICODE_STRING
AccountName: LSA_UNICODE_STRING
Password: LSA_UNICODE_STRING
ClientRealm: LSA_UNICODE_STRING
ClientName: LSA_UNICODE_STRING
Impersonating: uint8
KdcAddress: LSA_UNICODE_STRING
KdcAddressType: uint32struct LUID
{
uint LowPart;
int HighPart;
}
struct SecHandle
{
size_t dwLower;
size_t dwUpper;
}
struct LSA_UNICODE_STRING
{
ushort Length;
ushort MaximumLength;
void* Buffer;
}
struct KERB_SETPASSWORD_EX_REQUEST
{
int MessageType;
LUID LogonId;
SecHandle CredentialsHandle;
uint Flags;
LSA_UNICODE_STRING AccountRealm;
LSA_UNICODE_STRING AccountName;
LSA_UNICODE_STRING Password;
LSA_UNICODE_STRING ClientRealm;
LSA_UNICODE_STRING ClientName;
ubyte Impersonating;
LSA_UNICODE_STRING KdcAddress;
uint KdcAddressType;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KERB_SETPASSWORD_EX_REQUEST サイズ: 80 バイト(x86)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; MessageType : KERB_PROTOCOL_MESSAGE_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; LogonId : LUID (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; CredentialsHandle : SecHandle (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; Flags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; AccountRealm : LSA_UNICODE_STRING (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; AccountName : LSA_UNICODE_STRING (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; Password : LSA_UNICODE_STRING (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; ClientRealm : LSA_UNICODE_STRING (+48, 8byte) varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; ClientName : LSA_UNICODE_STRING (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; Impersonating : BOOLEAN (+64, 1byte) poke st,64,値 / 値 = peek(st,64)
; KdcAddress : LSA_UNICODE_STRING (+68, 8byte) varptr(st)+68 を基点に操作(8byte:入れ子/配列)
; KdcAddressType : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KERB_SETPASSWORD_EX_REQUEST サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; MessageType : KERB_PROTOCOL_MESSAGE_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; LogonId : LUID (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; CredentialsHandle : SecHandle (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; Flags : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; AccountRealm : LSA_UNICODE_STRING (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; AccountName : LSA_UNICODE_STRING (+56, 16byte) varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; Password : LSA_UNICODE_STRING (+72, 16byte) varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; ClientRealm : LSA_UNICODE_STRING (+88, 16byte) varptr(st)+88 を基点に操作(16byte:入れ子/配列)
; ClientName : LSA_UNICODE_STRING (+104, 16byte) varptr(st)+104 を基点に操作(16byte:入れ子/配列)
; Impersonating : BOOLEAN (+120, 1byte) poke st,120,値 / 値 = peek(st,120)
; KdcAddress : LSA_UNICODE_STRING (+128, 16byte) varptr(st)+128 を基点に操作(16byte:入れ子/配列)
; KdcAddressType : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LUID
#field int LowPart
#field int HighPart
#endstruct
#defstruct global SecHandle
#field intptr dwLower
#field intptr dwUpper
#endstruct
#defstruct global LSA_UNICODE_STRING
#field short Length
#field short MaximumLength
#field intptr Buffer
#endstruct
#defstruct global KERB_SETPASSWORD_EX_REQUEST
#field int MessageType
#field LUID LogonId
#field SecHandle CredentialsHandle
#field int Flags
#field LSA_UNICODE_STRING AccountRealm
#field LSA_UNICODE_STRING AccountName
#field LSA_UNICODE_STRING Password
#field LSA_UNICODE_STRING ClientRealm
#field LSA_UNICODE_STRING ClientName
#field bool1 Impersonating
#field LSA_UNICODE_STRING KdcAddress
#field int KdcAddressType
#endstruct
stdim st, KERB_SETPASSWORD_EX_REQUEST ; NSTRUCT 変数を確保
st->MessageType = 100
mes "MessageType=" + st->MessageType