Win32 API 日本語リファレンス
ホームSecurity.Cryptography › NCRYPT_PCP_TPM_FW_VERSION_INFO

NCRYPT_PCP_TPM_FW_VERSION_INFO

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

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

フィールド

フィールドサイズx64x86説明
major1WORD2+0+0TPMファームウェアバージョンのメジャー部上位ワード。
major2WORD2+2+2TPMファームウェアバージョンのメジャー部下位ワード。
minor1WORD2+4+4TPMファームウェアバージョンのマイナー部上位ワード。
minor2WORD2+6+6TPMファームウェアバージョンのマイナー部下位ワード。

各言語での定義

#include <windows.h>

// NCRYPT_PCP_TPM_FW_VERSION_INFO  (x64 8 / x86 8 バイト)
typedef struct NCRYPT_PCP_TPM_FW_VERSION_INFO {
    WORD major1;
    WORD major2;
    WORD minor1;
    WORD minor2;
} NCRYPT_PCP_TPM_FW_VERSION_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NCRYPT_PCP_TPM_FW_VERSION_INFO
{
    public ushort major1;
    public ushort major2;
    public ushort minor1;
    public ushort minor2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NCRYPT_PCP_TPM_FW_VERSION_INFO
    Public major1 As UShort
    Public major2 As UShort
    Public minor1 As UShort
    Public minor2 As UShort
End Structure
import ctypes
from ctypes import wintypes

class NCRYPT_PCP_TPM_FW_VERSION_INFO(ctypes.Structure):
    _fields_ = [
        ("major1", ctypes.c_ushort),
        ("major2", ctypes.c_ushort),
        ("minor1", ctypes.c_ushort),
        ("minor2", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct NCRYPT_PCP_TPM_FW_VERSION_INFO {
    pub major1: u16,
    pub major2: u16,
    pub minor1: u16,
    pub minor2: u16,
}
import "golang.org/x/sys/windows"

type NCRYPT_PCP_TPM_FW_VERSION_INFO struct {
	major1 uint16
	major2 uint16
	minor1 uint16
	minor2 uint16
}
type
  NCRYPT_PCP_TPM_FW_VERSION_INFO = record
    major1: Word;
    major2: Word;
    minor1: Word;
    minor2: Word;
  end;
const NCRYPT_PCP_TPM_FW_VERSION_INFO = extern struct {
    major1: u16,
    major2: u16,
    minor1: u16,
    minor2: u16,
};
type
  NCRYPT_PCP_TPM_FW_VERSION_INFO {.bycopy.} = object
    major1: uint16
    major2: uint16
    minor1: uint16
    minor2: uint16
struct NCRYPT_PCP_TPM_FW_VERSION_INFO
{
    ushort major1;
    ushort major2;
    ushort minor1;
    ushort minor2;
}

HSP用 定義

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

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

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