ホーム › Security.WinTrust › WIN_CERTIFICATE
WIN_CERTIFICATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| dwLength | DWORD | 4 | +0 | +0 | 署名の長さをバイト単位で指定します。 | ||||||||||
| wRevision | WORD | 2 | +4 | +4 | 証明書のリビジョンを指定します。 定義されている証明書のリビジョンは WIN_CERT_REVISION_1_0 (0x0100) および WIN_CERT_REVISION_2_0 (0x0200) です。 | ||||||||||
| wCertificateType | WORD | 2 | +6 | +6 | 証明書の種類を指定します。
| ||||||||||
| bCertificate | BYTE | 1 | +8 | +8 | 証明書の配列です。 このメンバーの形式は wCertificateType の値によって異なります。 |
公式ドキュメント
この構造体は、実行可能ファイルの検証に使用される署名をカプセル化します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// WIN_CERTIFICATE (x64 12 / x86 12 バイト)
typedef struct WIN_CERTIFICATE {
DWORD dwLength;
WORD wRevision;
WORD wCertificateType;
BYTE bCertificate[1];
} WIN_CERTIFICATE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIN_CERTIFICATE
{
public uint dwLength;
public ushort wRevision;
public ushort wCertificateType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] bCertificate;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIN_CERTIFICATE
Public dwLength As UInteger
Public wRevision As UShort
Public wCertificateType As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public bCertificate() As Byte
End Structureimport ctypes
from ctypes import wintypes
class WIN_CERTIFICATE(ctypes.Structure):
_fields_ = [
("dwLength", wintypes.DWORD),
("wRevision", ctypes.c_ushort),
("wCertificateType", ctypes.c_ushort),
("bCertificate", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct WIN_CERTIFICATE {
pub dwLength: u32,
pub wRevision: u16,
pub wCertificateType: u16,
pub bCertificate: [u8; 1],
}import "golang.org/x/sys/windows"
type WIN_CERTIFICATE struct {
dwLength uint32
wRevision uint16
wCertificateType uint16
bCertificate [1]byte
}type
WIN_CERTIFICATE = record
dwLength: DWORD;
wRevision: Word;
wCertificateType: Word;
bCertificate: array[0..0] of Byte;
end;const WIN_CERTIFICATE = extern struct {
dwLength: u32,
wRevision: u16,
wCertificateType: u16,
bCertificate: [1]u8,
};type
WIN_CERTIFICATE {.bycopy.} = object
dwLength: uint32
wRevision: uint16
wCertificateType: uint16
bCertificate: array[1, uint8]struct WIN_CERTIFICATE
{
uint dwLength;
ushort wRevision;
ushort wCertificateType;
ubyte[1] bCertificate;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WIN_CERTIFICATE サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; dwLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; wRevision : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; wCertificateType : WORD (+6, 2byte) wpoke st,6,値 / 値 = wpeek(st,6)
; bCertificate : BYTE (+8, 1byte) varptr(st)+8 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WIN_CERTIFICATE
#field int dwLength
#field short wRevision
#field short wCertificateType
#field byte bCertificate 1
#endstruct
stdim st, WIN_CERTIFICATE ; NSTRUCT 変数を確保
st->dwLength = 100
mes "dwLength=" + st->dwLength