-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using DNNE to generate proxy libraries #100
Comments
@DaZombieKiller Thanks for starting this conversation.
That is true. I don't see any way around that though. The biggest reason is the heavy impact of also transitioning from unmanaged to managed code. If a simple trampoline was all that was happening the transition would likely become far more costly to jump into managed code only to immediately jump to unmanaged code. I don't see a huge benefit in that.
From managed code, I think that is true. However, I just added support for supplying your own |
This is certainly an option for 32-bit, though on 64-bit it would be problematic when MSVC is the compiler being used (since it doesn't allow inline assembly). Maybe an additional feature to support |
I'm not sure that is the best way. The issue here is now DNNE would need to trigger an assembler – which I am loathe to do. Instead, I think supplying a Lines 60 to 62 in 52edb71
|
I am interested in experimenting with using DNNE to generate proxy libraries in C# using source generators, but I believe there is additional functionality necessary in DNNE to do so. I'm intending for this issue to serve as a discussion into how this functionality could be exposed (or if it's even considered to be within scope for the project.)
As a simple example: imagine that we want to log API calls to a COM library, which has the following exports:
A proxy library for this can be implemented today with code similar to the example below:
The signatures for these functions are well-known, but for the sake of the example let's imagine we either don't know what they are, or that they aren't relevant for what we want to do (in this example, logging API calls.)
Let's say that we only want to log calls to
DllGetClassObject
, and we don't care aboutDllCanUnloadNow
(or the potentially many other exports in the library). We would need to know the signatures of all of these exports in order to produce a proxy library with the above technique.The solution typically employed for this is for the body of the proxy method to simply
jmp
to the address of the real method, but as far as I'm aware there is currently no way to replicate this technique from DNNE.The text was updated successfully, but these errors were encountered: