Author: cgutman
Date: Tue May 5 06:13:53 2009
New Revision: 40792
URL:
http://svn.reactos.org/svn/reactos?rev=40792&view=rev
Log:
- Handle IRP_MN_QUERY_REMOVE_DEVICE and IRP_MN_CANCEL_REMOVE_DEVICE
- Implement NdisCompletePnPEvent
- Handle pending cases
Modified:
trunk/reactos/drivers/network/ndis/ndis/50stubs.c
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/ndis/ndis/protocol.c
Modified: trunk/reactos/drivers/network/ndis/ndis/50stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/50stubs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/50stubs.c [iso-8859-1] Tue May 5 06:13:53
2009
@@ -170,26 +170,6 @@
*/
VOID
EXPORT
-NdisCompletePnPEvent(
- IN NDIS_STATUS Status,
- IN NDIS_HANDLE NdisBindingHandle,
- IN PNET_PNP_EVENT NetPnPEvent)
-/*
- * FUNCTION:
- * ARGUMENTS:
- * NOTES:
- * NDIS 5.0
- */
-{
- UNIMPLEMENTED
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-EXPORT
NdisConvertStringToAtmAddress(
OUT PNDIS_STATUS Status,
IN PNDIS_STRING String,
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] Tue May 5 06:13:53
2009
@@ -2044,12 +2044,14 @@
IoCompleteRequest(Irp, IO_NO_INCREMENT);
break;
+ case IRP_MN_QUERY_REMOVE_DEVICE:
case IRP_MN_QUERY_STOP_DEVICE:
Status = NdisIPnPQueryStopDevice(DeviceObject, Irp);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
break;
+ case IRP_MN_CANCEL_REMOVE_DEVICE:
case IRP_MN_CANCEL_STOP_DEVICE:
Status = NdisIPnPCancelStopDevice(DeviceObject, Irp);
Irp->IoStatus.Status = Status;
@@ -2812,5 +2814,65 @@
Adapter);
}
+/*
+ * @implemented
+ */
+VOID
+EXPORT
+NdisCompletePnPEvent(
+ IN NDIS_STATUS Status,
+ IN NDIS_HANDLE NdisBindingHandle,
+ IN PNET_PNP_EVENT NetPnPEvent)
+/*
+ * FUNCTION:
+ * ARGUMENTS:
+ * NOTES:
+ * NDIS 5.0
+ */
+{
+ PIRP Irp = (PIRP)NetPnPEvent->NdisReserved[0];
+ PLIST_ENTRY CurrentEntry = (PLIST_ENTRY)NetPnPEvent->NdisReserved[1];
+ PADAPTER_BINDING AdapterBinding = NdisBindingHandle;
+ PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
+ NDIS_STATUS NdisStatus;
+
+ if (Status != NDIS_STATUS_SUCCESS)
+ {
+ ExFreePool(NetPnPEvent);
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return;
+ }
+
+ while (CurrentEntry != &Adapter->ProtocolListHead)
+ {
+ AdapterBinding = CONTAINING_RECORD(CurrentEntry, ADAPTER_BINDING,
AdapterListEntry);
+
+ NdisStatus = (*AdapterBinding->ProtocolBinding->Chars.PnPEventHandler)(
+ AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
+ NetPnPEvent);
+
+ if (NdisStatus == NDIS_STATUS_PENDING)
+ {
+ NetPnPEvent->NdisReserved[1] = (ULONG_PTR)CurrentEntry->Flink;
+ return;
+ }
+ else if (NdisStatus != NDIS_STATUS_SUCCESS)
+ {
+ ExFreePool(NetPnPEvent);
+ Irp->IoStatus.Status = NdisStatus;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return;
+ }
+
+ CurrentEntry = CurrentEntry->Flink;
+ }
+
+ ExFreePool(NetPnPEvent);
+
+ Irp->IoStatus.Status = NDIS_STATUS_SUCCESS;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+}
+
/* EOF */
Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Tue May 5 06:13:53
2009
@@ -71,8 +71,11 @@
if (Status == NDIS_STATUS_PENDING)
{
- /* We don't handle this yet */
- ASSERT(FALSE);
+ IoMarkIrpPending(Irp);
+ /* Yes, I know this is stupid */
+ PnPEvent->NdisReserved[0] = (ULONG_PTR)Irp;
+ PnPEvent->NdisReserved[1] = (ULONG_PTR)CurrentEntry->Flink;
+ return NDIS_STATUS_PENDING;
}
else if (Status != NDIS_STATUS_SUCCESS)
{
@@ -115,7 +118,13 @@
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
PnPEvent);
- /* A protocol should always succeed NetEventCancelRemoveDevice */
+ if (Status == NDIS_STATUS_PENDING)
+ {
+ IoMarkIrpPending(Irp);
+ PnPEvent->NdisReserved[0] = (ULONG_PTR)Irp;
+ PnPEvent->NdisReserved[1] = (ULONG_PTR)CurrentEntry->Flink;
+ return NDIS_STATUS_PENDING;
+ }
ASSERT(Status == NDIS_STATUS_SUCCESS);