220.127.116.11.30.1 IVdsDiskPartitionMF2::FormatPartitionEx2 (Opnum 3)
HRESULT FormatPartitionEx2( [in] ULONGLONG ullOffset, [in, unique, string] LPWSTR pwszFileSystemTypeName, [in] unsigned short usFileSystemRevision, [in] unsigned long ulDesiredUnitAllocationSize, [in, unique, string] LPWSTR pwszLabel, [in] DWORD Options, [out] IVdsAsync **ppAsync );
ullOffset: The byte offset of the partition from the beginning of the disk. This MUST be the offset at the start of a partition.
pwszFileSystemTypeName: A null-terminated Unicode string that contains the name of the file system with which to format the partition.
usFileSystemRevision: A 16-bit, binary-coded decimal number that indicates the revision of the file system, if any. The first two (most significant) digits (8-bits) indicate the major revision while the last two (least significant) digits (8-bits) indicate the minor revision (for example, 0x0250 represents version 2.50).
ulDesiredUnitAllocationSize: The size, in bytes, of the allocation unit for the file system. The value MUST be a power of 2. If the value is 0, a default allocation unit determined by the file system type is used. The allocation unit range is file system-dependent.
pwszLabel: The null-terminated Unicode string to assign to the new file system. The maximum label size is file system-dependent.
Options: The combination of any values, by using a bitwise OR operator, that are defined in the VDS_FORMAT_OPTION_FLAGS enumeration.
ppAsync: A pointer to an IVdsAsync interface that, if the operation is successfully completed, receives the IVdsAsync interface pointer to monitor and control this operation. Callers MUST release the interface when they are done with it.
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.
When the server receives this message, it MUST validate the following parameters:
Verify that ppAsync is not NULL.
Verify that the partition at offset ullOffset is an OEM, ESP, recovery, or unknown partition.
The server MUST perform the following:
Create a new async object implementing the IVdsAsync interface with an output type of VDS_ASYNCOUT_FORMAT and set the pointer ppAsync references to the interface.
Return an HRESULT indicating failure or success. Any errors encountered up through this point in processing the FormatPartitionEx2 operation are returned in this HRESULT.
The server MUST perform the following. Errors generated in this sequence of steps are returned in the pHrResult parameter to the IVdsAsync::Wait or IVdsAsyncQueryStatus methods.
If the operating system is unable to format the device with the file system type specified using the type parameter, then this method MUST return VDS_E_INCOMPATIBLE_FILE_SYSTEM.
If the target device\media is write-protected, then this method MUST return VDS_E_MEDIA_WRITE_PROTECTED.
If the pwszLabel parameter is incompatible with the file system type specified using the type parameter, then the server MUST return VDS_E_BAD_LABEL.
If the specified file system type has a minimum volume size requirement and that requirement is not met, then the server MUST return VDS_E_VOLUME_TOO_SMALL.
If the specified file system type has a maximum volume size requirement and that requirement is not met, then the server MUST return VDS_E_VOLUME_TOO_BIG.
If the specified file system type has a minimum or maximum cluster size requirement and that requirement is not met, then the server MUST return VDS_E_CLUSTER_SIZE_TOO_SMALL or VDS_E_CLUSTER_SIZE_TOO_BIG, respectively.
If the specified file system type has a maximum cluster count requirement and that requirement is not met, then the server MUST return VDS_E_CLUSTER_COUNT_BEYOND_32BITS.
The server MUST update the percentage completed value periodically during the following sequence, and send progress notifications to all clients. How often the percentage completed is updated, and at what point in the sequence, is implementation specific. To send progress notifications to the clients:
For each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify (Opnum 3)method with a VDS_NOTIFICATION structure with the following attributes:
objectType member is VDS_NTT_FILE_SYSTEM.
FileSystem member is a VDS_FILE_SYSTEM_NOTIFICATION with the following attributes:
ulEvent is VDS_NF_FILE_SYSTEM_FORMAT_PROGRESS.
volumeId is set to GUID_NULL.
dwPercentCompleted is the percentage completed value.
The server MUST then perform the following in sequence:
Format the partition following the parameters specified to the method.
If VDS_FSOF_COMPRESSION is specified and the file system being formatted supports compression, compress the file system after formatting is complete.<110>
Set the return code in the async object to an HRESULT indicating failure or success.
If the server was required to compress the file system after formatting but could not, the return code MUST be set to VDS_S_VOLUME_COMPRESS_FAILED (HRESULT of 0x00042443).
If the task completed successfully, set the percentage completed value in the async object to 100.
Set the signal state in the async object to TRUE.