Sunday, November 6, 2011

Accessing Other Storage Devices of Interaction With Hardware

Note  that the mechanism of reading from or writing to any device remains standard under Windows. We simply need to change the string that specifies the device. Here are some sample calls for reading/writing from/to various devices:

ReadSector ( "\\\\.\\a:", 0, 1, &b ) ; /* reading from 2nd floppy drive */
ReadSector ( "\\\\.\\d:", 0, 1, buffer ) ; /* reading from a CD-ROM drive */
WriteSector ( "\\\\.\\c:", 0, 1, &b ) ; /* writing to a hard disk */
ReadSector ( "\\\\.\\physicaldrive0", 0, 1, &b ) ; /* reading partition table */
Here are a few interesting points that you must note.


(a) If we are to read from the second floppy drive we should replace A: with B: while calling ReadSector( ).

(b) To read from storage devices like hard disk drive or CD-ROM or ZIP drive, etc. use the string with appropriate drive letter. The string can be in the range \\.\C: to \\.\Z:.

(c)
(d)
(e)
(a)
To read from the CD-ROM just specify the drive letter of the drive. Note that CD-ROMs follow a different storage organization known as CD File System (CDFS).
The hard disk is often divided into multiple partitions. Details like the place at which each partition begins and ends, the size of each partition, whether it is a bootable partition or not, etc. are stored in a table on the disk. This table is often called ‘Partition Table’. If we are to read the partition table contents we can do so by using the string \\.\physicaldrive0.
Using \\.\physicaldrive0 we can also read contents of any other parts of the disk. Here 0 represents the first hard disk in the system. If we are to read from the second hard disk we need to use 1 in place of 0.(c)
(d)
(e)
(a)
To read from the CD-ROM just specify the drive letter of the drive. Note that CD-ROMs follow a different storage organization known as CD File System (CDFS).
The hard disk is often divided into multiple partitions. Details like the place at which each partition begins and ends, the size of each partition, whether it is a bootable partition or not, etc. are stored in a table on the disk. This table is often called ‘Partition Table’. If we are to read the partition table contents we can do so by using the string \\.\physicaldrive0.
Using \\.\physicaldrive0 we can also read contents of any other parts of the disk. Here 0 represents the first hard disk in the system. If we are to read from the second hard disk we need to use 1 in place of 0.(c)

(c) To read from the CD-ROM just specify the drive letter of the drive. 

Note that CD-ROMs follow a different storage organization known as CD File System (CDFS).

(d)The hard disk is often divided into multiple partitions. Details like the place at which each partition begins and ends, the size of each partition, whether it is a bootable partition or not, etc. are stored in a table on the disk. This table is often called ‘Partition Table’. If we are to read the partition table contents we can do so by using the string \\.\physicaldrive0.

(e) Using \\.\physicaldrive0 we can also read contents of any other parts of the disk. Here 0 represents the first hard disk in the system. If we are to read from the second hard disk we need to use 1 in place of 0.

No comments:

Post a Comment