3.4.5.2.21.6 IVdsDisk::SetFlags (Opnum 8)

The SetFlags method sets the read-only flag of a disk.<90>

 HRESULT SetFlags(
   [in] unsigned long ulFlags

);

ulFlags: MUST be set to VDS_DF_READ_ONLY.

Return Values: The method MUST return zero or a non-error HRESULT (as specified in [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service Remote Protocol, see section 2.2.3.

Note This method cannot be used against CD/DVD or super floppy devices.

This method MUST return an HRESULT failure for OS boot disk, system disk, pagefile disk, hibernation file disk and crash dump disk.

When the server receives this message, it MUST validate the following parameter:

  • Verify that the ulFlags parameter is VDS_DF_READ_ONLY.

The server MUST perform the following in sequence:

  • Set the read-only attribute of the disk.

  • For each callback object that is registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify (Opnum 3) method by using a VDS_NOTIFICATION structure that has the following attributes:

    • objectType member is VDS_NTT_DISK.

    • Disk member is a VDS_DISK_NOTIFICATION that has the following attributes:

      • ulEvent is VDS_NF_DISK_MODIFY.

      • diskId is the VDS_OBJECT_ID of this disk object.

  • Return an HRESULT indicating failure or success.