3.1.6.4 File Is Moved by the Local Machine from Remote Machine to Remote Machine

This section specifies the following two procedures for moving a file by the local machine:

  1. From one remote machine to another remote machine.

  2. From one volume on a remote machine to another volume on the same remote machine.

Examples of these procedures are described in FSCTLs (section 4.2).

If the source MachineID and target MachineID are different, the following procedure SHOULD<20> be followed:<21>

  • The FileID of the source file MUST be obtained by sending two FSCTL_GET_OBJECT_ID requests for the source file. If either request fails, no further processing is performed. The source file is not considered to have an ObjectID, and as specified earlier, only files with ObjectIDs are processed.

  • If this step is successful, the VolumeID of the target file's volume MUST be retrieved by sending a request for an instance of the FileFsObjectIdInformation class, as specified in [MS-FSCC] section 2.5.6, and by interpreting the ObjectId field of the returned FILE_FS_OBJECTID_INFORMATION structure as the VolumeID. If the connection to the remote machine is using the [MS-SMB] protocol, this request MUST be sent by specifying FileFsObjectIdInformation as the InformationLevel of a TRANS2_QUERY_FS_INFORMATION request, specified in [MS-SMB] section 2.2.6.3.1. Otherwise, the connection to the remote machine is using the [MS-SMB2] protocol, and this request MUST be sent by specifying FileFsObjectidInformation as the FileInfoClass of an SMB2_QUERY_INFO request, specified in [MS-SMB2] section 2.2.37.<22>

  • If that step is successful, the ObjectID and FileID of the target file MUST be determined by sending an FSCTL_CREATE_OR_GET_OBJECT_ID request for the target file.

  • If that step is successful, the source machine MUST be notified of the move by sending an FSCTL_LMR_SET_LINK_TRACKING_INFORMATION request for the source file. In this request, the TargetFileObject data element MUST be set to zero. For the TargetLinkTrackingInformation data element, the format for a TargetLinkTrackingInformationLength greater than or equal to 36 MUST be used, the Type field MUST be set to zero, the VolumeID field MUST be set as the VolumeID of the target file, the ObjectID field MUST be set as the ObjectID of the target file, and the NetBIOSName field MUST be set as the MachineID of the target machine. For the NetBIOSName field, if the MachineID ends with more than one zero byte, it MUST be truncated such that only one zero byte is included in the value.

  • If that step is successful, an FSCTL_SET_OBJECT_ID_EXTENDED request MUST be sent for the target file with the FileID set to be that of the source file and with the CrossVolumeMoveFlag value set to 1.

If the source MachineID and target MachineID are the same, but the source and destination volumes are different, the following procedure SHOULD be followed:

  • The FileID of the source file SHOULD be obtained by sending an FSCTL_GET_OBJECT_ID request for the source file.<23>

  • If the preceding step is successful, the source machine MUST be notified of the move by sending an FSCTL_LMR_SET_LINK_TRACKING_INFORMATION request for the source file. In this request, the TargetFileObject data element MUST be set to be the Fid of the open target file if the connection to the remote machine is using the [MS-SMB] protocol (see [MS-FSCC] section 2.3.37.1), or set to zero otherwise (see [MS-FSCC] section 2.3.37.2)<24> (Note that in this latter case, because zero is passed as the TargetFileObject, the source machine will treat this notification as that of a move by a remote machine from the local machine to another machine, as described in section 3.1.4.2.)

    For the TargetLinkTrackingInformation data element, the format for a TargetLinkTrackingInformationLength less than 36 MUST be used (consequently, the Type, VolumeId, and ObjectId fields are not sent). The NetBIOSName field MUST be set to the MachineID of the remote machine. If that MachineID value ends with more than one zero byte, it MUST be truncated such that only one zero byte is included in the value. See section 3.1.4.2 for more information on this request.