Here are the errors i get with Dev C++ which use mingwm compilator.
Code:
main.cpp In function `BOOL InitInstance()':
71 main.cpp void value not ignored as it ought to be
72: main.cpp void value not ignored as it ought to be
Makefile.win [Build Error] [main.o] Error 1
Here is the code:
Code:
// code generated by "DLL proxy skeleton generator 0.1.1b", Luigi Auriemma http://aluigi.org
#include <cstdlib>
#include <iostream>
#define DLL_NAME "cgame_mp_x86.dll" // the name of the original DLL
// if DLL_PATH is not defined the proxy DLL will automatically retrieve the Windows system32
// folder of the system and will load the DLL in that location
//#define DLL_PATH "." // if uncommented will be loaded the DLL in this current location
//#define DLL_PATH "c:\\windows\\system32"
// if you want to proxify a system DLL remember to disable the header file which already exports those functions
// for example, if you want to proxify wsock32.dll or ws2_32.dll you must uncomment the following lines:
// #define _WINSOCK_H
// #define _WINSOCK2_H
// you can find the needed "#define"s in the include header files showed by your compiler when it reports the
// "redeclaration" or "previous declaration" errors (example: winsock.h and winsock2.h)
// if you need one or more specific functions declared in those include files you must redeclare them here
// all the original functions have an additional underscore before their name so, for example,
// the original recv function is _recv and the original one of __myfunc is ___myfunc
// example of a simple recv() hooking using two different types of declarations of the function
// available in this code so you can choose the most confortable (the resulting code IS the same):
// #define recv_(X) int (X)(int s, char *buf, int len, int flags)
// CALL_FUNCTION(recv) {
// len = _recv(s, buf, len, flags);
// return(len);
// }
// or:
// CALL_FUNCTION2(int, recv, int s, char *buf, int len, int flags) {
// len = _recv(s, buf, len, flags);
// return(len);
// }
// example of compiling: gcc -o ws2_32.dll ws2_32.c -shared ws2_32.def
//#define POP_EBP // uncomment if you use -fomit-frame-pointer
#define POP_EBP __asm__("pop %ebp"); // comment if you use -fomit-frame-pointer
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#define CALLING_CONVENTION WINAPI // default for Windows DLLs, this IS important
#define PROXY_PROTOTYPE(FUNCTION_NAME) void (FUNCTION_NAME)(void)
#define PROXY_FUNCTION(FUNCTION_NAME) static CALLING_CONVENTION PROXY_PROTOTYPE(*_##FUNCTION_NAME) = NULL;CALLING_CONVENTION PROXY_PROTOTYPE(FUNCTION_NAME) { POP_EBP __asm__("jmp *__"#FUNCTION_NAME);}
#define CALL_FUNCTION(FUNCTION_NAME) static CALLING_CONVENTION FUNCTION_NAME##_(*_##FUNCTION_NAME) = NULL; CALLING_CONVENTION FUNCTION_NAME##_(FUNCTION_NAME)
#define CALL_FUNCTION2(FUNCTION_RET, FUNCTION_NAME, FUNCTION_ARGS ...) static CALLING_CONVENTION FUNCTION_RET (*_##FUNCTION_NAME)(FUNCTION_ARGS) = NULL; CALLING_CONVENTION FUNCTION_RET FUNCTION_NAME(FUNCTION_ARGS)
HMODULE hm = NULL;
PROXY_FUNCTION(dllEntry)
PROXY_FUNCTION(vmMain)
BOOL InitInstance(void) {
char winpath[MAX_PATH];
if(hm) return(TRUE);
#ifdef DLL_PATH
strcpy(winpath, DLL_PATH);
#else
GetSystemDirectory(winpath, sizeof(winpath));
#endif
strcat(winpath, "\\" DLL_NAME);
hm = LoadLibrary(winpath);
if(!hm) return(FALSE);
_dllEntry = (void )GetProcAddress(hm, "dllEntry");
_vmMain = (void )GetProcAddress(hm, "vmMain");
return(TRUE);
}
void ExitInstance(void) {
if(hm) {
FreeLibrary(hm);
hm = NULL;
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
switch(fdwReason) {
case DLL_PROCESS_ATTACH: {
DisableThreadLibraryCalls(hinstDLL);
InitInstance();
break;
}
case DLL_PROCESS_DETACH: {
ExitInstance();
break;
}
default: break;
}
return(TRUE);
}