diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-08-31 08:48:54 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-08-31 08:48:54 +0200 |
| commit | b185afa29f8a6b8d368a161dea9de7186f3f314c (patch) | |
| tree | 69a4bfef28ec1791042104446a5f670e46f049eb /src/tools/fileutils.c | |
| parent | 742742fd486c1beb0d70aa734de4a0ecdbe9fca7 (diff) | |
| download | box64-b185afa29f8a6b8d368a161dea9de7186f3f314c.tar.gz box64-b185afa29f8a6b8d368a161dea9de7186f3f314c.zip | |
Fixed x86/x86_64 binary detection (for #399)
Diffstat (limited to 'src/tools/fileutils.c')
| -rwxr-xr-x | src/tools/fileutils.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c index a4b046f2..80a0ec60 100755 --- a/src/tools/fileutils.c +++ b/src/tools/fileutils.c @@ -17,8 +17,8 @@ static const char* x86sign = "\x7f" "ELF" "\x01" "\x01" "\x01" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x03" "\x00"; static const char* x64sign = "\x7f" "ELF" "\x02" "\x01" "\x01" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x3e" "\x00"; -static const char* x86lib = "\x7f" "ELF" "\x01" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x03" "\x00" "\x03" "\x00"; -static const char* x64lib = "\x7f" "ELF" "\x02" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x03" "\x00" "\x3e" "\x00"; +static const char* x86lib = "\x7f" "ELF" "\x01" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x03" "\x00"; +static const char* x64lib = "\x7f" "ELF" "\x02" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x3e" "\x00"; int FileExist(const char* filename, int flags) { @@ -75,6 +75,7 @@ int FileIsX64ELF(const char* filename) return 0; } head[7] = x64lib[7]; // this one changes + head[16]&=0xfe; if(!memcmp(head, x64lib, 20)) return 1; return 0; @@ -92,6 +93,7 @@ int FileIsX86ELF(const char* filename) return 0; } head[7] = x64lib[7]; + head[16]&=0xfe; if(!memcmp(head, x86lib, 20)) return 1; return 0; |