Looking for a way to pre-allocate space in your WinAPI created file, don't wanna write a bunch of zeros?
SetFileInformationByHandle looks promising for Vista+ but I never did get it working
I did however find 'NtSetInformationFile' - Available starting with Windows 2000
;hfile - handle to file opened with $GENERIC_WRITE access
;$llAllocationBytes - 64 bit int size to allocate for file
__WinAPI_SetFileAllocationInfo($hFile, $llAllocationBytes)
Func __WinAPI_SetFileAllocationInfo($hFile, $llAllocationBytes)
Local Const $eFileAllocationInformation = 0x13
Local $t_FILE_ALLOCATION_INFO = DllStructCreate("Align 8;INT64")
DllStructSetData($t_FILE_ALLOCATION_INFO, 1, $llAllocationBytes)
Local $iRet = DllCall("ntdll.dll", "int", "NtSetInformationFile", _
"handle", $hFile, _
"int64*", 0, _
"ptr", DllStructGetPtr($t_FILE_ALLOCATION_INFO), _
"ulong", DllStructGetSize($t_FILE_ALLOCATION_INFO), _
"int", $eFileAllocationInformation)
If @error Then Return False
Return $iRet[0] = 0
EndFunc ;==>__WinAPI_SetFileAllocationInfo
In case you are wondering (wandering?) here is my failed Attempt to call SetFileInformationByHandle
more info: https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_allocation_information