Closed daemitus closed 3 years ago
As long as the address you're hooking is right, you should be good if you switch the convention to stdcall
.
While it is true that IDXGISwapChain is a C++ interface and the calling convention would probably be thiscall
if it was part of the compiled program; consider the fact that you are technically interfacing with DX11 through COM where the standard calling convention is generally stdcall
.
For a quick cheat sheet, you can always look at the definition of CallingConventions
:
Extra Note: I've already made a Dear ImGui overlay you could use with Reloaded. :P
Edit:
And don't forget to use Reloaded
's own Function
attribute.
You can probably get away with something like this:
[Function(CallingConventions.Stdcall)]
public delegate IntPtr Present(IntPtr swapChainPtr, uint syncInterval, uint flags);
Hadn't seen your ImGui impl before. Great resource. Thanks for the quick response :)
@Sewer56 Apparently, the hook always worked just fine. It crashes due to the Discord overlay hook being already in-place on the same function. Got any ideas?
Well one thing that's worked so far, although I'm not entirely sure if it's the smartest way to do things: hooking the discord hook (or any other hook that hooks present) instead. Following any 0xE9 or 0xFF jumps until it gets back to real code.
I'm porting a project to net5 and trying to migrate off net472+easyhook. Currently, hooking d3d11.Present to render some ImGui windows is causing a crash-to-desktop on calling OriginalFunction. The data coming into the function looks to be valid as far as I can tell. I assume the issue is the calling convention, but I'm not entirely sure. If I swap out Reloaded for CoreHook, it works as expected.
This is the delegate currently being used to create the hook.
Do I need to use a calling convention wrapper to make this work properly or take some sort of other additional step?