Source code of Windows XP (NT5)
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.

106 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. devenum.h
  5. Abstract:
  6. Code for enum IDE ans SCSI controllers and attached to them storage devices
  7. and calculate for them SCSI Address.
  8. Author:
  9. Souren Aghajanyan (sourenag) 05-June-2001
  10. Revision History:
  11. --*/
  12. #pragma once
  13. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  14. #define MAX_PNPID_SIZE MAX_PATH+1
  15. #define MAX_REG_SIZE 512
  16. #define INVALID_SCSI_PORT 0xffffffff
  17. #define REG_ENUM_INVALID_INDEX 0xffffffff
  18. typedef enum tagCONTROLLER_TYPE{
  19. CONTROLLER_UNKNOWN = 0,
  20. CONTROLLER_ON_BOARD_IDE = 1,
  21. CONTROLLER_EXTRA_IDE = 2,
  22. CONTROLLER_SCSI = 3,
  23. }CONTROLLER_TYPE;
  24. typedef struct tagCONTROLLER_INFO
  25. {
  26. CONTROLLER_TYPE ControllerType;
  27. TCHAR PNPID[MAX_PNPID_SIZE];
  28. UINT SCSIPortNumber;
  29. }CONTROLLER_INFO, *PCONTROLLER_INFO;
  30. typedef struct tagCONTROLLERS_COLLECTION{
  31. UINT NumberOfControllers;
  32. PCONTROLLER_INFO ControllersInfo;
  33. }CONTROLLERS_COLLECTION, *PCONTROLLERS_COLLECTION;
  34. typedef struct tagDRIVE_SCSI_ADDRESS
  35. {
  36. DWORD DriveType;
  37. TCHAR DriveLetter;
  38. UCHAR PortNumber;
  39. UCHAR TargetId;
  40. UCHAR Lun;
  41. }DRIVE_SCSI_ADDRESS, *PDRIVE_SCSI_ADDRESS;
  42. typedef BOOL (*GATHERCONTROLLERINFO)(
  43. IN OUT PCONTROLLER_INFO ActiveControllersOut,
  44. IN OUT PUINT NumberOfActiveControllersOut
  45. );
  46. typedef BOOL (*PDEVICE_ENUM_CALLBACK_FUNCTION)(
  47. IN HKEY hDevice,
  48. IN PCONTROLLERS_COLLECTION ControllersCollection,
  49. IN UINT ControllerIndex,
  50. IN PVOID CallbackData);
  51. BOOL
  52. GatherControllersInfo(
  53. IN OUT PCONTROLLERS_COLLECTION * ControllersCollectionOut
  54. );
  55. BOOL
  56. ReleaseControllersInfo(
  57. IN PCONTROLLERS_COLLECTION ControllersCollection
  58. );
  59. BOOL
  60. GetSCSIAddressFromPnPId(
  61. IN PCONTROLLERS_COLLECTION ControllersCollection,
  62. IN HKEY hDeviceRegKey,
  63. IN PCTSTR PnPIdString,
  64. OUT DRIVE_SCSI_ADDRESS * ScsiAddressOut
  65. );
  66. BOOL
  67. GetDeviceType(
  68. IN HKEY hDevice,
  69. OUT DWORD* DriveType
  70. );
  71. BOOL
  72. DoesDriveExist(
  73. IN HKEY hDevice,
  74. OUT DWORD* DriveType
  75. );
  76. BOOL
  77. DeviceEnum(
  78. IN PCONTROLLERS_COLLECTION ControllersCollection,
  79. IN PCTSTR DeviceCategory,
  80. IN PDEVICE_ENUM_CALLBACK_FUNCTION DeviceEnumCallbackFunction,
  81. IN PVOID CallbackData
  82. );