Eleos Posted October 13, 2008 Share Posted October 13, 2008 Hi all.Wondering if anyone can provide source code for makinga generic patcher using a search and replace pattern.Thnx in advance Link to comment
Teddy Rogers Posted October 14, 2008 Share Posted October 14, 2008 One of the tick box's when you join is a promise to use search http://forum.tuts4you.com/index.php?act=Se...Bsearch+replace Ted. Link to comment
Eleos Posted October 14, 2008 Author Share Posted October 14, 2008 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 Link to comment
JohnWho Posted October 25, 2008 Share Posted October 25, 2008 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 JW. Link to comment
Ar4sh Posted October 28, 2008 Share Posted October 28, 2008 Thanx JohnWho nice Examle Link to comment
Eleos Posted November 6, 2008 Author Share Posted November 6, 2008 thnx JW. You are the man i was expecting a reply Did you quit RES? Link to comment
GioTiN Posted November 12, 2008 Share Posted November 12, 2008 Thanx JohnWho My Friend !bYE Link to comment
antrobs Posted November 15, 2008 Share Posted November 15, 2008 This is great i hope there's some more of this kind of stuff..... Link to comment
JohnWho Posted November 19, 2008 Share Posted November 19, 2008 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. Link to comment
Eleos Posted November 19, 2008 Author Share Posted November 19, 2008 That's sad cause the scene needs so much skillful and talented guys like you Link to comment
0xFF Posted December 16, 2008 Share Posted December 16, 2008 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_EXISTSING1.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. Link to comment
Departure Posted December 17, 2008 Share Posted December 17, 2008 I can'nt wait to see your example Rot1 Link to comment
0xFF Posted December 17, 2008 Share Posted December 17, 2008 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 Cardinalbeign 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. Link to comment
Departure Posted December 17, 2008 Share Posted December 17, 2008 (edited) 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.//EditOkay 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 December 17, 2008 by Departure Link to comment
0xFF Posted December 17, 2008 Share Posted December 17, 2008 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.//EditOkay 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 ? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now