Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSD_SECURITY_CERT_VALIDATION

WSD_SECURITY_CERT_VALIDATION

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

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

フィールド

フィールドサイズx64x86説明
certMatchArrayCERT_CONTEXT**8/4+0+0照合に用いる証明書コンテキストの配列。
dwCertMatchArrayCountDWORD4+8+4証明書配列の要素数。
hCertMatchStoreHCERTSTORE8/4+16+8照合用証明書ストアのハンドル。
hCertIssuerStoreHCERTSTORE8/4+24+12発行者証明書ストアのハンドル。
dwCertCheckOptionsDWORD4+32+16証明書検証時のオプションフラグ。
pszCNGHashAlgIdLPWSTR8/4+40+20CNGハッシュアルゴリズムの識別子文字列。
pbCertHashBYTE*8/4+48+24比較対象の証明書ハッシュ値バッファ。
dwCertHashSizeDWORD4+56+28証明書ハッシュのバイトサイズ。

各言語での定義

#include <windows.h>

// WSD_SECURITY_CERT_VALIDATION  (x64 64 / x86 32 バイト)
typedef struct WSD_SECURITY_CERT_VALIDATION {
    CERT_CONTEXT** certMatchArray;
    DWORD dwCertMatchArrayCount;
    HCERTSTORE hCertMatchStore;
    HCERTSTORE hCertIssuerStore;
    DWORD dwCertCheckOptions;
    LPWSTR pszCNGHashAlgId;
    BYTE* pbCertHash;
    DWORD dwCertHashSize;
} WSD_SECURITY_CERT_VALIDATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSD_SECURITY_CERT_VALIDATION
{
    public IntPtr certMatchArray;
    public uint dwCertMatchArrayCount;
    public IntPtr hCertMatchStore;
    public IntPtr hCertIssuerStore;
    public uint dwCertCheckOptions;
    public IntPtr pszCNGHashAlgId;
    public IntPtr pbCertHash;
    public uint dwCertHashSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSD_SECURITY_CERT_VALIDATION
    Public certMatchArray As IntPtr
    Public dwCertMatchArrayCount As UInteger
    Public hCertMatchStore As IntPtr
    Public hCertIssuerStore As IntPtr
    Public dwCertCheckOptions As UInteger
    Public pszCNGHashAlgId As IntPtr
    Public pbCertHash As IntPtr
    Public dwCertHashSize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WSD_SECURITY_CERT_VALIDATION(ctypes.Structure):
    _fields_ = [
        ("certMatchArray", ctypes.c_void_p),
        ("dwCertMatchArrayCount", wintypes.DWORD),
        ("hCertMatchStore", ctypes.c_void_p),
        ("hCertIssuerStore", ctypes.c_void_p),
        ("dwCertCheckOptions", wintypes.DWORD),
        ("pszCNGHashAlgId", ctypes.c_void_p),
        ("pbCertHash", ctypes.c_void_p),
        ("dwCertHashSize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WSD_SECURITY_CERT_VALIDATION {
    pub certMatchArray: *mut core::ffi::c_void,
    pub dwCertMatchArrayCount: u32,
    pub hCertMatchStore: *mut core::ffi::c_void,
    pub hCertIssuerStore: *mut core::ffi::c_void,
    pub dwCertCheckOptions: u32,
    pub pszCNGHashAlgId: *mut core::ffi::c_void,
    pub pbCertHash: *mut core::ffi::c_void,
    pub dwCertHashSize: u32,
}
import "golang.org/x/sys/windows"

type WSD_SECURITY_CERT_VALIDATION struct {
	certMatchArray uintptr
	dwCertMatchArrayCount uint32
	hCertMatchStore uintptr
	hCertIssuerStore uintptr
	dwCertCheckOptions uint32
	pszCNGHashAlgId uintptr
	pbCertHash uintptr
	dwCertHashSize uint32
}
type
  WSD_SECURITY_CERT_VALIDATION = record
    certMatchArray: Pointer;
    dwCertMatchArrayCount: DWORD;
    hCertMatchStore: Pointer;
    hCertIssuerStore: Pointer;
    dwCertCheckOptions: DWORD;
    pszCNGHashAlgId: Pointer;
    pbCertHash: Pointer;
    dwCertHashSize: DWORD;
  end;
const WSD_SECURITY_CERT_VALIDATION = extern struct {
    certMatchArray: ?*anyopaque,
    dwCertMatchArrayCount: u32,
    hCertMatchStore: ?*anyopaque,
    hCertIssuerStore: ?*anyopaque,
    dwCertCheckOptions: u32,
    pszCNGHashAlgId: ?*anyopaque,
    pbCertHash: ?*anyopaque,
    dwCertHashSize: u32,
};
type
  WSD_SECURITY_CERT_VALIDATION {.bycopy.} = object
    certMatchArray: pointer
    dwCertMatchArrayCount: uint32
    hCertMatchStore: pointer
    hCertIssuerStore: pointer
    dwCertCheckOptions: uint32
    pszCNGHashAlgId: pointer
    pbCertHash: pointer
    dwCertHashSize: uint32
struct WSD_SECURITY_CERT_VALIDATION
{
    void* certMatchArray;
    uint dwCertMatchArrayCount;
    void* hCertMatchStore;
    void* hCertIssuerStore;
    uint dwCertCheckOptions;
    void* pszCNGHashAlgId;
    void* pbCertHash;
    uint dwCertHashSize;
}

HSP用 定義

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

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

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