tags:

views:

53

answers:

1

I want to know that how to access a sector of the hard disk in Windows XP with a C program?

+2  A: 

You will need to open the raw disk device, ideally with the Windows API rather than any part of the standard C file I/O library. You would then use the Windows API to read and write (but only if you are careful) the raw sectors. To get write access, the disk must usually not be mounted. To do this at all, you need privileges granted to Administrators.

Start at the MSDN documentation for CreateFile(), and pay careful attention to the section titled "Physical Disks and Volumes". The pages on Naming a File and DOS device names may also be interesting.

RBerteig
and if i want to access a hard disk which is containing some data and i want to copy that from one sector to another , then is it possible ?
Yes, it is possible but very dangerous. You risk destroying the file system metadata needed to mount the disk in its normal environment. Your mileage may vary. Heed all warning labels. You have been warned.
RBerteig