Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform improvements #97

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}