VC++ DLL - Injecting doesn't work... or does it?

02/01/2012 15:21 -impulse-#1
Don't bother to read this thread unless you are interested in C++, or you know C++.

I have written a C++ DLL using Visual C++ (didn't use .NET), it does some detours (that's it's main purpose.)

On my PCs, if I inject into an application it works just fine same for another person, but for a third person, it doesn't.
My injector returns successful when it injects but, by the time the injection is done (guess) the process dumps the DLL(as in it's not part of the process and I can rename, delete w/e to the DLL I wanted to inject).
I added a logger to it and in DllMain I tried to write in a file "Hello world." flush and close but it didn't get that far.

All three PCs got Windows 7, mine and the person's that it doesn't work on have both x64 version.
The injector is ran as Administrator and all have C++ Redistributable packages installed.
Yes, I've set the MFC to static.

Any ideas...anyone?
02/01/2012 15:48 Mr_PoP#2
maybe because it dependencies on your OS DLL files try this:

Code:
your project properties > Configuration Properties > C/C++ > Code Generation > Runtime Library (change it to "Multi-Threaded Debug (/MTd)
build it again and test it , it may work .
02/01/2012 15:54 -impulse-#3
Quote:
Originally Posted by Mr_PoP View Post
maybe because it dependencies on your OS DLL files try this:

Code:
your project properties > Configuration Properties > C/C++ > Code Generation > Runtime Library (change it to "Multi-Threaded Debug (/MTd)
build it again and test it , it may work .
Why MTd and not MD?
02/01/2012 16:03 Mr_PoP#4
Quote:
Originally Posted by -impulse- View Post
Why MTd and not MD?
MD
Quote:
Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file.

Applications compiled with this option are statically linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR100.DLL, which must be available at run time to applications linked with MSVCRT.lib.

also it use Debug on internal software that is not shipped to customers. The debug runtime library *can't* be included with your application legally. Just to be clear, you *can* ship a debug version of your application to a customer, but it should use the *release* version of the runtime library.
MTD
Quote:
Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.

The Debug runtime library gives you access to some helpful debugging aids for error reporting and tracking down memory leaks.
[Only registered and activated users can see links. Click Here To Register...]
02/01/2012 16:21 IAmHawtness#5
Have you solved the problem yet? Missing DLLs should give you a warning, at least that's what I've experienced.
02/02/2012 18:14 -impulse-#6
Quote:
Originally Posted by IAmHawtness View Post
Have you solved the problem yet? Missing DLLs should give you a warning, at least that's what I've experienced.
It's not a missing DLL problem ...
Anyway I am not sure I am waiting for that person. It might be solved.
In case it wasn't fixed I will bump the thread.

BUMP.

Thank you all for contributing. Problem solved.
In case you want a dll to work for everyone else, other than yourself,
1. Make sure MFC to static
2. Make sure the Runtime Library is set to MTd.