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

WHEA_AER_BRIDGE_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
TypeWORD2+0+0エラーソースの種別を示す。
EnabledBOOLEAN1+2+2AER ブリッジが有効かを示すフラグ。
ReservedBYTE1+3+3予約フィールド。使用しない。
BusNumberDWORD4+4+4PCI バス番号を示す。
SlotWHEA_PCI_SLOT_NUMBER8/4+8+8PCI スロット番号(WHEA_PCI_SLOT_NUMBER)を示す。
DeviceControlWORD2+16+12デバイス制御レジスタの値を示す。
FlagsAER_BRIDGE_DESCRIPTOR_FLAGS2+18+14ブリッジ AER の属性フラグを示す。
UncorrectableErrorMaskDWORD4+20+16訂正不能エラーのマスク値を示す。
UncorrectableErrorSeverityDWORD4+24+20訂正不能エラーの重大度設定を示す。
CorrectableErrorMaskDWORD4+28+24訂正可能エラーのマスク値を示す。
AdvancedCapsAndControlDWORD4+32+28高度な機能と制御レジスタの値を示す。
SecondaryUncorrectableErrorMaskDWORD4+36+32セカンダリ側の訂正不能エラーのマスク値を示す。
SecondaryUncorrectableErrorSevDWORD4+40+36セカンダリ側の訂正不能エラーの重大度設定を示す。
SecondaryCapsAndControlDWORD4+44+40セカンダリ側の機能と制御レジスタの値を示す。

各言語での定義

#include <windows.h>

// WHEA_PCI_SLOT_NUMBER  (x64 8 / x86 4 バイト)
typedef struct WHEA_PCI_SLOT_NUMBER {
    _u_e__Union u;
} WHEA_PCI_SLOT_NUMBER;

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

// WHEA_AER_BRIDGE_DESCRIPTOR  (x64 48 / x86 44 バイト)
#pragma pack(push, 1)
typedef struct WHEA_AER_BRIDGE_DESCRIPTOR {
    WORD Type;
    BOOLEAN Enabled;
    BYTE Reserved;
    DWORD BusNumber;
    WHEA_PCI_SLOT_NUMBER Slot;
    WORD DeviceControl;
    AER_BRIDGE_DESCRIPTOR_FLAGS Flags;
    DWORD UncorrectableErrorMask;
    DWORD UncorrectableErrorSeverity;
    DWORD CorrectableErrorMask;
    DWORD AdvancedCapsAndControl;
    DWORD SecondaryUncorrectableErrorMask;
    DWORD SecondaryUncorrectableErrorSev;
    DWORD SecondaryCapsAndControl;
} WHEA_AER_BRIDGE_DESCRIPTOR;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WHEA_PCI_SLOT_NUMBER
{
    public _u_e__Union u;
}

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

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WHEA_AER_BRIDGE_DESCRIPTOR
{
    public ushort Type;
    [MarshalAs(UnmanagedType.U1)] public bool Enabled;
    public byte Reserved;
    public uint BusNumber;
    public WHEA_PCI_SLOT_NUMBER Slot;
    public ushort DeviceControl;
    public AER_BRIDGE_DESCRIPTOR_FLAGS Flags;
    public uint UncorrectableErrorMask;
    public uint UncorrectableErrorSeverity;
    public uint CorrectableErrorMask;
    public uint AdvancedCapsAndControl;
    public uint SecondaryUncorrectableErrorMask;
    public uint SecondaryUncorrectableErrorSev;
    public uint SecondaryCapsAndControl;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WHEA_PCI_SLOT_NUMBER
    Public u As _u_e__Union
End Structure

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

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WHEA_AER_BRIDGE_DESCRIPTOR
    Public Type As UShort
    <MarshalAs(UnmanagedType.U1)> Public Enabled As Boolean
    Public Reserved As Byte
    Public BusNumber As UInteger
    Public Slot As WHEA_PCI_SLOT_NUMBER
    Public DeviceControl As UShort
    Public Flags As AER_BRIDGE_DESCRIPTOR_FLAGS
    Public UncorrectableErrorMask As UInteger
    Public UncorrectableErrorSeverity As UInteger
    Public CorrectableErrorMask As UInteger
    Public AdvancedCapsAndControl As UInteger
    Public SecondaryUncorrectableErrorMask As UInteger
    Public SecondaryUncorrectableErrorSev As UInteger
    Public SecondaryCapsAndControl As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WHEA_PCI_SLOT_NUMBER(ctypes.Structure):
    _fields_ = [
        ("u", _u_e__Union),
    ]

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

class WHEA_AER_BRIDGE_DESCRIPTOR(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Type", ctypes.c_ushort),
        ("Enabled", ctypes.c_byte),
        ("Reserved", ctypes.c_ubyte),
        ("BusNumber", wintypes.DWORD),
        ("Slot", WHEA_PCI_SLOT_NUMBER),
        ("DeviceControl", ctypes.c_ushort),
        ("Flags", AER_BRIDGE_DESCRIPTOR_FLAGS),
        ("UncorrectableErrorMask", wintypes.DWORD),
        ("UncorrectableErrorSeverity", wintypes.DWORD),
        ("CorrectableErrorMask", wintypes.DWORD),
        ("AdvancedCapsAndControl", wintypes.DWORD),
        ("SecondaryUncorrectableErrorMask", wintypes.DWORD),
        ("SecondaryUncorrectableErrorSev", wintypes.DWORD),
        ("SecondaryCapsAndControl", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WHEA_PCI_SLOT_NUMBER {
    pub u: _u_e__Union,
}

#[repr(C, packed(1))]
pub struct AER_BRIDGE_DESCRIPTOR_FLAGS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUSHORT: u16,
}

#[repr(C, packed(1))]
pub struct WHEA_AER_BRIDGE_DESCRIPTOR {
    pub Type: u16,
    pub Enabled: u8,
    pub Reserved: u8,
    pub BusNumber: u32,
    pub Slot: WHEA_PCI_SLOT_NUMBER,
    pub DeviceControl: u16,
    pub Flags: AER_BRIDGE_DESCRIPTOR_FLAGS,
    pub UncorrectableErrorMask: u32,
    pub UncorrectableErrorSeverity: u32,
    pub CorrectableErrorMask: u32,
    pub AdvancedCapsAndControl: u32,
    pub SecondaryUncorrectableErrorMask: u32,
    pub SecondaryUncorrectableErrorSev: u32,
    pub SecondaryCapsAndControl: u32,
}
import "golang.org/x/sys/windows"

type WHEA_PCI_SLOT_NUMBER struct {
	u _u_e__Union
}

type AER_BRIDGE_DESCRIPTOR_FLAGS struct {
	Anonymous _Anonymous_e__Struct
	AsUSHORT uint16
}

type WHEA_AER_BRIDGE_DESCRIPTOR struct {
	Type uint16
	Enabled byte
	Reserved byte
	BusNumber uint32
	Slot WHEA_PCI_SLOT_NUMBER
	DeviceControl uint16
	Flags AER_BRIDGE_DESCRIPTOR_FLAGS
	UncorrectableErrorMask uint32
	UncorrectableErrorSeverity uint32
	CorrectableErrorMask uint32
	AdvancedCapsAndControl uint32
	SecondaryUncorrectableErrorMask uint32
	SecondaryUncorrectableErrorSev uint32
	SecondaryCapsAndControl uint32
}
type
  WHEA_PCI_SLOT_NUMBER = record
    u: _u_e__Union;
  end;

  AER_BRIDGE_DESCRIPTOR_FLAGS = packed record
    Anonymous: _Anonymous_e__Struct;
    AsUSHORT: Word;
  end;

  WHEA_AER_BRIDGE_DESCRIPTOR = packed record
    Type: Word;
    Enabled: ByteBool;
    Reserved: Byte;
    BusNumber: DWORD;
    Slot: WHEA_PCI_SLOT_NUMBER;
    DeviceControl: Word;
    Flags: AER_BRIDGE_DESCRIPTOR_FLAGS;
    UncorrectableErrorMask: DWORD;
    UncorrectableErrorSeverity: DWORD;
    CorrectableErrorMask: DWORD;
    AdvancedCapsAndControl: DWORD;
    SecondaryUncorrectableErrorMask: DWORD;
    SecondaryUncorrectableErrorSev: DWORD;
    SecondaryCapsAndControl: DWORD;
  end;
const WHEA_PCI_SLOT_NUMBER = extern struct {
    u: _u_e__Union,
};

const AER_BRIDGE_DESCRIPTOR_FLAGS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUSHORT: u16,
};

const WHEA_AER_BRIDGE_DESCRIPTOR = extern struct {
    Type: u16,
    Enabled: u8,
    Reserved: u8,
    BusNumber: u32,
    Slot: WHEA_PCI_SLOT_NUMBER,
    DeviceControl: u16,
    Flags: AER_BRIDGE_DESCRIPTOR_FLAGS,
    UncorrectableErrorMask: u32,
    UncorrectableErrorSeverity: u32,
    CorrectableErrorMask: u32,
    AdvancedCapsAndControl: u32,
    SecondaryUncorrectableErrorMask: u32,
    SecondaryUncorrectableErrorSev: u32,
    SecondaryCapsAndControl: u32,
};
type
  WHEA_PCI_SLOT_NUMBER {.bycopy.} = object
    u: _u_e__Union

  AER_BRIDGE_DESCRIPTOR_FLAGS {.packed.} = object
    Anonymous: _Anonymous_e__Struct
    AsUSHORT: uint16

  WHEA_AER_BRIDGE_DESCRIPTOR {.packed.} = object
    Type: uint16
    Enabled: uint8
    Reserved: uint8
    BusNumber: uint32
    Slot: WHEA_PCI_SLOT_NUMBER
    DeviceControl: uint16
    Flags: AER_BRIDGE_DESCRIPTOR_FLAGS
    UncorrectableErrorMask: uint32
    UncorrectableErrorSeverity: uint32
    CorrectableErrorMask: uint32
    AdvancedCapsAndControl: uint32
    SecondaryUncorrectableErrorMask: uint32
    SecondaryUncorrectableErrorSev: uint32
    SecondaryCapsAndControl: uint32
struct WHEA_PCI_SLOT_NUMBER
{
    _u_e__Union u;
}

align(1)
struct AER_BRIDGE_DESCRIPTOR_FLAGS
{
    _Anonymous_e__Struct Anonymous;
    ushort AsUSHORT;
}

align(1)
struct WHEA_AER_BRIDGE_DESCRIPTOR
{
    ushort Type;
    ubyte Enabled;
    ubyte Reserved;
    uint BusNumber;
    WHEA_PCI_SLOT_NUMBER Slot;
    ushort DeviceControl;
    AER_BRIDGE_DESCRIPTOR_FLAGS Flags;
    uint UncorrectableErrorMask;
    uint UncorrectableErrorSeverity;
    uint CorrectableErrorMask;
    uint AdvancedCapsAndControl;
    uint SecondaryUncorrectableErrorMask;
    uint SecondaryUncorrectableErrorSev;
    uint SecondaryCapsAndControl;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WHEA_AER_BRIDGE_DESCRIPTOR サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Enabled : BOOLEAN (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Reserved : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; BusNumber : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Slot : WHEA_PCI_SLOT_NUMBER (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; DeviceControl : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; Flags : AER_BRIDGE_DESCRIPTOR_FLAGS (+14, 2byte)  varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; UncorrectableErrorMask : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; UncorrectableErrorSeverity : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; CorrectableErrorMask : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; AdvancedCapsAndControl : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; SecondaryUncorrectableErrorMask : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; SecondaryUncorrectableErrorSev : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; SecondaryCapsAndControl : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WHEA_AER_BRIDGE_DESCRIPTOR サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Enabled : BOOLEAN (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; Reserved : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; BusNumber : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Slot : WHEA_PCI_SLOT_NUMBER (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; DeviceControl : WORD (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; Flags : AER_BRIDGE_DESCRIPTOR_FLAGS (+18, 2byte)  varptr(st)+18 を基点に操作(2byte:入れ子/配列)
; UncorrectableErrorMask : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; UncorrectableErrorSeverity : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; CorrectableErrorMask : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; AdvancedCapsAndControl : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; SecondaryUncorrectableErrorMask : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; SecondaryUncorrectableErrorSev : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; SecondaryCapsAndControl : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WHEA_PCI_SLOT_NUMBER
    #field byte u 8
#endstruct

#defstruct global WHEA_AER_BRIDGE_DESCRIPTOR, pack=1
    #field short Type
    #field bool1 Enabled
    #field byte Reserved
    #field int BusNumber
    #field WHEA_PCI_SLOT_NUMBER Slot
    #field short DeviceControl
    #field byte Flags 2
    #field int UncorrectableErrorMask
    #field int UncorrectableErrorSeverity
    #field int CorrectableErrorMask
    #field int AdvancedCapsAndControl
    #field int SecondaryUncorrectableErrorMask
    #field int SecondaryUncorrectableErrorSev
    #field int SecondaryCapsAndControl
#endstruct

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