Zbîrnea Tiberiu
Zbîrnea Tiberiu

Reputation: 11

How can I determine if an SSD drive is fixed drive or connected on USB?

Is it possible to determine if an SSD drive is connected on USB or if is fixed disk (connected to motherboard)?

Upvotes: 0

Views: 476

Answers (1)

EylM
EylM

Reputation: 6103

If you are on Windows, you can use GetDriveType.

Sample usage:

UINT nType = GetDriveType(_T("C:\\"))

Return values for nType:

DRIVE_FIXED: The drive has fixed media; for example, a hard disk drive or flash drive.

DRIVE_REMOVABLE: The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.

To check if it's USB drive, you must call for SetupDiGetDeviceRegistryProperty.

You can find a sample code here and here.

Upvotes: 2

Related Questions