Does anyone know of any Asm examples for calling C# dll exports dynamically.. ?
A C++ example would be ok as well, I can convert it.
Thanks
:idea:
Using COM: https://msdn.microsoft.com/en-us/library/zsfww439.aspx (https://msdn.microsoft.com/en-us/library/zsfww439.aspx)
Yeah.. I've been looking at that - thought there might be an Asm example lying around... not to worry though I'll make one.
:biggrin:
VAN,
You're referring to an exported .NET Framework class ???
VERTOGRAD wrote an exploratory app about a year ago: Finally I did it ... (http://masm32.com/board/index.php?topic=2106.msg23169#msg23169)
VERTOGRAD explains in great detail: Here's the sequence of calls for obtaining the pointer to virtual functions table of _AppDomain interface,... (http://masm32.com/board/index.php?topic=2106.msg23189#msg23189)
Actually I was thinking of writing a small mod for a game.. which unfortunately is written in C# (heaven knows why ?)
The thing is that I'm not sure whether the game exports functions outside .NET..
So I'm going to have to fiddle with COM and check if the GUIs are available.
The developers supply the interface (API) code for modders and I can extract the GUIs with IDA.
I'll give it a try.. otherwise I have to resort to ....ssshhh... keep quiet...Scripting in C# :-)
:shock: :icon_rolleyes: :greensml:
Hi, VAN,
DirectX can be accessed as managed (.NET Framework) code,...which is probably why the game was written in C#.
I just assumed that since you are interoperating with a C# module that it was a .NET Framework class or component. The .NET Framework is designed so that you can execute native code from within the C# module (https://msdn.microsoft.com/en-us/library/ms717435(v=vs.100).aspx). The whole Interop syntax (it was engineered primarily for COM and NET interoperability) is a pain in the ass,...and, very easy to get wrong. I don't even know how you would do it in MASM (but, I'll bet EDGAR or QWORD does). I assume that it's possible, but, prototyping the various C# routines would be a challenge.
It's been years since I wrote any NET Framework code, but, as I recall there is a utility that uses MetaData to disassemble a NET Framework app.
I think it's: (Ildasm.exe, IL Disassembler (https://msdn.microsoft.com/en-us/library/f7dy01k1(v=vs.110).aspx)).
These sites might be helpful:
Ildasm.exe Tutorial, MSDN (https://msdn.microsoft.com/en-us/library/aa309387(v=vs.71).aspx)
Reflection in the .NET Framework, MSDN (https://msdn.microsoft.com/en-us/library/f7ykdhsy(v=vs.110).aspx)
Interoperating with Unmanaged Code. MSDN (https://msdn.microsoft.com/en-us/library/sd10k43k(v=vs.110).aspx)