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.

105 lines
2.3 KiB

  1. /* iohelp.c
  2. * Copyright (c) 2001 Microsoft Corporation
  3. */
  4. #include <ntddk.h>
  5. #include <ntimage.h>
  6. #include <ntldr.h>
  7. /*++
  8. IoGetLowerDeviceObject
  9. Routine Description:
  10. This routine gets the next lower device object on the device stack.
  11. Parameters:
  12. DeviceObject - Supplies a pointer to the deviceObject whose next device object needs
  13. to be obtained.
  14. ReturnValue:
  15. NULL if driver is unloaded or marked for unload or if there is no attached deviceobject.
  16. Otherwise a referenced pointer to the deviceobject is returned.
  17. Notes:
  18. --*/
  19. PDEVICE_OBJECT
  20. IoGetLowerDeviceObject(
  21. IN PDEVICE_OBJECT DeviceObject
  22. );
  23. /*++
  24. IoDeviceIsVerifier
  25. Routine Description:
  26. This routine checks whether the device object is the Verifier.
  27. Parameters:
  28. DeviceObject - Supplies a pointer to the deviceObject whose to be checked
  29. ReturnValue:
  30. TRUE if the device object is Verifier
  31. Notes:
  32. This function simply checks whether the driver name is \Driver\Verifier
  33. --*/
  34. NTSTATUS IoDeviceIsVerifier(PDEVICE_OBJECT DeviceObject)
  35. {
  36. UNICODE_STRING DriverName;
  37. const PCWSTR strDriverName = L"\\Driver\\Verifier";
  38. RtlInitUnicodeString(&DriverName, strDriverName);
  39. if (RtlEqualUnicodeString(&DriverName, &DeviceObject->DriverObject->DriverName, TRUE)) return STATUS_SUCCESS;
  40. return STATUS_NOT_SUPPORTED;
  41. }
  42. /*++
  43. IoDeviceIsAcpi
  44. Routine Description:
  45. This routine checks whether the device object is the Acpi.
  46. Parameters:
  47. DeviceObject - Supplies a pointer to the deviceObject whose to be checked
  48. ReturnValue:
  49. TRUE if the device object is Acpi
  50. Notes:
  51. --*/
  52. NTSTATUS IoDeviceIsAcpi(PDEVICE_OBJECT DeviceObject)
  53. {
  54. UNICODE_STRING Name;
  55. PKLDR_DATA_TABLE_ENTRY Section;
  56. const PCWSTR strDriverName = L"\\Driver\\Acpi";
  57. const PCWSTR strDllName = L"acpi.sys";
  58. RtlInitUnicodeString(&Name, strDriverName);
  59. if (RtlEqualUnicodeString(&Name, &DeviceObject->DriverObject->DriverName, TRUE)) return STATUS_SUCCESS;
  60. RtlInitUnicodeString(&Name, strDllName);
  61. Section = DeviceObject->DriverObject->DriverSection;
  62. if (RtlEqualUnicodeString(&Name, &Section->BaseDllName, TRUE)) return STATUS_SUCCESS;
  63. return STATUS_NOT_SUPPORTED;
  64. }