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

TPM_DEVICE_INFO

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

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

フィールド

フィールドサイズx64x86説明
structVersionDWORD4+0+0この構造体のバージョン番号。
tpmVersionDWORD4+4+4TPMのバージョン(1.2または2.0)を示す値。
tpmInterfaceTypeDWORD4+8+8TPMのインターフェース種別を示す値。
tpmImpRevisionDWORD4+12+12TPM実装のリビジョン番号。

各言語での定義

#include <windows.h>

// TPM_DEVICE_INFO  (x64 16 / x86 16 バイト)
typedef struct TPM_DEVICE_INFO {
    DWORD structVersion;
    DWORD tpmVersion;
    DWORD tpmInterfaceType;
    DWORD tpmImpRevision;
} TPM_DEVICE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TPM_DEVICE_INFO
{
    public uint structVersion;
    public uint tpmVersion;
    public uint tpmInterfaceType;
    public uint tpmImpRevision;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TPM_DEVICE_INFO
    Public structVersion As UInteger
    Public tpmVersion As UInteger
    Public tpmInterfaceType As UInteger
    Public tpmImpRevision As UInteger
End Structure
import ctypes
from ctypes import wintypes

class TPM_DEVICE_INFO(ctypes.Structure):
    _fields_ = [
        ("structVersion", wintypes.DWORD),
        ("tpmVersion", wintypes.DWORD),
        ("tpmInterfaceType", wintypes.DWORD),
        ("tpmImpRevision", wintypes.DWORD),
    ]
#[repr(C)]
pub struct TPM_DEVICE_INFO {
    pub structVersion: u32,
    pub tpmVersion: u32,
    pub tpmInterfaceType: u32,
    pub tpmImpRevision: u32,
}
import "golang.org/x/sys/windows"

type TPM_DEVICE_INFO struct {
	structVersion uint32
	tpmVersion uint32
	tpmInterfaceType uint32
	tpmImpRevision uint32
}
type
  TPM_DEVICE_INFO = record
    structVersion: DWORD;
    tpmVersion: DWORD;
    tpmInterfaceType: DWORD;
    tpmImpRevision: DWORD;
  end;
const TPM_DEVICE_INFO = extern struct {
    structVersion: u32,
    tpmVersion: u32,
    tpmInterfaceType: u32,
    tpmImpRevision: u32,
};
type
  TPM_DEVICE_INFO {.bycopy.} = object
    structVersion: uint32
    tpmVersion: uint32
    tpmInterfaceType: uint32
    tpmImpRevision: uint32
struct TPM_DEVICE_INFO
{
    uint structVersion;
    uint tpmVersion;
    uint tpmInterfaceType;
    uint tpmImpRevision;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TPM_DEVICE_INFO サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; structVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; tpmVersion : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; tpmInterfaceType : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; tpmImpRevision : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TPM_DEVICE_INFO
    #field int structVersion
    #field int tpmVersion
    #field int tpmInterfaceType
    #field int tpmImpRevision
#endstruct

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