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);*/ }
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(); }
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 { } } }