View previous topic :: View next topic |
Author |
Message |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Tue Apr 21, 2009 3:07 am Post subject: [Help Please] Changing name of a window. |
|
|
Ok, so there is big exe file (lets say abc.exe) that I would like to edit.
Lets assume that window's name is xyz.
Editing abc.exe with hex editor and changing all occurances of xyz to zyx didn't work - abc.exe crashes (no wonder - there were like 500 occurances of xyz)
I tried running ollydbg with it but I am kinda lost......
Any help please? _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature.... |
|
Back to top |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Tue Apr 21, 2009 3:59 am Post subject: |
|
|
Try to set a breakpoint on CreateWindow. Then when the application calls it, find out where it gets the window name from. |
|
Back to top |
|
 |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Wed Apr 22, 2009 2:16 pm Post subject: |
|
|
ummm I am figuring it now... I somehow can't make it. Don't know why.... _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature.... |
|
Back to top |
|
 |
pkedpker Master Cheater
Reputation: 1
Joined: 11 Oct 2006 Posts: 412
|
|
Back to top |
|
 |
shhac Expert Cheater
Reputation: 0
Joined: 30 Oct 2007 Posts: 108
|
|
Back to top |
|
 |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Wed Jun 17, 2009 12:20 pm Post subject: |
|
|
The resource hacker didn't help.
The breakpoint at CreateWindow didn't help.
Checking out SetWindowText helped. Kinda.
There is this
push ecx,
push eax,
<this funny call to setwindowtext>
so I wanted to edit the push ecx part for example with
add ecx, 8
push ecx
even that slight change (eating one letter) would satisfy me. However when I want to do this olly says there is not enough room for such change. When I uncheck keep size the next few lines of the code get messed up automatically.
I wonder what tremendous changes would it require to change that name title to something completly different.... _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature.... |
|
Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Wed Jun 17, 2009 12:25 pm Post subject: |
|
|
Check up a bit and look where ecx has it's value set. I think it should be storing the address which the window title is stored at. |
|
Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Wed Jun 17, 2009 1:07 pm Post subject: |
|
|
tommmmmm wrote: | The resource hacker didn't help.
The breakpoint at CreateWindow didn't help.
Checking out SetWindowText helped. Kinda.
There is this
push ecx,
push eax,
<this funny call to setwindowtext>
so I wanted to edit the push ecx part for example with
add ecx, 8
push ecx
even that slight change (eating one letter) would satisfy me. However when I want to do this olly says there is not enough room for such change. When I uncheck keep size the next few lines of the code get messed up automatically.
I wonder what tremendous changes would it require to change that name title to something completly different.... | Of course it won't work, what you need to do is overwrite it with a jump to some codecave, write your code including the overwritten instructions, and then jmp back. Noz's suggestion is ideal if the string is a global string. _________________
|
|
Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jun 18, 2009 11:40 am Post subject: |
|
|
sponge wrote: | tommmmmm wrote: | The resource hacker didn't help.
The breakpoint at CreateWindow didn't help.
Checking out SetWindowText helped. Kinda.
There is this
push ecx,
push eax,
<this funny call to setwindowtext>
so I wanted to edit the push ecx part for example with
add ecx, 8
push ecx
even that slight change (eating one letter) would satisfy me. However when I want to do this olly says there is not enough room for such change. When I uncheck keep size the next few lines of the code get messed up automatically.
I wonder what tremendous changes would it require to change that name title to something completly different.... | Of course it won't work, what you need to do is overwrite it with a jump to some codecave, write your code including the overwritten instructions, and then jmp back. Noz's suggestion is ideal if the string is a global string. |
Don't see the point in all of that mess. Just detour SetWindowText and edit the parameters. |
|
Back to top |
|
 |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Fri Sep 04, 2009 11:02 am Post subject: |
|
|
I heard somewhere that you can't make jumps larger than set size, so editing the ecx at the end of the program is impossible.
I went back to idea of a constant - I found
MOV ECX,DWORD PTR SS:[ARG.7]
right before the function call
but wtf is ARG.7
I don't even know where to look for it......
-----
edit: when I clicked in olly it suddenly showed [ESP+6C]
I tried editing it to +75 or to +5A
In first case I got empty title in second some fancy letters.
ps: I presume it would be nice to see where esp leads, however it's not me who launches application (there is a launcher that launches launcher that launches application) so I have no idea what to do... _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature.... |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Sep 04, 2009 11:35 am Post subject: |
|
|
void:] wrote: | sponge wrote: | tommmmmm wrote: | The resource hacker didn't help.
The breakpoint at CreateWindow didn't help.
Checking out SetWindowText helped. Kinda.
There is this
push ecx,
push eax,
<this funny call to setwindowtext>
so I wanted to edit the push ecx part for example with
add ecx, 8
push ecx
even that slight change (eating one letter) would satisfy me. However when I want to do this olly says there is not enough room for such change. When I uncheck keep size the next few lines of the code get messed up automatically.
I wonder what tremendous changes would it require to change that name title to something completly different.... | Of course it won't work, what you need to do is overwrite it with a jump to some codecave, write your code including the overwritten instructions, and then jmp back. Noz's suggestion is ideal if the string is a global string. |
Don't see the point in all of that mess. Just detour SetWindowText and edit the parameters. |
that's quite stupid. do you realise how many times that function might be called ? also most window creations do not even use SetWindowText() for setting title text.. so it's quite possible the hook would not work for future versions of the program
tommmmmm wrote: | I heard somewhere that you can't make jumps larger than set size, so editing the ecx at the end of the program is impossible.
I went back to idea of a constant - I found
MOV ECX,DWORD PTR SS:[ARG.7]
right before the function call
but wtf is ARG.7
I don't even know where to look for it......
-----
edit: when I clicked in olly it suddenly showed [ESP+6C]
I tried editing it to +75 or to +5A
In first case I got empty title in second some fancy letters.
ps: I presume it would be nice to see where esp leads, however it's not me who launches application (there is a launcher that launches launcher that launches application) so I have no idea what to do... |
[ESP+6C] is a value on the stack. i am guessing what is happening is that a pointer to the window title is pushed onto the stack at some point and hence it is pointed to by ESP+6C. editing the offset does nothing other than make the title pointer to be some other random place on the stack
there are two easy ways as a solution. first off you can scroll up and find out where the pointer is being pushed. let's say it is pushing ecx << being the pointer to title. since ecx is the pointer if you follow it in the hex dump you should find the title in the data section of the program ; ) you can then edit it there. that would be the cleanest solution
a messy way and overkill is to codecave at various places, eg. just before the [ESP+6C] and then to edit the pointer there, or codecaving ecx, etc. etc.
actually an easy way to achieve what you are trying to do is to use CE to scan for the window title as a string. once you have the address you can go there in memory view and edit it there. alternatively you could breakpoint on access that address and change references to it to point to another string that you define yourself. instead of changing all references though, you need to make sure you just change the right ones
upload the exe somewhere and post the link and i'll show you what needs to be done |
|
Back to top |
|
 |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Fri Sep 04, 2009 12:12 pm Post subject: |
|
|
I read a bit about code caving and I code caved
push ecx,
push eax,
<this funny call to setwindowtext>
to
add ecx, <insert some number here>
push ecx,
push eax,
<this funny call to setwindowtext>
Facts:
add ecx, 0 ; leaves old name of the program - which at least means code cave is correct and everything is working
add ecx, 8 ; gives empty one
sub ecx, 8 ; gives fancy letters
which all makes sense because we had
mov ecx, [esp+6c]
push ecx,
push eax
<call to function>
so editing esp+6c is same as editing ecx later on in the code cave.
Which leads me to the point that the mistake was at the very beginning of thoughtful process - ansi letter is not 8 bits..... but google says it is...
so I am stuck again...
ps: and the part about following esp in hex dump is a total mystery to me.... esp is set some time in the past - probably long ago in the code - so getting the esp value (then addig offset to get data string) is impossible.... _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature....
Last edited by tommmmmm on Fri Sep 04, 2009 12:20 pm; edited 1 time in total |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Sep 04, 2009 12:18 pm Post subject: |
|
|
hex dump window is the one at bottom left. ansi letter is 8 bits indeed
add ecx, 0 >> changes nothing
add ecx, 8 >> changes title pointer to 8 letters ahead. since it's blank i am guessing the title is 7 or shorter bytes and you have changed the pointer to the null terminator or something past that
sub ecx, 8 >> changes title pointer to whatever random data was 8 bytes before
here is how to change the title. breakpoint on the push ecx, check ecx's value in the registers window on top right. go to hex dump >> ctrl-g >> enter that address
edit the address there, save the change
otherwise find another codecave, write your new title and in your codecaved bit, do mov ecx, X where X is a pointer to your new title |
|
Back to top |
|
 |
tommmmmm Expert Cheater
Reputation: 0
Joined: 09 Apr 2006 Posts: 147 Location: Poland
|
Posted: Fri Sep 04, 2009 12:27 pm Post subject: |
|
|
hmmm you were right +8 pushes 8 letters not 1. Thus I have achieved partially solution. I can edit the title by eating letters.
The other thing is that making new title would be best to edit old global constant than create one from scratch - the "following in hex dump" idea sound very nice.
However as I said there's this problem with running application:
It is launched by launcher's launcher - double clicking results in an error - and attaching olly to already running process is kinds meaningless because the title was long ago set....
I might be wrong however - I'll test both ideas atm. _________________
My old signature contained a link to UCE for 822 GG MapleStory. So yeah, I decided to edit the signature.... |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Sep 04, 2009 12:45 pm Post subject: |
|
|
i see what you are saying. most likely, the executable with the title is the one that is setting that also though. also likely, is that the title is a static constant as opposed to created dynamically
case : static title
find buffer address, edit buffer, save changes. next time the app is loaded the new title will be used
case : dynamic title, unlikely
try to attach to process on creation. hardware breakpoint on buffer address to see what code is creating the title, we work from there
you seem to be missing the point that you can change the 'global constant' AND SAVE IT meaning next time the app loads up the 'global constant' that is accessed will be the new, modified one |
|
Back to top |
|
 |
|