c++ - injecting a dll is not working on windows XP -
Then I'm trying to create an injector to inject a dll that is to hook a game client Uses Both were made with VC ++ 2010, so it should have worked, but this game launches on Windows XP but DLL is not being injected, idk is wrong here! EDIT: Well I believe MSVCR100D.DLL is missing in my XP, so my DLL Is not it dependent on this? Make your program not based on msvcr100.dll / msvcr100d.dll Open the project properties & gt; (Configurable Properties) -> Use General-> MFC-> Use "Use MFC in a Static Library" plus set the configuration to "Release" Default "Debug" is now form it again. Or you can "share" it by default, just click on "release" Change A configuration and add msvcr100.dll in your program. (Or install package) Release build takes less MB. The Free View C ++ version is unable to create stable MFCs only Visual Studio Professional or above pay or verage version. detours , it's easy, but there is a problem I do not know what is wrong it works fine on
Windows Vista + , but working on XP Not doing ... here is my code
// injector #ifndef INJECTOR_H_INCLUDED #define INJECTOR_H_INCLUDED #include & lt; Windows.h & gt; Class Injector {Private: STARTUPINFOA * Startup; PROCESS_INFORMATION * Process; Four * directory; BOOL start (four * applications); Public: Injector (four * directory); ~ Injector (zero); BOOL enclosed (four * applications, four * DLL); }; #endif // INJECTOR_H_INCLUDED #include "Injector.h" #include & lt; String & gt; # Include & lt; Cstdio & gt; using namespace std; Injector :: Injector (Four * directory) {int Size = strlen (directory) + 1; Directory = new four [size]; MoveMemory (directory, directory, size); Startup = new STARTUPINFOA (); Process = new PROCESS_INFORMATION (); } Injector: ~ Injector (Zero) {Delete} directory; Remove startup; Remove process; } BOOL Injector :: Start (four * applications) {Four command line [256]; Sprintoff (command line, "% s \\% s black", directory, application); Refund A (tap, command line, zero, zero, wrong, NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED, zero, directory, startup, process); } BOOL Injector :: Attach (four * application, four * dll) {if (start (application)) {handle hProcess = OpenProcess (PROCESS_ALL_ACCESS, false, process> dwProcessId); If (hpr.! = Null) {int length = stellon (dll) + 1; LPVOD Remote Memory = Virtual Aloxex (Hprocus, Nouvel, Length, MAMCMMIT, PNERDrite); If (RemoteMemory = zero!) {If (WriteProcessMemory (hProcess, RemoteMemory, Dll, length, null)) {FARPROC hLoadLibrary = GetProcAddress (GetModuleHandleA ( "Kernel32"), "LoadLibraryA"); Handle hThread = CreateRemoteThread (Acprosas, Nul, narwhal, (Elpithred_arartiitiian) Acelod Library, remote Memori, narwhal, null); If (hThread! = NULL) {WaitForSingleObject (hThread, 5000); VirtualFreex (Hprocus, Remote Memory, 0, Memolase); CloseHandle (hProcess); ResumeThread (Process & gt; hThread); Return TRUE; }} VirtualFreex (Hprocus, Remote Memory, 0, Mammules); } CloseHandle (Hprosas); } Resumereadth (process-> hThread); return false; } Else {printf ("CreateProcessA failed with the following error:% d \ n", GetLastError ()); return false; } return false; } // key racer / DLL with dllmain.cpp: defines the entry point for the DLL application #include "stdafx.h" #include "detours.h" # include & lt; WinSock2.h & gt; #include & lt; Shellapi.h & gt; HINSTANCE (WINAPI * OriginalShell) (HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory Int nShowCmd) = ShellExecuteA; HINSTANCE WINAPI DetouredShell (HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory Int nShowCmd) {if (strcmp ( "http://co.91.com/signout/", lpFile) == 0) {lpFile = "Http://www.google.com"; } Return the original shell (HWd, LPO Operation, LPFI, LPPermatories, LP Directory, Enosho CMD); } BOOL APIENTRY DllMain (HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {switch (ul_reason_for_call) {case DLL_PROCESS_ATTACH: DetourTransactionBegin (); DetourUpdateThread (GetCurrentThread ()); Affair Art (& amp; (Pivioaidi & amp ;; original shell, Detros shell); DetourTransactionCommit (); case DLL_THREAD_ATTACH: Case DLL_THREAD_DETACH: Case DLL_PROCESS_DETACH: break;} return TRUE;}
Comments
Post a Comment