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.

299 lines
6.0 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. spswitch.h
  5. Abstract:
  6. Macros & Functions to switch between old and
  7. new partitioning engine in textmode.
  8. NEW_PARTITION_ENGINE forces new partition engine
  9. code to be used for both MBR and GPT disks.
  10. GPT_PARTITION_ENGINE forces new partition engine
  11. code to be used for GPT disks and old partition
  12. engine code for MBR disks.
  13. OLD_PARTITION_ENGINE forces the old partition
  14. engine to used for MBR disks. This option cannot
  15. handle GPT disks.
  16. Note :
  17. If none of the NEW_PARTITION_ENGINE,
  18. OLD_PARTITION_ENGINE or GPT_PARTITION_ENGINE macro
  19. is defined, then by default NEW_PARTITION_ENGINE is
  20. used.
  21. Author:
  22. Vijay Jayaseelan (vijayj) 18 March 2000
  23. Revision History:
  24. --*/
  25. #include "spprecmp.h"
  26. #pragma hdrstop
  27. #ifdef NEW_PARTITION_ENGINE
  28. //
  29. // Switching stubs for NEW_PARTITION_ENGINE
  30. //
  31. NTSTATUS
  32. SpPtPrepareDisks(
  33. IN PVOID SifHandle,
  34. OUT PDISK_REGION *InstallRegion,
  35. OUT PDISK_REGION *SystemPartitionRegion,
  36. IN PWSTR SetupSourceDevicePath,
  37. IN PWSTR DirectoryOnSetupSource,
  38. IN BOOLEAN RemoteBootRepartition
  39. )
  40. {
  41. return SpPtnPrepareDisks(SifHandle,
  42. InstallRegion,
  43. SystemPartitionRegion,
  44. SetupSourceDevicePath,
  45. DirectoryOnSetupSource,
  46. RemoteBootRepartition);
  47. }
  48. NTSTATUS
  49. SpPtInitialize(
  50. VOID
  51. )
  52. {
  53. return SpPtnInitializeDiskDrives();
  54. }
  55. PDISK_REGION
  56. SpPtValidSystemPartition(
  57. VOID
  58. )
  59. {
  60. return SpPtnValidSystemPartition();
  61. }
  62. PDISK_REGION
  63. SpPtValidSystemPartitionArc(
  64. IN PVOID SifHandle,
  65. IN PWSTR SetupSourceDevicePath,
  66. IN PWSTR DirectoryOnSetupSource
  67. )
  68. {
  69. return SpPtnValidSystemPartitionArc(SifHandle,
  70. SetupSourceDevicePath,
  71. DirectoryOnSetupSource,
  72. TRUE);
  73. }
  74. BOOLEAN
  75. SpPtDoCreate(
  76. IN PDISK_REGION pRegion,
  77. OUT PDISK_REGION *pActualRegion, OPTIONAL
  78. IN BOOLEAN ForNT,
  79. IN ULONGLONG DesiredMB OPTIONAL,
  80. IN PPARTITION_INFORMATION_EX PartInfo OPTIONAL,
  81. IN BOOLEAN ConfirmIt
  82. )
  83. {
  84. return SpPtnDoCreate(pRegion,
  85. pActualRegion,
  86. ForNT,
  87. DesiredMB,
  88. PartInfo,
  89. ConfirmIt);
  90. }
  91. VOID
  92. SpPtDoDelete(
  93. IN PDISK_REGION pRegion,
  94. IN PWSTR RegionDescription,
  95. IN BOOLEAN ConfirmIt
  96. )
  97. {
  98. SpPtnDoDelete(pRegion,
  99. RegionDescription,
  100. ConfirmIt);
  101. }
  102. ULONG
  103. SpPtGetOrdinal(
  104. IN PDISK_REGION Region,
  105. IN PartitionOrdinalType OrdinalType
  106. )
  107. {
  108. return SpPtnGetOrdinal(Region, OrdinalType);
  109. }
  110. VOID
  111. SpPtGetSectorLayoutInformation(
  112. IN PDISK_REGION Region,
  113. OUT PULONGLONG HiddenSectors,
  114. OUT PULONGLONG VolumeSectorCount
  115. )
  116. {
  117. SpPtnGetSectorLayoutInformation(Region,
  118. HiddenSectors,
  119. VolumeSectorCount);
  120. }
  121. BOOLEAN
  122. SpPtCreate(
  123. IN ULONG DiskNumber,
  124. IN ULONGLONG StartSector,
  125. IN ULONGLONG SizeMB,
  126. IN BOOLEAN InExtended,
  127. IN PPARTITION_INFORMATION_EX PartInfo,
  128. OUT PDISK_REGION *ActualDiskRegion OPTIONAL
  129. )
  130. {
  131. return SpPtnCreate(DiskNumber,
  132. StartSector,
  133. 0, // SizeInSectors: Used only in ASR
  134. SizeMB,
  135. InExtended,
  136. TRUE, // AlignToCylinder
  137. PartInfo,
  138. ActualDiskRegion);
  139. }
  140. BOOLEAN
  141. SpPtDelete(
  142. IN ULONG DiskNumber,
  143. IN ULONGLONG StartSector
  144. )
  145. {
  146. return SpPtnDelete(DiskNumber, StartSector);
  147. }
  148. BOOL
  149. SpPtIsSystemPartitionRecognizable(
  150. VOID
  151. )
  152. {
  153. return SpPtnIsSystemPartitionRecognizable();
  154. }
  155. VOID
  156. SpPtMakeRegionActive(
  157. IN PDISK_REGION Region
  158. )
  159. {
  160. SpPtnMakeRegionActive(Region);
  161. }
  162. NTSTATUS
  163. SpPtCommitChanges(
  164. IN ULONG DiskNumber,
  165. OUT PBOOLEAN AnyChanges
  166. )
  167. {
  168. return SpPtnCommitChanges(DiskNumber, AnyChanges);
  169. }
  170. VOID
  171. SpPtDeletePartitionsForRemoteBoot(
  172. PPARTITIONED_DISK PartDisk,
  173. PDISK_REGION StartRegion,
  174. PDISK_REGION EndRegion,
  175. BOOLEAN Extended
  176. )
  177. {
  178. SpPtnDeletePartitionsForRemoteBoot(PartDisk,
  179. StartRegion,
  180. EndRegion,
  181. Extended);
  182. }
  183. VOID
  184. SpPtLocateSystemPartitions(
  185. VOID
  186. )
  187. {
  188. SpPtnLocateSystemPartitions();
  189. }
  190. #else
  191. #ifdef GPT_PARTITION_ENGINE
  192. //
  193. // Switching stubs for GPT_PARTITION_ENGINE
  194. //
  195. NTSTATUS
  196. SpPtPrepareDisks(
  197. IN PVOID SifHandle,
  198. OUT PDISK_REGION *InstallRegion,
  199. OUT PDISK_REGION *SystemPartitionRegion,
  200. IN PWSTR SetupSourceDevicePath,
  201. IN PWSTR DirectoryOnSetupSource,
  202. IN BOOLEAN RemoteBootRepartition
  203. )
  204. {
  205. return SpPtnPrepareDisks(SifHandle,
  206. InstallRegion,
  207. SystemPartitionRegion,
  208. SetupSourceDevicePath,
  209. DirectoryOnSetupSource,
  210. RemoteBootRepartition);
  211. }
  212. VOID
  213. SpPtMakeRegionActive(
  214. IN PDISK_REGION Region
  215. )
  216. {
  217. SpPtnMakeRegionActive(Region);
  218. }
  219. PDISK_REGION
  220. SpPtValidSystemPartitionArc(
  221. IN PVOID SifHandle,
  222. IN PWSTR SetupSourceDevicePath,
  223. IN PWSTR DirectoryOnSetupSource
  224. )
  225. {
  226. return SpPtnValidSystemPartitionArc(SifHandle,
  227. SetupSourceDevicePath,
  228. DirectoryOnSetupSource,
  229. TRUE);
  230. }
  231. BOOL
  232. SpPtIsSystemPartitionRecognizable(
  233. VOID
  234. )
  235. {
  236. return SpPtnIsSystemPartitionRecognizable();
  237. }
  238. VOID
  239. SpPtLocateSystemPartitions(
  240. VOID
  241. )
  242. {
  243. SpPtnLocateSystemPartitions();
  244. }
  245. #endif
  246. #endif // NEW_PARTITION_ENGINE