AddressOfEntryPoint is the address from where code being executed. There is no difference how it named in sources "DllMain", "MegaCode" or "WhatEverShit".
DLLMAIN.DLL - is x86 DLL with EntryPoint set as 0041E084, here is "DllMain"
NODLLMAIN.DLL - is x86 EXE with EntryPoint set as 0040DD16, here is "main".
Code: Select allLPVOID WINAPI PELoaderGetEntryPoint(
LPVOID ImageBase
)
{
PIMAGE_DOS_HEADER pdosh;
PIMAGE_FILE_HEADER pfh1;
PIMAGE_OPTIONAL_HEADER32 poh32;
PIMAGE_OPTIONAL_HEADER64 poh64;
LPVOID EntryPoint = NULL;
__try {
pdosh = (PIMAGE_DOS_HEADER)ImageBase;
pfh1 = (PIMAGE_FILE_HEADER)((ULONG_PTR)ImageBase + (pdosh->e_lfanew + sizeof(DWORD)));
poh32 = (PIMAGE_OPTIONAL_HEADER32)((ULONG_PTR)pfh1 + sizeof(IMAGE_FILE_HEADER));
poh64 = (PIMAGE_OPTIONAL_HEADER64)poh32;
EntryPoint = (pfh1->Machine == IMAGE_FILE_MACHINE_AMD64) ?
(LPVOID)(poh64->AddressOfEntryPoint + (ULONG_PTR)ImageBase) :
(LPVOID)(poh32->AddressOfEntryPoint + (ULONG_PTR)ImageBase);
} __except (EXCEPTION_EXECUTE_HANDLER) {
#ifdef PELDRDBG
LdrOutputDebugString(TEXT("PELoader: GetEntryPoint failed\n"));
#endif
}
return EntryPoint;
}