3.4.5.2.25.1 IVdsAdvancedDisk2::ChangePartitionType (Opnum 3)
The ChangePartitionType method changes the partition type on the disk at a specified byte offset.
-
HRESULT ChangePartitionType( [in] ULONGLONG ullOffset, [in] long bForce, [in] CHANGE_PARTITION_TYPE_PARAMETERS* para );
ullOffset: The byte offset of the partition, from the beginning of the disk. This offset MUST be the offset of a start of a partition.
bForce: A Boolean value that indicates whether a change will be forced even if the volume cannot be locked for exclusive access. When bForce is false, ChangePartitionType MUST lock and dismount the volume before changing the partition type. If bForce is true, the volume MUST be dismounted and the change MUST be made even if the locking of the volume fails.
para: A pointer to a CHANGE_PARTITION_TYPE_PARAMETERS structure that contains the partition type that the partition at the location specified by ullOffset is changed to.
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 is not valid for CD/DVD or super floppy devices. These devices do not support partition tables.
ERROR_SUCCESS (0x00000000)
When the server receives this message, it MUST validate the following parameter:
Verify that para is not NULL.
The server MUST perform the following:
Change the partition type following the parameters specified to the method.
If a volume exists on the partition, for each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify method with a VDS_NOTIFICATION structure with the following attributes:
objectType member is VDS_NTT_VOLUME.
Volume member is a VDS_VOLUME_NOTIFICATION with the following attributes:
ulEvent is VDS_NF_VOLUME_MODIFY.
volumeId is the VDS_OBJECT_ID of this volume object.
plexId is NULL GUID, but it is not relevant when ulEvent is VDS_NF_VOLUME_MODIFY.
ulPercentCompleted range is 0-100 and is implementation-specific; however, it is not relevant when ulEvent is VDS_NF_VOLUME_MODIFY.
Return an HRESULT indicating failure or success.
Note If the client changes the partition type from a recognized partition type (a type that indicates the partition will be exposed as a volume) to a nonrecognized partition type, the volume associated with the partition will be removed, and the normal volume removal notifications will be sent. Conversely, if the client changes a partition's partition type from a nonrecognized partition type to a recognized partition type, a new volume object will be created, and the normal notifications associated with volume arrivals will be sent.