[powrprof]
authorAleksey Bragin <aleksey@reactos.org>
Sun, 11 Oct 2009 09:49:09 +0000 (09:49 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Sun, 11 Oct 2009 09:49:09 +0000 (09:49 +0000)
- Add more powrprof.dll tests, by Alexander Wurzinger <lohnegrim@gmx.net>.
- Some cleanup and code typo fixes by me.
See issue #3381 for more details.

svn path=/trunk/; revision=43368

rostests/winetests/powrprof/pwrprof.c
rostests/winetests/powrprof/testlist.c

index 96a0790..34bf0fe 100644 (file)
@@ -9,7 +9,7 @@
 #include "winreg.h"
 #include "powrprof.h"
 #include "assert.h"
-
+#include "winnt.h"
 #include "wine/unicode.h"
 /*
    LONG WINAPI RegOpenCurrentUser(REGSAM a,PHKEY b)
@@ -46,10 +46,7 @@ static const WCHAR szMachPowerPoliciesSubKey[] = { 'S', 'O', 'F', 'T', 'W', 'A',
 
 static const WCHAR szTempPwrScheme[] = { '9', '9', 0 };
 
-ULONG DbgPrint(PCCH X,...)
-{
-   return (ULONG)NULL;
-}
+void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original);
 
 void test_CallNtPowerInformation(void)
 {
@@ -70,7 +67,7 @@ void test_CallNtPowerInformation(void)
    retval = CallNtPowerInformation(AdministratorPowerPolicy, 0, 0, &apolicy, sizeof(ADMINISTRATOR_POWER_POLICY));
    ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n", (UINT)retval);
    retval = CallNtPowerInformation(AdministratorPowerPolicy, &apolicy, sizeof(ADMINISTRATOR_POWER_POLICY), 0, 0);
-   ok(retval != STATUS_PRIVILEGE_NOT_HELD, "Privileg not held!!!! more errors to expect");
+   ok(retval != STATUS_PRIVILEGE_NOT_HELD, "Privileg not held!!!! more errors to expect\n");
    ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n", (UINT)retval);
 
    /* LastSleepTime tests */
@@ -386,7 +383,7 @@ void test_DeletePwrScheme(void)
    if (RegOpenKeyW(HKEY_LOCAL_MACHINE, szMachPowerPoliciesSubKey, &hSubKey) == ERROR_SUCCESS)
    {
       if (RegDeleteKeyW(hSubKey, szTempPwrScheme) != STATUS_SUCCESS)
-         printf("failed to delete subkey %i (testentry)\n", g_TempPwrScheme);
+         printf("#1 failed to delete subkey %i (testentry)\n", g_TempPwrScheme);
       RegCloseKey(hSubKey);
    }
 
@@ -491,22 +488,22 @@ void test_GetCurrentPowerPolicies(void)
    ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
    ret = SetActivePwrScheme(0, &gpp, 0);
 
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(0, 0, &pp);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(0, &gpp, &pp);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(current_scheme, &gpp, 0);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(current_scheme, 0, &pp);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(current_scheme, &gpp, &pp);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = SetActivePwrScheme(g_ActivePwrScheme, 0, 0);
    ok(ret, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
@@ -522,10 +519,10 @@ void test_GetCurrentPowerPolicies(void)
 
    ret = GetCurrentPowerPolicies(&gpp,&pp);
    ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
-   ok(gpp.mach.Revision  == 1,"Global Mach Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
-   ok(gpp.user.Revision  == 1,"Global User Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
-   ok(pp.mach.Revision  == 1,"Mach Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
-   ok(pp.user.Revision  == 1,"User Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
+   ok(gpp.mach.Revision  == 1,"Global Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
+   ok(gpp.user.Revision  == 1,"Global User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
+   ok(pp.mach.Revision  == 1,"Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
+   ok(pp.user.Revision  == 1,"User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
 
 
    ret = GetActivePwrScheme(&g_ActivePwrScheme);
@@ -606,10 +603,10 @@ void test_IsAdminOverrideActive(void)
    BOOLEAN ret;
 
    ret = IsAdminOverrideActive(0);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    ret = IsAdminOverrideActive(&app);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    app.MinSleep = 0;
    app.MaxSleep = 0;
@@ -619,7 +616,7 @@ void test_IsAdminOverrideActive(void)
    app.MaxSpindownTimeout = 0;
 
    ret = IsAdminOverrideActive(&app);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
    app.MinSleep = 1;
    app.MaxSleep = 2;
@@ -629,7 +626,7 @@ void test_IsAdminOverrideActive(void)
    app.MaxSpindownTimeout = 6;
 
    ret = IsAdminOverrideActive(&app);
-   ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+   ok(!ret, "function was expected to fail\n");
 
 }
 
@@ -639,7 +636,7 @@ void test_IsPwrHibernateAllowed(void)
         BOOLEAN ret;
 
         ret = IsPwrHibernateAllowed();
-        ok(!ret, "function was expected to fail, error %x\n",(UINT)GetLastError());
+        ok(!ret, "function was expected to fail\n");
  */
 }
 
@@ -670,8 +667,8 @@ void test_ReadGlobalPwrPolicy(void)
 
    ret = ReadGlobalPwrPolicy(&gpp);
    ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
-   ok(gpp.mach.Revision  == 1,"Global Mach Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
-   ok(gpp.user.Revision  == 1,"Global User Revision was expected to be 1 got %i",(UINT)gpp.mach.Revision);
+   ok(gpp.mach.Revision  == 1,"Global Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
+   ok(gpp.user.Revision  == 1,"Global User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
 
 
 
@@ -690,9 +687,9 @@ void test_ReadProcessorPwrScheme(void)
       ret = ReadProcessorPwrScheme(i,&mppp);
       if (ret)
       {
-         ok(mppp.Revision == 1,"Main Revision was expected to be 1 got %i",(UINT)mppp.Revision);
-         ok(mppp.ProcessorPolicyAc.Revision == 1,"PowerAC Revision was expected to be 1 got %i",(UINT)mppp.ProcessorPolicyAc.Revision);
-         ok(mppp.ProcessorPolicyDc.Revision == 1,"PowerDC Revision was expected to be 1 got %i",(UINT)mppp.ProcessorPolicyDc.Revision);
+         ok(mppp.Revision == 1,"Main Revision was expected to be 1 got %i\n",(UINT)mppp.Revision);
+         ok(mppp.ProcessorPolicyAc.Revision == 1,"PowerAC Revision was expected to be 1 got %i\n",(UINT)mppp.ProcessorPolicyAc.Revision);
+         ok(mppp.ProcessorPolicyDc.Revision == 1,"PowerDC Revision was expected to be 1 got %i\n",(UINT)mppp.ProcessorPolicyDc.Revision);
       }
       else
       {
@@ -740,12 +737,441 @@ void test_SetSuspendState(void)
 //     SetSuspendState(FALSE,FALSE,FALSE)
 }
 
-void test_ValidatePowerPolicies(void)
+
+BOOLEAN globalcompare(GLOBAL_POWER_POLICY gpp, GLOBAL_POWER_POLICY gpp_compare)
+{
+       //return TRUE;
+       int i,j;
+       BOOLEAN ret;
+
+       ret = TRUE;
+       if (gpp.mach.BroadcastCapacityResolution != gpp_compare.mach.BroadcastCapacityResolution)
+       {
+               printf("mach.BroadcastCapacityResolution failed %i != %i\n",gpp.mach.BroadcastCapacityResolution,gpp_compare.mach.BroadcastCapacityResolution);
+               ret = FALSE;
+       }
+       if (gpp.mach.LidOpenWakeAc != gpp_compare.mach.LidOpenWakeAc)
+       {
+               printf("mach.LidOpenWakeAc failed %i != %i\n",gpp.mach.LidOpenWakeAc,gpp_compare.mach.LidOpenWakeAc);
+               ret = FALSE;
+       }
+       if (gpp.mach.LidOpenWakeDc != gpp_compare.mach.LidOpenWakeDc)
+       {
+               printf("mach.LidOpenWakeDc failed %i != %i\n",gpp.mach.LidOpenWakeDc,gpp_compare.mach.LidOpenWakeDc);
+               ret = FALSE;
+       }
+       if (gpp.mach.Revision != gpp_compare.mach.Revision)
+       {
+               printf("mach.Revision failed %i != %i\n",gpp.mach.Revision,gpp_compare.mach.Revision);
+               ret = FALSE;
+       }
+
+       if (gpp.user.PowerButtonAc.Action != gpp_compare.user.PowerButtonAc.Action)
+       {
+               printf("user.PowerButtonAc.Action failed %i != %i\n",gpp.user.PowerButtonAc.Action,gpp_compare.user.PowerButtonAc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.PowerButtonAc.EventCode != gpp_compare.user.PowerButtonAc.EventCode)
+       {
+               printf("user.PowerButtonAc.EventCode failed %i != %i\n",gpp.user.PowerButtonAc.EventCode,gpp_compare.user.PowerButtonAc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.PowerButtonAc.Flags != gpp_compare.user.PowerButtonAc.Flags)
+       {
+               printf("user.PowerButtonAc.Flags failed %i != %i\n",gpp.user.PowerButtonAc.Flags,gpp_compare.user.PowerButtonAc.Flags);
+               ret = FALSE;
+       }
+       if (gpp.user.PowerButtonDc.Action != gpp_compare.user.PowerButtonDc.Action)
+       {
+               printf("user.PowerButtonDc.Action failed %i != %i\n",gpp.user.PowerButtonDc.Action,gpp_compare.user.PowerButtonDc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.PowerButtonDc.EventCode != gpp_compare.user.PowerButtonDc.EventCode)
+       {
+               printf("user.PowerButtonDc.EventCode failed %i != %i\n",gpp.user.PowerButtonDc.EventCode,gpp_compare.user.PowerButtonDc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.PowerButtonDc.Flags != gpp_compare.user.PowerButtonDc.Flags)
+       {
+               printf("user.PowerButtonDc.Flags failed %i != %i\n",gpp.user.PowerButtonDc.Flags,gpp_compare.user.PowerButtonDc.Flags);
+               ret = FALSE;
+       }
+    if (gpp.user.SleepButtonAc.Action != gpp_compare.user.SleepButtonAc.Action)
+       {
+               printf("user.SleepButtonAc.Action failed %i != %i\n",gpp.user.SleepButtonAc.Action,gpp_compare.user.SleepButtonAc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.SleepButtonAc.EventCode != gpp_compare.user.SleepButtonAc.EventCode)
+       {
+               printf("user.SleepButtonAc.EventCode failed %i != %i\n",gpp.user.SleepButtonAc.EventCode,gpp_compare.user.SleepButtonAc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.SleepButtonAc.Flags != gpp_compare.user.SleepButtonAc.Flags)
+       {
+               printf("user.SleepButtonAc.Flags failed %i != %i\n",gpp.user.SleepButtonAc.Flags,gpp_compare.user.SleepButtonAc.Flags);
+               ret = FALSE;
+       }
+       if (gpp.user.SleepButtonDc.Action != gpp_compare.user.SleepButtonDc.Action)
+       {
+               printf("user.SleepButtonDc.Action failed %i != %i\n",gpp.user.SleepButtonDc.Action,gpp_compare.user.SleepButtonDc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.SleepButtonDc.EventCode != gpp_compare.user.SleepButtonDc.EventCode)
+       {
+               printf("user.SleepButtonDc.EventCode failed %i != %i\n",gpp.user.SleepButtonDc.EventCode,gpp_compare.user.SleepButtonDc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.SleepButtonDc.Flags != gpp_compare.user.SleepButtonDc.Flags)
+       {
+               printf("user.SleepButtonDc.Flags failed %i != %i\n",gpp.user.SleepButtonDc.Flags,gpp_compare.user.SleepButtonDc.Flags);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseAc.Action != gpp_compare.user.LidCloseAc.Action)
+       {
+               printf("user.LidCloseAc.Action failed %i != %i\n",gpp.user.LidCloseAc.Action,gpp_compare.user.LidCloseAc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseAc.EventCode != gpp_compare.user.LidCloseAc.EventCode)
+       {
+               printf("user.LidCloseAc.EventCode failed %i != %i\n",gpp.user.LidCloseAc.EventCode,gpp_compare.user.LidCloseAc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseAc.Flags != gpp_compare.user.LidCloseAc.Flags)
+       {
+               printf("user.LidCloseAc.Flags failed %i != %i\n",gpp.user.LidCloseAc.Flags,gpp_compare.user.LidCloseAc.Flags);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseDc.Action != gpp_compare.user.LidCloseDc.Action)
+       {
+               printf("user.LidCloseDc.Action failed %i != %i\n",gpp.user.LidCloseDc.Action,gpp_compare.user.LidCloseDc.Action);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseDc.EventCode != gpp_compare.user.LidCloseDc.EventCode)
+       {
+               printf("user.LidCloseDc.EventCode failed %i != %i\n",gpp.user.LidCloseDc.EventCode,gpp_compare.user.LidCloseDc.EventCode);
+               ret = FALSE;
+       }
+       if (gpp.user.LidCloseDc.Flags != gpp_compare.user.LidCloseDc.Flags)
+       {
+               printf("user.LidCloseDc.Flags failed %i != %i\n",gpp.user.LidCloseDc.Flags,gpp_compare.user.LidCloseDc.Flags);
+               ret = FALSE;
+       }
+
+       for(i=0;i<NUM_DISCHARGE_POLICIES;i++)
+       {
+               if (gpp.user.DischargePolicy[i].Enable != gpp_compare.user.DischargePolicy[i].Enable)
+               {
+                       printf("user.DischargePolicy(%i).Enable failed %i != %i\n",i, gpp.user.DischargePolicy[i].Enable,gpp_compare.user.DischargePolicy[i].Enable);
+                   ret = FALSE;
+               }
+               for (j=0;j<3;j++)
+               {
+                       if (gpp.user.DischargePolicy[i].Spare[j] != gpp_compare.user.DischargePolicy[i].Spare[j])
+                       {
+                               printf("user.DischargePolicy(%i).Spare[j] failed %i != %i\n",i, gpp.user.DischargePolicy[i].Spare[j],gpp_compare.user.DischargePolicy[i].Spare[j]);
+                               ret = FALSE;
+                       }
+               }
+               if (gpp.user.DischargePolicy[i].BatteryLevel != gpp_compare.user.DischargePolicy[i].BatteryLevel)
+               {
+                       printf("user.DischargePolicy(%i).BatteryLevel failed %i != %i\n",i, gpp.user.DischargePolicy[i].BatteryLevel,gpp_compare.user.DischargePolicy[i].BatteryLevel);
+                   ret = FALSE;
+               }
+               if (gpp.user.DischargePolicy[i].PowerPolicy.Action != gpp_compare.user.DischargePolicy[i].PowerPolicy.Action)
+               {
+                       printf("user.DischargePolicy(%i).PowerPolicy.Action failed %i != %i\n",i, gpp.user.DischargePolicy[i].PowerPolicy.Action,gpp_compare.user.DischargePolicy[i].PowerPolicy.Action);
+                   ret = FALSE;
+               }
+               if (gpp.user.DischargePolicy[i].PowerPolicy.Flags != gpp_compare.user.DischargePolicy[i].PowerPolicy.Flags)
+               {
+                       printf("user.DischargePolicy(%i).PowerPolicy.Flags failed %i != %i\n",i, gpp.user.DischargePolicy[i].PowerPolicy.Flags,gpp_compare.user.DischargePolicy[i].PowerPolicy.Flags);
+                   ret = FALSE;
+               }
+               if (gpp.user.DischargePolicy[i].PowerPolicy.EventCode != gpp_compare.user.DischargePolicy[i].PowerPolicy.EventCode)
+               {
+                       printf("user.DischargePolicy(%i).PowerPolicy.EventCode failed %i != %i\n",i, gpp.user.DischargePolicy[i].PowerPolicy.EventCode,gpp_compare.user.DischargePolicy[i].PowerPolicy.EventCode);
+                   ret = FALSE;
+               }
+               if (gpp.user.DischargePolicy[i].MinSystemState != gpp_compare.user.DischargePolicy[i].MinSystemState)
+               {
+                       printf("user.DischargePolicy(%i).MinSystemState failed %i != %i\n",i, gpp.user.DischargePolicy[i].MinSystemState,gpp_compare.user.DischargePolicy[i].MinSystemState);
+                   ret = FALSE;
+               }
+       }
+    if (gpp.user.GlobalFlags != gpp_compare.user.GlobalFlags)
+       {
+               printf("user.GlobalFlags failed %i != %i\n",gpp.user.GlobalFlags,gpp_compare.user.GlobalFlags);
+               ret = FALSE;
+       }
+       if (gpp.user.Revision != gpp_compare.user.Revision)
+       {
+               printf("user.Revision failed %i != %i\n",gpp.user.Revision,gpp_compare.user.Revision);
+               ret = FALSE;
+       }
+    return ret;
+}
+BOOLEAN compare(POWER_POLICY pp, POWER_POLICY pp_compare)
+{
+       //return TRUE;
+       BOOLEAN ret=TRUE;
+
+       if (pp.mach.DozeS4TimeoutAc != pp_compare.mach.DozeS4TimeoutAc)
+       {
+               printf("mach.DozeS4TimeoutAc failed %i != %i\n",pp.mach.DozeS4TimeoutAc,pp_compare.mach.DozeS4TimeoutAc);
+               ret = FALSE;
+       }
+       if (pp.mach.DozeS4TimeoutDc != pp_compare.mach.DozeS4TimeoutDc)
+       {
+               printf("mach.DozeS4TimeoutDc failed %i != %i\n",pp.mach.DozeS4TimeoutDc,pp_compare.mach.DozeS4TimeoutDc);
+               ret = FALSE;
+       }
+       if (pp.mach.MinSleepAc != pp_compare.mach.MinSleepAc)
+       {
+               printf("mach.MinSleepAc failed %i != %i\n",pp.mach.MinSleepAc,pp_compare.mach.MinSleepAc);
+               ret = FALSE;
+       }
+       if (pp.mach.MinSleepDc != pp_compare.mach.MinSleepDc)
+       {
+               printf("mach.MinSleepDc failed %i != %i\n",pp.mach.MinSleepDc,pp_compare.mach.MinSleepDc);
+               ret = FALSE;
+       }
+       if (pp.mach.DozeTimeoutAc != pp_compare.mach.DozeTimeoutAc)
+       {
+               printf("mach.DozeTimeoutAc failed %i != %i\n",pp.mach.DozeTimeoutAc,pp_compare.mach.DozeTimeoutAc);
+               ret = FALSE;
+       }
+       if (pp.mach.DozeTimeoutDc != pp_compare.mach.DozeTimeoutDc)
+       {
+               printf("mach.DozeTimeoutDc failed %i != %i\n",pp.mach.DozeTimeoutDc,pp_compare.mach.DozeTimeoutDc);
+               ret = FALSE;
+       }
+       if (pp.mach.ReducedLatencySleepAc != pp_compare.mach.ReducedLatencySleepAc)
+       {
+               printf("mach.ReducedLatencySleepAc failed %i != %i\n",pp.mach.ReducedLatencySleepAc,pp_compare.mach.ReducedLatencySleepAc);
+               ret = FALSE;
+       }
+       if (pp.mach.ReducedLatencySleepDc != pp_compare.mach.ReducedLatencySleepDc)
+       {
+               printf("mach.ReducedLatencySleepDc failed %i != %i\n",pp.mach.ReducedLatencySleepDc,pp_compare.mach.ReducedLatencySleepDc);
+               ret = FALSE;
+       }
+       if (pp.mach.MinThrottleAc != pp_compare.mach.MinThrottleAc)
+       {
+               printf("mach.MinThrottleAc failed %i != %i\n",pp.mach.MinThrottleAc,pp_compare.mach.MinThrottleAc);
+               ret = FALSE;
+       }
+       if (pp.mach.MinThrottleDc != pp_compare.mach.MinThrottleDc)
+       {
+               printf("mach.MinThrottleDc failed %i != %i\n",pp.mach.MinThrottleDc,pp_compare.mach.MinThrottleDc);
+               ret = FALSE;
+       }
+
+       if (pp.mach.OverThrottledAc.Action != pp_compare.mach.OverThrottledAc.Action)
+       {
+               printf("mach.OverThrottledAc.Action failed %i != %i\n",pp.mach.OverThrottledAc.Action,pp_compare.mach.OverThrottledAc.Action);
+               ret = FALSE;
+       }
+       if (pp.mach.OverThrottledAc.Flags != pp_compare.mach.OverThrottledAc.Flags)
+       {
+               printf("mach.OverThrottledAc.Flags failed %i != %i\n",pp.mach.OverThrottledAc.Flags,pp_compare.mach.OverThrottledAc.Flags);
+               ret = FALSE;
+       }
+       if (pp.mach.OverThrottledAc.EventCode != pp_compare.mach.OverThrottledAc.EventCode)
+       {
+               printf("mach.OverThrottledAc.EventCode failed %i != %i\n",pp.mach.OverThrottledAc.EventCode,pp_compare.mach.OverThrottledAc.EventCode);
+               ret = FALSE;
+       }
+       if (pp.mach.OverThrottledDc.Action != pp_compare.mach.OverThrottledDc.Action)
+       {
+               printf("mach.OverThrottledDc.Action failed %i != %i\n",pp.mach.OverThrottledDc.Action,pp_compare.mach.OverThrottledDc.Action);
+               ret = FALSE;
+       }
+       if (pp.mach.OverThrottledDc.Flags != pp_compare.mach.OverThrottledDc.Flags)
+       {
+               printf("mach.OverThrottledDc.Flags failed %i != %i\n",pp.mach.OverThrottledDc.Flags,pp_compare.mach.OverThrottledDc.Flags);
+               ret = FALSE;
+       }
+       if (pp.mach.OverThrottledDc.EventCode != pp_compare.mach.OverThrottledDc.EventCode)
+       {
+               printf("mach.OverThrottledDc.EventCode failed %i != %i\n",pp.mach.OverThrottledDc.EventCode,pp_compare.mach.OverThrottledDc.EventCode);
+               ret = FALSE;
+       }
+
+       if (pp.mach.pad1[0] != pp_compare.mach.pad1[0])
+       {
+               printf("mach.pad1[0] failed %i != %i\n",pp.mach.pad1[0],pp_compare.mach.pad1[0]);
+               ret = FALSE;
+       }
+       if (pp.mach.pad1[1] != pp_compare.mach.pad1[1])
+       {
+               printf("mach.pad1[1] failed %i != %i\n",pp.mach.pad1[1],pp_compare.mach.pad1[1]);
+               ret = FALSE;
+       }
+       if (pp.mach.pad1[2] != pp_compare.mach.pad1[2])
+       {
+               printf("mach.pad1[2] failed %i != %i\n",pp.mach.pad1[2],pp_compare.mach.pad1[2]);
+               ret = FALSE;
+       }
+       if (pp.mach.Revision != pp_compare.mach.Revision)
+       {
+               printf("mach.Revision failed %i != %i\n",pp.mach.Revision,pp_compare.mach.Revision);
+               ret = FALSE;
+       }
+
+       if (pp.user.IdleAc.Action != pp_compare.user.IdleAc.Action)
+       {
+               printf("user.IdleAc.Action failed %i != %i\n",pp.user.IdleAc.Action,pp_compare.user.IdleAc.Action);
+               ret = FALSE;
+       }
+       if (pp.user.IdleAc.Flags != pp_compare.user.IdleAc.Flags)
+       {
+               printf("user.IdleAc.Flags failed %i != %i\n",pp.user.IdleAc.Flags,pp_compare.user.IdleAc.Flags);
+               ret = FALSE;
+       }
+       if (pp.user.IdleAc.EventCode != pp_compare.user.IdleAc.EventCode)
+       {
+               printf("user.IdleAc.EventCode failed %i != %i\n",pp.user.IdleAc.EventCode,pp_compare.user.IdleAc.EventCode);
+               ret = FALSE;
+       }
+       if (pp.user.IdleDc.Action != pp_compare.user.IdleDc.Action)
+       {
+               printf("user.IdleDc.Action failed %i != %i\n",pp.user.IdleDc.Action,pp_compare.user.IdleDc.Action);
+               ret = FALSE;
+       }
+       if (pp.user.IdleDc.Flags != pp_compare.user.IdleDc.Flags)
+       {
+               printf("user.IdleDc.Flags failed %i != %i\n",pp.user.IdleDc.Flags,pp_compare.user.IdleDc.Flags);
+               ret = FALSE;
+       }
+       if (pp.user.IdleDc.EventCode != pp_compare.user.IdleDc.EventCode)
+       {
+               printf("user.IdleDc.EventCode failed %i != %i\n",pp.user.IdleDc.EventCode,pp_compare.user.IdleDc.EventCode);
+               ret = FALSE;
+       }
+       if (pp.user.IdleTimeoutAc != pp_compare.user.IdleTimeoutAc)
+       {
+               printf("user.IdleTimeoutAc failed %i != %i\n",pp.user.IdleTimeoutAc,pp_compare.user.IdleTimeoutAc);
+               ret = FALSE;
+       }
+       if (pp.user.IdleTimeoutDc != pp_compare.user.IdleTimeoutDc)
+       {
+               printf("user.IdleTimeoutDc failed %i != %i\n",pp.user.IdleTimeoutDc,pp_compare.user.IdleTimeoutDc);
+               ret = FALSE;
+       }
+       if (pp.user.IdleSensitivityAc != pp_compare.user.IdleSensitivityAc)
+       {
+               printf("user.IdleSensitivityAc failed %i != %i\n",pp.user.IdleSensitivityAc,pp_compare.user.IdleSensitivityAc);
+               ret = FALSE;
+       }
+       if (pp.user.IdleSensitivityDc != pp_compare.user.IdleSensitivityDc)
+       {
+               printf("user.IdleSensitivityDc failed %i != %i\n",pp.user.IdleSensitivityDc,pp_compare.user.IdleSensitivityDc);
+               ret = FALSE;
+       }
+       if (pp.user.ThrottlePolicyAc != pp_compare.user.ThrottlePolicyAc)
+       {
+               printf("user.ThrottlePolicyAc failed %i != %i\n",pp.user.ThrottlePolicyAc,pp_compare.user.ThrottlePolicyAc);
+               ret = FALSE;
+       }
+       if (pp.user.ThrottlePolicyDc != pp_compare.user.ThrottlePolicyDc)
+       {
+               printf("user.ThrottlePolicyDc failed %i != %i\n",pp.user.ThrottlePolicyDc,pp_compare.user.ThrottlePolicyDc);
+               ret = FALSE;
+       }
+       if (pp.user.MaxSleepAc != pp_compare.user.MaxSleepAc)
+       {
+               printf("user.MaxSleepAc failed %i != %i\n",pp.user.MaxSleepAc,pp_compare.user.MaxSleepAc);
+               ret = FALSE;
+       }
+       if (pp.user.MaxSleepDc != pp_compare.user.MaxSleepDc)
+       {
+               printf("user.MaxSleepDc failed %i != %i\n",pp.user.MaxSleepDc,pp_compare.user.MaxSleepDc);
+               ret = FALSE;
+       }
+       if (pp.user.Reserved[0] != pp_compare.user.Reserved[0])
+       {
+               printf("user.Reserved[0] failed %i != %i\n",pp.user.Reserved[0],pp_compare.user.Reserved[0]);
+               ret = FALSE;
+       }
+       if (pp.user.Reserved[1] != pp_compare.user.Reserved[1])
+       {
+               printf("user.Reserved[1] failed %i != %i\n",pp.user.Reserved[1],pp_compare.user.Reserved[1]);
+               ret = FALSE;
+       }
+       if (pp.user.Reserved[2] != pp_compare.user.Reserved[2])
+       {
+               printf("user.Reserved[2] failed %i != %i\n",pp.user.Reserved[2],pp_compare.user.Reserved[2]);
+               ret = FALSE;
+       }
+       if (pp.user.VideoTimeoutAc != pp_compare.user.VideoTimeoutAc)
+       {
+               printf("user.VideoTimeoutAc failed %i != %i\n",pp.user.VideoTimeoutAc,pp_compare.user.VideoTimeoutAc);
+               ret = FALSE;
+       }
+       if (pp.user.VideoTimeoutDc != pp_compare.user.VideoTimeoutDc)
+       {
+               printf("user.VideoTimeoutDc failed %i != %i\n",pp.user.VideoTimeoutDc,pp_compare.user.VideoTimeoutDc);
+               ret = FALSE;
+       }
+
+       if (pp.user.SpindownTimeoutAc != pp_compare.user.SpindownTimeoutAc)
+       {
+               printf("user.SpindownTimeoutAc failed %i != %i\n",pp.user.SpindownTimeoutAc,pp_compare.user.SpindownTimeoutAc);
+               ret = FALSE;
+       }
+       if (pp.user.SpindownTimeoutDc != pp_compare.user.SpindownTimeoutDc)
+       {
+               printf("user.SpindownTimeoutDc failed %i != %i\n",pp.user.SpindownTimeoutDc,pp_compare.user.SpindownTimeoutDc);
+               ret = FALSE;
+       }
+       if (pp.user.OptimizeForPowerAc != pp_compare.user.OptimizeForPowerAc)
+       {
+               printf("user.OptimizeForPowerAc failed %i != %i\n",pp.user.OptimizeForPowerAc,pp_compare.user.OptimizeForPowerAc);
+               ret = FALSE;
+       }
+       if (pp.user.OptimizeForPowerDc != pp_compare.user.OptimizeForPowerDc)
+       {
+               printf("user.OptimizeForPowerDc failed %i != %i\n",pp.user.OptimizeForPowerDc,pp_compare.user.OptimizeForPowerDc);
+               ret = FALSE;
+       }
+       if (pp.user.FanThrottleToleranceAc != pp_compare.user.FanThrottleToleranceAc)
+       {
+               printf("user.FanThrottleToleranceAc failed %i != %i\n",pp.user.FanThrottleToleranceAc,pp_compare.user.FanThrottleToleranceAc);
+               ret = FALSE;
+       }
+       if (pp.user.FanThrottleToleranceDc != pp_compare.user.FanThrottleToleranceDc)
+       {
+               printf("user.FanThrottleToleranceDc failed %i != %i\n",pp.user.FanThrottleToleranceDc,pp_compare.user.FanThrottleToleranceDc);
+               ret = FALSE;
+       }
+       if (pp.user.ForcedThrottleAc != pp_compare.user.ForcedThrottleAc)
+       {
+               printf("user.ForcedThrottleAc failed %i != %i\n",pp.user.ForcedThrottleAc,pp_compare.user.ForcedThrottleAc);
+               ret = FALSE;
+       }
+       if (pp.user.ForcedThrottleDc != pp_compare.user.ForcedThrottleDc)
+       {
+               printf("user.ForcedThrottleDc failed %i != %i\n",pp.user.ForcedThrottleDc,pp_compare.user.ForcedThrottleDc);
+               ret = FALSE;
+       }
+       if (pp.user.Revision != pp_compare.user.Revision)
+       {
+               printf("user.Revision failed %i != %i\n",pp.user.Revision,pp_compare.user.Revision);
+               ret = FALSE;
+       }
+
+       return ret;
+}
+
+void test_ValidatePowerPolicies_Old(void)
 {
    GLOBAL_POWER_POLICY gpp;
    POWER_POLICY pp;
    BOOLEAN ret;
 
+   RtlZeroMemory(&gpp, sizeof(GLOBAL_POWER_POLICY));
+   RtlZeroMemory(&pp, sizeof(POWER_POLICY));
+
    SetLastError(0);
    ret = ValidatePowerPolicies(0,0);
    ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
@@ -767,14 +1193,13 @@ void test_ValidatePowerPolicies(void)
 
    ret = ValidatePowerPolicies(&gpp,0);
    ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
-   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
 
    gpp.mach.LidOpenWakeAc = PowerSystemWorking;
    gpp.mach.LidOpenWakeDc = PowerSystemWorking;
 
    ret = ValidatePowerPolicies(&gpp,0);
-   ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
-   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
 
    gpp.user.PowerButtonAc.Action = PowerActionNone;
    gpp.user.PowerButtonDc.Action = PowerActionNone;
@@ -837,7 +1262,7 @@ void test_ValidatePowerPolicies(void)
    ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
    if (!ret)
    {
-//             ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+               ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
    }
 
 
@@ -855,242 +1280,3622 @@ void test_ValidatePowerPolicies(void)
 
 }
 
-void test_WriteGlobalPwrPolicy(void)
+void test_ValidatePowerPolicies(void)
 {
-//     WriteGlobalPwrPolicy(&gpp);
-}
+   GLOBAL_POWER_POLICY gpp, gpp_compare, gpp_original;
+   POWER_POLICY pp, pp_compare, pp_original;
+   BOOLEAN ret;
 
-void test_WriteProcessorPwrScheme(void)
-{
-//     WriteProcessorPwrScheme(0,&mppp);
-}
+   RtlZeroMemory(&gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   RtlZeroMemory(&pp_original, sizeof(POWER_POLICY));
 
-void test_WritePwrScheme(void)
-{
-   DWORD retval;
-   static const WCHAR szTestSchemeName[] = {'P','o','w','r','p','r','o','f',0};
-   static const WCHAR szTestSchemeDesc[] = {'P','o','w','r','p','r','o','f',' ','S','c','h','e','m','e',0};
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   /*
-    * create a temporarly profile, will be deleted in test_DeletePwrScheme
-    */
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   retval = WritePwrScheme(&g_TempPwrScheme, (LPWSTR)szTestSchemeName, (LPWSTR)szTestSchemeDesc, &g_PowerPolicy);
-   ok(retval, "Warning: function should have succeeded\n");
-}
+   SetLastError(0);
+   ret = ValidatePowerPolicies(0,0);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
 
-void func_power(void)
-{
-   test_CallNtPowerInformation();
-   test_CanUserWritePwrScheme();
-   test_EnumPwrSchemes();
-   test_GetSetActivePwrScheme();
-   test_ReadPwrScheme();
-   test_WritePwrScheme();
-   test_DeletePwrScheme();
-   test_GetPwrDiskSpindownRange();
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH(%i,%i), but error :%i\n",(UINT)gpp.user.Revision,(UINT)gpp.mach.Revision,(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   test_GetCurrentPowerPolicies();
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   test_GetPwrCapabilities();
-   test_IsAdminOverrideActive();
-   test_IsPwrHibernateAllowed();
-   test_IsPwrShutdownAllowed();
-   test_IsPwrSuspendAllowed();
-   test_ReadGlobalPwrPolicy();
-   test_ReadProcessorPwrScheme();
-   test_SetSuspendState();
-   test_ValidatePowerPolicies();
-   test_WriteGlobalPwrPolicy();
-   test_WriteProcessorPwrScheme();
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-}
+   gpp_original.user.Revision = 1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-void func_ros_init(void)
-{
-   HKEY hUser, hKeyPowrCfg, hKeyGlobalPowrPol, hKeyPowerPolicies, hKeytmp;
-   DWORD err;
-   GLOBAL_USER_POWER_POLICY gupp;
-   GLOBAL_MACHINE_POWER_POLICY gmpp;
-   USER_POWER_POLICY upp;
-   MACHINE_POWER_POLICY mpp;
-   MACHINE_PROCESSOR_POWER_POLICY mppp;
-   GLOBAL_POWER_POLICY gpp;
-   POWER_POLICY pp;
+   gpp_original.mach.Revision = 1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.mach.LidOpenWakeAc = PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.mach.LidOpenWakeDc = PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+       
+   gpp_original.user.PowerButtonAc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.PowerButtonDc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.SleepButtonAc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.SleepButtonDc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.LidCloseAc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.LidCloseDc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[0].Enable=FALSE;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[1].Enable=FALSE;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[2].Enable=FALSE;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[3].Enable=FALSE;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[4].Enable=FALSE;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   pp_original.user.Revision = 1;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() ==  ERROR_REVISION_MISMATCH,"function was expected to fail with  ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   int i;
+   pp_original.mach.Revision = 1;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szUserPowrCfgKey[] = { 'C', 'o', 'n', 't', 'r', 'o', 'l', ' ',
-                                             'P', 'a', 'n', 'e', 'l', '\\', 'P', 'o', 'w', 'e', 'r', 'C', 'f', 'g', 0};
+   pp_original.mach.MinSleepAc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szCurrentPowerPolicy[] = {'C', 'u', 'r', 'r', 'e', 'n', 't', 'P',
-                                                'o', 'w', 'e', 'r', 'P', 'o', 'l', 'i', 'c', 'y', 0};
-   static const WCHAR szcpp[] = {'3', 0 };
+   pp_original.mach.MinSleepDc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szGlobalPowerPolicy[] = { 'G', 'l', 'o', 'b', 'a', 'l', 'P', 'o',
-                                                'w', 'e', 'r', 'P', 'o', 'l', 'i', 'c', 'y', 0};
-   static const WCHAR szPolicies[] = {'P', 'o', 'l', 'i', 'c', 'i', 'e', 's', 0};
-   static const WCHAR szPowerPolicies[] = { 'P', 'o', 'w', 'e', 'r', 'P', 'o', 'l', 'i',
-                                            'c', 'i', 'e', 's', 0};
+   pp_original.mach.ReducedLatencySleepAc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szProcessorPolicies[] = { 'P', 'r', 'o', 'c', 'e', 's', 's', 'o', 'r',
-                                                'P', 'o', 'l', 'i', 'c', 'i', 'e', 's', 0};
+   pp_original.mach.ReducedLatencySleepDc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szcName[] = {'N', 'a', 'm', 'e', 0};
-   static const WCHAR szcDescription[] = {'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', 0};
+   pp_original.mach.OverThrottledAc.Action = PowerActionNone;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static WCHAR szName[] = {'N', 'a', 'm', 'e', '(', '0', ')', 0};
-   static WCHAR szDescription[] = {'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'i', 'o', 'n', '(', '0', ')', 0};
+   pp_original.mach.OverThrottledDc.Action = PowerActionNone;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szMachPowrCfgKey[] = {'S', 'O', 'F', 'T', 'W', 'A', 'R', 'E', '\\', 'M', 'i',
-                                            'c', 'r', 'o', 's', 'o', 'f', 't', '\\', 'W', 'i', 'n', 'd', 'o', 'w', 's', '\\', 'C', 'u',
-                                            'r', 'r', 'e', 'n', 't', 'V', 'e', 'r', 's', 'i', 'o', 'n', '\\', 'C', 'o', 'n', 't', 'r',
-                                            'o', 'l', 's', ' ', 'F', 'o', 'l', 'd', 'e', 'r', '\\', 'P', 'o', 'w', 'e', 'r', 'C', 'f', 'g', 0};
+   pp_original.user.IdleAc.Action = PowerActionWarmEject+1;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szLastID[] = {'L', 'a', 's', 't', 'I', 'D', 0};
-   static const WCHAR szDiskSpinDownMax[] = {'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'D', 'o', 'w', 'n', 'M', 'a', 'x', 0};
-   static const WCHAR szDiskSpinDownMin[] = {'D', 'i', 's', 'k', 'S', 'p', 'i', 'n', 'D', 'o', 'w', 'n', 'M', 'i', 'n', 0};
+   pp_original.user.IdleDc.Action = PowerActionNone-1;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   static const WCHAR szLastIDValue[] = {'5', 0};
-   static const WCHAR szDiskSpinDownMaxValue[] = {'3', '6', '0', '0', 0};
-   static const WCHAR szDiskSpinDownMinValue[] = {'3', 0};
+   pp_original.user.MaxSleepAc = PowerSystemMaximum+1;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   WCHAR tmp[20];
-   /*
-    * Erstelle die Registry-struktur und Daten, welche dafür erforderlich ist damit diese Tests funktionieren
-    */
+   pp_original.user.MaxSleepDc = PowerSystemUnspecified;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   /*
-    * User
-    */
-   err = RegOpenCurrentUser(KEY_ALL_ACCESS,&hUser);
-   ok(err == ERROR_SUCCESS,"Öffnen des Aktuellen Users Fehlgeschlagen\n");
-   if (err == ERROR_SUCCESS)
-   {
-      err = RegCreateKey(hUser,szUserPowrCfgKey,&hKeyPowrCfg);
-      ok(err == ERROR_SUCCESS,"Create Key UserPowrCfg failed with error %i\n",(UINT)err);
-      ok(hKeyPowrCfg != NULL,"Erstellen des Eintrages Powercfg fehlgeschalgen\n");
-      err = RegSetValueExW(hKeyPowrCfg,szCurrentPowerPolicy,(DWORD)NULL,REG_SZ,(CONST BYTE *)szcpp,strlenW(szcpp)*sizeof(WCHAR));
-      ok(err == ERROR_SUCCESS,"Set Value CurrentPowerPolicy failed with error %i\n",(UINT)err);
-      err = RegCreateKey(hKeyPowrCfg,szGlobalPowerPolicy,&hKeyGlobalPowrPol);
-      ok(err == ERROR_SUCCESS,"Create Key GlobalPowerPolicy failed with error %i\n",(UINT)err);
-      gupp.Revision = 1;
-      gupp.PowerButtonAc.Action = PowerActionNone;
-      gupp.PowerButtonDc.Action = PowerActionNone;
-      gupp.SleepButtonAc.Action = PowerActionNone;
-      gupp.SleepButtonDc.Action = PowerActionNone;
-      gupp.LidCloseAc.Action = PowerActionNone;
-      gupp.LidCloseDc.Action = PowerActionNone;
-      for (i=0; i<NUM_DISCHARGE_POLICIES; i++)
-      {
-         gupp.DischargePolicy[0].Enable=FALSE;
-      }
+   pp_original.user.IdleAc.Action = PowerActionNone;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-      err = RegSetValueExW(hKeyGlobalPowrPol,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&gupp,sizeof(GLOBAL_USER_POWER_POLICY));
-      ok(err == ERROR_SUCCESS,"Set Value GlobalPowrPol failed with error %i\n",(UINT)err);
-      err = RegCloseKey(hKeyGlobalPowrPol);
-      ok(err == ERROR_SUCCESS,"Close Key GlobalPowrPol failed with error %i\n",(UINT)err);
-      err = RegCreateKey(hKeyPowrCfg,szPowerPolicies,&hKeyPowerPolicies);
-      ok(err == ERROR_SUCCESS,"Create Key PowerPolicies failed with error %i\n",(UINT)err);
-
-      upp.Revision = 1;
-      upp.IdleAc.Action = PowerActionNone;
-      upp.IdleDc.Action = PowerActionNone;
-      upp.MaxSleepAc = PowerSystemWorking;
-      upp.MaxSleepDc = PowerSystemWorking;
-      upp.VideoTimeoutAc = 0;
-      upp.VideoTimeoutDc = 0;
-      upp.SpindownTimeoutAc = 0;
-      upp.SpindownTimeoutDc = 0;
-
-      for (i = 0; i<6; i++)
-      {
-         _itow(i,tmp,10);
-         err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
-         ok(err == ERROR_SUCCESS,"Create Key PowerPolicies(%i) failed with error %i\n",i,(UINT)err);
-         szName[5]++;
-         szDescription[12]++;
-         err = RegSetValueExW(hKeytmp,szcName,(DWORD)NULL,REG_SZ,(CONST BYTE *)szName,strlenW(szName)*sizeof(WCHAR));
-         err = RegSetValueExW(hKeytmp,szcDescription,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDescription,strlenW(szDescription)*sizeof(WCHAR));
-         err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&upp,sizeof(USER_POWER_POLICY));
-         err = RegCloseKey(hKeytmp);
-      }
-      err = RegCloseKey(hKeyPowerPolicies);
-      err = RegCloseKey(hKeyPowrCfg);
-      err = RegCloseKey(hUser);
-   }
+   pp_original.user.IdleDc.Action = PowerActionNone;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   /*
-    * Mach
-    */
-   err = RegCreateKey(HKEY_LOCAL_MACHINE,szMachPowrCfgKey,&hKeyPowrCfg);
-   ok(err == ERROR_SUCCESS,"Create Key MachPowrCfgKey failed with error %i\n",(UINT)err);
-   err = RegSetValueExW(hKeyPowrCfg,szLastID,(DWORD)NULL,REG_SZ,(CONST BYTE *)szLastIDValue,strlenW(szLastIDValue)*sizeof(WCHAR));
-   err = RegSetValueExW(hKeyPowrCfg,szDiskSpinDownMax,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDiskSpinDownMaxValue,strlenW(szDiskSpinDownMaxValue)*sizeof(WCHAR));
-   err = RegSetValueExW(hKeyPowrCfg,szDiskSpinDownMin,(DWORD)NULL,REG_SZ,(CONST BYTE *)szDiskSpinDownMinValue,strlenW(szDiskSpinDownMinValue)*sizeof(WCHAR));
-
-   err = RegCreateKey(hKeyPowrCfg,szGlobalPowerPolicy,&hKeyGlobalPowrPol);
-   ok(err == ERROR_SUCCESS,"Create Key Mach GlobalPowerPolicy failed with error %i\n",(UINT)err);
-   gmpp.Revision = 1;
-   gmpp.LidOpenWakeAc = PowerSystemWorking;
-   gmpp.LidOpenWakeDc = PowerSystemWorking;
-   gmpp.BroadcastCapacityResolution=0;
-
-   err = RegSetValueExW(hKeyGlobalPowrPol,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&gmpp,sizeof(GLOBAL_MACHINE_POWER_POLICY));
-
-   err = RegCloseKey(hKeyGlobalPowrPol);
-   err = RegCreateKey(hKeyPowrCfg,szPowerPolicies,&hKeyPowerPolicies);
-   ok(err == ERROR_SUCCESS,"Create Key Mach PowerPolicies failed with error %i\n",(UINT)err);
-
-   mpp.Revision = 1;
-   mpp.MinSleepAc = PowerSystemWorking;
-   mpp.MinSleepDc = PowerSystemWorking;
-   mpp.ReducedLatencySleepAc = PowerSystemWorking;
-   mpp.ReducedLatencySleepDc = PowerSystemWorking;
-   mpp.OverThrottledAc.Action = PowerActionNone;
-   mpp.OverThrottledDc.Action = PowerActionNone;
-   mpp.DozeS4TimeoutAc=0;
-   mpp.DozeS4TimeoutDc=0;
-
-   for (i = 0; i<6; i++)
-   {
-      _itow(i,tmp,10);
-      err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
-      ok(err == ERROR_SUCCESS,"Create Key Mach PowerPolicies(%i) failed with error %i\n",(UINT)i,(UINT)err);
-      err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&mpp,sizeof(MACHINE_POWER_POLICY));
-      err = RegCloseKey(hKeytmp);
-   }
-   err = RegCloseKey(hKeyPowerPolicies);
+   pp_original.user.MaxSleepAc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
 
-   err = RegCreateKey(hKeyPowrCfg,szProcessorPolicies,&hKeyPowerPolicies);
-   ok(err == ERROR_SUCCESS,"Create Key Mach ProcessorPolicies failed with error %i\n",(UINT)err);
+   pp_original.user.MaxSleepDc = PowerSystemWorking;
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.BroadcastCapacityResolution=100;
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+
+   gpp_original.mach.BroadcastCapacityResolution=95;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 256;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 256;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 256;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+   gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+   gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+
+   gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
+   gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
+   gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
+   gpp_original.mach.LidOpenWakeAc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.mach.LidOpenWakeAc=PowerSystemWorking;
+   gpp_original.mach.LidOpenWakeDc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+   gpp_original.mach.LidOpenWakeDc=PowerSystemWorking;
+   gpp_original.user.LidCloseAc.Action = PowerActionWarmEject+1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   mppp.Revision = 1;
-   mppp.ProcessorPolicyAc.Revision = 1;
-   mppp.ProcessorPolicyDc.Revision = 1;
+   gpp_original.user.LidCloseAc.Action = PowerActionWarmEject;
+   gpp_original.user.LidCloseDc.Action = PowerActionNone;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   for (i = 0; i<6; i++)
-   {
-      _itow(i,tmp,10);
-      err = RegCreateKey(hKeyPowerPolicies,tmp,&hKeytmp);
-      ok(err == ERROR_SUCCESS,"Create Key Mach ProcessorPolicies(%i) failed with error %i\n",i,(UINT)err);
-      err = RegSetValueExW(hKeytmp,szPolicies,(DWORD)NULL,REG_BINARY,(CONST BYTE *)&mppp,sizeof(MACHINE_PROCESSOR_POWER_POLICY));
-      err = RegCloseKey(hKeytmp);
-   }
-   err = RegCloseKey(hKeyPowerPolicies);
+   gpp_original.user.LidCloseDc.Action = PowerActionWarmEject;
+   gpp_original.user.PowerButtonAc.Action = PowerActionNone-1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   err = RegCloseKey(hKeyPowrCfg);
+   gpp_original.user.PowerButtonAc.Action = PowerActionNone;
+   gpp_original.user.PowerButtonDc.Action = PowerActionWarmEject;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   err = GetCurrentPowerPolicies(&gpp,&pp);
-   ok(err, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_original.user.SleepButtonAc.Action = PowerActionWarmEject;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   err = ValidatePowerPolicies(&gpp,&pp);
-   ok(err, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_original.user.SleepButtonDc.Action = PowerActionWarmEject;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
 
-   /*
-      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy]
-      "CursorProperties"=...
 
-    */
+   pp_original.mach.MinSleepAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemUnspecified;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   //pp_compare.mach.MinSleepAc=4;
+   //pp_compare.mach.MinSleepDc=4;
+   //pp_compare.user.MaxSleepAc=4;
+   //pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   //pp_compare.mach.MinSleepAc=4;
+   //pp_compare.mach.MinSleepDc=4;
+   //pp_compare.user.MaxSleepAc=4;
+   //pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   //pp_compare.mach.MinSleepAc=4;
+   //pp_compare.mach.MinSleepDc=4;
+   //pp_compare.user.MaxSleepAc=4;
+   //pp_compare.user.MaxSleepDc=4;
+   //pp_compare.user.OptimizeForPowerAc=1;
+   //pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemWorking;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemSleeping1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemSleeping1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemSleeping1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemSleeping1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemSleeping2;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemSleeping2;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemSleeping2;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemSleeping2;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemSleeping3;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemSleeping3;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemSleeping3;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemSleeping3;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemHibernate;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemHibernate;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemHibernate;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemHibernate;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   pp_compare.user.OptimizeForPowerAc=1;
+   pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemShutdown;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemShutdown;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemShutdown;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemShutdown;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemMaximum;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemMaximum;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemMaximum;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemMaximum;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemMaximum+1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepDc=PowerSystemMaximum+1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepAc=PowerSystemMaximum+1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.user.MaxSleepDc=PowerSystemMaximum+1;
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pp_original.mach.MinSleepAc=PowerSystemWorking;
+   pp_original.mach.MinSleepDc=PowerSystemWorking;
+   pp_original.user.MaxSleepAc=PowerSystemWorking;
+   pp_original.user.MaxSleepDc=PowerSystemWorking;
+
+
+   test_ValidatePowerPolicies_Next(&gpp_original,&pp_original);
+
+   
+ //   memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+ //   memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       //memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+ //   memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = GetCurrentPowerPolicies(&gpp_original,&pp_original);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   //gpp_compare.mach.BroadcastCapacityResolution = 3;
+   //gpp_compare.user.PowerButtonAc.Action = 2;
+   //gpp_compare.user.PowerButtonAc.Flags=3;
+   //gpp_compare.user.PowerButtonDc.EventCode=16;
+   //gpp_compare.user.PowerButtonDc.Flags=3;
+   //gpp_compare.user.SleepButtonAc.Action=2;
+   //gpp_compare.user.SleepButtonAc.Flags=3;
+   //gpp_compare.user.SleepButtonDc.Action=2;
+   //gpp_compare.user.SleepButtonDc.Flags=3;
+   //gpp_compare.user.LidCloseAc.EventCode=-2147483648;
+   //gpp_compare.user.LidCloseAc.Flags=1;
+   //gpp_compare.user.LidCloseDc.EventCode=-2147483648;
+   //gpp_compare.user.LidCloseDc.Flags=1;
+
+   //gpp_compare.user.DischargePolicy[0].Enable=1;
+   ////gpp_compare.user.DischargePolicy[0].Spare[0]=3;
+   //gpp_compare.user.DischargePolicy[0].Spare[3]=3;
+   //gpp_compare.user.DischargePolicy[0].BatteryLevel=3;
+   //gpp_compare.user.DischargePolicy[0].PowerPolicy.Action=2;
+   //gpp_compare.user.DischargePolicy[0].PowerPolicy.Flags=-1073741820;
+   //gpp_compare.user.DischargePolicy[0].PowerPolicy.EventCode=1;
+   //gpp_compare.user.DischargePolicy[0].MinSystemState=4;
+
+   //gpp_compare.user.DischargePolicy[1].Enable=1;
+   ////gpp_compare.user.DischargePolicy[1].Spare[0]=3;
+   //gpp_compare.user.DischargePolicy[1].Spare[3]=10;
+   //gpp_compare.user.DischargePolicy[1].BatteryLevel=10;
+   ////gpp_compare.user.DischargePolicy[1].PowerPolicy.Action=3;
+   //gpp_compare.user.DischargePolicy[1].PowerPolicy.Flags=3;
+   //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode=65537;
+   //gpp_compare.user.DischargePolicy[1].MinSystemState=1;
+   //
+   //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode=131072;
+   //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode=196608;
+   //gpp_compare.user.GlobalFlags=20;
+
+   //ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.MinSleepAc=4;
+   //pp_compare.mach.MinSleepDc=4;
+   //pp_compare.mach.ReducedLatencySleepAc=4;
+   //pp_compare.mach.ReducedLatencySleepDc=4;
+   //pp_compare.mach.OverThrottledAc.Action=2;
+   //pp_compare.mach.OverThrottledAc.Flags=-1073741820;
+   //pp_compare.mach.OverThrottledDc.Action=2;
+   //pp_compare.mach.OverThrottledDc.Flags=-1073741820;
+   //pp_compare.mach.pad1[2]=2;
+   //pp_compare.user.IdleAc.Flags=1;
+   //pp_compare.user.IdleDc.Flags=1;
+   //pp_compare.user.IdleSensitivityAc=50;
+   //pp_compare.user.IdleSensitivityDc=50;
+   //pp_compare.user.ThrottlePolicyAc=3;
+   //pp_compare.user.ThrottlePolicyDc=3;
+   //pp_compare.user.Reserved[2]=1200;
+   //pp_compare.user.VideoTimeoutAc=1200;
+   //pp_compare.user.VideoTimeoutDc=600;
+   //pp_compare.user.SpindownTimeoutAc=2700;
+   //pp_compare.user.SpindownTimeoutDc=600;
+   //pp_compare.user.FanThrottleToleranceAc=100;
+   //pp_compare.user.FanThrottleToleranceDc=80;
+   //pp_compare.user.ForcedThrottleAc=100;
+   //pp_compare.user.ForcedThrottleDc=100;
+   //pp_compare.user.MaxSleepAc=4;
+   //pp_compare.user.MaxSleepDc=4;
+   //pp_compare.user.OptimizeForPowerAc=1;
+   //pp_compare.user.OptimizeForPowerDc=1;
+   //ok(compare(pp,pp_compare),"Difference Found\n");
+
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,0);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   //gpp_compare.mach.BroadcastCapacityResolution=100;
+   //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+    memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(0,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   //pp_compare.mach.MinSleepAc=4;
+   //pp_compare.mach.MinSleepDc=4;
+   //pp_compare.user.MaxSleepAc=4;
+   //pp_compare.user.MaxSleepDc=4;
+   //pp_compare.user.OptimizeForPowerAc=1;
+   //pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+       memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   //gpp_compare.mach.BroadcastCapacityResolution=100;
+   //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
+   //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
+   //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   pp_compare.mach.MinSleepDc=4;
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepDc=4;
+   //pp_compare.user.OptimizeForPowerAc=1;
+   //pp_compare.user.OptimizeForPowerDc=1;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+}
+
+void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original)
+{
+   GLOBAL_POWER_POLICY gpp, gpp_compare;
+   POWER_POLICY pp, pp_compare;
+   BOOLEAN ret;
+
+   //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeAc);//1
+   //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeDc);//1
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseAc.Action,pGPP_original->user.LidCloseAc.EventCode,pGPP_original->user.LidCloseAc.Flags);//7
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseDc.Action,pGPP_original->user.LidCloseDc.EventCode,pGPP_original->user.LidCloseDc.Flags);//7
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonAc.Action,pGPP_original->user.PowerButtonAc.EventCode,pGPP_original->user.PowerButtonAc.Flags);//0,0,0
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonDc.Action,pGPP_original->user.PowerButtonDc.EventCode,pGPP_original->user.PowerButtonDc.Flags);//7,0,0
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonAc.Action,pGPP_original->user.SleepButtonAc.EventCode,pGPP_original->user.SleepButtonAc.Flags);//7,0,0
+   //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonDc.Action,pGPP_original->user.SleepButtonDc.EventCode,pGPP_original->user.SleepButtonDc.Flags);//7,0,0
+   //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutAc);//0
+   //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutDc);//0
+   //printf("Old: %i \n",pPP_original->mach.DozeTimeoutAc);//0
+   //printf("Old: %i \n",pPP_original->mach.DozeTimeoutDc);//0
+   //printf("Old: %i \n",pPP_original->mach.MinSleepAc);//1
+   //printf("Old: %i \n",pPP_original->mach.MinSleepDc);//1
+   //printf("Old: %i \n",pPP_original->mach.MinThrottleAc);//0
+   //printf("Old: %i \n",pPP_original->mach.MinThrottleDc);//0
+   //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledAc.Action,pPP_original->mach.OverThrottledAc.EventCode,pPP_original->mach.OverThrottledAc.Flags);//0,0,0
+   //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledDc.Action,pPP_original->mach.OverThrottledDc.EventCode,pPP_original->mach.OverThrottledDc.Flags);//0,0,0
+   //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepAc);//1
+   //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepDc);//1
+   //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceAc);//0
+   //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceDc);//0
+   //printf("Old: %i \n",pPP_original->user.ForcedThrottleAc);//0
+   //printf("Old: %i \n",pPP_original->user.ForcedThrottleDc);//0
+   //printf("Old: %i,%i,%i \n",pPP_original->user.IdleAc.Action,pPP_original->user.IdleAc.EventCode,pPP_original->user.IdleAc.Flags);//0,0,0
+   //printf("Old: %i,%i,%i \n",pPP_original->user.IdleDc.Action,pPP_original->user.IdleDc.EventCode,pPP_original->user.IdleDc.Flags);//0,0,0
+   //printf("Old: %i \n",pPP_original->user.IdleSensitivityAc);//0
+   //printf("Old: %i \n",pPP_original->user.IdleSensitivityDc);//0
+   //printf("Old: %i \n",pPP_original->user.IdleTimeoutAc);//0
+   //printf("Old: %i \n",pPP_original->user.IdleTimeoutDc);//0
+   //printf("Old: %i \n",pPP_original->user.MaxSleepAc);//1
+   //printf("Old: %i \n",pPP_original->user.MaxSleepDc);//1
+   //printf("Old: %i \n",pPP_original->user.OptimizeForPowerAc);//0
+   //printf("Old: %i \n",pPP_original->user.OptimizeForPowerDc);//0
+   //printf("Old: %i \n",pPP_original->user.SpindownTimeoutAc);//0
+   //printf("Old: %i \n",pPP_original->user.SpindownTimeoutDc);//0
+   //printf("Old: %i \n",pPP_original->user.ThrottlePolicyAc);//0
+   //printf("Old: %i \n",pPP_original->user.ThrottlePolicyDc);//0
+   //printf("Old: %i \n",pPP_original->user.VideoTimeoutAc);//0
+   //printf("Old: %i \n",pPP_original->user.VideoTimeoutDc);//0
+
+   pPP_original->mach.MinSleepAc=4;
+pPP_original->mach.MinSleepDc=4;
+pPP_original->user.MaxSleepAc=4;
+pPP_original->user.MaxSleepDc=4;
+pPP_original->user.OptimizeForPowerAc=1;
+pPP_original->user.OptimizeForPowerDc=1;
+
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeAc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeAc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeAc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+   pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
+
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeDc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeDc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.mach.LidOpenWakeDc=4;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+   pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.LidCloseAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.LidCloseAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
+
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.LidCloseDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.LidCloseDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
+
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.PowerButtonAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.PowerButtonAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
+
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.PowerButtonDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.PowerButtonDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
+
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.SleepButtonAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.SleepButtonAc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
+
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.SleepButtonDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   gpp_compare.user.SleepButtonDc.Action=2;
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
+
+
+   pPP_original->mach.MinSleepAc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepAc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
+
+
+   pPP_original->mach.MinSleepDc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.MinSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.MinSleepDc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
+
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   pp_compare.mach.OverThrottledAc.Action=2;
+   pp_compare.mach.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.OverThrottledAc.Action=2;
+   pp_compare.mach.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
+
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   pp_compare.mach.OverThrottledDc.Action=2;
+   pp_compare.mach.OverThrottledAc.Action=0;
+   pp_compare.mach.pad1[2]=0;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.OverThrottledDc.Action=2;
+   pp_compare.mach.OverThrottledAc.Action=0;
+   pp_compare.mach.pad1[2]=0;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.OverThrottledDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
+
+
+     pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
+
+
+     pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.mach.ReducedLatencySleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
+
+
+   pPP_original->user.IdleAc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   pp_compare.user.IdleAc.Action=2;
+   //pp_compare.user.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.IdleAc.Action=2;
+   //pp_compare.user.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleAc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleAc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->user.IdleAc.Action=PowerActionNone;
+
+
+  
+   pPP_original->user.IdleDc.Action=PowerActionNone-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionNone-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionNone;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionReserved;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   pp_compare.user.IdleDc.Action=2;
+//   pp_compare.user.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionSleep;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.IdleDc.Action=2;
+//   pp_compare.user.pad1[2]=2;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionShutdownReset;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.IdleDc.Action=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionShutdownOff;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionWarmEject;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionWarmEject+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.IdleDc.Action=PowerActionWarmEject+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->user.IdleDc.Action=PowerActionNone;
+
+
+   pPP_original->user.MaxSleepAc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepAc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepAc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
+
+
+   pPP_original->user.MaxSleepDc=PowerSystemUnspecified-2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemUnspecified-1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemUnspecified;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(!ret, "function was expected to fail\n");
+   ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   //pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemWorking;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemSleeping1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemSleeping2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemHibernate;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemShutdown;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemMaximum;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemMaximum+1;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+
+   pPP_original->user.MaxSleepDc=PowerSystemMaximum+2;
+    memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+    memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
+       memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
+    memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
+   ret = ValidatePowerPolicies(&gpp,&pp);
+   ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
+   ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
+   pp_compare.user.MaxSleepDc=4;
+   ok(compare(pp,pp_compare),"Difference Found\n");
+  pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
+
+}
+
+void test_WriteGlobalPwrPolicy(void)
+{
+//     WriteGlobalPwrPolicy(&gpp);
+}
+
+void test_WriteProcessorPwrScheme(void)
+{
+//     WriteProcessorPwrScheme(0,&mppp);
+}
+
+void test_WritePwrScheme(void)
+{
+   DWORD retval;
+   HKEY hSubKey;
+   LONG lSize;
+   LONG Err;
+   WCHAR szPath[MAX_PATH];
+   static const WCHAR szTestSchemeName[] = {'P','o','w','r','p','r','o','f',0};
+   static const WCHAR szTestSchemeDesc[] = {'P','o','w','r','p','r','o','f',' ','S','c','h','e','m','e',0};
+
+   /*
+    * create a temporarly profile, will be deleted in test_DeletePwrScheme
+    */
+
+   retval = WritePwrScheme(&g_TempPwrScheme, (LPWSTR)szTestSchemeName, (LPWSTR)szTestSchemeDesc, &g_PowerPolicy);
+   ok(retval, "Warning: function should have succeeded\n");
+   if (RegOpenKeyW(HKEY_LOCAL_MACHINE, szMachPowerPoliciesSubKey, &hSubKey) == ERROR_SUCCESS)
+   {
+          lSize = MAX_PATH * sizeof(WCHAR);
+          Err = RegQueryValueW(hSubKey, szTempPwrScheme, szPath, &lSize);
+          if (Err != STATUS_SUCCESS)
+         printf("#1 failed to query subkey %i (testentry)\n", g_TempPwrScheme);
+      RegCloseKey(hSubKey);
+   }
+
+}
+
+void func_power(void)
+{
+   test_CallNtPowerInformation();
+   test_CanUserWritePwrScheme();
+   test_EnumPwrSchemes();
+   test_GetSetActivePwrScheme();
+   test_ReadPwrScheme();
+   test_WritePwrScheme();
+   test_DeletePwrScheme();
+   test_GetPwrDiskSpindownRange();
+
+   test_GetCurrentPowerPolicies();
+
+   test_GetPwrCapabilities();
+   test_IsAdminOverrideActive();
+   test_IsPwrHibernateAllowed();
+   test_IsPwrShutdownAllowed();
+   test_IsPwrSuspendAllowed();
+   test_ReadGlobalPwrPolicy();
+   test_ReadProcessorPwrScheme();
+   test_SetSuspendState();
+   test_ValidatePowerPolicies_Old();
+   test_ValidatePowerPolicies();
+   test_WriteGlobalPwrPolicy();
+   test_WriteProcessorPwrScheme();
 
 }
index 636ad96..3575ce2 100644 (file)
@@ -14,12 +14,10 @@ struct test
 };
 
 extern void func_power(void);
-extern void func_ros_init(void);
 
 const struct test winetest_testlist[] =
 {
        { "power", func_power },
-       { "ros_init", func_ros_init },
        { 0, 0 }
 };