mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
add hook tester to data window
This commit is contained in:
parent
a54427f6dd
commit
b0fac2bc47
1 changed files with 28 additions and 18 deletions
|
|
@ -328,28 +328,38 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
|
|
||||||
case DataKind.Hook:
|
case DataKind.Hook:
|
||||||
{
|
{
|
||||||
if (ImGui.Button("Create"))
|
try
|
||||||
{
|
{
|
||||||
this.messageBoxMinHook = Hook<MessageBoxWDelegate>.FromSymbol("User32", "MessageBoxW",
|
if (ImGui.Button("Create"))
|
||||||
(wnd, text, caption, type) =>
|
{
|
||||||
{
|
this.messageBoxMinHook = Hook<MessageBoxWDelegate>.FromSymbol(
|
||||||
Log.Information("[DATAHOOK] {0} {1} {2} {3}", wnd, text, caption, type);
|
"User32", "MessageBoxW",
|
||||||
return this.messageBoxMinHook.Original(wnd, text, caption, type);
|
(wnd, text, caption, type) =>
|
||||||
});
|
{
|
||||||
|
Log.Information("[DATAHOOK] {0} {1} {2} {3}", wnd, text, caption, type);
|
||||||
|
return this.messageBoxMinHook.Original(wnd, text, caption, type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.Button("Enable")) this.messageBoxMinHook?.Enable();
|
||||||
|
|
||||||
|
if (ImGui.Button("Disable")) this.messageBoxMinHook?.Disable();
|
||||||
|
|
||||||
|
if (ImGui.Button("Dispose"))
|
||||||
|
{
|
||||||
|
this.messageBoxMinHook?.Dispose();
|
||||||
|
this.messageBoxMinHook = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.Button("Test")) NativeFunctions.MessageBoxW(IntPtr.Zero, "Hi", "Hello", NativeFunctions.MessageBoxType.Ok);
|
||||||
|
|
||||||
|
if (this.messageBoxMinHook != null)
|
||||||
|
ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
if (ImGui.Button("Enable")) this.messageBoxMinHook?.Enable();
|
|
||||||
|
|
||||||
if (ImGui.Button("Disable")) this.messageBoxMinHook?.Disable();
|
|
||||||
|
|
||||||
if (ImGui.Button("Dispose"))
|
|
||||||
{
|
{
|
||||||
this.messageBoxMinHook?.Dispose();
|
Log.Error(ex, "MinHook error caught");
|
||||||
this.messageBoxMinHook = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.messageBoxMinHook != null)
|
|
||||||
ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue