Commit 67295a78 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

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

Fixes Freestyle 2: Street Basketball update check failure. Signed-off-by: 's avatarPaul Gofman <pgofman@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3c4860b9
...@@ -2096,7 +2096,9 @@ DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove, ...@@ -2096,7 +2096,9 @@ DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove,
PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext) PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
{ {
FIXME("(%p %d %p %d %lx): stub\n", hFile, lDistanceToMove, pReserved, dwMoveContext, 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;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -590,6 +590,8 @@ static void InternetReadFile_test(int flags, const test_data_t *test) ...@@ -590,6 +590,8 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
DWORD length, length2, index, exlen = 0, post_len = 0; DWORD length, length2, index, exlen = 0, post_len = 0;
const char *types[2] = { "*", NULL }; const char *types[2] = { "*", NULL };
HINTERNET hi, hic = 0, hor = 0; 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); trace("Starting InternetReadFile test with flags 0x%x on url %s\n",flags,test->url);
reset_events(); reset_events();
...@@ -816,10 +818,23 @@ static void InternetReadFile_test(int flags, const test_data_t *test) ...@@ -816,10 +818,23 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,&index); res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,&index);
trace("Option HTTP_QUERY_CONTENT_LENGTH -> %i %s (%u)\n",res,buffer,GetLastError()); trace("Option HTTP_QUERY_CONTENT_LENGTH -> %i %s (%u)\n",res,buffer,GetLastError());
if(test->flags & TESTF_COMPRESSED) if(test->flags & TESTF_COMPRESSED)
{
ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
"expected ERROR_HTTP_HEADER_NOT_FOUND, got %x (%u)\n", res, GetLastError()); "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); 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; length = 100;
res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_TYPE,buffer,&length,0x0); res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_TYPE,buffer,&length,0x0);
buffer[length]=0; buffer[length]=0;
...@@ -831,6 +846,26 @@ static void InternetReadFile_test(int flags, const test_data_t *test) ...@@ -831,6 +846,26 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
trace("Option HTTP_QUERY_CONTENT_ENCODING -> %i %s\n",res,buffer); trace("Option HTTP_QUERY_CONTENT_ENCODING -> %i %s\n",res,buffer);
SetLastError(0xdeadbeef); 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); res = InternetReadFile(NULL, buffer, 100, &length);
ok(!res, "InternetReadFile should have failed\n"); ok(!res, "InternetReadFile should have failed\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, ok(GetLastError() == ERROR_INVALID_HANDLE,
......
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