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

KEY_TYPE_SUBTYPE

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

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

フィールド

フィールドサイズx64x86説明
dwKeySpecDWORD4+0+0鍵の用途指定(AT_KEYEXCHANGE/AT_SIGNATURE等)。
TypeGUID16+4+4鍵の型を示すGUID。
SubtypeGUID16+20+20鍵のサブタイプを示すGUID。

各言語での定義

#include <windows.h>

// KEY_TYPE_SUBTYPE  (x64 36 / x86 36 バイト)
typedef struct KEY_TYPE_SUBTYPE {
    DWORD dwKeySpec;
    GUID Type;
    GUID Subtype;
} KEY_TYPE_SUBTYPE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KEY_TYPE_SUBTYPE
{
    public uint dwKeySpec;
    public Guid Type;
    public Guid Subtype;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KEY_TYPE_SUBTYPE
    Public dwKeySpec As UInteger
    Public Type As Guid
    Public Subtype As Guid
End Structure
import ctypes
from ctypes import wintypes

class KEY_TYPE_SUBTYPE(ctypes.Structure):
    _fields_ = [
        ("dwKeySpec", wintypes.DWORD),
        ("Type", GUID),
        ("Subtype", GUID),
    ]
#[repr(C)]
pub struct KEY_TYPE_SUBTYPE {
    pub dwKeySpec: u32,
    pub Type: GUID,
    pub Subtype: GUID,
}
import "golang.org/x/sys/windows"

type KEY_TYPE_SUBTYPE struct {
	dwKeySpec uint32
	Type windows.GUID
	Subtype windows.GUID
}
type
  KEY_TYPE_SUBTYPE = record
    dwKeySpec: DWORD;
    Type: TGUID;
    Subtype: TGUID;
  end;
const KEY_TYPE_SUBTYPE = extern struct {
    dwKeySpec: u32,
    Type: GUID,
    Subtype: GUID,
};
type
  KEY_TYPE_SUBTYPE {.bycopy.} = object
    dwKeySpec: uint32
    Type: GUID
    Subtype: GUID
struct KEY_TYPE_SUBTYPE
{
    uint dwKeySpec;
    GUID Type;
    GUID Subtype;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KEY_TYPE_SUBTYPE サイズ: 36 バイト(x64)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; dwKeySpec : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Type : GUID (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; Subtype : GUID (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global KEY_TYPE_SUBTYPE
    #field int dwKeySpec
    #field GUID Type
    #field GUID Subtype
#endstruct

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