Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Runtime.InteropServices;
- namespace DumpUI
- {
- class Program
- {
- [DllImport("user32")]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool ScreenToClient(IntPtr hWnd, ref POINT lpPoint);
- [DllImport("user32.dll")]
- public static extern bool SetCursorPos(int X, int Y);
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
- public struct POINT
- {
- public int X;
- public int Y;
- }
- static Magic.BlackMagic BM;
- public enum UIFrame
- {
- UIBase = 0x00B499A8,
- FirstFrame = 0x0CD4,
- NextFrame = 0x0CCC,
- UnkDivWidth = 0x00AC0CB4,
- UnkDivHeight = 0x00AC0CB8,
- ScreenWidth = 0x00BD07F0,
- ScreenHeight = 0x00BD07F4,
- FrameLeft = 0x68,
- FrameRight = 0x70,
- FrameTop = 0x6C,
- FrameBottom = 0x64,
- ParentPtr = 0x94,
- EffectiveScale = 0x7C,
- Name = 0x1C,
- Visible = 0xDC,
- }
- public class Frame
- {
- public UInt32 baseAddress;
- public Frame(UInt32 baseAddress)
- {
- this.baseAddress = baseAddress;
- }
- public Boolean IsVisible
- {
- get
- {
- return (BM.ReadInt(baseAddress + (uint)UIFrame.Visible) == 1);
- }
- }
- public String Name
- {
- get
- {
- return BM.ReadASCIIString(BM.ReadUInt(baseAddress + (uint)UIFrame.Name), 255);
- }
- }
- public Single EffectiveScale
- {
- get
- {
- return BM.ReadFloat(baseAddress + (uint)UIFrame.EffectiveScale);
- }
- }
- public UInt32 ParentPtr
- {
- get
- {
- return BM.ReadUInt(baseAddress + (uint)UIFrame.ParentPtr);
- }
- }
- public Frame Parent
- {
- get
- {
- return new Frame(ParentPtr);
- }
- }
- public Single Left
- {
- get
- {
- Single a1 = BM.ReadFloat(baseAddress + (uint)UIFrame.FrameLeft);
- return (a1 * BM.ReadInt((uint)UIFrame.ScreenWidth) / BM.ReadFloat((uint)UIFrame.UnkDivWidth));
- }
- }
- public Single Right
- {
- get
- {
- Single a1 = BM.ReadFloat(baseAddress + (uint)UIFrame.FrameRight);
- return (a1 * BM.ReadInt((uint)UIFrame.ScreenWidth) / BM.ReadFloat((uint)UIFrame.UnkDivWidth));
- }
- }
- public Single Top
- {
- get
- {
- Single a1 = BM.ReadFloat(baseAddress + (uint)UIFrame.FrameTop);
- return (a1 * BM.ReadInt((uint)UIFrame.ScreenHeight) / BM.ReadFloat((uint)UIFrame.UnkDivHeight));
- }
- }
- public Single Bottom
- {
- get
- {
- Single a1 = BM.ReadFloat(baseAddress + (uint)UIFrame.FrameBottom);
- return (a1 * BM.ReadInt((uint)UIFrame.ScreenHeight) / BM.ReadFloat((uint)UIFrame.UnkDivHeight));
- }
- }
- public Single Witdh
- {
- get
- {
- return Right - Left;
- }
- }
- public Single Height
- {
- get
- {
- return Top - Bottom;
- }
- }
- public void MoveMouseOver()
- {
- POINT p = new POINT();
- ScreenToClient(BM.WindowHandle, ref p);
- SetCursorPos(Math.Abs(p.X) + (int)this.Left + (int)(this.Witdh / 2), Math.Abs(p.Y) + BM.ReadInt((uint)UIFrame.ScreenHeight) - (int)this.Top + (int)(this.Height / 2));
- }
- }
- public static Frame GetFrameByName(String frameName)
- {
- foreach (Frame f in GetFrames)
- if (f.Name == frameName)
- return f;
- return null;
- }
- public static List<Frame> GetFrames
- {
- get
- {
- List<Frame> result = new List<Frame>();
- UInt32 Base = BM.ReadUInt((uint)UIFrame.UIBase);
- UInt32 CurrentFrame = BM.ReadUInt(Base + (uint)UIFrame.FirstFrame);
- while (CurrentFrame != 0)
- {
- result.Add(new Frame(CurrentFrame));
- CurrentFrame = BM.ReadUInt(CurrentFrame + BM.ReadUInt(Base + (uint)UIFrame.NextFrame) + 4);
- }
- return result;
- }
- }
- static void Main(string[] args)
- {
- Int32 TotalFrames = 0;
- Int32 TotalVisibleFrames = 0;
- BM = new Magic.BlackMagic(Magic.SProcess.GetProcessFromProcessName("Wow"));
- foreach (Frame f in GetFrames)
- {
- if (f.IsVisible)
- TotalVisibleFrames++;
- if (f.Name.Length > 0)
- Console.WriteLine("Frame 0x" + f.baseAddress.ToString("X") + " Name : " + f.Name);
- TotalFrames++;
- }
- Console.WriteLine("Total frames : " + TotalFrames);
- Console.WriteLine("Total visible frames : " + TotalVisibleFrames);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement