In the Microsoft documention the dll loading order is defined under the following link
https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order
If SafeDllSearchMode is disabled, the search order is as follows:
I don't understand the difference between
Let's say the application is installed in %programfiles% and I have a shortcut on the desktop to start it. In that scenario what is "The directory from which the application loaded."? The current directory must be the dektop, right?
Any clarification is greatly appreciated.
The comments basically answer your question, but let me answer it directly, and then provide examples.
The "directory from which the application loaded" is the directory that contains the .exe for the application. Note that the location of a shortcut doesn't affect this--the shortcut just points to the location of the .exe.
The "current directory" is, as @ErykSun mentioned, the process's working directory; it can change as the process runs (the developer can make a call to SetCurrentDirectory). The process's working directory will often start simply as the directory containing the .exe though.
However, a shortcut can modify the initial working directory to be a directory other than that containing the .exe, using the shortcut property "Start in".
Here's an example:
Or a simpler situation:
Services
One common example of when these two directories are different is with services. A service that runs under the SYSTEM account will generally start the process from the "C:\Windows\System32" directory, while the application executable will generally reside in some other directory, e.g. within "C:\Program Files".