Registriert seit: 28. Jan 2010
27 Beiträge
|
AW: ReadProcessMemory -> Problem
15. Okt 2010, 14:00
Es klappt nun.
Ich habe einfach PChar mit integer ausgetauscht.
Quellcode, der jetzt geht:
Delphi-Quellcode:
program Tut;
{$APPTYPE CONSOLE}
uses
SysUtils,
Windows;
var
ThreadID, ProcessID: Integer;
WindowHWnd: HWnd;
write: Cardinal;
WindowHandle: THandle;
P: Integer; //Variable für ReadProcessMemory
Procedure OpenMemory;
begin
While WindowHWnd = 0 do
begin
WindowHWnd := FindWindow(nil, 'Spider Solitär');
sleep(100);
end;
ThreadID := GetWindowThreadProcessID(WindowHWnd, @ProcessID);
WindowHandle := OpenProcess(PROCESS_ALL_ACCESS, false, ProcessID);
Writeln('ThreadID: ' + IntToStr(ThreadID) + ' / ' + 'ProcessID: ' + IntToStr(ProcessID) + ' / ' + 'WindowHandle: ' + IntToStr(WindowHandle));
end;
Function ReadMemory: Integer;
var New: Integer;
begin
try
ReadProcessMemory(WindowHandle, Ptr($04D4480), @P, SizeOf(P), write);
New := P+$10;
ReadProcessMemory(WindowHandle, Ptr(New), @P, SizeOf(P), write);
New := P+$8c;
ReadProcessMemory(WindowHandle, Ptr(New), @P, SizeOf(P), write);
Result := P;
finally
CloseHandle(WindowHandle);
end;
end;
begin
OpenMemory;
Writeln(ReadMemory);
Readln;
end.
|
|
Zitat
|