The FormatPartitionEx2 method formats an existing OEM, ESP, or unknown partition. This method is only supported on OEM, ESP, recovery, and unknown partitions.

 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.

Note This method is not valid on CD/DVD or super floppy devices. These devices do not support partition tables.

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

The server MUST perform the following:

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.

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:

The server MUST then perform the following in sequence: