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

SECPKG_USER_FUNCTION_TABLE

構造体
サイズx64: 120 バイト / x86: 60 バイト

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

フィールド

フィールドサイズx64x86説明
InstanceInitSpInstanceInitFn8/4+0+0ユーザーモードインスタンスを初期化する関数へのポインタ。
InitUserModeContextSpInitUserModeContextFn8/4+8+4ユーザーモードのセキュリティコンテキストを初期化する関数へのポインタ。
MakeSignatureSpMakeSignatureFn8/4+16+8メッセージ署名を生成する関数へのポインタ。
VerifySignatureSpVerifySignatureFn8/4+24+12メッセージ署名を検証する関数へのポインタ。
SealMessageSpSealMessageFn8/4+32+16メッセージを暗号化(封印)する関数へのポインタ。
UnsealMessageSpUnsealMessageFn8/4+40+20封印されたメッセージを復号する関数へのポインタ。
GetContextTokenSpGetContextTokenFn8/4+48+24コンテキストに関連付くトークンを取得する関数へのポインタ。
QueryContextAttributesASpQueryContextAttributesFn8/4+56+28コンテキスト属性を照会するANSI関数へのポインタ。
CompleteAuthTokenSpCompleteAuthTokenFn8/4+64+32認証トークンを完成させる関数へのポインタ。
DeleteUserModeContextSpDeleteContextFn8/4+72+36ユーザーモードコンテキストを削除する関数へのポインタ。
FormatCredentialsSpFormatCredentialsFn8/4+80+40資格情報を整形する関数へのポインタ。
MarshallSupplementalCredsSpMarshallSupplementalCredsFn8/4+88+44補助資格情報をマーシャリングする関数へのポインタ。
ExportContextSpExportSecurityContextFn8/4+96+48セキュリティコンテキストをエクスポートする関数へのポインタ。
ImportContextSpImportSecurityContextFn8/4+104+52セキュリティコンテキストをインポートする関数へのポインタ。
MarshalAttributeDataSpMarshalAttributeDataFn8/4+112+56属性データをマーシャリングする関数へのポインタ。

各言語での定義

#include <windows.h>

// SECPKG_USER_FUNCTION_TABLE  (x64 120 / x86 60 バイト)
typedef struct SECPKG_USER_FUNCTION_TABLE {
    SpInstanceInitFn InstanceInit;
    SpInitUserModeContextFn InitUserModeContext;
    SpMakeSignatureFn MakeSignature;
    SpVerifySignatureFn VerifySignature;
    SpSealMessageFn SealMessage;
    SpUnsealMessageFn UnsealMessage;
    SpGetContextTokenFn GetContextToken;
    SpQueryContextAttributesFn QueryContextAttributesA;
    SpCompleteAuthTokenFn CompleteAuthToken;
    SpDeleteContextFn DeleteUserModeContext;
    SpFormatCredentialsFn FormatCredentials;
    SpMarshallSupplementalCredsFn MarshallSupplementalCreds;
    SpExportSecurityContextFn ExportContext;
    SpImportSecurityContextFn ImportContext;
    SpMarshalAttributeDataFn MarshalAttributeData;
} SECPKG_USER_FUNCTION_TABLE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECPKG_USER_FUNCTION_TABLE
{
    public IntPtr InstanceInit;
    public IntPtr InitUserModeContext;
    public IntPtr MakeSignature;
    public IntPtr VerifySignature;
    public IntPtr SealMessage;
    public IntPtr UnsealMessage;
    public IntPtr GetContextToken;
    public IntPtr QueryContextAttributesA;
    public IntPtr CompleteAuthToken;
    public IntPtr DeleteUserModeContext;
    public IntPtr FormatCredentials;
    public IntPtr MarshallSupplementalCreds;
    public IntPtr ExportContext;
    public IntPtr ImportContext;
    public IntPtr MarshalAttributeData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECPKG_USER_FUNCTION_TABLE
    Public InstanceInit As IntPtr
    Public InitUserModeContext As IntPtr
    Public MakeSignature As IntPtr
    Public VerifySignature As IntPtr
    Public SealMessage As IntPtr
    Public UnsealMessage As IntPtr
    Public GetContextToken As IntPtr
    Public QueryContextAttributesA As IntPtr
    Public CompleteAuthToken As IntPtr
    Public DeleteUserModeContext As IntPtr
    Public FormatCredentials As IntPtr
    Public MarshallSupplementalCreds As IntPtr
    Public ExportContext As IntPtr
    Public ImportContext As IntPtr
    Public MarshalAttributeData As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SECPKG_USER_FUNCTION_TABLE(ctypes.Structure):
    _fields_ = [
        ("InstanceInit", ctypes.c_void_p),
        ("InitUserModeContext", ctypes.c_void_p),
        ("MakeSignature", ctypes.c_void_p),
        ("VerifySignature", ctypes.c_void_p),
        ("SealMessage", ctypes.c_void_p),
        ("UnsealMessage", ctypes.c_void_p),
        ("GetContextToken", ctypes.c_void_p),
        ("QueryContextAttributesA", ctypes.c_void_p),
        ("CompleteAuthToken", ctypes.c_void_p),
        ("DeleteUserModeContext", ctypes.c_void_p),
        ("FormatCredentials", ctypes.c_void_p),
        ("MarshallSupplementalCreds", ctypes.c_void_p),
        ("ExportContext", ctypes.c_void_p),
        ("ImportContext", ctypes.c_void_p),
        ("MarshalAttributeData", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SECPKG_USER_FUNCTION_TABLE {
    pub InstanceInit: *mut core::ffi::c_void,
    pub InitUserModeContext: *mut core::ffi::c_void,
    pub MakeSignature: *mut core::ffi::c_void,
    pub VerifySignature: *mut core::ffi::c_void,
    pub SealMessage: *mut core::ffi::c_void,
    pub UnsealMessage: *mut core::ffi::c_void,
    pub GetContextToken: *mut core::ffi::c_void,
    pub QueryContextAttributesA: *mut core::ffi::c_void,
    pub CompleteAuthToken: *mut core::ffi::c_void,
    pub DeleteUserModeContext: *mut core::ffi::c_void,
    pub FormatCredentials: *mut core::ffi::c_void,
    pub MarshallSupplementalCreds: *mut core::ffi::c_void,
    pub ExportContext: *mut core::ffi::c_void,
    pub ImportContext: *mut core::ffi::c_void,
    pub MarshalAttributeData: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SECPKG_USER_FUNCTION_TABLE struct {
	InstanceInit uintptr
	InitUserModeContext uintptr
	MakeSignature uintptr
	VerifySignature uintptr
	SealMessage uintptr
	UnsealMessage uintptr
	GetContextToken uintptr
	QueryContextAttributesA uintptr
	CompleteAuthToken uintptr
	DeleteUserModeContext uintptr
	FormatCredentials uintptr
	MarshallSupplementalCreds uintptr
	ExportContext uintptr
	ImportContext uintptr
	MarshalAttributeData uintptr
}
type
  SECPKG_USER_FUNCTION_TABLE = record
    InstanceInit: Pointer;
    InitUserModeContext: Pointer;
    MakeSignature: Pointer;
    VerifySignature: Pointer;
    SealMessage: Pointer;
    UnsealMessage: Pointer;
    GetContextToken: Pointer;
    QueryContextAttributesA: Pointer;
    CompleteAuthToken: Pointer;
    DeleteUserModeContext: Pointer;
    FormatCredentials: Pointer;
    MarshallSupplementalCreds: Pointer;
    ExportContext: Pointer;
    ImportContext: Pointer;
    MarshalAttributeData: Pointer;
  end;
const SECPKG_USER_FUNCTION_TABLE = extern struct {
    InstanceInit: ?*anyopaque,
    InitUserModeContext: ?*anyopaque,
    MakeSignature: ?*anyopaque,
    VerifySignature: ?*anyopaque,
    SealMessage: ?*anyopaque,
    UnsealMessage: ?*anyopaque,
    GetContextToken: ?*anyopaque,
    QueryContextAttributesA: ?*anyopaque,
    CompleteAuthToken: ?*anyopaque,
    DeleteUserModeContext: ?*anyopaque,
    FormatCredentials: ?*anyopaque,
    MarshallSupplementalCreds: ?*anyopaque,
    ExportContext: ?*anyopaque,
    ImportContext: ?*anyopaque,
    MarshalAttributeData: ?*anyopaque,
};
type
  SECPKG_USER_FUNCTION_TABLE {.bycopy.} = object
    InstanceInit: pointer
    InitUserModeContext: pointer
    MakeSignature: pointer
    VerifySignature: pointer
    SealMessage: pointer
    UnsealMessage: pointer
    GetContextToken: pointer
    QueryContextAttributesA: pointer
    CompleteAuthToken: pointer
    DeleteUserModeContext: pointer
    FormatCredentials: pointer
    MarshallSupplementalCreds: pointer
    ExportContext: pointer
    ImportContext: pointer
    MarshalAttributeData: pointer
struct SECPKG_USER_FUNCTION_TABLE
{
    void* InstanceInit;
    void* InitUserModeContext;
    void* MakeSignature;
    void* VerifySignature;
    void* SealMessage;
    void* UnsealMessage;
    void* GetContextToken;
    void* QueryContextAttributesA;
    void* CompleteAuthToken;
    void* DeleteUserModeContext;
    void* FormatCredentials;
    void* MarshallSupplementalCreds;
    void* ExportContext;
    void* ImportContext;
    void* MarshalAttributeData;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SECPKG_USER_FUNCTION_TABLE サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; InstanceInit : SpInstanceInitFn (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; InitUserModeContext : SpInitUserModeContextFn (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; MakeSignature : SpMakeSignatureFn (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; VerifySignature : SpVerifySignatureFn (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SealMessage : SpSealMessageFn (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; UnsealMessage : SpUnsealMessageFn (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; GetContextToken : SpGetContextTokenFn (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; QueryContextAttributesA : SpQueryContextAttributesFn (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; CompleteAuthToken : SpCompleteAuthTokenFn (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; DeleteUserModeContext : SpDeleteContextFn (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; FormatCredentials : SpFormatCredentialsFn (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; MarshallSupplementalCreds : SpMarshallSupplementalCredsFn (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ExportContext : SpExportSecurityContextFn (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ImportContext : SpImportSecurityContextFn (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; MarshalAttributeData : SpMarshalAttributeDataFn (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECPKG_USER_FUNCTION_TABLE サイズ: 120 バイト(x64)
dim st, 30    ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; InstanceInit : SpInstanceInitFn (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; InitUserModeContext : SpInitUserModeContextFn (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; MakeSignature : SpMakeSignatureFn (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; VerifySignature : SpVerifySignatureFn (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SealMessage : SpSealMessageFn (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; UnsealMessage : SpUnsealMessageFn (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; GetContextToken : SpGetContextTokenFn (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; QueryContextAttributesA : SpQueryContextAttributesFn (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; CompleteAuthToken : SpCompleteAuthTokenFn (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; DeleteUserModeContext : SpDeleteContextFn (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; FormatCredentials : SpFormatCredentialsFn (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; MarshallSupplementalCreds : SpMarshallSupplementalCredsFn (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ExportContext : SpExportSecurityContextFn (+96, 8byte)  qpoke st,96,値 / qpeek(st,96)  ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ImportContext : SpImportSecurityContextFn (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; MarshalAttributeData : SpMarshalAttributeDataFn (+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_USER_FUNCTION_TABLE
    #field intptr InstanceInit
    #field intptr InitUserModeContext
    #field intptr MakeSignature
    #field intptr VerifySignature
    #field intptr SealMessage
    #field intptr UnsealMessage
    #field intptr GetContextToken
    #field intptr QueryContextAttributesA
    #field intptr CompleteAuthToken
    #field intptr DeleteUserModeContext
    #field intptr FormatCredentials
    #field intptr MarshallSupplementalCreds
    #field intptr ExportContext
    #field intptr ImportContext
    #field intptr MarshalAttributeData
#endstruct

stdim st, SECPKG_USER_FUNCTION_TABLE        ; NSTRUCT 変数を確保