Win32 API 日本語リファレンス
ホームSystem.Ioctl › PHYSICAL_ELEMENT_STATUS_REQUEST

PHYSICAL_ELEMENT_STATUS_REQUEST

構造体
サイズx64: 16 バイト / x86: 16 バイト

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
SizeDWORD4+4+4この構造体のサイズをバイト単位で示す。
StartingElementDWORD4+8+8取得を開始する物理要素の識別子。
FilterBYTE1+12+12報告する要素を絞り込むフィルタ値。
ReportTypeBYTE1+13+13報告の種類を示す値。
ReservedBYTE2+14+14将来の拡張のために予約されたバイト配列。

各言語での定義

#include <windows.h>

// PHYSICAL_ELEMENT_STATUS_REQUEST  (x64 16 / x86 16 バイト)
typedef struct PHYSICAL_ELEMENT_STATUS_REQUEST {
    DWORD Version;
    DWORD Size;
    DWORD StartingElement;
    BYTE Filter;
    BYTE ReportType;
    BYTE Reserved[2];
} PHYSICAL_ELEMENT_STATUS_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PHYSICAL_ELEMENT_STATUS_REQUEST
{
    public uint Version;
    public uint Size;
    public uint StartingElement;
    public byte Filter;
    public byte ReportType;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PHYSICAL_ELEMENT_STATUS_REQUEST
    Public Version As UInteger
    Public Size As UInteger
    Public StartingElement As UInteger
    Public Filter As Byte
    Public ReportType As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
End Structure
import ctypes
from ctypes import wintypes

class PHYSICAL_ELEMENT_STATUS_REQUEST(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("StartingElement", wintypes.DWORD),
        ("Filter", ctypes.c_ubyte),
        ("ReportType", ctypes.c_ubyte),
        ("Reserved", ctypes.c_ubyte * 2),
    ]
#[repr(C)]
pub struct PHYSICAL_ELEMENT_STATUS_REQUEST {
    pub Version: u32,
    pub Size: u32,
    pub StartingElement: u32,
    pub Filter: u8,
    pub ReportType: u8,
    pub Reserved: [u8; 2],
}
import "golang.org/x/sys/windows"

type PHYSICAL_ELEMENT_STATUS_REQUEST struct {
	Version uint32
	Size uint32
	StartingElement uint32
	Filter byte
	ReportType byte
	Reserved [2]byte
}
type
  PHYSICAL_ELEMENT_STATUS_REQUEST = record
    Version: DWORD;
    Size: DWORD;
    StartingElement: DWORD;
    Filter: Byte;
    ReportType: Byte;
    Reserved: array[0..1] of Byte;
  end;
const PHYSICAL_ELEMENT_STATUS_REQUEST = extern struct {
    Version: u32,
    Size: u32,
    StartingElement: u32,
    Filter: u8,
    ReportType: u8,
    Reserved: [2]u8,
};
type
  PHYSICAL_ELEMENT_STATUS_REQUEST {.bycopy.} = object
    Version: uint32
    Size: uint32
    StartingElement: uint32
    Filter: uint8
    ReportType: uint8
    Reserved: array[2, uint8]
struct PHYSICAL_ELEMENT_STATUS_REQUEST
{
    uint Version;
    uint Size;
    uint StartingElement;
    ubyte Filter;
    ubyte ReportType;
    ubyte[2] Reserved;
}

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_REQUEST サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; StartingElement : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Filter : BYTE (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; ReportType : BYTE (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; Reserved : BYTE (+14, 2byte)  varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PHYSICAL_ELEMENT_STATUS_REQUEST
    #field int Version
    #field int Size
    #field int StartingElement
    #field byte Filter
    #field byte ReportType
    #field byte Reserved 2
#endstruct

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