Win32 API 日本語リファレンス
ホームNetworkManagement.QoS › SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD

SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD

構造体
サイズx64: 17 バイト / x86: 17 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
RootIDDWORD4+0+0署名者のルート証明書を識別するID。
CertificatesLengthDWORD4+4+4証明書データ全体のバイト長。
CertificatesCountWORD2+8+8含まれる証明書の数。
PolicyNameLengthWORD2+10+10ポリシー名の文字数(長さ)。
EKUsLengthWORD2+12+12拡張キー使用法(EKU)データのバイト長。
EKUsCountWORD2+14+14EKUエントリの数。
VarLengthDataBYTE1+16+16証明書・ポリシー名・EKUを含む可変長データの先頭バイト。

各言語での定義

#include <windows.h>

// SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD  (x64 17 / x86 17 バイト)
#pragma pack(push, 1)
typedef struct SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD {
    DWORD RootID;
    DWORD CertificatesLength;
    WORD CertificatesCount;
    WORD PolicyNameLength;
    WORD EKUsLength;
    WORD EKUsCount;
    BYTE VarLengthData[1];
} SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD
{
    public uint RootID;
    public uint CertificatesLength;
    public ushort CertificatesCount;
    public ushort PolicyNameLength;
    public ushort EKUsLength;
    public ushort EKUsCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] VarLengthData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD
    Public RootID As UInteger
    Public CertificatesLength As UInteger
    Public CertificatesCount As UShort
    Public PolicyNameLength As UShort
    Public EKUsLength As UShort
    Public EKUsCount As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public VarLengthData() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("RootID", wintypes.DWORD),
        ("CertificatesLength", wintypes.DWORD),
        ("CertificatesCount", ctypes.c_ushort),
        ("PolicyNameLength", ctypes.c_ushort),
        ("EKUsLength", ctypes.c_ushort),
        ("EKUsCount", ctypes.c_ushort),
        ("VarLengthData", ctypes.c_ubyte * 1),
    ]
#[repr(C, packed(1))]
pub struct SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD {
    pub RootID: u32,
    pub CertificatesLength: u32,
    pub CertificatesCount: u16,
    pub PolicyNameLength: u16,
    pub EKUsLength: u16,
    pub EKUsCount: u16,
    pub VarLengthData: [u8; 1],
}
import "golang.org/x/sys/windows"

type SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD struct {
	RootID uint32
	CertificatesLength uint32
	CertificatesCount uint16
	PolicyNameLength uint16
	EKUsLength uint16
	EKUsCount uint16
	VarLengthData [1]byte
}
type
  SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD = packed record
    RootID: DWORD;
    CertificatesLength: DWORD;
    CertificatesCount: Word;
    PolicyNameLength: Word;
    EKUsLength: Word;
    EKUsCount: Word;
    VarLengthData: array[0..0] of Byte;
  end;
const SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD = extern struct {
    RootID: u32,
    CertificatesLength: u32,
    CertificatesCount: u16,
    PolicyNameLength: u16,
    EKUsLength: u16,
    EKUsCount: u16,
    VarLengthData: [1]u8,
};
type
  SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD {.packed.} = object
    RootID: uint32
    CertificatesLength: uint32
    CertificatesCount: uint16
    PolicyNameLength: uint16
    EKUsLength: uint16
    EKUsCount: uint16
    VarLengthData: array[1, uint8]
align(1)
struct SIPAEVENT_SI_POLICY_SIGNER_PAYLOAD
{
    uint RootID;
    uint CertificatesLength;
    ushort CertificatesCount;
    ushort PolicyNameLength;
    ushort EKUsLength;
    ushort EKUsCount;
    ubyte[1] VarLengthData;
}

HSP用 定義

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

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

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