kernel32: Remove a 0-length read optimization from ReadFile.
This commit is contained in:
parent
70930fa12c
commit
b4ab43b3de
|
@ -408,7 +408,6 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
|
|||
bytesRead, overlapped );
|
||||
|
||||
if (bytesRead) *bytesRead = 0; /* Do this before anything else */
|
||||
if (!bytesToRead) return TRUE;
|
||||
|
||||
if (is_console_handle(hFile))
|
||||
{
|
||||
|
|
|
@ -2152,7 +2152,6 @@ todo_wine
|
|||
bytes = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(hcom, buf, 0, &bytes, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
|
|
|
@ -80,16 +80,13 @@ static int mailslot_test(void)
|
|||
count = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(INVALID_HANDLE_VALUE, buffer, 0, &count, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError());
|
||||
ok(count == 0, "expected 0, got %u\n", count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(hSlot, buffer, 0, &count, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_SEM_TIMEOUT, "wrong error %u\n", GetLastError());
|
||||
|
|
|
@ -1860,9 +1860,7 @@ static void test_readfileex_pending(void)
|
|||
num_bytes = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(INVALID_HANDLE_VALUE, read_buf, 0, &num_bytes, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError());
|
||||
ok(num_bytes == 0, "expected 0, got %u\n", num_bytes);
|
||||
|
||||
|
@ -1877,12 +1875,11 @@ todo_wine
|
|||
todo_wine
|
||||
ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %d\n", GetLastError());
|
||||
ok(num_bytes == 0, "bytes %u\n", num_bytes);
|
||||
todo_wine
|
||||
ok((NTSTATUS)overlapped.Internal == STATUS_PENDING, "expected STATUS_PENDING, got %#lx\n", overlapped.Internal);
|
||||
todo_wine
|
||||
ok(overlapped.InternalHigh == -1, "expected -1, got %lu\n", overlapped.InternalHigh);
|
||||
|
||||
wait = WaitForSingleObject(event, 100);
|
||||
todo_wine
|
||||
ok(wait == WAIT_TIMEOUT, "WaitForSingleObject returned %x\n", wait);
|
||||
|
||||
num_bytes = 0xdeadbeef;
|
||||
|
@ -1890,13 +1887,13 @@ todo_wine
|
|||
ok(ret, "WriteFile failed\n");
|
||||
ok(num_bytes == 1, "bytes %u\n", num_bytes);
|
||||
|
||||
wait = WaitForSingleObject(event, 0);
|
||||
wait = WaitForSingleObject(event, 100);
|
||||
todo_wine
|
||||
ok(wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait);
|
||||
|
||||
ok(num_bytes == 1, "bytes %u\n", num_bytes);
|
||||
todo_wine
|
||||
ok((NTSTATUS)overlapped.Internal == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#lx\n", overlapped.Internal);
|
||||
todo_wine
|
||||
ok(overlapped.InternalHigh == 0, "expected 0, got %lu\n", overlapped.InternalHigh);
|
||||
|
||||
/* read the pending byte and clear the pipe */
|
||||
|
|
|
@ -1986,9 +1986,7 @@ static void test_read_write(void)
|
|||
bytes = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(INVALID_HANDLE_VALUE, buf, 0, &bytes, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||
ok(bytes == 0, "bytes %u\n", bytes);
|
||||
|
||||
|
@ -2201,9 +2199,7 @@ todo_wine
|
|||
bytes = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = ReadFile(INVALID_HANDLE_VALUE, buf, 0, &bytes, NULL);
|
||||
todo_wine
|
||||
ok(!ret, "ReadFile should fail\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||
ok(bytes == 0, "bytes %u\n", bytes);
|
||||
|
||||
|
@ -2220,7 +2216,6 @@ todo_wine
|
|||
ok(bytes == 0, "bytes %u\n", bytes);
|
||||
todo_wine
|
||||
ok((NTSTATUS)ovl.Internal == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#lx\n", ovl.Internal);
|
||||
todo_wine
|
||||
ok(ovl.InternalHigh == 0, "expected 0, got %lu\n", ovl.InternalHigh);
|
||||
|
||||
bytes = 0xdeadbeef;
|
||||
|
|
Loading…
Reference in New Issue