Cracking WinForm Apps

Nov 13, 2008 at 2:07 PM
Hi Josh,

I have a quick question (hopefully not a stupid one!). When I crack a WPF app I locate the Application class and drill down into the application instance via the Current property.

How do I perform the same with Windows Forms? When I crack a WinForms app the Program / Application class doesn't seem to have any static properties. How do locate the instance of my application?

By the way, thanks for Mole (and to the other Molers). It is a tool that I use all the time.

Colin E.
Coordinator
Nov 13, 2008 at 3:14 PM
Hi Colin,

Thanks for the feedback on Crack.NET.  To access a window in a WinForms app, you can navigate to the System.Windows.Forms.Form class, and then drill into the ActiveForm property.

Josh
Dec 3, 2008 at 8:25 PM
Josh,

When I try to crack WinForms app this way, the ActiveForm property points to the Crack.NET UI itself. Is taht a bug?

Justin
Coordinator
Dec 3, 2008 at 8:27 PM
Justin,

That's not a bug.  The injected window from Crack is truly running inside of the cracked process, and becomes "part of" the cracked application.  It actually can be the active form in the cracked app.

Josh
Dec 3, 2008 at 11:10 PM
> It actually can be the active form in the cracked app.

Actually, it's always the active form of the app (since the Crack.NET window has to be active when I browse the tree/refresh the view etc.), right? Maybe you should add an easy entry point to the main window of the process or add a property for that to the Crack.NET window where we can drill down to the main window instance.

Thanks anyway for that great tool.
Coordinator
Dec 3, 2008 at 11:14 PM
The Application class in WinForms already provides the static OpenForms collection, so I don't see why Crack.NET should expose anything "extra" here.

Josh
Dec 3, 2008 at 11:47 PM
Hi Josh,

thank you for that! I didn't know about that collection, and I'm sure a lot of other don't either. One or two sentences in the readme or here on the page would have helped me a lot (and btw. pointing to Form.ActiveForm completely steered me in the wrong direction).

Here's another question: is there any solution for not being able to inspect modal dialogs? As Crack.NET's window is injected into the app's process I'm afraid I already know your answer, but maybe I'm missing something here too.

Thanks again.
Coordinator
Dec 3, 2008 at 11:51 PM
Your hunch is correct: since the dialog is modal, the injected window won't be available until you close it.  I'm not sure if there's a workaround for that one.  :-\

Josh