DLL issue
Posted: Fri May 29, 2020 10:53 am
Hello,
I am making a PE DLL loader. I managed to successfully create a GetProcAddress function, but am having issues reading the import table. Here is the code:
Thank you for your help.
I am making a PE DLL loader. I managed to successfully create a GetProcAddress function, but am having issues reading the import table. Here is the code:
Code: Select all
PE_VA moduleBase = LoadDll(moduleAddr, i);
PE_VA kernelBase = peHeader->optHeader.ImageBase;
PIMAGE_IMPORT_DESCRIPTOR importDir = (PIMAGE_IMPORT_DESCRIPTOR)
(peHeader->optHeader.DataDirectory[1].VirtualAddress + kernelBase);
PIMAGE_THUNK_DATA thunk = (PIMAGE_THUNK_DATA)(importDir->OriginalFirstThunk + kernelBase);
PIMAGE_IMPORT_BY_NAME import = (PIMAGE_IMPORT_BY_NAME)(thunk->u1.AddressOfData + kernelBase);
PSTR name = (PSTR)(import->Name);
DWORD proc = GetProcAddress(moduleBase, name);