在 windows7 - 32 位系统上获取有关磁盘驱动器结果的信息
当我在 Windows XP - 32 上运行以下代码时,我得到以下结果。
我只插入了一个 USB 笔式驱动器
On Windows XP - 32 Bit
-----------------------
Drive C:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 1
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive D:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 2
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive E:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 3
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive F:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 4
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive G:
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\00000080
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&2B6971CE&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive G: is removeable
Drive X:
When i run the below code on windows7 - 32 , i get the below result
i have plugged the same usb pen drive which is used on windows xp - 32 bit...
On Windows 7 - 32 Bit
-----------------------
Drive C:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 2
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive C: is removeable
Drive D:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 3
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive D: is removeable
Drive E:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 4
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive E: is removeable
Drive F:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 5
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive F: is removeable
Drive G:
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskHitachi_HDS721616PLA380_________________P22OAB3A
Friendly Name: Hitachi HDS721616PLA380 ATA Device
Physical Device Object Name: \Device\Ide\IdeDeviceP1T0L0-1
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&35CD87E&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_27C08086&R
EV_01\3&2411E6FE&1&FA
DeviceInstanceId: IDE\DISKHITACHI_HDS721616PLA380_________________P22OAB3A\5
&4BE38F&0&0.0.0
Drive G: is removeable
Drive Z:
块引用
---------------------------------------------------------------------------------
请查看这两个结果...
我在两个系统(xp 和 windows7)上插入了相同的 USB 设备,但结果有所不同...
请检查驱动器 G:两个操作系统上的结果...
Drive G: ( On Windows 7 - 32 bit )
-----------------------------------
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskHitachi_HDS721616PLA380_________________P22OAB3A
Friendly Name: Hitachi HDS721616PLA380 ATA Device
Physical Device Object Name: \Device\Ide\IdeDeviceP1T0L0-1
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&35CD87E&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_27C08086&R
EV_01\3&2411E6FE&1&FA
DeviceInstanceId: IDE\DISKHITACHI_HDS721616PLA380_________________P22OAB3A\5
&4BE38F&0&0.0.0
Drive G: is removeable
Drive G: ( On Windows XP - 32 bit )
-----------------------------------
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\00000080
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&2B6971CE&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive G: is removeable
谢谢您需要任何帮助吗
When i run the below code on windows XP - 32 , i get the below result.
i have plugged only one usb pen drive
On Windows XP - 32 Bit
-----------------------
Drive C:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 1
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive D:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 2
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive E:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 3
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive F:
ProductId: ST3160215AS
ProductRevision: 3.AAD
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 4
DevicePath: \\?\ide#diskst3160215as_____________________________3.aad___#5&2
7db0ed4&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskST3160215AS_____________________________3.AAD___
Friendly Name: ST3160215AS
Physical Device Object Name: \Device\Ide\IdeDeviceP2T0L0-5
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&1C1E8A11&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_72671462&R
EV_01\3&11583659&0&FA
DeviceInstanceId: IDE\DISKST3160215AS_____________________________3.AAD___\5
&27DB0ED4&0&0.0.0
Drive G:
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\00000080
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&2B6971CE&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive G: is removeable
Drive X:
When i run the below code on windows7 - 32 , i get the below result
i have plugged the same usb pen drive which is used on windows xp - 32 bit...
On Windows 7 - 32 Bit
-----------------------
Drive C:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 2
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive C: is removeable
Drive D:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 3
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive D: is removeable
Drive E:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 4
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive E: is removeable
Drive F:
ProductId: Hitachi HDS721616PLA380
ProductRevision: P22OAB3A
DeviceType: 7, DeviceNumber: 0, PartitionNumber: 5
DevicePath: \\?\ide#diskhitachi_hds721616pla380_________________p22oab3a#5&4
be38f&0&0.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\0000006f
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&4E31217&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive F: is removeable
Drive G:
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskHitachi_HDS721616PLA380_________________P22OAB3A
Friendly Name: Hitachi HDS721616PLA380 ATA Device
Physical Device Object Name: \Device\Ide\IdeDeviceP1T0L0-1
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&35CD87E&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_27C08086&R
EV_01\3&2411E6FE&1&FA
DeviceInstanceId: IDE\DISKHITACHI_HDS721616PLA380_________________P22OAB3A\5
&4BE38F&0&0.0.0
Drive G: is removeable
Drive Z:
Blockquote
---------------------------------------------------------------------------------
Kindly look at the both the results...
I have plugged a same usb device on both the systems ( xp and windows7 ) but the results varies...
please check the Drive G: results on the both the Os...
Drive G: ( On Windows 7 - 32 bit )
-----------------------------------
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: IDE\DiskHitachi_HDS721616PLA380_________________P22OAB3A
Friendly Name: Hitachi HDS721616PLA380 ATA Device
Physical Device Object Name: \Device\Ide\IdeDeviceP1T0L0-1
Device Description: Disk drive
Parent Device Instance ID: PCIIDE\IDECHANNEL\4&35CD87E&0&0
Parent of Parent Device Instance ID: PCI\VEN_8086&DEV_27C0&SUBSYS_27C08086&R
EV_01\3&2411E6FE&1&FA
DeviceInstanceId: IDE\DISKHITACHI_HDS721616PLA380_________________P22OAB3A\5
&4BE38F&0&0.0.0
Drive G: is removeable
Drive G: ( On Windows XP - 32 bit )
-----------------------------------
VendorId: JetFlash
ProductId: Transcend 2GB
ProductRevision: 8.07
DeviceType: 7, DeviceNumber: 1, PartitionNumber: 1
DevicePath: \\?\usbstor#disk&ven_jetflash&prod_transcend_2gb&rev_8.07#e3o29u
13&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
Class: DiskDrive
Hardware ID: USBSTOR\DiskJetFlashTranscend_2GB___8.07
Friendly Name: JetFlash Transcend 2GB USB Device
Physical Device Object Name: \Device\00000080
Device Description: Disk drive
Parent Device Instance ID: USB\VID_058F&PID_6387\E3O29U13
Parent of Parent Device Instance ID: USB\ROOT_HUB20\4&2B6971CE&0
DeviceInstanceId: USBSTOR\DISK&VEN_JETFLASH&PROD_TRANSCEND_2GB&REV_8.07\E3O2
9U13&0
Drive G: is removeable
Thank you for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我用 C 编写了一个程序,演示了如何接收您需要的信息。
该程序可以在不安装 Windows DDK 的情况下编译(仅需要 Windows SDK,例如与 Visual Studio 一起安装)。该程序产生如下输出:
因为我们只对可通过驱动器号访问的设备感兴趣,所以程序首先根据
GetLogicalDriveStrings
函数枚举系统中的所有逻辑驱动器。对于每个驱动器,我们都可以使用IOCTL_STORAGE_QUERY_PROPERTY
来获取VendorId
、ProductId
和ProductRevision
等信息。使用IOCTL_STORAGE_GET_DEVICE_NUMBER
允许我们获取驱动器类型(例如 CD/DVD 或磁盘/软盘)。另外两个数字:DeviceType
和DeviceNumber
在系统中是唯一的,我们可以使用它们作为基础来微调设备实例(使用SetupDi
-功能)的驱动器。由于软盘和磁盘设备具有相同的设备类型
FILE_DEVICE_DISK
,我演示了另一个带有FileFsDeviceInformation
参数的函数NtQueryVolumeInformationFile
,以获得如此命名的特性。该特性是从其他磁盘指定软盘并为设备枚举选择相应的类和接口 GUID(GUID_DEVINTERFACE_FLOPPY
或GUID_DEVINTERFACE_DISK
)的最佳方法。我们获取根据SetupDi
API 枚举的所有设备的 DeviceType 和 DeviceNumber。通过这种方式,我们可以找出哪个设备具有哪个驱动器号。更重要的一件事是设备的层次结构:父/子关系。为了演示这一点,我在代码示例中使用了 CM_Get_Parent 和 CM_Get_Device_ID 函数。这样我们就可以看到哪个USB设备有哪个存储设备作为子设备。
我显示了有关找到的设备的一些信息。您可以将示例中的 API 与
IOCTL_MOUNTMGR_QUERY_POINTS
结合使用(请参阅使用 IOCTL_MOUNTMGR_QUERY_POINTS a>) 或FindFirstVolumeW
、FindNextVolumeW
和GetVolumePathNamesForVolumeNameW
(请参阅 http://msdn.microsoft.com/en-us/library/cc542456(VS.85).aspx) 接收更多信息如果需要的话,提供详细信息。更新:顺便说一下,
IOCTL_STORAGE_QUERY_PROPERTY
返回的缓冲区还有另一个字段,例如STORAGE_BUS_TYPE BusType
(BusTypeUsb
,BusTypeFibre
、BusTypeSd
等)等。您还可以使用IOCTL_STORAGE_QUERY_PROPERTY
询问其他信息,例如StorageDeviceUniqueIdProperty
或StorageDeviceUniqueIdProperty< /code> 等。如果您想了解更多 USB 特定信息,我建议您 http:// /www.emmet-gray.com/Articles/USB_SerialNumbers.htm,其中显示了
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX
、IOCTL_USB_GET_NODE_INFORMATION
和IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION
的用法。更新2:我将程序的扩展版本放在http下://www.ok-soft-gmbh.com/ForStackOverflow/EnumMassStorage.c,因为 stackoverflow.com 中消息大小的限制。测试输出如下所示 http://www.ok-soft-gmbh.com /ForStackOverflow/EnumMassStorage.txt
更新3:我发现了一个错误并更新了代码。请使用最新版本的代码并验证您的问题是否已解决。
I wrote a program in C which demonstrate how to receive the information which you need
The program can be compiled without Windows DDK installed (only Windows SDK, which installed for example together with Visual Studio is required). The program produces output like following:
Because we are interesting for only devices which are accessible through drive letters the program start with enumerating of all logical drives in the system with respect of
GetLogicalDriveStrings
function. For every drive we can useIOCTL_STORAGE_QUERY_PROPERTY
to get information likeVendorId
,ProductId
andProductRevision
. The usage ofIOCTL_STORAGE_GET_DEVICE_NUMBER
allow us to get the drive type (like CD/DVD or Disk/Floppy). Moreover two numbers:DeviceType
andDeviceNumber
are unique in the system and we can use these as the basis to fine the device instance (usingSetupDi
- functions) for the drive.Because Floppy and Disk devices has the same defice type
FILE_DEVICE_DISK
I demonstrate another functionNtQueryVolumeInformationFile
withFileFsDeviceInformation
parameter to get so named Characteristics for the device. The characteristic is the best way to destinguisch floppy from other disks and choose the corresponding class and interface GUID for the device enumeration (GUID_DEVINTERFACE_FLOPPY
orGUID_DEVINTERFACE_DISK
). We get the DeviceType and DeviceNumber for all devices enumerated with respect ofSetupDi
API. In the way we find out which device has which drive letter.One more important thing is the hierarchy of devices: parent/child relationship. To demonstrate this I use
CM_Get_Parent
andCM_Get_Device_ID
functions in the code example. So we can see which USB device has which storage divice as the child.I displayed some information about the found devices. You can combine API from the example with
IOCTL_MOUNTMGR_QUERY_POINTS
(see Using IOCTL_MOUNTMGR_QUERY_POINTS) orFindFirstVolumeW
,FindNextVolumeW
andGetVolumePathNamesForVolumeNameW
(see http://msdn.microsoft.com/en-us/library/cc542456(VS.85).aspx) to receive more detailed information if needed.UPDATED: By the way the buffer returned by
IOCTL_STORAGE_QUERY_PROPERTY
has another fields likeSTORAGE_BUS_TYPE BusType
(BusTypeUsb
,BusTypeFibre
,BusTypeSd
etc.) etc. You can also useIOCTL_STORAGE_QUERY_PROPERTY
to ask another information likeStorageDeviceUniqueIdProperty
orStorageDeviceUniqueIdProperty
etc. If you want to have more USB specific information, I recommend you http://www.emmet-gray.com/Articles/USB_SerialNumbers.htm which shows the usage ofIOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX
,IOCTL_USB_GET_NODE_INFORMATION
andIOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION
.UPDATED 2: I placed the extended version of program under http://www.ok-soft-gmbh.com/ForStackOverflow/EnumMassStorage.c because of restriction with the message size in stackoverflow.com. The test output looks like folowing http://www.ok-soft-gmbh.com/ForStackOverflow/EnumMassStorage.txt
UPDATED 3: I found a bug and updated the code. Please use the latest version of the code and verify that your problem is solved.