xmllite: Drop superfluous casts to self.
[wine.git] / dlls / setupapi / tests / diskspace.c
blobdab6705eee33a9821bda925811bfa8f0bad86429
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;
153 SetLastError(0xdeadbeef);
154 duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, 0);
155 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
156 ok(GetLastError() == ERROR_INVALID_HANDLE,
157 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
159 SetLastError(0xdeadbeef);
160 duplicate = SetupDuplicateDiskSpaceListA(NULL, (void *)0xdeadbeef, 0, 0);
161 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
162 ok(GetLastError() == ERROR_INVALID_PARAMETER,
163 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
165 SetLastError(0xdeadbeef);
166 duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0xdeadbeef, 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, 0, ~0U);
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 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
178 ok(handle != NULL,
179 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
181 if (!handle)
183 skip("Failed to create a disk space handle\n");
184 return;
187 SetLastError(0xdeadbeef);
188 duplicate = SetupDuplicateDiskSpaceListA(handle, (void *)0xdeadbeef, 0, 0);
189 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
190 ok(GetLastError() == ERROR_INVALID_PARAMETER,
191 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
193 SetLastError(0xdeadbeef);
194 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0xdeadbeef, 0);
195 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
196 ok(GetLastError() == ERROR_INVALID_PARAMETER,
197 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
199 SetLastError(0xdeadbeef);
200 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, SPDSL_IGNORE_DISK);
201 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
202 ok(GetLastError() == ERROR_INVALID_PARAMETER,
203 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
205 SetLastError(0xdeadbeef);
206 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, ~0U);
207 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
208 ok(GetLastError() == ERROR_INVALID_PARAMETER,
209 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
211 duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, 0);
212 ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
213 ok(duplicate != handle,
214 "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
216 ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
217 ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
220 static void test_SetupDuplicateDiskSpaceListW(void)
222 HDSKSPC handle, duplicate;
224 SetLastError(0xdeadbeef);
225 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, 0);
226 if (!duplicate && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
228 win_skip("SetupDuplicateDiskSpaceListW is not available\n");
229 return;
231 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
232 ok(GetLastError() == ERROR_INVALID_HANDLE,
233 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
235 SetLastError(0xdeadbeef);
236 duplicate = SetupDuplicateDiskSpaceListW(NULL, (void *)0xdeadbeef, 0, 0);
237 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
238 ok(GetLastError() == ERROR_INVALID_PARAMETER,
239 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
241 SetLastError(0xdeadbeef);
242 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0xdeadbeef, 0);
243 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
244 ok(GetLastError() == ERROR_INVALID_PARAMETER,
245 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
247 SetLastError(0xdeadbeef);
248 duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, ~0U);
249 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
250 ok(GetLastError() == ERROR_INVALID_PARAMETER,
251 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
253 handle = SetupCreateDiskSpaceListW(NULL, 0, 0);
254 ok(handle != NULL,
255 "Expected SetupCreateDiskSpaceListW to return a valid handle, got NULL\n");
257 if (!handle)
259 skip("Failed to create a disk space handle\n");
260 return;
263 SetLastError(0xdeadbeef);
264 duplicate = SetupDuplicateDiskSpaceListW(handle, (void *)0xdeadbeef, 0, 0);
265 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
266 ok(GetLastError() == ERROR_INVALID_PARAMETER,
267 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
269 SetLastError(0xdeadbeef);
270 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0xdeadbeef, 0);
271 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
272 ok(GetLastError() == ERROR_INVALID_PARAMETER,
273 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
275 SetLastError(0xdeadbeef);
276 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, SPDSL_IGNORE_DISK);
277 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
278 ok(GetLastError() == ERROR_INVALID_PARAMETER,
279 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
281 SetLastError(0xdeadbeef);
282 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, ~0U);
283 ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
284 ok(GetLastError() == ERROR_INVALID_PARAMETER,
285 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
287 duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, 0);
288 ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
289 ok(duplicate != handle,
290 "Expected new handle (%p) to be different from the old handle (%p)\n", duplicate, handle);
292 ok(SetupDestroyDiskSpaceList(duplicate), "Expected SetupDestroyDiskSpaceList to succeed\n");
293 ok(SetupDestroyDiskSpaceList(handle), "Expected SetupDestroyDiskSpaceList to succeed\n");
296 static void test_SetupQuerySpaceRequiredOnDriveA(void)
298 BOOL ret;
299 HDSKSPC handle;
300 LONGLONG space;
302 SetLastError(0xdeadbeef);
303 ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, NULL, NULL, 0);
304 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
305 ok(GetLastError() == ERROR_INVALID_PARAMETER,
306 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
307 GetLastError());
309 SetLastError(0xdeadbeef);
310 space = 0xdeadbeef;
311 ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, &space, NULL, 0);
312 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
313 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
314 ok(GetLastError() == ERROR_INVALID_PARAMETER,
315 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
316 GetLastError());
318 SetLastError(0xdeadbeef);
319 ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", NULL, NULL, 0);
320 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
321 ok(GetLastError() == ERROR_INVALID_HANDLE,
322 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
323 GetLastError());
325 SetLastError(0xdeadbeef);
326 space = 0xdeadbeef;
327 ret = SetupQuerySpaceRequiredOnDriveA(NULL, "", &space, NULL, 0);
328 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
329 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
330 ok(GetLastError() == ERROR_INVALID_HANDLE,
331 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
332 GetLastError());
334 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
335 ok(handle != NULL,
336 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
338 SetLastError(0xdeadbeef);
339 ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, NULL, NULL, 0);
340 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
341 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
342 GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
343 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
344 GetLastError());
346 SetLastError(0xdeadbeef);
347 space = 0xdeadbeef;
348 ret = SetupQuerySpaceRequiredOnDriveA(handle, NULL, &space, NULL, 0);
349 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
350 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
351 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
352 GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
353 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
354 GetLastError());
356 SetLastError(0xdeadbeef);
357 ret = SetupQuerySpaceRequiredOnDriveA(handle, "", NULL, NULL, 0);
358 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
359 ok(GetLastError() == ERROR_INVALID_DRIVE,
360 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
361 GetLastError());
363 SetLastError(0xdeadbeef);
364 space = 0xdeadbeef;
365 ret = SetupQuerySpaceRequiredOnDriveA(handle, "", &space, NULL, 0);
366 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
367 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
368 ok(GetLastError() == ERROR_INVALID_DRIVE,
369 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
370 GetLastError());
372 ok(SetupDestroyDiskSpaceList(handle),
373 "Expected SetupDestroyDiskSpaceList to succeed\n");
376 static void test_SetupQuerySpaceRequiredOnDriveW(void)
378 static const WCHAR emptyW[] = {0};
380 BOOL ret;
381 HDSKSPC handle;
382 LONGLONG space;
384 SetLastError(0xdeadbeef);
385 ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, NULL, NULL, 0);
386 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
388 win_skip("SetupQuerySpaceRequiredOnDriveW is not available\n");
389 return;
391 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
392 ok(GetLastError() == ERROR_INVALID_HANDLE,
393 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
394 GetLastError());
396 SetLastError(0xdeadbeef);
397 space = 0xdeadbeef;
398 ret = SetupQuerySpaceRequiredOnDriveW(NULL, NULL, &space, NULL, 0);
399 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
400 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
401 ok(GetLastError() == ERROR_INVALID_HANDLE,
402 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
403 GetLastError());
405 SetLastError(0xdeadbeef);
406 ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, NULL, NULL, 0);
407 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
408 ok(GetLastError() == ERROR_INVALID_HANDLE,
409 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
410 GetLastError());
412 SetLastError(0xdeadbeef);
413 space = 0xdeadbeef;
414 ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, &space, NULL, 0);
415 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
416 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
417 ok(GetLastError() == ERROR_INVALID_HANDLE,
418 "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
419 GetLastError());
421 handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
422 ok(handle != NULL,
423 "Expected SetupCreateDiskSpaceListA to return a valid handle, got NULL\n");
425 SetLastError(0xdeadbeef);
426 ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, NULL, NULL, 0);
427 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
428 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
429 GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
430 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
431 GetLastError());
433 SetLastError(0xdeadbeef);
434 space = 0xdeadbeef;
435 ret = SetupQuerySpaceRequiredOnDriveW(handle, NULL, &space, NULL, 0);
436 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
437 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
438 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
439 GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
440 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
441 GetLastError());
443 SetLastError(0xdeadbeef);
444 ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, NULL, NULL, 0);
445 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
446 ok(GetLastError() == ERROR_INVALID_DRIVE,
447 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
448 GetLastError());
450 SetLastError(0xdeadbeef);
451 space = 0xdeadbeef;
452 ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, &space, NULL, 0);
453 ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
454 ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
455 ok(GetLastError() == ERROR_INVALID_DRIVE,
456 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
457 GetLastError());
459 ok(SetupDestroyDiskSpaceList(handle),
460 "Expected SetupDestroyDiskSpaceList to succeed\n");
463 START_TEST(diskspace)
465 test_SetupCreateDiskSpaceListA();
466 test_SetupCreateDiskSpaceListW();
467 test_SetupDuplicateDiskSpaceListA();
468 test_SetupDuplicateDiskSpaceListW();
469 test_SetupQuerySpaceRequiredOnDriveA();
470 test_SetupQuerySpaceRequiredOnDriveW();