[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Архив - только для чтения
C# Non-Hooked / External DirectX Overlay
nuzesvenДата: Пятница, 16.01.2015, 00:54 | Сообщение # 1
Генералиссимус
Группа: Администраторы
Сообщений: 6
Награды: 2
Репутация: 228
Статус: Offline
Please do not copy this thread onto other places, I've written this for UC-Forums only - However feel free to link back to it.

Summary:

About a month ago I started out in the game hacking world, and wrote a C# permant radar which only used RPM, thus wasn't detectable; Secondary Monitor Radar with Minimap / non hooked ESP

Over time I expanded my hack and detected I wanted ESP. However the only options where to hook DirectX (either directly or using the games rendering functions). These hooks may become detectable in the future, so I wanted an external solution.

I found one which was released a couple days after I starting looking into this issue written by KN4CK3R which used GDI to draw over the game's window. However this would flicker a lot as GDI is very slow, and the game's DirectX would render over the top of the ESP before the ESP program had finished drawing all the boxes. So I came up with a solution to both the flicker and the slow updating of GDI.

I said if it was undetected I would explain how I did it, it's been three weeks and no VAC ban, so I've sure it's not VAC detectable. I also think this is not PB screen shot detectable as it's a completely external DirectX application.

Requirements:
The game is running in Windowed Mode
You are running Vista or Windows 7 (sorry XP users)

The Tutorial:

This is written in C#, but if you understand programming, it's easily transferable to any other language. This only contains code to create the overlay, nothing on drawing the ESP it self, however there is plenty of tutorials and pieces of example code on this site on how to do that.

1 Create a new form.
2 Set this form's BackColor as Black (we are going to use black as a transparency key)
3 Set;
1 FormBorderStyle = None
2 ShowIcon = False
3 ShowInTaskbar = False
4 TopMost = True
5WindowState = Maximized
4 In the form's class add the following PInvokes and defintitions
Код
private Margins marg;

             //this is used to specify the boundaries of the transparent area
             internal struct Margins
             {
                 public int Left, Right, Top, Bottom;
             }

             [DllImport("user32.dll", SetLastError = true)]

             private static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex);

             [DllImport("user32.dll")]

             static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);

             [DllImport("user32.dll")]

             static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags);

             public const int GWL_EXSTYLE = -20;

             public const int WS_EX_LAYERED = 0x80000;

             public const int WS_EX_TRANSPARENT = 0x20;

             public const int LWA_ALPHA = 0x2;

             public const int LWA_COLORKEY = 0x1;

             [DllImport("dwmapi.dll")]
             static extern void DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMargins);

             private Device device = null;

In the form's constructor add;
Код
//Make the window's border completely transparant
                 SetWindowLong(this.Handle, GWL_EXSTYLE,
                         (IntPtr)(GetWindowLong(this.Handle, GWL_EXSTYLE) ^ WS_EX_LAYERED ^ WS_EX_TRANSPARENT));

                 //Set the Alpha on the Whole Window to 255 (solid)
                 SetLayeredWindowAttributes(this.Handle, 0, 255, LWA_ALPHA);

                 //Init DirectX
                         //This initializes the DirectX device. It needs to be done once.
                 //The alpha channel in the backbuffer is critical.
                 PresentParameters presentParameters = new  PresentParameters();
                 presentParameters.Windowed = true;
                 presentParameters.SwapEffect = SwapEffect.Discard;
                 presentParameters.BackBufferFormat = Format.A8R8G8B8;

                 this.device = new Device(0, DeviceType.Hardware,  this.Handle,
                 CreateFlags.HardwareVertexProcessing, presentParameters);

                      
                 Thread dx = new Thread(new ThreadStart(this.dxThread));
                 dx.IsBackground = true;
                 dx.Start();

Ok, now we create a basic DirectX thread (you'll need to insert your own logic and rendering code)
Код
private void dxThread()
{
         while (true)
         {
             //Place your update logic here
             device.Clear(ClearFlags.Target, Color.FromArgb(0, 0, 0, 0), 1.0f, 0);
             device.RenderState.ZBufferEnable = false;
             device.RenderState.Lighting = false;
             device.RenderState.CullMode = Cull.None;
             device.Transform.Projection = Matrix.OrthoOffCenterLH(0, this.Width, this.Height, 0, 0, 1);
             device.BeginScene();

             //Place your rendering logic here

             device.EndScene();
             device.Present();
         }

         this.device.Dispose();
         Application.Exit();
}

At this stage we have a maximised solid border less window with DirectX running in it (nothing special). This is where we change that window into an overlay - and the part which makes this Vista/7 only.

Add an On Paint method to the form and set put the following code in it;
Код
//Create a margin (the whole form)
                 marg.Left = 0;
                 marg.Top = 0;
                 marg.Right = this.Width;
                 marg.Bottom = this.Height;

                 //Expand the Aero Glass Effect Border to the WHOLE form.
                 // since we have already had the border invisible we now
                 // have a completely invisible window - apart from the DirectX
                 // renders NOT in black.
                 DwmExtendFrameIntoClientArea(this.Handle, ref marg);

Credits:Recruit

 
  • Страница 1 из 1
  • 1
Поиск: