Skip to content

Commit

Permalink
Add Memory.RemoteAlloc/RemoteFree
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Apr 11, 2024
1 parent 8127283 commit 2ac05f2
Show file tree
Hide file tree
Showing 2 changed files with 30 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());
}
};
}
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);
}
};
}

0 comments on commit 2ac05f2

Please sign in to comment.