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

fat_rec.h File Reference

Go to the source code of this file.

Classes

union  _UCHAR1
union  _UCHAR2
union  _UCHAR4
struct  _PACKED_BIOS_PARAMETER_BLOCK
struct  BIOS_PARAMETER_BLOCK
struct  _PACKED_BOOT_SECTOR

Defines

#define CopyUchar1(Dst, Src)
#define CopyUchar2(Dst, Src)
#define CopyUchar4(Dst, Src)

Typedefs

typedef _UCHAR1 UCHAR1
typedef _UCHAR1PUCHAR1
typedef _UCHAR2 UCHAR2
typedef _UCHAR2PUCHAR2
typedef _UCHAR4 UCHAR4
typedef _UCHAR4PUCHAR4
typedef _PACKED_BIOS_PARAMETER_BLOCK PACKED_BIOS_PARAMETER_BLOCK
typedef PACKED_BIOS_PARAMETER_BLOCKPPACKED_BIOS_PARAMETER_BLOCK
typedef BIOS_PARAMETER_BLOCK BIOS_PARAMETER_BLOCK
typedef BIOS_PARAMETER_BLOCKPBIOS_PARAMETER_BLOCK
typedef _PACKED_BOOT_SECTOR PACKED_BOOT_SECTOR
typedef PACKED_BOOT_SECTORPPACKED_BOOT_SECTOR

Functions

BOOLEAN IsFatVolume (IN PPACKED_BOOT_SECTOR Buffer)
VOID UnpackBiosParameterBlock (IN PPACKED_BIOS_PARAMETER_BLOCK Bios, OUT PBIOS_PARAMETER_BLOCK UnpackedBios)


Define Documentation

#define CopyUchar1 Dst,
Src   ) 
 

Value:

{ \ *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \ }

Definition at line 50 of file fat_rec.h.

Referenced by UnpackBiosParameterBlock().

#define CopyUchar2 Dst,
Src   ) 
 

Value:

{ \ *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \ }

Definition at line 58 of file fat_rec.h.

Referenced by UnpackBiosParameterBlock().

#define CopyUchar4 Dst,
Src   ) 
 

Value:

{ \ *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \ }

Definition at line 66 of file fat_rec.h.

Referenced by UnpackBiosParameterBlock().


Typedef Documentation

typedef struct BIOS_PARAMETER_BLOCK BIOS_PARAMETER_BLOCK
 

typedef struct _PACKED_BIOS_PARAMETER_BLOCK PACKED_BIOS_PARAMETER_BLOCK
 

typedef struct _PACKED_BOOT_SECTOR PACKED_BOOT_SECTOR
 

Referenced by NtfsRecFsControl().

typedef struct BIOS_PARAMETER_BLOCK * PBIOS_PARAMETER_BLOCK
 

Referenced by UnpackBiosParameterBlock().

typedef PACKED_BIOS_PARAMETER_BLOCK* PPACKED_BIOS_PARAMETER_BLOCK
 

Definition at line 89 of file fat_rec.h.

Referenced by UnpackBiosParameterBlock().

typedef PACKED_BOOT_SECTOR* PPACKED_BOOT_SECTOR
 

Definition at line 122 of file fat_rec.h.

Referenced by FatRecFsControl().

typedef union _UCHAR1 * PUCHAR1
 

typedef union _UCHAR2 * PUCHAR2
 

typedef union _UCHAR4 * PUCHAR4
 

typedef union _UCHAR1 UCHAR1
 

typedef union _UCHAR2 UCHAR2
 

typedef union _UCHAR4 UCHAR4
 


Function Documentation

BOOLEAN IsFatVolume IN PPACKED_BOOT_SECTOR  Buffer  ) 
 

Definition at line 184 of file fat_rec.c.

References Buffer, BIOS_PARAMETER_BLOCK::BytesPerSector, FALSE, BIOS_PARAMETER_BLOCK::Fats, BIOS_PARAMETER_BLOCK::LargeSectors, BIOS_PARAMETER_BLOCK::Media, PAGED_CODE, BIOS_PARAMETER_BLOCK::ReservedSectors, BIOS_PARAMETER_BLOCK::RootEntries, BIOS_PARAMETER_BLOCK::Sectors, BIOS_PARAMETER_BLOCK::SectorsPerCluster, BIOS_PARAMETER_BLOCK::SectorsPerFat, TRUE, and UnpackBiosParameterBlock().

Referenced by FatRecFsControl().

00190 : 00191 00192 This routine looks at the buffer passed in which contains the FAT boot 00193 sector and determines whether or not it represents an actual FAT boot 00194 sector. 00195 00196 Arguments: 00197 00198 Buffer - Pointer to buffer containing potential boot block. 00199 00200 Return Value: 00201 00202 The function returns TRUE if the buffer contains a recognizable FAT boot 00203 sector, otherwise it returns FALSE. 00204 00205 --*/ 00206 00207 { 00208 BIOS_PARAMETER_BLOCK bios; 00209 BOOLEAN result; 00210 00211 PAGED_CODE(); 00212 00213 // 00214 // Begin by unpacking the Bios Parameter Block that is packed in the boot 00215 // sector so that it can be examined without incurring alignment faults. 00216 // 00217 00218 UnpackBiosParameterBlock( &Buffer->PackedBpb, &bios ); 00219 00220 // 00221 // Assume that the sector represents a FAT boot block and then determine 00222 // whether or not it really does. 00223 // 00224 00225 result = TRUE; 00226 00227 if (bios.Sectors) { 00228 bios.LargeSectors = 0; 00229 } 00230 00231 // FMR Jul.11.1994 NaokiM - Fujitsu - 00232 // FMR boot sector has 'IPL1' string at the beginnig. 00233 00234 if (Buffer->Jump[0] != 0x49 && /* FMR */ 00235 Buffer->Jump[0] != 0xe9 && 00236 Buffer->Jump[0] != 0xeb) { 00237 00238 result = FALSE; 00239 00240 00241 // FMR Jul.11.1994 NaokiM - Fujitsu - 00242 // Sector size of FMR partition is 2048. 00243 00244 } else if (bios.BytesPerSector != 128 && 00245 bios.BytesPerSector != 256 && 00246 bios.BytesPerSector != 512 && 00247 bios.BytesPerSector != 1024 && 00248 bios.BytesPerSector != 2048 && /* FMR */ 00249 bios.BytesPerSector != 4096) { 00250 00251 result = FALSE; 00252 00253 } else if (bios.SectorsPerCluster != 1 && 00254 bios.SectorsPerCluster != 2 && 00255 bios.SectorsPerCluster != 4 && 00256 bios.SectorsPerCluster != 8 && 00257 bios.SectorsPerCluster != 16 && 00258 bios.SectorsPerCluster != 32 && 00259 bios.SectorsPerCluster != 64 && 00260 bios.SectorsPerCluster != 128) { 00261 00262 result = FALSE; 00263 00264 } else if (!bios.ReservedSectors) { 00265 00266 result = FALSE; 00267 00268 } else if (!bios.Fats) { 00269 00270 result = FALSE; 00271 00272 // 00273 // Prior to DOS 3.2 might contains value in both of Sectors and 00274 // Sectors Large. 00275 // 00276 } else if (!bios.Sectors && !bios.LargeSectors) { 00277 00278 result = FALSE; 00279 00280 // FMR Jul.11.1994 NaokiM - Fujitsu - 00281 // 1. Media descriptor of FMR partitions is 0xfa. 00282 // 2. Media descriptor of partitions formated by FMR OS/2 is 0x00. 00283 // 3. Media descriptor of floppy disks formated by FMR DOS is 0x01. 00284 00285 } else if (bios.Media != 0x00 && /* FMR */ 00286 bios.Media != 0x01 && /* FMR */ 00287 bios.Media != 0xf0 && 00288 bios.Media != 0xf8 && 00289 bios.Media != 0xf9 && 00290 bios.Media != 0xfa && /* FMR */ 00291 bios.Media != 0xfb && 00292 bios.Media != 0xfc && 00293 bios.Media != 0xfd && 00294 bios.Media != 0xfe && 00295 bios.Media != 0xff) { 00296 00297 result = FALSE; 00298 00299 } else if (bios.SectorsPerFat != 0 && bios.RootEntries == 0) { 00300 00301 result = FALSE; 00302 } 00303 00304 return result; 00305 }

VOID UnpackBiosParameterBlock IN PPACKED_BIOS_PARAMETER_BLOCK  Bios,
OUT PBIOS_PARAMETER_BLOCK  UnpackedBios
 

Definition at line 309 of file fat_rec.c.

References CopyUchar1, CopyUchar2, CopyUchar4, PAGED_CODE, PBIOS_PARAMETER_BLOCK, and PPACKED_BIOS_PARAMETER_BLOCK.

Referenced by IsFatVolume().

00316 : 00317 00318 This routine copies a packed Bios Parameter Block to an unpacked Bios 00319 Parameter Block. 00320 00321 Arguments: 00322 00323 Bios - Pointer to the packed Bios Parameter Block. 00324 00325 UnpackedBios - Pointer to the unpacked Bios Parameter Block. 00326 00327 Return Value: 00328 00329 None. 00330 00331 --*/ 00332 00333 { 00334 PAGED_CODE(); 00335 00336 // 00337 // Unpack the Bios Parameter Block. 00338 // 00339 00340 CopyUchar2( &UnpackedBios->BytesPerSector, &Bios->BytesPerSector[0] ); 00341 CopyUchar2( &UnpackedBios->BytesPerSector, &Bios->BytesPerSector[0] ); 00342 CopyUchar1( &UnpackedBios->SectorsPerCluster, &Bios->SectorsPerCluster[0] ); 00343 CopyUchar2( &UnpackedBios->ReservedSectors, &Bios->ReservedSectors[0] ); 00344 CopyUchar1( &UnpackedBios->Fats, &Bios->Fats[0] ); 00345 CopyUchar2( &UnpackedBios->RootEntries, &Bios->RootEntries[0] ); 00346 CopyUchar2( &UnpackedBios->Sectors, &Bios->Sectors[0] ); 00347 CopyUchar1( &UnpackedBios->Media, &Bios->Media[0] ); 00348 CopyUchar2( &UnpackedBios->SectorsPerFat, &Bios->SectorsPerFat[0] ); 00349 CopyUchar2( &UnpackedBios->SectorsPerTrack, &Bios->SectorsPerTrack[0] ); 00350 CopyUchar2( &UnpackedBios->Heads, &Bios->Heads[0] ); 00351 CopyUchar4( &UnpackedBios->HiddenSectors, &Bios->HiddenSectors[0] ); 00352 CopyUchar4( &UnpackedBios->LargeSectors, &Bios->LargeSectors[0] ); 00353 } }


Generated on Sat May 15 19:43:36 2004 for test by doxygen 1.3.7