advpack: Fix a few failing tests in win95.
[wine] / dlls / advpack / tests / files.c
1 /*
2  * Unit tests for advpack.dll file 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 <advpub.h>
24 #include <fci.h>
25 #include "wine/test.h"
26
27 /* make the max size large so there is only one cab file */
28 #define MEDIA_SIZE          999999999
29 #define FOLDER_THRESHOLD    900000
30
31 /* function pointers */
32 HMODULE hAdvPack;
33 static HRESULT (WINAPI *pAddDelBackupEntry)(LPCSTR, LPCSTR, LPCSTR, DWORD);
34 static HRESULT (WINAPI *pExtractFiles)(LPCSTR, LPCSTR, DWORD, LPCSTR, LPVOID, DWORD);
35 static HRESULT (WINAPI *pAdvInstallFile)(HWND,LPCSTR,LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD);
36
37 CHAR CURR_DIR[MAX_PATH];
38
39 static void init_function_pointers(void)
40 {
41     hAdvPack = LoadLibraryA("advpack.dll");
42
43     if (hAdvPack)
44     {
45         pAddDelBackupEntry = (void *)GetProcAddress(hAdvPack, "AddDelBackupEntry");
46         pExtractFiles = (void *)GetProcAddress(hAdvPack, "ExtractFiles");
47         pAdvInstallFile = (void*)GetProcAddress(hAdvPack, "AdvInstallFile");
48     }
49 }
50
51 /* creates a file with the specified name for tests */
52 static void createTestFile(const CHAR *name)
53 {
54     HANDLE file;
55     DWORD written;
56
57     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
58     ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
59     WriteFile(file, name, strlen(name), &written, NULL);
60     WriteFile(file, "\n", strlen("\n"), &written, NULL);
61     CloseHandle(file);
62 }
63
64 static void create_test_files(void)
65 {
66     int len;
67
68     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
69     len = lstrlenA(CURR_DIR);
70
71     if(len && (CURR_DIR[len-1] == '\\'))
72         CURR_DIR[len-1] = 0;
73
74     createTestFile("a.txt");
75     createTestFile("b.txt");
76     CreateDirectoryA("testdir", NULL);
77     createTestFile("testdir\\c.txt");
78     createTestFile("testdir\\d.txt");
79     CreateDirectoryA("dest", NULL);
80 }
81
82 static void delete_test_files(void)
83 {
84     DeleteFileA("a.txt");
85     DeleteFileA("b.txt");
86     DeleteFileA("testdir\\c.txt");
87     DeleteFileA("testdir\\d.txt");
88     RemoveDirectoryA("testdir");
89     RemoveDirectoryA("dest");
90
91     DeleteFileA("extract.cab");
92 }
93
94 static BOOL check_ini_file_attr(LPSTR filename)
95 {
96     BOOL ret;
97     DWORD expected = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY;
98     DWORD attr = GetFileAttributesA(filename);
99
100     ret = (attr & expected) && (attr != INVALID_FILE_ATTRIBUTES);
101     SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL);
102
103     return ret;
104 }
105
106 static void test_AddDelBackupEntry(void)
107 {
108     HRESULT res;
109     CHAR path[MAX_PATH];
110     CHAR windir[MAX_PATH];
111
112     lstrcpyA(path, CURR_DIR);
113     lstrcatA(path, "\\backup\\basename.INI");
114
115     /* native AddDelBackupEntry crashes if lpcszBaseName is NULL */
116
117     /* try a NULL file list */
118     res = pAddDelBackupEntry(NULL, "backup", "basename", AADBE_ADD_ENTRY);
119     ok(res == S_OK, "Expected S_OK, got %d\n", res);
120     ok(!DeleteFileA(path), "Expected path to not exist\n");
121
122     lstrcpyA(path, CURR_DIR);
123     lstrcatA(path, "\\backup\\.INI");
124
125     /* try an empty base name */
126     res = pAddDelBackupEntry("one\0two\0three\0", "backup", "", AADBE_ADD_ENTRY);
127     ok(res == S_OK, "Expected S_OK, got %d\n", res);
128     ok(!DeleteFileA(path), "Expected path to not exist\n");
129
130     lstrcpyA(path, CURR_DIR);
131     lstrcatA(path, "\\basename.INI");
132
133     /* try an invalid flag */
134     res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", 0);
135     ok(res == S_OK, "Expected S_OK, got %d\n", res);
136     ok(!DeleteFileA(path), "Expected path to not exist\n");
137
138     lstrcpyA(path, "c:\\basename.INI");
139
140     /* create the INF file */
141     res = pAddDelBackupEntry("one\0two\0three\0", "c:\\", "basename", AADBE_ADD_ENTRY);
142     ok(res == S_OK, "Expected S_OK, got %d\n", res);
143     ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
144     ok(DeleteFileA(path), "Expected path to exist\n");
145
146     lstrcpyA(path, CURR_DIR);
147     lstrcatA(path, "\\backup\\basename.INI");
148
149     /* try to create the INI file in a nonexistent directory */
150     RemoveDirectoryA("backup");
151     res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
152     ok(res == S_OK, "Expected S_OK, got %d\n", res);
153     ok(!check_ini_file_attr(path), "Expected ini file to not be hidden\n");
154     ok(!DeleteFileA(path), "Expected path to not exist\n");
155
156     /* try an existent, relative backup directory */
157     CreateDirectoryA("backup", NULL);
158     res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
159     ok(res == S_OK, "Expected S_OK, got %d\n", res);
160     ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
161     ok(DeleteFileA(path), "Expected path to exist\n");
162     RemoveDirectoryA("backup");
163
164     GetWindowsDirectoryA(windir, sizeof(windir));
165     sprintf(path, "%s\\basename.INI", windir);
166
167     /* try a NULL backup dir, INI is created in the windows directory */
168     res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", AADBE_ADD_ENTRY);
169     ok(res == S_OK, "Expected S_OK, got %d\n", res);
170
171     /* remove the entries with AADBE_DEL_ENTRY */
172     SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
173     res = pAddDelBackupEntry("one\0three\0", NULL, "basename", AADBE_DEL_ENTRY);
174     SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
175     ok(res == S_OK, "Expected S_OK, got %d\n", res);
176     ok(DeleteFileA(path), "Expected path to exist\n");
177 }
178
179 /* the FCI callbacks */
180
181 static void *mem_alloc(ULONG cb)
182 {
183     return HeapAlloc(GetProcessHeap(), 0, cb);
184 }
185
186 static void mem_free(void *memory)
187 {
188     HeapFree(GetProcessHeap(), 0, memory);
189 }
190
191 static BOOL get_next_cabinet(PCCAB pccab, ULONG  cbPrevCab, void *pv)
192 {
193     return TRUE;
194 }
195
196 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
197 {
198     return 0;
199 }
200
201 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
202                        BOOL fContinuation, void *pv)
203 {
204     return 0;
205 }
206
207 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
208 {
209     HANDLE handle;
210     DWORD dwAccess = 0;
211     DWORD dwShareMode = 0;
212     DWORD dwCreateDisposition = OPEN_EXISTING;
213     
214     dwAccess = GENERIC_READ | GENERIC_WRITE;
215     /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
216     dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
217
218     if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
219         dwCreateDisposition = OPEN_EXISTING;
220     else
221         dwCreateDisposition = CREATE_NEW;
222
223     handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
224                          dwCreateDisposition, 0, NULL);
225
226     ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
227
228     return (INT_PTR)handle;
229 }
230
231 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
232 {
233     HANDLE handle = (HANDLE)hf;
234     DWORD dwRead;
235     BOOL res;
236     
237     res = ReadFile(handle, memory, cb, &dwRead, NULL);
238     ok(res, "Failed to ReadFile\n");
239
240     return dwRead;
241 }
242
243 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
244 {
245     HANDLE handle = (HANDLE)hf;
246     DWORD dwWritten;
247     BOOL res;
248
249     res = WriteFile(handle, memory, cb, &dwWritten, NULL);
250     ok(res, "Failed to WriteFile\n");
251
252     return dwWritten;
253 }
254
255 static int fci_close(INT_PTR hf, int *err, void *pv)
256 {
257     HANDLE handle = (HANDLE)hf;
258     ok(CloseHandle(handle), "Failed to CloseHandle\n");
259
260     return 0;
261 }
262
263 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
264 {
265     HANDLE handle = (HANDLE)hf;
266     DWORD ret;
267     
268     ret = SetFilePointer(handle, dist, NULL, seektype);
269     ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
270
271     return ret;
272 }
273
274 static int fci_delete(char *pszFile, int *err, void *pv)
275 {
276     BOOL ret = DeleteFileA(pszFile);
277     ok(ret, "Failed to DeleteFile %s\n", pszFile);
278
279     return 0;
280 }
281
282 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
283 {
284     LPSTR tempname;
285
286     tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
287     GetTempFileNameA(".", "xx", 0, tempname);
288
289     if (tempname && (strlen(tempname) < (unsigned)cbTempName))
290     {
291         lstrcpyA(pszTempName, tempname);
292         HeapFree(GetProcessHeap(), 0, tempname);
293         return TRUE;
294     }
295
296     HeapFree(GetProcessHeap(), 0, tempname);
297
298     return FALSE;
299 }
300
301 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
302                              USHORT *pattribs, int *err, void *pv)
303 {
304     BY_HANDLE_FILE_INFORMATION finfo;
305     FILETIME filetime;
306     HANDLE handle;
307     DWORD attrs;
308     BOOL res;
309
310     handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
311                         OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
312
313     ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
314
315     res = GetFileInformationByHandle(handle, &finfo);
316     ok(res, "Expected GetFileInformationByHandle to succeed\n");
317    
318     FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
319     FileTimeToDosDateTime(&filetime, pdate, ptime);
320
321     attrs = GetFileAttributes(pszName);
322     ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
323
324     return (INT_PTR)handle;
325 }
326
327 static void add_file(HFCI hfci, char *file)
328 {
329     char path[MAX_PATH];
330     BOOL res;
331
332     lstrcpyA(path, CURR_DIR);
333     lstrcatA(path, "\\");
334     lstrcatA(path, file);
335
336     res = FCIAddFile(hfci, path, file, FALSE, get_next_cabinet, progress,
337                      get_open_info, tcompTYPE_MSZIP);
338     ok(res, "Expected FCIAddFile to succeed\n");
339 }
340
341 static void set_cab_parameters(PCCAB pCabParams)
342 {
343     ZeroMemory(pCabParams, sizeof(CCAB));
344
345     pCabParams->cb = MEDIA_SIZE;
346     pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
347     pCabParams->setID = 0xbeef;
348     lstrcpyA(pCabParams->szCabPath, CURR_DIR);
349     lstrcatA(pCabParams->szCabPath, "\\");
350     lstrcpyA(pCabParams->szCab, "extract.cab");
351 }
352
353 static void create_cab_file(void)
354 {
355     CCAB cabParams;
356     HFCI hfci;
357     ERF erf;
358     static CHAR a_txt[] = "a.txt",
359                 b_txt[] = "b.txt",
360                 testdir_c_txt[] = "testdir\\c.txt",
361                 testdir_d_txt[] = "testdir\\d.txt";
362     BOOL res;
363
364     set_cab_parameters(&cabParams);
365
366     hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
367                       fci_read, fci_write, fci_close, fci_seek, fci_delete,
368                       get_temp_file, &cabParams, NULL);
369
370     ok(hfci != NULL, "Failed to create an FCI context\n");
371
372     add_file(hfci, a_txt);
373     add_file(hfci, b_txt);
374     add_file(hfci, testdir_c_txt);
375     add_file(hfci, testdir_d_txt);
376
377     res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
378     ok(res, "Failed to flush the cabinet\n");
379
380     res = FCIDestroy(hfci);
381     ok(res, "Failed to destroy the cabinet\n");
382 }
383
384 static void test_ExtractFiles(void)
385 {
386     HRESULT hr;
387     char destFolder[MAX_PATH];
388
389     lstrcpyA(destFolder, CURR_DIR);
390     lstrcatA(destFolder, "\\");
391     lstrcatA(destFolder, "dest");
392
393     /* try NULL cab file */
394     hr = pExtractFiles(NULL, destFolder, 0, NULL, NULL, 0);
395     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
396     ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
397     
398     /* try NULL destination */
399     hr = pExtractFiles("extract.cab", NULL, 0, NULL, NULL, 0);
400     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
401     ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
402
403     /* extract all files in the cab to nonexistent destination directory */
404     hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
405     ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) ||
406        hr == E_FAIL, /* win95 */
407        "Expected %08x or %08x, got %08x\n", E_FAIL,
408        HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), hr);
409     ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
410     ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
411     ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
412     ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
413
414     /* extract all files in the cab to the destination directory */
415     CreateDirectoryA("dest", NULL);
416     hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
417     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
418     ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
419     ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
420     ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
421     ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
422     ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
423
424     /* extract all files to a relative destination directory */
425     hr = pExtractFiles("extract.cab", "dest", 0, NULL, NULL, 0);
426     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
427     ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
428     ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
429     ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
430     ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
431     ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
432
433     /* only extract two of the files from the cab */
434     hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:testdir\\c.txt", NULL, 0);
435     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
436     ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
437     ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
438     ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
439     ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
440     ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
441
442     /* use valid chars before and after file list */
443     hr = pExtractFiles("extract.cab", "dest", 0, " :\t: a.txt:testdir\\c.txt  \t:", NULL, 0);
444     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
445     ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
446     ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
447     ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
448     ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
449     ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
450
451     /* use invalid chars before and after file list */
452     hr = pExtractFiles("extract.cab", "dest", 0, " +-\\ a.txt:testdir\\c.txt  a_:", NULL, 0);
453     ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
454     ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
455     ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
456     ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
457
458     /* try an empty file list */
459     hr = pExtractFiles("extract.cab", "dest", 0, "", NULL, 0);
460     ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
461     ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
462     ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
463
464     /* try a nonexistent file in the file list */
465     hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:idontexist:testdir\\c.txt", NULL, 0);
466     ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
467     ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
468     ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
469     ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
470 }
471
472 static void test_AdvInstallFile(void)
473 {
474     HRESULT hr;
475     HMODULE hmod;
476     char CURR_DIR[MAX_PATH];
477     char destFolder[MAX_PATH];
478
479     hmod = LoadLibrary("setupapi.dll");
480     if (!hmod)
481     {
482         skip("setupapi.dll not present\n");
483         return;
484     }
485
486     FreeLibrary(hmod);
487
488     GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
489
490     lstrcpyA(destFolder, CURR_DIR);
491     lstrcatA(destFolder, "\\");
492     lstrcatA(destFolder, "dest");
493
494     createTestFile("source.txt");
495
496     /* try invalid source directory */
497     hr = pAdvInstallFile(NULL, NULL, "source.txt", destFolder, "destination.txt", 0, 0);
498     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
499     ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
500
501     /* try invalid source file */
502     hr = pAdvInstallFile(NULL, CURR_DIR, NULL, destFolder, "destination.txt", 0, 0);
503     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
504     ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
505
506     /* try invalid destination directory */
507     hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", NULL, "destination.txt", 0, 0);
508     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
509     ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
510
511     /* try copying to nonexistent destination directory */
512     hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder, "destination.txt", 0, 0);
513     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
514     ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
515
516     /* native windows screws up if the source file doesn't exist */
517
518     /* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
519     createTestFile("dest\\destination.txt");
520     hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder,
521                          "destination.txt", AIF_NOOVERWRITE | AIF_QUIET, 0);
522     ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
523     ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
524     ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
525
526     DeleteFileA("source.txt");
527 }
528
529 START_TEST(files)
530 {
531     init_function_pointers();
532     create_test_files();
533     create_cab_file();
534
535     test_AddDelBackupEntry();
536     test_ExtractFiles();
537     test_AdvInstallFile();
538
539     delete_test_files();
540
541     FreeLibrary(hAdvPack);
542 }