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

CERT_FORTEZZA_DATA_PROP

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

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

フィールド

フィールドサイズx64x86説明
SerialNumberBYTE8+0+0FORTEZZAカードのシリアル番号(固定長配列)。
CertIndexINT4+8+8カード上の証明書インデックス。
CertLabelBYTE36+12+12証明書のラベル文字列(固定長配列)。

各言語での定義

#include <windows.h>

// CERT_FORTEZZA_DATA_PROP  (x64 48 / x86 48 バイト)
typedef struct CERT_FORTEZZA_DATA_PROP {
    BYTE SerialNumber[8];
    INT CertIndex;
    BYTE CertLabel[36];
} CERT_FORTEZZA_DATA_PROP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_FORTEZZA_DATA_PROP
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] SerialNumber;
    public int CertIndex;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 36)] public byte[] CertLabel;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_FORTEZZA_DATA_PROP
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public SerialNumber() As Byte
    Public CertIndex As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=36)> Public CertLabel() As Byte
End Structure
import ctypes
from ctypes import wintypes

class CERT_FORTEZZA_DATA_PROP(ctypes.Structure):
    _fields_ = [
        ("SerialNumber", ctypes.c_ubyte * 8),
        ("CertIndex", ctypes.c_int),
        ("CertLabel", ctypes.c_ubyte * 36),
    ]
#[repr(C)]
pub struct CERT_FORTEZZA_DATA_PROP {
    pub SerialNumber: [u8; 8],
    pub CertIndex: i32,
    pub CertLabel: [u8; 36],
}
import "golang.org/x/sys/windows"

type CERT_FORTEZZA_DATA_PROP struct {
	SerialNumber [8]byte
	CertIndex int32
	CertLabel [36]byte
}
type
  CERT_FORTEZZA_DATA_PROP = record
    SerialNumber: array[0..7] of Byte;
    CertIndex: Integer;
    CertLabel: array[0..35] of Byte;
  end;
const CERT_FORTEZZA_DATA_PROP = extern struct {
    SerialNumber: [8]u8,
    CertIndex: i32,
    CertLabel: [36]u8,
};
type
  CERT_FORTEZZA_DATA_PROP {.bycopy.} = object
    SerialNumber: array[8, uint8]
    CertIndex: int32
    CertLabel: array[36, uint8]
struct CERT_FORTEZZA_DATA_PROP
{
    ubyte[8] SerialNumber;
    int CertIndex;
    ubyte[36] CertLabel;
}

HSP用 定義

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

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

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