i was trying one of the examples in the documantation to be precisely this one http://help.madshi.net/ProcessApi.htm .
I am working on VS 2010 my os windows 10 obviously trying to run the example on c++ and i am with the latest version of madCodeHook
so here is the code i am trying to run
Code: Select all
#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include "madCHook.h"
#include <WinDef.h>
#include <exception>
#include <iostream>
using namespace std;
UINT (WINAPI *WinExecNextHook) (LPCSTR cmdLine, UINT showCmd);
UINT WINAPI WinExecHookProc(LPCSTR cmdLine,UINT showCmd)
{
if(MessageBox(0,cmdLine, "Executet?", MB_YESNO | MB_ICONQUESTION)==IDYES)
{
return WinExecNextHook(cmdLine, showCmd);
}
else
{
return ERROR_ACCESS_DENIED;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
HookAPI( "kernel32.dll", "WinExec", WinExecHookProc, (PVOID*)&WinExecNextHook );
WinExec("notepad.exe", SW_SHOWNORMAL);
UnhookAPI((PVOID*) &WinExecNextHook);
return 0;
}
and here is the error which occure when run
Unhandled exception at 0x77866d79 in FIRSTTESTWITHMADHOOKS.exe: 0xC0000005: Access violation writing location 0x00000014.
also here is the output
Code: Select all
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'E:\Projects\FIRSTTESTWITHMADHOOKS\Debug\FIRSTTESTWITHMADHOOKS.exe', Symbols loaded.
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\combase.dll', Cannot find or open the PDB file
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'FIRSTTESTWITHMADHOOKS.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
First-chance exception at 0x77866d79 in FIRSTTESTWITHMADHOOKS.exe: 0xC0000005: Access violation writing location 0x00000014.
Unhandled exception at 0x77866d79 in FIRSTTESTWITHMADHOOKS.exe: 0xC0000005: Access violation writing location 0x00000014.
The program '[5620] FIRSTTESTWITHMADHOOKS.exe: Native' has exited with code 0 (0x0).