ホーム › Storage.Nvme › TCG_HISTORY_ENTRY
TCG_HISTORY_ENTRY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| VersionNumber | BYTE | 1 | +0 | +0 | このTCG履歴エントリ形式の版数。 |
| EntryLength | BYTE | 1 | +1 | +1 | このエントリのバイト長。 |
| PowerCycleCount | WORD | 2 | +2 | +2 | エントリ記録時点の電源投入回数。 |
| TcgCommandCount | DWORD | 4 | +4 | +4 | 実行されたTCGコマンドの通し番号。 |
| TcgCommandCompletionTS | ULONGLONG | 8 | +8 | +8 | TCGコマンド完了時刻のタイムスタンプ。 |
| InvokingId | ULONGLONG | 8 | +16 | +16 | コマンドの呼び出し対象オブジェクトID。 |
| MethodId | ULONGLONG | 8 | +24 | +24 | 呼び出されたメソッドのID。 |
| ComId | WORD | 2 | +32 | +32 | TCG通信に用いられたComID。 |
| ProtocolId | BYTE | 1 | +34 | +34 | セキュリティプロトコル識別子。 |
| TcgStatus | BYTE | 1 | +35 | +35 | TCGコマンドのステータスコード。 |
| ProcessTime | WORD | 2 | +36 | +36 | コマンドの処理時間。 |
| CommandSpecific | BYTE | 10 | +38 | +38 | コマンド固有の追加情報領域。 |
各言語での定義
#include <windows.h>
// TCG_HISTORY_ENTRY (x64 48 / x86 48 バイト)
#pragma pack(push, 1)
typedef struct TCG_HISTORY_ENTRY {
BYTE VersionNumber;
BYTE EntryLength;
WORD PowerCycleCount;
DWORD TcgCommandCount;
ULONGLONG TcgCommandCompletionTS;
ULONGLONG InvokingId;
ULONGLONG MethodId;
WORD ComId;
BYTE ProtocolId;
BYTE TcgStatus;
WORD ProcessTime;
BYTE CommandSpecific[10];
} TCG_HISTORY_ENTRY;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct TCG_HISTORY_ENTRY
{
public byte VersionNumber;
public byte EntryLength;
public ushort PowerCycleCount;
public uint TcgCommandCount;
public ulong TcgCommandCompletionTS;
public ulong InvokingId;
public ulong MethodId;
public ushort ComId;
public byte ProtocolId;
public byte TcgStatus;
public ushort ProcessTime;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] CommandSpecific;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure TCG_HISTORY_ENTRY
Public VersionNumber As Byte
Public EntryLength As Byte
Public PowerCycleCount As UShort
Public TcgCommandCount As UInteger
Public TcgCommandCompletionTS As ULong
Public InvokingId As ULong
Public MethodId As ULong
Public ComId As UShort
Public ProtocolId As Byte
Public TcgStatus As Byte
Public ProcessTime As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public CommandSpecific() As Byte
End Structureimport ctypes
from ctypes import wintypes
class TCG_HISTORY_ENTRY(ctypes.Structure):
_pack_ = 1
_fields_ = [
("VersionNumber", ctypes.c_ubyte),
("EntryLength", ctypes.c_ubyte),
("PowerCycleCount", ctypes.c_ushort),
("TcgCommandCount", wintypes.DWORD),
("TcgCommandCompletionTS", ctypes.c_ulonglong),
("InvokingId", ctypes.c_ulonglong),
("MethodId", ctypes.c_ulonglong),
("ComId", ctypes.c_ushort),
("ProtocolId", ctypes.c_ubyte),
("TcgStatus", ctypes.c_ubyte),
("ProcessTime", ctypes.c_ushort),
("CommandSpecific", ctypes.c_ubyte * 10),
]#[repr(C, packed(1))]
pub struct TCG_HISTORY_ENTRY {
pub VersionNumber: u8,
pub EntryLength: u8,
pub PowerCycleCount: u16,
pub TcgCommandCount: u32,
pub TcgCommandCompletionTS: u64,
pub InvokingId: u64,
pub MethodId: u64,
pub ComId: u16,
pub ProtocolId: u8,
pub TcgStatus: u8,
pub ProcessTime: u16,
pub CommandSpecific: [u8; 10],
}import "golang.org/x/sys/windows"
type TCG_HISTORY_ENTRY struct {
VersionNumber byte
EntryLength byte
PowerCycleCount uint16
TcgCommandCount uint32
TcgCommandCompletionTS uint64
InvokingId uint64
MethodId uint64
ComId uint16
ProtocolId byte
TcgStatus byte
ProcessTime uint16
CommandSpecific [10]byte
}type
TCG_HISTORY_ENTRY = packed record
VersionNumber: Byte;
EntryLength: Byte;
PowerCycleCount: Word;
TcgCommandCount: DWORD;
TcgCommandCompletionTS: UInt64;
InvokingId: UInt64;
MethodId: UInt64;
ComId: Word;
ProtocolId: Byte;
TcgStatus: Byte;
ProcessTime: Word;
CommandSpecific: array[0..9] of Byte;
end;const TCG_HISTORY_ENTRY = extern struct {
VersionNumber: u8,
EntryLength: u8,
PowerCycleCount: u16,
TcgCommandCount: u32,
TcgCommandCompletionTS: u64,
InvokingId: u64,
MethodId: u64,
ComId: u16,
ProtocolId: u8,
TcgStatus: u8,
ProcessTime: u16,
CommandSpecific: [10]u8,
};type
TCG_HISTORY_ENTRY {.packed.} = object
VersionNumber: uint8
EntryLength: uint8
PowerCycleCount: uint16
TcgCommandCount: uint32
TcgCommandCompletionTS: uint64
InvokingId: uint64
MethodId: uint64
ComId: uint16
ProtocolId: uint8
TcgStatus: uint8
ProcessTime: uint16
CommandSpecific: array[10, uint8]align(1)
struct TCG_HISTORY_ENTRY
{
ubyte VersionNumber;
ubyte EntryLength;
ushort PowerCycleCount;
uint TcgCommandCount;
ulong TcgCommandCompletionTS;
ulong InvokingId;
ulong MethodId;
ushort ComId;
ubyte ProtocolId;
ubyte TcgStatus;
ushort ProcessTime;
ubyte[10] CommandSpecific;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TCG_HISTORY_ENTRY サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; VersionNumber : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; EntryLength : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; PowerCycleCount : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; TcgCommandCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; TcgCommandCompletionTS : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; InvokingId : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; MethodId : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ComId : WORD (+32, 2byte) wpoke st,32,値 / 値 = wpeek(st,32)
; ProtocolId : BYTE (+34, 1byte) poke st,34,値 / 値 = peek(st,34)
; TcgStatus : BYTE (+35, 1byte) poke st,35,値 / 値 = peek(st,35)
; ProcessTime : WORD (+36, 2byte) wpoke st,36,値 / 値 = wpeek(st,36)
; CommandSpecific : BYTE (+38, 10byte) varptr(st)+38 を基点に操作(10byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TCG_HISTORY_ENTRY, pack=1
#field byte VersionNumber
#field byte EntryLength
#field short PowerCycleCount
#field int TcgCommandCount
#field int64 TcgCommandCompletionTS
#field int64 InvokingId
#field int64 MethodId
#field short ComId
#field byte ProtocolId
#field byte TcgStatus
#field short ProcessTime
#field byte CommandSpecific 10
#endstruct
stdim st, TCG_HISTORY_ENTRY ; NSTRUCT 変数を確保
st->VersionNumber = 100
mes "VersionNumber=" + st->VersionNumber