clang-format
This commit is contained in:
@@ -989,7 +989,7 @@ int xe_xex2_get_import_infos(xe_xex2_ref xex,
|
||||
}
|
||||
|
||||
int xe_xex2_lookup_export(xe_xex2_ref xex, const char *name,
|
||||
PEExport &peexport) {
|
||||
PEExport &peexport) {
|
||||
auto header = xe_xex2_get_header(xex);
|
||||
|
||||
// no exports :(
|
||||
@@ -997,15 +997,23 @@ int xe_xex2_lookup_export(xe_xex2_ref xex, const char *name,
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint64_t baseaddr = (uint64_t)xex->memory->TranslateVirtual(header->exe_address);
|
||||
IMAGE_EXPORT_DIRECTORY *e = (PIMAGE_EXPORT_DIRECTORY)(baseaddr + header->export_table_offset);
|
||||
uint64_t baseaddr =
|
||||
(uint64_t)xex->memory->TranslateVirtual(header->exe_address);
|
||||
IMAGE_EXPORT_DIRECTORY *e =
|
||||
(PIMAGE_EXPORT_DIRECTORY)(baseaddr + header->export_table_offset);
|
||||
|
||||
// e->AddressOfX RVAs are relative to the IMAGE_EXPORT_DIRECTORY!
|
||||
uint32_t* function_table = (uint32_t*)((uint64_t)e + e->AddressOfFunctions); // Functions relative to base
|
||||
uint32_t* name_table = (uint32_t*)((uint64_t)e + e->AddressOfNames); // Names relative to directory
|
||||
uint16_t* ordinal_table = (uint16_t*)((uint64_t)e + e->AddressOfNameOrdinals); // Table of ordinals
|
||||
uint32_t *function_table =
|
||||
(uint32_t *)((uint64_t)e +
|
||||
e->AddressOfFunctions); // Functions relative to base
|
||||
uint32_t *name_table =
|
||||
(uint32_t *)((uint64_t)e +
|
||||
e->AddressOfNames); // Names relative to directory
|
||||
uint16_t *ordinal_table =
|
||||
(uint16_t *)((uint64_t)e +
|
||||
e->AddressOfNameOrdinals); // Table of ordinals
|
||||
|
||||
const char* mod_name = (const char*)((uint64_t)e + e->Name);
|
||||
const char *mod_name = (const char *)((uint64_t)e + e->Name);
|
||||
|
||||
for (int i = 0; i < e->NumberOfNames; i++) {
|
||||
const char *fn_name = (const char *)((uint64_t)e + name_table[i]);
|
||||
|
||||
@@ -44,10 +44,10 @@ class PESection {
|
||||
};
|
||||
|
||||
struct PEExport {
|
||||
const char *name;
|
||||
const char* name;
|
||||
uint32_t ordinal;
|
||||
|
||||
uint64_t addr; // Function address
|
||||
uint64_t addr; // Function address
|
||||
};
|
||||
|
||||
xe_xex2_ref xe_xex2_load(xe::Memory* memory, const void* addr,
|
||||
@@ -62,7 +62,7 @@ int xe_xex2_get_import_infos(xe_xex2_ref xex,
|
||||
xe_xex2_import_info_t** out_import_infos,
|
||||
size_t* out_import_info_count);
|
||||
|
||||
int xe_xex2_lookup_export(xe_xex2_ref xex, const char *name,
|
||||
PEExport &peexport);
|
||||
int xe_xex2_lookup_export(xe_xex2_ref xex, const char* name,
|
||||
PEExport& peexport);
|
||||
|
||||
#endif // XENIA_KERNEL_UTIL_XEX2_H_
|
||||
|
||||
Reference in New Issue
Block a user