Page 1 of 1
Mono dissect + get pointer for .net generic class
Posted: Sun May 08, 2022 2:37 pm
by Pekar
Hello everyone.
After mono disscection we have reflected .net names for addresses.
And we can do some operation with names, for example
aobscanregion(pointer1, Controller:Update, Controller:Update+1000, 0F ** 0F)
But due to .net structure we may get a huge string
Controller+<Coroutine>d__42:MoveNext
is it possible to use this generic named adrres some how in variables or with aobscanregion?
ofc, this is not working
aobscanregion(pointer1, Controller+<Coroutine>d__42:MoveNext, Controller+<Coroutine>d__42:MoveNext+1000, 0F ** 0F)
Re: Mono dissect + get pointer for .net generic class
Posted: Sun May 08, 2022 3:10 pm
by GreenHouse
I don't think so. Your best bet is either to use a normal AOBScan, or to make a LUA script which gets all classes and does search for the name you input. Which is pretty much what I do.
Re: Mono dissect + get pointer for .net generic class
Posted: Tue May 17, 2022 9:36 pm
by Pekar
GreenHouse wrote: ↑Sun May 08, 2022 3:10 pm
I don't think so. Your best bet is either to use a normal AOBScan, or to make a LUA script which gets all classes and does search for the name you input. Which is pretty much what I do.
Attempting to do
local Controller_ClassID = mono_findClass('Assembly-CSharp', 'Controller+<Coroutine>d__42')
is also nil
what the heck? why?
Re: Mono dissect + get pointer for .net generic class
Posted: Tue May 17, 2022 10:01 pm
by GreenHouse
Pekar wrote: ↑Tue May 17, 2022 9:36 pm
what the heck? why?
You should get the last monoscript, which works with those. Just copy/paste the "mono_image_findClassSlow" function into a main script that is enabled before the rest do, and then use "mono_findClass" the same way.
Last monoscript:
[Link]
Re: Mono dissect + get pointer for .net generic class
Posted: Tue May 17, 2022 10:17 pm
by Pekar
found the reason and how it works.
I've used github repo to investigate how it works...
There is no simple methrods, so i've done as
enum images -> select image by assemblyid -> enum classes
due to tracing I found that there is no combination as
Controller+<Coroutine>d__42
but with
print(string.format("%x : %s:%s", classes[i].class, classes[i].namespace, classes[i].classname))
got
22c5af5d5a8 : :Controller
22d6dd8df50 : :<Coroutine>d__42
that means
if I use
local Controller_ClassID = mono_findClass('Assembly-CSharp', '<Coroutine>d__42')
and just
<Coroutine>d__42:MoveNext
in memory view or in a aobscan
and the final form
local Coroutine_MethodID = mono_findMethod('Assembly-CSharp', '<Coroutine>d__42', 'MoveNext')
it's working!!!
it's really not obvious
and no where described