January 15, 2016

How to organize exe and dll files - solution by Windows Registry

How to organize dlls?
We require 3 things:
1. not to mess up environment variable PATH
2. not to have 4747 dlls by each .exe file
3. not to have same dll more than once

Requirement:
1. you really want to run your exe and not a script which run your exe due to debugging or other issues

How to do that?

Open Registry editor (i.e. regedit.exe)

If your program name is SomethingToExecute.exe, and his Path is
D:/Path/To/My/Program/SomethingToExecute.exe

then add subkey

HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/
App Paths/SomethingToExecute.exe

and as (Default) key add value D:/Path/To/My/Program/SomethingToExecute.exe

(Be careful subkey and exe file has identical name)

Then add key Path with value of type REG_SZ , which will be string containing paths to directories with your dlls separated by ";".

For more information read

https://helgeklein.com/blog/2010/08/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/

or for more exhaustive manual

https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

This procedure can be taken also by your installer.
One more advantage - you can run you application simply pressing Win+R and writing SomethingToExecute

No comments:

Post a Comment