1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Tests for powrprof.dll
5 * PROGRAMMER: Alex Wurzinger
6 * Johannes Anderwald
7 * Martin Rottensteiner
8 */
9
10 #include <apitest.h>
11
12 #include <stdio.h>
13 #include <stdarg.h>
14 #include <ntstatus.h>
15 #define WIN32_NO_STATUS
16 #include <winreg.h>
17 #include <ndk/potypes.h>
18 #include <powrprof.h>
19
20 unsigned int g_NumPwrSchemes = 0;
21 unsigned int g_NumPwrSchemesEnumerated = 0;
22 unsigned int g_ActivePwrScheme = 3;
23 unsigned int g_TempPwrScheme = 99;
24
25 POWER_POLICY g_PowerPolicy;
26
27 static const WCHAR szMachPowerPoliciesSubKey[] = { 'S', 'O', 'F', 'T', 'W', 'A', 'R',
28 'E', '\\', 'M', 'i', 'c', 'r', 'o', 's', 'o', 'f', 't', '\\', 'W', 'i', 'n', 'd',
29 'o', 'w', 's', '\\', 'C', 'u', 'r', 'r', 'e', 'n', 't', 'V', 'e', 'r', 's', 'i',
30 'o', 'n', '\\', 'C', 'o', 'n', 't', 'r', 'o', 'l', 's', ' ', 'F', 'o', 'l', 'd',
31 'e', 'r', '\\', 'P', 'o', 'w', 'e', 'r', 'C', 'f', 'g', '\\', 'P', 'o', 'w', 'e',
32 'r', 'P', 'o', 'l', 'i', 'c', 'i', 'e', 's', 0};
33
34 static const WCHAR szTempPwrScheme[] = { '9', '9', 0 };
35
36 void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original);
37
test_CallNtPowerInformation(void)38 void test_CallNtPowerInformation(void)
39 {
40 DWORD retval;
41 ADMINISTRATOR_POWER_POLICY apolicy;
42 ULONGLONG atime, ctime;
43 PROCESSOR_POWER_INFORMATION ppi, *pppi;
44 PROCESSOR_POWER_POLICY ppp;
45 SYSTEM_BATTERY_STATE sbs;
46 SYSTEM_POWER_CAPABILITIES spc;
47 SYSTEM_POWER_INFORMATION spi;
48 SYSTEM_POWER_POLICY spp;
49 HANDLE x=NULL;
50
51 /* AdministratorPowerPolicy tests */
52 retval = CallNtPowerInformation(AdministratorPowerPolicy, 0, 0, 0, 0);
53 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
54 retval = CallNtPowerInformation(AdministratorPowerPolicy, 0, 0, &apolicy, sizeof(ADMINISTRATOR_POWER_POLICY));
55 ok(retval == STATUS_SUCCESS, "function expected STATUS_SUCCESS but got %d\n", (UINT)retval);
56 retval = CallNtPowerInformation(AdministratorPowerPolicy, &apolicy, sizeof(ADMINISTRATOR_POWER_POLICY), 0, 0);
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);
83 retval = CallNtPowerInformation(ProcessorInformation, 0, 0, &ppi, sizeof(PROCESSOR_POWER_INFORMATION));
84 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
85 retval = CallNtPowerInformation(ProcessorInformation, &ppi, sizeof(PROCESSOR_POWER_INFORMATION), 0, 0);
86 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
87 retval = CallNtPowerInformation(ProcessorInformation, &ppi, sizeof(PROCESSOR_POWER_INFORMATION), &ppi, sizeof(PROCESSOR_POWER_INFORMATION));
88
89 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
90 retval = CallNtPowerInformation(ProcessorInformation, 0, 0, &pppi, sizeof(PPROCESSOR_POWER_INFORMATION));
91 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
92 retval = CallNtPowerInformation(ProcessorInformation, &pppi, sizeof(PPROCESSOR_POWER_INFORMATION), 0, 0);
93 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
94 retval = CallNtPowerInformation(ProcessorInformation, &pppi, sizeof(PPROCESSOR_POWER_INFORMATION), &pppi, sizeof(PPROCESSOR_POWER_INFORMATION));
95 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
96
97 /* ProcessorPowerPolicyAc tests */
98 retval = CallNtPowerInformation(ProcessorPowerPolicyAc, 0, 0, 0, 0);
99 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
100 retval = CallNtPowerInformation(ProcessorPowerPolicyAc, 0, 0, &ppp, sizeof(PROCESSOR_POWER_POLICY));
101 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
102 retval = CallNtPowerInformation(ProcessorPowerPolicyAc, &ppp, sizeof(PROCESSOR_POWER_POLICY), 0, 0);
103 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
104 retval = CallNtPowerInformation(ProcessorPowerPolicyAc, &ppp, sizeof(PROCESSOR_POWER_POLICY), &ppp, sizeof(PROCESSOR_POWER_POLICY));
105 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
106
107 /* ProcessorPowerPolicyCurrent tests */
108 retval = CallNtPowerInformation(ProcessorPowerPolicyCurrent, 0, 0, 0, 0);
109 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
110 retval = CallNtPowerInformation(ProcessorPowerPolicyCurrent, 0, 0, &ppp, sizeof(PROCESSOR_POWER_POLICY));
111 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
112 retval = CallNtPowerInformation(ProcessorPowerPolicyCurrent, &ppp, sizeof(PROCESSOR_POWER_POLICY), 0, 0);
113 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
114 retval = CallNtPowerInformation(ProcessorPowerPolicyCurrent, &ppp, sizeof(PROCESSOR_POWER_POLICY), &ppp, sizeof(PROCESSOR_POWER_POLICY));
115 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
116
117 /* ProcessorPowerPolicyDc tests */
118 retval = CallNtPowerInformation(ProcessorPowerPolicyDc, 0, 0, 0, 0);
119 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
120 retval = CallNtPowerInformation(ProcessorPowerPolicyDc, 0, 0, &ppp, sizeof(PROCESSOR_POWER_POLICY));
121 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
122 retval = CallNtPowerInformation(ProcessorPowerPolicyDc, &ppp, sizeof(PROCESSOR_POWER_POLICY), 0, 0);
123 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
124 retval = CallNtPowerInformation(ProcessorPowerPolicyDc, &ppp, sizeof(PROCESSOR_POWER_POLICY), &ppp, sizeof(PROCESSOR_POWER_POLICY));
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);
130 retval = CallNtPowerInformation(SystemBatteryState, 0, 0, &sbs, sizeof(SYSTEM_BATTERY_STATE));
131 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
132 retval = CallNtPowerInformation(SystemBatteryState, &sbs, sizeof(SYSTEM_BATTERY_STATE), 0, 0);
133 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
134 retval = CallNtPowerInformation(SystemBatteryState, &sbs, sizeof(SYSTEM_BATTERY_STATE), &sbs, sizeof(SYSTEM_BATTERY_STATE));
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 */
142 retval = CallNtPowerInformation(SystemPowerCapabilities, 0, 0, 0, 0);
143 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
144 retval = CallNtPowerInformation(SystemPowerCapabilities, 0, 0, &spc, sizeof(SYSTEM_POWER_CAPABILITIES));
145 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
146 retval = CallNtPowerInformation(SystemPowerCapabilities, &spc, sizeof(SYSTEM_POWER_CAPABILITIES), 0, 0);
147 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
148 retval = CallNtPowerInformation(SystemPowerCapabilities, &spc, sizeof(SYSTEM_POWER_CAPABILITIES), &spc, sizeof(SYSTEM_POWER_CAPABILITIES));
149 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
150
151 /* SystemPowerInformation tests */
152 retval = CallNtPowerInformation(SystemPowerInformation, 0, 0, 0, 0);
153 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
154 retval = CallNtPowerInformation(SystemPowerInformation, 0, 0, &spi, sizeof(SYSTEM_POWER_INFORMATION));
155 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
156 retval = CallNtPowerInformation(SystemPowerInformation, &spi, sizeof(SYSTEM_POWER_INFORMATION), 0, 0);
157 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
158 retval = CallNtPowerInformation(SystemPowerInformation, &spi, sizeof(SYSTEM_POWER_INFORMATION), &spi, sizeof(SYSTEM_POWER_INFORMATION));
159 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
160 retval = CallNtPowerInformation(SystemPowerInformation, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
161 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
162 retval = CallNtPowerInformation(SystemPowerInformation, &spp, sizeof(SYSTEM_POWER_POLICY), &spi, sizeof(SYSTEM_POWER_INFORMATION));
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);
168 retval = CallNtPowerInformation(SystemPowerPolicyAc, 0, 0, &spp, sizeof(SYSTEM_POWER_POLICY));
169 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
170 retval = CallNtPowerInformation(SystemPowerPolicyAc, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
171 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
172 retval = CallNtPowerInformation(SystemPowerPolicyAc, &spp, sizeof(SYSTEM_POWER_POLICY), &spp, sizeof(SYSTEM_POWER_POLICY));
173 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
174
175 /* SystemPowerPolicyCurrent tests */
176 retval = CallNtPowerInformation(SystemPowerPolicyCurrent, 0, 0, 0, 0);
177 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
178 retval = CallNtPowerInformation(SystemPowerPolicyCurrent, 0, 0, &spp, sizeof(SYSTEM_POWER_POLICY));
179 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
180 retval = CallNtPowerInformation(SystemPowerPolicyCurrent, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
181 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
182 retval = CallNtPowerInformation(SystemPowerPolicyCurrent, &spp, sizeof(SYSTEM_POWER_POLICY), &spp, sizeof(SYSTEM_POWER_POLICY));
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);
188 retval = CallNtPowerInformation(SystemPowerPolicyDc, 0, 0, &spp, sizeof(SYSTEM_POWER_POLICY));
189 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
190 retval = CallNtPowerInformation(SystemPowerPolicyDc, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
191 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
192 retval = CallNtPowerInformation(SystemPowerPolicyDc, &spp, sizeof(SYSTEM_POWER_POLICY), &spp, sizeof(SYSTEM_POWER_POLICY));
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 */
230 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyAc, 0, 0, 0, 0);
231 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
232 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyAc, 0, 0, &ppp, sizeof(PROCESSOR_POWER_POLICY));
233 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
234 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyAc, &ppp, sizeof(PROCESSOR_POWER_POLICY), 0, 0);
235 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
236 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyAc, &ppp, sizeof(PROCESSOR_POWER_POLICY), &ppp, sizeof(PROCESSOR_POWER_POLICY));
237 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
238
239 /* VerifyProcessorPowerPolicyDc tests */
240 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyDc, 0, 0, 0, 0);
241 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
242 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyDc, 0, 0, &ppp, sizeof(PROCESSOR_POWER_POLICY));
243 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
244 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyDc, &ppp, sizeof(PROCESSOR_POWER_POLICY), 0, 0);
245 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
246 retval = CallNtPowerInformation(VerifyProcessorPowerPolicyDc, &ppp, sizeof(PROCESSOR_POWER_POLICY), &ppp, sizeof(PROCESSOR_POWER_POLICY));
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);
252 retval = CallNtPowerInformation(VerifySystemPolicyAc, 0, 0, &spp, sizeof(SYSTEM_POWER_POLICY));
253 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
254 retval = CallNtPowerInformation(VerifySystemPolicyAc, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
255 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
256 retval = CallNtPowerInformation(VerifySystemPolicyAc, &spp, sizeof(SYSTEM_POWER_POLICY), &spp, sizeof(SYSTEM_POWER_POLICY));
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);
262 retval = CallNtPowerInformation(VerifySystemPolicyDc, 0, 0, &spp, sizeof(SYSTEM_POWER_POLICY));
263 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
264 retval = CallNtPowerInformation(VerifySystemPolicyDc, &spp, sizeof(SYSTEM_POWER_POLICY), 0, 0);
265 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
266 retval = CallNtPowerInformation(VerifySystemPolicyDc, &spp, sizeof(SYSTEM_POWER_POLICY), &spp, sizeof(SYSTEM_POWER_POLICY));
267 ok(retval == STATUS_SUCCESS, "function result wrong expected STATUS_SUCCESS but got %d\n", (UINT)retval);
268
269 /* SystemPowerStateHandler tests */
270 retval = CallNtPowerInformation(SystemPowerStateHandler, 0, 0, 0, 0);
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 */
282 retval = CallNtPowerInformation(ProcessorStateHandler2, 0, 0, 0, 0);
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 */
288 retval = CallNtPowerInformation(SystemPowerStateNotifyHandler, 0, 0, 0, 0);
289 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
290 retval = CallNtPowerInformation(SystemPowerStateNotifyHandler, 0, 0, x, sizeof(HANDLE));
291 ok(retval == STATUS_INVALID_PARAMETER, "function result wrong expected STATUS_INVALID_PARAMETER but got %d\n", (UINT)retval);
292
293 }
294
295 /*
296 @implemented
297 */
test_CanUserWritePwrScheme(void)298 void test_CanUserWritePwrScheme(void)
299 {
300 DWORD error, retval;
301
302 retval = CanUserWritePwrScheme();
303
304 error = GetLastError();
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 }
test_callback_EnumPwrScheme(UINT uiIndex,DWORD dwName,LPWSTR sName,DWORD dwDesc,LPWSTR sDesc,PPOWER_POLICY pp,LPARAM lParam)312 BOOLEAN CALLBACK test_callback_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc,
313 LPWSTR sDesc, PPOWER_POLICY pp,LPARAM lParam )
314 {
315 ok(uiIndex == g_NumPwrSchemes, "expected power scheme index of %d but got %d\n", g_NumPwrSchemes, uiIndex);
316 g_NumPwrSchemes++;
317
318 ok(lParam == 0xDEADBEEF, "expected function lParam to be 0xDEADBEEF but got %d\n", (UINT)lParam);
319
320 return TRUE;
321 }
322
test_callback_stop_EnumPwrScheme(UINT uiIndex,DWORD dwName,LPWSTR sName,DWORD dwDesc,LPWSTR sDesc,PPOWER_POLICY pp,LPARAM lParam)323 BOOLEAN CALLBACK test_callback_stop_EnumPwrScheme(UINT uiIndex, DWORD dwName, LPWSTR sName, DWORD dwDesc,
324 LPWSTR sDesc, PPOWER_POLICY pp,LPARAM lParam )
325 {
326 ok((!uiIndex || g_NumPwrSchemesEnumerated + 1 == uiIndex), "expected power scheme %d but got %d\n",g_NumPwrSchemesEnumerated+1, uiIndex);
327 g_NumPwrSchemesEnumerated = 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 }
335
test_DeletePwrScheme(void)336 void test_DeletePwrScheme(void)
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
353 retval = GetActivePwrScheme(&g_ActivePwrScheme);
354 ok(retval, "function was expected to succeed, error %x\n",(UINT)GetLastError());
355
356 retval = DeletePwrScheme(g_ActivePwrScheme);
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 */
363 retval = DeletePwrScheme(g_TempPwrScheme);
364 ok(retval, "function should have succeeded\n");
365
366 /*
367 * clean up, delete illegal entry, witch was created for this test
368 */
369
370 if (RegOpenKeyW(HKEY_LOCAL_MACHINE, szMachPowerPoliciesSubKey, &hSubKey) == ERROR_SUCCESS)
371 {
372 if (RegDeleteKeyW(hSubKey, szTempPwrScheme) != STATUS_SUCCESS)
373 printf("#1 failed to delete subkey %i (testentry)\n", g_TempPwrScheme);
374 RegCloseKey(hSubKey);
375 }
376
377 }
378
test_EnumPwrSchemes(void)379 void test_EnumPwrSchemes(void)
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
403 retval = EnumPwrSchemes(test_callback_stop_EnumPwrScheme, (LPARAM)0);
404 ok(!retval, "function was expected to false\n");
405
406 /*
407 * enumerate half of all avalailble profiles
408 */
409
410 g_NumPwrSchemesEnumerated = 0;
411 retval = EnumPwrSchemes(test_callback_stop_EnumPwrScheme, (LPARAM)g_NumPwrSchemes / 2);
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 }
417
test_GetSetActivePwrScheme(void)418 void test_GetSetActivePwrScheme(void)
419 {
420 DWORD retval;
421 UINT current_scheme = 2;
422 UINT temp_scheme = 0;
423
424 /*
425 * read active power scheme
426 */
427
428 retval = GetActivePwrScheme(&g_ActivePwrScheme);
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
461 retval = SetActivePwrScheme(g_ActivePwrScheme, 0, 0);
462 ok(retval, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
463 }
464
test_GetCurrentPowerPolicies(void)465 void test_GetCurrentPowerPolicies(void)
466 {
467 GLOBAL_POWER_POLICY gpp;
468 POWER_POLICY pp;
469 BOOLEAN ret;
470 UINT current_scheme = 2;
471
472 g_ActivePwrScheme=3;
473 ret = GetActivePwrScheme(&g_ActivePwrScheme);
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
495 ret = SetActivePwrScheme(g_ActivePwrScheme, 0, 0);
496 ok(ret, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
497
498 ret = GetCurrentPowerPolicies(0,0);
499 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
500
501 ret = GetCurrentPowerPolicies(&gpp,0);
502 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
503
504 ret = GetCurrentPowerPolicies(0,&pp);
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
515 ret = GetActivePwrScheme(&g_ActivePwrScheme);
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
536 ret = SetActivePwrScheme(g_ActivePwrScheme, 0, 0);
537 ok(ret, "Warning: failed to restore old active power scheme %d\n", (UINT)g_ActivePwrScheme);
538
539 }
540
test_GetPwrCapabilities(void)541 void test_GetPwrCapabilities(void)
542 {
543 SYSTEM_POWER_CAPABILITIES spc;
544 BOOLEAN ret;
545
546 ret = GetPwrCapabilities(0);
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 }
555
test_GetPwrDiskSpindownRange(void)556 void test_GetPwrDiskSpindownRange(void)
557 {
558 DWORD retval;
559 UINT min = 0;
560 UINT max = 0;
561
562 /*
563 * invalid parameter checks
564 */
565
566 retval = GetPwrDiskSpindownRange(NULL, NULL);
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 }
586
test_IsAdminOverrideActive(void)587 void test_IsAdminOverrideActive(void)
588 {
589 ADMINISTRATOR_POWER_POLICY app;
590 BOOLEAN ret;
591
592 ret = IsAdminOverrideActive(0);
593 ok(!ret, "function was expected to fail\n");
594
595 ret = IsAdminOverrideActive(&app);
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
605 ret = IsAdminOverrideActive(&app);
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
615 ret = IsAdminOverrideActive(&app);
616 ok(!ret, "function was expected to fail\n");
617
618 }
619
test_IsPwrHibernateAllowed(void)620 void test_IsPwrHibernateAllowed(void)
621 {
622 /*
623 BOOLEAN ret;
624
625 ret = IsPwrHibernateAllowed();
626 ok(!ret, "function was expected to fail\n");
627 */
628 }
629
test_IsPwrShutdownAllowed(void)630 void test_IsPwrShutdownAllowed(void)
631 {
632 /*
633 BOOLEAN ret;
634
635 ret = IsPwrShutdownAllowed();
636 ok(ret, "function was expected to succeed, error %x\n",(UINT)GetLastError());
637 */
638 }
639
test_IsPwrSuspendAllowed(void)640 void test_IsPwrSuspendAllowed(void)
641 {
642 /*
643 BOOLEAN ret;
644
645 ret = IsPwrSuspendAllowed();
646 ok(ret, "function was expected to succed, error %x\n",(UINT)GetLastError());
647 */
648 }
649
test_ReadGlobalPwrPolicy(void)650 void test_ReadGlobalPwrPolicy(void)
651 {
652 GLOBAL_POWER_POLICY gpp;
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 }
663
test_ReadProcessorPwrScheme(void)664 void test_ReadProcessorPwrScheme(void)
665 {
666 MACHINE_PROCESSOR_POWER_POLICY mppp;
667 BOOLEAN ret;
668 UINT i = 0;
669 DWORD err;
670
671 do
672 {
673 RtlZeroMemory(&mppp, sizeof(MACHINE_PROCESSOR_POWER_POLICY));
674 ret = ReadProcessorPwrScheme(i,&mppp);
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 }
693
test_ReadPwrScheme(void)694 void test_ReadPwrScheme(void)
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
717 retval = ReadPwrScheme(g_ActivePwrScheme, &g_PowerPolicy);
718 ok(retval, "function was expected to succeed error %x\n",(UINT)GetLastError());
719
720 }
721
test_SetSuspendState(void)722 void test_SetSuspendState(void)
723 {
724 // SetSuspendState(FALSE,FALSE,FALSE)
725 }
726
727
globalcompare(GLOBAL_POWER_POLICY gpp,GLOBAL_POWER_POLICY gpp_compare)728 BOOLEAN globalcompare(GLOBAL_POWER_POLICY gpp, GLOBAL_POWER_POLICY gpp_compare)
729 {
730 //return TRUE;
731 int i,j;
732 BOOLEAN ret;
733
734 ret = TRUE;
735 if (gpp.mach.BroadcastCapacityResolution != gpp_compare.mach.BroadcastCapacityResolution)
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 }
761 if (gpp.user.PowerButtonAc.EventCode != gpp_compare.user.PowerButtonAc.EventCode)
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 }
776 if (gpp.user.PowerButtonDc.EventCode != gpp_compare.user.PowerButtonDc.EventCode)
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 }
791 if (gpp.user.SleepButtonAc.EventCode != gpp_compare.user.SleepButtonAc.EventCode)
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 }
806 if (gpp.user.SleepButtonDc.EventCode != gpp_compare.user.SleepButtonDc.EventCode)
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 }
862 if (gpp.user.DischargePolicy[i].BatteryLevel != gpp_compare.user.DischargePolicy[i].BatteryLevel)
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 }
867 if (gpp.user.DischargePolicy[i].PowerPolicy.Action != gpp_compare.user.DischargePolicy[i].PowerPolicy.Action)
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 }
872 if (gpp.user.DischargePolicy[i].PowerPolicy.Flags != gpp_compare.user.DischargePolicy[i].PowerPolicy.Flags)
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 }
877 if (gpp.user.DischargePolicy[i].PowerPolicy.EventCode != gpp_compare.user.DischargePolicy[i].PowerPolicy.EventCode)
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 }
882 if (gpp.user.DischargePolicy[i].MinSystemState != gpp_compare.user.DischargePolicy[i].MinSystemState)
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 }
compare(POWER_POLICY pp,POWER_POLICY pp_compare)900 BOOLEAN compare(POWER_POLICY pp, POWER_POLICY pp_compare)
901 {
902 //return TRUE;
903 BOOLEAN ret=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 }
935 if (pp.mach.ReducedLatencySleepAc != pp_compare.mach.ReducedLatencySleepAc)
936 {
937 printf("mach.ReducedLatencySleepAc failed %i != %i\n",pp.mach.ReducedLatencySleepAc,pp_compare.mach.ReducedLatencySleepAc);
938 ret = FALSE;
939 }
940 if (pp.mach.ReducedLatencySleepDc != pp_compare.mach.ReducedLatencySleepDc)
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
956 if (pp.mach.OverThrottledAc.Action != pp_compare.mach.OverThrottledAc.Action)
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 }
966 if (pp.mach.OverThrottledAc.EventCode != pp_compare.mach.OverThrottledAc.EventCode)
967 {
968 printf("mach.OverThrottledAc.EventCode failed %lu != %lu\n",pp.mach.OverThrottledAc.EventCode,pp_compare.mach.OverThrottledAc.EventCode);
969 ret = FALSE;
970 }
971 if (pp.mach.OverThrottledDc.Action != pp_compare.mach.OverThrottledDc.Action)
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 }
981 if (pp.mach.OverThrottledDc.EventCode != pp_compare.mach.OverThrottledDc.EventCode)
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 }
1119 if (pp.user.FanThrottleToleranceAc != pp_compare.user.FanThrottleToleranceAc)
1120 {
1121 printf("user.FanThrottleToleranceAc failed %i != %i\n",pp.user.FanThrottleToleranceAc,pp_compare.user.FanThrottleToleranceAc);
1122 ret = FALSE;
1123 }
1124 if (pp.user.FanThrottleToleranceDc != pp_compare.user.FanThrottleToleranceDc)
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 }
1147
test_ValidatePowerPolicies_Old(void)1148 void test_ValidatePowerPolicies_Old(void)
1149 {
1150 GLOBAL_POWER_POLICY gpp;
1151 POWER_POLICY pp;
1152 BOOLEAN ret;
1153
1154 RtlZeroMemory(&gpp, sizeof(GLOBAL_POWER_POLICY));
1155 RtlZeroMemory(&pp, sizeof(POWER_POLICY));
1156
1157 SetLastError(0);
1158 ret = ValidatePowerPolicies(0,0);
1159 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1160
1161 ret = ValidatePowerPolicies(&gpp,0);
1162 ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
1163 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());
1164
1165 ret = ValidatePowerPolicies(0,&pp);
1166 ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
1167 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1168
1169 ret = ValidatePowerPolicies(&gpp,&pp);
1170 ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
1171 ok(GetLastError() == ERROR_REVISION_MISMATCH,"function was expected to fail with ERROR_REVISION_MISMATCH, but error :%i\n",(UINT)GetLastError());
1172
1173 gpp.user.Revision = 1;
1174 gpp.mach.Revision = 1;
1175
1176 ret = ValidatePowerPolicies(&gpp,0);
1177 ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
1178 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1179
1180 gpp.mach.LidOpenWakeAc = PowerSystemWorking;
1181 gpp.mach.LidOpenWakeDc = PowerSystemWorking;
1182
1183 ret = ValidatePowerPolicies(&gpp,0);
1184 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1185
1186 gpp.user.PowerButtonAc.Action = PowerActionNone;
1187 gpp.user.PowerButtonDc.Action = PowerActionNone;
1188 gpp.user.SleepButtonAc.Action = PowerActionNone;
1189 gpp.user.SleepButtonDc.Action = PowerActionNone;
1190 gpp.user.LidCloseAc.Action = PowerActionNone;
1191 gpp.user.LidCloseDc.Action = PowerActionNone;
1192
1193 gpp.user.DischargePolicy[0].Enable=FALSE;
1194 gpp.user.DischargePolicy[1].Enable=FALSE;
1195 gpp.user.DischargePolicy[2].Enable=FALSE;
1196 gpp.user.DischargePolicy[3].Enable=FALSE;
1197 ret = ValidatePowerPolicies(&gpp,0);
1198 ok(ret, "function was expected to succeed return %i\n",(UINT)GetLastError());
1199 if (!ret)
1200 {
1201 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1202 }
1203
1204 pp.user.Revision = 1;
1205 pp.mach.Revision = 1;
1206
1207 ret = ValidatePowerPolicies(0,&pp);
1208 ok(!ret, "function was expected to fail return %i\n",(UINT)ret);
1209 ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE or ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1210
1211 pp.mach.MinSleepAc = PowerSystemWorking;
1212 pp.mach.MinSleepDc = PowerSystemWorking;
1213 pp.mach.ReducedLatencySleepAc = PowerSystemWorking;
1214 pp.mach.ReducedLatencySleepDc = PowerSystemWorking;
1215 pp.mach.OverThrottledAc.Action = PowerActionNone;
1216 pp.mach.OverThrottledDc.Action = PowerActionNone;
1217
1218 pp.user.IdleAc.Action = PowerActionWarmEject+1;
1219 pp.user.IdleDc.Action = PowerActionNone-1;
1220 pp.user.MaxSleepAc = PowerSystemMaximum+1;
1221 pp.user.MaxSleepDc = PowerSystemUnspecified;
1222
1223 ret = ValidatePowerPolicies(0,&pp);
1224 ok(!ret, "function was expected to fail return %i\n",(UINT)GetLastError());
1225 if (!ret)
1226 {
1227 ok(GetLastError() == ERROR_INVALID_DATA,"function was expected to fail with ERROR_INVALID_DATA, but error :%i\n",(UINT)GetLastError());
1228 }
1229
1230 pp.user.IdleAc.Action = PowerActionNone;
1231 pp.user.IdleDc.Action = PowerActionNone;
1232 pp.user.MaxSleepAc = PowerSystemWorking;
1233 pp.user.MaxSleepDc = PowerSystemWorking;
1234
1235 ret = ValidatePowerPolicies(0,&pp);
1236 ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
1237 if (!ret)
1238 {
1239 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1240 }
1241
1242 ret = ValidatePowerPolicies(&gpp,&pp);
1243 ok(ret, "function was expected to succeed, error %i\n",(UINT)GetLastError());
1244 if (!ret)
1245 {
1246 ok(GetLastError() == ERROR_GEN_FAILURE,"function was expected to fail with ERROR_GEN_FAILURE, but error :%i\n",(UINT)GetLastError());
1247 }
1248
1249
1250 ret = GetCurrentPowerPolicies(&gpp,&pp);
1251 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1252
1253 ret = ValidatePowerPolicies(&gpp,0);
1254 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1255
1256 ret = ValidatePowerPolicies(0,&pp);
1257 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1258
1259 ret = ValidatePowerPolicies(&gpp,&pp);
1260 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
1261
1262 }
1263
test_ValidatePowerPolicies(void)1264 void test_ValidatePowerPolicies(void)
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);
1282 ret = ValidatePowerPolicies(0,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
1344 gpp_original.user.PowerButtonAc.Action = PowerActionNone;
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
1355 gpp_original.user.PowerButtonDc.Action = PowerActionNone;
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
1366 gpp_original.user.SleepButtonAc.Action = PowerActionNone;
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
1377 gpp_original.user.SleepButtonDc.Action = PowerActionNone;
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
1486 pp_original.mach.ReducedLatencySleepAc = PowerSystemWorking;
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
1494 pp_original.mach.ReducedLatencySleepDc = PowerSystemWorking;
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
1502 pp_original.mach.OverThrottledAc.Action = PowerActionNone;
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
1510 pp_original.mach.OverThrottledDc.Action = PowerActionNone;
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
1542 pp_original.user.MaxSleepDc = PowerSystemUnspecified;
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;
1651 gpp_original.mach.LidOpenWakeAc=PowerSystemUnspecified;
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
1659 gpp_original.mach.LidOpenWakeAc=PowerSystemWorking;
1660 gpp_original.mach.LidOpenWakeDc=PowerSystemUnspecified;
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
1668 gpp_original.mach.LidOpenWakeDc=PowerSystemWorking;
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
1677 gpp_original.user.LidCloseAc.Action = PowerActionWarmEject;
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
1685 gpp_original.user.LidCloseDc.Action = PowerActionWarmEject;
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
1694 gpp_original.user.PowerButtonAc.Action = PowerActionNone;
1695 gpp_original.user.PowerButtonDc.Action = PowerActionWarmEject;
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
1702 gpp_original.user.SleepButtonAc.Action = PowerActionWarmEject;
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
1709 gpp_original.user.SleepButtonDc.Action = PowerActionWarmEject;
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
1717 pp_original.mach.MinSleepAc=PowerSystemUnspecified-1;
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
1732 pp_original.mach.MinSleepDc=PowerSystemUnspecified-1;
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
1747 pp_original.user.MaxSleepAc=PowerSystemUnspecified-1;
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
1762 pp_original.user.MaxSleepDc=PowerSystemUnspecified-1;
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
1777 pp_original.mach.MinSleepAc=PowerSystemUnspecified;
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
1792 pp_original.mach.MinSleepDc=PowerSystemUnspecified;
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
1807 pp_original.user.MaxSleepAc=PowerSystemUnspecified;
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
1817 pp_original.user.MaxSleepDc=PowerSystemUnspecified;
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
1827 pp_original.mach.MinSleepAc=PowerSystemWorking;
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
1841 pp_original.mach.MinSleepDc=PowerSystemWorking;
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
1855 pp_original.user.MaxSleepAc=PowerSystemWorking;
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
1871 pp_original.user.MaxSleepDc=PowerSystemWorking;
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
1886 pp_original.mach.MinSleepAc=PowerSystemSleeping1;
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
1901 pp_original.mach.MinSleepDc=PowerSystemSleeping1;
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
1916 pp_original.user.MaxSleepAc=PowerSystemSleeping1;
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
1931 pp_original.user.MaxSleepDc=PowerSystemSleeping1;
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
1946 pp_original.mach.MinSleepAc=PowerSystemSleeping2;
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
1961 pp_original.mach.MinSleepDc=PowerSystemSleeping2;
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
1976 pp_original.user.MaxSleepAc=PowerSystemSleeping2;
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
1991 pp_original.user.MaxSleepDc=PowerSystemSleeping2;
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
2006 pp_original.mach.MinSleepAc=PowerSystemSleeping3;
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
2020 pp_original.mach.MinSleepDc=PowerSystemSleeping3;
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
2033 pp_original.user.MaxSleepAc=PowerSystemSleeping3;
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
2045 pp_original.user.MaxSleepDc=PowerSystemSleeping3;
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
2056 pp_original.mach.MinSleepAc=PowerSystemHibernate;
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
2071 pp_original.mach.MinSleepDc=PowerSystemHibernate;
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
2086 pp_original.user.MaxSleepAc=PowerSystemHibernate;
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
2101 pp_original.user.MaxSleepDc=PowerSystemHibernate;
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
2116 pp_original.mach.MinSleepAc=PowerSystemShutdown;
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
2126 pp_original.mach.MinSleepDc=PowerSystemShutdown;
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
2136 pp_original.user.MaxSleepAc=PowerSystemShutdown;
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
2146 pp_original.user.MaxSleepDc=PowerSystemShutdown;
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
2156 pp_original.mach.MinSleepAc=PowerSystemMaximum;
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
2166 pp_original.mach.MinSleepDc=PowerSystemMaximum;
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
2176 pp_original.user.MaxSleepAc=PowerSystemMaximum;
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
2186 pp_original.user.MaxSleepDc=PowerSystemMaximum;
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
2236 pp_original.mach.MinSleepAc=PowerSystemWorking;
2237 pp_original.mach.MinSleepDc=PowerSystemWorking;
2238 pp_original.user.MaxSleepAc=PowerSystemWorking;
2239 pp_original.user.MaxSleepDc=PowerSystemWorking;
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;
2266 ////gpp_compare.user.DischargePolicy[0].Spare[0]=3;
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;
2275 ////gpp_compare.user.DischargePolicy[1].Spare[0]=3;
2276 //gpp_compare.user.DischargePolicy[1].Spare[3]=10;
2277 //gpp_compare.user.DischargePolicy[1].BatteryLevel=10;
2278 ////gpp_compare.user.DischargePolicy[1].PowerPolicy.Action=3;
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 }
2362
test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original)2363 void test_ValidatePowerPolicies_Next(PGLOBAL_POWER_POLICY pGPP_original,PPOWER_POLICY pPP_original)
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;
2411 pPP_original->mach.MinSleepDc=4;
2412 pPP_original->user.MaxSleepAc=4;
2413 pPP_original->user.MaxSleepDc=4;
2414 pPP_original->user.OptimizeForPowerAc=1;
2415 pPP_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
2450 pGPP_original->mach.LidOpenWakeAc=PowerSystemUnspecified;
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
2471 pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping1;
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
2482 pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping2;
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
2493 pGPP_original->mach.LidOpenWakeAc=PowerSystemSleeping3;
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
2503 pGPP_original->mach.LidOpenWakeAc=PowerSystemHibernate;
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
2580 pGPP_original->mach.LidOpenWakeDc=PowerSystemUnspecified;
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
2601 pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping1;
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
2612 pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping2;
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
2623 pGPP_original->mach.LidOpenWakeDc=PowerSystemSleeping3;
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
2633 pGPP_original->mach.LidOpenWakeDc=PowerSystemHibernate;
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
2721 pGPP_original->user.LidCloseAc.Action=PowerActionReserved;
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
2742 pGPP_original->user.LidCloseAc.Action=PowerActionHibernate;
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
2753 pGPP_original->user.LidCloseAc.Action=PowerActionShutdown;
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
2763 pGPP_original->user.LidCloseAc.Action=PowerActionShutdownReset;
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
2773 pGPP_original->user.LidCloseAc.Action=PowerActionShutdownOff;
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
2783 pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
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));
2798 ret = ValidatePowerPolicies(&gpp,&pp);
2799 ok(!ret, "function was expected to fail\n");
2800 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
2801 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2802 ok(compare(pp,pp_compare),"Difference Found\n");
2803
2804 pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject+2;
2805 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2806 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2807 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2808 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2809 ret = ValidatePowerPolicies(&gpp,&pp);
2810 ok(!ret, "function was expected to fail\n");
2811 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
2812 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2813 ok(compare(pp,pp_compare),"Difference Found\n");
2814 pGPP_original->user.LidCloseAc.Action=PowerActionWarmEject;
2815
2816
2817 pGPP_original->user.LidCloseDc.Action=PowerActionNone-2;
2818 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2819 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2820 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2821 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2822 ret = ValidatePowerPolicies(&gpp,&pp);
2823 ok(!ret, "function was expected to fail\n");
2824 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2825 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2826 ok(compare(pp,pp_compare),"Difference Found\n");
2827
2828 pGPP_original->user.LidCloseDc.Action=PowerActionNone-1;
2829 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2830 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2831 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2832 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2833 ret = ValidatePowerPolicies(&gpp,&pp);
2834 ok(!ret, "function was expected to fail\n");
2835 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2836 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2837 ok(compare(pp,pp_compare),"Difference Found\n");
2838
2839 pGPP_original->user.LidCloseDc.Action=PowerActionNone;
2840 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2841 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2842 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2843 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2844 ret = ValidatePowerPolicies(&gpp,&pp);
2845 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2846 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2847 ok(compare(pp,pp_compare),"Difference Found\n");
2848
2849 pGPP_original->user.LidCloseDc.Action=PowerActionReserved;
2850 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2851 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2852 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2853 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2854 ret = ValidatePowerPolicies(&gpp,&pp);
2855 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2856 gpp_compare.user.LidCloseDc.Action=2;
2857 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2858 ok(compare(pp,pp_compare),"Difference Found\n");
2859
2860 pGPP_original->user.LidCloseDc.Action=PowerActionSleep;
2861 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2862 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2863 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2864 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2865 ret = ValidatePowerPolicies(&gpp,&pp);
2866 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2867 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2868 ok(compare(pp,pp_compare),"Difference Found\n");
2869
2870 pGPP_original->user.LidCloseDc.Action=PowerActionHibernate;
2871 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2872 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2873 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2874 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2875 ret = ValidatePowerPolicies(&gpp,&pp);
2876 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2877 gpp_compare.user.LidCloseDc.Action=2;
2878 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2879 ok(compare(pp,pp_compare),"Difference Found\n");
2880
2881 pGPP_original->user.LidCloseDc.Action=PowerActionShutdown;
2882 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2883 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2884 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2885 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2886 ret = ValidatePowerPolicies(&gpp,&pp);
2887 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2888 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2889 ok(compare(pp,pp_compare),"Difference Found\n");
2890
2891 pGPP_original->user.LidCloseDc.Action=PowerActionShutdownReset;
2892 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2893 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2894 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2895 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2896 ret = ValidatePowerPolicies(&gpp,&pp);
2897 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2898 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2899 ok(compare(pp,pp_compare),"Difference Found\n");
2900
2901 pGPP_original->user.LidCloseDc.Action=PowerActionShutdownOff;
2902 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2903 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2904 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2905 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2906 ret = ValidatePowerPolicies(&gpp,&pp);
2907 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2908 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2909 ok(compare(pp,pp_compare),"Difference Found\n");
2910
2911 pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
2912 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2913 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2914 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2915 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2916 ret = ValidatePowerPolicies(&gpp,&pp);
2917 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2918 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2919 ok(compare(pp,pp_compare),"Difference Found\n");
2920
2921 pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+1;
2922 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2923 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2924 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2925 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2926 ret = ValidatePowerPolicies(&gpp,&pp);
2927 ok(!ret, "function was expected to fail\n");
2928 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
2929 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2930 ok(compare(pp,pp_compare),"Difference Found\n");
2931
2932 pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject+2;
2933 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2934 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2935 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2936 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2937 ret = ValidatePowerPolicies(&gpp,&pp);
2938 ok(!ret, "function was expected to fail\n");
2939 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
2940 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2941 ok(compare(pp,pp_compare),"Difference Found\n");
2942 pGPP_original->user.LidCloseDc.Action=PowerActionWarmEject;
2943
2944
2945 pGPP_original->user.PowerButtonAc.Action=PowerActionNone-2;
2946 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2947 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2948 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2949 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2950 ret = ValidatePowerPolicies(&gpp,&pp);
2951 ok(!ret, "function was expected to fail\n");
2952 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2953 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2954 ok(compare(pp,pp_compare),"Difference Found\n");
2955
2956 pGPP_original->user.PowerButtonAc.Action=PowerActionNone-1;
2957 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2958 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2959 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2960 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2961 ret = ValidatePowerPolicies(&gpp,&pp);
2962 ok(!ret, "function was expected to fail\n");
2963 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
2964 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2965 ok(compare(pp,pp_compare),"Difference Found\n");
2966
2967 pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
2968 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2969 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2970 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2971 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2972 ret = ValidatePowerPolicies(&gpp,&pp);
2973 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2974 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2975 ok(compare(pp,pp_compare),"Difference Found\n");
2976
2977 pGPP_original->user.PowerButtonAc.Action=PowerActionReserved;
2978 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2979 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2980 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2981 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2982 ret = ValidatePowerPolicies(&gpp,&pp);
2983 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2984 gpp_compare.user.PowerButtonAc.Action=2;
2985 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2986 ok(compare(pp,pp_compare),"Difference Found\n");
2987
2988 pGPP_original->user.PowerButtonAc.Action=PowerActionSleep;
2989 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2990 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
2991 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
2992 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
2993 ret = ValidatePowerPolicies(&gpp,&pp);
2994 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
2995 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
2996 ok(compare(pp,pp_compare),"Difference Found\n");
2997
2998 pGPP_original->user.PowerButtonAc.Action=PowerActionHibernate;
2999 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3000 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3001 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3002 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3003 ret = ValidatePowerPolicies(&gpp,&pp);
3004 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3005 gpp_compare.user.PowerButtonAc.Action=2;
3006 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3007 ok(compare(pp,pp_compare),"Difference Found\n");
3008
3009 pGPP_original->user.PowerButtonAc.Action=PowerActionShutdown;
3010 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3011 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3012 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3013 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3014 ret = ValidatePowerPolicies(&gpp,&pp);
3015 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3016 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3017 ok(compare(pp,pp_compare),"Difference Found\n");
3018
3019 pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownReset;
3020 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3021 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3022 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3023 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3024 ret = ValidatePowerPolicies(&gpp,&pp);
3025 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3026 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3027 ok(compare(pp,pp_compare),"Difference Found\n");
3028
3029 pGPP_original->user.PowerButtonAc.Action=PowerActionShutdownOff;
3030 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3031 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3032 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3033 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3034 ret = ValidatePowerPolicies(&gpp,&pp);
3035 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3036 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3037 ok(compare(pp,pp_compare),"Difference Found\n");
3038
3039 pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject;
3040 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3041 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3042 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3043 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3044 ret = ValidatePowerPolicies(&gpp,&pp);
3045 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3046 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3047 ok(compare(pp,pp_compare),"Difference Found\n");
3048
3049 pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+1;
3050 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3051 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3052 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3053 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3054 ret = ValidatePowerPolicies(&gpp,&pp);
3055 ok(!ret, "function was expected to fail\n");
3056 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3057 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3058 ok(compare(pp,pp_compare),"Difference Found\n");
3059
3060 pGPP_original->user.PowerButtonAc.Action=PowerActionWarmEject+2;
3061 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3062 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3063 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3064 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3065 ret = ValidatePowerPolicies(&gpp,&pp);
3066 ok(!ret, "function was expected to fail\n");
3067 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3068 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3069 ok(compare(pp,pp_compare),"Difference Found\n");
3070 pGPP_original->user.PowerButtonAc.Action=PowerActionNone;
3071
3072
3073 pGPP_original->user.PowerButtonDc.Action=PowerActionNone-2;
3074 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3075 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3076 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3077 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3078 ret = ValidatePowerPolicies(&gpp,&pp);
3079 ok(!ret, "function was expected to fail\n");
3080 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3081 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3082 ok(compare(pp,pp_compare),"Difference Found\n");
3083
3084 pGPP_original->user.PowerButtonDc.Action=PowerActionNone-1;
3085 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3086 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3087 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3088 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3089 ret = ValidatePowerPolicies(&gpp,&pp);
3090 ok(!ret, "function was expected to fail\n");
3091 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3092 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3093 ok(compare(pp,pp_compare),"Difference Found\n");
3094
3095 pGPP_original->user.PowerButtonDc.Action=PowerActionNone;
3096 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3097 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3098 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3099 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3100 ret = ValidatePowerPolicies(&gpp,&pp);
3101 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3102 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3103 ok(compare(pp,pp_compare),"Difference Found\n");
3104
3105 pGPP_original->user.PowerButtonDc.Action=PowerActionReserved;
3106 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3107 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3108 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3109 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3110 ret = ValidatePowerPolicies(&gpp,&pp);
3111 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3112 gpp_compare.user.PowerButtonDc.Action=2;
3113 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3114 ok(compare(pp,pp_compare),"Difference Found\n");
3115
3116 pGPP_original->user.PowerButtonDc.Action=PowerActionSleep;
3117 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3118 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3119 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3120 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3121 ret = ValidatePowerPolicies(&gpp,&pp);
3122 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3123 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3124 ok(compare(pp,pp_compare),"Difference Found\n");
3125
3126 pGPP_original->user.PowerButtonDc.Action=PowerActionHibernate;
3127 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3128 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3129 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3130 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3131 ret = ValidatePowerPolicies(&gpp,&pp);
3132 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3133 gpp_compare.user.PowerButtonDc.Action=2;
3134 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3135 ok(compare(pp,pp_compare),"Difference Found\n");
3136
3137 pGPP_original->user.PowerButtonDc.Action=PowerActionShutdown;
3138 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3139 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3140 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3141 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3142 ret = ValidatePowerPolicies(&gpp,&pp);
3143 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3144 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3145 ok(compare(pp,pp_compare),"Difference Found\n");
3146
3147 pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownReset;
3148 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3149 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3150 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3151 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3152 ret = ValidatePowerPolicies(&gpp,&pp);
3153 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3154 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3155 ok(compare(pp,pp_compare),"Difference Found\n");
3156
3157 pGPP_original->user.PowerButtonDc.Action=PowerActionShutdownOff;
3158 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3159 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3160 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3161 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3162 ret = ValidatePowerPolicies(&gpp,&pp);
3163 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3164 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3165 ok(compare(pp,pp_compare),"Difference Found\n");
3166
3167 pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
3168 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3169 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3170 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3171 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3172 ret = ValidatePowerPolicies(&gpp,&pp);
3173 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3174 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3175 ok(compare(pp,pp_compare),"Difference Found\n");
3176
3177 pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+1;
3178 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3179 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3180 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3181 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3182 ret = ValidatePowerPolicies(&gpp,&pp);
3183 ok(!ret, "function was expected to fail\n");
3184 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3185 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3186 ok(compare(pp,pp_compare),"Difference Found\n");
3187
3188 pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject+2;
3189 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3190 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3191 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3192 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3193 ret = ValidatePowerPolicies(&gpp,&pp);
3194 ok(!ret, "function was expected to fail\n");
3195 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3196 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3197 ok(compare(pp,pp_compare),"Difference Found\n");
3198 pGPP_original->user.PowerButtonDc.Action=PowerActionWarmEject;
3199
3200
3201 pGPP_original->user.SleepButtonAc.Action=PowerActionNone-2;
3202 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3203 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3204 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3205 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3206 ret = ValidatePowerPolicies(&gpp,&pp);
3207 ok(!ret, "function was expected to fail\n");
3208 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3209 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3210 ok(compare(pp,pp_compare),"Difference Found\n");
3211
3212 pGPP_original->user.SleepButtonAc.Action=PowerActionNone-1;
3213 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3214 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3215 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3216 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3217 ret = ValidatePowerPolicies(&gpp,&pp);
3218 ok(!ret, "function was expected to fail\n");
3219 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3220 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3221 ok(compare(pp,pp_compare),"Difference Found\n");
3222
3223 pGPP_original->user.SleepButtonAc.Action=PowerActionNone;
3224 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3225 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3226 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3227 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3228 ret = ValidatePowerPolicies(&gpp,&pp);
3229 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3230 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3231 ok(compare(pp,pp_compare),"Difference Found\n");
3232
3233 pGPP_original->user.SleepButtonAc.Action=PowerActionReserved;
3234 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3235 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3236 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3237 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3238 ret = ValidatePowerPolicies(&gpp,&pp);
3239 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3240 gpp_compare.user.SleepButtonAc.Action=2;
3241 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3242 ok(compare(pp,pp_compare),"Difference Found\n");
3243
3244 pGPP_original->user.SleepButtonAc.Action=PowerActionSleep;
3245 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3246 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3247 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3248 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3249 ret = ValidatePowerPolicies(&gpp,&pp);
3250 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3251 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3252 ok(compare(pp,pp_compare),"Difference Found\n");
3253
3254 pGPP_original->user.SleepButtonAc.Action=PowerActionHibernate;
3255 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3256 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3257 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3258 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3259 ret = ValidatePowerPolicies(&gpp,&pp);
3260 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3261 gpp_compare.user.SleepButtonAc.Action=2;
3262 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3263 ok(compare(pp,pp_compare),"Difference Found\n");
3264
3265 pGPP_original->user.SleepButtonAc.Action=PowerActionShutdown;
3266 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3267 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3268 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3269 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3270 ret = ValidatePowerPolicies(&gpp,&pp);
3271 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3272 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3273 ok(compare(pp,pp_compare),"Difference Found\n");
3274
3275 pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownReset;
3276 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3277 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3278 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3279 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3280 ret = ValidatePowerPolicies(&gpp,&pp);
3281 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3282 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3283 ok(compare(pp,pp_compare),"Difference Found\n");
3284
3285 pGPP_original->user.SleepButtonAc.Action=PowerActionShutdownOff;
3286 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3287 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3288 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3289 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3290 ret = ValidatePowerPolicies(&gpp,&pp);
3291 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3292 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3293 ok(compare(pp,pp_compare),"Difference Found\n");
3294
3295 pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
3296 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3297 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3298 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3299 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3300 ret = ValidatePowerPolicies(&gpp,&pp);
3301 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3302 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3303 ok(compare(pp,pp_compare),"Difference Found\n");
3304
3305 pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+1;
3306 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3307 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3308 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3309 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3310 ret = ValidatePowerPolicies(&gpp,&pp);
3311 ok(!ret, "function was expected to fail\n");
3312 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3313 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3314 ok(compare(pp,pp_compare),"Difference Found\n");
3315
3316 pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject+2;
3317 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3318 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3319 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3320 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3321 ret = ValidatePowerPolicies(&gpp,&pp);
3322 ok(!ret, "function was expected to fail\n");
3323 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3324 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3325 ok(compare(pp,pp_compare),"Difference Found\n");
3326 pGPP_original->user.SleepButtonAc.Action=PowerActionWarmEject;
3327
3328
3329 pGPP_original->user.SleepButtonDc.Action=PowerActionNone-2;
3330 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3331 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3332 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3333 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3334 ret = ValidatePowerPolicies(&gpp,&pp);
3335 ok(!ret, "function was expected to fail\n");
3336 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3337 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3338 ok(compare(pp,pp_compare),"Difference Found\n");
3339
3340 pGPP_original->user.SleepButtonDc.Action=PowerActionNone-1;
3341 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3342 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3343 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3344 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3345 ret = ValidatePowerPolicies(&gpp,&pp);
3346 ok(!ret, "function was expected to fail\n");
3347 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %x\n",(UINT)GetLastError());
3348 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3349 ok(compare(pp,pp_compare),"Difference Found\n");
3350
3351 pGPP_original->user.SleepButtonDc.Action=PowerActionNone;
3352 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3353 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3354 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3355 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3356 ret = ValidatePowerPolicies(&gpp,&pp);
3357 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3358 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3359 ok(compare(pp,pp_compare),"Difference Found\n");
3360
3361 pGPP_original->user.SleepButtonDc.Action=PowerActionReserved;
3362 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3363 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3364 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3365 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3366 ret = ValidatePowerPolicies(&gpp,&pp);
3367 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3368 gpp_compare.user.SleepButtonDc.Action=2;
3369 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3370 ok(compare(pp,pp_compare),"Difference Found\n");
3371
3372 pGPP_original->user.SleepButtonDc.Action=PowerActionSleep;
3373 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3374 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3375 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3376 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3377 ret = ValidatePowerPolicies(&gpp,&pp);
3378 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3379 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3380 ok(compare(pp,pp_compare),"Difference Found\n");
3381
3382 pGPP_original->user.SleepButtonDc.Action=PowerActionHibernate;
3383 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3384 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3385 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3386 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3387 ret = ValidatePowerPolicies(&gpp,&pp);
3388 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3389 gpp_compare.user.SleepButtonDc.Action=2;
3390 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3391 ok(compare(pp,pp_compare),"Difference Found\n");
3392
3393 pGPP_original->user.SleepButtonDc.Action=PowerActionShutdown;
3394 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3395 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3396 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3397 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3398 ret = ValidatePowerPolicies(&gpp,&pp);
3399 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3400 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3401 ok(compare(pp,pp_compare),"Difference Found\n");
3402
3403 pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownReset;
3404 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3405 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3406 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3407 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3408 ret = ValidatePowerPolicies(&gpp,&pp);
3409 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3410 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3411 ok(compare(pp,pp_compare),"Difference Found\n");
3412
3413 pGPP_original->user.SleepButtonDc.Action=PowerActionShutdownOff;
3414 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3415 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3416 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3417 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3418 ret = ValidatePowerPolicies(&gpp,&pp);
3419 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3420 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3421 ok(compare(pp,pp_compare),"Difference Found\n");
3422
3423 pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
3424 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3425 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3426 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3427 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3428 ret = ValidatePowerPolicies(&gpp,&pp);
3429 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3430 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3431 ok(compare(pp,pp_compare),"Difference Found\n");
3432
3433 pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+1;
3434 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3435 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3436 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3437 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3438 ret = ValidatePowerPolicies(&gpp,&pp);
3439 ok(!ret, "function was expected to fail\n");
3440 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3441 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3442 ok(compare(pp,pp_compare),"Difference Found\n");
3443
3444 pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject+2;
3445 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3446 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3447 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3448 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3449 ret = ValidatePowerPolicies(&gpp,&pp);
3450 ok(!ret, "function was expected to fail\n");
3451 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3452 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3453 ok(compare(pp,pp_compare),"Difference Found\n");
3454 pGPP_original->user.SleepButtonDc.Action=PowerActionWarmEject;
3455
3456
3457 pPP_original->mach.MinSleepAc=PowerSystemUnspecified-2;
3458 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3459 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3460 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3461 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3462 ret = ValidatePowerPolicies(&gpp,&pp);
3463 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3464 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3465 pp_compare.mach.MinSleepAc=4;
3466 ok(compare(pp,pp_compare),"Difference Found\n");
3467
3468 pPP_original->mach.MinSleepAc=PowerSystemUnspecified-1;
3469 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3470 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3471 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3472 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3473 ret = ValidatePowerPolicies(&gpp,&pp);
3474 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3475 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3476 pp_compare.mach.MinSleepAc=4;
3477 ok(compare(pp,pp_compare),"Difference Found\n");
3478
3479 pPP_original->mach.MinSleepAc=PowerSystemUnspecified;
3480 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3481 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3482 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3483 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3484 ret = ValidatePowerPolicies(&gpp,&pp);
3485 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3486 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3487 pp_compare.mach.MinSleepAc=4;
3488 ok(compare(pp,pp_compare),"Difference Found\n");
3489
3490 pPP_original->mach.MinSleepAc=PowerSystemWorking;
3491 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3492 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3493 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3494 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3495 ret = ValidatePowerPolicies(&gpp,&pp);
3496 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3497 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3498 pp_compare.mach.MinSleepAc=4;
3499 ok(compare(pp,pp_compare),"Difference Found\n");
3500
3501 pPP_original->mach.MinSleepAc=PowerSystemSleeping1;
3502 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3503 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3504 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3505 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3506 ret = ValidatePowerPolicies(&gpp,&pp);
3507 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3508 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3509 pp_compare.mach.MinSleepAc=4;
3510 ok(compare(pp,pp_compare),"Difference Found\n");
3511
3512 pPP_original->mach.MinSleepAc=PowerSystemSleeping2;
3513 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3514 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3515 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3516 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3517 ret = ValidatePowerPolicies(&gpp,&pp);
3518 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3519 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3520 pp_compare.mach.MinSleepAc=4;
3521 ok(compare(pp,pp_compare),"Difference Found\n");
3522
3523 pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
3524 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3525 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3526 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3527 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3528 ret = ValidatePowerPolicies(&gpp,&pp);
3529 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3530 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3531 ok(compare(pp,pp_compare),"Difference Found\n");
3532
3533 pPP_original->mach.MinSleepAc=PowerSystemHibernate;
3534 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3535 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3536 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3537 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3538 ret = ValidatePowerPolicies(&gpp,&pp);
3539 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3540 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3541 pp_compare.mach.MinSleepAc=4;
3542 ok(compare(pp,pp_compare),"Difference Found\n");
3543
3544 pPP_original->mach.MinSleepAc=PowerSystemShutdown;
3545 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3546 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3547 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3548 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3549 ret = ValidatePowerPolicies(&gpp,&pp);
3550 ok(!ret, "function was expected to fail\n");
3551 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3552 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3553 ok(compare(pp,pp_compare),"Difference Found\n");
3554
3555 pPP_original->mach.MinSleepAc=PowerSystemMaximum;
3556 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3557 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3558 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3559 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3560 ret = ValidatePowerPolicies(&gpp,&pp);
3561 ok(!ret, "function was expected to fail\n");
3562 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3563 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3564 ok(compare(pp,pp_compare),"Difference Found\n");
3565
3566 pPP_original->mach.MinSleepAc=PowerSystemMaximum+1;
3567 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3568 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3569 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3570 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3571 ret = ValidatePowerPolicies(&gpp,&pp);
3572 ok(!ret, "function was expected to fail\n");
3573 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3574 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3575 ok(compare(pp,pp_compare),"Difference Found\n");
3576
3577 pPP_original->mach.MinSleepAc=PowerSystemMaximum+2;
3578 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3579 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3580 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3581 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3582 ret = ValidatePowerPolicies(&gpp,&pp);
3583 ok(!ret, "function was expected to fail\n");
3584 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3585 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3586 ok(compare(pp,pp_compare),"Difference Found\n");
3587 pPP_original->mach.MinSleepAc=PowerSystemSleeping3;
3588
3589
3590 pPP_original->mach.MinSleepDc=PowerSystemUnspecified-2;
3591 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3592 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3593 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3594 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3595 ret = ValidatePowerPolicies(&gpp,&pp);
3596 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3597 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3598 pp_compare.mach.MinSleepDc=4;
3599 ok(compare(pp,pp_compare),"Difference Found\n");
3600
3601 pPP_original->mach.MinSleepDc=PowerSystemUnspecified-1;
3602 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3603 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3604 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3605 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3606 ret = ValidatePowerPolicies(&gpp,&pp);
3607 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3608 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3609 pp_compare.mach.MinSleepDc=4;
3610 ok(compare(pp,pp_compare),"Difference Found\n");
3611
3612 pPP_original->mach.MinSleepDc=PowerSystemUnspecified;
3613 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3614 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3615 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3616 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3617 ret = ValidatePowerPolicies(&gpp,&pp);
3618 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3619 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3620 pp_compare.mach.MinSleepDc=4;
3621 ok(compare(pp,pp_compare),"Difference Found\n");
3622
3623 pPP_original->mach.MinSleepDc=PowerSystemWorking;
3624 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3625 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3626 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3627 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3628 ret = ValidatePowerPolicies(&gpp,&pp);
3629 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3630 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3631 pp_compare.mach.MinSleepDc=4;
3632 ok(compare(pp,pp_compare),"Difference Found\n");
3633
3634 pPP_original->mach.MinSleepDc=PowerSystemSleeping1;
3635 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3636 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3637 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3638 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3639 ret = ValidatePowerPolicies(&gpp,&pp);
3640 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3641 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3642 pp_compare.mach.MinSleepDc=4;
3643 ok(compare(pp,pp_compare),"Difference Found\n");
3644
3645 pPP_original->mach.MinSleepDc=PowerSystemSleeping2;
3646 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3647 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3648 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3649 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3650 ret = ValidatePowerPolicies(&gpp,&pp);
3651 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3652 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3653 pp_compare.mach.MinSleepDc=4;
3654 ok(compare(pp,pp_compare),"Difference Found\n");
3655
3656 pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
3657 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3658 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3659 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3660 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3661 ret = ValidatePowerPolicies(&gpp,&pp);
3662 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3663 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3664 ok(compare(pp,pp_compare),"Difference Found\n");
3665
3666 pPP_original->mach.MinSleepDc=PowerSystemHibernate;
3667 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3668 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3669 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3670 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3671 ret = ValidatePowerPolicies(&gpp,&pp);
3672 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3673 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3674 pp_compare.mach.MinSleepDc=4;
3675 ok(compare(pp,pp_compare),"Difference Found\n");
3676
3677 pPP_original->mach.MinSleepDc=PowerSystemShutdown;
3678 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3679 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3680 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3681 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3682 ret = ValidatePowerPolicies(&gpp,&pp);
3683 ok(!ret, "function was expected to fail\n");
3684 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3685 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3686 ok(compare(pp,pp_compare),"Difference Found\n");
3687
3688 pPP_original->mach.MinSleepDc=PowerSystemMaximum;
3689 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3690 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3691 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3692 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3693 ret = ValidatePowerPolicies(&gpp,&pp);
3694 ok(!ret, "function was expected to fail\n");
3695 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3696 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3697 ok(compare(pp,pp_compare),"Difference Found\n");
3698
3699 pPP_original->mach.MinSleepDc=PowerSystemMaximum+1;
3700 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3701 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3702 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3703 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3704 ret = ValidatePowerPolicies(&gpp,&pp);
3705 ok(!ret, "function was expected to fail\n");
3706 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3707 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3708 ok(compare(pp,pp_compare),"Difference Found\n");
3709
3710 pPP_original->mach.MinSleepDc=PowerSystemMaximum+2;
3711 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3712 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3713 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3714 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3715 ret = ValidatePowerPolicies(&gpp,&pp);
3716 ok(!ret, "function was expected to fail\n");
3717 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
3718 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3719 ok(compare(pp,pp_compare),"Difference Found\n");
3720 pPP_original->mach.MinSleepDc=PowerSystemSleeping3;
3721
3722
3723 pPP_original->mach.OverThrottledAc.Action=PowerActionNone-2;
3724 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3725 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3726 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3727 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3728 ret = ValidatePowerPolicies(&gpp,&pp);
3729 ok(!ret, "function was expected to fail\n");
3730 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3731 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3732 //pp_compare.mach.OverThrottledAc.Action=4;
3733 ok(compare(pp,pp_compare),"Difference Found\n");
3734
3735 pPP_original->mach.OverThrottledAc.Action=PowerActionNone-1;
3736 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3737 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3738 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3739 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3740 ret = ValidatePowerPolicies(&gpp,&pp);
3741 ok(!ret, "function was expected to fail\n");
3742 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3743 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3744 //pp_compare.mach.OverThrottledAc.Action=4;
3745 ok(compare(pp,pp_compare),"Difference Found\n");
3746
3747 pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
3748 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3749 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3750 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3751 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3752 ret = ValidatePowerPolicies(&gpp,&pp);
3753 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3754 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3755 //pp_compare.mach.OverThrottledAc.Action=4;
3756 ok(compare(pp,pp_compare),"Difference Found\n");
3757
3758 pPP_original->mach.OverThrottledAc.Action=PowerActionReserved;
3759 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3760 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3761 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3762 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3763 ret = ValidatePowerPolicies(&gpp,&pp);
3764 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3765 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3766 //pp_compare.mach.OverThrottledAc.Action=4;
3767 pp_compare.mach.OverThrottledAc.Action=2;
3768 pp_compare.mach.pad1[2]=2;
3769 ok(compare(pp,pp_compare),"Difference Found\n");
3770
3771 pPP_original->mach.OverThrottledAc.Action=PowerActionSleep;
3772 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3773 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3774 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3775 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3776 ret = ValidatePowerPolicies(&gpp,&pp);
3777 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3778 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3779 //pp_compare.mach.OverThrottledAc.Action=4;
3780 ok(compare(pp,pp_compare),"Difference Found\n");
3781
3782 pPP_original->mach.OverThrottledAc.Action=PowerActionHibernate;
3783 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3784 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3785 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3786 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3787 ret = ValidatePowerPolicies(&gpp,&pp);
3788 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3789 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3790 pp_compare.mach.OverThrottledAc.Action=2;
3791 pp_compare.mach.pad1[2]=2;
3792 ok(compare(pp,pp_compare),"Difference Found\n");
3793
3794 pPP_original->mach.OverThrottledAc.Action=PowerActionShutdown;
3795 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3796 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3797 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3798 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3799 ret = ValidatePowerPolicies(&gpp,&pp);
3800 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3801 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3802 ok(compare(pp,pp_compare),"Difference Found\n");
3803
3804 pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownReset;
3805 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3806 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3807 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3808 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3809 ret = ValidatePowerPolicies(&gpp,&pp);
3810 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3811 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3812 //pp_compare.mach.OverThrottledAc.Action=4;
3813 ok(compare(pp,pp_compare),"Difference Found\n");
3814
3815 pPP_original->mach.OverThrottledAc.Action=PowerActionShutdownOff;
3816 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3817 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3818 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3819 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3820 ret = ValidatePowerPolicies(&gpp,&pp);
3821 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3822 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3823 ok(compare(pp,pp_compare),"Difference Found\n");
3824
3825 pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject;
3826 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3827 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3828 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3829 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3830 ret = ValidatePowerPolicies(&gpp,&pp);
3831 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3832 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3833 ok(compare(pp,pp_compare),"Difference Found\n");
3834
3835 pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+1;
3836 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3837 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3838 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3839 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3840 ret = ValidatePowerPolicies(&gpp,&pp);
3841 ok(!ret, "function was expected to fail\n");
3842 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3843 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3844 ok(compare(pp,pp_compare),"Difference Found\n");
3845
3846 pPP_original->mach.OverThrottledAc.Action=PowerActionWarmEject+2;
3847 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3848 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3849 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3850 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3851 ret = ValidatePowerPolicies(&gpp,&pp);
3852 ok(!ret, "function was expected to fail\n");
3853 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3854 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3855 ok(compare(pp,pp_compare),"Difference Found\n");
3856 pPP_original->mach.OverThrottledAc.Action=PowerActionNone;
3857
3858
3859 pPP_original->mach.OverThrottledDc.Action=PowerActionNone-2;
3860 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3861 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3862 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3863 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3864 ret = ValidatePowerPolicies(&gpp,&pp);
3865 ok(!ret, "function was expected to fail\n");
3866 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3867 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3868 //pp_compare.mach.OverThrottledDc.Action=4;
3869 ok(compare(pp,pp_compare),"Difference Found\n");
3870
3871 pPP_original->mach.OverThrottledDc.Action=PowerActionNone-1;
3872 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3873 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3874 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3875 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3876 ret = ValidatePowerPolicies(&gpp,&pp);
3877 ok(!ret, "function was expected to fail\n");
3878 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3879 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3880 //pp_compare.mach.OverThrottledDc.Action=4;
3881 ok(compare(pp,pp_compare),"Difference Found\n");
3882
3883 pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
3884 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3885 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3886 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3887 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3888 ret = ValidatePowerPolicies(&gpp,&pp);
3889 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3890 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3891 //pp_compare.mach.OverThrottledDc.Action=4;
3892 ok(compare(pp,pp_compare),"Difference Found\n");
3893
3894 pPP_original->mach.OverThrottledDc.Action=PowerActionReserved;
3895 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3896 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3897 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3898 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3899 ret = ValidatePowerPolicies(&gpp,&pp);
3900 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3901 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3902 //pp_compare.mach.OverThrottledDc.Action=4;
3903 pp_compare.mach.OverThrottledDc.Action=2;
3904 pp_compare.mach.OverThrottledAc.Action=0;
3905 pp_compare.mach.pad1[2]=0;
3906 ok(compare(pp,pp_compare),"Difference Found\n");
3907
3908 pPP_original->mach.OverThrottledDc.Action=PowerActionSleep;
3909 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3910 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3911 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3912 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3913 ret = ValidatePowerPolicies(&gpp,&pp);
3914 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3915 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3916 //pp_compare.mach.OverThrottledDc.Action=4;
3917 ok(compare(pp,pp_compare),"Difference Found\n");
3918
3919 pPP_original->mach.OverThrottledDc.Action=PowerActionHibernate;
3920 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3921 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3922 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3923 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3924 ret = ValidatePowerPolicies(&gpp,&pp);
3925 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3926 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3927 pp_compare.mach.OverThrottledDc.Action=2;
3928 pp_compare.mach.OverThrottledAc.Action=0;
3929 pp_compare.mach.pad1[2]=0;
3930 ok(compare(pp,pp_compare),"Difference Found\n");
3931
3932 pPP_original->mach.OverThrottledDc.Action=PowerActionShutdown;
3933 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3934 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3935 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3936 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3937 ret = ValidatePowerPolicies(&gpp,&pp);
3938 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3939 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3940 ok(compare(pp,pp_compare),"Difference Found\n");
3941
3942 pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownReset;
3943 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3944 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3945 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3946 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3947 ret = ValidatePowerPolicies(&gpp,&pp);
3948 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3949 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3950 //pp_compare.mach.OverThrottledDc.Action=4;
3951 ok(compare(pp,pp_compare),"Difference Found\n");
3952
3953 pPP_original->mach.OverThrottledDc.Action=PowerActionShutdownOff;
3954 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3955 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3956 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3957 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3958 ret = ValidatePowerPolicies(&gpp,&pp);
3959 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3960 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3961 ok(compare(pp,pp_compare),"Difference Found\n");
3962
3963 pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject;
3964 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3965 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3966 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3967 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3968 ret = ValidatePowerPolicies(&gpp,&pp);
3969 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
3970 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3971 ok(compare(pp,pp_compare),"Difference Found\n");
3972
3973 pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+1;
3974 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3975 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3976 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3977 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3978 ret = ValidatePowerPolicies(&gpp,&pp);
3979 ok(!ret, "function was expected to fail\n");
3980 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3981 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3982 ok(compare(pp,pp_compare),"Difference Found\n");
3983
3984 pPP_original->mach.OverThrottledDc.Action=PowerActionWarmEject+2;
3985 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3986 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3987 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
3988 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
3989 ret = ValidatePowerPolicies(&gpp,&pp);
3990 ok(!ret, "function was expected to fail\n");
3991 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
3992 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
3993 ok(compare(pp,pp_compare),"Difference Found\n");
3994 pPP_original->mach.OverThrottledDc.Action=PowerActionNone;
3995
3996
3997 pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-2;
3998 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
3999 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4000 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4001 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4002 ret = ValidatePowerPolicies(&gpp,&pp);
4003 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4004 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4005 //pp_compare.mach.ReducedLatencySleepAc=4;
4006 ok(compare(pp,pp_compare),"Difference Found\n");
4007
4008 pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified-1;
4009 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4010 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4011 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4012 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4013 ret = ValidatePowerPolicies(&gpp,&pp);
4014 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4015 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4016 //pp_compare.mach.ReducedLatencySleepAc=4;
4017 ok(compare(pp,pp_compare),"Difference Found\n");
4018
4019 pPP_original->mach.ReducedLatencySleepAc=PowerSystemUnspecified;
4020 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4021 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4022 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4023 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4024 ret = ValidatePowerPolicies(&gpp,&pp);
4025 ok(!ret, "function was expected to fail\n");
4026 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4027 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4028 //pp_compare.mach.ReducedLatencySleepAc=4;
4029 ok(compare(pp,pp_compare),"Difference Found\n");
4030
4031 pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
4032 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4033 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4034 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4035 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4036 ret = ValidatePowerPolicies(&gpp,&pp);
4037 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4038 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4039 //pp_compare.mach.ReducedLatencySleepAc=4;
4040 ok(compare(pp,pp_compare),"Difference Found\n");
4041
4042 pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping1;
4043 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4044 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4045 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4046 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4047 ret = ValidatePowerPolicies(&gpp,&pp);
4048 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4049 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4050 pp_compare.mach.ReducedLatencySleepAc=4;
4051 ok(compare(pp,pp_compare),"Difference Found\n");
4052
4053 pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping2;
4054 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4055 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4056 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4057 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4058 ret = ValidatePowerPolicies(&gpp,&pp);
4059 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4060 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4061 pp_compare.mach.ReducedLatencySleepAc=4;
4062 ok(compare(pp,pp_compare),"Difference Found\n");
4063
4064 pPP_original->mach.ReducedLatencySleepAc=PowerSystemSleeping3;
4065 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4066 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4067 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4068 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4069 ret = ValidatePowerPolicies(&gpp,&pp);
4070 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4071 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4072 ok(compare(pp,pp_compare),"Difference Found\n");
4073
4074 pPP_original->mach.ReducedLatencySleepAc=PowerSystemHibernate;
4075 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4076 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4077 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4078 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4079 ret = ValidatePowerPolicies(&gpp,&pp);
4080 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4081 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4082 pp_compare.mach.ReducedLatencySleepAc=4;
4083 ok(compare(pp,pp_compare),"Difference Found\n");
4084
4085 pPP_original->mach.ReducedLatencySleepAc=PowerSystemShutdown;
4086 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4087 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4088 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4089 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4090 ret = ValidatePowerPolicies(&gpp,&pp);
4091 ok(!ret, "function was expected to fail\n");
4092 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4093 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4094 ok(compare(pp,pp_compare),"Difference Found\n");
4095
4096 pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum;
4097 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4098 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4099 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4100 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4101 ret = ValidatePowerPolicies(&gpp,&pp);
4102 ok(!ret, "function was expected to fail\n");
4103 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4104 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4105 ok(compare(pp,pp_compare),"Difference Found\n");
4106
4107 pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+1;
4108 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4109 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4110 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4111 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4112 ret = ValidatePowerPolicies(&gpp,&pp);
4113 ok(!ret, "function was expected to fail\n");
4114 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4115 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4116 ok(compare(pp,pp_compare),"Difference Found\n");
4117
4118 pPP_original->mach.ReducedLatencySleepAc=PowerSystemMaximum+2;
4119 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4120 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4121 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4122 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4123 ret = ValidatePowerPolicies(&gpp,&pp);
4124 ok(!ret, "function was expected to fail\n");
4125 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4126 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4127 ok(compare(pp,pp_compare),"Difference Found\n");
4128 pPP_original->mach.ReducedLatencySleepAc=PowerSystemWorking;
4129
4130
4131 pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-2;
4132 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4133 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4134 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4135 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4136 ret = ValidatePowerPolicies(&gpp,&pp);
4137 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4138 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4139 //pp_compare.mach.ReducedLatencySleepDc=4;
4140 ok(compare(pp,pp_compare),"Difference Found\n");
4141
4142 pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified-1;
4143 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4144 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4145 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4146 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4147 ret = ValidatePowerPolicies(&gpp,&pp);
4148 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4149 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4150 //pp_compare.mach.ReducedLatencySleepDc=4;
4151 ok(compare(pp,pp_compare),"Difference Found\n");
4152
4153 pPP_original->mach.ReducedLatencySleepDc=PowerSystemUnspecified;
4154 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4155 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4156 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4157 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4158 ret = ValidatePowerPolicies(&gpp,&pp);
4159 ok(!ret, "function was expected to fail\n");
4160 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4161 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4162 //pp_compare.mach.ReducedLatencySleepDc=4;
4163 ok(compare(pp,pp_compare),"Difference Found\n");
4164
4165 pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
4166 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4167 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4168 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4169 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4170 ret = ValidatePowerPolicies(&gpp,&pp);
4171 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4172 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4173 //pp_compare.mach.ReducedLatencySleepDc=4;
4174 ok(compare(pp,pp_compare),"Difference Found\n");
4175
4176 pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping1;
4177 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4178 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4179 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4180 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4181 ret = ValidatePowerPolicies(&gpp,&pp);
4182 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4183 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4184 pp_compare.mach.ReducedLatencySleepDc=4;
4185 ok(compare(pp,pp_compare),"Difference Found\n");
4186
4187 pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping2;
4188 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4189 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4190 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4191 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4192 ret = ValidatePowerPolicies(&gpp,&pp);
4193 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4194 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4195 pp_compare.mach.ReducedLatencySleepDc=4;
4196 ok(compare(pp,pp_compare),"Difference Found\n");
4197
4198 pPP_original->mach.ReducedLatencySleepDc=PowerSystemSleeping3;
4199 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4200 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4201 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4202 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4203 ret = ValidatePowerPolicies(&gpp,&pp);
4204 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4205 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4206 ok(compare(pp,pp_compare),"Difference Found\n");
4207
4208 pPP_original->mach.ReducedLatencySleepDc=PowerSystemHibernate;
4209 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4210 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4211 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4212 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4213 ret = ValidatePowerPolicies(&gpp,&pp);
4214 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4215 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4216 pp_compare.mach.ReducedLatencySleepDc=4;
4217 ok(compare(pp,pp_compare),"Difference Found\n");
4218
4219 pPP_original->mach.ReducedLatencySleepDc=PowerSystemShutdown;
4220 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4221 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4222 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4223 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4224 ret = ValidatePowerPolicies(&gpp,&pp);
4225 ok(!ret, "function was expected to fail\n");
4226 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4227 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4228 ok(compare(pp,pp_compare),"Difference Found\n");
4229
4230 pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum;
4231 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4232 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4233 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4234 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4235 ret = ValidatePowerPolicies(&gpp,&pp);
4236 ok(!ret, "function was expected to fail\n");
4237 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4238 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4239 ok(compare(pp,pp_compare),"Difference Found\n");
4240
4241 pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+1;
4242 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4243 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4244 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4245 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4246 ret = ValidatePowerPolicies(&gpp,&pp);
4247 ok(!ret, "function was expected to fail\n");
4248 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4249 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4250 ok(compare(pp,pp_compare),"Difference Found\n");
4251
4252 pPP_original->mach.ReducedLatencySleepDc=PowerSystemMaximum+2;
4253 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4254 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4255 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4256 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4257 ret = ValidatePowerPolicies(&gpp,&pp);
4258 ok(!ret, "function was expected to fail\n");
4259 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %x\n",(UINT)GetLastError());
4260 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4261 ok(compare(pp,pp_compare),"Difference Found\n");
4262 pPP_original->mach.ReducedLatencySleepDc=PowerSystemWorking;
4263
4264
4265 pPP_original->user.IdleAc.Action=PowerActionNone-2;
4266 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4267 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4268 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4269 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4270 ret = ValidatePowerPolicies(&gpp,&pp);
4271 ok(!ret, "function was expected to fail\n");
4272 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4273 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4274 //pp_compare.user.IdleAc.Action=4;
4275 ok(compare(pp,pp_compare),"Difference Found\n");
4276
4277 pPP_original->user.IdleAc.Action=PowerActionNone-1;
4278 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4279 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4280 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4281 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4282 ret = ValidatePowerPolicies(&gpp,&pp);
4283 ok(!ret, "function was expected to fail\n");
4284 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4285 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4286 //pp_compare.user.IdleAc.Action=4;
4287 ok(compare(pp,pp_compare),"Difference Found\n");
4288
4289 pPP_original->user.IdleAc.Action=PowerActionNone;
4290 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4291 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4292 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4293 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4294 ret = ValidatePowerPolicies(&gpp,&pp);
4295 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4296 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4297 //pp_compare.user.IdleAc.Action=4;
4298 ok(compare(pp,pp_compare),"Difference Found\n");
4299
4300 pPP_original->user.IdleAc.Action=PowerActionReserved;
4301 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4302 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4303 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4304 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4305 ret = ValidatePowerPolicies(&gpp,&pp);
4306 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4307 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4308 //pp_compare.user.IdleAc.Action=4;
4309 pp_compare.user.IdleAc.Action=2;
4310 //pp_compare.user.pad1[2]=2;
4311 ok(compare(pp,pp_compare),"Difference Found\n");
4312
4313 pPP_original->user.IdleAc.Action=PowerActionSleep;
4314 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4315 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4316 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4317 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4318 ret = ValidatePowerPolicies(&gpp,&pp);
4319 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4320 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4321 //pp_compare.user.IdleAc.Action=4;
4322 ok(compare(pp,pp_compare),"Difference Found\n");
4323
4324 pPP_original->user.IdleAc.Action=PowerActionHibernate;
4325 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4326 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4327 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4328 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4329 ret = ValidatePowerPolicies(&gpp,&pp);
4330 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4331 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4332 pp_compare.user.IdleAc.Action=2;
4333 //pp_compare.user.pad1[2]=2;
4334 ok(compare(pp,pp_compare),"Difference Found\n");
4335
4336 pPP_original->user.IdleAc.Action=PowerActionShutdown;
4337 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4338 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4339 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4340 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4341 ret = ValidatePowerPolicies(&gpp,&pp);
4342 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4343 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4344 ok(compare(pp,pp_compare),"Difference Found\n");
4345
4346 pPP_original->user.IdleAc.Action=PowerActionShutdownReset;
4347 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4348 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4349 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4350 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4351 ret = ValidatePowerPolicies(&gpp,&pp);
4352 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4353 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4354 //pp_compare.user.IdleAc.Action=4;
4355 ok(compare(pp,pp_compare),"Difference Found\n");
4356
4357 pPP_original->user.IdleAc.Action=PowerActionShutdownOff;
4358 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4359 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4360 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4361 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4362 ret = ValidatePowerPolicies(&gpp,&pp);
4363 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4364 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4365 ok(compare(pp,pp_compare),"Difference Found\n");
4366
4367 pPP_original->user.IdleAc.Action=PowerActionWarmEject;
4368 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4369 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4370 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4371 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4372 ret = ValidatePowerPolicies(&gpp,&pp);
4373 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4374 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4375 ok(compare(pp,pp_compare),"Difference Found\n");
4376
4377 pPP_original->user.IdleAc.Action=PowerActionWarmEject+1;
4378 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4379 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4380 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4381 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4382 ret = ValidatePowerPolicies(&gpp,&pp);
4383 ok(!ret, "function was expected to fail\n");
4384 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4385 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4386 ok(compare(pp,pp_compare),"Difference Found\n");
4387
4388 pPP_original->user.IdleAc.Action=PowerActionWarmEject+2;
4389 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4390 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4391 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4392 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4393 ret = ValidatePowerPolicies(&gpp,&pp);
4394 ok(!ret, "function was expected to fail\n");
4395 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4396 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4397 ok(compare(pp,pp_compare),"Difference Found\n");
4398 pPP_original->user.IdleAc.Action=PowerActionNone;
4399
4400
4401
4402 pPP_original->user.IdleDc.Action=PowerActionNone-2;
4403 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4404 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4405 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4406 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4407 ret = ValidatePowerPolicies(&gpp,&pp);
4408 ok(!ret, "function was expected to fail\n");
4409 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4410 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4411 //pp_compare.user.IdleDc.Action=4;
4412 ok(compare(pp,pp_compare),"Difference Found\n");
4413
4414 pPP_original->user.IdleDc.Action=PowerActionNone-1;
4415 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4416 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4417 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4418 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4419 ret = ValidatePowerPolicies(&gpp,&pp);
4420 ok(!ret, "function was expected to fail\n");
4421 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4422 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4423 //pp_compare.user.IdleDc.Action=4;
4424 ok(compare(pp,pp_compare),"Difference Found\n");
4425
4426 pPP_original->user.IdleDc.Action=PowerActionNone;
4427 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4428 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4429 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4430 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4431 ret = ValidatePowerPolicies(&gpp,&pp);
4432 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4433 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4434 //pp_compare.user.IdleDc.Action=4;
4435 ok(compare(pp,pp_compare),"Difference Found\n");
4436
4437 pPP_original->user.IdleDc.Action=PowerActionReserved;
4438 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4439 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4440 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4441 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4442 ret = ValidatePowerPolicies(&gpp,&pp);
4443 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4444 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4445 //pp_compare.user.IdleDc.Action=4;
4446 pp_compare.user.IdleDc.Action=2;
4447 // pp_compare.user.pad1[2]=2;
4448 ok(compare(pp,pp_compare),"Difference Found\n");
4449
4450 pPP_original->user.IdleDc.Action=PowerActionSleep;
4451 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4452 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4453 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4454 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4455 ret = ValidatePowerPolicies(&gpp,&pp);
4456 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4457 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4458 //pp_compare.user.IdleDc.Action=4;
4459 ok(compare(pp,pp_compare),"Difference Found\n");
4460
4461 pPP_original->user.IdleDc.Action=PowerActionHibernate;
4462 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4463 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4464 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4465 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4466 ret = ValidatePowerPolicies(&gpp,&pp);
4467 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4468 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4469 pp_compare.user.IdleDc.Action=2;
4470 // pp_compare.user.pad1[2]=2;
4471 ok(compare(pp,pp_compare),"Difference Found\n");
4472
4473 pPP_original->user.IdleDc.Action=PowerActionShutdown;
4474 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4475 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4476 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4477 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4478 ret = ValidatePowerPolicies(&gpp,&pp);
4479 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4480 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4481 ok(compare(pp,pp_compare),"Difference Found\n");
4482
4483 pPP_original->user.IdleDc.Action=PowerActionShutdownReset;
4484 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4485 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4486 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4487 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4488 ret = ValidatePowerPolicies(&gpp,&pp);
4489 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4490 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4491 //pp_compare.user.IdleDc.Action=4;
4492 ok(compare(pp,pp_compare),"Difference Found\n");
4493
4494 pPP_original->user.IdleDc.Action=PowerActionShutdownOff;
4495 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4496 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4497 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4498 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4499 ret = ValidatePowerPolicies(&gpp,&pp);
4500 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4501 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4502 ok(compare(pp,pp_compare),"Difference Found\n");
4503
4504 pPP_original->user.IdleDc.Action=PowerActionWarmEject;
4505 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4506 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4507 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4508 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4509 ret = ValidatePowerPolicies(&gpp,&pp);
4510 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4511 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4512 ok(compare(pp,pp_compare),"Difference Found\n");
4513
4514 pPP_original->user.IdleDc.Action=PowerActionWarmEject+1;
4515 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4516 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4517 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4518 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4519 ret = ValidatePowerPolicies(&gpp,&pp);
4520 ok(!ret, "function was expected to fail\n");
4521 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4522 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4523 ok(compare(pp,pp_compare),"Difference Found\n");
4524
4525 pPP_original->user.IdleDc.Action=PowerActionWarmEject+2;
4526 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4527 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4528 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4529 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4530 ret = ValidatePowerPolicies(&gpp,&pp);
4531 ok(!ret, "function was expected to fail\n");
4532 ok(GetLastError() == ERROR_INVALID_DATA, "expected ERROR_INVALID_DATA but got %i\n",(UINT)GetLastError());
4533 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4534 ok(compare(pp,pp_compare),"Difference Found\n");
4535 pPP_original->user.IdleDc.Action=PowerActionNone;
4536
4537
4538 pPP_original->user.MaxSleepAc=PowerSystemUnspecified-2;
4539 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4540 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4541 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4542 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4543 ret = ValidatePowerPolicies(&gpp,&pp);
4544 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4545 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4546 pp_compare.user.MaxSleepAc=4;
4547 ok(compare(pp,pp_compare),"Difference Found\n");
4548
4549 pPP_original->user.MaxSleepAc=PowerSystemUnspecified-1;
4550 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4551 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4552 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4553 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4554 ret = ValidatePowerPolicies(&gpp,&pp);
4555 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4556 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4557 pp_compare.user.MaxSleepAc=4;
4558 ok(compare(pp,pp_compare),"Difference Found\n");
4559
4560 pPP_original->user.MaxSleepAc=PowerSystemUnspecified;
4561 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4562 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4563 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4564 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4565 ret = ValidatePowerPolicies(&gpp,&pp);
4566 ok(!ret, "function was expected to fail\n");
4567 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
4568 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4569 //pp_compare.user.MaxSleepAc=4;
4570 ok(compare(pp,pp_compare),"Difference Found\n");
4571
4572 pPP_original->user.MaxSleepAc=PowerSystemWorking;
4573 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4574 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4575 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4576 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4577 ret = ValidatePowerPolicies(&gpp,&pp);
4578 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4579 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4580 pp_compare.user.MaxSleepAc=4;
4581 ok(compare(pp,pp_compare),"Difference Found\n");
4582
4583 pPP_original->user.MaxSleepAc=PowerSystemSleeping1;
4584 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4585 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4586 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4587 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4588 ret = ValidatePowerPolicies(&gpp,&pp);
4589 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4590 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4591 pp_compare.user.MaxSleepAc=4;
4592 ok(compare(pp,pp_compare),"Difference Found\n");
4593
4594 pPP_original->user.MaxSleepAc=PowerSystemSleeping2;
4595 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4596 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4597 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4598 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4599 ret = ValidatePowerPolicies(&gpp,&pp);
4600 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4601 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4602 pp_compare.user.MaxSleepAc=4;
4603 ok(compare(pp,pp_compare),"Difference Found\n");
4604
4605 pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
4606 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4607 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4608 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4609 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4610 ret = ValidatePowerPolicies(&gpp,&pp);
4611 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4612 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4613 ok(compare(pp,pp_compare),"Difference Found\n");
4614
4615 pPP_original->user.MaxSleepAc=PowerSystemHibernate;
4616 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4617 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4618 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4619 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4620 ret = ValidatePowerPolicies(&gpp,&pp);
4621 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4622 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4623 pp_compare.user.MaxSleepAc=4;
4624 ok(compare(pp,pp_compare),"Difference Found\n");
4625
4626 pPP_original->user.MaxSleepAc=PowerSystemShutdown;
4627 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4628 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4629 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4630 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4631 ret = ValidatePowerPolicies(&gpp,&pp);
4632 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4633 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4634 pp_compare.user.MaxSleepAc=4;
4635 ok(compare(pp,pp_compare),"Difference Found\n");
4636
4637 pPP_original->user.MaxSleepAc=PowerSystemMaximum;
4638 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4639 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4640 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4641 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4642 ret = ValidatePowerPolicies(&gpp,&pp);
4643 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4644 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4645 pp_compare.user.MaxSleepAc=4;
4646 ok(compare(pp,pp_compare),"Difference Found\n");
4647
4648 pPP_original->user.MaxSleepAc=PowerSystemMaximum+1;
4649 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4650 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4651 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4652 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4653 ret = ValidatePowerPolicies(&gpp,&pp);
4654 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4655 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4656 pp_compare.user.MaxSleepAc=4;
4657 ok(compare(pp,pp_compare),"Difference Found\n");
4658
4659 pPP_original->user.MaxSleepAc=PowerSystemMaximum+2;
4660 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4661 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4662 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4663 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4664 ret = ValidatePowerPolicies(&gpp,&pp);
4665 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4666 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4667 pp_compare.user.MaxSleepAc=4;
4668 ok(compare(pp,pp_compare),"Difference Found\n");
4669 pPP_original->user.MaxSleepAc=PowerSystemSleeping3;
4670
4671
4672 pPP_original->user.MaxSleepDc=PowerSystemUnspecified-2;
4673 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4674 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4675 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4676 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4677 ret = ValidatePowerPolicies(&gpp,&pp);
4678 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4679 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4680 pp_compare.user.MaxSleepDc=4;
4681 ok(compare(pp,pp_compare),"Difference Found\n");
4682
4683 pPP_original->user.MaxSleepDc=PowerSystemUnspecified-1;
4684 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4685 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4686 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4687 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4688 ret = ValidatePowerPolicies(&gpp,&pp);
4689 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4690 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4691 pp_compare.user.MaxSleepDc=4;
4692 ok(compare(pp,pp_compare),"Difference Found\n");
4693
4694 pPP_original->user.MaxSleepDc=PowerSystemUnspecified;
4695 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4696 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4697 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4698 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4699 ret = ValidatePowerPolicies(&gpp,&pp);
4700 ok(!ret, "function was expected to fail\n");
4701 ok(GetLastError() == ERROR_GEN_FAILURE, "expected ERROR_GEN_FAILURE but got %i\n",(UINT)GetLastError());
4702 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4703 //pp_compare.user.MaxSleepDc=4;
4704 ok(compare(pp,pp_compare),"Difference Found\n");
4705
4706 pPP_original->user.MaxSleepDc=PowerSystemWorking;
4707 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4708 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4709 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4710 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4711 ret = ValidatePowerPolicies(&gpp,&pp);
4712 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4713 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4714 pp_compare.user.MaxSleepDc=4;
4715 ok(compare(pp,pp_compare),"Difference Found\n");
4716
4717 pPP_original->user.MaxSleepDc=PowerSystemSleeping1;
4718 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4719 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4720 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4721 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4722 ret = ValidatePowerPolicies(&gpp,&pp);
4723 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4724 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4725 pp_compare.user.MaxSleepDc=4;
4726 ok(compare(pp,pp_compare),"Difference Found\n");
4727
4728 pPP_original->user.MaxSleepDc=PowerSystemSleeping2;
4729 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4730 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4731 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4732 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4733 ret = ValidatePowerPolicies(&gpp,&pp);
4734 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4735 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4736 pp_compare.user.MaxSleepDc=4;
4737 ok(compare(pp,pp_compare),"Difference Found\n");
4738
4739 pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
4740 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4741 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4742 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4743 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4744 ret = ValidatePowerPolicies(&gpp,&pp);
4745 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4746 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4747 ok(compare(pp,pp_compare),"Difference Found\n");
4748
4749 pPP_original->user.MaxSleepDc=PowerSystemHibernate;
4750 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4751 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4752 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4753 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4754 ret = ValidatePowerPolicies(&gpp,&pp);
4755 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4756 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4757 pp_compare.user.MaxSleepDc=4;
4758 ok(compare(pp,pp_compare),"Difference Found\n");
4759
4760 pPP_original->user.MaxSleepDc=PowerSystemShutdown;
4761 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4762 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4763 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4764 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4765 ret = ValidatePowerPolicies(&gpp,&pp);
4766 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4767 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4768 pp_compare.user.MaxSleepDc=4;
4769 ok(compare(pp,pp_compare),"Difference Found\n");
4770
4771 pPP_original->user.MaxSleepDc=PowerSystemMaximum;
4772 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4773 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4774 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4775 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4776 ret = ValidatePowerPolicies(&gpp,&pp);
4777 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4778 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4779 pp_compare.user.MaxSleepDc=4;
4780 ok(compare(pp,pp_compare),"Difference Found\n");
4781
4782 pPP_original->user.MaxSleepDc=PowerSystemMaximum+1;
4783 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4784 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4785 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4786 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4787 ret = ValidatePowerPolicies(&gpp,&pp);
4788 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4789 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4790 pp_compare.user.MaxSleepDc=4;
4791 ok(compare(pp,pp_compare),"Difference Found\n");
4792
4793 pPP_original->user.MaxSleepDc=PowerSystemMaximum+2;
4794 memcpy(&gpp, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4795 memcpy(&gpp_compare, pGPP_original, sizeof(GLOBAL_POWER_POLICY));
4796 memcpy(&pp, pPP_original, sizeof(POWER_POLICY));
4797 memcpy(&pp_compare, pPP_original, sizeof(POWER_POLICY));
4798 ret = ValidatePowerPolicies(&gpp,&pp);
4799 ok(ret, "function was expected to succeed error %i\n",(UINT)GetLastError());
4800 ok(globalcompare(gpp,gpp_compare),"Difference Found\n");
4801 pp_compare.user.MaxSleepDc=4;
4802 ok(compare(pp,pp_compare),"Difference Found\n");
4803 pPP_original->user.MaxSleepDc=PowerSystemSleeping3;
4804
4805 }
4806
test_WriteGlobalPwrPolicy(void)4807 void test_WriteGlobalPwrPolicy(void)
4808 {
4809 // WriteGlobalPwrPolicy(&gpp);
4810 }
4811
test_WriteProcessorPwrScheme(void)4812 void test_WriteProcessorPwrScheme(void)
4813 {
4814 // WriteProcessorPwrScheme(0,&mppp);
4815 }
4816
test_WritePwrScheme(void)4817 void test_WritePwrScheme(void)
4818 {
4819 DWORD retval;
4820 HKEY hSubKey;
4821 LONG lSize;
4822 LONG Err;
4823 WCHAR szPath[MAX_PATH];
4824 static const WCHAR szTestSchemeName[] = {'P','o','w','r','p','r','o','f',0};
4825 static const WCHAR szTestSchemeDesc[] = {'P','o','w','r','p','r','o','f',' ','S','c','h','e','m','e',0};
4826
4827 /*
4828 * create a temporarly profile, will be deleted in test_DeletePwrScheme
4829 */
4830
4831 retval = WritePwrScheme(&g_TempPwrScheme, (LPWSTR)szTestSchemeName, (LPWSTR)szTestSchemeDesc, &g_PowerPolicy);
4832 ok(retval, "Warning: function should have succeeded\n");
4833 if (RegOpenKeyW(HKEY_LOCAL_MACHINE, szMachPowerPoliciesSubKey, &hSubKey) == ERROR_SUCCESS)
4834 {
4835 lSize = MAX_PATH * sizeof(WCHAR);
4836 Err = RegQueryValueW(hSubKey, szTempPwrScheme, szPath, &lSize);
4837 if (Err != STATUS_SUCCESS)
4838 printf("#1 failed to query subkey %i (testentry)\n", g_TempPwrScheme);
4839 RegCloseKey(hSubKey);
4840 }
4841
4842 }
4843
func_power(void)4844 void func_power(void)
4845 {
4846 if (1)
4847 skip("CallNtPowerInformation test is broken and fails on Windows\n");
4848 else
4849 test_CallNtPowerInformation();
4850 test_CanUserWritePwrScheme();
4851 test_EnumPwrSchemes();
4852 test_GetSetActivePwrScheme();
4853 test_ReadPwrScheme();
4854 test_WritePwrScheme();
4855 test_DeletePwrScheme();
4856 test_GetPwrDiskSpindownRange();
4857
4858 test_GetCurrentPowerPolicies();
4859
4860 test_GetPwrCapabilities();
4861 test_IsAdminOverrideActive();
4862 test_IsPwrHibernateAllowed();
4863 test_IsPwrShutdownAllowed();
4864 test_IsPwrSuspendAllowed();
4865 test_ReadGlobalPwrPolicy();
4866 test_ReadProcessorPwrScheme();
4867 test_SetSuspendState();
4868 if (1)
4869 skip("ValidatePowerPolicies tests are broken and fail on Windows\n");
4870 else
4871 {
4872 test_ValidatePowerPolicies_Old();
4873 test_ValidatePowerPolicies();
4874 }
4875 test_WriteGlobalPwrPolicy();
4876 test_WriteProcessorPwrScheme();
4877
4878 }
4879