mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12: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
1 changed files with 10 additions and 0 deletions
|
@ -345,6 +345,16 @@ namespace utils
|
||||||
|
|
||||||
if (DeviceIoControl(h, FSCTL_SET_SPARSE, nullptr, 0, nullptr, 0, nullptr, nullptr))
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue