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.

84 lines
2.6 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 1998-1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: DrvInfo.h
  6. //
  7. // Owner: YanL
  8. //
  9. // Description:
  10. //
  11. // Interface to device enumeration
  12. //
  13. // Note:
  14. // wustl.h required
  15. //
  16. //=======================================================================
  17. #ifndef _DRVINFO_H
  18. // auto handle to HDEVINFO`
  19. struct auto_hdevinfo_traits {
  20. static HDEVINFO invalid() { return INVALID_HANDLE_VALUE; }
  21. static void release(HDEVINFO hDevInfo) { SetupDiDestroyDeviceInfoList(hDevInfo); }
  22. };
  23. typedef auto_resource< HDEVINFO, auto_hdevinfo_traits > auto_hdevinfo;
  24. // auto handle to HINF
  25. struct auto_hinf_traits {
  26. static HINF invalid() { return INVALID_HANDLE_VALUE; }
  27. static void release(HINF hinf) { SetupCloseInfFile(hinf); }
  28. };
  29. typedef auto_resource< HINF, auto_hinf_traits > auto_hinf;
  30. // auto handle to HSPFILEQ
  31. struct auto_hspfileq_traits {
  32. static HSPFILEQ invalid() { return INVALID_HANDLE_VALUE; }
  33. static void release(HSPFILEQ hspfileq) { SetupCloseFileQueue(hspfileq); }
  34. };
  35. typedef auto_resource< HINF, auto_hspfileq_traits > auto_hspfileq;
  36. // Main working interface
  37. // We are using an interface - not an object to hide the fact that
  38. // we can return both real and fake devices
  39. // It will let as query properties at the run time
  40. struct IDrvInfo
  41. {
  42. virtual bool GetDeviceInstanceID(tchar_buffer& bufDeviceInstanceID) = 0;
  43. virtual bool HasDriver() = 0;
  44. virtual bool IsPrinter() = 0;
  45. virtual bool GetAllHardwareIDs(tchar_buffer& bufHardwareIDs) = 0;
  46. virtual bool GetHardwareIDs(tchar_buffer& bufHardwareIDs) = 0;
  47. virtual bool GetCompatIDs(tchar_buffer& bufHardwareIDs) = 0;
  48. virtual bool GetMatchingDeviceId(tchar_buffer& bufMatchingDeviceId) = 0;
  49. virtual bool GetManufacturer(tchar_buffer& bufMfg) = 0;
  50. virtual bool GetProvider(tchar_buffer& bufProvider) = 0;
  51. virtual bool GetDescription(tchar_buffer& bufDescription) = 0;
  52. virtual bool GetDriverDate(FILETIME& ftDriverDate) = 0;
  53. virtual ~IDrvInfo() {}
  54. protected:
  55. // to be used interally
  56. friend class CDrvInfoEnum;
  57. virtual bool Init(LPCTSTR szDevInstID) = 0;
  58. };
  59. // Device enumerator will return IDrvInfo ofr real or fake device
  60. class CDrvInfoEnum
  61. {
  62. public:
  63. // to be used by CDM.DLL with wszDevInstID set from DOWNLOADINFO struct
  64. static bool GetDrvInfo(LPCWSTR wszDevInstID, IDrvInfo** ppDrvInfo);
  65. public:
  66. // to be used by WUV3IS.DLL and Win98 part of CDM.DLL
  67. CDrvInfoEnum();
  68. bool GetNextDrvInfo(IDrvInfo** ppDrvInfo);
  69. protected:
  70. auto_hdevinfo m_hDevInfoSet;
  71. DWORD m_dwDeviceIndex;
  72. };
  73. #define _DRVINFO_H
  74. #endif