Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. dbgloop.c
  5. Abstract:
  6. Debug Subsystem Listen and API loops
  7. Author:
  8. Mark Lucovsky (markl) 04-Oct-1989
  9. Revision History:
  10. --*/
  11. #include "smsrvp.h"
  12. EXCEPTION_DISPOSITION
  13. DbgpUnhandledExceptionFilter(
  14. struct _EXCEPTION_POINTERS *ExceptionInfo
  15. )
  16. {
  17. UNICODE_STRING UnicodeParameter;
  18. ULONG_PTR Parameters[ 4 ];
  19. ULONG Response;
  20. BOOLEAN WasEnabled;
  21. NTSTATUS Status;
  22. //
  23. // Terminating will cause sm's wait to sense that we crashed. This will
  24. // result in a clean shutdown due to sm's hard error logic.
  25. //
  26. Status = RtlAdjustPrivilege( SE_SHUTDOWN_PRIVILEGE,
  27. (BOOLEAN)TRUE,
  28. TRUE,
  29. &WasEnabled
  30. );
  31. if (Status == STATUS_NO_TOKEN) {
  32. //
  33. // No thread token, use the process token.
  34. //
  35. Status = RtlAdjustPrivilege( SE_SHUTDOWN_PRIVILEGE,
  36. (BOOLEAN)TRUE,
  37. FALSE,
  38. &WasEnabled
  39. );
  40. }
  41. RtlInitUnicodeString( &UnicodeParameter, L"Session Manager" );
  42. Parameters[ 0 ] = (ULONG_PTR)&UnicodeParameter;
  43. Parameters[ 1 ] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionCode;
  44. Parameters[ 2 ] = (ULONG_PTR)ExceptionInfo->ExceptionRecord->ExceptionAddress;
  45. Parameters[ 3 ] = (ULONG_PTR)ExceptionInfo->ContextRecord;
  46. Status = NtRaiseHardError( STATUS_SYSTEM_PROCESS_TERMINATED,
  47. 4,
  48. 1,
  49. Parameters,
  50. OptionShutdownSystem,
  51. &Response
  52. );
  53. //
  54. // If this returns, give up.
  55. //
  56. NtTerminateProcess(NtCurrentProcess(),ExceptionInfo->ExceptionRecord->ExceptionCode);
  57. return EXCEPTION_EXECUTE_HANDLER;
  58. }