diff --git a/src/Bindings/Memory.cpp b/src/Bindings/Memory.cpp index 2172b70..fe5471f 100644 --- a/src/Bindings/Memory.cpp +++ b/src/Bindings/Memory.cpp @@ -90,14 +90,18 @@ namespace Dotx64Dbg::Native return (int)bytesWritten; } - static uint32_t GetProtection(duint addr) + static uint32_t GetProtection(System::UIntPtr addr, bool useCache) { - return 0; + auto va = static_cast(addr.ToUInt64()); + + return Script::Memory::GetProtect(va, false, useCache); } - static uint32_t SetProtection(duint addr, uint32_t prot) + static bool SetProtection(System::UIntPtr addr, uint32_t prot, int size) { - return 0; + auto va = static_cast(addr.ToUInt64()); + + return Script::Memory::SetProtect(va, prot, (duint)size); } static System::UIntPtr GetBase(System::UIntPtr addr) diff --git a/src/Dotx64Managed/API/Memory.cs b/src/Dotx64Managed/API/Memory.cs index a45fc34..66917f0 100644 --- a/src/Dotx64Managed/API/Memory.cs +++ b/src/Dotx64Managed/API/Memory.cs @@ -90,5 +90,23 @@ public static nuint GetBase(ulong address) { return GetBase((nuint)address); } + + public static Protection GetProtection(nuint address, bool useCache) + { + return (Protection)Native.Memory.GetProtection(address, useCache); + } + public static Protection GetProtection(ulong address, bool useCache) + { + return GetProtection((nuint)address, useCache); + } + + public static bool SetProtection(nuint address, Protection protect, int size) + { + return Native.Memory.SetProtection(address, (UInt32)protect, size); + } + public static bool SetProtection(ulong address, Protection protect, int size) + { + return SetProtection((nuint)address, protect, size); + } }; }