Results 1 to 2 of 2
  1. #1
    ArronLayyd's Avatar
    Join Date
    Oct 2017
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    Write Process Memory causing CS:GO to crash?

    Hi Guys,

    So i'm starting to get into developing hacks for CS:GO, following a few tutorials and using some resources from this site to help me get started. The tutorial I've been following has been using VAMemory which i understand as not being that good? So i've been implementing the Read and Write process memory functions but when it tries to write a value of 0 it is crashing CS:GO? Any help?

    Code:
                    ProcessMemory pMemory = new ProcessMemory();
                    Process lProcess = Process.GetProcessesByName("csgo")[0];
                    IntPtr oProcess = OpenProcess(0x1F0FFF, false, (IntPtr)lProces*****);
    
                    if (GetModuleAddy())
                    {
                        while (true)
                        {
                            GlowStruct Enemy = new GlowStruct()
                            {
                                r = 1,
                                g = 0,
                                b = 0,
                                a = 1,
                                rwo = true,
                                rwuo = true
    
                            };
    
                            int address;
                            int i = 1;
    
                            do
                            {
                                address = bClient + Offsets.oLocalPlayer;
                                int Player = pMemory.Read(oProcess, address);
    
                                address = Player + Offsets.oTeam;
                                int MyTeam = pMemory.Read(oProcess, address);
    
                                address = bClient + Offsets.oEntityList + (i - 1) * 0x10;
                                int EntityList = pMemory.Read(oProcess, address);
    
                                address = EntityList + Offsets.oTeam;
                                int EnemyTeam = pMemory.Read(oProcess, address);
    
                                address = EntityList + Offsets.oGlowIndex;
    
                                int GlowIndex = pMemory.Read(oProcess, address);
    
                                address = EnemyTeam + Offsets.oDormant;
                                if (!pMemory.ReadBoolean(oProcess, address))
                                {
                                    address = bClient + Offsets.oGlowObject;
                                    int GlowObject = pMemory.Read(oProcess, address);
    
                                    int calculation = GlowIndex * 0x38 + 0x4;
                                    int current = GlowObject + calculation;
                                    pMemory.WriteFloat(oProcess, address, Enemy.r);
    
                                    calculation = GlowIndex * 0x38 + 0x8;
                                    current = GlowObject + calculation;
                                    pMemory.WriteFloat(oProcess, address, Enemy.g);
    
                                    calculation = GlowIndex * 0x38 + 0xC;
                                    current = GlowObject + calculation;
                                    pMemory.WriteFloat(oProcess, address, Enemy.b);
    
                                    calculation = GlowIndex * 0x38 + 0x10;
                                    current = GlowObject + calculation;
                                    pMemory.WriteFloat(oProcess, address, Enemy.a);
    
                                    calculation = GlowIndex * 0x38 + 0x24;
                                    current = GlowObject + calculation;
                                    pMemory.WriteBoolean(oProcess, address, Enemy.rwo);
    
                                    calculation = GlowIndex * 0x38 + 0x25;
                                    current = GlowObject + calculation;
                                    pMemory.WriteBoolean(oProcess, address, Enemy.rwuo);
                                }
    
                                i++;
                            } while (i < 65);
    
                            Thread.Sleep(10);
                        }
    Specifically it is crashing after executing this set of code:

    Code:
                                    
                                    calculation = GlowIndex * 0x38 + 0x8;
                                    current = GlowObject + calculation;
                                    pMemory.WriteFloat(oProcess, address, Enemy.g);
    and here is the WriteFloat function in case the problem is in that:

    Code:
            public bool WriteFloat(IntPtr handle, int address, float value)
            {
                byte[] dataBuffer = BitConverter.GetBytes(value);
                IntPtr bytesWritten = IntPtr.Zero;
    
                WriteProcessMemory(handle, (IntPtr)address, dataBuffer, dataBuffer.Length, out bytesWritten);
    
                if (bytesWritten == IntPtr.Zero)
                {
                    return false;
                }
                if (bytesWritten.ToInt32() < dataBuffer.Length)
                {
                    return false;
                }
    
                return true;
            }

    Any help would be appreciated, Thank-you!

  2. #2
    ArronLayyd's Avatar
    Join Date
    Oct 2017
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Resolved:

    For anyone wondering about this i was writing to the wrong address

    Code:
    pMemory.WriteFloat(oProcess, address, Enemy.g);
    'address' should have been 'current'

Similar Threads

  1. [Unresolved] Write Process Memory 64bit
    By normiescum in forum Visual Basic Programming
    Replies: 3
    Last Post: 01-24-2017, 10:33 AM
  2. [Help Request] c++ need help about read/write process memory
    By nepafter37 in forum C++/C Programming
    Replies: 15
    Last Post: 04-08-2016, 01:00 AM
  3. [Help] Write Process Memory Class
    By ViPeR124 in forum Visual Basic Programming
    Replies: 1
    Last Post: 08-29-2013, 05:33 AM
  4. [Help] Memory editing (Read/Write Process Memory)
    By wolfguardiann in forum Visual Basic Programming
    Replies: 31
    Last Post: 06-04-2011, 03:23 AM
  5. [Help] Write Process Memory
    By tremaster in forum Visual Basic Programming
    Replies: 6
    Last Post: 03-22-2010, 03:28 PM