ホーム › Security.Authentication.Identity › SECPKG_KERNEL_FUNCTION_TABLE
SECPKG_KERNEL_FUNCTION_TABLE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Initialize | KspInitPackageFn | 8/4 | +0 | +0 | カーネルモードのパッケージを初期化する関数へのポインタ。 |
| DeleteContext | KspDeleteContextFn | 8/4 | +8 | +4 | カーネルモードのコンテキストを削除する関数へのポインタ。 |
| InitContext | KspInitContextFn | 8/4 | +16 | +8 | カーネルモードのコンテキストを初期化する関数へのポインタ。 |
| MapHandle | KspMapHandleFn | 8/4 | +24 | +12 | ハンドルをマッピングする関数へのポインタ。 |
| Sign | KspMakeSignatureFn | 8/4 | +32 | +16 | メッセージに署名する関数へのポインタ。 |
| Verify | KspVerifySignatureFn | 8/4 | +40 | +20 | メッセージ署名を検証する関数へのポインタ。 |
| Seal | KspSealMessageFn | 8/4 | +48 | +24 | メッセージを封印(暗号化)する関数へのポインタ。 |
| Unseal | KspUnsealMessageFn | 8/4 | +56 | +28 | 封印されたメッセージを復号する関数へのポインタ。 |
| GetToken | KspGetTokenFn | 8/4 | +64 | +32 | コンテキストのトークンを取得する関数へのポインタ。 |
| QueryAttributes | KspQueryAttributesFn | 8/4 | +72 | +36 | コンテキスト属性を照会する関数へのポインタ。 |
| CompleteToken | KspCompleteTokenFn | 8/4 | +80 | +40 | トークンを完成させる関数へのポインタ。 |
| ExportContext | SpExportSecurityContextFn | 8/4 | +88 | +44 | セキュリティコンテキストをエクスポートする関数へのポインタ。 |
| ImportContext | SpImportSecurityContextFn | 8/4 | +96 | +48 | セキュリティコンテキストをインポートする関数へのポインタ。 |
| SetPackagePagingMode | KspSetPagingModeFn | 8/4 | +104 | +52 | パッケージのページングモードを設定する関数へのポインタ。 |
| SerializeAuthData | KspSerializeAuthDataFn | 8/4 | +112 | +56 | 認証データをシリアライズする関数へのポインタ。 |
各言語での定義
#include <windows.h>
// SECPKG_KERNEL_FUNCTION_TABLE (x64 120 / x86 60 バイト)
typedef struct SECPKG_KERNEL_FUNCTION_TABLE {
KspInitPackageFn Initialize;
KspDeleteContextFn DeleteContext;
KspInitContextFn InitContext;
KspMapHandleFn MapHandle;
KspMakeSignatureFn Sign;
KspVerifySignatureFn Verify;
KspSealMessageFn Seal;
KspUnsealMessageFn Unseal;
KspGetTokenFn GetToken;
KspQueryAttributesFn QueryAttributes;
KspCompleteTokenFn CompleteToken;
SpExportSecurityContextFn ExportContext;
SpImportSecurityContextFn ImportContext;
KspSetPagingModeFn SetPackagePagingMode;
KspSerializeAuthDataFn SerializeAuthData;
} SECPKG_KERNEL_FUNCTION_TABLE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECPKG_KERNEL_FUNCTION_TABLE
{
public IntPtr Initialize;
public IntPtr DeleteContext;
public IntPtr InitContext;
public IntPtr MapHandle;
public IntPtr Sign;
public IntPtr Verify;
public IntPtr Seal;
public IntPtr Unseal;
public IntPtr GetToken;
public IntPtr QueryAttributes;
public IntPtr CompleteToken;
public IntPtr ExportContext;
public IntPtr ImportContext;
public IntPtr SetPackagePagingMode;
public IntPtr SerializeAuthData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECPKG_KERNEL_FUNCTION_TABLE
Public Initialize As IntPtr
Public DeleteContext As IntPtr
Public InitContext As IntPtr
Public MapHandle As IntPtr
Public Sign As IntPtr
Public Verify As IntPtr
Public Seal As IntPtr
Public Unseal As IntPtr
Public GetToken As IntPtr
Public QueryAttributes As IntPtr
Public CompleteToken As IntPtr
Public ExportContext As IntPtr
Public ImportContext As IntPtr
Public SetPackagePagingMode As IntPtr
Public SerializeAuthData As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class SECPKG_KERNEL_FUNCTION_TABLE(ctypes.Structure):
_fields_ = [
("Initialize", ctypes.c_void_p),
("DeleteContext", ctypes.c_void_p),
("InitContext", ctypes.c_void_p),
("MapHandle", ctypes.c_void_p),
("Sign", ctypes.c_void_p),
("Verify", ctypes.c_void_p),
("Seal", ctypes.c_void_p),
("Unseal", ctypes.c_void_p),
("GetToken", ctypes.c_void_p),
("QueryAttributes", ctypes.c_void_p),
("CompleteToken", ctypes.c_void_p),
("ExportContext", ctypes.c_void_p),
("ImportContext", ctypes.c_void_p),
("SetPackagePagingMode", ctypes.c_void_p),
("SerializeAuthData", ctypes.c_void_p),
]#[repr(C)]
pub struct SECPKG_KERNEL_FUNCTION_TABLE {
pub Initialize: *mut core::ffi::c_void,
pub DeleteContext: *mut core::ffi::c_void,
pub InitContext: *mut core::ffi::c_void,
pub MapHandle: *mut core::ffi::c_void,
pub Sign: *mut core::ffi::c_void,
pub Verify: *mut core::ffi::c_void,
pub Seal: *mut core::ffi::c_void,
pub Unseal: *mut core::ffi::c_void,
pub GetToken: *mut core::ffi::c_void,
pub QueryAttributes: *mut core::ffi::c_void,
pub CompleteToken: *mut core::ffi::c_void,
pub ExportContext: *mut core::ffi::c_void,
pub ImportContext: *mut core::ffi::c_void,
pub SetPackagePagingMode: *mut core::ffi::c_void,
pub SerializeAuthData: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type SECPKG_KERNEL_FUNCTION_TABLE struct {
Initialize uintptr
DeleteContext uintptr
InitContext uintptr
MapHandle uintptr
Sign uintptr
Verify uintptr
Seal uintptr
Unseal uintptr
GetToken uintptr
QueryAttributes uintptr
CompleteToken uintptr
ExportContext uintptr
ImportContext uintptr
SetPackagePagingMode uintptr
SerializeAuthData uintptr
}type
SECPKG_KERNEL_FUNCTION_TABLE = record
Initialize: Pointer;
DeleteContext: Pointer;
InitContext: Pointer;
MapHandle: Pointer;
Sign: Pointer;
Verify: Pointer;
Seal: Pointer;
Unseal: Pointer;
GetToken: Pointer;
QueryAttributes: Pointer;
CompleteToken: Pointer;
ExportContext: Pointer;
ImportContext: Pointer;
SetPackagePagingMode: Pointer;
SerializeAuthData: Pointer;
end;const SECPKG_KERNEL_FUNCTION_TABLE = extern struct {
Initialize: ?*anyopaque,
DeleteContext: ?*anyopaque,
InitContext: ?*anyopaque,
MapHandle: ?*anyopaque,
Sign: ?*anyopaque,
Verify: ?*anyopaque,
Seal: ?*anyopaque,
Unseal: ?*anyopaque,
GetToken: ?*anyopaque,
QueryAttributes: ?*anyopaque,
CompleteToken: ?*anyopaque,
ExportContext: ?*anyopaque,
ImportContext: ?*anyopaque,
SetPackagePagingMode: ?*anyopaque,
SerializeAuthData: ?*anyopaque,
};type
SECPKG_KERNEL_FUNCTION_TABLE {.bycopy.} = object
Initialize: pointer
DeleteContext: pointer
InitContext: pointer
MapHandle: pointer
Sign: pointer
Verify: pointer
Seal: pointer
Unseal: pointer
GetToken: pointer
QueryAttributes: pointer
CompleteToken: pointer
ExportContext: pointer
ImportContext: pointer
SetPackagePagingMode: pointer
SerializeAuthData: pointerstruct SECPKG_KERNEL_FUNCTION_TABLE
{
void* Initialize;
void* DeleteContext;
void* InitContext;
void* MapHandle;
void* Sign;
void* Verify;
void* Seal;
void* Unseal;
void* GetToken;
void* QueryAttributes;
void* CompleteToken;
void* ExportContext;
void* ImportContext;
void* SetPackagePagingMode;
void* SerializeAuthData;
}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_FUNCTION_TABLE サイズ: 60 バイト(x86)
dim st, 15 ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; Initialize : KspInitPackageFn (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DeleteContext : KspDeleteContextFn (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; InitContext : KspInitContextFn (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MapHandle : KspMapHandleFn (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Sign : KspMakeSignatureFn (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Verify : KspVerifySignatureFn (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Seal : KspSealMessageFn (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Unseal : KspUnsealMessageFn (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; GetToken : KspGetTokenFn (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; QueryAttributes : KspQueryAttributesFn (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; CompleteToken : KspCompleteTokenFn (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ExportContext : SpExportSecurityContextFn (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ImportContext : SpImportSecurityContextFn (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; SetPackagePagingMode : KspSetPagingModeFn (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; SerializeAuthData : KspSerializeAuthDataFn (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECPKG_KERNEL_FUNCTION_TABLE サイズ: 120 バイト(x64)
dim st, 30 ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; Initialize : KspInitPackageFn (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; DeleteContext : KspDeleteContextFn (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; InitContext : KspInitContextFn (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; MapHandle : KspMapHandleFn (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; Sign : KspMakeSignatureFn (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Verify : KspVerifySignatureFn (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; Seal : KspSealMessageFn (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Unseal : KspUnsealMessageFn (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; GetToken : KspGetTokenFn (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; QueryAttributes : KspQueryAttributesFn (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; CompleteToken : KspCompleteTokenFn (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ExportContext : SpExportSecurityContextFn (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ImportContext : SpImportSecurityContextFn (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; SetPackagePagingMode : KspSetPagingModeFn (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; SerializeAuthData : KspSerializeAuthDataFn (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SECPKG_KERNEL_FUNCTION_TABLE
#field intptr Initialize
#field intptr DeleteContext
#field intptr InitContext
#field intptr MapHandle
#field intptr Sign
#field intptr Verify
#field intptr Seal
#field intptr Unseal
#field intptr GetToken
#field intptr QueryAttributes
#field intptr CompleteToken
#field intptr ExportContext
#field intptr ImportContext
#field intptr SetPackagePagingMode
#field intptr SerializeAuthData
#endstruct
stdim st, SECPKG_KERNEL_FUNCTION_TABLE ; NSTRUCT 変数を確保