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.

214 lines
4.4 KiB

  1. #if !defined(NO_LEGACY_DRIVERS)
  2. /*++
  3. Copyright (c) 1989 Microsoft Corporation
  4. Module Name:
  5. drivesup.c
  6. Abstract:
  7. This module contains the subroutines for drive support. This includes
  8. such things as how drive letters are assigned on a particular platform,
  9. how device partitioning works, etc.
  10. Author:
  11. Darryl E. Havens (darrylh) 23-Apr-1992
  12. Environment:
  13. Kernel mode
  14. Revision History:
  15. --*/
  16. #include "halp.h"
  17. #include "bugcodes.h"
  18. #include "ntddft.h"
  19. #include "ntdddisk.h"
  20. #include "ntdskreg.h"
  21. #include "stdio.h"
  22. #include "string.h"
  23. VOID
  24. HalpAssignDriveLetters(
  25. PLOADER_PARAMETER_BLOCK LoaderBlock,
  26. PSTRING NtDeviceName,
  27. OUT PUCHAR NtSystemPath,
  28. OUT PSTRING NtSystemPathString
  29. );
  30. NTSTATUS
  31. HalpReadPartitionTable(
  32. IN PDEVICE_OBJECT DeviceObject,
  33. IN ULONG SectorSize,
  34. IN BOOLEAN ReturnRecognizedPartitions,
  35. OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer
  36. );
  37. NTSTATUS
  38. HalpSetPartitionInformation(
  39. IN PDEVICE_OBJECT DeviceObject,
  40. IN ULONG SectorSize,
  41. IN ULONG PartitionNumber,
  42. IN ULONG PartitionType
  43. );
  44. NTSTATUS
  45. HalpWritePartitionTable(
  46. IN PDEVICE_OBJECT DeviceObject,
  47. IN ULONG SectorSize,
  48. IN ULONG SectorsPerTrack,
  49. IN ULONG NumberOfHeads,
  50. IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer
  51. );
  52. NTKERNELAPI
  53. VOID
  54. FASTCALL
  55. IoAssignDriveLetters(
  56. PLOADER_PARAMETER_BLOCK LoaderBlock,
  57. PSTRING NtDeviceName,
  58. OUT PUCHAR NtSystemPath,
  59. OUT PSTRING NtSystemPathString
  60. );
  61. NTKERNELAPI
  62. NTSTATUS
  63. FASTCALL
  64. IoReadPartitionTable(
  65. IN PDEVICE_OBJECT DeviceObject,
  66. IN ULONG SectorSize,
  67. IN BOOLEAN ReturnRecognizedPartitions,
  68. OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer
  69. );
  70. NTKERNELAPI
  71. NTSTATUS
  72. FASTCALL
  73. IoSetPartitionInformation(
  74. IN PDEVICE_OBJECT DeviceObject,
  75. IN ULONG SectorSize,
  76. IN ULONG PartitionNumber,
  77. IN ULONG PartitionType
  78. );
  79. NTKERNELAPI
  80. NTSTATUS
  81. FASTCALL
  82. IoWritePartitionTable(
  83. IN PDEVICE_OBJECT DeviceObject,
  84. IN ULONG SectorSize,
  85. IN ULONG SectorsPerTrack,
  86. IN ULONG NumberOfHeads,
  87. IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer
  88. );
  89. #ifdef ALLOC_PRAGMA
  90. #pragma alloc_text(PAGE, HalpAssignDriveLetters)
  91. #pragma alloc_text(PAGE, HalpReadPartitionTable)
  92. #pragma alloc_text(PAGE, HalpSetPartitionInformation)
  93. #pragma alloc_text(PAGE, HalpWritePartitionTable)
  94. #endif
  95. VOID
  96. HalpAssignDriveLetters(
  97. PLOADER_PARAMETER_BLOCK LoaderBlock,
  98. PSTRING NtDeviceName,
  99. OUT PUCHAR NtSystemPath,
  100. OUT PSTRING NtSystemPathString
  101. )
  102. {
  103. //
  104. // Stub to call extensible routine in ke so that hal vendors
  105. // don't have to support.
  106. //
  107. IoAssignDriveLetters(
  108. LoaderBlock,
  109. NtDeviceName,
  110. NtSystemPath,
  111. NtSystemPathString
  112. );
  113. }
  114. NTSTATUS
  115. HalpReadPartitionTable(
  116. IN PDEVICE_OBJECT DeviceObject,
  117. IN ULONG SectorSize,
  118. IN BOOLEAN ReturnRecognizedPartitions,
  119. OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer
  120. )
  121. {
  122. //
  123. // Stub to call extensible routine in ke so that hal vendors
  124. // don't have to support.
  125. //
  126. return IoReadPartitionTable(
  127. DeviceObject,
  128. SectorSize,
  129. ReturnRecognizedPartitions,
  130. PartitionBuffer
  131. );
  132. }
  133. NTSTATUS
  134. HalpSetPartitionInformation(
  135. IN PDEVICE_OBJECT DeviceObject,
  136. IN ULONG SectorSize,
  137. IN ULONG PartitionNumber,
  138. IN ULONG PartitionType
  139. )
  140. {
  141. //
  142. // Stub to call extensible routine in ke so that hal vendors
  143. // don't have to support.
  144. //
  145. return IoSetPartitionInformation(
  146. DeviceObject,
  147. SectorSize,
  148. PartitionNumber,
  149. PartitionType
  150. );
  151. }
  152. NTSTATUS
  153. HalpWritePartitionTable(
  154. IN PDEVICE_OBJECT DeviceObject,
  155. IN ULONG SectorSize,
  156. IN ULONG SectorsPerTrack,
  157. IN ULONG NumberOfHeads,
  158. IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer
  159. )
  160. {
  161. //
  162. // Stub to call extensible routine in ke so that hal vendors
  163. // don't have to support.
  164. //
  165. return IoWritePartitionTable(
  166. DeviceObject,
  167. SectorSize,
  168. SectorsPerTrack,
  169. NumberOfHeads,
  170. PartitionBuffer
  171. );
  172. }
  173. #endif // NO_LEGACY_DRIVERS