asm:调用 DLL
我反汇编了游戏的 DLL 并想插入一些代码。 我需要asm代码来调用当前目录中的另一个DLL(我在Windows上)。 背景是,我希望能够在我的 DLL 中执行自定义代码, 但我无法加载DLL。所以我的想法是通过修改游戏DLL来加载DLL。
游戏中可能有一个函数可以为我提供 DLL 的当前目录路径,但我想我找不到它。
I disassemled a game's DLL and want to insert some code.
I need asm code to call another DLL in the current directory(I'm on Windows).
The background is, that I want to be able to execute custom code in my DLL,
but I can't load the DLL. So my idea was to load the DLL via modified game DLL.
There may be a function in the game which gives me the current directory path the DLL's are but I think I won't find it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您要查找的调用是 LoadLibrary,它将在 选择位置,包括当前目录 DLL,然后加载它,然后 GetProcAddress。
如果 DLL 进行任何其他 Win32 调用,它可能已经链接到
kernel32.dll
,因此这就是您需要做的全部事情。修改 DLL 或使用 DLL 注入 是否更快是有争议的编写代码需要多长时间,因为无论如何您都必须进行逆向工程,但是,纯 DLL 注入的一个优点是,所有现有代码在安装方面都保持不变,使得这些修改更容易撤消用户希望“解除”你正在做的任何事情。
The calls you are looking for are LoadLibrary, which will search in a selection of places including the current directory for the DLL and then load it, then GetProcAddress.
If the DLL makes any other Win32 calls it is probably already linked against
kernel32.dll
, so that's all you need to do.It is arguable as to whether modifying the DLL or using DLL injection is faster in terms of how long it takes to write the code since you're going to have to reverse engineer anyway, however, one advantage of pure DLL injection is that all existing code remains unmodified in terms of the installation, making these modifications easier to undo should the user wish to "unpatch" whatever you are doing.
Microsoft Detours 附带
setdll.exe
和 < code>withdll.exe,这些实用程序将允许您使用自定义 dll 文件启动 exe。Microsoft Detours comes with
setdll.exe
andwithdll.exe
, those utilities will let you start an exe with a custom dll file.