M
makecte
Unregistered / Unconfirmed
GUEST, unregistred user!
DLL工程中可以通过Run paramaters对话框指定某程序为宿主应用程序。然后你就可以在DLL代码中设置断点并且按F9运行它——就像在一个普通应用程序中做的那样。Delphi会运行指定的宿主程序,并且,通过编译带有调试信息的DLL,把你指引到DLL代码内的断点处。
可是我程序里面怎么设置断点都不会断下来。郁闷啊
library text;
uses
SysUtils,
Classes,
Windows,
Unit1 in 'Unit1.pas' {Form1},
varhead in 'varhead.pas';
{$R *.res}
exports
HookOn index 20,
Hookoff index 10;
function HookProc(nCode: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall;
begin
if nCode < 1 then
begin
if isLogin then
begin
isLogin := false;
gwnd := GetForegroundWindow;
OpenMap;
Login_num:=PTLogin1^.user;
Login_Psw:=PTLogin1^.psw;
cuser:=PTLogin1^.cuser;
cpsw:=PTLogin1^.cpsw;
LineStr:=PTLogin1^.LineStr;
CloseHandle(hMapping);
if Login_num <> '' then
begin
BeginThread(nil, 0, @AutoLogin, nil, 0, PSum);
end;
end;
isBeep := false;
if (WPARAM = vk_home) and (((lParam shr 30) and $F) = 0) then
begin
if not Assigned(Form1) then
begin
gwnd := GetForegroundWindow; //获取游戏窗口句柄备用
form1 := tform1.Create(Application);
form1.Show;
init; //初始化一些变量
HookCode(@hookTakeText, Pointer($64291D)); //hook文本信息
HookCode(@hookrecv, Pointer($9F5EF1)); //Hook游戏的收包处理函数
HookCode(@GetBitMapData, Pointer($466F9E));
BeginThread(nil, 0, @Mybeep, nil, 0, psum);
BeginThread(nil, 0, @OnTimeUseItem, nil, 0, psum);
BeginThread(nil, 0, @AutoSayThread, nil, 0, psum);
BeginThread(nil, 0, @AutoRequestJoinTeamThread, nil, 0, psum);
end
else
form1.Visible := not form1.Visible;
end;
if (WPARAM = vk_end) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn3.Click;
end;
if (WPARAM = vk_f11) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn1.Click;
end;
if (WPARAM = vk_f12) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn2.Click;
end;
if (WPARAM = vk_f10) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.Button2.Click;
end;
end;
Result := CallNextHookEx(hHk, nCode, WParam, LParam);
end;
function HookOn(lpHwnd: HWND; lpType: Longint): Longint; stdcall; export;
begin
hHk := SetWindowsHookEx(lpType, @HookProc, hInstance, lpHwnd); // WH_KEYBOARD
Result := hHk;
end;
我设置断点在
hootpro函数的
OpenMap;这行。可是不会到执行到这个地方断下来。。。好郁闷啊。。这个怎么回事啊
可是我程序里面怎么设置断点都不会断下来。郁闷啊
library text;
uses
SysUtils,
Classes,
Windows,
Unit1 in 'Unit1.pas' {Form1},
varhead in 'varhead.pas';
{$R *.res}
exports
HookOn index 20,
Hookoff index 10;
function HookProc(nCode: Integer; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall;
begin
if nCode < 1 then
begin
if isLogin then
begin
isLogin := false;
gwnd := GetForegroundWindow;
OpenMap;
Login_num:=PTLogin1^.user;
Login_Psw:=PTLogin1^.psw;
cuser:=PTLogin1^.cuser;
cpsw:=PTLogin1^.cpsw;
LineStr:=PTLogin1^.LineStr;
CloseHandle(hMapping);
if Login_num <> '' then
begin
BeginThread(nil, 0, @AutoLogin, nil, 0, PSum);
end;
end;
isBeep := false;
if (WPARAM = vk_home) and (((lParam shr 30) and $F) = 0) then
begin
if not Assigned(Form1) then
begin
gwnd := GetForegroundWindow; //获取游戏窗口句柄备用
form1 := tform1.Create(Application);
form1.Show;
init; //初始化一些变量
HookCode(@hookTakeText, Pointer($64291D)); //hook文本信息
HookCode(@hookrecv, Pointer($9F5EF1)); //Hook游戏的收包处理函数
HookCode(@GetBitMapData, Pointer($466F9E));
BeginThread(nil, 0, @Mybeep, nil, 0, psum);
BeginThread(nil, 0, @OnTimeUseItem, nil, 0, psum);
BeginThread(nil, 0, @AutoSayThread, nil, 0, psum);
BeginThread(nil, 0, @AutoRequestJoinTeamThread, nil, 0, psum);
end
else
form1.Visible := not form1.Visible;
end;
if (WPARAM = vk_end) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn3.Click;
end;
if (WPARAM = vk_f11) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn1.Click;
end;
if (WPARAM = vk_f12) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.btn2.Click;
end;
if (WPARAM = vk_f10) and (((lParam shr 30) and $F) = 0) then
begin
if Assigned(Form1) then
form1.Button2.Click;
end;
end;
Result := CallNextHookEx(hHk, nCode, WParam, LParam);
end;
function HookOn(lpHwnd: HWND; lpType: Longint): Longint; stdcall; export;
begin
hHk := SetWindowsHookEx(lpType, @HookProc, hInstance, lpHwnd); // WH_KEYBOARD
Result := hHk;
end;
我设置断点在
hootpro函数的
OpenMap;这行。可是不会到执行到这个地方断下来。。。好郁闷啊。。这个怎么回事啊