peppy
peppy
CC#
Created by peppy on 6/15/2023 in #help
In a hooking/detouring scenario, "A callback was made on a garbage collected delegate of type (...)"
8 replies
CC#
Created by peppy on 6/15/2023 in #help
In a hooking/detouring scenario, "A callback was made on a garbage collected delegate of type (...)"
Which admittedly doesn't do much to explain what's going on for me, but I'll raise it with the relevant folks and see if they can clarify why the two would not be able to coexist.
8 replies
CC#
Created by peppy on 6/15/2023 in #help
In a hooking/detouring scenario, "A callback was made on a garbage collected delegate of type (...)"
Okay, it gets more confusing. If I run my hooks alone, as I normally do, everything works just fine. No problems, and definitely no crashes with randomly "garbage collected" delegates. That being said. For this particular application, there is another oft-used .NET application that runs beside it. It attaches to the process and twiddles a few knobs. It is only when it runs side-by-side with my hooks that I get this nonsense occurring.
8 replies
CC#
Created by peppy on 6/15/2023 in #help
In a hooking/detouring scenario, "A callback was made on a garbage collected delegate of type (...)"
however I thought that GetFunctionPointerForDelegate on a UnmanagedFunctionPointerAttribute with a reference was fine anyway.
Yeah, exactly. The delegate type I'm using here (PrintfVarargDelegate) is marked [UnmanagedFunctionPointer(CallingConvention.Cdecl)],
8 replies
CC#
Created by peppy on 6/15/2023 in #help
In a hooking/detouring scenario, "A callback was made on a garbage collected delegate of type (...)"
If this is insufficient material to go on, I can share the entire project at your request.
8 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
Glad it was discovered. Thank you once again for your time and patience. The workaround is perfectly fine for now; it works well.
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
Thank you very much, I was in over my head here
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
I appreciate the help regardless- if you could just post a link so I can track the issue, that'd be great
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
1686077931073 | [Info] printfh.cs:83 (CLRPrintfHook): fmt: Virtuos: Loaded %s successfully, size = %d
1686077931073 | [Info] printfh.cs:84 (CLRPrintfHook): argc: 2
1686077931073 | [Info] printfh.cs:108 (CLRPrintfHook): bl: 94
1686077931073 | [Info] printfh.cs:83 (CLRPrintfHook): fmt: Virtuos: Loaded %s successfully, size = %d
1686077931073 | [Info] printfh.cs:84 (CLRPrintfHook): argc: 2
1686077931073 | [Info] printfh.cs:108 (CLRPrintfHook): bl: 94
etc. etc.
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
seems to work as intended now
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
the _scprintf call indeed does not crash if the P/Invoke is declared in fhcshook itself
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
Got it, be right back
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
Sure, one moment
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
I assume this also means I can just place the P/Invoke definitions in fhcshook, or does it specifically have to be what you just said
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
In fact, in my use case the call will never be in the same assembly as the P/Invoke.
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
The call is in fhcshook.dll.
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
all the way in the original post, for instance, there are _vscprintf and vsprintf signatures that do not exhibit any issues
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
The "special" thing in this instance is that I'm hosting the CLR, but then again, any non-vararg P/Invokes work fine in the exact same scenario
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
The assembly containing the P/Invoke signature is just a regular old class library: https://github.com/fkelava/fahrenheit/blob/main/src/cs/Fahrenheit.CoreLib/Fahrenheit.CoreLib.csproj and the assembly using it doesn't seem to me to be out of the ordinary either: https://github.com/fkelava/fahrenheit/blob/main/src/cs/Fahrenheit.CLRHost/Fahrenheit.CLRHost.csproj I build them and that's it- I host the CLR and jump into a static method in CLRHost
67 replies
CC#
Created by peppy on 6/5/2023 in #help
✅ ✅ Vararg P/Invoke (x86) throws BadImageFormatException (0x80131124 "Index not found")
Post-processing? What would fall into 'post-processing'?
67 replies