Sector reading and writing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.











.



Relevant Pages

  • Re: Writing reserved sectors in Vista
    ... The question is about "raw" writing a specific sector in a disk image file ... "access is denied" in Windows Vista. ... Microsoft Online Community Support ...
    (microsoft.public.win32.programmer.kernel)
  • Sector reading and writing
    ... I have problem in reading and writing to the sector ... The direct function Calls are used to deal with sector ... this image file I am restoring back the contents of the disk or drive. ...
    (microsoft.public.vc.language)
  • Re: Odd Harddrive problem
    ... though I haven't done a sector by sector for fear of it ... as can writing it but so far it's succeeded every time. ... Motherboard drivers are the latest ones, ... Once the data is safe on CD/DVD then you can proceed with diagnostics, ...
    (uk.comp.homebuilt)
  • Re: Atomic section query
    ... the data and checking whether the perticular sector is bad or not. ... Reading the data from the sector ... Writing the new data into that sectors ... Again putting the original data back to the sectors. ...
    (comp.os.linux.embedded)
  • Re: Odd Harddrive problem
    ... though I haven't done a sector by sector for fear of it writing off my ... Access to data can take several minutes, as can writing ... Dave Johnson. ... Beta TR34 (Ring ding ding ding pop pop) ...
    (uk.comp.homebuilt)