The FormatEx2 method formats a file system on a volume.

 HRESULT FormatEx2(
   [in, unique, string] LPWSTR pwszFileSystemTypeName,
   [in] USHORT usFileSystemRevision,
   [in] ULONG ulDesiredUnitAllocationSize,
   [in, unique, string] LPWSTR pwszLabel,
   [in] DWORD Options,
   [out] IVdsAsync** ppAsync
 );

pwszFileSystemTypeName: A null-terminated Unicode string that contains the name of the file systems to format the volume with.

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, and the last two (least significant) digits (8 bits) indicate the minor revision. For example, 0x0250 represents revision 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 that is determined by the file system type is used. The allocation unit range is file system-dependent.

pwszLabel: A 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 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 parameter:

The server MUST then 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 perform the following in sequence: