ReactOS 0.4.16-dev-252-g9ccafe8
power.c File Reference
#include <apitest.h>
#include <stdio.h>
#include <stdarg.h>
#include <ntstatus.h>
#include <winreg.h>
#include <ndk/potypes.h>
#include <powrprof.h>
Include dependency graph for power.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 

Functions

void test_ValidatePowerPolicies_Next (PGLOBAL_POWER_POLICY pGPP_original, PPOWER_POLICY pPP_original)
 
void test_CallNtPowerInformation (void)
 
void test_CanUserWritePwrScheme (void)
 
BOOLEAN CALLBACK test_callback_EnumPwrScheme (UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc, LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam)
 
BOOLEAN CALLBACK test_callback_stop_EnumPwrScheme (UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc, LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam)
 
void test_DeletePwrScheme (void)
 
void test_EnumPwrSchemes (void)
 
void test_GetSetActivePwrScheme (void)
 
void test_GetCurrentPowerPolicies (void)
 
void test_GetPwrCapabilities (void)
 
void test_GetPwrDiskSpindownRange (void)
 
void test_IsAdminOverrideActive (void)
 
void test_IsPwrHibernateAllowed (void)
 
void test_IsPwrShutdownAllowed (void)
 
void test_IsPwrSuspendAllowed (void)
 
void test_ReadGlobalPwrPolicy (void)
 
void test_ReadProcessorPwrScheme (void)
 
void test_ReadPwrScheme (void)
 
void test_SetSuspendState (void)
 
BOOLEAN globalcompare (GLOBAL_POWER_POLICY gpp, GLOBAL_POWER_POLICY gpp_compare)
 
BOOLEAN compare (POWER_POLICY pp, POWER_POLICY pp_compare)
 
void test_ValidatePowerPolicies_Old (void)
 
void test_ValidatePowerPolicies (void)
 
void test_WriteGlobalPwrPolicy (void)
 
void test_WriteProcessorPwrScheme (void)
 
void test_WritePwrScheme (void)
 
void func_power (void)
 

Variables

unsigned int g_NumPwrSchemes = 0
 
unsigned int g_NumPwrSchemesEnumerated = 0
 
unsigned int g_ActivePwrScheme = 3
 
unsigned int g_TempPwrScheme = 99
 
POWER_POLICY g_PowerPolicy
 
static const WCHAR szMachPowerPoliciesSubKey []
 
static const WCHAR szTempPwrScheme [] = { '9', '9', 0 }
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 15 of file power.c.

Function Documentation

◆ compare()

BOOLEAN compare ( POWER_POLICY  pp,
POWER_POLICY  pp_compare 
)

Definition at line 900 of file power.c.

901{
902 //return TRUE;
904
905 if (pp.mach.DozeS4TimeoutAc != pp_compare.mach.DozeS4TimeoutAc)
906 {
907 printf("mach.DozeS4TimeoutAc failed %lu != %lu\n",pp.mach.DozeS4TimeoutAc,pp_compare.mach.DozeS4TimeoutAc);
908 ret = FALSE;
909 }
910 if (pp.mach.DozeS4TimeoutDc != pp_compare.mach.DozeS4TimeoutDc)
911 {
912 printf("mach.DozeS4TimeoutDc failed %lu != %lu\n",pp.mach.DozeS4TimeoutDc,pp_compare.mach.DozeS4TimeoutDc);
913 ret = FALSE;
914 }
915 if (pp.mach.MinSleepAc != pp_compare.mach.MinSleepAc)
916 {
917 printf("mach.MinSleepAc failed %i != %i\n",pp.mach.MinSleepAc,pp_compare.mach.MinSleepAc);
918 ret = FALSE;
919 }
920 if (pp.mach.MinSleepDc != pp_compare.mach.MinSleepDc)
921 {
922 printf("mach.MinSleepDc failed %i != %i\n",pp.mach.MinSleepDc,pp_compare.mach.MinSleepDc);
923 ret = FALSE;
924 }
925 if (pp.mach.DozeTimeoutAc != pp_compare.mach.DozeTimeoutAc)
926 {
927 printf("mach.DozeTimeoutAc failed %lu != %lu\n",pp.mach.DozeTimeoutAc,pp_compare.mach.DozeTimeoutAc);
928 ret = FALSE;
929 }
930 if (pp.mach.DozeTimeoutDc != pp_compare.mach.DozeTimeoutDc)
931 {
932 printf("mach.DozeTimeoutDc failed %lu != %lu\n",pp.mach.DozeTimeoutDc,pp_compare.mach.DozeTimeoutDc);
933 ret = FALSE;
934 }
936 {
937 printf("mach.ReducedLatencySleepAc failed %i != %i\n",pp.mach.ReducedLatencySleepAc,pp_compare.mach.ReducedLatencySleepAc);
938 ret = FALSE;
939 }
941 {
942 printf("mach.ReducedLatencySleepDc failed %i != %i\n",pp.mach.ReducedLatencySleepDc,pp_compare.mach.ReducedLatencySleepDc);
943 ret = FALSE;
944 }
945 if (pp.mach.MinThrottleAc != pp_compare.mach.MinThrottleAc)
946 {
947 printf("mach.MinThrottleAc failed %i != %i\n",pp.mach.MinThrottleAc,pp_compare.mach.MinThrottleAc);
948 ret = FALSE;
949 }
950 if (pp.mach.MinThrottleDc != pp_compare.mach.MinThrottleDc)
951 {
952 printf("mach.MinThrottleDc failed %i != %i\n",pp.mach.MinThrottleDc,pp_compare.mach.MinThrottleDc);
953 ret = FALSE;
954 }
955
957 {
958 printf("mach.OverThrottledAc.Action failed %i != %i\n",pp.mach.OverThrottledAc.Action,pp_compare.mach.OverThrottledAc.Action);
959 ret = FALSE;
960 }
961 if (pp.mach.OverThrottledAc.Flags != pp_compare.mach.OverThrottledAc.Flags)
962 {
963 printf("mach.OverThrottledAc.Flags failed %lu != %lu\n",pp.mach.OverThrottledAc.Flags,pp_compare.mach.OverThrottledAc.Flags);
964 ret = FALSE;
965 }
967 {
968 printf("mach.OverThrottledAc.EventCode failed %lu != %lu\n",pp.mach.OverThrottledAc.EventCode,pp_compare.mach.OverThrottledAc.EventCode);
969 ret = FALSE;
970 }
972 {
973 printf("mach.OverThrottledDc.Action failed %i != %i\n",pp.mach.OverThrottledDc.Action,pp_compare.mach.OverThrottledDc.Action);
974 ret = FALSE;
975 }
976 if (pp.mach.OverThrottledDc.Flags != pp_compare.mach.OverThrottledDc.Flags)
977 {
978 printf("mach.OverThrottledDc.Flags failed %lu != %lu\n",pp.mach.OverThrottledDc.Flags,pp_compare.mach.OverThrottledDc.Flags);
979 ret = FALSE;
980 }
982 {
983 printf("mach.OverThrottledDc.EventCode failed %lu != %lu\n",pp.mach.OverThrottledDc.EventCode,pp_compare.mach.OverThrottledDc.EventCode);
984 ret = FALSE;
985 }
986
987 if (pp.mach.pad1[0] != pp_compare.mach.pad1[0])
988 {
989 printf("mach.pad1[0] failed %i != %i\n",pp.mach.pad1[0],pp_compare.mach.pad1[0]);
990 ret = FALSE;
991 }
992 if (pp.mach.pad1[1] != pp_compare.mach.pad1[1])
993 {
994 printf("mach.pad1[1] failed %i != %i\n",pp.mach.pad1[1],pp_compare.mach.pad1[1]);
995 ret = FALSE;
996 }
997 if (pp.mach.Revision != pp_compare.mach.Revision)
998 {
999 printf("mach.Revision failed %lu != %lu\n",pp.mach.Revision,pp_compare.mach.Revision);
1000 ret = FALSE;
1001 }
1002
1003 if (pp.user.IdleAc.Action != pp_compare.user.IdleAc.Action)
1004 {
1005 printf("user.IdleAc.Action failed %i != %i\n",pp.user.IdleAc.Action,pp_compare.user.IdleAc.Action);
1006 ret = FALSE;
1007 }
1008 if (pp.user.IdleAc.Flags != pp_compare.user.IdleAc.Flags)
1009 {
1010 printf("user.IdleAc.Flags failed %lu != %lu\n",pp.user.IdleAc.Flags,pp_compare.user.IdleAc.Flags);
1011 ret = FALSE;
1012 }
1013 if (pp.user.IdleAc.EventCode != pp_compare.user.IdleAc.EventCode)
1014 {
1015 printf("user.IdleAc.EventCode failed %lu != %lu\n",pp.user.IdleAc.EventCode,pp_compare.user.IdleAc.EventCode);
1016 ret = FALSE;
1017 }
1018 if (pp.user.IdleDc.Action != pp_compare.user.IdleDc.Action)
1019 {
1020 printf("user.IdleDc.Action failed %i != %i\n",pp.user.IdleDc.Action,pp_compare.user.IdleDc.Action);
1021 ret = FALSE;
1022 }
1023 if (pp.user.IdleDc.Flags != pp_compare.user.IdleDc.Flags)
1024 {
1025 printf("user.IdleDc.Flags failed %lu != %lu\n",pp.user.IdleDc.Flags,pp_compare.user.IdleDc.Flags);
1026 ret = FALSE;
1027 }
1028 if (pp.user.IdleDc.EventCode != pp_compare.user.IdleDc.EventCode)
1029 {
1030 printf("user.IdleDc.EventCode failed %lu != %lu\n",pp.user.IdleDc.EventCode,pp_compare.user.IdleDc.EventCode);
1031 ret = FALSE;
1032 }
1033 if (pp.user.IdleTimeoutAc != pp_compare.user.IdleTimeoutAc)
1034 {
1035 printf("user.IdleTimeoutAc failed %lu != %lu\n",pp.user.IdleTimeoutAc,pp_compare.user.IdleTimeoutAc);
1036 ret = FALSE;
1037 }
1038 if (pp.user.IdleTimeoutDc != pp_compare.user.IdleTimeoutDc)
1039 {
1040 printf("user.IdleTimeoutDc failed %lu != %lu\n",pp.user.IdleTimeoutDc,pp_compare.user.IdleTimeoutDc);
1041 ret = FALSE;
1042 }
1043 if (pp.user.IdleSensitivityAc != pp_compare.user.IdleSensitivityAc)
1044 {
1045 printf("user.IdleSensitivityAc failed %i != %i\n",pp.user.IdleSensitivityAc,pp_compare.user.IdleSensitivityAc);
1046 ret = FALSE;
1047 }
1048 if (pp.user.IdleSensitivityDc != pp_compare.user.IdleSensitivityDc)
1049 {
1050 printf("user.IdleSensitivityDc failed %i != %i\n",pp.user.IdleSensitivityDc,pp_compare.user.IdleSensitivityDc);
1051 ret = FALSE;
1052 }
1053 if (pp.user.ThrottlePolicyAc != pp_compare.user.ThrottlePolicyAc)
1054 {
1055 printf("user.ThrottlePolicyAc failed %i != %i\n",pp.user.ThrottlePolicyAc,pp_compare.user.ThrottlePolicyAc);
1056 ret = FALSE;
1057 }
1058 if (pp.user.ThrottlePolicyDc != pp_compare.user.ThrottlePolicyDc)
1059 {
1060 printf("user.ThrottlePolicyDc failed %i != %i\n",pp.user.ThrottlePolicyDc,pp_compare.user.ThrottlePolicyDc);
1061 ret = FALSE;
1062 }
1063 if (pp.user.MaxSleepAc != pp_compare.user.MaxSleepAc)
1064 {
1065 printf("user.MaxSleepAc failed %i != %i\n",pp.user.MaxSleepAc,pp_compare.user.MaxSleepAc);
1066 ret = FALSE;
1067 }
1068 if (pp.user.MaxSleepDc != pp_compare.user.MaxSleepDc)
1069 {
1070 printf("user.MaxSleepDc failed %i != %i\n",pp.user.MaxSleepDc,pp_compare.user.MaxSleepDc);
1071 ret = FALSE;
1072 }
1073 if (pp.user.Reserved[0] != pp_compare.user.Reserved[0])
1074 {
1075 printf("user.Reserved[0] failed %lu != %lu\n",pp.user.Reserved[0],pp_compare.user.Reserved[0]);
1076 ret = FALSE;
1077 }
1078 if (pp.user.Reserved[1] != pp_compare.user.Reserved[1])
1079 {
1080 printf("user.Reserved[1] failed %lu != %lu\n",pp.user.Reserved[1],pp_compare.user.Reserved[1]);
1081 ret = FALSE;
1082 }
1083 if (pp.user.Reserved[2] != pp_compare.user.Reserved[2])
1084 {
1085 printf("user.Reserved[2] failed %lu != %lu\n",pp.user.Reserved[2],pp_compare.user.Reserved[2]);
1086 ret = FALSE;
1087 }
1088 if (pp.user.VideoTimeoutAc != pp_compare.user.VideoTimeoutAc)
1089 {
1090 printf("user.VideoTimeoutAc failed %lu != %lu\n",pp.user.VideoTimeoutAc,pp_compare.user.VideoTimeoutAc);
1091 ret = FALSE;
1092 }
1093 if (pp.user.VideoTimeoutDc != pp_compare.user.VideoTimeoutDc)
1094 {
1095 printf("user.VideoTimeoutDc failed %lu != %lu\n",pp.user.VideoTimeoutDc,pp_compare.user.VideoTimeoutDc);
1096 ret = FALSE;
1097 }
1098
1099 if (pp.user.SpindownTimeoutAc != pp_compare.user.SpindownTimeoutAc)
1100 {
1101 printf("user.SpindownTimeoutAc failed %lu != %lu\n",pp.user.SpindownTimeoutAc,pp_compare.user.SpindownTimeoutAc);
1102 ret = FALSE;
1103 }
1104 if (pp.user.SpindownTimeoutDc != pp_compare.user.SpindownTimeoutDc)
1105 {
1106 printf("user.SpindownTimeoutDc failed %lu != %lu\n",pp.user.SpindownTimeoutDc,pp_compare.user.SpindownTimeoutDc);
1107 ret = FALSE;
1108 }
1109 if (pp.user.OptimizeForPowerAc != pp_compare.user.OptimizeForPowerAc)
1110 {
1111 printf("user.OptimizeForPowerAc failed %i != %i\n",pp.user.OptimizeForPowerAc,pp_compare.user.OptimizeForPowerAc);
1112 ret = FALSE;
1113 }
1114 if (pp.user.OptimizeForPowerDc != pp_compare.user.OptimizeForPowerDc)
1115 {
1116 printf("user.OptimizeForPowerDc failed %i != %i\n",pp.user.OptimizeForPowerDc,pp_compare.user.OptimizeForPowerDc);
1117 ret = FALSE;
1118 }
1120 {
1121 printf("user.FanThrottleToleranceAc failed %i != %i\n",pp.user.FanThrottleToleranceAc,pp_compare.user.FanThrottleToleranceAc);
1122 ret = FALSE;
1123 }
1125 {
1126 printf("user.FanThrottleToleranceDc failed %i != %i\n",pp.user.FanThrottleToleranceDc,pp_compare.user.FanThrottleToleranceDc);
1127 ret = FALSE;
1128 }
1129 if (pp.user.ForcedThrottleAc != pp_compare.user.ForcedThrottleAc)
1130 {
1131 printf("user.ForcedThrottleAc failed %i != %i\n",pp.user.ForcedThrottleAc,pp_compare.user.ForcedThrottleAc);
1132 ret = FALSE;
1133 }
1134 if (pp.user.ForcedThrottleDc != pp_compare.user.ForcedThrottleDc)
1135 {
1136 printf("user.ForcedThrottleDc failed %i != %i\n",pp.user.ForcedThrottleDc,pp_compare.user.ForcedThrottleDc);
1137 ret = FALSE;
1138 }
1139 if (pp.user.Revision != pp_compare.user.Revision)
1140 {
1141 printf("user.Revision failed %lu != %lu\n",pp.user.Revision,pp_compare.user.Revision);
1142 ret = FALSE;
1143 }
1144
1145 return ret;
1146}
unsigned char BOOLEAN
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define printf
Definition: freeldr.h:97
SYSTEM_POWER_STATE MinSleepAc
Definition: powrprof.h:47
SYSTEM_POWER_STATE ReducedLatencySleepDc
Definition: powrprof.h:50
POWER_ACTION_POLICY OverThrottledDc
Definition: powrprof.h:59
SYSTEM_POWER_STATE ReducedLatencySleepAc
Definition: powrprof.h:49
POWER_ACTION_POLICY OverThrottledAc
Definition: powrprof.h:58
SYSTEM_POWER_STATE MinSleepDc
Definition: powrprof.h:48
POWER_ACTION Action
Definition: ntpoapi.h:408
MACHINE_POWER_POLICY mach
Definition: powrprof.h:92
USER_POWER_POLICY user
Definition: powrprof.h:91
SYSTEM_POWER_STATE MaxSleepAc
Definition: powrprof.h:76
ULONG VideoTimeoutDc
Definition: powrprof.h:80
ULONG Reserved[2]
Definition: powrprof.h:78
SYSTEM_POWER_STATE MaxSleepDc
Definition: powrprof.h:77
POWER_ACTION_POLICY IdleAc
Definition: powrprof.h:68
UCHAR FanThrottleToleranceDc
Definition: powrprof.h:86
UCHAR ThrottlePolicyAc
Definition: powrprof.h:74
ULONG SpindownTimeoutAc
Definition: powrprof.h:81
UCHAR FanThrottleToleranceAc
Definition: powrprof.h:85
UCHAR IdleSensitivityDc
Definition: powrprof.h:73
ULONG SpindownTimeoutDc
Definition: powrprof.h:82
ULONG IdleTimeoutAc
Definition: powrprof.h:70
BOOLEAN OptimizeForPowerDc
Definition: powrprof.h:84
UCHAR ForcedThrottleAc
Definition: powrprof.h:87
UCHAR ForcedThrottleDc
Definition: powrprof.h:88
POWER_ACTION_POLICY IdleDc
Definition: powrprof.h:69
UCHAR ThrottlePolicyDc
Definition: powrprof.h:75
UCHAR IdleSensitivityAc
Definition: powrprof.h:72
ULONG IdleTimeoutDc
Definition: powrprof.h:71
BOOLEAN OptimizeForPowerAc
Definition: powrprof.h:83
ULONG VideoTimeoutAc
Definition: powrprof.h:79
int ret

◆ func_power()

void func_power ( void  )

Definition at line 4844 of file power.c.

4845{
4846 if (1)
4847 skip("CallNtPowerInformation test is broken and fails on Windows\n");
4848 else
4857
4859
4868 if (1)
4869 skip("ValidatePowerPolicies tests are broken and fail on Windows\n");
4870 else
4871 {
4874 }
4877
4878}
#define skip(...)
Definition: atltest.h:64
void test_GetPwrCapabilities(void)
Definition: power.c:541
void test_ReadProcessorPwrScheme(void)
Definition: power.c:664
void test_ReadGlobalPwrPolicy(void)
Definition: power.c:650
void test_ReadPwrScheme(void)
Definition: power.c:694
void test_WriteGlobalPwrPolicy(void)
Definition: power.c:4807
void test_IsPwrShutdownAllowed(void)
Definition: power.c:630
void test_IsPwrHibernateAllowed(void)
Definition: power.c:620
void test_GetSetActivePwrScheme(void)
Definition: power.c:418
void test_GetCurrentPowerPolicies(void)
Definition: power.c:465
void test_SetSuspendState(void)
Definition: power.c:722
void test_CallNtPowerInformation(void)
Definition: power.c:38
void test_IsAdminOverrideActive(void)
Definition: power.c:587
void test_GetPwrDiskSpindownRange(void)
Definition: power.c:556
void test_EnumPwrSchemes(void)
Definition: power.c:379
void test_ValidatePowerPolicies_Old(void)
Definition: power.c:1148
void test_CanUserWritePwrScheme(void)
Definition: power.c:298
void test_ValidatePowerPolicies(void)
Definition: power.c:1264
void test_IsPwrSuspendAllowed(void)
Definition: power.c:640
void test_WriteProcessorPwrScheme(void)
Definition: power.c:4812
void test_WritePwrScheme(void)
Definition: power.c:4817
void test_DeletePwrScheme(void)
Definition: power.c:336

◆ globalcompare()

BOOLEAN globalcompare ( GLOBAL_POWER_POLICY  gpp,
GLOBAL_POWER_POLICY  gpp_compare 
)

Definition at line 728 of file power.c.

729{
730 //return TRUE;
731 int i,j;
732 BOOLEAN ret;
733
734 ret = TRUE;
736 {
737 printf("mach.BroadcastCapacityResolution failed %lu != %lu\n",gpp.mach.BroadcastCapacityResolution,gpp_compare.mach.BroadcastCapacityResolution);
738 ret = FALSE;
739 }
740 if (gpp.mach.LidOpenWakeAc != gpp_compare.mach.LidOpenWakeAc)
741 {
742 printf("mach.LidOpenWakeAc failed %i != %i\n",gpp.mach.LidOpenWakeAc,gpp_compare.mach.LidOpenWakeAc);
743 ret = FALSE;
744 }
745 if (gpp.mach.LidOpenWakeDc != gpp_compare.mach.LidOpenWakeDc)
746 {
747 printf("mach.LidOpenWakeDc failed %i != %i\n",gpp.mach.LidOpenWakeDc,gpp_compare.mach.LidOpenWakeDc);
748 ret = FALSE;
749 }
750 if (gpp.mach.Revision != gpp_compare.mach.Revision)
751 {
752 printf("mach.Revision failed %lu != %lu\n",gpp.mach.Revision,gpp_compare.mach.Revision);
753 ret = FALSE;
754 }
755
756 if (gpp.user.PowerButtonAc.Action != gpp_compare.user.PowerButtonAc.Action)
757 {
758 printf("user.PowerButtonAc.Action failed %i != %i\n",gpp.user.PowerButtonAc.Action,gpp_compare.user.PowerButtonAc.Action);
759 ret = FALSE;
760 }
762 {
763 printf("user.PowerButtonAc.EventCode failed %lu != %lu\n",gpp.user.PowerButtonAc.EventCode,gpp_compare.user.PowerButtonAc.EventCode);
764 ret = FALSE;
765 }
766 if (gpp.user.PowerButtonAc.Flags != gpp_compare.user.PowerButtonAc.Flags)
767 {
768 printf("user.PowerButtonAc.Flags failed %lu != %lu\n",gpp.user.PowerButtonAc.Flags,gpp_compare.user.PowerButtonAc.Flags);
769 ret = FALSE;
770 }
771 if (gpp.user.PowerButtonDc.Action != gpp_compare.user.PowerButtonDc.Action)
772 {
773 printf("user.PowerButtonDc.Action failed %i != %i\n",gpp.user.PowerButtonDc.Action,gpp_compare.user.PowerButtonDc.Action);
774 ret = FALSE;
775 }
777 {
778 printf("user.PowerButtonDc.EventCode failed %lu != %lu\n",gpp.user.PowerButtonDc.EventCode,gpp_compare.user.PowerButtonDc.EventCode);
779 ret = FALSE;
780 }
781 if (gpp.user.PowerButtonDc.Flags != gpp_compare.user.PowerButtonDc.Flags)
782 {
783 printf("user.PowerButtonDc.Flags failed %lu != %lu\n",gpp.user.PowerButtonDc.Flags,gpp_compare.user.PowerButtonDc.Flags);
784 ret = FALSE;
785 }
786 if (gpp.user.SleepButtonAc.Action != gpp_compare.user.SleepButtonAc.Action)
787 {
788 printf("user.SleepButtonAc.Action failed %i != %i\n",gpp.user.SleepButtonAc.Action,gpp_compare.user.SleepButtonAc.Action);
789 ret = FALSE;
790 }
792 {
793 printf("user.SleepButtonAc.EventCode failed %lu != %lu\n",gpp.user.SleepButtonAc.EventCode,gpp_compare.user.SleepButtonAc.EventCode);
794 ret = FALSE;
795 }
796 if (gpp.user.SleepButtonAc.Flags != gpp_compare.user.SleepButtonAc.Flags)
797 {
798 printf("user.SleepButtonAc.Flags failed %lu != %lu\n",gpp.user.SleepButtonAc.Flags,gpp_compare.user.SleepButtonAc.Flags);
799 ret = FALSE;
800 }
801 if (gpp.user.SleepButtonDc.Action != gpp_compare.user.SleepButtonDc.Action)
802 {
803 printf("user.SleepButtonDc.Action failed %i != %i\n",gpp.user.SleepButtonDc.Action,gpp_compare.user.SleepButtonDc.Action);
804 ret = FALSE;
805 }
807 {
808 printf("user.SleepButtonDc.EventCode failed %lu != %lu\n",gpp.user.SleepButtonDc.EventCode,gpp_compare.user.SleepButtonDc.EventCode);
809 ret = FALSE;
810 }
811 if (gpp.user.SleepButtonDc.Flags != gpp_compare.user.SleepButtonDc.Flags)
812 {
813 printf("user.SleepButtonDc.Flags failed %lu != %lu\n",gpp.user.SleepButtonDc.Flags,gpp_compare.user.SleepButtonDc.Flags);
814 ret = FALSE;
815 }
816 if (gpp.user.LidCloseAc.Action != gpp_compare.user.LidCloseAc.Action)
817 {
818 printf("user.LidCloseAc.Action failed %i != %i\n",gpp.user.LidCloseAc.Action,gpp_compare.user.LidCloseAc.Action);
819 ret = FALSE;
820 }
821 if (gpp.user.LidCloseAc.EventCode != gpp_compare.user.LidCloseAc.EventCode)
822 {
823 printf("user.LidCloseAc.EventCode failed %lu != %lu\n",gpp.user.LidCloseAc.EventCode,gpp_compare.user.LidCloseAc.EventCode);
824 ret = FALSE;
825 }
826 if (gpp.user.LidCloseAc.Flags != gpp_compare.user.LidCloseAc.Flags)
827 {
828 printf("user.LidCloseAc.Flags failed %lu != %lu\n",gpp.user.LidCloseAc.Flags,gpp_compare.user.LidCloseAc.Flags);
829 ret = FALSE;
830 }
831 if (gpp.user.LidCloseDc.Action != gpp_compare.user.LidCloseDc.Action)
832 {
833 printf("user.LidCloseDc.Action failed %i != %i\n",gpp.user.LidCloseDc.Action,gpp_compare.user.LidCloseDc.Action);
834 ret = FALSE;
835 }
836 if (gpp.user.LidCloseDc.EventCode != gpp_compare.user.LidCloseDc.EventCode)
837 {
838 printf("user.LidCloseDc.EventCode failed %lu != %lu\n",gpp.user.LidCloseDc.EventCode,gpp_compare.user.LidCloseDc.EventCode);
839 ret = FALSE;
840 }
841 if (gpp.user.LidCloseDc.Flags != gpp_compare.user.LidCloseDc.Flags)
842 {
843 printf("user.LidCloseDc.Flags failed %lu != %lu\n",gpp.user.LidCloseDc.Flags,gpp_compare.user.LidCloseDc.Flags);
844 ret = FALSE;
845 }
846
847 for(i=0;i<NUM_DISCHARGE_POLICIES;i++)
848 {
849 if (gpp.user.DischargePolicy[i].Enable != gpp_compare.user.DischargePolicy[i].Enable)
850 {
851 printf("user.DischargePolicy(%i).Enable failed %i != %i\n",i, gpp.user.DischargePolicy[i].Enable,gpp_compare.user.DischargePolicy[i].Enable);
852 ret = FALSE;
853 }
854 for (j=0;j<3;j++)
855 {
856 if (gpp.user.DischargePolicy[i].Spare[j] != gpp_compare.user.DischargePolicy[i].Spare[j])
857 {
858 printf("user.DischargePolicy(%i).Spare[j] failed %i != %i\n",i, gpp.user.DischargePolicy[i].Spare[j],gpp_compare.user.DischargePolicy[i].Spare[j]);
859 ret = FALSE;
860 }
861 }
863 {
864 printf("user.DischargePolicy(%i).BatteryLevel failed %lu != %lu\n",i, gpp.user.DischargePolicy[i].BatteryLevel,gpp_compare.user.DischargePolicy[i].BatteryLevel);
865 ret = FALSE;
866 }
868 {
869 printf("user.DischargePolicy(%i).PowerPolicy.Action failed %i != %i\n",i, gpp.user.DischargePolicy[i].PowerPolicy.Action,gpp_compare.user.DischargePolicy[i].PowerPolicy.Action);
870 ret = FALSE;
871 }
873 {
874 printf("user.DischargePolicy(%i).PowerPolicy.Flags failed %lu != %lu\n",i, gpp.user.DischargePolicy[i].PowerPolicy.Flags,gpp_compare.user.DischargePolicy[i].PowerPolicy.Flags);
875 ret = FALSE;
876 }
878 {
879 printf("user.DischargePolicy(%i).PowerPolicy.EventCode failed %lu != %lu\n",i, gpp.user.DischargePolicy[i].PowerPolicy.EventCode,gpp_compare.user.DischargePolicy[i].PowerPolicy.EventCode);
880 ret = FALSE;
881 }
883 {
884 printf("user.DischargePolicy(%i).MinSystemState failed %i != %i\n",i, gpp.user.DischargePolicy[i].MinSystemState,gpp_compare.user.DischargePolicy[i].MinSystemState);
885 ret = FALSE;
886 }
887 }
888 if (gpp.user.GlobalFlags != gpp_compare.user.GlobalFlags)
889 {
890 printf("user.GlobalFlags failed %lu != %lu\n",gpp.user.GlobalFlags,gpp_compare.user.GlobalFlags);
891 ret = FALSE;
892 }
893 if (gpp.user.Revision != gpp_compare.user.Revision)
894 {
895 printf("user.Revision failed %lu != %lu\n",gpp.user.Revision,gpp_compare.user.Revision);
896 ret = FALSE;
897 }
898 return ret;
899}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define NUM_DISCHARGE_POLICIES
Definition: ntpoapi.h:432
SYSTEM_POWER_STATE LidOpenWakeDc
Definition: powrprof.h:27
SYSTEM_POWER_STATE LidOpenWakeAc
Definition: powrprof.h:26
GLOBAL_USER_POWER_POLICY user
Definition: powrprof.h:42
GLOBAL_MACHINE_POWER_POLICY mach
Definition: powrprof.h:43
SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]
Definition: powrprof.h:38
POWER_ACTION_POLICY PowerButtonDc
Definition: powrprof.h:33
POWER_ACTION_POLICY LidCloseDc
Definition: powrprof.h:37
POWER_ACTION_POLICY SleepButtonDc
Definition: powrprof.h:35
POWER_ACTION_POLICY PowerButtonAc
Definition: powrprof.h:32
POWER_ACTION_POLICY SleepButtonAc
Definition: powrprof.h:34
POWER_ACTION_POLICY LidCloseAc
Definition: powrprof.h:36
SYSTEM_POWER_STATE MinSystemState
Definition: winnt_old.h:3965
POWER_ACTION_POLICY PowerPolicy
Definition: winnt_old.h:3964

Referenced by test_ValidatePowerPolicies(), and test_ValidatePowerPolicies_Next().

◆ test_callback_EnumPwrScheme()

BOOLEAN CALLBACK test_callback_EnumPwrScheme ( UINT  uiIndex,
DWORD  dwName,
LPWSTR  sName,
DWORD  dwDesc,
LPWSTR  sDesc,
PPOWER_POLICY  pp,
LPARAM  lParam 
)

Definition at line 312 of file power.c.

314{
315 ok(uiIndex == g_NumPwrSchemes, "expected power scheme index of %d but got %d\n", g_NumPwrSchemes, uiIndex);
317
318 ok(lParam == 0xDEADBEEF, "expected function lParam to be 0xDEADBEEF but got %d\n", (UINT)lParam);
319
320 return TRUE;
321}
#define ok(value,...)
Definition: atltest.h:57
LPARAM lParam
Definition: combotst.c:139
unsigned int g_NumPwrSchemes
Definition: power.c:20
unsigned int UINT
Definition: ndis.h:50

Referenced by test_EnumPwrSchemes().

◆ test_callback_stop_EnumPwrScheme()

BOOLEAN CALLBACK test_callback_stop_EnumPwrScheme ( UINT  uiIndex,
DWORD  dwName,
LPWSTR  sName,
DWORD  dwDesc,
LPWSTR  sDesc,
PPOWER_POLICY  pp,
LPARAM  lParam 
)

Definition at line 323 of file power.c.

325{
326 ok((!uiIndex || g_NumPwrSchemesEnumerated + 1 == uiIndex), "expected power scheme %d but got %d\n",g_NumPwrSchemesEnumerated+1, uiIndex);
328
329 ok(uiIndex <= (UINT)lParam, "enumeration should have already been stopped at index %d current index %d\n", (UINT)lParam, uiIndex);
330 if (uiIndex == (UINT)lParam)
331 return FALSE;
332 else
333 return TRUE;
334}
unsigned int g_NumPwrSchemesEnumerated
Definition: power.c:21

Referenced by test_EnumPwrSchemes().

◆ test_CallNtPowerInformation()

void test_CallNtPowerInformation ( void  )

Definition at line 38 of file power.c.

39{
40 DWORD retval;
42 ULONGLONG atime, ctime;
50
51 /* AdministratorPowerPolicy tests */
53 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
55 ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n", (UINT)retval);
57 ok(retval != STATUS_PRIVILEGE_NOT_HELD, "Privileg not held!!!! more errors to expect\n");
58 ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n", (UINT)retval);
59
60 /* LastSleepTime tests */
61 retval = CallNtPowerInformation(LastSleepTime, 0, 0, 0, 0);
62 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
63 retval = CallNtPowerInformation(LastSleepTime, &atime, sizeof(ULONGLONG), 0, 0);
64 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
65 retval = CallNtPowerInformation(LastSleepTime, &atime, sizeof(ULONGLONG), &ctime, sizeof(ULONGLONG));
66 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
67 retval = CallNtPowerInformation(LastSleepTime, 0, 0, &atime, sizeof(ULONGLONG));
68 ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n",(UINT)retval);
69
70 /* LastWakeTime tests */
71 retval = CallNtPowerInformation(LastWakeTime, 0, 0, 0, 0);
72 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
73 retval = CallNtPowerInformation(LastWakeTime, &atime, sizeof(ULONGLONG), 0, 0);
74 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
75 retval = CallNtPowerInformation(LastWakeTime, &atime, sizeof(ULONGLONG), &ctime, sizeof(ULONGLONG));
76 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
77 retval = CallNtPowerInformation(LastWakeTime, 0, 0, &atime, sizeof(ULONGLONG));
78 ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n",(UINT)retval);
79
80 /* ProcessorInformation tests */
81 retval = CallNtPowerInformation(ProcessorInformation, 0, 0, 0, 0);
82 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
84 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
86 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
88
89 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
91 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
93 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
95 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
96
97 /* ProcessorPowerPolicyAc tests */
99 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
101 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
103 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
105 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
106
107 /* ProcessorPowerPolicyCurrent tests */
109 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
111 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
113 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
115 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
116
117 /* ProcessorPowerPolicyDc tests */
119 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
121 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
123 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
125 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
126
127 /* SystemBatteryState tests */
128 retval = CallNtPowerInformation(SystemBatteryState, 0, 0, 0, 0);
129 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
131 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
133 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
135 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
136
137 /* SystemExecutionState tests */
138 retval = CallNtPowerInformation(SystemExecutionState, 0, 0, 0, 0);
139 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
140
141 /* SystemPowerCapabilities tests */
143 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
145 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
147 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
149 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
150
151 /* SystemPowerInformation tests */
153 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
155 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
157 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
159 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
161 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
163 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
164
165 /* SystemPowerPolicyAc tests */
166 retval = CallNtPowerInformation(SystemPowerPolicyAc, 0, 0, 0, 0);
167 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
169 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
171 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
173 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
174
175 /* SystemPowerPolicyCurrent tests */
177 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
179 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
181 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
183 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
184
185 /* SystemPowerPolicyDc tests */
186 retval = CallNtPowerInformation(SystemPowerPolicyDc, 0, 0, 0, 0);
187 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
189 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
191 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
193 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
194
195 /* SystemReserveHiberFile tests */
196/*
197 retval = CallNtPowerInformation(SystemReserveHiberFile, 0, 0, 0, 0);
198 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %ld\n", retval);
199 bln=TRUE;
200 retval = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), 0, 0);
201 ok(retval == STATUS_DISK_FULL, "function result wrong expected STATUS_DISK_FULL but got %ld\n", nret);
202 bln=FALSE;
203 retval = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), 0, 0);
204 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %ld\n", nret);
205
206 bln2=TRUE;
207 nret = CallNtPowerInformation(SystemReserveHiberFile, 0, 0, &bln2, sizeof(bln2));
208 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
209 bln2=FALSE;
210 nret = CallNtPowerInformation(SystemReserveHiberFile, 0, 0, &bln2, sizeof(bln2));
211 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
212
213 bln=TRUE;
214 bln2=TRUE;
215 nret = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), &bln2, sizeof(bln2));
216 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
217 bln2=FALSE;
218 nret = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), &bln2, sizeof(bln2));
219 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
220 bln=FALSE;
221 bln2=TRUE;
222 nret = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), &bln2, sizeof(bln2));
223 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
224 bln2=FALSE;
225 nret = CallNtPowerInformation(SystemReserveHiberFile, &bln, sizeof(bln), &bln2, sizeof(bln2));
226 ok(nret == STATUS_DATATYPE_MISALIGNMENT, "function result wrong expected STATUS_DATATYPE_MISALIGNMENT but got %ld\n", nret);
227 */
228
229 /* VerifyProcessorPowerPolicyAc tests */
231 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
233 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
235 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
237 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
238
239 /* VerifyProcessorPowerPolicyDc tests */
241 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
243 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
245 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
247 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
248
249 /* VerifySystemPolicyAc tests */
250 retval = CallNtPowerInformation(VerifySystemPolicyAc, 0, 0, 0, 0);
251 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
253 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
255 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
257 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
258
259 /* VerifySystemPolicyDc tests */
260 retval = CallNtPowerInformation(VerifySystemPolicyDc, 0, 0, 0, 0);
261 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
263 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
265 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
267 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
268
269 /* SystemPowerStateHandler tests */
271 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
272 retval = CallNtPowerInformation(SystemPowerStateHandler, 0, 0, x, sizeof(HANDLE));
273 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
274
275 /* ProcessorStateHandler tests */
276 retval = CallNtPowerInformation(ProcessorStateHandler, 0, 0, 0, 0);
277 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
278 retval = CallNtPowerInformation(ProcessorStateHandler, 0, 0, x, sizeof(HANDLE));
279 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
280
281 /* ProcessorStateHandler2 tests */
283 ok(retval == STATUS_ACCESS_DENIED, "function result wrong expected STATUS_ACCESS_DENIED but got %d\n", (UINT)retval);
284 retval = CallNtPowerInformation(ProcessorStateHandler2, 0, 0, x, sizeof(HANDLE));
285 ok(retval == STATUS_ACCESS_DENIED, "function result wrong expected STATUS_ACCESS_DENIED but got %d\n", (UINT)retval);
286
287 /* SystemPowerStateNotifyHandler tests */
289 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
291 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
292
293}
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
@ SystemPowerInformation
Definition: ntddk_ex.h:54
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
__u16 ctime
Definition: mkdosfs.c:4
@ ProcessorPowerPolicyDc
Definition: ntpoapi.h:86
@ SystemPowerStateNotifyHandler
Definition: ntpoapi.h:84
@ LastWakeTime
Definition: ntpoapi.h:81
@ SystemBatteryState
Definition: ntpoapi.h:72
@ AdministratorPowerPolicy
Definition: ntpoapi.h:76
@ LastSleepTime
Definition: ntpoapi.h:82
@ SystemPowerCapabilities
Definition: ntpoapi.h:71
@ ProcessorStateHandler
Definition: ntpoapi.h:74
@ ProcessorPowerPolicyCurrent
Definition: ntpoapi.h:89
@ SystemExecutionState
Definition: ntpoapi.h:83
@ VerifyProcessorPowerPolicyDc
Definition: ntpoapi.h:88
@ VerifySystemPolicyDc
Definition: ntpoapi.h:70
@ ProcessorStateHandler2
Definition: ntpoapi.h:80
@ SystemPowerPolicyAc
Definition: ntpoapi.h:67
@ ProcessorInformation
Definition: ntpoapi.h:78
@ VerifyProcessorPowerPolicyAc
Definition: ntpoapi.h:87
@ VerifySystemPolicyAc
Definition: ntpoapi.h:69
@ ProcessorPowerPolicyAc
Definition: ntpoapi.h:85
@ SystemPowerPolicyDc
Definition: ntpoapi.h:68
@ SystemPowerPolicyCurrent
Definition: ntpoapi.h:75
@ SystemPowerStateHandler
Definition: ntpoapi.h:73
NTSTATUS WINAPI CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel, PVOID lpInputBuffer, ULONG nInputBufferSize, PVOID lpOutputBuffer, ULONG nOutputBufferSize)
Definition: powrprof.c:59
#define STATUS_SUCCESS
Definition: shellext.h:65
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by func_power().

◆ test_CanUserWritePwrScheme()

void test_CanUserWritePwrScheme ( void  )

Definition at line 298 of file power.c.

299{
300 DWORD error, retval;
301
302 retval = CanUserWritePwrScheme();
303
305
306 if (retval)
307 ok(retval, "function failed?");
308 else
309 ok(error == ERROR_ACCESS_DENIED, "function last error wrong expected ERROR_ACCESS_DENIED but got %d\n", (UINT)error);
310
311}
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define error(str)
Definition: mkdosfs.c:1605
BOOLEAN WINAPI CanUserWritePwrScheme(VOID)
Definition: powrprof.c:79
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by func_power().

◆ test_DeletePwrScheme()

void test_DeletePwrScheme ( void  )

Definition at line 336 of file power.c.

337{
338 DWORD retval;
339 HKEY hSubKey = NULL;
340
341
342 /*
343 * try inexistant profile number, should fail
344 */
345
346 retval = DeletePwrScheme(0xFFFFFFFF);
347 ok(!retval, "function should have failed error %x\n",(UINT)GetLastError());
348
349 /*
350 * delete active power scheme, should fail
351 */
352
354 ok(retval, "function was expected to succeed, error %x\n",(UINT)GetLastError());
355
357 ok(!retval, "function should have failed\n");
358 ok(GetLastError() == ERROR_ACCESS_DENIED, "function should have failed with ERROR_ACCESS_DENIED but got %x\n", (UINT)GetLastError());
359
360 /*
361 * delete a temporarly created power scheme
362 */
364 ok(retval, "function should have succeeded\n");
365
366/*
367 * clean up, delete illegal entry, witch was created for this test
368 */
369
371 {
373 printf("#1 failed to delete subkey %i (testentry)\n", g_TempPwrScheme);
374 RegCloseKey(hSubKey);
375 }
376
377}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
static const WCHAR szMachPowerPoliciesSubKey[]
Definition: power.c:27
unsigned int g_ActivePwrScheme
Definition: power.c:22
static const WCHAR szTempPwrScheme[]
Definition: power.c:34
unsigned int g_TempPwrScheme
Definition: power.c:23
BOOLEAN WINAPI GetActivePwrScheme(PUINT puiID)
Definition: powrprof.c:285
BOOLEAN WINAPI DeletePwrScheme(UINT uiIndex)
Definition: powrprof.c:99
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by func_power().

◆ test_EnumPwrSchemes()

void test_EnumPwrSchemes ( void  )

Definition at line 379 of file power.c.

380{
381 BOOLEAN retval;
382
383 /*
384 * test EnumPwrScheme with null pointer callback
385 */
386
387 retval = EnumPwrSchemes(0, 0);
388 ok(!retval, "function was expected to fail\n");
389 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER but got %x\n",(UINT)GetLastError());
390
391 /*
392 * enumerate power schemes, should succeed
393 */
394
395 retval = EnumPwrSchemes(test_callback_EnumPwrScheme, 0xDEADBEEF);
396 ok(retval, "function was expected to succeed %d\n",retval);
397 ok(g_NumPwrSchemes, "Warning: no power schemes available\n");
398
399 /*
400 * stop enumeration after first power scheme
401 */
402
404 ok(!retval, "function was expected to false\n");
405
406 /*
407 * enumerate half of all avalailble profiles
408 */
409
412 ok(retval, "function was expected to succeed but got %i\n", (UINT)retval);
413 ok(g_NumPwrSchemesEnumerated == g_NumPwrSchemes / 2, "function did not enumerate requested num of profiles %d enumerated %d\n", g_NumPwrSchemes / 2, g_NumPwrSchemesEnumerated);
414
415
416}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOLEAN CALLBACK test_callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc, LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam)
Definition: power.c:312
BOOLEAN CALLBACK test_callback_stop_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc, LPWSTR sDesc, PPOWER_POLICY pp, LPARAM lParam)
Definition: power.c:323
BOOLEAN WINAPI EnumPwrSchemes(PWRSCHEMESENUMPROC lpfnPwrSchemesEnumProc, LPARAM lParam)
Definition: powrprof.c:219
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by func_power().

◆ test_GetCurrentPowerPolicies()

void test_GetCurrentPowerPolicies ( void  )

Definition at line 465 of file power.c.

466{
468 POWER_POLICY pp;
469 BOOLEAN ret;
470 UINT current_scheme = 2;
471
474
475 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
476 ret = SetActivePwrScheme(0, &gpp, 0);
477
478 ok(!ret, "function was expected to fail\n");
479
480 ret = SetActivePwrScheme(0, 0, &pp);
481 ok(!ret, "function was expected to fail\n");
482
483 ret = SetActivePwrScheme(0, &gpp, &pp);
484 ok(!ret, "function was expected to fail\n");
485
486 ret = SetActivePwrScheme(current_scheme, &gpp, 0);
487 ok(!ret, "function was expected to fail\n");
488
489 ret = SetActivePwrScheme(current_scheme, 0, &pp);
490 ok(!ret, "function was expected to fail\n");
491
492 ret = SetActivePwrScheme(current_scheme, &gpp, &pp);
493 ok(!ret, "function was expected to fail\n");
494
496 ok(ret, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
497
499 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
500
502 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
503
505 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
506
507 ret = GetCurrentPowerPolicies(&gpp,&pp);
508 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
509 ok(gpp.mach.Revision == 1,"Global Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
510 ok(gpp.user.Revision == 1,"Global User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
511 ok(pp.mach.Revision == 1,"Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
512 ok(pp.user.Revision == 1,"User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
513
514
516 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
517
518 ret = SetActivePwrScheme(0, &gpp, 0);
519 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
520
521 ret = SetActivePwrScheme(0, 0, &pp);
522 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
523
524 ret = SetActivePwrScheme(0, &gpp, &pp);
525 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
526
527 ret = SetActivePwrScheme(current_scheme, &gpp, 0);
528 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
529
530 ret = SetActivePwrScheme(current_scheme, 0, &pp);
531 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
532
533 ret = SetActivePwrScheme(current_scheme, &gpp, &pp);
534 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
535
537 ok(ret, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
538
539}
BOOLEAN WINAPI GetCurrentPowerPolicies(PGLOBAL_POWER_POLICY pGlobalPowerPolicy, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:321
BOOLEAN WINAPI SetActivePwrScheme(UINT uiID, PGLOBAL_POWER_POLICY lpGlobalPowerPolicy, PPOWER_POLICY lpPowerPolicy)
Definition: powrprof.c:642

Referenced by func_power().

◆ test_GetPwrCapabilities()

void test_GetPwrCapabilities ( void  )

Definition at line 541 of file power.c.

542{
544 BOOLEAN ret;
545
547 ok(!ret, "function was expected to fail\n");
548 if (!ret)
549 {
550 ok(GetLastError() == ERROR_INVALID_PARAMETER,"function was expectet to return ERROR_INVALID_PARAMETER, but returns: %x\n",(UINT)GetLastError());
551 }
552 ret = GetPwrCapabilities(&spc);
553 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
554}
BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES lpSystemPowerCapabilities)
Definition: powrprof.c:358

Referenced by func_power().

◆ test_GetPwrDiskSpindownRange()

void test_GetPwrDiskSpindownRange ( void  )

Definition at line 556 of file power.c.

557{
558 DWORD retval;
559 UINT min = 0;
560 UINT max = 0;
561
562 /*
563 * invalid parameter checks
564 */
565
567 ok(!retval, "function was expected to fail\n");
568 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected error ERROR_INVALID_PARAMETER but got %x\n", (UINT)GetLastError());
569
570 retval = GetPwrDiskSpindownRange(&max, NULL);
571 ok(!retval, "function was expected to fail\n");
572 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected error ERROR_INVALID_PARAMETER but got %x\n", (UINT)GetLastError());
573
574 retval = GetPwrDiskSpindownRange(NULL, &min);
575 ok(!retval, "function was expected to fail\n");
576 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected error ERROR_INVALID_PARAMETER but got %x\n", (UINT)GetLastError());
577
578 /*
579 * read disk spindown range
580 */
581
582 retval = GetPwrDiskSpindownRange(&max, &min);
583 ok(retval, "function was expected to succeed error %x\n",(UINT)GetLastError());
584 ok(min <= max, "range mismatch min %d max %d\n",min, max);
585}
#define min(a, b)
Definition: monoChain.cc:55
BOOLEAN WINAPI GetPwrDiskSpindownRange(PUINT RangeMax, PUINT RangeMin)
Definition: powrprof.c:381
#define max(a, b)
Definition: svc.c:63

Referenced by func_power().

◆ test_GetSetActivePwrScheme()

void test_GetSetActivePwrScheme ( void  )

Definition at line 418 of file power.c.

419{
420 DWORD retval;
421 UINT current_scheme = 2;
422 UINT temp_scheme = 0;
423
424 /*
425 * read active power scheme
426 */
427
429
430 ok(retval, "function was expected to succeed, error %x\n",(UINT)GetLastError());
431 ok(retval <= g_NumPwrSchemes, "expected index lower as power scheme count %d but got %d\n", g_NumPwrSchemes, g_ActivePwrScheme);
432
433 /*
434 * sets active power scheme to inexistant profile
435 * -> corrupts power scheme enumeration on Windows XP SP2
436 */
437 //corrupts registry
438 //retval = SetActivePwrScheme(0xFFFFFFFF, 0, 0);
439 //ok(!retval, "function was expected to fail");
440 //current_scheme = min(active_scheme+1, g_NumPwrSchemes-1);
441
442 /*
443 * sets the active power scheme to profile with index 0
444 */
445
446 retval = SetActivePwrScheme(current_scheme, 0, 0);
447 ok(retval, "function was expected to succeed, error %x\n",(UINT)GetLastError());
448
449 /*
450 * read back the active power scheme
451 */
452
453 retval = GetActivePwrScheme(&temp_scheme);
454 ok(retval, "function was expected to succeed, error %x\n",(UINT)GetLastError());
455 ok(temp_scheme == current_scheme, "expected %d but got %d\n", (UINT)current_scheme, (UINT)temp_scheme);
456
457 /*
458 * restore previous active power scheme
459 */
460
462 ok(retval, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
463}

Referenced by func_power().

◆ test_IsAdminOverrideActive()

void test_IsAdminOverrideActive ( void  )

Definition at line 587 of file power.c.

588{
590 BOOLEAN ret;
591
593 ok(!ret, "function was expected to fail\n");
594
596 ok(!ret, "function was expected to fail\n");
597
598 app.MinSleep = 0;
599 app.MaxSleep = 0;
600 app.MinVideoTimeout = 0;
601 app.MaxVideoTimeout = 0;
602 app.MinSpindownTimeout = 0;
603 app.MaxSpindownTimeout = 0;
604
606 ok(!ret, "function was expected to fail\n");
607
608 app.MinSleep = 1;
609 app.MaxSleep = 2;
610 app.MinVideoTimeout = 3;
611 app.MaxVideoTimeout = 4;
612 app.MinSpindownTimeout = 5;
613 app.MaxSpindownTimeout = 6;
614
616 ok(!ret, "function was expected to fail\n");
617
618}
BOOLEAN WINAPI IsAdminOverrideActive(PADMINISTRATOR_POWER_POLICY p)
Definition: powrprof.c:443
SYSTEM_POWER_STATE MinSleep
Definition: winnt_old.h:4258
SYSTEM_POWER_STATE MaxSleep
Definition: winnt_old.h:4259

Referenced by func_power().

◆ test_IsPwrHibernateAllowed()

void test_IsPwrHibernateAllowed ( void  )

Definition at line 620 of file power.c.

621{
622/*
623 BOOLEAN ret;
624
625 ret = IsPwrHibernateAllowed();
626 ok(!ret, "function was expected to fail\n");
627 */
628}

Referenced by func_power().

◆ test_IsPwrShutdownAllowed()

void test_IsPwrShutdownAllowed ( void  )

Definition at line 630 of file power.c.

631{
632/*
633 BOOLEAN ret;
634
635 ret = IsPwrShutdownAllowed();
636 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
637 */
638}

Referenced by func_power().

◆ test_IsPwrSuspendAllowed()

void test_IsPwrSuspendAllowed ( void  )

Definition at line 640 of file power.c.

641{
642/*
643 BOOLEAN ret;
644
645 ret = IsPwrSuspendAllowed();
646 ok(ret, "function was expected to succed, error %x\n",(UINT)GetLastError());
647 */
648}

Referenced by func_power().

◆ test_ReadGlobalPwrPolicy()

void test_ReadGlobalPwrPolicy ( void  )

Definition at line 650 of file power.c.

651{
653 BOOLEAN ret;
654
655 ret = ReadGlobalPwrPolicy(&gpp);
656 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
657 ok(gpp.mach.Revision == 1,"Global Mach Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
658 ok(gpp.user.Revision == 1,"Global User Revision was expected to be 1 got %i\n",(UINT)gpp.mach.Revision);
659
660
661
662}
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
Definition: powrprof.c:521

Referenced by func_power().

◆ test_ReadProcessorPwrScheme()

void test_ReadProcessorPwrScheme ( void  )

Definition at line 664 of file power.c.

665{
667 BOOLEAN ret;
668 UINT i = 0;
669 DWORD err;
670
671 do
672 {
675 if (ret)
676 {
677 ok(mppp.Revision == 1,"Main Revision was expected to be 1 got %i\n",(UINT)mppp.Revision);
678 ok(mppp.ProcessorPolicyAc.Revision == 1,"PowerAC Revision was expected to be 1 got %i\n",(UINT)mppp.ProcessorPolicyAc.Revision);
679 ok(mppp.ProcessorPolicyDc.Revision == 1,"PowerDC Revision was expected to be 1 got %i\n",(UINT)mppp.ProcessorPolicyDc.Revision);
680 }
681 else
682 {
683 err = GetLastError();
684 ok(err == 0,"Failed Error %x\n",(UINT)err);
685 return;
686 }
687 i++;
688 if (i == g_NumPwrSchemes)
689 return;
690 } while (TRUE);
691
692}
BOOLEAN WINAPI ReadProcessorPwrScheme(UINT uiID, PMACHINE_PROCESSOR_POWER_POLICY pMachineProcessorPowerPolicy)
Definition: powrprof.c:584
#define err(...)
PROCESSOR_POWER_POLICY ProcessorPolicyDc
Definition: powrprof.h:64
PROCESSOR_POWER_POLICY ProcessorPolicyAc
Definition: powrprof.h:63
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by func_power().

◆ test_ReadPwrScheme()

void test_ReadPwrScheme ( void  )

Definition at line 694 of file power.c.

695{
696 DWORD retval;
697
698 /*
699 * read power scheme with null pointer -> crashs on Windows XP SP2
700 */
701 //retval = ReadPwrScheme(0, NULL);
702 //ok(!retval, "function was expected to fail\n");
703 //ok(GetLastError() == STATUS_INVALID_PARAMETER, "expected error ... but got %x\n", GetLastError());
704
705 /*
706 * read a power scheme with an invalid index, leads to the creation of the key
707 * -> corrupts power scheme enumeration
708 */
709 //retval = ReadPwrScheme(0xFFFFFFFF, &powerPolicy);
710 //ok(!retval, "function was expected to fail\n");
711 //ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error ERROR_ACCESS_DENIED but got %x\n", GetLastError());
712
713 /*
714 * read current active power scheme
715 */
716
718 ok(retval, "function was expected to succeed error %x\n",(UINT)GetLastError());
719
720}
POWER_POLICY g_PowerPolicy
Definition: power.c:25
BOOLEAN WINAPI ReadPwrScheme(UINT uiID, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:610

Referenced by func_power().

◆ test_SetSuspendState()

void test_SetSuspendState ( void  )

Definition at line 722 of file power.c.

723{
724// SetSuspendState(FALSE,FALSE,FALSE)
725}

Referenced by func_power().

◆ test_ValidatePowerPolicies()

void test_ValidatePowerPolicies ( void  )

Definition at line 1264 of file power.c.

1265{
1266 GLOBAL_POWER_POLICY gpp, gpp_compare, gpp_original;
1267 POWER_POLICY pp, pp_compare, pp_original;
1268 BOOLEAN ret;
1269
1270 RtlZeroMemory(&gpp_original, sizeof(GLOBAL_POWER_POLICY));
1271 RtlZeroMemory(&pp_original, sizeof(POWER_POLICY));
1272
1273 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1274 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1275 ok(compare(pp,pp_compare),"Difference Found\n");
1276
1277 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1278 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1279 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1280
1281 SetLastError(0);
1283 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1284
1285 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1286 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1287 ret = ValidatePowerPolicies(&gpp,0);
1288 ok(!ret, "function was expected to fail\n");
1289 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());
1290 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1291
1292 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1293 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1294 ret = ValidatePowerPolicies(0,&pp);
1295 ok(!ret, "function was expected to fail\n");
1296 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1297 ok(compare(pp,pp_compare),"Difference Found\n");
1298
1299 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1300 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1301 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1302 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1303 ret = ValidatePowerPolicies(&gpp,&pp);
1304 ok(!ret, "function was expected to fail\n");
1305 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1306 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1307 ok(compare(pp,pp_compare),"Difference Found\n");
1308
1309 gpp_original.user.Revision = 1;
1310 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1311 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1312 ret = ValidatePowerPolicies(&gpp,0);
1313 ok(!ret, "function was expected to fail\n");
1314 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1315 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1316
1317 gpp_original.mach.Revision = 1;
1318 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1319 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1320 ret = ValidatePowerPolicies(&gpp,0);
1321 ok(!ret, "function was expected to fail\n");
1322 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1323 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1324
1325 gpp_original.mach.LidOpenWakeAc = PowerSystemWorking;
1326 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1327 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1328 ret = ValidatePowerPolicies(&gpp,0);
1329 ok(!ret, "function was expected to fail\n");
1330 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1331 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1332
1333 gpp_original.mach.LidOpenWakeDc = PowerSystemWorking;
1334 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1335 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1336 ret = ValidatePowerPolicies(&gpp,0);
1337 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
1338 gpp_compare.mach.BroadcastCapacityResolution=100;
1339 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1340 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1341 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1342 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1343
1345 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1346 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1347 ret = ValidatePowerPolicies(&gpp,0);
1348 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1349 gpp_compare.mach.BroadcastCapacityResolution=100;
1350 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1351 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1352 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1353 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1354
1356 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1357 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1358 ret = ValidatePowerPolicies(&gpp,0);
1359 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1360 gpp_compare.mach.BroadcastCapacityResolution=100;
1361 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1362 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1363 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1364 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1365
1367 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1368 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1369 ret = ValidatePowerPolicies(&gpp,0);
1370 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1371 gpp_compare.mach.BroadcastCapacityResolution=100;
1372 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1373 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1374 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1375 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1376
1378 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1379 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1380 ret = ValidatePowerPolicies(&gpp,0);
1381 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1382 gpp_compare.mach.BroadcastCapacityResolution=100;
1383 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1384 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1385 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1386 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1387
1388 gpp_original.user.LidCloseAc.Action = PowerActionNone;
1389 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1390 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1391 ret = ValidatePowerPolicies(&gpp,0);
1392 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1393 gpp_compare.mach.BroadcastCapacityResolution=100;
1394 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1395 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1396 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1397 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1398
1399 gpp_original.user.LidCloseDc.Action = PowerActionNone;
1400 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1401 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1402 ret = ValidatePowerPolicies(&gpp,0);
1403 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1404 gpp_compare.mach.BroadcastCapacityResolution=100;
1405 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1406 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1407 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1408 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1409
1410 gpp_original.user.DischargePolicy[0].Enable=FALSE;
1411 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1412 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1413 ret = ValidatePowerPolicies(&gpp,0);
1414 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1415 gpp_compare.mach.BroadcastCapacityResolution=100;
1416 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1417 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1418 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1419 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1420
1421 gpp_original.user.DischargePolicy[1].Enable=FALSE;
1422 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1423 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1424 ret = ValidatePowerPolicies(&gpp,0);
1425 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1426 gpp_compare.mach.BroadcastCapacityResolution=100;
1427 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1428 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1429 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1430 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1431
1432 gpp_original.user.DischargePolicy[2].Enable=FALSE;
1433 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1434 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1435 ret = ValidatePowerPolicies(&gpp,0);
1436 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1437 gpp_compare.mach.BroadcastCapacityResolution=100;
1438 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1439 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1440 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1441 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1442
1443 gpp_original.user.DischargePolicy[3].Enable=FALSE;
1444 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1445 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1446 ret = ValidatePowerPolicies(&gpp,0);
1447 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1448 gpp_compare.mach.BroadcastCapacityResolution=100;
1449 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1450 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1451 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1452 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1453
1454 pp_original.user.Revision = 1;
1455 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1456 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1457 ret = ValidatePowerPolicies(0,&pp);
1458 ok(!ret, "function was expected to fail\n");
1459 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1460 ok(compare(pp,pp_compare),"Difference Found\n");
1461
1462 pp_original.mach.Revision = 1;
1463 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1464 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1465 ret = ValidatePowerPolicies(0,&pp);
1466 ok(!ret, "function was expected to fail\n");
1467 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1468 ok(compare(pp,pp_compare),"Difference Found\n");
1469
1470 pp_original.mach.MinSleepAc = PowerSystemWorking;
1471 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1472 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1473 ret = ValidatePowerPolicies(0,&pp);
1474 ok(!ret, "function was expected to fail\n");
1475 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1476 ok(compare(pp,pp_compare),"Difference Found\n");
1477
1478 pp_original.mach.MinSleepDc = PowerSystemWorking;
1479 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1480 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1481 ret = ValidatePowerPolicies(0,&pp);
1482 ok(!ret, "function was expected to fail\n");
1483 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1484 ok(compare(pp,pp_compare),"Difference Found\n");
1485
1487 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1488 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1489 ret = ValidatePowerPolicies(0,&pp);
1490 ok(!ret, "function was expected to fail\n");
1491 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1492 ok(compare(pp,pp_compare),"Difference Found\n");
1493
1495 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1496 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1497 ret = ValidatePowerPolicies(0,&pp);
1498 ok(!ret, "function was expected to fail\n");
1499 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1500 ok(compare(pp,pp_compare),"Difference Found\n");
1501
1503 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1504 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1505 ret = ValidatePowerPolicies(0,&pp);
1506 ok(!ret, "function was expected to fail\n");
1507 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1508 ok(compare(pp,pp_compare),"Difference Found\n");
1509
1511 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1512 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1513 ret = ValidatePowerPolicies(0,&pp);
1514 ok(!ret, "function was expected to fail\n");
1515 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1516 ok(compare(pp,pp_compare),"Difference Found\n");
1517
1518 pp_original.user.IdleAc.Action = PowerActionWarmEject+1;
1519 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1520 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1521 ret = ValidatePowerPolicies(0,&pp);
1522 ok(!ret, "function was expected to fail\n");
1523 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1524 ok(compare(pp,pp_compare),"Difference Found\n");
1525
1526 pp_original.user.IdleDc.Action = PowerActionNone-1;
1527 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1528 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1529 ret = ValidatePowerPolicies(0,&pp);
1530 ok(!ret, "function was expected to fail\n");
1531 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1532 ok(compare(pp,pp_compare),"Difference Found\n");
1533
1534 pp_original.user.MaxSleepAc = PowerSystemMaximum+1;
1535 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1536 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1537 ret = ValidatePowerPolicies(0,&pp);
1538 ok(!ret, "function was expected to fail\n");
1539 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1540 ok(compare(pp,pp_compare),"Difference Found\n");
1541
1543 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1544 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1545 ret = ValidatePowerPolicies(0,&pp);
1546 ok(!ret, "function was expected to fail\n");
1547 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1548 ok(compare(pp,pp_compare),"Difference Found\n");
1549
1550 pp_original.user.IdleAc.Action = PowerActionNone;
1551 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1552 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1553 ret = ValidatePowerPolicies(0,&pp);
1554 ok(!ret, "function was expected to fail\n");
1555 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1556 ok(compare(pp,pp_compare),"Difference Found\n");
1557
1558 pp_original.user.IdleDc.Action = PowerActionNone;
1559 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1560 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1561 ret = ValidatePowerPolicies(0,&pp);
1562 ok(!ret, "function was expected to fail\n");
1563 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1564 ok(compare(pp,pp_compare),"Difference Found\n");
1565
1566 pp_original.user.MaxSleepAc = PowerSystemWorking;
1567 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1568 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1569 ret = ValidatePowerPolicies(0,&pp);
1570 ok(!ret, "function was expected to fail\n");
1571 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1572 ok(compare(pp,pp_compare),"Difference Found\n");
1573
1574 pp_original.user.MaxSleepDc = PowerSystemWorking;
1575 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1576 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1577 ret = ValidatePowerPolicies(0,&pp);
1578 ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
1579 pp_compare.mach.MinSleepAc=4;
1580 pp_compare.mach.MinSleepDc=4;
1581 pp_compare.user.MaxSleepAc=4;
1582 pp_compare.user.MaxSleepDc=4;
1583 pp_compare.user.OptimizeForPowerAc=1;
1584 pp_compare.user.OptimizeForPowerDc=1;
1585 ok(compare(pp,pp_compare),"Difference Found\n");
1586
1587 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1588 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1589 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1590 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1591 ret = ValidatePowerPolicies(&gpp,&pp);
1592 ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
1593 gpp_compare.mach.BroadcastCapacityResolution=100;
1594 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1595 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1596 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1597 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1598 pp_compare.mach.MinSleepAc=4;
1599 pp_compare.mach.MinSleepDc=4;
1600 pp_compare.user.MaxSleepAc=4;
1601 pp_compare.user.MaxSleepDc=4;
1602 pp_compare.user.OptimizeForPowerAc=1;
1603 pp_compare.user.OptimizeForPowerDc=1;
1604 ok(compare(pp,pp_compare),"Difference Found\n");
1605
1606
1607 gpp_original.mach.BroadcastCapacityResolution=95;
1608 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1609 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1610 ret = ValidatePowerPolicies(&gpp,0);
1611 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1612 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
1613 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1614 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1615 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1616
1617 gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 256;
1618 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1619 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1620 ret = ValidatePowerPolicies(&gpp,0);
1621 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1622 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
1623 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
1624 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1625 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1626
1627 gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 256;
1628 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1629 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1630 ret = ValidatePowerPolicies(&gpp,0);
1631 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1632 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
1633 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
1634 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
1635 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1636
1637 gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 256;
1638 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1639 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1640 ret = ValidatePowerPolicies(&gpp,0);
1641 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1642 gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
1643 gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
1644 gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
1645 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1646
1647
1648 gpp_original.user.DischargePolicy[1].PowerPolicy.EventCode = 65792;
1649 gpp_original.user.DischargePolicy[2].PowerPolicy.EventCode = 131328;
1650 gpp_original.user.DischargePolicy[3].PowerPolicy.EventCode = 196864;
1652 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1653 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1654 ret = ValidatePowerPolicies(&gpp,0);
1655 ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1656 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1657 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1658
1661 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1662 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1663 ret = ValidatePowerPolicies(&gpp,0);
1664 ok(!ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1665 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1666 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1667
1669 gpp_original.user.LidCloseAc.Action = PowerActionWarmEject+1;
1670 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1671 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1672 ret = ValidatePowerPolicies(&gpp,0);
1673 ok(!ret, "function was expected to fail\n");
1674 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1675 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1676
1678 gpp_original.user.LidCloseDc.Action = PowerActionNone;
1679 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1680 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1681 ret = ValidatePowerPolicies(&gpp,0);
1682 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1683 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1684
1686 gpp_original.user.PowerButtonAc.Action = PowerActionNone-1;
1687 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1688 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1689 ret = ValidatePowerPolicies(&gpp,0);
1690 ok(!ret, "function was expected to fail\n");
1691 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1692 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1693
1696 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1697 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1698 ret = ValidatePowerPolicies(&gpp,0);
1699 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1700 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1701
1703 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1704 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1705 ret = ValidatePowerPolicies(&gpp,0);
1706 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1707 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1708
1710 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1711 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1712 ret = ValidatePowerPolicies(&gpp,0);
1713 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1714 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
1715
1716
1718 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1719 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1720 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1721 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1722 ret = ValidatePowerPolicies(0,&pp);
1723 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1724 pp_compare.mach.MinSleepAc=4;
1725 pp_compare.mach.MinSleepDc=4;
1726 pp_compare.user.MaxSleepAc=4;
1727 pp_compare.user.MaxSleepDc=4;
1728 pp_compare.user.OptimizeForPowerAc=1;
1729 pp_compare.user.OptimizeForPowerDc=1;
1730 ok(compare(pp,pp_compare),"Difference Found\n");
1731
1733 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1734 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1735 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1736 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1737 ret = ValidatePowerPolicies(0,&pp);
1738 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1739 pp_compare.mach.MinSleepAc=4;
1740 pp_compare.mach.MinSleepDc=4;
1741 pp_compare.user.MaxSleepAc=4;
1742 pp_compare.user.MaxSleepDc=4;
1743 pp_compare.user.OptimizeForPowerAc=1;
1744 pp_compare.user.OptimizeForPowerDc=1;
1745 ok(compare(pp,pp_compare),"Difference Found\n");
1746
1748 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1749 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1750 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1751 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1752 ret = ValidatePowerPolicies(0,&pp);
1753 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1754 pp_compare.mach.MinSleepAc=4;
1755 pp_compare.mach.MinSleepDc=4;
1756 pp_compare.user.MaxSleepAc=4;
1757 pp_compare.user.MaxSleepDc=4;
1758 pp_compare.user.OptimizeForPowerAc=1;
1759 pp_compare.user.OptimizeForPowerDc=1;
1760 ok(compare(pp,pp_compare),"Difference Found\n");
1761
1763 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1764 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1765 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1766 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1767 ret = ValidatePowerPolicies(0,&pp);
1768 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1769 pp_compare.mach.MinSleepAc=4;
1770 pp_compare.mach.MinSleepDc=4;
1771 pp_compare.user.MaxSleepAc=4;
1772 pp_compare.user.MaxSleepDc=4;
1773 pp_compare.user.OptimizeForPowerAc=1;
1774 pp_compare.user.OptimizeForPowerDc=1;
1775 ok(compare(pp,pp_compare),"Difference Found\n");
1776
1778 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1779 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1780 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1781 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1782 ret = ValidatePowerPolicies(0,&pp);
1783 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1784 pp_compare.mach.MinSleepAc=4;
1785 pp_compare.mach.MinSleepDc=4;
1786 pp_compare.user.MaxSleepAc=4;
1787 pp_compare.user.MaxSleepDc=4;
1788 pp_compare.user.OptimizeForPowerAc=1;
1789 pp_compare.user.OptimizeForPowerDc=1;
1790 ok(compare(pp,pp_compare),"Difference Found\n");
1791
1793 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1794 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1795 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1796 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1797 ret = ValidatePowerPolicies(0,&pp);
1798 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1799 pp_compare.mach.MinSleepAc=4;
1800 pp_compare.mach.MinSleepDc=4;
1801 pp_compare.user.MaxSleepAc=4;
1802 pp_compare.user.MaxSleepDc=4;
1803 pp_compare.user.OptimizeForPowerAc=1;
1804 pp_compare.user.OptimizeForPowerDc=1;
1805 ok(compare(pp,pp_compare),"Difference Found\n");
1806
1808 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1809 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1810 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1811 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1812 ret = ValidatePowerPolicies(0,&pp);
1813 ok(!ret, "function was expected to fail\n");
1814 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1815 ok(compare(pp,pp_compare),"Difference Found\n");
1816
1818 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1819 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1820 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1821 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1822 ret = ValidatePowerPolicies(0,&pp);
1823 ok(!ret, "function was expected to fail\n");
1824 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1825 ok(compare(pp,pp_compare),"Difference Found\n");
1826
1828 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1829 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1830 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1831 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1832 ret = ValidatePowerPolicies(0,&pp);
1833 ok(!ret, "function was expected to fail\n");
1834 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1835 //pp_compare.mach.MinSleepAc=4;
1836 //pp_compare.mach.MinSleepDc=4;
1837 //pp_compare.user.MaxSleepAc=4;
1838 //pp_compare.user.MaxSleepDc=4;
1839 ok(compare(pp,pp_compare),"Difference Found\n");
1840
1842 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1843 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1844 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1845 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1846 ret = ValidatePowerPolicies(0,&pp);
1847 ok(!ret, "function was expected to fail\n");
1848 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1849 //pp_compare.mach.MinSleepAc=4;
1850 //pp_compare.mach.MinSleepDc=4;
1851 //pp_compare.user.MaxSleepAc=4;
1852 //pp_compare.user.MaxSleepDc=4;
1853 ok(compare(pp,pp_compare),"Difference Found\n");
1854
1856 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1857 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1858 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1859 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1860 ret = ValidatePowerPolicies(0,&pp);
1861 ok(!ret, "function was expected to fail\n");
1862 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1863 //pp_compare.mach.MinSleepAc=4;
1864 //pp_compare.mach.MinSleepDc=4;
1865 //pp_compare.user.MaxSleepAc=4;
1866 //pp_compare.user.MaxSleepDc=4;
1867 //pp_compare.user.OptimizeForPowerAc=1;
1868 //pp_compare.user.OptimizeForPowerDc=1;
1869 ok(compare(pp,pp_compare),"Difference Found\n");
1870
1872 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1873 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1874 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1875 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1876 ret = ValidatePowerPolicies(0,&pp);
1877 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1878 pp_compare.mach.MinSleepAc=4;
1879 pp_compare.mach.MinSleepDc=4;
1880 pp_compare.user.MaxSleepAc=4;
1881 pp_compare.user.MaxSleepDc=4;
1882 pp_compare.user.OptimizeForPowerAc=1;
1883 pp_compare.user.OptimizeForPowerDc=1;
1884 ok(compare(pp,pp_compare),"Difference Found\n");
1885
1887 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1888 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1889 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1890 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1891 ret = ValidatePowerPolicies(0,&pp);
1892 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1893 pp_compare.mach.MinSleepAc=4;
1894 pp_compare.mach.MinSleepDc=4;
1895 pp_compare.user.MaxSleepAc=4;
1896 pp_compare.user.MaxSleepDc=4;
1897 pp_compare.user.OptimizeForPowerAc=1;
1898 pp_compare.user.OptimizeForPowerDc=1;
1899 ok(compare(pp,pp_compare),"Difference Found\n");
1900
1902 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1903 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1904 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1905 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1906 ret = ValidatePowerPolicies(0,&pp);
1907 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1908 pp_compare.mach.MinSleepAc=4;
1909 pp_compare.mach.MinSleepDc=4;
1910 pp_compare.user.MaxSleepAc=4;
1911 pp_compare.user.MaxSleepDc=4;
1912 pp_compare.user.OptimizeForPowerAc=1;
1913 pp_compare.user.OptimizeForPowerDc=1;
1914 ok(compare(pp,pp_compare),"Difference Found\n");
1915
1917 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1918 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1919 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1920 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1921 ret = ValidatePowerPolicies(0,&pp);
1922 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1923 pp_compare.mach.MinSleepAc=4;
1924 pp_compare.mach.MinSleepDc=4;
1925 pp_compare.user.MaxSleepAc=4;
1926 pp_compare.user.MaxSleepDc=4;
1927 pp_compare.user.OptimizeForPowerAc=1;
1928 pp_compare.user.OptimizeForPowerDc=1;
1929 ok(compare(pp,pp_compare),"Difference Found\n");
1930
1932 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1933 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1934 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1935 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1936 ret = ValidatePowerPolicies(0,&pp);
1937 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1938 pp_compare.mach.MinSleepAc=4;
1939 pp_compare.mach.MinSleepDc=4;
1940 pp_compare.user.MaxSleepAc=4;
1941 pp_compare.user.MaxSleepDc=4;
1942 pp_compare.user.OptimizeForPowerAc=1;
1943 pp_compare.user.OptimizeForPowerDc=1;
1944 ok(compare(pp,pp_compare),"Difference Found\n");
1945
1947 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1948 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1949 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1950 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1951 ret = ValidatePowerPolicies(0,&pp);
1952 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1953 pp_compare.mach.MinSleepAc=4;
1954 pp_compare.mach.MinSleepDc=4;
1955 pp_compare.user.MaxSleepAc=4;
1956 pp_compare.user.MaxSleepDc=4;
1957 pp_compare.user.OptimizeForPowerAc=1;
1958 pp_compare.user.OptimizeForPowerDc=1;
1959 ok(compare(pp,pp_compare),"Difference Found\n");
1960
1962 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1963 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1964 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1965 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1966 ret = ValidatePowerPolicies(0,&pp);
1967 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1968 pp_compare.mach.MinSleepAc=4;
1969 pp_compare.mach.MinSleepDc=4;
1970 pp_compare.user.MaxSleepAc=4;
1971 pp_compare.user.MaxSleepDc=4;
1972 pp_compare.user.OptimizeForPowerAc=1;
1973 pp_compare.user.OptimizeForPowerDc=1;
1974 ok(compare(pp,pp_compare),"Difference Found\n");
1975
1977 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1978 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1979 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1980 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1981 ret = ValidatePowerPolicies(0,&pp);
1982 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1983 pp_compare.mach.MinSleepAc=4;
1984 pp_compare.mach.MinSleepDc=4;
1985 pp_compare.user.MaxSleepAc=4;
1986 pp_compare.user.MaxSleepDc=4;
1987 pp_compare.user.OptimizeForPowerAc=1;
1988 pp_compare.user.OptimizeForPowerDc=1;
1989 ok(compare(pp,pp_compare),"Difference Found\n");
1990
1992 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1993 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
1994 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
1995 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
1996 ret = ValidatePowerPolicies(0,&pp);
1997 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1998 pp_compare.mach.MinSleepAc=4;
1999 pp_compare.mach.MinSleepDc=4;
2000 pp_compare.user.MaxSleepAc=4;
2001 pp_compare.user.MaxSleepDc=4;
2002 pp_compare.user.OptimizeForPowerAc=1;
2003 pp_compare.user.OptimizeForPowerDc=1;
2004 ok(compare(pp,pp_compare),"Difference Found\n");
2005
2007 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2008 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2009 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2010 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2011 ret = ValidatePowerPolicies(0,&pp);
2012 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2013 pp_compare.mach.MinSleepDc=4;
2014 pp_compare.user.MaxSleepAc=4;
2015 pp_compare.user.MaxSleepDc=4;
2016 pp_compare.user.OptimizeForPowerAc=1;
2017 pp_compare.user.OptimizeForPowerDc=1;
2018 ok(compare(pp,pp_compare),"Difference Found\n");
2019
2021 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2022 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2023 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2024 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2025 ret = ValidatePowerPolicies(0,&pp);
2026 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2027 pp_compare.user.MaxSleepAc=4;
2028 pp_compare.user.MaxSleepDc=4;
2029 pp_compare.user.OptimizeForPowerAc=1;
2030 pp_compare.user.OptimizeForPowerDc=1;
2031 ok(compare(pp,pp_compare),"Difference Found\n");
2032
2034 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2035 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2036 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2037 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2038 ret = ValidatePowerPolicies(0,&pp);
2039 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2040 pp_compare.user.MaxSleepDc=4;
2041 pp_compare.user.OptimizeForPowerAc=1;
2042 pp_compare.user.OptimizeForPowerDc=1;
2043 ok(compare(pp,pp_compare),"Difference Found\n");
2044
2046 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2047 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2048 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2049 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2050 ret = ValidatePowerPolicies(0,&pp);
2051 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2052 pp_compare.user.OptimizeForPowerAc=1;
2053 pp_compare.user.OptimizeForPowerDc=1;
2054 ok(compare(pp,pp_compare),"Difference Found\n");
2055
2057 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2058 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2059 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2060 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2061 ret = ValidatePowerPolicies(0,&pp);
2062 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2063 pp_compare.mach.MinSleepAc=4;
2064 pp_compare.mach.MinSleepDc=4;
2065 pp_compare.user.MaxSleepAc=4;
2066 pp_compare.user.MaxSleepDc=4;
2067 pp_compare.user.OptimizeForPowerAc=1;
2068 pp_compare.user.OptimizeForPowerDc=1;
2069 ok(compare(pp,pp_compare),"Difference Found\n");
2070
2072 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2073 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2074 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2075 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2076 ret = ValidatePowerPolicies(0,&pp);
2077 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2078 pp_compare.mach.MinSleepAc=4;
2079 pp_compare.mach.MinSleepDc=4;
2080 pp_compare.user.MaxSleepAc=4;
2081 pp_compare.user.MaxSleepDc=4;
2082 pp_compare.user.OptimizeForPowerAc=1;
2083 pp_compare.user.OptimizeForPowerDc=1;
2084 ok(compare(pp,pp_compare),"Difference Found\n");
2085
2087 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2088 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2089 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2090 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2091 ret = ValidatePowerPolicies(0,&pp);
2092 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2093 pp_compare.mach.MinSleepAc=4;
2094 pp_compare.mach.MinSleepDc=4;
2095 pp_compare.user.MaxSleepAc=4;
2096 pp_compare.user.MaxSleepDc=4;
2097 pp_compare.user.OptimizeForPowerAc=1;
2098 pp_compare.user.OptimizeForPowerDc=1;
2099 ok(compare(pp,pp_compare),"Difference Found\n");
2100
2102 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2103 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2104 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2105 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2106 ret = ValidatePowerPolicies(0,&pp);
2107 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2108 pp_compare.mach.MinSleepAc=4;
2109 pp_compare.mach.MinSleepDc=4;
2110 pp_compare.user.MaxSleepAc=4;
2111 pp_compare.user.MaxSleepDc=4;
2112 pp_compare.user.OptimizeForPowerAc=1;
2113 pp_compare.user.OptimizeForPowerDc=1;
2114 ok(compare(pp,pp_compare),"Difference Found\n");
2115
2117 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2118 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2119 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2120 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2121 ret = ValidatePowerPolicies(0,&pp);
2122 ok(!ret, "function was expected to fail\n");
2123 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2124 ok(compare(pp,pp_compare),"Difference Found\n");
2125
2127 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2128 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2129 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2130 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2131 ret = ValidatePowerPolicies(0,&pp);
2132 ok(!ret, "function was expected to fail\n");
2133 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2134 ok(compare(pp,pp_compare),"Difference Found\n");
2135
2137 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2138 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2139 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2140 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2141 ret = ValidatePowerPolicies(0,&pp);
2142 ok(!ret, "function was expected to fail\n");
2143 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2144 ok(compare(pp,pp_compare),"Difference Found\n");
2145
2147 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2148 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2149 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2150 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2151 ret = ValidatePowerPolicies(0,&pp);
2152 ok(!ret, "function was expected to fail\n");
2153 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2154 ok(compare(pp,pp_compare),"Difference Found\n");
2155
2157 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2158 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2159 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2160 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2161 ret = ValidatePowerPolicies(0,&pp);
2162 ok(!ret, "function was expected to fail\n");
2163 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2164 ok(compare(pp,pp_compare),"Difference Found\n");
2165
2167 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2168 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2169 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2170 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2171 ret = ValidatePowerPolicies(0,&pp);
2172 ok(!ret, "function was expected to fail\n");
2173 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2174 ok(compare(pp,pp_compare),"Difference Found\n");
2175
2177 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2178 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2179 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2180 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2181 ret = ValidatePowerPolicies(0,&pp);
2182 ok(!ret, "function was expected to fail\n");
2183 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2184 ok(compare(pp,pp_compare),"Difference Found\n");
2185
2187 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2188 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2189 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2190 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2191 ret = ValidatePowerPolicies(0,&pp);
2192 ok(!ret, "function was expected to fail\n");
2193 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2194 ok(compare(pp,pp_compare),"Difference Found\n");
2195
2196 pp_original.mach.MinSleepAc=PowerSystemMaximum+1;
2197 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2198 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2199 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2200 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2201 ret = ValidatePowerPolicies(0,&pp);
2202 ok(!ret, "function was expected to fail\n");
2203 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2204 ok(compare(pp,pp_compare),"Difference Found\n");
2205
2206 pp_original.mach.MinSleepDc=PowerSystemMaximum+1;
2207 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2208 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2209 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2210 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2211 ret = ValidatePowerPolicies(0,&pp);
2212 ok(!ret, "function was expected to fail\n");
2213 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2214 ok(compare(pp,pp_compare),"Difference Found\n");
2215
2216 pp_original.user.MaxSleepAc=PowerSystemMaximum+1;
2217 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2218 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2219 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2220 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2221 ret = ValidatePowerPolicies(0,&pp);
2222 ok(!ret, "function was expected to fail\n");
2223 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2224 ok(compare(pp,pp_compare),"Difference Found\n");
2225
2226 pp_original.user.MaxSleepDc=PowerSystemMaximum+1;
2227 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2228 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2229 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2230 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2231 ret = ValidatePowerPolicies(0,&pp);
2232 ok(!ret, "function was expected to fail\n");
2233 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
2234 ok(compare(pp,pp_compare),"Difference Found\n");
2235
2240
2241
2242 test_ValidatePowerPolicies_Next(&gpp_original,&pp_original);
2243
2244
2245 // memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2246 // memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2247 //memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2248 // memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2249 ret = GetCurrentPowerPolicies(&gpp_original,&pp_original);
2250 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2251 //gpp_compare.mach.BroadcastCapacityResolution = 3;
2252 //gpp_compare.user.PowerButtonAc.Action = 2;
2253 //gpp_compare.user.PowerButtonAc.Flags=3;
2254 //gpp_compare.user.PowerButtonDc.EventCode=16;
2255 //gpp_compare.user.PowerButtonDc.Flags=3;
2256 //gpp_compare.user.SleepButtonAc.Action=2;
2257 //gpp_compare.user.SleepButtonAc.Flags=3;
2258 //gpp_compare.user.SleepButtonDc.Action=2;
2259 //gpp_compare.user.SleepButtonDc.Flags=3;
2260 //gpp_compare.user.LidCloseAc.EventCode=-2147483648;
2261 //gpp_compare.user.LidCloseAc.Flags=1;
2262 //gpp_compare.user.LidCloseDc.EventCode=-2147483648;
2263 //gpp_compare.user.LidCloseDc.Flags=1;
2264
2265 //gpp_compare.user.DischargePolicy[0].Enable=1;
2267 //gpp_compare.user.DischargePolicy[0].Spare[3]=3;
2268 //gpp_compare.user.DischargePolicy[0].BatteryLevel=3;
2269 //gpp_compare.user.DischargePolicy[0].PowerPolicy.Action=2;
2270 //gpp_compare.user.DischargePolicy[0].PowerPolicy.Flags=-1073741820;
2271 //gpp_compare.user.DischargePolicy[0].PowerPolicy.EventCode=1;
2272 //gpp_compare.user.DischargePolicy[0].MinSystemState=4;
2273
2274 //gpp_compare.user.DischargePolicy[1].Enable=1;
2276 //gpp_compare.user.DischargePolicy[1].Spare[3]=10;
2277 //gpp_compare.user.DischargePolicy[1].BatteryLevel=10;
2279 //gpp_compare.user.DischargePolicy[1].PowerPolicy.Flags=3;
2280 //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode=65537;
2281 //gpp_compare.user.DischargePolicy[1].MinSystemState=1;
2282 //
2283 //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode=131072;
2284 //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode=196608;
2285 //gpp_compare.user.GlobalFlags=20;
2286
2287 //ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2288 //pp_compare.mach.MinSleepAc=4;
2289 //pp_compare.mach.MinSleepDc=4;
2290 //pp_compare.mach.ReducedLatencySleepAc=4;
2291 //pp_compare.mach.ReducedLatencySleepDc=4;
2292 //pp_compare.mach.OverThrottledAc.Action=2;
2293 //pp_compare.mach.OverThrottledAc.Flags=-1073741820;
2294 //pp_compare.mach.OverThrottledDc.Action=2;
2295 //pp_compare.mach.OverThrottledDc.Flags=-1073741820;
2296 //pp_compare.mach.pad1[2]=2;
2297 //pp_compare.user.IdleAc.Flags=1;
2298 //pp_compare.user.IdleDc.Flags=1;
2299 //pp_compare.user.IdleSensitivityAc=50;
2300 //pp_compare.user.IdleSensitivityDc=50;
2301 //pp_compare.user.ThrottlePolicyAc=3;
2302 //pp_compare.user.ThrottlePolicyDc=3;
2303 //pp_compare.user.Reserved[2]=1200;
2304 //pp_compare.user.VideoTimeoutAc=1200;
2305 //pp_compare.user.VideoTimeoutDc=600;
2306 //pp_compare.user.SpindownTimeoutAc=2700;
2307 //pp_compare.user.SpindownTimeoutDc=600;
2308 //pp_compare.user.FanThrottleToleranceAc=100;
2309 //pp_compare.user.FanThrottleToleranceDc=80;
2310 //pp_compare.user.ForcedThrottleAc=100;
2311 //pp_compare.user.ForcedThrottleDc=100;
2312 //pp_compare.user.MaxSleepAc=4;
2313 //pp_compare.user.MaxSleepDc=4;
2314 //pp_compare.user.OptimizeForPowerAc=1;
2315 //pp_compare.user.OptimizeForPowerDc=1;
2316 //ok(compare(pp,pp_compare),"Difference Found\n");
2317
2318 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2319 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2320 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2321 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2322 ret = ValidatePowerPolicies(&gpp,0);
2323 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2324 //gpp_compare.mach.BroadcastCapacityResolution=100;
2325 //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
2326 //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
2327 //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
2328 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2329
2330 memcpy(&gpp, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2331 memcpy(&gpp_compare, &gpp_original, sizeof(GLOBAL_POWER_POLICY));
2332 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2333 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2334 ret = ValidatePowerPolicies(0,&pp);
2335 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2336 //pp_compare.mach.MinSleepAc=4;
2337 //pp_compare.mach.MinSleepDc=4;
2338 //pp_compare.user.MaxSleepAc=4;
2339 //pp_compare.user.MaxSleepDc=4;
2340 //pp_compare.user.OptimizeForPowerAc=1;
2341 //pp_compare.user.OptimizeForPowerDc=1;
2342 ok(compare(pp,pp_compare),"Difference Found\n");
2343
2344 memcpy(&pp, &pp_original, sizeof(POWER_POLICY));
2345 memcpy(&pp_compare, &pp_original, sizeof(POWER_POLICY));
2346 ret = ValidatePowerPolicies(&gpp,&pp);
2347 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2348 //gpp_compare.mach.BroadcastCapacityResolution=100;
2349 //gpp_compare.user.DischargePolicy[1].PowerPolicy.EventCode = 65536;
2350 //gpp_compare.user.DischargePolicy[2].PowerPolicy.EventCode = 131072;
2351 //gpp_compare.user.DischargePolicy[3].PowerPolicy.EventCode = 196608;
2352 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2353 pp_compare.mach.MinSleepAc=4;
2354 pp_compare.mach.MinSleepDc=4;
2355 pp_compare.user.MaxSleepAc=4;
2356 pp_compare.user.MaxSleepDc=4;
2357 //pp_compare.user.OptimizeForPowerAc=1;
2358 //pp_compare.user.OptimizeForPowerDc=1;
2359 ok(compare(pp,pp_compare),"Difference Found\n");
2360
2361}
#define compare
#define SetLastError(x)
Definition: compat.h:752
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original, PPOWER_POLICY pPP_original)
Definition: power.c:2363
BOOLEAN globalcompare(GLOBAL_POWER_POLICY gpp, GLOBAL_POWER_POLICY gpp_compare)
Definition: power.c:728
@ PowerSystemMaximum
Definition: ntpoapi.h:42
@ PowerSystemUnspecified
Definition: ntpoapi.h:35
@ PowerSystemSleeping1
Definition: ntpoapi.h:37
@ PowerSystemSleeping2
Definition: ntpoapi.h:38
@ PowerSystemSleeping3
Definition: ntpoapi.h:39
@ PowerSystemShutdown
Definition: ntpoapi.h:41
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ PowerSystemHibernate
Definition: ntpoapi.h:40
@ PowerActionNone
Definition: ntpoapi.h:123
@ PowerActionWarmEject
Definition: ntpoapi.h:130
BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
Definition: powrprof.c:1017
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define ERROR_INVALID_DATA
Definition: winerror.h:116
#define ERROR_REVISION_MISMATCH
Definition: winerror.h:788

Referenced by func_power().

◆ test_ValidatePowerPolicies_Next()

void test_ValidatePowerPolicies_Next ( PGLOBAL_POWER_POLICY  pGPP_original,
PPOWER_POLICY  pPP_original 
)

Definition at line 2363 of file power.c.

2364{
2365 GLOBAL_POWER_POLICY gpp, gpp_compare;
2366 POWER_POLICY pp, pp_compare;
2367 BOOLEAN ret;
2368
2369 //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeAc);//1
2370 //printf("Old: %i\n",pGPP_original->mach.LidOpenWakeDc);//1
2371 //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseAc.Action,pGPP_original->user.LidCloseAc.EventCode,pGPP_original->user.LidCloseAc.Flags);//7
2372 //printf("Old: %i,%i,%i \n",pGPP_original->user.LidCloseDc.Action,pGPP_original->user.LidCloseDc.EventCode,pGPP_original->user.LidCloseDc.Flags);//7
2373 //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonAc.Action,pGPP_original->user.PowerButtonAc.EventCode,pGPP_original->user.PowerButtonAc.Flags);//0,0,0
2374 //printf("Old: %i,%i,%i \n",pGPP_original->user.PowerButtonDc.Action,pGPP_original->user.PowerButtonDc.EventCode,pGPP_original->user.PowerButtonDc.Flags);//7,0,0
2375 //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonAc.Action,pGPP_original->user.SleepButtonAc.EventCode,pGPP_original->user.SleepButtonAc.Flags);//7,0,0
2376 //printf("Old: %i,%i,%i \n",pGPP_original->user.SleepButtonDc.Action,pGPP_original->user.SleepButtonDc.EventCode,pGPP_original->user.SleepButtonDc.Flags);//7,0,0
2377 //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutAc);//0
2378 //printf("Old: %i \n",pPP_original->mach.DozeS4TimeoutDc);//0
2379 //printf("Old: %i \n",pPP_original->mach.DozeTimeoutAc);//0
2380 //printf("Old: %i \n",pPP_original->mach.DozeTimeoutDc);//0
2381 //printf("Old: %i \n",pPP_original->mach.MinSleepAc);//1
2382 //printf("Old: %i \n",pPP_original->mach.MinSleepDc);//1
2383 //printf("Old: %i \n",pPP_original->mach.MinThrottleAc);//0
2384 //printf("Old: %i \n",pPP_original->mach.MinThrottleDc);//0
2385 //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledAc.Action,pPP_original->mach.OverThrottledAc.EventCode,pPP_original->mach.OverThrottledAc.Flags);//0,0,0
2386 //printf("Old: %i,%i,%i \n",pPP_original->mach.OverThrottledDc.Action,pPP_original->mach.OverThrottledDc.EventCode,pPP_original->mach.OverThrottledDc.Flags);//0,0,0
2387 //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepAc);//1
2388 //printf("Old: %i \n",pPP_original->mach.ReducedLatencySleepDc);//1
2389 //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceAc);//0
2390 //printf("Old: %i \n",pPP_original->user.FanThrottleToleranceDc);//0
2391 //printf("Old: %i \n",pPP_original->user.ForcedThrottleAc);//0
2392 //printf("Old: %i \n",pPP_original->user.ForcedThrottleDc);//0
2393 //printf("Old: %i,%i,%i \n",pPP_original->user.IdleAc.Action,pPP_original->user.IdleAc.EventCode,pPP_original->user.IdleAc.Flags);//0,0,0
2394 //printf("Old: %i,%i,%i \n",pPP_original->user.IdleDc.Action,pPP_original->user.IdleDc.EventCode,pPP_original->user.IdleDc.Flags);//0,0,0
2395 //printf("Old: %i \n",pPP_original->user.IdleSensitivityAc);//0
2396 //printf("Old: %i \n",pPP_original->user.IdleSensitivityDc);//0
2397 //printf("Old: %i \n",pPP_original->user.IdleTimeoutAc);//0
2398 //printf("Old: %i \n",pPP_original->user.IdleTimeoutDc);//0
2399 //printf("Old: %i \n",pPP_original->user.MaxSleepAc);//1
2400 //printf("Old: %i \n",pPP_original->user.MaxSleepDc);//1
2401 //printf("Old: %i \n",pPP_original->user.OptimizeForPowerAc);//0
2402 //printf("Old: %i \n",pPP_original->user.OptimizeForPowerDc);//0
2403 //printf("Old: %i \n",pPP_original->user.SpindownTimeoutAc);//0
2404 //printf("Old: %i \n",pPP_original->user.SpindownTimeoutDc);//0
2405 //printf("Old: %i \n",pPP_original->user.ThrottlePolicyAc);//0
2406 //printf("Old: %i \n",pPP_original->user.ThrottlePolicyDc);//0
2407 //printf("Old: %i \n",pPP_original->user.VideoTimeoutAc);//0
2408 //printf("Old: %i \n",pPP_original->user.VideoTimeoutDc);//0
2409
2410 pPP_original->mach.MinSleepAc=4;
2411pPP_original->mach.MinSleepDc=4;
2412pPP_original->user.MaxSleepAc=4;
2413pPP_original->user.MaxSleepDc=4;
2414pPP_original->user.OptimizeForPowerAc=1;
2415pPP_original->user.OptimizeForPowerDc=1;
2416
2417 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2418 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2419 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2420
2421 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2422 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2423 ok(compare(pp,pp_compare),"Difference Found\n");
2424
2425 ret = ValidatePowerPolicies(&gpp,&pp);
2426 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2427 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2428 ok(compare(pp,pp_compare),"Difference Found\n");
2429
2430 pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-2;
2431 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2432 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2433 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2434 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2435 ret = ValidatePowerPolicies(&gpp,&pp);
2436 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2437 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2438 ok(compare(pp,pp_compare),"Difference Found\n");
2439
2440 pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified-1;
2441 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2442 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2443 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2444 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2445 ret = ValidatePowerPolicies(&gpp,&pp);
2446 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2447 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2448 ok(compare(pp,pp_compare),"Difference Found\n");
2449
2451 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2452 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2453 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2454 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2455 ret = ValidatePowerPolicies(&gpp,&pp);
2456 ok(!ret, "function was expected to fail\n");
2457 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2458 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2459 ok(compare(pp,pp_compare),"Difference Found\n");
2460
2461 pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
2462 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2463 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2464 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2465 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2466 ret = ValidatePowerPolicies(&gpp,&pp);
2467 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2468 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2469 ok(compare(pp,pp_compare),"Difference Found\n");
2470
2472 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2473 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2474 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2475 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2476 ret = ValidatePowerPolicies(&gpp,&pp);
2477 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2478 gpp_compare.mach.LidOpenWakeAc=4;
2479 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2480 ok(compare(pp,pp_compare),"Difference Found\n");
2481
2483 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2484 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2485 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2486 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2487 ret = ValidatePowerPolicies(&gpp,&pp);
2488 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2489 gpp_compare.mach.LidOpenWakeAc=4;
2490 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2491 ok(compare(pp,pp_compare),"Difference Found\n");
2492
2494 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2495 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2496 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2497 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2498 ret = ValidatePowerPolicies(&gpp,&pp);
2499 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2500 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2501 ok(compare(pp,pp_compare),"Difference Found\n");
2502
2504 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2505 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2506 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2507 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2508 ret = ValidatePowerPolicies(&gpp,&pp);
2509 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2510 gpp_compare.mach.LidOpenWakeAc=4;
2511 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2512 ok(compare(pp,pp_compare),"Difference Found\n");
2513
2514 pGPP_original->mach.LidOpenWakeAc=PowerSystemShutdown;
2515 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2516 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2517 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2518 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2519 ret = ValidatePowerPolicies(&gpp,&pp);
2520 ok(!ret, "function was expected to fail\n");
2521 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2522 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2523 ok(compare(pp,pp_compare),"Difference Found\n");
2524
2525 pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum;
2526 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2527 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2528 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2529 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2530 ret = ValidatePowerPolicies(&gpp,&pp);
2531 ok(!ret, "function was expected to fail\n");
2532 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2533 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2534 ok(compare(pp,pp_compare),"Difference Found\n");
2535
2536 pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+1;
2537 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2538 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2539 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2540 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2541 ret = ValidatePowerPolicies(&gpp,&pp);
2542 ok(!ret, "function was expected to fail\n");
2543 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2544 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2545 ok(compare(pp,pp_compare),"Difference Found\n");
2546
2547 pGPP_original->mach.LidOpenWakeAc=PowerSystemMaximum+2;
2548 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2549 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2550 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2551 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2552 ret = ValidatePowerPolicies(&gpp,&pp);
2553 ok(!ret, "function was expected to fail\n");
2554 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2555 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2556 ok(compare(pp,pp_compare),"Difference Found\n");
2557 pGPP_original->mach.LidOpenWakeAc=PowerSystemWorking;
2558
2559
2560 pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-2;
2561 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2562 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2563 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2564 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2565 ret = ValidatePowerPolicies(&gpp,&pp);
2566 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2567 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2568 ok(compare(pp,pp_compare),"Difference Found\n");
2569
2570 pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified-1;
2571 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2572 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2573 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2574 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2575 ret = ValidatePowerPolicies(&gpp,&pp);
2576 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2577 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2578 ok(compare(pp,pp_compare),"Difference Found\n");
2579
2581 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2582 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2583 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2584 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2585 ret = ValidatePowerPolicies(&gpp,&pp);
2586 ok(!ret, "function was expected to fail\n");
2587 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2588 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2589 ok(compare(pp,pp_compare),"Difference Found\n");
2590
2591 pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
2592 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2593 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2594 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2595 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2596 ret = ValidatePowerPolicies(&gpp,&pp);
2597 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2598 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2599 ok(compare(pp,pp_compare),"Difference Found\n");
2600
2602 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2603 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2604 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2605 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2606 ret = ValidatePowerPolicies(&gpp,&pp);
2607 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2608 gpp_compare.mach.LidOpenWakeDc=4;
2609 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2610 ok(compare(pp,pp_compare),"Difference Found\n");
2611
2613 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2614 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2615 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2616 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2617 ret = ValidatePowerPolicies(&gpp,&pp);
2618 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2619 gpp_compare.mach.LidOpenWakeDc=4;
2620 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2621 ok(compare(pp,pp_compare),"Difference Found\n");
2622
2624 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2625 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2626 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2627 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2628 ret = ValidatePowerPolicies(&gpp,&pp);
2629 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2630 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2631 ok(compare(pp,pp_compare),"Difference Found\n");
2632
2634 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2635 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2636 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2637 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2638 ret = ValidatePowerPolicies(&gpp,&pp);
2639 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2640 gpp_compare.mach.LidOpenWakeDc=4;
2641 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2642 ok(compare(pp,pp_compare),"Difference Found\n");
2643
2644 pGPP_original->mach.LidOpenWakeDc=PowerSystemShutdown;
2645 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2646 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2647 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2648 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2649 ret = ValidatePowerPolicies(&gpp,&pp);
2650 ok(!ret, "function was expected to fail\n");
2651 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2652 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2653 ok(compare(pp,pp_compare),"Difference Found\n");
2654
2655 pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum;
2656 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2657 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2658 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2659 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2660 ret = ValidatePowerPolicies(&gpp,&pp);
2661 ok(!ret, "function was expected to fail\n");
2662 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2663 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2664 ok(compare(pp,pp_compare),"Difference Found\n");
2665
2666 pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+1;
2667 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2668 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2669 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2670 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2671 ret = ValidatePowerPolicies(&gpp,&pp);
2672 ok(!ret, "function was expected to fail\n");
2673 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2674 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2675 ok(compare(pp,pp_compare),"Difference Found\n");
2676
2677 pGPP_original->mach.LidOpenWakeDc=PowerSystemMaximum+2;
2678 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2679 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2680 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2681 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2682 ret = ValidatePowerPolicies(&gpp,&pp);
2683 ok(!ret, "function was expected to fail\n");
2684 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
2685 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2686 ok(compare(pp,pp_compare),"Difference Found\n");
2687 pGPP_original->mach.LidOpenWakeDc=PowerSystemWorking;
2688
2689 pGPP_original->user.LidCloseAc.Action=PowerActionNone-2;
2690 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2691 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2692 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2693 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2694 ret = ValidatePowerPolicies(&gpp,&pp);
2695 ok(!ret, "function was expected to fail\n");
2696 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2697 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2698 ok(compare(pp,pp_compare),"Difference Found\n");
2699
2700 pGPP_original->user.LidCloseAc.Action=PowerActionNone-1;
2701 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2702 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2703 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2704 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2705 ret = ValidatePowerPolicies(&gpp,&pp);
2706 ok(!ret, "function was expected to fail\n");
2707 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2708 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2709 ok(compare(pp,pp_compare),"Difference Found\n");
2710
2711 pGPP_original->user.LidCloseAc.Action=PowerActionNone;
2712 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2713 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2714 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2715 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2716 ret = ValidatePowerPolicies(&gpp,&pp);
2717 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2718 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2719 ok(compare(pp,pp_compare),"Difference Found\n");
2720
2722 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2723 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2724 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2725 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2726 ret = ValidatePowerPolicies(&gpp,&pp);
2727 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2728 gpp_compare.user.LidCloseAc.Action=2;
2729 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2730 ok(compare(pp,pp_compare),"Difference Found\n");
2731
2732 pGPP_original->user.LidCloseAc.Action=PowerActionSleep;
2733 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2734 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2735 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2736 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2737 ret = ValidatePowerPolicies(&gpp,&pp);
2738 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2739 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2740 ok(compare(pp,pp_compare),"Difference Found\n");
2741
2743 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2744 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2745 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2746 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2747 ret = ValidatePowerPolicies(&gpp,&pp);
2748 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2749 gpp_compare.user.LidCloseAc.Action=2;
2750 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2751 ok(compare(pp,pp_compare),"Difference Found\n");
2752
2754 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2755 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2756 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2757 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2758 ret = ValidatePowerPolicies(&gpp,&pp);
2759 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2760 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2761 ok(compare(pp,pp_compare),"Difference Found\n");
2762
2764 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2765 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2766 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2767 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2768 ret = ValidatePowerPolicies(&gpp,&pp);
2769 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2770 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2771 ok(compare(pp,pp_compare),"Difference Found\n");
2772
2774 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2775 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2776 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2777 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2778 ret = ValidatePowerPolicies(&gpp,&pp);
2779 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2780 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2781 ok(compare(pp,pp_compare),"Difference Found\n");
2782
2784 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2785 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2786 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2787 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2788 ret = ValidatePowerPolicies(&gpp,&pp);
2789 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2790 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2791 ok(compare(pp,pp_compare),"Difference Found\n");
2792
2793 pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+1;
2794 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2795 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2796 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2797 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));