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

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Como resolver estos errores?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 Ir Abajo Respuesta Imprimir
Autor Tema: Como resolver estos errores?  (Leído 7,331 veces)
Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Como resolver estos errores?
« en: 14 Marzo 2017, 14:21 pm »

Estoy intentando compilar ejemplos de esta libreria:
Código:
https://www.codeproject.com/KB/winsdk/LibMinHook/MinHook_133_src.zip

El tio compila ejemplos de todos pero cuando yo lo intento me devuelve:
Código:
C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h:141:
22: note:   candidate expects 5 arguments, 4 provided
DynamicLinkSample.cpp:12:18: note: template<class T> MH_STATUS MH_CreateHookApiE
x(LPCWSTR, LPCSTR, LPVOID, T**)
 inline MH_STATUS MH_CreateHookApiEx(LPCWSTR pszModule, LPCSTR pszProcName, LPVO
ID pDetour, T** ppOriginal)
                  ^
DynamicLinkSample.cpp:12:18: note:   template argument deduction/substitution fa
iled:
DynamicLinkSample.cpp:37:88: note:   cannot convert 'DetourMessageBoxW' (type 'i
nt (__attribute__((__stdcall__)) *)(HWND, LPCWSTR, LPCWSTR, UINT) {aka int (__at
tribute__((__stdcall__)) *)(HWND__*, const wchar_t*, const wchar_t*, unsigned in
t)}') to type 'LPVOID {aka void*}'
     if (MH_CreateHookApiEx(L"user32", "MessageBoxW", &DetourMessageBoxW, &fpMes
sageBoxW) != MH_OK)

        ^
DynamicLinkSample.cpp:43:35: error: invalid conversion from 'int (__attribute__(
(__stdcall__)) *)(HWND, LPCWSTR, LPCWSTR, UINT) {aka int (__attribute__((__stdca
ll__)) *)(HWND__*, const wchar_t*, const wchar_t*, unsigned int)}' to 'LPVOID {a
ka void*}' [-fpermissive]
     if (MH_EnableHook(&MessageBoxW) != MH_OK)
                                   ^
In file included from DynamicLinkSample.cpp:2:0:
C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h:154:
22: note: initializing argument 1 of 'MH_STATUS MH_EnableHook(LPVOID)'
     MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
                      ^
DynamicLinkSample.cpp:52:36: error: invalid conversion from 'int (__attribute__(
(__stdcall__)) *)(HWND, LPCWSTR, LPCWSTR, UINT) {aka int (__attribute__((__stdca
ll__)) *)(HWND__*, const wchar_t*, const wchar_t*, unsigned int)}' to 'LPVOID {a
ka void*}' [-fpermissive]
     if (MH_DisableHook(&MessageBoxW) != MH_OK)
                                    ^
In file included from DynamicLinkSample.cpp:2:0:
C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h:161:
22: note: initializing argument 1 of 'MH_STATUS MH_DisableHook(LPVOID)'
     MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
                      ^

Supongo algo estare haciendo mal. En este caso estoy intentando desde consola con g++, que el compilador sería mingw.


« Última modificación: 14 Marzo 2017, 14:53 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: Como resolver estos errores?
« Respuesta #1 en: 14 Marzo 2017, 14:58 pm »

Esa librería sera de C (los errores son errores de conversión de un puntero a función a un void*, cosa que en C se podía hacer de forma implícita). O modificas las funciones añadiendo casts a void*, o:
https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra
Hay una parte que pone: If you are a C++ user, ...


En línea

Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Como resolver estos errores?
« Respuesta #2 en: 14 Marzo 2017, 15:07 pm »

Esa librería sera de C (los errores son errores de conversión de un puntero a función a un void*, cosa que en C se podía hacer de forma implícita). O modificas las funciones añadiendo casts a void*, o:
https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra
Hay una parte que pone: If you are a C++ user, ...
Primero tengo unas dudas cuando dices librería te refieres a cabecera? también se le puede llamar libreria a un .h por ejemplo? Segundo :
Citar
los errores son errores de conversión de un puntero a función a un void*, cosa que en C se podía hacer de forma implícita). O modificas las funciones añadiendo casts a void*

Cuando dices añadir casts a void* te refieres que en la libreria/cabecera minhook.h debó incluirle el * de puntero?

En cuanto a esto:
Citar
If you are a C++ user, ...

Lo intente cambiando la parte de arriba y de abajo y dejando el main tal como estaba pero al compilarlo seguia devolviendo error.

« Última modificación: 14 Marzo 2017, 15:09 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Como resolver estos errores?
« Respuesta #3 en: 14 Marzo 2017, 15:14 pm »

La librería es la siguiente:
Código
  1. #pragma once
  2.  
  3. #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__)
  4.    #error MinHook supports only x86 and x64 systems.
  5. #endif
  6.  
  7. #include <windows.h>
  8.  
  9. // MinHook Error Codes.
  10. typedef enum MH_STATUS
  11. {
  12.    // Unknown error. Should not be returned.
  13.    MH_UNKNOWN = -1,
  14.  
  15.    // Successful.
  16.    MH_OK = 0,
  17.  
  18.    // MinHook is already initialized.
  19.    MH_ERROR_ALREADY_INITIALIZED,
  20.  
  21.    // MinHook is not initialized yet, or already uninitialized.
  22.    MH_ERROR_NOT_INITIALIZED,
  23.  
  24.    // The hook for the specified target function is already created.
  25.    MH_ERROR_ALREADY_CREATED,
  26.  
  27.    // The hook for the specified target function is not created yet.
  28.    MH_ERROR_NOT_CREATED,
  29.  
  30.    // The hook for the specified target function is already enabled.
  31.    MH_ERROR_ENABLED,
  32.  
  33.    // The hook for the specified target function is not enabled yet, or already
  34.    // disabled.
  35.    MH_ERROR_DISABLED,
  36.  
  37.    // The specified pointer is invalid. It points the address of non-allocated
  38.    // and/or non-executable region.
  39.    MH_ERROR_NOT_EXECUTABLE,
  40.  
  41.    // The specified target function cannot be hooked.
  42.    MH_ERROR_UNSUPPORTED_FUNCTION,
  43.  
  44.    // Failed to allocate memory.
  45.    MH_ERROR_MEMORY_ALLOC,
  46.  
  47.    // Failed to change the memory protection.
  48.    MH_ERROR_MEMORY_PROTECT,
  49.  
  50.    // The specified module is not loaded.
  51.    MH_ERROR_MODULE_NOT_FOUND,
  52.  
  53.    // The specified function is not found.
  54.    MH_ERROR_FUNCTION_NOT_FOUND
  55. }
  56. MH_STATUS;
  57.  
  58. // Can be passed as a parameter to MH_EnableHook, MH_DisableHook,
  59. // MH_QueueEnableHook or MH_QueueDisableHook.
  60. #define MH_ALL_HOOKS NULL
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66.    // Initialize the MinHook library. You must call this function EXACTLY ONCE
  67.    // at the beginning of your program.
  68.    MH_STATUS WINAPI MH_Initialize(VOID);
  69.  
  70.    // Uninitialize the MinHook library. You must call this function EXACTLY
  71.    // ONCE at the end of your program.
  72.    MH_STATUS WINAPI MH_Uninitialize(VOID);
  73.  
  74.    // Creates a Hook for the specified target function, in disabled state.
  75.    // Parameters:
  76.    //   pTarget    [in]  A pointer to the target function, which will be
  77.    //                    overridden by the detour function.
  78.    //   pDetour    [in]  A pointer to the detour function, which will override
  79.    //                    the target function.
  80.    //   ppOriginal [out] A pointer to the trampoline function, which will be
  81.    //                    used to call the original target function.
  82.    //                    This parameter can be NULL.
  83.    MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
  84.  
  85.    // Creates a Hook for the specified API function, in disabled state.
  86.    // Parameters:
  87.    //   pszModule  [in]  A pointer to the loaded module name which contains the
  88.    //                    target function.
  89.    //   pszTarget  [in]  A pointer to the target function name, which will be
  90.    //                    overridden by the detour function.
  91.    //   pDetour    [in]  A pointer to the detour function, which will override
  92.    //                    the target function.
  93.    //   ppOriginal [out] A pointer to the trampoline function, which will be
  94.    //                    used to call the original target function.
  95.    //                    This parameter can be NULL.
  96.    MH_STATUS WINAPI MH_CreateHookApi(
  97.        LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal);
  98.  
  99.    // Creates a Hook for the specified API function, in disabled state.
  100.    // Parameters:
  101.    //   pszModule  [in]  A pointer to the loaded module name which contains the
  102.    //                    target function.
  103.    //   pszTarget  [in]  A pointer to the target function name, which will be
  104.    //                    overridden by the detour function.
  105.    //   pDetour    [in]  A pointer to the detour function, which will override
  106.    //                    the target function.
  107.    //   ppOriginal [out] A pointer to the trampoline function, which will be
  108.    //                    used to call the original target function.
  109.    //                    This parameter can be NULL.
  110.    //   ppTarget   [out] A pointer to the target function, which will be used
  111.    //                    with other functions.
  112.    //                    This parameter can be NULL.
  113.    MH_STATUS WINAPI MH_CreateHookApiEx(
  114.        LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget);
  115.  
  116.    // Removes an already created hook.
  117.    // Parameters:
  118.    //   pTarget [in] A pointer to the target function.
  119.    MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
  120.  
  121.    // Enables an already created hook.
  122.    // Parameters:
  123.    //   pTarget [in] A pointer to the target function.
  124.    //                If this parameter is MH_ALL_HOOKS, all created hooks are
  125.    //                enabled in one go.
  126.    MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
  127.  
  128.    // Disables an already created hook.
  129.    // Parameters:
  130.    //   pTarget [in] A pointer to the target function.
  131.    //                If this parameter is MH_ALL_HOOKS, all created hooks are
  132.    //                disabled in one go.
  133.    MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
  134.  
  135.    // Queues to enable an already created hook.
  136.    // Parameters:
  137.    //   pTarget [in] A pointer to the target function.
  138.    //                If this parameter is MH_ALL_HOOKS, all created hooks are
  139.    //                queued to be enabled.
  140.    MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
  141.  
  142.    // Queues to disable an already created hook.
  143.    // Parameters:
  144.    //   pTarget [in] A pointer to the target function.
  145.    //                If this parameter is MH_ALL_HOOKS, all created hooks are
  146.    //                queued to be disabled.
  147.    MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
  148.  
  149.    // Applies all queued changes in one go.
  150.    MH_STATUS WINAPI MH_ApplyQueued(VOID);
  151.  
  152.    // Translates the MH_STATUS to its name as a string.
  153.    const char * WINAPI MH_StatusToString(MH_STATUS status);
  154.  
  155. #ifdef __cplusplus
  156. }
  157. #endif
  158.  
  159.  

Como podría agregar a las funciones casts a void* digamos dentro de los parametros, ya que necesito hacer la conversión de un puntero a función a un void*.
« Última modificación: 14 Marzo 2017, 16:16 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: Como resolver estos errores?
« Respuesta #4 en: 14 Marzo 2017, 15:50 pm »

Como no sé exactamente cómo está tu proyecto, te pongo un ejemplo:

Código:
DynamicLinkSample.cpp:43:35: error: invalid conversion from 'int (__attribute__(
(__stdcall__)) *)(HWND, LPCWSTR, LPCWSTR, UINT) {aka int (__attribute__((__stdca
ll__)) *)(HWND__*, const wchar_t*, const wchar_t*, unsigned int)}' to 'LPVOID {a
ka void*}' [-fpermissive]
     if (MH_EnableHook(&MessageBoxW) != MH_OK)
                                   ^

Y según has puesto, MH_EnableHook es:
Código
  1. MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
&MessageBoxW no es un void*, es un unteor a esa función. Podrías poner:
Código
  1. if (MH_EnableHook((void*)&MessageBoxW) != MH_OK)

Y algunos de los otros errores son más de lo mismo.
En línea

Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Como resolver estos errores?
« Respuesta #5 en: 14 Marzo 2017, 16:13 pm »

El proyecto mio es este:
Código
  1. #include <Windows.h>
  2. #include "C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h"
  3.  
  4. #if defined _M_X64
  5. #pragma comment(lib, "MinHook.x64.lib")
  6. #elif defined _M_IX86
  7. #pragma comment(lib, "MinHook.x86.lib")
  8. #endif
  9.  
  10. // Helper function for MH_CreateHookApi().
  11. template <typename T>
  12. inline MH_STATUS MH_CreateHookApiEx(LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, T** ppOriginal)
  13. {
  14.    return MH_CreateHookApi(pszModule, pszProcName, pDetour, reinterpret_cast<LPVOID*>(ppOriginal));
  15. }
  16.  
  17. typedef int (WINAPI *MESSAGEBOXW)(HWND, LPCWSTR, LPCWSTR, UINT);
  18.  
  19. // Pointer for calling original MessageBoxW.
  20. MESSAGEBOXW fpMessageBoxW = NULL;
  21.  
  22. // Detour function which overrides MessageBoxW.
  23. int WINAPI DetourMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)
  24. {
  25.    return fpMessageBoxW(hWnd, L"Hooked!", lpCaption, uType);
  26. }
  27.  
  28. int main()
  29. {
  30.    // Initialize MinHook.
  31.    if (MH_Initialize() != MH_OK)
  32.    {
  33.        return 1;
  34.    }
  35.  
  36.    // Create a hook for MessageBoxW, in disabled state.
  37.    if (MH_CreateHookApiEx(L"user32", "MessageBoxW", &DetourMessageBoxW, &fpMessageBoxW) != MH_OK)
  38.    {
  39.        return 1;
  40.    }
  41.  
  42.    // Enable the hook for MessageBoxW.
  43.    if (MH_EnableHook((void*)&MessageBoxW) != MH_OK)
  44.    {
  45.        return 1;
  46.    }
  47.  
  48.    // Expected to tell "Hooked!".
  49.    MessageBoxW(NULL, L"Not hooked...", L"MinHook Sample", MB_OK);
  50.  
  51.    // Disable the hook for MessageBoxW.
  52.    if (MH_DisableHook((void*)&MessageBoxW) != MH_OK)
  53.    {
  54.        return 1;
  55.    }
  56.  
  57.    // Expected to tell "Not hooked...".
  58.    MessageBoxW(NULL, L"Not hooked...", L"MinHook Sample", MB_OK);
  59.  
  60.    // Uninitialize MinHook.
  61.    if (MH_Uninitialize() != MH_OK)
  62.    {
  63.        return 1;
  64.    }
  65.  
  66.    return 0;
  67. }

Y cambie lo de messagebox añadiendole los void*. Aún así obtengo otros errores crees que los podría solucionar igual?:
Código:
C:\Users\Androide\Desktop\minhook\Dynamic>cd C:\Users\Androide\Desktop\minhook\D
ynamic

C:\Users\Androide\Desktop\minhook\Dynamic>g++ -o Dynamic.exe Dynamic.cpp
Dynamic.cpp: In function 'int main()':
Dynamic.cpp:37:88: error: no matching function for call to 'MH_CreateHookApiEx(c
onst wchar_t [7], const char [12], int (__attribute__((__stdcall__)) *)(HWND, LP
CWSTR, LPCWSTR, UINT), int (__attribute__((__stdcall__)) **)(HWND, LPCWSTR, LPCW
STR, UINT))'
     if (MH_CreateHookApiEx(L"user32", "MessageBoxW", &DetourMessageBoxW, &fpMes
sageBoxW) != MH_OK)

        ^
Dynamic.cpp:37:88: note: candidates are:
In file included from Dynamic.cpp:2:0:
C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h:141:
22: note: MH_STATUS MH_CreateHookApiEx(LPCWSTR, LPCSTR, LPVOID, void**, void**)
     MH_STATUS WINAPI MH_CreateHookApiEx(
                      ^
C:\Users\Androide\Desktop\minhook\Dynamic\MinHook_133_src\include\MinHook.h:141:
22: note:   candidate expects 5 arguments, 4 provided
Dynamic.cpp:12:18: note: template<class T> MH_STATUS MH_CreateHookApiEx(LPCWSTR,
 LPCSTR, LPVOID, T**)
 inline MH_STATUS MH_CreateHookApiEx(LPCWSTR pszModule, LPCSTR pszProcName, LPVO
ID pDetour, T** ppOriginal)
                  ^
Dynamic.cpp:12:18: note:   template argument deduction/substitution failed:
Dynamic.cpp:37:88: note:   cannot convert 'DetourMessageBoxW' (type 'int (__attr
ibute__((__stdcall__)) *)(HWND, LPCWSTR, LPCWSTR, UINT) {aka int (__attribute__(
(__stdcall__)) *)(HWND__*, const wchar_t*, const wchar_t*, unsigned int)}') to t
ype 'LPVOID {aka void*}'
     if (MH_CreateHookApiEx(L"user32", "MessageBoxW", &DetourMessageBoxW, &fpMes
sageBoxW) != MH_OK)

        ^

Sino tendré que crear mi proyecto en c y punto.
« Última modificación: 14 Marzo 2017, 19:04 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: Como resolver estos errores?
« Respuesta #6 en: 14 Marzo 2017, 19:27 pm »

Varios de esos errores son lo mismo:
Código:
if (MH_CreateHookApiEx(L"user32", "MessageBoxW", &DetourMessageBoxW, &fpMes
sageBoxW) != MH_OK)
A &DetourMessageBoxW hay que ponerle también el void*.
En línea

Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Como resolver estos errores?
« Respuesta #7 en: 14 Marzo 2017, 19:42 pm »

Varios de esos errores son lo mismo:

Hola disculpa tienes razón pero ahora creo que tendré que declararlos porque me devuelve estos error, supongo algo habré me faltara o no lo habré incluido bien:
Código:
C:\Users\Androide\Desktop\minhook\Dynamic>gcc -o bot.exe Dynamic.cpp
C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o:Dynamic.cpp:(.text+0x48): undefi
ned reference to `MH_Initialize@0'
C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o:Dynamic.cpp:(.text+0x9e): undefi
ned reference to `MH_EnableHook@4'
C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o:Dynamic.cpp:(.text+0xe7): undefi
ned reference to `MH_DisableHook@4'
C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o:Dynamic.cpp:(.text+0x126): undef
ined reference to `MH_Uninitialize@0'
C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o:Dynamic.cpp:(.text$_Z18MH_Create
HookApiExIFiP6HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_[__Z18MH_CreateHookApiExIFiP6
HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_]+0xfffffd2e): undefined reference to `MH_C
reateHookApi@16'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw
32/bin/ld.exe: C:\Users\Androide\AppData\Local\Temp\ccHkYwzX.o: bad reloc addres
s 0x22 in section `.text$_Z18MH_CreateHookApiExIFiP6HWND__PKwS3_jEE9MH_STATUSS3_
PKcPvPPT_[__Z18MH_CreateHookApiExIFiP6HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw
32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
« Última modificación: 14 Marzo 2017, 19:45 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
ivancea96


Desconectado Desconectado

Mensajes: 3.412


ASMático


Ver Perfil WWW
Re: Como resolver estos errores?
« Respuesta #8 en: 14 Marzo 2017, 19:47 pm »

Si ya te compila, entonces vamos al segundo paso.
¿Linkeaste correctamente la librería? Esos son errores de linker.

Bueno, leyendo la línea, no:
Citar
gcc -o bot.exe Dynamic.cpp

Cuando tratas de compilar un programa con uno o más archvios de código o librerías, hay que hacerlo por pasos.

Primero, compilar los códigos:
Citar
g++ -o Dynamic.o -c Dynamic.cpp

Luego, linkear todo:
Citar
g++ -o bot.exe Dynamic.o libreria1.o archivo2.o
En línea

Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Como resolver estos errores?
« Respuesta #9 en: 14 Marzo 2017, 20:51 pm »

Vale tienes razón no sabía que se podia hacer por partes lo cual  es de gran utilidad. Tengo una pequeña duda ahora he compilado la libreria para la versión para mingw (la cual me da los archivos .o para el linkeado), aparentemente se crea pero en consola me muestra lo siguiente:

Código:
C:\Users\Androide\Desktop\minhook-master\build\MinGW>windres -i ../../dll_reso
ces/MinHook.rc -o MinHook_rc.o   && dllwrap --driver-name g++ -o MinHook.dll -
sm=intel --def ../../dll_resources/MinHook.def -Wl,-enable-stdcall-fixup -Wall
inHook_rc.o ../../src/*.c ../../src/HDE/*.c -I../../include -I../../src -Werro
-std=c++11 -s -static-libgcc -static-libstdc++  || pause
../../src/hook.c: In function 'void Freeze(PFROZEN_THREADS, UINT, UINT)':
../../src/hook.c:319:82: error: 'OpenThread' was not declared in this scope
             HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItem
i]);

  ^
../../src/hook.c: In function 'void Unfreeze(PFROZEN_THREADS)':
../../src/hook.c:338:82: error: 'OpenThread' was not declared in this scope
             HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItem
i]);

  ^
dllwrap: g++ exited with status 1

Después cojo el fichero .o y linkeo:
Código:
C:\Users\Androide\Desktop\minhook\Dynamic>g++ -o Dynamic.o -c Dynamic.cpp

C:\Users\Androide\Desktop\minhook\Dynamic>g++ -o bot.exe Dynamic.o MinHook_rc.o
Dynamic.o:Dynamic.cpp:(.text+0x48): undefined reference to `MH_Initialize@0'
Dynamic.o:Dynamic.cpp:(.text+0x9e): undefined reference to `MH_EnableHook@4'
Dynamic.o:Dynamic.cpp:(.text+0xe7): undefined reference to `MH_DisableHook@4'
Dynamic.o:Dynamic.cpp:(.text+0x126): undefined reference to `MH_Uninitialize@0'
Dynamic.o:Dynamic.cpp:(.text$_Z18MH_CreateHookApiExIFiP6HWND__PKwS3_jEE9MH_STATU
SS3_PKcPvPPT_[__Z18MH_CreateHookApiExIFiP6HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_]
+0xfffffd2e): undefined reference to `MH_CreateHookApi@16'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw
32/bin/ld.exe: Dynamic.o: bad reloc address 0x22 in section `.text$_Z18MH_Create
HookApiExIFiP6HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_[__Z18MH_CreateHookApiExIFiP6
HWND__PKwS3_jEE9MH_STATUSS3_PKcPvPPT_]'
C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw
32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

Crees que se deba al error de la libreria o al mejor pienso que el .o que obtengo sea la causa del problema.

Pienso que la razón es el error que no me incluye los .o correctamente de mi fichero hook.c por el error que cite.
« Última modificación: 14 Marzo 2017, 21:01 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
Páginas: [1] 2 Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Urgente ayudenme resolver estos ejercicos en C#
Ejercicios
Ruben Yiyo 4 7,111 Último mensaje 16 Febrero 2010, 02:13 am
por micky123
[C][?]Ayuda a resolver estos errores
Programación C/C++
Xcution 1 2,343 Último mensaje 1 Noviembre 2013, 20:50 pm
por vangodp
Necesito ayuda para resolver estos errores en este programa de C
Programación C/C++
Xcution 0 1,678 Último mensaje 29 Noviembre 2013, 03:44 am
por Xcution
Microsoft te ayuda a resolver errores provocados por actualizaciones en ....
Noticias
wolfbcn 0 1,146 Último mensaje 24 Diciembre 2016, 19:04 pm
por wolfbcn
Como solucionar estos errores de mi proyecto
Programación C/C++
Borito30 1 1,968 Último mensaje 13 Marzo 2017, 01:56 am
por Borito30
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines