System.IndexOutOfRangeException: "The index was out of range of the array." c# ReadWriteMemory

private void WeaponPistol_Click(object sender, EventArgs e)
{
uint vIn = 0xA2719263;


long vOut = Convert.ToInt64(vIn);




//This line is why im getting the error message
Process process = Process.GetProcessesByName("00004D48-FiveM_GTAProcess.exe")[0];
IntPtr processHandle = OpenProcess(PROCESS_ALL_ACCESS, false, process.Id);

int bytesWritten = 0;
byte[] buffer = Encoding.Unicode.GetBytes("WEAPON_PISTOL\0");

WriteProcessMemory((int) processHandle, (int)vOut , buffer, buffer.Length, ref bytesWritten);




}
}
Was this page helpful?