OSDN Git Service

2008-01-29 Brandon Sneed <nivenh@sourceware.org>
authornivenh <nivenh>
Tue, 29 Jan 2008 21:18:49 +0000 (21:18 +0000)
committernivenh <nivenh>
Tue, 29 Jan 2008 21:18:49 +0000 (21:18 +0000)
* include/winnt.h (SYSTEM_POWER_CONDITION): typedef.
* include/winuser.h (PBT_POWERSETTINGCHANGE, DEVICE_NOTIFY_WINDOW_HANDLE,
DEVICE_NOTIFY_SERVICE_HANDLE): define.
* include/winuser.h (LPCGUID, HPOWERNOTIFY, POWERBROADCAST_SETTING): typedefs.
* include/winuser.h (GUID_POWERSCHEME_PERSONALITY, GUID_MIN_POWER_SAVINGS,
GUID_MAX_POWER_SAVINGS, GUID_TYPICAL_POWER_SAVINGS, GUID_ACDC_POWER_SOURCE,
GUID_BATTERY_PERCENTAGE_REMAINING, GUID_IDLE_BACKGROUND_TASK,
GUID_SYSTEM_AWAYMODE, GUID_MONITOR_POWER_ON): added externs for GUIDs.
* include/winuser.h (RegisterPowerSettingNotification,
UnregisterPowerSettingNotification): Add prototypes.
* lib/user32.def: Added imports for the above prototypes.
* lib/Makefile.in: Added build support for power-uuid.c.
* lib/power-uuid.c: New file containing power GUID definitions.

winsup/w32api/ChangeLog
winsup/w32api/include/winnt.h
winsup/w32api/include/winuser.h
winsup/w32api/lib/Makefile.in
winsup/w32api/lib/power-uuid.c [new file with mode: 0644]
winsup/w32api/lib/user32.def

index 0b6b70f..73e7d7e 100644 (file)
@@ -1,5 +1,22 @@
 2008-01-29  Brandon Sneed  <nivenh@sourceware.org>
 
+       * include/winnt.h (SYSTEM_POWER_CONDITION): typedef.
+       * include/winuser.h (PBT_POWERSETTINGCHANGE, DEVICE_NOTIFY_WINDOW_HANDLE,
+       DEVICE_NOTIFY_SERVICE_HANDLE): define.
+       * include/winuser.h (LPCGUID, HPOWERNOTIFY, POWERBROADCAST_SETTING): typedefs.
+       * include/winuser.h (GUID_POWERSCHEME_PERSONALITY, GUID_MIN_POWER_SAVINGS,
+       GUID_MAX_POWER_SAVINGS, GUID_TYPICAL_POWER_SAVINGS, GUID_ACDC_POWER_SOURCE,
+       GUID_BATTERY_PERCENTAGE_REMAINING, GUID_IDLE_BACKGROUND_TASK,
+       GUID_SYSTEM_AWAYMODE, GUID_MONITOR_POWER_ON): added externs for GUIDs.
+       * include/winuser.h (RegisterPowerSettingNotification,
+       UnregisterPowerSettingNotification): Add prototypes.
+       * lib/user32.def: Added imports for the above prototypes.
+       * lib/Makefile.in: Added build support for power-uuid.c.
+       * lib/power-uuid.c: New file containing power GUID definitions.
+
+
+2008-01-29  Brandon Sneed  <nivenh@sourceware.org>
+
        * include/ras.h (RAS_MaxDnsSuffix): define.
 
 2008-01-29  Brandon Sneed  <nivenh@sourceware.org>
index 01547ed..3f63b56 100644 (file)
@@ -3545,6 +3545,15 @@ typedef enum {
        PowerActionWarmEject
 } POWER_ACTION, *PPOWER_ACTION;
 
+#if (_WIN32_WINNT >= 0x0600)
+typedef enum {
+       PoAc = 0,
+       PoDc = 1,
+       PoHot = 2,
+       PoConditionMaximum = 3
+} SYSTEM_POWER_CONDITION, *PSYSTEM_POWER_CONDITION;
+#endif
+       
 typedef enum _DEVICE_POWER_STATE {
        PowerDeviceUnspecified,
        PowerDeviceD0,
index aab36cc..efccca5 100644 (file)
@@ -1100,9 +1100,11 @@ extern "C" {
 #define PBT_APMPOWERSTATUSCHANGE 10
 #define PBT_APMOEMEVENT 11
 #define PBT_APMRESUMEAUTOMATIC 18
-
 #define PBTF_APMRESUMEFROMFAILURE 1
 #endif
+#if (_WIN32_WINNT >= 0x0600)
+#define PBT_POWERSETTINGCHANGE 32787
+#endif
 /* end pbt.h */
 
 #define PM_NOREMOVE 0
@@ -3367,7 +3369,35 @@ typedef struct {
   (p).y=HIWORD(*(DWORD *)&ps); \
 }
 #define POINTTOPOINTS(p) ((POINTS)MAKELONG((p).x,(p).y))
+       
+#ifndef _LPCGUID_DEFINED
+#define _LPCGUID_DEFINED
+typedef const GUID *LPCGUID;
+#endif
+       
+#if (_WIN32_WINNT >= 0x0600)
+#define DEVICE_NOTIFY_WINDOW_HANDLE            0
+#define DEVICE_NOTIFY_SERVICE_HANDLE   1
+       
+typedef HANDLE HPOWERNOTIFY;
+
+typedef struct {
+       GUID PowerSetting;
+       DWORD DataLength;
+       UCHAR Data[1];
+} POWERBROADCAST_SETTING, *PPOWERBROADCAST_SETTING;
 
+extern const GUID GUID_POWERSCHEME_PERSONALITY;
+extern const GUID GUID_MIN_POWER_SAVINGS;
+extern const GUID GUID_MAX_POWER_SAVINGS;
+extern const GUID GUID_TYPICAL_POWER_SAVINGS;
+extern const GUID GUID_ACDC_POWER_SOURCE;
+extern const GUID GUID_BATTERY_PERCENTAGE_REMAINING;
+extern const GUID GUID_IDLE_BACKGROUND_TASK;
+extern const GUID GUID_SYSTEM_AWAYMODE;
+extern const GUID GUID_MONITOR_POWER_ON;
+#endif
+       
 WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL,UINT);
 WINUSERAPI BOOL WINAPI AdjustWindowRect(LPRECT,DWORD,BOOL);
 WINUSERAPI BOOL WINAPI AdjustWindowRectEx(LPRECT,DWORD,BOOL,DWORD);
@@ -3890,6 +3920,9 @@ WINUSERAPI UINT WINAPI RegisterClipboardFormatW(LPCWSTR);
 WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE,LPVOID,DWORD);
 WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE,LPVOID,DWORD);
 #endif
+#if (_WIN32_WINNT >= 0x0600)
+WINUSERAPI HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE,LPCGUID,DWORD);
+#endif
 WINUSERAPI BOOL WINAPI RegisterHotKey(HWND,int,UINT,UINT);
 #if (_WIN32_WINNT >= 0x0501)
 WINUSERAPI BOOL WINAPI RegisterRawInputDevices(PCRAWINPUTDEVICE,UINT,UINT);
@@ -4037,6 +4070,9 @@ WINUSERAPI BOOL WINAPI UnregisterClassW(LPCWSTR,HINSTANCE);
 #if (_WIN32_WINDOWS >= 0x0410 || _WIN32_WINNT >= 0x0500)
 WINUSERAPI BOOL WINAPI UnregisterDeviceNotification(HANDLE);
 #endif
+#if (_WIN32_WINNT >= 0x0600)
+WINUSERAPI BOOL WINAPI UnregisterPowerSettingNotification(HPOWERNOTIFY);
+#endif
 WINUSERAPI BOOL WINAPI UnregisterHotKey(HWND,int);
 WINUSERAPI BOOL WINAPI UpdateWindow(HWND);
 #if (_WIN32_WINNT >= 0x0500)
index c1c193c..d1bcebf 100644 (file)
@@ -126,7 +126,7 @@ UUID_OBJS = mshtml-uuid.o msxml-uuid.o unknwn-uuid.o \
                        objsafe-uuid.o oaidl-uuid.o docobj-uuid.o comcat-uuid.o \
                        exdisp-uuid.o mlang-uuid.o objidl-uuid.o cguid-uuid.o \
                        olectlid-uuid.o ativscp-uuid.o urlmon-uuid.o hlink-uuid.o \
-                       hlguids-uuid.o extras-uuid.o devguid.o
+                       hlguids-uuid.o extras-uuid.o devguid.o power-uuid.o
 EXTRA_OBJS = shell32.o scrnsave.o scrnsavw.o largeint.o \
        $(UUID_OBJS) ws2_32.o
 UUID_SOURCES = mshtml-uuid.c msxml-uuid.c unknwn-uuid.c \
@@ -134,7 +134,7 @@ UUID_SOURCES = mshtml-uuid.c msxml-uuid.c unknwn-uuid.c \
                           objsafe-uuid.c oaidl-uuid.c docobj-uuid.c comcat-uuid.c \
                           exdisp-uuid.c mlang-uuid.c objidl-uuid.c cguid-uuid.c \
                           olectlid-uuid.c ativscp-uuid.c urlmon-uuid.c hlink-uuid.c \
-                          hlguids-uuid.c extras-uuid.c devguid.c
+                          hlguids-uuid.c extras-uuid.c devguid.c power-uuid.c
 SOURCES = scrnsave.c shell32.c  largeint.c $(UUID_SOURCES)\
 res.rc test.c ws2_32.c
 
diff --git a/winsup/w32api/lib/power-uuid.c b/winsup/w32api/lib/power-uuid.c
new file mode 100644 (file)
index 0000000..1126d28
--- /dev/null
@@ -0,0 +1,18 @@
+/* power-uuid.c */
+/* Generate GUIDs for OLE Accessibility interfaces */
+
+/* All IIDs defined in this file were found at "Registering for Power Events" on MSDN here:
+ * http://msdn2.microsoft.com/en-us/library/aa373195.aspx
+ */
+
+#define INITGUID
+#include <basetyps.h>
+DEFINE_GUID(GUID_POWERSCHEME_PERSONALITY, 0x245d8541, 0x3943, 0x4422, 0xb0, 0x25, 0x13, 0xA7, 0x84, 0xF6, 0x79, 0xB7);
+DEFINE_GUID(GUID_MIN_POWER_SAVINGS, 0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c);
+DEFINE_GUID(GUID_MAX_POWER_SAVINGS, 0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a);
+DEFINE_GUID(GUID_TYPICAL_POWER_SAVINGS, 0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e);
+DEFINE_GUID(GUID_ACDC_POWER_SOURCE, 0x5d3e9a59, 0xe9D5, 0x4b00, 0xa6, 0xbd, 0xff, 0x34, 0xff, 0x51, 0x65, 0x48);
+DEFINE_GUID(GUID_BATTERY_PERCENTAGE_REMAINING, 0xa7ad8041, 0xb45a, 0x4cae, 0x87, 0xa3, 0xee, 0xcb, 0xb4, 0x68, 0xa9, 0xe1);
+DEFINE_GUID(GUID_IDLE_BACKGROUND_TASK, 0x515c31d8, 0xf734, 0x163d, 0xa0, 0xfd, 0x11, 0xa0, 0x8c, 0x91, 0xe8, 0xf1);
+DEFINE_GUID(GUID_SYSTEM_AWAYMODE, 0x98a7f580, 0x01f7, 0x48aa, 0x9c, 0x0f, 0x44, 0x35, 0x2c, 0x29, 0xe5, 0xC0);
+DEFINE_GUID(GUID_MONITOR_POWER_ON, 0x02731015, 0x4510, 0x4526, 0x99, 0xe6, 0xe5, 0xa1, 0x7e, 0xbd, 0x1a, 0xea);
index b06bb0a..451b4be 100644 (file)
@@ -484,6 +484,7 @@ RegisterClipboardFormatA@4
 RegisterClipboardFormatW@4
 RegisterDeviceNotificationA@12
 RegisterDeviceNotificationW@12
+RegisterPowerSettingNotification@12
 RegisterHotKey@16
 RegisterRawInputDevices@12
 RegisterWindowMessageA@4
@@ -613,6 +614,7 @@ UnpackDDElParam@16
 UnregisterClassA@8
 UnregisterClassW@8
 UnregisterDeviceNotification@4
+UnregisterPowerSettingNotification@4
 UnregisterHotKey@8
 UpdateLayeredWindow@36
 UpdateWindow@4