Tech Support > Microsoft Windows > Development Resources > Physical drive name by handle (WinAPI | C++)
Physical drive name by handle (WinAPI | C++)
Posted by CAHEK on April 16th, 2008


Hi all!
Anybody knows how to get physical drive name by it's handle?
Thanks!

Posted by Christian ASTOR on April 16th, 2008


On 16 avr, 16:47, CAHEK <h4cker_...@hotmail.com> wrote:
This has recently been asked...
SetupDiGetDeviceRegistryProperty()

Posted by Uwe Sieber on April 16th, 2008


CAHEK wrote:
STORAGE_DEVICE_NUMBER sdn;
DWORD dwBytesReturned = 0;
DeviceIoControl(hDrive, IOCTL_STORAGE_GET_DEVICE_NUMBER, NULL,
0, &sdn, sizeof(sdn), &dwBytesReturned, NULL);

sprintf(szXXX, "\\\\.\\PHYSICALDRIVE%u", sdn.DeviceNumber);



Greetings from Germany

Uwe


Posted by CAHEK on April 28th, 2008


Thank you for your post!
But i need to retrieve the serial name of my drive and not it's number
anyway ur post was very useful for me coz it's nice method))

Posted by Uwe Sieber on May 2nd, 2008


CAHEK wrote:
It's a bit sophisticated, check out this great demo:
http://www.winsim.com/diskid32/diskid32.html


Uwe


Posted by Christian ASTOR on May 3rd, 2008


Uwe Sieber wrote:
IOCTL_STORAGE_QUERY_PROPERTY and SerialNumberOffset on
"\\\\.\\drive:"
is sufficient.

Posted by Uwe Sieber on May 4th, 2008


Christian ASTOR wrote:
Only at first sight. Most non Microsoft drivers do not
provide the serial at SerialNumberOffset. Therefore
Lynn McGuire uses multiple techniques in his DiskId32
to gather all information.
http://www.winsim.com/diskid32/diskid32.html


Uwe


Posted by David on May 4th, 2008


Uwe Sieber wrote:



For XP and Vista, I never met a signed driver where
IOCTL_STORAGE_QUERY_PROPERTY doesn't work

Posted by Sebastian G. on May 4th, 2008


David wrote:


SerialNumberOffset is an optional field in STORAGE_DEVICE_DESCRIPTOR...

Posted by CAHEK on May 5th, 2008


Hi! Thank u all.
I never worked with this kind of types
can u say me how to put this serial name(SerialNumberOffset) into the
char buffer for exemple


Similar Posts