MCPcopy Create free account
hub / github.com/GrowthEase/GameSentry / hotfix_lua

Function hotfix_lua

lib/cli/module/lua-hotfix.js:9–30  ·  view source on GitHub ↗
(package_name, module)

Source from the content-addressed store, hash-verified

7var LuaFileWatcherNative = new NativeCallback(LuaFileWatcher, 'void', ['void'])
8
9function hotfix_lua(package_name, module) {
10 LUA_PATH = '/data/data/' + package_name + '/luadump'
11 helper.send_message("HotFix_Init", module)
12
13 Interceptor.attach(Module.findExportByName("libxlua.so", "luaL_openlibs"), {
14 onEnter: function (args) {
15 console.log("lua_State:" + args[0])
16 lua_State = ptr(args[0])
17 luaL_loadstring = new NativeFunction(Module.findExportByName("libxlua.so", "luaL_loadstring"), 'int', ['pointer', 'pointer'])
18 lua_pcall = new NativeFunction(Module.findExportByName("libxlua.so", "lua_pcall"), 'int', ['pointer', 'int', 'int', 'int'])
19 lua_tolstring = new NativeFunction(Module.findExportByName("libxlua.so", "lua_tolstring"), 'pointer', ['pointer', 'int'])
20 }, onLeave: function (ret) {
21 }
22 });
23
24 pthread_create = new NativeFunction(Module.findExportByName(null, "pthread_create"), 'int', ['pointer', 'pointer', 'pointer', 'pointer'])
25 //启动新线程对目标目录进行文件监控。
26 var ret = pthread_create(Memory.alloc(16), new NativePointer(0), LuaFileWatcherNative, new NativePointer(0))
27 if (ret == 0)
28 helper.send_message("HotFix_Init", "init success")
29 helper.send_message("HotFix_Init", "ret:" + ret)
30}
31
32function LuaFileWatcher() {
33 var inotify_init = new NativeFunction(Module.findExportByName(null, "inotify_init"), 'int', [])

Callers

nothing calls this directly

Calls 2

attachMethod · 0.80
allocMethod · 0.45

Tested by

no test coverage detected