Function Reference


_WinAPI_GetDriveBusType

Retrieves a bus type for the specified drive

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

Parameters

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

Return Value

Success: The bus type constant ($DRIVE_BUS_TYPE_*).
Failure: (-1) and sets the @error flag to non-zero.

Remarks

$DRIVE_BUS_TYPE_* constants require #include <APIFilesConstants.au3>

This function works with the Plug and Play drivers only.

See Also

Search IOCTL_STORAGE_QUERY_PROPERTY in MSDN Library.

Example

#include <APIFilesConstants.au3>
#include <WinAPIFiles.au3>

Local $iBus, $sText, $aDrive = DriveGetDrive('ALL')
For $i = 1 To $aDrive[0]
        $iBus = _WinAPI_GetDriveBusType($aDrive[$i])
        Switch $iBus
                Case $DRIVE_BUS_TYPE_UNKNOWN
                        $sText = 'UNKNOWN'
                Case $DRIVE_BUS_TYPE_SCSI
                        $sText = 'SCSI'
                Case $DRIVE_BUS_TYPE_ATAPI
                        $sText = 'ATAPI'
                Case $DRIVE_BUS_TYPE_ATA
                        $sText = 'ATA'
                Case $DRIVE_BUS_TYPE_1394
                        $sText = '1394'
                Case $DRIVE_BUS_TYPE_SSA
                        $sText = 'SSA'
                Case $DRIVE_BUS_TYPE_FIBRE
                        $sText = 'FIBRE'
                Case $DRIVE_BUS_TYPE_USB
                        $sText = 'USB'
                Case $DRIVE_BUS_TYPE_RAID
                        $sText = 'RAID'
                Case $DRIVE_BUS_TYPE_ISCSI
                        $sText = 'ISCSI'
                Case $DRIVE_BUS_TYPE_SAS
                        $sText = 'SAS'
                Case $DRIVE_BUS_TYPE_SATA
                        $sText = 'SATA'
                Case $DRIVE_BUS_TYPE_SD
                        $sText = 'SD'
                Case $DRIVE_BUS_TYPE_MMC
                        $sText = 'MMC'
        EndSwitch
        ConsoleWrite(StringUpper($aDrive[$i]) & ' => ' & $sText & @CRLF)
Next