Skip to content

Commit

Permalink
Update ManualMap.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemk14ebr authored Jan 3, 2024
1 parent 02dccef commit 633033d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions JITCall/JITLoadDll/ManualMapper/ManualMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ bool ManualMapper::loadImage(char* pBase) {
continue;
}

uint64_t* pThunkRef = (uint64_t*)(pBase + pImportDescr->OriginalFirstThunk);
uint64_t* pFuncRef = (uint64_t*)(pBase + pImportDescr->FirstThunk);
size_t* pThunkRef = (size_t*)(pBase + pImportDescr->OriginalFirstThunk);
size_t* pFuncRef = (size_t*)(pBase + pImportDescr->FirstThunk);

if (!pThunkRef)
pThunkRef = pFuncRef;

for (; *pThunkRef; ++pThunkRef, ++pFuncRef) {
if (IMAGE_SNAP_BY_ORDINAL(*pThunkRef)) {
*pFuncRef = (uint64_t)GetProcAddress(hDll, reinterpret_cast<char*>(*pThunkRef & 0xFFFF));
*pFuncRef = (size_t)GetProcAddress(hDll, reinterpret_cast<char*>(*pThunkRef & 0xFFFF));
} else {
auto pImport = (IMAGE_IMPORT_BY_NAME*)(pBase + (*pThunkRef));
*pFuncRef = (uint64_t)GetProcAddress(hDll, pImport->Name);
*pFuncRef = (size_t)GetProcAddress(hDll, pImport->Name);
}
}
++pImportDescr;
Expand Down Expand Up @@ -349,4 +349,4 @@ uint64_t ManualMapper::getProcAddress(HMODULE hModule, std::string procName) {
return RVA2VA(uint64_t, hModule, exportPtrs.addressOfFunctions[i]);
}
return 0;
}
}

0 comments on commit 633033d

Please sign in to comment.