28 #define MEDIA_SIZE 999999999 29 #define FOLDER_THRESHOLD 900000 129 res = pAddDelBackupEntry(
"one\0two\0three\0",
NULL,
"basename", 0);
144 win_skip(
"Test file could not be created\n");
179 "Expected path to exist\n");
205 BOOL fContinuation,
void *pv)
214 DWORD dwShareMode = 0;
227 dwCreateDisposition, 0,
NULL);
241 ok(
res,
"Failed to ReadFile\n");
253 ok(
res,
"Failed to WriteFile\n");
280 ok(
ret,
"Failed to DeleteFile %s\n", pszFile);
292 if (tempname && (
strlen(tempname) < (
unsigned)cbTempName))
319 ok(
res,
"Expected GetFileInformationByHandle to succeed\n");
341 ok(
res,
"Expected FCIAddFile to succeed\n");
350 pCabParams->
setID = 0xbeef;
361 static CHAR a_txt[] =
"a.txt",
363 testdir_c_txt[] =
"testdir\\c.txt",
364 testdir_d_txt[] =
"testdir\\d.txt";
373 ok(hfci !=
NULL,
"Failed to create an FCI context\n");
381 ok(
res,
"Failed to flush the cabinet\n");
384 ok(
res,
"Failed to destroy the cabinet\n");
407 hr = pExtractFiles(
"extract.cab", destFolder, 0,
NULL,
NULL, 0);
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");
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");
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");
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");
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");
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");
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");
455 hr = pExtractFiles(
"extract.cab",
"dest", 0,
" +-\\ a.txt:testdir\\c.txt a_:",
NULL, 0);
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");
462 hr = pExtractFiles(
"extract.cab",
"dest", 0,
"",
NULL, 0);
464 ok(!
DeleteFileA(
"dest\\a.txt"),
"Expected dest\\a.txt to not exist\n");
468 hr = pExtractFiles(
"extract.cab",
"dest", 0,
"a.txt:idontexist:testdir\\c.txt",
NULL, 0);
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");
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};
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");
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");
488 win_skip(
"ExtractFilesW not available\n");
501 skip(
"setupapi.dll not present\n");
514 hr = pAdvInstallFile(
NULL,
NULL,
"source.txt", destFolder,
"destination.txt", 0, 0);
516 ok(!
DeleteFileA(
"dest\\destination.txt"),
"Expected dest\\destination.txt to not exist\n");
521 ok(!
DeleteFileA(
"dest\\destination.txt"),
"Expected dest\\destination.txt to not exist\n");
526 ok(!
DeleteFileA(
"dest\\destination.txt"),
"Expected dest\\destination.txt to not exist\n");
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");
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");
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static void create_test_files(void)
#define HRESULT_FROM_WIN32(x)
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
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)
ACPI_SIZE strlen(const char *String)
static void test_ExtractFiles(void)
static HRESULT(WINAPI *pAddDelBackupEntry)(LPCSTR
static void createTestFile(const CHAR *name)
BOOL __cdecl FCIDestroy(HFCI hfci)
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
#define INVALID_HANDLE_VALUE
static void CDECL mem_free(void *memory)
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
static char memory[1024 *256]
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
#define sprintf(buf, format,...)
static void delete_test_files(void)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
char szCab[CB_MAX_CABINET_NAME]
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
static void set_cab_parameters(PCCAB pCabParams)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
static void create_cab_file(void)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
double __cdecl erf(double)
static void init_function_pointers(void)
#define FILE_ATTRIBUTE_READONLY
#define INVALID_FILE_ATTRIBUTES
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
static PEXPLICIT_ACCESSW *static HMODULE hmod
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
static void test_AddDelBackupEntry(void)
int WINAPI lstrlenA(LPCSTR lpString)
#define INVALID_SET_FILE_POINTER
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
#define FILE_FLAG_SEQUENTIAL_SCAN
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
#define ReadFile(a, b, c, d, e)
#define FILE_ATTRIBUTE_HIDDEN
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
static HMODULE MODULEINFO DWORD cb
char szCabPath[CB_MAX_CAB_PATH]
static BOOL check_ini_file_attr(LPSTR filename)
#define GetProcAddress(x, y)
static CHAR CURR_DIR[MAX_PATH]
#define ERROR_PATH_NOT_FOUND
#define CreateFileA(a, b, c, d, e, f, g)
static void add_file(HFCI hfci, char *file)
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
#define HeapFree(x, y, z)
static void *CDECL mem_alloc(ULONG cb)
static void test_AdvInstallFile(void)