1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 20:22:30 +01:00

vm_native: sparse file fixup (Win32)

Clear file if it occupies blocks.
Makes it more fool-proof and fixes possible bug.
This commit is contained in:
Nekotekina 2021-05-19 16:34:31 +03:00
parent 88bfd3c3a7
commit 16620f6835

View File

@ -345,6 +345,16 @@ namespace utils
if (DeviceIoControl(h, FSCTL_SET_SPARSE, nullptr, 0, nullptr, 0, nullptr, nullptr))
{
FILE_STANDARD_INFO info;
ensure(GetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info)));
if (info.AllocationSize.QuadPart)
{
// Make sure the file is not "dirty"
FILE_END_OF_FILE_INFO _eof{};
ensure(SetFileInformationByHandle(h, FileEndOfFileInfo, &_eof, sizeof(_eof)));
}
return true;
}