wininet: Always set last error in InternetReadFile.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47352
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 8f5b9f4d4b)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
oldstable
Alistair Leslie-Hughes 2019-06-24 00:22:53 +00:00 committed by Michael Stefaniuc
parent ba957cd2e4
commit b9a24ae16e
2 changed files with 7 additions and 2 deletions

View File

@ -2194,8 +2194,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
TRACE("-- %s (%u) (bytes read: %d)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE", res,
pdwNumOfBytesRead ? *pdwNumOfBytesRead : -1);
if(res != ERROR_SUCCESS)
SetLastError(res);
SetLastError(res);
return res == ERROR_SUCCESS;
}

View File

@ -984,7 +984,10 @@ static void InternetReadFile_chunked_test(void)
{
char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
SetLastError(0xdeadbeef);
res = InternetReadFile(hor,buffer,length,&got);
ok(GetLastError() == 0 ||
broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
buffer[got]=0;
trace("ReadFile -> %i %i\n",res,got);
@ -997,8 +1000,11 @@ static void InternetReadFile_chunked_test(void)
if (length == 0)
{
got = 0xdeadbeef;
SetLastError(0xdeadbeef);
res = InternetReadFile( hor, buffer, 1, &got );
ok( res, "InternetReadFile failed: %u\n", GetLastError() );
ok(GetLastError() == 0 ||
broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
ok( !got, "got %u\n", got );
break;
}