Open lahma0 opened 10 months ago
@lahma0 I'm almost certain that your problem will be fixed by replacing <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
with <EnableDynamicLoading>true</EnableDynamicLoading>
. See the sample project.
If that doesn'5t work, please attach a copy of your code for me to test. Thanks!
@Mbucari Unforunately, that did not work. I've attached a zip which includes my solution containing both the injector and the patcher. It also contains a copy of the program that I'm attempting to inject the patcher DLL into ('ColorControl' directory). This is totally not important so if you're busy or have better things to worry about at the moment, please don't waste time on it. If you can get around to looking at it at some point, that would be great, but seriously, no hurry. ColorControlPatcher.zip
Hi again @Mbucari , I'm attempting to use your library again but this time I'm trying to inject a .NET 7 DLL into a .NET 7 process. Unfortunately, after injecting (WaitForReturn: true), Marshal.ThrowExceptionForHR is throwing a COM exception and the 1st line of code in my injected DLL isn't even running (1st line is debug output which isn't appearing). My Inject method looks like this:
I also tried using the following as the fully qualified name as it is what is actually returned by 'methodInfo.DeclaringType.AssemblyQualifiedName':
Since .NET 7 DLLs don't normally output a runtimeconfig.json file, I included
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
in the project file of my DLL that is injected (so a runtimeconfig.json file is being output now).Here is an image of the exception being generated:
The error code being returned is -1073741819 or 0xC0000005.
Here is the beginning of the bootstrap method in my dll that is being injected:
My injector is set to x64 and the process I'm injecting into running as a 64-bit process. I've tried following your examples as closely as possible and I've tried every variation and permutation I can think of but nothing is working. I'm sure I'm doing something wrong though.. Is there anything you can see that I'm explicitly doing wrong or is there any advice you can offer? I really appreciate your help. Thanks!