I was inspired to write this DIY(do it yourself) after guy known by name VicR
asked me to tell how i did all that dumping stuff.
Although all that was rather long ago, i will try to reproduce steps and finally
get those classes.
| In case of StarForce it will be challenging to exemine il2fb.exe, rts.dll etc. I didn't bother to do it myself. |
| Here you can get LDR, LDRCallBack, RTS, SFSInputStream already retrieved. |
| When i played with IL2(1st), patching of rts.dll was used. Patching of jvm is more elegant way i think, because it will allow to bypass SF (partly) |
| Here are sources of small tool to probe JVM(find DefineClass) and dumper itself(VC++) |
Don't forget to make backup copies of file(s) to be changed
First of all we need to determine position of DefineClass inside the jvm.dll.There are several methods to achieve this. You may disassamble jvm.dll and find the place of interest.
| I didn't manage to run dumper stably under SF.That caused crash of IL2 and crash log didn't show my dll in list of loaded modules. It seems that SF knows which modules should be loaded, and unloaded my dll. Sneaky SF!! But ~8Mb of dumped classes were already in the basket :) |
Or you may allow JNI to determine it for you. Also you'll need dumper function
to save bytearray when we intercept DefineClass call.
I chose to use it as dll exported functoin. Lets consider that DefineClass
is positioned at 219ae ;) inside jvm.dll. We have
to extend import section with info about our dumper. PE
Tools allows to do it almost automatically. When we have our import
added it's time to do some hex editing. First thing to do is to find some free
space inside jvm.dll to add our custom code. Good place to look is end of code
section.
Open jvm.dll with hex editor (from here all actions are applied to Hiew. Capable
hex editor may have similar features).
We
see that code section has 560 bytes of unused space (94000
- 93dd0). Good place to add some nop
- s from ;) Don't forget about ofset(1000)
during RVA calculations.