diff --git a/LuaProfiler/Runtime/Core/Driver/Hook/AndroidHook/AndroidNativeHooker.cs b/LuaProfiler/Runtime/Core/Driver/Hook/AndroidHook/AndroidNativeHooker.cs index 75c69ea2..c8193ecc 100644 --- a/LuaProfiler/Runtime/Core/Driver/Hook/AndroidHook/AndroidNativeHooker.cs +++ b/LuaProfiler/Runtime/Core/Driver/Hook/AndroidHook/AndroidNativeHooker.cs @@ -65,7 +65,7 @@ public void HookLoadLibrary(Action callBack) static IntPtr dlopen_replace(string libfile, int flag) { var ret = dlopenF(libfile, flag); - if (!isLoadLuaSo && dlsym(ret, "luaL_newstate") != IntPtr.Zero) + if (!isLoadLuaSo && dlsym(ret, "lua_newstate") != IntPtr.Zero) { isLoadLuaSo = true; _callBack.Invoke(ret); diff --git a/LuaProfiler/Runtime/Core/Driver/Hook/WindowsHook/WindowsNativeHooker.cs b/LuaProfiler/Runtime/Core/Driver/Hook/WindowsHook/WindowsNativeHooker.cs index a2540647..465aeaff 100644 --- a/LuaProfiler/Runtime/Core/Driver/Hook/WindowsHook/WindowsNativeHooker.cs +++ b/LuaProfiler/Runtime/Core/Driver/Hook/WindowsHook/WindowsNativeHooker.cs @@ -50,7 +50,7 @@ public void HookLoadLibrary(Action callBack) fun = (IntPtr lpFileName, IntPtr hFile, int dwFlags) => { var ret = LoadLibraryExW_dll(lpFileName, hFile, dwFlags); - if (GetProcAddressByHandle(ret, "luaL_newstate") != IntPtr.Zero) + if (GetProcAddressByHandle(ret, "lua_newstate") != IntPtr.Zero) { callBack(ret); hooker.Uninstall(); diff --git a/LuaProfiler/Runtime/Core/Driver/LuaDLL.cs b/LuaProfiler/Runtime/Core/Driver/LuaDLL.cs index 87feb8f9..a84787f9 100644 --- a/LuaProfiler/Runtime/Core/Driver/LuaDLL.cs +++ b/LuaProfiler/Runtime/Core/Driver/LuaDLL.cs @@ -108,7 +108,7 @@ public static void lua_unref(IntPtr luaState, int reference) #endregion #region hooks - private static INativeHooker luaL_newstate_hook; + private static INativeHooker lua_newstate_hook; private static INativeHooker lua_close_hook; private static INativeHooker lua_gc_hook; private static INativeHooker lua_call_hook; @@ -131,8 +131,8 @@ public static void lua_unref(IntPtr luaState, int reference) #region 通用操作 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate IntPtr luaL_newstate_fun(); - public static luaL_newstate_fun luaL_newstate; + public delegate IntPtr lua_newstate_fun(IntPtr f, IntPtr ud); + public static lua_newstate_fun lua_newstate; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void lua_close_fun(IntPtr L); @@ -383,10 +383,10 @@ public static void lua_pushstdcallcfunction(IntPtr luaState, LuaCSFunction func) public static void Uninstall() { - if (luaL_newstate_hook != null) + if (lua_newstate_hook != null) { - luaL_newstate_hook.Uninstall(); - luaL_newstate_hook = null; + lua_newstate_hook.Uninstall(); + lua_newstate_hook = null; } if (lua_close_hook != null) @@ -509,15 +509,15 @@ public static void BindEasyHook(IntPtr module) UnityEngine.Debug.Log("lua versin:" + LUA_VERSION); - if (luaL_newstate_hook == null) + if (lua_newstate_hook == null) { - IntPtr handle = GetProcAddress(module, "luaL_newstate"); - luaL_newstate_fun luaFun = new luaL_newstate_fun(luaL_newstate_replace); + IntPtr handle = GetProcAddress(module, "lua_newstate"); + lua_newstate_fun luaFun = new lua_newstate_fun(lua_newstate_replace); INativeHooker hooker = nativeUtil.CreateHook(); hooker.Init(handle, Marshal.GetFunctionPointerForDelegate(luaFun)); hooker.Install(); - luaL_newstate = (luaL_newstate_fun)hooker.GetProxyFun(typeof(luaL_newstate_fun)); - luaL_newstate_hook = hooker; + lua_newstate = (lua_newstate_fun)hooker.GetProxyFun(typeof(lua_newstate_fun)); + lua_newstate_hook = hooker; } if (lua_close_hook == null) @@ -984,25 +984,25 @@ public static IntPtr CheckHasLuaDLL() var modules = process.Modules; foreach (ProcessModule item in modules) { - result = GetProcAddress(item.BaseAddress, "luaL_newstate"); + result = GetProcAddress(item.BaseAddress, "lua_newstate"); if (result != IntPtr.Zero) { return item.BaseAddress; } } #else - result = GetProcAddress(IntPtr.Zero, "luaL_newstate"); + result = GetProcAddress(IntPtr.Zero, "lua_newstate"); #endif return result; } - [MonoPInvokeCallbackAttribute(typeof(luaL_newstate_fun))] - public static IntPtr luaL_newstate_replace() + [MonoPInvokeCallbackAttribute(typeof(lua_newstate_fun))] + public static IntPtr lua_newstate_replace(IntPtr f, IntPtr ud) { UnityEngine.Debug.Log("test newstate success"); lock (m_Lock) { - IntPtr intPtr = luaL_newstate(); + IntPtr intPtr = lua_newstate(f, ud); if (isHook) { MikuLuaProfilerLuaProfilerWrap.RegisterError(intPtr);