【求助】为何远程注入后,宿主程序会进入假死状态?
各位朋友好,我用网上找的代码,把我写的一个dll注入到记事本中,但是一旦注入,就会发现记事本进入假死状态,后来换成注入explorer.exe,就会发现系统不能正常使用了,只能强行结束explorer,请教各位朋友,如果才能使宿主程序不进入假死状态。
PS:附上dll里面的入口和所调用的函数:
library HookLib;
uses
Forms,
Windows,
SysUtils,
Classes,
UnitMouseHook in 'UnitMouseHook.pas',
Hooker in 'Hooker.pas' {frmBase},
Tasklist in 'Tasklist.pas' {frmTasklist},
UnitKeyHook in 'UnitKeyHook.pas';
{$R *.res}
procedure DllEntryPoint(dwReason: DWORD);
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
StartApp;
end;
DLL_PROCESS_DETACH:
begin
end;
DLL_THREAD_ATTACH:
begin
end;
DLL_THREAD_DETACH:
begin
end;
end;
end;
exports
StartApp;
begin
DllProc := @DllEntryPoint;
DllEntryPoint(DLL_PROCESS_ATTACH);
end.
function StartApp: BOOL; stdcall;
begin
Result := True;
try
try
Application.Initialize;
Application.CreateForm(TfrmBase, frmBase);
frmBase.FormStyle := fsStayOnTop;
Application.Run;
except
on e: Exception do
begin
Result := False;
end;
end;
finally
FreeAndNil(frmBase);
end;
end;
麻烦各位朋友帮忙想想办法,谢谢了。
[解决办法]
LZ这个程序里,dll代码不全吧,没有消息处理函数么?
[解决办法]
Application.Initialize; Application.CreateForm(TfrmBase, frmBase); frmBase.FormStyle := fsStayOnTop; Application.Run;
[解决办法]
var frmBase: TfrmBase;procedure DllEntryPoint(dwReason: DWORD);begin case dwReason of DLL_PROCESS_ATTACH: begin frmBase:= TfrmBase.create(nil); frmBase.FormStyle := fsStayOnTop; frmBase.show; end; DLL_PROCESS_DETACH: begin if Assigned(frmBase) then FreeAndNil(frmBase); end; end;end;begin DllProc := @DllEntryPoint; DllEntryPoint(DLL_PROCESS_ATTACH);end;