Author Topic: Changing some data in the data section  (Read 10441 times)

KeepingRealBusy

  • Member
  • ***
  • Posts: 426
Re: Changing some data in the data section
« Reply #15 on: December 06, 2012, 10:07:57 AM »
I respect your opinion, but I am not coming close to violating ANY laws.

I had already planned that I will NOT be posting the source here.

I may post very small snips in another language to get help as well as dummy code.

Have a beer and relax.  :biggrin:

I sometimes think the worst in situations.

Andy

You might check with Alex (Antaryi). He had a way to modify the code section (in the old forum), but it slowed down the execution. Not good for single use, but might be useful for a high use function that could be tailored for a specific operational state. I tried to find the example, but no luck.

Dave.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7036
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Changing some data in the data section
« Reply #16 on: December 06, 2012, 10:09:55 AM »
It will depend exactly what it does, patching a binary file is simple file IO but if anything even vaguely looks like search and destroy patcher, we will remove it.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

hfheatherfox07

  • Member
  • ***
  • Posts: 464
Re: Changing some data in the data section
« Reply #17 on: December 06, 2012, 10:27:44 AM »
Thank you for the clarification ..... :biggrin:

I came across that source that Magnum was referring to when I was looking for a Hex conversion routine ....that was all I needed (not the actual patcher)
I believe that patcher than to be a No, No...
It is a Blank patcher that loads any file! search pattern and bye bye

Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

jj2007

  • Member
  • *****
  • Posts: 10094
  • Assembler is fun ;-)
    • MasmBasic
Re: Changing some data in the data section
« Reply #18 on: December 06, 2012, 05:40:18 PM »
You might check with Alex (Antaryi). He had a way to modify the code section (in the old forum), but it slowed down the execution. Not good for single use, but ...

No rocket science involved. You need VirtualProtect to allow writing to your own code space, and two lines to get EIP:
Code: [Select]
include \masm32\include\masm32rt.inc

.code
start:
call @F
@@: pop eax    ; address 401005
inkey hex$(eax)
exit

end start

sinsi

  • Guest
Re: Changing some data in the data section
« Reply #19 on: December 06, 2012, 06:54:37 PM »
Copy original.exe to a temp directory as temp.exe.
Run temp.exe with some command line params, "/patch original.exe offset value" then exit.
Let the temp.exe patch original.exe, optionally restart original.exe

edit:
Have you looked at the imagehlp functions? Things like ImageRvaToVa are in there

Magnum

  • Member
  • *****
  • Posts: 2308
Re: Changing some data in the data section
« Reply #20 on: December 06, 2012, 11:45:23 PM »
No problem.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Magnum

  • Member
  • *****
  • Posts: 2308
Re: Changing some data in the data section
« Reply #21 on: December 06, 2012, 11:55:33 PM »
I see several different methods that you guys have come up with.

I also would like to develop Hutch's method of storing the "fixer" into the executable.

I think Linux Mint code could use some fixing.  :t

Andy

Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

Magnum

  • Member
  • *****
  • Posts: 2308
Re: Changing some data in the data section
« Reply #22 on: December 07, 2012, 01:11:07 AM »
Sinsi,

I will look into the imagehlp functions.

Andy
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org