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

AER_ROOTPORT_DESCRIPTOR_FLAGS

共用体
サイズx64: 2 バイト / x86: 2 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
Anonymous_Anonymous_e__Struct2+0+0PCIe ルートポート AER の属性をビットフィールドで表す無名構造体。
AsUSHORTWORD2+0+0フラグ全体を単一の WORD としてアクセスする値。

構造体: _Anonymous_e__Struct x64 2B / x86 2B

フィールドサイズx64x86
_bitfieldWORD2+0+0

各言語での定義

#include <windows.h>

// AER_ROOTPORT_DESCRIPTOR_FLAGS  (x64 2 / x86 2 バイト)
#pragma pack(push, 1)
typedef struct AER_ROOTPORT_DESCRIPTOR_FLAGS {
    _Anonymous_e__Struct Anonymous;
    WORD AsUSHORT;
} AER_ROOTPORT_DESCRIPTOR_FLAGS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct AER_ROOTPORT_DESCRIPTOR_FLAGS
{
    public _Anonymous_e__Struct Anonymous;
    public ushort AsUSHORT;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure AER_ROOTPORT_DESCRIPTOR_FLAGS
    Public Anonymous As _Anonymous_e__Struct
    Public AsUSHORT As UShort
End Structure
import ctypes
from ctypes import wintypes

class AER_ROOTPORT_DESCRIPTOR_FLAGS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("AsUSHORT", ctypes.c_ushort),
    ]
#[repr(C, packed(1))]
pub struct AER_ROOTPORT_DESCRIPTOR_FLAGS {
    pub Anonymous: _Anonymous_e__Struct,
    pub AsUSHORT: u16,
}
import "golang.org/x/sys/windows"

type AER_ROOTPORT_DESCRIPTOR_FLAGS struct {
	Anonymous _Anonymous_e__Struct
	AsUSHORT uint16
}
type
  AER_ROOTPORT_DESCRIPTOR_FLAGS = packed record
    Anonymous: _Anonymous_e__Struct;
    AsUSHORT: Word;
  end;
const AER_ROOTPORT_DESCRIPTOR_FLAGS = extern struct {
    Anonymous: _Anonymous_e__Struct,
    AsUSHORT: u16,
};
type
  AER_ROOTPORT_DESCRIPTOR_FLAGS {.packed.} = object
    Anonymous: _Anonymous_e__Struct
    AsUSHORT: uint16
align(1)
struct AER_ROOTPORT_DESCRIPTOR_FLAGS
{
    _Anonymous_e__Struct Anonymous;
    ushort AsUSHORT;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AER_ROOTPORT_DESCRIPTOR_FLAGS サイズ: 2 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 2 / 4 切り上げ)
; Anonymous : _Anonymous_e__Struct (+0, 2byte)  varptr(st)+0 を基点に操作(2byte:入れ子/配列)
; AsUSHORT : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global AER_ROOTPORT_DESCRIPTOR_FLAGS, pack=1
    #field _Anonymous_e__Struct Anonymous
    #field short AsUSHORT
#endstruct

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