winhttp, wininet: Load i2d_X509 from libcrypto.so.
[wine] / dlls / setupapi / tests / query.c
1 /*
2  * Unit tests for setupapi.dll query functions
3  *
4  * Copyright (C) 2006 James Hawkins
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdio.h>
22 #include <windows.h>
23 #include <setupapi.h>
24 #include "wine/test.h"
25
26 CHAR CURR_DIR[MAX_PATH];
27 CHAR WIN_DIR[MAX_PATH];
28
29 static void get_directories(void)
30 {
31     int len;
32
33     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
34     len = lstrlenA(CURR_DIR);
35
36     if(len && (CURR_DIR[len-1] == '\\'))
37         CURR_DIR[len-1] = 0;
38
39     GetWindowsDirectoryA(WIN_DIR, MAX_PATH);
40     len = lstrlenA(WIN_DIR);
41
42     if (len && (WIN_DIR[len-1] == '\\'))
43         WIN_DIR[len-1] = 0;
44 }
45
46 static const char inf_data1[] =
47     "[Version]\n"
48     "Signature=\"$Chicago$\"\n"
49     "AdvancedINF=2.5\n"
50     "[SourceDisksNames]\n"
51     "2 = %SrcDiskName%, LANCOM\\LANtools\\lanconf.cab\n"
52     "[SourceDisksFiles]\n"
53     "lanconf.exe = 2\n"
54     "[DestinationDirs]\n"
55     "DefaultDestDir = 24, %DefaultDest%\n"
56     "[Strings]\n"
57     "LangDir = english\n"
58     "DefaultDest = LANCOM\n"
59     "SrcDiskName = \"LANCOM Software CD\"\n";
60
61 static const char inf_data2[] =
62     "[SourceFileInfo]\n"
63     "sp1qfe\\bitsinst.exe=250B3702C7CCD7C2F9E4DAA1555C933E,000600060A28062C,27136,SP1QFE\n"
64     "sp1qfe\\bitsprx2.dll=4EBEA67F4BB4EB402E725CA7CA2857AE,000600060A280621,7680,SP1QFE\n"
65     "sp1qfe\\bitsprx3.dll=C788A1D9330DA011EF25E95D3BC7BDE5,000600060A280621,7168,SP1QFE\n"
66     "sp1qfe\\qmgr.dll=696AC82FB290A03F205901442E0E9589,000600060A280621,361984,SP1QFE\n"
67     "sp1qfe\\qmgrprxy.dll=8B5848144829E1BC985EA4C3D8CA7E3F,000600060A280621,17408,SP1QFE\n"
68     "sp1qfe\\winhttp.dll=3EC6F518114606CA59D4160322077437,000500010A280615,331776,SP1QFE\n"
69     "sp1qfe\\xpob2res.dll=DB83156B9F496F20D1EA70E4ABEC0166,000500010A280622,158720,SP1QFE\n";
70
71 static const char inf_data3[] =
72     "[Version]\n"
73     "Signature = \"$Windows NT$\"\n"
74     "[DestinationDirs]\n"
75     "CopyAlways.Windir.files = 10\n"
76     "[CopyAlways.Windir.Files]\n"
77     "WindowsCodecs.dll\n";
78
79 static const char inf_data4[] =
80     "[Version]\n"
81     "Signature = \"$Windows NT$\"\n"
82     "[CopyAlways.System32.Files]\n"
83     "WindowsCodecs.dll\n";
84
85 static const char inf_data5[] =
86     "[Version]\n"
87     "Signature = \"$Windows NT$\"\n"
88     "[DestinationDirs]\n"
89     "DefaultDestDir = 11\n"
90     "CopyAlways.Windir.files = 10\n"
91     "[CopyAlways.Windir.Files]\n"
92     "WindowsCodecs.dll\n";
93
94 static const char inf_data6[] =
95     "[Version]\n"
96     "Signature = \"$Windows NT$\"\n"
97     "[DestinationDirs]\n"
98     "DefaultDestDir = 10\n"
99     "[CopyAlways.Windir.Files]\n"
100     "WindowsCodecs.dll\n";
101
102 static void create_inf_file(LPSTR filename, const char *data, DWORD size)
103 {
104     DWORD dwNumberOfBytesWritten;
105     HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
106                            CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
107     WriteFile(hf, data, size, &dwNumberOfBytesWritten, NULL);
108     CloseHandle(hf);
109 }
110
111 static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test)
112 {
113     LPSTR filename;
114     DWORD size;
115     BOOL ret = FALSE;
116
117     if (!SetupQueryInfFileInformationA(info, 0, NULL, 0, &size))
118         return FALSE;
119
120     filename = HeapAlloc(GetProcessHeap(), 0, size);
121     if (!filename)
122         return FALSE;
123
124     SetupQueryInfFileInformationA(info, 0, filename, size, &size);
125
126     if (!lstrcmpiA(test, filename))
127         ret = TRUE;
128
129     HeapFree(GetProcessHeap(), 0, filename);
130     return ret;
131 }
132
133 static PSP_INF_INFORMATION alloc_inf_info(LPCSTR filename, DWORD search, PDWORD size)
134 {
135     PSP_INF_INFORMATION info;
136     BOOL ret;
137
138     ret = SetupGetInfInformationA(filename, search, NULL, 0, size);
139     if (!ret)
140         return NULL;
141
142     info = HeapAlloc(GetProcessHeap(), 0, *size);
143     return info;
144 }
145
146 static void test_SetupGetInfInformation(void)
147 {
148     PSP_INF_INFORMATION info;
149     CHAR inf_filename[MAX_PATH];
150     CHAR inf_one[MAX_PATH], inf_two[MAX_PATH];
151     LPSTR revfile;
152     DWORD size;
153     HINF hinf;
154     BOOL ret;
155
156     lstrcpyA(inf_filename, CURR_DIR);
157     lstrcatA(inf_filename, "\\");
158     lstrcatA(inf_filename, "test.inf");
159
160     /* try an invalid inf handle */
161     size = 0xdeadbeef;
162     SetLastError(0xbeefcafe);
163     ret = SetupGetInfInformationA(NULL, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size);
164     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
165     ok(GetLastError() == ERROR_INVALID_HANDLE ||
166        broken(GetLastError() == ERROR_BAD_PATHNAME) || /* win95 */
167        broken(GetLastError() == ERROR_FILE_NOT_FOUND) || /* win98 */
168        broken(GetLastError() == ERROR_PATH_NOT_FOUND) || /* NT4 */
169        broken(GetLastError() == ERROR_INVALID_NAME) || /* win2k */
170        broken(GetLastError() == ERROR_GENERAL_SYNTAX), /* another win2k */
171        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
172     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
173
174     /* try an invalid inf filename */
175     /* do not use NULL as absolute inf filename on win9x (crash) */
176     if ((GetLastError() != ERROR_BAD_PATHNAME) &&   /* win95 */
177         (GetLastError() != ERROR_FILE_NOT_FOUND))  /* win98 */
178     {
179         size = 0xdeadbeef;
180         SetLastError(0xbeefcafe);
181         ret = SetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
182         ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
183         ok(GetLastError() == ERROR_INVALID_PARAMETER,
184            "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
185         ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
186     }
187
188     create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1);
189
190     /* try an invalid search flag */
191     size = 0xdeadbeef;
192     SetLastError(0xbeefcafe);
193     ret = SetupGetInfInformationA(inf_filename, -1, NULL, 0, &size);
194     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
195     ok(GetLastError() == ERROR_INVALID_PARAMETER,
196        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
197     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
198
199     /* try a nonexistent inf file */
200     size = 0xdeadbeef;
201     SetLastError(0xbeefcafe);
202     ret = SetupGetInfInformationA("idontexist", INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
203     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
204     ok(GetLastError() == ERROR_FILE_NOT_FOUND,
205        "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
206     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
207
208     /* successfully open the inf file */
209     size = 0xdeadbeef;
210     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
211     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
212     ok(size != 0xdeadbeef, "Expected a valid size on return\n");
213
214     /* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size' */
215     SetLastError(0xbeefcafe);
216     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, &size);
217     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
218     ok(GetLastError() == ERROR_INVALID_PARAMETER,
219        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
220
221     /* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size-1' */
222     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size-1, &size);
223     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
224
225     /* some tests for behaviour with a NULL RequiredSize pointer */
226     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, NULL);
227     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
228     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size - 1, NULL);
229     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
230     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, NULL);
231     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
232
233     info = HeapAlloc(GetProcessHeap(), 0, size);
234
235     /* try valid ReturnBuffer but too small size */
236     SetLastError(0xbeefcafe);
237     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size - 1, &size);
238     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
239     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
240        "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
241
242     /* successfully get the inf information */
243     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size, &size);
244     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
245     ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n");
246
247     HeapFree(GetProcessHeap(), 0, info);
248
249     /* try the INFINFO_INF_SPEC_IS_HINF search flag */
250     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
251     info = alloc_inf_info(hinf, INFINFO_INF_SPEC_IS_HINF, &size);
252     ret = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, info, size, &size);
253     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
254     ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n");
255     SetupCloseInfFile(hinf);
256
257     lstrcpyA(inf_two, WIN_DIR);
258     lstrcatA(inf_two, "\\system32\\");
259     lstrcatA(inf_two, "test.inf");
260     create_inf_file(inf_two, inf_data1, sizeof(inf_data1) - 1);
261
262     HeapFree(GetProcessHeap(), 0, info);
263     info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
264
265     /* check if system32 is searched for inf */
266     ret = SetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size);
267     if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
268         revfile = inf_one; /* Vista */
269     else
270         revfile = inf_two;
271
272     lstrcpyA(inf_one, WIN_DIR);
273     lstrcatA(inf_one, "\\inf\\");
274     lstrcatA(inf_one, "test.inf");
275     create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1);
276
277     HeapFree(GetProcessHeap(), 0, info);
278     info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
279
280     /* test the INFINFO_DEFAULT_SEARCH search flag */
281     ret = SetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size);
282     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %d\n", GetLastError());
283     ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n");
284
285     HeapFree(GetProcessHeap(), 0, info);
286     info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size);
287
288     /* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */
289     ret = SetupGetInfInformationA("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, info, size, &size);
290     ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n");
291     ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n");
292
293     HeapFree(GetProcessHeap(), 0, info);
294
295     DeleteFileA(inf_filename);
296     DeleteFileA(inf_one);
297     DeleteFileA(inf_two);
298 }
299
300 static void test_SetupGetSourceFileLocation(void)
301 {
302     char buffer[MAX_PATH] = "not empty", inf_filename[MAX_PATH];
303     UINT source_id;
304     DWORD required, error;
305     HINF hinf;
306     BOOL ret;
307
308     lstrcpyA(inf_filename, CURR_DIR);
309     lstrcatA(inf_filename, "\\");
310     lstrcatA(inf_filename, "test.inf");
311
312     create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1);
313
314     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
315     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
316
317     required = 0;
318     source_id = 0;
319
320     ret = SetupGetSourceFileLocationA(hinf, NULL, "lanconf.exe", &source_id, buffer, sizeof(buffer), &required);
321     ok(ret, "SetupGetSourceFileLocation failed\n");
322
323     ok(required == 1, "unexpected required size: %d\n", required);
324     ok(source_id == 2, "unexpected source id: %d\n", source_id);
325     ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer);
326
327     SetupCloseInfFile(hinf);
328     DeleteFileA(inf_filename);
329
330     create_inf_file(inf_filename, inf_data2, sizeof(inf_data2) - 1);
331
332     SetLastError(0xdeadbeef);
333     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
334     error = GetLastError();
335     ok(hinf == INVALID_HANDLE_VALUE, "could open inf file\n");
336     ok(error == ERROR_WRONG_INF_STYLE, "got wrong error: %d\n", error);
337
338     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_OLDNT, NULL);
339     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
340
341     ret = SetupGetSourceFileLocationA(hinf, NULL, "", &source_id, buffer, sizeof(buffer), &required);
342     ok(!ret, "SetupGetSourceFileLocation succeeded\n");
343
344     SetupCloseInfFile(hinf);
345     DeleteFileA(inf_filename);
346 }
347
348 static void test_SetupGetSourceInfo(void)
349 {
350     char buffer[MAX_PATH], inf_filename[MAX_PATH];
351     DWORD required;
352     HINF hinf;
353     BOOL ret;
354
355     lstrcpyA(inf_filename, CURR_DIR);
356     lstrcatA(inf_filename, "\\");
357     lstrcatA(inf_filename, "test.inf");
358
359     create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1);
360
361     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
362     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
363
364     required = 0;
365
366     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_PATH, buffer, sizeof(buffer), &required);
367     ok(ret, "SetupGetSourceInfoA failed\n");
368
369     ok(required == 1, "unexpected required size: %d\n", required);
370     ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer);
371
372     required = 0;
373     buffer[0] = 0;
374
375     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_TAGFILE, buffer, sizeof(buffer), &required);
376     ok(ret, "SetupGetSourceInfoA failed\n");
377
378     ok(required == 28, "unexpected required size: %d\n", required);
379     ok(!lstrcmpA("LANCOM\\LANtools\\lanconf.cab", buffer), "unexpected result string: %s\n", buffer);
380
381     required = 0;
382     buffer[0] = 0;
383
384     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_DESCRIPTION, buffer, sizeof(buffer), &required);
385     ok(ret, "SetupGetSourceInfoA failed\n");
386
387     ok(required == 19, "unexpected required size: %d\n", required);
388     ok(!lstrcmpA("LANCOM Software CD", buffer), "unexpected result string: %s\n", buffer);
389
390     SetupCloseInfFile(hinf);
391     DeleteFileA(inf_filename);
392 }
393
394 static void test_SetupGetTargetPath(void)
395 {
396     char buffer[MAX_PATH], inf_filename[MAX_PATH];
397     char destfile[MAX_PATH];
398     DWORD required;
399     HINF hinf;
400     INFCONTEXT ctx;
401     BOOL ret;
402
403     lstrcpyA(inf_filename, CURR_DIR);
404     lstrcatA(inf_filename, "\\");
405     lstrcatA(inf_filename, "test.inf");
406
407     create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1);
408
409     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
410     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
411
412     ctx.Inf = hinf;
413     ctx.CurrentInf = hinf;
414     ctx.Section = 7;
415     ctx.Line = 0;
416
417     required = 0;
418
419     ret = SetupGetTargetPathA(hinf, &ctx, NULL, buffer, sizeof(buffer), &required);
420     ok(ret, "SetupGetTargetPathA failed\n");
421     ok(required == 10, "unexpected required size: %d\n", required);
422     /* Retrieve the system drive from the windows directory.
423      * (%SystemDrive% is not available on Win9x)
424      */
425     lstrcpyA(destfile, WIN_DIR);
426     destfile[3] = '\0';
427     lstrcatA(destfile, "LANCOM");
428     ok(!lstrcmpiA(destfile, buffer), "unexpected result string: %s\n", buffer);
429
430     SetupCloseInfFile(hinf);
431     DeleteFileA(inf_filename);
432
433     create_inf_file(inf_filename, inf_data3, sizeof(inf_data3) - 1);
434
435     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
436     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
437
438     required = 0;
439
440     ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required);
441     ok(ret, "SetupGetTargetPathA failed\n");
442
443     lstrcpyA(destfile, WIN_DIR);
444
445     ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
446     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
447
448     SetupCloseInfFile(hinf);
449     DeleteFileA(inf_filename);
450
451     create_inf_file(inf_filename, inf_data4, sizeof(inf_data4) - 1);
452
453     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
454     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
455
456     required = 0;
457
458     ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.System32.Files", buffer, sizeof(buffer), &required);
459     ok(ret, "SetupGetTargetPathA failed\n");
460
461     GetSystemDirectoryA(destfile, MAX_PATH);
462
463     ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
464     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
465
466     SetupCloseInfFile(hinf);
467     DeleteFileA(inf_filename);
468
469     create_inf_file(inf_filename, inf_data5, sizeof(inf_data5) - 1);
470
471     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
472     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
473
474     required = 0;
475
476     ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required);
477     ok(ret, "SetupGetTargetPathA failed\n");
478
479     lstrcpyA(destfile, WIN_DIR);
480
481     ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
482     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
483
484     SetupCloseInfFile(hinf);
485     DeleteFileA(inf_filename);
486
487     create_inf_file(inf_filename, inf_data6, sizeof(inf_data6) - 1);
488
489     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
490     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
491
492     required = 0;
493
494     ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required);
495     ok(ret, "SetupGetTargetPathA failed\n");
496
497     lstrcpyA(destfile, WIN_DIR);
498
499     ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
500     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
501
502     SetupCloseInfFile(hinf);
503     DeleteFileA(inf_filename);
504 }
505
506 START_TEST(query)
507 {
508     get_directories();
509
510     test_SetupGetInfInformation();
511     test_SetupGetSourceFileLocation();
512     test_SetupGetSourceInfo();
513     test_SetupGetTargetPath();
514 }