Re: How to convert "\Device\HarddiskVolume1\" to "C:\"
- From: "anton bassov" <soviet_bloke@xxxxxxxxxxx>
- Date: 3 Jan 2007 14:03:19 -0800
If you need a generic solution that works in both kernel and user mode,
the whole things can be done like ZwOpenSymbolicLink() -
ZwQuerySymbolicLink() sequence for each drive letter (A;B;C;D,etc. If
the target volume is mounted on a partition of a basic disk, you will
get a string in the form "\Device\HarddiskVolumeX\...". If the target
volume is mounted on a partition of a removable USB disk, you will get
a string in the form "\Device\HarddiskX\DP(1)0-0+b\..." If the target
volume is a network drive, you will get a string in the form
"\Device\LanmanRedirector\ServerX\...". ). In other words, you have no
chance to miss your target string.
If you want a solution that works only in the kernel mode, you can
check IoVolumeDeviceToDosName() (or RtlVolumeDeviceToDosName(), if you
want your code to run on W2K as well ) documentation on MSDN....
Anton Bassov
Mario Beutler wrote:
Hello,
How to convert the following full file names into "normal" file names:
\Device\HarddiskVolume1\windows\system32\lsass.exe
\Device\Harddisk5\DP(1)0-0+b\test.exe
\Device\LanmanRedirector\Server007\TEMP\test.exe
I need the "normal" file names like:
C:\windows\system32\lsass.exe
J:\test.exe (<-This is a USB drive.)
\\Server007\TEMP\test.exe
I tried GetVolumePathNamesForVolumeName,
GetVolumeNameForVolumeMountPoint, GetFullPathName and QueryDosDevice -
but nothing seems to work for all cases (e.g. USB, network shares).
Any ideas? Thanks.
Mario
.
- Follow-Ups:
- Re: How to convert "\Device\HarddiskVolume1\" to "C:\"
- From: Mario Beutler
- Re: How to convert "\Device\HarddiskVolume1\" to "C:\"
- References:
- How to convert "\Device\HarddiskVolume1\" to "C:\"
- From: Mario Beutler
- How to convert "\Device\HarddiskVolume1\" to "C:\"
- Prev by Date: Re: C++ Save state with readprocessmemory
- Next by Date: Re: Generate NT Events
- Previous by thread: How to convert "\Device\HarddiskVolume1\" to "C:\"
- Next by thread: Re: How to convert "\Device\HarddiskVolume1\" to "C:\"
- Index(es):
Relevant Pages
|