Author: cgutman
Date: Wed Oct 28 03:12:21 2015
New Revision: 69728
URL:
http://svn.reactos.org/svn/reactos?rev=69728&view=rev
Log:
[AFD]
- Fix WSAEnumNetworkEvents failing if no event was supplied (uTorrent issue - CORE-6656)
Modified:
trunk/reactos/drivers/network/afd/afd/select.c
Modified: trunk/reactos/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/se…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] Wed Oct 28 03:12:21 2015
@@ -344,21 +344,25 @@
return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 );
}
- Status = ObReferenceObjectByHandle(EnumReq->Event,
- EVENT_ALL_ACCESS,
- *ExEventObjectType,
- UserMode,
- (PVOID *)&UserEvent,
- NULL);
- if (!NT_SUCCESS(Status))
+ /* An event may optionally be provided for us to clear */
+ if (EnumReq->Event != NULL)
{
- AFD_DbgPrint(MIN_TRACE,("Unable to reference event %x\n", Status));
- return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
- }
-
- /* Clear the event */
- KeClearEvent(UserEvent);
- ObDereferenceObject(UserEvent);
+ Status = ObReferenceObjectByHandle(EnumReq->Event,
+ EVENT_ALL_ACCESS,
+ *ExEventObjectType,
+ UserMode,
+ (PVOID *)&UserEvent,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ AFD_DbgPrint(MIN_TRACE,("Unable to reference event %x\n",
Status));
+ return UnlockAndMaybeComplete(FCB, Status, Irp, 0);
+ }
+
+ /* Clear the event */
+ KeClearEvent(UserEvent);
+ ObDereferenceObject(UserEvent);
+ }
/* Copy the poll state, masking out disabled events */
EnumReq->PollEvents = (FCB->PollState & ~FCB->EventSelectDisabled);