3.2.4.4.1.18 IVolumeClient::EnumDriveLetters (Opnum 21)

The EnumDriveLetters method enumerates the server's drive letters, both used and free. For drive letters that are in use, the method returns the mapping between the drive letter and the volume, partition, or logical drive that uses it.

 HRESULT EnumDriveLetters(
   [in, out] unsigned long* driveLetterCount,
   [out, size_is(,*driveLetterCount)] 
     DRIVE_LETTER_INFO** driveLetterList
 );

driveLetterCount: Pointer to the number of elements returned in driveLetterList. This parameter is used only on output.

driveLetterList: Pointer to an array of DRIVE_LETTER_INFO structures. Memory for the array is allocated by the server and freed by the client.

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] section 2.1; 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:

  1. Verify that driveLetterCount and driveLetterList are not NULL.

 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 process the message as follows:

  1. Enumerate all drive letter objects from the list of storage objects.<75>

  2. Allocate a buffer large enough to contain DRIVE_LETTER_INFO structures that describe all enumerated drive letters.

  3. Populate each DRIVE_LETTER_INFO structure in the buffer with information about the drive letter.

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

  5. The number of DRIVE_LETTER_INFO structures in the buffer MUST be returned in the output parameter driveLetterCount.

  6. Return a response that contains the preceding output parameters above and the status of the operation.

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