ホーム › Security.Authentication.Identity › SECPKG_KERNEL_FUNCTIONS
SECPKG_KERNEL_FUNCTIONS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AllocateHeap | PLSA_ALLOCATE_LSA_HEAP | 8/4 | +0 | +0 | カーネルモードでヒープメモリを割り当てる関数へのポインタ。 |
| FreeHeap | PLSA_FREE_LSA_HEAP | 8/4 | +8 | +4 | カーネルモードでヒープメモリを解放する関数へのポインタ。 |
| CreateContextList | PKSEC_CREATE_CONTEXT_LIST | 8/4 | +16 | +8 | コンテキストリストを作成する関数へのポインタ。 |
| InsertListEntry | PKSEC_INSERT_LIST_ENTRY | 8/4 | +24 | +12 | リストにエントリを挿入する関数へのポインタ。 |
| ReferenceListEntry | PKSEC_REFERENCE_LIST_ENTRY | 8/4 | +32 | +16 | リストエントリの参照を取得する関数へのポインタ。 |
| DereferenceListEntry | PKSEC_DEREFERENCE_LIST_ENTRY | 8/4 | +40 | +20 | リストエントリの参照を解放する関数へのポインタ。 |
| SerializeWinntAuthData | PKSEC_SERIALIZE_WINNT_AUTH_DATA | 8/4 | +48 | +24 | WinNT認証データをシリアライズする関数へのポインタ。 |
| SerializeSchannelAuthData | PKSEC_SERIALIZE_SCHANNEL_AUTH_DATA | 8/4 | +56 | +28 | Schannel認証データをシリアライズする関数へのポインタ。 |
| LocatePackageById | PKSEC_LOCATE_PKG_BY_ID | 8/4 | +64 | +32 | IDによりパッケージを特定する関数へのポインタ。 |
各言語での定義
#include <windows.h>
// SECPKG_KERNEL_FUNCTIONS (x64 72 / x86 36 バイト)
typedef struct SECPKG_KERNEL_FUNCTIONS {
PLSA_ALLOCATE_LSA_HEAP AllocateHeap;
PLSA_FREE_LSA_HEAP FreeHeap;
PKSEC_CREATE_CONTEXT_LIST CreateContextList;
PKSEC_INSERT_LIST_ENTRY InsertListEntry;
PKSEC_REFERENCE_LIST_ENTRY ReferenceListEntry;
PKSEC_DEREFERENCE_LIST_ENTRY DereferenceListEntry;
PKSEC_SERIALIZE_WINNT_AUTH_DATA SerializeWinntAuthData;
PKSEC_SERIALIZE_SCHANNEL_AUTH_DATA SerializeSchannelAuthData;
PKSEC_LOCATE_PKG_BY_ID LocatePackageById;
} SECPKG_KERNEL_FUNCTIONS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECPKG_KERNEL_FUNCTIONS
{
public IntPtr AllocateHeap;
public IntPtr FreeHeap;
public IntPtr CreateContextList;
public IntPtr InsertListEntry;
public IntPtr ReferenceListEntry;
public IntPtr DereferenceListEntry;
public IntPtr SerializeWinntAuthData;
public IntPtr SerializeSchannelAuthData;
public IntPtr LocatePackageById;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECPKG_KERNEL_FUNCTIONS
Public AllocateHeap As IntPtr
Public FreeHeap As IntPtr
Public CreateContextList As IntPtr
Public InsertListEntry As IntPtr
Public ReferenceListEntry As IntPtr
Public DereferenceListEntry As IntPtr
Public SerializeWinntAuthData As IntPtr
Public SerializeSchannelAuthData As IntPtr
Public LocatePackageById As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class SECPKG_KERNEL_FUNCTIONS(ctypes.Structure):
_fields_ = [
("AllocateHeap", ctypes.c_void_p),
("FreeHeap", ctypes.c_void_p),
("CreateContextList", ctypes.c_void_p),
("InsertListEntry", ctypes.c_void_p),
("ReferenceListEntry", ctypes.c_void_p),
("DereferenceListEntry", ctypes.c_void_p),
("SerializeWinntAuthData", ctypes.c_void_p),
("SerializeSchannelAuthData", ctypes.c_void_p),
("LocatePackageById", ctypes.c_void_p),
]#[repr(C)]
pub struct SECPKG_KERNEL_FUNCTIONS {
pub AllocateHeap: *mut core::ffi::c_void,
pub FreeHeap: *mut core::ffi::c_void,
pub CreateContextList: *mut core::ffi::c_void,
pub InsertListEntry: *mut core::ffi::c_void,
pub ReferenceListEntry: *mut core::ffi::c_void,
pub DereferenceListEntry: *mut core::ffi::c_void,
pub SerializeWinntAuthData: *mut core::ffi::c_void,
pub SerializeSchannelAuthData: *mut core::ffi::c_void,
pub LocatePackageById: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type SECPKG_KERNEL_FUNCTIONS struct {
AllocateHeap uintptr
FreeHeap uintptr
CreateContextList uintptr
InsertListEntry uintptr
ReferenceListEntry uintptr
DereferenceListEntry uintptr
SerializeWinntAuthData uintptr
SerializeSchannelAuthData uintptr
LocatePackageById uintptr
}type
SECPKG_KERNEL_FUNCTIONS = record
AllocateHeap: Pointer;
FreeHeap: Pointer;
CreateContextList: Pointer;
InsertListEntry: Pointer;
ReferenceListEntry: Pointer;
DereferenceListEntry: Pointer;
SerializeWinntAuthData: Pointer;
SerializeSchannelAuthData: Pointer;
LocatePackageById: Pointer;
end;const SECPKG_KERNEL_FUNCTIONS = extern struct {
AllocateHeap: ?*anyopaque,
FreeHeap: ?*anyopaque,
CreateContextList: ?*anyopaque,
InsertListEntry: ?*anyopaque,
ReferenceListEntry: ?*anyopaque,
DereferenceListEntry: ?*anyopaque,
SerializeWinntAuthData: ?*anyopaque,
SerializeSchannelAuthData: ?*anyopaque,
LocatePackageById: ?*anyopaque,
};type
SECPKG_KERNEL_FUNCTIONS {.bycopy.} = object
AllocateHeap: pointer
FreeHeap: pointer
CreateContextList: pointer
InsertListEntry: pointer
ReferenceListEntry: pointer
DereferenceListEntry: pointer
SerializeWinntAuthData: pointer
SerializeSchannelAuthData: pointer
LocatePackageById: pointerstruct SECPKG_KERNEL_FUNCTIONS
{
void* AllocateHeap;
void* FreeHeap;
void* CreateContextList;
void* InsertListEntry;
void* ReferenceListEntry;
void* DereferenceListEntry;
void* SerializeWinntAuthData;
void* SerializeSchannelAuthData;
void* LocatePackageById;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SECPKG_KERNEL_FUNCTIONS サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; AllocateHeap : PLSA_ALLOCATE_LSA_HEAP (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; FreeHeap : PLSA_FREE_LSA_HEAP (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CreateContextList : PKSEC_CREATE_CONTEXT_LIST (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; InsertListEntry : PKSEC_INSERT_LIST_ENTRY (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ReferenceListEntry : PKSEC_REFERENCE_LIST_ENTRY (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DereferenceListEntry : PKSEC_DEREFERENCE_LIST_ENTRY (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SerializeWinntAuthData : PKSEC_SERIALIZE_WINNT_AUTH_DATA (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; SerializeSchannelAuthData : PKSEC_SERIALIZE_SCHANNEL_AUTH_DATA (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; LocatePackageById : PKSEC_LOCATE_PKG_BY_ID (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECPKG_KERNEL_FUNCTIONS サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; AllocateHeap : PLSA_ALLOCATE_LSA_HEAP (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; FreeHeap : PLSA_FREE_LSA_HEAP (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; CreateContextList : PKSEC_CREATE_CONTEXT_LIST (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; InsertListEntry : PKSEC_INSERT_LIST_ENTRY (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ReferenceListEntry : PKSEC_REFERENCE_LIST_ENTRY (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; DereferenceListEntry : PKSEC_DEREFERENCE_LIST_ENTRY (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; SerializeWinntAuthData : PKSEC_SERIALIZE_WINNT_AUTH_DATA (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; SerializeSchannelAuthData : PKSEC_SERIALIZE_SCHANNEL_AUTH_DATA (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; LocatePackageById : PKSEC_LOCATE_PKG_BY_ID (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SECPKG_KERNEL_FUNCTIONS
#field intptr AllocateHeap
#field intptr FreeHeap
#field intptr CreateContextList
#field intptr InsertListEntry
#field intptr ReferenceListEntry
#field intptr DereferenceListEntry
#field intptr SerializeWinntAuthData
#field intptr SerializeSchannelAuthData
#field intptr LocatePackageById
#endstruct
stdim st, SECPKG_KERNEL_FUNCTIONS ; NSTRUCT 変数を確保