C++向目标进程PEB模块链添加自己的DLL

有时候为了让内存注入的DLL现身, 就需要用到这个方法了
	auto lppeb = reinterpret_cast<PPEB>(AppBase::GetPEBAddress());
	if (NtGetModule(_T("QQManager.dll")) == NULL)
	{
		String StartupPath = String(BaseDllDir) + _T("QQManager.dll");
		BaseDllPEB.DllBase = BaseDllPEB.EntryPoint = pimage;
		RtlInitUnicodeString(&BaseDllPEB.FullDllName, StartupPath);
		RtlInitUnicodeString(&BaseDllPEB.BaseDllName, StartupPath);
		BaseDllPEB.InInitializationOrderLinks.Blink = &lppeb->Ldr->InInitializationOrderModuleList;
		BaseDllPEB.InMemoryOrderLinks.Blink = &lppeb->Ldr->InMemoryOrderModuleList;
		InsertTailList(<span style="font-family: Arial, Helvetica, sans-serif;">lppeb</span>->Ldr->InLoadOrderModuleList.Blink, &BaseDllPEB.InMemoryOrderLinks);
	} //if


你可能感兴趣的:(C++向目标进程PEB模块链添加自己的DLL)