Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug › WHEA_ERROR_SOURCE_DESCRIPTOR

WHEA_ERROR_SOURCE_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
LengthDWORD4+0+0この記述子のバイト長を示す。
VersionDWORD4+4+4記述子のバージョンを示す。
TypeWHEA_ERROR_SOURCE_TYPE4+8+8エラーソースの種別(WHEA_ERROR_SOURCE_TYPE)を示す。
StateWHEA_ERROR_SOURCE_STATE4+12+12エラーソースの状態(WHEA_ERROR_SOURCE_STATE)を示す。
MaxRawDataLengthDWORD4+16+16生データの最大バイト長を示す。
NumRecordsToPreallocateDWORD4+20+20事前確保するエラーレコード数を示す。
MaxSectionsPerRecordDWORD4+24+241レコードあたりの最大セクション数を示す。
ErrorSourceIdDWORD4+28+28エラーソースを識別する ID を示す。
PlatformErrorSourceIdDWORD4+32+32プラットフォーム側のエラーソース ID を示す。
FlagsDWORD4+36+36エラーソースの属性フラグを示す。
Info_Info_e__Union920+40+40エラーソース種別ごとの詳細情報を保持する無名共用体。

共用体: _Info_e__Union x64 920B / x86 920B

フィールドサイズx64x86
XpfMceDescriptorWHEA_XPF_MCE_DESCRIPTOR920+0+0
XpfCmcDescriptorWHEA_XPF_CMC_DESCRIPTOR920/912+0+0
XpfNmiDescriptorWHEA_XPF_NMI_DESCRIPTOR3+0+0
IpfMcaDescriptorWHEA_IPF_MCA_DESCRIPTOR4+0+0
IpfCmcDescriptorWHEA_IPF_CMC_DESCRIPTOR4+0+0
IpfCpeDescriptorWHEA_IPF_CPE_DESCRIPTOR4+0+0
AerRootportDescriptorWHEA_AER_ROOTPORT_DESCRIPTOR40/36+0+0
AerEndpointDescriptorWHEA_AER_ENDPOINT_DESCRIPTOR36/32+0+0
AerBridgeDescriptorWHEA_AER_BRIDGE_DESCRIPTOR48/44+0+0
GenErrDescriptorWHEA_GENERIC_ERROR_DESCRIPTOR40/32+0+0
GenErrDescriptorV2WHEA_GENERIC_ERROR_DESCRIPTOR_V268/60+0+0
DeviceDriverDescriptorWHEA_DEVICE_DRIVER_DESCRIPTOR116/96+0+0

各言語での定義

#include <windows.h>

// WHEA_ERROR_SOURCE_DESCRIPTOR  (x64 960 / x86 960 バイト)
#pragma pack(push, 1)
typedef struct WHEA_ERROR_SOURCE_DESCRIPTOR {
    DWORD Length;
    DWORD Version;
    WHEA_ERROR_SOURCE_TYPE Type;
    WHEA_ERROR_SOURCE_STATE State;
    DWORD MaxRawDataLength;
    DWORD NumRecordsToPreallocate;
    DWORD MaxSectionsPerRecord;
    DWORD ErrorSourceId;
    DWORD PlatformErrorSourceId;
    DWORD Flags;
    _Info_e__Union Info;
} WHEA_ERROR_SOURCE_DESCRIPTOR;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WHEA_ERROR_SOURCE_DESCRIPTOR
{
    public uint Length;
    public uint Version;
    public int Type;
    public int State;
    public uint MaxRawDataLength;
    public uint NumRecordsToPreallocate;
    public uint MaxSectionsPerRecord;
    public uint ErrorSourceId;
    public uint PlatformErrorSourceId;
    public uint Flags;
    public _Info_e__Union Info;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WHEA_ERROR_SOURCE_DESCRIPTOR
    Public Length As UInteger
    Public Version As UInteger
    Public Type As Integer
    Public State As Integer
    Public MaxRawDataLength As UInteger
    Public NumRecordsToPreallocate As UInteger
    Public MaxSectionsPerRecord As UInteger
    Public ErrorSourceId As UInteger
    Public PlatformErrorSourceId As UInteger
    Public Flags As UInteger
    Public Info As _Info_e__Union
End Structure
import ctypes
from ctypes import wintypes

class WHEA_ERROR_SOURCE_DESCRIPTOR(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Length", wintypes.DWORD),
        ("Version", wintypes.DWORD),
        ("Type", ctypes.c_int),
        ("State", ctypes.c_int),
        ("MaxRawDataLength", wintypes.DWORD),
        ("NumRecordsToPreallocate", wintypes.DWORD),
        ("MaxSectionsPerRecord", wintypes.DWORD),
        ("ErrorSourceId", wintypes.DWORD),
        ("PlatformErrorSourceId", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("Info", _Info_e__Union),
    ]
#[repr(C, packed(1))]
pub struct WHEA_ERROR_SOURCE_DESCRIPTOR {
    pub Length: u32,
    pub Version: u32,
    pub Type: i32,
    pub State: i32,
    pub MaxRawDataLength: u32,
    pub NumRecordsToPreallocate: u32,
    pub MaxSectionsPerRecord: u32,
    pub ErrorSourceId: u32,
    pub PlatformErrorSourceId: u32,
    pub Flags: u32,
    pub Info: _Info_e__Union,
}
import "golang.org/x/sys/windows"

type WHEA_ERROR_SOURCE_DESCRIPTOR struct {
	Length uint32
	Version uint32
	Type int32
	State int32
	MaxRawDataLength uint32
	NumRecordsToPreallocate uint32
	MaxSectionsPerRecord uint32
	ErrorSourceId uint32
	PlatformErrorSourceId uint32
	Flags uint32
	Info _Info_e__Union
}
type
  WHEA_ERROR_SOURCE_DESCRIPTOR = packed record
    Length: DWORD;
    Version: DWORD;
    Type: Integer;
    State: Integer;
    MaxRawDataLength: DWORD;
    NumRecordsToPreallocate: DWORD;
    MaxSectionsPerRecord: DWORD;
    ErrorSourceId: DWORD;
    PlatformErrorSourceId: DWORD;
    Flags: DWORD;
    Info: _Info_e__Union;
  end;
const WHEA_ERROR_SOURCE_DESCRIPTOR = extern struct {
    Length: u32,
    Version: u32,
    Type: i32,
    State: i32,
    MaxRawDataLength: u32,
    NumRecordsToPreallocate: u32,
    MaxSectionsPerRecord: u32,
    ErrorSourceId: u32,
    PlatformErrorSourceId: u32,
    Flags: u32,
    Info: _Info_e__Union,
};
type
  WHEA_ERROR_SOURCE_DESCRIPTOR {.packed.} = object
    Length: uint32
    Version: uint32
    Type: int32
    State: int32
    MaxRawDataLength: uint32
    NumRecordsToPreallocate: uint32
    MaxSectionsPerRecord: uint32
    ErrorSourceId: uint32
    PlatformErrorSourceId: uint32
    Flags: uint32
    Info: _Info_e__Union
align(1)
struct WHEA_ERROR_SOURCE_DESCRIPTOR
{
    uint Length;
    uint Version;
    int Type;
    int State;
    uint MaxRawDataLength;
    uint NumRecordsToPreallocate;
    uint MaxSectionsPerRecord;
    uint ErrorSourceId;
    uint PlatformErrorSourceId;
    uint Flags;
    _Info_e__Union Info;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WHEA_ERROR_SOURCE_DESCRIPTOR サイズ: 960 バイト(x64)
dim st, 240    ; 4byte整数×240(構造体サイズ 960 / 4 切り上げ)
; Length : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Version : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Type : WHEA_ERROR_SOURCE_TYPE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; State : WHEA_ERROR_SOURCE_STATE (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; MaxRawDataLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; NumRecordsToPreallocate : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; MaxSectionsPerRecord : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ErrorSourceId : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; PlatformErrorSourceId : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Flags : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; Info : _Info_e__Union (+40, 920byte)  varptr(st)+40 を基点に操作(920byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WHEA_ERROR_SOURCE_DESCRIPTOR, pack=1
    #field int Length
    #field int Version
    #field int Type
    #field int State
    #field int MaxRawDataLength
    #field int NumRecordsToPreallocate
    #field int MaxSectionsPerRecord
    #field int ErrorSourceId
    #field int PlatformErrorSourceId
    #field int Flags
    #field byte Info 920
#endstruct

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