So when you work with Windows NT services, you might want to make sure the right DLLs are loaded at the proper time. When debugging issues on NT service startup time, this becomes important. On Windows, the order of DLL loading is as follows (see also Visual C++'s help on LoadLibrary()):
- The directories listed in the App Path registry key (if any)
- The directory where the executable module for the current process is located.
- The current directory.
- 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 directories listed in the PATH environment variable.
KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\test.exeto the full path of your executable, for example:
C:\Program Files\Test\test.exe
Add a sub-key named Path, set it's value to the full path of the DLL, for example:
C:\Program Files\Test\lib
Use regedit see examples of other applications, and how they setup their App Path keys.
No comments:
Post a Comment