Beispiel #1
0
        static void Main(string[] args)
        {
            uint dwCodeLoc;

            wow = new BlackMagic();

            if (wow.OpenProcessAndThread(SProcess.GetProcessFromProcessName("wow")))
            {
                Console.WriteLine(wow.GetModuleFilePath());
                DateTime dt = DateTime.Now;

                //dwCodeLoc = SPattern.FindPattern(wow.ProcessHandle, wow.MainModule, PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION, ' ');
                dwCodeLoc = wow.FindPattern(PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION);
                Console.WriteLine("Pattern found in {0}ms", DateTime.Now.Subtract(dt).TotalMilliseconds);
                Console.WriteLine("Code loc: 0x{0:X08}", dwCodeLoc);
                Console.WriteLine("CLIENT_CONNECTION: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x16));
                Console.WriteLine("CURMGR_OFFSET: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x1C));
            }
            else
            {
                Console.WriteLine("World of Warcraft could not be opened for read/write.");
            }

            Console.ReadLine();
        }
Beispiel #2
0
        public bool Init()
        {
            // Open the Diablo III process
            int processID = SProcess.GetProcessFromProcessName(PROCESS_NAME);

            if (processID == 0)
            {
                Log.Error("Diablo III process not found");
                return(false);
            }

            // Attempt to open the D3 process with read/write permission
            if (!d3.IsProcessOpen && !d3.Open(processID))
            {
                d3 = null;
                Log.Error("Failed to open Diablo III process " + processID);
                return(false);
            }

            if (!computedHash)
            {
                // Compute the MD5 hash of the D3 executable to make sure we're working with the right version
                byte[] md5Bytes;
                using (FileStream exeStream = File.OpenRead(d3.GetModuleFilePath()))
                    md5Bytes = new MD5CryptoServiceProvider().ComputeHash(exeStream);
                string md5Hash = ProcessUtils.BytesToHexString(md5Bytes);
                if (md5Hash != Offsets.MD5_CLIENT)
                {
                    throw new Exception("MD5 checksum failed: " + md5Hash);
                }

                computedHash = true;
            }

            // Initialize the memory reader, including important global pointer addresses
            if (!memReader.UpdatePointers())
            {
                return(false);
            }

            // Install our detour into the DirectX9 EndScene() method
            try
            {
                injector = new Injector(d3, memReader.EndSceneAddr);
            }
            catch (Exception ex)
            {
                Log.Error("Failed to inject custom code", ex);
                return(false);
            }

            return(true);
        }