Replaced usage of 'SetDefaultDllDirectories' #453
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This was done to fix PalServer not working properly after an update. The usage of 'SetDefaultDllDirectories' was there to allow C++ mods that have dynamic dependencies to store those dependencies right next to main.dll instead of in the Win64 directory.
This behavior remains intact, but we're using 'LoadLibraryEx' instead of 'LoadLibrary' to set the path specifically for main.dll instead of globally with 'SetDefaultDllDirectories'.
See #452 for discussion around this problem.
Fixes #452.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I made a C++ mod and a dependency with at least one export and dynamically linked that dependency with my C++ mod.
I then added both dlls (main.dll & dep.dll) to my UE4SS installation for PalServer.
After that, I launched PalServer and made sure that both my C++ mod and the dependency loaded.
I did this by adding an export in the dependency (global function) that calls printf, and then I checked for that output in the Win32 console after starting PalServer, and it was there.
I then started PalWorld and made sure I could connect to my server.
Checklist