IsValidMemoryAddress() private method

private IsValidMemoryAddress ( uint Address ) : bool
Address uint
return bool
Example #1
0
        internal void ThreadEventDispatcher()
        {
            while (true)
            {
                if (DispatchConnect)
                {
                    DispatchConnect = false;
                    DoConnect();
                }
                if (DispatchOpenProcess)
                {
                    DispatchOpenProcess = false;
                    DoOpenProcess();
                }
                if (DispatchSearch)
                {
                    DispatchSearch = false;
                    DoSearch();
                }
                if (DispatchConfig)
                {
                    DispatchConfig = false;
                    DoConfig();
                }
                if (DispatchImport)
                {
                    DispatchImport = false;
                    DoImport();
                }
                if (DispatchPointerSearch != null)
                {
                    string TempAddress = DispatchPointerSearch;
                    DispatchPointerSearch = null;
                    DoPointerSearch(TempAddress);
                }
                while (RefreshValueAddresses.Count > 0)
                {
                    MemoryDispatch Row = new MemoryDispatch();
                    RefreshValueAddresses.TryDequeue(out Row);
                    uint Address;

                    if (HexRegex.IsMatch(Row.TextAddress))
                    {
                        Address = BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(Row.TextAddress).Reverse().ToArray(), 0);;
                    }
                    else
                    {
                        Match TopMatch = ParserRegex.Match(Row.TextAddress);

                        if (!TopMatch.Success)
                        {
                            return;
                        }

                        Address = ResolvePointer(TopMatch);
                    }

                    if (Form.IsValidMemoryAddress(Address))
                    {
                        Row.ResolvedAddress = Utilities.GetStringFromByteArray(BitConverter.GetBytes(Address).Reverse().ToArray());
                        Row.Value           = GetMemoryAtAddress(CurrentSelectedProcess, Address, Row.Type);
                        RefreshValueReturn.Enqueue(Row);
                    }
                }
                while (WriteAddress.Count > 0)
                {
                    MemoryDispatch Row = new MemoryDispatch();
                    WriteAddress.TryDequeue(out Row);
                    uint Address;

                    if (HexRegex.IsMatch(Row.TextAddress))
                    {
                        Address = BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(Row.TextAddress).Reverse().ToArray(), 0);;
                    }
                    else
                    {
                        Match TopMatch = ParserRegex.Match(Row.TextAddress);

                        if (!TopMatch.Success)
                        {
                            return;
                        }

                        Address = ResolvePointer(TopMatch);
                    }

                    if (Form.IsValidMemoryAddress(Address))
                    {
                        Row.ResolvedAddress = Utilities.GetStringFromByteArray(BitConverter.GetBytes(Address).Reverse().ToArray());
                        uint ProcessID = BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(CurrentSelectedProcess.Split('|')[0]), 0);
                        Form.NTRConnection.SendWriteMemoryPacket(ProcessID, Address, Row.Value);
                    }
                }

                Thread.Sleep(100);
            }
        }