mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
[CABINET_WINETEST] Sync with Wine Staging 2.2. CORE-12823
svn path=/trunk/; revision=73930
This commit is contained in:
parent
42057b458d
commit
95668db524
1 changed files with 46 additions and 42 deletions
|
@ -80,6 +80,18 @@ static void createTestFile(const CHAR *name)
|
|||
CloseHandle(file);
|
||||
}
|
||||
|
||||
static int getFileSize(const CHAR *name)
|
||||
{
|
||||
HANDLE file;
|
||||
int size;
|
||||
file = CreateFileA(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
return -1;
|
||||
size = GetFileSize(file, NULL);
|
||||
CloseHandle(file);
|
||||
return size;
|
||||
}
|
||||
|
||||
static void create_test_files(void)
|
||||
{
|
||||
int len;
|
||||
|
@ -621,49 +633,46 @@ static void test_Extract(void)
|
|||
ok(!check_list(&node, "a.txt", FALSE), "list entry should not exist\n");
|
||||
free_file_list(&session);
|
||||
|
||||
/* first file exists */
|
||||
/* first file exists but is read-only */
|
||||
createTestFile("dest\\a.txt");
|
||||
SetFileAttributesA("dest\\a.txt", FILE_ATTRIBUTE_READONLY);
|
||||
ok(getFileSize("dest\\a.txt") == 11, "Expected dest\\a.txt to be 11 bytes\n");
|
||||
ZeroMemory(&session, sizeof(SESSION));
|
||||
lstrcpyA(session.Destination, "dest");
|
||||
session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES;
|
||||
res = pExtract(&session, "extract.cab");
|
||||
node = session.FileList;
|
||||
todo_wine
|
||||
{
|
||||
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL,
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) or E_FAIL, got %08x\n", res);
|
||||
ok(session.FileSize == 6, "Expected 6, got %d\n", session.FileSize);
|
||||
ok(session.Error.erfOper == FDIERROR_USER_ABORT,
|
||||
"Expected FDIERROR_USER_ABORT, got %d\n", session.Error.erfOper);
|
||||
ok(session.Error.fError == TRUE, "Expected TRUE, got %d\n", session.Error.fError);
|
||||
ok(session.FileCount == 1, "Expected 1, got %d\n", session.FileCount);
|
||||
ok(!lstrcmpA(session.CurrentFile, "dest\\a.txt"),
|
||||
"Expected dest\\a.txt, got %s\n", session.CurrentFile);
|
||||
}
|
||||
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL,
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) or E_FAIL, got %08x\n", res);
|
||||
ok(session.FileSize == 6, "Expected 6, got %d\n", session.FileSize);
|
||||
ok(session.Error.erfOper == FDIERROR_USER_ABORT,
|
||||
"Expected FDIERROR_USER_ABORT, got %d\n", session.Error.erfOper);
|
||||
ok(session.Error.fError == TRUE, "Expected TRUE, got %d\n", session.Error.fError);
|
||||
ok(session.FileCount == 1, "Expected 1, got %d\n", session.FileCount);
|
||||
ok(!lstrcmpA(session.CurrentFile, "dest\\a.txt"),
|
||||
"Expected dest\\a.txt, got %s\n", session.CurrentFile);
|
||||
ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType);
|
||||
ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES),
|
||||
"Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation);
|
||||
ok(!lstrcmpA(session.Destination, "dest"), "Expected dest, got %s\n", session.Destination);
|
||||
ok(!*session.Reserved, "Expected empty string, got %s\n", session.Reserved);
|
||||
ok(!session.FilterList, "Expected empty filter list\n");
|
||||
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
|
||||
todo_wine
|
||||
{
|
||||
ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
|
||||
ok(!check_list(&node, "testdir\\d.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "testdir\\c.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "b.txt", FALSE), "list entry should not exist\n");
|
||||
}
|
||||
ok(getFileSize("dest\\a.txt") == 11, "Expected dest\\a.txt to be 11 bytes\n");
|
||||
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to be read-only\n");
|
||||
ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
|
||||
ok(!check_list(&node, "testdir\\d.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "testdir\\c.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "b.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "a.txt", FALSE), "list entry should not exist\n");
|
||||
free_file_list(&session);
|
||||
|
||||
SetFileAttributesA("dest\\a.txt", FILE_ATTRIBUTE_NORMAL);
|
||||
DeleteFileA("dest\\a.txt");
|
||||
|
||||
/* third file exists */
|
||||
/* first file exists and is writable, third file exists but is read-only */
|
||||
createTestFile("dest\\a.txt");
|
||||
createTestFile("dest\\testdir\\c.txt");
|
||||
SetFileAttributesA("dest\\testdir\\c.txt", FILE_ATTRIBUTE_READONLY);
|
||||
ZeroMemory(&session, sizeof(SESSION));
|
||||
|
@ -671,32 +680,27 @@ static void test_Extract(void)
|
|||
session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES;
|
||||
res = pExtract(&session, "extract.cab");
|
||||
node = session.FileList;
|
||||
todo_wine
|
||||
{
|
||||
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL,
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) or E_FAIL, got %08x\n", res);
|
||||
ok(session.FileSize == 26, "Expected 26, got %d\n", session.FileSize);
|
||||
ok(session.Error.erfOper == FDIERROR_USER_ABORT,
|
||||
"Expected FDIERROR_USER_ABORT, got %d\n", session.Error.erfOper);
|
||||
ok(session.Error.fError == TRUE, "Expected TRUE, got %d\n", session.Error.fError);
|
||||
ok(session.FileCount == 3, "Expected 3, got %d\n", session.FileCount);
|
||||
ok(!lstrcmpA(session.CurrentFile, "dest\\testdir\\c.txt"),
|
||||
"Expected dest\\c.txt, got %s\n", session.CurrentFile);
|
||||
}
|
||||
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL,
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) or E_FAIL, got %08x\n", res);
|
||||
ok(session.FileSize == 26, "Expected 26, got %d\n", session.FileSize);
|
||||
ok(session.Error.erfOper == FDIERROR_USER_ABORT,
|
||||
"Expected FDIERROR_USER_ABORT, got %d\n", session.Error.erfOper);
|
||||
ok(session.Error.fError == TRUE, "Expected TRUE, got %d\n", session.Error.fError);
|
||||
ok(session.FileCount == 3, "Expected 3, got %d\n", session.FileCount);
|
||||
ok(!lstrcmpA(session.CurrentFile, "dest\\testdir\\c.txt"),
|
||||
"Expected dest\\c.txt, got %s\n", session.CurrentFile);
|
||||
ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType);
|
||||
ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES),
|
||||
"Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation);
|
||||
ok(!lstrcmpA(session.Destination, "dest"), "Expected dest, got %s\n", session.Destination);
|
||||
ok(!*session.Reserved, "Expected empty string, got %s\n", session.Reserved);
|
||||
ok(!session.FilterList, "Expected empty filter list\n");
|
||||
ok(getFileSize("dest\\a.txt") == 6, "Expected dest\\a.txt to be 6 bytes\n");
|
||||
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
|
||||
ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
|
||||
todo_wine
|
||||
{
|
||||
ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
|
||||
ok(!check_list(&node, "testdir\\d.txt", FALSE), "list entry should not exist\n");
|
||||
}
|
||||
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to be read-only\n");
|
||||
ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.txt to not exist\n");
|
||||
ok(!check_list(&node, "testdir\\d.txt", FALSE), "list entry should not exist\n");
|
||||
ok(!check_list(&node, "testdir\\c.txt", FALSE), "list entry wrong\n");
|
||||
ok(!check_list(&node, "b.txt", FALSE), "list entry wrong\n");
|
||||
ok(!check_list(&node, "a.txt", TRUE), "list entry wrong\n");
|
||||
|
|
Loading…
Reference in a new issue