Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.9 KiB

  1. #include "pch.h"
  2. VOID
  3. PptUnload(
  4. IN PDRIVER_OBJECT DriverObject
  5. )
  6. /*++
  7. Routine Description:
  8. This routine cleans up all of the memory associated with
  9. any of the devices belonging to the driver. It will
  10. loop through the device list.
  11. Arguments:
  12. DriverObject - Supplies the driver object controlling all of the
  13. devices.
  14. Return Value:
  15. None.
  16. --*/
  17. {
  18. PDEVICE_OBJECT CurrentDevice;
  19. PFDO_EXTENSION Extension;
  20. PLIST_ENTRY Head;
  21. PISR_LIST_ENTRY Entry;
  22. CurrentDevice = DriverObject->DeviceObject;
  23. while( CurrentDevice ) {
  24. Extension = CurrentDevice->DeviceExtension;
  25. if (Extension->InterruptRefCount) {
  26. PptDisconnectInterrupt(Extension);
  27. }
  28. while (!IsListEmpty(&Extension->IsrList)) {
  29. Head = RemoveHeadList(&Extension->IsrList);
  30. Entry = CONTAINING_RECORD(Head, ISR_LIST_ENTRY, ListEntry);
  31. ExFreePool(Entry);
  32. }
  33. ExFreePool(Extension->DeviceName.Buffer);
  34. IoDeleteDevice(CurrentDevice);
  35. IoGetConfigurationInformation()->ParallelCount--;
  36. CurrentDevice = DriverObject->DeviceObject;
  37. }
  38. if( PortInfoMutex ) {
  39. ExFreePool( PortInfoMutex );
  40. PortInfoMutex = NULL;
  41. }
  42. if( PowerStateCallbackRegistration ) {
  43. ExUnregisterCallback( PowerStateCallbackRegistration );
  44. PowerStateCallbackRegistration = NULL; // probably not needed, but shouldn't hurt
  45. }
  46. if( PowerStateCallbackObject ) {
  47. ObDereferenceObject( PowerStateCallbackObject );
  48. PowerStateCallbackObject = NULL;
  49. }
  50. RtlFreeUnicodeString( &RegistryPath );
  51. DD(NULL,DDE,"PptUnload\n");
  52. }