3.3.5.15.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:
If the MaxOutputResponse of the request is less than 16 bytes, the server MUST fail the request with STATUS_INVALID_PARAMETER.
The server SHOULD<379> refresh the snapshot list by querying the timestamps of available previous versions of the share. The server MUST construct Share.SnapshotList so that the list contains only the snapshots that are active.
The server MUST calculate the size required to return the SRV_SNAPSHOT_ARRAY structure containing the previous version array based on the number of previous versions of the file available in the listed snapshots in Share.SnapshotList as constructed in the previous paragraph.
If there are no previous versions of the file available or 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 structure following the syntax specified in section 2.2.32.2, with the following values:
NumberOfSnapShots MUST be set to the number of previous versions of the file available in the listed snapshots in Share.SnapshotList.
NumberOfSnapShotsReturned MUST be set to 0.
SnapShotArraySize SHOULD<380> be set to the size, in bytes, required to receive all of the previous version timestamps of the file listed in Share.SnapshotList.
Otherwise, the server MUST construct an SRV_SNAPSHOT_ARRAY structure following the syntax specified in section 2.2.32.2, with the following values:
NumberOfSnapShots MUST be set to the number of previous versions of the file available in the listed snapshots in Share.SnapshotList.
NumberOfSnapShotsReturned MUST be set to the number of previous version timestamps being returned in the SnapShots array.
SnapShotArraySize MUST be set to the size, in bytes, of the SnapShots array.
The SnapShots array MUST list the time stamps in textual GMT format for all of the previous version timestamps listed in Share.SnapshotList, as specified in section 2.2.32.2.
The server MUST then construct an SMB2 IOCTL response following the syntax specified in section 2.2.32, with the following values:
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.