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.

192 lines
3.5 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::IsRemote()
  20. {
  21. return _IsRemote();
  22. }
  23. BOOL CMountPoint::IsFloppy()
  24. {
  25. return _IsFloppy();
  26. }
  27. BOOL CMountPoint::IsDVD()
  28. {
  29. return _IsDVD();
  30. }
  31. BOOL CMountPoint::IsAudioCD()
  32. {
  33. return _IsAudioCD();
  34. }
  35. BOOL CMountPoint::IsAudioCDNoData()
  36. {
  37. return _IsAudioCDNoData();
  38. }
  39. BOOL CMountPoint::IsDVDRAMMedia()
  40. {
  41. return _IsDVDRAMMedia();
  42. }
  43. BOOL CMountPoint::IsFormattable()
  44. {
  45. return _IsFormattable();
  46. }
  47. BOOL CMountPoint::IsCompressible()
  48. {
  49. return ((DRIVE_ISCOMPRESSIBLE & _GetGVIDriveFlags()) ? TRUE : FALSE);
  50. }
  51. BOOL CMountPoint::IsRemovableDevice()
  52. {
  53. return _IsRemovableDevice();
  54. }
  55. BOOL CMountPoint::IsCompressed()
  56. {
  57. BOOL fRet = FALSE;
  58. if (!_IsFloppy35() && !_IsFloppy525() && !_IsCDROM())
  59. {
  60. DWORD dwAttrib;
  61. TraceMsg(TF_MOUNTPOINT, "CMountPoint::IsCompressed: for '%s'", _GetName());
  62. if (_GetFileAttributes(&dwAttrib))
  63. {
  64. if (dwAttrib & FILE_ATTRIBUTE_COMPRESSED)
  65. {
  66. fRet = TRUE;
  67. }
  68. }
  69. }
  70. return (fRet ? TRUE : FALSE);
  71. }
  72. BOOL CMountPoint::IsSupportingSparseFile()
  73. {
  74. BOOL fRet = FALSE;
  75. DWORD dwFlags;
  76. if (_GetFileSystemFlags(&dwFlags))
  77. {
  78. fRet = (FILE_SUPPORTS_SPARSE_FILES & dwFlags) ? TRUE : FALSE;
  79. }
  80. return fRet;
  81. }
  82. BOOL CMountPoint::IsContentIndexed()
  83. {
  84. BOOL fRet = FALSE;
  85. DWORD dwAttrib;
  86. TraceMsg(TF_MOUNTPOINT, "CMountPoint::IsContentIndexed: for '%s'", _GetName());
  87. if (_GetFileAttributes(&dwAttrib))
  88. {
  89. fRet = !(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED & dwAttrib);
  90. }
  91. return (fRet ? TRUE : FALSE);
  92. }
  93. BOOL CMountPoint::IsNTFS()
  94. {
  95. BOOL fRet = FALSE;
  96. WCHAR szFileSysName[MAX_FILESYSNAME];
  97. if (_GetFileSystemName(szFileSysName, ARRAYSIZE(szFileSysName)))
  98. {
  99. fRet = BOOLFROMPTR(StrStr(TEXT("NTFS"), szFileSysName));
  100. }
  101. return fRet;
  102. }
  103. BOOL CMountPoint::_IsLFN()
  104. {
  105. int iFlags = GetVolumeFlags();
  106. return !!(iFlags & DRIVE_LFN);
  107. }
  108. BOOL CMountPoint::_IsSecure()
  109. {
  110. int iFlags = GetVolumeFlags();
  111. return !!(iFlags & DRIVE_SECURITY);
  112. }
  113. /////////////////////////////////////////////////////////////////////////////
  114. // static IsXXX fct
  115. /////////////////////////////////////////////////////////////////////////////
  116. STDAPI_(BOOL) CMtPt_IsSlow(int iDrive)
  117. {
  118. BOOL fRet = FALSE;
  119. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  120. if (pmtpt)
  121. {
  122. fRet = pmtpt->_IsSlow();
  123. pmtpt->Release();
  124. }
  125. return fRet;
  126. }
  127. STDAPI_(BOOL) CMtPt_IsLFN(int iDrive)
  128. {
  129. BOOL fRet = FALSE;
  130. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  131. if (pmtpt)
  132. {
  133. fRet = pmtpt->_IsLFN();
  134. pmtpt->Release();
  135. }
  136. return fRet;
  137. }
  138. STDAPI_(BOOL) CMtPt_IsSecure(int iDrive)
  139. {
  140. BOOL fRet = FALSE;
  141. CMountPoint* pmtpt = CMountPoint::GetMountPoint(iDrive, FALSE);
  142. if (pmtpt)
  143. {
  144. fRet = pmtpt->_IsSecure();
  145. pmtpt->Release();
  146. }
  147. return fRet;
  148. }