LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Injecting a DLL into an EXE?

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.

0 Kudos
Message 1 of 12
(6,613 Views)

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.

0 Kudos
Message 2 of 12
(6,595 Views)

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.

0 Kudos
Message 3 of 12
(6,593 Views)

Are you talking about a LabVIEW executable, or are you just trying to spam your site link all over the internet?

0 Kudos
Message 4 of 12
(6,589 Views)

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.

0 Kudos
Message 5 of 12
(6,583 Views)

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.

0 Kudos
Message 6 of 12
(6,549 Views)
0 Kudos
Message 7 of 12
(6,546 Views)

What exactly does "inject into an exe" mean?

0 Kudos
Message 8 of 12
(6,544 Views)

@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.

 

Message 9 of 12
(6,534 Views)

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.

Rolf Kalbermatter
My Blog
Message 10 of 12
(6,523 Views)