Puedes guiarte mediante esta función, saludos.
Código Delphi
[-]function WriteBytes(pAddress: Pointer; Bytes: array of Byte): Boolean;
var
OldProtect, NewProtect: DWORD;
begin
if VirtualProtect(pAddress, SizeOf(Bytes), PAGE_EXECUTE_READWRITE, @OldProtect) then
begin
Move(Bytes, pAddress^, Length(Bytes));
VirtualProtect(pAddress, SizeOf(Bytes), OldProtect, @NewProtect);
Result := True;
end
else
Result := False;
end;
Suponiendo que el proceso es externo y la edición la quieres efectuar internamente entonces tendrás que usar técnicas de inyección de DLL
o modificar la función y usar la API WriteProcessMemory pero entonces ya estaríamos hablando de algo externo