Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2014, 05:01
REHome
 
Fecha de Ingreso: mayo-2007
Ubicación: PIC-16F84A
Mensajes: 727
Antigüedad: 17 años
Puntos: 8
Leer esta dll datos de variables y mostrarlo.

Hola:

Tengo una variable creada conVisual C++ 2013 en Win32. Su código es de abajo. Tiene variables que se llama Vida, Balas y Mana.

Código:
#include <stdio.h>
#include <Windows.h>

bool vida = false; // = true;
bool balas = false;
bool mana = false;

bool salir = false;

void Hacks()
{
	DWORD entryPoint = (DWORD)GetModuleHandle(NULL);
	while (!salir) // while ("NO" (salir == true)) => while (salir == false) --> "mientras no salir" --> "mientras no tengamos que salir"
	{
		DWORD estructura = *(DWORD*)(entryPoint + 0x544C);

		// HACK VIDA = 100
		if (vida) // if (vida == true) -> "Si la vida es verdadera"
		{
			// Nivel 1
			*(DWORD*)(entryPoint + 0x5444) = 100;

			// Nivel 2
			// PUNTERO -> DIRECCION (ADDRESS) -> VIDA
			DWORD direccion = *(DWORD*)(entryPoint + 0x5448);
			if (direccion != 0)
			{
				*(DWORD*)(direccion) = 100;
			}

			// Nivel 3
			// PUNTERO (ESTRUCTURA) -> DIRECCION (ADDRESS) + OFFSET -> VIDA
			if (estructura != 0)
			{
				*(DWORD*)(estructura + 0) = 100;
			}
		}

		if (balas)
		{
			// Nivel 1
			*(DWORD*)(entryPoint + 0x5454) = 10;

			// Nivel 2
			// PUNTERO -> DIRECCION (ADDRESS) -> BALAS
			DWORD direccion = *(DWORD*)(entryPoint + 0x5460);
			if (direccion != 0)
			{
				*(DWORD*)(direccion) = 10;
			}

			// Nivel 3
			// PUNTERO (ESTRUCTURA) -> DIRECCION (ADDRESS) + OFFSET -> VIDA
			if (estructura != 0)
			{
				*(DWORD*)(estructura + 4) = 10;
			}
		}

		if (mana)
		{
			// Nivel 1
			*(DWORD*)(entryPoint + 0x545C) = 100;

			// Nivel 2
			// PUNTERO -> DIRECCION (ADDRESS) -> MANA
			DWORD direccion = *(DWORD*)(entryPoint + 0x5450);
			if (direccion != 0)
			{
				*(DWORD*)(direccion) = 100;
			}

			// Nivel 3
			// PUNTERO (ESTRUCTURA) -> DIRECCION (ADDRESS) + OFFSET -> VIDA
			if (estructura != 0)
			{
				*(DWORD*)(estructura + 8) = 100;
			}
		}

		Sleep(200); // 200 milisegundos
		// Sleep(1);
	}
}

void Teclado()
{
	while (!salir)
	{
		// 'a' => vida = activar/desactivar (true/false)
		if (GetAsyncKeyState(VkKeyScan('a')) & 1)
		{
			vida = !vida; // ! "NO"/"LO CONTRARIO"
			/*
			vida es true
			vida = "NO" true => vida = false
			vida = "NO" false => vida = true
			*/
		}

		// 's' => balas = activar/desactivar (true/false)
		if (GetAsyncKeyState(VkKeyScan('s')) & 1)
		{
			balas = !balas;
		}

		// 'd' => mana = activar/desactivar (true/false)
		if (GetAsyncKeyState(VkKeyScan('d')) & 1)
		{
			mana = !mana;
		}

		Sleep(300);
	}
}

// DllMain <--- 
// Cierra --> Dllmain
BOOL WINAPI DllMain(HINSTANCE module, DWORD reason, LPVOID reserved)
{
	if (reason == DLL_PROCESS_ATTACH)
	{
		// OK! Estamos dentro!
		// Thread
		// Hacks();
		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Hacks, 0, 0, 0);
		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Teclado, 0, 0, 0);
	}
	else if (reason == DLL_PROCESS_DETACH)
	{
		// Salimos del juego!
		salir = true;
	}

	// Devolver
	return true;
}
Usando Visual C# 2013, creando otro proyecto a parte con Windows Form, coloco la dll llamada HackDLL.dll en el directorio del proyecto del C#.

Creao en C# una clase que se llama Super_DLL.cs. Dentro de ella tiene este código que en realidad no es nada.

Código:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Runtime.InteropServices; // No olvidar. Para Dllimport.

namespace Prueba_DLL
{
    class Super_DLL
    {
        [DllImport("HackDLL.dll")]
        
    }
}
El formulario principal solo he colocado un using.

Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Prueba_DLL; // No olvidar este using. Para llamar a la clase Super_DLL.cs.

namespace Prueba_DLL
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}
En Windows Form de C# solo tiene tres label para mostrar dichas variables. Los label para no condundir se llama su nombre interno.

label_vida

label_balas

label_mana

No se si es posible hacerlo con el código mostrado. Lo que hace simplente ejecutar un juego básico hecho con C++ 2013 (no tengo código fuente y puede ser el ejecutable de cualquier juego).

Se crea una dll a parte con otro proyecto del código de arriba.

Luego creo otro proyecto con Windows Form bajo C# como dije antes arriba. Solo tiene que leer las variables del juego cuando está en ejecución. La dll hace el trabajo principal leyendo y C# solo muestra información optenida gracias a la dll.

Espero que se entienda y me ayuden.

Saludo.
__________________
Meta Shell, VERSIÓN 1.2.2
Descargar