Exemplo n.º 1
0
        public static ulong MapSection(this Process process, ulong sectionHandle, NT.MemoryProtection memoryProtection)
        {
            ulong memoryPointer = 0;
            var   result        = NT.NtMapViewOfSection(sectionHandle, process.Handle, ref memoryPointer, 0, 0, 0, out uint viewSize, 2, 0, memoryProtection);

            if (result != 0)
            {
                throw new Exception($"MapSection - NtMapViewOfSection() failed - {result.ToString("x2")}");
            }

            return(memoryPointer);
        }