当我在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___ …Run Code Online (Sandbox Code Playgroud) 我无法知道如何使用 IOCTL_MOUNTMGR_QUERY_POINTS 。
我在互联网上搜索并找到了一些示例代码来尝试。
但我不确定它是否正确......
您能告诉我如何使用 IOCTL_MOUNTMGR_QUERY_POINTS 来获取驱动器号吗
感谢您的时间
下面是我的源代码
HANDLE hUsbDevice = CreateFile( pDetData->DevicePath,
GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, NULL);
UCHAR Bytes[10000];
PMOUNTMGR_MOUNT_POINTS pMntPoints = (PMOUNTMGR_MOUNT_POINTS) Bytes;
MOUNTMGR_MOUNT_POINT mntPoint, *pmnt;
DWORD bytesReturned;
if (hUsbDevice == INVALID_HANDLE_VALUE) {
qDebug()<<"CreateFile failed with error: %d\n"<<GetLastError();
}
else {
qDebug ()<<"VALID DEVICE";
BOOL status = DeviceIoControl( hUsbDevice,
IOCTL_MOUNTMGR_QUERY_POINTS,
&mntPoint,
sizeof(MOUNTMGR_MOUNT_POINT),
pMntPoints,
10000,
&bytesReturned,
NULL);
wprintf(L"\tBOOL VALUE : %d\n", status);
qDebug ()<<pMntPoints->MountPoints;
}
Run Code Online (Sandbox Code Playgroud)