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.

166 lines
5.4 KiB

  1. #include "namellst.h"
  2. #include "hwdev.h"
  3. #include "cmmn.h"
  4. #include "misc.h"
  5. #include <objbase.h>
  6. #include <shpriv.h>
  7. ///////////////////////////////////////////////////////////////////////////////
  8. //
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. class CVolume : public CNamedElem, public CHandleNotifTarget
  12. {
  13. public:
  14. // CNamedElem
  15. HRESULT Init(LPCWSTR pszElemName);
  16. // CHandleNotifTarget
  17. HRESULT HNTHandleEvent(DEV_BROADCAST_HANDLE* pdbh, DWORD dwEventType);
  18. // CVolume
  19. // Returns S_FALSE if can't find it
  20. HRESULT GetHWDeviceInst(CHWDeviceInst** pphwdevinst);
  21. HRESULT GetVolumeConstInfo(LPWSTR pszVolumeGUID, DWORD cchVolumeGUID,
  22. DWORD* pdwVolumeFlags, DWORD* pdwDriveType, DWORD* pdwDriveCap);
  23. HRESULT GetVolumeMediaInfo(LPWSTR pszLabel, DWORD cchLabel,
  24. LPWSTR pszFileSystem, DWORD cchFileSystem, DWORD* pdwFileSystemFlags,
  25. DWORD* pdwMaxFileNameLen, DWORD* pdwRootAttributes,
  26. DWORD* pdwSerialNumber, DWORD* pdwDriveState, DWORD* pdwMediaState,
  27. DWORD* pdwMediaCap);
  28. HRESULT GetIconAndLabelInfo(LPWSTR pszAutorunIconLocation,
  29. DWORD cchAutorunIconLocation, LPWSTR pszAutorunLabel, DWORD cchAutorunLabel,
  30. LPWSTR pszIconLocationFromService, DWORD cchIconLocationFromService,
  31. LPWSTR pszNoMediaIconLocationFromService,
  32. DWORD cchNoMediaIconLocationFromService,
  33. LPWSTR pszLabelFromService, DWORD cchLabelFromService);
  34. HRESULT HandleArrival();
  35. HRESULT HandleRemoval();
  36. public:
  37. static HRESULT Create(CNamedElem** ppelem);
  38. static HRESULT GetFillEnum(CFillEnum** ppfillenum);
  39. public:
  40. CVolume();
  41. ~CVolume();
  42. private:
  43. HRESULT _InitHelper(LPCWSTR pszElemName);
  44. void _HandleAccessDenied();
  45. HRESULT _CreateMountPoints();
  46. HRESULT _UpdateMountPoints();
  47. HRESULT _GetMountPoints(LPWSTR* ppsz, DWORD* pcch);
  48. HRESULT _CreateMtPt(LPWSTR pszMtPt);
  49. HRESULT _RemoveMtPt(LPWSTR pszMtPt);
  50. HRESULT _RegisterNotif();
  51. HRESULT _UnregisterNotif();
  52. HRESULT _InitDriveType(HANDLE hDevice);
  53. HRESULT _InitHWDeviceInst();
  54. HRESULT _UpdateConstInfo(HANDLE hDevice);
  55. HRESULT _UpdateMediaInfo(HANDLE hDevice, BOOL fGetYourOwnHandle);
  56. HRESULT _UpdateMediaInfoOnRemove();
  57. HRESULT _UpdateSoftEjectCaps();
  58. HRESULT _UpdateRemovableDevice();
  59. HRESULT _UpdateHasMedia(HANDLE hDevice);
  60. HRESULT _UpdateSpecialFilePresence();
  61. HRESULT _UpdateTrackInfo(HANDLE hDevice);
  62. HRESULT _FillMMC2CD(HANDLE hDevice);
  63. HRESULT _UpdateMMC2CDInfo(HANDLE hDevice);
  64. HRESULT _ExtractAutorunIconAndLabel();
  65. HRESULT _GetDeviceHandleSafe(HANDLE* phDevice, BOOL fGenericReadRequired);
  66. HRESULT _CloseDeviceHandleSafe(HANDLE hDevice);
  67. HRESULT _HandleMediaArrival();
  68. HRESULT _HandleMediaRemoval();
  69. HRESULT _HandleVolumeChange();
  70. HRESULT _AdviseVolumeChangeHelper(BOOL fAdded);
  71. HRESULT _AdviseMountPointHelper(LPCWSTR pszMountPoint, BOOL fAdded);
  72. HRESULT _AdviseVolumeMountingEvent(DWORD dwEvent);
  73. HRESULT _GetVOLUMEINFO2(VOLUMEINFO2** ppvolinfo2);
  74. HRESULT _ShouldTryAutoplay(BOOL* pfTry);
  75. HRESULT _GetDeviceIDDisk(LPWSTR pszDeviceIDDisk,
  76. DWORD cchDeviceIDDisk);
  77. HRESULT _DVDRAMHack(HANDLE hDevice);
  78. public:
  79. DWORD _dwState;
  80. private:
  81. DWORD _dwMediaPresentFromEvent;
  82. DWORD _dwMediaState;
  83. DWORD _dwMediaCap;
  84. WCHAR _szVolumeGUID[50];
  85. DWORD _dwVolumeFlags;
  86. DWORD _dwDriveType;
  87. DWORD _dwDriveCap;
  88. DWORD _dwDriveState;
  89. WCHAR _szDeviceIDDisk[MAX_DEVICEID];
  90. WCHAR _szLabel[MAX_LABEL];
  91. DWORD _dwSerialNumber;
  92. DWORD _dwMaxFileNameLen;
  93. DWORD _dwFileSystemFlags;
  94. WCHAR _szFileSystem[MAX_FILESYSNAME];
  95. DWORD _dwRootAttributes;
  96. DEVICE_TYPE _devtype;
  97. ULONG _ulDeviceNumber;
  98. ULONG _ulPartitionNumber;
  99. LPWSTR _pszMountPoints;
  100. DWORD _cchMountPoints;
  101. CHWDeviceInst _hwdevinst;
  102. BOOL _fHWDevInstInited;
  103. DWORD* _prgMMC2Features;
  104. BOOL _fFirstTime;
  105. CCritSect _cs;
  106. DEVINST _devinst;
  107. HDEVNOTIFY _hdevnotify;
  108. #ifdef DEBUG
  109. BOOL _fGenericReadRequired;
  110. #endif
  111. public: //for now, and for CStorageInfoImpl only
  112. WCHAR _szAutorunIconLocation[MAX_ICONLOCATION];
  113. WCHAR _szAutorunLabel[MAX_LABEL];
  114. };
  115. class CVolumeFillEnum : public CFillEnum
  116. {
  117. public:
  118. HRESULT Next(LPWSTR pszElemName, DWORD cchElemName, DWORD* pcchRequired);
  119. public:
  120. HRESULT _Init();
  121. private:
  122. CIntfFillEnum _intffillenum;
  123. };