Home > Back-end >  Set the hook in the dynamic link library, in the process of A dynamic link library reference hooks t
Set the hook in the dynamic link library, in the process of A dynamic link library reference hooks t

Time:11-20

/* */
in the dynamic link libraryHHOOK g_CbtHook=NULL;
HMOUDLE HMOUDLE=NULL;

DLLMAIN (a,)
{
.
DLL_ATTACH:
Hmoudle=a;
break;
.
}

LRESULT a CALLBACK CbtProc (,,)
{
Return CallNextHook ();
}



SetHook (LPWSTR ProcessName)
{
DwProcessId=GetprocessIdByName (ProcessName);//success find out the process ID

G_CbtHook=SetWindowsHookEx (WH_CBT CbtProc, hmoudle, dwProcessId);
Int a=GetLastError ();// this error to 87
}
  • Related