Results 1 to 2 of 2
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    [Snippet] Write bytes to memory

    Made this little function because WriteProcessMemory was getting detected in a game hack I was making
    // Write Bytes to Address Method
    Function WriteIt(pAddress: Pointer; Bytes: Array of Byte): Boolean;
    var
    OldProtect, DummyProtect: DWord;
    begin
    if VirtualProtect(pAddress, SizeOf(Bytes), PAGE_EXECUTE_READWRITE, @OldProtect) then
    begin
    Move(Bytes, pAddress^, Length(Bytes));
    VirtualProtect(pAddress, SizeOf(Bytes), OldProtect, @DummyProtect);
    Result := True
    end
    else
    Result := False;
    end;

    Great for when you Dll is injected into a process, you can use it like this... Example]Const
    //NoReLoad
    AddressReload = $374B1826;
    PatchReload : Array[0..7] of byte = ($90,$90,$90,$90,$90,$90,$90,$90);
    OriginalReload : Array[0..7] of byte = ($81,$44,$24,$04,$1C,$00,$00,$00);

    .......
    //Apply new bytes
    WriteIt(ptr(AddressReload),PatchReload);

    //Restore Old bytes
    //WriteIt(ptr(AddressReload),OriginalReload);[/delphi]
    by Departure
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

  2. #2
    LittleRAT
    LittleRAT is offline
    Inactive
    Join Date
    2019 Oct
    Posts
    1
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Write exact value to address

    Hello there i'v been researching game hacking in delphi for a while now, I'v gotten to the point were i can inject and change a value yet when using the function above i try set example $821 it comes with a different value? how to resolve this issue & i change the bytes to a UInt64 value.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •