ホーム › System.Ioctl › PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のサイズをバイト単位で示す。 |
| ElementIdentifier | DWORD | 4 | +8 | +8 | 物理要素を識別する番号。 |
| PhysicalElementType | BYTE | 1 | +12 | +12 | 物理要素の種類を示す値。記憶要素等。 |
| PhysicalElementHealth | BYTE | 1 | +13 | +13 | 物理要素の健全性を示す値。 |
| Reserved1 | BYTE | 2 | +14 | +14 | 将来の拡張のために予約されたバイト配列。 |
| AssociatedCapacity | ULONGLONG | 8 | +16 | +16 | この物理要素に関連付けられた容量をバイト単位で示す。 |
| Reserved2 | DWORD | 16 | +24 | +24 | 将来の拡張のために予約された32ビット領域の配列。 |
各言語での定義
#include <windows.h>
// PHYSICAL_ELEMENT_STATUS_DESCRIPTOR (x64 40 / x86 40 バイト)
typedef struct PHYSICAL_ELEMENT_STATUS_DESCRIPTOR {
DWORD Version;
DWORD Size;
DWORD ElementIdentifier;
BYTE PhysicalElementType;
BYTE PhysicalElementHealth;
BYTE Reserved1[2];
ULONGLONG AssociatedCapacity;
DWORD Reserved2[4];
} PHYSICAL_ELEMENT_STATUS_DESCRIPTOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
{
public uint Version;
public uint Size;
public uint ElementIdentifier;
public byte PhysicalElementType;
public byte PhysicalElementHealth;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved1;
public ulong AssociatedCapacity;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] Reserved2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
Public Version As UInteger
Public Size As UInteger
Public ElementIdentifier As UInteger
Public PhysicalElementType As Byte
Public PhysicalElementHealth As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved1() As Byte
Public AssociatedCapacity As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Reserved2() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PHYSICAL_ELEMENT_STATUS_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("ElementIdentifier", wintypes.DWORD),
("PhysicalElementType", ctypes.c_ubyte),
("PhysicalElementHealth", ctypes.c_ubyte),
("Reserved1", ctypes.c_ubyte * 2),
("AssociatedCapacity", ctypes.c_ulonglong),
("Reserved2", wintypes.DWORD * 4),
]#[repr(C)]
pub struct PHYSICAL_ELEMENT_STATUS_DESCRIPTOR {
pub Version: u32,
pub Size: u32,
pub ElementIdentifier: u32,
pub PhysicalElementType: u8,
pub PhysicalElementHealth: u8,
pub Reserved1: [u8; 2],
pub AssociatedCapacity: u64,
pub Reserved2: [u32; 4],
}import "golang.org/x/sys/windows"
type PHYSICAL_ELEMENT_STATUS_DESCRIPTOR struct {
Version uint32
Size uint32
ElementIdentifier uint32
PhysicalElementType byte
PhysicalElementHealth byte
Reserved1 [2]byte
AssociatedCapacity uint64
Reserved2 [4]uint32
}type
PHYSICAL_ELEMENT_STATUS_DESCRIPTOR = record
Version: DWORD;
Size: DWORD;
ElementIdentifier: DWORD;
PhysicalElementType: Byte;
PhysicalElementHealth: Byte;
Reserved1: array[0..1] of Byte;
AssociatedCapacity: UInt64;
Reserved2: array[0..3] of DWORD;
end;const PHYSICAL_ELEMENT_STATUS_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
ElementIdentifier: u32,
PhysicalElementType: u8,
PhysicalElementHealth: u8,
Reserved1: [2]u8,
AssociatedCapacity: u64,
Reserved2: [4]u32,
};type
PHYSICAL_ELEMENT_STATUS_DESCRIPTOR {.bycopy.} = object
Version: uint32
Size: uint32
ElementIdentifier: uint32
PhysicalElementType: uint8
PhysicalElementHealth: uint8
Reserved1: array[2, uint8]
AssociatedCapacity: uint64
Reserved2: array[4, uint32]struct PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
{
uint Version;
uint Size;
uint ElementIdentifier;
ubyte PhysicalElementType;
ubyte PhysicalElementHealth;
ubyte[2] Reserved1;
ulong AssociatedCapacity;
uint[4] Reserved2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PHYSICAL_ELEMENT_STATUS_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ElementIdentifier : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; PhysicalElementType : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; PhysicalElementHealth : BYTE (+13, 1byte) poke st,13,値 / 値 = peek(st,13)
; Reserved1 : BYTE (+14, 2byte) varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; AssociatedCapacity : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Reserved2 : DWORD (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PHYSICAL_ELEMENT_STATUS_DESCRIPTOR
#field int Version
#field int Size
#field int ElementIdentifier
#field byte PhysicalElementType
#field byte PhysicalElementHealth
#field byte Reserved1 2
#field int64 AssociatedCapacity
#field int Reserved2 4
#endstruct
stdim st, PHYSICAL_ELEMENT_STATUS_DESCRIPTOR ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version