mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-26 13:14:13 +08:00
safe
This commit is contained in:
parent
27b3c12800
commit
035795a693
@ -257,6 +257,7 @@ DWORD Rva2Offset(DWORD rva, PIMAGE_SECTION_HEADER psh, PIMAGE_NT_HEADERS pnt)
|
|||||||
}
|
}
|
||||||
pSeh++;
|
pSeh++;
|
||||||
}
|
}
|
||||||
|
if(pSeh->VirtualAddress==0||pSeh->PointerToRawData==0)return -1;
|
||||||
return (rva - pSeh->VirtualAddress + pSeh->PointerToRawData);
|
return (rva - pSeh->VirtualAddress + pSeh->PointerToRawData);
|
||||||
}
|
}
|
||||||
std::set<std::string> getimporttable(const std::wstring&pe){
|
std::set<std::string> getimporttable(const std::wstring&pe){
|
||||||
@ -299,7 +300,11 @@ std::set<std::string> getimporttable(const std::wstring&pe){
|
|||||||
while (pImportDescriptor->Name != NULL)
|
while (pImportDescriptor->Name != NULL)
|
||||||
{
|
{
|
||||||
//Get the name of each DLL
|
//Get the name of each DLL
|
||||||
ret.insert((PCHAR)((DWORD_PTR)virtualpointer + Rva2Offset(pImportDescriptor->Name, pSech, ntheaders)));
|
auto nameoffset=Rva2Offset(pImportDescriptor->Name, pSech, ntheaders);
|
||||||
|
if(nameoffset==(DWORD)-1)
|
||||||
|
//无导入
|
||||||
|
return {};
|
||||||
|
ret.insert((PCHAR)((DWORD_PTR)virtualpointer + nameoffset ));
|
||||||
|
|
||||||
pImportDescriptor++; //advance to next IMAGE_IMPORT_DESCRIPTOR
|
pImportDescriptor++; //advance to next IMAGE_IMPORT_DESCRIPTOR
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user