Ваш вызов printValue(t);
разрезает ваш объект на Descriptor
.
Если вы хотите, чтобы это работало, вам нужно определить параметр как Descriptor &t
, чтобы функция ссылалась на исходный объект:
void printValue(Descriptor &t) {
...
}
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).