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.

67 lines
1.5 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // IDebugAdvanced implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999-2000.
  6. //
  7. //----------------------------------------------------------------------------
  8. #include "ntsdp.hpp"
  9. STDMETHODIMP
  10. DebugClient::GetThreadContext(
  11. THIS_
  12. OUT PVOID Context,
  13. IN ULONG ContextSize
  14. )
  15. {
  16. if (!IS_MACHINE_ACCESSIBLE())
  17. {
  18. return E_UNEXPECTED;
  19. }
  20. HRESULT Status;
  21. ENTER_ENGINE();
  22. if ((Status = g_Machine->GetContextState(MCTX_FULL)) == S_OK)
  23. {
  24. Status = g_Machine->ConvertContextTo(&g_Machine->m_Context,
  25. g_SystemVersion, ContextSize,
  26. Context);
  27. }
  28. LEAVE_ENGINE();
  29. return Status;
  30. }
  31. STDMETHODIMP
  32. DebugClient::SetThreadContext(
  33. THIS_
  34. IN PVOID Context,
  35. IN ULONG ContextSize
  36. )
  37. {
  38. if (!IS_MACHINE_ACCESSIBLE())
  39. {
  40. return E_UNEXPECTED;
  41. }
  42. HRESULT Status;
  43. ENTER_ENGINE();
  44. if ((Status = g_Machine->GetContextState(MCTX_DIRTY)) == S_OK)
  45. {
  46. Status = g_Machine->ConvertContextFrom(&g_Machine->m_Context,
  47. g_SystemVersion, ContextSize,
  48. Context);
  49. if (Status == S_OK)
  50. {
  51. NotifyChangeDebuggeeState(DEBUG_CDS_REGISTERS, DEBUG_ANY_ID);
  52. }
  53. }
  54. LEAVE_ENGINE();
  55. return Status;
  56. }