DLL 不工作

发布于 2024-12-07 10:06:34 字数 411 浏览 0 评论 0原文

最近,我决定开始使用 C++ 进行 DLL 编程。 我制作了一个简单的 DLL,但是当我将它注入到进程中时,没有任何反应。 代码如下:

#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH){
MessageBoxA(0,"Injected","Injected",MB_OK);
}
return TRUE; // succesful
}

当它被注入到进程中时,它应该显示一个消息框,但它不起作用。 任何帮助将不胜感激

我使用 dll 注入器将其注入到进程中。我的操作系统是windows 7。

Recently, I decided to get into DLL programming with C++.
I made a simple DLL but when I inject it into a process, nothing happens.
Here's the code:

#include <windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if(fdwReason == DLL_PROCESS_ATTACH){
MessageBoxA(0,"Injected","Injected",MB_OK);
}
return TRUE; // succesful
}

It's supposed to display a message box when it gets injected into a process, but it doesn't work.
Any help would be appreciated

I used a dll injector to inject it into a process. And my OS is windows 7.

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

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

发布评论

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

评论(1

有木有妳兜一样 2024-12-14 10:06:34

我建议您先阅读这些书籍(从我的书店),然后再继续(了解基础知识):

确实如此,尤其是描述 ASR(地址空间随机化)的部分,使得您几乎不可能将 DLL 函数注入到其中另一个进程(并且用您自己的函数重写某些函数调用,无论是系统函数调用还是进程中的公共函数)而不引发异常,除非您熟悉与 Windows 消息传递和提升相关的非常高级的技术被调用的调用的权限基于 NT 内核(KERNEL32.dll 和相关库)中的内核函数中已知的(或者不是真正的)代码缺陷。

I advice you to read these books (from my bookstore), before you can proceed (to understand the basics) :

That is true, especially the part describing the ASR (adress space randomization), making it viirtually impossible to inject you DLL function into another process (and, rewriting some function call with your own function, either system function calls or public functions in a process) without raising an exception, except you are familiar with very advanced thechniques related with the Windows messaging and elevationg priveleges fot the call being called, bases on a known (or, not really) code flaws in a kernel functions from NT kernel (KERNEL32.dll and relevant libs).

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