그래서 ReadProcessMemory를 사용하여 변수를 읽으려고했는데 치트 엔진에서 주소를 찾는 것이 완벽하게 이루어졌지만 프로그래밍을 마치 자마자 몇 가지 문제가 발생했습니다. 치트 엔진에서 탄약과 건강 주소를 검색했고 건강 상태가 한 수준의 포인터 였고 탄약이 3 단계 포인터였습니다. 나는 건강을 읽는했지만, 매번 나는,이 치트 엔진에 주소를 0으로사용 방법 ReadProcessMemory
namespace AssaultCubeTrainer
{
public partial class MainWindow : Window
{
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool ReadProcessMemory(IntPtr pHandle, IntPtr Address, byte[] Buffer, int Size, IntPtr NumberofBytesRead);
public static Process myProc;
public static Player p1;
public MainWindow()
{
InitializeComponent();
p1 = new Player();
MessageBox.Show("Please press the attach button as soon as the game has started", " Information",MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
private void AttachProcButton_Click(object sender, RoutedEventArgs e)
{
try
{
myProc = Process.GetProcessesByName("ac_client")[0];
if (myProc.Handle != null)
{
MessageBox.Show("Process successfully attached", "Success", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
}
catch
{
MessageBox.Show("The process was not found","Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
}
}
private void ButtonTest_Click(object sender, RoutedEventArgs e)
{
lbHealthInfo.Content = p1.GetHealthInfo();
}
}
}
namespace AssaultCubeTrainer
{
public class Player
{
private byte[] buffer;
public bool ReadSuccess;
public int HealthAddress;
public int HealthOffset;
public int AmmoAddress;
public int AmmoOffset;
public int Health;
public int Ammo;
public IntPtr bytesRead;
public Player()
{
HealthAddress = 0x00509B74;
HealthOffset = 0xF8;
AmmoAddress = 0x00509B74;
AmmoOffset = 0x374;
Health = HealthAddress + HealthOffset;
Ammo = AmmoAddress + AmmoOffset;
}
//Here I have the problem when reading variable
public int GetHealthInfo()
{
**buffer = new byte[4];
ReadSuccess = MainWindow.ReadProcessMemory(MainWindow.myProc.Handle, (IntPtr)Health, buffer, buffer.Length, bytesRead);
return BitConverter.ToInt32(buffer, 0);**
}
}
}
을 Heres 링크를 반환 읽어 을 couldnt가 업로드 여기 : P
내 코드에서 치트 엔진의 포인터와 오프셋을 올바르게 사용하려면 어떻게해야하며 코드에 다중 레벨 포인터를 구현하려면 어떻게해야합니까? 제 엿 같은 영어를 용서하십시오.
난 당신이'OpenProcess' API를 사용하여 프로세스를 열 필요가 두려워 - [이] (확인 https://stackoverflow.com/questions/34467311/c-sharp-readprocessmemory -how-to-read-a-64-bit- 메모리 주소). – vasek