3.2.5.1 Receiving an Open Request

If Open.LocalOpen is not NULL, the server MUST look up an Open in OpenTable where Open.LocalOpen matches the Open provided by the SMB2 server, as specified in [MS-SMB2] section 3.3.5.9.12. If an Open is found, the server MUST stop processing the request. If no Open is found, the server MUST fail the request with STATUS_INVALID_HANDLE.

If Open.LocalOpen is NULL, this indicates that the server received a request to open a shared virtual disk file.

If any of the following conditions is TRUE, the server MUST fail the request with STATUS_BUFFER_TOO_SMALL:

  • If the size of the received context is less than the size of the SVHDX_OPEN_DEVICE_CONTEXT structure.

  • If ServerServiceVersion is RSVD Protocol version 2, and the first 4 bytes, interpreted as little-endian, of the received context are equal to 0x00000002, and the size of the received context is less than size of the SVHDX_OPEN_DEVICE_CONTEXT_V2 structure.

If ServerServiceVersion is RSVD Protocol version 1 and if the first 4 bytes, interpreted as little-endian, of the received context is not 0x00000001, the server SHOULD<8> fail the request with STATUS_INVALID_PARAMETER.

If ServerServiceVersion is RSVD Protocol version 2 and if the first 4 bytes, interpreted as little-endian, of the received context are neither 0x00000001 nor 0x00000002, the server MUST fail the request with STATUS_INVALID_PARAMETER.

If HasInitiatorId is neither FALSE (0x00) nor TRUE (0x01), the server MUST fail the request with STATUS_INVALID_PARAMETER.

If the OriginatorFlags field in the request is set to SVHDX_ORIGINATOR_VHDMP, the server MUST search the OpenTable where Open.FileName matches the file name. If an Open is found, the server MUST fail the request with STATUS_VHD_SHARED. Otherwise, the server MUST pass the request to the underlying object store to open the file with read and write access permissions.

If the OriginatorFlags field in the request is not set to SVHDX_ORIGINATOR_VHDMP, the server SHOULD<9> pass the request to the virtual SCSI disk.

If the underlying object store or virtual SCSI disk returns a failure indicating that the attempted open operation failed, the server MUST return the received error code.

If the underlying object store or virtual SCSI disk returns success, the server MUST initialize the Open as follows:

  • Open.LocalOpen is set to the Open of the object in the local resource received as part of the local create operation.

  • If HasInitiatorId is 0x00, Open.InitiatorId is set to zero. Otherwise, it is set to InitiatorId.

  • Open.FileName MUST be set to the application-provided file name.

  • Open.SenseErrorDataList MUST be set to empty.

  • Open.SenseErrorSequence MUST be set to 0x00.

  • Open.IsVirtualSCSIDisk SHOULD<10> be set to TRUE if OriginatorFlags is not set to SVHDX_ORIGINATOR_VHDMP. Otherwise, it MUST be set to FALSE.

  • Open.CreateOptions MUST be set to the CreateOptions received as part of the local create operation.

  • Open.IsVHDSet MUST be set to TRUE if the application-provided file name has the .vhds extension. FALSE otherwise.

  • Open.PendingDelete MUST be set to FALSE.

If ServerServiceVersion is RSVD Protocol version 1 and the first 4 bytes, interpreted as little-endian, of the received context is 0x00000001, the server MUST construct a SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE structure by setting all the fields to their respective values received in the request, and the server SHOULD<11> return the constructed SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE and STATUS_SUCCESS to the client.

If ServerServiceVersion is RSVD Protocol version 2 and the first 4 bytes, interpreted as little-endian, of the received context are equal to 0x00000001, the server MUST construct an SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE structure by setting all the fields to their respective values received in the request and MUST return the constructed SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE and STATUS_SUCCESS to the client.

If ServerServiceVersion is RSVD Protocol version 2 and the first 4 bytes, interpreted as little-endian, of the received context are equal to 0x00000002, the server MUST return the SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE_V2 structure constructed as below and STATUS_SUCCESS to the client:

  • If the virtual SCSI disk returns the VirtualSectorSize, PhysicalSectorSize, and VirtualSize fields, the server MUST construct an SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE_V2 structure as follows:

    • The Version, HasInitiatorId, Reserved, InitiatorId, Flags, OriginatorFlags, OpenRequestId, InitiatorHostNameLength and InitiatorHostName fields are set to the value received in the request context.

    • VirtualDiskPropertiesInitialized is set to TRUE.

    • ServerServiceVersion is set to RSVD Protocol version 2.

    • VirtualSectorSize is set to the value received from the virtual SCSI disk.

    • PhysicalSectorSize is set to the value received from the virtual SCSI disk.

    • VirtualSize is set to the value received from the virtual SCSI disk.

  • Otherwise, the server MUST construct an SVHDX_OPEN_DEVICE_CONTEXT_RESPONSE_V2 structure as follows:

    • The Version, HasInitiatorId, Reserved, InitiatorId, Flags, OriginatorFlags, OpenRequestId, InitiatorHostNameLength, and InitiatorHostName fields are set to the value received in the request context.

    • VirtualDiskPropertiesInitialized is set to FALSE.

    • ServerServiceVersion is set to RSVD Protocol version 2.

    • VirtualSectorSize, PhysicalSectorSize, and VirtualSize are set to zero.

  • If change tracking was previously started on the server, the server MUST issue a start tracking request to the virtual SCSI disk in an implementation-specific manner, after a successful open but before any write requests are processed.

Show: