阅读:1557回复:5
判断是否是U盘
我使用SetupDi的函数得到所有的Disk类设备的读写handle:DiskClassGuid = {0x53f56307L, 0xb6bf, 0x11d0, {0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b}},请问一下如何区别是硬盘还是U盘?
能通过该handle获得U盘的vid和pid吗? 高分求救! |
|
最新喜欢:![]() |
沙发#
发布于:2005-01-17 17:40
你用的好像是设备接口GUID(GUID_DEVINTERFACE_DISK),你可以用设备类GUID(GUID_DEVCLASS_DISKDRIVE)。
对于一个磁盘设备用SetupDiGetDeviceRegistryProperty + SPDRP_ENUMERATOR_NAME来获得该设备的Enum属性,如果为USB存储设备,则该属性应该为USBSTOR。 [编辑 - 1/17/05 by fslife] |
|
|
板凳#
发布于:2005-01-17 18:01
不太明白
|
|
地板#
发布于:2005-02-21 14:28
直接getdrivetype就可以了啊!
The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive. UINT GetDriveType( LPCTSTR lpRootPathName // pointer to root path ); Parameters lpRootPathName Pointer to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory. Return Values The return value specifies the type of drive. It can be one of the following values: Value Meaning DRIVE_UNKNOWN The drive type cannot be determined. DRIVE_NO_ROOT_DIR The root directory does not exist. DRIVE_REMOVABLE The disk can be removed from the drive. DRIVE_FIXED The disk cannot be removed from the drive. DRIVE_REMOTE The drive is a remote (network) drive. DRIVE_CDROM The drive is a CD-ROM drive. DRIVE_RAMDISK The drive is a RAM disk. |
|
地下室#
发布于:2005-02-21 14:35
直接getdrivetype就可以了啊! DRIVE_REMOVABLE用来判断,好象不够吧?? |
|
|
5楼#
发布于:2005-02-21 15:04
IoGetDeviceProperty行不行
|
|
|