Index: trunk/include/helpers/acpih.h
===================================================================
--- trunk/include/helpers/acpih.h	(revision 412)
+++ trunk/include/helpers/acpih.h	(revision 414)
@@ -11,5 +11,5 @@
  */
 
-/*      Copyright (C) 2006 Paul Ratcliffe.
+/*      Copyright (C) 2006-2013 Paul Ratcliffe.
  *      This file is part of the "XWorkplace helpers" source package.
  *      This is free software; you can redistribute it and/or modify
@@ -27,65 +27,40 @@
 #endif
 
+// @@changed V1.0.9 (2012-02-20) [slevine]: sync with current ACPI toolkit, code by David Azarewicz
+
 #ifndef ACPIH_HEADER_INCLUDED
     #define ACPIH_HEADER_INCLUDED
 
+    #pragma pack(4)
+    #include <acpi.h>
+    #include <acpiapi.h>
+    #pragma pack()
     /*
      * Power state values
      */
 
-    #define ACPI_STATE_UNKNOWN              (UCHAR) 0xFF
-
-    #define ACPI_STATE_S0                   (UCHAR) 0
-    #define ACPI_STATE_S1                   (UCHAR) 1
-    #define ACPI_STATE_S2                   (UCHAR) 2
-    #define ACPI_STATE_S3                   (UCHAR) 3
-    #define ACPI_STATE_S4                   (UCHAR) 4
-    #define ACPI_STATE_S5                   (UCHAR) 5
-    #define ACPI_S_STATES_MAX               ACPI_STATE_S5
-    #define ACPI_S_STATE_COUNT              6
-
-    #pragma pack(1)
-
-    typedef struct _VersionAcpi_
-    {
-        ULONG  Major;
-        ULONG  Minor;
-    } ACPI_VERSION;
-
-    typedef struct _AcpiApiHandle_
-    {
-        HFILE           AcpiDrv;                 // Handle to ACPICA driver
-        ACPI_VERSION    PSD;                     // Version PSD
-        ACPI_VERSION    Driver;                  // Version ACPICA driver
-        ACPI_VERSION    DLL;                     // Version acpi32.dll
-        ULONG           StartAddrPSD;            // Start address PSD (for testcase)
-        ULONG           AddrCommApp;             // Address DosCommApp from PSD (which not write IBM)
-        ULONG           StartAddrDriver;         // Start address ACPICA (for testcase)
-        ULONG           AddrFindPSD;             // Address function for find PSD (find CommApp)
-        ULONG           IRQNumber;               // Number use IRQ
-        void            *Internal;               // For internal DLL use
-    } ACPI_API_HANDLE, *PACPI_API_HANDLE;
-
-    /* ******************************************************************
-     *
-     *   ACPI helper APIs
-     *
-     ********************************************************************/
-
-    #pragma pack()
-
-    APIRET APIENTRY AcpiStartApi(ACPI_API_HANDLE *);
+    // Extracted from acpi.h actype.h etc.
     typedef APIRET APIENTRY ACPISTARTAPI(ACPI_API_HANDLE *);
     typedef ACPISTARTAPI *PACPISTARTAPI;
 
-    APIRET APIENTRY AcpiEndApi(ACPI_API_HANDLE *);
     typedef APIRET APIENTRY ACPIENDAPI(ACPI_API_HANDLE *);
     typedef ACPIENDAPI *PACPIENDAPI;
 
-    APIRET APIENTRY AcpiGoToSleep(ACPI_API_HANDLE *, UCHAR);
     typedef APIRET APIENTRY ACPIGOTOSLEEP(ACPI_API_HANDLE *, UCHAR);
     typedef ACPIGOTOSLEEP *PACPIGOTOSLEEP;
 
+    // @@added V1.0.9 (2012-12-10) [slevine]: sync with current ACPI toolkit
+    typedef ACPI_STATUS APIENTRY ACPITKPREPARETOSLEEP(UINT8);
+    typedef ACPITKPREPARETOSLEEP *PACPITKPREPARETOSLEEP;
+
+    typedef APIRET APIENTRY ACPITKGETOBJECTINFOALLOC(ACPI_HANDLE *, PVOID);
+    typedef APIRET APIENTRY ACPITKGETHANDLE(ACPI_HANDLE, ACPI_STRING, ACPI_HANDLE *);
+    typedef APIRET APIENTRY ACPITKOSFREE(PVOID);
+    typedef APIRET APIENTRY ACPITKWALKNAMESPACE(ACPI_OBJECT_TYPE, ACPI_HANDLE, UINT32,ACPI_WALK_CALLBACK, PVOID, void **);
+    typedef APIRET APIENTRY ACPITKEVALUATEOBJECT(ACPI_HANDLE, ACPI_STRING, ACPI_OBJECT_LIST *, ACPI_BUFFER *);
+
     APIRET APIENTRY acpihOpen(ACPI_API_HANDLE *phACPI);
+    typedef APIRET APIENTRY ACPIHOPEN(ACPI_API_HANDLE *);
+    typedef ACPIHOPEN *PACPIHOPEN;
 
     VOID APIENTRY acpihClose(ACPI_API_HANDLE *phACPI);
@@ -93,7 +68,20 @@
     APIRET APIENTRY acpihGoToSleep(ACPI_API_HANDLE *phACPI, UCHAR ucState);
 
+    APIRET APIENTRY acpihGetPowerStatus(PAPM, PBOOL);
+    typedef APIRET APIENTRY ACPIHGETPOWERSTATUS(PAPM, PBOOL);
+    typedef ACPIHGETPOWERSTATUS *PACPIHGETPOWERSTATUS;
+
+    BOOL acpihHasBattery(VOID);
+
     #define ORD_ACPISTARTAPI    16
     #define ORD_ACPIENDAPI      17
     #define ORD_ACPIGOTOSLEEP   19
+    #define ORD_ACPITKGETOBJECTINFOALLOC 85
+    #define ORD_ACPITKGETHANDLE 65
+    #define ORD_ACPITKOSFREE 66
+    #define ORD_ACPITKWALKNAMESPACE 56
+    #define ORD_ACPITKEVALUATEOBJECT 50
+    // @@added V1.0.9 (2012-12-10) [slevine]: sync with current ACPI toolkit
+    #define ORD_ACPITKPREPARETOSLEEP 89
 
 #endif
