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

CARD_CACHE_FILE_FORMAT

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

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

フィールド

フィールドサイズx64x86説明
bVersionBYTE1+0+0キャッシュファイル形式のバージョン番号。
bPinsFreshnessBYTE1+1+1PINの鮮度(更新世代)カウンタ。
wContainersFreshnessWORD2+2+2コンテナの鮮度(更新世代)カウンタ。
wFilesFreshnessWORD2+4+4ファイルの鮮度(更新世代)カウンタ。

各言語での定義

#include <windows.h>

// CARD_CACHE_FILE_FORMAT  (x64 6 / x86 6 バイト)
typedef struct CARD_CACHE_FILE_FORMAT {
    BYTE bVersion;
    BYTE bPinsFreshness;
    WORD wContainersFreshness;
    WORD wFilesFreshness;
} CARD_CACHE_FILE_FORMAT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CARD_CACHE_FILE_FORMAT
{
    public byte bVersion;
    public byte bPinsFreshness;
    public ushort wContainersFreshness;
    public ushort wFilesFreshness;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CARD_CACHE_FILE_FORMAT
    Public bVersion As Byte
    Public bPinsFreshness As Byte
    Public wContainersFreshness As UShort
    Public wFilesFreshness As UShort
End Structure
import ctypes
from ctypes import wintypes

class CARD_CACHE_FILE_FORMAT(ctypes.Structure):
    _fields_ = [
        ("bVersion", ctypes.c_ubyte),
        ("bPinsFreshness", ctypes.c_ubyte),
        ("wContainersFreshness", ctypes.c_ushort),
        ("wFilesFreshness", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct CARD_CACHE_FILE_FORMAT {
    pub bVersion: u8,
    pub bPinsFreshness: u8,
    pub wContainersFreshness: u16,
    pub wFilesFreshness: u16,
}
import "golang.org/x/sys/windows"

type CARD_CACHE_FILE_FORMAT struct {
	bVersion byte
	bPinsFreshness byte
	wContainersFreshness uint16
	wFilesFreshness uint16
}
type
  CARD_CACHE_FILE_FORMAT = record
    bVersion: Byte;
    bPinsFreshness: Byte;
    wContainersFreshness: Word;
    wFilesFreshness: Word;
  end;
const CARD_CACHE_FILE_FORMAT = extern struct {
    bVersion: u8,
    bPinsFreshness: u8,
    wContainersFreshness: u16,
    wFilesFreshness: u16,
};
type
  CARD_CACHE_FILE_FORMAT {.bycopy.} = object
    bVersion: uint8
    bPinsFreshness: uint8
    wContainersFreshness: uint16
    wFilesFreshness: uint16
struct CARD_CACHE_FILE_FORMAT
{
    ubyte bVersion;
    ubyte bPinsFreshness;
    ushort wContainersFreshness;
    ushort wFilesFreshness;
}

HSP用 定義

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

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

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