3.3.5.7 Receiving an SMB_COM_CLOSE Request
Upon receipt of an SMB_COM_CLOSE Request (section 2.2.4.5.1), the server MUST confirm that the supplied FID is valid and that it represents a file system object held open by the client. This is done by looking up the FID in Server.Connection.FileOpenTable to find the corresponding Open.
If the Open is not found, the FID is not valid, and the server MUST return an error response to the client with a Status of STATUS_INVALID_HANDLE (ERRDOS/ERRbadfid). The server SHOULD<249> update the last modification time for the file if the value of the SMB_Parameters.Word.LastTimeModified field is neither 0x00000000 nor 0xFFFFFFFF, and the client has write/append access to the file. Then the server MUST decrease Open.TreeConnect.OpenCount and Server.Statistics.sts0_fopens by 1, release the OpLocks by closing the Open indicated by the FID,<250> release every lock in Server.Open.Locks,<251> and invalidate the FID by removing the Open entry from Server.Connection.FileOpenTable. The server MUST provide Open.FileGlobalId as an input parameter and MUST deregister the Open by invoking the Server Deregisters an Open event ([MS-SRVS] section 3.1.6.5).
Once the FID has been invalidated, it is available to be reused by future open or create operations.
The response MUST be sent to the client as specified in section 3.3.4.1.