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.

150 lines
2.3 KiB

  1. #include "stdafx.h"
  2. #include "EvenHand.h"
  3. #include "SvcObjDef.h"
  4. STDMETHODIMP_(ULONG)
  5. EventCallbacks::AddRef(
  6. THIS
  7. )
  8. {
  9. // This class is designed to be static so
  10. // there's no true refcount.
  11. return 1;
  12. }
  13. STDMETHODIMP_(ULONG)
  14. EventCallbacks::Release(
  15. THIS
  16. )
  17. {
  18. // This class is designed to be static so
  19. // there's no true refcount.
  20. return 0;
  21. }
  22. STDMETHODIMP
  23. EventCallbacks::GetInterestMask(
  24. THIS_
  25. OUT PULONG Mask
  26. )
  27. {
  28. *Mask =
  29. // DEBUG_EVENT_CHANGE_DEBUGGEE_STATE |
  30. DEBUG_EVENT_EXIT_PROCESS |
  31. DEBUG_EVENT_CHANGE_ENGINE_STATE |
  32. DEBUG_EVENT_EXCEPTION |
  33. DEBUG_EVENT_SESSION_STATUS;
  34. return S_OK;
  35. }
  36. #if 0
  37. #define DBG_CALLBACK
  38. #endif
  39. // Symbol state has changed.
  40. STDMETHODIMP
  41. EventCallbacks::ChangeSymbolState(
  42. THIS_
  43. IN ULONG Flags,
  44. IN ULONG64 Argument
  45. )
  46. {
  47. return S_OK;
  48. }
  49. STDMETHODIMP
  50. EventCallbacks::SessionStatus(
  51. THIS_
  52. IN ULONG Status
  53. )
  54. {
  55. if (Status & DEBUG_SESSION_HIBERNATE)
  56. {
  57. // MessageBox(NULL, _T("Debuggee stopped"), _T("STop"), MB_OK);
  58. }
  59. if (Status & DEBUG_SESSION_END)
  60. {
  61. // MessageBox(NULL, _T("Debuggee stopped"), _T("STop"), MB_OK);
  62. }
  63. return DEBUG_STATUS_NO_CHANGE;
  64. }
  65. STDMETHODIMP
  66. EventCallbacks::ChangeDebuggeeState(
  67. THIS_
  68. IN ULONG Flags,
  69. IN ULONG64 Argument
  70. )
  71. {
  72. return S_OK;
  73. }
  74. STDMETHODIMP
  75. EventCallbacks::ChangeEngineState(
  76. THIS_
  77. IN ULONG Flags,
  78. IN ULONG64 Argument
  79. )
  80. {
  81. ULONG InvFlags = 0;
  82. if (Flags & DEBUG_CES_EXECUTION_STATUS)
  83. {
  84. // if(Argument == DEBUG_STATUS_NO_DEBUGGEE)
  85. // MessageBox(NULL, _T("Debuggee stopped"), _T("STop"), MB_OK);
  86. }
  87. return S_OK;
  88. }
  89. STDMETHODIMP
  90. EventCallbacks::Exception(
  91. THIS_
  92. IN PEXCEPTION_RECORD64 pException,
  93. IN ULONG FirstChance
  94. )
  95. {
  96. DWORD excpcd = pException->ExceptionCode;
  97. do
  98. {
  99. if( excpcd == STATUS_BREAKPOINT ) break;
  100. /*
  101. if( excpcd == EXCEPTION_BREAKPOINT ||
  102. excpcd == EXCEPTION_ACCESS_VIOLATION){
  103. }
  104. */
  105. {
  106. m_pEMThread->eDBGServie = DBGService_HandleException;
  107. m_pEMThread->OnException(pException);
  108. }
  109. }
  110. while(FALSE);
  111. return DEBUG_STATUS_NO_CHANGE;
  112. }
  113. STDMETHODIMP
  114. EventCallbacks::Breakpoint(
  115. THIS_
  116. IN PDEBUG_BREAKPOINT Bp
  117. )
  118. {
  119. return 0L;
  120. }
  121. STDMETHODIMP
  122. EventCallbacks::ExitProcess(
  123. THIS_
  124. IN ULONG ExitCode
  125. )
  126. {
  127. // MessageBox(NULL, _T("Process Exit"), _T("STop"), MB_OK);
  128. m_pEMThread->OnProcessExit(ExitCode);
  129. return 0L;
  130. }