Extreme Hacking | Sadik Shaikh
Ethical Hacking Institute Course in Pune-India

Hello everyone welcome back to Arizona Programming zone, today I will show you how to catch interruption signals on a Windows system and what you can do when such signals are sent to your application. Interruption signals are for example control-c, a break or shutdown event.
Its just for windows

Go through the logical flow and create a new one for yourself. If any problem in understanding the logical flow you can contact sadik.shaikh@extremehacking.org

Here is the code.

#include <windows.h>
#include <stdio.h>

/*
*
*/
BOOL APE_ControlHandler(DWORD pControlType);

int main()
{
int lRetVal = 0;

// Register the event handler
SetConsoleCtrlHandler((PHANDLER_ROUTINE) APE_ControlHandler, TRUE);

while (1)
Sleep(100);

return(lRetVal);
}

/*
*
*/
BOOL APE_ControlHandler(DWORD pControlType)
{

switch(pControlType)
{
// Handle the CTRL-C signal.
case CTRL_C_EVENT:
Beep(500, 200);
printf(“Ctrl-C event : Starting depoisoning process”);
return(FALSE);

case CTRL_CLOSE_EVENT:
Beep(600, 200);
printf(“Ctrl-Close event : Starting depoisoning process”);
return(FALSE);

case CTRL_BREAK_EVENT:
Beep(700, 200);
printf(“Ctrl-Break event : Starting depoisoning process”);
return(FALSE);

case CTRL_LOGOFF_EVENT:
Beep(800, 200);
printf(“Ctrl-Logoff event : Starting depoisoning process”);
return(FALSE);

case CTRL_SHUTDOWN_EVENT:
Beep(900, 200);
printf(“Ctrl-Shutdown event : Starting depoisoning process”);
return(FALSE);

default:
Beep(1000, 200);
printf(“Unknown event \”%d\” : Starting depoisoning process”, pControlType);
return(FALSE);
}
}

www.extremehacking.org
CEHv9 CHFI ECSAv9 CAST ENSA CCNA CCNA SECURITY MCITP RHCE CHECKPOINT ASA FIREWALL VMWARE CLOUD ANDROID IPHONE NETWORKING HARDWARE TRAINING INSTITUTE IN PUNE, Certified Ethical Hacking, Center For Advanced Security Training in India, ceh v9 course in Pune-India, ceh certification in pune-India, ceh v9 training in Pune-India, Ethical Hacking Course in Pune-India