Log in

View Full Version : it's me again with more question :>


crUsAdEr
March 31st, 2002, 00:29
Hi folks,

yap it's me again.. asking more question than ever....

I am reversing this app, and i want to inject some code into this routine that is shared by a few buttons... I need to know which button was clicked so that i can patch appropriately... how should i go about finding the handle for the sender of this routine... it is a Delphi app!!!

Thanx.

foxthree
March 31st, 2002, 10:04
Hi binh:

You can do this by running Spy ++ and noting down the handle of those buttons. Then in SICE, do a bmsg (ie breakpoint on messages) and set a WM_COMMAND with BN_CLICKED. You can look up the definitions of these in MSDN.

But as for code injecting, you'll have to trap the WM_COMMAND itself (i.e. subclass the window containing these buttons) such that button click notifications arrive to your function and you can then play "master".

Hope this helps,

Signed,
-- FoxThree

LaptoniC
March 31st, 2002, 10:47
Delphi apps are little bit different.Ifyou dissamble with dede you can see the events when buttons are clicked like Button1Click etc.You can change this functions.Also in Dafixer's site there is a tutorial by him about adding functionality existing delphi apps.
hxxp://www.balbaro.com/dafixer/D1.html

foxthree
March 31st, 2002, 11:15
Man, I must be getting old. Ofcourse, try to disassemble the program using DeDe. You'll get a few laughs

Signed,
-- FoxThree

... er, unless ofcourse it is obfuscated by one of the delphi manglers

crUsAdEr
March 31st, 2002, 15:38
Thanx, guys

Yep, Delphi apps are more different... yeah i have read Dafixer's tutorial before and Dede is such a lovely tool... but i am still having problem... ah well since when we dont get problems :>... but hopefully someone can tell me where i did wrong...

Okie.... I wanted to add OnClick event on one of the label, so i go to the resource section (DFM), add in OnClick : Label1Click...

Then i go to the declration section in data section, increase the number of procedure declared in form 1 from 8 to 9 (1 more)... then i inserted a new procedure, with the same format as other procedure, aka : Hint, VA, ProcName
0000 0050 4000 0BLabel1Click
(of course Label1Click was in Hex :>>>

Yeah then i adjustted the caption etc so that the offset of others are same, ( i got lots of stream read error befoer getting this right)... so now Dede decompile it fine... it recognise my added procedure but when i run the prog, i get this error, Label.OnClick : invalid operand.....

When i change Label1OnClick to button1Click (an proc from the original program), it runs fine and when i clicked on label1, itperform button1click procedure.. but if i change this button1click to label1 click it reports the error...

So my question is do I have to declare my new added proc somewhere else as well before i can call it? (make sense but a search in the exe file for name of the original proc did not yield any other info :<.... Hope i made myself clear... somehow i feel that you would not understand what i am writing about :<<<.

Ah well... that is all... hopefully soemone can tell me what is wrong?

P.S : DaFixer tutorial only includes modifying event handler of existign procedure, not adding new one....

nikolatesla20
April 8th, 2002, 04:57
The only thing I can think of is that you have not accounted for the appropriate parameters that are to be passed to the OnClick function, and hence the "invalid parameter" message ?

-nt20