elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 ... 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [20] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ... 72
191  Programación / .NET (C#, VB.NET, ASP) / [Tutorial] Como Superponer Form Sobre Juegos En "Pantalla Completa" en: 2 Octubre 2020, 00:44 am
Hola , A todos. Algunos ya sabran que es Imposible Superponer tu Aplicación sobre un Juego que trabaja con Direcx y que esta en Pantalla Completa.

Bien Empecemos !



Introduccion :

     Es un Problema muy Común que cuando algún Programador en .Net , (Que haga Cheats) para juegos.
     Cuando quiera superponer su Applicacion sobre el juego en pantalla completa no lo logre. ya que basicamente El Juego "Secuestra la pantalla".

     En este caso , hago este Post , para Compartir "Mi" solución a este Problema.


     Cabe Resaltar que :
 
     
  •      Los Juegos que Usan Como motor OPENGL, No tienen este Problema. Se puede superponer facilmente otra Applicacion sobre ellos.
  •      No todos Los juegos Direcx tienen este Problema, Por Ejemplo Operation7, WolfTeam, Swat4 ,Entre Otros...
  •      La mayoría de Juegos creados con Unity Tampoco tienen este Problema.

     Entonces Empecemos...



    Primero que todo Mi solución no fue Intentar Forzar de alguna manera la superposición. ya que no lo logre.

     Quiero resaltar que hay un método que funciona, pero No muy Practico a mi parecer. Basicamente tienes que Conectar con EndScene .

     Basicamente usando SlimDX y EasyHook, Aca un Breve tutorial : [Tutorial] How to become an EndScene() hooker

     Por que no es muy Practico? , No lo es ya que Este metodo es facilmente Detectado por los AC (Anti-Cheats).




Solución :

     Bien mi Método , Fue una Solucion facil , Si no puedo Superponer sobre un Juego en pantalla Completa. Entonces :

     - EMULARE EL MODO PANTALLA COMPLETA.

     Básicamente Hacemos esto :


     1) Corremos Nuestro Juego en modo ventana, Algunos traen la opción en el Apartado de Configuración - Video.

     En caso de que No traiga esta Opción , Tienes que Crear un Acceso Directo, Abrir las Propiedades del Acceso Directo y Colocar al final el Parámetro : "-window"
     De todos modos aquí dejo un Tutorial Sobre esto : Play a Computer Game in Windowed Mode

     2) Emulamos / Forzamos El modo FullScreen. Para Ello Hacemos :


      Paso 1 : Agregamos a Su Proyecto Las Clases SetWindowStyle.vb y SetWindowState.vb.


SetWindowStyle.vb
Código
  1. ' ***********************************************************************
  2. ' Author           : Destroyer
  3. ' Last Modified On : 29-09-2020
  4. ' ***********************************************************************
  5. ' <copyright file="SetWindowStyle.vb" company="Elektro Studios">
  6. '     Copyright (c) All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. 'Dim HWND As IntPtr = Process.GetProcessesByName("devenv").First.MainWindowHandle
  13. '
  14. 'SetWindowState.SetWindowStyle(HWND, SetWindowStyle.WindowStyles.WS_BORDER)
  15. 'SetWindowState.SetWindowStyle("devenv", SetWindowStyle.WindowStyles.WS_BORDER, Recursivity:=False)
  16.  
  17. #End Region
  18.  
  19. #Region " Imports "
  20.  
  21. Imports System.Runtime.InteropServices
  22.  
  23. #End Region
  24.  
  25. ''' <summary>
  26. ''' Sets the style of a window.
  27. ''' </summary>
  28. Public NotInheritable Class SetWindowStyle
  29.  
  30. #Region " P/Invoke "
  31.  
  32.    ''' <summary>
  33.    ''' Platform Invocation methods (P/Invoke), access unmanaged code.
  34.    ''' This class does not suppress stack walks for unmanaged code permission.
  35.    ''' <see cref="System.Security.SuppressUnmanagedCodeSecurityAttribute"/>  must not be applied to this class.
  36.    ''' This class is for methods that can be used anywhere because a stack walk will be performed.
  37.    ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/ms182161.aspx
  38.    ''' </summary>
  39.    Protected NotInheritable Class NativeMethods
  40.  
  41. #Region " Methods "
  42.  
  43.        ''' <summary>
  44.        ''' Retrieves a handle to the top-level window whose class name and window name match the specified strings.
  45.        ''' This function does not search child windows.
  46.        ''' This function does not perform a case-sensitive search.
  47.        ''' To search child windows, beginning with a specified child window, use the FindWindowEx function.
  48.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
  49.        ''' </summary>
  50.        ''' <param name="lpClassName">The class name.
  51.        ''' If this parameter is NULL, it finds any window whose title matches the lpWindowName parameter.</param>
  52.        ''' <param name="lpWindowName">The window name (the window's title).
  53.        ''' If this parameter is NULL, all window names match.</param>
  54.        ''' <returns>If the function succeeds, the return value is a handle to the window that has the specified class name and window name.
  55.        ''' If the function fails, the return value is NULL.</returns>
  56.        <DllImport("user32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  57.        Friend Shared Function FindWindow(
  58.           ByVal lpClassName As String,
  59.           ByVal lpWindowName As String
  60.        ) As IntPtr
  61.        End Function
  62.  
  63.        ''' <summary>
  64.        ''' Retrieves a handle to a window whose class name and window name match the specified strings.
  65.        ''' The function searches child windows, beginning with the one following the specified child window.
  66.        ''' This function does not perform a case-sensitive search.
  67.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500%28v=vs.85%29.aspx
  68.        ''' </summary>
  69.        ''' <param name="hwndParent">
  70.        ''' A handle to the parent window whose child windows are to be searched.
  71.        ''' If hwndParent is NULL, the function uses the desktop window as the parent window.
  72.        ''' The function searches among windows that are child windows of the desktop.
  73.        ''' </param>
  74.        ''' <param name="hwndChildAfter">
  75.        ''' A handle to a child window.
  76.        ''' The search begins with the next child window in the Z order.
  77.        ''' The child window must be a direct child window of hwndParent, not just a descendant window.
  78.        ''' If hwndChildAfter is NULL, the search begins with the first child window of hwndParent.
  79.        ''' </param>
  80.        ''' <param name="strClassName">
  81.        ''' The window class name.
  82.        ''' </param>
  83.        ''' <param name="strWindowName">
  84.        ''' The window name (the window's title).
  85.        ''' If this parameter is NULL, all window names match.
  86.        ''' </param>
  87.        ''' <returns>
  88.        ''' If the function succeeds, the return value is a handle to the window that has the specified class and window names.
  89.        ''' If the function fails, the return value is NULL.
  90.        ''' </returns>
  91.        <DllImport("User32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  92.        Friend Shared Function FindWindowEx(
  93.           ByVal hwndParent As IntPtr,
  94.           ByVal hwndChildAfter As IntPtr,
  95.           ByVal strClassName As String,
  96.           ByVal strWindowName As String
  97.        ) As IntPtr
  98.        End Function
  99.  
  100.        ''' <summary>
  101.        ''' Retrieves the identifier of the thread that created the specified window
  102.        ''' and, optionally, the identifier of the process that created the window.
  103.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633522%28v=vs.85%29.aspx
  104.        ''' </summary>
  105.        ''' <param name="hWnd">A handle to the window.</param>
  106.        ''' <param name="ProcessId">
  107.        ''' A pointer to a variable that receives the process identifier.
  108.        ''' If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable;
  109.        ''' otherwise, it does not.
  110.        ''' </param>
  111.        ''' <returns>The identifier of the thread that created the window.</returns>
  112.        <DllImport("user32.dll")>
  113.        Friend Shared Function GetWindowThreadProcessId(
  114.            ByVal hWnd As IntPtr,
  115.            ByRef ProcessId As Integer
  116.        ) As Integer
  117.        End Function
  118.  
  119.        <System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint:="SetWindowLong")> _
  120.        Friend Shared Function SetWindowLong32(ByVal hWnd As IntPtr, <MarshalAs(UnmanagedType.I4)> nIndex As WindowLongFlags, ByVal dwNewLong As Integer) As Integer
  121.        End Function
  122.  
  123.        <System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint:="SetWindowLongPtr")> _
  124.        Friend Shared Function SetWindowLongPtr64(ByVal hWnd As IntPtr, <MarshalAs(UnmanagedType.I4)> nIndex As WindowLongFlags, ByVal dwNewLong As IntPtr) As IntPtr
  125.        End Function
  126.  
  127.        Friend Shared Function SetWindowLongPtr(ByVal hWnd As IntPtr, nIndex As WindowLongFlags, ByVal dwNewLong As IntPtr) As IntPtr
  128.            If IntPtr.Size = 8 Then
  129.                Return SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
  130.            Else
  131.                Return New IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32))
  132.            End If
  133.        End Function
  134.  
  135. #End Region
  136.  
  137.    End Class
  138.  
  139. #End Region
  140.  
  141. #Region " Enumerations "
  142.  
  143.    Public Enum WindowLongFlags As Integer
  144.        GWL_EXSTYLE = -20
  145.        GWLP_HINSTANCE = -6
  146.        GWLP_HWNDPARENT = -8
  147.        GWL_ID = -12
  148.        GWL_STYLE = -16
  149.        GWL_USERDATA = -21
  150.        GWL_WNDPROC = -4
  151.        DWLP_USER = &H8
  152.        DWLP_MSGRESULT = &H0
  153.        DWLP_DLGPROC = &H4
  154.    End Enum
  155.  
  156.   <FlagsAttribute()> _
  157.  Public Enum WindowStyles As Long
  158.  
  159.        Todo1 = 2
  160.        Todo2 = 2048
  161.        Todo3 = 32768
  162.  
  163.        WS_OVERLAPPED = 0
  164.        WS_POPUP = 2147483648
  165.        WS_CHILD = 1073741824
  166.        WS_MINIMIZE = 536870912
  167.        WS_VISIBLE = 268435456
  168.        WS_DISABLED = 134217728
  169.        WS_CLIPSIBLINGS = 67108864
  170.        WS_CLIPCHILDREN = 33554432
  171.        WS_MAXIMIZE = 16777216
  172.        WS_BORDER = 8388608
  173.        WS_DLGFRAME = 4194304
  174.        WS_VSCROLL = 2097152
  175.        WS_HSCROLL = 1048576
  176.        WS_SYSMENU = 524288
  177.        WS_THICKFRAME = 262144
  178.        WS_GROUP = 131072
  179.        WS_TABSTOP = 65536
  180.  
  181.        WS_MINIMIZEBOX = 131072
  182.        WS_MAXIMIZEBOX = 65536
  183.  
  184.        WS_CAPTION = WS_BORDER Or WS_DLGFRAME
  185.        WS_TILED = WS_OVERLAPPED
  186.        WS_ICONIC = WS_MINIMIZE
  187.        WS_SIZEBOX = WS_THICKFRAME
  188.        WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
  189.  
  190.        WS_OVERLAPPEDWINDOW = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or _
  191.                  WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
  192.        WS_POPUPWINDOW = WS_POPUP Or WS_BORDER Or WS_SYSMENU
  193.        WS_CHILDWINDOW = WS_CHILD
  194.  
  195.        WS_EX_DLGMODALFRAME = 1
  196.        WS_EX_NOPARENTNOTIFY = 4
  197.        WS_EX_TOPMOST = 8
  198.        WS_EX_ACCEPTFILES = 16
  199.        WS_EX_TRANSPARENT = 32
  200.  
  201.        '#If (WINVER >= 400) Then
  202.        WS_EX_MDICHILD = 64
  203.        WS_EX_TOOLWINDOW = 128
  204.        WS_EX_WINDOWEDGE = 256
  205.        WS_EX_CLIENTEDGE = 512
  206.        WS_EX_CONTEXTHELP = 1024
  207.  
  208.        WS_EX_RIGHT = 4096
  209.        WS_EX_LEFT = 0
  210.        WS_EX_RTLREADING = 8192
  211.        WS_EX_LTRREADING = 0
  212.        WS_EX_LEFTSCROLLBAR = 16384
  213.        WS_EX_RIGHTSCROLLBAR = 0
  214.  
  215.        WS_EX_CONTROLPARENT = 65536
  216.        WS_EX_STATICEDGE = 131072
  217.        WS_EX_APPWINDOW = 262144
  218.  
  219.        WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE Or WS_EX_CLIENTEDGE
  220.        WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE Or WS_EX_TOOLWINDOW Or WS_EX_TOPMOST
  221.        '#End If
  222.  
  223.        '#If (WIN32WINNT >= 500) Then
  224.        WS_EX_LAYERED = 524288
  225.        '#End If
  226.  
  227.        '#If (WINVER >= 500) Then
  228.        WS_EX_NOINHERITLAYOUT = 1048576 ' Disable inheritence of mirroring by children
  229.        WS_EX_LAYOUTRTL = 4194304 ' Right to left mirroring
  230.        '#End If
  231.  
  232.        '#If (WIN32WINNT >= 500) Then
  233.        WS_EX_COMPOSITED = 33554432
  234.        WS_EX_NOACTIVATE = 67108864
  235.        '#End If
  236.  
  237.    End Enum
  238.  
  239. #End Region
  240.  
  241. #Region " Public Methods "
  242.  
  243.    ''' <summary>
  244.    ''' Set the state of a window by an HWND.
  245.    ''' </summary>
  246.    ''' <param name="WindowHandle">A handle to the window.</param>
  247.    ''' <param name="WindowStyle">The Style of the window.</param>
  248.    ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  249.    Friend Shared Function SetWindowStyle(ByVal WindowHandle As IntPtr,
  250.                                          ByVal WindowStyle As WindowStyles) As Boolean
  251.  
  252.        Return NativeMethods.SetWindowLongPtr(WindowHandle, WindowLongFlags.GWL_STYLE, WindowStyle)
  253.  
  254.    End Function
  255.  
  256.    ''' <summary>
  257.    ''' Set the state of a window by a process name.
  258.    ''' </summary>
  259.    ''' <param name="ProcessName">The name of the process.</param>
  260.    ''' <param name="WindowStyle">The Style of the window.</param>
  261.    ''' <param name="Recursivity">If set to <c>false</c>, only the first process instance will be processed.</param>
  262.    Friend Shared Sub SetWindowStyle(ByVal ProcessName As String,
  263.                                     ByVal WindowStyle As WindowStyles,
  264.                                     Optional ByVal Recursivity As Boolean = False)
  265.  
  266.        If ProcessName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) Then
  267.            ProcessName = ProcessName.Remove(ProcessName.Length - ".exe".Length)
  268.        End If
  269.  
  270.        Dim pHandle As IntPtr = IntPtr.Zero
  271.        Dim pID As Integer = 0I
  272.  
  273.        Dim Processes As Process() = Process.GetProcessesByName(ProcessName)
  274.  
  275.        ' If any process matching the name is found then...
  276.        If Processes.Count = 0 Then
  277.            Exit Sub
  278.        End If
  279.  
  280.        For Each p As Process In Processes
  281.  
  282.            ' If Window is visible then...
  283.            If p.MainWindowHandle <> IntPtr.Zero Then
  284.                SetWindowStyle(p.MainWindowHandle, WindowStyle)
  285.  
  286.            Else ' Window is hidden
  287.  
  288.                ' Check all open windows (not only the process we are looking),
  289.                ' begining from the child of the desktop, phandle = IntPtr.Zero initialy.
  290.                While pID <> p.Id ' Check all windows.
  291.  
  292.                    ' Get child handle of window who's handle is "pHandle".
  293.                    pHandle = NativeMethods.FindWindowEx(IntPtr.Zero, pHandle, Nothing, Nothing)
  294.  
  295.                    ' Get ProcessId from "pHandle".
  296.                    NativeMethods.GetWindowThreadProcessId(pHandle, pID)
  297.  
  298.                    ' If the ProcessId matches the "pID" then...
  299.                    If pID = p.Id Then
  300.  
  301.                        NativeMethods.SetWindowLongPtr(pHandle, WindowLongFlags.GWL_STYLE, WindowStyle)
  302.  
  303.                        If Not Recursivity Then
  304.                            Exit For
  305.                        End If
  306.  
  307.                    End If
  308.  
  309.                End While
  310.  
  311.            End If
  312.  
  313.        Next p
  314.  
  315.    End Sub
  316.  
  317. #End Region
  318.  
  319. End Class
  320.  


SetWindowState.vb
Código
  1. ' ***********************************************************************
  2. ' Author           : Elektro
  3. ' Last Modified On : 10-02-2014
  4. ' ***********************************************************************
  5. ' <copyright file="SetWindowState.vb" company="Elektro Studios">
  6. '     Copyright (c) Elektro Studios. All rights reserved.
  7. ' </copyright>
  8. ' ***********************************************************************
  9.  
  10. #Region " Usage Examples "
  11.  
  12. 'Dim HWND As IntPtr = Process.GetProcessesByName("devenv").First.MainWindowHandle
  13. '
  14. 'SetWindowState.SetWindowState(HWND, SetWindowState.WindowState.Hide)
  15. 'SetWindowState.SetWindowState("devenv", SetWindowState.WindowState.Restore, Recursivity:=False)
  16.  
  17. #End Region
  18.  
  19. #Region " Imports "
  20.  
  21. Imports System.Runtime.InteropServices
  22.  
  23. #End Region
  24.  
  25. ''' <summary>
  26. ''' Sets the state of a window.
  27. ''' </summary>
  28. Public NotInheritable Class SetWindowState
  29.  
  30. #Region " P/Invoke "
  31.  
  32.    ''' <summary>
  33.    ''' Platform Invocation methods (P/Invoke), access unmanaged code.
  34.    ''' This class does not suppress stack walks for unmanaged code permission.
  35.    ''' <see cref="System.Security.SuppressUnmanagedCodeSecurityAttribute"/>  must not be applied to this class.
  36.    ''' This class is for methods that can be used anywhere because a stack walk will be performed.
  37.    ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/ms182161.aspx
  38.    ''' </summary>
  39.    Protected NotInheritable Class NativeMethods
  40.  
  41. #Region " Methods "
  42.  
  43.        ''' <summary>
  44.        ''' Retrieves a handle to the top-level window whose class name and window name match the specified strings.
  45.        ''' This function does not search child windows.
  46.        ''' This function does not perform a case-sensitive search.
  47.        ''' To search child windows, beginning with a specified child window, use the FindWindowEx function.
  48.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
  49.        ''' </summary>
  50.        ''' <param name="lpClassName">The class name.
  51.        ''' If this parameter is NULL, it finds any window whose title matches the lpWindowName parameter.</param>
  52.        ''' <param name="lpWindowName">The window name (the window's title).
  53.        ''' If this parameter is NULL, all window names match.</param>
  54.        ''' <returns>If the function succeeds, the return value is a handle to the window that has the specified class name and window name.
  55.        ''' If the function fails, the return value is NULL.</returns>
  56.        <DllImport("user32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  57.        Friend Shared Function FindWindow(
  58.           ByVal lpClassName As String,
  59.           ByVal lpWindowName As String
  60.        ) As IntPtr
  61.        End Function
  62.  
  63.        ''' <summary>
  64.        ''' Retrieves a handle to a window whose class name and window name match the specified strings.
  65.        ''' The function searches child windows, beginning with the one following the specified child window.
  66.        ''' This function does not perform a case-sensitive search.
  67.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500%28v=vs.85%29.aspx
  68.        ''' </summary>
  69.        ''' <param name="hwndParent">
  70.        ''' A handle to the parent window whose child windows are to be searched.
  71.        ''' If hwndParent is NULL, the function uses the desktop window as the parent window.
  72.        ''' The function searches among windows that are child windows of the desktop.
  73.        ''' </param>
  74.        ''' <param name="hwndChildAfter">
  75.        ''' A handle to a child window.
  76.        ''' The search begins with the next child window in the Z order.
  77.        ''' The child window must be a direct child window of hwndParent, not just a descendant window.
  78.        ''' If hwndChildAfter is NULL, the search begins with the first child window of hwndParent.
  79.        ''' </param>
  80.        ''' <param name="strClassName">
  81.        ''' The window class name.
  82.        ''' </param>
  83.        ''' <param name="strWindowName">
  84.        ''' The window name (the window's title).
  85.        ''' If this parameter is NULL, all window names match.
  86.        ''' </param>
  87.        ''' <returns>
  88.        ''' If the function succeeds, the return value is a handle to the window that has the specified class and window names.
  89.        ''' If the function fails, the return value is NULL.
  90.        ''' </returns>
  91.        <DllImport("User32.dll", SetLastError:=False, CharSet:=CharSet.Auto, BestFitMapping:=False)>
  92.        Friend Shared Function FindWindowEx(
  93.           ByVal hwndParent As IntPtr,
  94.           ByVal hwndChildAfter As IntPtr,
  95.           ByVal strClassName As String,
  96.           ByVal strWindowName As String
  97.        ) As IntPtr
  98.        End Function
  99.  
  100.        ''' <summary>
  101.        ''' Retrieves the identifier of the thread that created the specified window
  102.        ''' and, optionally, the identifier of the process that created the window.
  103.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633522%28v=vs.85%29.aspx
  104.        ''' </summary>
  105.        ''' <param name="hWnd">A handle to the window.</param>
  106.        ''' <param name="ProcessId">
  107.        ''' A pointer to a variable that receives the process identifier.
  108.        ''' If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable;
  109.        ''' otherwise, it does not.
  110.        ''' </param>
  111.        ''' <returns>The identifier of the thread that created the window.</returns>
  112.        <DllImport("user32.dll")>
  113.        Friend Shared Function GetWindowThreadProcessId(
  114.            ByVal hWnd As IntPtr,
  115.            ByRef ProcessId As Integer
  116.        ) As Integer
  117.        End Function
  118.  
  119.        ''' <summary>
  120.        ''' Sets the specified window's show state.
  121.        ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
  122.        ''' </summary>
  123.        ''' <param name="hwnd">A handle to the window.</param>
  124.        ''' <param name="nCmdShow">Controls how the window is to be shown.</param>
  125.        ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  126.        <DllImport("User32", SetLastError:=False)>
  127.        Friend Shared Function ShowWindow(
  128.           ByVal hwnd As IntPtr,
  129.           ByVal nCmdShow As WindowState
  130.        ) As Boolean
  131.        End Function
  132.  
  133. #End Region
  134.  
  135.    End Class
  136.  
  137. #End Region
  138.  
  139. #Region " Enumerations "
  140.  
  141.    ''' <summary>
  142.    ''' Controls how the window is to be shown.
  143.    ''' MSDN Documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx
  144.    ''' </summary>
  145.    Friend Enum WindowState As Integer
  146.  
  147.        ''' <summary>
  148.        ''' Hides the window and activates another window.
  149.        ''' </summary>
  150.        Hide = 0I
  151.  
  152.        ''' <summary>
  153.        ''' Activates and displays a window.
  154.        ''' If the window is minimized or maximized, the system restores it to its original size and position.
  155.        ''' An application should specify this flag when displaying the window for the first time.
  156.        ''' </summary>
  157.        Normal = 1I
  158.  
  159.        ''' <summary>
  160.        ''' Activates the window and displays it as a minimized window.
  161.        ''' </summary>
  162.        ShowMinimized = 2I
  163.  
  164.        ''' <summary>
  165.        ''' Maximizes the specified window.
  166.        ''' </summary>
  167.        Maximize = 3I
  168.  
  169.        ''' <summary>
  170.        ''' Activates the window and displays it as a maximized window.
  171.        ''' </summary>      
  172.        ShowMaximized = Maximize
  173.  
  174.        ''' <summary>
  175.        ''' Displays a window in its most recent size and position.
  176.        ''' This value is similar to <see cref="WindowState.Normal"/>, except the window is not actived.
  177.        ''' </summary>
  178.        ShowNoActivate = 4I
  179.  
  180.        ''' <summary>
  181.        ''' Activates the window and displays it in its current size and position.
  182.        ''' </summary>
  183.        Show = 5I
  184.  
  185.        ''' <summary>
  186.        ''' Minimizes the specified window and activates the next top-level window in the Z order.
  187.        ''' </summary>
  188.        Minimize = 6I
  189.  
  190.        ''' <summary>
  191.        ''' Displays the window as a minimized window.
  192.        ''' This value is similar to <see cref="WindowState.ShowMinimized"/>, except the window is not activated.
  193.        ''' </summary>
  194.        ShowMinNoActive = 7I
  195.  
  196.        ''' <summary>
  197.        ''' Displays the window in its current size and position.
  198.        ''' This value is similar to <see cref="WindowState.Show"/>, except the window is not activated.
  199.        ''' </summary>
  200.        ShowNA = 8I
  201.  
  202.        ''' <summary>
  203.        ''' Activates and displays the window.
  204.        ''' If the window is minimized or maximized, the system restores it to its original size and position.
  205.        ''' An application should specify this flag when restoring a minimized window.
  206.        ''' </summary>
  207.        Restore = 9I
  208.  
  209.        ''' <summary>
  210.        ''' Sets the show state based on the SW_* value specified in the STARTUPINFO structure
  211.        ''' passed to the CreateProcess function by the program that started the application.
  212.        ''' </summary>
  213.        ShowDefault = 10I
  214.  
  215.        ''' <summary>
  216.        ''' <b>Windows 2000/XP:</b>
  217.        ''' Minimizes a window, even if the thread that owns the window is not responding.
  218.        ''' This flag should only be used when minimizing windows from a different thread.
  219.        ''' </summary>
  220.        ForceMinimize = 11I
  221.  
  222.    End Enum
  223.  
  224. #End Region
  225.  
  226. #Region " Public Methods "
  227.  
  228.    ''' <summary>
  229.    ''' Set the state of a window by an HWND.
  230.    ''' </summary>
  231.    ''' <param name="WindowHandle">A handle to the window.</param>
  232.    ''' <param name="WindowState">The state of the window.</param>
  233.    ''' <returns><c>true</c> if the function succeeds, <c>false</c> otherwise.</returns>
  234.    Friend Shared Function SetWindowState(ByVal WindowHandle As IntPtr,
  235.                                          ByVal WindowState As WindowState) As Boolean
  236.  
  237.        Return NativeMethods.ShowWindow(WindowHandle, WindowState)
  238.  
  239.    End Function
  240.  
  241.    ''' <summary>
  242.    ''' Set the state of a window by a process name.
  243.    ''' </summary>
  244.    ''' <param name="ProcessName">The name of the process.</param>
  245.    ''' <param name="WindowState">The state of the window.</param>
  246.    ''' <param name="Recursivity">If set to <c>false</c>, only the first process instance will be processed.</param>
  247.    Friend Shared Sub SetWindowState(ByVal ProcessName As String,
  248.                                     ByVal WindowState As WindowState,
  249.                                     Optional ByVal Recursivity As Boolean = False)
  250.  
  251.        If ProcessName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) Then
  252.            ProcessName = ProcessName.Remove(ProcessName.Length - ".exe".Length)
  253.        End If
  254.  
  255.        Dim pHandle As IntPtr = IntPtr.Zero
  256.        Dim pID As Integer = 0I
  257.  
  258.        Dim Processes As Process() = Process.GetProcessesByName(ProcessName)
  259.  
  260.        ' If any process matching the name is found then...
  261.        If Processes.Count = 0 Then
  262.            Exit Sub
  263.        End If
  264.  
  265.        For Each p As Process In Processes
  266.  
  267.            ' If Window is visible then...
  268.            If p.MainWindowHandle <> IntPtr.Zero Then
  269.                SetWindowState(p.MainWindowHandle, WindowState)
  270.  
  271.            Else ' Window is hidden
  272.  
  273.                ' Check all open windows (not only the process we are looking),
  274.                ' begining from the child of the desktop, phandle = IntPtr.Zero initialy.
  275.                While pID <> p.Id ' Check all windows.
  276.  
  277.                    ' Get child handle of window who's handle is "pHandle".
  278.                    pHandle = NativeMethods.FindWindowEx(IntPtr.Zero, pHandle, Nothing, Nothing)
  279.  
  280.                    ' Get ProcessId from "pHandle".
  281.                    NativeMethods.GetWindowThreadProcessId(pHandle, pID)
  282.  
  283.                    ' If the ProcessId matches the "pID" then...
  284.                    If pID = p.Id Then
  285.  
  286.                        NativeMethods.ShowWindow(pHandle, WindowState)
  287.  
  288.                        If Not Recursivity Then
  289.                            Exit For
  290.                        End If
  291.  
  292.                    End If
  293.  
  294.                End While
  295.  
  296.            End If
  297.  
  298.        Next p
  299.  
  300.    End Sub
  301.  
  302. #End Region
  303.  
  304. End Class
  305.  


   Paso 2 : Agregamos el Siguiente Código  su Proyecto. (En el Evento Load Si es Posible)

Código
  1. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  2.        FullScreenEmulation("ProcessName")
  3.    End Sub
  4.  
  5.    Private Sub FullScreenEmulation(ByVal ProcessName As String)
  6.        If ProcessName.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) Then ProcessName = ProcessName.Remove(ProcessName.Length - ".exe".Length)
  7.        Dim HWND As IntPtr = Process.GetProcessesByName(ProcessName).First.MainWindowHandle
  8.        SetWindowStyle.SetWindowStyle(HWND, SetWindowStyle.WindowStyles.WS_BORDER)
  9.        SetWindowState.SetWindowState(HWND, SetWindowState.WindowState.Maximize)
  10.    End Sub

Con esto ya tendríamos a nuestro Juego que estaba en modo ventana, Ahora en Pantalla Completa. (Falsa) , y Podemos Superponer Nuestra Aplicación encima del Juego Deseado.

Gracias A @Elektro por su clase SetWindowState.vb.

 

Imagen de Final De un Juego en modo Ventana, Forzado a Pantalla Completa (En este caso es Halo CE [Direcx9]):




PD: Se puede Superponer Perfectamente! Con el Juego en modo "FullScreen" !

Comenten xD.


192  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Mi Class Overlay para Cheats genera un Alto Consumo de Ram. en: 16 Septiembre 2020, 21:54 pm
Perfecto. reduje en mas del 50% de lo que consumía.  gracias de nuevo bro.
También actualice los Pinvokes.

 ;-)
193  Programación / .NET (C#, VB.NET, ASP) / [Ayuda] Mi Class Overlay para Cheats genera un Alto Consumo de Ram. en: 16 Septiembre 2020, 16:20 pm
Hola, soy yo de nuevo pidiendo una ayudita....

Mi clase que hice ya hace un tiempo me esta dando problema al laggear la PC , en proyectos medianamente grandes.

Por ende necesito algunos consejos. para restructurar el codigo y que consuma poca ram.

La clase Overlay es la que uso para que el cheat se mantenga Junto a la ventana del juego .
y tambien monitoriza cuando el juego se cierra. todo Asincronico.

Pero consume mucha ram , haber si alguien con mas conocimientos sobre optimizar codigo me podria ayudar :

Elektro otra ayudita porfa..

Uso:
'ProcessGame Nombre del proceso del juego
'Me El form el cual se va a superponer encima del juego.
Código
  1. Private AttachClienGame As New Overlay(ProcessGame, Me)

Overlay.vb

Código
  1. Imports System.Runtime.InteropServices
  2. Imports System.Net.Mail
  3. Imports System.Text
  4.  
  5.  
  6. Public Class Overlay
  7.  
  8. #Region " P/Invokes "
  9.  
  10.    <DllImport("user32.dll")> _
  11.    Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef lpRect As RECT) As Boolean
  12.    End Function
  13.  
  14.    <DllImport("user32.dll", SetLastError:=True)> _
  15.    Private Shared Function GetForegroundWindow() As IntPtr
  16.    End Function
  17.  
  18.    <DllImport("user32.dll", SetLastError:=True)> _
  19.    Private Shared Function GetWindowThreadProcessId(ByVal hWnd As IntPtr, ByRef lpdwProcessId As UInteger) As Integer
  20.    End Function
  21.  
  22.    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As IntPtr
  23.    Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer
  24.    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As IntPtr
  25.    Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As IntPtr) As Integer
  26.  
  27. #End Region
  28.  
  29. #Region " Properties "
  30.  
  31.    Private Shared Monitor As Boolean = True
  32.    Public Property ActivateMonitoring As Boolean
  33.        Get
  34.            Return Monitor
  35.        End Get
  36.        Set(value As Boolean)
  37.            Monitor = value
  38.        End Set
  39.    End Property
  40.  
  41.    Private Shared GameWindowsTitle As String = String.Empty
  42.    Public ReadOnly Property GetWindowsTitle As String
  43.        Get
  44.            Return GameWindowsTitle
  45.        End Get
  46.    End Property
  47.  
  48.    Private Shared GameHandle As IntPtr = Nothing
  49.    Public ReadOnly Property GetGameHandle As IntPtr
  50.        Get
  51.            Return GameHandle
  52.        End Get
  53.    End Property
  54.  
  55.    Private Shared GameLocation As Point = Nothing
  56.    Public ReadOnly Property GetGameLocation As Point
  57.        Get
  58.            Return GameLocation
  59.        End Get
  60.    End Property
  61.  
  62.    Private Shared GameSize As Size = Nothing
  63.    Public ReadOnly Property GetGameSize As Size
  64.        Get
  65.            Return GameSize
  66.        End Get
  67.    End Property
  68.  
  69. #End Region
  70.  
  71. #Region " Structures "
  72.  
  73.    Public Structure RECT
  74.        Public Left As Integer
  75.        Public Top As Integer
  76.        Public Right As Integer
  77.        Public Bottom As Integer
  78.    End Structure
  79.  
  80. #End Region
  81.  
  82. #Region " Declare's "
  83.  
  84.    Public window_loc As RECT
  85.    Public screencenter(1) As Integer
  86.    Public hWnd As IntPtr = Nothing
  87.    Public pHandle As IntPtr = Nothing
  88.    Public processID As Integer = Nothing
  89.    Private ProcessName As String = String.Empty
  90.    Public Const PROCESS_VM_ALL As Integer = &H1F0FFF
  91.    Private MyAppProcess As String = Process.GetCurrentProcess().ProcessName
  92.    Private FormManagement As Form = Nothing
  93.  
  94. #End Region
  95.  
  96. #Region " Public Methods "
  97.  
  98.    Public Sub New(ByVal ProcName As String, Optional ByVal FormC As Form = Nothing)
  99.        ProcessName = ProcName
  100.        If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  101.        FormManagement = FormC
  102.        Dim tsk As New Task(AddressOf AttachtClient, TaskCreationOptions.LongRunning)
  103.        tsk.Start()
  104.    End Sub
  105.  
  106. #End Region
  107.  
  108. #Region " Private Methods "
  109.  
  110.    Private Sub AttachtClient()
  111.        'On Error Resume Next
  112.        Do While True
  113.            If Monitor = True Then
  114.                If Not ProcessName = String.Empty Then
  115.  
  116.                    Dim proc() As Process = Process.GetProcessesByName(ProcessName)
  117.  
  118.                    If Not proc.Length = 0 Then
  119.  
  120.                        If IsGameAppFocus() = True Then
  121.  
  122.                            Dim windowname As String = proc(0).MainWindowTitle
  123.                            GameWindowsTitle = windowname
  124.  
  125.                            hWnd = FindWindow(vbNullString, windowname)
  126.  
  127.                            GetWindowThreadProcessId(hWnd, processID)
  128.  
  129.                            pHandle = OpenProcess(PROCESS_VM_ALL, 0, processID)
  130.                            GameHandle = pHandle
  131.  
  132.                            If hWnd = 0 Then Exit Do
  133.  
  134.                            GetWindowRect(hWnd, window_loc)
  135.  
  136.                            GameLocation = New Point((window_loc.Left + 10), (window_loc.Top + 35))
  137.  
  138.                            GameSize = New Point(((window_loc.Right - window_loc.Left) - 25), ((window_loc.Bottom - window_loc.Top) - 45))
  139.  
  140.                            If Not (FormManagement Is Nothing) Then
  141.  
  142.                                If FormManagement.Visible = True Then
  143.  
  144.                                    FormManagement.BeginInvoke(Sub()
  145.                                                                   FormManagement.Location = GameLocation
  146.                                                                   FormManagement.Size = GameSize
  147.                                                               End Sub)
  148.  
  149.                                End If
  150.  
  151.                            End If
  152.  
  153.                        Else
  154.  
  155.                            If FormManagement.Visible = True Then
  156.  
  157.                                FormManagement.BeginInvoke(Sub()
  158.                                                               FormManagement.Hide()
  159.                                                           End Sub)
  160.  
  161.                            End If
  162.  
  163.                        End If
  164.  
  165.                    Else
  166.  
  167.                        is_active(True)
  168.  
  169.                    End If
  170.                End If
  171.            End If
  172.        Loop
  173.    End Sub
  174.  
  175.    Private Function IsGameAppFocus() As Boolean
  176.        Dim ActiveProcess As Process = GetActiveProcess()
  177.        Dim IsFocusGame As Boolean = False
  178.        If ActiveProcess IsNot Nothing Then
  179.            Dim CurrentProcName As String = ActiveProcess.ProcessName
  180.  
  181.            If LCase(CurrentProcName) = LCase(MyAppProcess) Then
  182.                IsFocusGame = True
  183.            End If
  184.  
  185.            If LCase(CurrentProcName) = LCase(ProcessName) Then
  186.                IsFocusGame = True
  187.            End If
  188.  
  189.  
  190.            Return IsFocusGame
  191.  
  192.        End If
  193.  
  194.        Return IsFocusGame
  195.    End Function
  196.  
  197.    Private Function GetActiveProcess() As Process
  198.        Dim FocusedWindow As IntPtr = GetForegroundWindow()
  199.        If FocusedWindow = IntPtr.Zero Then Return Nothing
  200.  
  201.        Dim FocusedWindowProcessId As UInteger = 0
  202.        GetWindowThreadProcessId(FocusedWindow, FocusedWindowProcessId)
  203.  
  204.        If FocusedWindowProcessId = 0 Then Return Nothing
  205.        Return Process.GetProcessById(CType(FocusedWindowProcessId, Integer))
  206.    End Function
  207.  
  208.    Private Sub is_active(Optional ByVal exit_ As Boolean = True)
  209.        Dim p As Process() = Process.GetProcessesByName(ProcessName)
  210.        If p.Length = 0 And exit_ Then
  211.            Environment.Exit(0)
  212.        End If
  213.    End Sub
  214.  
  215. #End Region
  216.  
  217. End Class
  218.  
194  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Prevenir que un Programa se Minimize o se cambie el foco de Windows. en: 15 Septiembre 2020, 18:19 pm
Coño, lo mio también es trabajo honesto, literalmente todo el código que te he mostrado lo hice hoy para ayudarte xD (vale que aparte intento comercializar la libreria, pero eso es otro tema)

Siempre ayudas de verdad. y aquellos testamentos que me ponías me ayudaron bastante.  deberían regresarte el Moderador.... como mínimo.



Citar
Leyendo el Readme.md del repositorio se nota que es un trabajo bastante amplio, lleno de características. Me ha parecido curiosa la detección de DnSpy

La deteccion es realmente sencilla. el Dnspy y el D4dot crean carpetas en Appdata-local. para guardar su configuracion , solo reviso si la carpeta existe. y listo. sin contar la deteccion de los procesos que hago ...



Citar
pero te olvidas de un par más de decompiladores bastante populares que quizás quieras añadirlos a las detecciones: ILSpy, SAE (Simple Assembly Explorer) y .NET Reflector.
¿Y que hay de otras máquinas virtuales diferentes a VMWare y VirtualPC?, QEMU se utiliza mucho también. Adicionálmente a esto veo que faltaría protección anti-debug remota para bloquear el acceso de paquetes de red a programas como Fiddler, Wireshark o WPE Pro.


Intentare agregarlos, aunque siempre la mejor protección para .Net, en mi experiencia es Obfuzcar bien el código . de manera de dejarlo completamente Irreconocible.

Ya lo otro seria pasarle un buen Packer. como por ejemplo Enigma o VMProtect.

básicamente la mayor parte del proyecto es gracias a esta guia :

An Anti-Reverse Engineering Guide

195  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Prevenir que un Programa se Minimize o se cambie el foco de Windows. en: 15 Septiembre 2020, 16:33 pm
¿Pero lo estás jugando a pantalla completa dedicada, o ventana sin bordes?...

De todas formas si ese problema es tal y como dices, entonces lo más simple para prevenirlo sería desarrollar un cheat sin interfaz gráfica y así evitar el problema. Si no puedes vencer a tu enemigo, acomódate a él. xD

También puedes probar a utilizar la función de Windows 'SetWindowLongPtr' sobre la ventana de tu aplicación:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra

con la combinación de estilos extendidos de ventana: WS_EX_TOPMOST + WS_EX_NOACTIVATE:
https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles

Teoricamente con esa combinación de estilos puedes superponer una ventana sobre las demás (top most) sin activar el foco de entrada de dicha ventana.


Gracias bro, como siempre este es el único lugar donde siempre logro resolver completamente mis dudas gracias ti.

Como siempre tu conocimiento en .Net me dejaron boca abierta.... he quedado como que wtf.

Has dado justo en el clavo. justo lo que necesitaba.  Así lo resolví :

Funciona Perfectamente. Se puede interactuar con el cheat encima del juego y no perder el foco de la ventana del juego.

Código
  1. #Region " No Windows Focus "
  2.  
  3.    Protected Overrides ReadOnly Property ShowWithoutActivation As Boolean
  4.        Get
  5.            Return True
  6.        End Get
  7.    End Property
  8.  
  9.    Private Const WS_EX_TOPMOST As Integer = &H8
  10.  
  11.    Private Const WS_THICKFRAME As Integer = &H40000
  12.    Private Const WS_CHILD As Integer = &H40000000
  13.    Private Const WS_EX_NOACTIVATE As Integer = &H8000000
  14.    Private Const WS_EX_TOOLWINDOW As Integer = &H80
  15.  
  16.    Protected Overrides ReadOnly Property CreateParams As CreateParams
  17.        Get
  18.            Dim createParamsA As CreateParams = MyBase.CreateParams
  19.            createParamsA.ExStyle = createParamsA.ExStyle Or WS_EX_TOPMOST Or WS_EX_NOACTIVATE Or WS_EX_TOOLWINDOW
  20.            Return createParamsA
  21.        End Get
  22.    End Property
  23.  
  24. #End Region



Citar
No se a que clase te refieres, pero esto te debería servir para suspender y reanudar el proceso:

https://foro.elhacker.net/net_c_vbnet_asp/libreria_de_snippets_para_vbnet_compartan_aqui_sus_snippets-t378770.0.html;msg1859297#msg1859297

Aquí te dejo una actualización del código:


Por alguna razon tu clase no me funcionaba, pero esta actualizacion de codigo fuciona perfectamente. lo malo es q el juego se desconecta del servidor. y pos pausar el proceso tampoco funciona.

Este era mi actual codigo para pausar y reanudar procesos :

ProcessPausator.vb

Código
  1. Public Class ProcessPausator
  2.  
  3. #Region " Pinvoke "
  4.  
  5.    Public Declare Function OpenThread Lib "kernel32.dll" (ByVal dwDesiredAccess As ThreadAccess, ByVal bInheritHandle As Boolean, ByVal dwThreadId As UInteger) As IntPtr
  6.    Public Declare Function SuspendThread Lib "kernel32.dll" (ByVal hThread As IntPtr) As UInteger
  7.    Public Declare Function ResumeThread Lib "kernel32.dll" (ByVal hThread As IntPtr) As UInteger
  8.    Public Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As IntPtr) As Boolean
  9.  
  10. #End Region
  11.  
  12. #Region " Enum "
  13.  
  14.    Public Enum ThreadAccess As Integer
  15.        TERMINATE = (&H1)
  16.        SUSPEND_RESUME = (&H2)
  17.        GET_CONTEXT = (&H8)
  18.        SET_CONTEXT = (&H10)
  19.        SET_INFORMATION = (&H20)
  20.        QUERY_INFORMATION = (&H40)
  21.        SET_THREAD_TOKEN = (&H80)
  22.        IMPERSONATE = (&H100)
  23.        DIRECT_IMPERSONATION = (&H200)
  24.    End Enum
  25.  
  26. #End Region
  27.  
  28.    Public Shared Function PauseThread(ByRef Process_Name As String) As Boolean
  29.  
  30.        If Process_Name.ToLower.EndsWith(".exe") Then Process_Name = Process_Name.Substring(0, Process_Name.Length - 4)
  31.  
  32.        Dim proc() As Process = Process.GetProcessesByName(Process_Name)
  33.  
  34.        If Not proc.Length = 0 Then
  35.            SuspendProcess(proc(0))
  36.            Return True
  37.        End If
  38.        Return False
  39.    End Function
  40.  
  41.    Public Shared Function ResumeThread(ByRef Process_Name As String) As Boolean
  42.  
  43.        If Process_Name.ToLower.EndsWith(".exe") Then Process_Name = Process_Name.Substring(0, Process_Name.Length - 4)
  44.  
  45.        Dim proc() As Process = Process.GetProcessesByName(Process_Name)
  46.  
  47.        If Not proc.Length = 0 Then
  48.            ResumeProcess(proc(0))
  49.            Return True
  50.        End If
  51.        Return False
  52.    End Function
  53.  
  54.    Private Shared Sub SuspendProcess(ByVal process As System.Diagnostics.Process)
  55.        For Each t As ProcessThread In process.Threads
  56.            Dim th As IntPtr = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
  57.            If Not th = IntPtr.Zero Then
  58.                SuspendThread(th)
  59.                CloseHandle(th)
  60.            End If
  61.        Next
  62.    End Sub
  63.  
  64.    Private Shared Sub ResumeProcess(ByVal process As System.Diagnostics.Process)
  65.        For Each t As ProcessThread In process.Threads
  66.            Dim th As IntPtr = OpenThread(ThreadAccess.SUSPEND_RESUME, False, t.Id)
  67.            If Not th = IntPtr.Zero Then
  68.                ResumeThread(th)
  69.                CloseHandle(th)
  70.            End If
  71.        Next
  72.    End Sub
  73.  
  74. End Class
  75.  

No es mucho pero es trabajo honesto .... pero si lo comparo a tu code.....

PD: Que opinas de mi mejor proyecto , que he hecho hasta ahora? .

es mi obra maestra : https://github.com/DestroyerDarkNess/DestroyerProtection



196  Programación / .NET (C#, VB.NET, ASP) / Re: [Ayuda] Prevenir que un Programa se Minimize o se cambie el foco de Windows. en: 15 Septiembre 2020, 00:07 am
Hola:
         no he intentado lo que planteas, ya me voya aponer a ver que pasa, pero... ¿por qué no usar el cheat directamente con combinación de teclas?

En efecto eso es lo que estoy haciendo actualmente. uso Up, Down , Left , Righ . para navegar por las opciones, un menu simple de cheat ON - OFF.



Pero deberia haber algun modo. de que al llamar a la venta del cheat. no se cambie el foco de windows. y ya con esto podria hacer un cheat con botones, textbox. etc..
197  Programación / .NET (C#, VB.NET, ASP) / [Ayuda] Prevenir que un Programa se Minimize o se cambie el foco de Windows. en: 14 Septiembre 2020, 23:25 pm
Hola, Tengo un Problemilla.

Bueno les pondre en contexto. hace unos dias que vengo desarrollando un Cheat para Among US.

Among US es un juego creado en Unity. y la mayoria de estos juegos . permiten superponer formularios (GDI) sobre el.

El cheat lo estamos desarrollando un amigo y yo.

el caso es que le dio por probar el menu que hice sobre otros juegos, y por casualidad funciono. yo me quede como wtf.

Bueno el caso es que el cheat puede superponerse sobre varios juegos . como es el caso de Operation 7...

Pero tengo un problema. y es de lo que vengo a pedir guia.



El problema que tengo es que algunos juegos al perder el "Foco" de la ventana del mismo se minimizan. y quiero prevenir esto.

Osea me refiero a que cuando se muestra el cheat encima del juego en pantalla completa. obviamente el foco de windows cambia de la venta del juego a mi cheat. y en ese momento el juego al perder el foco se minimiza.




Para solucionar esto. se me  ocurrieron varias ideas :

1) Pausar (suspender) el Proceso del juego y reanudarlo cuando oculte el cheat.

  R: Use la clase vieja de Elektro para hacer esto pero por alguna razón no sirve.
       -La clase esa esta medio bug , no me detectaba el proceso tuve que acomodarla.
  
     Por alguna razon el Proceso del juego no se suspendio. no se que paso la verdad.
     -tal vez sea el anticheat xingcode que no deja-



2) Intente Usar AppActivate , al parecer intento funcionar pero , en una milesima de segundo se pierde la el foco de la venta del juego y por ende se minimiza.
  
  R: Pondre Mi codigo a continuacion, que hice para que mantener el foco en el juego :
    
    Modo de uso :

    
Código
  1. Private ActiveProc As New ProcessActivate(ProcessGame)

    ProcessActivate.vb
    
Código
  1. Public Class ProcessActivate
  2.  
  3.    Private Shared Monitor As Boolean = True
  4.    Public Property ActivateMonitoring As Boolean
  5.        Get
  6.            Return Monitor
  7.        End Get
  8.        Set(value As Boolean)
  9.            Monitor = value
  10.        End Set
  11.    End Property
  12.  
  13.    Private ProcessName As String = String.Empty
  14.  
  15.    Public Sub New(ByVal ProcName As String)
  16.        ProcessName = ProcName
  17.  
  18.        Dim tsk As New Task(AddressOf AppActivateEx, TaskCreationOptions.LongRunning)
  19.        tsk.Start()
  20.    End Sub
  21.  
  22.    Private Sub AppActivateEx()
  23.        On Error Resume Next
  24.        Do While True
  25.            If Monitor = True Then
  26.                If Not ProcessName = String.Empty Then
  27.                    If ProcessName.ToLower.EndsWith(".exe") Then ProcessName = ProcessName.Substring(0, ProcessName.Length - 4)
  28.  
  29.                    Dim proc() As Process = Process.GetProcessesByName(ProcessName)
  30.  
  31.                    If Not proc.Length = 0 Then
  32.  
  33.                        AppActivate(proc(0).MainWindowTitle)
  34.  
  35.                    End If
  36.                End If
  37.            End If
  38.        Loop
  39.    End Sub
  40.  
  41. End Class
  42.  



Bueno Básicamente Necesito ayuda / Ideas , sobre como mantener el foco sobre la ventana del juego , aunque de click encima del Form del Cheat.

Incluso también me servia , alguna forma de tener el form del cheat desactivado aunque de click encima de el no llame al foco de ventana de windows. asi solo tendría que emular los clicks . etc..

Elektro una ayudita plox ...... :,v



Imagenes :
 

 



198  Programación / .NET (C#, VB.NET, ASP) / [Source-Code] StrelyCleaner Pro en: 21 Agosto 2020, 18:51 pm

Hola hoy publico la fuente de mi anti-malware creado en VB.Net



StrelyCleaner Pro


StrelyCleaner es un antimalware que se destaca por detectar malware creado en .Net y scripts maliciosos en su sistema.

Caracteristicas

  • Quick Scan.
  • Custom Scan
  • USB Scan
  • Booster
  • Startup Manager
  • Basic Network Scan


Si quieren mas Info visiten el repositorio :



Pagina Oficial : StrelyCleaner Oficial Page



Imagenes :

  

 

Comenten sujerencias  , ETC...
199  Seguridad Informática / Análisis y Diseño de Malware / Re: Muestra de virus Polimorfico Sality. en: 15 Agosto 2020, 23:39 pm
Me Sirvió perfectamente , gracias.
200  Seguridad Informática / Análisis y Diseño de Malware / Muestra de virus Polimorfico Sality. en: 15 Agosto 2020, 19:55 pm
Buenas, Como dice el titulo, alguien me pasa una muestra de este virus ?

Estoy haciendo una API para identificar malware, y preciso de una muestra del virus Sality.

Gracias de antemano.
Páginas: 1 ... 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [20] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ... 72
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines