From e641cac71c2db658d68bf3552f0bb08a2eea94c6 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Tue, 26 Oct 2021 23:34:10 +0200 Subject: [PATCH] move detour into function --- Dalamud/Interface/Internal/Windows/DataWindow.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/DataWindow.cs b/Dalamud/Interface/Internal/Windows/DataWindow.cs index dd67356c7..5d2da5bd5 100644 --- a/Dalamud/Interface/Internal/Windows/DataWindow.cs +++ b/Dalamud/Interface/Internal/Windows/DataWindow.cs @@ -333,12 +333,7 @@ namespace Dalamud.Interface.Internal.Windows if (ImGui.Button("Create")) { this.messageBoxMinHook = Hook.FromSymbol( - "User32", "MessageBoxW", - (wnd, text, caption, type) => - { - Log.Information("[DATAHOOK] {0} {1} {2} {3}", wnd, text, caption, type); - return this.messageBoxMinHook.Original(wnd, text, caption, type); - }); + "User32", "MessageBoxW", MessageBoxWDetour); } if (ImGui.Button("Enable")) this.messageBoxMinHook?.Enable(); @@ -380,6 +375,12 @@ namespace Dalamud.Interface.Internal.Windows ImGui.EndChild(); } + private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, NativeFunctions.MessageBoxType type) + { + Log.Information("[DATAHOOK] {0} {1} {2} {3}", hwnd, text, caption, type); + return this.messageBoxMinHook.Original(hwnd, text, caption, type); + } + private void DrawServerOpCode() { ImGui.TextUnformatted(this.serverOpString);