SYSTEM_POWER_CAPABILITIES の公式サイトの定義がでたらめ過ぎる件
SYSTEM_POWER_CAPABILITIES (winnt.h) - Win32 apps | Microsoft Learn
Microsoft 公式サイトの SYSTEM_POWER_CAPABILITIES構造体の定義
typedef struct { BOOLEAN PowerButtonPresent; BOOLEAN SleepButtonPresent; BOOLEAN LidPresent; BOOLEAN SystemS1; BOOLEAN SystemS2; BOOLEAN SystemS3; BOOLEAN SystemS4; BOOLEAN SystemS5; BOOLEAN HiberFilePresent; BOOLEAN FullWake; BOOLEAN VideoDimPresent; BOOLEAN ApmPresent; BOOLEAN UpsPresent; BOOLEAN ThermalControl; BOOLEAN ProcessorThrottle; BYTE ProcessorMinThrottle; BYTE ProcessorThrottleScale; BYTE spare2[4]; BYTE ProcessorMaxThrottle; BOOLEAN FastSystemS4; BOOLEAN Hiberboot; BOOLEAN WakeAlarmPresent; BOOLEAN AoAc; BOOLEAN DiskSpinDown; if … BYTE spare3[8]; BYTE HiberFileType; BOOLEAN AoAcConnectivitySupported; else BYTE spare3[6]; endif BOOLEAN SystemBatteriesPresent; BOOLEAN BatteriesAreShortTerm; BATTERY_REPORTING_SCALE BatteryScale[3]; SYSTEM_POWER_STATE AcOnLineWake; SYSTEM_POWER_STATE SoftLidWake; SYSTEM_POWER_STATE RtcWake; SYSTEM_POWER_STATE MinDeviceWakeState; SYSTEM_POWER_STATE DefaultLowLatencyWake; } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES; |
こんな風になってる。
ちなみに、Windows SDK 2003でコンパイルすると76バイトだった。
分かりやすく比較画像にしてみた。
左が SDK2003、右が公式ドキュメントなんだけど
spare2と DiskSpinDownの間に 2バイト割り込んできて互換性が破壊されてる上、
if文の上と下で構造体サイズが 10バイト/6バイトと変化するのが意味不明。構造体サイズを計算すると 84/80 バイト。
最新版のWindows SDKを見るとこうなってる。
typedef struct { // Misc supported system features BOOLEAN PowerButtonPresent; BOOLEAN SleepButtonPresent; BOOLEAN LidPresent; BOOLEAN SystemS1; BOOLEAN SystemS2; BOOLEAN SystemS3; BOOLEAN SystemS4; // hibernate BOOLEAN SystemS5; // off BOOLEAN HiberFilePresent; BOOLEAN FullWake; BOOLEAN VideoDimPresent; BOOLEAN ApmPresent; BOOLEAN UpsPresent; // Processors BOOLEAN ThermalControl; BOOLEAN ProcessorThrottle; BYTE ProcessorMinThrottle; if (NTDDI_VERSION < NTDDI_WINXP) BYTE ProcessorThrottleScale; BYTE spare2[4]; else BYTE ProcessorMaxThrottle; BOOLEAN FastSystemS4; BOOLEAN Hiberboot; BOOLEAN WakeAlarmPresent; BOOLEAN AoAc; endif // (NTDDI_VERSION < NTDDI_WINXP) // Disk BOOLEAN DiskSpinDown; if (NTDDI_VERSION < NTDDI_WINTHRESHOLD) BYTE spare3[8]; else // HiberFile BYTE HiberFileType; BOOLEAN AoAcConnectivitySupported; BYTE spare3[6]; endif // (NTDDI_VERSION < NTDDI_WINTHRESHOLD) // System Battery BOOLEAN SystemBatteriesPresent; BOOLEAN BatteriesAreShortTerm; BATTERY_REPORTING_SCALE BatteryScale[3]; // Wake SYSTEM_POWER_STATE AcOnLineWake; SYSTEM_POWER_STATE SoftLidWake; SYSTEM_POWER_STATE RtcWake; SYSTEM_POWER_STATE MinDeviceWakeState; // note this may change on driver load SYSTEM_POWER_STATE DefaultLowLatencyWake; } SYSTEM_POWER_CAPABILITIES2, *PSYSTEM_POWER_CAPABILITIES2; |
結論:マイクロソフトの公式ドキュメントがいい加減だった
what would Microsoft have lost if they added this to Windows 2000 andserval other things in SP4
Perhaps the official Microsoft documentation has been sloppy lately, and the technical page from about 15 years ago was accurate.