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

WHEA_GENERIC_ERROR_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
TypeWORD2+0+0エラーソースの種別を示す。
ReservedBYTE1+2+2予約フィールド。使用しない。
EnabledBYTE1+3+3汎用エラーソースが有効かを示すフラグ。
ErrStatusBlockLengthDWORD4+4+4エラーステータスブロックのバイト長を示す。
RelatedErrorSourceIdDWORD4+8+8関連するエラーソースの ID を示す。
ErrStatusAddressSpaceIDBYTE1+12+12エラーステータスアドレスのアドレス空間 ID(ACPI GAS)を示す。
ErrStatusAddressBitWidthBYTE1+13+13エラーステータスアドレスのビット幅を示す。
ErrStatusAddressBitOffsetBYTE1+14+14エラーステータスアドレスのビットオフセットを示す。
ErrStatusAddressAccessSizeBYTE1+15+15エラーステータスアドレスのアクセスサイズを示す。
ErrStatusAddressLONGLONG8+16+16エラーステータスの読み取りアドレスを示す。
NotifyWHEA_NOTIFICATION_DESCRIPTOR16/8+24+24エラー通知方法を示す記述子(WHEA_NOTIFICATION_DESCRIPTOR)。

各言語での定義

#include <windows.h>

// WHEA_NOTIFICATION_FLAGS  (x64 2 / x86 2 バイト)
#pragma pack(push, 1)
typedef struct WHEA_NOTIFICATION_FLAGS {
    _Anonymous_e__Struct Anonymous;
    WORD AsUSHORT;
} WHEA_NOTIFICATION_FLAGS;
#pragma pack(pop)

// WHEA_NOTIFICATION_DESCRIPTOR  (x64 16 / x86 8 バイト)
typedef struct WHEA_NOTIFICATION_DESCRIPTOR {
    BYTE Type;
    BYTE Length;
    WHEA_NOTIFICATION_FLAGS Flags;
    _u_e__Union u;
} WHEA_NOTIFICATION_DESCRIPTOR;

// WHEA_GENERIC_ERROR_DESCRIPTOR  (x64 40 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct WHEA_GENERIC_ERROR_DESCRIPTOR {
    WORD Type;
    BYTE Reserved;
    BYTE Enabled;
    DWORD ErrStatusBlockLength;
    DWORD RelatedErrorSourceId;
    BYTE ErrStatusAddressSpaceID;
    BYTE ErrStatusAddressBitWidth;
    BYTE ErrStatusAddressBitOffset;
    BYTE ErrStatusAddressAccessSize;
    LONGLONG ErrStatusAddress;
    WHEA_NOTIFICATION_DESCRIPTOR Notify;
} WHEA_GENERIC_ERROR_DESCRIPTOR;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WHEA_NOTIFICATION_FLAGS
{
    public _Anonymous_e__Struct Anonymous;
    public ushort AsUSHORT;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WHEA_NOTIFICATION_DESCRIPTOR
{
    public byte Type;
    public byte Length;
    public WHEA_NOTIFICATION_FLAGS Flags;
    public _u_e__Union u;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WHEA_GENERIC_ERROR_DESCRIPTOR
{
    public ushort Type;
    public byte Reserved;
    public byte Enabled;
    public uint ErrStatusBlockLength;
    public uint RelatedErrorSourceId;
    public byte ErrStatusAddressSpaceID;
    public byte ErrStatusAddressBitWidth;
    public byte ErrStatusAddressBitOffset;
    public byte ErrStatusAddressAccessSize;
    public long ErrStatusAddress;
    public WHEA_NOTIFICATION_DESCRIPTOR Notify;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WHEA_NOTIFICATION_FLAGS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUSHORT As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WHEA_NOTIFICATION_DESCRIPTOR
    Public Type As Byte
    Public Length As Byte
    Public Flags As WHEA_NOTIFICATION_FLAGS
    Public u As _u_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WHEA_GENERIC_ERROR_DESCRIPTOR
    Public Type As UShort
    Public Reserved As Byte
    Public Enabled As Byte
    Public ErrStatusBlockLength As UInteger
    Public RelatedErrorSourceId As UInteger
    Public ErrStatusAddressSpaceID As Byte
    Public ErrStatusAddressBitWidth As Byte
    Public ErrStatusAddressBitOffset As Byte
    Public ErrStatusAddressAccessSize As Byte
    Public ErrStatusAddress As Long
    Public Notify As WHEA_NOTIFICATION_DESCRIPTOR
End Structure
import ctypes
from ctypes import wintypes

class WHEA_NOTIFICATION_FLAGS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUSHORT", ctypes.c_ushort),
    ]

class WHEA_NOTIFICATION_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ubyte),
        ("Length", ctypes.c_ubyte),
        ("Flags", WHEA_NOTIFICATION_FLAGS),
        ("u", _u_e__Union),
    ]

class WHEA_GENERIC_ERROR_DESCRIPTOR(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Type", ctypes.c_ushort),
        ("Reserved", ctypes.c_ubyte),
        ("Enabled", ctypes.c_ubyte),
        ("ErrStatusBlockLength", wintypes.DWORD),
        ("RelatedErrorSourceId", wintypes.DWORD),
        ("ErrStatusAddressSpaceID", ctypes.c_ubyte),
        ("ErrStatusAddressBitWidth", ctypes.c_ubyte),
        ("ErrStatusAddressBitOffset", ctypes.c_ubyte),
        ("ErrStatusAddressAccessSize", ctypes.c_ubyte),
        ("ErrStatusAddress", ctypes.c_longlong),
        ("Notify", WHEA_NOTIFICATION_DESCRIPTOR),
    ]
#[repr(C, packed(1))]
pub struct WHEA_NOTIFICATION_FLAGS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUSHORT: u16,
}

#[repr(C)]
pub struct WHEA_NOTIFICATION_DESCRIPTOR {
    pub Type: u8,
    pub Length: u8,
    pub Flags: WHEA_NOTIFICATION_FLAGS,
    pub u: _u_e__Union,
}

#[repr(C, packed(1))]
pub struct WHEA_GENERIC_ERROR_DESCRIPTOR {
    pub Type: u16,
    pub Reserved: u8,
    pub Enabled: u8,
    pub ErrStatusBlockLength: u32,
    pub RelatedErrorSourceId: u32,
    pub ErrStatusAddressSpaceID: u8,
    pub ErrStatusAddressBitWidth: u8,
    pub ErrStatusAddressBitOffset: u8,
    pub ErrStatusAddressAccessSize: u8,
    pub ErrStatusAddress: i64,
    pub Notify: WHEA_NOTIFICATION_DESCRIPTOR,
}
import "golang.org/x/sys/windows"

type WHEA_NOTIFICATION_FLAGS struct {
	Anonymous _Anonymous_e__Struct
	AsUSHORT uint16
}

type WHEA_NOTIFICATION_DESCRIPTOR struct {
	Type byte
	Length byte
	Flags WHEA_NOTIFICATION_FLAGS
	u _u_e__Union
}

type WHEA_GENERIC_ERROR_DESCRIPTOR struct {
	Type uint16
	Reserved byte
	Enabled byte
	ErrStatusBlockLength uint32
	RelatedErrorSourceId uint32
	ErrStatusAddressSpaceID byte
	ErrStatusAddressBitWidth byte
	ErrStatusAddressBitOffset byte
	ErrStatusAddressAccessSize byte
	ErrStatusAddress int64
	Notify WHEA_NOTIFICATION_DESCRIPTOR
}
type
  WHEA_NOTIFICATION_FLAGS = packed record
    Anonymous: _Anonymous_e__Struct;
    AsUSHORT: Word;
  end;

  WHEA_NOTIFICATION_DESCRIPTOR = record
    Type: Byte;
    Length: Byte;
    Flags: WHEA_NOTIFICATION_FLAGS;
    u: _u_e__Union;
  end;

  WHEA_GENERIC_ERROR_DESCRIPTOR = packed record
    Type: Word;
    Reserved: Byte;
    Enabled: Byte;
    ErrStatusBlockLength: DWORD;
    RelatedErrorSourceId: DWORD;
    ErrStatusAddressSpaceID: Byte;
    ErrStatusAddressBitWidth: Byte;
    ErrStatusAddressBitOffset: Byte;
    ErrStatusAddressAccessSize: Byte;
    ErrStatusAddress: Int64;
    Notify: WHEA_NOTIFICATION_DESCRIPTOR;
  end;
const WHEA_NOTIFICATION_FLAGS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUSHORT: u16,
};

const WHEA_NOTIFICATION_DESCRIPTOR = extern struct {
    Type: u8,
    Length: u8,
    Flags: WHEA_NOTIFICATION_FLAGS,
    u: _u_e__Union,
};

const WHEA_GENERIC_ERROR_DESCRIPTOR = extern struct {
    Type: u16,
    Reserved: u8,
    Enabled: u8,
    ErrStatusBlockLength: u32,
    RelatedErrorSourceId: u32,
    ErrStatusAddressSpaceID: u8,
    ErrStatusAddressBitWidth: u8,
    ErrStatusAddressBitOffset: u8,
    ErrStatusAddressAccessSize: u8,
    ErrStatusAddress: i64,
    Notify: WHEA_NOTIFICATION_DESCRIPTOR,
};
type
  WHEA_NOTIFICATION_FLAGS {.packed.} = object
    Anonymous: _Anonymous_e__Struct
    AsUSHORT: uint16

  WHEA_NOTIFICATION_DESCRIPTOR {.bycopy.} = object
    Type: uint8
    Length: uint8
    Flags: WHEA_NOTIFICATION_FLAGS
    u: _u_e__Union

  WHEA_GENERIC_ERROR_DESCRIPTOR {.packed.} = object
    Type: uint16
    Reserved: uint8
    Enabled: uint8
    ErrStatusBlockLength: uint32
    RelatedErrorSourceId: uint32
    ErrStatusAddressSpaceID: uint8
    ErrStatusAddressBitWidth: uint8
    ErrStatusAddressBitOffset: uint8
    ErrStatusAddressAccessSize: uint8
    ErrStatusAddress: int64
    Notify: WHEA_NOTIFICATION_DESCRIPTOR
align(1)
struct WHEA_NOTIFICATION_FLAGS
{
    _Anonymous_e__Struct Anonymous;
    ushort AsUSHORT;
}

struct WHEA_NOTIFICATION_DESCRIPTOR
{
    ubyte Type;
    ubyte Length;
    WHEA_NOTIFICATION_FLAGS Flags;
    _u_e__Union u;
}

align(1)
struct WHEA_GENERIC_ERROR_DESCRIPTOR
{
    ushort Type;
    ubyte Reserved;
    ubyte Enabled;
    uint ErrStatusBlockLength;
    uint RelatedErrorSourceId;
    ubyte ErrStatusAddressSpaceID;
    ubyte ErrStatusAddressBitWidth;
    ubyte ErrStatusAddressBitOffset;
    ubyte ErrStatusAddressAccessSize;
    long ErrStatusAddress;
    WHEA_NOTIFICATION_DESCRIPTOR Notify;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WHEA_GENERIC_ERROR_DESCRIPTOR サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Enabled : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; ErrStatusBlockLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; RelatedErrorSourceId : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ErrStatusAddressSpaceID : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; ErrStatusAddressBitWidth : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; ErrStatusAddressBitOffset : BYTE (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; ErrStatusAddressAccessSize : BYTE (+15, 1byte)  poke st,15,値  /  値 = peek(st,15)
; ErrStatusAddress : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Notify : WHEA_NOTIFICATION_DESCRIPTOR (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WHEA_GENERIC_ERROR_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Enabled : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; ErrStatusBlockLength : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; RelatedErrorSourceId : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ErrStatusAddressSpaceID : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; ErrStatusAddressBitWidth : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; ErrStatusAddressBitOffset : BYTE (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; ErrStatusAddressAccessSize : BYTE (+15, 1byte)  poke st,15,値  /  値 = peek(st,15)
; ErrStatusAddress : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Notify : WHEA_NOTIFICATION_DESCRIPTOR (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WHEA_NOTIFICATION_DESCRIPTOR
    #field byte Type
    #field byte Length
    #field byte Flags 2
    #field byte u 8
#endstruct

#defstruct global WHEA_GENERIC_ERROR_DESCRIPTOR, pack=1
    #field short Type
    #field byte Reserved
    #field byte Enabled
    #field int ErrStatusBlockLength
    #field int RelatedErrorSourceId
    #field byte ErrStatusAddressSpaceID
    #field byte ErrStatusAddressBitWidth
    #field byte ErrStatusAddressBitOffset
    #field byte ErrStatusAddressAccessSize
    #field int64 ErrStatusAddress
    #field WHEA_NOTIFICATION_DESCRIPTOR Notify
#endstruct

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