Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/04/2015, 13:02
zonesjm
 
Fecha de Ingreso: octubre-2008
Mensajes: 4
Antigüedad: 16 años, 2 meses
Puntos: 0
Problema con programa c++

Me sale estos errores al compilar el programa en visual c++ 2008.

Código:
archivo.cpp(33) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'int32_t *' to 'LPTHREAD_START_ROUTINE'
        There is no context in which this conversion is possible
archivo.cpp(52) : error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'int32_t *' to 'HMODULE'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
archivo.cpp(53) : error C2440: 'initializing' : cannot convert from 'FARPROC' to 'int32_t (__cdecl *)(void)'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
archivo.cpp(55) : error C2664: 'VirtualProtect' : cannot convert parameter 4 from 'int32_t *' to 'PDWORD'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
archivo.cpp(56) : error C2664: 'VirtualProtect' : cannot convert parameter 4 from 'int32_t *' to 'PDWORD'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
El Codigo Fuente es este:
Código:
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <windows.h>

/* -------- Function Prototypes --------- */

int32_t entry_point(int32_t a1);
void function_10001038(void);
void function_100010d0(void);

/* ---------- Global Variables ---------- */

int32_t g1 = -0x7c1374ab; // 0x10001038
bool g2 = false; // gpr0

/* ------------- Functions -------------- */

// Address range: 0x10001000 - 0x10001035
int32_t entry_point(int32_t a1) {
    // bb
    int32_t v1;
    switch (v1) {
        case 1: {
            // 0x10001009
            g2 = true;
            CreateThread(0, 0, &g1, NULL, 0, NULL);
            // branch -> 0x10001034
            break;
        }
        case 0: {
            // 0x1000102d
            ExitProcess(0);
            // branch -> 0x10001034
            break;
        }
    }
    // 0x10001034
    return 1;
}

// Address range: 0x10001038 - 0x100010ca
void function_10001038(void) {
    // bb
    GetModuleHandleA("entitiesmp.dll");
    int32_t (*func)() = GetProcAddress(g2 ? (int32_t *)function_10001038 : NULL, "CRangeWeapon_DLLClass"); // 0x1000104e
    int32_t (*func2)() = GetProcAddress(GetModuleHandleA("entitiesmp.dll"), "CNpcSkeletonMusketeer2_DLLClass"); // 0x10001065
    int32_t * lpflOldProtect;
    VirtualProtect((int32_t *)*(int32_t *)func, 96, 64, lpflOldProtect);
    VirtualProtect((int32_t *)*(int32_t *)func2, 96, 64, lpflOldProtect);
    *(int8_t *)func = *(int8_t *)func2;
    int32_t v1 = 95; // 0x10001095
    // branch -> 0x1000108d
    while (v1 != 0) {
        // 0x1000108d
        func = (int32_t (*)())((int32_t)func + 1);
        func2 = (int32_t (*)())((int32_t)func2 + 1);
        *(int8_t *)func = *(int8_t *)func2;
        v1--;
        // continue -> 0x1000108d
    }
    // 0x10001097
    MessageBoxA(NULL, "s", "Probando si funciona", 0);
}