Commit 71581f71 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

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

parent 4857f958
...@@ -1683,8 +1683,7 @@ BOOL WINAPI DeleteFileW( LPCWSTR path ) ...@@ -1683,8 +1683,7 @@ BOOL WINAPI DeleteFileW( LPCWSTR path )
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
status = NtCreateFile(&hFile, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE | DELETE, status = NtCreateFile(&hFile, SYNCHRONIZE | DELETE, &attr, &io, NULL, 0,
&attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0); FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0);
if (status == STATUS_SUCCESS) status = NtClose(hFile); if (status == STATUS_SUCCESS) status = NtClose(hFile);
......
...@@ -1794,14 +1794,12 @@ static void test_DeleteFileA( void ) ...@@ -1794,14 +1794,12 @@ static void test_DeleteFileA( void )
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = DeleteFileA(temp_file); ret = DeleteFileA(temp_file);
todo_wine
ok(ret, "DeleteFile error %d\n", GetLastError()); ok(ret, "DeleteFile error %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CloseHandle(hfile); ret = CloseHandle(hfile);
ok(ret, "CloseHandle error %d\n", GetLastError()); ok(ret, "CloseHandle error %d\n", GetLastError());
ret = DeleteFileA(temp_file); ret = DeleteFileA(temp_file);
todo_wine
ok(!ret, "DeleteFile should fail\n"); ok(!ret, "DeleteFile should fail\n");
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
......
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