Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Making Generic Patcher with Delphi

Featured Replies

Posted

Hi all.

Wondering if anyone can provide source code for making

a generic patcher using a search and replace pattern.

Thnx in advance

  • Author

i did searched for it Mr Teddy but i only found on VB.

I know most people use VB but i don't that's why i need Delphi code

  • 2 weeks later...

Here's a very basic example.

Delphi.SnR.Patch.Example.rar

With a little tweaking you can do masked searching.

P.S. i didn't bothered cleaning up the code :kick:

JW.

Thanx JohnWho :)

nice Examle :flowers:

  • 2 weeks later...
  • Author

thnx JW. You are the man i was expecting a reply :)

Did you quit RES?

Thanx JohnWho My Friend !

bYE

This is great i hope there's some more of this kind of stuff..... :thumbsup:

thnx JW. You are the man i was expecting a reply :)

Did you quit RES?

More or less, wasn't around for a long time so now i'm out :)

JW.

  • Author

That's sad cause the scene needs so much skillful and talented guys like you

  • 4 weeks later...

I will provide you an example as soon as i can (too late right now):

1) CreateFile();

- If you wanna write a saved buffer (e.g: cracked .exe) use CREATE_ALWAYS flag to empty the file to ZERO-BYTE length.

- If you want to go to offsets and patch some bytes or words, etc... then OPEN_EXISTSING

1.5) SetFilePointer(); (To go to a specific offset if needed)

2) WriteFile(); on the handle CreateFile returned. (very similiar to WPM)

3) CloseHandle(); on the handle CreateFile returned.

I can'nt wait to see your example Rot1 :)

I can'nt wait to see your example Rot1 :)

No problem, here you go:

NOTE: All the ... stuff you see must be filled manually according to your needs, check out MSDN for details.

const
buffer: Array[0..1] of byte = ($90, $90);
var
hFile: THandle; //or Cardinal
beign
hFile := (... , GENERIC_WRITE , ... , OPEN_EXISTING, ... );
SetFilePointer( hFile, $XXXXX, ... , FILE_BEGIN ); //Sets position offset @ address ($offset in hex)
WriteFile( hFile, buffer, sizeof(buffer), ... );
CloseHandle( hFile );
end;

study this code carefully.

ah okay i thought this was to be a search and replace example, I will defently look into SetFilePointer API but from what you have wrote you need to know the offset address to patch? or am i missing something here? anyway I will check out the SetFilePointer API, it seems to just point an offset address therefore it seems at first glance nothing to do with Search and replace byte patterns.

//Edit

Okay i had a quick look on msdn site at SetFilePointer, I see what you mean now

Quote Msdn:"You can also use the SetFilePointer function to query the current file pointer position. To do this, specify a move method of FILE_CURRENT and a distance of zero (0)."

Im guessing this means we can loop through the file checking the byte at current position. I still need to look into to this but thanks for the tip.

Edited by Departure

ah okay i thought this was to be a search and replace example, I will defently look into SetFilePointer API but from what you have wrote you need to know the offset address to patch? or am i missing something here? anyway I will check out the SetFilePointer API, it seems to just point an offset address therefore it seems at first glance nothing to do with Search and replace byte patterns.

//Edit

Okay i had a quick look on msdn site at SetFilePointer, I see what you mean now

Quote Msdn:"You can also use the SetFilePointer function to query the current file pointer position. To do this, specify a move method of FILE_CURRENT and a distance of zero (0)."

Im guessing this means we can loop through the file checking the byte at current position. I still need to look into to this but thanks for the tip.

What SetFilePointer does is setting a different position in a file (offset), for example you open the binary file with a HEX Editor and you see the dumped result, the current offset (FILE_BEGIN) will be 0x00 (0), move 1 byte will be 0x01 (1), get me ?

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.