Exemplo n.º 1
0
        public static UIntPtr VirtualQueryExCustom(IntPtr hProcess, UIntPtr lpAddress,
                                                   out Classes.MEMORY_BASIC_INFORMATION64 lpBuffer)
#endif
        {
#if x86
            var retVal = Native_VirtualQueryEx(hProcess, lpAddress, out Classes.MEMORY_BASIC_INFORMATION32 tmp32, new UIntPtr((uint)Marshal.SizeOf <Classes.MEMORY_BASIC_INFORMATION32>()));

            if (retVal == UIntPtr.Zero)
            {
                int err = Marshal.GetLastWin32Error();
                int y   = 1;
            }

            lpBuffer.BaseAddress       = tmp32.BaseAddress;
            lpBuffer.AllocationBase    = tmp32.AllocationBase;
            lpBuffer.AllocationProtect = tmp32.AllocationProtect;
            lpBuffer.RegionSize        = tmp32.RegionSize;
            lpBuffer.State             = tmp32.State;
            lpBuffer.Protect           = tmp32.Protect;
            lpBuffer.Type = tmp32.Type;
#else
            var retVal = Native_VirtualQueryEx(hProcess, lpAddress, out Classes.MEMORY_BASIC_INFORMATION64 tmp64, new UIntPtr((uint)Marshal.SizeOf <Classes.MEMORY_BASIC_INFORMATION64>()));
            if (retVal == UIntPtr.Zero)
            {
                int err = Marshal.GetLastWin32Error();
                int y   = 1;
            }

            lpBuffer.BaseAddress       = tmp64.BaseAddress;
            lpBuffer.AllocationBase    = tmp64.AllocationBase;
            lpBuffer.AllocationProtect = tmp64.AllocationProtect;
            lpBuffer.RegionSize        = tmp64.RegionSize;
            lpBuffer.State             = tmp64.State;
            lpBuffer.Protect           = tmp64.Protect;
            lpBuffer.Type         = tmp64.Type;
            lpBuffer.__alignment1 = tmp64.__alignment1;
            lpBuffer.__alignment2 = tmp64.__alignment2;
#endif
            return(retVal);
        }
Exemplo n.º 2
0
 public static extern UIntPtr Native_VirtualQueryEx(IntPtr hProcess, UIntPtr lpAddress,
                                                    out Classes.MEMORY_BASIC_INFORMATION64 lpBuffer, UIntPtr dwLength);