C$CHDIR Returns UNC Path Rather Than Drive Letter On Windows 8



The Windows 8 PC has a Y: drive mapped to a shared folder on the server. When calling C$CHDIR with a blank parameter it returns the current directory.  If the current directory is Y:\DATA it returns the UNC name instead, \\SERVER\SHARE\DATA.  On Windows 7 and earlier it returns Y:\DATA.


It turns out that the application is launched from a shortcut using "Run as administrator".  Under the hood the C$CHDIR library routine calls Microsoft's Win32 API function GetCurrentDirectory().  Unfortunately, Microsoft changed how this function works on Windows 8 (and newer), so that when "Run as Administrator" it returns the UNC path, and not the drive letter path.  As such Micro Focus Development has marked this issue as a permanent restriction.  On Windows 8, and newer, calling C$CHDIR will return the UNC path when using "Run as administrator".

Comment List
Related Discussions