-
Notifications
You must be signed in to change notification settings - Fork 62
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
[Help] wonder how luv_renamed.c implement #97
Comments
ping @rjemanuele |
Hi, Yes, that is what luv_renamed.c does. It uses a Microsoft concept called Delay Loaded DLLs. Since our extensions that are DLLs are built against the exports from luvi.exe, those DLLs look for luvi.exe for their unresolved symbols. Since luvi.exe can be renamed and packaged with an appended zip file to contain the lua code and DLLs it may not be able to find luvi.exe. Using the delay loading hooks, tell the operating system loading the DLLs what to do. In our case we catch the lookup of symbols from luvi.exe and redirect it to the current executable. The delay loading failure hook needs to be in the DLL. In our case, we require some DLL library, that DLL loads, it has other symbols to resolve (including from our luvi.exe), the failure hook makes that redirection. You may need to build your DLL in a certain way, without more information I cannot be sure. How we build extension DLLs is like this: https://github.com/virgo-agent-toolkit/lua-sigar/blob/master/CMakeLists.txt |
Thank you for explaining! I wonder there is a way to redirect dll's dependency without modify dll. e.g. I have a foo.dll, it depends bar.dll, when I load foo.dll, I make foo.dll do not load bar.dll, but use process handler (GetModuleHandle(NULL)) to resolve symbols. Is that possible? |
I believe you can look up each symbol you need thought GetModuleHandle(NULL), just seems like more work. |
Hi,
luv_renamed.c used to redirect dll's that linked with 'luvi.exe' to load symbols from current process, right?
I just want the same tech to make a standalone lua.exe, to makes dlls that linked against lua53.dll to use symbols exported by lua.exe, so I write a redir_luadll.c, same with luv_renamed.c.
but I have some questions:
The text was updated successfully, but these errors were encountered: