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

Hola:

Tienes razón que cambia el nombre de la direcciones, sobre todo los dos primeros bytes en cada ejecución, así que modificar la variable. También he añadido este código desde el principio.

Código:
extern "C" __declspec(dllexport) bool ObtenerVida()
{
	return vida;
}
Código:
#include <stdio.h>
#include <Windows.h>

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

bool salir = false;

extern "C" __declspec(dllexport) bool ObtenerVida()
{
	return vida;
}

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;
}
Con Windows Form he hecho esto. Puse un label_vida en el Form1 y este código, compila pero no lee nada de nada.

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();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
           bool vida = Super_DLL.ObtenerVida();
           label_vida.Text = vida.ToString();
        }
    }
}
No me funciona ni así. Leeré tu enlace.

Hay gente que si les funciona y es capaz de leer cualquier variable con su dll hecho por él mismo.

Debo buscar la solución de otra manera.

Saludo.
__________________
Meta Shell, VERSIÓN 1.2.2
Descargar

Última edición por REHome; 16/03/2014 a las 11:58