about summary refs log tree commit diff stats
path: root/src/wrapped
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-05-06 19:45:38 +0800
committerGitHub <noreply@github.com>2025-05-06 13:45:38 +0200
commit8d7db7f1fb1002adf06a9a3a59302d6a8f8f989a (patch)
treefd5675bec67ddd8ecdc568b4de7885d53e8e8202 /src/wrapped
parent11563f3b62be60d443bcbcd33d02555ef6aa1ba5 (diff)
downloadbox64-8d7db7f1fb1002adf06a9a3a59302d6a8f8f989a.tar.gz
box64-8d7db7f1fb1002adf06a9a3a59302d6a8f8f989a.zip
Added a simple PE loaded dedicated for volatileMetadata (#2607)
Diffstat (limited to 'src/wrapped')
-rw-r--r--src/wrapped/wrappedlibc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 58ecd5b4..3761f609 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -68,6 +68,7 @@
 #include "globalsymbols.h"
 #include "env.h"
 #include "wine_tools.h"
+#include "pe_tools.h"
 #include "cleanup.h"
 #ifndef LOG_INFO
 #define LOG_INFO 1
@@ -3032,7 +3033,14 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, size_t length, int prot, int f
     #endif
     if(ret!=MAP_FAILED) {
         if(emu && !(flags&MAP_ANONYMOUS) && (fd>0)) {
-            DetectUnityPlayer(fd);
+            char filename[4096];
+            char buf[128];
+            sprintf(buf, "/proc/self/fd/%d", fd);
+            ssize_t r = readlink(buf, filename, sizeof(filename) - 1);
+            if (r != -1) filename[r] = 0;
+
+            DetectUnityPlayer(filename);
+            // ParseVolatileMetadata(filename, addr);
             // the last_mmap will allow mmap created by wine, even those that have hole, to be fully tracked as one single mmap
             if((ret>=last_mmap_addr[0]) && ret+length<(last_mmap_addr[0]+last_mmap_len[0]))
                 RecordEnvMappings((uintptr_t)last_mmap_addr[0], last_mmap_len[0], fd);