Rebase against 179137c259ffed546fb6f2c88c0d4df0e140cc4c.

[kernel32-FreeUserPhysicalPages]
Removed patch to add stub for kernel32.FreeUserPhysicalPages (accepted upstream).

[wininet-HTTPREQ_ReadFile_Async]
Removed patch to implement support for async handling in InternetReadFile
(accepted upstream).
This commit is contained in:
Sebastian Lackner 2016-04-28 20:58:08 +02:00
parent 51b447a55f
commit 79eb485272
11 changed files with 11 additions and 545 deletions

View File

@ -20,6 +20,5 @@ Fixes: Add kernelbase dll
Fixes: Add iertutil dll
Fixes: Add shcore dll
Fixes: [40451] Add feclient dll
Depends: kernel32-FreeUserPhysicalPages
Depends: kernel32-GetCurrentPackageFamilyName
Depends: combase-RoApi

View File

@ -1,67 +0,0 @@
From 2fc1bd4a187ffa5e4166174f4295623340b73564 Mon Sep 17 00:00:00 2001
From: Austin English <austinenglish@gmail.com>
Date: Tue, 3 Nov 2015 11:03:54 -0600
Subject: kernel32: add FreeUserPhysicalPages stub (try 2)
For https://bugs.winehq.org/show_bug.cgi?id=39543
Signed-off-by: Austin English <austinenglish@gmail.com>
---
.../api-ms-win-core-memory-l1-1-2.spec | 4 ++--
dlls/kernel32/heap.c | 7 +++++++
dlls/kernel32/kernel32.spec | 4 ++--
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
index cf10c20..2ad54b7 100644
--- a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
+++ b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec
@@ -1,6 +1,6 @@
-@ stdcall AllocateUserPhysicalPages(ptr ptr ptr) kernel32.AllocateUserPhysicalPages
+@ stdcall AllocateUserPhysicalPages(long ptr ptr) kernel32.AllocateUserPhysicalPages
@ stub AllocateUserPhysicalPagesNuma
-@ stub FreeUserPhysicalPages
+@ stdcall FreeUserPhysicalPages(long ptr ptr) kernel32.FreeUserPhysicalPages
@ stub GetMemoryErrorHandlingCapabilities
@ stub MapUserPhysicalPages
@ stub RegisterBadMemoryNotification
diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c
index eeed785..af2503c 100644
--- a/dlls/kernel32/heap.c
+++ b/dlls/kernel32/heap.c
@@ -1491,3 +1491,10 @@ BOOL WINAPI AllocateUserPhysicalPages(HANDLE process, ULONG_PTR *pages, ULONG_PT
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
+
+BOOL WINAPI FreeUserPhysicalPages(HANDLE process, ULONG_PTR *pages, ULONG_PTR *userarray)
+{
+ FIXME("stub: %p %p %p\n", process, pages, userarray);
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
+}
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index d606d9b..48c58cd 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -154,7 +154,7 @@
@ stdcall AllocConsole()
@ stub -i386 AllocLSCallback
@ stdcall -i386 -private AllocSLCallback(ptr ptr) krnl386.exe16.AllocSLCallback
-@ stdcall AllocateUserPhysicalPages(ptr ptr ptr)
+@ stdcall AllocateUserPhysicalPages(long ptr ptr)
@ stdcall ApplicationRecoveryFinished(long)
@ stdcall ApplicationRecoveryInProgress(ptr)
@ stdcall AreFileApisANSI()
@@ -535,7 +535,7 @@
@ stdcall FreeLibraryWhenCallbackReturns(ptr ptr) ntdll.TpCallbackUnloadDllOnCompletion
@ stdcall FreeResource(long)
@ stdcall -i386 -private FreeSLCallback(long) krnl386.exe16.FreeSLCallback
-@ stub FreeUserPhysicalPages
+@ stdcall FreeUserPhysicalPages(long ptr ptr)
@ stub FreeVirtualBuffer
@ stdcall GenerateConsoleCtrlEvent(long long)
@ stdcall -i386 -private Get16DLLAddress(long str) krnl386.exe16.Get16DLLAddress
--
2.7.1

View File

@ -1 +0,0 @@
Fixes: [39543] Add stub kernel32.FreeUserPhysicalPages

View File

@ -1,4 +1,4 @@
From d9292d6db7d1096596339c6b831e7e0c405c7559 Mon Sep 17 00:00:00 2001
From 3c92859cfaa24d7f873d7bd818c26832b856a356 Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Thu, 22 Oct 2015 15:54:30 +0800
Subject: ntdll: Implement FileNamesInformation class support.
@ -8,10 +8,10 @@ Subject: ntdll: Implement FileNamesInformation class support.
1 file changed, 9 insertions(+)
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 4faafe9..39e5465 100644
index 41e7115..f0e0703 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -173,6 +173,7 @@ union file_directory_info
@@ -178,6 +178,7 @@ union file_directory_info
FILE_FULL_DIRECTORY_INFORMATION full;
FILE_ID_BOTH_DIRECTORY_INFORMATION id_both;
FILE_ID_FULL_DIRECTORY_INFORMATION id_full;
@ -19,7 +19,7 @@ index 4faafe9..39e5465 100644
};
static BOOL show_dot_files;
@@ -255,6 +256,8 @@ static inline unsigned int dir_info_size( FILE_INFORMATION_CLASS class, unsigned
@@ -260,6 +261,8 @@ static inline unsigned int dir_info_size( FILE_INFORMATION_CLASS class, unsigned
return (FIELD_OFFSET( FILE_ID_BOTH_DIRECTORY_INFORMATION, FileName[len] ) + 7) & ~7;
case FileIdFullDirectoryInformation:
return (FIELD_OFFSET( FILE_ID_FULL_DIRECTORY_INFORMATION, FileName[len] ) + 7) & ~7;
@ -28,7 +28,7 @@ index 4faafe9..39e5465 100644
default:
assert(0);
return 0;
@@ -1492,6 +1495,11 @@ static union file_directory_info *append_entry( void *info_ptr, IO_STATUS_BLOCK
@@ -1485,6 +1488,11 @@ static union file_directory_info *append_entry( void *info_ptr, IO_STATUS_BLOCK
filename = info->id_both.FileName;
break;
@ -40,14 +40,14 @@ index 4faafe9..39e5465 100644
default:
assert(0);
return NULL;
@@ -2264,6 +2272,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event,
@@ -2244,6 +2252,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event,
case FileFullDirectoryInformation:
case FileIdBothDirectoryInformation:
case FileIdFullDirectoryInformation:
+ case FileNamesInformation:
if (length < dir_info_size( info_class, 1 )) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
if (!buffer) return io->u.Status = STATUS_ACCESS_VIOLATION;
if (length < dir_info_size( info_class, 1 )) return STATUS_INFO_LENGTH_MISMATCH;
if (!buffer) return STATUS_ACCESS_VIOLATION;
break;
--
2.6.1
2.8.0

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4be4e282b737a7cfbccf18552a581ee6de3ac13c"
echo "179137c259ffed546fb6f2c88c0d4df0e140cc4c"
}
# Show version information
@ -166,7 +166,6 @@ patch_enable_all ()
enable_kernel32_CopyFileEx="$1"
enable_kernel32_Cwd_Startup_Info="$1"
enable_kernel32_FindFirstFile="$1"
enable_kernel32_FreeUserPhysicalPages="$1"
enable_kernel32_GetCurrentPackageFamilyName="$1"
enable_kernel32_GetShortPathName="$1"
enable_kernel32_LocaleNameToLCID="$1"
@ -378,7 +377,6 @@ patch_enable_all ()
enable_winex11_wglShareLists="$1"
enable_winhttp_System_Proxy_Autoconfig="$1"
enable_wininet_Cleanup="$1"
enable_wininet_HTTPREQ_ReadFile_Async="$1"
enable_wininet_HttpOpenRequestW="$1"
enable_wininet_Internet_Settings="$1"
enable_wininet_ParseX509EncodedCertificateForListBoxEntry="$1"
@ -669,9 +667,6 @@ patch_enable ()
kernel32-FindFirstFile)
enable_kernel32_FindFirstFile="$2"
;;
kernel32-FreeUserPhysicalPages)
enable_kernel32_FreeUserPhysicalPages="$2"
;;
kernel32-GetCurrentPackageFamilyName)
enable_kernel32_GetCurrentPackageFamilyName="$2"
;;
@ -1305,9 +1300,6 @@ patch_enable ()
wininet-Cleanup)
enable_wininet_Cleanup="$2"
;;
wininet-HTTPREQ_ReadFile_Async)
enable_wininet_HTTPREQ_ReadFile_Async="$2"
;;
wininet-HttpOpenRequestW)
enable_wininet_HttpOpenRequestW="$2"
;;
@ -1979,13 +1971,6 @@ if test "$enable_wpcap_Dynamic_Linking" -eq 1; then
enable_wpcap_Several_Fixes=1
fi
if test "$enable_wininet_Cleanup" -eq 1; then
if test "$enable_wininet_HTTPREQ_ReadFile_Async" -gt 1; then
abort "Patchset wininet-HTTPREQ_ReadFile_Async disabled, but wininet-Cleanup depends on that."
fi
enable_wininet_HTTPREQ_ReadFile_Async=1
fi
if test "$enable_wined3d_CSMT_Helper" -eq 1; then
if test "$enable_makedep_PARENTSPEC" -gt 1; then
abort "Patchset makedep-PARENTSPEC disabled, but wined3d-CSMT_Helper depends on that."
@ -2313,14 +2298,10 @@ if test "$enable_api_ms_win_Stub_DLLs" -eq 1; then
if test "$enable_combase_RoApi" -gt 1; then
abort "Patchset combase-RoApi disabled, but api-ms-win-Stub_DLLs depends on that."
fi
if test "$enable_kernel32_FreeUserPhysicalPages" -gt 1; then
abort "Patchset kernel32-FreeUserPhysicalPages disabled, but api-ms-win-Stub_DLLs depends on that."
fi
if test "$enable_kernel32_GetCurrentPackageFamilyName" -gt 1; then
abort "Patchset kernel32-GetCurrentPackageFamilyName disabled, but api-ms-win-Stub_DLLs depends on that."
fi
enable_combase_RoApi=1
enable_kernel32_FreeUserPhysicalPages=1
enable_kernel32_GetCurrentPackageFamilyName=1
fi
@ -2573,21 +2554,6 @@ if test "$enable_combase_RoApi" -eq 1; then
) >> "$patchlist"
fi
# Patchset kernel32-FreeUserPhysicalPages
# |
# | This patchset fixes the following Wine bugs:
# | * [#39543] Add stub kernel32.FreeUserPhysicalPages
# |
# | Modified files:
# | * dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec, dlls/kernel32/heap.c, dlls/kernel32/kernel32.spec
# |
if test "$enable_kernel32_FreeUserPhysicalPages" -eq 1; then
patch_apply kernel32-FreeUserPhysicalPages/0001-kernel32-add-FreeUserPhysicalPages-stub-try-2.patch
(
echo '+ { "Austin English", "kernel32: Add FreeUserPhysicalPages stub.", 2 },';
) >> "$patchlist"
fi
# Patchset kernel32-GetCurrentPackageFamilyName
# |
# | Modified files:
@ -2603,7 +2569,7 @@ fi
# Patchset api-ms-win-Stub_DLLs
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * combase-RoApi, kernel32-FreeUserPhysicalPages, kernel32-GetCurrentPackageFamilyName
# | * combase-RoApi, kernel32-GetCurrentPackageFamilyName
# |
# | This patchset fixes the following Wine bugs:
# | * [#40451] Add feclient dll
@ -7494,29 +7460,8 @@ if test "$enable_winhttp_System_Proxy_Autoconfig" -eq 1; then
) >> "$patchlist"
fi
# Patchset wininet-HTTPREQ_ReadFile_Async
# |
# | Modified files:
# | * dlls/wininet/http.c, dlls/wininet/tests/http.c
# |
if test "$enable_wininet_HTTPREQ_ReadFile_Async" -eq 1; then
patch_apply wininet-HTTPREQ_ReadFile_Async/0001-wininet-Fix-async-check-in-HTTPREQ_ReadFileEx.-resen.patch
patch_apply wininet-HTTPREQ_ReadFile_Async/0002-wininet-tests-Add-tests-for-asynchronous-InternetRea.patch
patch_apply wininet-HTTPREQ_ReadFile_Async/0003-wininet-Handle-async-mode-in-HTTPREQ_ReadFile.-resen.patch
patch_apply wininet-HTTPREQ_ReadFile_Async/0004-wininet-tests-Add-tests-for-asynchronous-InternetRea.patch
(
echo '+ { "Michael Müller", "wininet: Fix async check in HTTPREQ_ReadFileEx.", 1 },';
echo '+ { "Sebastian Lackner", "wininet/tests: Add tests for asynchronous InternetReadFileEx.", 3 },';
echo '+ { "Michael Müller", "wininet: Handle async mode in HTTPREQ_ReadFile.", 1 },';
echo '+ { "Sebastian Lackner", "wininet/tests: Add tests for asynchronous InternetReadFile.", 3 },';
) >> "$patchlist"
fi
# Patchset wininet-Cleanup
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * wininet-HTTPREQ_ReadFile_Async
# |
# | Modified files:
# | * dlls/wininet/http.c, dlls/wininet/tests/http.c
# |

View File

@ -1,2 +1 @@
# Fixes: [28911] Add HTTP Host header in HttpSendRequest instead of HttpOpenRequest
Depends: wininet-HTTPREQ_ReadFile_Async

View File

@ -1,30 +0,0 @@
From 6545fc4c2c3fcc407b849185f9042118826e2ed7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 26 Apr 2016 23:37:13 +0200
Subject: wininet: Fix async check in HTTPREQ_ReadFileEx. (resend)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wininet/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index bdc659d..2774ab0 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3153,7 +3153,7 @@ static DWORD HTTPREQ_ReadFileEx(object_header_t *hdr, void *buf, DWORD size, DWO
INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
- if (hdr->dwFlags & INTERNET_FLAG_ASYNC)
+ if (req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{
read_file_ex_task_t *task;
--
2.8.0

View File

@ -1,162 +0,0 @@
From f9828f2ad26faa73c8820f98610a393c46339289 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 26 Apr 2016 23:37:54 +0200
Subject: wininet/tests: Add tests for asynchronous InternetReadFileEx. (v3)
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wininet/tests/http.c | 117 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 116 insertions(+), 1 deletion(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 82fd10b..fcaba10 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -109,7 +109,7 @@ static int expect[MAX_INTERNET_STATUS], optional[MAX_INTERNET_STATUS],
wine_allow[MAX_INTERNET_STATUS], notified[MAX_INTERNET_STATUS];
static const char *status_string[MAX_INTERNET_STATUS];
-static HANDLE hCompleteEvent, conn_close_event;
+static HANDLE hCompleteEvent, conn_close_event, conn_wait_event;
static DWORD req_error;
#define TESTF_REDIRECT 0x01
@@ -2358,6 +2358,15 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
send(c, notokmsg, sizeof notokmsg-1, 0);
}
+ if (strstr(buffer, "/async_read"))
+ {
+ const char *page1_mid = page1 + (sizeof page1 - 1)/2;
+ const char *page1_end = page1 + sizeof page1 - 1;
+ send(c, okmsg, sizeof okmsg-1, 0);
+ send(c, page1, page1_mid - page1, 0);
+ WaitForSingleObject(conn_wait_event, INFINITE);
+ send(c, page1_mid, page1_end - page1_mid, 0);
+ }
shutdown(c, 2);
closesocket(c);
c = -1;
@@ -4420,6 +4429,111 @@ static void test_basic_auth_credentials_reuse(int port)
InternetCloseHandle( ses );
}
+static void test_async_read(int port)
+{
+ HINTERNET ses, con, req;
+ INTERNET_BUFFERSA ib;
+ char buffer[0x100];
+ DWORD pending_reads;
+ DWORD res, count;
+ BOOL ret;
+
+ hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+ conn_wait_event = CreateEventW(NULL, FALSE, FALSE, NULL);
+
+ /* test asynchronous InternetReadFileEx */
+ ses = InternetOpenA( "winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC );
+ ok( ses != NULL, "InternetOpenA failed\n" );
+ pInternetSetStatusCallbackA( ses, &callback );
+
+ SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
+ con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef );
+ ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+ CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
+
+ SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
+ req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef );
+ ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+ CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
+
+ SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT );
+ SET_OPTIONAL( INTERNET_STATUS_DETECTING_PROXY );
+ SET_EXPECT( INTERNET_STATUS_CONNECTING_TO_SERVER );
+ SET_EXPECT( INTERNET_STATUS_CONNECTED_TO_SERVER );
+ SET_EXPECT( INTERNET_STATUS_SENDING_REQUEST );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_SENT );
+ SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE );
+ SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED );
+ SET_OPTIONAL( INTERNET_STATUS_CLOSING_CONNECTION );
+ SET_OPTIONAL( INTERNET_STATUS_CONNECTION_CLOSED );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
+
+ SetLastError( 0xdeadbeef );
+ ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
+ ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" );
+ ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+ WaitForSingleObject( hCompleteEvent, INFINITE );
+ ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+
+ CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT );
+ CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY );
+ CHECK_NOTIFIED( INTERNET_STATUS_CONNECTING_TO_SERVER );
+ CHECK_NOTIFIED( INTERNET_STATUS_CONNECTED_TO_SERVER );
+ CHECK_NOTIFIED( INTERNET_STATUS_SENDING_REQUEST );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_SENT );
+ CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
+ CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
+ CLEAR_NOTIFIED( INTERNET_STATUS_CLOSING_CONNECTION );
+ CLEAR_NOTIFIED( INTERNET_STATUS_CONNECTION_CLOSED );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE );
+
+ pending_reads = 0;
+ memset( &ib, 0, sizeof(ib) );
+ memset( buffer, 0, sizeof(buffer) );
+ ib.dwStructSize = sizeof(ib);
+ for (count = 0; count < sizeof(buffer); count += ib.dwBufferLength)
+ {
+ ib.lpvBuffer = buffer + count;
+ ib.dwBufferLength = min(16, sizeof(buffer) - count);
+
+ SET_OPTIONAL( INTERNET_STATUS_RECEIVING_RESPONSE );
+ SET_OPTIONAL( INTERNET_STATUS_RESPONSE_RECEIVED );
+
+ ret = InternetReadFileExA( req, &ib, 0, 0xdeadbeef );
+ if (!count) /* the first part should arrive immediately */
+ ok( ret, "InternetReadFileExA failed %u\n", GetLastError() );
+ if (!ret)
+ {
+ ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
+ if (!pending_reads++)
+ {
+ res = WaitForSingleObject( hCompleteEvent, 0 );
+ ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res );
+ SetEvent( conn_wait_event );
+ }
+ res = WaitForSingleObject( hCompleteEvent, INFINITE );
+ ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res );
+ ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+ todo_wine_if( pending_reads > 1 )
+ ok( ib.dwBufferLength != 0, "expected ib.dwBufferLength != 0\n" );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE );
+ }
+
+ CLEAR_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
+ CLEAR_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
+ if (!ib.dwBufferLength) break;
+ }
+
+ todo_wine
+ ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads );
+ ok( !strcmp(buffer, page1), "unexpected buffer content\n" );
+ close_async_handle( ses, hCompleteEvent, 2 );
+
+ CloseHandle( hCompleteEvent );
+ CloseHandle( conn_wait_event );
+}
+
static void test_http_connection(void)
{
struct server_info si;
@@ -4469,6 +4583,7 @@ static void test_http_connection(void)
test_request_content_length(si.port);
test_accept_encoding(si.port);
test_basic_auth_credentials_reuse(si.port);
+ test_async_read(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "GET", "/quit");
--
2.8.0

View File

@ -1,96 +0,0 @@
From ace80a3673e0f48a26e27b821c03e96140c1557b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 26 Apr 2016 23:38:16 +0200
Subject: wininet: Handle async mode in HTTPREQ_ReadFile. (resend)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wininet/http.c | 61 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 44 insertions(+), 17 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 2774ab0..6c2c567 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3105,23 +3105,6 @@ static BOOL drain_content(http_request_t *req, BOOL blocking)
return ret;
}
-static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DWORD *read)
-{
- http_request_t *req = (http_request_t*)hdr;
- DWORD res;
-
- EnterCriticalSection( &req->read_section );
- if(hdr->dwError == INTERNET_HANDLE_IN_USE)
- hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
-
- res = HTTPREQ_Read(req, buffer, size, read);
- if(res == ERROR_SUCCESS)
- res = hdr->dwError;
- LeaveCriticalSection( &req->read_section );
-
- return res;
-}
-
typedef struct {
task_header_t hdr;
void *buf;
@@ -3238,6 +3221,50 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
return res;
}
+static DWORD HTTPREQ_ReadFile(object_header_t *hdr, void *buffer, DWORD size, DWORD *read)
+{
+ http_request_t *req = (http_request_t*)hdr;
+ DWORD res;
+
+ if (req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
+ {
+ read_file_ex_task_t *task;
+
+ if (TryEnterCriticalSection( &req->read_section ))
+ {
+ if (get_avail_data(req))
+ {
+ res = HTTPREQ_Read(req, buffer, size, read);
+ LeaveCriticalSection( &req->read_section );
+ goto done;
+ }
+ LeaveCriticalSection( &req->read_section );
+ }
+
+ task = alloc_async_task(&req->hdr, AsyncReadFileExProc, sizeof(*task));
+ task->buf = buffer;
+ task->size = size;
+ task->ret_read = read;
+
+ *read = 0;
+ INTERNET_AsyncCall(&task->hdr);
+
+ return ERROR_IO_PENDING;
+ }
+
+ EnterCriticalSection( &req->read_section );
+ if(hdr->dwError == INTERNET_HANDLE_IN_USE)
+ hdr->dwError = ERROR_INTERNET_INTERNAL_ERROR;
+
+ res = HTTPREQ_Read(req, buffer, size, read);
+ if(res == ERROR_SUCCESS)
+ res = hdr->dwError;
+ LeaveCriticalSection( &req->read_section );
+
+done:
+ return res;
+}
+
typedef struct {
task_header_t hdr;
DWORD *ret_size;
--
2.8.0

View File

@ -1,120 +0,0 @@
From 748c8bfe4b67785a4c2933365d73a87e3ed31f80 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 26 Apr 2016 23:38:41 +0200
Subject: wininet/tests: Add tests for asynchronous InternetReadFile. (v3)
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wininet/tests/http.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 88 insertions(+), 1 deletion(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index fcaba10..67392cd 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -4435,7 +4435,7 @@ static void test_async_read(int port)
INTERNET_BUFFERSA ib;
char buffer[0x100];
DWORD pending_reads;
- DWORD res, count;
+ DWORD res, count, bytes;
BOOL ret;
hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
@@ -4529,6 +4529,93 @@ static void test_async_read(int port)
ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads );
ok( !strcmp(buffer, page1), "unexpected buffer content\n" );
close_async_handle( ses, hCompleteEvent, 2 );
+ ResetEvent( conn_wait_event );
+
+ /* test asynchronous InternetReadFile */
+ ses = InternetOpenA( "winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC );
+ ok( ses != NULL, "InternetOpenA failed\n" );
+ pInternetSetStatusCallbackA( ses, &callback );
+
+ SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
+ con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef );
+ ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+ CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
+
+ SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
+ req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef );
+ ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+ CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
+
+ SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT );
+ SET_OPTIONAL( INTERNET_STATUS_DETECTING_PROXY );
+ SET_EXPECT( INTERNET_STATUS_CONNECTING_TO_SERVER );
+ SET_EXPECT( INTERNET_STATUS_CONNECTED_TO_SERVER );
+ SET_EXPECT( INTERNET_STATUS_SENDING_REQUEST );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_SENT );
+ SET_EXPECT( INTERNET_STATUS_RECEIVING_RESPONSE );
+ SET_EXPECT( INTERNET_STATUS_RESPONSE_RECEIVED );
+ SET_OPTIONAL( INTERNET_STATUS_CLOSING_CONNECTION );
+ SET_OPTIONAL( INTERNET_STATUS_CONNECTION_CLOSED );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
+
+ SetLastError( 0xdeadbeef );
+ ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
+ ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" );
+ ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+ WaitForSingleObject( hCompleteEvent, INFINITE );
+ ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+
+ CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT );
+ CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY );
+ CHECK_NOTIFIED( INTERNET_STATUS_CONNECTING_TO_SERVER );
+ CHECK_NOTIFIED( INTERNET_STATUS_CONNECTED_TO_SERVER );
+ CHECK_NOTIFIED( INTERNET_STATUS_SENDING_REQUEST );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_SENT );
+ CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
+ CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
+ CLEAR_NOTIFIED( INTERNET_STATUS_CLOSING_CONNECTION );
+ CLEAR_NOTIFIED( INTERNET_STATUS_CONNECTION_CLOSED );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE );
+
+ pending_reads = 0;
+ memset( buffer, 0, sizeof(buffer) );
+ for (count = 0; count < sizeof(buffer); count += bytes)
+ {
+ SET_OPTIONAL( INTERNET_STATUS_RECEIVING_RESPONSE );
+ SET_OPTIONAL( INTERNET_STATUS_RESPONSE_RECEIVED );
+
+ bytes = 0xdeadbeef;
+ ret = InternetReadFile( req, buffer + count, min(16, sizeof(buffer) - count), &bytes );
+ if (!count) /* the first part should arrive immediately */
+ ok( ret, "InternetReadFile failed %u\n", GetLastError() );
+ if (!ret)
+ {
+ ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+ ok( bytes == 0, "expected 0, got %u\n", bytes );
+ SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
+ if (!pending_reads++)
+ {
+ res = WaitForSingleObject( hCompleteEvent, 0 );
+ ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res );
+ SetEvent( conn_wait_event );
+ }
+ res = WaitForSingleObject( hCompleteEvent, INFINITE );
+ ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res );
+ ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+ todo_wine_if( pending_reads > 1 )
+ ok( bytes != 0, "expected bytes != 0\n" );
+ CHECK_NOTIFIED( INTERNET_STATUS_REQUEST_COMPLETE );
+ }
+
+ CLEAR_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
+ CLEAR_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
+ if (!bytes) break;
+ }
+
+ todo_wine
+ ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads );
+ ok( !strcmp(buffer, page1), "unexpected buffer content\n" );
+ close_async_handle( ses, hCompleteEvent, 2 );
CloseHandle( hCompleteEvent );
CloseHandle( conn_wait_event );
--
2.8.0

View File

@ -1 +0,0 @@
Fixes: Add support for async handling in InternetReadFile()