Найдите, которому диск соответствует который устройство массового хранения USB в WinXP

Ваш вызов printValue(t); разрезает ваш объект на Descriptor.

Если вы хотите, чтобы это работало, вам нужно определить параметр как Descriptor &t, чтобы функция ссылалась на исходный объект:

void printValue(Descriptor &t) {
    ...
}

Онлайн демонстрационный

9
задан Glorfindel 10 March 2019 в 08:01
поделиться

1 ответ

It's a non-trivial question. There is no official API for it, as far as I can tell. So, you need an undocumented API: the registry. HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices contains entries for both drive letters and volume IDs. If you look at the actual data, you'll find that it identifies the drive. Look at the binary data as a Unicode string. It will point you to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ENUM\. However, XP and Vista differ in exactly what subkeys are referenced there, and how. (Vista is easier, so try that first).

5
ответ дан 4 December 2019 в 22:30
поделиться
Другие вопросы по тегам:

Похожие вопросы: