
Originally Posted by
freedompeace
Your hack isn't even being started. This is a problem with your injector. IS the program being run administrator permissions? (WinXP = Right click context menu > Run As; WinVista/Win7 = Right click context menu > Run As Administrator)
Yes. It'll let me open any other process just fine (calc.exe for example) but not Engine.exe.
Edit: Code from my injector to enable SeDebug
Code:
void SetSeDebug()
{
HANDLE hToken;
LUID seDebugValue;
TOKEN_PRIVILEGES tPriv;
ZeroMemory(&tPriv, sizeof(tPriv));
if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
MessageBox(NULL, "OpenProcessToken failed.\nDLL injection may not work.\n", "Error", MB_ICONEXCLAMATION);
return;
}
if(!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &seDebugValue)) {
MessageBox(NULL, "LookupPrivilegeValue failed.\nDLL injection may not work.\n", "Error", MB_ICONEXCLAMATION);
CloseHandle(hToken);
return;
}
tPriv.PrivilegeCount = 1;
tPriv.Privileges[0].Luid = seDebugValue;
tPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if(!AdjustTokenPrivileges(hToken, FALSE, &tPriv, sizeof(tPriv), NULL, NULL) || GetLastError() != 0)
MessageBox(NULL, "AdjustTokenPrivileges failed.\nDLL injection may not work.\n\nTry running this program as an administrator.", "Error", MB_ICONEXCLAMATION);
CloseHandle(hToken);
}
And the code to inject the DLL:
Code:
int DllInject(HWND hDialog, DWORD procID, LPCSTR dllName)
{
int response;
char msg[1024];
HANDLE proc;
LPVOID remoteStr, loadLibrary;
sprintf(msg, "You have chosen to inject %s into process %d. Do you want to continue?", dllName, procID);
response = MessageBox(hDialog, msg, "Message", MB_YESNO | MB_ICONQUESTION);
if(response != IDYES)
return 1;
if(procID == 0)
return 2;
proc = OpenProcess(CREATE_THREAD_ACCESS, FALSE, procID);
if(proc == 0) {
sprintf(msg, "Failed to open the process: %d", GetLastError());
MessageBox(hDialog, msg, "Error", MB_ICONEXCLAMATION);
return 3;
}
loadLibrary = (LPVOID) GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
remoteStr = (LPVOID) VirtualAllocEx(proc, NULL, strlen(dllName), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory(proc, (LPVOID) remoteStr, dllName, strlen(dllName), NULL);
CreateRemoteThread(proc, NULL, 0, (LPTHREAD_START_ROUTINE) loadLibrary, (LPVOID) remoteStr, 0, NULL);
CloseHandle(proc);
MessageBox(hDialog, "DLL successfully injected into process.", "Message", MB_ICONINFORMATION);
return 0;
}