diff --git a/src/Bindings/Memory.cpp b/src/Bindings/Memory.cpp index 8dc8e47..ac20ebe 100644 --- a/src/Bindings/Memory.cpp +++ b/src/Bindings/Memory.cpp @@ -119,5 +119,16 @@ namespace Dotx64Dbg::Native const uintptr_t size = Script::Memory::GetSize(va); return System::UIntPtr(size); } + + static System::UIntPtr RemoteAlloc(System::UIntPtr addr, int size) + { + uintptr_t va = Script::Memory::RemoteAlloc(addr.ToUInt64(), (duint)size); + return System::UIntPtr(va); + } + + static bool RemoteFree(System::UIntPtr addr) + { + return Script::Memory::RemoteFree(addr.ToUInt64()); + } }; } diff --git a/src/Bindings/Platform.cpp b/src/Bindings/Platform.cpp index f4ad97f..205651d 100644 --- a/src/Bindings/Platform.cpp +++ b/src/Bindings/Platform.cpp @@ -132,6 +132,20 @@ namespace Dotx64Dbg::Native { SetClipboardData(CF_UNICODETEXT, hMem); CloseClipboard(); } + + static void MessageBoxInfo(System::String^ text, System::String^ title) + { + const auto textStr = interop::toUTF16(text); + const auto titleStr = title ? interop::toUTF16(title) : L"Information"; + MessageBoxW(GuiGetWindowHandle(), textStr.c_str(), titleStr.c_str(), MB_ICONINFORMATION); + } + + static void MessageBoxError(System::String^ text, System::String^ title) + { + const auto textStr = interop::toUTF16(text); + const auto titleStr = title ? interop::toUTF16(title) : L"Error"; + MessageBoxW(GuiGetWindowHandle(), textStr.c_str(), titleStr.c_str(), MB_ICONERROR); + } }; } diff --git a/src/Dotx64Managed/API/Memory.cs b/src/Dotx64Managed/API/Memory.cs index d82af28..2a12755 100644 --- a/src/Dotx64Managed/API/Memory.cs +++ b/src/Dotx64Managed/API/Memory.cs @@ -187,5 +187,24 @@ public static bool SetProtection(ulong address, Protection protect, int size) { return SetProtection((nuint)address, protect, size); } + + public static nuint RemoteAlloc(nuint address, int size) + { + return Native.Memory.RemoteAlloc(address, size); + } + public static nuint RemoteAlloc(ulong address, int size) + { + return RemoteAlloc((nuint)address, size); + } + + public static bool RemoteFree(nuint address) + { + return Native.Memory.RemoteFree(address); + } + + public static bool RemoteFree(ulong address) + { + return RemoteFree((nuint)address); + } }; } diff --git a/src/Dotx64Managed/API/Platform.cs b/src/Dotx64Managed/API/Platform.cs index f0ec237..651dc10 100644 --- a/src/Dotx64Managed/API/Platform.cs +++ b/src/Dotx64Managed/API/Platform.cs @@ -22,5 +22,15 @@ public static void SetClipboardText(string text) { Native.Platform.SetClipboardText(text); } + + public static void MessageBoxInfo(string text, string title = null) + { + Native.Platform.MessageBoxInfo(text, title); + } + + public static void MessageBoxError(string text, string title = null) + { + Native.Platform.MessageBoxError(text, title); + } } }