hiii

In my program I'm reading the clusters in the volume using the appropriate physical offsets to the disk.

for(  i=0; i<  total_number_ of_ clusters;i++)
{
  
// convert logical offset to physical offset 

 phys_offset= conversion(i);  // this value I get correctly


 if(!SetFilePointer(drive_handle, 
                             phys_offset,
                             NULL,
                             0))
{
 printf("\nSetFilePointer Failed: Error Number : %d\n",GetLastError());
 return o;
 }


 if(!ReadFile(drive_handle,
                    bBuffer1,
                    cluster_size,
                    &dwRetBytes1,
                    0))
{
printf("\nUnable to Read the Drive Error: %d\n",GetLastError());   
return o;
}
   

} // next cluster

The above code not giving no error messages, but how do we know the program reading correctly?.It returns the correct no of bytes read after one read operation .When I wrote theses data into destination , nothing wrote. What may be the problem??
Where is the mistake in the code ?

Any idea?
-----------
Thanking you
Krish

commented: Cross posting. -3

Would have been nice if you had posted the file open function with the properties you used!

hmyhandle= CreateFile( _T("\\\\.\\PhysicalDrive0"),
                  GENERIC_READ|GENERIC_WRITE,
                  FILE_SHARE_READ | FILE_SHARE_WRITE,
                  NULL,
                  OPEN_EXISTING,
                  FILE_ATTRIBUTE_NORMAL| 
                  FILE_FLAG_NO_BUFFERING,
                  NULL);
if (hmyhandle==INVALID_HANDLE_VALUE)
{
    printf("\nUnable to Open the source_drive Err_NO:%d\n",GetLastError()); 
    return 0;
}

May be a security issue? Your open function appears to be correct for read/write!

May be a security issue? Your open function appears to be correct for read/write!

But I've opened as administrator....