[WINESYNC] wininet: Correctly return error status from InternetSetFilePointer() stub.

Fixes Freestyle 2: Street Basketball update check failure.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 67295a7844b94ccbfce85dbee22a76f12c9f5b36 by Paul Gofman <pgofman@codeweavers.com>
This commit is contained in:
winesync 2020-12-08 18:17:50 +01:00 committed by Jérôme Gardou
parent ef9a828ef8
commit 23e96deb0b
3 changed files with 39 additions and 2 deletions

View file

@ -2103,7 +2103,9 @@ DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove,
PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
{
FIXME("(%p %d %p %d %lx): stub\n", hFile, lDistanceToMove, pReserved, dwMoveContext, dwContext);
return FALSE;
SetLastError(ERROR_INTERNET_INVALID_OPERATION);
return INVALID_SET_FILE_POINTER;
}
/***********************************************************************

View file

@ -591,6 +591,8 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
DWORD length, length2, index, exlen = 0, post_len = 0;
const char *types[2] = { "*", NULL };
HINTERNET hi, hic = 0, hor = 0;
DWORD contents_length, accepts_ranges;
BOOL not_supported;
trace("Starting InternetReadFile test with flags 0x%x on url %s\n",flags,test->url);
reset_events();
@ -817,10 +819,23 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,&index);
trace("Option HTTP_QUERY_CONTENT_LENGTH -> %i %s (%u)\n",res,buffer,GetLastError());
if(test->flags & TESTF_COMPRESSED)
{
ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
"expected ERROR_HTTP_HEADER_NOT_FOUND, got %x (%u)\n", res, GetLastError());
contents_length = 0;
}
else
{
contents_length = atoi(buffer);
}
ok(!res || index == 1, "Index was not incremented although result is %x (index = %u)\n", res, index);
length = 64;
*buffer = 0;
res = HttpQueryInfoA(hor,HTTP_QUERY_ACCEPT_RANGES,&buffer,&length,0x0);
trace("Option HTTP_QUERY_ACCEPT_RANGES -> %i %s (%u)\n",res,buffer,GetLastError());
accepts_ranges = res && !strcmp(buffer, "bytes");
length = 100;
res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_TYPE,buffer,&length,0x0);
buffer[length]=0;
@ -831,6 +846,26 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
buffer[length]=0;
trace("Option HTTP_QUERY_CONTENT_ENCODING -> %i %s\n",res,buffer);
SetLastError(0xdeadbeef);
length = InternetSetFilePointer(hor, 0, NULL, FILE_END, 0);
not_supported = length == INVALID_SET_FILE_POINTER
&& GetLastError() == ERROR_INTERNET_INVALID_OPERATION;
if (accepts_ranges)
todo_wine ok((length == contents_length && (GetLastError() == ERROR_SUCCESS
|| broken(GetLastError() == 0xdeadbeef))) || broken(not_supported),
"Got unexpected length %#x, GetLastError() %u, contents_length %u, accepts_ranges %#x.\n",
length, GetLastError(), contents_length, accepts_ranges);
else
ok(not_supported, "Got unexpected length %#x, GetLastError() %u.\n", length, GetLastError());
if (length != INVALID_SET_FILE_POINTER)
{
SetLastError(0xdeadbeef);
length = InternetSetFilePointer(hor, 0, NULL, FILE_BEGIN, 0);
ok(!length && (GetLastError() == ERROR_SUCCESS || broken(GetLastError() == 0xdeadbeef)),
"Got unexpected length %#x, GetLastError() %u.\n", length, GetLastError());
}
SetLastError(0xdeadbeef);
res = InternetReadFile(NULL, buffer, 100, &length);
ok(!res, "InternetReadFile should have failed\n");

View file

@ -5,4 +5,4 @@ files:
include/wininet.h: sdk/include/psdk/wininet.h
include/winineti.h: sdk/include/psdk/winineti.h
tags:
wine: bcdb58cc7959afd5fa35ab039e6564934888b4c0
wine: 67295a7844b94ccbfce85dbee22a76f12c9f5b36