mirror of
https://github.com/decompals/wibo.git
synced 2025-12-16 00:17:04 +00:00
Add support for SN compilers (#4)
* More kernel32 functions implemented poorly * fix a smattering of issues to make cc1n64 work * fix issues breaking psyq aspsx * Return lowercase Windows paths if uppercase path doesnt exist * Add SetStdHandle * Add super naive FormatMessageA * Case insensitive file matching * PR comments * Adding CompareString* + SetEnvironmentVariableA functions Co-authored-by: Ash Wolf <ninji@wuffs.org> Co-authored-by: Simon Lindholm <simon.lindholm10@gmail.com>
This commit is contained in:
@@ -145,6 +145,7 @@ bool wibo::Executable::loadPE(FILE *file) {
|
||||
// Build buffer
|
||||
imageSize = header32.sizeOfImage;
|
||||
imageBuffer = mmap((void *) header32.imageBase, header32.sizeOfImage, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANONYMOUS|MAP_FIXED|MAP_PRIVATE, -1, 0);
|
||||
memset(imageBuffer, 0, header32.sizeOfImage);
|
||||
if (imageBuffer == MAP_FAILED) {
|
||||
perror("Image mapping failed!");
|
||||
imageBuffer = 0;
|
||||
@@ -164,11 +165,11 @@ bool wibo::Executable::loadPE(FILE *file) {
|
||||
DEBUG_LOG("Section %d: name=%s addr=%x size=%x (raw=%x) ptr=%x\n", i, name, section.virtualAddress, section.virtualSize, section.sizeOfRawData, section.pointerToRawData);
|
||||
|
||||
void *sectionBase = (void *) (header32.imageBase + section.virtualAddress);
|
||||
if (section.sizeOfRawData > 0) {
|
||||
if (section.pointerToRawData > 0 && section.sizeOfRawData > 0) {
|
||||
// Grab this data
|
||||
long savePos = ftell(file);
|
||||
fseek(file, section.pointerToRawData, SEEK_SET);
|
||||
fread(sectionBase, section.virtualSize, 1, file);
|
||||
fread(sectionBase, section.sizeOfRawData, 1, file);
|
||||
fseek(file, savePos, SEEK_SET);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user