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.

174 lines
3.7 KiB

  1. /****************************************************************************/
  2. /* */
  3. /* WFDOS.C - */
  4. /* */
  5. /* Ported code from wfdos.asm */
  6. /* */
  7. /****************************************************************************/
  8. #include "winfile.h"
  9. DWORD
  10. APIENTRY
  11. GetExtendedError()
  12. {
  13. return (GetLastError()); // temp fix, called by IsDiskReallyThere().
  14. }
  15. VOID
  16. APIENTRY
  17. DosGetDTAAddress()
  18. {
  19. }
  20. VOID
  21. APIENTRY
  22. DosResetDTAAddress()
  23. {
  24. }
  25. DWORD
  26. APIENTRY
  27. GetFreeDiskSpace(
  28. WORD wDrive
  29. )
  30. {
  31. DWORD dwSectorsPerCluster;
  32. DWORD dwBytesPerSector;
  33. DWORD dwFreeClusters;
  34. DWORD dwTotalClusters;
  35. if (GetDiskFreeSpace(GetRootPath(wDrive),
  36. &dwSectorsPerCluster,
  37. &dwBytesPerSector,
  38. &dwFreeClusters,
  39. &dwTotalClusters)) {
  40. return (dwFreeClusters * dwSectorsPerCluster * dwBytesPerSector);
  41. } else {
  42. return (0);
  43. }
  44. }
  45. DWORD
  46. APIENTRY
  47. GetTotalDiskSpace(
  48. WORD wDrive
  49. )
  50. {
  51. DWORD dwSectorsPerCluster;
  52. DWORD dwBytesPerSector;
  53. DWORD dwFreeClusters;
  54. DWORD dwTotalClusters;
  55. if (GetDiskFreeSpace(GetRootPath(wDrive),
  56. &dwSectorsPerCluster,
  57. &dwBytesPerSector,
  58. &dwFreeClusters,
  59. &dwTotalClusters)) {
  60. return (dwTotalClusters * dwSectorsPerCluster * dwBytesPerSector);
  61. } else {
  62. return (0);
  63. }
  64. }
  65. INT
  66. APIENTRY
  67. ChangeVolumeLabel(
  68. INT nDrive,
  69. LPSTR lpNewVolName
  70. )
  71. {
  72. UNREFERENCED_PARAMETER(nDrive);
  73. UNREFERENCED_PARAMETER(lpNewVolName);
  74. return (0);
  75. }
  76. INT
  77. APIENTRY
  78. GetVolumeLabel(
  79. INT nDrive,
  80. LPSTR lpszVol,
  81. BOOL bBrackets
  82. )
  83. {
  84. *lpszVol = 0;
  85. if (apVolInfo[nDrive] == NULL)
  86. FillVolumeInfo(nDrive);
  87. if (apVolInfo[nDrive]) {
  88. if ((BOOL)*apVolInfo[nDrive]->szVolumeName)
  89. lstrcpy(&lpszVol[bBrackets ? 1 : 0],
  90. apVolInfo[nDrive]->szVolumeName);
  91. else
  92. return (0);
  93. } else {
  94. return (0);
  95. }
  96. if (bBrackets) {
  97. lpszVol[0] = '[';
  98. lstrcat(lpszVol, "]");
  99. }
  100. return (1);
  101. }
  102. INT
  103. APIENTRY
  104. DeleteVolumeLabel(
  105. INT nDrive
  106. )
  107. {
  108. UNREFERENCED_PARAMETER(nDrive);
  109. return (0);
  110. }
  111. HFILE
  112. APIENTRY
  113. CreateVolumeFile(
  114. LPSTR lpFileName
  115. )
  116. {
  117. UNREFERENCED_PARAMETER(lpFileName);
  118. return (0);
  119. }
  120. VOID
  121. APIENTRY
  122. FillVolumeInfo(
  123. INT iVol
  124. )
  125. {
  126. VOLINFO vi;
  127. vi.dwDriveType = rgiDriveType[iVol];
  128. if (GetVolumeInformation(
  129. GetRootPath((WORD)iVol),
  130. &vi.szVolumeName[0], MAX_VOLNAME,
  131. &vi.dwVolumeSerialNumber,
  132. &vi.dwMaximumComponentLength,
  133. &vi.dwFileSystemFlags,
  134. &vi.szFileSysName[0], MAX_FILESYSNAME)) {;
  135. if (apVolInfo[iVol] == NULL)
  136. apVolInfo[iVol] = LocalAlloc(LPTR, sizeof(VOLINFO));
  137. if (apVolInfo[iVol])
  138. *apVolInfo[iVol] = vi;
  139. }
  140. }