I need to know which is the real path of a given path.
For example:
The real path is: d:\\src\\File.txt
And the user give me: D:\\src\\file.txt
I nee
The way to get the actual path of a file (this won't work for folders) is to follow these steps:
CreateFileMapping to create a mapping for the file.GetMappedFileName to get the name of the file.QueryDosDevice to convert it to an MS-DOS-style path name.If you feel like writing a more robust program that also works with directories (but with more pain and a few undocumented features), follow these steps:
CreateFile or NtOpenFile.NtQueryObject to get the full path name.NtQueryInformationFile with FileNameInformation to get the volume-relative path.\Device\HarddiskVolume1\Hello.txt for the first path and \Hello.txt for the second, you now know the volume's path is \Device\HarddiskVolume1.QueryDosDevice to convert substitute the volume portion of the full NT-style path with the drive letter.Now you have the real path of the file.