Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdint.h>
- // set struct alignment in memory to 1 byte
- #pragma pack(push, 1)
- typedef struct _FAT32_BOOTSECTOR
- {
- uint8_t jmp[3];
- int8_t OemName[8];
- uint16_t BytesPerSector;
- uint8_t SectorsPerCluster;
- uint16_t ReservedSectors;
- uint8_t NumberOfFATs;
- uint16_t RootEntries;
- uint16_t TotalSectors;
- uint8_t Media;
- uint16_t SectorsPerFAT;
- uint16_t SectorsPerTrack;
- uint16_t HeadsPerCylinder;
- uint32_t HiddenSectors;
- uint32_t BigTotalSectors;
- uint32_t BigSectorsPerFAT;
- uint16_t Flags;
- uint16_t Version;
- uint32_t RootCluster;
- uint16_t InfoSector;
- uint16_t BootBackupStart;
- uint8_t Reserved[12];
- uint8_t DriveNumber;
- uint8_t Unused;
- uint8_t ExtBootSignature;
- uint32_t SerialNumber;
- int8_t VolumeLabel[11];
- int8_t FileSystem[8];
- uint8_t BootCode[422];
- } FAT32_BOOTSECTOR;
- #pragma pack(pop)
- typedef struct _FAT32_BOOTSECTOR_2
- {
- uint8_t jmp[3];
- int8_t OemName[8];
- uint16_t BytesPerSector;
- uint8_t SectorsPerCluster;
- uint16_t ReservedSectors;
- uint8_t NumberOfFATs;
- uint16_t RootEntries;
- uint16_t TotalSectors;
- uint8_t Media;
- uint16_t SectorsPerFAT;
- uint16_t SectorsPerTrack;
- uint16_t HeadsPerCylinder;
- uint32_t HiddenSectors;
- uint32_t BigTotalSectors;
- uint32_t BigSectorsPerFAT;
- uint16_t Flags;
- uint16_t Version;
- uint32_t RootCluster;
- uint16_t InfoSector;
- uint16_t BootBackupStart;
- uint8_t Reserved[12];
- uint8_t DriveNumber;
- uint8_t Unused;
- uint8_t ExtBootSignature;
- uint32_t SerialNumber;
- int8_t VolumeLabel[11];
- int8_t FileSystem[8];
- uint8_t BootCode[422];
- } FAT32_BOOTSECTOR_2;
- int main(int argc, char *argv[])
- {
- printf("FAT32_BOOTSECTOR (1-byte aligned) size: %lu\n", sizeof(FAT32_BOOTSECTOR));
- printf("FAT32_BOOTSECTOR_2 size: %lu\n", sizeof(FAT32_BOOTSECTOR_2));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement