2 * Unit tests for advpack.dll file functions
4 * Copyright (C) 2006 James Hawkins
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
25 #include "wine/test.h"
27 /* make the max size large so there is only one cab file */
28 #define MEDIA_SIZE 999999999
29 #define FOLDER_THRESHOLD 900000
31 /* function pointers */
32 static 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
*pExtractFilesW
)(const WCHAR
*,const WCHAR
*,DWORD
,const WCHAR
*,void*,DWORD
);
36 static HRESULT (WINAPI
*pAdvInstallFile
)(HWND
,LPCSTR
,LPCSTR
,LPCSTR
,LPCSTR
,DWORD
,DWORD
);
38 static CHAR CURR_DIR
[MAX_PATH
];
40 static void init_function_pointers(void)
42 hAdvPack
= LoadLibraryA("advpack.dll");
46 pAddDelBackupEntry
= (void *)GetProcAddress(hAdvPack
, "AddDelBackupEntry");
47 pExtractFiles
= (void *)GetProcAddress(hAdvPack
, "ExtractFiles");
48 pExtractFilesW
= (void *)GetProcAddress(hAdvPack
, "ExtractFilesW");
49 pAdvInstallFile
= (void*)GetProcAddress(hAdvPack
, "AdvInstallFile");
53 /* creates a file with the specified name for tests */
54 static void createTestFile(const CHAR
*name
)
59 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
60 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
61 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
62 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
66 static void create_test_files(void)
68 createTestFile("a.txt");
69 createTestFile("b.txt");
70 CreateDirectoryA("testdir", NULL
);
71 createTestFile("testdir\\c.txt");
72 createTestFile("testdir\\d.txt");
73 CreateDirectoryA("dest", NULL
);
76 static void delete_test_files(void)
80 DeleteFileA("testdir\\c.txt");
81 DeleteFileA("testdir\\d.txt");
82 RemoveDirectoryA("testdir");
83 RemoveDirectoryA("dest");
85 DeleteFileA("extract.cab");
88 static BOOL
check_ini_file_attr(LPSTR filename
)
91 DWORD expected
= FILE_ATTRIBUTE_HIDDEN
| FILE_ATTRIBUTE_READONLY
;
92 DWORD attr
= GetFileAttributesA(filename
);
94 ret
= (attr
& expected
) && (attr
!= INVALID_FILE_ATTRIBUTES
);
95 SetFileAttributesA(filename
, FILE_ATTRIBUTE_NORMAL
);
100 static void test_AddDelBackupEntry(void)
104 CHAR path
[MAX_PATH
+ 13];
105 CHAR windir
[MAX_PATH
];
107 lstrcpyA(path
, CURR_DIR
);
108 lstrcatA(path
, "\\backup\\basename.INI");
110 /* native AddDelBackupEntry crashes if lpcszBaseName is NULL */
112 /* try a NULL file list */
113 res
= pAddDelBackupEntry(NULL
, "backup", "basename", AADBE_ADD_ENTRY
);
114 ok(res
== S_OK
, "Expected S_OK, got %d\n", res
);
115 ok(!DeleteFileA(path
), "Expected path to not exist\n");
117 lstrcpyA(path
, CURR_DIR
);
118 lstrcatA(path
, "\\backup\\.INI");
120 /* try an empty base name */
121 res
= pAddDelBackupEntry("one\0two\0three\0", "backup", "", AADBE_ADD_ENTRY
);
122 ok(res
== S_OK
, "Expected S_OK, got %d\n", res
);
123 ok(!DeleteFileA(path
), "Expected path to not exist\n");
125 lstrcpyA(path
, CURR_DIR
);
126 lstrcatA(path
, "\\basename.INI");
128 /* try an invalid flag */
129 res
= pAddDelBackupEntry("one\0two\0three\0", NULL
, "basename", 0);
130 ok(res
== S_OK
, "Expected S_OK, got %d\n", res
);
131 ok(!DeleteFileA(path
), "Expected path to not exist\n");
133 lstrcpyA(path
, "c:\\basename.INI");
135 /* create the INF file */
136 res
= pAddDelBackupEntry("one\0two\0three\0", "c:\\", "basename", AADBE_ADD_ENTRY
);
137 ok(res
== S_OK
, "Expected S_OK, got %d\n", res
);
138 if (GetFileAttributesA(path
) != INVALID_FILE_ATTRIBUTES
)
140 ok(check_ini_file_attr(path
), "Expected ini file to be hidden\n");
141 ok(DeleteFileA(path
), "Expected path to exist\n");
144 win_skip("Test file could not be created\n");
146 lstrcpyA(path
, CURR_DIR
);
147 lstrcatA(path
, "\\backup\\basename.INI");
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");
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");
164 GetWindowsDirectoryA(windir
, sizeof(windir
));
165 sprintf(path
, "%s\\basename.INI", windir
);
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
);
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 ret
= DeleteFileA(path
);
178 broken(ret
== FALSE
), /* win98 */
179 "Expected path to exist\n");
182 /* the FCI callbacks */
184 static void * CDECL
mem_alloc(ULONG cb
)
186 return HeapAlloc(GetProcessHeap(), 0, cb
);
189 static void CDECL
mem_free(void *memory
)
191 HeapFree(GetProcessHeap(), 0, memory
);
194 static BOOL CDECL
get_next_cabinet(PCCAB pccab
, ULONG cbPrevCab
, void *pv
)
199 static LONG CDECL
progress(UINT typeStatus
, ULONG cb1
, ULONG cb2
, void *pv
)
204 static int CDECL
file_placed(PCCAB pccab
, char *pszFile
, LONG cbFile
,
205 BOOL fContinuation
, void *pv
)
210 static INT_PTR CDECL
fci_open(char *pszFile
, int oflag
, int pmode
, int *err
, void *pv
)
214 DWORD dwShareMode
= 0;
215 DWORD dwCreateDisposition
= OPEN_EXISTING
;
217 dwAccess
= GENERIC_READ
| GENERIC_WRITE
;
218 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
219 dwShareMode
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
221 if (GetFileAttributesA(pszFile
) != INVALID_FILE_ATTRIBUTES
)
222 dwCreateDisposition
= OPEN_EXISTING
;
224 dwCreateDisposition
= CREATE_NEW
;
226 handle
= CreateFileA(pszFile
, dwAccess
, dwShareMode
, NULL
,
227 dwCreateDisposition
, 0, NULL
);
229 ok(handle
!= INVALID_HANDLE_VALUE
, "Failed to CreateFile %s\n", pszFile
);
231 return (INT_PTR
)handle
;
234 static UINT CDECL
fci_read(INT_PTR hf
, void *memory
, UINT cb
, int *err
, void *pv
)
236 HANDLE handle
= (HANDLE
)hf
;
240 res
= ReadFile(handle
, memory
, cb
, &dwRead
, NULL
);
241 ok(res
, "Failed to ReadFile\n");
246 static UINT CDECL
fci_write(INT_PTR hf
, void *memory
, UINT cb
, int *err
, void *pv
)
248 HANDLE handle
= (HANDLE
)hf
;
252 res
= WriteFile(handle
, memory
, cb
, &dwWritten
, NULL
);
253 ok(res
, "Failed to WriteFile\n");
258 static int CDECL
fci_close(INT_PTR hf
, int *err
, void *pv
)
260 HANDLE handle
= (HANDLE
)hf
;
261 ok(CloseHandle(handle
), "Failed to CloseHandle\n");
266 static LONG CDECL
fci_seek(INT_PTR hf
, LONG dist
, int seektype
, int *err
, void *pv
)
268 HANDLE handle
= (HANDLE
)hf
;
271 ret
= SetFilePointer(handle
, dist
, NULL
, seektype
);
272 ok(ret
!= INVALID_SET_FILE_POINTER
, "Failed to SetFilePointer\n");
277 static int CDECL
fci_delete(char *pszFile
, int *err
, void *pv
)
279 BOOL ret
= DeleteFileA(pszFile
);
280 ok(ret
, "Failed to DeleteFile %s\n", pszFile
);
285 static BOOL CDECL
get_temp_file(char *pszTempName
, int cbTempName
, void *pv
)
289 tempname
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
290 GetTempFileNameA(".", "xx", 0, tempname
);
292 if (tempname
&& (strlen(tempname
) < (unsigned)cbTempName
))
294 lstrcpyA(pszTempName
, tempname
);
295 HeapFree(GetProcessHeap(), 0, tempname
);
299 HeapFree(GetProcessHeap(), 0, tempname
);
304 static INT_PTR CDECL
get_open_info(char *pszName
, USHORT
*pdate
, USHORT
*ptime
,
305 USHORT
*pattribs
, int *err
, void *pv
)
307 BY_HANDLE_FILE_INFORMATION finfo
;
313 handle
= CreateFileA(pszName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
314 OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_SEQUENTIAL_SCAN
, NULL
);
316 ok(handle
!= INVALID_HANDLE_VALUE
, "Failed to CreateFile %s\n", pszName
);
318 res
= GetFileInformationByHandle(handle
, &finfo
);
319 ok(res
, "Expected GetFileInformationByHandle to succeed\n");
321 FileTimeToLocalFileTime(&finfo
.ftLastWriteTime
, &filetime
);
322 FileTimeToDosDateTime(&filetime
, pdate
, ptime
);
324 attrs
= GetFileAttributesA(pszName
);
325 ok(attrs
!= INVALID_FILE_ATTRIBUTES
, "Failed to GetFileAttributes\n");
327 return (INT_PTR
)handle
;
330 static void add_file(HFCI hfci
, char *file
)
335 lstrcpyA(path
, CURR_DIR
);
336 lstrcatA(path
, "\\");
337 lstrcatA(path
, file
);
339 res
= FCIAddFile(hfci
, path
, file
, FALSE
, get_next_cabinet
, progress
,
340 get_open_info
, tcompTYPE_MSZIP
);
341 ok(res
, "Expected FCIAddFile to succeed\n");
344 static void set_cab_parameters(PCCAB pCabParams
)
346 ZeroMemory(pCabParams
, sizeof(CCAB
));
348 pCabParams
->cb
= MEDIA_SIZE
;
349 pCabParams
->cbFolderThresh
= FOLDER_THRESHOLD
;
350 pCabParams
->setID
= 0xbeef;
351 lstrcpyA(pCabParams
->szCabPath
, CURR_DIR
);
352 lstrcatA(pCabParams
->szCabPath
, "\\");
353 lstrcpyA(pCabParams
->szCab
, "extract.cab");
356 static void create_cab_file(void)
361 static CHAR a_txt
[] = "a.txt",
363 testdir_c_txt
[] = "testdir\\c.txt",
364 testdir_d_txt
[] = "testdir\\d.txt";
367 set_cab_parameters(&cabParams
);
369 hfci
= FCICreate(&erf
, file_placed
, mem_alloc
, mem_free
, fci_open
,
370 fci_read
, fci_write
, fci_close
, fci_seek
, fci_delete
,
371 get_temp_file
, &cabParams
, NULL
);
373 ok(hfci
!= NULL
, "Failed to create an FCI context\n");
375 add_file(hfci
, a_txt
);
376 add_file(hfci
, b_txt
);
377 add_file(hfci
, testdir_c_txt
);
378 add_file(hfci
, testdir_d_txt
);
380 res
= FCIFlushCabinet(hfci
, FALSE
, get_next_cabinet
, progress
);
381 ok(res
, "Failed to flush the cabinet\n");
383 res
= FCIDestroy(hfci
);
384 ok(res
, "Failed to destroy the cabinet\n");
387 static void test_ExtractFiles(void)
390 char destFolder
[MAX_PATH
];
392 lstrcpyA(destFolder
, CURR_DIR
);
393 lstrcatA(destFolder
, "\\");
394 lstrcatA(destFolder
, "dest");
396 /* try NULL cab file */
397 hr
= pExtractFiles(NULL
, destFolder
, 0, NULL
, NULL
, 0);
398 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %d\n", hr
);
399 ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
401 /* try NULL destination */
402 hr
= pExtractFiles("extract.cab", NULL
, 0, NULL
, NULL
, 0);
403 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %d\n", hr
);
404 ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
406 /* extract all files in the cab to nonexistent destination directory */
407 hr
= pExtractFiles("extract.cab", destFolder
, 0, NULL
, NULL
, 0);
408 ok(hr
== HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
) ||
409 hr
== E_FAIL
, /* win95 */
410 "Expected %08x or %08x, got %08x\n", E_FAIL
,
411 HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND
), hr
);
412 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
413 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
414 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
415 ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
417 /* extract all files in the cab to the destination directory */
418 CreateDirectoryA("dest", NULL
);
419 hr
= pExtractFiles("extract.cab", destFolder
, 0, NULL
, NULL
, 0);
420 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
421 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
422 ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
423 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
424 ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
425 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
427 /* extract all files to a relative destination directory */
428 hr
= pExtractFiles("extract.cab", "dest", 0, NULL
, NULL
, 0);
429 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
430 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
431 ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
432 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
433 ok(DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to exist\n");
434 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
436 /* only extract two of the files from the cab */
437 hr
= pExtractFiles("extract.cab", "dest", 0, "a.txt:testdir\\c.txt", NULL
, 0);
438 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
439 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
440 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
441 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
442 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
443 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
445 /* use valid chars before and after file list */
446 hr
= pExtractFiles("extract.cab", "dest", 0, " :\t: a.txt:testdir\\c.txt \t:", NULL
, 0);
447 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
448 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
449 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
450 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
451 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
452 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
454 /* use invalid chars before and after file list */
455 hr
= pExtractFiles("extract.cab", "dest", 0, " +-\\ a.txt:testdir\\c.txt a_:", NULL
, 0);
456 ok(hr
== E_FAIL
, "Expected E_FAIL, got %d\n", hr
);
457 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
458 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
459 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
461 /* try an empty file list */
462 hr
= pExtractFiles("extract.cab", "dest", 0, "", NULL
, 0);
463 ok(hr
== E_FAIL
, "Expected E_FAIL, got %d\n", hr
);
464 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
465 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
467 /* try a nonexistent file in the file list */
468 hr
= pExtractFiles("extract.cab", "dest", 0, "a.txt:idontexist:testdir\\c.txt", NULL
, 0);
469 ok(hr
== E_FAIL
, "Expected E_FAIL, got %d\n", hr
);
470 ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
471 ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
472 ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
475 hr
= pExtractFilesW(L
"extract.cab", L
"dest", 0, L
"a.txt:testdir\\c.txt", NULL
, 0);
476 ok(hr
== S_OK
, "Expected S_OK, got %08x\n", hr
);
477 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
478 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
479 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
480 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
481 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
483 win_skip("ExtractFilesW not available\n");
487 static void test_AdvInstallFile(void)
491 char destFolder
[MAX_PATH
];
493 hmod
= LoadLibraryA("setupapi.dll");
496 skip("setupapi.dll not present\n");
502 lstrcpyA(destFolder
, CURR_DIR
);
503 lstrcatA(destFolder
, "\\");
504 lstrcatA(destFolder
, "dest");
506 createTestFile("source.txt");
508 /* try invalid source directory */
509 hr
= pAdvInstallFile(NULL
, NULL
, "source.txt", destFolder
, "destination.txt", 0, 0);
510 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %d\n", hr
);
511 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
513 /* try invalid source file */
514 hr
= pAdvInstallFile(NULL
, CURR_DIR
, NULL
, destFolder
, "destination.txt", 0, 0);
515 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %d\n", hr
);
516 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
518 /* try invalid destination directory */
519 hr
= pAdvInstallFile(NULL
, CURR_DIR
, "source.txt", NULL
, "destination.txt", 0, 0);
520 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %d\n", hr
);
521 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
523 /* try copying to nonexistent destination directory */
524 hr
= pAdvInstallFile(NULL
, CURR_DIR
, "source.txt", destFolder
, "destination.txt", 0, 0);
525 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
526 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
528 /* native windows screws up if the source file doesn't exist */
530 /* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
531 createTestFile("dest\\destination.txt");
532 hr
= pAdvInstallFile(NULL
, CURR_DIR
, "source.txt", destFolder
,
533 "destination.txt", AIF_NOOVERWRITE
| AIF_QUIET
, 0);
534 ok(hr
== S_OK
, "Expected S_OK, got %d\n", hr
);
535 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
536 ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
538 DeleteFileA("source.txt");
544 char temp_path
[MAX_PATH
], prev_path
[MAX_PATH
];
546 init_function_pointers();
548 GetCurrentDirectoryA(MAX_PATH
, prev_path
);
549 GetTempPathA(MAX_PATH
, temp_path
);
550 SetCurrentDirectoryA(temp_path
);
552 lstrcpyA(CURR_DIR
, temp_path
);
553 len
= lstrlenA(CURR_DIR
);
555 if(len
&& (CURR_DIR
[len
- 1] == '\\'))
556 CURR_DIR
[len
- 1] = 0;
561 test_AddDelBackupEntry();
563 test_AdvInstallFile();
567 FreeLibrary(hAdvPack
);
568 SetCurrentDirectoryA(prev_path
);