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

STORAGE_CRYPTO_CAPABILITY_V2

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
CryptoCapabilityIndexDWORD4+8+8この暗号機能エントリのインデックス。
AlgorithmIdSTORAGE_CRYPTO_ALGORITHM_ID4+12+12暗号アルゴリズムの識別子を示すSTORAGE_CRYPTO_ALGORITHM_ID列挙値。
KeySizeSTORAGE_CRYPTO_KEY_SIZE4+16+16暗号鍵のサイズを示すSTORAGE_CRYPTO_KEY_SIZE列挙値。
DataUnitSizeBitmaskDWORD4+20+20サポートするデータユニットサイズをビットマスクで示す。
MaxIVBitSizeWORD2+24+24初期化ベクタ(IV)の最大ビットサイズ。
ReservedWORD2+26+26将来の拡張のために予約された16ビット領域。
SecurityComplianceBitmaskSTORAGE_SECURITY_COMPLIANCE_BITMASK1+28+28サポートするセキュリティ準拠規格をビットマスクで示す。

各言語での定義

#include <windows.h>

// STORAGE_SECURITY_COMPLIANCE_BITMASK  (x64 1 / x86 1 バイト)
typedef struct STORAGE_SECURITY_COMPLIANCE_BITMASK {
    _Anonymous_e__Struct Anonymous;
    BYTE AsUchar;
} STORAGE_SECURITY_COMPLIANCE_BITMASK;

// STORAGE_CRYPTO_CAPABILITY_V2  (x64 32 / x86 32 バイト)
typedef struct STORAGE_CRYPTO_CAPABILITY_V2 {
    DWORD Version;
    DWORD Size;
    DWORD CryptoCapabilityIndex;
    STORAGE_CRYPTO_ALGORITHM_ID AlgorithmId;
    STORAGE_CRYPTO_KEY_SIZE KeySize;
    DWORD DataUnitSizeBitmask;
    WORD MaxIVBitSize;
    WORD Reserved;
    STORAGE_SECURITY_COMPLIANCE_BITMASK SecurityComplianceBitmask;
} STORAGE_CRYPTO_CAPABILITY_V2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_SECURITY_COMPLIANCE_BITMASK
{
    public _Anonymous_e__Struct Anonymous;
    public byte AsUchar;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_CRYPTO_CAPABILITY_V2
{
    public uint Version;
    public uint Size;
    public uint CryptoCapabilityIndex;
    public int AlgorithmId;
    public int KeySize;
    public uint DataUnitSizeBitmask;
    public ushort MaxIVBitSize;
    public ushort Reserved;
    public STORAGE_SECURITY_COMPLIANCE_BITMASK SecurityComplianceBitmask;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_SECURITY_COMPLIANCE_BITMASK
    Public Anonymous As _Anonymous_e__Struct
    Public AsUchar As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_CRYPTO_CAPABILITY_V2
    Public Version As UInteger
    Public Size As UInteger
    Public CryptoCapabilityIndex As UInteger
    Public AlgorithmId As Integer
    Public KeySize As Integer
    Public DataUnitSizeBitmask As UInteger
    Public MaxIVBitSize As UShort
    Public Reserved As UShort
    Public SecurityComplianceBitmask As STORAGE_SECURITY_COMPLIANCE_BITMASK
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_SECURITY_COMPLIANCE_BITMASK(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUchar", ctypes.c_ubyte),
    ]

class STORAGE_CRYPTO_CAPABILITY_V2(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("CryptoCapabilityIndex", wintypes.DWORD),
        ("AlgorithmId", ctypes.c_int),
        ("KeySize", ctypes.c_int),
        ("DataUnitSizeBitmask", wintypes.DWORD),
        ("MaxIVBitSize", ctypes.c_ushort),
        ("Reserved", ctypes.c_ushort),
        ("SecurityComplianceBitmask", STORAGE_SECURITY_COMPLIANCE_BITMASK),
    ]
#[repr(C)]
pub struct STORAGE_SECURITY_COMPLIANCE_BITMASK {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUchar: u8,
}

#[repr(C)]
pub struct STORAGE_CRYPTO_CAPABILITY_V2 {
    pub Version: u32,
    pub Size: u32,
    pub CryptoCapabilityIndex: u32,
    pub AlgorithmId: i32,
    pub KeySize: i32,
    pub DataUnitSizeBitmask: u32,
    pub MaxIVBitSize: u16,
    pub Reserved: u16,
    pub SecurityComplianceBitmask: STORAGE_SECURITY_COMPLIANCE_BITMASK,
}
import "golang.org/x/sys/windows"

type STORAGE_SECURITY_COMPLIANCE_BITMASK struct {
	Anonymous _Anonymous_e__Struct
	AsUchar byte
}

type STORAGE_CRYPTO_CAPABILITY_V2 struct {
	Version uint32
	Size uint32
	CryptoCapabilityIndex uint32
	AlgorithmId int32
	KeySize int32
	DataUnitSizeBitmask uint32
	MaxIVBitSize uint16
	Reserved uint16
	SecurityComplianceBitmask STORAGE_SECURITY_COMPLIANCE_BITMASK
}
type
  STORAGE_SECURITY_COMPLIANCE_BITMASK = record
    Anonymous: _Anonymous_e__Struct;
    AsUchar: Byte;
  end;

  STORAGE_CRYPTO_CAPABILITY_V2 = record
    Version: DWORD;
    Size: DWORD;
    CryptoCapabilityIndex: DWORD;
    AlgorithmId: Integer;
    KeySize: Integer;
    DataUnitSizeBitmask: DWORD;
    MaxIVBitSize: Word;
    Reserved: Word;
    SecurityComplianceBitmask: STORAGE_SECURITY_COMPLIANCE_BITMASK;
  end;
const STORAGE_SECURITY_COMPLIANCE_BITMASK = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUchar: u8,
};

const STORAGE_CRYPTO_CAPABILITY_V2 = extern struct {
    Version: u32,
    Size: u32,
    CryptoCapabilityIndex: u32,
    AlgorithmId: i32,
    KeySize: i32,
    DataUnitSizeBitmask: u32,
    MaxIVBitSize: u16,
    Reserved: u16,
    SecurityComplianceBitmask: STORAGE_SECURITY_COMPLIANCE_BITMASK,
};
type
  STORAGE_SECURITY_COMPLIANCE_BITMASK {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    AsUchar: uint8

  STORAGE_CRYPTO_CAPABILITY_V2 {.bycopy.} = object
    Version: uint32
    Size: uint32
    CryptoCapabilityIndex: uint32
    AlgorithmId: int32
    KeySize: int32
    DataUnitSizeBitmask: uint32
    MaxIVBitSize: uint16
    Reserved: uint16
    SecurityComplianceBitmask: STORAGE_SECURITY_COMPLIANCE_BITMASK
struct STORAGE_SECURITY_COMPLIANCE_BITMASK
{
    _Anonymous_e__Struct Anonymous;
    ubyte AsUchar;
}

struct STORAGE_CRYPTO_CAPABILITY_V2
{
    uint Version;
    uint Size;
    uint CryptoCapabilityIndex;
    int AlgorithmId;
    int KeySize;
    uint DataUnitSizeBitmask;
    ushort MaxIVBitSize;
    ushort Reserved;
    STORAGE_SECURITY_COMPLIANCE_BITMASK SecurityComplianceBitmask;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_CRYPTO_CAPABILITY_V2 サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; CryptoCapabilityIndex : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; AlgorithmId : STORAGE_CRYPTO_ALGORITHM_ID (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; KeySize : STORAGE_CRYPTO_KEY_SIZE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; DataUnitSizeBitmask : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; MaxIVBitSize : WORD (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; Reserved : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; SecurityComplianceBitmask : STORAGE_SECURITY_COMPLIANCE_BITMASK (+28, 1byte)  varptr(st)+28 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_CRYPTO_CAPABILITY_V2
    #field int Version
    #field int Size
    #field int CryptoCapabilityIndex
    #field int AlgorithmId
    #field int KeySize
    #field int DataUnitSizeBitmask
    #field short MaxIVBitSize
    #field short Reserved
    #field byte SecurityComplianceBitmask 1
#endstruct

stdim st, STORAGE_CRYPTO_CAPABILITY_V2        ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。