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

CERT_CHAIN_ENGINE_CONFIG

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズ(バイト単位)。
hRestrictedRootHCERTSTORE8/4+8+4信頼するルートを限定する証明書ストアのハンドル。NULL可。
hRestrictedTrustHCERTSTORE8/4+16+8信頼する中間証明書を限定するストアのハンドル。NULL可。
hRestrictedOtherHCERTSTORE8/4+24+12その他の証明書を限定するストアのハンドル。NULL可。
cAdditionalStoreDWORD4+32+16rghAdditionalStore配列の要素数。
rghAdditionalStoreHCERTSTORE*8/4+40+20チェーン構築に使う追加証明書ストアの配列へのポインタ。NULL可。
dwFlagsDWORD4+48+24チェーンエンジンの動作を制御するフラグ。
dwUrlRetrievalTimeoutDWORD4+52+28URL取得のタイムアウト(ミリ秒単位)。0で既定値。
MaximumCachedCertificatesDWORD4+56+32キャッシュする証明書の最大数。0で既定値。
CycleDetectionModulusDWORD4+60+36循環検出を行う頻度を示す値。0で既定値。
hExclusiveRootHCERTSTORE8/4+64+40排他的に信頼するルートを格納するストアのハンドル。NULL可。
hExclusiveTrustedPeopleHCERTSTORE8/4+72+44排他的に信頼するエンティティを格納するストアのハンドル。NULL可。
dwExclusiveFlagsDWORD4+80+48排他的信頼の動作を制御するフラグ。

各言語での定義

#include <windows.h>

// CERT_CHAIN_ENGINE_CONFIG  (x64 88 / x86 52 バイト)
typedef struct CERT_CHAIN_ENGINE_CONFIG {
    DWORD cbSize;
    HCERTSTORE hRestrictedRoot;
    HCERTSTORE hRestrictedTrust;
    HCERTSTORE hRestrictedOther;
    DWORD cAdditionalStore;
    HCERTSTORE* rghAdditionalStore;
    DWORD dwFlags;
    DWORD dwUrlRetrievalTimeout;
    DWORD MaximumCachedCertificates;
    DWORD CycleDetectionModulus;
    HCERTSTORE hExclusiveRoot;
    HCERTSTORE hExclusiveTrustedPeople;
    DWORD dwExclusiveFlags;
} CERT_CHAIN_ENGINE_CONFIG;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_CHAIN_ENGINE_CONFIG
{
    public uint cbSize;
    public IntPtr hRestrictedRoot;
    public IntPtr hRestrictedTrust;
    public IntPtr hRestrictedOther;
    public uint cAdditionalStore;
    public IntPtr rghAdditionalStore;
    public uint dwFlags;
    public uint dwUrlRetrievalTimeout;
    public uint MaximumCachedCertificates;
    public uint CycleDetectionModulus;
    public IntPtr hExclusiveRoot;
    public IntPtr hExclusiveTrustedPeople;
    public uint dwExclusiveFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_CHAIN_ENGINE_CONFIG
    Public cbSize As UInteger
    Public hRestrictedRoot As IntPtr
    Public hRestrictedTrust As IntPtr
    Public hRestrictedOther As IntPtr
    Public cAdditionalStore As UInteger
    Public rghAdditionalStore As IntPtr
    Public dwFlags As UInteger
    Public dwUrlRetrievalTimeout As UInteger
    Public MaximumCachedCertificates As UInteger
    Public CycleDetectionModulus As UInteger
    Public hExclusiveRoot As IntPtr
    Public hExclusiveTrustedPeople As IntPtr
    Public dwExclusiveFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CERT_CHAIN_ENGINE_CONFIG(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("hRestrictedRoot", ctypes.c_void_p),
        ("hRestrictedTrust", ctypes.c_void_p),
        ("hRestrictedOther", ctypes.c_void_p),
        ("cAdditionalStore", wintypes.DWORD),
        ("rghAdditionalStore", ctypes.c_void_p),
        ("dwFlags", wintypes.DWORD),
        ("dwUrlRetrievalTimeout", wintypes.DWORD),
        ("MaximumCachedCertificates", wintypes.DWORD),
        ("CycleDetectionModulus", wintypes.DWORD),
        ("hExclusiveRoot", ctypes.c_void_p),
        ("hExclusiveTrustedPeople", ctypes.c_void_p),
        ("dwExclusiveFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CERT_CHAIN_ENGINE_CONFIG {
    pub cbSize: u32,
    pub hRestrictedRoot: *mut core::ffi::c_void,
    pub hRestrictedTrust: *mut core::ffi::c_void,
    pub hRestrictedOther: *mut core::ffi::c_void,
    pub cAdditionalStore: u32,
    pub rghAdditionalStore: *mut core::ffi::c_void,
    pub dwFlags: u32,
    pub dwUrlRetrievalTimeout: u32,
    pub MaximumCachedCertificates: u32,
    pub CycleDetectionModulus: u32,
    pub hExclusiveRoot: *mut core::ffi::c_void,
    pub hExclusiveTrustedPeople: *mut core::ffi::c_void,
    pub dwExclusiveFlags: u32,
}
import "golang.org/x/sys/windows"

type CERT_CHAIN_ENGINE_CONFIG struct {
	cbSize uint32
	hRestrictedRoot uintptr
	hRestrictedTrust uintptr
	hRestrictedOther uintptr
	cAdditionalStore uint32
	rghAdditionalStore uintptr
	dwFlags uint32
	dwUrlRetrievalTimeout uint32
	MaximumCachedCertificates uint32
	CycleDetectionModulus uint32
	hExclusiveRoot uintptr
	hExclusiveTrustedPeople uintptr
	dwExclusiveFlags uint32
}
type
  CERT_CHAIN_ENGINE_CONFIG = record
    cbSize: DWORD;
    hRestrictedRoot: Pointer;
    hRestrictedTrust: Pointer;
    hRestrictedOther: Pointer;
    cAdditionalStore: DWORD;
    rghAdditionalStore: Pointer;
    dwFlags: DWORD;
    dwUrlRetrievalTimeout: DWORD;
    MaximumCachedCertificates: DWORD;
    CycleDetectionModulus: DWORD;
    hExclusiveRoot: Pointer;
    hExclusiveTrustedPeople: Pointer;
    dwExclusiveFlags: DWORD;
  end;
const CERT_CHAIN_ENGINE_CONFIG = extern struct {
    cbSize: u32,
    hRestrictedRoot: ?*anyopaque,
    hRestrictedTrust: ?*anyopaque,
    hRestrictedOther: ?*anyopaque,
    cAdditionalStore: u32,
    rghAdditionalStore: ?*anyopaque,
    dwFlags: u32,
    dwUrlRetrievalTimeout: u32,
    MaximumCachedCertificates: u32,
    CycleDetectionModulus: u32,
    hExclusiveRoot: ?*anyopaque,
    hExclusiveTrustedPeople: ?*anyopaque,
    dwExclusiveFlags: u32,
};
type
  CERT_CHAIN_ENGINE_CONFIG {.bycopy.} = object
    cbSize: uint32
    hRestrictedRoot: pointer
    hRestrictedTrust: pointer
    hRestrictedOther: pointer
    cAdditionalStore: uint32
    rghAdditionalStore: pointer
    dwFlags: uint32
    dwUrlRetrievalTimeout: uint32
    MaximumCachedCertificates: uint32
    CycleDetectionModulus: uint32
    hExclusiveRoot: pointer
    hExclusiveTrustedPeople: pointer
    dwExclusiveFlags: uint32
struct CERT_CHAIN_ENGINE_CONFIG
{
    uint cbSize;
    void* hRestrictedRoot;
    void* hRestrictedTrust;
    void* hRestrictedOther;
    uint cAdditionalStore;
    void* rghAdditionalStore;
    uint dwFlags;
    uint dwUrlRetrievalTimeout;
    uint MaximumCachedCertificates;
    uint CycleDetectionModulus;
    void* hExclusiveRoot;
    void* hExclusiveTrustedPeople;
    uint dwExclusiveFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CERT_CHAIN_ENGINE_CONFIG サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hRestrictedRoot : HCERTSTORE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hRestrictedTrust : HCERTSTORE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; hRestrictedOther : HCERTSTORE (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cAdditionalStore : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; rghAdditionalStore : HCERTSTORE* (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwFlags : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwUrlRetrievalTimeout : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; MaximumCachedCertificates : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; CycleDetectionModulus : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; hExclusiveRoot : HCERTSTORE (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; hExclusiveTrustedPeople : HCERTSTORE (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwExclusiveFlags : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CERT_CHAIN_ENGINE_CONFIG サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hRestrictedRoot : HCERTSTORE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hRestrictedTrust : HCERTSTORE (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hRestrictedOther : HCERTSTORE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cAdditionalStore : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; rghAdditionalStore : HCERTSTORE* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dwFlags : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwUrlRetrievalTimeout : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; MaximumCachedCertificates : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; CycleDetectionModulus : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; hExclusiveRoot : HCERTSTORE (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; hExclusiveTrustedPeople : HCERTSTORE (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; dwExclusiveFlags : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CERT_CHAIN_ENGINE_CONFIG
    #field int cbSize
    #field intptr hRestrictedRoot
    #field intptr hRestrictedTrust
    #field intptr hRestrictedOther
    #field int cAdditionalStore
    #field intptr rghAdditionalStore
    #field int dwFlags
    #field int dwUrlRetrievalTimeout
    #field int MaximumCachedCertificates
    #field int CycleDetectionModulus
    #field intptr hExclusiveRoot
    #field intptr hExclusiveTrustedPeople
    #field int dwExclusiveFlags
#endstruct

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