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

Load more than one custom dll possible? #76

Closed
jsc-paneda opened this issue Feb 5, 2020 · 5 comments
Closed

Load more than one custom dll possible? #76

jsc-paneda opened this issue Feb 5, 2020 · 5 comments

Comments

@jsc-paneda
Copy link

I have successfully used loadlibrary to load a custom dll and used some of its functions.

However one of the dll functions has a dependency to the GetVersionExA in the kernel32.dll.

So I used 'detours' to create a myhook.dll that replaces this function. This worked fine on Windows. However on Linux side I realized that I pretty much only replaced the kernel32.dll dependency with myhook.dll dependency. And so the issue remains.

If only I could somehow load myhook.dll also? Or is there some other way? Or do I need Wine? Its all a bit of black magic right now..

@cube0x8
Copy link
Collaborator

cube0x8 commented Jan 10, 2021

Umh... I know I am commenting something quite old, but here you can find the hook for the API you need.

So, if your DLL has only that dependency, I guess you should be fine.

@jsc-paneda
Copy link
Author

Yes a bit old, trying to remember myself..but I think the question was meant as a general question regarding possibility to load multiple dll:s, i.e. 'yes' or 'no'. As I recall my conclusion was 'no' and would just like to get confirmation on that.

@cube0x8
Copy link
Collaborator

cube0x8 commented Jan 11, 2021

I am quite sure that the short answer to your question is: no.

i.e. if your .dll calls some of the kernel32.dll APIs, you cannot use loadlibrary to load your .dll along with kernel32.dll to make your dll able to use the exported functions of kernel32.dll.

Anyway, keep in mind that this does not mean you cannot load your dll at all if it calls third-party APIs. You can still load it, using the loadlibrary's hooks.

I hope I explained myself better this time.

@jsc-paneda
Copy link
Author

Understood and as I expected. Thanks, btw I'm using loadlibrary in my app successfully so I'm very pleased with your time and effort to put this together!

@cube0x8
Copy link
Collaborator

cube0x8 commented Oct 26, 2021

This can be considered a duplicate of #101

@cube0x8 cube0x8 closed this as completed Oct 26, 2021
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

No branches or pull requests

2 participants