一种躲避模块检测的方法。(断链隐藏模块Ldr)含代码。

void hide_module()
{
	HMODULE hMod = AfxGetApp()->m_hInstance;
	PLIST_ENTRY Head,Cur;
	PPEB_LDR_DATA ldr;
	PLDR_MODULE ldm;
	__asm
	{
		mov eax , fs:[0x30]
			mov ecx , [eax + 0x0c] //Ldr
			mov ldr , ecx
	}
	Head = &(ldr->InLoadOrderModuleList);
	Cur = Head->Flink;
	do
	{
		ldm = CONTAINING_RECORD( Cur, LDR_MODULE, InLoadOrderModuleList);
		if( hMod == ldm->BaseAddress)
		{
			ldm->InLoadOrderModuleList.Blink->Flink =
				ldm->InLoadOrderModuleList.Flink;
			ldm->InLoadOrderModuleList.Flink->Blink =
				ldm->InLoadOrderModuleList.Blink; 
			ldm->InInitializationOrderModuleList.Blink->Flink =
				ldm->InInitializationOrderModuleList.Flink;
			ldm->InInitializationOrderModuleList.Flink->Blink =
				ldm->InInitializationOrderModuleList.Blink;  
			ldm->InMemoryOrderModuleList.Blink->Flink =
				ldm->InMemoryOrderModuleList.Flink;
			ldm->InMemoryOrderModuleList.Flink->Blink =
				ldm->InMemoryOrderModuleList.Blink;  
			break;
		}
		Cur= Cur->Flink; 
	}while(Head != Cur);
}

你可能感兴趣的:(游戏应用逆向)