Module Search Path
Previous Top Next

The Module Search Path menu appears when you right-click on a file in your project which is a DLL, OCX, or EXE.

clip0273

When right-clicking on EXE or DLL added to your Thinstall project, a new submenu appears that is not present for normal files. This submenu allows you to control the search path order used to locate an EXE or DLL to load. The search path is used when no file path is specified for functions such as LoadLibrary, CreateProcess, ShellExecute, and SearchPath.

· Always load this EXE/DLL/OCX
When this option is selected, Thinstall will always load this EXE/DLL when no path is specified by the application. This allows you to load DLLs from virtual subdirectories, without needing to modify the PATH environment variable. This option also allows your DLLs to be loaded instead c:\windows\system32, which is not normally possible by setting the PATH variable because of the search order described below.

· Load if system search fails
This option will load the internally bundled EXE/DLL if the normal system search fails to locate a match. This option can be used if you want to use the system DLL when available, but provide a backup option if it is not available. In this case, all paths are ignored and only the filename is used for a match.

· Use normal EXE/DLL/OCX Search Order
Thinstall will search for the DLL using the normal system search path. The internal and external file systems are consulted simultaneously and if two DLLs with the same name exists internally and externally then the Read Order option is consulted to determine which to use. The normal system search order is:


1. The directory specified in the DLL load request.
2. The directory where the EXE is located (i.e. %InstallPath%)
3. The current directory
4. The System Directory (usually c:\windows\system32)
5. The 16 bit system directory (usually c:\windows\system)
6. The Windows directory (usually c:\windows)
7. All directories included in the PATH Environment Variable.

Advanced Options

· Load Dll when requested
Thinstall will load the DLL in question when a request is made by the applicaiton. This is default behavior.

· Force load before EXE starts
When this option is selected, the DLL in question will be loaded before your program starts. This allows you to "inject" the DLL into the process, even though the process may never load the DLL. The Dll can preform actions in its DllMain that preform operations before the EXE starts. Some examples uses:
- Use to run License checking before the EXE starts, call ExitProcess to abort execution if the user is not permitted.
- Use to start a thread in your DLL that monitors/modifies the application. For example, it could wait for the application to create a window with with a specific windows title and force this window to become hidden, thus removing advertisements.