You should check for errors...
Delphi-Quellcode:
hVolume := FindFirstVolumeW(VolumeName, CharCount);
if hVolume = INVALID_HANDLE_VALUE then
...
As far as I recall GetDriveType should return the type for non mounted volumes as well, does my ChDrvLetter program show it? If so then GetDriveType works
(if you run ChrDrvLetter without parameters it will just dump all volumes, this is the example output on my pc
Delphi-Quellcode:
c:\Users\rweijnen\Documents\Delphi\OldProjects\ChDrvLetter>ChDrvLetter.exe
ChDrvLetter v1.4 (c) Copyright 2008 by Remko Weijnen ([
url]www.remkoweijnen.nl[/
url])
Assigned Letters: [CDY]
Volume 0
Letter: C:\
Label : SEVEN
Device: \Device\HarddiskVolume1
Name : \\?\Volume
{445041c9-9f61-11de-87fd-806e6f6e6963}\
Type : DRIVE_FIXED
Volume 1
Letter: D:\
Label : MFD2_UNLOCK
Device: \Device\CdRom0
Name : \\?\Volume
{445041cd-9f61-11de-87fd-806e6f6e6963}\
Type : DRIVE_CDROM
Volume 2
Letter: Y:\
Label : dvd2_eur_2010_vx v7
Device: \Device\CdRom1
Name : \\?\Volume
{f097e2b2-9fcc-11de-8c17-001e3799c3f7}\
Type : DRIVE_CDROM