FSCTL_QUERY_FILE_REGIONS stuck on sparse file on ReFS(v2) with 64KB cluster size.
- Windows Server 2025 (26100.3194)
Do Format E: /FS:ReFS /A:64K /Q
.
Run below code.
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <winioctl.h> | |
int main() | |
{ | |
HANDLE h = CreateFileW(LR"(E:\test.dat)", GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr); | |
ULONG _; | |
DeviceIoControl(h, FSCTL_SET_SPARSE, nullptr, 0, nullptr, 0, &_, nullptr); | |
FILE_END_OF_FILE_INFO eof = { {.QuadPart = 16LL * 1024 * 1024 * 1024 } }; | |
SetFileInformationByHandle(h, FileEndOfFileInfo, &eof, sizeof eof); | |
FILE_REGION_OUTPUT file_region_output; | |
DeviceIoControl(h, FSCTL_QUERY_FILE_REGIONS, nullptr, 0, &file_region_output, sizeof file_region_output, &_, nullptr); | |
} |