mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +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:
parent
88bfd3c3a7
commit
16620f6835
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user