Description
Describe the bug
Hello, we are using WindowsAppRuntime (indirectly) from an winui3 desktop application. We noticed that the application does not start when calling SetDefaultDllDirectories. I managed to track the issue to this LoadLibraryExW call when calling it with a relative path (dcompi.dll
during my tests)
).
The documentation of LoadLibraryExW states about LOAD_WITH_ALTERED_SEARCH_PATH
that:
If this value is used and lpFileName specifies a relative path, the behavior is undefined.
A minimally reproducible example of the behavior (without the entire winui infrastructure, just for demonstration purposes):
int main()
{
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
HMODULE mod = LoadLibraryExW(L"dcompi.dll", nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
return 0;
}
Steps to reproduce the bug
Run any WindowsAppRuntime app that calls SetDefaultDllDirectories. It should just work.
Expected behavior
No response
Screenshots
No response
NuGet package version
None
Packaging type
No response
Windows version
No response
IDE
Visual Studio 2022
Additional context
No response