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.

215 lines
3.7 KiB

  1. #include "shellprv.h"
  2. #pragma hdrstop
  3. #include "mtpt.h"
  4. /////////////////////////////////////////////////////////////////////////////
  5. //
  6. /////////////////////////////////////////////////////////////////////////////
  7. BOOL CMountPoint::IsCDROM()
  8. {
  9. return _IsCDROM();
  10. }
  11. BOOL CMountPoint::IsFixedDisk()
  12. {
  13. return _IsFixedDisk();
  14. }
  15. BOOL CMountPoint::IsStrictRemovable()
  16. {
  17. return _IsStrictRemovable();
  18. }
  19. BOOL CMountPoint::IsAutoRun()
  20. {
  21. return _IsAutorun();
  22. }
  23. BOOL CMountPoint::IsRemote()
  24. {
  25. return _IsRemote();
  26. }
  27. BOOL CMountPoint::IsFloppy()
  28. {
  29. return _IsFloppy();
  30. }
  31. BOOL CMountPoint::IsDVD()
  32. {
  33. return _IsDVD();
  34. }
  35. BOOL CMountPoint::IsAudioCD()
  36. {
  37. return _IsAudioCD();
  38. }
  39. BOOL CMountPoint::IsAudioCDNoData()
  40. {
  41. return _IsAudioCDNoData();
  42. }
  43. BOOL CMountPoint::IsRAMDisk()
  44. {
  45. return (DRIVE_RAMDISK == GetDriveType(_szName));
  46. }
  47. BOOL CMountPoint::IsDVDRAMMedia()
  48. {
  49. return _IsDVDRAMMedia();
  50. }
  51. BOOL CMountPoint::IsFormattable()
  52. {
  53. return _IsFormattable();
  54. }
  55. BOOL CMountPoint::IsCompressible()
  56. {
  57. return ((DRIVE_ISCOMPRESSIBLE & _GetGVIDriveFlags()) ? TRUE : FALSE);
  58. }
  59. BOOL CMountPoint::IsRemovableDevice()
  60. {
  61. return _IsRemovableDevice();
  62. }
  63. BOOL CMountPoint::IsCompressed()
  64. {
  65. BOOL fRet = FALSE;
  66. if (!_IsFloppy35() && !_IsFloppy525() && !_IsCDROM())
  67. {
  68. DWORD dwAttrib;
  69. TraceMsg(TF_MOUNTPOINT, "CMountPoint::IsCompressed: for '%s'", _GetName());
  70. if (_GetFileAttributes(&dwAttrib))
  71. {
  72. if (dwAttrib & FILE_ATTRIBUTE_COMPRESSED)
  73. {
  74. fRet = TRUE;
  75. }
  76. }
  77. }
  78. return (fRet ? TRUE : FALSE);
  79. }
  80. BOOL CMountPoint::IsSupportingSparseFile()
  81. {
  82. BOOL fRet = FALSE;
  83. DWORD dwFlags;
  84. if (_GetFileSystemFlags(&dwFlags))
  85. {
  86. fRet = (FILE_SUPPORTS_SPARSE_FILES & dwFlags) ? TRUE : FALSE;
  87. }
  88. return fRet;
  89. }
  90. BOOL CMountPoint::IsContentIndexed()
  91. {
  92. BOOL fRet = FALSE;
  93. DWORD dwAttrib;
  94. TraceMsg(TF_MOUNTPOINT, "CMountPoint::IsContentIndexed: for '%s'", _GetName());
  95. if (_GetFileAttributes(&dwAttrib))
  96. {
  97. fRet = !(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED & dwAttrib);
  98. }
  99. return (fRet ? TRUE : FALSE);
  100. }
  101. BOOL CMountPoint::IsNTFS()
  102. {
  103. BOOL fRet = FALSE;
  104. WCHAR szFileSysName[MAX_FILESYSNAME];
  105. if (_GetFileSystemName(szFileSysName, ARRAYSIZE(szFileSysName)))
  106. {
  107. fRet = BOOLFROMPTR(StrStr(TEXT("NTFS"), szFileSysName));
  108. }
  109. return fRet;
  110. }
  111. BOOL CMountPoint::_IsLFN()
  112. {
  113. int iFlags = GetVolumeFlags();
  114. return !!(iFlags & DRIVE_LFN);
  115. }
  116. BOOL CMountPoint::_IsSecure()
  117. {
  118. int iFlags = GetVolumeFlags();
  119. return !!(iFlags & DRIVE_SECURITY);
  120. }
  121. BOOL CMountPoint::_IsShellOpen()
  122. {
  123. int iDriveFlags = GetDriveFlags();
  124. return !!(DRIVE_SHELLOPEN & iDriveFlags);
  125. }
  126. BOOL CMountPoint::_IsAutoOpen()
  127. {
  128. int iDriveFlags = GetDriveFlags();
  129. return !!(DRIVE_AUTOOPEN & iDriveFlags);
  130. }
  131. /////////////////////////////////////////////////////////////////////////////
  132. // static IsXXX fct
  133. /////////////////////////////////////////////////////////////////////////////
  134. STDAPI_(BOOL) CMtPt_IsSlow(int iDrive)
  135. {
  136. BOOL fRet = FALSE;
  137. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  138. if (pmtpt)
  139. {
  140. fRet = pmtpt->_IsSlow();
  141. pmtpt->Release();
  142. }
  143. return fRet;
  144. }
  145. STDAPI_(BOOL) CMtPt_IsLFN(int iDrive)
  146. {
  147. BOOL fRet = FALSE;
  148. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  149. if (pmtpt)
  150. {
  151. fRet = pmtpt->_IsLFN();
  152. pmtpt->Release();
  153. }
  154. return fRet;
  155. }
  156. STDAPI_(BOOL) CMtPt_IsSecure(int iDrive)
  157. {
  158. BOOL fRet = FALSE;
  159. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  160. if (pmtpt)
  161. {
  162. fRet = pmtpt->_IsSecure();
  163. pmtpt->Release();
  164. }
  165. return fRet;
  166. }