Mam oto taki kod w delphi
function ReadString(Address: Integer): String;
var
NB : LongWord;
Temp : ARRAY [1..255] OF Byte;
I : Byte;
IDProcess, proc_ID : Cardinal;
begin
GetWindowThreadProcessID(FindWindow('gg', nil), @proc_ID);
IDProcess := OpenProcess(PROCESS_ALL_ACCESS, false, proc_ID);
Result := '';
ReadProcessMemory(IDProcess, Ptr(Address), @Temp[1], 255, NB);
for I := 1 to 255 do
begin
if ((Temp[i] = 0) or (Temp[i] = $0F)) then
Break;
Result := Result + Chr(Temp[i]);
end;
end;
function ReadInteger(Address: Cardinal): Cardinal; //Read adress:value
var
ProcId: Cardinal;
tProc: THandle;
NBR: Cardinal;
value:integer;
begin
GetWindowThreadProcessId(FindWindow('gg',Nil), @ProcId);
tProc:= OpenProcess(PROCESS_ALL_ACCESS, False, ProcId);
ReadProcessMemory(tProc, Ptr(Address), @value, 4, NBR);
CloseHandle(tProc);
Result:=value;
end;
procedure WriteInteger(Address: Integer; buf: Integer; Length: DWORD);
var ProcID, THandle: Integer;
e: DWORD;
begin
GetWindowThreadProcessId(FindWindow('gg',Nil), @ProcID);
THandle := OpenProcess(PROCESS_ALL_ACCESS, False, ProcID);
WriteProcessMemory(THandle, Ptr(Address), @buf, Length, e);
CloseHandle(THandle);
end;
procedure WriteString(Address: Integer; buf: String; Length: DWORD);
var ProcID: Integer;
THandle: hWnd;
e: DWORD;
begin
GetWindowThreadProcessId(FindWindow('gg',Nil), @ProcID);
THandle := OpenProcess(PROCESS_ALL_ACCESS, False, ProcID);
WriteProcessMemory(THandle, Pointer(Address), PChar(buf), Length, e);
CloseHandle(THandle);
end;
Jak go zamienic na c++??