hhctrl.ocx: Open a specific topic when requested.
[wine/multimedia.git] / dlls / setupapi / tests / diskspace.c
blob573eb73453662bd739e3d3ba15e7a283f98d68a0
1 /*
2 * Unit tests for disk space functions
4 * Copyright 2010 Andrew Nguyen
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.
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.
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
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winnls.h"
26 #include "winuser.h"
27 #include "winreg.h"
28 #include "setupapi.h"
30 #include "wine/test.h"
32 static void test_SetupCreateDiskSpaceListA(void)
34 HDSKSPC ret;
36 ret = SetupCreateDiskSpaceListA(NULL, 0, 0);
37 ok(ret != NULL,
38 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
40 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
42 ret = SetupCreateDiskSpaceListA(NULL, 0, SPDSL_IGNORE_DISK);
43 ok(ret != NULL,
44 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
46 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
48 SetLastError(0xdeadbeef);
49 ret = SetupCreateDiskSpaceListA(NULL, 0, ~0U);
50 ok(ret == NULL ||
51 broken(ret != NULL), /* NT4/Win9x/Win2k */
52 "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
53 if (!ret)
54 ok(GetLastError() == ERROR_INVALID_PARAMETER,
55 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
56 GetLastError());
57 else
58 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
60 SetLastError(0xdeadbeef);
61 ret = SetupCreateDiskSpaceListA(NULL, 0xdeadbeef, 0);
62 ok(ret == NULL,
63 "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
64 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
65 broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
66 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
67 GetLastError());
69 SetLastError(0xdeadbeef);
70 ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0, 0);
71 ok(ret == NULL,
72 "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
73 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
74 broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
75 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
76 GetLastError());
78 SetLastError(0xdeadbeef);
79 ret = SetupCreateDiskSpaceListA((void *)0xdeadbeef, 0xdeadbeef, 0);
80 ok(ret == NULL,
81 "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
82 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
83 broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
84 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
85 GetLastError());
88 static void test_SetupCreateDiskSpaceListW(void)
90 HDSKSPC ret;
92 ret = SetupCreateDiskSpaceListW(NULL, 0, 0);
93 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
95 win_skip("SetupCreateDiskSpaceListW is not implemented\n");
96 return;
98 ok(ret != NULL,
99 "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
101 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
103 ret = SetupCreateDiskSpaceListW(NULL, 0, SPDSL_IGNORE_DISK);
104 ok(ret != NULL,
105 "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
107 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
109 SetLastError(0xdeadbeef);
110 ret = SetupCreateDiskSpaceListW(NULL, 0, ~0U);
111 ok(ret == NULL ||
112 broken(ret != NULL), /* NT4/Win2k */
113 "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
114 if (!ret)
115 ok(GetLastError() == ERROR_INVALID_PARAMETER,
116 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
117 GetLastError());
118 else
119 ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
121 SetLastError(0xdeadbeef);
122 ret = SetupCreateDiskSpaceListW(NULL, 0xdeadbeef, 0);
123 ok(ret == NULL,
124 "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
125 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
126 broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
127 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
128 GetLastError());
130 SetLastError(0xdeadbeef);
131 ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0, 0);
132 ok(ret == NULL,
133 "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
134 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
135 broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
136 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
137 GetLastError());
139 SetLastError(0xdeadbeef);
140 ret = SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0);
141 ok(ret == NULL,
142 "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
143 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
144 broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
145 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
146 GetLastError());
149 static void test_SetupDuplicateDiskSpaceListA(void)
151 HDSKSPC handle, duplicate;
152 int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
153 GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
155 if (is_win9x)
156 win_skip("SetupDuplicateDiskSpaceListA crashes with NULL disk space handle on Win9x\n");
157 else
159 SetLastError(0xdeadbeef);
160 duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, 0);
161 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
162 ok(GetLastError() == ERROR_INVALID_HANDLE,
163 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
165 SetLastError(0xdeadbeef);
166 duplicate = SetupDuplicateDiskSpaceListA(NULL, (void *)0xdeadbeef, 0, 0);
167 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
168 ok(GetLastError() == ERROR_INVALID_PARAMETER,
169 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
171 SetLastError(0xdeadbeef);
172 duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0xdeadbeef, 0);
173 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
174 ok(GetLastError() == ERROR_INVALID_PARAMETER,
175 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
177 SetLastError(0xdeadbeef);
178 duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, ~0U);
179 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
180 ok(GetLastError() == ERROR_INVALID_PARAMETER,
181 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
184 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
185 ok(handle != NULL,
186 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
188 if (!handle)
190 skip("Failed to create a disk space handle\n");
191 return;
194 SetLastError(0xdeadbeef);
195 duplicate = SetupDuplicateDiskSpaceListA(handle, (void *)0xdeadbeef, 0, 0);
196 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
197 ok(GetLastError() == ERROR_INVALID_PARAMETER,
198 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
200 SetLastError(0xdeadbeef);
201 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0xdeadbeef, 0);
202 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
203 ok(GetLastError() == ERROR_INVALID_PARAMETER,
204 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
206 SetLastError(0xdeadbeef);
207 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, SPDSL_IGNORE_DISK);
208 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
209 ok(GetLastError() == ERROR_INVALID_PARAMETER,
210 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
212 SetLastError(0xdeadbeef);
213 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, ~0U);
214 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
215 ok(GetLastError() == ERROR_INVALID_PARAMETER,
216 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
218 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, 0);
219 ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
220 ok(duplicate != handle,
221 "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
223 ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
224 ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
227 static void test_SetupDuplicateDiskSpaceListW(void)
229 HDSKSPC handle, duplicate;
231 SetLastError(0xdeadbeef);
232 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, 0);
233 if (!duplicate && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
235 win_skip("SetupDuplicateDiskSpaceListW is not available\n");
236 return;
238 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
239 ok(GetLastError() == ERROR_INVALID_HANDLE,
240 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
242 SetLastError(0xdeadbeef);
243 duplicate = SetupDuplicateDiskSpaceListW(NULL, (void *)0xdeadbeef, 0, 0);
244 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
245 ok(GetLastError() == ERROR_INVALID_PARAMETER,
246 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
248 SetLastError(0xdeadbeef);
249 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0xdeadbeef, 0);
250 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
251 ok(GetLastError() == ERROR_INVALID_PARAMETER,
252 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
254 SetLastError(0xdeadbeef);
255 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, ~0U);
256 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
257 ok(GetLastError() == ERROR_INVALID_PARAMETER,
258 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
260 handle = SetupCreateDiskSpaceListW(NULL, 0, 0);
261 ok(handle != NULL,
262 "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
264 if (!handle)
266 skip("Failed to create a disk space handle\n");
267 return;
270 SetLastError(0xdeadbeef);
271 duplicate = SetupDuplicateDiskSpaceListW(handle, (void *)0xdeadbeef, 0, 0);
272 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
273 ok(GetLastError() == ERROR_INVALID_PARAMETER,
274 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
276 SetLastError(0xdeadbeef);
277 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0xdeadbeef, 0);
278 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
279 ok(GetLastError() == ERROR_INVALID_PARAMETER,
280 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
282 SetLastError(0xdeadbeef);
283 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, SPDSL_IGNORE_DISK);
284 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
285 ok(GetLastError() == ERROR_INVALID_PARAMETER,
286 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
288 SetLastError(0xdeadbeef);
289 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, ~0U);
290 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
291 ok(GetLastError() == ERROR_INVALID_PARAMETER,
292 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
294 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, 0);
295 ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
296 ok(duplicate != handle,
297 "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
299 ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
300 ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
303 static void test_SetupQuerySpaceRequiredOnDriveA(void)
305 BOOL ret;
306 HDSKSPC handle;
307 LONGLONG space;
308 int is_win9x = !SetupCreateDiskSpaceListW((void *)0xdeadbeef, 0xdeadbeef, 0) &&
309 GetLastError() == ERROR_CALL_NOT_IMPLEMENTED;
311 if (is_win9x)
312 win_skip("SetupQuerySpaceRequiredOnDriveA crashes with NULL disk space handle on Win9x\n");
313 else
315 SetLastError(0xdeadbeef);
316 ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, NULL, NULL, 0);
317 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
318 ok(GetLastError() == ERROR_INVALID_PARAMETER,
319 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
320 GetLastError());
322 SetLastError(0xdeadbeef);
323 space = 0xdeadbeef;
324 ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, &space, NULL, 0);
325 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
326 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
327 ok(GetLastError() == ERROR_INVALID_PARAMETER,
328 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
329 GetLastError());
331 SetLastError(0xdeadbeef);
332 ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", NULL, NULL, 0);
333 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
334 ok(GetLastError() == ERROR_INVALID_HANDLE,
335 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
336 GetLastError());
338 SetLastError(0xdeadbeef);
339 space = 0xdeadbeef;
340 ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", &space, NULL, 0);
341 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
342 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
343 ok(GetLastError() == ERROR_INVALID_HANDLE,
344 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
345 GetLastError());
348 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
349 ok(handle != NULL,
350 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
352 SetLastError(0xdeadbeef);
353 ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, NULL, NULL, 0);
354 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
355 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
356 GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
357 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
358 GetLastError());
360 SetLastError(0xdeadbeef);
361 space = 0xdeadbeef;
362 ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, &space, NULL, 0);
363 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
364 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
365 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
366 GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
367 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
368 GetLastError());
370 SetLastError(0xdeadbeef);
371 ret = SetupQuerySpaceRequiredOnDriveA(handle, "", NULL, NULL, 0);
372 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
373 ok(GetLastError() == ERROR_INVALID_DRIVE,
374 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
375 GetLastError());
377 SetLastError(0xdeadbeef);
378 space = 0xdeadbeef;
379 ret = SetupQuerySpaceRequiredOnDriveA(handle, "", &space, NULL, 0);
380 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
381 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
382 ok(GetLastError() == ERROR_INVALID_DRIVE,
383 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
384 GetLastError());
386 ok(SetupDestroyDiskSpaceList(handle),
387 "Expected SetupDestroyDiskSpaceList to succeed\n");
390 static void test_SetupQuerySpaceRequiredOnDriveW(void)
392 static const WCHAR emptyW[] = {0};
394 BOOL ret;
395 HDSKSPC handle;
396 LONGLONG space;
398 SetLastError(0xdeadbeef);
399 ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, NULL, NULL, 0);
400 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
402 win_skip("SetupQuerySpaceRequiredOnDriveW is not available\n");
403 return;
405 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
406 ok(GetLastError() == ERROR_INVALID_HANDLE,
407 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
408 GetLastError());
410 SetLastError(0xdeadbeef);
411 space = 0xdeadbeef;
412 ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, &space, NULL, 0);
413 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
414 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
415 ok(GetLastError() == ERROR_INVALID_HANDLE,
416 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
417 GetLastError());
419 SetLastError(0xdeadbeef);
420 ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, NULL, NULL, 0);
421 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
422 ok(GetLastError() == ERROR_INVALID_HANDLE,
423 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
424 GetLastError());
426 SetLastError(0xdeadbeef);
427 space = 0xdeadbeef;
428 ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, &space, NULL, 0);
429 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
430 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
431 ok(GetLastError() == ERROR_INVALID_HANDLE,
432 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
433 GetLastError());
435 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
436 ok(handle != NULL,
437 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
439 SetLastError(0xdeadbeef);
440 ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, NULL, NULL, 0);
441 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
442 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
443 GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
444 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
445 GetLastError());
447 SetLastError(0xdeadbeef);
448 space = 0xdeadbeef;
449 ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, &space, NULL, 0);
450 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
451 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
452 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
453 GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
454 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
455 GetLastError());
457 SetLastError(0xdeadbeef);
458 ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, NULL, NULL, 0);
459 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
460 ok(GetLastError() == ERROR_INVALID_DRIVE,
461 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
462 GetLastError());
464 SetLastError(0xdeadbeef);
465 space = 0xdeadbeef;
466 ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, &space, NULL, 0);
467 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
468 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
469 ok(GetLastError() == ERROR_INVALID_DRIVE,
470 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
471 GetLastError());
473 ok(SetupDestroyDiskSpaceList(handle),
474 "Expected SetupDestroyDiskSpaceList to succeed\n");
477 START_TEST(diskspace)
479 test_SetupCreateDiskSpaceListA();
480 test_SetupCreateDiskSpaceListW();
481 test_SetupDuplicateDiskSpaceListA();
482 test_SetupDuplicateDiskSpaceListW();
483 test_SetupQuerySpaceRequiredOnDriveA();
484 test_SetupQuerySpaceRequiredOnDriveW();