How to disable caching often used DLL's

  • Thread starter Thread starter Konstantin Levinsky
  • Start date Start date
K

Konstantin Levinsky

Hello!

I have some difficulties with starting an updated software. I made an update
for some program and this program doesn't want to start properly... By the
way my program shows me that it's used old libraries but I am sure that I
made correct update of my program.
Well, later I found old libraries somewhere inside in \WINDOWS folder. And
they have old version!!! So I made a conclusion that my WindowsXP made some
local copy of libraries used by my program...

Does anybody know how to disable caching often used DLL's in WindowsXP
 
No but how would that help anyway. Luckily you had the rare sense to include your problem rather than just your wrong solution as most do.

In the application's directory create a file with the same name as the program and suffix .local to it. Program.exe needs a file called program.exe.local. It's only the file's name that is important. Copy the dlls you want that program only to use to the same directory and remove them from windows (this is to ensure other programs don't find them by mistake).
 
Hello David Candy" .,

could you please explain what do I need to create .local file for my program
for?
 
Anything - only the name is important and only the name is read. Create a new text file which will be 0 bytes and rename that.

Without .local file this is what happens.

The first program to use the dll will look here in order specified
1.. The directory from which the application loaded.
2.. The current directory.
Windows XP: If HKLM\System\CurrentControlSet\Control\SessionManager\SafeDllSearchMode is 1, the current directory is the last directory searched. The default value is 0.

3.. The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT/2000/XP: The name of this directory is System32.

4.. Windows NT/2000/XP: The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
5.. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6.. The directories that are listed in the PATH environment variable.
If another program now tries to use it it will use the copy in memory

So if XYZ.exe and ABC.exe both use different versions of a dll then loading order matters. So if XYZ uses Ver 2 of MyDll.dll and ABC uses Ver 1, amd both can use Ver 2 because the authors of MyDll.dll made it backwards compatible (as they should if it has the same name). Further the dll is in each program's folder (to make this example easy to follow), If you start ABC first it will workusing ver2, if you start XYZ first it will work using ver1.

If you start XYZ first then ABC both will work as ABC can use Ver 2. If you start ABC first then XYZ, it will error if you try to start it as XYZ can't use version 1.

System dlls have a registry key (one for 32 bit and one for 16 bit programs) that specify the dll must be loaded from system32.

..Local forces a new copy in memory. The bad part of this is it takes more memory.
 
Back
Top