05-12-2012 05:24 PM
I'm trying to simply inject a dll into a running excutable.
Similar to this: http://www.mpgh.net/forum/292-combat-arms-spammers-injectors-multi-tools/399433-extreme-injector-v1-... - Scroll down a bit.
05-13-2012 12:14 PM
Scroll down to what?
I don't understand what you are trying to accomplish, or why.
If you have a .NET Assembly, then you can call it using the .NET functions in LabVIEW.
05-13-2012 12:48 PM
Basically I have a DLL programmed in C++ and I want to inject that DLL into an Excutable so it can hook into the Excutable's memory.
05-13-2012 01:00 PM
Are you talking about a LabVIEW executable, or are you just trying to spam your site link all over the internet?
05-13-2012 01:13 PM
No I'm not trying to spam. This is not my website, and the website has nothing to do with why I'm trying to do this, it just has a good example of what I'm trying to accomplish.
05-13-2012 07:09 PM
Why are you asking this question in this forum? Is there a LabVIEW connection? You've told us that you have a DLL written in C++ that you want loaded into some executable, with no mention of LabVIEW at all.
05-13-2012 07:48 PM
I want to inject using LabView.
http://forums.ni.com/t5/LabVIEW/Injecting-a-DLL-into-an-EXE-with-NET/td-p/1989389
05-13-2012 07:53 PM
What exactly does "inject into an exe" mean?
05-14-2012 12:26 AM - edited 05-14-2012 12:27 AM
@oliver_alarm2079 wrote:
I'm trying to simply inject a dll into a running executable.
Hi, oliver_alarm2079,
Your question is "too common", and looks like "beginner" question. What is your final goal for code injection? Assumed, that if you thinking about this - you're experienced user with deep LabVIEW and OS understanding. In parallel topic I see then you trying to wrote the injection utility in LabVIEW. Impossible is nothing, but LabVIEW is pretty high level tool, so using MSVC is the best and easiest way (you will need this in any case, because for code injection you will need to know the addressed of the hooked functions - its impossible in LabVIEW directly).
Basic of code injection - is routing DLL calls from external application into your code. The easiest way is - use own proxy dll with same export as original and __declspec(naked), then perform jumps into original code. Another possible way is hooking with MS Detours. The CreateRemoteThread/WriteProcessMemory technique is also pretty advanced. But from your code I see that you haven't enough experience, sorry about that.
In the past I've used code injection with LabVIEW only once. It was used for debugging. I've got trouble with my builded exe. LabVIEW Run-Time sporadically throws internal exception at line 663 in MemoryManager.cpp in large application. So, I wrote my own DLL, then inject the code into DSSetHandleSize (function where exception occurred), then trace all calls and finally successfully figured out which LabVIEW code was involved.
What I can recommend to you - proceed to www.codeproject.com and search for keywords like "code injection, proxy dll, ms detours". You will get much more information about this.
Andrey.
05-14-2012 02:37 AM
In addition to what Andrey mentions, you can do these things in modern OSes only with full privileges. The OS has specific debug APIs you need to use for this and they refuse to work with lower privileges. Trying to do it in different ways also is a dead end, since the OS nowadays protects process bounderies rather effectively.