2298为explorer的PID DLL为64位
,process explorer查看不到explorer中有此DLL模块
// TODO: 在此添加控件通知处理程序代码
//This dll path should be relative to the target process or an absolute path
char* dll = "D:\\ggg\\TEST_TrayClock\\x64\Debug\\TrayClockDll.dll";
//We need a handle to the process we will be injecting into
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 2298);
//Create the space needed for the dll we are going to be injecting
LPVOID lpSpace = (LPVOID)VirtualAllocEx(hProcess, NULL, strlen(dll), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
//Write inject.dll to memory of process
int n = WriteProcessMemory(hProcess, lpSpace, dll, strlen(dll), NULL);
HMODULE hModule = GetModuleHandle(L"kernel32.dll");
LPVOID lpBaseAddress = (LPVOID)GetProcAddress(hModule,"LoadLibraryA");
//Create Remote Thread using the address to LoadLibraryA and the space for the DLL
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)lpBaseAddress, lpSpace, NULL, NULL);
MessageBox(L"Inject");
//CDialogEx::OnOK();