-
-
Save ayende/68dcb097c0500785b18a14ab9afa69a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HANDLE hFile = CreateFile("test.file",GENERIC_WRITE, | |
0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL | |
); | |
DWORD temp; | |
DeviceIoControl(hFile, FSCTL_SET_SPARSE, NULL, 0, | |
NULL, 0, &temp, NULL); | |
LARGE_INTEGER li; | |
li.QuadPart = 128LL * 1024 * 1024 - 1; | |
SetFilePointerEx(hFile, li, NULL, FILE_BEGIN); | |
SetEndOfFile(hFile); | |
FILE_ZERO_DATA_INFORMATION zeroData; | |
zeroData.FileOffset.QuadPart = 16LL * 1024 * 1024; | |
zeroData.BeyondFinalZero.QuadPart = 32LL * 1024 * 1024; | |
DeviceIoControl(hFile, FSCTL_SET_ZERO_DATA, &zeroData, | |
sizeof(zeroData), NULL, 0, &temp, NULL); | |
CloseHandle(hFile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment