The EnumDisksEx method enumerates the server's mass storage devices.

 HRESULT EnumDisksEx(
   [out] unsigned long* diskCount,
   [out, size_is(,*diskCount)] DISK_INFO_EX** diskList
 );

diskCount: Pointer to the number of elements in diskList.

diskList: Pointer to an array of DISK_INFO_EX structures.

Return Values: The method MUST return 0 or a nonerror HRESULT on success, or an implementation-specific nonzero error code on failure (as specified in [MS-ERREF]; see also section 2.2.1 for HRESULT values predefined by the Disk Management Remote Protocol).

Upon receiving this message, the server MUST validate parameters:

If parameter validation fails, the server MUST fail the operation immediately, returning an appropriate error as its response to the client.

Otherwise, the server MUST compose a response to the client as follows:

  1. Enumerate all disk objects from the list of storage objects.

  2. Allocate a buffer large enough to contain DISK_INFO_EX structures that describe all enumerated disks.

  3. Populate each DISK_INFO_EX structure in the buffer with information about the disk.

  4. The buffer MUST be returned to the client in the output parameter diskList.

  5. The number of DISK_INFO_EX structures in the buffer MUST be returned in the output parameter diskCount.

  6. Return a response containing the output parameters mentioned previously and the status of the operation.

The server MUST NOT change the list of storage objects as part of processing this message.