2.3.52 FSCTL_QUERY_ALLOCATED_RANGES Reply

The FSCTL_QUERY_ALLOCATED_RANGES Reply message returns the results of the FSCTL_QUERY_ALLOCATED_RANGES Request (section 2.3.51).

This message MUST return an array of zero or more FILE_ALLOCATED_RANGE_BUFFER data elements. The number of FILE_ALLOCATED_RANGE_BUFFER elements returned is computed by dividing the size of the returned output buffer (from either SMB or SMB2, the lower-layer protocol that carries the FSCTL) by the size of the FILE_ALLOCATED_RANGE_BUFFER element. Ranges returned MUST intersect the range specified in the FSCTL_QUERY_ALLOCATED_RANGES Request. Zero FILE_ALLOCATED_RANGE_BUFFER data elements MUST be returned when the file has no allocated ranges.<44>

The FILE_ALLOCATED_RANGE_BUFFER data element is as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

FileOffset

...

Length

...

FileOffset (8 bytes): A 64-bit signed integer that contains the file offset in bytes from the start of the file; the start of a range of bytes to which storage is allocated. If the file is a sparse file, it can contain ranges of bytes for which storage is not allocated; these ranges will be excluded from the list of allocated ranges returned by this FSCTL.<45> Because an application using a sparse file can choose whether or not to allocate disk space for each sequence of 0x00-valued bytes, the allocated ranges can contain 0x00-valued bytes. This value MUST be greater than or equal to 0.<46>

Length (8 bytes): A 64-bit signed integer that contains the size, in bytes, of the range. In a request message, the value of this field MUST be greater than or equal to 0. In a reply message, it MUST be greater than 0.

This message returns a status code as specified in section 2.2. Upon success, the status code returned by the function that processes this FSCTL is STATUS_SUCCESS. The most common error codes are listed in the following table.

 Error code

 Meaning

STATUS_INVALID_PARAMETER

0xC000000D

The handle is not to a file, or the size of the input buffer is less than the size of a FILE_ALLOCATED_RANGE_BUFFER structure, or the given FileOffset field value is less than zero, or the given Length field value is less than zero, or the given FileOffset field value plus the given Length field value is larger than 0x7FFFFFFFFFFFFFFF.

STATUS_INVALID_USER_BUFFER

0xC00000E8

The input buffer or output buffer is not aligned to a 4-byte boundary.

STATUS_BUFFER_TOO_SMALL

0xC0000023

The output buffer is too small to contain a FILE_ALLOCATED_RANGE_BUFFER structure.

STATUS_BUFFER_OVERFLOW

0x80000005

The output buffer is too small to contain the required number of FILE_ALLOCATED_RANGE_BUFFER structures.