win-pvdrivers

changeset 136:351dfc4aa660

Don't unload driver on device shutdown... wait until driver unload callback.
Still crashes on unload, but getting closer.
author James Harper <james.harper@bendigoit.com.au>
date Sat Jan 19 14:51:33 2008 +1100 (2008-01-19)
parents 307dd7532ca1
children 76b6a278e97d
files xennet/sources xennet/xennet.c
line diff
     1.1 --- a/xennet/sources	Fri Jan 18 11:16:30 2008 -0800
     1.2 +++ b/xennet/sources	Sat Jan 19 14:51:33 2008 +1100
     1.3 @@ -1,7 +1,7 @@
     1.4  TARGETNAME=XENNET
     1.5  TARGETTYPE=DRIVER
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7 -VERSION=0.5.0.96
     1.8 +VERSION=0.5.0.97
     1.9  KMDF_VERSION=1
    1.10  MSC_WARNING_LEVEL=/W4
    1.11  INF_NAME=xennet
     2.1 --- a/xennet/xennet.c	Fri Jan 18 11:16:30 2008 -0800
     2.2 +++ b/xennet/xennet.c	Sat Jan 19 14:51:33 2008 +1100
     2.3 @@ -1727,7 +1727,7 @@ PageAlloc--;
     2.4  
     2.5    xi->XenInterface.InterfaceHeader.InterfaceDereference(NULL);
     2.6  
     2.7 -  WdfDriverMiniportUnload(WdfGetDriver());
     2.8 +  //WdfDriverMiniportUnload(WdfGetDriver()); // this should only happen on _driver_ unload
     2.9  
    2.10    NdisFreeBufferPool(xi->buffer_pool);
    2.11  BufferPoolAlloc--;
    2.12 @@ -1751,6 +1751,20 @@ NdisAlloc--;
    2.13    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    2.14  }
    2.15  
    2.16 +VOID
    2.17 +XenNet_Unload(
    2.18 +  PDRIVER_OBJECT  DriverObject
    2.19 +  )
    2.20 +{
    2.21 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.22 +
    2.23 +  UNREFERENCED_PARAMETER(DriverObject);
    2.24 +
    2.25 +  WdfDriverMiniportUnload(WdfGetDriver());
    2.26 +  
    2.27 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    2.28 +}
    2.29 +
    2.30  NTSTATUS
    2.31  DriverEntry(
    2.32    PDRIVER_OBJECT DriverObject,
    2.33 @@ -1818,5 +1832,7 @@ BufferPoolAlloc = 0;
    2.34      return status;
    2.35    }
    2.36  
    2.37 +  NdisMRegisterUnloadHandler(ndis_wrapper_handle, XenNet_Unload);
    2.38 +
    2.39    return status;
    2.40  }