![]() |
|
|
|
#1
|
|||
|
|||
|
Code:
bInjectLibrary(pi.hThread, DllPath.c_str()); // Resume process execution ResumeThread(pi.hThread); Code:
bInjectLibrary(pi.hProcess, DllPath.c_str()); // Resume process execution ResumeThread(pi.hProcess); //Close thread handle CloseHandle(pi.hThread); //Close process handle CloseHandle(pi.hProcess); |
|
#2
|
|||
|
|||
|
ResumeThread() has to be called with pi.hThread, that was right. The process will stay suspended, if you call it with pi.hProcess.
But apart from that, I tried your suggestions. I also tried to start the process non-suspended, which doesn't work either... This injection stuff is a debugging nightmare, you can't debug it in the development environment, and debugging in IDA doesn't work neither because of all this .NET stuff... :-( Don't you have somer loader, which is known working for .NET applications? |
|
#3
|
|||
|
|||
|
Sorry yes that was a typo. Are you on a x64 system? If the .NET metadata in your target executable is not marked as 32bit required then it will spawn as a 64bit process. This will result in failure. You will need to compile the DLL as a 64bit DLL to inject.
I have successfully got the DLL working in your test app, spoofing processor ID with my hook + this loader: http://code.google.com/p/injector/ Command line: newloaderv4.1.exe --lib "E:\Downloads\WmiSpoof.dll" --launch Test.exe http://i.imgur.com/2rqsj.png |
|
#4
|
|||
|
|||
|
Yes, I am on a x64 system...
I just tried the loader you mentioned in a virtual machine (x86), but without any success either... Code:
newloaderv4.1.exe --lib WmiSpoof_x86_StaticRuntime.dll --launch Test.exe When I close Test.exe, the loader outputs: Code:
Error: [@InjectLibraryW] Unknown Error (LoadLibraryW). Error: [@SuspendResumeProcess] NtResumeProcess. [NtStatus: 0xC000010A] [LastErro r: 6] Error: [@InjectLibraryW] Could not resume process. Error: [@commandline_parser] Injection failed. I built it Non-Unicode with static runtime ('release' mode) with MSVC 2010. I tried other options as well, neither worked (dynamic runtime, Unicode). Does my attached DLL work for you? (Thanks for your patience, by the way!) |
|
#5
|
|||
|
|||
|
Yes, it works when I run the injector from administrative cmd line and modify the exe to have 32bit required in the .NET metadata header.
|
|
#6
|
|||
|
|||
|
So why doesn't it work for me?
I tried to run it on Windows XP x86, as the Administrator user... No luck! What's your version of the .NET Framework? Maybe that's the difference... |
|
#7
|
|||
|
|||
|
You are hooking a non-framework native module. I do not know what to tell you if it does not work on XP (unless you are lacking runtimes for VS2010 or something, even though it does not import it). I am on Windows 7 Ultimate x64 SP1 with all updates and it works fine, and it worked when I was on XP SP3 as well.
When I compile modules like that I link against the latest WDK libs and headers to cut down on size and importing anything from the new runtimes. It will link against msvcrt.dll instead. Perhaps you can PM me and tell me what you want to spoof your processor ID to and I can compile one in my environment and you can try it. |
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .NET dll hooking | Avi_RE | General Discussion | 10 | 09-28-2023 07:09 |
| API Hooking | thomasantony | General Discussion | 5 | 04-22-2005 11:44 |
| API-hooking | MaRKuS-DJM | General Discussion | 11 | 03-25-2005 13:27 |
| C++ Help (Hooking a function) | Peter[Pan] | General Discussion | 8 | 08-31-2004 20:37 |