Hello all,
I want to check in a external process if an address X, that i'll call here $00000001 is "NOPPED", i know that an address with NOP its byte is x90, so my question is:
Can i use ReadProcessMemory putting the value x90 as the IpBuffer or do you have a better idea,
EX:

if ReadProcessMemory(hProcess, Ptr($00000001), ptr(90), 4, Written) then
ShowMessage('He is nopped');

No, you misused the ReadProcessMemory function.

This is how it should be used:

procedure NotifyAboutNOP(ProcessHandle:THandle; Address:Longword);
var
  B : Byte;

begin
  if LongBool( ReadProcessMemory(ProcessHandle, Pointer(Address), @B, 1, NIL) ) then begin
  // reading succeeded:
  if B = $90
    then ShowMessage('the byte at Address of the process ProcessHandle contains a NOP instruction.')
    else ShowMessage('the byte at Address of the process ProcessHandle contains hexadecimal value ' + IntToHex(B,2));
end else begin
  ShowMessage('Failure trying to read memory from another process.');
end;

end;

procedure TForm1.Button1Click(Sender:TObject);
begin
  NotifyAboutNOP(hProcess, $00000001);
end;

Thanks a lot bro.I think it can work.
Can it be called with WriteProcessMemory() too?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.