我创建了一个带有表单的 dll,当我们注入 dll 时,表单打开。但是当我这样做时,问题是我注入的过程,卡住了,我无法让他注意到。
这就是我所做的。
DWORD WINAPI MessageLoop(HINSTANCE hInstance)
{
hWindow = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DLGPROC(WindowProc));
MSG Msg;
while(GetMessage(&Msg, 0, 0, 0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
和注射:
DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPSTR lpszReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)MessageLoop(hInstance), 0, 0, 0);
}
return 0;
}
@雷米勒博:
DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPSTR lpszReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, &MessageLoop, hInstance, 0, 0);
}
return 0;
}