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

CMC_ADD_ATTRIBUTES_INFO

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

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

フィールド

フィールドサイズx64x86説明
dwCmcDataReferenceDWORD4+0+0DWORD 型のデータ参照番号です。
cCertReferenceDWORD4+4+4rgdwCertReference 配列の要素数です。
rgdwCertReferenceDWORD*8/4+8+8証明書参照番号の配列です。
cAttributeDWORD4+16+12rgAttribute 配列の要素数です。
rgAttributeCRYPT_ATTRIBUTE*8/4+24+16追加する CRYPT_ATTRIBUTE 証明書属性へのポインターの配列です。

公式ドキュメント

CMC_ADD_ATTRIBUTES_INFO 構造体は、証明書に追加する証明書属性を格納します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// CMC_ADD_ATTRIBUTES_INFO  (x64 32 / x86 20 バイト)
typedef struct CMC_ADD_ATTRIBUTES_INFO {
    DWORD dwCmcDataReference;
    DWORD cCertReference;
    DWORD* rgdwCertReference;
    DWORD cAttribute;
    CRYPT_ATTRIBUTE* rgAttribute;
} CMC_ADD_ATTRIBUTES_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CMC_ADD_ATTRIBUTES_INFO
{
    public uint dwCmcDataReference;
    public uint cCertReference;
    public IntPtr rgdwCertReference;
    public uint cAttribute;
    public IntPtr rgAttribute;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CMC_ADD_ATTRIBUTES_INFO
    Public dwCmcDataReference As UInteger
    Public cCertReference As UInteger
    Public rgdwCertReference As IntPtr
    Public cAttribute As UInteger
    Public rgAttribute As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CMC_ADD_ATTRIBUTES_INFO(ctypes.Structure):
    _fields_ = [
        ("dwCmcDataReference", wintypes.DWORD),
        ("cCertReference", wintypes.DWORD),
        ("rgdwCertReference", ctypes.c_void_p),
        ("cAttribute", wintypes.DWORD),
        ("rgAttribute", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CMC_ADD_ATTRIBUTES_INFO {
    pub dwCmcDataReference: u32,
    pub cCertReference: u32,
    pub rgdwCertReference: *mut core::ffi::c_void,
    pub cAttribute: u32,
    pub rgAttribute: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CMC_ADD_ATTRIBUTES_INFO struct {
	dwCmcDataReference uint32
	cCertReference uint32
	rgdwCertReference uintptr
	cAttribute uint32
	rgAttribute uintptr
}
type
  CMC_ADD_ATTRIBUTES_INFO = record
    dwCmcDataReference: DWORD;
    cCertReference: DWORD;
    rgdwCertReference: Pointer;
    cAttribute: DWORD;
    rgAttribute: Pointer;
  end;
const CMC_ADD_ATTRIBUTES_INFO = extern struct {
    dwCmcDataReference: u32,
    cCertReference: u32,
    rgdwCertReference: ?*anyopaque,
    cAttribute: u32,
    rgAttribute: ?*anyopaque,
};
type
  CMC_ADD_ATTRIBUTES_INFO {.bycopy.} = object
    dwCmcDataReference: uint32
    cCertReference: uint32
    rgdwCertReference: pointer
    cAttribute: uint32
    rgAttribute: pointer
struct CMC_ADD_ATTRIBUTES_INFO
{
    uint dwCmcDataReference;
    uint cCertReference;
    void* rgdwCertReference;
    uint cAttribute;
    void* rgAttribute;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CMC_ADD_ATTRIBUTES_INFO サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; dwCmcDataReference : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cCertReference : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; rgdwCertReference : DWORD* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cAttribute : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; rgAttribute : CRYPT_ATTRIBUTE* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CMC_ADD_ATTRIBUTES_INFO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwCmcDataReference : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cCertReference : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; rgdwCertReference : DWORD* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cAttribute : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; rgAttribute : CRYPT_ATTRIBUTE* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CMC_ADD_ATTRIBUTES_INFO
    #field int dwCmcDataReference
    #field int cCertReference
    #field intptr rgdwCertReference
    #field int cAttribute
    #field intptr rgAttribute
#endstruct

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