Exemplo n.º 1
0
        private void DisplayWinner(GameObject winner)
        {
            var blackTex  = @"Contents\UI\Winners\blackWinsText.png";
            var purpleTex = @"Contents\UI\Winners\purpleWinsText.png";

            var car = winner as Car;

            if (car != null)
            {
                switch (car.id)
                {
                case "Black":
                    EngineCore.AddGameObject(new UIElement(blackTex, new Vector2(0f, 0f)));
                    EndGame();
                    break;

                case "Purple":
                    EngineCore.AddGameObject(new UIElement(purpleTex, new Vector2(0f, 0f)));
                    EndGame();
                    break;

                default:
                    throw new Exception("There is nothing to display.");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new snapshot of memory in the target process. Will not read any memory.
        /// </summary>
        /// <returns>The snapshot of memory taken in the target process.</returns>
        private Snapshot CreateSnapshotFromSettings()
        {
            MemoryProtectionEnum requiredPageFlags = SettingsViewModel.GetInstance().GetRequiredProtectionSettings();
            MemoryProtectionEnum excludedPageFlags = SettingsViewModel.GetInstance().GetExcludedProtectionSettings();
            MemoryTypeEnum       allowedTypeFlags  = SettingsViewModel.GetInstance().GetAllowedTypeSettings();

            IntPtr startAddress, endAddress;

            if (SettingsViewModel.GetInstance().IsUserMode)
            {
                startAddress = IntPtr.Zero;
                endAddress   = EngineCore.GetInstance().VirtualMemory.GetMaxUsermodeAddress().ToIntPtr();
            }
            else
            {
                startAddress = SettingsViewModel.GetInstance().StartAddress.ToIntPtr();
                endAddress   = SettingsViewModel.GetInstance().EndAddress.ToIntPtr();
            }

            List <ReadGroup> memoryRegions = new List <ReadGroup>();
            IEnumerable <NormalizedRegion> virtualPages = EngineCore.GetInstance().VirtualMemory.GetVirtualPages(
                requiredPageFlags,
                excludedPageFlags,
                allowedTypeFlags,
                startAddress,
                endAddress);

            // Convert each virtual page to a snapshot region
            foreach (NormalizedRegion virtualPage in virtualPages)
            {
                memoryRegions.Add(new ReadGroup(virtualPage.BaseAddress, virtualPage.RegionSize));
            }

            return(new Snapshot(null, memoryRegions));
        }
Exemplo n.º 3
0
        public void InitializeEngine()
        {
            Directory.CreateDirectory($"{Environment.CurrentDirectory}/Object");
            Directory.CreateDirectory($"{Environment.CurrentDirectory}/Animation");
            Directory.CreateDirectory($"{Environment.CurrentDirectory}/Project");
            Directory.CreateDirectory($"{Environment.CurrentDirectory}/Export");

            var engineParameters = new EngineParameters {
                Handle = PictureAnimation.Handle,
                Width  = PictureAnimation.Width,
                Height = PictureAnimation.Height
            };

            var fontParameters = new EngineFontParameters {
                Name  = "Tahoma",
                Size  = 9f,
                Style = FontStyle.Regular
            };

            engine = new EngineCore(engineParameters, fontParameters);

            UpdateClipArea();

            AddLanguages();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Processes all pages, computing checksums to determine chunks of virtual pages that have changed.
        /// </summary>
        private void ProcessPages()
        {
            Boolean isOpenedProcess32Bit             = EngineCore.GetInstance().Processes.IsOpenedProcess32Bit();
            dynamic invalidPointerMin                = isOpenedProcess32Bit ? (UInt32)UInt16.MaxValue : (UInt64)UInt16.MaxValue;
            dynamic invalidPointerMax                = isOpenedProcess32Bit ? Int32.MaxValue : Int64.MaxValue;
            ConcurrentHashSet <IntPtr> foundPointers = new ConcurrentHashSet <IntPtr>();

            // Add static bases
            List <SnapshotRegion> baseRegions = new List <SnapshotRegion>();

            foreach (NormalizedModule normalizedModule in EngineCore.GetInstance().OperatingSystemAdapter.GetModules())
            {
                baseRegions.Add(new SnapshotRegion(normalizedModule.BaseAddress, normalizedModule.RegionSize));
            }

            ((dynamic)this.PrefilteredSnapshot).AddSnapshotRegions(baseRegions);

            lock (this.RegionLock)
            {
                List <SnapshotRegion> pointerRegions = new List <SnapshotRegion>();

                foreach (IntPtr pointer in PointerCollector.GetInstance().GetFoundPointers())
                {
                    pointerRegions.Add(new SnapshotRegion(pointer.Subtract(ShallowPointerPrefilter.PointerRadius), ShallowPointerPrefilter.PointerRadius * 2));
                }

                ((dynamic)this.PrefilteredSnapshot).AddSnapshotRegions(pointerRegions);
                this.processedCount = Math.Max(this.processedCount, this.PrefilteredSnapshot.GetRegionCount());
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new snapshot of memory in the target process. Will not read any memory.
        /// </summary>
        /// <returns>The snapshot of memory taken in the target process.</returns>
        public Snapshot CreateSnapshotFromSettings()
        {
            MemoryProtectionEnum requiredPageFlags = SettingsViewModel.GetInstance().GetRequiredProtectionSettings();
            MemoryProtectionEnum excludedPageFlags = SettingsViewModel.GetInstance().GetExcludedProtectionSettings();
            MemoryTypeEnum       allowedTypeFlags  = SettingsViewModel.GetInstance().GetAllowedTypeSettings();

            IntPtr startAddress, endAddress;

            if (SettingsViewModel.GetInstance().IsUserMode)
            {
                startAddress = IntPtr.Zero;
                endAddress   = EngineCore.GetInstance().VirtualMemory.GetUserModeRegion().EndAddress;
            }
            else
            {
                startAddress = SettingsViewModel.GetInstance().StartAddress.ToIntPtr();
                endAddress   = SettingsViewModel.GetInstance().EndAddress.ToIntPtr();
            }

            List <SnapshotRegion>          memoryRegions = new List <SnapshotRegion>();
            IEnumerable <NormalizedRegion> virtualPages  = EngineCore.GetInstance().VirtualMemory.GetVirtualPages(
                requiredPageFlags,
                excludedPageFlags,
                allowedTypeFlags,
                startAddress,
                endAddress);

            // Convert each virtual page to a snapshot region (a more condensed representation of the information)
            foreach (NormalizedRegion virtualPage in virtualPages)
            {
                memoryRegions.Add(new SnapshotRegion(virtualPage.BaseAddress, virtualPage.RegionSize));
            }

            return(new Snapshot(memoryRegions));
        }
        private IntPtr ResolvePointer(Tuple <IntPtr, List <Int32> > fullPointer)
        {
            IntPtr       pointer = fullPointer.Item1;
            List <Int32> offsets = fullPointer.Item2;

            if (offsets == null || offsets.Count == 0)
            {
                return(pointer);
            }

            Boolean successReading = true;

            foreach (Int32 offset in offsets)
            {
                pointer = EngineCore.GetInstance().OperatingSystemAdapter.Read <IntPtr>(pointer, out successReading);
                pointer = pointer.Add(offset);

                if (!successReading)
                {
                    break;
                }
            }

            return(pointer);
        }
Exemplo n.º 7
0
        public void RulesThatCheckContextValue()
        {
            var identity = new Identity("device", "1");
            var context  = CreateContext(identity, new Tuple <string, JsonValue>("PartnerBrand", JsonValue.NewString("ABC")));

            var rulesRepo = RulesRepositoryHelpers
                            .With("path/to/key", FakeRule.Create(ctx => ctx("device.PartnerBrand") == JsonValue.NewString("ABC") ? new ConfigurationValue(JsonValue.NewString("SomeValue")) : Option <ConfigurationValue> .None));

            var value = EngineCore.GetRulesEvaluator(new IdentityHashSet {
                identity
            }, context, rulesRepo)("path/to/key").Map(x => x.Value);

            Assert.Equal(JsonValue.NewString("SomeValue"), value);

            rulesRepo = rulesRepo
                        .With("path/to/other/key", FakeRule.Create(ctx => ctx("device.OtherProp") == JsonValue.NewString("DEF") ? new ConfigurationValue(JsonValue.NewString("SomeValue")) : Option <ConfigurationValue> .None));

            value = EngineCore.GetRulesEvaluator(new IdentityHashSet {
                identity
            }, context, rulesRepo)("path/to/other/key").Map(x => x.Value);
            Assert.True(value.IsNone);

            rulesRepo = rulesRepo
                        .With("path/to/other/key", FakeRule.Create(ctx => ctx("device.PartnerBrand") == JsonValue.NewString("ABC") ? new ConfigurationValue(JsonValue.NewString("SomeValue")) : Option <ConfigurationValue> .None));

            value = EngineCore.GetRulesEvaluator(new IdentityHashSet {
                identity
            }, context, rulesRepo)("path/to/other/key").Map(x => x.Value);

            Assert.Equal(JsonValue.NewString("SomeValue"), value);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Run method for the injected library, invoked by EasyHook when injecting a wrapper process.
        /// </summary>
        /// <remarks>
        /// The GC won't unload the library as long as this method doesn't return.
        /// <br />
        /// The Run() method should return if you want the injected library needs to be unloaded.
        /// Unhandled exceptions ARE NOT redirected automatically.
        /// As the connection to the host is established in <see cref="EngineCore.Initialize"/>,
        /// errors should be reported using <see cref="EngineCore.Log"/>.
        /// </remarks>
        /// <param name="inContext">Information about the environment in which the library main method has been invoked, used by the EasyHook library.</param>
        /// <param name="channelName">The name of the inter-process communication channel to connect to, used by the EasyHook library.</param>
        /// <param name="wrappedProcessExecutable">The executable containing the main method of the guest process.</param>
        /// <param name="args">Optional arguments to pass to the guest's main method.</param>
        public void Run(RemoteHooking.IContext inContext, string channelName, string wrappedProcessExecutable, string args)
        {
            try
            {
                InitializeForRun();
                // Set the working directory to the one expected by the executable.
                Directory.SetCurrentDirectory(Path.GetDirectoryName(wrappedProcessExecutable));
                // Run the main method of the wrapped process.
                string[] arguments = args.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                EngineCore.Log.Debug("Invoking main method of targeted guest... using #{0} method parameters{1}",
                                     arguments.Length, arguments.Length == 0 ? "" : ": " + args);
                var exitCode = AssemblyHelper.RunMainMethod(wrappedProcessExecutable, arguments.Length == 0 ? null : arguments);
                EngineCore.Log.Message("Target main method returned exitcode " + exitCode);
                // First attempt a clean shutdown, then try a forced shutdown.
                EngineCore.TerminateProcess(exitCode, ExitMethod.Request | ExitMethod.Kill);
            }

            catch (Exception e)
            {
#if DEBUG
                if (Debugger.IsAttached)
                {
                    Debugger.Break();
                }
#endif
                EngineCore.Log.Critical("An unexpected exception occured.", e);
                // Exit code 1067 = ERROR_PROCESS_ABORTED "The process terminated unexpectedly."
                if (!EngineCore.TerminateProcess(1067, ExitMethod.Request | ExitMethod.Kill))
                {
                    throw new ApplicationException("An unexpected fatal exception occured.", e);
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Creates a snapshot from modules in the selected process.
        /// </summary>
        /// <returns>The created snapshot.</returns>
        private Snapshot CreateSnapshotFromModules()
        {
            IEnumerable <ReadGroup> moduleGroups = EngineCore.GetInstance().VirtualMemory.GetModules().Select(region => new ReadGroup(region.BaseAddress, region.RegionSize));
            Snapshot moduleSnapshot = new Snapshot(null, moduleGroups);

            return(moduleSnapshot);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Determines if a process is 32 bit
        /// </summary>
        /// <param name="process">The process to check</param>
        /// <returns>Returns true if the process is 32 bit, otherwise false</returns>
        public Boolean IsProcess32Bit(NormalizedProcess process)
        {
            Boolean isWow64;

            // First do the simple check if seeing if the OS is 32 bit, in which case the process wont be 64 bit
            if (EngineCore.GetInstance().OperatingSystemAdapter.IsOperatingSystem32Bit())
            {
                return(true);
            }

            // No process provided, assume 32 bit
            if (process == null)
            {
                return(true);
            }

            try
            {
                if (this.SystemProcess == null || !Native.NativeMethods.IsWow64Process(this.SystemProcess.Handle, out isWow64))
                {
                    // Error, assume 32 bit
                    return(true);
                }
            }
            catch
            {
                // Error, assume 32 bit
                return(true);
            }

            return(isWow64);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Update event for this project item. Resolves addresses and values.
        /// </summary>
        /// <returns>True if update was made, otherwise false.</returns>
        public override Boolean Update()
        {
            this.CalculatedAddress = this.ResolveAddress();

            if (this.IsActivated)
            {
                // Freeze current value if this entry is activated
                Object value = this.AddressValue;
                if (value != null && value.GetType() == this.DataType)
                {
                    this.WriteValue(value);
                }
            }
            else
            {
                // Otherwise we read as normal (bypass value setter and set value directly to avoid a write-back to memory)
                Boolean readSuccess;
                Object  oldValue = addressValue;

                this.addressValue = EngineCore.GetInstance()?.VirtualMemory?.Read(this.DataType, this.CalculatedAddress, out readSuccess);

                if (this.AddressValue?.ToString() != oldValue?.ToString())
                {
                    this.RaisePropertyChanged(nameof(this.AddressValue));
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Injects instructions at the specified location, overwriting following instructions. This will nop-fill.
        /// </summary>
        /// <param name="address">The injection address.</param>
        /// <param name="assembly">The assembly code to disassemble and inject into the code cave.</param>
        /// <returns>The address of the code cave.</returns>
        public UInt64 InjectCode(UInt64 address, String assembly)
        {
            this.PrintDebugTag();

            assembly = this.ResolveKeywords(assembly);

            Int32 assemblySize = this.GetAssemblySize(assembly, address);

            Byte[] originalBytes = this.CollectOriginalBytes(address, assemblySize);

            if (originalBytes == null)
            {
                throw new Exception("Could not gather original bytes");
            }

            // Determine number of no-ops to fill dangling bytes
            String noOps = (originalBytes.Length - assemblySize > 0 ? "db " : String.Empty) + String.Join(" ", Enumerable.Repeat("0x90,", originalBytes.Length - assemblySize)).TrimEnd(',');

            Byte[] injectionBytes = this.GetAssemblyBytes(assembly + "\n" + noOps, address);
            EngineCore.GetInstance().VirtualMemory.WriteBytes(address.ToIntPtr(), injectionBytes);

            CodeCave codeCave = new CodeCave(address, 0, originalBytes);

            this.CodeCaves.Add(codeCave);

            return(address);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Resolves the address of an address, pointer, or managed object.
        /// </summary>
        /// <returns>The base address of this object.</returns>
        protected override IntPtr ResolveAddress()
        {
            IntPtr  pointer        = AddressResolver.GetInstance().ResolveModule(this.ModuleName);
            Boolean successReading = true;

            pointer = pointer.Add(this.ModuleOffset);

            if (this.PointerOffsets == null || this.PointerOffsets.Count() == 0)
            {
                return(pointer);
            }

            foreach (Int32 offset in this.PointerOffsets)
            {
                if (EngineCore.GetInstance().Processes.IsOpenedProcess32Bit())
                {
                    pointer = EngineCore.GetInstance().VirtualMemory.Read <Int32>(pointer, out successReading).ToIntPtr();
                }
                else
                {
                    pointer = EngineCore.GetInstance().VirtualMemory.Read <Int64>(pointer, out successReading).ToIntPtr();
                }

                if (pointer == IntPtr.Zero || !successReading)
                {
                    pointer = IntPtr.Zero;
                    break;
                }

                pointer = pointer.Add(offset);
            }

            return(pointer);
        }
Exemplo n.º 14
0
        public IntPtr EvaluatePointer(IntPtr address, IEnumerable <Int32> offsets)
        {
            IntPtr finalAddress = address;

            if (!offsets.IsNullOrEmpty())
            {
                // Add and trace offsets
                foreach (Int32 offset in offsets.Take(offsets.Count() - 1))
                {
                    Boolean success;
                    if (EngineCore.GetInstance().Processes.IsOpenedProcess32Bit())
                    {
                        finalAddress = (this.Read <UInt32>(finalAddress + offset, out success).ToInt64()).ToIntPtr();
                    }
                    else
                    {
                        finalAddress = (this.Read <UInt64>(finalAddress, out success).ToInt64() + offset).ToIntPtr();
                    }
                }

                // The last offset is added, but not traced
                finalAddress = finalAddress.Add(offsets.Last());
            }

            return(finalAddress);
        }
Exemplo n.º 15
0
        internal static void LoadZoneFile(string path, EngineCore engine)
        {
            using (var zip = ZipFile.OpenRead(path)) {
                using (var ms = new MemoryStream()) {
                    using (var temp = zip.GetEntry("main.oes")?.Open())
                        temp?.CopyTo(ms);
                    ms.Position = 0;
                    var zone = OESFile.Read <OESZone>(ms);
                    WriteLine($"Loading {zone.Name}");

                    engine.Add(FromMeshes(FromSkin(zone.Find <OESSkin>().First(), zip), new[] { Matrix4x4.Identity }, zone.Find <OESStaticMesh>()));

                    var objInstances = zone.Find <OESObject>().ToDictionary(x => x, x => new List <Matrix4x4>());
                    zone.Find <OESInstance>().ForEach(inst => {
                        objInstances[inst.Object].Add(Matrix4x4.CreateScale(inst.Scale) * Matrix4x4.CreateFromQuaternion(inst.Rotation) * Matrix4x4.CreateTranslation(inst.Position));
                    });
                    foreach (var(obj, instances) in objInstances)
                    {
                        engine.Add(FromMeshes(
                                       FromSkin(obj.Find <OESSkin>().First(), zip),
                                       instances.ToArray(),
                                       obj.Find <OESStaticMesh>()
                                       ));
                    }

                    zone.Find <OESLight>().ForEach(light => engine.AddLight(light.Position, light.Radius, light.Attenuation, light.Color));
                }
            }
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            if (!Configuration.Open())
            {
                MessageBox.Show("Arquivo de configuração não encontrado. O programa será fechado.");
                return;
            }

            Application.EnableVisualStyles();

            GraphicsDisplay = new CreateDevice();

            if (!EngineCore.InitializeDirectX())
            {
                MessageBox.Show("Não foi possível inicializar o Direct3D. O programa será fechado.");
                return;
            }

            if (!EngineCore.InitializeEngine())
            {
                MessageBox.Show("Não foi possível inicializar os recursos. O programa será fechado.");
                return;
            }

            GraphicsDisplay.Show();

            Application.Idle += new EventHandler(GraphicsDisplay.OnApplicationIdle);
            Application.Run(GraphicsDisplay);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Update event for this project item. Resolves addresses and values.
        /// </summary>
        public override void Update()
        {
            this.CalculatedAddress = this.ResolveAddress();

            // Freeze current value if this entry is activated
            if (this.IsActivated)
            {
                Object value = this.AddressValue;

                if (value != null && value.GetType() == this.DataType)
                {
                    this.WriteValue(value);
                }
            }
            else
            {
                Object previousValue = this.AddressValue;

                // Otherwise we read as normal (bypass assigning setter and set value directly to avoid a write-back to memory)
                this.addressValue = EngineCore.GetInstance()?.VirtualMemory?.Read(this.DataType, this.CalculatedAddress, out _);

                if (!(this.AddressValue?.Equals(previousValue) ?? false))
                {
                    this.RaisePropertyChanged(nameof(this.AddressValue));
                    this.RaisePropertyChanged(nameof(this.DisplayValue));
                }
            }
        }
Exemplo n.º 18
0
        public void Ensure_Registered_Properties_Are_Injected()
        {
            var    collection    = new ServiceCollection();
            string expectedValue = "TestValue";

            collection.AddSingleton(new TestViewModel()
            {
                Title = expectedValue
            });
            var propertyInjector = new PropertyInjector(collection.BuildServiceProvider());

            var builder = new StringBuilder();

            builder.AppendLine("@model object");
            builder.AppendLine("@inject RazorLight.MVC.Tests.TestViewModel test");
            builder.AppendLine("Hello @test");

            IEngineCore       engineCore = new EngineCore(new Templating.Embedded.EmbeddedResourceTemplateManager(typeof(PropertyInjectorTest)));
            CompilationResult result     = engineCore.CompileSource(new Templating.LoadedTemplateSource(builder.ToString()), new ModelTypeInfo(typeof(object)));

            var page = (TemplatePage)Activator.CreateInstance(result.CompiledType);

            propertyInjector.Inject(page);

            var prop = page.GetType().GetProperty("test").GetValue(page);

            Assert.NotNull(prop);
            Assert.IsAssignableFrom <TestViewModel>(prop);
            Assert.Equal((prop as TestViewModel).Title, expectedValue);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Loads the instructions to display.
        /// </summary>
        private void LoadInstructions()
        {
            Byte[] bytes = EngineCore.GetInstance().VirtualMemory.ReadBytes(this.BaseAddress.ToIntPtr(), 200, out _);

            if (bytes.IsNullOrEmpty())
            {
                return;
            }

            Boolean isProcess32Bit = EngineCore.GetInstance().Processes.IsOpenedProcess32Bit();

            // Disassemble instructions
            IEnumerable <NormalizedInstruction> disassembledInstructions = this.Disassembler.Disassemble(bytes, isProcess32Bit, this.BaseAddress.ToIntPtr());
            IList <InstructionItem>             instructions             = new List <InstructionItem>();

            foreach (NormalizedInstruction disassembledInstruction in disassembledInstructions)
            {
                String moduleName;
                UInt64 address = AddressResolver.GetInstance().AddressToModule(disassembledInstruction.Address, out moduleName);

                instructions.Add(new InstructionItem(address.ToIntPtr(), moduleName, disassembledInstruction.Instruction, disassembledInstruction.Bytes));
            }

            this.Instructions = new FullyObservableCollection <InstructionItem>(instructions);
        }
Exemplo n.º 20
0
        public void OnDeserialized(StreamingContext streamingContext)
        {
            this.LastActivated   = DateTime.MinValue;
            this.ActivationDelay = KeyboardHotkey.DefaultActivationDelay;
            this.AccessLock      = new object();

            this.Subscription = EngineCore.GetInstance().Input?.GetKeyboardCapture().WeakSubscribe(this);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Reads the array of bytes of the specified count at the given address.
        /// </summary>
        /// <param name="address">The address of the read.</param>
        /// <param name="count">The number of bytes to read.</param>
        /// <returns>The bytes read at the address.</returns>
        public Byte[] Read(UInt64 address, Int32 count)
        {
            this.PrintDebugTag(address.ToString("x"), count.ToString());

            Boolean readSuccess;

            return(EngineCore.GetInstance().VirtualMemory.ReadBytes(address.ToIntPtr(), count, out readSuccess));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Reads the value at the given address.
        /// </summary>
        /// <typeparam name="T">The data type to read.</typeparam>
        /// <param name="address">The address of the read.</param>
        /// <returns>The value read from memory.</returns>
        public T Read <T>(UInt64 address)
        {
            this.PrintDebugTag(address.ToString("x"));

            Boolean readSuccess;

            return(EngineCore.GetInstance().VirtualMemory.Read <T>(address.ToIntPtr(), out readSuccess));
        }
Exemplo n.º 23
0
        public UInt64 EvaluatePointer(UInt64 address, IEnumerable <Int32> offsets)
        {
            this.PrintDebugTag();

            UInt64 finalAddress = EngineCore.GetInstance().VirtualMemory.EvaluatePointer(address.ToIntPtr(), offsets).ToUInt64();

            return(finalAddress);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Reads the value at the given address.
        /// </summary>
        /// <typeparam name="T">The data type to read.</typeparam>
        /// <param name="address">The address of the read.</param>
        /// <returns>The value read from memory.</returns>
        public T Read <T>(UInt64 address)
        {
            this.PrintDebugTag(address.ToString("x"));

            Boolean readSuccess;

            return(EngineCore.GetInstance().OperatingSystemAdapter.Read <T>(address.ToIntPtr(), out readSuccess));
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            var engine = new EngineCore();

            LoadZoneFile($"../ConverterApp/{args[0]}_oes.zip", engine);

            engine.Run();
        }
Exemplo n.º 26
0
        /// <summary>
        /// Searches for the first address that matches the array of bytes.
        /// </summary>
        /// <param name="bytes">The array of bytes to search for.</param>
        /// <returns>The address of the first first array of byte match.</returns>
        public UInt64 SearchAob(Byte[] bytes)
        {
            this.PrintDebugTag();

            UInt64 address = EngineCore.GetInstance().VirtualMemory.SearchAob(bytes).ToUInt64();

            return(address);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Searches for the first address that matches the array of bytes.
        /// </summary>
        /// <param name="bytes">The array of bytes to search for.</param>
        /// <returns>The address of the first first array of byte match.</returns>
        public UInt64 SearchAob(Byte[] bytes)
        {
            this.PrintDebugTag();

            UInt64 address = EngineCore.GetInstance().OperatingSystemAdapter.SearchAob(bytes).ToUInt64();

            return(address);
        }
Exemplo n.º 28
0
        private void CleanUp()
        {
            this.Snapshot = null;

            EngineCore.GetInstance().Input?.GetKeyboardCapture().Unsubscribe(this);
            EngineCore.GetInstance().Input?.GetControllerCapture().Unsubscribe(this);
            EngineCore.GetInstance().Input?.GetMouseCapture().Unsubscribe(this);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Writes a value to the computed address of this item.
        /// </summary>
        /// <param name="newValue">The value to write.</param>
        protected virtual void WriteValue(Object newValue)
        {
            if (newValue == null)
            {
                return;
            }

            EngineCore.GetInstance()?.VirtualMemory?.Write(this.DataType, this.CalculatedAddress, newValue);
        }
Exemplo n.º 30
0
        public void Update(NormalizedProcess process)
        {
            if (process != null)
            {
                this.BaseAddress = EngineCore.GetInstance().VirtualMemory.GetModules().FirstOrDefault()?.BaseAddress.ToUInt64() ?? 0UL;

                this.LoadInstructions();
            }
        }