using System.Runtime.InteropServices; namespace LightlessSync.Utils { internal static class PtrGuardMemory { [StructLayout(LayoutKind.Sequential)] internal struct MEMORY_BASIC_INFORMATION { public nint BaseAddress; public nint AllocationBase; public uint AllocationProtect; public nuint RegionSize; public uint State; public uint Protect; public uint Type; } [DllImport("kernel32.dll", SetLastError = true)] internal static extern nuint VirtualQuery( nint lpAddress, out MEMORY_BASIC_INFORMATION lpBuffer, nuint dwLength); [DllImport("kernel32.dll", SetLastError = true)] internal static extern bool ReadProcessMemory( nint hProcess, nint lpBaseAddress, out nint lpBuffer, nuint nSize, out nuint lpNumberOfBytesRead); [DllImport("kernel32.dll")] internal static extern nint GetCurrentProcess(); } }