My need is simple. Given a Windows directory path all I want is the actual path. I am sure the terminology is wrong, so I am giving an example.
Given C:\Documents and Settings\All Users the method should display:
- C:\ProgramData on windows 7
- C:\Documents and Settings\All Users on windows 2003
This is because on windows 7 C:\Documents and Settings is a junction referencing C:\Users and C:\Users\All Users is yet another junction referencing C:\ProgramData, which is the actual directory.
So, my question is what .NET API lets me do all this?
Thanks.
Check out this code sample from someone who has figured it out already.
Essentially, you have to use the Win32 function DeviceIoControl via P/Invoke passing the
FSCTL_GET_REPARSE_POINT
as thedwIoControlCode
parameter.As the guy on CodeProject says...
There is no "native" .NET API to do this, but bear in mind that much of the framework is just a wrapper around P/Invoke calls anyway, so you shouldn't fear them :)