Skip to content

Commit

Permalink
Merge pull request #97 from x64dbg/platform-improvements
Browse files Browse the repository at this point in the history
Platform improvements
  • Loading branch information
mrexodia authored Apr 12, 2024
2 parents 8127283 + d6da84f commit 7670610
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Bindings/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
};
}
14 changes: 14 additions & 0 deletions src/Bindings/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

}
19 changes: 19 additions & 0 deletions src/Dotx64Managed/API/Memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
}
10 changes: 10 additions & 0 deletions src/Dotx64Managed/API/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 7670610

Please sign in to comment.