Sector reading and writing

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



Hi All,

                   I 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);

                 I 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.
                 I am creating a image file of the read sector, and using
this image file I am 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, I am able to create the image, but after
writing the data i am unable see the contents.
                  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

  • Sector reading and writing
    ... We have problem in reading and writing to the sector ... The direct function Calls are used to deal with sector ... this image file we are restoring back the contents of the disk or drive. ...
    (microsoft.public.windowsxp.device_driver.dev)
  • 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)
  • 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)