Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

fat_rec.h

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1992 Microsoft Corporation 00004 00005 Module Name: 00006 00007 fat_rec.h 00008 00009 Abstract: 00010 00011 This module contains the mini-file system recognizer for FAT. 00012 00013 Author: 00014 00015 Darryl E. Havens (darrylh) 8-dec-1992 00016 00017 Environment: 00018 00019 Kernel mode, local to I/O system 00020 00021 Revision History: 00022 00023 00024 --*/ 00025 00026 // 00027 // The following types and macros are used to help unpack the packed and 00028 // misaligned fields found in the Bios parameter block 00029 // 00030 00031 typedef union _UCHAR1 { 00032 UCHAR Uchar[1]; 00033 UCHAR ForceAlignment; 00034 } UCHAR1, *PUCHAR1; 00035 00036 typedef union _UCHAR2 { 00037 UCHAR Uchar[2]; 00038 USHORT ForceAlignment; 00039 } UCHAR2, *PUCHAR2; 00040 00041 typedef union _UCHAR4 { 00042 UCHAR Uchar[4]; 00043 ULONG ForceAlignment; 00044 } UCHAR4, *PUCHAR4; 00045 00046 // 00047 // This macro copies an unaligned src byte to an aligned dst byte 00048 // 00049 00050 #define CopyUchar1(Dst,Src) { \ 00051 *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \ 00052 } 00053 00054 // 00055 // This macro copies an unaligned src word to an aligned dst word 00056 // 00057 00058 #define CopyUchar2(Dst,Src) { \ 00059 *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \ 00060 } 00061 00062 // 00063 // This macro copies an unaligned src longword to an aligned dsr longword 00064 // 00065 00066 #define CopyUchar4(Dst,Src) { \ 00067 *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \ 00068 } 00069 00070 // 00071 // Define the Packed and Unpacked BIOS Parameter Block 00072 // 00073 00074 typedef struct _PACKED_BIOS_PARAMETER_BLOCK { 00075 UCHAR BytesPerSector[2]; // offset = 0x000 0 00076 UCHAR SectorsPerCluster[1]; // offset = 0x002 2 00077 UCHAR ReservedSectors[2]; // offset = 0x003 3 00078 UCHAR Fats[1]; // offset = 0x005 5 00079 UCHAR RootEntries[2]; // offset = 0x006 6 00080 UCHAR Sectors[2]; // offset = 0x008 8 00081 UCHAR Media[1]; // offset = 0x00A 10 00082 UCHAR SectorsPerFat[2]; // offset = 0x00B 11 00083 UCHAR SectorsPerTrack[2]; // offset = 0x00D 13 00084 UCHAR Heads[2]; // offset = 0x00F 15 00085 UCHAR HiddenSectors[4]; // offset = 0x011 17 00086 UCHAR LargeSectors[4]; // offset = 0x015 21 00087 } PACKED_BIOS_PARAMETER_BLOCK; // sizeof = 0x019 25 00088 00089 typedef PACKED_BIOS_PARAMETER_BLOCK *PPACKED_BIOS_PARAMETER_BLOCK; 00090 00091 typedef struct BIOS_PARAMETER_BLOCK { 00092 USHORT BytesPerSector; 00093 UCHAR SectorsPerCluster; 00094 USHORT ReservedSectors; 00095 UCHAR Fats; 00096 USHORT RootEntries; 00097 USHORT Sectors; 00098 UCHAR Media; 00099 USHORT SectorsPerFat; 00100 USHORT SectorsPerTrack; 00101 USHORT Heads; 00102 ULONG HiddenSectors; 00103 ULONG LargeSectors; 00104 } BIOS_PARAMETER_BLOCK, *PBIOS_PARAMETER_BLOCK; 00105 00106 // 00107 // Define the boot sector 00108 // 00109 00110 typedef struct _PACKED_BOOT_SECTOR { 00111 UCHAR Jump[3]; // offset = 0x000 0 00112 UCHAR Oem[8]; // offset = 0x003 3 00113 PACKED_BIOS_PARAMETER_BLOCK PackedBpb; // offset = 0x00B 11 00114 UCHAR PhysicalDriveNumber; // offset = 0x024 36 00115 UCHAR Reserved; // offset = 0x025 37 00116 UCHAR Signature; // offset = 0x026 38 00117 UCHAR Id[4]; // offset = 0x027 39 00118 UCHAR VolumeLabel[11]; // offset = 0x02B 43 00119 UCHAR SystemId[8]; // offset = 0x036 54 00120 } PACKED_BOOT_SECTOR; // sizeof = 0x03E 62 00121 00122 typedef PACKED_BOOT_SECTOR *PPACKED_BOOT_SECTOR; 00123 00124 // 00125 // Define the functions provided by this driver. 00126 // 00127 00128 BOOLEAN 00129 IsFatVolume( 00130 IN PPACKED_BOOT_SECTOR Buffer 00131 ); 00132 00133 VOID 00134 UnpackBiosParameterBlock( 00135 IN PPACKED_BIOS_PARAMETER_BLOCK Bios, 00136 OUT PBIOS_PARAMETER_BLOCK UnpackedBios 00137 );

Generated on Sat May 15 19:39:58 2004 for test by doxygen 1.3.7