Sector reading and writing

S

Sumana

Hi All,

We have problem in reading and writing to the sector
beyond 6GB of data.

The direct function Calls are used to deal with sector
reading and writing.

// First a handle is created using the following code.
CreateFile(_devicename, GENERIC_READ, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

// Then it is made to point to sector using the following.
SetFilePointerEx (hDevice, L,&L1, FILE_BEGIN)

//Reading of the sector is done using the following
ReadFile (hDevice, buffer, 512*numberofsectors,
&bytesread, NULL);

//Writing to the sector is done as follows.
WriteFile (hDevice, buffer,
512*numberofsectors,&byteswrite, NULL);

We got the program in MSDN to know the hard disk details, so
sure with size of sector.

Reading and writing is done on block of the sectors, i.e,
100 * 1024.
We are creating a image file of the read sector, and using
this image file we are restoring back the contents of the disk or drive.

There is no problem in reading and writing of data till
6GB it is working fine with no loss of data.

Beyong 6Gb, We are able to create the image, but after
writing the data we are unable see the contents.
We tested with the image created by blocking the write
operation,
which showed the few contents. With which we were sure that
image created after reading the sector has got no problem.
So there was some problem in writing to the sectors.

No files can be seen, but the size is reflected. But after
that whats actually happening, not able to track it.

Program is written in VC++.Net on Windows XP. Is there any
limit or restriction of the harddisk or OS(whatever dont know exactly)
after certain amount of data.

Kindly suggest if any idea regarding this.

Regards,
sumana.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top