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

CERT_NAME_CONSTRAINTS_INFO

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

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

フィールド

フィールドサイズx64x86説明
cPermittedSubtreeDWORD4+0+0許可サブツリーの個数。
rgPermittedSubtreeCERT_GENERAL_SUBTREE*8/4+8+4許可されるCERT_GENERAL_SUBTREE構造体の配列へのポインタ。
cExcludedSubtreeDWORD4+16+8除外サブツリーの個数。
rgExcludedSubtreeCERT_GENERAL_SUBTREE*8/4+24+12除外されるCERT_GENERAL_SUBTREE構造体の配列へのポインタ。

各言語での定義

#include <windows.h>

// CERT_NAME_CONSTRAINTS_INFO  (x64 32 / x86 16 バイト)
typedef struct CERT_NAME_CONSTRAINTS_INFO {
    DWORD cPermittedSubtree;
    CERT_GENERAL_SUBTREE* rgPermittedSubtree;
    DWORD cExcludedSubtree;
    CERT_GENERAL_SUBTREE* rgExcludedSubtree;
} CERT_NAME_CONSTRAINTS_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CERT_NAME_CONSTRAINTS_INFO
{
    public uint cPermittedSubtree;
    public IntPtr rgPermittedSubtree;
    public uint cExcludedSubtree;
    public IntPtr rgExcludedSubtree;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CERT_NAME_CONSTRAINTS_INFO
    Public cPermittedSubtree As UInteger
    Public rgPermittedSubtree As IntPtr
    Public cExcludedSubtree As UInteger
    Public rgExcludedSubtree As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class CERT_NAME_CONSTRAINTS_INFO(ctypes.Structure):
    _fields_ = [
        ("cPermittedSubtree", wintypes.DWORD),
        ("rgPermittedSubtree", ctypes.c_void_p),
        ("cExcludedSubtree", wintypes.DWORD),
        ("rgExcludedSubtree", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct CERT_NAME_CONSTRAINTS_INFO {
    pub cPermittedSubtree: u32,
    pub rgPermittedSubtree: *mut core::ffi::c_void,
    pub cExcludedSubtree: u32,
    pub rgExcludedSubtree: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type CERT_NAME_CONSTRAINTS_INFO struct {
	cPermittedSubtree uint32
	rgPermittedSubtree uintptr
	cExcludedSubtree uint32
	rgExcludedSubtree uintptr
}
type
  CERT_NAME_CONSTRAINTS_INFO = record
    cPermittedSubtree: DWORD;
    rgPermittedSubtree: Pointer;
    cExcludedSubtree: DWORD;
    rgExcludedSubtree: Pointer;
  end;
const CERT_NAME_CONSTRAINTS_INFO = extern struct {
    cPermittedSubtree: u32,
    rgPermittedSubtree: ?*anyopaque,
    cExcludedSubtree: u32,
    rgExcludedSubtree: ?*anyopaque,
};
type
  CERT_NAME_CONSTRAINTS_INFO {.bycopy.} = object
    cPermittedSubtree: uint32
    rgPermittedSubtree: pointer
    cExcludedSubtree: uint32
    rgExcludedSubtree: pointer
struct CERT_NAME_CONSTRAINTS_INFO
{
    uint cPermittedSubtree;
    void* rgPermittedSubtree;
    uint cExcludedSubtree;
    void* rgExcludedSubtree;
}

HSP用 定義

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

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

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