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

CRYPTUI_VIEWCERTIFICATE_STRUCTW

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイト数。呼び出し前に設定する。
hwndParentHWND8/4+8+4証明書表示ダイアログの親ウィンドウハンドル。NULL可。
dwFlagsCRYPTUI_VIEWCERTIFICATE_FLAGS4+16+8ダイアログの表示や動作を制御するフラグの組み合わせ。
szTitleLPWSTR8/4+24+12ダイアログのタイトル文字列(Unicode)。NULL可。
pCertContextCERT_CONTEXT*8/4+32+16表示対象となる証明書コンテキストへのポインタ。
rgszPurposesLPSTR*8/4+40+20検証対象とする用途OID文字列の配列へのポインタ。
cPurposesDWORD4+48+24rgszPurposes配列の要素数。
Anonymous_Anonymous_e__Union8/4+56+28署名検証用のメッセージかストア情報を保持する無名共用体。
fpCryptProviderDataTrustedUsageBOOL4+64+32プロバイダデータの用途が信頼済みかを示す真偽値。
idxSignerDWORD4+68+36対象とする署名者のインデックス。
idxCertDWORD4+72+40署名者の証明書チェーン内インデックス。
fCounterSignerBOOL4+76+44副署名者を対象とするかを示す真偽値。
idxCounterSignerDWORD4+80+48対象とする副署名者のインデックス。
cStoresDWORD4+84+52rghStores配列の要素数。
rghStoresHCERTSTORE*8/4+88+56証明書チェーン構築に使う追加ストアハンドル配列へのポインタ。
cPropSheetPagesDWORD4+96+60rgPropSheetPages配列の要素数。
rgPropSheetPagesPROPSHEETPAGEW*8/4+104+64追加表示するプロパティシートページ配列(Unicode)へのポインタ。
nStartPageDWORD4+112+68最初に表示するプロパティシートページのインデックス。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
pCryptProviderDataCRYPT_PROVIDER_DATA*8/4+0+0
hWVTStateDataHANDLE8/4+0+0

各言語での定義

#include <windows.h>

// CRYPTUI_VIEWCERTIFICATE_STRUCTW  (x64 120 / x86 72 バイト)
typedef struct CRYPTUI_VIEWCERTIFICATE_STRUCTW {
    DWORD dwSize;
    HWND hwndParent;
    CRYPTUI_VIEWCERTIFICATE_FLAGS dwFlags;
    LPWSTR szTitle;
    CERT_CONTEXT* pCertContext;
    LPSTR* rgszPurposes;
    DWORD cPurposes;
    _Anonymous_e__Union Anonymous;
    BOOL fpCryptProviderDataTrustedUsage;
    DWORD idxSigner;
    DWORD idxCert;
    BOOL fCounterSigner;
    DWORD idxCounterSigner;
    DWORD cStores;
    HCERTSTORE* rghStores;
    DWORD cPropSheetPages;
    PROPSHEETPAGEW* rgPropSheetPages;
    DWORD nStartPage;
} CRYPTUI_VIEWCERTIFICATE_STRUCTW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPTUI_VIEWCERTIFICATE_STRUCTW
{
    public uint dwSize;
    public IntPtr hwndParent;
    public uint dwFlags;
    public IntPtr szTitle;
    public IntPtr pCertContext;
    public IntPtr rgszPurposes;
    public uint cPurposes;
    public _Anonymous_e__Union Anonymous;
    [MarshalAs(UnmanagedType.Bool)] public bool fpCryptProviderDataTrustedUsage;
    public uint idxSigner;
    public uint idxCert;
    [MarshalAs(UnmanagedType.Bool)] public bool fCounterSigner;
    public uint idxCounterSigner;
    public uint cStores;
    public IntPtr rghStores;
    public uint cPropSheetPages;
    public IntPtr rgPropSheetPages;
    public uint nStartPage;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPTUI_VIEWCERTIFICATE_STRUCTW
    Public dwSize As UInteger
    Public hwndParent As IntPtr
    Public dwFlags As UInteger
    Public szTitle As IntPtr
    Public pCertContext As IntPtr
    Public rgszPurposes As IntPtr
    Public cPurposes As UInteger
    Public Anonymous As _Anonymous_e__Union
    <MarshalAs(UnmanagedType.Bool)> Public fpCryptProviderDataTrustedUsage As Boolean
    Public idxSigner As UInteger
    Public idxCert As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public fCounterSigner As Boolean
    Public idxCounterSigner As UInteger
    Public cStores As UInteger
    Public rghStores As IntPtr
    Public cPropSheetPages As UInteger
    Public rgPropSheetPages As IntPtr
    Public nStartPage As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CRYPTUI_VIEWCERTIFICATE_STRUCTW(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("hwndParent", ctypes.c_void_p),
        ("dwFlags", wintypes.DWORD),
        ("szTitle", ctypes.c_void_p),
        ("pCertContext", ctypes.c_void_p),
        ("rgszPurposes", ctypes.c_void_p),
        ("cPurposes", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("fpCryptProviderDataTrustedUsage", wintypes.BOOL),
        ("idxSigner", wintypes.DWORD),
        ("idxCert", wintypes.DWORD),
        ("fCounterSigner", wintypes.BOOL),
        ("idxCounterSigner", wintypes.DWORD),
        ("cStores", wintypes.DWORD),
        ("rghStores", ctypes.c_void_p),
        ("cPropSheetPages", wintypes.DWORD),
        ("rgPropSheetPages", ctypes.c_void_p),
        ("nStartPage", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CRYPTUI_VIEWCERTIFICATE_STRUCTW {
    pub dwSize: u32,
    pub hwndParent: *mut core::ffi::c_void,
    pub dwFlags: u32,
    pub szTitle: *mut core::ffi::c_void,
    pub pCertContext: *mut core::ffi::c_void,
    pub rgszPurposes: *mut core::ffi::c_void,
    pub cPurposes: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub fpCryptProviderDataTrustedUsage: i32,
    pub idxSigner: u32,
    pub idxCert: u32,
    pub fCounterSigner: i32,
    pub idxCounterSigner: u32,
    pub cStores: u32,
    pub rghStores: *mut core::ffi::c_void,
    pub cPropSheetPages: u32,
    pub rgPropSheetPages: *mut core::ffi::c_void,
    pub nStartPage: u32,
}
import "golang.org/x/sys/windows"

type CRYPTUI_VIEWCERTIFICATE_STRUCTW struct {
	dwSize uint32
	hwndParent uintptr
	dwFlags uint32
	szTitle uintptr
	pCertContext uintptr
	rgszPurposes uintptr
	cPurposes uint32
	Anonymous _Anonymous_e__Union
	fpCryptProviderDataTrustedUsage int32
	idxSigner uint32
	idxCert uint32
	fCounterSigner int32
	idxCounterSigner uint32
	cStores uint32
	rghStores uintptr
	cPropSheetPages uint32
	rgPropSheetPages uintptr
	nStartPage uint32
}
type
  CRYPTUI_VIEWCERTIFICATE_STRUCTW = record
    dwSize: DWORD;
    hwndParent: Pointer;
    dwFlags: DWORD;
    szTitle: Pointer;
    pCertContext: Pointer;
    rgszPurposes: Pointer;
    cPurposes: DWORD;
    Anonymous: _Anonymous_e__Union;
    fpCryptProviderDataTrustedUsage: BOOL;
    idxSigner: DWORD;
    idxCert: DWORD;
    fCounterSigner: BOOL;
    idxCounterSigner: DWORD;
    cStores: DWORD;
    rghStores: Pointer;
    cPropSheetPages: DWORD;
    rgPropSheetPages: Pointer;
    nStartPage: DWORD;
  end;
const CRYPTUI_VIEWCERTIFICATE_STRUCTW = extern struct {
    dwSize: u32,
    hwndParent: ?*anyopaque,
    dwFlags: u32,
    szTitle: ?*anyopaque,
    pCertContext: ?*anyopaque,
    rgszPurposes: ?*anyopaque,
    cPurposes: u32,
    Anonymous: _Anonymous_e__Union,
    fpCryptProviderDataTrustedUsage: i32,
    idxSigner: u32,
    idxCert: u32,
    fCounterSigner: i32,
    idxCounterSigner: u32,
    cStores: u32,
    rghStores: ?*anyopaque,
    cPropSheetPages: u32,
    rgPropSheetPages: ?*anyopaque,
    nStartPage: u32,
};
type
  CRYPTUI_VIEWCERTIFICATE_STRUCTW {.bycopy.} = object
    dwSize: uint32
    hwndParent: pointer
    dwFlags: uint32
    szTitle: pointer
    pCertContext: pointer
    rgszPurposes: pointer
    cPurposes: uint32
    Anonymous: _Anonymous_e__Union
    fpCryptProviderDataTrustedUsage: int32
    idxSigner: uint32
    idxCert: uint32
    fCounterSigner: int32
    idxCounterSigner: uint32
    cStores: uint32
    rghStores: pointer
    cPropSheetPages: uint32
    rgPropSheetPages: pointer
    nStartPage: uint32
struct CRYPTUI_VIEWCERTIFICATE_STRUCTW
{
    uint dwSize;
    void* hwndParent;
    uint dwFlags;
    void* szTitle;
    void* pCertContext;
    void* rgszPurposes;
    uint cPurposes;
    _Anonymous_e__Union Anonymous;
    int fpCryptProviderDataTrustedUsage;
    uint idxSigner;
    uint idxCert;
    int fCounterSigner;
    uint idxCounterSigner;
    uint cStores;
    void* rghStores;
    uint cPropSheetPages;
    void* rgPropSheetPages;
    uint nStartPage;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CRYPTUI_VIEWCERTIFICATE_STRUCTW サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndParent : HWND (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFlags : CRYPTUI_VIEWCERTIFICATE_FLAGS (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; szTitle : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pCertContext : CERT_CONTEXT* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; rgszPurposes : LPSTR* (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; cPurposes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+28, 4byte)  varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; fpCryptProviderDataTrustedUsage : BOOL (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; idxSigner : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; idxCert : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; fCounterSigner : BOOL (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; idxCounterSigner : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; cStores : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; rghStores : HCERTSTORE* (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; cPropSheetPages : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; rgPropSheetPages : PROPSHEETPAGEW* (+64, 4byte)  varptr(st)+64 を基点に操作(4byte:入れ子/配列)
; nStartPage : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CRYPTUI_VIEWCERTIFICATE_STRUCTW サイズ: 120 バイト(x64)
dim st, 30    ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hwndParent : HWND (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwFlags : CRYPTUI_VIEWCERTIFICATE_FLAGS (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; szTitle : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pCertContext : CERT_CONTEXT* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; rgszPurposes : LPSTR* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; cPurposes : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; fpCryptProviderDataTrustedUsage : BOOL (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; idxSigner : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; idxCert : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; fCounterSigner : BOOL (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; idxCounterSigner : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; cStores : DWORD (+84, 4byte)  st.21 = 値  /  値 = st.21   (lpoke/lpeek も可)
; rghStores : HCERTSTORE* (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; cPropSheetPages : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; rgPropSheetPages : PROPSHEETPAGEW* (+104, 8byte)  varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; nStartPage : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CRYPTUI_VIEWCERTIFICATE_STRUCTW
    #field int dwSize
    #field intptr hwndParent
    #field int dwFlags
    #field intptr szTitle
    #field intptr pCertContext
    #field intptr rgszPurposes
    #field int cPurposes
    #field byte Anonymous 8
    #field bool fpCryptProviderDataTrustedUsage
    #field int idxSigner
    #field int idxCert
    #field bool fCounterSigner
    #field int idxCounterSigner
    #field int cStores
    #field intptr rghStores
    #field int cPropSheetPages
    #field intptr rgPropSheetPages
    #field int nStartPage
#endstruct

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