I've downloaded the 26d code, and with minor modifications I have sparse file support; so, if I get a chunk which is located at the end of the file, then no space is lost due to premature allocation of previous segments in the file.
Here is what I've added to CPartFile::CreatePartFile() -
if (!m_hpartfile.Open(partfull,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyWrite|CFile::osSequentialScan)){
//if (!m_hpartfile.Open(partfull,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyWrite|CFile::osSequentialScan|CFile::osWriteThrough)){
theApp.emuledlg->AddLogLine(false,GetResString(IDS_ERR_CREATEPARTFILE));
status = PS_ERROR;
}
else /**** THIS IS THE ADDITION !!!!!! ******/
{
DWORD d;
theApp.emuledlg->AddLogLine(false, CString("Setting File as Sparse"));
if (DeviceIoControl(m_hpartfile.m_hFile, FSCTL_SET_SPARSE, 0, NULL, 0, NULL, &d, NULL))
{
theApp.emuledlg->AddLogLine(false, CString("Sparse Succssessfull"));
// should we extends the file, so it's final size is refelected in the file system?
/*
ULONGLONG ull;
ull = m_nFileSize;
m_hpartfile.SetLength(ull);
m_hpartfile.SeekToBegin();
*/
}
else theApp.emuledlg->AddLogLine(false, CString("Sparse Unsuccsessful"));
}
There is another modifications needs to be done, and that is to stdafx.h - change the windows versions to 0x0500 (I've modified all of them, but perhaps _WIN32_WINNT is sufficient).










Sign In
Register
