Commit 68ffbaa7 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernel32: Add a test for deleting a file opened for reading.

parent 0a8be862
......@@ -1291,6 +1291,8 @@ static void test_GetTempFileNameA(void)
static void test_DeleteFileA( void )
{
BOOL ret;
char temp_path[MAX_PATH], temp_file[MAX_PATH];
HANDLE hfile;
ret = DeleteFileA(NULL);
ok(!ret && (GetLastError() == ERROR_INVALID_PARAMETER ||
......@@ -1308,6 +1310,25 @@ static void test_DeleteFileA( void )
GetLastError() == ERROR_ACCESS_DENIED ||
GetLastError() == ERROR_INVALID_FUNCTION),
"DeleteFileA(\"nul\") returned ret=%d error=%d\n",ret,GetLastError());
GetTempPathA(MAX_PATH, temp_path);
GetTempFileName(temp_path, "tst", 0, temp_file);
SetLastError(0xdeadbeef);
hfile = CreateFile(temp_file, GENERIC_READ, FILE_SHARE_DELETE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
ok(hfile != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = DeleteFile(temp_file);
todo_wine
ok(ret, "DeleteFile error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CloseHandle(hfile);
ok(ret, "CloseHandle error %d\n", GetLastError());
ret = DeleteFile(temp_file);
todo_wine
ok(!ret, "DeleteFile should fail\n");
}
static void test_DeleteFileW( void )
......
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