代码拉取完成,页面将自动刷新
unit WindowsDebugger;
{
Debugger interface for the default windows api.
It's basically just a forward for everything
}
{$mode delphi}
interface
{$ifdef windows}
uses
Classes, SysUtils, DebuggerInterface, windows, cefuncproc,newkernelhandler,
symbolhandler, dialogs;
type TWindowsDebuggerInterface=class(TDebuggerInterface)
public
function WaitForDebugEvent(var lpDebugEvent: TDebugEvent; dwMilliseconds: DWORD): BOOL; override;
function ContinueDebugEvent(dwProcessId: DWORD; dwThreadId: DWORD; dwContinueStatus: DWORD): BOOL; override;
function SetThreadContext(hThread: THandle; const lpContext: TContext; isFrozenThread: Boolean=false): BOOL; override;
function GetThreadContext(hThread: THandle; var lpContext: TContext; isFrozenThread: Boolean=false): BOOL; override;
function DebugActiveProcess(dwProcessId: DWORD): WINBOOL; override;
function DebugActiveProcessStop(dwProcessID: DWORD): BOOL; override;
constructor create;
end;
{$endif}
implementation
{$ifdef windows}
uses autoassembler, pluginexports, CEDebugger, DebugHelper, processhandlerunit;
resourcestring
rsErrorAttachingTheWindowsDebugger = 'Error attaching the windows debugger: '
+'%s';
constructor TWindowsDebuggerInterface.create;
begin
inherited create;
fDebuggerCapabilities:=[dbcSoftwareBreakpoint, dbcHardwareBreakpoint, dbcExceptionBreakpoint, dbcBreakOnEntry];
name:='Windows Debugger';
fmaxSharedBreakpointCount:=4;
end;
function TWindowsDebuggerInterface.WaitForDebugEvent(var lpDebugEvent: TDebugEvent; dwMilliseconds: DWORD): BOOL;
begin
result:=newkernelhandler.WaitForDebugEvent(lpDebugEvent, dwMilliseconds);
end;
function TWindowsDebuggerInterface.ContinueDebugEvent(dwProcessId: DWORD; dwThreadId: DWORD; dwContinueStatus: DWORD): BOOL;
begin
result:=newkernelhandler.ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus);
end;
function TWindowsDebuggerInterface.SetThreadContext(hThread: THandle; const lpContext: TContext; isFrozenThread: Boolean=false): BOOL;
begin
result:=newkernelhandler.SetThreadContext(hThread, lpContext);
end;
function TWindowsDebuggerInterface.GetThreadContext(hThread: THandle; var lpContext: TContext; isFrozenThread: Boolean=false):BOOL;
begin
result:=newkernelhandler.GetThreadContext(hThread, lpContext);
end;
function TWindowsDebuggerInterface.DebugActiveProcessStop(dwProcessID: DWORD): BOOL;
begin
if assigned(CEDebugger.DebugActiveProcessStop) then
result:=CEDebugger.DebugActiveProcessStop(dwProcessID)
else
result:=false;
end;
function TWindowsDebuggerInterface.DebugActiveProcess(dwProcessId: DWORD): WINBOOL;
var d: tstringlist;
begin
// OutputDebugString('Windows Debug Active Process');
processhandler.processid:=dwProcessID;
// OutputDebugString('Before calling Open_Process');
Open_Process;
// OutputDebugString('After calling Open_Process');
symhandler.reinitialize;
symhandler.waitforsymbolsloaded(true);
if PreventDebuggerDetection then
begin
d:=tstringlist.create;
try
d.Add('IsDebuggerPresent:');
d.add('xor eax,eax');
d.add('ret');
try
autoassemble(d,false);
except
end;
finally
d.free;
end;
end;
result:=newkernelhandler.DebugActiveProcess(dwProcessId);
if result=false then
ferrorstring:=Format(rsErrorAttachingTheWindowsDebugger, [inttostr(
getlasterror)])
else
symhandler.reinitialize;
//processhandler.processid:=dwProcessID;
//Open_Process;
end;
{$endif}
end.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。