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.

216 lines
3.9 KiB

  1. #include "shellprv.h"
  2. #pragma hdrstop
  3. #include "mtptl.h"
  4. /////////////////////////////////////////////////////////////////////////////
  5. //
  6. /////////////////////////////////////////////////////////////////////////////
  7. // Lies in Safe boot mode about floppies
  8. BOOL CMtPtLocal::_IsStrictRemovable()
  9. {
  10. BOOL fRet;
  11. if (_CanUseVolume())
  12. {
  13. fRet = _pvol->dwDriveType & HWDTS_REMOVABLEDISK;
  14. }
  15. else
  16. {
  17. fRet = FALSE;
  18. if (GetDriveType(_GetNameForFctCall()) == DRIVE_REMOVABLE)
  19. {
  20. WCHAR ch = _GetNameFirstCharUCase();
  21. if ((TEXT('A') != ch) || (TEXT('B') != ch))
  22. {
  23. fRet = TRUE;
  24. }
  25. }
  26. }
  27. return fRet;
  28. }
  29. BOOL CMtPtLocal::_IsFixedDisk()
  30. {
  31. BOOL fRet;
  32. if (_CanUseVolume())
  33. {
  34. fRet = _pvol->dwDriveType & HWDTS_FIXEDDISK;
  35. }
  36. else
  37. {
  38. fRet = (GetDriveType(_GetNameForFctCall()) == DRIVE_FIXED);
  39. }
  40. return fRet;
  41. }
  42. BOOL CMtPtLocal::_IsFloppy()
  43. {
  44. BOOL fRet;
  45. if (_CanUseVolume())
  46. {
  47. fRet = _pvol->dwDriveType & (HWDTS_FLOPPY35 | HWDTS_FLOPPY525);
  48. }
  49. else
  50. {
  51. fRet = FALSE;
  52. if (GetDriveType(_GetNameForFctCall()) == DRIVE_REMOVABLE)
  53. {
  54. WCHAR ch = _GetNameFirstCharUCase();
  55. if ((TEXT('A') == ch) || (TEXT('B') == ch))
  56. {
  57. fRet = TRUE;
  58. }
  59. }
  60. }
  61. return fRet;
  62. }
  63. // Lies in Safe boot mode about floppies
  64. BOOL CMtPtLocal::_IsFloppy35()
  65. {
  66. BOOL fRet;
  67. if (_CanUseVolume())
  68. {
  69. fRet = _pvol->dwDriveType & HWDTS_FLOPPY35;
  70. }
  71. else
  72. {
  73. fRet = FALSE;
  74. if (GetDriveType(_GetNameForFctCall()) == DRIVE_REMOVABLE)
  75. {
  76. WCHAR ch = _GetNameFirstCharUCase();
  77. if (TEXT('A') == ch)
  78. {
  79. fRet = TRUE;
  80. }
  81. }
  82. }
  83. return fRet;
  84. }
  85. // Lies in Safe boot mode about floppies
  86. BOOL CMtPtLocal::_IsFloppy525()
  87. {
  88. BOOL fRet;
  89. if (_CanUseVolume())
  90. {
  91. fRet = _pvol->dwDriveType & HWDTS_FLOPPY525;
  92. }
  93. else
  94. {
  95. fRet = FALSE;
  96. if (GetDriveType(_GetNameForFctCall()) == DRIVE_REMOVABLE)
  97. {
  98. WCHAR ch = _GetNameFirstCharUCase();
  99. if (TEXT('B') == ch)
  100. {
  101. fRet = TRUE;
  102. }
  103. }
  104. }
  105. return fRet;
  106. }
  107. BOOL CMtPtLocal::_IsCDROM()
  108. {
  109. BOOL fRet;
  110. if (_CanUseVolume())
  111. {
  112. fRet = _pvol->dwDriveType & HWDTS_CDROM;
  113. }
  114. else
  115. {
  116. fRet = (GetDriveType(_GetNameForFctCall()) == DRIVE_CDROM);
  117. }
  118. return fRet;
  119. }
  120. BOOL CMtPtLocal::_IsAudioCD()
  121. {
  122. BOOL fRet;
  123. if (_CanUseVolume())
  124. {
  125. fRet = _pvol->dwMediaCap & HWDMC_HASAUDIOTRACKS;
  126. }
  127. else
  128. {
  129. fRet = FALSE;
  130. }
  131. return fRet;
  132. }
  133. BOOL CMtPtLocal::_IsAudioCDNoData()
  134. {
  135. return _IsAudioCD() && !(_pvol->dwMediaCap & HWDMC_HASDATATRACKS);
  136. }
  137. BOOL CMtPtLocal::_IsDVDRAMMedia()
  138. {
  139. BOOL fRetVal = FALSE;
  140. if (_CanUseVolume())
  141. {
  142. fRetVal = ((HWDDC_CAPABILITY_SUPPORTDETECTION & _pvol->dwDriveCapability) &&
  143. (HWDMC_WRITECAPABILITY_SUPPORTDETECTION & _pvol->dwMediaCap) &&
  144. (_pvol->dwMediaCap & HWDMC_DVDRAM) &&
  145. (_pvol->dwDriveCapability & HWDDC_DVDRAM));
  146. }
  147. return fRetVal;
  148. }
  149. BOOL CMtPtLocal::_IsFormattable()
  150. {
  151. return (_IsStrictRemovable() || _IsFixedDisk() || _IsFloppy() || _IsDVDRAMMedia());
  152. }
  153. /*BOOL CMtPtLocal::_IsDVDMedia()
  154. {
  155. BOOL fRet;
  156. if (_CanUseVolume())
  157. {
  158. if (HWDMC_WRITECAPABILITY_SUPPORTDETECTION & _pvol->dwMediaCap)
  159. {
  160. fRet = !!(_pvol->dwMediaCap &
  161. (HWDMC_DVDROM | HWDMC_DVDRECORDABLE | HWDMC_DVDRAM));
  162. }
  163. else
  164. {
  165. fRet = FALSE;
  166. }
  167. }
  168. else
  169. {
  170. fRet = FALSE;
  171. }
  172. return fRet;
  173. }*/
  174. BOOL CMtPtLocal::_IsDVD()
  175. {
  176. return _IsDVDDisc();
  177. }