Paul Gofman : wininet: Correctly return error status from InternetSetFilePointer() stub.
Alexandre Julliard
julliard at winehq.org
Wed Nov 11 15:31:43 CST 2020
Module: wine
Branch: master
Commit: 67295a7844b94ccbfce85dbee22a76f12c9f5b36
URL: https://source.winehq.org/git/wine.git/?a=commit;h=67295a7844b94ccbfce85dbee22a76f12c9f5b36
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Wed Nov 11 13:17:30 2020 +0300
wininet: Correctly return error status from InternetSetFilePointer() stub.
Fixes Freestyle 2: Street Basketball update check failure.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wininet/internet.c | 4 +++-
dlls/wininet/tests/http.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index fb02488934d..91bff2ece93 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -2096,7 +2096,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;
}
/***********************************************************************
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index fc984f6d33d..a5f5215f584 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -590,6 +590,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();
@@ -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);
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;
@@ -830,6 +845,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");
More information about the wine-cvs
mailing list