Registriert seit: 30. Jan 2004
823 Beiträge
|
Re: getthreadcontext verständnisfrage
21. Feb 2006, 18:08
Delphi-Quellcode:
const DEINE_ADDR = $00441234;
var dwProcessID: DWord;
dwThreadID: DWord;
wBuf: Word;
dwRead: DWord;
wJmp: Word;
Context: TContext;
bFound: Boolean;
begin
dwProcessID := uallProcess.FindProcess('solitär.exe');
wJmp := $FEEB;
if dwProcessID <> 0 then
begin
dwThreadID := uallProcess.GetThread(dwProcessID);
dwProcessID := OpenProcess(PROCESS_ALL_ACCESS,false,dwProcessID);
if ReadProcessMemory(dwProcessID,pointer(DEINE_ADDR),@wbuf,SizeOf(wBuf),dwRead) and
(dwRead = SizeOf(wBuf)) then
if WriteProcessMemory(dwProcessID,pointer(DEINE_ADDR),@wJmp,SizeOf(wJmp),dwRead) and
(dwRead = SizeOf(wJmp)) then
begin
bFound := false;
repeat
if GetThreadContext(dwThreadID,Context) then
begin
if (Context.Eip = DEINE_ADDR) then
begin
WriteProcessMemory(dwProcessID,pointer(DEINE_ADDR),@wBuf,SizeOf(wBuf),dwRead);
bFound := true;
// Context.Eax hat den Wert
end;
end;
Sleep(100);
until bFound;
end;
CloseHandle(dwProcessID);
end;
end;
Sollte als Beispiel genügen.
|
|
Zitat
|