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.

281 lines
8.4 KiB

  1. #define FF_CAPMASK 0x00FF
  2. #define FF_SAVED 0x0100
  3. #define FF_MAKESYS 0x0200
  4. #define FF_QUICK 0x0400
  5. #define FF_HIGHCAP 0x0800
  6. #define FF_ONLYONE 0x1000
  7. #define MS_720 0
  8. #define MS_144 4
  9. #define MS_288 6
  10. #define SS48 2 // indexs into bpbList[] and cCluster[]
  11. #define DS48 3
  12. #define DS96 4
  13. #define DS720KB 5
  14. #define DS144M 6
  15. #define DS288M 7
  16. #define FAT_READ 1
  17. #define FAT_WRITE 2
  18. #define BOOTSECSIZE 512
  19. /* FormatTrackHead() Error Codes */
  20. #define DATAERROR 0x1000
  21. #define ADDMARKNOTFOUND 0x0200
  22. #define SECTORNOTFOUND 0x0400
  23. #define IOCTL_FORMAT 0x42
  24. #define IOCTL_SETFLAG 0x47
  25. #define IOCTL_MEDIASSENSE 0x68
  26. #define IOCTL_GET_DPB 0x60
  27. #define IOCTL_SET_DPB 0x40
  28. #define IOCTL_READ 0x61
  29. #define IOCTL_WRITE 0x41
  30. /* Media descriptor values for different floppy drives */
  31. // NOTE: these are not all unique!
  32. #define MEDIA_160 0xFE /* 160KB */
  33. #define MEDIA_320 0xFF /* 320KB */
  34. #define MEDIA_180 0xFC /* 180KB */
  35. #define MEDIA_360 0xFD /* 360KB */
  36. #define MEDIA_1200 0xF9 /* 1.2MB */
  37. #define MEDIA_720 0xF9 /* 720KB */
  38. #define MEDIA_1440 0xF0 /* 1.44M */
  39. #define MEDIA_2880 0xF0 /* 2.88M */
  40. #define DOS_320 0x314 /* DOS version # 3.20 */
  41. #define DRIVEID(path) ((path[0] - 'A')&31)
  42. /* IOCTL_Functions() error codes */
  43. #define NOERROR 0
  44. #define SECNOTFOUND 0x1B
  45. #define CRCERROR 0x17
  46. #define GENERALERROR 0x1F
  47. /*--------------------------------------------------------------------------*/
  48. /* BIOS Parameter Block Structure - */
  49. /*--------------------------------------------------------------------------*/
  50. typedef struct tagBPB
  51. {
  52. WORD cbSec; /* Bytes per sector */
  53. BYTE secPerClus; /* Sectors per cluster */
  54. WORD cSecRes; /* Reserved sectors */
  55. BYTE cFAT; /* FATS */
  56. WORD cDir; /* Root Directory Entries */
  57. WORD cSec; /* Total number of sectors in image */
  58. BYTE bMedia; /* Media descriptor */
  59. WORD secPerFAT; /* Sectors per FAT */
  60. WORD secPerTrack; /* Sectors per track */
  61. WORD cHead; /* Heads */
  62. WORD cSecHidden; /* Hidden sectors */
  63. } BPB;
  64. typedef BPB *PBPB;
  65. typedef BPB FAR *LPBPB;
  66. /*--------------------------------------------------------------------------*/
  67. /* Drive Parameter Block Structure - */
  68. /*--------------------------------------------------------------------------*/
  69. typedef struct tagDPB
  70. {
  71. BYTE drive;
  72. BYTE unit;
  73. WORD sector_size;
  74. BYTE cluster_mask;
  75. BYTE cluster_shift;
  76. WORD first_FAT;
  77. BYTE FAT_count;
  78. WORD root_entries;
  79. WORD first_sector;
  80. WORD max_cluster;
  81. BYTE FAT_size;
  82. WORD dir_sector;
  83. LONG reserved1;
  84. BYTE media;
  85. BYTE first_access;
  86. BYTE reserved2[4];
  87. WORD next_free;
  88. WORD free_cnt;
  89. BYTE DOS4_Extra; /* FAT_size field is a WORD in DOS 4.X.
  90. * To compensate for it, we have one extra byte
  91. */
  92. } DPB;
  93. typedef DPB *PDPB;
  94. typedef DPB FAR *LPDPB;
  95. #define MAX_SEC_PER_TRACK 40
  96. /*--------------------------------------------------------------------------*/
  97. /* Device Parameter Block Structure - */
  98. /*--------------------------------------------------------------------------*/
  99. typedef struct tagDevPB
  100. {
  101. CHAR SplFunctions;
  102. CHAR devType;
  103. CHAR reserved1[2];
  104. INT NumCyls;
  105. CHAR bMediaType; /* 0=>1.2MB and 1=>360KB */
  106. BPB BPB;
  107. CHAR reserved3[MAX_SEC_PER_TRACK * 4 + 2];
  108. } DevPB, NEAR *PDevPB, FAR *LPDevPB;
  109. #define TRACKLAYOUT_OFFSET (7+31) /* Offset of tracklayout
  110. * in a Device Parameter Block */
  111. /*--------------------------------------------------------------------------*/
  112. /* Disk Base Table Structure - */
  113. /*--------------------------------------------------------------------------*/
  114. typedef struct tagDBT
  115. {
  116. CHAR SRHU;
  117. CHAR HLDMA;
  118. CHAR wait;
  119. CHAR bytespersec;
  120. CHAR lastsector;
  121. CHAR gaplengthrw;
  122. CHAR datalength;
  123. CHAR gaplengthf;
  124. CHAR datavalue;
  125. CHAR HeadSettle;
  126. CHAR MotorStart;
  127. } DBT;
  128. typedef DBT *PDBT;
  129. typedef DBT FAR *LPDBT;
  130. /*--------------------------------------------------------------------------*/
  131. /* Directory Entry Structure - */
  132. /*--------------------------------------------------------------------------*/
  133. typedef struct tagDIRTYPE
  134. {
  135. CHAR name[11];
  136. BYTE attr;
  137. CHAR pad[10];
  138. WORD time;
  139. WORD date;
  140. WORD first;
  141. LONG size;
  142. } DIRTYPE;
  143. typedef DIRTYPE FAR *LPDIRTYPE;
  144. /*--------------------------------------------------------------------------*/
  145. /* MS-DOS Boot Sector Structure - */
  146. /*--------------------------------------------------------------------------*/
  147. typedef struct tagBOOTSEC
  148. {
  149. BYTE jump[3]; /* 3 byte jump */
  150. CHAR label[8]; /* OEM name and version */
  151. BPB BPB; /* BPB */
  152. BYTE bootdrive; /* INT 13h indicator for boot device */
  153. BYTE dontcare[BOOTSECSIZE-12-3-sizeof(BPB)];
  154. BYTE phydrv;
  155. WORD signature;
  156. } BOOTSEC;
  157. /*--------------------------------------------------------------------------*/
  158. /* Disk Information Structure - */
  159. /*--------------------------------------------------------------------------*/
  160. typedef struct tagDISKINFO
  161. {
  162. WORD wDrive;
  163. WORD wCylinderSize;
  164. WORD wLastCylinder;
  165. WORD wHeads;
  166. WORD wSectorsPerTrack;
  167. WORD wSectorSize;
  168. } DISKINFO;
  169. typedef DISKINFO *PDISKINFO;
  170. typedef DISKINFO FAR *LPDISKINFO;
  171. /*--------------------------------------------------------------------------*/
  172. /* DOS Disk Transfer Area Structure - */
  173. /*--------------------------------------------------------------------------*/
  174. typedef struct tagDOSDTA
  175. {
  176. BYTE Reserved[21]; /* 21 */
  177. BYTE Attrib; /* 22 */
  178. WORD Time; /* 24 */
  179. WORD Date; /* 26 */
  180. DWORD Length; /* 30 */
  181. CHAR szName[MAXDOSFILENAMELEN]; /* 43 */
  182. CHAR dummy[1]; /* 44 */
  183. // we do WORD move of 22 words so pad this out by 1 byte
  184. } DOSDTA;
  185. typedef DOSDTA *PDOSDTA;
  186. typedef DOSDTA FAR *LPDOSDTA;
  187. // this is the structure used to store file information in the
  188. // directory window. these are variable length blocks. the
  189. // first entry is a dummy that holds the number of entries in
  190. // the whole block in the Length field. use the wSize field
  191. // to give you a pointer to the next block
  192. typedef struct tagMYDTA
  193. {
  194. WORD wSize; // size of this structure (cFileName is variable)
  195. SHORT iBitmap;
  196. INT nIndex;
  197. DWORD my_dwAttrs; // must match WIN32_FIND_DATA from here down!
  198. FILETIME my_ftCreationTime;
  199. FILETIME my_ftLastAccessTime;
  200. FILETIME my_ftLastWriteTime;
  201. DWORD my_nFileSizeHigh;
  202. DWORD my_nFileSizeLow;
  203. CHAR my_cFileName[];
  204. } MYDTA;
  205. typedef MYDTA *PMYDTA;
  206. typedef MYDTA FAR *LPMYDTA;
  207. #define IMPORTANT_DTA_SIZE \
  208. (sizeof(MYDTA) - \
  209. sizeof(INT) - \
  210. sizeof(WORD) - \
  211. sizeof(SHORT))
  212. #define GETDTAPTR(lpStart, offset) ((LPMYDTA)((LPSTR)lpStart + offset))
  213. // stuff used by the search window
  214. typedef struct tagDTASEARCH {
  215. DWORD sch_dwAttrs; // must match WIN32_FIND_DATA
  216. FILETIME sch_ftCreationTime;
  217. FILETIME sch_ftLastAccessTime;
  218. FILETIME sch_ftLastWriteTime;
  219. DWORD sch_nFileSizeHigh;
  220. DWORD sch_nFileSizeLow;
  221. } DTASEARCH, FAR *LPDTASEARCH;
  222. /*--------------------------------------------------------------------------*/
  223. /* DOS Extended File Control Block Structure - */
  224. /*--------------------------------------------------------------------------*/
  225. typedef struct tagEFCB
  226. {
  227. BYTE Flag;
  228. BYTE Reserve1[5];
  229. BYTE Attrib;
  230. BYTE Drive;
  231. BYTE Filename[11];
  232. BYTE Reserve2[5];
  233. BYTE NewName[11];
  234. BYTE Reserve3[9];
  235. } EFCB;