Quote:
Rage9 (08-05-2001 20:08):
LaptoniC: sorry my bad, that way is much easier, the other way you would have to add the api's to the import table, sorry!
-Rage9 |
Actually, I found it interesting that you *could* load a dialog resource from a dll without using FindResource and LoadResource. You just need to modify the params of WinMain and CreateDialogParamA.
I've been playing with this to see how you could load the resource using FindResource and LoadResource. I made up a skeleton app using Iczelion's tut 10-1 example. Adding a LoadLibrary call for the dll and changing WinMain and CreateDialogParamA as above I was able to duplicate the results of patching the crackme, the correct dialog box was called.
However, I got some strange results when I added the following code:
invoke FindResource, hInstance_of_Dll, ADDR DllResource, RT_DIALOG
invoke LoadResource, hInstance_of_Dll, eax
;returns a global memory pointer of the resource that can be used in subsequent API's
invoke CreateDialogIndirectParam, hInstance, eax, 0, wc.lpfnWndProc, 0
I get the dll resource displayed, but it's corrupted. The bitmap, icon and buttons don't show, but the edit boxes, static text and main window does. Even more strange is that there seems to be a morphing with the original dialog resource that's in the exe (I used Icz's example resource). The dll dialog box now has menu items as well!
LOL, what's the term, Transmogrification? It seems that some of the exe dialog resource is in memory where only the dll dialog resource should be, after the LoadResource call.
Anyway, I'm just trying to figure out the proper procedure to call a dialog resource from a dll using FindResource and LoadResource. CreateDialogIndirectParam is supposed to create a modeless dialog box from a dialog box template in MEMORY, so I think this is the right API to use, and it does work - to a degree
Anybody got any insights?
Kayaker