Function Reference


_WinAPI_GetDriveNumber

Retrieves a device type, device number, and partition number for the specified drive

#include <WinAPIFiles.au3>
_WinAPI_GetDriveNumber ( $sDrive )

Parameters

$sDrive The drive letter to retrieve information, in the format D:, E:, etc.

Return Value

Success: The array containing the following information:
[0] - The type of device ($FILE_DEVICE_*).
[1] - The device number.
[2] - The partition number, or (-1) if device cannot be partitioned.
Failure: Sets the @error flag to non-zero.

See Also

Search IOCTL_STORAGE_GET_DEVICE_NUMBER in MSDN Library.

Example

#include <WinAPIFiles.au3>

Local $aData, $aDrive = DriveGetDrive('FIXED')
Local $aList[10]

For $i = 0 To UBound($aDrive) - 1
        $aList[$i] = ''
Next
If IsArray($aDrive) Then
        For $i = 1 To $aDrive[0]
                $aData = _WinAPI_GetDriveNumber($aDrive[$i])
                If IsArray($aData) Then
                        $aList[$aData[1]] &= StringUpper($aDrive[$i]) & ' '
                EndIf
        Next
EndIf
For $i = 0 To UBound($aDrive) - 1
        If $aList[$i] Then
                ConsoleWrite('Drive' & $i & ' => ' & $aList[$i] & @CRLF)
        EndIf
Next