BlackMagic Memory Read - Error menu

User Tag List

Results 1 to 11 of 11
  1. #1
    Cryptography's Avatar Member
    Reputation
    2
    Join Date
    Sep 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    BlackMagic Memory Read - Error

    I know this is a simple question however I don't know the answer. I have been trying to use Shnyd's BlackMagic memory reader. Unfortunately I cannot seem to get things to work like I would expect..

    The following code uses the memory addresses specified in the 3.0.9 Memory offsets page to attempt to get the currentPlayers XYZ location and the current targets guid. The Current Target returns somthing that only changes when i change targets so It may well be the guid, however the code as written causes an exception when creating the player base...

    This same exception is called effectively anytime I call a Nested memory read. I am sure I am doing something wrong, but I don't know what it is. Please enlighten me.

    Code:
    namespace BlackMagicTest
    {
        class Program
        {
    		static void Main(string[] args)
    		{
                uint CLIENT_CONNECTION;
    
    			BlackMagic wow = new BlackMagic();
    			if (wow.OpenProcessAndThread(SProcess.GetProcessFromProcessName("wow")))
    			{
    
                    uint playerBase = wow.ReadUInt(wow.ReadUInt(wow.ReadUInt(0x127F3C) + 0x30) + 0x28);
                    
                    float x = wow.ReadFloat(playerBase + 0x7D0);
                    float y = wow.ReadFloat(playerBase + 0x7D4);
                    float z = wow.ReadFloat(playerBase + 0x7D8);
    
                    UInt64 CurTargetGuid = wow.ReadUInt64(0x10A68E0);
    
                    Console.WriteLine("Loc: {0}, {1}, {2} | {3}", x, y, z, CurTargetGuid);
                }
                else
                {
                    Console.WriteLine("World of Warcraft could not be opened for read/write.");
                }
    
                Console.ReadLine();
    
    		}
    	}
    }
    Edit:

    Note, Attached Process is running in debug mode.

    The error, which I should have specified more percisely earlier is the exception thrown from this function included in SMemory.cs of Black Magic.
    Code:
    		public static uint ReadUInt(IntPtr hProcess, uint dwAddress, bool bReverse)
    		{
    			byte[] buf = ReadBytes(hProcess, dwAddress, sizeof(uint));
    			if (buf == null)
    				throw new Exception("ReadUInt failed.");
    
    			if (bReverse)
    				Array.Reverse(buf);
    
    			return BitConverter.ToUInt32(buf, 0);
    		}
    Robske007a, Thanks for the note on the address. I have changed it, but cannot test till servers are online.
    Last edited by Cryptography; 02-24-2009 at 11:27 AM.

    BlackMagic Memory Read - Error
  2. #2
    JuJuBoSc's Avatar Banned for scamming CoreCoins Purchaser
    Reputation
    1019
    Join Date
    May 2007
    Posts
    922
    Thanks G/R
    1/3
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to read first 0x127F3C, then result + 0x30, then result + 0x28 for the player base imo.

  3. #3
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have another question.
    If you change somehing in the .rdata section you first need to change the Acess to let's say PAGE_EXECUTE_READWRITE
    and then i write the new value and then when i try to read it i get an error saying it cant be read. Anyone who know's why? here some of the code

    Code:
    using Magic;
    using System;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    
    
    namespace MrHackIt.Jumping
    {
        class Jumping
        {
            [DllImport("kernel32.dll")]
            static extern bool VirtualProtectEx(IntPtr hProcess, IntPtr lpAddress,
            UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);
    
            private BlackMagic wow { get; set; }
            public uint landjmp_patch { get; set; }
            public uint waterjmp_patch {get; set;}
    
             public Jumping(BlackMagic _BlackMagic)
            {
                this.wow = _BlackMagic;
    
                this.landjmp_patch = 0x9A9A7C;
                this.waterjmp_patch = 0x9A9A80;
            }
    
            public float jmpheight_land 
            { 
                get
                {
                    uint old;
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.landjmp_patch, (UIntPtr)0x4, 0x02, out old);
                    return wow.ReadFloat(landjmp_patch);   
                }
                set
                {
                    uint old;
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.landjmp_patch, (UIntPtr)0x4, 0x40, out old);
                    wow.WriteFloat(landjmp_patch, value);
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.landjmp_patch, (UIntPtr)0x4, old, out old);
                }
            
            }
            public float jmpheight_water 
            { 
                get
                {
                    uint old;
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.waterjmp_patch, (UIntPtr)0x4, 0x02, out old);
                    return wow.ReadFloat(waterjmp_patch);   
                }
                set
                {
                    uint old;
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.waterjmp_patch, (UIntPtr)0x4, 0x40, out old);
                    wow.WriteFloat(waterjmp_patch, value);
                    VirtualProtectEx(wow.ProcessHandle, (IntPtr)this.waterjmp_patch, (UIntPtr)0x4, old, out old);
                }
            }
        }
    }

  4. #4
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uhm.. so what does the exception say exactly? (to the OP) I somehow missed that part, might be helpful.

    Edit: Also, Process.EnterDebugMode(); might help, dunno.

  5. #5
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by JuJuBoSc View Post
    You need to read first 0x127F3C, then result + 0x30, then result + 0x28 for the player base imo.
    Code:
    uint playerBase = wow.ReadUInt( wow.ReadUInt( wow.ReadUInt(0x127F3C) + 0x30 ) + 0x28 );
    That's what he's doing... but with a wrong pointer to the playerbase.

    0x00127F3C : wrong
    0x0127F13C : correct
    Last edited by Robske; 02-24-2009 at 08:46 AM.
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  6. #6
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by SKU View Post
    Uhm.. so what does the exception say exactly? (to the OP) I somehow missed that part, might be helpful.

    Edit: Also, Process.EnterDebugMode(); might help, dunno.
    read Float failed, and yes ive tried to enter debug mode but it didnt help i think i need to change the Acess type

  7. #7
    SKU's Avatar Contributor
    Reputation
    306
    Join Date
    May 2007
    Posts
    565
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nesox View Post
    read Float failed, and yes ive tried to enter debug mode but it didnt help i think i need to change the Acess type
    I'm sorry if I was confusing, I meant the thread-starter. I really have no idea concerning your problem, sorry.

  8. #8
    Cryptography's Avatar Member
    Reputation
    2
    Join Date
    Sep 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Robske007a View Post
    Code:
    uint playerBase = wow.ReadUInt( wow.ReadUInt( wow.ReadUInt(0x127F3C) + 0x30 ) + 0x28 );
    That's what he's doing... but with a wrong pointer to the playerbase.

    0x00127F3C : wrong
    0x0127F13C : correct
    Thanks. That worked. +Rep

    For the one that asked about the exception thrown... I updated the post above but it was a generic exception created by BlackMagic. Somthing like Read Uint64 Failure.

    This Code Works in 3.0.9 with the BlackMagic Libraries.
    Code:
    namespace BlackMagicTest
    {
        class Program
        {
    		static void Main(string[] args)
    		{
                uint CLIENT_CONNECTION;
    
    			BlackMagic wow = new BlackMagic();
    			if (wow.OpenProcessAndThread(SProcess.GetProcessFromProcessName("wow")))
    			{
    
                    wow.SuspendThread(wow.ThreadHandle);
    
                    float x = 0, y = 0, z =0;
                    try
                    {
                        uint playerBase = wow.ReadUInt(wow.ReadUInt(wow.ReadUInt(0x0127F13C) + 0x30) + 0x28);
    
                        x = wow.ReadFloat(playerBase + 0x7D0);
                        y = wow.ReadFloat(playerBase + 0x7D4);
                        z = wow.ReadFloat(playerBase + 0x7D8);
                    }
                    catch (Exception e)
                    {
    
                    }
                    finally
                    {
                        wow.ResumeThread();
                    }
                    UInt64 CurTargetGuid = wow.ReadUInt64(0x10A68E0);
    
                    Console.WriteLine("Loc: {0}, {1}, {2} | {3}", x, y, z, CurTargetGuid);
                }
                else
                {
                    Console.WriteLine("World of Warcraft could not be opened for read/write.");
                }
    
                Console.ReadLine();
    
    		}
    	}
    }

  9. #9
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why would you suspend WoW's thread for some mere memory reads?

    And

    Code:
    uint CLIENT_CONNECTION;
    Is looking rather silly there
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  10. #10
    Cryptography's Avatar Member
    Reputation
    2
    Join Date
    Sep 2008
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Robske007a View Post
    Why would you suspend WoW's thread for some mere memory reads?

    And

    Code:
    uint CLIENT_CONNECTION;
    Is looking rather silly there
    Right now I am just happy that it works... Anyway I suspended the process for the memory read yesterday just to see if that helped. Hadn't removed it yet. Though as you say it isn't needed... Thanks again.

  11. #11
    bhpushnslide's Avatar Member
    Reputation
    5
    Join Date
    Feb 2009
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! Just robbed this as a working example of using the BlackMagic Lib... and it worked!!

    :-D

    Understand it all so much better now :-)

Similar Threads

  1. White Paper : Memory reading
    By tttommeke in forum WoW Memory Editing
    Replies: 41
    Last Post: 06-19-2008, 02:30 AM
  2. WoW Leveling Bot Memory Reading
    By Lindoz12 in forum WoW Memory Editing
    Replies: 2
    Last Post: 02-21-2008, 06:25 PM
  3. VB .Net Memory Reading Project
    By Glitchy in forum WoW Memory Editing
    Replies: 4
    Last Post: 01-22-2008, 12:37 PM
  4. [AutoIT3] WoW Cordinator (X,Y,MapID and rotation memory reading)
    By Vladinator in forum World of Warcraft Bots and Programs
    Replies: 22
    Last Post: 05-15-2007, 03:26 AM
All times are GMT -5. The time now is 03:14 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search