Lookup XEX export by ordinal

This commit is contained in:
Dr. Chat
2015-05-05 18:54:01 -05:00
parent 7898851856
commit bffd2624fc
3 changed files with 57 additions and 10 deletions

View File

@@ -143,9 +143,12 @@ X_STATUS XUserModule::LoadFromMemory(const void* addr, const size_t length) {
}
void* XUserModule::GetProcAddressByOrdinal(uint16_t ordinal) {
// TODO(benvanik): check export tables.
XELOGE("GetProcAddressByOrdinal not implemented");
return NULL;
PEExport export;
int ret = xe_xex2_lookup_export(xex_, ordinal, export);
if (ret) return nullptr;
return (void*)export.addr;
}
void* XUserModule::GetProcAddressByName(const char* name) {
@@ -153,7 +156,7 @@ void* XUserModule::GetProcAddressByName(const char* name) {
int ret = xe_xex2_lookup_export(xex_, name, export);
// Failure.
if (ret) return NULL;
if (ret) return nullptr;
return (void*)export.addr;
}