I created a library
injection method on my machine in C++ which works very well when I try to inject a specific dll into a process. However, when I run the program on my friend's computer (where Visual Studio
's redistributables are not installed), I am warned that I need MSVCR
, etc ... (the redistributables).
So I compiled in the release
mode with the following setting in Visual Studio 2012 : Runtime Library : Multi-threaded /MT
. Now when I run it on my friend's
machine I am warned that I need only the library MSVCP110D.dll
( weird, asking for the debug version) (there is no antivirus, and UAC is disabled ).
I copied the requested library manually in the release path and still wont work.
This is the injection code i made :
int inject(string lpLibraryPath)
{
HANDLE hProc;
LPVOID paramAddr;
HINSTANCE hDll;
hDll = LoadLibrary(L"KERNEL32");
fpLoadLibrary LoadLibraryAddr = (fpLoadLibrary)GetProcAddress(hDll, "LoadLibraryA");
hProc = OpenProcess(PROCESS_ALL_ACCESS, false, id);
paramAddr = VirtualAllocEx(hProc, 0, strlen(lpLibraryPath.c_str()) + 1, MEM_COMMIT, PAGE_READWRITE);
if(WriteProcessMemory(hProc, paramAddr, lpLibraryPath.c_str(), strlen(lpLibraryPath.c_str()) + 1, NULL) == NULL)
{
return 0;
}
CreateRemoteThread(hProc, 0, 0, (LPTHREAD_START_ROUTINE)LoadLibraryAddr, paramAddr, 0, 0);
CloseHandle(hProc);
return 1;
}
};
I found some references on stackoverflow but they were of no help . like msvcp110.dll, how do I get around it? or Fixing the "MSVCP110D.dll is missing from your computer" issue