wintrust: Use helper function for setting confidence in SoftpubCheckCert.
[wine] / dlls / ntdll / tests / info.c
1 /* Unit test suite for *Information* Registry API functions
2  *
3  * Copyright 2005 Paul Vriens
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  *
19  */
20
21 #include "ntdll_test.h"
22 #include <winnls.h>
23
24 static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
25 static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
26 static NTSTATUS (WINAPI * pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
27
28 /* one_before_last_pid is used to be able to compare values of a still running process
29    with the output of the test_query_process_times and test_query_process_handlecount tests.
30 */
31 static DWORD one_before_last_pid = 0;
32
33 #define NTDLL_GET_PROC(func) do {                     \
34     p ## func = (void*)GetProcAddress(hntdll, #func); \
35     if(!p ## func) { \
36       trace("GetProcAddress(%s) failed\n", #func); \
37       return FALSE; \
38     } \
39   } while(0)
40
41 static BOOL InitFunctionPtrs(void)
42 {
43     /* All needed functions are NT based, so using GetModuleHandle is a good check */
44     HMODULE hntdll = GetModuleHandle("ntdll");
45     if (!hntdll)
46     {
47         skip("Not running on NT\n");
48         return FALSE;
49     }
50
51     NTDLL_GET_PROC(NtQuerySystemInformation);
52     NTDLL_GET_PROC(NtQueryInformationProcess);
53     NTDLL_GET_PROC(NtReadVirtualMemory);
54
55     return TRUE;
56 }
57
58 static void test_query_basic(void)
59 {
60     NTSTATUS status;
61     ULONG ReturnLength;
62     SYSTEM_BASIC_INFORMATION sbi;
63
64     /* This test also covers some basic parameter testing that should be the same for 
65      * every information class
66     */
67
68     /* Use a nonexistent info class */
69     trace("Check nonexistent info class\n");
70     status = pNtQuerySystemInformation(-1, NULL, 0, NULL);
71     ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_NOT_IMPLEMENTED /* vista */,
72         "Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08x\n", status);
73
74     /* Use an existing class but with a zero-length buffer */
75     trace("Check zero-length buffer\n");
76     status = pNtQuerySystemInformation(SystemBasicInformation, NULL, 0, NULL);
77     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
78
79     /* Use an existing class, correct length but no SystemInformation buffer */
80     trace("Check no SystemInformation buffer\n");
81     status = pNtQuerySystemInformation(SystemBasicInformation, NULL, sizeof(sbi), NULL);
82     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER /* vista */,
83         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER, got %08x\n", status);
84
85     /* Use a existing class, correct length, a pointer to a buffer but no ReturnLength pointer */
86     trace("Check no ReturnLength pointer\n");
87     status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
88     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
89
90     /* Check a too large buffer size */
91     trace("Check a too large buffer size\n");
92     status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi) * 2, &ReturnLength);
93     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
94
95     /* Finally some correct calls */
96     trace("Check with correct parameters\n");
97     status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
98     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
99     ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
100
101     /* Check if we have some return values */
102     trace("Number of Processors : %d\n", sbi.NumberOfProcessors);
103     ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n", sbi.NumberOfProcessors);
104 }
105
106 static void test_query_cpu(void)
107 {
108     DWORD status;
109     ULONG ReturnLength;
110     SYSTEM_CPU_INFORMATION sci;
111
112     status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &ReturnLength);
113     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
114     ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
115
116     /* Check if we have some return values */
117     trace("Processor FeatureSet : %08x\n", sci.FeatureSet);
118     ok( sci.FeatureSet != 0, "Expected some features for this processor, got %08x\n", sci.FeatureSet);
119 }
120
121 static void test_query_performance(void)
122 {
123     NTSTATUS status;
124     ULONG ReturnLength;
125     SYSTEM_PERFORMANCE_INFORMATION spi;
126
127     status = pNtQuerySystemInformation(SystemPerformanceInformation, &spi, 0, &ReturnLength);
128     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
129
130     status = pNtQuerySystemInformation(SystemPerformanceInformation, &spi, sizeof(spi), &ReturnLength);
131     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
132     ok( sizeof(spi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
133
134     status = pNtQuerySystemInformation(SystemPerformanceInformation, &spi, sizeof(spi) + 2, &ReturnLength);
135     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
136     ok( sizeof(spi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
137
138     /* Not return values yet, as struct members are unknown */
139 }
140
141 static void test_query_timeofday(void)
142 {
143     NTSTATUS status;
144     ULONG ReturnLength;
145
146     /* Copy of our winternl.h structure turned into a private one */
147     typedef struct _SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE {
148         LARGE_INTEGER liKeBootTime;
149         LARGE_INTEGER liKeSystemTime;
150         LARGE_INTEGER liExpTimeZoneBias;
151         ULONG uCurrentTimeZoneId;
152         DWORD dwUnknown1[5];
153     } SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE, *PSYSTEM_TIMEOFDAY_INFORMATION_PRIVATE;
154
155     SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE sti;
156   
157     /*  The struct size for NT (32 bytes) and Win2K/XP (48 bytes) differ.
158      *
159      *  Windows 2000 and XP return STATUS_INFO_LENGTH_MISMATCH if the given buffer size is greater
160      *  then 48 and 0 otherwise
161      *  Windows NT returns STATUS_INFO_LENGTH_MISMATCH when the given buffer size is not correct
162      *  and 0 otherwise
163      *
164      *  Windows 2000 and XP copy the given buffer size into the provided buffer, if the return code is STATUS_SUCCESS
165      *  NT only fills the buffer if the return code is STATUS_SUCCESS
166      *
167     */
168
169     status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength);
170
171     if (status == STATUS_INFO_LENGTH_MISMATCH)
172     {
173         trace("Windows version is NT, we have to cater for differences with W2K/WinXP\n");
174  
175         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 0, &ReturnLength);
176         ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
177         ok( 0 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
178
179         sti.uCurrentTimeZoneId = 0xdeadbeef;
180         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 28, &ReturnLength);
181         ok( 0xdeadbeef == sti.uCurrentTimeZoneId, "This part of the buffer should not have been filled\n");
182
183         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 32, &ReturnLength);
184         ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
185         ok( 32 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
186     }
187     else
188     {
189         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 0, &ReturnLength);
190         ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
191         ok( 0 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
192
193         sti.uCurrentTimeZoneId = 0xdeadbeef;
194         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 24, &ReturnLength);
195         ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
196         ok( 24 == ReturnLength, "ReturnLength should be 24, it is (%d)\n", ReturnLength);
197         ok( 0xdeadbeef == sti.uCurrentTimeZoneId, "This part of the buffer should not have been filled\n");
198     
199         sti.uCurrentTimeZoneId = 0xdeadbeef;
200         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 32, &ReturnLength);
201         ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
202         ok( 32 == ReturnLength, "ReturnLength should be 32, it is (%d)\n", ReturnLength);
203         ok( 0xdeadbeef != sti.uCurrentTimeZoneId, "Buffer should have been partially filled\n");
204     
205         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 49, &ReturnLength);
206         ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
207         ok( ReturnLength == 0 || ReturnLength == sizeof(sti) /* vista */,
208             "ReturnLength should be 0, it is (%d)\n", ReturnLength);
209     
210         status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength);
211         ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
212         ok( sizeof(sti) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
213     }
214
215     /* Check if we have some return values */
216     trace("uCurrentTimeZoneId : (%d)\n", sti.uCurrentTimeZoneId);
217 }
218
219 static void test_query_process(void)
220 {
221     NTSTATUS status;
222     DWORD last_pid;
223     ULONG ReturnLength;
224     int i = 0, k = 0;
225     int is_nt = 0;
226     SYSTEM_BASIC_INFORMATION sbi;
227
228     /* Copy of our winternl.h structure turned into a private one */
229     typedef struct _SYSTEM_PROCESS_INFORMATION_PRIVATE {
230         DWORD dwOffset;
231         DWORD dwThreadCount;
232         DWORD dwUnknown1[6];
233         FILETIME ftCreationTime;
234         FILETIME ftUserTime;
235         FILETIME ftKernelTime;
236         UNICODE_STRING ProcessName;
237         DWORD dwBasePriority;
238         DWORD dwProcessID;
239         DWORD dwParentProcessID;
240         DWORD dwHandleCount;
241         DWORD dwUnknown3;
242         DWORD dwUnknown4;
243         VM_COUNTERS vmCounters;
244         IO_COUNTERS ioCounters;
245         SYSTEM_THREAD_INFORMATION ti[1];
246     } SYSTEM_PROCESS_INFORMATION_PRIVATE, *PSYSTEM_PROCESS_INFORMATION_PRIVATE;
247
248     ULONG SystemInformationLength = sizeof(SYSTEM_PROCESS_INFORMATION_PRIVATE);
249     SYSTEM_PROCESS_INFORMATION_PRIVATE *spi, *spi_buf = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
250
251     /* Only W2K3 returns the needed length, the rest returns 0, so we have to loop */
252
253     for (;;)
254     {
255         status = pNtQuerySystemInformation(SystemProcessInformation, spi_buf, SystemInformationLength, &ReturnLength);
256
257         if (status != STATUS_INFO_LENGTH_MISMATCH) break;
258         
259         spi_buf = HeapReAlloc(GetProcessHeap(), 0, spi_buf , SystemInformationLength *= 2);
260     }
261     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
262     spi = spi_buf;
263
264     /* Get the first dwOffset, from this we can deduce the OS version we're running
265      *
266      * W2K/WinXP/W2K3:
267      *   dwOffset for a process is 184 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION)
268      * NT:
269      *   dwOffset for a process is 136 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION)
270      * Wine (with every windows version):
271      *   dwOffset for a process is 0 if just this test is running
272      *   dwOffset for a process is 184 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION) +
273      *                             ProcessName.MaximumLength
274      *     if more wine processes are running
275      *
276      * Note : On windows the first process is in fact the Idle 'process' with a thread for every processor
277     */
278
279     pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
280
281     is_nt = ( spi->dwOffset - (sbi.NumberOfProcessors * sizeof(SYSTEM_THREAD_INFORMATION)) == 136);
282
283     if (is_nt) skip("Windows version is NT, we will skip thread tests\n");
284
285     /* Check if we have some return values
286      * 
287      * On windows there will be several processes running (Including the always present Idle and System)
288      * On wine we only have one (if this test is the only wine process running)
289     */
290     
291     /* Loop through the processes */
292
293     for (;;)
294     {
295         i++;
296
297         last_pid = spi->dwProcessID;
298
299         ok( spi->dwThreadCount > 0, "Expected some threads for this process, got 0\n");
300
301         /* Loop through the threads, skip NT4 for now */
302         
303         if (!is_nt)
304         {
305             DWORD j;
306             for ( j = 0; j < spi->dwThreadCount; j++) 
307             {
308                 k++;
309                 ok ( spi->ti[j].dwOwningPID == spi->dwProcessID, 
310                      "The owning pid of the thread (%d) doesn't equal the pid (%d) of the process\n",
311                      spi->ti[j].dwOwningPID, spi->dwProcessID);
312             }
313         }
314
315         if (!spi->dwOffset) break;
316
317         one_before_last_pid = last_pid;
318
319         spi = (SYSTEM_PROCESS_INFORMATION_PRIVATE*)((char*)spi + spi->dwOffset);
320     }
321     trace("Total number of running processes : %d\n", i);
322     if (!is_nt) trace("Total number of running threads   : %d\n", k);
323
324     if (one_before_last_pid == 0) one_before_last_pid = last_pid;
325
326     HeapFree( GetProcessHeap(), 0, spi_buf);
327 }
328
329 static void test_query_procperf(void)
330 {
331     NTSTATUS status;
332     ULONG ReturnLength;
333     ULONG NeededLength;
334     SYSTEM_BASIC_INFORMATION sbi;
335     SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi;
336
337     /* Find out the number of processors */
338     status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
339     NeededLength = sbi.NumberOfProcessors * sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
340
341     sppi = HeapAlloc(GetProcessHeap(), 0, NeededLength);
342
343     status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, 0, &ReturnLength);
344     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
345
346     /* Try it for 1 processor */
347     status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi,
348                                        sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), &ReturnLength);
349     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
350     ok( sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) == ReturnLength,
351         "Inconsistent length %d\n", ReturnLength);
352  
353     /* Try it for all processors */
354     status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength, &ReturnLength);
355     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
356     ok( NeededLength == ReturnLength, "Inconsistent length (%d) <-> (%d)\n", NeededLength, ReturnLength);
357
358     /* A too large given buffer size */
359     sppi = HeapReAlloc(GetProcessHeap(), 0, sppi , NeededLength + 2);
360     status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength + 2, &ReturnLength);
361     ok( status == STATUS_SUCCESS || status == STATUS_INFO_LENGTH_MISMATCH /* vista */,
362         "Expected STATUS_SUCCESS or STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
363     ok( NeededLength == ReturnLength, "Inconsistent length (%d) <-> (%d)\n", NeededLength, ReturnLength);
364
365     HeapFree( GetProcessHeap(), 0, sppi);
366 }
367
368 static void test_query_module(void)
369 {
370     NTSTATUS status;
371     ULONG ReturnLength;
372     ULONG ModuleCount, i;
373
374     ULONG SystemInformationLength = sizeof(SYSTEM_MODULE_INFORMATION);
375     SYSTEM_MODULE_INFORMATION* smi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength); 
376     SYSTEM_MODULE* sm;
377
378     /* Request the needed length */
379     status = pNtQuerySystemInformation(SystemModuleInformation, smi, 0, &ReturnLength);
380     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
381     ok( ReturnLength > 0, "Expected a ReturnLength to show the needed length\n");
382
383     SystemInformationLength = ReturnLength;
384     smi = HeapReAlloc(GetProcessHeap(), 0, smi , SystemInformationLength);
385     status = pNtQuerySystemInformation(SystemModuleInformation, smi, SystemInformationLength, &ReturnLength);
386     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
387
388     ModuleCount = smi->ModulesCount;
389     sm = &smi->Modules[0];
390     /* our implementation is a stub for now */
391     ok( ModuleCount > 0, "Expected some modules to be loaded\n");
392
393     /* Loop through all the modules/drivers, Wine doesn't get here (yet) */
394     for (i = 0; i < ModuleCount ; i++)
395     {
396         ok( i == sm->Id, "Id (%d) should have matched %u\n", sm->Id, i);
397         sm++;
398     }
399
400     HeapFree( GetProcessHeap(), 0, smi);
401 }
402
403 static void test_query_handle(void)
404 {
405     NTSTATUS status;
406     ULONG ReturnLength;
407     ULONG SystemInformationLength = sizeof(SYSTEM_HANDLE_INFORMATION);
408     SYSTEM_HANDLE_INFORMATION* shi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
409
410     /* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
411     status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
412     todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
413
414     SystemInformationLength = ReturnLength;
415     shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength);
416     status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
417     if (status != STATUS_INFO_LENGTH_MISMATCH) /* vista */
418     {
419         ok( status == STATUS_SUCCESS,
420             "Expected STATUS_SUCCESS, got %08x\n", status);
421
422         /* Check if we have some return values */
423         trace("Number of Handles : %d\n", shi->Count);
424         todo_wine
425         {
426             /* our implementation is a stub for now */
427             ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
428         }
429     }
430     HeapFree( GetProcessHeap(), 0, shi);
431 }
432
433 static void test_query_cache(void)
434 {
435     NTSTATUS status;
436     ULONG ReturnLength;
437     SYSTEM_CACHE_INFORMATION sci;
438
439     status = pNtQuerySystemInformation(SystemCacheInformation, &sci, 0, &ReturnLength);
440     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
441
442     status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci), &ReturnLength);
443     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
444     ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
445
446     status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci) + 2, &ReturnLength);
447     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
448     ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
449 }
450
451 static void test_query_interrupt(void)
452 {
453     NTSTATUS status;
454     ULONG ReturnLength;
455     ULONG NeededLength;
456     SYSTEM_BASIC_INFORMATION sbi;
457     SYSTEM_INTERRUPT_INFORMATION* sii;
458
459     /* Find out the number of processors */
460     status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
461     NeededLength = sbi.NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION);
462
463     sii = HeapAlloc(GetProcessHeap(), 0, NeededLength);
464
465     status = pNtQuerySystemInformation(SystemInterruptInformation, sii, 0, &ReturnLength);
466     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
467
468     /* Try it for all processors */
469     status = pNtQuerySystemInformation(SystemInterruptInformation, sii, NeededLength, &ReturnLength);
470     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
471
472     /* Windows XP and W2K3 (and others?) always return 0 for the ReturnLength
473      * No test added for this as it's highly unlikely that an app depends on this
474     */
475
476     HeapFree( GetProcessHeap(), 0, sii);
477 }
478
479 static void test_query_kerndebug(void)
480 {
481     NTSTATUS status;
482     ULONG ReturnLength;
483     SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
484
485     status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, 0, &ReturnLength);
486     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
487
488     status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi), &ReturnLength);
489     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
490     ok( sizeof(skdi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
491
492     status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi) + 2, &ReturnLength);
493     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
494     ok( sizeof(skdi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
495 }
496
497 static void test_query_regquota(void)
498 {
499     NTSTATUS status;
500     ULONG ReturnLength;
501     SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
502
503     status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, 0, &ReturnLength);
504     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
505
506     status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi), &ReturnLength);
507     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
508     ok( sizeof(srqi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
509
510     status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi) + 2, &ReturnLength);
511     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
512     ok( sizeof(srqi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
513 }
514
515 static void test_query_process_basic(void)
516 {
517     NTSTATUS status;
518     ULONG ReturnLength;
519
520     typedef struct _PROCESS_BASIC_INFORMATION_PRIVATE {
521         DWORD ExitStatus;
522         DWORD PebBaseAddress;
523         DWORD AffinityMask;
524         DWORD BasePriority;
525         ULONG UniqueProcessId;
526         ULONG InheritedFromUniqueProcessId;
527     } PROCESS_BASIC_INFORMATION_PRIVATE, *PPROCESS_BASIC_INFORMATION_PRIVATE;
528
529     PROCESS_BASIC_INFORMATION_PRIVATE pbi;
530
531     /* This test also covers some basic parameter testing that should be the same for
532      * every information class
533     */
534
535     /* Use a nonexistent info class */
536     trace("Check nonexistent info class\n");
537     status = pNtQueryInformationProcess(NULL, -1, NULL, 0, NULL);
538     ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_NOT_IMPLEMENTED /* vista */,
539         "Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08x\n", status);
540
541     /* Do not give a handle and buffer */
542     trace("Check NULL handle and buffer and zero-length buffersize\n");
543     status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, NULL, 0, NULL);
544     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
545
546     /* Use a correct info class and buffer size, but still no handle and buffer */
547     trace("Check NULL handle and buffer\n");
548     status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, NULL, sizeof(pbi), NULL);
549     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
550         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
551
552     /* Use a correct info class and buffer size, but still no handle */
553     trace("Check NULL handle\n");
554     status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
555     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
556
557     /* Use a greater buffer size */
558     trace("Check NULL handle and too large buffersize\n");
559     status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, &pbi, sizeof(pbi) * 2, NULL);
560     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
561
562     /* Use no ReturnLength */
563     trace("Check NULL ReturnLength\n");
564     status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
565     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
566
567     /* Finally some correct calls */
568     trace("Check with correct parameters\n");
569     status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), &ReturnLength);
570     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
571     ok( sizeof(pbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
572
573     /* Everything is correct except a too large buffersize */
574     trace("Too large buffersize\n");
575     status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi) * 2, &ReturnLength);
576     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
577     ok( sizeof(pbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
578                                                                                                                                                
579     /* Check if we have some return values */
580     trace("ProcessID : %d\n", pbi.UniqueProcessId);
581     ok( pbi.UniqueProcessId > 0, "Expected a ProcessID > 0, got 0\n");
582 }
583
584 static void test_query_process_vm(void)
585 {
586     NTSTATUS status;
587     ULONG ReturnLength;
588     VM_COUNTERS pvi;
589
590     status = pNtQueryInformationProcess(NULL, ProcessVmCounters, NULL, sizeof(pvi), NULL);
591     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
592         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
593
594     status = pNtQueryInformationProcess(NULL, ProcessVmCounters, &pvi, sizeof(pvi), NULL);
595     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
596
597     /* Windows XP and W2K3 will report success for a size of 44 AND 48 !
598        Windows W2K will only report success for 44.
599        For now we only care for 44, which is sizeof(VM_COUNTERS)
600        If an app depends on it, we have to implement this in ntdll/process.c
601     */
602
603     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, 24, &ReturnLength);
604     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
605
606     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), &ReturnLength);
607     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
608     ok( sizeof(pvi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
609
610     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, 46, &ReturnLength);
611     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
612     ok( sizeof(pvi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
613
614     /* Check if we have some return values */
615     trace("WorkingSetSize : %ld\n", pvi.WorkingSetSize);
616     todo_wine
617     {
618         ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
619     }
620 }
621
622 static void test_query_process_io(void)
623 {
624     NTSTATUS status;
625     ULONG ReturnLength;
626     IO_COUNTERS pii;
627
628     /* NT4 doesn't support this information class, so check for it */
629     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii), &ReturnLength);
630     if (status == STATUS_NOT_SUPPORTED)
631     {
632         skip("ProcessIoCounters information class is not supported\n");
633         return;
634     }
635  
636     status = pNtQueryInformationProcess(NULL, ProcessIoCounters, NULL, sizeof(pii), NULL);
637     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
638         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
639
640     status = pNtQueryInformationProcess(NULL, ProcessIoCounters, &pii, sizeof(pii), NULL);
641     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
642
643     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, 24, &ReturnLength);
644     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
645
646     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii), &ReturnLength);
647     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
648     ok( sizeof(pii) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
649
650     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii) * 2, &ReturnLength);
651     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
652     ok( sizeof(pii) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
653
654     /* Check if we have some return values */
655     trace("OtherOperationCount : 0x%x%08x\n", (DWORD)(pii.OtherOperationCount >> 32), (DWORD)pii.OtherOperationCount);
656     todo_wine
657     {
658         ok( pii.OtherOperationCount > 0, "Expected an OtherOperationCount > 0\n");
659     }
660 }
661
662 static void test_query_process_times(void)
663 {
664     NTSTATUS status;
665     ULONG ReturnLength;
666     HANDLE process;
667     SYSTEMTIME UTC, Local;
668     KERNEL_USER_TIMES spti;
669
670     status = pNtQueryInformationProcess(NULL, ProcessTimes, NULL, sizeof(spti), NULL);
671     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
672         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
673
674     status = pNtQueryInformationProcess(NULL, ProcessTimes, &spti, sizeof(spti), NULL);
675     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
676
677     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessTimes, &spti, 24, &ReturnLength);
678     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
679
680     process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, one_before_last_pid);
681     if (!process)
682     {
683         trace("Could not open process with ID : %d, error : %u. Going to use current one.\n", one_before_last_pid, GetLastError());
684         process = GetCurrentProcess();
685         trace("ProcessTimes for current process\n");
686     }
687     else
688         trace("ProcessTimes for process with ID : %d\n", one_before_last_pid);
689
690     status = pNtQueryInformationProcess( process, ProcessTimes, &spti, sizeof(spti), &ReturnLength);
691     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
692     ok( sizeof(spti) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
693     CloseHandle(process);
694
695     FileTimeToSystemTime((const FILETIME *)&spti.CreateTime, &UTC);
696     SystemTimeToTzSpecificLocalTime(NULL, &UTC, &Local);
697     trace("CreateTime : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
698            Local.wHour, Local.wMinute, Local.wSecond);
699
700     FileTimeToSystemTime((const FILETIME *)&spti.ExitTime, &UTC);
701     SystemTimeToTzSpecificLocalTime(NULL, &UTC, &Local);
702     trace("ExitTime   : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
703            Local.wHour, Local.wMinute, Local.wSecond);
704
705     FileTimeToSystemTime((const FILETIME *)&spti.KernelTime, &Local);
706     trace("KernelTime : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
707
708     FileTimeToSystemTime((const FILETIME *)&spti.UserTime, &Local);
709     trace("UserTime   : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
710
711     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessTimes, &spti, sizeof(spti) * 2, &ReturnLength);
712     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
713     ok( sizeof(spti) == ReturnLength || ReturnLength == 0 /* vista */,
714         "Inconsistent length %d\n", ReturnLength);
715 }
716
717 static void test_query_process_handlecount(void)
718 {
719     NTSTATUS status;
720     ULONG ReturnLength;
721     DWORD handlecount;
722     HANDLE process;
723
724     status = pNtQueryInformationProcess(NULL, ProcessHandleCount, NULL, sizeof(handlecount), NULL);
725     ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
726         "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
727
728     status = pNtQueryInformationProcess(NULL, ProcessHandleCount, &handlecount, sizeof(handlecount), NULL);
729     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
730
731     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessHandleCount, &handlecount, 2, &ReturnLength);
732     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
733
734     process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, one_before_last_pid);
735     if (!process)
736     {
737         trace("Could not open process with ID : %d, error : %u. Going to use current one.\n", one_before_last_pid, GetLastError());
738         process = GetCurrentProcess();
739         trace("ProcessHandleCount for current process\n");
740     }
741     else
742         trace("ProcessHandleCount for process with ID : %d\n", one_before_last_pid);
743
744     status = pNtQueryInformationProcess( process, ProcessHandleCount, &handlecount, sizeof(handlecount), &ReturnLength);
745     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
746     ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
747     CloseHandle(process);
748
749     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessHandleCount, &handlecount, sizeof(handlecount) * 2, &ReturnLength);
750     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
751     ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
752
753     /* Check if we have some return values */
754     trace("HandleCount : %d\n", handlecount);
755     todo_wine
756     {
757         ok( handlecount > 0, "Expected some handles, got 0\n");
758     }
759 }
760
761 static void test_query_process_image_file_name(void)
762 {
763     NTSTATUS status;
764     ULONG ReturnLength;
765     UNICODE_STRING image_file_name;
766     void *buffer;
767     char *file_nameA;
768     INT len;
769
770     status = pNtQueryInformationProcess(NULL, ProcessImageFileName, &image_file_name, sizeof(image_file_name), NULL);
771     if (status == STATUS_INVALID_INFO_CLASS)
772     {
773         skip("ProcessImageFileName is not supported\n");
774         return;
775     }
776     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
777
778     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, &image_file_name, 2, &ReturnLength);
779     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
780
781     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, &image_file_name, sizeof(image_file_name), &ReturnLength);
782     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
783
784     buffer = HeapAlloc(GetProcessHeap(), 0, ReturnLength);
785     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, buffer, ReturnLength, &ReturnLength);
786     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
787     memcpy(&image_file_name, buffer, sizeof(image_file_name));
788     len = WideCharToMultiByte(CP_ACP, 0, image_file_name.Buffer, image_file_name.Length/sizeof(WCHAR), NULL, 0, NULL, NULL);
789     file_nameA = HeapAlloc(GetProcessHeap(), 0, len + 1);
790     WideCharToMultiByte(CP_ACP, 0, image_file_name.Buffer, image_file_name.Length/sizeof(WCHAR), file_nameA, len, NULL, NULL);
791     file_nameA[len] = '\0';
792     HeapFree(GetProcessHeap(), 0, buffer);
793     trace("process image file name: %s\n", file_nameA);
794     HeapFree(GetProcessHeap(), 0, file_nameA);
795 }
796
797
798 static void test_readvirtualmemory(void)
799 {
800     HANDLE process;
801     NTSTATUS status;
802     SIZE_T readcount;
803     static const char teststring[] = "test string";
804     char buffer[12];
805
806     process = OpenProcess(PROCESS_VM_READ, FALSE, GetCurrentProcessId());
807     ok(process != 0, "Expected to be able to open own process for reading memory\n");
808
809     /* normal operation */
810     status = pNtReadVirtualMemory(process, teststring, buffer, 12, &readcount);
811     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
812     ok( readcount == 12, "Expected to read 12 bytes, got %ld\n",readcount);
813     ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
814
815     /* no number of bytes */
816     memset(buffer, 0, 12);
817     status = pNtReadVirtualMemory(process, teststring, buffer, 12, NULL);
818     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
819     ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
820
821     /* illegal remote address */
822     todo_wine{
823     status = pNtReadVirtualMemory(process, (void *) 0x1234, buffer, 12, &readcount);
824     ok( status == STATUS_PARTIAL_COPY || broken(status == STATUS_ACCESS_VIOLATION), "Expected STATUS_PARTIAL_COPY, got %08x\n", status);
825     if (status == STATUS_PARTIAL_COPY)
826         ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
827     }
828
829     /* 0 handle */
830     status = pNtReadVirtualMemory(0, teststring, buffer, 12, &readcount);
831     ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
832     ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
833
834     /* pseudo handle for current process*/
835     memset(buffer, 0, 12);
836     status = pNtReadVirtualMemory((HANDLE)-1, teststring, buffer, 12, &readcount);
837     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
838     ok( readcount == 12, "Expected to read 12 bytes, got %ld\n",readcount);
839     ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
840
841     /* this test currently crashes wine with "wine client error:<process id>: read: Bad address"
842      * because the reply from wine server is directly read into the buffer and that fails with EFAULT
843      */
844     /* illegal local address */
845     /*status = pNtReadVirtualMemory(process, teststring, (void *)0x1234, 12, &readcount);
846     ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
847     ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
848     */
849
850     CloseHandle(process);
851 }
852
853 START_TEST(info)
854 {
855     if(!InitFunctionPtrs())
856         return;
857
858     /* NtQuerySystemInformation */
859
860     /* 0x0 SystemBasicInformation */
861     trace("Starting test_query_basic()\n");
862     test_query_basic();
863
864     /* 0x1 SystemCpuInformation */
865     trace("Starting test_query_cpu()\n");
866     test_query_cpu();
867
868     /* 0x2 SystemPerformanceInformation */
869     trace("Starting test_query_performance()\n");
870     test_query_performance();
871
872     /* 0x3 SystemTimeOfDayInformation */
873     trace("Starting test_query_timeofday()\n");
874     test_query_timeofday();
875
876     /* 0x5 SystemProcessInformation */
877     trace("Starting test_query_process()\n");
878     test_query_process();
879
880     /* 0x8 SystemProcessorPerformanceInformation */
881     trace("Starting test_query_procperf()\n");
882     test_query_procperf();
883
884     /* 0xb SystemModuleInformation */
885     trace("Starting test_query_module()\n");
886     test_query_module();
887
888     /* 0x10 SystemHandleInformation */
889     trace("Starting test_query_handle()\n");
890     test_query_handle();
891
892     /* 0x15 SystemCacheInformation */
893     trace("Starting test_query_cache()\n");
894     test_query_cache();
895
896     /* 0x17 SystemInterruptInformation */
897     trace("Starting test_query_interrupt()\n");
898     test_query_interrupt();
899
900     /* 0x23 SystemKernelDebuggerInformation */
901     trace("Starting test_query_kerndebug()\n");
902     test_query_kerndebug();
903
904     /* 0x25 SystemRegistryQuotaInformation */
905     trace("Starting test_query_regquota()\n");
906     test_query_regquota();
907
908     /* NtQueryInformationProcess */
909
910     /* 0x0 ProcessBasicInformation */
911     trace("Starting test_query_process_basic()\n");
912     test_query_process_basic();
913
914     /* 0x2 ProcessIoCounters */
915     trace("Starting test_query_process_io()\n");
916     test_query_process_io();
917
918     /* 0x3 ProcessVmCounters */
919     trace("Starting test_query_process_vm()\n");
920     test_query_process_vm();
921
922     /* 0x4 ProcessTimes */
923     trace("Starting test_query_process_times()\n");
924     test_query_process_times();
925
926     /* 0x14 ProcessHandleCount */
927     trace("Starting test_query_process_handlecount()\n");
928     test_query_process_handlecount();
929
930     /* 27 ProcessImageFileName */
931     trace("Starting test_query_process_image_file_name()\n");
932     test_query_process_image_file_name();
933
934     /* belongs into it's own file */
935     trace("Starting test_readvirtualmemory()\n");
936     test_readvirtualmemory();
937 }