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.

333 lines
5.5 KiB

  1. #include <mytypes.h>
  2. #include <misclib.h>
  3. #include <diskio.h>
  4. #include <partimag.h>
  5. #include <msgfile.h>
  6. #include <displib.h>
  7. #include <partio.h>
  8. #include <string.h>
  9. #include <malloc.h>
  10. #include <memory.h>
  11. #include <ctype.h>
  12. #include <errno.h>
  13. #include <dos.h>
  14. #include <share.h>
  15. #include <fcntl.h>
  16. #include <stdlib.h>
  17. #include <stdio.h>
  18. #include <stdarg.h>
  19. //
  20. // Global data
  21. //
  22. extern FPVOID IoBuffer,_IoBuffer;
  23. extern MASTER_DISK MasterDiskInfo;
  24. extern CMD_LINE_ARGS CmdLineArgs;
  25. extern PARTITION_IMAGE PartitionImage;
  26. //
  27. // Text
  28. //
  29. extern MESSAGE_STRING TextMessages[];
  30. unsigned
  31. GetTextCount(
  32. VOID
  33. );
  34. extern char *textCantLoadFont;
  35. extern char *textNoXmsManager;
  36. extern char *textXmsMemoryError;
  37. extern char *textFatalError1;
  38. extern char *textFatalError2;
  39. extern char *textReadFailedAtSector;
  40. extern char *textWriteFailedAtSector;
  41. extern char *textCantFindMasterDisk;
  42. extern char *textOOM;
  43. extern char *textCantOpenMasterDisk;
  44. extern char *textCantFindMPKBoot;
  45. extern char *textNoOsImages;
  46. extern char *textSelectLanguage;
  47. extern char *textConfirmLanguage1;
  48. extern char *textConfirmLanguage2;
  49. extern char *textRebootPrompt1;
  50. extern char *textRebootPrompt2;
  51. extern char *textSelectOsPrompt;
  52. extern char *textConfirmOs1;
  53. extern char *textConfirmOs2;
  54. extern char *textPleaseWaitRestoring;
  55. extern char *textValidatingImage;
  56. extern char *textChecksumFail;
  57. extern char *textChecksumOk;
  58. //
  59. // [10000]-[10009] are reserved for language names
  60. // [11000]-[11009] are reserved for OS selection names,
  61. // which override the names specified in the images'
  62. // partition image header structures.
  63. //
  64. #define TEXT_LANGUAGE_NAME_BASE 10000
  65. extern char *textLangName0;
  66. extern char *textLangName1;
  67. extern char *textLangName2;
  68. extern char *textLangName3;
  69. extern char *textLangName4;
  70. extern char *textLangName5;
  71. extern char *textLangName6;
  72. extern char *textLangName7;
  73. extern char *textLangName8;
  74. extern char *textLangName9;
  75. #define TEXT_LANGUAGE_NAME_END 10009
  76. #define TEXT_OS_NAME_BASE 11000
  77. extern char *textOsName0;
  78. extern char *textOsName1;
  79. extern char *textOsName2;
  80. extern char *textOsName3;
  81. extern char *textOsName4;
  82. extern char *textOsName5;
  83. extern char *textOsName6;
  84. extern char *textOsName7;
  85. extern char *textOsName8;
  86. extern char *textOsName9;
  87. #define TEXT_OS_NAME_END 11009
  88. #define TEXT_OS_DESC_BASE 12000
  89. extern char *textOsDesc0;
  90. extern char *textOsDesc1;
  91. extern char *textOsDesc2;
  92. extern char *textOsDesc3;
  93. extern char *textOsDesc4;
  94. extern char *textOsDesc5;
  95. extern char *textOsDesc6;
  96. extern char *textOsDesc7;
  97. extern char *textOsDesc8;
  98. extern char *textOsDesc9;
  99. #define TEXT_OS_DESC_END 12009
  100. //
  101. // Text positioning stuff
  102. //
  103. #define TEXT_LEFT_MARGIN 3
  104. #define TEXT_TOP_LINE 0
  105. //
  106. // Constant that gives the number of clusters described in
  107. // one sector of the cluster bitmap (sector size * bits per byte)
  108. //
  109. #define CLUSTER_BITS_PER_SECTOR 4096
  110. //
  111. // Top-level routine for restoring the user's disk.
  112. //
  113. VOID
  114. RestoreUsersDisk(
  115. IN HDISK DiskHandle
  116. );
  117. VOID
  118. ExpandImage(
  119. IN HDISK DiskHandle,
  120. IN BYTE SectorsPerTrack,
  121. IN ULONG SourceStart,
  122. IN ULONG TargetStart
  123. );
  124. //
  125. // Misc routines
  126. //
  127. VOID
  128. UpdateMasterDiskState(
  129. IN HDISK DiskHandle,
  130. IN UINT NewState
  131. );
  132. UINT
  133. LocateMasterDisk(
  134. IN UINT UserSpecifiedInt13Unit OPTIONAL
  135. );
  136. VOID
  137. GetUserOsChoice(
  138. IN HDISK DiskHandle
  139. );
  140. VOID
  141. FatalError(
  142. IN FPCHAR FormatString,
  143. ...
  144. );
  145. //
  146. // Keyboard reading stuff
  147. //
  148. USHORT
  149. GetKey(
  150. VOID
  151. );
  152. #define DN_KEY_DOWN 0x0100
  153. #define DN_KEY_UP 0x0200
  154. #define DN_KEY_F8 0x1800
  155. #define ASCI_CR 13
  156. #define ASCI_ESC 27
  157. VOID
  158. DrainKeyboard(
  159. VOID
  160. );
  161. //
  162. // Display routines
  163. //
  164. #define DEFAULT_TEXT_PIXEL_VALUE VGAPIX_LIGHT_GRAY
  165. #define HIGHLIGHT_TEXT_PIXEL_VALUE VGAPIX_WHITE
  166. VOID
  167. DispInitialize(
  168. VOID
  169. );
  170. VOID
  171. DispReinitialize(
  172. VOID
  173. );
  174. VOID
  175. DispClearClientArea(
  176. IN FPCHAR NewBannerBitmap OPTIONAL
  177. );
  178. VOID
  179. DispSetCurrentPixelValue(
  180. IN BYTE PixelValue
  181. );
  182. VOID
  183. DispPositionCursor(
  184. IN BYTE X,
  185. IN BYTE Y
  186. );
  187. VOID
  188. DispGetCursorPosition(
  189. OUT FPBYTE X,
  190. OUT FPBYTE Y
  191. );
  192. FPVOID
  193. DispSaveDescriptionArea(
  194. OUT USHORT *SaveTop,
  195. OUT USHORT *SaveHeight,
  196. OUT USHORT *SaveBytesPerRow,
  197. OUT USHORT *DescriptionTop
  198. );
  199. VOID
  200. DispWriteChar(
  201. IN CHAR chr
  202. );
  203. VOID
  204. DispWriteString(
  205. IN FPCHAR String
  206. );
  207. VOID
  208. DispSetLeftMargin(
  209. IN BYTE X
  210. );
  211. //
  212. // Gas gauge routines
  213. //
  214. VOID
  215. GaugeInit(
  216. IN ULONG RangeMax
  217. );
  218. VOID
  219. GaugeDelta(
  220. IN ULONG Delta
  221. );
  222. //
  223. // XMS i/o routines
  224. //
  225. VOID
  226. XmsInit(
  227. VOID
  228. );
  229. VOID
  230. XmsTerminate(
  231. VOID
  232. );
  233. VOID
  234. XmsIoDiskRead(
  235. IN HDISK DiskHandle,
  236. IN ULONG StartSector,
  237. IN ULONG SectorCount,
  238. OUT ULONG *SectorsRead,
  239. OUT BOOL *Xms
  240. );
  241. VOID
  242. XmsIoDiskWrite(
  243. IN HDISK DiskHandle,
  244. IN ULONG StartSector,
  245. IN ULONG SectorOffset,
  246. IN ULONG SectorCount,
  247. IN BOOL Xms
  248. );
  249. #if 0
  250. //
  251. // Inf routines
  252. //
  253. int
  254. LoadInf(
  255. IN FPCHAR Filename,
  256. OUT FPVOID *Handle,
  257. OUT FPUINT ErrorLineNumber
  258. );
  259. VOID
  260. UnloadInf(
  261. IN FPVOID Handle
  262. );
  263. BOOL
  264. InfSectionExists(
  265. IN FPVOID Handle,
  266. IN FPCHAR SectionName
  267. );
  268. FPCHAR
  269. InfGetSectionLineIndex(
  270. IN FPVOID Handle,
  271. IN FPCHAR SectionName,
  272. IN unsigned LineIndex,
  273. IN unsigned ValueIndex
  274. );
  275. FPCHAR
  276. InfGetSectionKeyIndex(
  277. IN FPVOID Handle,
  278. IN FPCHAR SectionName,
  279. IN FPCHAR Key,
  280. IN unsigned ValueIndex
  281. );
  282. FPCHAR
  283. InfGetSectionLineKey(
  284. IN FPVOID Handle,
  285. IN FPCHAR SectionName,
  286. IN unsigned LineIndex
  287. );
  288. #endif