#ifndef _NTIOAPI_H
/**
* The FILE_ALLOCATION_INFORMATION structure is used to set the allocation size for a file.
* \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_allocation_information
*/
typedef struct _FILE_ALLOCATION_INFORMATION
{
LARGE_INTEGER AllocationSize;
} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
View code on GitHub
// ntifs.h
typedef struct _FILE_ALLOCATION_INFORMATION {
LARGE_INTEGER AllocationSize;
} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
View the official Windows Driver Kit DDI reference
This structure is documented in Windows Driver Kit.
The FILE_ALLOCATION_INFORMATION structure is used to set the allocation size for a file.
AllocationSize
File allocation size, in bytes. Usually this value is a multiple of the sector or cluster size of the underlying physical device.
This operation can be performed in either of the following ways:
Call FltSetInformationFile or ZwSetInformationFile, passing FileAllocationInformation as the value of FileInformationClass and passing a caller-allocated, FILE_ALLOCATION_INFORMATION-structured buffer as the value of FileInformation. The FileHandle parameter specifies the file whose allocation size is to be set.
Create an IRP with major function code IRP_MJ_SET_INFORMATION.
This operation is valid only for files. It is undefined for directories.
File system minifilters must use FltSetInformationFile, not ZwSetInformationFile, to set the allocation size for a file.
FILE_WRITE_DATA access is required to set this information.
A file's allocation size and end-of-file position are independent of each other, with the following exception: The end-of-file position must always be less than or equal to the allocation size. If the allocation size is set to a value that is less than the end-of-file position, the end-of-file position is automatically adjusted to match the allocation size.
The size of the FileInformation buffer passed to FltSetInformationFile or ZwSetInformationFile must be >= sizeof(FILE_ALLOCATION_INFORMATION)
.
This structure must be aligned on a LONGLONG (8-byte) boundary.