Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LoadLibraryW hook to fix DLL loading issues #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

modestimpala
Copy link

This PR adds a hook for the LoadLibraryW function to address issues I've encountered with loading custom DLLs.

  • Adding a static detour for LoadLibraryW
  • Implementing a loadlibraryw_detour function
  • Initializing the new hook in the enable_hooks function

These changes allow the shimloader to intercept and potentially redirect LoadLibraryW calls, which should resolve issues where custom DLLs were not being loaded correctly.

UE4SS uses LoadLibraryW for loading C++ mods. Without this hook, the shimloader was unable to properly intercept and redirect these calls, leading to failures in loading custom DLLs. This implementation is currently the only way I was able to get custom DLLs working correctly with UE4SS in this environment. If there are any other solutions please share.

Testing:

  • Tested with Voices of the Void 0.8e
  • Verified that custom DLLs are now being loaded correctly
  • Checked that other mod files (e.g., Lua scripts) continue to load as expected
  • Mod tested (local import r2modman): r2.zip
  • unreal-shimloader launched with args:

--mod-dir "C:\Users\user\AppData\Roaming\r2modmanPlus-local\VotV\profiles\Default\shimloader\mod" --pak-dir "C:\Users\user\AppData\Roaming\r2modmanPlus-local\VotV\profiles\Default\shimloader\pak" --cfg-dir "C:\Users\user\AppData\Roaming\r2modmanPlus-local\VotV\profiles\Default\shimloader\cfg"

Without LoadLibraryW hook:
365439870-43ca42d4-1d3a-4115-8871-97de648b9009

With LoadLibraryW hook:
image

Related issues: #4

Let me know if you need any additional information or if you'd like me to make any changes to this PR.

@CLAassistant
Copy link

CLAassistant commented Sep 10, 2024

CLA assistant check
All committers have signed the CLA.

@modestimpala
Copy link
Author

Any chance this will get reviewed soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants