1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for NtQuery/SetSystemInformation
5  * PROGRAMMERS:     Timo Kreuzer
6  *                  Thomas Faber <thomas.faber@reactos.org>
7  */
8 
9 #include <apitest.h>
10 
11 #define WIN32_NO_STATUS
12 #include <ndk/exfuncs.h>
13 #include <ndk/rtlfuncs.h>
14 #include <ndk/setypes.h>
15 
16 #define ntv6(x) (LOBYTE(LOWORD(GetVersion())) >= 6 ? (x) : 0)
17 
18 static
19 void
20 Test_Flags(void)
21 {
22     NTSTATUS Status;
23     ULONG ReturnLength;
24     ULONG Flags;
25     ULONG Buffer[2];
26     ULONG Buffer2[2];
27     PSYSTEM_FLAGS_INFORMATION FlagsInfo = (PVOID)Buffer;
28     BOOLEAN PrivilegeEnabled;
29 
30     /* Query */
31     ReturnLength = 0x55555555;
32     Status = NtQuerySystemInformation(SystemFlagsInformation, NULL, 0, &ReturnLength);
33     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
34     ok(ReturnLength == 0 ||
35        ntv6(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
36 
37     ReturnLength = 0x55555555;
38     Status = NtQuerySystemInformation(SystemFlagsInformation, NULL, sizeof(SYSTEM_FLAGS_INFORMATION) - 1, &ReturnLength);
39     ok(Status == STATUS_ACCESS_VIOLATION, "NtQuerySystemInformation returned %lx\n", Status);
40     ok(ReturnLength == 0x55555555, "ReturnLength = %lu\n", ReturnLength);
41 
42     ReturnLength = 0x55555555;
43     Status = NtQuerySystemInformation(SystemFlagsInformation, (PVOID)2, 0, &ReturnLength);
44     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
45     ok(ReturnLength == 0 ||
46        ntv6(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
47 
48     ReturnLength = 0x55555555;
49     Status = NtQuerySystemInformation(SystemFlagsInformation, (PVOID)4, 0, &ReturnLength);
50     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
51     ok(ReturnLength == 0 ||
52        ntv6(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
53 
54     ReturnLength = 0x55555555;
55     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
56     Status = NtQuerySystemInformation(SystemFlagsInformation, (PUCHAR)FlagsInfo + 2, sizeof(SYSTEM_FLAGS_INFORMATION), &ReturnLength);
57     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtQuerySystemInformation returned %lx\n", Status);
58     ok(ReturnLength == 0x55555555, "ReturnLength = %lu\n", ReturnLength);
59     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
60     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
61 
62     ReturnLength = 0x55555555;
63     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
64     Status = NtQuerySystemInformation(SystemFlagsInformation, (PUCHAR)FlagsInfo + 2, sizeof(SYSTEM_FLAGS_INFORMATION) - 1, &ReturnLength);
65     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtQuerySystemInformation returned %lx\n", Status);
66     ok(ReturnLength == 0x55555555, "ReturnLength = %lu\n", ReturnLength);
67     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
68     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
69 
70     ReturnLength = 0x55555555;
71     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
72     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION) - 1, &ReturnLength);
73     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
74     ok(ReturnLength == 0 ||
75        ntv6(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
76     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
77     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
78 
79     ReturnLength = 0x55555555;
80     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
81     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), &ReturnLength);
82     ok(Status == STATUS_SUCCESS, "NtQuerySystemInformation returned %lx\n", Status);
83     ok(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION), "ReturnLength = %lu\n", ReturnLength);
84     ok(FlagsInfo->Flags != 0x55555555, "Flags = %lx\n", FlagsInfo->Flags);
85     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
86     Flags = FlagsInfo->Flags;
87 
88     ReturnLength = 0x55555555;
89     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
90     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION) + 1, &ReturnLength);
91     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
92     ok(ReturnLength == 0 ||
93        ntv6(ReturnLength == sizeof(SYSTEM_FLAGS_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
94     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
95     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
96 
97     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
98     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), NULL);
99     ok(Status == STATUS_SUCCESS, "NtQuerySystemInformation returned %lx\n", Status);
100     ok(FlagsInfo->Flags == Flags, "Flags = %lx, expected %lx\n", FlagsInfo->Flags, Flags);
101     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
102 
103     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
104     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), (PVOID)4);
105     ok(Status == STATUS_ACCESS_VIOLATION, "NtQuerySystemInformation returned %lx\n", Status);
106     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
107     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
108 
109     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
110     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), (PVOID)2);
111     ok(Status == STATUS_ACCESS_VIOLATION, "NtQuerySystemInformation returned %lx\n", Status);
112     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
113     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
114 
115     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
116     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), (PVOID)1);
117     ok(Status == STATUS_ACCESS_VIOLATION, "NtQuerySystemInformation returned %lx\n", Status);
118     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
119     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
120 
121     RtlFillMemory(Buffer2, sizeof(Buffer2), 0x55);
122     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
123     Status = NtQuerySystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION), (PULONG)((PUCHAR)Buffer2 + 1));
124     ok(Status == STATUS_SUCCESS, "NtQuerySystemInformation returned %lx\n", Status);
125     ok(FlagsInfo->Flags == Flags, "Flags = %lx, expected %lx\n", FlagsInfo->Flags, Flags);
126     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
127     ok(Buffer2[0] == 0x00000455, "Buffer2[0] = %lx\n", Buffer2[0]);
128     ok(Buffer2[1] == 0x55555500, "Buffer2[1] = %lx\n", Buffer2[1]);
129 
130     /* Set */
131     Status = NtSetSystemInformation(SystemFlagsInformation, NULL, 0);
132     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtSetSystemInformation returned %lx\n", Status);
133 
134     Status = NtSetSystemInformation(SystemFlagsInformation, NULL, sizeof(SYSTEM_FLAGS_INFORMATION) - 1);
135     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtSetSystemInformation returned %lx\n", Status);
136 
137     Status = NtSetSystemInformation(SystemFlagsInformation, NULL, sizeof(SYSTEM_FLAGS_INFORMATION));
138     ok(Status == STATUS_ACCESS_DENIED, "NtSetSystemInformation returned %lx\n", Status);
139 
140     Status = NtSetSystemInformation(SystemFlagsInformation, (PVOID)2, sizeof(SYSTEM_FLAGS_INFORMATION));
141     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtSetSystemInformation returned %lx\n", Status);
142 
143     Status = RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &PrivilegeEnabled);
144     if (!NT_SUCCESS(Status))
145     {
146         skip("Cannot acquire SeDebugPrivilege\n");
147         return;
148     }
149 
150     Status = NtSetSystemInformation(SystemFlagsInformation, NULL, sizeof(SYSTEM_FLAGS_INFORMATION));
151     ok(Status == STATUS_ACCESS_VIOLATION, "NtSetSystemInformation returned %lx\n", Status);
152 
153     Status = NtSetSystemInformation(SystemFlagsInformation, (PVOID)2, sizeof(SYSTEM_FLAGS_INFORMATION));
154     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtSetSystemInformation returned %lx\n", Status);
155 
156     Status = NtSetSystemInformation(SystemFlagsInformation, (PVOID)4, sizeof(SYSTEM_FLAGS_INFORMATION));
157     ok(Status == STATUS_ACCESS_VIOLATION, "NtSetSystemInformation returned %lx\n", Status);
158 
159     FlagsInfo->Flags = Flags;
160     Status = NtSetSystemInformation(SystemFlagsInformation, (PUCHAR)FlagsInfo + 2, sizeof(SYSTEM_FLAGS_INFORMATION));
161     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtSetSystemInformation returned %lx\n", Status);
162 
163     Status = NtSetSystemInformation(SystemFlagsInformation, (PUCHAR)FlagsInfo + 2, sizeof(SYSTEM_FLAGS_INFORMATION) - 1);
164     ok(Status == STATUS_DATATYPE_MISALIGNMENT, "NtSetSystemInformation returned %lx\n", Status);
165 
166     Status = NtSetSystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION) - 1);
167     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtSetSystemInformation returned %lx\n", Status);
168 
169     Status = NtSetSystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION) + 1);
170     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtSetSystemInformation returned %lx\n", Status);
171 
172     Status = NtSetSystemInformation(SystemFlagsInformation, FlagsInfo, sizeof(SYSTEM_FLAGS_INFORMATION));
173     ok(Status == STATUS_SUCCESS, "NtSetSystemInformation returned %lx\n", Status);
174 
175     ok(FlagsInfo->Flags == Flags, "Flags = %lx, expected %lu\n", FlagsInfo->Flags, Flags);
176 
177     Status = RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, PrivilegeEnabled, FALSE, &PrivilegeEnabled);
178     ok(Status == STATUS_SUCCESS, "RtlAdjustPrivilege returned %lx\n", Status);
179 }
180 
181 static
182 void
183 Test_TimeAdjustment(void)
184 {
185     SYSTEM_QUERY_TIME_ADJUST_INFORMATION TimeInfoOrg, GetTimeInfo;
186     SYSTEM_SET_TIME_ADJUST_INFORMATION SetTimeInfo;
187     NTSTATUS Status;
188     ULONG ReturnLength;
189     BOOLEAN PrivilegeEnabled;
190 
191     SetTimeInfo.TimeAdjustment = 0;
192     SetTimeInfo.Enable = 0;
193 
194     /* Query original values */
195     Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation,
196                                       &TimeInfoOrg,
197                                       sizeof(TimeInfoOrg),
198                                       &ReturnLength);
199 
200     /* Test without privilege */
201     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
202                                     &SetTimeInfo,
203                                     sizeof(SetTimeInfo));
204     ok_ntstatus(Status, STATUS_PRIVILEGE_NOT_HELD);
205 
206     /* Get the required privilege */
207     Status = RtlAdjustPrivilege(SE_SYSTEMTIME_PRIVILEGE, TRUE, FALSE, &PrivilegeEnabled);
208     if (!NT_SUCCESS(Status))
209     {
210         skip("Cannot acquire SeSystemTimePrivilege\n");
211         return;
212     }
213 
214     /* Test wrong length */
215     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
216                                     &SetTimeInfo,
217                                     sizeof(SetTimeInfo) + 1);
218     ok_ntstatus(Status, STATUS_INFO_LENGTH_MISMATCH);
219 
220     /* Test both members 0 */
221     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
222                                     &SetTimeInfo,
223                                     sizeof(SetTimeInfo));
224     ok_ntstatus(Status, STATUS_INVALID_PARAMETER_2);
225 
226     /* Set huge value */
227     SetTimeInfo.TimeAdjustment = -1;
228     SetTimeInfo.Enable = 0;
229     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
230                                     &SetTimeInfo,
231                                     sizeof(SetTimeInfo));
232     ok_ntstatus(Status, STATUS_SUCCESS);
233 
234     /* Query the result */
235     Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation,
236                                       &GetTimeInfo,
237                                       sizeof(GetTimeInfo),
238                                       &ReturnLength);
239     ok_ntstatus(Status, STATUS_SUCCESS);
240     ok_long(GetTimeInfo.TimeAdjustment, -1);
241     ok_long(GetTimeInfo.Enable, 0);
242 
243     /* set Enable to 1 */
244     SetTimeInfo.TimeAdjustment = -1;
245     SetTimeInfo.Enable = 1;
246     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
247                                     &SetTimeInfo,
248                                     sizeof(SetTimeInfo));
249     ok_ntstatus(Status, STATUS_SUCCESS);
250 
251     /* Query the result */
252     Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation,
253                                       &GetTimeInfo,
254                                       sizeof(GetTimeInfo),
255                                       &ReturnLength);
256     ok_ntstatus(Status, STATUS_SUCCESS);
257     ok_long(GetTimeInfo.TimeAdjustment, GetTimeInfo.TimeIncrement);
258     ok_long(GetTimeInfo.Enable, 1);
259 
260     /* Restore original values */
261     SetTimeInfo.TimeAdjustment = TimeInfoOrg.TimeAdjustment;
262     SetTimeInfo.Enable = TimeInfoOrg.Enable;
263     Status = NtSetSystemInformation(SystemTimeAdjustmentInformation,
264                                     &SetTimeInfo,
265                                     sizeof(SetTimeInfo));
266     ok_ntstatus(Status, STATUS_SUCCESS);
267 
268     Status = RtlAdjustPrivilege(SE_SYSTEMTIME_PRIVILEGE, PrivilegeEnabled, FALSE, &PrivilegeEnabled);
269     ok(Status == STATUS_SUCCESS, "RtlAdjustPrivilege returned %lx\n", Status);
270 }
271 
272 static
273 void
274 Test_KernelDebugger(void)
275 {
276     NTSTATUS Status;
277     ULONG ReturnLength;
278     ULONG Buffer[2];
279     PSYSTEM_KERNEL_DEBUGGER_INFORMATION DebuggerInfo = (PVOID)Buffer;
280 
281     /* Query */
282     ReturnLength = 0x55555555;
283     Status = NtQuerySystemInformation(SystemKernelDebuggerInformation, NULL, 0, &ReturnLength);
284     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
285     ok(ReturnLength == 0 ||
286        ntv6(ReturnLength == sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
287 
288     ReturnLength = 0x55555555;
289     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
290     Status = NtQuerySystemInformation(SystemKernelDebuggerInformation, DebuggerInfo, sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION) - 1, &ReturnLength);
291     ok(Status == STATUS_INFO_LENGTH_MISMATCH, "NtQuerySystemInformation returned %lx\n", Status);
292     ok(ReturnLength == 0 ||
293        ntv6(ReturnLength == sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION)), "ReturnLength = %lu\n", ReturnLength);
294     ok(Buffer[0] == 0x55555555, "Buffer[0] = %lx\n", Buffer[0]);
295     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
296 
297     ReturnLength = 0x55555555;
298     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
299     Status = NtQuerySystemInformation(SystemKernelDebuggerInformation, (PUCHAR)DebuggerInfo + 1, sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION), &ReturnLength);
300     ok(Status == STATUS_SUCCESS, "NtQuerySystemInformation returned %lx\n", Status);
301     ok(ReturnLength == sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION), "ReturnLength = %lu\n", ReturnLength);
302     ok((Buffer[0] & 0x55fefe55) == 0x55000055, "Buffer[0] = %lx\n", Buffer[0]);
303     ok(Buffer[1] == 0x55555555, "Buffer[1] = %lx\n", Buffer[1]);
304 
305     ReturnLength = 0x55555555;
306     RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
307     Status = NtQuerySystemInformation(SystemKernelDebuggerInformation, DebuggerInfo, sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION), &ReturnLength);
308     ok(Status == STATUS_SUCCESS, "NtQuerySystemInformation returned %lx\n", Status);
309     ok(ReturnLength == sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION), "ReturnLength = %lu\n", ReturnLength);
310     ok(DebuggerInfo->KernelDebuggerEnabled == FALSE ||
311        DebuggerInfo->KernelDebuggerEnabled == TRUE, "KernelDebuggerEnabled = %u\n", DebuggerInfo->KernelDebuggerEnabled);
312     ok(DebuggerInfo->KernelDebuggerNotPresent == FALSE ||
313        DebuggerInfo->KernelDebuggerNotPresent == TRUE, "KernelDebuggerNotPresent = %u\n", DebuggerInfo->KernelDebuggerNotPresent);
314 
315     /* Set - not supported */
316     DebuggerInfo->KernelDebuggerEnabled = FALSE;
317     DebuggerInfo->KernelDebuggerNotPresent = TRUE;
318     Status = NtSetSystemInformation(SystemKernelDebuggerInformation, DebuggerInfo, sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION));
319     ok(Status == STATUS_INVALID_INFO_CLASS, "NtSetSystemInformation returned %lx\n", Status);
320 }
321 
322 START_TEST(NtSystemInformation)
323 {
324     NTSTATUS Status;
325     ULONG ReturnLength;
326 
327     Status = NtQuerySystemInformation(9999, NULL, 0, NULL);
328     ok(Status == STATUS_INVALID_INFO_CLASS, "NtQuerySystemInformation returned %lx\n", Status);
329 
330     Status = NtQuerySystemInformation(9999, NULL, 0, (PVOID)1);
331     ok(Status == STATUS_ACCESS_VIOLATION ||
332        ntv6(Status == STATUS_INVALID_INFO_CLASS), "NtQuerySystemInformation returned %lx\n", Status);
333 
334     ReturnLength = 0x55555555;
335     Status = NtQuerySystemInformation(9999, NULL, 0, &ReturnLength);
336     ok(Status == STATUS_INVALID_INFO_CLASS, "NtQuerySystemInformation returned %lx\n", Status);
337     ok(ReturnLength == 0 ||
338        ntv6(ReturnLength == 0x55555555), "ReturnLength = %lu\n", ReturnLength);
339 
340     ReturnLength = 0x55555555;
341     Status = NtQuerySystemInformation(9999, NULL, 1, &ReturnLength);
342     ok(Status == STATUS_ACCESS_VIOLATION ||
343        ntv6(Status == STATUS_INVALID_INFO_CLASS), "NtQuerySystemInformation returned %lx\n", Status);
344     ok(ReturnLength == 0x55555555, "ReturnLength = %lu\n", ReturnLength);
345 
346     ReturnLength = 0x55555555;
347     Status = NtQuerySystemInformation(9999, (PVOID)1, 1, &ReturnLength);
348     ok(Status == STATUS_DATATYPE_MISALIGNMENT ||
349        ntv6(Status == STATUS_INVALID_INFO_CLASS), "NtQuerySystemInformation returned %lx\n", Status);
350     ok(ReturnLength == 0x55555555, "ReturnLength = %lu\n", ReturnLength);
351 
352     Status = NtQuerySystemInformation(9999, NULL, 1, (PVOID)1);
353     ok(Status == STATUS_ACCESS_VIOLATION ||
354        ntv6(Status == STATUS_INVALID_INFO_CLASS), "NtQuerySystemInformation returned %lx\n", Status);
355 
356     Status = NtQuerySystemInformation(9999, (PVOID)1, 1, (PVOID)1);
357     ok(Status == STATUS_DATATYPE_MISALIGNMENT ||
358        ntv6(Status == STATUS_INVALID_INFO_CLASS), "NtQuerySystemInformation returned %lx\n", Status);
359 
360     Test_Flags();
361     Test_TimeAdjustment();
362     Test_KernelDebugger();
363 }
364