//Write to Address public bool Write(UInt64 iMemoryAddress, byte bByteToWrite) { byte[] bBuffer = { bByteToWrite }; IntPtr ptrBytesWritten; ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptrBytesWritten); return(ptrBytesWritten.ToInt32() == 1); }
public bool Write(UInt64 iMemoryAddress, double iDoubleToWrite) { byte[] bBuffer = BitConverter.GetBytes(iDoubleToWrite); IntPtr ptrBytesWritten; ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptrBytesWritten); return(ptrBytesWritten.ToInt32() == 8); }
public unsafe static void VirtualQueryEx(IntPtr processHandle, IntPtr lpAddress, out ProcessMemoryReaderApi.MEMORY_BASIC_INFORMATION64 lpBuffer, uint dwLength) { bool Is32Bit; //First check if we are a 32 bit OS, in which case target process cannot be 64 bit if (sizeof(IntPtr) == (int)DataTypeSize.Int32) { Is32Bit = true; } else { ProcessMemoryReaderApi.IsWow64Process(processHandle, out Is32Bit); } if (!Is32Bit) { ProcessMemoryReaderApi.VirtualQueryEx(processHandle, lpAddress, out lpBuffer, dwLength); } else { ProcessMemoryReaderApi.MEMORY_BASIC_INFORMATION32 lpBuffer32; ProcessMemoryReaderApi.VirtualQueryEx(processHandle.ToInt32(), lpAddress.ToInt32(), out lpBuffer32, dwLength); lpBuffer.AllocationBase = lpBuffer32.AllocationBase; lpBuffer.AllocationProtect = lpBuffer32.AllocationProtect; lpBuffer.BaseAddress = lpBuffer32.BaseAddress; lpBuffer.lType = lpBuffer32.Type; lpBuffer.Protect = lpBuffer32.Protect; lpBuffer.RegionSize = (UInt64)lpBuffer32.RegionSize; lpBuffer.State = lpBuffer32.State; lpBuffer.__alignment1 = 0; lpBuffer.__alignment2 = 0; } }
public static unsafe void VirtualQueryEx(IntPtr processHandle, IntPtr lpAddress, out ProcessMemoryReaderApi.MEMORY_BASIC_INFORMATION64 lpBuffer, uint dwLength) { bool Is32Bit; //First check if we are a 32 bit OS, in which case target process cannot be 64 bit if (sizeof(IntPtr) == (int)DataTypeSize.Int32) Is32Bit = true; else ProcessMemoryReaderApi.IsWow64Process(processHandle, out Is32Bit); if (!Is32Bit) ProcessMemoryReaderApi.VirtualQueryEx(processHandle, lpAddress, out lpBuffer, dwLength); else { ProcessMemoryReaderApi.MEMORY_BASIC_INFORMATION32 lpBuffer32; ProcessMemoryReaderApi.VirtualQueryEx(processHandle.ToInt32(), lpAddress.ToInt32(), out lpBuffer32, dwLength); lpBuffer.AllocationBase = lpBuffer32.AllocationBase; lpBuffer.AllocationProtect = lpBuffer32.AllocationProtect; lpBuffer.BaseAddress = lpBuffer32.BaseAddress; lpBuffer.lType = lpBuffer32.Type; lpBuffer.Protect = lpBuffer32.Protect; lpBuffer.RegionSize = (UInt64)lpBuffer32.RegionSize; lpBuffer.State = lpBuffer32.State; lpBuffer.__alignment1 = 0; lpBuffer.__alignment2 = 0; } }
//Calculate Pointer public int CalculatePointer(int iMemoryAddress, int[] iOffsets) { int iPointerCount = iOffsets.Length - 1; IntPtr ptrBytesRead; byte[] bBuffer = new byte[4]; int iTemporaryAddress = 0; if (iPointerCount == 0) { iTemporaryAddress = iMemoryAddress; } for (int i = 0; i <= iPointerCount; i++) { if (i == iPointerCount) { ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iTemporaryAddress, bBuffer, 4, out ptrBytesRead); iTemporaryAddress = Conversions.Conversions.HexToInt(CreateAddress(bBuffer)) + iOffsets[i]; return(iTemporaryAddress); } else if (i == 0) { ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptrBytesRead); iTemporaryAddress = Conversions.Conversions.HexToInt(CreateAddress(bBuffer)) + iOffsets[0]; } else { ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iTemporaryAddress, bBuffer, 4, out ptrBytesRead); iTemporaryAddress = Conversions.Conversions.HexToInt(CreateAddress(bBuffer)) + iOffsets[i]; } } return(0); }
/// <summary> /// Write memory at address location. /// </summary> /// <param name="memoryAddress">Address location</param> /// <param name="buffer">Result in a byte buffer</param> /// <param name="bytesWritten">Bytes written</param> public void WriteMemory(IntPtr memoryAddress, byte[] buffer, out int bytesWritten) { IntPtr pBytesWritten = IntPtr.Zero; ProcessMemoryReaderApi.WriteProcessMemory(handle, memoryAddress, buffer, (uint)buffer.Length, out pBytesWritten); bytesWritten = pBytesWritten.ToInt32(); }
public void OpenProcess() { ProcessMemoryReaderApi.ProcessAccessType access; access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ; // | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE // | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION; m_hProcess = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)m_ReadProcess.Id); }
public Byte[] ReadAOB(IntPtr iMemoryAddress, uint iBytesToRead) { byte[] bBuffer = new byte[iBytesToRead]; IntPtr ptrBytesRead; ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, iMemoryAddress, bBuffer, iBytesToRead, out ptrBytesRead); return(bBuffer); }
public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten) { IntPtr ptrBytesWritten; ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten); bytesWritten = ptrBytesWritten.ToInt32(); }
public bool Write(UInt64 iMemoryAddress, byte[] bBytesToWrite) { IntPtr ptrBytesWritten; ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBytesToWrite, (uint)bBytesToWrite.Length, out ptrBytesWritten); return(ptrBytesWritten.ToInt32() == bBytesToWrite.Length); }
public int ReadProcessInt(IntPtr MemoryAddress) { byte[] buffer = new byte[4]; IntPtr ptrBytesRead; ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, 4, out ptrBytesRead); return(BitConverter.ToInt32(buffer, 0)); }
public byte[] ReadProcessMemory(IntPtr MemoryAddress, UInt64 bytesToRead, out Int64 bytesRead, byte[] buffer) { IntPtr ptrBytesRead = new IntPtr(); int rval = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead); bytesRead = ptrBytesRead.ToInt64(); return(buffer); }
/// <summary> /// Open process for memory write/read operation. /// </summary> public void OpenProcess() { ProcessMemoryReaderApi.ProcessAccessType access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_QUERY_INFORMATION | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION; handle = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)ReadProcess.Id); }
public byte[] ReadMemory(IntPtr memoryaddress, uint bytesToRead, out int bytesRead) { byte[] buffer = new byte[bytesToRead]; IntPtr pBytesRead; int returned = ProcessMemoryReaderApi.ReadProcessMemory(handle, memoryaddress, buffer, bytesToRead, out pBytesRead); bytesRead = pBytesRead.ToInt32(); return(buffer); }
public void CloseHandle() { int iRetValue; iRetValue = ProcessMemoryReaderApi.CloseHandle(m_hProcess); if (iRetValue == 0) { throw new Exception("CloseHandle failed"); } }
private void LoopTMR_Tick(object sender, EventArgs e) { if (attach) { try { // Step2 Value를 찾아서 모니터링 (현재 값이 무엇인지 계속적으로 확인) int step2SturctAddress = mem.ReadMultiLevelPointer(step2Data.baseAddress, 4, step2Data.multiLevel); int step2value = mem.ReadInt(step2SturctAddress + step2Data.offsets.health); Step2ValueLBL.Text = "Step 2 Value: " + step2value; // Step8 Value를 찾아서 모니터링 int step8SturctAddress = mem.ReadMultiLevelPointer(step8Data.baseAddress, 4, step8Data.multiLevel); int step8value = mem.ReadInt(step8SturctAddress + step8Data.offsets.health); Step8ValueLBL.Text = "Step 8 Value: " + step8value; // Step9의 플레이어 데이터를 모니터링 int p1Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P1multiLevel); int p2Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P2multiLevel); int p3Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P3multiLevel); int p4Base = mem.ReadMultiLevelPointer(step9PlayerData.baseAddress, 4, step9PlayerData.step9P4multiLevel); P1LBL.Text = "P1: [" + mem.ReadInt(p1Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p1Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p1Base + step9PlayerData.healthOffset); P2LBL.Text = "P2: [" + mem.ReadInt(p2Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p2Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p2Base + step9PlayerData.healthOffset); P3LBL.Text = "P3: [" + mem.ReadInt(p3Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p3Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p3Base + step9PlayerData.healthOffset); P4LBL.Text = "P4: [" + mem.ReadInt(p4Base + step9PlayerData.teamOffset) + " 팀]" + mem.ReadString(p4Base + step9PlayerData.nameOffset) + ": " + mem.ReadFloat(p4Base + step9PlayerData.healthOffset); // 크랙을 동작시켰을때, 현재 크랙이 값을 수정하도록 만드는 작업 int hotkey = ProcessMemoryReaderApi.GetKeyState(0x02); // 마우스 오른쪽키에 대한 상태 if ((hotkey & 0x8000) != 0) // 키가 눌렸을 경우 { if (crackState == false) // 크랙이 꺼져있는 경우에는 크랙 켜고 크랙 시도! { crackState = true; CrackStatusLBL.Text = "크랙 상태: On"; } else // 크랙이 켜져있는 경우에는 크랙을 끕니다. { crackState = false; CrackStatusLBL.Text = "크랙 상태: Off"; } } if (crackState) { Step2Solve(step2SturctAddress); // step2 Value를 1000으로 수정 Step8Solve(step8SturctAddress); // step2 Value를 1000으로 수정 } } catch (Exception ex) { crackState = false; MessageBox.Show("읽기 쓰기 오류: " + ex.Message); } } }
private void tmrProcess_Tick(object sender, EventArgs e) { if (gameFound && !SA[0].HasExited) { // Only the base address or multiLevel addresses need to be established first int playerBaseAddress = mem.ReadInt(offsets.baseAddr); // Stores an address which is the base address of the player struct. int XAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.xPos); // Multi level pointer with 2 offsets is needed to find the address of X position, // then this address can be read as a float. int ZAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.zPos); int YAddress = mem.ReadMultiLevelPointer(offsets.baseAddr, 4, offsets.yPos); lblX.Text = mem.ReadFloat(XAddress).ToString(); lblZ.Text = mem.ReadFloat(ZAddress).ToString(); lblY.Text = mem.ReadFloat(YAddress).ToString(); lblHealth.Text = mem.ReadFloat(playerBaseAddress + offsets.health).ToString(); int Hotkey = ProcessMemoryReaderApi.GetKeyState(0x74);//F5 if ((Hotkey & 0x8000) != 0) { // Teleport to Grove Street mem.WriteFloat(XAddress, 2495); mem.WriteFloat(ZAddress, -1668); mem.WriteFloat(YAddress, 13); } int Hotkey2 = ProcessMemoryReaderApi.GetKeyState(0x75);//F6 if ((Hotkey2 & 0x8000) != 0) { // Teleport to Dome Stadium Roof mem.WriteFloat(XAddress, 2737); mem.WriteFloat(ZAddress, -1760); mem.WriteFloat(YAddress, 44); } int Hotkey3 = ProcessMemoryReaderApi.GetKeyState(0x76);//F7 if ((Hotkey3 & 0x8000) != 0) { // Teleport to Skyscraper mem.WriteFloat(XAddress, 1544); mem.WriteFloat(ZAddress, -1353); mem.WriteFloat(YAddress, 330); } } else { // Game has ended so stop performing readMemory etc gameFound = false; btnAttach.BackColor = Color.Red; btnAttach.Enabled = true; } }//tmrProcess
public static bool Write(long Address, byte[] buffer, int size) { if (Process.GameRunning) { return(ProcessMemoryReaderApi.WriteProcessMemory(Voodoo.Process.Handle, (UIntPtr)Address, buffer, (UIntPtr)size, IntPtr.Zero)); } else { return(false); } }
public byte[] ReadProcessMemory(IntPtr MemoryAddress, uint bytesToRead, out int bytesRead) { byte[] buffer = new byte[bytesToRead]; IntPtr ptrBytesRead; int code = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead); bytesRead = ptrBytesRead.ToInt32(); return(buffer); }
public bool NOP(UInt64 iMemoryAddress, int iLength) { byte[] bBuffer = new byte[iLength]; IntPtr ptrBytesWritten; for (int i = 0; i < iLength; i++) { bBuffer[i] = 0x90; } ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)iLength, out ptrBytesWritten); return(ptrBytesWritten.ToInt32() == iLength); }
public string ReadProcessMemoryString(IntPtr MemoryAddress, uint bytesToRead, out int bytesRead) { byte[] buffer = new byte[bytesToRead]; IntPtr ptrBytesRead; ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead); bytesRead = ptrBytesRead.ToInt32(); return(System.Text.Encoding.Default.GetString(buffer)); }
private void TmrProcess_Tick(object sender, EventArgs e) { if (gameFound && !pro[0].HasExited) { GetCurrentData(); // AIMBOT - right mouse click if ((ProcessMemoryReaderApi.GetKeyState(02) & 0x8000) != 0) { Aimbot(); } // Client sided Health hack - (F5 Key) if ((ProcessMemoryReaderApi.GetKeyState(0x74) & 0x8000) != 0) { mem.WriteInt(player.pointerAddress + player.health, 999); } #region Teleporter // VK_F1 = 0x70, Save Current location as A if ((ProcessMemoryReaderApi.GetKeyState(0x70) & 0x8000) != 0) { SaveCoords(0); } // VK_F2 = 0x71, Save Current location as B if ((ProcessMemoryReaderApi.GetKeyState(0x71) & 0x8000) != 0) { SaveCoords(1); } // VK_F3 = 0x72, Load location A if ((ProcessMemoryReaderApi.GetKeyState(0x72) & 0x8000) != 0) { LoadCoords(0); } // VK_F4 = 0x73, Load location B if ((ProcessMemoryReaderApi.GetKeyState(0x73) & 0x8000) != 0) { LoadCoords(1); } #endregion }//if gamefound else { gameFound = false; btnAttach.BackColor = Color.FromArgb(220, 61, 65); // Red btnAttach.Enabled = true; } }
private void ProcessTMR_Tick(object sender, EventArgs e) { if (GameFound) { mouseXValueLBL.Text = Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.yaw).ToString(); mouseYValueLBL.Text = Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.pitch).ToString(); //DISPLAY OUR XYZ MAIN PLAYER'S POS xPosValueLBL.Text = Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.xPos).ToString(); yPosValueLBL.Text = Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.yPos).ToString(); zPosValueLBL.Text = Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.zPos).ToString(); //SHOW OUR ENEMY VARIABLES HealthMineLBL.Text = Mem.ReadInt(MainPlayer.baseAddress + MainPlayer.offsets.health).ToString(); EnHealthValueLBL.Text = Mem.ReadInt(EnemyAddresses[2].baseAddress + MainPlayer.offsets.health).ToString(); xPosEnValueLBL.Text = Mem.ReadFloat(EnemyAddresses[2].baseAddress + MainPlayer.offsets.xPos).ToString(); yPosEnValueLBL.Text = Mem.ReadFloat(EnemyAddresses[2].baseAddress + MainPlayer.offsets.yPos).ToString(); zPosEnValueLBL.Text = Mem.ReadFloat(EnemyAddresses[2].baseAddress + MainPlayer.offsets.zPos).ToString(); //RIGHT MOUSE int res = ProcessMemoryReaderApi.GetKeyState(02); if ((res & 0x8000) != 0) { //if enemy is holding AIMBOT btn or key we focus on that person until they are dead FocusingOnEnemy = true; AimBot(); } else { //otherwise we stop staring at them and change targets FocusingOnEnemy = false; FocusTarget = -1; } } try { if (MyProcess != null) { if (MyProcess[0].HasExited) { GameFound = false; } } } catch (Exception ex) { MessageBox.Show("There was an error " + ex.Message); } }
public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten) { IntPtr ptrBytesWritten; uint oldProtect; bool res = ProcessMemoryReaderApi.VirtualProtectEx(m_hProcess, MemoryAddress, new UIntPtr((uint)bytesToWrite.Length), 0x40, out oldProtect); int code; code = Marshal.GetLastWin32Error(); ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten); code = Marshal.GetLastWin32Error(); bytesWritten = ptrBytesWritten.ToInt32(); }
public double ReadDouble(UInt64 iMemoryAddress) { byte[] bBuffer = new byte[8]; IntPtr ptrBytesRead; int iReturn = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 8, out ptrBytesRead); if (iReturn == 0) { return(0); } else { return(BitConverter.ToDouble(bBuffer, 0)); } }
public Int32 ReadInt32(UInt64 iMemoryAddress) { byte[] bBuffer = new byte[4]; IntPtr ptrBytesRead; int iReturn = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 4, out ptrBytesRead); if (iReturn == 0) { return(0); } else { return(BitConverter.ToInt32(bBuffer, 0)); } }
public SByte ReadSByte(UInt64 iMemoryAddress) { byte[] bBuffer = new byte[1]; IntPtr ptrBytesRead; int iReturn = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, 1, out ptrBytesRead); if (iReturn == 0) { return(0); } else { return((SByte)bBuffer[0]); } }
public void CloseHandle() { try { int iRetValue; iRetValue = ProcessMemoryReaderApi.CloseHandle(m_hProcess); if (iRetValue == 0) { throw new Exception("CloseHandle failed"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } }
public int ReadProcessMemory(IntPtr MemoryAddress, UInt64 bytesToRead, out Int64 bytesRead, byte[] buffer) { IntPtr ptrBytesRead = new IntPtr(); int rval = ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead); if (rval == 1) { bytesRead = ptrBytesRead.ToInt64(); } else { bytesRead = 0; } return(rval); }
private void ProcessTMR_Tick(object sender, EventArgs e) { if (GameFound) { xMouse.Text = "xMouse: " + Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.yaw).ToString(); yMouse.Text = "yMouse: " + Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.pitch).ToString(); xPosLabel.Text = "xPos: " + Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.xPos).ToString(); yPosLabel.Text = "yPos: " + Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.yPos).ToString(); zPosLabel.Text = "zPos: " + Mem.ReadFloat(MainPlayer.baseAddress + MainPlayer.offsets.zPos).ToString(); playerHealth.Text = "Health: " + Mem.ReadInt(MainPlayer.baseAddress + MainPlayer.offsets.health).ToString(); //RIGHT MOUSE int res = ProcessMemoryReaderApi.GetKeyState(02); if ((res & 0x8000) != 0) { FocusingOnEnemy = true; AimBot(); } else { FocusingOnEnemy = false; FocusTarget = -1; } } try { if (MyProcess != null) { if (MyProcess[0].HasExited) { GameFound = false; } } } catch (Exception ex) { MessageBox.Show("Der opstod en fejl, prøv igen:\n " + ex.Message); } }
public bool Write(UInt64 iMemoryAddress, string sStringToWrite, int iMode = 0) { byte[] bBuffer = { 0 }; IntPtr ptrBytesWritten; if (iMode == 0) { bBuffer = CreateAOBText(sStringToWrite); } else if (iMode == 1) { bBuffer = ReverseBytes(CreateAOBString(sStringToWrite)); } ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, (IntPtr)iMemoryAddress, bBuffer, (uint)bBuffer.Length, out ptrBytesWritten); return(ptrBytesWritten.ToInt32() == bBuffer.Length); }