[MSAFD]
authorCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 02:25:56 +0000 (02:25 +0000)
committerCameron Gutman <aicommander@gmail.com>
Fri, 28 May 2010 02:25:56 +0000 (02:25 +0000)
- Zero the entire struct not just the lpNetworkEvents member
- Write the error codes returned from AFD to the iErrorCode array
- Fixes hundreds of ws2_32_winetest sock failures (only 104 failures now)
- Dedicated to Physicus

svn path=/trunk/; revision=47376

reactos/dll/win32/msafd/misc/event.c

index 9a49e31..ab340ae 100644 (file)
@@ -179,43 +179,51 @@ WSPEnumNetworkEvents(
     AFD_DbgPrint(MID_TRACE,("About to touch struct at %x (%d)\n", 
                            lpNetworkEvents, sizeof(*lpNetworkEvents)));
 
-    lpNetworkEvents->lNetworkEvents = 0;
+    RtlZeroMemory(lpNetworkEvents, sizeof(*lpNetworkEvents));
 
     AFD_DbgPrint(MID_TRACE,("Zeroed struct\n"));
 
     /* Set Events to wait for */
     if (EnumReq.PollEvents & AFD_EVENT_RECEIVE) {
        lpNetworkEvents->lNetworkEvents |= FD_READ;
+       lpNetworkEvents->iErrorCode[FD_READ_BIT] = EnumReq.EventStatus[FD_READ_BIT];
     }
 
     if (EnumReq.PollEvents & AFD_EVENT_SEND) {
        lpNetworkEvents->lNetworkEvents |= FD_WRITE;
+       lpNetworkEvents->iErrorCode[FD_WRITE_BIT] = EnumReq.EventStatus[FD_WRITE_BIT];
     }
 
     if (EnumReq.PollEvents & AFD_EVENT_OOB_RECEIVE) {
         lpNetworkEvents->lNetworkEvents |= FD_OOB;
+       lpNetworkEvents->iErrorCode[FD_OOB_BIT] = EnumReq.EventStatus[FD_OOB_BIT];
     }
 
     if (EnumReq.PollEvents & AFD_EVENT_ACCEPT) {
        lpNetworkEvents->lNetworkEvents |= FD_ACCEPT;
+       lpNetworkEvents->iErrorCode[FD_ACCEPT_BIT] = EnumReq.EventStatus[FD_ACCEPT_BIT];
     }
 
     if (EnumReq.PollEvents & 
        (AFD_EVENT_CONNECT | AFD_EVENT_CONNECT_FAIL)) {
         lpNetworkEvents->lNetworkEvents |= FD_CONNECT;
+       lpNetworkEvents->iErrorCode[FD_CONNECT_BIT] = EnumReq.EventStatus[FD_CONNECT_BIT];
     }
 
     if (EnumReq.PollEvents & 
        (AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT | AFD_EVENT_CLOSE)) {
        lpNetworkEvents->lNetworkEvents |= FD_CLOSE;
+       lpNetworkEvents->iErrorCode[FD_CLOSE_BIT] = EnumReq.EventStatus[FD_CLOSE_BIT];
     }
 
     if (EnumReq.PollEvents & AFD_EVENT_QOS) {
        lpNetworkEvents->lNetworkEvents |= FD_QOS;
+       lpNetworkEvents->iErrorCode[FD_QOS_BIT] = EnumReq.EventStatus[FD_QOS_BIT];
     }
 
     if (EnumReq.PollEvents & AFD_EVENT_GROUP_QOS) {
        lpNetworkEvents->lNetworkEvents |= FD_GROUP_QOS;
+       lpNetworkEvents->iErrorCode[FD_GROUP_QOS_BIT] = EnumReq.EventStatus[FD_GROUP_QOS_BIT];
     }
 
     if( NT_SUCCESS(Status) ) *lpErrno = 0;