fixed mistake in menuet header, improved formatting

This commit is contained in:
rgimad 2024-03-20 21:07:37 +03:00
parent e69292b815
commit 2e7cc4191e
3 changed files with 19 additions and 8 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.exe *.exe
*.zip *.zip
*.img *.img
tests/

BIN
kexview

Binary file not shown.

View File

@ -7,6 +7,7 @@
typedef struct { typedef struct {
char signature[SIGNATURE_SIZE]; char signature[SIGNATURE_SIZE];
uint32_t version;
uint32_t start_address; uint32_t start_address;
uint32_t file_size; uint32_t file_size;
uint32_t memory_required; uint32_t memory_required;
@ -34,15 +35,16 @@ void show_menuet_xx(const char *fpath) {
printf("Error: Invalid signature.\n"); printf("Error: Invalid signature.\n");
return; return;
} }
printf("Version: %.*s\n", SIGNATURE_SIZE, header.signature); printf("Signature: %.*s\n", SIGNATURE_SIZE, header.signature);
printf("Start Address: 0x%x\n", header.start_address); printf("Version: 0x%x\n", header.version);
printf("File Size: %u bytes\n", header.file_size); printf("Start Address: 0x%x\n", header.start_address);
printf("Memory Required: %u bytes\n", header.memory_required); printf("File Size: %u bytes\n", header.file_size);
printf("ESP Value: 0x%x\n", header.esp_value); printf("Memory Required: %u bytes\n", header.memory_required);
printf("ESP Value: 0x%x\n", header.esp_value);
printf("Parameter Address: 0x%x\n", header.param_address); printf("Parameter Address: 0x%x\n", header.param_address);
printf("File Path Address: 0x%x\n", header.file_path_address); printf("File Path Address: 0x%x\n", header.file_path_address);
if (strncmp(header.signature, "MENUET02", SIGNATURE_SIZE) == 0) { if (strncmp(header.signature, "MENUET02", SIGNATURE_SIZE) == 0) {
printf("TLS Data Address: 0x%x\n", header.tls_data_address); printf("TLS Data Address: 0x%x\n", header.tls_data_address);
} }
} }
@ -52,6 +54,7 @@ void show_library(const char *fpath) {
printf("Failed to load library."); printf("Failed to load library.");
return; return;
} }
printf("Export table:\n\nFunction Address\n-------------------------------------\n");
size_t i = 0; size_t i = 0;
for (;;) { for (;;) {
char *func_name = (table + i)->func_name; char *func_name = (table + i)->func_name;
@ -62,7 +65,14 @@ void show_library(const char *fpath) {
} }
return; return;
} else { } else {
printf("%s %p\n", func_name, func_ptr); printf("%s", func_name);
int x = strlen(func_name);
while (x < 25) {
putc(' ');
x++;
}
putc(' ');
printf(" 0x%x\n", func_ptr);
} }
i++; i++;
} }