Windows library search order (EXE/DLL/module) (via “The Old New Thing”) and max PATH length
Posted by jpluimers on 2013/08/27
From The Old New Thing:
Recall that the library search path searches directories in the following order:
- The directory containing the application EXE.
- The system32 directory.
- The system directory.
- The Windows directory.
- The current directory.
- The PATH.
Note that the PATH environment variable has a limited length, which can be impacted by the installation programs you use and the Windows versions you use.
To be on the safe side, use 1024 or 1920.
I found various limitations:
- What is the maximum length of an environment variable? – The Old New Thing – Site Home – MSDN Blogs.
- On Windows Server 2003, if the PATH gets longer than 1920 characters, then system PATH and user PATH are not concatenated any more.
- The latest Windows XP and Windows Server 2003 technically for 2048 characters if you have at least Service Pack 2 installed.
But when your latest update is before mid september 2005, the limit was 1024.
A hotfix is available to circumvent the 1024 limit.
–jeroen
Leave a Reply