Programs get drive allocation information for disk usage functions intdos intdosx

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

The functions intdos and intdosx execute DOS interrupt 0x21 to invoke a specified DOS function. The value of inregs->h.ah specifies the DOS function to be invoked. The function intdosx also copies the segregs ->ds and segregs ->es values into the corresponding registers before invoking the DOS function and then restores DS.

This feature of the functions allows the programs that use far pointers or a large data memory model specify which segment is to be used for the function execution. With intdosx function you can invoke a DOS function that takes a value of DS different from the default data segment and/or takes an argument in ES.

Both the functions return the value of AX after completion of the DOS function call and if the carry flag is set (outregs -> x.cflag != 0), it indicates that an error occurred.

After the interrupt 0x21 returns the functions copy the current register values to outregs, status of the carry flag to the x.cflag field in outregs and value of the 8086 flags register to the x.flags field in outregs. Both inregs and outregs can point to the same structure. Let us see the examples of these functions.

The example of the use of intdos function has been given below. This program obtains the selected information about the floppy (1.44Mb, 3½ inch floppy disk) disk drive. This program provides the allocation information of a floppy disk.

/* The get drive allocation information for disk usage */

#include <dos.h> /* for intdos() and union REGS */
#include <stdio.h> /* for printf() */

union REGS inregs, outregs;

void main()
{
inregs.h.ah = 0x36; /* get disk free space
function number */
inregs.h.dl = 0x01; /* drive A: */

intdos(&inregs, &outregs);

printf("%d sectors/cluster,\n%d clusters,\n%d bytes/sector,
\n%d total clusters",
outregs.x.ax,outregs.x.bx,
outregs.x.cx, outregs.x.dx);
getch();
}

And output of the program will be like this:

1 sectors/cluster,
1933 clusters,
512 bytes/sector,
2843 total clusters


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 | 34 | 35 | 36 | 37 | 38

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