MCPcopy Create free account
hub / github.com/mhammond/pywin32 / DebugControlHandler

Function DebugControlHandler

win32/src/PythonService.cpp:1027–1049  ·  view source on GitHub ↗

When debugging, a console event handler that simulates a service stop control.

Source from the content-addressed store, hash-verified

1025// When debugging, a console event handler that simulates a service
1026// stop control.
1027BOOL WINAPI DebugControlHandler ( DWORD dwCtrlType )
1028{
1029 switch( dwCtrlType )
1030 {
1031 case CTRL_BREAK_EVENT: // use Ctrl+C or Ctrl+Break to simulate
1032 case CTRL_C_EVENT: // SERVICE_CONTROL_STOP in debug mode
1033 {
1034 _tprintf(TEXT("Stopping debug service.\n"));
1035 // simulate a stop even to each service
1036 PY_SERVICE_TABLE_ENTRY *ppy = PythonServiceTable;
1037 SERVICE_TABLE_ENTRY *ps = DispatchTable;
1038 while (ps->lpServiceName) {
1039 service_ctrl_ex(SERVICE_CONTROL_STOP, 0, NULL, ppy);
1040 ppy++;
1041 ps++;
1042 }
1043 return TRUE;
1044 break;
1045 }
1046
1047 }
1048 return FALSE;
1049}
1050
1051/*************************************************************************
1052 *

Callers

nothing calls this directly

Calls 1

service_ctrl_exFunction · 0.85

Tested by

no test coverage detected