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.

156 lines
5.1 KiB

  1. /*
  2. * $Log: V:/Flite/archives/TrueFFS5/Src/DOSFORMT.H_V $
  3. *
  4. * Rev 1.2 Feb 19 2002 20:59:22 oris
  5. * Moved fltl.h include directive to the head of the file.
  6. *
  7. * Rev 1.1 Apr 01 2001 07:45:06 oris
  8. * Updated copywrite notice
  9. *
  10. * Rev 1.0 Feb 02 2001 13:51:48 oris
  11. * Initial revision.
  12. */
  13. /***********************************************************************************/
  14. /* M-Systems Confidential */
  15. /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */
  16. /* All Rights Reserved */
  17. /***********************************************************************************/
  18. /* NOTICE OF M-SYSTEMS OEM */
  19. /* SOFTWARE LICENSE AGREEMENT */
  20. /* */
  21. /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */
  22. /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */
  23. /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */
  24. /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */
  25. /* E-MAIL = [email protected] */
  26. /***********************************************************************************/
  27. #ifndef DOSFORMT_H
  28. #define DOSFORMT_H
  29. #include "flformat.h"
  30. #include "fltl.h"
  31. /* The BIOS parameter block (a part of the boot sector) */
  32. /* Note that this is NOT the customary definition of the BPB */
  33. /* (customary is to start it on 'bytesPerSector'). To avoid the */
  34. /* nuisance of a structure that starts at an odd offset, we add */
  35. /* the first 11 bytes of the boot sector here. */
  36. typedef struct {
  37. unsigned char jumpInstruction[3];
  38. char OEMname[8];
  39. Unaligned bytesPerSector;
  40. unsigned char sectorsPerCluster;
  41. LEushort reservedSectors;
  42. unsigned char noOfFATS;
  43. Unaligned rootDirectoryEntries;
  44. Unaligned totalSectorsInVolumeDOS3;
  45. unsigned char mediaDescriptor;
  46. LEushort sectorsPerFAT;
  47. LEushort sectorsPerTrack;
  48. LEushort noOfHeads;
  49. LEulong noOfHiddenSectors;
  50. LEulong totalSectorsInVolume;
  51. } BPB;
  52. typedef struct {
  53. BPB bpb;
  54. unsigned char physicalDriveNo;
  55. char reserved0;
  56. char extendedBootSignature;
  57. char volumeId[4];
  58. char volumeLabel[11];
  59. char systemId[8];
  60. char bootstrap[448];
  61. LEushort signature;
  62. } DOSBootSector;
  63. typedef struct {
  64. char name[11];
  65. unsigned char attributes; /* mapped below */
  66. unsigned char reserved[10];
  67. LEushort updateTime;
  68. /* The date field is encoded as follows: */
  69. /* bit 0-4: Day of month (1-31) */
  70. /* bit 5-8: Month (1-12) */
  71. /* bit 9-15: Year relative to 1980 */
  72. LEushort updateDate;
  73. /* The DOS time field is encoded as follows: */
  74. /* bit 0-4: seconds divided by 2 (0-29) */
  75. /* bit 5-10: minutes (0-59) */
  76. /* bit 11-15: hours (0-23) */
  77. LEushort startingCluster;
  78. LEulong fileSize;
  79. } DirectoryEntry;
  80. /* Directory entry attribute bits */
  81. #define ATTR_READ_ONLY 1
  82. #define ATTR_HIDDEN 2
  83. #define ATTR_SYSTEM 4
  84. #define ATTR_VOL_LABEL 8
  85. #define ATTR_DIRECTORY 0x10
  86. #define ATTR_ARCHIVE 0x20
  87. #define DIRECTORY_ENTRY_SIZE sizeof(DirectoryEntry)
  88. #define DIRECTORY_ENTRIES_PER_SECTOR (SECTOR_SIZE / DIRECTORY_ENTRY_SIZE)
  89. #define NEVER_USED_DIR_ENTRY 0
  90. #define DELETED_DIR_ENTRY ((char) 0xe5)
  91. /* FAT definitions */
  92. #define FAT_FREE 0
  93. #define FAT_BAD_CLUSTER 0xfff7
  94. #define FAT_LAST_CLUSTER 0xffff /* actually any of 0xfff8-0xffff */
  95. /* Partition table definitions */
  96. #define PARTITION_SIGNATURE 0xaa55
  97. #define CYLINDER_SECTOR(cylinder,sector) ((sector) + ((cylinder & 0xff) << 8) + ((cylinder & 0x300) >> 2))
  98. #define FAT12_PARTIT 0x01
  99. #define FAT16_PARTIT 0x04
  100. #define EX_PARTIT 0x05
  101. #define DOS4_PARTIT 0x06
  102. #define MAX_PARTITION_DEPTH 8
  103. typedef struct {
  104. /* First partition entry starts here. We do not map it as a */
  105. /* separate structure because it is not longword aligned */
  106. unsigned char activeFlag; /* 80h = bootable */
  107. unsigned char startingHead;
  108. LEushort startingCylinderSector;
  109. char type;
  110. unsigned char endingHead;
  111. LEushort endingCylinderSector;
  112. Unaligned4 startingSectorOfPartition;
  113. Unaligned4 sectorsInPartition;
  114. /* Partition entries 2,3 and 4 are structured as the 1st partition */
  115. } Partition;
  116. typedef struct {
  117. char reserved1[0x1A6];
  118. Unaligned4 passwordInfo[3]; /* M-Systems proprietary */
  119. char reserved2[0xC]; /* NT4 or NT5 signature place */
  120. /* First partition entry starts here. We do not map it as a */
  121. /* separate structure because it is not longword aligned */
  122. Partition ptEntry[4];
  123. LEushort signature; /* = PARTITION_SIGNATURE */
  124. } PartitionTable;
  125. #ifdef FORMAT_VOLUME
  126. extern FLStatus flDosFormat(TL *, BDTLPartitionFormatParams FAR1 *formatParams);
  127. #endif /* FORMAT_VOLUME */
  128. #endif /* DOSFORMT_H */