ホーム › System.Ioctl › DEVICE_POWER_DESCRIPTOR
DEVICE_POWER_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Version | DWORD | 4 | +0 | +0 | 構造体のバージョン番号。 |
| Size | DWORD | 4 | +4 | +4 | この構造体のサイズをバイト単位で示す。 |
| DeviceAttentionSupported | BOOLEAN | 1 | +8 | +8 | デバイスアテンション(注意喚起)をサポートするかを示す真偽値。 |
| AsynchronousNotificationSupported | BOOLEAN | 1 | +9 | +9 | 非同期通知をサポートするかを示す真偽値。 |
| IdlePowerManagementEnabled | BOOLEAN | 1 | +10 | +10 | アイドル電源管理が有効かを示す真偽値。 |
| D3ColdEnabled | BOOLEAN | 1 | +11 | +11 | D3コールド電源状態が有効かを示す真偽値。 |
| D3ColdSupported | BOOLEAN | 1 | +12 | +12 | D3コールド電源状態をサポートするかを示す真偽値。 |
| NoVerifyDuringIdlePower | BOOLEAN | 1 | +13 | +13 | アイドル電源中に検証を行わないかを示す真偽値。 |
| Reserved | BYTE | 2 | +14 | +14 | 将来の拡張のために予約されたバイト領域。 |
| IdleTimeoutInMS | DWORD | 4 | +16 | +16 | アイドル状態へ移行するまでのタイムアウトをミリ秒単位で示す。 |
各言語での定義
#include <windows.h>
// DEVICE_POWER_DESCRIPTOR (x64 20 / x86 20 バイト)
typedef struct DEVICE_POWER_DESCRIPTOR {
DWORD Version;
DWORD Size;
BOOLEAN DeviceAttentionSupported;
BOOLEAN AsynchronousNotificationSupported;
BOOLEAN IdlePowerManagementEnabled;
BOOLEAN D3ColdEnabled;
BOOLEAN D3ColdSupported;
BOOLEAN NoVerifyDuringIdlePower;
BYTE Reserved[2];
DWORD IdleTimeoutInMS;
} DEVICE_POWER_DESCRIPTOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVICE_POWER_DESCRIPTOR
{
public uint Version;
public uint Size;
[MarshalAs(UnmanagedType.U1)] public bool DeviceAttentionSupported;
[MarshalAs(UnmanagedType.U1)] public bool AsynchronousNotificationSupported;
[MarshalAs(UnmanagedType.U1)] public bool IdlePowerManagementEnabled;
[MarshalAs(UnmanagedType.U1)] public bool D3ColdEnabled;
[MarshalAs(UnmanagedType.U1)] public bool D3ColdSupported;
[MarshalAs(UnmanagedType.U1)] public bool NoVerifyDuringIdlePower;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
public uint IdleTimeoutInMS;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVICE_POWER_DESCRIPTOR
Public Version As UInteger
Public Size As UInteger
<MarshalAs(UnmanagedType.U1)> Public DeviceAttentionSupported As Boolean
<MarshalAs(UnmanagedType.U1)> Public AsynchronousNotificationSupported As Boolean
<MarshalAs(UnmanagedType.U1)> Public IdlePowerManagementEnabled As Boolean
<MarshalAs(UnmanagedType.U1)> Public D3ColdEnabled As Boolean
<MarshalAs(UnmanagedType.U1)> Public D3ColdSupported As Boolean
<MarshalAs(UnmanagedType.U1)> Public NoVerifyDuringIdlePower As Boolean
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
Public IdleTimeoutInMS As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DEVICE_POWER_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Version", wintypes.DWORD),
("Size", wintypes.DWORD),
("DeviceAttentionSupported", ctypes.c_byte),
("AsynchronousNotificationSupported", ctypes.c_byte),
("IdlePowerManagementEnabled", ctypes.c_byte),
("D3ColdEnabled", ctypes.c_byte),
("D3ColdSupported", ctypes.c_byte),
("NoVerifyDuringIdlePower", ctypes.c_byte),
("Reserved", ctypes.c_ubyte * 2),
("IdleTimeoutInMS", wintypes.DWORD),
]#[repr(C)]
pub struct DEVICE_POWER_DESCRIPTOR {
pub Version: u32,
pub Size: u32,
pub DeviceAttentionSupported: u8,
pub AsynchronousNotificationSupported: u8,
pub IdlePowerManagementEnabled: u8,
pub D3ColdEnabled: u8,
pub D3ColdSupported: u8,
pub NoVerifyDuringIdlePower: u8,
pub Reserved: [u8; 2],
pub IdleTimeoutInMS: u32,
}import "golang.org/x/sys/windows"
type DEVICE_POWER_DESCRIPTOR struct {
Version uint32
Size uint32
DeviceAttentionSupported byte
AsynchronousNotificationSupported byte
IdlePowerManagementEnabled byte
D3ColdEnabled byte
D3ColdSupported byte
NoVerifyDuringIdlePower byte
Reserved [2]byte
IdleTimeoutInMS uint32
}type
DEVICE_POWER_DESCRIPTOR = record
Version: DWORD;
Size: DWORD;
DeviceAttentionSupported: ByteBool;
AsynchronousNotificationSupported: ByteBool;
IdlePowerManagementEnabled: ByteBool;
D3ColdEnabled: ByteBool;
D3ColdSupported: ByteBool;
NoVerifyDuringIdlePower: ByteBool;
Reserved: array[0..1] of Byte;
IdleTimeoutInMS: DWORD;
end;const DEVICE_POWER_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
DeviceAttentionSupported: u8,
AsynchronousNotificationSupported: u8,
IdlePowerManagementEnabled: u8,
D3ColdEnabled: u8,
D3ColdSupported: u8,
NoVerifyDuringIdlePower: u8,
Reserved: [2]u8,
IdleTimeoutInMS: u32,
};type
DEVICE_POWER_DESCRIPTOR {.bycopy.} = object
Version: uint32
Size: uint32
DeviceAttentionSupported: uint8
AsynchronousNotificationSupported: uint8
IdlePowerManagementEnabled: uint8
D3ColdEnabled: uint8
D3ColdSupported: uint8
NoVerifyDuringIdlePower: uint8
Reserved: array[2, uint8]
IdleTimeoutInMS: uint32struct DEVICE_POWER_DESCRIPTOR
{
uint Version;
uint Size;
ubyte DeviceAttentionSupported;
ubyte AsynchronousNotificationSupported;
ubyte IdlePowerManagementEnabled;
ubyte D3ColdEnabled;
ubyte D3ColdSupported;
ubyte NoVerifyDuringIdlePower;
ubyte[2] Reserved;
uint IdleTimeoutInMS;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEVICE_POWER_DESCRIPTOR サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Version : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Size : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; DeviceAttentionSupported : BOOLEAN (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; AsynchronousNotificationSupported : BOOLEAN (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; IdlePowerManagementEnabled : BOOLEAN (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; D3ColdEnabled : BOOLEAN (+11, 1byte) poke st,11,値 / 値 = peek(st,11)
; D3ColdSupported : BOOLEAN (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; NoVerifyDuringIdlePower : BOOLEAN (+13, 1byte) poke st,13,値 / 値 = peek(st,13)
; Reserved : BYTE (+14, 2byte) varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; IdleTimeoutInMS : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEVICE_POWER_DESCRIPTOR
#field int Version
#field int Size
#field bool1 DeviceAttentionSupported
#field bool1 AsynchronousNotificationSupported
#field bool1 IdlePowerManagementEnabled
#field bool1 D3ColdEnabled
#field bool1 D3ColdSupported
#field bool1 NoVerifyDuringIdlePower
#field byte Reserved 2
#field int IdleTimeoutInMS
#endstruct
stdim st, DEVICE_POWER_DESCRIPTOR ; NSTRUCT 変数を確保
st->Version = 100
mes "Version=" + st->Version