Comments on coding:
The function Display_Information is to read the file and directory information and from the root directory. In the Structure we are reading the 32 bytes information for every file or directory with root.
The unsigned integer arrays name and ext are for File or Directory name for DOS in 8.3 (Eight Dot Three) Format. Similarly one byte is for attribute and two bytes for starting cluster. long unsigned int size; is to store the size of the file of four bytes.
The _bios_disk function reads the sector, specified by the structure finfo and the status of the operation is stored in result.
From the every information of 512 bytes read by the _bios_disk function, till the root directory area ends, we collect the information of the files and directories stored in the disk and display them on the screen.
The integer file_no is stores the number of the file or directory in the list, starting from 0. Generally the size of root directory is of 14 sectors and root directory generally starts from Cylinder =0, Head = 0 and Sector =2 in case of 1.44MB and 3½ floppy disk.
If user gives the character ‘M’ or ‘m’ as input, the information of next sector is displayed if the choice by user is ‘R’ or ‘r’ the recovery functions are called. The coding of the function recover() has been given below:
/* Function To Start Recovery for The Specified File */
void recover(unsigned int *root,unsigned int len)
void clear_the_line(unsigned int r); /* Function to Clear
a Row on the Screen */
/* Function to Integrate The Specified File */
void integrate(long unsigned int,unsigned int,
unsigned int,unsigned int);
unsigned int file_no,i;
unsigned int *loc;
unsigned int cylinder,head,sector;
unsigned int start;
long unsigned int size;
clear_the_line(21); /* Clear The Row Number 21 */
clear_the_line(22); /* Clear The Row Number 22 */
clear_the_line(23); /* Clear The Row Number 23 */
clear_the_line(24); /* Clear The Row Number 24 */
cprintf("Enter FNO. of the file you want to recover");
scanf("%u",&file_no); /* Get the File No. to be
|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)