Author: cgutman
Date: Sun Mar 1 10:43:12 2015
New Revision: 66514
URL:
http://svn.reactos.org/svn/reactos?rev=66514&view=rev
Log:
[NDIS]
- Fix a bugcheck caused when drivers pend requests NDIS-internal requests issued during
initialization
- Fixes Dell 1390 WLAN card (currently scanning via wlanconf isn't working, but
connecting via SSID works)
Modified:
trunk/reactos/drivers/network/ndis/ndis/miniport.c
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sun Mar 1 10:43:12
2015
@@ -495,11 +495,25 @@
MacBlock = (PNDIS_REQUEST_MAC_BLOCK)Request->MacReserved;
- if( MacBlock->Binding->RequestCompleteHandler ) {
- (*MacBlock->Binding->RequestCompleteHandler)(
- MacBlock->Binding->ProtocolBindingContext,
- Request,
- Status);
+ /* We may or may not be doing this request on behalf of an adapter binding */
+ if (MacBlock->Binding != NULL)
+ {
+ /* We are, so invoke its request complete handler */
+ if (MacBlock->Binding->RequestCompleteHandler != NULL)
+ {
+ (*MacBlock->Binding->RequestCompleteHandler)(
+ MacBlock->Binding->ProtocolBindingContext,
+ Request,
+ Status);
+ }
+ }
+ else
+ {
+ /* We are doing this internally, so we'll signal this event we've stashed
in the MacBlock */
+ ASSERT(MacBlock->Unknown1 != NULL);
+ ASSERT(MacBlock->Unknown3 == NULL);
+ MacBlock->Unknown3 = (PVOID)Status;
+ KeSetEvent(MacBlock->Unknown1, IO_NO_INCREMENT, FALSE);
}
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
@@ -746,6 +760,8 @@
{
NDIS_STATUS NdisStatus;
PNDIS_REQUEST NdisRequest;
+ KEVENT Event;
+ PNDIS_REQUEST_MAC_BLOCK MacBlock;
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
@@ -762,11 +778,19 @@
NdisRequest->DATA.SET_INFORMATION.InformationBuffer = Buffer;
NdisRequest->DATA.SET_INFORMATION.InformationBufferLength = Size;
+ /* We'll need to give the completion routine some way of letting us know
+ * when it's finished. We'll stash a pointer to an event in the MacBlock */
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ MacBlock = (PNDIS_REQUEST_MAC_BLOCK)NdisRequest->MacReserved;
+ MacBlock->Unknown1 = &Event;
+
NdisStatus = MiniDoRequest(Adapter, NdisRequest);
- /* FIXME: Wait in pending case! */
-
- ASSERT(NdisStatus != NDIS_STATUS_PENDING);
+ if (NdisStatus == NDIS_STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
+ NdisStatus = (NDIS_STATUS)MacBlock->Unknown3;
+ }
*BytesRead = NdisRequest->DATA.SET_INFORMATION.BytesRead;
@@ -796,6 +820,8 @@
{
NDIS_STATUS NdisStatus;
PNDIS_REQUEST NdisRequest;
+ KEVENT Event;
+ PNDIS_REQUEST_MAC_BLOCK MacBlock;
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
@@ -812,11 +838,19 @@
NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer = Buffer;
NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength = Size;
+ /* We'll need to give the completion routine some way of letting us know
+ * when it's finished. We'll stash a pointer to an event in the MacBlock */
+ KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ MacBlock = (PNDIS_REQUEST_MAC_BLOCK)NdisRequest->MacReserved;
+ MacBlock->Unknown1 = &Event;
+
NdisStatus = MiniDoRequest(Adapter, NdisRequest);
- /* FIXME: Wait in pending case! */
-
- ASSERT(NdisStatus != NDIS_STATUS_PENDING);
+ if (NdisStatus == NDIS_STATUS_PENDING)
+ {
+ KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
+ NdisStatus = (NDIS_STATUS)MacBlock->Unknown3;
+ }
*BytesWritten = NdisRequest->DATA.QUERY_INFORMATION.BytesWritten;