wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / setupapi / tests / setupcab.c
blob0bfab8142c23d04d3d751dcb91d7c64e592f47d3
1 /*
2 * Unit tests for SetupIterateCabinet
4 * Copyright 2007 Hans Leidekker
5 * Copyright 2010 Andrew Nguyen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "winreg.h"
29 #include "setupapi.h"
30 #include "wine/test.h"
32 static const BYTE comp_cab_zip_multi[] = {
33 0x4d, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
35 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00,
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x38, 0xf0, 0x48, 0x20, 0x00, 0x74, 0x72, 0x69, 0x73,
37 0x74, 0x72, 0x61, 0x6d, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1,
38 0x38, 0xf0, 0x48, 0x20, 0x00, 0x77, 0x69, 0x6e, 0x65, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00,
39 0x00, 0x00, 0x00, 0x00, 0xd1, 0x38, 0xf0, 0x48, 0x20, 0x00, 0x73, 0x68, 0x61, 0x6e, 0x64, 0x79,
40 0x00, 0x67, 0x2c, 0x03, 0x85, 0x23, 0x00, 0x20, 0x00, 0x43, 0x4b, 0xcb, 0x49, 0x2c, 0x2d, 0x4a,
41 0xcd, 0x4b, 0x4e, 0xe5, 0xe5, 0x2a, 0xcd, 0x4b, 0xce, 0xcf, 0x2d, 0x28, 0x4a, 0x2d, 0x2e, 0x4e,
42 0x4d, 0xe1, 0xe5, 0x2a, 0x2e, 0x49, 0x2d, 0xca, 0x03, 0x8a, 0x02, 0x00
45 static const WCHAR docW[] = {'d','o','c',0};
47 static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size)
49 HANDLE handle;
50 DWORD written;
52 handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
53 FILE_ATTRIBUTE_NORMAL, NULL);
54 WriteFile(handle, data, size, &written, NULL);
55 CloseHandle(handle);
58 static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size)
60 HANDLE handle;
61 DWORD written;
63 handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
64 FILE_ATTRIBUTE_NORMAL, NULL);
65 WriteFile(handle, data, size, &written, NULL);
66 CloseHandle(handle);
69 static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification,
70 UINT_PTR Param1, UINT_PTR Param2)
72 ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
73 Notification, Param1, Param2);
74 return 0;
77 static UINT CALLBACK dummy_callbackW(PVOID Context, UINT Notification,
78 UINT_PTR Param1, UINT_PTR Param2)
80 ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
81 Notification, Param1, Param2);
82 return 0;
85 static void test_invalid_parametersA(void)
87 BOOL ret;
88 char source[MAX_PATH], temp[MAX_PATH];
89 int i;
91 const struct
93 PCSTR CabinetFile;
94 PSP_FILE_CALLBACK_A MsgHandler;
95 DWORD expected_lasterror;
96 int todo_lasterror;
97 } invalid_parameters[] =
99 {NULL, NULL, ERROR_INVALID_PARAMETER},
100 {NULL, dummy_callbackA, ERROR_INVALID_PARAMETER},
101 {"c:\\nonexistent.cab", NULL, ERROR_FILE_NOT_FOUND},
102 {"c:\\nonexistent.cab", dummy_callbackA, ERROR_FILE_NOT_FOUND},
103 {source, NULL, ERROR_INVALID_DATA, 1},
104 {source, dummy_callbackA, ERROR_INVALID_DATA, 1},
107 GetTempPathA(sizeof(temp), temp);
108 GetTempFileNameA(temp, "doc", 0, source);
110 create_source_fileA(source, NULL, 0);
112 for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
114 SetLastError(0xdeadbeef);
115 ret = SetupIterateCabinetA(invalid_parameters[i].CabinetFile, 0,
116 invalid_parameters[i].MsgHandler, NULL);
117 ok(!ret, "[%d] Expected SetupIterateCabinetA to return 0, got %d\n", i, ret);
118 todo_wine_if (invalid_parameters[i].todo_lasterror)
119 ok(GetLastError() == invalid_parameters[i].expected_lasterror,
120 "[%d] Expected GetLastError() to return %u, got %u\n",
121 i, invalid_parameters[i].expected_lasterror, GetLastError());
124 SetLastError(0xdeadbeef);
125 ret = SetupIterateCabinetA("", 0, NULL, NULL);
126 ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
127 ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
128 GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
129 "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
130 GetLastError());
132 SetLastError(0xdeadbeef);
133 ret = SetupIterateCabinetA("", 0, dummy_callbackA, NULL);
134 ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
135 ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
136 GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
137 "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
138 GetLastError());
140 DeleteFileA(source);
143 static void test_invalid_parametersW(void)
145 static const WCHAR nonexistentW[] = {'c',':','\\','n','o','n','e','x','i','s','t','e','n','t','.','c','a','b',0};
146 static const WCHAR emptyW[] = {0};
148 BOOL ret;
149 WCHAR source[MAX_PATH], temp[MAX_PATH];
150 int i;
152 const struct
154 PCWSTR CabinetFile;
155 PSP_FILE_CALLBACK_W MsgHandler;
156 DWORD expected_lasterror;
157 int todo_lasterror;
158 } invalid_parameters[] =
160 {nonexistentW, NULL, ERROR_FILE_NOT_FOUND},
161 {nonexistentW, dummy_callbackW, ERROR_FILE_NOT_FOUND},
162 {source, NULL, ERROR_INVALID_DATA, 1},
163 {source, dummy_callbackW, ERROR_INVALID_DATA, 1},
166 ret = SetupIterateCabinetW(NULL, 0, NULL, NULL);
167 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
169 win_skip("SetupIterateCabinetW is not available\n");
170 return;
173 GetTempPathW(ARRAY_SIZE(temp), temp);
174 GetTempFileNameW(temp, docW, 0, source);
176 create_source_fileW(source, NULL, 0);
178 for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
180 SetLastError(0xdeadbeef);
181 ret = SetupIterateCabinetW(invalid_parameters[i].CabinetFile, 0,
182 invalid_parameters[i].MsgHandler, NULL);
183 ok(!ret, "[%d] Expected SetupIterateCabinetW to return 0, got %d\n", i, ret);
184 todo_wine_if (invalid_parameters[i].todo_lasterror)
185 ok(GetLastError() == invalid_parameters[i].expected_lasterror,
186 "[%d] Expected GetLastError() to return %u, got %u\n",
187 i, invalid_parameters[i].expected_lasterror, GetLastError());
190 SetLastError(0xdeadbeef);
191 ret = SetupIterateCabinetW(NULL, 0, NULL, NULL);
192 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
193 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
194 GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
195 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
196 GetLastError());
198 SetLastError(0xdeadbeef);
199 ret = SetupIterateCabinetW(NULL, 0, dummy_callbackW, NULL);
200 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
201 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
202 GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
203 "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
204 GetLastError());
206 SetLastError(0xdeadbeef);
207 ret = SetupIterateCabinetW(emptyW, 0, NULL, NULL);
208 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
209 ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
210 GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
211 "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
212 GetLastError());
214 SetLastError(0xdeadbeef);
215 ret = SetupIterateCabinetW(emptyW, 0, dummy_callbackW, NULL);
216 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
217 ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
218 GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
219 "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
220 GetLastError());
222 DeleteFileW(source);
225 static UINT CALLBACK crash_callbackA(PVOID Context, UINT Notification,
226 UINT_PTR Param1, UINT_PTR Param2)
228 *(volatile char*)0 = 2;
229 return 0;
232 static UINT CALLBACK crash_callbackW(PVOID Context, UINT Notification,
233 UINT_PTR Param1, UINT_PTR Param2)
235 *(volatile char*)0 = 2;
236 return 0;
239 static void test_invalid_callbackA(void)
241 BOOL ret;
242 char source[MAX_PATH], temp[MAX_PATH];
244 GetTempPathA(sizeof(temp), temp);
245 GetTempFileNameA(temp, "doc", 0, source);
247 create_source_fileA(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
249 SetLastError(0xdeadbeef);
250 ret = SetupIterateCabinetA(source, 0, NULL, NULL);
251 ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
252 ok(GetLastError() == ERROR_INVALID_DATA,
253 "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
254 GetLastError());
256 SetLastError(0xdeadbeef);
257 ret = SetupIterateCabinetA(source, 0, crash_callbackA, NULL);
258 ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
259 ok(GetLastError() == ERROR_INVALID_DATA,
260 "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
261 GetLastError());
263 DeleteFileA(source);
266 static void test_invalid_callbackW(void)
268 BOOL ret;
269 WCHAR source[MAX_PATH], temp[MAX_PATH];
271 ret = SetupIterateCabinetW(NULL, 0, NULL, NULL);
272 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
274 win_skip("SetupIterateCabinetW is not available\n");
275 return;
278 GetTempPathW(ARRAY_SIZE(temp), temp);
279 GetTempFileNameW(temp, docW, 0, source);
281 create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
283 SetLastError(0xdeadbeef);
284 ret = SetupIterateCabinetW(source, 0, NULL, NULL);
285 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
286 ok(GetLastError() == ERROR_INVALID_DATA,
287 "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
288 GetLastError());
290 SetLastError(0xdeadbeef);
291 ret = SetupIterateCabinetW(source, 0, crash_callbackW, NULL);
292 ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
293 ok(GetLastError() == ERROR_INVALID_DATA,
294 "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
295 GetLastError());
297 DeleteFileW(source);
300 static const struct
302 const char *nameA;
303 const WCHAR *nameW;
304 DWORD size;
306 expected_files[] =
308 {"tristram", L"tristram", 10},
309 {"wine", L"wine", 14},
310 {"shandy", L"shandy", 8},
313 static UINT CALLBACK simple_callbackA(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
315 static int index;
316 int *file_count = context;
318 switch (message)
320 case SPFILENOTIFY_CABINETINFO:
322 const CABINET_INFO_A *info = (const CABINET_INFO_A *)param1;
323 char temp[MAX_PATH];
325 GetTempPathA(ARRAY_SIZE(temp), temp);
326 ok(!strcmp(info->CabinetPath, temp), "Got path %s.\n", debugstr_a(info->CabinetPath));
327 ok(!info->CabinetFile[0], "Got file %s.\n", debugstr_a(info->CabinetFile));
328 ok(!info->DiskName[0], "Got disk name %s.\n", debugstr_a(info->DiskName));
329 ok(!info->SetId, "Got set ID %#x.\n", info->SetId);
330 ok(!info->CabinetNumber, "Got cabinet number %u.\n", info->CabinetNumber);
331 ok(!param2, "Got param2 %#Ix.\n", param2);
332 return ERROR_SUCCESS;
335 case SPFILENOTIFY_FILEINCABINET:
337 FILE_IN_CABINET_INFO_A *info = (FILE_IN_CABINET_INFO_A *)param1;
338 char temp[MAX_PATH], path[MAX_PATH];
340 (*file_count)++;
342 ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
343 ok(!strcmp(info->NameInCabinet, expected_files[index].nameA),
344 "%u: Got file name %s.\n", index, debugstr_a(info->NameInCabinet));
345 ok(info->FileSize == expected_files[index].size, "%u: Got file size %u.\n", index, info->FileSize);
346 ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
347 ok(info->DosDate == 14545, "%u: Got date %u.\n", index, info->DosDate);
348 ok(info->DosTime == 18672, "%u: Got time %u.\n", index, info->DosTime);
349 ok(info->DosAttribs == FILE_ATTRIBUTE_ARCHIVE, "%u: Got attributes %#x.\n", index, info->DosAttribs);
351 GetTempPathA(ARRAY_SIZE(temp), temp);
352 snprintf(path, ARRAY_SIZE(path), "%s/./testcab.cab", temp);
353 ok(!strcmp((const char *)param2, path), "%u: Got file name %s.\n",
354 index, debugstr_a((const char *)param2));
356 snprintf(info->FullTargetName, ARRAY_SIZE(info->FullTargetName),
357 "%s\\%s", temp, expected_files[index].nameA);
359 return FILEOP_DOIT;
362 case SPFILENOTIFY_FILEEXTRACTED:
364 const FILEPATHS_A *info = (const FILEPATHS_A *)param1;
365 char temp[MAX_PATH], path[MAX_PATH];
367 GetTempPathA(ARRAY_SIZE(temp), temp);
368 ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
369 snprintf(path, ARRAY_SIZE(path), "%s/./testcab.cab", temp);
370 ok(!strcmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_a(info->Source));
371 snprintf(path, ARRAY_SIZE(path), "%s\\%s", temp, expected_files[index].nameA);
372 ok(!strcmp(info->Target, path), "%u: Got target %s.\n", index, debugstr_a(info->Target));
373 ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
374 /* info->Flags seems to contain garbage. */
376 ok(!param2, "Got param2 %#Ix.\n", param2);
377 ++index;
378 return ERROR_SUCCESS;
381 default:
382 ok(0, "Unexpected message %#x.\n", message);
383 return ERROR_CALL_NOT_IMPLEMENTED;
387 static void test_simple_enumerationA(void)
389 BOOL ret;
390 char temp[MAX_PATH], path[MAX_PATH];
391 unsigned int enum_count = 0, i;
393 ret = SetupIterateCabinetA(NULL, 0, NULL, NULL);
394 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
396 win_skip("SetupIterateCabinetW is not available\n");
397 return;
400 GetTempPathA(ARRAY_SIZE(temp), temp);
401 snprintf(path, ARRAY_SIZE(path), "%s/./testcab.cab", temp);
403 create_source_fileA(path, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
405 ret = SetupIterateCabinetA(path, 0, simple_callbackA, &enum_count);
406 ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret);
407 ok(enum_count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", enum_count);
409 for (i = 0; i < ARRAY_SIZE(expected_files); ++i)
411 snprintf(path, ARRAY_SIZE(path), "%s\\%s", temp, expected_files[i].nameA);
412 ret = DeleteFileA(path);
413 ok(ret, "Failed to delete %s, error %u.\n", debugstr_a(path), GetLastError());
416 snprintf(path, ARRAY_SIZE(path), "%s\\testcab.cab", temp);
417 ret = DeleteFileA(path);
418 ok(ret, "Failed to delete %s, error %u.\n", debugstr_a(path), GetLastError());
421 static UINT CALLBACK simple_callbackW(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
423 static int index;
424 int *file_count = context;
426 switch (message)
428 case SPFILENOTIFY_CABINETINFO:
430 const CABINET_INFO_W *info = (const CABINET_INFO_W *)param1;
431 WCHAR temp[MAX_PATH];
433 GetTempPathW(ARRAY_SIZE(temp), temp);
434 ok(!wcscmp(info->CabinetPath, temp), "Got path %s.\n", debugstr_w(info->CabinetPath));
435 ok(!info->CabinetFile[0], "Got file %s.\n", debugstr_w(info->CabinetFile));
436 ok(!info->DiskName[0], "Got disk name %s.\n", debugstr_w(info->DiskName));
437 ok(!info->SetId, "Got set ID %#x.\n", info->SetId);
438 ok(!info->CabinetNumber, "Got cabinet number %u.\n", info->CabinetNumber);
439 ok(!param2, "Got param2 %#Ix.\n", param2);
440 return ERROR_SUCCESS;
443 case SPFILENOTIFY_FILEINCABINET:
445 FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)param1;
446 WCHAR temp[MAX_PATH], path[MAX_PATH];
448 (*file_count)++;
450 ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
451 ok(!wcscmp(info->NameInCabinet, expected_files[index].nameW),
452 "%u: Got file name %s.\n", index, debugstr_w(info->NameInCabinet));
453 ok(info->FileSize == expected_files[index].size, "%u: Got file size %u.\n", index, info->FileSize);
454 ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
455 ok(info->DosDate == 14545, "%u: Got date %u.\n", index, info->DosDate);
456 ok(info->DosTime == 18672, "%u: Got time %u.\n", index, info->DosTime);
457 ok(info->DosAttribs == FILE_ATTRIBUTE_ARCHIVE, "%u: Got attributes %#x.\n", index, info->DosAttribs);
459 GetTempPathW(ARRAY_SIZE(temp), temp);
460 swprintf(path, ARRAY_SIZE(path), L"%s/./testcab.cab", temp);
461 ok(!wcscmp((const WCHAR *)param2, path), "%u: Got file name %s.\n",
462 index, debugstr_w((const WCHAR *)param2));
464 swprintf(info->FullTargetName, ARRAY_SIZE(info->FullTargetName),
465 L"%s\\%s", temp, expected_files[index].nameW);
467 return FILEOP_DOIT;
470 case SPFILENOTIFY_FILEEXTRACTED:
472 const FILEPATHS_W *info = (const FILEPATHS_W *)param1;
473 WCHAR temp[MAX_PATH], path[MAX_PATH];
475 GetTempPathW(ARRAY_SIZE(temp), temp);
476 ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
477 swprintf(path, ARRAY_SIZE(path), L"%s/./testcab.cab", temp);
478 ok(!wcscmp(info->Source, path), "%u: Got source %s.\n", index, debugstr_w(info->Source));
479 swprintf(path, ARRAY_SIZE(path), L"%s\\%s", temp, expected_files[index].nameW);
480 ok(!wcscmp(info->Target, path), "%u: Got target %s.\n", index, debugstr_w(info->Target));
481 ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
482 /* info->Flags seems to contain garbage. */
484 ok(!param2, "Got param2 %#Ix.\n", param2);
485 ++index;
486 return ERROR_SUCCESS;
489 default:
490 ok(0, "Unexpected message %#x.\n", message);
491 return ERROR_CALL_NOT_IMPLEMENTED;
495 static void test_simple_enumerationW(void)
497 BOOL ret;
498 WCHAR temp[MAX_PATH], path[MAX_PATH];
499 unsigned int enum_count = 0, i;
501 ret = SetupIterateCabinetW(NULL, 0, NULL, NULL);
502 if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
504 win_skip("SetupIterateCabinetW is not available\n");
505 return;
508 GetTempPathW(ARRAY_SIZE(temp), temp);
509 swprintf(path, ARRAY_SIZE(path), L"%s/./testcab.cab", temp);
511 create_source_fileW(path, comp_cab_zip_multi, sizeof(comp_cab_zip_multi));
513 ret = SetupIterateCabinetW(path, 0, simple_callbackW, &enum_count);
514 ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret);
515 ok(enum_count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", enum_count);
517 for (i = 0; i < ARRAY_SIZE(expected_files); ++i)
519 swprintf(path, ARRAY_SIZE(path), L"%s\\%s", temp, expected_files[i].nameW);
520 ret = DeleteFileW(path);
521 ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(path), GetLastError());
524 swprintf(path, ARRAY_SIZE(path), L"%s\\testcab.cab", temp);
525 ret = DeleteFileW(path);
526 ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(path), GetLastError());
529 START_TEST(setupcab)
531 test_invalid_parametersA();
532 test_invalid_parametersW();
534 /* Tests crash on NT4/Win9x/Win2k and Wine. */
535 if (0)
537 test_invalid_callbackA();
538 test_invalid_callbackW();
541 test_simple_enumerationA();
542 test_simple_enumerationW();