diff --git a/patches/ws2_32-TransmitFile/0001-ws2_32-Add-stub-for-TransmitFile.patch b/patches/ws2_32-TransmitFile/0001-ws2_32-Add-stub-for-TransmitFile.patch index ca6a6c33..4dd45e85 100644 --- a/patches/ws2_32-TransmitFile/0001-ws2_32-Add-stub-for-TransmitFile.patch +++ b/patches/ws2_32-TransmitFile/0001-ws2_32-Add-stub-for-TransmitFile.patch @@ -1,4 +1,4 @@ -From 9a7e400269a26545f47dfbd4f40ac2e74713c496 Mon Sep 17 00:00:00 2001 +From 56a72cb0a034dd7b3cc6ac68ad2d296c7f2ac47b Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 17:52:50 -0700 Subject: ws2_32: Add stub for TransmitFile. @@ -8,10 +8,10 @@ Subject: ws2_32: Add stub for TransmitFile. 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index a855285..c7f17c7 100644 +index d5e9fd1..07d2a47 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -2473,6 +2473,18 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW +@@ -2485,6 +2485,18 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW } /*********************************************************************** @@ -30,7 +30,7 @@ index a855285..c7f17c7 100644 * GetAcceptExSockaddrs */ static void WINAPI WS2_GetAcceptExSockaddrs(PVOID buffer, DWORD data_size, DWORD local_size, DWORD remote_size, -@@ -3974,7 +3986,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID +@@ -4031,7 +4043,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID } else if ( IsEqualGUID(&transmitfile_guid, in_buff) ) { diff --git a/patches/ws2_32-TransmitFile/0002-ws2_32-Check-for-invalid-parameters-in-TransmitFile.patch b/patches/ws2_32-TransmitFile/0002-ws2_32-Check-for-invalid-parameters-in-TransmitFile.patch index 0cb70fdb..635e21ac 100644 --- a/patches/ws2_32-TransmitFile/0002-ws2_32-Check-for-invalid-parameters-in-TransmitFile.patch +++ b/patches/ws2_32-TransmitFile/0002-ws2_32-Check-for-invalid-parameters-in-TransmitFile.patch @@ -1,18 +1,18 @@ -From 4ee238e8c4b76aba464025ba0d0d9c2f297c7300 Mon Sep 17 00:00:00 2001 +From 75ceb8ccd7dcf5908f7a1fcf9ef4d20b71f4148a Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Fri, 17 Jan 2014 12:35:57 -0700 Subject: ws2_32: Check for invalid parameters in TransmitFile. --- - dlls/ws2_32/socket.c | 20 +++++++++ + dlls/ws2_32/socket.c | 21 ++++++++++ dlls/ws2_32/tests/sock.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 123 insertions(+) + 2 files changed, 124 insertions(+) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index c7f17c7..ae23dd6 100644 +index 07d2a47..597b248 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -2478,8 +2478,28 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW +@@ -2490,8 +2490,29 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send, LPOVERLAPPED overlapped, LPTRANSMIT_FILE_BUFFERS buffers, DWORD flags ) { @@ -22,12 +22,13 @@ index c7f17c7..ae23dd6 100644 + FIXME("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, flags ); -+ if (s == INVALID_SOCKET) ++ ++ fd = get_sock_fd( s, 0, NULL ); ++ if (fd == -1) + { -+ WSASetLastError( WSAENOTSOCK ); ++ SetLastError( WSAENOTSOCK ); + return FALSE; + } -+ fd = get_sock_fd( s, 0, NULL ); + if (getpeername( fd, &uaddr.addr, &uaddrlen ) != 0) + { + release_sock_fd( s, fd ); @@ -42,10 +43,10 @@ index c7f17c7..ae23dd6 100644 return FALSE; } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 0abf732..9b01dd5 100644 +index 8a9cbba..dc393e6 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -6334,6 +6334,108 @@ end: +@@ -6491,6 +6491,108 @@ end: closesocket(connector2); } @@ -154,7 +155,7 @@ index 0abf732..9b01dd5 100644 static void test_getpeername(void) { SOCKET sock; -@@ -7564,6 +7666,7 @@ START_TEST( sock ) +@@ -7726,6 +7828,7 @@ START_TEST( sock ) test_events(1); test_ipv6only(); diff --git a/patches/ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.patch b/patches/ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.patch index 3e859929..3e84f0ad 100644 --- a/patches/ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.patch +++ b/patches/ws2_32-TransmitFile/0003-ws2_32-Implement-a-basic-synchronous-TransmitFile.patch @@ -1,23 +1,23 @@ -From e1278ab064bba641f34caa8132c8ddc8e83b9778 Mon Sep 17 00:00:00 2001 +From 882d1b1d21aeccfca1dbb6a25168fafa10ee91bf Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 18:24:27 -0700 Subject: ws2_32: Implement a basic synchronous TransmitFile. --- - dlls/ws2_32/socket.c | 66 ++++++++++++++++++++++++++++++++++++++++-- + dlls/ws2_32/socket.c | 65 +++++++++++++++++++++++++++++++++++++++++- dlls/ws2_32/tests/sock.c | 71 +++++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 134 insertions(+), 3 deletions(-) + 2 files changed, 134 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index ae23dd6..1faf443 100644 +index 597b248..b4e45df 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -2473,6 +2473,64 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW +@@ -2485,6 +2485,64 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW } /*********************************************************************** + * WS2_transmitfile_base (INTERNAL) -+ * ++ * + * Shared implementation for both synchronous and asynchronous TransmitFile. + */ +static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send, @@ -77,17 +77,16 @@ index ae23dd6..1faf443 100644 * TransmitFile */ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send, -@@ -2482,8 +2540,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR +@@ -2494,7 +2552,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR unsigned int uaddrlen = sizeof(uaddr); int fd; - FIXME("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, -- flags ); -+ TRACE("(%lx, %p, %d, %d, %p, %p, %d)\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, flags ); - if (s == INVALID_SOCKET) - { - WSASetLastError( WSAENOTSOCK ); -@@ -2500,6 +2557,11 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR ++ TRACE("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, + flags ); + + fd = get_sock_fd( s, 0, NULL ); +@@ -2513,6 +2571,11 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR if (flags) FIXME("Flags are not currently supported (0x%x).\n", flags); @@ -100,10 +99,10 @@ index ae23dd6..1faf443 100644 return FALSE; } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 30c8bc1..79052ab 100644 +index dc393e6..2312f50 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -6334,15 +6334,45 @@ end: +@@ -6491,15 +6491,45 @@ end: closesocket(connector2); } @@ -149,7 +148,7 @@ index 30c8bc1..79052ab 100644 int iret, len; BOOL bret; -@@ -6420,7 +6450,46 @@ static void test_TransmitFile(void) +@@ -6577,7 +6607,46 @@ static void test_TransmitFile(void) /* Test TransmitFile with no possible buffer */ bret = pTransmitFile(client, NULL, 0, 0, NULL, NULL, 0); diff --git a/patches/ws2_32-TransmitFile/0004-ws2_32-Add-asynchronous-support-for-TransmitFile.patch b/patches/ws2_32-TransmitFile/0004-ws2_32-Add-asynchronous-support-for-TransmitFile.patch index bf95fd29..e88700a3 100644 --- a/patches/ws2_32-TransmitFile/0004-ws2_32-Add-asynchronous-support-for-TransmitFile.patch +++ b/patches/ws2_32-TransmitFile/0004-ws2_32-Add-asynchronous-support-for-TransmitFile.patch @@ -1,4 +1,4 @@ -From ecf3a78c92ff49e1322d5e7467c54081606e9e8d Mon Sep 17 00:00:00 2001 +From 519fb92c76fd924bd3cc00181ddd69231f12549e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 18:24:53 -0700 Subject: ws2_32: Add asynchronous support for TransmitFile. @@ -9,10 +9,10 @@ Subject: ws2_32: Add asynchronous support for TransmitFile. 2 files changed, 124 insertions(+), 9 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index 1faf443..2323e3d 100644 +index b4e45df..3b54e3e 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -363,6 +363,18 @@ typedef struct ws2_accept_async +@@ -364,6 +364,18 @@ typedef struct ws2_accept_async struct ws2_async *read; } ws2_accept_async; @@ -31,7 +31,7 @@ index 1faf443..2323e3d 100644 /****************************************************************/ /* ----------------------------------- internal data */ -@@ -2499,6 +2511,16 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD +@@ -2511,6 +2523,16 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD buffer = HeapAlloc( GetProcessHeap(), 0, bytes_per_send ); if (!buffer) goto cleanup; @@ -48,12 +48,12 @@ index 1faf443..2323e3d 100644 /* read and send the data from the file */ do { -@@ -2531,6 +2553,32 @@ cleanup: +@@ -2543,6 +2565,32 @@ cleanup: } /*********************************************************************** + * WS2_async_transmitfile (INTERNAL) -+ * ++ * + * Asynchronous callback for overlapped TransmitFile operations. + */ +static NTSTATUS WS2_async_transmitfile( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) @@ -81,7 +81,7 @@ index 1faf443..2323e3d 100644 * TransmitFile */ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send, -@@ -2538,7 +2586,9 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR +@@ -2550,7 +2598,9 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR { union generic_unix_sockaddr uaddr; unsigned int uaddrlen = sizeof(uaddr); @@ -90,9 +90,9 @@ index 1faf443..2323e3d 100644 + struct ws2_transmitfile_async *wsa; + int status, fd; - TRACE("(%lx, %p, %d, %d, %p, %p, %d)\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, flags ); - if (s == INVALID_SOCKET) -@@ -2560,9 +2610,37 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR + TRACE("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, total_bytes, bytes_per_send, overlapped, buffers, + flags ); +@@ -2574,9 +2624,37 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR if (!overlapped) return WS2_transmitfile_base( s, h, total_bytes, bytes_per_send, overlapped, buffers, flags ); @@ -134,10 +134,10 @@ index 1faf443..2323e3d 100644 } diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 79052ab..652f75f 100644 +index 2312f50..dbb762a 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -6334,15 +6334,15 @@ end: +@@ -6491,15 +6491,15 @@ end: closesocket(connector2); } @@ -156,7 +156,7 @@ index 79052ab..652f75f 100644 while (1) { DWORD n1 = 0, n2 = 0; -@@ -6372,10 +6372,13 @@ static void test_TransmitFile(void) +@@ -6529,10 +6529,13 @@ static void test_TransmitFile(void) TRANSMIT_FILE_BUFFERS buffers; SOCKET client, server, dest; DWORD num_bytes, err; @@ -170,7 +170,7 @@ index 79052ab..652f75f 100644 /* Setup sockets for testing TransmitFile */ client = socket(AF_INET, SOCK_STREAM, 0); server = socket(AF_INET, SOCK_STREAM, 0); -@@ -6473,7 +6476,7 @@ static void test_TransmitFile(void) +@@ -6630,7 +6633,7 @@ static void test_TransmitFile(void) /* Test TransmitFile with only file data */ bret = pTransmitFile(client, file, 0, 0, NULL, NULL, 0); ok(bret, "TransmitFile failed unexpectedly.\n"); @@ -179,7 +179,7 @@ index 79052ab..652f75f 100644 /* Test TransmitFile with both file and buffer data */ buffers.Head = &header_msg[0]; -@@ -6486,11 +6489,44 @@ static void test_TransmitFile(void) +@@ -6643,11 +6646,44 @@ static void test_TransmitFile(void) iret = recv(dest, buf, sizeof(header_msg)+1, 0); ok(memcmp(buf, &header_msg[0], sizeof(header_msg)+1) == 0, "TransmitFile header buffer did not match!\n"); @@ -225,7 +225,7 @@ index 79052ab..652f75f 100644 /* Test TransmitFile with a UDP datagram socket */ closesocket(client); client = socket(AF_INET, SOCK_DGRAM, 0); -@@ -6501,6 +6537,7 @@ static void test_TransmitFile(void) +@@ -6658,6 +6694,7 @@ static void test_TransmitFile(void) cleanup: CloseHandle(file); diff --git a/patches/ws2_32-TransmitFile/0005-ws2_32-Add-support-for-TF_DISCONNECT-and-TF_REUSE_SO.patch b/patches/ws2_32-TransmitFile/0005-ws2_32-Add-support-for-TF_DISCONNECT-and-TF_REUSE_SO.patch index 4c61dfa6..2448ca00 100644 --- a/patches/ws2_32-TransmitFile/0005-ws2_32-Add-support-for-TF_DISCONNECT-and-TF_REUSE_SO.patch +++ b/patches/ws2_32-TransmitFile/0005-ws2_32-Add-support-for-TF_DISCONNECT-and-TF_REUSE_SO.patch @@ -1,4 +1,4 @@ -From 986759caf5c16c81f4a479e57b6ff2a96dbb3a2a Mon Sep 17 00:00:00 2001 +From 0e7bb2d1abdc6b27fb6b48520780a39c12343de8 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 19:08:30 -0700 Subject: ws2_32: Add support for TF_DISCONNECT and TF_REUSE_SOCKET to @@ -13,10 +13,10 @@ Subject: ws2_32: Add support for TF_DISCONNECT and TF_REUSE_SOCKET to 5 files changed, 89 insertions(+), 12 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index 2323e3d..500d288 100644 +index 3b54e3e..172b131 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -2545,6 +2545,18 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD +@@ -2557,6 +2557,18 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD if (buffers && WS_send( s, buffers->Tail, buffers->TailLength, 0 ) == SOCKET_ERROR) goto cleanup; @@ -35,7 +35,7 @@ index 2323e3d..500d288 100644 ret = TRUE; cleanup: -@@ -2586,6 +2598,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR +@@ -2598,6 +2610,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR { union generic_unix_sockaddr uaddr; unsigned int uaddrlen = sizeof(uaddr); @@ -43,7 +43,7 @@ index 2323e3d..500d288 100644 IO_STATUS_BLOCK *iosb = (IO_STATUS_BLOCK *)overlapped; struct ws2_transmitfile_async *wsa; int status, fd; -@@ -2604,8 +2617,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR +@@ -2618,8 +2631,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR return FALSE; } release_sock_fd( s, fd ); @@ -55,10 +55,10 @@ index 2323e3d..500d288 100644 if (!overlapped) return WS2_transmitfile_base( s, h, total_bytes, bytes_per_send, overlapped, buffers, flags ); diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 652f75f..8f96f84 100644 +index dbb762a..5bf23a0 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -6527,8 +6527,17 @@ static void test_TransmitFile(void) +@@ -6684,8 +6684,17 @@ static void test_TransmitFile(void) ok(iret == WAIT_OBJECT_0, "Overlapped TransmitFile failed.\n"); compare_file(file, dest, 10); @@ -90,10 +90,10 @@ index 06e6309..4426557 100644 #define FD_WINE_NONBLOCKING 0x20000000 #define FD_WINE_CONNECTED 0x40000000 diff --git a/server/protocol.def b/server/protocol.def -index fec5e75..a1ac327 100644 +index c9270ea..328f8a8 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -1220,6 +1220,12 @@ enum server_fd_type +@@ -1208,6 +1208,12 @@ enum server_fd_type @END @@ -107,10 +107,10 @@ index fec5e75..a1ac327 100644 @REQ(set_socket_event) obj_handle_t handle; /* handle to the socket */ diff --git a/server/sock.c b/server/sock.c -index 5ffb1fe..242327d 100644 +index 4adad0f..15afe81 100644 --- a/server/sock.c +++ b/server/sock.c -@@ -77,6 +77,7 @@ +@@ -80,6 +80,7 @@ #define FD_CLOSE 0x00000020 /* internal per-socket flags */ @@ -118,7 +118,7 @@ index 5ffb1fe..242327d 100644 #define FD_WINE_LISTENING 0x10000000 #define FD_WINE_NONBLOCKING 0x20000000 #define FD_WINE_CONNECTED 0x40000000 -@@ -121,6 +122,8 @@ static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, +@@ -124,6 +125,8 @@ static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, static void sock_reselect_async( struct fd *fd, struct async_queue *queue ); static void sock_cancel_async( struct fd *fd, struct process *process, struct thread *thread, client_ptr_t iosb ); @@ -127,7 +127,7 @@ index 5ffb1fe..242327d 100644 static int sock_get_ntstatus( int err ); static int sock_get_error( int err ); static void sock_set_error(void); -@@ -141,7 +144,7 @@ static const struct object_ops sock_ops = +@@ -144,7 +147,7 @@ static const struct object_ops sock_ops = default_set_sd, /* set_sd */ no_lookup_name, /* lookup_name */ no_open_file, /* open_file */ @@ -136,7 +136,7 @@ index 5ffb1fe..242327d 100644 sock_destroy /* destroy */ }; -@@ -580,6 +583,47 @@ static struct fd *sock_get_fd( struct object *obj ) +@@ -583,6 +586,47 @@ static struct fd *sock_get_fd( struct object *obj ) return (struct fd *)grab_object( sock->fd ); } @@ -184,7 +184,7 @@ index 5ffb1fe..242327d 100644 static void sock_destroy( struct object *obj ) { struct sock *sock = (struct sock *)obj; -@@ -627,15 +671,8 @@ static struct object *create_socket( int family, int type, int protocol, unsigne +@@ -630,15 +674,8 @@ static struct object *create_socket( int family, int type, int protocol, unsigne struct sock *sock; int sockfd; @@ -201,7 +201,7 @@ index 5ffb1fe..242327d 100644 if (!(sock = alloc_object( &sock_ops ))) { close( sockfd ); -@@ -960,6 +997,17 @@ DECL_HANDLER(accept_into_socket) +@@ -963,6 +1000,17 @@ DECL_HANDLER(accept_into_socket) release_object( sock ); }