"PATH SYNTAX BAD" error when loading a dependent DLL of a Windows 7 application on a UNC path

Applies to: Windows 7 Enterprise


Consider the following scenario:
  • You have an application that loads a DLL that has a dependency on a second DLL. 
  • You run the application on a Windows 7-based computer.
  • Your current working directory is a UNC path.
 In this scenario, the dependent DLL fails to load, and a "PATH SYNTAX BAD" error is generated.


This issue occurs because, when the application searches the UNC path for the dependent DLL, the path for the current directory and the first path element are combined incorrectly.  

The following is an example of a path that is combined incorrectly:
\\Client\;U:000000003129b4db\FolderA\SubfolderA\ "c:\testing\FolderB\SubfolderB"\dlxapi64.dll  


To resolve this issue, remove the quotation marks from the first entry of the path statement. 

In previously mentioned example path, you would remove the quotation marks from the  "c:\testing\FolderB\SubfolderB string.