#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    1
    Rep Power
    0

    API Hooking Newbie


    Ok i am new to API Hooking in C, so i wanted to try out something i have never done before, i have some knowledge of C so i wanted to see how good i can get with this

    here is my code
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    DWORD HookFunction(LPCSTR lpModule, LPCSTR lpFuncName, LPVOID lpFunction, unsigned char *lpBackup,LPCSTR LpProcess);
    BOOL UnHookFunction(LPCSTR lpModule, LPCSTR lpFuncName, unsigned char *lpBackup,LPCSTR LpProcess);
    int MyMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
    
    
    DWORD HookFunction(LPCSTR LpProcess)
    
    if (LpProcess == "notepad.exe")
    	{
    	   DWORD HookFunction(LPCSTR lpModule, LPCSTR lpFuncName, LPVOID lpFunction, unsigned char *lpBackup,LPCSTR LpProcess);
    	   DWORD dwAddr = (DWORD)GetProcAddress(GetModuleHandle(lpModule),lpFuncName);
    	   printf("I Have Hooked You!");
    	   return 0;
    	}
    Now i get this error

    Code:
    1>------ Build started: Project: StarProject, Configuration: Debug Win32 ------
    1>Build started 07/11/2013 13:11:37.
    1>InitializeBuildStatus:
    1>  Touching "Debug\StarProject.unsuccessfulbuild".
    1>ClCompile:
    1>  Hookme.c
    1>c:\users\spaxxxpc\desktop\formgrabproject\starproject\starproject\hookme.c(9): error C2059: syntax error : 'if'
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:01.60
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    i dont have an idea what is wrong, what could go wrong?
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,889
    Rep Power
    481
    Look for BuildLog.htm which may be

    2/or/3/levels/down/BuildLog.htm


    Absolute guess here. It may contain details.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    187
    Rep Power
    82
    Chen's response from this thread is the correct answer to your problem.

    Comments on this post

    • salem agrees

IMN logo majestic logo threadwatch logo seochat tools logo