Normalize path name API

Posted on 2007-10-21
Medium Priority
Last Modified: 2008-01-09
I'm trying to find an API to normalize a path passed as a parameter, for example:

c:\windows\system32\driver.sys --> \Device\HarddiskVolume2\windows\system32\driver.sys
\\server\path\file.ext --> \Device\LanmanRedirector\server\path\file.ext

Any pointers to a Win32 API to accomplish this would be very helpful.
Question by:jimstar
  • 2
LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 20119309
'QueryDosDevice()' (http://msdn2.microsoft.com/en-us/library/aa365461.aspx) is what you are looking for. See the sample code at http://support.microsoft.com/kb/235128 ("INFO: Understanding Device Names and Symbolic Links")

Author Comment

ID: 20119390
>> See the sample code ...
Thanks, this is what really helped. I had been playing with QueryDosDevice but the docs on MSDN were not the best - the sample code cleared up everything.

Do you happen to know how Internal NT Device Names are assigned?

I'm wondering in what cases the \Device\HarddriveVolume2 would change... for example, whether it would change if another HDD were added, if Volume1 were deleted then perhaps Volume2 would change to be Volume1, etc etc.
LVL 86

Expert Comment

ID: 20120121
>>Do you happen to know how Internal NT Device Names are assigned?

AFAIK the object manager assigns these upon boot. You can be sure that they (except for removable devices) do not change at runtime.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question