There are 5 errorsCode:#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <shlwapi.h> #include "ddraw.h" #include "testdll.h" #include "..\apihijack.h" // Text buffer for sprintf char Work[256]; HINSTANCE hDLL; // Function pointer types. typedef DWORD (WINAPI *GetVersion_Type)( void ); typedef BOOL (WINAPI *GetVersionExA_Type)( LPOSVERSIONINFO lpVersionInfo ); // Function prototypes. DWORD WINAPI MyGetVersion( void ); BOOL WINAPI MyGetVersionEx( LPOSVERSIONINFO lpVersionInfo ); // Hook structure. enum { gFN_GetVersion = 0, gFN_GetVersionExA = 1 }; SDLLHook gHook = { "KERNEL32.DLL", false, NULL, // Default hook disabled, NULL function pointer. { { "GetVersion", MyGetVersion }, { "GetVersionExA", MyGetVersionEx }, { NULL, NULL } } }; // Hook functions. DWORD WINAPI MyGetVersion( void ) { // Let the world know we're working. MessageBeep( MB_ICONINFORMATION ); OutputDebugString( "TESTDLL: MyGetVersion called.\n" ); GetVersion_Type OldFn = (GetVersion_Type)gHook.Functions[gFN_GetVersion].OrigFn; return OldFn(); } BOOL WINAPI MyGetVersionEx( LPOSVERSIONINFO lpVersionInfo ) { // Let the world know we're working. MessageBeep( MB_ICONINFORMATION ); OutputDebugString( "TESTDLL: MyGetVersionEx called.\n" ); GetVersionExA_Type OldFn = (GetVersionExA_Type)gHook.Functions[gFN_GetVersionExA].OrigFn; return OldFn( lpVersionInfo ); } // CBT Hook-style injection. BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD fdwReason, LPVOID lpReserved ) { if ( fdwReason == DLL_PROCESS_ATTACH ) // When initializing.... { hDLL = hModule; // We don't need thread notifications for what we're doing. Thus, get // rid of them, thereby eliminating some of the overhead of this DLL DisableThreadLibraryCalls( hModule ); // Only hook the APIs if this is the Everquest proess. GetModuleFileName( GetModuleHandle( NULL ), Work, sizeof(Work) ); PathStripPath( Work ); OutputDebugString( "TESTDLL checking process: " ); OutputDebugString( Work ); OutputDebugString( "\n" ); if ( stricmp( Work, "BF2_EditorSetup_Jan04.exe" ) == 0 ) HookAPICalls( &gHook ); } 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() { OutputDebugString( "TESTDLL hook installed.\n" ); hHook = SetWindowsHookEx( WH_CBT, HookProc, hDLL, 0 ); } TESTDLL_API void RemoveHook() { OutputDebugString( "TESTDLL hook removed.\n" ); UnhookWindowsHookEx( hHook ); }
Line 37:excess elements in aggregate initialzier
Line 97:function 'LRESULT HookProc(int, WPARAM,LPARAM)' definition is marked dllimport
Line 102:function 'void InstallHook()' definition is marked dllimport
Line 108:fucntion 'void RemoveHook()' definition is marked dllimport
[Build Error] [dllmain.o] Error 1
i did not write this thus I do not take credit for it, it is hijacking the GetVersionExA from a install file I am trying to isntall but it was made before winxpx64 came out thus, the version numbers are not up to date so this will let it install, i would contact the writer of the dll, ubt alas, he is not online.
Any help would be greatly appreciated. Any other needed information I will be hjappy to give, the ddraw.h is in "" because I had to copy->paste it into the project folder to get detected.