Author: cgutman
Date: Mon Jun 8 07:12:03 2009
New Revision: 41348
URL:
http://svn.reactos.org/svn/reactos?rev=41348&view=rev
Log:
- Rewrite MiniQueryInformation so it creates a NDIS_REQUEST and passes it to
MiniDoRequest for processing to reduce code duplication
- Call MiniportCoRequest in connection-oriented miniports
- Now our NDIS loads all the way to the ASSERT for unsupported media on XP
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] Mon Jun 8 07:12:03
2009
@@ -666,25 +666,29 @@
*/
{
NDIS_STATUS NdisStatus;
- ULONG BytesNeeded;
- KIRQL OldIrql;
+ PNDIS_REQUEST NdisRequest;
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
- /* call the miniport's queryinfo handler */
- KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
- NdisStatus =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
- Adapter->NdisMiniportBlock.MiniportAdapterContext,
- Oid,
- Buffer,
- Size,
- BytesWritten,
- &BytesNeeded);
- KeLowerIrql(OldIrql);
+ NdisRequest = ExAllocatePool(NonPagedPool, sizeof(NDIS_REQUEST));
+ if (!NdisRequest) return NDIS_STATUS_RESOURCES;
+
+ RtlZeroMemory(NdisRequest, sizeof(NDIS_REQUEST));
+
+ NdisRequest->RequestType = NdisRequestQueryInformation;
+ NdisRequest->DATA.QUERY_INFORMATION.Oid = Oid;
+ NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer = Buffer;
+ NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength = Size;
+
+ NdisStatus = MiniDoRequest(Adapter, NdisRequest);
/* FIXME: Wait in pending case! */
ASSERT(NdisStatus != NDIS_STATUS_PENDING);
+
+ *BytesWritten = NdisRequest->DATA.QUERY_INFORMATION.BytesWritten;
+
+ ExFreePool(NdisRequest);
return NdisStatus;
}
@@ -929,30 +933,40 @@
Adapter->NdisMiniportBlock.PendingRequest = NdisRequest;
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
- switch (NdisRequest->RequestType)
- {
- case NdisRequestQueryInformation:
- Status =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
+ if
(!Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.CoRequestHandler)
+ {
+ switch (NdisRequest->RequestType)
+ {
+ case NdisRequestQueryInformation:
+ Status =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext,
+ NdisRequest->DATA.QUERY_INFORMATION.Oid,
+ NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer,
+ NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength,
+ (PULONG)&NdisRequest->DATA.QUERY_INFORMATION.BytesWritten,
+ (PULONG)&NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded);
+ break;
+
+ case NdisRequestSetInformation:
+ Status =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SetInformationHandler)(
+ Adapter->NdisMiniportBlock.MiniportAdapterContext,
+ NdisRequest->DATA.SET_INFORMATION.Oid,
+ NdisRequest->DATA.SET_INFORMATION.InformationBuffer,
+ NdisRequest->DATA.SET_INFORMATION.InformationBufferLength,
+ (PULONG)&NdisRequest->DATA.SET_INFORMATION.BytesRead,
+ (PULONG)&NdisRequest->DATA.SET_INFORMATION.BytesNeeded);
+ break;
+
+ default:
+ Status = NDIS_STATUS_FAILURE;
+ }
+ }
+ else
+ {
+ Status =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.CoRequestHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext,
- NdisRequest->DATA.QUERY_INFORMATION.Oid,
- NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer,
- NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength,
- (PULONG)&NdisRequest->DATA.QUERY_INFORMATION.BytesWritten,
- (PULONG)&NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded);
- break;
-
- case NdisRequestSetInformation:
- Status =
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SetInformationHandler)(
- Adapter->NdisMiniportBlock.MiniportAdapterContext,
- NdisRequest->DATA.SET_INFORMATION.Oid,
- NdisRequest->DATA.SET_INFORMATION.InformationBuffer,
- NdisRequest->DATA.SET_INFORMATION.InformationBufferLength,
- (PULONG)&NdisRequest->DATA.SET_INFORMATION.BytesRead,
- (PULONG)&NdisRequest->DATA.SET_INFORMATION.BytesNeeded);
- break;
-
- default:
- Status = NDIS_STATUS_FAILURE;
+ NULL, /* FIXME */
+ NdisRequest);
}
if (Status != NDIS_STATUS_PENDING) {