Shitload of syntax errors

Posts 1–13 of 13 · Page 1 of 1
Shitload of syntax errors
I really need some help with my hook.
I have been working on this for weeks/months (Whole hack not just this one snippet)
So please can you help me fix some of the stuff I have done wrong.

Code:
DETOUR_TRAMPOLINE(BOOL WINAPI GetThreadContext_Trampoline(HANDLE ,LPCONTEXT), GetThreadContext);
DETOUR_TRAMPOLINE(LPTOP_LEVEL_EXCEPTION_FILTER SetUnhandledExceptionFilter_Trampoline(LPTOP_LEVEL_EXCEPTION_FILTER), SetUnhandledExceptionFilter);

// Function defines
void Set_SEH_and_BreakPoints(void);				// Set the SEH and breakpoints
LPTOP_LEVEL_EXCEPTION_FILTER oldHandler = NULL;	// Pointer to existing exception handler

// Global variables
DWORD	dwBreakPoint1		=	0x00463F50;		// BREAKPOINT: CL_WritePacket
DWORD	dwBreakPoint2		= 	0x004F9AB0;		// BREAKPOINT: SendCommandToConsole
DWORD	dwBreakPoint3		= 	0x0042C010;		// BREAKPOINT: R_EndFrame
DWORD	dwBreakPoint4		=	0x00435620;		// BREAKPOINT: CG_Obituary

BYTE	opcodes[5];								// Original opcodes in GetTickCount() entry-point to be stored for restoring

// Hijacked GetTickCount. This is called when target-app (Notepad) is calling GetTickCount()
DWORD WINAPI GetTickCount_Detour()
{
	// From here we add our Structured Exception Handler
	// We can't add it in the DLLmain since that function is called in 
	// different thread-context and the SEH and Breakpoints are per thread basis
	Set_SEH_and_BreakPoints();

	// Return original bytes to GetTickCount() i.e. unhook it. We only need this "callback" once.
	WriteProcessMemory(GetCurrentProcess(),(LPVOID)GetProcAddress(GetModuleHandle("Kernel32"),"GetTickCount"),&opcodes,5,0);

	// Return actual function result
	return GetTickCount();
}

// Add the SEH-handler and set HW-breakpoint(s)
void Set_SEH_and_BreakPoints()
{
	// Store existing handler to global variable to reset later
	oldHandler = SetUnhandledExceptionFilter(UnhandlerExceptionFilter);
	
	// Set debug-registers for HW-breakpoint and activate it
	CONTEXT ctx = {CONTEXT_DEBUG_REGISTERS};
	ctx.Dr6 = 0x00000000;

	ctx.Dr0 = dwBreakPoint1;	// Set Address of Breakpoint 1
	ctx.Dr1 = dwBreakPoint2;	// Set Address of Breakpoint 2
	ctx.Dr2 = dwBreakPoint3;	// Set Address of Breakpoint 3
	ctx.Dr3 = dwBreakPoint4;	// Set Address of Breakpoint 3
	ctx.Dr7 = (1<<0)|(1<<2)|(1<<4)|(1<<6);   

	// Write the values to registers. From now on the breakpoint is active 
	SetThreadContext(GetCurrentThread(), &ctx); 
}

// Our ExceptionHandler
// study the ExceptionInfo-struct for stuff you need
LONG WINAPI UnhandlerExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
    if(ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP) 
    {
		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint1)  
        {
			oCL_WritePacket = Hook(dwBreakPoint1, hCL_WritePacket, tCL_WritePacket);
			ExceptionInfo->ContextRecord->Eip = (DWORD)hCL_WritePacket;
			DetourRemove((PBYTE)oCL_WritePacket, (PBYTE)hCL_WritePacket);

            return EXCEPTION_CONTINUE_EXECUTION;
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint2)  
        {
			o_CG_SendCommandToConsole = Hook( dwBreakPoint2, h_CG_SendCommandToConsole, t_CG_SendCommandToConsole);
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_CG_SendCommandToConsole;
			DetourRemove((PBYTE)o_CG_SendCommandToConsole, (PBYTE)h_CG_SendCommandToConsole);

            return EXCEPTION_CONTINUE_EXECUTION;  
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint3) 
        {
			o_RE_EndFrame = Hook( dwBreakPoint3, h_RE_EndFrame, void (__fastcall *)());
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_RE_EndFrame;
			DetourRemove((PBYTE)o_RE_EndFrame, (PBYTE)h_RE_EndFrame);

            return EXCEPTION_CONTINUE_EXECUTION; 
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint4)  
        {
			o_CG_Obituary = Hook( dwBreakPoint4, h_CG_Obituary, t_CG_Obituary);
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_CG_Obituary;
			DetourRemove((PBYTE)o_CG_Obituary, (PBYTE)h_CG_Obituary);

            return EXCEPTION_CONTINUE_EXECUTION; 
        }
    }
    // Some other exception occurred. Pass it to next handler 
    return EXCEPTION_CONTINUE_SEARCH; 
}

// SetUnhandledExceptionFilter
LPTOP_LEVEL_EXCEPTION_FILTER hSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER arg1)
{
	return SetUnhandledExceptionFilter_Trampoline(UnhandlerExceptionFilter);
}

// Hijacked GetThreadContext(). We don't actually need this in our notepad-example
// I included it just for help since for a real hack you need to fake 
// DEBUG-registers so that the game doesn't see they that are altered
BOOL WINAPI GetThreadContext_Detour (HANDLE hThread,LPCONTEXT lpContext)
{
	// Get the Real values from original API-function (see the _trampoline)
	BOOL ret = GetThreadContext_Trampoline( hThread, lpContext);

	// If target is interested in Debug-registers return fake values 
	if (lpContext->ContextFlags && CONTEXT_DEBUG_REGISTERS) {
		lpContext->Dr0=0;
		lpContext->Dr1=0;
		lpContext->Dr2=0;
		lpContext->Dr3=0;
		lpContext->Dr6=0;
		lpContext->Dr7=0;
	}
	return ret;
}

///////////////////////////////////////
void CHook::DestroyDetours( )
{
	UnHook( o_CG_SendCommandToConsole, h_CG_SendCommandToConsole );
	UnHook( o_RE_EndFrame, h_RE_EndFrame );
	UnHook( o_CG_Obituary, h_CG_Obituary );

	DetourRemove((PBYTE)GetTickCount, (PBYTE)GetTickCount_Detour);
	DetourRemoveWithTrampoline((PBYTE)GetThreadContext_Trampoline, (PBYTE)GetThreadContext_Detour);
	DetourRemoveWithTrampoline((PBYTE)SetUnhandledExceptionFilter_Trampoline, (PBYTE)hSetUnhandledExceptionFilter);
}
///////////////////////////////////////
bool APIENTRY DllMain( HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
{
	switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		{
			MessageBox( HWND_DESKTOP, "This hack is in beta and may have some bugs. Do you wish to continue?", "IHaxYou CoD4 VIP", MB_YESNO     );
			GetModuleFileName( hModule, dlldir, 512 );

			for( int i = strlen( dlldir ); i > 0; i-- ) 
			{
				if( dlldir[i] == '\\' ) 
				{ 
					dlldir[i+1] = 0; 
					break;
				}
			}


			// Store original opcodes under GetTickCount()
			ReadProcessMemory(GetCurrentProcess(), (LPVOID)GetProcAddress(GetModuleHandle("Kernel32"),"GetTickCount"),&opcodes,5,0);
									
			// Hijack GetTickCount to jmp to our GetTickCount_Detour 
			DetourFunction((PBYTE)GetTickCount, (PBYTE)GetTickCount_Detour);

			// Hijack also GetThreadContext() to hide debug-registers altering
			DetourFunctionWithTrampoline((PBYTE)GetThreadContext_Trampoline, (PBYTE)GetThreadContext_Detour);

			// SetUnhandledExceptionFilter
			DetourFunctionWithTrampoline((PBYTE)SetUnhandledExceptionFilter_Trampoline, (PBYTE)hSetUnhandledExceptionFilter);

			// Load Settings
			Settings.Load();

			break;
		}
	}
	return true;
}
///////////////////////////////////////
CompileLog
Code:
1>.\Hook_CoD4.cpp(37) : error C2143: syntax error : missing ')' before '__stdcall'
1>.\Hook_CoD4.cpp(37) : error C2143: syntax error : missing ';' before '__stdcall'
1>.\Hook_CoD4.cpp(37) : error C2079: 'BOOL' uses undefined struct '_DETOUR_TRAMPOLINE'
1>.\Hook_CoD4.cpp(37) : error C2377: 'BOOL' : redefinition; typedef cannot be overloaded with any other symbol
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windef.h(153) : see declaration of 'BOOL'
1>.\Hook_CoD4.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(37) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(37) : error C2365: 'GetThreadContext' : redefinition; previous definition was 'function'
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(4013) : see declaration of 'GetThreadContext'
1>.\Hook_CoD4.cpp(38) : error C2146: syntax error : missing ')' before identifier 'SetUnhandledExceptionFilter_Trampoline'
1>.\Hook_CoD4.cpp(38) : error C2146: syntax error : missing ';' before identifier 'SetUnhandledExceptionFilter_Trampoline'
1>.\Hook_CoD4.cpp(38) : error C2079: 'LPTOP_LEVEL_EXCEPTION_FILTER' uses undefined struct '_DETOUR_TRAMPOLINE'
1>.\Hook_CoD4.cpp(38) : error C2377: 'LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition; typedef cannot be overloaded with any other symbol
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(3499) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(38) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(38) : error C2365: 'SetUnhandledExceptionFilter' : redefinition; previous definition was 'function'
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(3504) : see declaration of 'SetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(42) : error C2146: syntax error : missing ';' before identifier 'oldHandler'
1>.\Hook_CoD4.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(42) : error C2086: 'int LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition
1>        .\Hook_CoD4.cpp(38) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(71) : error C2440: '=' : cannot convert from 'LPTOP_LEVEL_EXCEPTION_FILTER' to 'int'
1>        There is no context in which this conversion is possible
1>.\Hook_CoD4.cpp(134) : error C2146: syntax error : missing ';' before identifier 'hSetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(134) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(134) : error C2086: 'int LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition
1>        .\Hook_CoD4.cpp(38) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(134) : error C2146: syntax error : missing ')' before identifier 'arg1'
1>.\Hook_CoD4.cpp(134) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(134) : error C2365: 'hSetUnhandledExceptionFilter' : redefinition; previous definition was 'function'
1>        .\Hook_CoD4.cpp(35) : see declaration of 'hSetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(134) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(135) : error C2143: syntax error : missing ';' before '{'
1>.\Hook_CoD4.cpp(135) : error C2447: '{' : missing function header (old-style formal list?)
1>.\Hook_CoD4.cpp(142) : error C2143: syntax error : missing ';' before '__stdcall'
1>.\Hook_CoD4.cpp(142) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(142) : error C2086: 'int BOOL' : redefinition
1>        .\Hook_CoD4.cpp(37) : see declaration of 'BOOL'
1>.\Hook_CoD4.cpp(143) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(145) : error C2146: syntax error : missing ';' before identifier 'ret'
1>.\Hook_CoD4.cpp(145) : error C2065: 'ret' : undeclared identifier
1>.\Hook_CoD4.cpp(156) : error C2065: 'ret' : undeclared identifier
1>.\Hook_CoD4.cpp(167) : error C3861: 'DetourRemoveWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(168) : error C3861: 'DetourRemoveWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(197) : error C3861: 'DetourFunctionWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(200) : error C3861: 'DetourFunctionWithTrampoline': identifier not found
Errors start from the start of the code I posted.
When you have syntax errors you're probably missing one ';' or ')' somewhere to fix things like this, given the size of your snippet, I'd load it into a better ide (like notepad++) It'll show you where you're missing a ';' or '{'
Quote Originally Posted by IHaxYou! View Post
I really need some help with my hook.
I have been working on this for weeks/months (Whole hack not just this one snippet)
So please can you help me fix some of the stuff I have done wrong.

Code:
DETOUR_TRAMPOLINE(BOOL WINAPI GetThreadContext_Trampoline(HANDLE ,LPCONTEXT), GetThreadContext);
DETOUR_TRAMPOLINE(LPTOP_LEVEL_EXCEPTION_FILTER SetUnhandledExceptionFilter_Trampoline(LPTOP_LEVEL_EXCEPTION_FILTER), SetUnhandledExceptionFilter);

// Function defines
void Set_SEH_and_BreakPoints(void);				// Set the SEH and breakpoints
LPTOP_LEVEL_EXCEPTION_FILTER oldHandler = NULL;	// Pointer to existing exception handler

// Global variables
DWORD	dwBreakPoint1		=	0x00463F50;		// BREAKPOINT: CL_WritePacket
DWORD	dwBreakPoint2		= 	0x004F9AB0;		// BREAKPOINT: SendCommandToConsole
DWORD	dwBreakPoint3		= 	0x0042C010;		// BREAKPOINT: R_EndFrame
DWORD	dwBreakPoint4		=	0x00435620;		// BREAKPOINT: CG_Obituary

BYTE	opcodes[5];								// Original opcodes in GetTickCount() entry-point to be stored for restoring

// Hijacked GetTickCount. This is called when target-app (Notepad) is calling GetTickCount()
DWORD WINAPI GetTickCount_Detour()
{
	// From here we add our Structured Exception Handler
	// We can't add it in the DLLmain since that function is called in 
	// different thread-context and the SEH and Breakpoints are per thread basis
	Set_SEH_and_BreakPoints();

	// Return original bytes to GetTickCount() i.e. unhook it. We only need this "callback" once.
	WriteProcessMemory(GetCurrentProcess(),(LPVOID)GetProcAddress(GetModuleHandle("Kernel32"),"GetTickCount"),&opcodes,5,0);

	// Return actual function result
	return GetTickCount();
}

// Add the SEH-handler and set HW-breakpoint(s)
void Set_SEH_and_BreakPoints()
{
	// Store existing handler to global variable to reset later
	oldHandler = SetUnhandledExceptionFilter(UnhandlerExceptionFilter);
	
	// Set debug-registers for HW-breakpoint and activate it
	CONTEXT ctx = {CONTEXT_DEBUG_REGISTERS};
	ctx.Dr6 = 0x00000000;

	ctx.Dr0 = dwBreakPoint1;	// Set Address of Breakpoint 1
	ctx.Dr1 = dwBreakPoint2;	// Set Address of Breakpoint 2
	ctx.Dr2 = dwBreakPoint3;	// Set Address of Breakpoint 3
	ctx.Dr3 = dwBreakPoint4;	// Set Address of Breakpoint 3
	ctx.Dr7 = (1<<0)|(1<<2)|(1<<4)|(1<<6);   

	// Write the values to registers. From now on the breakpoint is active 
	SetThreadContext(GetCurrentThread(), &ctx); 
}

// Our ExceptionHandler
// study the ExceptionInfo-struct for stuff you need
LONG WINAPI UnhandlerExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo)
{
    if(ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP) 
    {
		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint1)  
        {
			oCL_WritePacket = Hook(dwBreakPoint1, hCL_WritePacket, tCL_WritePacket);
			ExceptionInfo->ContextRecord->Eip = (DWORD)hCL_WritePacket;
			DetourRemove((PBYTE)oCL_WritePacket, (PBYTE)hCL_WritePacket);

            return EXCEPTION_CONTINUE_EXECUTION;
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint2)  
        {
			o_CG_SendCommandToConsole = Hook( dwBreakPoint2, h_CG_SendCommandToConsole, t_CG_SendCommandToConsole);
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_CG_SendCommandToConsole;
			DetourRemove((PBYTE)o_CG_SendCommandToConsole, (PBYTE)h_CG_SendCommandToConsole);

            return EXCEPTION_CONTINUE_EXECUTION;  
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint3) 
        {
			o_RE_EndFrame = Hook( dwBreakPoint3, h_RE_EndFrame, void (__fastcall *)());
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_RE_EndFrame;
			DetourRemove((PBYTE)o_RE_EndFrame, (PBYTE)h_RE_EndFrame);

            return EXCEPTION_CONTINUE_EXECUTION; 
        }

		if((DWORD)ExceptionInfo->ExceptionRecord->ExceptionAddress == dwBreakPoint4)  
        {
			o_CG_Obituary = Hook( dwBreakPoint4, h_CG_Obituary, t_CG_Obituary);
			ExceptionInfo->ContextRecord->Eip = (DWORD)h_CG_Obituary;
			DetourRemove((PBYTE)o_CG_Obituary, (PBYTE)h_CG_Obituary);

            return EXCEPTION_CONTINUE_EXECUTION; 
        }
    }
    // Some other exception occurred. Pass it to next handler 
    return EXCEPTION_CONTINUE_SEARCH; 
}

// SetUnhandledExceptionFilter
LPTOP_LEVEL_EXCEPTION_FILTER hSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER arg1)
{
	return SetUnhandledExceptionFilter_Trampoline(UnhandlerExceptionFilter);
}

// Hijacked GetThreadContext(). We don't actually need this in our notepad-example
// I included it just for help since for a real hack you need to fake 
// DEBUG-registers so that the game doesn't see they that are altered
BOOL WINAPI GetThreadContext_Detour (HANDLE hThread,LPCONTEXT lpContext)
{
	// Get the Real values from original API-function (see the _trampoline)
	BOOL ret = GetThreadContext_Trampoline( hThread, lpContext);

	// If target is interested in Debug-registers return fake values 
	if (lpContext->ContextFlags && CONTEXT_DEBUG_REGISTERS) {
		lpContext->Dr0=0;
		lpContext->Dr1=0;
		lpContext->Dr2=0;
		lpContext->Dr3=0;
		lpContext->Dr6=0;
		lpContext->Dr7=0;
	}
	return ret;
}

///////////////////////////////////////
void CHook::DestroyDetours( )
{
	UnHook( o_CG_SendCommandToConsole, h_CG_SendCommandToConsole );
	UnHook( o_RE_EndFrame, h_RE_EndFrame );
	UnHook( o_CG_Obituary, h_CG_Obituary );

	DetourRemove((PBYTE)GetTickCount, (PBYTE)GetTickCount_Detour);
	DetourRemoveWithTrampoline((PBYTE)GetThreadContext_Trampoline, (PBYTE)GetThreadContext_Detour);
	DetourRemoveWithTrampoline((PBYTE)SetUnhandledExceptionFilter_Trampoline, (PBYTE)hSetUnhandledExceptionFilter);
}
///////////////////////////////////////
bool APIENTRY DllMain( HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
{
	switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		{
			MessageBox( HWND_DESKTOP, "This hack is in beta and may have some bugs. Do you wish to continue?", "IHaxYou CoD4 VIP", MB_YESNO     );
			GetModuleFileName( hModule, dlldir, 512 );

			for( int i = strlen( dlldir ); i > 0; i-- ) 
			{
				if( dlldir[i] == '\\' ) 
				{ 
					dlldir[i+1] = 0; 
					break;
				}
			}


			// Store original opcodes under GetTickCount()
			ReadProcessMemory(GetCurrentProcess(), (LPVOID)GetProcAddress(GetModuleHandle("Kernel32"),"GetTickCount"),&opcodes,5,0);
									
			// Hijack GetTickCount to jmp to our GetTickCount_Detour 
			DetourFunction((PBYTE)GetTickCount, (PBYTE)GetTickCount_Detour);

			// Hijack also GetThreadContext() to hide debug-registers altering
			DetourFunctionWithTrampoline((PBYTE)GetThreadContext_Trampoline, (PBYTE)GetThreadContext_Detour);

			// SetUnhandledExceptionFilter
			DetourFunctionWithTrampoline((PBYTE)SetUnhandledExceptionFilter_Trampoline, (PBYTE)hSetUnhandledExceptionFilter);

			// Load Settings
			Settings.Load();

			break;
		}
	}
	return true;
}
///////////////////////////////////////
CompileLog
Code:
1>.\Hook_CoD4.cpp(37) : error C2143: syntax error : missing ')' before '__stdcall'
1>.\Hook_CoD4.cpp(37) : error C2143: syntax error : missing ';' before '__stdcall'
1>.\Hook_CoD4.cpp(37) : error C2079: 'BOOL' uses undefined struct '_DETOUR_TRAMPOLINE'
1>.\Hook_CoD4.cpp(37) : error C2377: 'BOOL' : redefinition; typedef cannot be overloaded with any other symbol
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windef.h(153) : see declaration of 'BOOL'
1>.\Hook_CoD4.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(37) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(37) : error C2365: 'GetThreadContext' : redefinition; previous definition was 'function'
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(4013) : see declaration of 'GetThreadContext'
1>.\Hook_CoD4.cpp(38) : error C2146: syntax error : missing ')' before identifier 'SetUnhandledExceptionFilter_Trampoline'
1>.\Hook_CoD4.cpp(38) : error C2146: syntax error : missing ';' before identifier 'SetUnhandledExceptionFilter_Trampoline'
1>.\Hook_CoD4.cpp(38) : error C2079: 'LPTOP_LEVEL_EXCEPTION_FILTER' uses undefined struct '_DETOUR_TRAMPOLINE'
1>.\Hook_CoD4.cpp(38) : error C2377: 'LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition; typedef cannot be overloaded with any other symbol
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(3499) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(38) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(38) : error C2365: 'SetUnhandledExceptionFilter' : redefinition; previous definition was 'function'
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h(3504) : see declaration of 'SetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(42) : error C2146: syntax error : missing ';' before identifier 'oldHandler'
1>.\Hook_CoD4.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(42) : error C2086: 'int LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition
1>        .\Hook_CoD4.cpp(38) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(42) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(71) : error C2440: '=' : cannot convert from 'LPTOP_LEVEL_EXCEPTION_FILTER' to 'int'
1>        There is no context in which this conversion is possible
1>.\Hook_CoD4.cpp(134) : error C2146: syntax error : missing ';' before identifier 'hSetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(134) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(134) : error C2086: 'int LPTOP_LEVEL_EXCEPTION_FILTER' : redefinition
1>        .\Hook_CoD4.cpp(38) : see declaration of 'LPTOP_LEVEL_EXCEPTION_FILTER'
1>.\Hook_CoD4.cpp(134) : error C2146: syntax error : missing ')' before identifier 'arg1'
1>.\Hook_CoD4.cpp(134) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(134) : error C2365: 'hSetUnhandledExceptionFilter' : redefinition; previous definition was 'function'
1>        .\Hook_CoD4.cpp(35) : see declaration of 'hSetUnhandledExceptionFilter'
1>.\Hook_CoD4.cpp(134) : error C2059: syntax error : ')'
1>.\Hook_CoD4.cpp(135) : error C2143: syntax error : missing ';' before '{'
1>.\Hook_CoD4.cpp(135) : error C2447: '{' : missing function header (old-style formal list?)
1>.\Hook_CoD4.cpp(142) : error C2143: syntax error : missing ';' before '__stdcall'
1>.\Hook_CoD4.cpp(142) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(142) : error C2086: 'int BOOL' : redefinition
1>        .\Hook_CoD4.cpp(37) : see declaration of 'BOOL'
1>.\Hook_CoD4.cpp(143) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\Hook_CoD4.cpp(145) : error C2146: syntax error : missing ';' before identifier 'ret'
1>.\Hook_CoD4.cpp(145) : error C2065: 'ret' : undeclared identifier
1>.\Hook_CoD4.cpp(156) : error C2065: 'ret' : undeclared identifier
1>.\Hook_CoD4.cpp(167) : error C3861: 'DetourRemoveWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(168) : error C3861: 'DetourRemoveWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(197) : error C3861: 'DetourFunctionWithTrampoline': identifier not found
1>.\Hook_CoD4.cpp(200) : error C3861: 'DetourFunctionWithTrampoline': identifier not found
Errors start from the start of the code I posted.
*Problems exist in you BASE, try to correct you BASE before the first BUILD,and try to check his hook and syntax in your project ( h. )

*These examples make an accurate hook PBlackout or PointBlank

Code:
/*
  Name: Qmoainx-Project™
  Copyright: Copyright © 2002-2011. MPGH/Qmoainx. All rights reserved
  Date: 12/08/2011
*/
#include <windows.h>
#include <shlwapi.h>
#include <ddraw.h>
#include "testdll.h"
#include "syntax"
 
char temp[256];
HINSTANCE hDLL;
 
// type defs
typedef HRESULT (WINAPI *DirectDrawCreateEx_Type)( GUID FAR *lpGUID, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter );
 
// function prototypes
HRESULT WINAPI MyDirectDrawCreateEx( GUID FAR * lpGuid, LPVOID  *lplpDD, REFIID  iid,IUnknown FAR *pUnkOuter );
 
// hook structure
enum
{
    D3DFN_DirectDrawCreateEx = 0
};
 
SDLLHook D3DHook = 
{
    "DDRAW.DLL",
    false, NULL,
    {
        { "DirectDrawCreateEx", MyDirectDrawCreateEx },
        { NULL, NULL }
    }
};
 
// Hook function.
HRESULT WINAPI MyDirectDrawCreateEx(GUID FAR* lpGuid, LPVOID  *lplpDD, REFIID  iid,IUnknown FAR *pUnkOuter )
{
    DirectDrawCreateEx_Type OldFn = (DirectDrawCreateEx_Type)D3DHook.Functions[D3DFN_DirectDrawCreateEx].OrigFn;
    return OldFn( lpGuid, lplpDD, iid, pUnkOuter );
}
 
// CBT Hook-style injection.
BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved )
{
    if ( fdwReason == DLL_PROCESS_ATTACH )  // When initializing....
    {
        hDLL = hModule;
 
        // Only hook the APIs if this is the fsim proess.
        GetModuleFileName(GetModuleHandle(NULL), temp, sizeof(temp));
        PathStripPath(temp);
 
        if(stricmp(temp, "fsim.exe" ) == 0)
            HookAPICalls( &D3DHook );
    }
 
    return TRUE;
}
 
// This segment must be defined as SHARED in the .DEF
#pragma data_seg (".HookSection")           
// Shared instance for all processes.
HHOOK hHook = NULL;   
#pragma data_seg ()
 
TESTDLL_API LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam) 
{
    return CallNextHookEx( hHook, nCode, wParam, lParam); 
}
 
TESTDLL_API void InstallHook()
{
    hHook = SetWindowsHookEx(WH_CBT, HookProc, hDLL, 0); 
}
 
TESTDLL_API void RemoveHook()
{
    UnhookWindowsHookEx( hHook );
}
hopefully useful
#include "detours.h"

kthxbye
Quote Originally Posted by Nico View Post
#include "detours.h"

kthxbye
I did that before I posted this thread.
Didn't help much.
Got rid of about 2 errors.
And I've also fixed some syntax errors but there are some errors in which I don't know what to do -_-
Quote Originally Posted by master131 View Post
I know, learn C++. :3
Master, always helpful


Ontopic:
Just search for the correct includes...
Quote Originally Posted by master131 View Post
I know, learn C++. :3
I have learn't C++.
I am just not that good at remembering everything in that 800+ paged book.
Quote Originally Posted by IHaxYou! View Post
I have learn't C++.
I am just not that good at remembering everything in that 800+ paged book.
I read a 1200 page book on C++. Went back and re-read the book 2 times. I then went on to read 4 online eBooks each of 500 pages in length. 800 pages of C++ is not enough to teach you C++. I still consider myself barely advanced at C++, after all of that. I suggest learning C++ before you try and make a hack. Some of those errors are simple as balls and any idiot can fix them
Read a 200 page book and learned C++
Quote Originally Posted by Nico View Post
Read a 200 page book and learned C++
And you just code consoles for a Nexon game...
Quote Originally Posted by IHaxYou! View Post
And you just code consoles for a Nexon game...
And what do you do? Ask about syntax errors with ";" and ")"? Yea thats a whole fucking lot better
/Closed. Learn C++.
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us