コード例 #1
0
ファイル: Freezer.cs プロジェクト: Sghirate/7wSizer
 public Freezer(Process process)
 {
     _timer = new System.Timers.Timer();
     _writer = new ProcessMemoryReader();
     _writer.ReadProcess = process;
     _records = new List<MemoryRecord>();
     _timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
 }
コード例 #2
0
ファイル: Sizing.cs プロジェクト: Sghirate/7wSizer
        private static void SEARCH()
        {
            //Console.WriteLine("INIT SEARCH");
            _rsmax = 0x10000000 / BLOCK;
            POS_RAHMEN_R = -1;
            POS_RAHMEN_U = -1;
            int breite = Read(POS_FENSTER_BREITE);
            int hoehe = Read(POS_FENSTER_HOEHE);
            ProcessMemoryReader reader = new ProcessMemoryReader();
            reader.ReadProcess = m_proc;
            reader.OpenProcess();
            int bytesWritten;
            reader.WriteProcessMemory((IntPtr)POS_FENSTER_X, BitConverter.GetBytes((Int32)0), out bytesWritten);
            reader.WriteProcessMemory((IntPtr)POS_FENSTER_Y, BitConverter.GetBytes((Int32)0), out bytesWritten);
            for (int i = 0; i <= 0x10000000 / BLOCK; i++)
            {
                _rscur = i;
                //Console.WriteLine(" {0} / {1}", i, (0x10000000 / BLOCK));
                //Console.SetCursorPosition(0, cp);
                int bytesRead;
                byte[] data = reader.ReadProcessMemory((IntPtr)(i * 1024 * 64), (1024 * 64), out bytesRead);
                for (int p = 0; p < (data.Length - 4); p++)
                {
                    int val = BitConverter.ToInt32(data, p);
                    if (val == breite)
                        if (BitConverter.ToInt32(data, p - 12) == hoehe)
                            POS_RAHMEN_R = (i * 1024 * 64) + p;
                    if (val == hoehe)
                        if (BitConverter.ToInt32(data, p - 4) == -5)
                            POS_RAHMEN_U = (i * 1024 * 64) + p;
                }
            }
            //Console.WriteLine();
            //Console.WriteLine("{0:X}", POS_RAHMEN_R);
            //Console.WriteLine("{0:X}", POS_RAHMEN_U);

            if ((POS_RAHMEN_R > -1) && (POS_RAHMEN_U > -1))
                _RahmenFound = true;
            else
                _RahmenFound = false;
            MainForm.Instance.SetBorder(_RahmenFound);
            _searchingRahmen = false;
            reader.CloseHandle();
        }
コード例 #3
0
ファイル: Sizing.cs プロジェクト: Sghirate/7wSizer
 private static Int32 Read(int adress)
 {
     Int32 toRet = 0;
     IntPtr m_adress = (IntPtr)adress;
     ProcessMemoryReader reader = new ProcessMemoryReader();
     reader.ReadProcess = m_proc;
     reader.OpenProcess();
     int bytesReadSize;
     byte[] gelesen;
     gelesen = reader.ReadProcessMemory(m_adress, 4, out bytesReadSize);
     toRet = BitConverter.ToInt32(gelesen, 0);
     //reader.CloseHandle();
     return toRet;
 }
コード例 #4
0
ファイル: Sizing.cs プロジェクト: Sghirate/7wSizer
        public static void Set(Size toSet)
        {
            //MainForm.Instance.SetUsed(true);
            Int32 nX = (Int32)toSet.Width;
            Int32 nY = (Int32)toSet.Height;

            //SET X Y
            ProcessMemoryReader pRW = new ProcessMemoryReader();
            pRW.ReadProcess = m_proc;
            pRW.OpenProcess();
            int written;
            pRW.WriteProcessMemory((IntPtr)POS_FENSTER_X, BitConverter.GetBytes((Int16)1), out written);
            pRW.WriteProcessMemory((IntPtr)POS_FENSTER_Y, BitConverter.GetBytes((Int16)1), out written);
            pRW.WriteProcessMemory((IntPtr)POS_FENSTER_BREITE, BitConverter.GetBytes((Int32)nX), out written);
            pRW.WriteProcessMemory((IntPtr)POS_FENSTER_HOEHE, BitConverter.GetBytes((Int32)nY), out written);
            pRW.WriteProcessMemory((IntPtr)POS_RAHMEN_R, BitConverter.GetBytes((Int32)nX), out written);
            pRW.WriteProcessMemory((IntPtr)POS_RAHMEN_U, BitConverter.GetBytes((Int32)nY), out written);
            pRW.CloseHandle();
            //SET & FREEZE SCRREN SIZE
            /*if (m_freeze != null)
                m_freeze.StopFreezing();
            m_freeze = new Freezer(m_proc);
            m_freeze.AddMemoryAddress(POS_FENSTER_BREITE, (Int16)nX);
            m_freeze.AddMemoryAddress(POS_FENSTER_HOEHE, (Int16)nY);
            m_freeze.AddMemoryAddress(POS_RAHMEN_R, (Int16)nX);
            m_freeze.AddMemoryAddress(POS_RAHMEN_U, (Int16)nY);
            m_freeze.StartFreezing(100);*/
        }
コード例 #5
0
ファイル: Sizing.cs プロジェクト: Sghirate/7wSizer
 public static void Reset()
 {
     if (m_used)
     {
         if (m_freeze != null)
             m_freeze.StopFreezing();
         try
         {
             ProcessMemoryReader writer = new ProcessMemoryReader();
             writer.ReadProcess = m_proc;
             int bytesWritten;
             writer.WriteProcessMemory((IntPtr)POS_FENSTER_BREITE, BitConverter.GetBytes(m_oldSize.Width), out bytesWritten);
             writer.WriteProcessMemory((IntPtr)POS_FENSTER_HOEHE, BitConverter.GetBytes(m_oldSize.Height), out bytesWritten);
             MainForm.Instance.SetUsed(false);
             writer.CloseHandle();
         }
         catch { }
     }
 }