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

SIGNER_SIGNATURE_INFO

構造体
サイズx64: 40 バイト / x86: 24 バイト

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のバイト単位サイズ。呼び出し前に設定する。
algidHashALG_ID4+4+4署名で使用するハッシュアルゴリズムのALG_ID。
dwAttrChoiceSIGNER_SIGNATURE_ATTRIBUTE_CHOICE4+8+8署名属性の指定方法を示す列挙値。
Anonymous_Anonymous_e__Union8/4+16+12選択方式に応じた署名属性情報を保持する無名共用体。
psAuthenticatedCRYPT_ATTRIBUTES*8/4+24+16認証付き属性CRYPT_ATTRIBUTESへのポインタ。NULL可。
psUnauthenticatedCRYPT_ATTRIBUTES*8/4+32+20非認証属性CRYPT_ATTRIBUTESへのポインタ。NULL可。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
pAttrAuthcodeSIGNER_ATTR_AUTHCODE*8/4+0+0

各言語での定義

#include <windows.h>

// SIGNER_SIGNATURE_INFO  (x64 40 / x86 24 バイト)
typedef struct SIGNER_SIGNATURE_INFO {
    DWORD cbSize;
    ALG_ID algidHash;
    SIGNER_SIGNATURE_ATTRIBUTE_CHOICE dwAttrChoice;
    _Anonymous_e__Union Anonymous;
    CRYPT_ATTRIBUTES* psAuthenticated;
    CRYPT_ATTRIBUTES* psUnauthenticated;
} SIGNER_SIGNATURE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIGNER_SIGNATURE_INFO
{
    public uint cbSize;
    public uint algidHash;
    public uint dwAttrChoice;
    public _Anonymous_e__Union Anonymous;
    public IntPtr psAuthenticated;
    public IntPtr psUnauthenticated;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIGNER_SIGNATURE_INFO
    Public cbSize As UInteger
    Public algidHash As UInteger
    Public dwAttrChoice As UInteger
    Public Anonymous As _Anonymous_e__Union
    Public psAuthenticated As IntPtr
    Public psUnauthenticated As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SIGNER_SIGNATURE_INFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("algidHash", wintypes.DWORD),
        ("dwAttrChoice", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("psAuthenticated", ctypes.c_void_p),
        ("psUnauthenticated", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SIGNER_SIGNATURE_INFO {
    pub cbSize: u32,
    pub algidHash: u32,
    pub dwAttrChoice: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub psAuthenticated: *mut core::ffi::c_void,
    pub psUnauthenticated: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SIGNER_SIGNATURE_INFO struct {
	cbSize uint32
	algidHash uint32
	dwAttrChoice uint32
	Anonymous _Anonymous_e__Union
	psAuthenticated uintptr
	psUnauthenticated uintptr
}
type
  SIGNER_SIGNATURE_INFO = record
    cbSize: DWORD;
    algidHash: DWORD;
    dwAttrChoice: DWORD;
    Anonymous: _Anonymous_e__Union;
    psAuthenticated: Pointer;
    psUnauthenticated: Pointer;
  end;
const SIGNER_SIGNATURE_INFO = extern struct {
    cbSize: u32,
    algidHash: u32,
    dwAttrChoice: u32,
    Anonymous: _Anonymous_e__Union,
    psAuthenticated: ?*anyopaque,
    psUnauthenticated: ?*anyopaque,
};
type
  SIGNER_SIGNATURE_INFO {.bycopy.} = object
    cbSize: uint32
    algidHash: uint32
    dwAttrChoice: uint32
    Anonymous: _Anonymous_e__Union
    psAuthenticated: pointer
    psUnauthenticated: pointer
struct SIGNER_SIGNATURE_INFO
{
    uint cbSize;
    uint algidHash;
    uint dwAttrChoice;
    _Anonymous_e__Union Anonymous;
    void* psAuthenticated;
    void* psUnauthenticated;
}

HSP用 定義

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

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

stdim st, SIGNER_SIGNATURE_INFO        ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。