Function verify_the_sector() verifies sector to be read by the _bios_disk()

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

Comments on coding:

The function integrate() is the actual module of performing the recovery of the user specified file, in this recovery program.

The file name with the destination path to store the recovered file is stored in the character pointer *Filename_with_path. If there is any error in opening the destination file, error message is displayed and user is prompt again to enter the destination.

The function _bios_disk(_DISK_READ, &dinfo); reads the data of the file from the data area of the disk sector by sector, specified by the structure dinfo and stored in the data buffer buf. This data of 512 bytes is written to the destination file. This is repeated until the complete file is integrated.

The function status=verify_the_sector(cylinder,head,sector); verifies the sector to be read. If the status = 10, it represents a bad (0xA) sector. The coding of the function has been given below:

/// Verify the Sector. (No Data is Transferred here) \\\

int verify_the_sector(unsigned int c,unsigned int h,unsigned int s)
{
int status;
char *buf;
union REGS in, out;
struct SREGS sg;

in.h.ah = 0x04; /* Function Number */
in.h.al = 1; /* Number of Sectors to Verify*/
in.h.dl = 0x00; /* Drive Number for A: */
in.h.ch = c; /* Cylinder Number */
in.h.dh = h; /* Head Number */
in.h.cl = s; /* Sector Number */
in.x.bx = FP_OFF(buf);/* Offset */
sg.es = FP_SEG(buf); /* Segment */

int86x(0x13,&in,&out,&sg); /* Call the Function 4H of INT 13H */

if(out.x.cflag)
{
status=out.h.ah;
}
return(status);
}

Comments on Coding:

The function verify_the_sector(), verifies sector to be read by the _bios_disk() function and returns the status of the operation. The function uses INT 13H and function 4H to verify the sector.

*buf is the data buffer, 0x04 is the function number specified by in.h.ah = 0x04; and in.h.al = 1; instructs to verify the one sector at a time. in.h.dl = 0x00; is used for the drive number for floppy drive A:, c,h, and s are Cylinder, Head and Sector numbers.

The function int86x() is used to invoke INT 13H (function 4H) with segment register values. The status of the operation is returned by the integer status.

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20


page 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 
Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor