From 6735cfc56ec9ded79a18ebe2d593cc57cc56bd35 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 13 Nov 2011 06:02:08 +0000 Subject: [PATCH] [NDIS] - Fix a critical bug in NdisMGetDmaAlignment which was causing every NIC driver calling this function to crash because we thought we were passed an NDIS_DMA_BLOCK handle when in fact we receive an NDIS_MINIPORT_BLOCK handle - Fixes RTL8169 and 3Com NICs (and probably several more) [bug 6651 and bug 4330] svn path=/trunk/; revision=54372 --- reactos/drivers/network/ndis/ndis/io.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/network/ndis/ndis/io.c b/reactos/drivers/network/ndis/ndis/io.c index 87b9537ee97..33e84dfd41c 100644 --- a/reactos/drivers/network/ndis/ndis/io.c +++ b/reactos/drivers/network/ndis/ndis/io.c @@ -831,6 +831,7 @@ EXPORT NdisMReadDmaCounter( IN NDIS_HANDLE MiniportDmaHandle) { + /* NOTE: Unlike NdisMGetDmaAlignment() below, this is a handle to the DMA block */ PNDIS_DMA_BLOCK DmaBlock = MiniportDmaHandle; PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject; @@ -846,10 +847,11 @@ NdisMReadDmaCounter( ULONG EXPORT NdisMGetDmaAlignment( - IN NDIS_HANDLE MiniportDmaHandle) + IN NDIS_HANDLE MiniportAdapterHandle) { - PNDIS_DMA_BLOCK DmaBlock = MiniportDmaHandle; - PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject; + /* NOTE: Unlike NdisMReadDmaCounter() above, this is a handle to the NDIS miniport block */ + PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle; + PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)Adapter->NdisMiniportBlock.SystemAdapterObject; NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));