50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
|
|
using AutoAgent.Domain.Models;
|
|||
|
|
using System.Text.Json.Serialization;
|
|||
|
|
|
|||
|
|
namespace AutoAgent.Models
|
|||
|
|
{
|
|||
|
|
public class MemoryRegion : ConcurrentObject
|
|||
|
|
{
|
|||
|
|
private long _addr = 0;
|
|||
|
|
private ulong _size = 0;
|
|||
|
|
|
|||
|
|
[JsonIgnore]
|
|||
|
|
public long MemoryAddress
|
|||
|
|
{
|
|||
|
|
get => LockedGet(ref _addr);
|
|||
|
|
set => LockedSet(ref _addr, value);
|
|||
|
|
}
|
|||
|
|
public ulong MemorySize
|
|||
|
|
{
|
|||
|
|
get => LockedGet(ref _size);
|
|||
|
|
set => LockedSet(ref _size, value);
|
|||
|
|
}
|
|||
|
|
public string? BaseAddress
|
|||
|
|
{
|
|||
|
|
get => (MemoryAddress > 0) ? $"0x{MemoryAddress:X16}" : null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public class MemoryRegionInfo : MemoryRegion
|
|||
|
|
{
|
|||
|
|
private WindowsProcess.MemoryState _state = 0;
|
|||
|
|
private WindowsProcess.MemoryPageProtectionState _protect = 0;
|
|||
|
|
private WindowsProcess.MemoryType _type = 0;
|
|||
|
|
|
|||
|
|
public WindowsProcess.MemoryState MemoryState
|
|||
|
|
{
|
|||
|
|
get => LockedGet(ref _state);
|
|||
|
|
set => LockedSet(ref _state, value);
|
|||
|
|
}
|
|||
|
|
public WindowsProcess.MemoryPageProtectionState MemoryPageProtection
|
|||
|
|
{
|
|||
|
|
get => LockedGet(ref _protect);
|
|||
|
|
set => LockedSet(ref _protect, value);
|
|||
|
|
}
|
|||
|
|
public WindowsProcess.MemoryType MemoryType
|
|||
|
|
{
|
|||
|
|
get => LockedGet(ref _type);
|
|||
|
|
set => LockedSet(ref _type, value);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|