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.

150 lines
7.0 KiB

  1. SAFEFORMAT
  2. =======================================================================
  3. The following new source files have been added to the format
  4. directory.
  5. SAFE.ASM - Additional program source code
  6. SAFE.INC - Extrn definitions to be included in other modules
  7. SAFEDEF.INC - Structure and equates used in SAFE.ASM
  8. NEWFMT.DOC - This information and specification file
  9. All changes to the existing format program have been incorporated
  10. within conditionals. The defined value SAFE will determine whether
  11. the new safe format is built. The build the safe format add the
  12. command line switch for the assembler "-DSAFE=1". To disable
  13. creation of the safe format and build the normal format program
  14. change the switch to -DSAFE=0.
  15. =======================================================================
  16. The design specification for the MS-DOS 4.x safe format and unformat
  17. utility is based on the these underlying assumptions.
  18. FORMAT assumptions:
  19. 1. The utility is version dependent and will alway fail to run
  20. under versions of DOS (as reported by DOS function 30h)
  21. other the version it was designed for.
  22. 2. The utility will only attempt to preserve and restore existing
  23. DOS 4.x compatible parititions.
  24. 3. The utililty will incorporate general safty features but will
  25. rely on the integrety of the underlying operating system for
  26. detecting error conditions while accessing the hard disk.
  27. 4. There will be no attempt to allow restoration of a partition
  28. which was recognized as being damaged before the format
  29. operation had begun.
  30. 5. If for any reason the restoration files cannot be created
  31. the user will notified and allowed to decide if the format
  32. should continue without the restoration ability. There is
  33. one exception to this assumption and that is the case where
  34. a partition is detected to be unformated as described later.
  35. 6. The default operation during format will be to create the
  36. restoration file. A command line switch will allow the user
  37. to disable the feature.
  38. 7. All disk access will be done via DOS file handles and interrupts
  39. 25h and 26h to allow DOS to detect and return any error
  40. conditions.
  41. 8. Only the first copy of the FAT will be saved. If any sectors
  42. in the first copy of the FAT cannot be successfully read
  43. using int 25h, an attempt will be made to read the corresponding
  44. sectors from the second copy of the FAT. Only if the
  45. corresponding sectors in both copies of the FAT cannot be read
  46. will it be assumed the the FAT is bad and a restoration file
  47. cannot be created.
  48. 9. The restoration file must contain all information neccessary
  49. to allow the restoration program to restore the original
  50. partition immediately after a format. If the original partition
  51. was a boot partition it must be restored so that it will boot
  52. the original operating system which was present before the
  53. format operation.
  54. 10. The system files will consist of the either of the following
  55. 2 groups of files plus COMMAND.COM.
  56. (IO.SYS and MSDOS.SYS) or (IBMBIO.SYS and IBMDOS.SYS)
  57. 11. It will be assumed that a partition has never been formatted
  58. if the boot record is not valid using the conditions that the
  59. last 2 bytes of a boot sector contain a boot signature and
  60. the first byte is near or short jump opcode. When a partition
  61. has never been formatted a restoration file will not be
  62. created. There will be no need to alert the user to this action
  63. and formating will proceed as it does with the existing DOS 4.x
  64. utility.
  65. 12. The restoration file will be created in the root directory
  66. before formating begins and this directory entry will be
  67. restored to the root directory as the 4th entry in the new
  68. root directory with an E5h placed in the first byte of the
  69. first 3 directory entries to allow room for operating system
  70. files. The restoration file will use the name "UNFORMAT.DAT"
  71. and will be created with HIDDEN, SYSTEM and READONLY
  72. attributes set.
  73. 13. Any previous restoration file will be deleted at the time
  74. a new restoration file is created.
  75. WARNING: This will mean that if a user reformats a hard
  76. disk immediately after a previous format, the original
  77. contents of the hard disk will be lost.
  78. 14. The restoration file will be designed so that it can allow
  79. restoration of the hard disk reguardless of the condition of
  80. boot sector, FAT or root directory after completion of the
  81. format operation. This feature is only for possible future
  82. enhancements and in this implementation there will be no
  83. attempt to restore a hard disk if the restoration file
  84. cannot be successfully read from the disk using the normal
  85. DOS file and sector read and write operations.
  86. 15. The FAT which is written to the restoration file will also
  87. contain the FAT allocation chain for the restoration file.
  88. 16. The DOS control C check will be disabled while the system areas
  89. of the disk are being written to help minimize the chance of
  90. losing the restoration file's directory entry and FAT chain.
  91. NOTE:
  92. The user will still be allowed to CTRL C out of the format at
  93. any time previous to this without damaging the integrity of
  94. the existing partition other than the deletion of any
  95. previously existing restoration file.
  96. 17. There will be 2 checksums in the restoration file header. One
  97. will be a checksum of the sector containing the file header
  98. and the other will be a checksum of the entire restoration
  99. file. The file header checksum will be used to confirm the
  100. file header is the valid starting sector of a restoration
  101. file and the file checksum will be used to insure the
  102. integrety of entire restoration file before a restoration
  103. is done.
  104. 18. The information contained in the restoration file is intended
  105. to only allow the restoration of a hard disk partition if the
  106. UNFORMAT utility is used before any new files are written to
  107. the partition after a format operation. If any new files are
  108. written the partition is formatted it will void the integrety
  109. of the original FAT and the partition will be corrupt.
  110. 19. The FORMAT utility must allow restoration of the original
  111. partition even in the event that the /S option is used to
  112. install a new operating system on the partition. This will
  113. be accomplished by assuring that the new OS does not
  114. overwrite any existing allocated areas other than the first
  115. 2 clusters of the disk which have been saved in the restoration
  116. file.
  117. 20. The fatal disk error handler will be changed so that IGNORE is
  118. not an option for handling of fatal disk errors. Only RETRY,
  119. FAIL and ABORT will be valid options.
  120.