从 DLL 创建线程 - ERROR_NOT_ENOUGH_MEMORY

发布于 2024-11-05 06:22:35 字数 227 浏览 1 评论 0原文

我有这个dll,它在被LoadLibraryA加载时创建一个线程,使用RtlCreateUserThread将该dll注入到另一个进程中,注入成功,该dll被加载到目标进程中(kernel32 LoadLibraryA线程在那里),但是当涉及到CreateThread 我得到了 ERROR_NOT_ENOUGH_MEMORY,那么 RtlCreateUserThread 或目标进程或 DLL 本身的问题出在哪里?我该如何解决它?多谢!!

i've got this dll that creates a thread when loaded by LoadLibraryA, the dll is injected into another process using RtlCreateUserThread, the injection succeeds, the dll is loaded into the target process (kernel32 LoadLibraryA thread is there) but when it comes to the CreateThread i got ERROR_NOT_ENOUGH_MEMORY, so where is the problem RtlCreateUserThread or the target process or the DLL itself? and how may i solve it? thanks alot!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九八野马 2024-11-12 06:22:35

好吧,我确实解决了这个问题,我在dll中使用了RtlCreateUserThread而不是CreateThread,无论如何谢谢大家,对于给您带来的不便表示歉意。

Well, i did solve it, i used RtlCreateUserThread inside the dll instead of CreateThread, thank you all anyway, sorry for any incovenience.

顾北清歌寒 2024-11-12 06:22:35

问题出在你的目标上。您加载了 Kernel32,很好,但是您没有告诉目标进程该函数的地址在哪里。我假设您从主机进程注入了代码段,因此没有像 DLL 注入那样解析注入到目标进程的导入表。

您可以从注入的函数中调用CreateThread,但是您需要首先加载它的地址!

typedef DATATYPE_OF_CREATETHREAD (__stdcall *MyCreateThread)(PARAMS_OF_CREATETHREAD);
MyCreateThread _MyCreateThread;

_MyCreateThread = (MyCreateThread)GetProcAddress("kernel32.dll", "CreateThread");
_MyCreateThread(PARAMS_TO_PASS); // CreateThread, with it's address loaded in memory of your injected code segment/function

像这样^,您将能够从注入的函数中调用CreateThread

PS我不记得createthread的参数,但这是当场写的。

不客气 :)

The problem is in your target. You loaded Kernel32, great, but you didn't tell the target process where the address of the function is. I assume you injected a code segment from your host process, therefore did not resolve the import table for your injection to the target process, as you would with DLL injection.

You can call CreateThread from the injected function, however you need to load it's address first!

typedef DATATYPE_OF_CREATETHREAD (__stdcall *MyCreateThread)(PARAMS_OF_CREATETHREAD);
MyCreateThread _MyCreateThread;

_MyCreateThread = (MyCreateThread)GetProcAddress("kernel32.dll", "CreateThread");
_MyCreateThread(PARAMS_TO_PASS); // CreateThread, with it's address loaded in memory of your injected code segment/function

Like that ^, you will be able to call CreateThread from your injected function.

P.S. I don't memorize the params createthread has, but this was written on the spot.

You're welcome :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文