{
DWORD dwNumberOfBytesWritten;
DWORD dwFilePosition;
BOOL bRetVal;
//// FIXME: this doesn't seem to handle the situation// properly when SectorNumber is bigger than the// amount of sectors on the disk. Seems to me that// the call to SetFilePointer() should just give an// out of bounds error or something but it doesn't.//
dwFilePosition = SetFilePointer(hDiskVolume, (SectorNumber * 512), NULL, FILE_BEGIN);
if (dwFilePosition != (SectorNumber * 512))
{
_tprintf(_T("%s:%d: "), __FILE__, __LINE__);
_tprintf(_T("SetFilePointer() failed. Error code %ld.\n"), GetLastError());
returnFALSE;
}
bRetVal = WriteFile(hDiskVolume, SectorBuffer, 512, &dwNumberOfBytesWritten, NULL);
if (!bRetVal || (dwNumberOfBytesWritten != 512))
{
_tprintf(_T("%s:%d: "), __FILE__, __LINE__);
_tprintf(_T("WriteFile() failed. Error code %ld.\n"), GetLastError());
returnFALSE;
}
returnTRUE;
}
Generated on Sun May 27 2012 04:48:51 for ReactOS by
1.7.6.1
ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.