Closed ghost closed 3 years ago
Given that you have tried using 2 libraries, have you considered that perhaps your problem may be somewhere else?
I copied your code to a new empty .NET 5 Project, replacing Minecraft (not installed on this laptop) with notepad
and had no issues.
I injected Reloaded-II because it was the first DLL that came into my head.
Hm, I'm using some try-catch loops (whenever I try to inject it, the catch always triggers). I didn't find a way to remove it otherwise without the program crashing.
When thinking about injection problems; the following things typically come to mind:
Target process running as Admin but your process is not running as admin.
A DLL required by the DLL you are injecting cannot be found. (e.g. vcruntime140.dll
if you are missing Visual C++ Runtime).
Hint: Dependency Walker
Interference from Antivirus software etc.
I know it's not much of a hint but it's better than nothing :P
The result of GetLastError
may possibly also be useful but with how this library's built it's not an option.
My source code is available if you want to take a quick check on it (if you have the time)
https://github.com/AcaiBerii/BootJect
Otherwise, I do have an admin script in my manifest. (<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />)
, leftover code from my experiments with Memory.DLL. My antivirus is not running at the moment and not giving me any notifications of the sort.
I do believe that the process I'm trying to inject the DLL into has it's own anticheat, but it may not be true (Minecraft: Windows 10 Edition). I'm making a mod for it and it should work. Otherwise, I will try another app to inject my dlls into. I did hear you tried Notepad, so I will try that next. Thank you for your time!
Ah, never mind, I see now. My program is coded in x64, and the DLL injection is meant for x32/x86. Sorry!
Note: Unlike most libraries, this library does support injecting into x86 processes from an x64 process (but not the other way around).
If you look at the library's Unit Tests, you should see such is the case.
I got an error from the try-catch loop with an exception this time: System.ComponentModel.Win32Exception (0x800004005): A 32 bit processes cannot access modules of a 64 bit process. So that would mean the library is x32? I couldn't find any other way to find this out.
Hint: It means your program is running as 32-bit.
If you're working with the old .NET Framework and compiling under AnyCPU, I suggest googling the term "Prefer 32-bit"; it's on by default.
Ah, thank you. I did update my build config and it worked. I appreciate your answer a lot!
For a good library like this, I think it would be a good idea to make docs on how to inject DLLs into a process. I didn't find any good way to convert a C++ DLL to bytes and stuff, and using the type "dll" with the code
OpenFileDialog open = new OpenFileDialog(); open.InitialDirectory = "c:\\"; open.Filter = "DLL Cheats (*.dll)|*.dll"; open.RestoreDirectory = true; if (open.ShowDialog() == DialogResult.OK) { string fullPath = open.FileName; string fileName = open.SafeFileName; string path = fullPath.Replace(fileName, ""); Process[] proclist = Process.GetProcesses(); foreach (Process pr in proclist) { if (pr.ProcessName.StartsWith("Minecraft")) { Injector inj = new Injector(pr); inj.Inject(fullPath); inj.Dispose(); } } }
didn't work. I tried using both Memory.dll and this, nothing from either of them.