so, I've been investigating this quite a lot, and think i have an answer.
First, a bit of explanation about what I was seeing!
on server A, there is a share which contains a symbolic link to a share on server B:
\\serverA\Path\To\Folder
and the target of that is
\\serverB\Folder
What was actually happening was, the value returned from FolderBrowserDialog.SelectedPath
was \\serverB\Folder
, and I was mistakenly thinking it was missing parts of the path, because the strings serverA and serverB are very similar! Sorry for misleading everyone.
I created my own wrapper following this MSDN Example and noticed that the Shell32.dll function SHGetPathFromIDList
is returning the Target of the reparse point, despite the fact that the documentation says
If the pidl parameter specifies a shortcut, the pszPath will contain
the path to the shortcut, not to the shortcut's target
I did notice that the path before that is the correct one though, so in my callback method when the status changed, I captured the untranslated selected path
private int FolderBrowserCallback(IntPtr hwnd, int msg, IntPtr lParam, IntPtr lpData)
{
switch (msg)
{
case BrowseForFolderMessages.BffmSelchanged:
if (haveValidPath && !String.IsNullOrEmpty(displayedPath))
{
if (IntPtr.Zero != _hwndEdit)
{
SelectedFullPath = displayedPath;
}
}
So the SelectedFullPath
Property contains \\serverA\Path\To\Folder
and SelectedPath
property contains \\ServerB\Folder
, which leaves me a lot to work with.