Commit 1f7d144f authored by Lauri Kenttä's avatar Lauri Kenttä Committed by Alexandre Julliard

cabinet: Make Extract fail on read-only files.

parent af86bdc3
...@@ -253,9 +253,7 @@ static INT_PTR CDECL fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICAT ...@@ -253,9 +253,7 @@ static INT_PTR CDECL fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICAT
hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL, hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile != INVALID_HANDLE_VALUE && node)
hFile = 0;
else if (node)
node->DoExtract = FALSE; node->DoExtract = FALSE;
} }
......
...@@ -642,8 +642,6 @@ static void test_Extract(void) ...@@ -642,8 +642,6 @@ static void test_Extract(void)
session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES; session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES;
res = pExtract(&session, "extract.cab"); res = pExtract(&session, "extract.cab");
node = session.FileList; node = session.FileList;
todo_wine
{
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL, 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); "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.FileSize == 6, "Expected 6, got %d\n", session.FileSize);
...@@ -653,7 +651,6 @@ static void test_Extract(void) ...@@ -653,7 +651,6 @@ static void test_Extract(void)
ok(session.FileCount == 1, "Expected 1, got %d\n", session.FileCount); ok(session.FileCount == 1, "Expected 1, got %d\n", session.FileCount);
ok(!lstrcmpA(session.CurrentFile, "dest\\a.txt"), ok(!lstrcmpA(session.CurrentFile, "dest\\a.txt"),
"Expected dest\\a.txt, got %s\n", session.CurrentFile); "Expected dest\\a.txt, got %s\n", session.CurrentFile);
}
ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType); ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType);
ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES), ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES),
"Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation); "Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation);
...@@ -662,15 +659,12 @@ static void test_Extract(void) ...@@ -662,15 +659,12 @@ static void test_Extract(void)
ok(!session.FilterList, "Expected empty filter list\n"); ok(!session.FilterList, "Expected empty filter list\n");
ok(getFileSize("dest\\a.txt") == 11, "Expected dest\\a.txt to be 11 bytes\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\\a.txt"), "Expected dest\\a.txt to be read-only\n");
todo_wine
{
ok(!DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to not exist\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\\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(!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\\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, "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, "b.txt", FALSE), "list entry should not exist\n");
}
ok(!check_list(&node, "a.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); free_file_list(&session);
...@@ -686,8 +680,6 @@ static void test_Extract(void) ...@@ -686,8 +680,6 @@ static void test_Extract(void)
session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES; session.Operation = EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES;
res = pExtract(&session, "extract.cab"); res = pExtract(&session, "extract.cab");
node = session.FileList; node = session.FileList;
todo_wine
{
ok(res == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || res == E_FAIL, 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); "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.FileSize == 26, "Expected 26, got %d\n", session.FileSize);
...@@ -697,7 +689,6 @@ static void test_Extract(void) ...@@ -697,7 +689,6 @@ static void test_Extract(void)
ok(session.FileCount == 3, "Expected 3, got %d\n", session.FileCount); ok(session.FileCount == 3, "Expected 3, got %d\n", session.FileCount);
ok(!lstrcmpA(session.CurrentFile, "dest\\testdir\\c.txt"), ok(!lstrcmpA(session.CurrentFile, "dest\\testdir\\c.txt"),
"Expected dest\\c.txt, got %s\n", session.CurrentFile); "Expected dest\\c.txt, got %s\n", session.CurrentFile);
}
ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType); ok(session.Error.erfType == 0, "Expected 0, got %d\n", session.Error.erfType);
ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES), ok(session.Operation == (EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES),
"Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation); "Expected EXTRACT_FILLFILELIST | EXTRACT_EXTRACTFILES, got %d\n", session.Operation);
...@@ -708,11 +699,8 @@ static void test_Extract(void) ...@@ -708,11 +699,8 @@ static void test_Extract(void)
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\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\\b.txt"), "Expected dest\\b.txt to exist\n");
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to be read-only\n"); ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to be read-only\n");
todo_wine
{
ok(!DeleteFileA("dest\\testdir\\d.txt"), "Expected dest\\testdir\\d.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\\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, "testdir\\c.txt", FALSE), "list entry wrong\n");
ok(!check_list(&node, "b.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"); ok(!check_list(&node, "a.txt", TRUE), "list entry wrong\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment