ConvertVAtoFileOffsetEx

* now returns 0 on error (and not INVALID_VALUE  => -1)
* implementation for ReturnType 

In short I just copied that from:
c5aed9fccc/StaticEngine/Emulator.h (L507)
This commit is contained in:
cw2k 2020-11-03 05:37:41 +01:00 committed by GitHub
parent c5aed9fccc
commit 07ec166b94
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -590,7 +590,10 @@ public:
__debugbreak(); //return 0; __debugbreak(); //return 0;
if(!found->second.pe->IsValidPe()) if(!found->second.pe->IsValidPe())
__debugbreak(); //return 0; __debugbreak(); //return 0;
return found->second.pe->ConvertRvaToOffset(uint32(AddressToConvert)); auto offset = found->second.pe->ConvertRvaToOffset(uint32(AddressToConvert));
if (offset == INVALID_VALUE)
return 0;
return ReturnType ? FileMapVA + offset : offset;
} }
template<typename T> template<typename T>