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

ACPI_TIME_AND_ALARM_CAPABILITIES

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

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

フィールド

フィールドサイズx64x86説明
AcWakeSupportedBOOLEAN1+0+0AC電源時のウェイクアラームをサポートするかを示すブール値。
DcWakeSupportedBOOLEAN1+1+1DC(バッテリ)電源時のウェイクアラームをサポートするかを示す。
S4AcWakeSupportedBOOLEAN1+2+2S4状態かつAC電源からのウェイクをサポートするかを示す。
S4DcWakeSupportedBOOLEAN1+3+3S4状態かつDC電源からのウェイクをサポートするかを示す。
S5AcWakeSupportedBOOLEAN1+4+4S5状態かつAC電源からのウェイクをサポートするかを示す。
S5DcWakeSupportedBOOLEAN1+5+5S5状態かつDC電源からのウェイクをサポートするかを示す。
S4S5WakeStatusSupportedBOOLEAN1+6+6S4/S5からのウェイク状態取得をサポートするかを示す。
DeepestWakeSystemStateDWORD4+8+8ウェイク可能な最も深いシステム電源状態を示す。
RealTimeFeaturesSupportedBOOLEAN1+12+12リアルタイムクロック機能をサポートするかを示すブール値。
RealTimeResolutionACPI_TIME_RESOLUTION4+16+16リアルタイムクロックの分解能を示す列挙値。

各言語での定義

#include <windows.h>

// ACPI_TIME_AND_ALARM_CAPABILITIES  (x64 20 / x86 20 バイト)
typedef struct ACPI_TIME_AND_ALARM_CAPABILITIES {
    BOOLEAN AcWakeSupported;
    BOOLEAN DcWakeSupported;
    BOOLEAN S4AcWakeSupported;
    BOOLEAN S4DcWakeSupported;
    BOOLEAN S5AcWakeSupported;
    BOOLEAN S5DcWakeSupported;
    BOOLEAN S4S5WakeStatusSupported;
    DWORD DeepestWakeSystemState;
    BOOLEAN RealTimeFeaturesSupported;
    ACPI_TIME_RESOLUTION RealTimeResolution;
} ACPI_TIME_AND_ALARM_CAPABILITIES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ACPI_TIME_AND_ALARM_CAPABILITIES
{
    [MarshalAs(UnmanagedType.U1)] public bool AcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool DcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool S4AcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool S4DcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool S5AcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool S5DcWakeSupported;
    [MarshalAs(UnmanagedType.U1)] public bool S4S5WakeStatusSupported;
    public uint DeepestWakeSystemState;
    [MarshalAs(UnmanagedType.U1)] public bool RealTimeFeaturesSupported;
    public int RealTimeResolution;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ACPI_TIME_AND_ALARM_CAPABILITIES
    <MarshalAs(UnmanagedType.U1)> Public AcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public DcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public S4AcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public S4DcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public S5AcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public S5DcWakeSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public S4S5WakeStatusSupported As Boolean
    Public DeepestWakeSystemState As UInteger
    <MarshalAs(UnmanagedType.U1)> Public RealTimeFeaturesSupported As Boolean
    Public RealTimeResolution As Integer
End Structure
import ctypes
from ctypes import wintypes

class ACPI_TIME_AND_ALARM_CAPABILITIES(ctypes.Structure):
    _fields_ = [
        ("AcWakeSupported", ctypes.c_byte),
        ("DcWakeSupported", ctypes.c_byte),
        ("S4AcWakeSupported", ctypes.c_byte),
        ("S4DcWakeSupported", ctypes.c_byte),
        ("S5AcWakeSupported", ctypes.c_byte),
        ("S5DcWakeSupported", ctypes.c_byte),
        ("S4S5WakeStatusSupported", ctypes.c_byte),
        ("DeepestWakeSystemState", wintypes.DWORD),
        ("RealTimeFeaturesSupported", ctypes.c_byte),
        ("RealTimeResolution", ctypes.c_int),
    ]
#[repr(C)]
pub struct ACPI_TIME_AND_ALARM_CAPABILITIES {
    pub AcWakeSupported: u8,
    pub DcWakeSupported: u8,
    pub S4AcWakeSupported: u8,
    pub S4DcWakeSupported: u8,
    pub S5AcWakeSupported: u8,
    pub S5DcWakeSupported: u8,
    pub S4S5WakeStatusSupported: u8,
    pub DeepestWakeSystemState: u32,
    pub RealTimeFeaturesSupported: u8,
    pub RealTimeResolution: i32,
}
import "golang.org/x/sys/windows"

type ACPI_TIME_AND_ALARM_CAPABILITIES struct {
	AcWakeSupported byte
	DcWakeSupported byte
	S4AcWakeSupported byte
	S4DcWakeSupported byte
	S5AcWakeSupported byte
	S5DcWakeSupported byte
	S4S5WakeStatusSupported byte
	DeepestWakeSystemState uint32
	RealTimeFeaturesSupported byte
	RealTimeResolution int32
}
type
  ACPI_TIME_AND_ALARM_CAPABILITIES = record
    AcWakeSupported: ByteBool;
    DcWakeSupported: ByteBool;
    S4AcWakeSupported: ByteBool;
    S4DcWakeSupported: ByteBool;
    S5AcWakeSupported: ByteBool;
    S5DcWakeSupported: ByteBool;
    S4S5WakeStatusSupported: ByteBool;
    DeepestWakeSystemState: DWORD;
    RealTimeFeaturesSupported: ByteBool;
    RealTimeResolution: Integer;
  end;
const ACPI_TIME_AND_ALARM_CAPABILITIES = extern struct {
    AcWakeSupported: u8,
    DcWakeSupported: u8,
    S4AcWakeSupported: u8,
    S4DcWakeSupported: u8,
    S5AcWakeSupported: u8,
    S5DcWakeSupported: u8,
    S4S5WakeStatusSupported: u8,
    DeepestWakeSystemState: u32,
    RealTimeFeaturesSupported: u8,
    RealTimeResolution: i32,
};
type
  ACPI_TIME_AND_ALARM_CAPABILITIES {.bycopy.} = object
    AcWakeSupported: uint8
    DcWakeSupported: uint8
    S4AcWakeSupported: uint8
    S4DcWakeSupported: uint8
    S5AcWakeSupported: uint8
    S5DcWakeSupported: uint8
    S4S5WakeStatusSupported: uint8
    DeepestWakeSystemState: uint32
    RealTimeFeaturesSupported: uint8
    RealTimeResolution: int32
struct ACPI_TIME_AND_ALARM_CAPABILITIES
{
    ubyte AcWakeSupported;
    ubyte DcWakeSupported;
    ubyte S4AcWakeSupported;
    ubyte S4DcWakeSupported;
    ubyte S5AcWakeSupported;
    ubyte S5DcWakeSupported;
    ubyte S4S5WakeStatusSupported;
    uint DeepestWakeSystemState;
    ubyte RealTimeFeaturesSupported;
    int RealTimeResolution;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ACPI_TIME_AND_ALARM_CAPABILITIES サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; AcWakeSupported : BOOLEAN (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; DcWakeSupported : BOOLEAN (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; S4AcWakeSupported : BOOLEAN (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; S4DcWakeSupported : BOOLEAN (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; S5AcWakeSupported : BOOLEAN (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; S5DcWakeSupported : BOOLEAN (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; S4S5WakeStatusSupported : BOOLEAN (+6, 1byte)  poke st,6,値  /  値 = peek(st,6)
; DeepestWakeSystemState : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; RealTimeFeaturesSupported : BOOLEAN (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; RealTimeResolution : ACPI_TIME_RESOLUTION (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ACPI_TIME_AND_ALARM_CAPABILITIES
    #field bool1 AcWakeSupported
    #field bool1 DcWakeSupported
    #field bool1 S4AcWakeSupported
    #field bool1 S4DcWakeSupported
    #field bool1 S5AcWakeSupported
    #field bool1 S5DcWakeSupported
    #field bool1 S4S5WakeStatusSupported
    #field int DeepestWakeSystemState
    #field bool1 RealTimeFeaturesSupported
    #field int RealTimeResolution
#endstruct

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