hier mal als kleines Delphi Beispiel
Code:
procedure WriteAddress(aHandle, address:Cardinal; bytes: string); // Ref# 011
var
ActByte:Byte;
Loop:integer;
write, pid,newproc : Cardinal;
begin
Bytes := StringReplace(Bytes,' ','',[rfReplaceAll]);
GetWindowThreadProcessId(aHandle,@pid);
newproc := OpenProcess(PROCESS_ALL_ACCESS,FALSE,pid);
if Length(Bytes) mod 2 = 0 then for Loop := 1 to (Length(Bytes) div 2) do
begin
ActByte := StrToInt('$'+Bytes[Loop*2-1]+Bytes[2*Loop]);
WriteProcessMemory(newproc,ptr(address),@ActByte,sizeof(ActByte),write);
inc(address);
end;
CloseHandle(newproc);
end;
Aufgerufen wird die Funktion dann mit
Code:
WriteAdress(123456,$10ABF,'90 90 90 90')
wobei 123456 das Prozesshandle ist, $10ABF die Speicheradresse und 90 90 90 90 steht exemplarisch für 4 NOP's.
Ich weiss, nur zum ausnoppen kann man das auch einfacher machen, aber mit der Funktion kann man sich auch einfach den Code ausm Tsearch ala "Poke 10ABF 1F 10 FF 90 B3" oder sowas rauskopieren.