I need to inject into explorer.exe, I have a dll that has this code:
#include "stdafx.h" #include <stdio.h> #include "windows.h" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { MessageBox(NULL, "Hello injected to explorer.exe", "Info", MB_OK); } I tried to collect both 32 cue ball and 64 cue ball. Windows 10 x64.
There is an injector with this code:
char *CDP = TEXT("C:\\ProgramData\\windows.dll"); printf("Hi from inject\n"); HANDLE proc_handle; printf("Hi from inject\n"); LPVOID RemoteString; printf("Hi from inject\n"); LPVOID LoadLibAddy; printf("Hi from inject\n"); if (pID == 0) { printf("pID not found\n"); return false; } proc_handle = OpenProcess(PROCESS_ALL_ACCESS, false, pID); printf("Hi from inject\n"); if (proc_handle == 0) { printf("Cannot take file handle\n"); return false; } LoadLibAddy = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"); printf("Hi from inject\n"); RemoteString = (LPVOID)VirtualAllocEx(proc_handle, NULL, strlen(CDP), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); printf("Hi from inject\n"); WriteProcessMemory(proc_handle, RemoteString, CDP, strlen(CDP), NULL); printf("Hi from inject\n"); CreateRemoteThread(proc_handle, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibAddy, RemoteString, NULL, NULL); printf("Injection was successful\n"); CloseHandle(proc_handle); return true; printf("Hi from inject\n") used for debugging. Also collected both 32 and 64 cue ball. Only nothing is injected. In programs like torrents or browsers, it is injected without problems. What could be the problem?