ReactOS  0.4.15-dev-5455-g015cd25
query.c
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Akihiro Sagawa
3  * Copyright 2016-2018, 2021 Hugh McMaster
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 #include "reg_test.h"
21 
22 static void read_from_pipe(HANDLE child_proc_stdout, BYTE *buf, DWORD buf_size)
23 {
24  DWORD read, len = 0;
25  BOOL ret;
26 
27  while (1)
28  {
29  ret = ReadFile(child_proc_stdout, buf + len, buf_size - len, &read, NULL);
30  if (!ret || !read) break;
31 
32  len += read;
33  }
34 
35  buf[len] = 0;
36 }
37 
38 #define read_reg_output(c,b,s,r) read_reg_output_(__FILE__,__LINE__,c,b,s,r)
39 static BOOL read_reg_output_(const char *file, unsigned line, const char *cmd,
40  BYTE *buf, DWORD buf_size, DWORD *rc)
41 {
43  HANDLE pipe_stdout_rd, pipe_stdout_wr;
44  STARTUPINFOA si = {0};
46  char cmdline[256];
47  BOOL bret;
48  DWORD ret;
49 
50  sa.nLength = sizeof(SECURITY_ATTRIBUTES);
51  sa.bInheritHandle = TRUE;
52  sa.lpSecurityDescriptor = NULL;
53 
54  if (!CreatePipe(&pipe_stdout_rd, &pipe_stdout_wr, &sa, 0))
55  return FALSE;
56 
57  if (!SetHandleInformation(pipe_stdout_rd, HANDLE_FLAG_INHERIT, 0))
58  return FALSE;
59 
60  si.cb = sizeof(si);
63  si.hStdOutput = pipe_stdout_wr;
65 
66  strcpy(cmdline, cmd);
67  if (!CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
68  return FALSE;
69 
70  CloseHandle(pipe_stdout_wr);
71 
72  read_from_pipe(pipe_stdout_rd, buf, buf_size);
73 
74  ret = WaitForSingleObject(pi.hProcess, 10000);
75  if (ret == WAIT_TIMEOUT)
76  TerminateProcess(pi.hProcess, 1);
77 
78  bret = GetExitCodeProcess(pi.hProcess, rc);
79  lok(bret, "GetExitCodeProcess failed: %d\n", GetLastError());
80 
81  CloseHandle(pipe_stdout_rd);
82  CloseHandle(pi.hThread);
83  CloseHandle(pi.hProcess);
84  return bret;
85 }
86 
87 #define compare_query(b,e,c,todo) compare_query_(__FILE__,__LINE__,b,e,c,todo)
88 static void compare_query_(const char *file, unsigned line, const BYTE *buf,
89  const char *expected, BOOL cmp_len, DWORD todo)
90 {
91  const char *str = (const char *)buf;
92  const char *err = "query output does not match expected output";
93 
94  if (!cmp_len)
95  {
97  lok(!strcmp(str, expected), "%s\n", err);
98  }
99  else
100  {
102  lok(!strncmp(str, expected, strlen(expected)), "%s\n", err);
103  }
104 }
105 
106 /* Unit tests */
107 
108 static void test_command_syntax(void)
109 {
110  DWORD r;
111 
112  run_reg_exe("reg query", &r);
113  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
114 
115  run_reg_exe("reg query /?", &r);
116  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
117 
118  run_reg_exe("reg query /h", &r);
119  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
120 
121  run_reg_exe("reg query -H", &r);
122  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
123 
124  run_reg_exe("reg query HKCU\\" KEY_BASE " /v", &r);
125  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
126 
127  run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /v Test2", &r);
128  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
129 
130  run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test1 /ve", &r);
131  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
132 
133  run_reg_exe("reg query HKCU\\" KEY_BASE " /s /s", &r);
134  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
135 
136  /* Test registry view */
137  run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:32 /reg:32", &r);
138  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
139 
140  run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:32 /reg:64", &r);
141  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
142 
143  run_reg_exe("reg query HKCU\\" KEY_BASE " /reg:64 /reg:64", &r);
144  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
145 }
146 
147 static void test_query(void)
148 {
149  const char *test1 = "\r\n"
150  "HKEY_CURRENT_USER\\" KEY_BASE "\r\n"
151  " Test1 REG_SZ Hello, World\r\n"
152  " Test2 REG_DWORD 0x123\r\n\r\n";
153 
154  const char *test2 = "\r\n"
155  "HKEY_CURRENT_USER\\" KEY_BASE "\r\n"
156  " Test1 REG_SZ Hello, World\r\n\r\n";
157 
158  const char *test3 = "\r\n"
159  "HKEY_CURRENT_USER\\" KEY_BASE "\r\n"
160  " Test1 REG_SZ Hello, World\r\n"
161  " Test2 REG_DWORD 0x123\r\n"
162  " Wine REG_SZ First instance\r\n\r\n"
163  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n";
164 
165  const char *test4 = "\r\n"
166  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n"
167  " Test3 REG_SZ Some string data\r\n"
168  " Test4 REG_DWORD 0xabc\r\n\r\n";
169 
170  const char *test5 = "\r\n"
171  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n"
172  " Test4 REG_DWORD 0xabc\r\n\r\n";
173 
174  const char *test6 = "\r\n"
175  "HKEY_CURRENT_USER\\" KEY_BASE "\r\n"
176  " Test1 REG_SZ Hello, World\r\n"
177  " Test2 REG_DWORD 0x123\r\n"
178  " Wine REG_SZ First instance\r\n\r\n"
179  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n"
180  " Test3 REG_SZ Some string data\r\n"
181  " Test4 REG_DWORD 0xabc\r\n"
182  " Wine REG_SZ Second instance\r\n\r\n";
183 
184  const char *test7 = "\r\n"
185  "HKEY_CURRENT_USER\\" KEY_BASE "\r\n"
186  " Wine REG_SZ First instance\r\n\r\n"
187  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey\r\n"
188  " Wine REG_SZ Second instance\r\n\r\n";
189 
190  const char *test8a = "\r\n"
191  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey1\r\n"
192  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey2\r\n"
193  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey3\r\n"
194  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey4\r\n";
195 
196  const char *test8b = "\r\n"
197  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey1\r\n\r\n"
198  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey2\r\n\r\n"
199  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey3\r\n\r\n"
200  "HKEY_CURRENT_USER\\" KEY_BASE "\\subkey4\r\n\r\n";
201 
202  DWORD r, dword = 0x123;
203  HKEY hkey, subkey;
204  BYTE buf[512];
205 
207 
208  /* Key not present */
209  run_reg_exe("reg query HKCU\\" KEY_BASE, &r);
210  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
211 
212  /* Create a test key */
213  add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
214  add_value(hkey, "Test1", REG_SZ, "Hello, World", 13);
215  add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword));
216 
217  run_reg_exe("reg query HKCU\\" KEY_BASE " /v Missing", &r);
218  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
219 
220  read_reg_output("reg query HKCU\\" KEY_BASE, buf, sizeof(buf), &r);
221  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
223 
224  run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r);
225  ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
226  "got exit code %d, expected 0\n", r);
227 
228  read_reg_output("reg query HKCU\\" KEY_BASE " /v Test1", buf, sizeof(buf), &r);
229  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
231 
232  run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test2", &r);
233  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
234 
235  add_value(hkey, "Wine", REG_SZ, "First instance", 15);
236 
237  /* Create a test subkey */
238  add_key(hkey, "subkey", 0, &subkey);
239 
240  read_reg_output("reg query HKCU\\" KEY_BASE, buf, sizeof(buf), &r);
241  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
243 
244  add_value(subkey, "Test3", REG_SZ, "Some string data", 16);
245  dword = 0xabc;
246  add_value(subkey, "Test4", REG_DWORD, &dword, sizeof(dword));
247 
248  read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey", buf, sizeof(buf), &r);
249  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
251 
252  run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test3", &r);
253  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
254 
255  read_reg_output("reg query HKCU\\" KEY_BASE "\\subkey /v Test4", buf, sizeof(buf), &r);
256  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
258 
259  add_value(subkey, "Wine", REG_SZ, "Second instance", 16);
260 
261  /* Test recursion */
262  read_reg_output("reg query HKCU\\" KEY_BASE " /s", buf, sizeof(buf), &r);
263  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
265 
266  read_reg_output("reg query HKCU\\" KEY_BASE "\\ /s", buf, sizeof(buf), &r);
267  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
269 
270  read_reg_output("reg query HKCU\\" KEY_BASE " /v Wine /s", buf, sizeof(buf), &r);
271  ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */,
272  "got exit code %d, expected 0\n", r);
273  compare_query(buf, test7, TRUE, 0);
274 
275  add_value(hkey, NULL, REG_SZ, "Empty", 6);
276  add_value(subkey, NULL, REG_SZ, "Empty", 6);
277  close_key(subkey);
278  close_key(hkey);
279 
280  run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /ve", &r);
281  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
282 
283  run_reg_exe("reg query HKCU\\" KEY_BASE " /ve /s", &r);
284  ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */,
285  "got exit code %d, expected 0\n", r);
286 
288 
289  /* Subkeys only */
290  add_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
291  add_key(hkey, "subkey1", 0, NULL);
292  add_key(hkey, "subkey2", 0, NULL);
293  add_key(hkey, "subkey3", 0, NULL);
294  add_key(hkey, "subkey4", 0, NULL);
295  close_key(hkey);
296 
297  read_reg_output("reg query HKCU\\" KEY_BASE, buf, sizeof(buf), &r);
298  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
299  compare_query(buf, test8a, FALSE, 0);
300 
301  read_reg_output("reg query HKCU\\" KEY_BASE " /s", buf, sizeof(buf), &r);
302  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
303  compare_query(buf, test8b, FALSE, 0);
304 
306 }
307 
308 #if 0
309 static const char *test9a = "\r\n"
310  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n"
311  " Test1 REG_SZ Hello, World\r\n"
312  " Test2 REG_DWORD 0x123\r\n"
313  " Wine REG_SZ First instance\r\n\r\n"
314  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n";
315 
316 static const char *test9b = "\r\n"
317  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n"
318  " Test1 REG_SZ Hello, World\r\n"
319  " Test2 REG_DWORD 0x123\r\n"
320  " Wine REG_SZ First instance\r\n\r\n"
321  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n"
322  " Test3 REG_SZ Some string data\r\n"
323  " Test4 REG_DWORD 0xabc\r\n"
324  " Wine REG_SZ Second instance\r\n\r\n";
325 
326 static const char *test9c = "\r\n"
327  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\r\n"
328  " Wine REG_SZ First instance\r\n\r\n"
329  "HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey\r\n"
330  " Wine REG_SZ Second instance\r\n\r\n";
331 
332 static void create_test_key(REGSAM sam)
333 {
334  HKEY hkey, subkey;
335  DWORD dword;
336 
338  add_value(hkey, "Test1", REG_SZ, "Hello, World", 13);
339  dword = 0x123;
340  add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword));
341  add_value(hkey, "Wine", REG_SZ, "First instance", 15);
342 
343  add_key(hkey, "subkey", sam, &subkey);
344  add_value(subkey, "Test3", REG_SZ, "Some string data", 16);
345  dword = 0xabc;
346  add_value(subkey, "Test4", REG_DWORD, &dword, sizeof(dword));
347  add_value(subkey, "Wine", REG_SZ, "Second instance", 16);
348 
349  close_key(subkey);
350  close_key(hkey);
351 }
352 
353 static void test_registry_view_win32(void)
354 {
355  BOOL is_wow64, is_win32;
356  DWORD r;
357  BYTE buf[512];
358 
360  is_win32 = !is_wow64 && (sizeof(void *) == sizeof(int));
361 
362  if (!is_win32) return;
363 
365 
366  /* Try querying the 32-bit registry view (32-bit Windows) */
367  create_test_key(KEY_WOW64_32KEY);
368 
369  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r);
370  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
371  compare_query(buf, test9a, FALSE, 0);
372 
373  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r);
374  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
375  compare_query(buf, test9b, FALSE, 0);
376 
377  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r);
378  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
379  compare_query(buf, test9c, TRUE, 0);
380 
382 
383  /* Try querying the 64-bit registry view, which doesn't exist on 32-bit Windows */
384  create_test_key(KEY_WOW64_64KEY);
385 
386  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r);
387  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
388  compare_query(buf, test9a, FALSE, 0);
389 
390  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r);
391  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
392  compare_query(buf, test9b, FALSE, 0);
393 
394  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r);
395  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
396  compare_query(buf, test9c, TRUE, 0);
397 
399 }
400 
401 static void test_registry_view_win64(void)
402 {
404  DWORD r;
405  BYTE buf[512];
406 
408  is_win64 = !is_wow64 && (sizeof(void *) > sizeof(int));
409 
410  if (!is_win64) return;
411 
413 
414  /* Try querying the 32-bit registry view (64-bit Windows) */
415  create_test_key(KEY_WOW64_32KEY);
416 
417  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r);
418  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
419  compare_query(buf, test9a, FALSE, 0);
420 
421  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r);
422  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
423  compare_query(buf, test9b, FALSE, 0);
424 
425  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r);
426  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
427  compare_query(buf, test9c, TRUE, 0);
428 
431 
432  /* Try querying the 64-bit registry view (64-bit Windows) */
433  create_test_key(KEY_WOW64_64KEY);
434 
435  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r);
436  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
437  compare_query(buf, test9a, FALSE, 0);
438 
439  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r);
440  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
441  compare_query(buf, test9b, FALSE, 0);
442 
443  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r);
444  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
445  compare_query(buf, test9c, TRUE, 0);
446 
448 }
449 
450 static void test_registry_view_wow64(void)
451 {
452  BOOL is_wow64;
453  DWORD r;
454  BYTE buf[512];
455 
457 
458  if (!is_wow64) return;
459 
461 
462  /* Try querying the 32-bit registry view (WOW64) */
463  create_test_key(KEY_WOW64_32KEY);
464 
465  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:32", buf, sizeof(buf), &r);
466  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
467  compare_query(buf, test9a, FALSE, 0);
468 
469  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:32", buf, sizeof(buf), &r);
470  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
471  compare_query(buf, test9b, FALSE, 0);
472 
473  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:32", buf, sizeof(buf), &r);
474  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
475  compare_query(buf, test9c, TRUE, 0);
476 
479 
480  /* Try querying the 64-bit registry view (WOW64) */
481  create_test_key(KEY_WOW64_64KEY);
482 
483  read_reg_output("reg query HKLM\\" KEY_BASE " /reg:64", buf, sizeof(buf), &r);
484  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
485  compare_query(buf, test9a, FALSE, 0);
486 
487  read_reg_output("reg query HKLM\\" KEY_BASE " /s /reg:64", buf, sizeof(buf), &r);
488  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
489  compare_query(buf, test9b, FALSE, 0);
490 
491  read_reg_output("reg query HKLM\\" KEY_BASE " /v Wine /s /reg:64", buf, sizeof(buf), &r);
492  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
493  compare_query(buf, test9c, TRUE, 0);
494 
496 }
497 #endif
498 
500 {
501  DWORD r;
502 
503  if (!run_reg_exe("reg.exe /?", &r)) {
504  win_skip("reg.exe not available, skipping 'query' tests\n");
505  return;
506  }
507 
509  test_query();
510 
511  /* Check if reg.exe is running with elevated privileges */
512  if (!is_elevated_process())
513  {
514  win_skip("reg.exe is not running with elevated privileges; "
515  "skipping registry view tests\n");
516  return;
517  }
518 
519 #if 0
520  test_registry_view_win32();
521  test_registry_view_win64();
522  test_registry_view_wow64();
523 #endif
524 
525 }
#define lok
Definition: registry.c:202
#define CloseHandle
Definition: compat.h:739
static void compare_query_(const char *file, unsigned line, const BYTE *buf, const char *expected, BOOL cmp_len, DWORD todo)
Definition: query.c:88
#define run_reg_exe(c, r)
Definition: reg_test.h:39
static void test_query(void)
Definition: query.c:147
BOOL is_wow64
Definition: msi.c:54
#define TODO_REG_COMPARE
Definition: reg_test.h:36
#define REG_EXIT_FAILURE
Definition: reg_test.h:31
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: ftp_var.h:139
#define TRUE
Definition: types.h:120
static void read_from_pipe(HANDLE child_proc_stdout, BYTE *buf, DWORD buf_size)
Definition: query.c:22
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define close_key(k)
Definition: reg_test.h:52
BOOL todo
Definition: filedlg.c:313
static BOOL read_reg_output_(const char *file, unsigned line, const char *cmd, BYTE *buf, DWORD buf_size, DWORD *rc)
Definition: query.c:39
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD dwFlags
Definition: winbase.h:842
#define read_reg_output(c, b, s, r)
Definition: query.c:38
TCHAR * cmdline
Definition: stretchblt.cpp:32
void test4()
Definition: ehthrow.cxx:298
#define delete_tree(r, p, s)
Definition: reg_test.h:67
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
START_TEST(query)
Definition: query.c:499
const WCHAR * str
static const BOOL is_win64
Definition: shellpath.c:59
Definition: parser.c:48
#define HANDLE_FLAG_INHERIT
Definition: winbase.h:264
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1975
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define STARTF_USESTDHANDLES
Definition: winbase.h:499
void test6()
Definition: ehthrow.cxx:312
DWORD cb
Definition: winbase.h:831
static refpint_t pi[]
Definition: server.c:96
#define todo_wine_if(is_todo)
Definition: custom.c:76
void test1()
Definition: ehthrow.cxx:277
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4743
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE hStdOutput
Definition: winbase.h:847
static void test_command_syntax(void)
Definition: query.c:108
#define WAIT_TIMEOUT
Definition: dderror.h:14
void test3()
Definition: ehthrow.cxx:291
int ret
void test7()
Definition: ehthrow.cxx:346
GLenum GLsizei len
Definition: glext.h:6722
#define GetCurrentProcess()
Definition: compat.h:759
#define err(...)
BOOL WINAPI CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
Definition: npipe.c:117
unsigned char BYTE
Definition: xxhash.c:193
#define broken(x)
Definition: _sntprintf.h:21
#define REG_EXIT_SUCCESS
Definition: reg_test.h:30
HANDLE hStdInput
Definition: winbase.h:846
void test5()
Definition: ehthrow.cxx:305
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
void test2()
Definition: ehthrow.cxx:284
#define ok(value,...)
Definition: atltest.h:57
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define NULL
Definition: types.h:112
#define KEY_BASE
Definition: reg_test.h:29
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static REGSAM sam
Definition: query.c:143
#define compare_query(b, e, c, todo)
Definition: query.c:87
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL WINAPI SetHandleInformation(IN HANDLE hObject, IN DWORD dwMask, IN DWORD dwFlags)
Definition: handle.c:78
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define add_key(r, p, s, k)
Definition: reg_test.h:61
#define REG_DWORD
Definition: sdbapi.c:596
#define win_skip
Definition: test.h:160
#define add_value(k, n, t, d, s)
Definition: reg_test.h:70
HANDLE hStdError
Definition: winbase.h:848
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
BOOL expected
Definition: store.c:2063
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
BOOL is_elevated_process(void)
Definition: import.c:21
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
Definition: fci.c:126
#define REG_SZ
Definition: layer.c:22