ReactOS 0.4.16-dev-250-g3ecd236
files.c
Go to the documentation of this file.
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 */
33static HRESULT (WINAPI *pAddDelBackupEntry)(LPCSTR, LPCSTR, LPCSTR, DWORD);
34static HRESULT (WINAPI *pExtractFiles)(LPCSTR, LPCSTR, DWORD, LPCSTR, LPVOID, DWORD);
35static HRESULT (WINAPI *pExtractFilesW)(const WCHAR*,const WCHAR*,DWORD,const WCHAR*,void*,DWORD);
36static HRESULT (WINAPI *pAdvInstallFile)(HWND,LPCSTR,LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD);
37
39
40static void init_function_pointers(void)
41{
42 hAdvPack = LoadLibraryA("advpack.dll");
43
44 if (hAdvPack)
45 {
46 pAddDelBackupEntry = (void *)GetProcAddress(hAdvPack, "AddDelBackupEntry");
47 pExtractFiles = (void *)GetProcAddress(hAdvPack, "ExtractFiles");
48 pExtractFilesW = (void *)GetProcAddress(hAdvPack, "ExtractFilesW");
49 pAdvInstallFile = (void*)GetProcAddress(hAdvPack, "AdvInstallFile");
50 }
51}
52
53/* creates a file with the specified name for tests */
54static void createTestFile(const CHAR *name)
55{
57 DWORD written;
58
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);
64}
65
66static void create_test_files(void)
67{
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);
74}
75
76static void delete_test_files(void)
77{
78 DeleteFileA("a.txt");
79 DeleteFileA("b.txt");
80 DeleteFileA("testdir\\c.txt");
81 DeleteFileA("testdir\\d.txt");
82 RemoveDirectoryA("testdir");
83 RemoveDirectoryA("dest");
84
85 DeleteFileA("extract.cab");
86}
87
89{
90 BOOL ret;
93
96
97 return ret;
98}
99
100static void test_AddDelBackupEntry(void)
101{
102 BOOL ret;
103 HRESULT res;
105 CHAR windir[MAX_PATH];
106
108 lstrcatA(path, "\\backup\\basename.INI");
109
110 /* native AddDelBackupEntry crashes if lpcszBaseName is NULL */
111
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");
116
118 lstrcatA(path, "\\backup\\.INI");
119
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");
124
126 lstrcatA(path, "\\basename.INI");
127
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");
132
133 lstrcpyA(path, "c:\\basename.INI");
134
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);
139 {
140 ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
141 ok(DeleteFileA(path), "Expected path to exist\n");
142 }
143 else
144 win_skip("Test file could not be created\n");
145
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 */
173 res = pAddDelBackupEntry("one\0three\0", NULL, "basename", AADBE_DEL_ENTRY);
175 ok(res == S_OK, "Expected S_OK, got %d\n", res);
177 ok(ret == TRUE ||
178 broken(ret == FALSE), /* win98 */
179 "Expected path to exist\n");
180}
181
182/* the FCI callbacks */
183
184static void * CDECL mem_alloc(ULONG cb)
185{
186 return HeapAlloc(GetProcessHeap(), 0, cb);
187}
188
189static void CDECL mem_free(void *memory)
190{
192}
193
194static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
195{
196 return TRUE;
197}
198
199static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
200{
201 return 0;
202}
203
204static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
205 BOOL fContinuation, void *pv)
206{
207 return 0;
208}
209
210static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
211{
213 DWORD dwAccess = 0;
214 DWORD dwShareMode = 0;
215 DWORD dwCreateDisposition = OPEN_EXISTING;
216
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;
220
222 dwCreateDisposition = OPEN_EXISTING;
223 else
224 dwCreateDisposition = CREATE_NEW;
225
226 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
227 dwCreateDisposition, 0, NULL);
228
229 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
230
231 return (INT_PTR)handle;
232}
233
234static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
235{
236 HANDLE handle = (HANDLE)hf;
237 DWORD dwRead;
238 BOOL res;
239
240 res = ReadFile(handle, memory, cb, &dwRead, NULL);
241 ok(res, "Failed to ReadFile\n");
242
243 return dwRead;
244}
245
246static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
247{
248 HANDLE handle = (HANDLE)hf;
249 DWORD dwWritten;
250 BOOL res;
251
252 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
253 ok(res, "Failed to WriteFile\n");
254
255 return dwWritten;
256}
257
258static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
259{
260 HANDLE handle = (HANDLE)hf;
261 ok(CloseHandle(handle), "Failed to CloseHandle\n");
262
263 return 0;
264}
265
266static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
267{
268 HANDLE handle = (HANDLE)hf;
269 DWORD ret;
270
271 ret = SetFilePointer(handle, dist, NULL, seektype);
272 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
273
274 return ret;
275}
276
277static int CDECL fci_delete(char *pszFile, int *err, void *pv)
278{
279 BOOL ret = DeleteFileA(pszFile);
280 ok(ret, "Failed to DeleteFile %s\n", pszFile);
281
282 return 0;
283}
284
285static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
286{
287 LPSTR tempname;
288
289 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
290 GetTempFileNameA(".", "xx", 0, tempname);
291
292 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
293 {
294 lstrcpyA(pszTempName, tempname);
295 HeapFree(GetProcessHeap(), 0, tempname);
296 return TRUE;
297 }
298
299 HeapFree(GetProcessHeap(), 0, tempname);
300
301 return FALSE;
302}
303
304static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
305 USHORT *pattribs, int *err, void *pv)
306{
310 DWORD attrs;
311 BOOL res;
312
315
316 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
317
319 ok(res, "Expected GetFileInformationByHandle to succeed\n");
320
322 FileTimeToDosDateTime(&filetime, pdate, ptime);
323
324 attrs = GetFileAttributesA(pszName);
325 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
326
327 return (INT_PTR)handle;
328}
329
330static void add_file(HFCI hfci, char *file)
331{
332 char path[MAX_PATH];
333 BOOL res;
334
336 lstrcatA(path, "\\");
338
341 ok(res, "Expected FCIAddFile to succeed\n");
342}
343
344static void set_cab_parameters(PCCAB pCabParams)
345{
346 ZeroMemory(pCabParams, sizeof(CCAB));
347
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");
354}
355
356static void create_cab_file(void)
357{
358 CCAB cabParams;
359 HFCI hfci;
360 ERF erf;
361 static CHAR a_txt[] = "a.txt",
362 b_txt[] = "b.txt",
363 testdir_c_txt[] = "testdir\\c.txt",
364 testdir_d_txt[] = "testdir\\d.txt";
365 BOOL res;
366
367 set_cab_parameters(&cabParams);
368
371 get_temp_file, &cabParams, NULL);
372
373 ok(hfci != NULL, "Failed to create an FCI context\n");
374
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);
379
381 ok(res, "Failed to flush the cabinet\n");
382
383 res = FCIDestroy(hfci);
384 ok(res, "Failed to destroy the cabinet\n");
385}
386
387static void test_ExtractFiles(void)
388{
389 HRESULT hr;
390 char destFolder[MAX_PATH];
391
392 lstrcpyA(destFolder, CURR_DIR);
393 lstrcatA(destFolder, "\\");
394 lstrcatA(destFolder, "dest");
395
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");
400
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");
405
406 /* extract all files in the cab to nonexistent destination directory */
407 hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
409 hr == E_FAIL, /* win95 */
410 "Expected %08x or %08x, got %08x\n", E_FAIL,
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");
416
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");
426
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");
435
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");
444
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");
453
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");
460
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");
466
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");
473
474 if(pExtractFilesW) {
475 static const WCHAR extract_cabW[] = {'e','x','t','r','a','c','t','.','c','a','b',0};
476 static const WCHAR destW[] = {'d','e','s','t',0};
477 static const WCHAR file_listW[] =
478 {'a','.','t','x','t',':','t','e','s','t','d','i','r','\\','c','.','t','x','t',0};
479
480 hr = pExtractFilesW(extract_cabW, destW, 0, file_listW, NULL, 0);
481 ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
482 ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
483 ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
484 ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
485 ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
486 ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
487 }else {
488 win_skip("ExtractFilesW not available\n");
489 }
490}
491
492static void test_AdvInstallFile(void)
493{
494 HRESULT hr;
496 char destFolder[MAX_PATH];
497
498 hmod = LoadLibraryA("setupapi.dll");
499 if (!hmod)
500 {
501 skip("setupapi.dll not present\n");
502 return;
503 }
504
506
507 lstrcpyA(destFolder, CURR_DIR);
508 lstrcatA(destFolder, "\\");
509 lstrcatA(destFolder, "dest");
510
511 createTestFile("source.txt");
512
513 /* try invalid source directory */
514 hr = pAdvInstallFile(NULL, NULL, "source.txt", 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");
517
518 /* try invalid source file */
519 hr = pAdvInstallFile(NULL, CURR_DIR, NULL, destFolder, "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");
522
523 /* try invalid destination directory */
524 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", NULL, "destination.txt", 0, 0);
525 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
526 ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
527
528 /* try copying to nonexistent destination directory */
529 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder, "destination.txt", 0, 0);
530 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
531 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
532
533 /* native windows screws up if the source file doesn't exist */
534
535 /* test AIF_NOOVERWRITE behavior, asks the user to overwrite if AIF_QUIET is not specified */
536 createTestFile("dest\\destination.txt");
537 hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder,
538 "destination.txt", AIF_NOOVERWRITE | AIF_QUIET, 0);
539 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
540 ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
541 ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
542
543 DeleteFileA("source.txt");
544}
545
547{
548 DWORD len;
549 char temp_path[MAX_PATH], prev_path[MAX_PATH];
550
552
553 GetCurrentDirectoryA(MAX_PATH, prev_path);
556
559
560 if(len && (CURR_DIR[len - 1] == '\\'))
561 CURR_DIR[len - 1] = 0;
562
565
569
571
573 SetCurrentDirectoryA(prev_path);
574}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define AADBE_DEL_ENTRY
Definition: advpub.h:116
#define AIF_QUIET
Definition: advpub.h:127
#define AADBE_ADD_ENTRY
Definition: advpub.h:115
#define AIF_NOOVERWRITE
Definition: advpub.h:123
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
cd_progress_ptr progress
Definition: cdjpeg.h:152
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define mem_free(ptr, bsize)
Definition: types.h:124
#define NULL
Definition: types.h:112
#define mem_alloc(bsize)
Definition: types.h:123
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static LPCSTR
Definition: files.c:563
#define CDECL
Definition: compat.h:29
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
HANDLE HWND
Definition: compat.h:19
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:458
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:776
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
Definition: time.c:37
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1397
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
#define tcompTYPE_MSZIP
Definition: fci.h:65
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
double __cdecl erf(double)
#define CREATE_ALWAYS
Definition: disk.h:72
#define CREATE_NEW
Definition: disk.h:69
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
static CHAR CURR_DIR[MAX_PATH]
Definition: files.c:38
static void test_ExtractFiles(void)
Definition: files.c:387
#define MEDIA_SIZE
Definition: files.c:28
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: files.c:194
static BOOL check_ini_file_attr(LPSTR filename)
Definition: files.c:88
static void createTestFile(const CHAR *name)
Definition: files.c:54
static void delete_test_files(void)
Definition: files.c:76
static void init_function_pointers(void)
Definition: files.c:40
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: files.c:246
static void add_file(HFCI hfci, char *file)
Definition: files.c:330
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: files.c:285
static void set_cab_parameters(PCCAB pCabParams)
Definition: files.c:344
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: files.c:234
#define FOLDER_THRESHOLD
Definition: files.c:29
static void create_test_files(void)
Definition: files.c:66
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: files.c:304
static void test_AddDelBackupEntry(void)
Definition: files.c:100
static void test_AdvInstallFile(void)
Definition: files.c:492
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: files.c:210
static DWORD
Definition: files.c:33
static void create_cab_file(void)
Definition: files.c:356
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: files.c:277
static LPVOID
Definition: files.c:34
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: files.c:204
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: files.c:266
static HMODULE hAdvPack
Definition: files.c:32
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: files.c:258
BOOL expected
Definition: store.c:2063
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static char memory[1024 *256]
Definition: process.c:116
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define GENERIC_WRITE
Definition: nt_native.h:90
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define err(...)
#define win_skip
Definition: test.h:163
HRESULT hr
Definition: shlfolder.c:183
Definition: fci.h:144
ULONG cbFolderThresh
Definition: fci.h:146
USHORT setID
Definition: fci.h:157
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161
ULONG cb
Definition: fci.h:145
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
Definition: fci.h:44
Definition: cookie.c:202
Definition: fci.c:127
Definition: name.c:39
int32_t INT_PTR
Definition: typedefs.h:64
PVOID HANDLE
Definition: typedefs.h:73
uint32_t ULONG
Definition: typedefs.h:59
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
int ret
#define ZeroMemory
Definition: winbase.h:1737
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175