We recover the data by reading the information of the file(s) from the Root Directory and then integrate the file to the destination path and recover the file. Our next program performs the following steps to recover the data:
- Read the Root Directory entries and Display them on the screen with all information such as File/Directory name, Extension of the File, Starting cluster size of the files in Bytes.
- Read the Files and Directories information in the Subdirectories and display them if required.
- Confirm the File name to be recovered and continue recovery.
- Calculate the CHS (Cylinder, Head, and Sector) info for the Specified file to be recovered.
- Integrate the data of the file from the data area of the disk and save the recovered file to the specified destination file name in specified path.
This Program does not care if the boot information of the floppy is readable or not. Therefore you can recover even deleted data from the corrupted floppy disk too. Let us see the coding of the program:
/* Program to recover the data from the Floppy disk by Reading file information from the Root Directory */
void Display_Information(unsigned int,unsigned int,
unsigned int track=0,head=1,sector=2;
} /*End of main */
void Display_Information(unsigned int track,
unsigned int head,
unsigned int sector)
void recover(unsigned int *,unsigned int);
char buf; // Buffer of 512 Bytes
struct diskinfo_t finfo; //Structure, Used by _bios_disk
unsigned int result,i,j, count=0; /* Unsigned Integers
unsigned int file_no; /* Unsigned Integer
for File Number */
unsigned int name,ext; /* File Name for DOS in 8.3
(Eight Dot Three) Format */
unsigned int attribute; // File/Directory Attribute
unsigned int start; // Starting Cluster of the File
long unsigned int size; // Size of the File in Bytes
}root; /* 32 Bytes Information of
File/Directory in Root
|Sample Chapters from book DATA RECOVERY WITH AND WITHOUT PROGRAMMING by Author Tarun Tyagi
Publishers of the Book
Number of Pages
Price of the Book
BPB Publications, New Delhi, India
$69.00 (Including Shipping Charges, Cost of Book and Other expenses, Free Source Code CD included with the Book)