mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
ws2_32-TransmitFile: Various fixes and style improvements.
This commit is contained in:
parent
89e58b5105
commit
05cb27bb21
@ -4275,17 +4275,17 @@ fi
|
||||
if test "$enable_ws2_32_TransmitFile" -eq 1; then
|
||||
patch_apply ws2_32-TransmitFile/0001-ws2_32-Add-stub-for-TransmitFile.patch
|
||||
patch_apply ws2_32-TransmitFile/0002-ws2_32-Check-for-invalid-parameters-in-TransmitFile.patch
|
||||
patch_apply ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.patch
|
||||
patch_apply ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.-r.patch
|
||||
patch_apply ws2_32-TransmitFile/0004-ws2_32-Add-support-for-TransmitFile-headers-and-foot.patch
|
||||
patch_apply ws2_32-TransmitFile/0005-ws2_32-Add-asynchronous-support-for-TransmitFile.patch
|
||||
patch_apply ws2_32-TransmitFile/0005-ws2_32-Add-asynchronous-support-for-TransmitFile.-re.patch
|
||||
patch_apply ws2_32-TransmitFile/0006-ws2_32-Add-support-for-TF_DISCONNECT-to-TransmitFile.patch
|
||||
patch_apply ws2_32-TransmitFile/0007-ws2_32-Add-support-for-TF_REUSE_SOCKET-to-TransmitFi.patch
|
||||
(
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add stub for TransmitFile.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Check for invalid parameters in TransmitFile.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Implement a basic synchronous TransmitFile.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Implement a basic synchronous TransmitFile.", 2 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add support for TransmitFile headers and footers.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add asynchronous support for TransmitFile.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add asynchronous support for TransmitFile.", 2 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add support for TF_DISCONNECT to TransmitFile.", 1 },';
|
||||
echo '+ { "Erich E. Hoover", "ws2_32: Add support for TF_REUSE_SOCKET to TransmitFile.", 1 },';
|
||||
) >> "$patchlist"
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 503facafdcc2a11ed60058d86214f724ecbec851 Mon Sep 17 00:00:00 2001
|
||||
From 73dbe41e80fa7ed3aeb3c3f0ee91fe2023b2a356 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 17:52:50 -0700
|
||||
Subject: ws2_32: Add stub for TransmitFile.
|
||||
@ -8,7 +8,7 @@ Subject: ws2_32: Add stub for TransmitFile.
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 5bfdecf..536dbc9 100644
|
||||
index 760e184..86efbe6 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -2538,6 +2538,19 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
|
||||
@ -31,7 +31,7 @@ index 5bfdecf..536dbc9 100644
|
||||
* GetAcceptExSockaddrs
|
||||
*/
|
||||
static void WINAPI WS2_GetAcceptExSockaddrs(PVOID buffer, DWORD data_size, DWORD local_size, DWORD remote_size,
|
||||
@@ -4163,7 +4176,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
|
||||
@@ -4177,7 +4190,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
|
||||
}
|
||||
else if ( IsEqualGUID(&transmitfile_guid, in_buff) )
|
||||
{
|
||||
@ -42,5 +42,5 @@ index 5bfdecf..536dbc9 100644
|
||||
else if ( IsEqualGUID(&transmitpackets_guid, in_buff) )
|
||||
{
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From bc996ca58033c91065f86980d1fd3eac2dd8be66 Mon Sep 17 00:00:00 2001
|
||||
From 9e8e6d6b4c14478ac28da693de9bd1a51f60d3eb Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Fri, 17 Jan 2014 12:35:57 -0700
|
||||
Subject: ws2_32: Check for invalid parameters in TransmitFile.
|
||||
@ -9,7 +9,7 @@ Subject: ws2_32: Check for invalid parameters in TransmitFile.
|
||||
2 files changed, 124 insertions(+)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 536dbc9..5b4996e 100644
|
||||
index 86efbe6..96335cd 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -2544,8 +2544,29 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@ -164,5 +164,5 @@ index 7155a09..0991e54 100644
|
||||
test_getaddrinfo();
|
||||
test_AcceptEx();
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
From a48693d8345a2e8d45083e0746e1bf801f086aa6 Mon Sep 17 00:00:00 2001
|
||||
From 3174cffa6b4d0e934004db80506a153422c5af94 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 18:24:27 -0700
|
||||
Subject: ws2_32: Implement a basic synchronous TransmitFile.
|
||||
Subject: ws2_32: Implement a basic synchronous TransmitFile. (rev 2)
|
||||
|
||||
---
|
||||
dlls/ws2_32/socket.c | 138 ++++++++++++++++++++++++++++++++++++++++++++---
|
||||
dlls/ws2_32/tests/sock.c | 36 ++++++++++++-
|
||||
2 files changed, 167 insertions(+), 7 deletions(-)
|
||||
dlls/ws2_32/socket.c | 144 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
dlls/ws2_32/tests/sock.c | 36 +++++++++++-
|
||||
2 files changed, 173 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 5b4996e..6598f7c 100644
|
||||
index 96335cd..36ce0dd 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -378,6 +378,18 @@ struct ws2_accept_async
|
||||
struct ws2_async *read;
|
||||
};
|
||||
|
||||
+typedef struct ws2_transmitfile_async
|
||||
+struct ws2_transmitfile_async
|
||||
+{
|
||||
+ struct ws2_async_io io;
|
||||
+ char *buffer;
|
||||
@ -26,12 +26,12 @@ index 5b4996e..6598f7c 100644
|
||||
+ DWORD bytes_per_send;
|
||||
+ DWORD flags;
|
||||
+ struct ws2_async write;
|
||||
+} ws2_transmitfile_async;
|
||||
+};
|
||||
+
|
||||
static struct ws2_async_io *async_io_freelist;
|
||||
|
||||
static void release_async_io( struct ws2_async_io *io )
|
||||
@@ -2538,6 +2550,70 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
|
||||
@@ -2538,6 +2550,76 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -54,22 +54,27 @@ index 5b4996e..6598f7c 100644
|
||||
+
|
||||
+ /* when the size of the transfer is limited ensure that we don't go past that limit */
|
||||
+ if (wsa->file_bytes != 0)
|
||||
+ bytes_per_send = min(wsa->bytes_per_send, wsa->file_bytes - wsa->file_read);
|
||||
+ bytes_per_send = min(bytes_per_send, wsa->file_bytes - wsa->file_read);
|
||||
+ status = NtReadFile( wsa->file, 0, NULL, NULL, &iosb, wsa->buffer, bytes_per_send,
|
||||
+ NULL, NULL );
|
||||
+ if(status == STATUS_END_OF_FILE)
|
||||
+ if (status == STATUS_END_OF_FILE)
|
||||
+ return STATUS_SUCCESS;
|
||||
+ else if(status != STATUS_SUCCESS)
|
||||
+ else if (status != STATUS_SUCCESS)
|
||||
+ return status;
|
||||
+ else
|
||||
+ {
|
||||
+ wsa->write.first_iovec = 0;
|
||||
+ wsa->write.n_iovecs = 1;
|
||||
+ wsa->write.iovec[0].iov_base = wsa->buffer;
|
||||
+ wsa->write.iovec[0].iov_len = iosb.Information;
|
||||
+ wsa->file_read += iosb.Information;
|
||||
+ if (iosb.Information)
|
||||
+ {
|
||||
+ wsa->write.first_iovec = 0;
|
||||
+ wsa->write.n_iovecs = 1;
|
||||
+ wsa->write.iovec[0].iov_base = wsa->buffer;
|
||||
+ wsa->write.iovec[0].iov_len = iosb.Information;
|
||||
+ wsa->file_read += iosb.Information;
|
||||
+ }
|
||||
+
|
||||
+ if (wsa->file_bytes != 0 && wsa->file_read >= wsa->file_bytes)
|
||||
+ wsa->file = NULL;
|
||||
+
|
||||
+ return STATUS_PENDING;
|
||||
+ }
|
||||
+ }
|
||||
@ -92,9 +97,10 @@ index 5b4996e..6598f7c 100644
|
||||
+ DWORD n;
|
||||
+
|
||||
+ n = WS2_send( fd, &wsa->write );
|
||||
+ if (n == -1)
|
||||
+ if (n == -1 && errno != EAGAIN)
|
||||
+ return wsaErrStatus();
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
@ -102,7 +108,7 @@ index 5b4996e..6598f7c 100644
|
||||
* TransmitFile
|
||||
*/
|
||||
static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD bytes_per_send,
|
||||
@@ -2546,12 +2622,22 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2546,12 +2628,22 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
{
|
||||
union generic_unix_sockaddr uaddr;
|
||||
unsigned int uaddrlen = sizeof(uaddr);
|
||||
@ -128,7 +134,7 @@ index 5b4996e..6598f7c 100644
|
||||
if (fd == -1)
|
||||
{
|
||||
WSASetLastError( WSAENOTSOCK );
|
||||
@@ -2563,12 +2649,52 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2563,12 +2655,52 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
WSASetLastError( WSAENOTCONN );
|
||||
return FALSE;
|
||||
}
|
||||
@ -246,5 +252,5 @@ index 0991e54..1288694 100644
|
||||
/* Test TransmitFile with a UDP datagram socket */
|
||||
closesocket(client);
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
From ccfa39a3110cf7fe425bb37fe4a9528215abacf4 Mon Sep 17 00:00:00 2001
|
||||
From 408befce279d57fe2f5e3e5ba12bae4a09456fda Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Wed, 4 Mar 2015 15:10:43 -0700
|
||||
Subject: ws2_32: Add support for TransmitFile headers and footers.
|
||||
@ -9,17 +9,17 @@ Subject: ws2_32: Add support for TransmitFile headers and footers.
|
||||
2 files changed, 64 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 6598f7c..115101c 100644
|
||||
index 36ce0dd..e45c838 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -386,6 +386,7 @@ typedef struct ws2_transmitfile_async
|
||||
@@ -386,6 +386,7 @@ struct ws2_transmitfile_async
|
||||
DWORD file_read;
|
||||
DWORD file_bytes;
|
||||
DWORD bytes_per_send;
|
||||
+ TRANSMIT_FILE_BUFFERS buffers;
|
||||
DWORD flags;
|
||||
struct ws2_async write;
|
||||
} ws2_transmitfile_async;
|
||||
};
|
||||
@@ -2560,6 +2561,17 @@ static NTSTATUS WS2_transmitfile_getbuffer( int fd, struct ws2_transmitfile_asyn
|
||||
if (wsa->write.first_iovec < wsa->write.n_iovecs)
|
||||
return STATUS_PENDING;
|
||||
@ -41,13 +41,13 @@ index 6598f7c..115101c 100644
|
||||
@@ -2573,7 +2585,7 @@ static NTSTATUS WS2_transmitfile_getbuffer( int fd, struct ws2_transmitfile_asyn
|
||||
status = NtReadFile( wsa->file, 0, NULL, NULL, &iosb, wsa->buffer, bytes_per_send,
|
||||
NULL, NULL );
|
||||
if(status == STATUS_END_OF_FILE)
|
||||
if (status == STATUS_END_OF_FILE)
|
||||
- return STATUS_SUCCESS;
|
||||
+ wsa->file = NULL; /* continue on to the footer */
|
||||
else if(status != STATUS_SUCCESS)
|
||||
else if (status != STATUS_SUCCESS)
|
||||
return status;
|
||||
else
|
||||
@@ -2589,6 +2601,17 @@ static NTSTATUS WS2_transmitfile_getbuffer( int fd, struct ws2_transmitfile_asyn
|
||||
@@ -2594,6 +2606,17 @@ static NTSTATUS WS2_transmitfile_getbuffer( int fd, struct ws2_transmitfile_asyn
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ index 6598f7c..115101c 100644
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2626,7 +2649,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2632,7 +2655,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
NTSTATUS status;
|
||||
int fd;
|
||||
|
||||
@ -74,7 +74,7 @@ index 6598f7c..115101c 100644
|
||||
{
|
||||
FIXME("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, file_bytes, bytes_per_send,
|
||||
overlapped, buffers, flags);
|
||||
@@ -2662,6 +2685,10 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2668,6 +2691,10 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
WSASetLastError( WSAEFAULT );
|
||||
return FALSE;
|
||||
}
|
||||
@ -146,5 +146,5 @@ index 1288694..a93dbe3 100644
|
||||
closesocket(client);
|
||||
client = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
From 33df3649a18892fb9da00fc0b545213dbe847f3b Mon Sep 17 00:00:00 2001
|
||||
From 3ff267363ed9aa032ec26f14cd9f05b6c6af2113 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Tue, 3 Mar 2015 23:19:40 -0700
|
||||
Subject: ws2_32: Add asynchronous support for TransmitFile.
|
||||
Subject: ws2_32: Add asynchronous support for TransmitFile. (rev 2)
|
||||
|
||||
---
|
||||
dlls/ws2_32/socket.c | 71 ++++++++++++++++++++++++++++++++-----
|
||||
dlls/ws2_32/socket.c | 72 +++++++++++++++++++++++++++++++++-----
|
||||
dlls/ws2_32/tests/sock.c | 91 ++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 147 insertions(+), 15 deletions(-)
|
||||
2 files changed, 148 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index 115101c..de04d9b 100644
|
||||
index e45c838..f9cac67 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -2627,36 +2627,60 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
@@ -2632,13 +2632,45 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
status = WS2_transmitfile_getbuffer( fd, wsa );
|
||||
if (status == STATUS_PENDING)
|
||||
{
|
||||
@ -20,14 +20,16 @@ index 115101c..de04d9b 100644
|
||||
DWORD n;
|
||||
|
||||
n = WS2_send( fd, &wsa->write );
|
||||
if (n == -1)
|
||||
if (n == -1 && errno != EAGAIN)
|
||||
return wsaErrStatus();
|
||||
+
|
||||
+ if (iosb) iosb->Information += n;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * WS2_async_transmitfile (INTERNAL)
|
||||
+ *
|
||||
+ * Asynchronous callback for overlapped TransmitFile operations.
|
||||
@ -38,28 +40,25 @@ index 115101c..de04d9b 100644
|
||||
+ struct ws2_transmitfile_async *wsa = user;
|
||||
+ int fd;
|
||||
+
|
||||
+ if (status != STATUS_ALERTED)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if ((status = wine_server_handle_to_fd( wsa->write.hSocket, FILE_WRITE_DATA, &fd, NULL ) ))
|
||||
+ goto cleanup;
|
||||
+ status = WS2_transmitfile_base( fd, wsa );
|
||||
+ wine_server_release_fd( wsa->write.hSocket, fd );
|
||||
+ if (status == STATUS_PENDING)
|
||||
+ return iosb->u.Status;
|
||||
+
|
||||
+ if (wsa->write.user_overlapped->hEvent)
|
||||
+ SetEvent(wsa->write.user_overlapped->hEvent);
|
||||
+cleanup:
|
||||
+ if (status == STATUS_ALERTED)
|
||||
+ {
|
||||
+ if (!(status = wine_server_handle_to_fd( wsa->write.hSocket, FILE_WRITE_DATA, &fd, NULL )))
|
||||
+ {
|
||||
+ status = WS2_transmitfile_base( fd, wsa );
|
||||
+ wine_server_release_fd( wsa->write.hSocket, fd );
|
||||
+ }
|
||||
+ if (status == STATUS_PENDING)
|
||||
+ return status;
|
||||
}
|
||||
|
||||
+ iosb->u.Status = status;
|
||||
+ if (wsa->write.user_overlapped->hEvent)
|
||||
+ NtSetEvent(wsa->write.user_overlapped->hEvent, NULL);
|
||||
+ release_async_io( &wsa->io );
|
||||
+ return iosb->u.Status;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
* TransmitFile
|
||||
*/
|
||||
static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD bytes_per_send,
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -2649,20 +2681,13 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
LPOVERLAPPED overlapped, LPTRANSMIT_FILE_BUFFERS buffers,
|
||||
DWORD flags )
|
||||
{
|
||||
@ -81,7 +80,7 @@ index 115101c..de04d9b 100644
|
||||
TRACE("(%lx, %p, %d, %d, %p, %p, %d)\n", s, h, file_bytes, bytes_per_send, overlapped,
|
||||
buffers, flags );
|
||||
|
||||
@@ -2703,7 +2727,36 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2709,7 +2734,36 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
wsa->write.control = NULL;
|
||||
wsa->write.n_iovecs = 0;
|
||||
wsa->write.first_iovec = 0;
|
||||
@ -274,5 +273,5 @@ index a93dbe3..4716b61 100644
|
||||
closesocket(server);
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
@ -1,39 +1,36 @@
|
||||
From b9da4e6bcf31ebb5669faa7a35fd85c907e4eed7 Mon Sep 17 00:00:00 2001
|
||||
From 08bff2c19fbe3ac44b8c1323d50c0aabc8bb0ddc Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@wine-staging.com>
|
||||
Date: Wed, 4 Mar 2015 13:16:20 -0700
|
||||
Subject: ws2_32: Add support for TF_DISCONNECT to TransmitFile.
|
||||
|
||||
---
|
||||
dlls/ws2_32/socket.c | 19 ++++++++++++++++---
|
||||
dlls/ws2_32/socket.c | 16 +++++++++++++---
|
||||
dlls/ws2_32/tests/sock.c | 11 +++++++++++
|
||||
2 files changed, 27 insertions(+), 3 deletions(-)
|
||||
2 files changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index de04d9b..b5b14c2 100644
|
||||
index f9cac67..6cc0a79 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -2635,7 +2635,19 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
return wsaErrStatus();
|
||||
@@ -2642,7 +2642,16 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
if (iosb) iosb->Information += n;
|
||||
}
|
||||
|
||||
- return status;
|
||||
+ if (status != STATUS_SUCCESS)
|
||||
+ return status;
|
||||
+
|
||||
+ if (wsa->flags & TF_DISCONNECT)
|
||||
+ {
|
||||
+ if (WS_closesocket( HANDLE2SOCKET(wsa->write.hSocket) ) != 0)
|
||||
+ {
|
||||
+ status = wsaErrStatus();
|
||||
+ return status;
|
||||
+ }
|
||||
+ /* we can't use WS_closesocket because it modifies the last error */
|
||||
+ NtClose( SOCKET2HANDLE(wsa->write.hSocket) );
|
||||
+ }
|
||||
+
|
||||
+ return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -2674,6 +2686,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2681,6 +2690,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
LPOVERLAPPED overlapped, LPTRANSMIT_FILE_BUFFERS buffers,
|
||||
DWORD flags )
|
||||
{
|
||||
@ -41,7 +38,7 @@ index de04d9b..b5b14c2 100644
|
||||
IO_STATUS_BLOCK *iosb = (IO_STATUS_BLOCK *)overlapped;
|
||||
union generic_unix_sockaddr uaddr;
|
||||
unsigned int uaddrlen = sizeof(uaddr);
|
||||
@@ -2696,8 +2709,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
@@ -2703,8 +2713,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
WSASetLastError( WSAENOTCONN );
|
||||
return FALSE;
|
||||
}
|
||||
@ -75,5 +72,5 @@ index 4716b61..36920a7 100644
|
||||
closesocket(client);
|
||||
client = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 909b44b24c7654670db892d4d91f572dd09b3d56 Mon Sep 17 00:00:00 2001
|
||||
From c3dd4a094fe7ab0c3cd3934c4e30ce228e24aeb3 Mon Sep 17 00:00:00 2001
|
||||
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
|
||||
Date: Thu, 16 Jan 2014 19:08:30 -0700
|
||||
Subject: ws2_32: Add support for TF_REUSE_SOCKET to TransmitFile.
|
||||
@ -12,10 +12,10 @@ Subject: ws2_32: Add support for TF_REUSE_SOCKET to TransmitFile.
|
||||
5 files changed, 75 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
|
||||
index b5b14c2..6188087 100644
|
||||
index 5c4a183..a29bcaa 100644
|
||||
--- a/dlls/ws2_32/socket.c
|
||||
+++ b/dlls/ws2_32/socket.c
|
||||
@@ -2638,6 +2638,17 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
@@ -2645,6 +2645,17 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws
|
||||
if (status != STATUS_SUCCESS)
|
||||
return status;
|
||||
|
||||
@ -32,8 +32,8 @@ index b5b14c2..6188087 100644
|
||||
+ }
|
||||
if (wsa->flags & TF_DISCONNECT)
|
||||
{
|
||||
if (WS_closesocket( HANDLE2SOCKET(wsa->write.hSocket) ) != 0)
|
||||
@@ -2686,7 +2697,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
/* we can't use WS_closesocket because it modifies the last error */
|
||||
@@ -2690,7 +2701,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD
|
||||
LPOVERLAPPED overlapped, LPTRANSMIT_FILE_BUFFERS buffers,
|
||||
DWORD flags )
|
||||
{
|
||||
@ -196,5 +196,5 @@ index f3bab85..46bd2f7 100644
|
||||
DECL_HANDLER(set_socket_event)
|
||||
{
|
||||
--
|
||||
1.9.1
|
||||
2.3.0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user