Win32 API 日本語リファレンス
ホームSystem.Environment › TRUSTLET_BINDING_DATA

TRUSTLET_BINDING_DATA

構造体
サイズx64: 56 バイト / x86: 56 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
TrustletIdentityULONGLONG8+0+0トラストレットを識別するID。
TrustletSessionIdPS_TRUSTLET_TKSESSION_ID32+8+8トラストレットのTKセッションID(PS_TRUSTLET_TKSESSION_ID)。
TrustletSvnDWORD4+40+40トラストレットのセキュリティバージョン番号。
Reserved1DWORD4+44+44予約フィールド。0であること。
Reserved2ULONGLONG8+48+48予約フィールド。0であること。

各言語での定義

#include <windows.h>

// PS_TRUSTLET_TKSESSION_ID  (x64 32 / x86 32 バイト)
typedef struct PS_TRUSTLET_TKSESSION_ID {
    ULONGLONG SessionId[4];
} PS_TRUSTLET_TKSESSION_ID;

// TRUSTLET_BINDING_DATA  (x64 56 / x86 56 バイト)
#pragma pack(push, 1)
typedef struct TRUSTLET_BINDING_DATA {
    ULONGLONG TrustletIdentity;
    PS_TRUSTLET_TKSESSION_ID TrustletSessionId;
    DWORD TrustletSvn;
    DWORD Reserved1;
    ULONGLONG Reserved2;
} TRUSTLET_BINDING_DATA;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PS_TRUSTLET_TKSESSION_ID
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ulong[] SessionId;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct TRUSTLET_BINDING_DATA
{
    public ulong TrustletIdentity;
    public PS_TRUSTLET_TKSESSION_ID TrustletSessionId;
    public uint TrustletSvn;
    public uint Reserved1;
    public ulong Reserved2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PS_TRUSTLET_TKSESSION_ID
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public SessionId() As ULong
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure TRUSTLET_BINDING_DATA
    Public TrustletIdentity As ULong
    Public TrustletSessionId As PS_TRUSTLET_TKSESSION_ID
    Public TrustletSvn As UInteger
    Public Reserved1 As UInteger
    Public Reserved2 As ULong
End Structure
import ctypes
from ctypes import wintypes

class PS_TRUSTLET_TKSESSION_ID(ctypes.Structure):
    _fields_ = [
        ("SessionId", ctypes.c_ulonglong * 4),
    ]

class TRUSTLET_BINDING_DATA(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("TrustletIdentity", ctypes.c_ulonglong),
        ("TrustletSessionId", PS_TRUSTLET_TKSESSION_ID),
        ("TrustletSvn", wintypes.DWORD),
        ("Reserved1", wintypes.DWORD),
        ("Reserved2", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct PS_TRUSTLET_TKSESSION_ID {
    pub SessionId: [u64; 4],
}

#[repr(C, packed(1))]
pub struct TRUSTLET_BINDING_DATA {
    pub TrustletIdentity: u64,
    pub TrustletSessionId: PS_TRUSTLET_TKSESSION_ID,
    pub TrustletSvn: u32,
    pub Reserved1: u32,
    pub Reserved2: u64,
}
import "golang.org/x/sys/windows"

type PS_TRUSTLET_TKSESSION_ID struct {
	SessionId [4]uint64
}

type TRUSTLET_BINDING_DATA struct {
	TrustletIdentity uint64
	TrustletSessionId PS_TRUSTLET_TKSESSION_ID
	TrustletSvn uint32
	Reserved1 uint32
	Reserved2 uint64
}
type
  PS_TRUSTLET_TKSESSION_ID = record
    SessionId: array[0..3] of UInt64;
  end;

  TRUSTLET_BINDING_DATA = packed record
    TrustletIdentity: UInt64;
    TrustletSessionId: PS_TRUSTLET_TKSESSION_ID;
    TrustletSvn: DWORD;
    Reserved1: DWORD;
    Reserved2: UInt64;
  end;
const PS_TRUSTLET_TKSESSION_ID = extern struct {
    SessionId: [4]u64,
};

const TRUSTLET_BINDING_DATA = extern struct {
    TrustletIdentity: u64,
    TrustletSessionId: PS_TRUSTLET_TKSESSION_ID,
    TrustletSvn: u32,
    Reserved1: u32,
    Reserved2: u64,
};
type
  PS_TRUSTLET_TKSESSION_ID {.bycopy.} = object
    SessionId: array[4, uint64]

  TRUSTLET_BINDING_DATA {.packed.} = object
    TrustletIdentity: uint64
    TrustletSessionId: PS_TRUSTLET_TKSESSION_ID
    TrustletSvn: uint32
    Reserved1: uint32
    Reserved2: uint64
struct PS_TRUSTLET_TKSESSION_ID
{
    ulong[4] SessionId;
}

align(1)
struct TRUSTLET_BINDING_DATA
{
    ulong TrustletIdentity;
    PS_TRUSTLET_TKSESSION_ID TrustletSessionId;
    uint TrustletSvn;
    uint Reserved1;
    ulong Reserved2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TRUSTLET_BINDING_DATA サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; TrustletIdentity : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; TrustletSessionId : PS_TRUSTLET_TKSESSION_ID (+8, 32byte)  varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; TrustletSvn : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Reserved1 : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Reserved2 : ULONGLONG (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PS_TRUSTLET_TKSESSION_ID
    #field int64 SessionId 4
#endstruct

#defstruct global TRUSTLET_BINDING_DATA, pack=1
    #field int64 TrustletIdentity
    #field PS_TRUSTLET_TKSESSION_ID TrustletSessionId
    #field int TrustletSvn
    #field int Reserved1
    #field int64 Reserved2
#endstruct

stdim st, TRUSTLET_BINDING_DATA        ; NSTRUCT 変数を確保
st->TrustletIdentity = 100
mes "TrustletIdentity=" + st->TrustletIdentity