Advertisement
anhkiet2507

Program to display boot sector information on FAT16

Sep 29th, 2022
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.73 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<stdio.h>
  3. #include<conio.h>
  4. #include<dos.h>
  5. #include<string.h>
  6.  
  7. struct bootsector
  8. {
  9.     char jump_instruction[3];
  10.     char OEM_ID[8];
  11.     int bytes_per_sector;
  12.     char sector_per_cluster;
  13.     int reserved_sectors;
  14.     char number_of_fats;
  15.     int root_entries;
  16.     int small_sectors;
  17.     char media_descriptor;
  18.     int sectors_per_fat;
  19.     int sectors_per_track;
  20.     int number_of_heads;
  21.     long hidden_sectors;
  22.     long large_sectors;
  23.     char physical_drive_number;
  24.     char reserved;
  25.     char extended_boot_signature;
  26.     char volume_serial_number[4];
  27.     char volume_lable[11];
  28.     char file_system_type[8];
  29.     char bootstrap_code[448];
  30.     char end_of_sector_marker[2];
  31.  
  32. };
  33.  
  34. void bootsectorPrint (bootsector *bs)
  35. {
  36.     printf("OEM ID: %s \n", bs->OEM_ID);
  37.     printf("bytes per sector: %d \n", bs->bytes_per_sector);
  38.     printf("sectors per cluster: %d \n", bs->sector_per_cluster);
  39.     printf("number of fat table: %d \n", bs->number_of_fats);
  40.     printf("root entries: %d \n", bs->root_entries);
  41.     printf("total sectors: %d \n", bs->small_sectors);
  42.     printf(" media descriptor: %x \n", bs->media_descriptor );
  43.     printf("sectors per fat: %d \n", bs->sectors_per_fat);
  44.     printf("sectors per track: %d \n", bs->sectors_per_track);
  45.     printf("number of heads: %d \n", bs->number_of_heads);
  46.     printf("hidden sectors: %ld \n", bs->hidden_sectors);
  47.     printf("total sectors: %ld \n", bs->large_sectors);
  48.     printf("physical drive number: %x \n", bs->physical_drive_number);
  49.     printf("volume serial number: %s \n", bs->volume_serial_number);
  50.     printf("volume lable: %s \n", bs->volume_lable);
  51.     printf("file system type: %s \n", bs->file_system_type);
  52.  
  53. }
  54.  
  55.  
  56. void main()
  57. {
  58.    
  59.  
  60.     bootsector *bs= new bootsector();
  61.  
  62.     absread(2,1,0,bs);
  63.     bootsectorPrint(bs);
  64.     getch();
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement