Witam.
Znalazłem na forum taki kod:
const
Target: array[0..4] of byte = ($6E, $69, $63, $6F);
var
Mbi: TMemoryBasicInformation;
Handle: THandle;
buff: array of byte;
hWin, ProcID, BuffSize: Cardinal;
Addr: DWORD_PTR;
BytesRead: NativeUInt;
i: integer;
begin
hWin := FindWindow(nil, 'TestSft');
if hWin > 0 then
GetWindowThreadProcessID(hWin, @ProcId);
if ProcId > 0 then
begin
Handle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, false, ProcId);
if Handle <> 0 then
begin
while (VirtualQueryEx(Handle, Ptr(Addr), Mbi, SizeOf(Mbi)) <> 0) do
begin
SetLength(buff, BuffSize);
if ReadProcessMemory(Handle, Mbi.BaseAddress, Buff, Mbi.RegionSize, BytesRead) then
begin
for i := 0 to Length(Buff) do
if CompareMem(@Buff[i], @Target[1], Length(Target)) then
begin
ShowMessage('Found');
end;
end;
if Addr + BuffSize < Addr then
break;
Addr := Addr + BuffSize;
end;
SetLength(buff, 0);
CloseHandle(Handle);
end;
end;
end;
Bardzo fajny, ale dało by radę go jakoś łatwo zmienić na przeszukiwanie stringów, zamiast array of bytes? Było by to bardziej pożyteczne z tego względu, że każdy tekst obecnie zamieniam na array of bytes, a później w programie to wpisuję jako $coś $coś $coś. Trochę dużo z tym roboty i lepiej by było po prostu wpisać tekst :)