New API hooking in C
Nov 7, 2013 at 12:50pm UTC
Ok i started to new coding with C, so i decided to code something
So lets begin, i started of with this code.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <windows.h>
#include <stdio.h>
DWORD HookFunction(LPCSTR lpModule, LPCSTR lpFuncName, LPVOID lpFunction, unsigned char *lpBackup, LPCSRTR lpProccessName);
BOOL UnHookFunction(LPCSTR lpModule, LPCSTR lpFuncName, unsigned char *lpBackup); int MyMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
If (lpProcessName == "notepad.exe" ) {
DWORD HookFunction(LPCSTR lpModule, LPCSTR lpFuncName, LPVOID lpFunction, unsigned char *lpBackup,LPCSTR lpProcessName) {
DWORD dwAddr = (DWORD)GetProcAddress(GetModuleHandle("kernel32.dll" ), "GetProcAddress" );
printf("Hook successful" );
}
}
Kindly assist me as soon as possible, i am quite new to API programming
Nov 7, 2013 at 10:25pm UTC
DWORD dwAddr = (DWORD)GetProcAddress(GetModuleHandle("kernel32.dll" ), "GetProcAddress" );
Let's pretend for a moment that this isn't inside of an if statement that is in the global scope. Do you actually know what this line of code is meant for compared to what you have it doing?
Nov 7, 2013 at 10:44pm UTC
Huh...
Do you actually know what hooking is?
Nov 7, 2013 at 10:56pm UTC
i am quite new to API programming
no your not. the standard c library and the stl are both apis. i think you meant you are new to the windows api and or hooking
Topic archived. No new replies allowed.