问题
If you call LoadLibrary
without a path (e.g., LoadLibrary("whatever.dll")
, Windows will generally follow its standard search algorithm, the same one it uses to find EXEs.
My question is this: suppose that an application manifest specifies specifies a particular version of a system DLL, say, comctl32.dll 6.0. In that case, will LoadLibrary("comctl32.dll")
go immediately to the correct side-by-side folder, or does it still perform some kind of search?
回答1:
From Microsoft:
Applications can control the location from which a DLL is loaded by specifying a full path, using DLL redirection, or by using a manifest. If none of these methods are used, the system searches for the DLL at load time as described in this topic.
So yes, if a manifest is present, it will directly go to the SxS folder.
回答2:
To probe the loader when having troubles with missing libraries, you can use the "sxstrace" feature. www.codeproject.com/KB/DLL/QueryAssemblyIdentities.aspx gives some details about the dependencies between manifest and WinSxs.
来源:https://stackoverflow.com/questions/154281/windows-path-searching-in-loadlibrary-with-manifest