184.108.40.206.1 Handling an Enumeration of Previous Versions Request
When the server receives a request with an SMB2 header with a Command value equal to SMB2 IOCTL, and a CtlCode of FSCTL_SRV_ENUMERATE_SNAPSHOTS, message handling proceeds as follows:
The server MUST query the time stamps of available previous versions of the file from the object store.<303> If there are no previous versions available, the server MUST construct an SRV_SNAPSHOT_ARRAY following the syntax specified in section 220.127.116.11, and SHOULD<304> set NumberOfSnapShots to zero, NumberOfSnapShotsReturned to zero, and SnapShotArraySize to zero.
If the MaxOutputResponse of the request is less than 16 bytes, the server MUST fail the request with STATUS_INVALID_PARAMETER.
The server MUST calculate the size required to return the SRV_SNAPSHOT_ARRAY structure containing the previous version array.
If the size required in bytes is greater than the MaxOutputResponse received in the SMB2 IOCTL request, the server MUST construct an SRV_SNAPSHOT_ARRAY following the syntax specified in section 18.104.22.168 with NumberOfSnapShots set to the number of previous versions available, NumberOfSnapShotsReturned set to 0, and SnapShotArraySize set to the size, in bytes, required to receive all of the previous version time stamps, and MUST return STATUS_SUCCESS.
If the size required in bytes is less than or equal to MaxOutputResponse, the server MUST construct an SRV_SNAPSHOT_ARRAY with NumberOfSnapShots set to the number of previous versions available, NumberOfSnapShotsReturned set to the number of previous version time stamps being returned in the buffer, and SnapShotArraySize set to the size, in bytes, of the SnapShots buffer, which MUST then be filled in to hold the time stamps in textual GMT format for the previous version time stamps.
CtlCode MUST be set to FSCTL_SRV_ENUMERATE_SNAPSHOTS.
FileId.Persistent MUST be set to Open.DurableFileId. FileId.Volatile MUST be set to Open.FileId.
InputOffset SHOULD be set to the offset, in bytes, from the beginning of the SMB2 header to the Buffer field of the response.
InputCount SHOULD be set to zero.
OutputOffset MUST be set to InputOffset + InputCount, rounded up to a multiple of 8.
OutputCount MUST be set to the size of the SRV_SNAPSHOT_ARRAY that is constructed, as specified above.
Flags MUST be set to zero.
The server MUST copy the constructed SRV_SNAPSHOT_ARRAY into the Buffer field at the OutputOffset computed above.
The response MUST be sent to the client.