kernel32: DeleteFile should open the file without read/write permissions.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2015-11-11 01:21:55 +01:00 committed by Alexandre Julliard
parent 4857f95803
commit 71581f71d5
2 changed files with 1 additions and 4 deletions

View File

@ -1683,8 +1683,7 @@ BOOL WINAPI DeleteFileW( LPCWSTR path )
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
status = NtCreateFile(&hFile, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE | DELETE,
&attr, &io, NULL, 0,
status = NtCreateFile(&hFile, SYNCHRONIZE | DELETE, &attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0);
if (status == STATUS_SUCCESS) status = NtClose(hFile);

View File

@ -1794,14 +1794,12 @@ static void test_DeleteFileA( void )
SetLastError(0xdeadbeef);
ret = DeleteFileA(temp_file);
todo_wine
ok(ret, "DeleteFile error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CloseHandle(hfile);
ok(ret, "CloseHandle error %d\n", GetLastError());
ret = DeleteFileA(temp_file);
todo_wine
ok(!ret, "DeleteFile should fail\n");
SetLastError(0xdeadbeef);