3

In Windows, what is the preference of how Windows looks through these folders to find .dlls? For example, if I have two versions of the same dll, one in the System 32 folder and one on the System Path, where does Windows look first?

4 Answers 4

2

Windows first searches for "known DLLs", such as Kernel32.dll and User32.dll.

Windows then searches for the DLLs in the following sequence:

The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.

The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.

The directory where the executable module for the current process is located.

The current directory.

The directories listed in the PATH environment variable.

Note that under 64 bit windows 32 bit processes use the 32 bit system32 directory- not the 64 bit one.

It's slightly different pre sp1 of 2k3 or XP.

0

Depends on your PATH environment variable, but usually %windir%\System32 is added before %windir%.

Wearing my developer hat: wherever possible I'd avoid installing anything to either of these folders, especially for recent OS versions with side-by-side assembly support (e.g. XP/Vista/2008).

If you've installed an application that's put a .DLL in both places then I'd contact the developer to fix it.

1
  • And @chickeninabiscuit is right too :-)
    – devstuff
    Jul 10, 2009 at 0:40
0

Have a bang on this:

http://msdn.microsoft.com/en-us/library/7d83bc18(VS.80).aspx

Note the "Order has changed!" comment that references this page:

http://msdn.microsoft.com/en-us/library/ms972822.aspx

0

DLL loading is handled by the Windows API LoadLibrary function and the search order is described in the documentation for that: http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .