Leaked source code of windows server 2003
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.

65 lines
1.6 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // IDebugAdvanced implementation.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999-2002.
  6. //
  7. //----------------------------------------------------------------------------
  8. #include "ntsdp.hpp"
  9. STDMETHODIMP
  10. DebugClient::GetThreadContext(
  11. THIS_
  12. OUT PVOID Context,
  13. IN ULONG ContextSize
  14. )
  15. {
  16. HRESULT Status;
  17. ENTER_ENGINE();
  18. if (!IS_CUR_MACHINE_ACCESSIBLE())
  19. {
  20. Status = E_UNEXPECTED;
  21. }
  22. else if ((Status = g_Machine->GetContextState(MCTX_FULL)) == S_OK)
  23. {
  24. Status = g_Machine->ConvertContextTo(&g_Machine->m_Context,
  25. g_Target->m_SystemVersion,
  26. ContextSize, 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. HRESULT Status;
  39. ENTER_ENGINE();
  40. if (!IS_CUR_MACHINE_ACCESSIBLE())
  41. {
  42. Status = E_UNEXPECTED;
  43. }
  44. else if ((Status = g_Machine->GetContextState(MCTX_DIRTY)) == S_OK)
  45. {
  46. Status = g_Machine->ConvertContextFrom(&g_Machine->m_Context,
  47. g_Target->m_SystemVersion,
  48. ContextSize, Context);
  49. if (Status == S_OK)
  50. {
  51. NotifyChangeDebuggeeState(DEBUG_CDS_REGISTERS, DEBUG_ANY_ID);
  52. }
  53. }
  54. LEAVE_ENGINE();
  55. return Status;
  56. }