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.

83 lines
2.3 KiB

  1. /*---------------------------------------------------------------------------
  2. File: StatusObj.h
  3. Comments: COM object used internally by the engine to track whether a job
  4. is running, or finished, and to provide a mechanism for aborting a job.
  5. The agent will set the status to running, or finished, as appropriate.
  6. If the client cancels the job, the engine's CancelJob function will change the
  7. status to 'Aborting'.
  8. Each helper object that performs a lengthy operation, such as account replication, or
  9. security translation is responsible for periodically checking the status object to see
  10. if it needs to abort the task in progress. The engine itself will check between migration
  11. tasks to see if the job has been aborted.
  12. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  13. Proprietary and confidential to Mission Critical Software, Inc.
  14. REVISION LOG ENTRY
  15. Revision By: Christy Boles
  16. Revised on 05/18/99
  17. ---------------------------------------------------------------------------
  18. */
  19. // StatusObj.h : Declaration of the CStatusObj
  20. #ifndef __STATUSOBJ_H_
  21. #define __STATUSOBJ_H_
  22. #include "resource.h" // main symbols
  23. #include "DCTStat.h"
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CStatusObj
  26. class ATL_NO_VTABLE CStatusObj :
  27. public CComObjectRootEx<CComMultiThreadModel>,
  28. public CComCoClass<CStatusObj, &CLSID_StatusObj>,
  29. public IDispatchImpl<IStatusObj, &IID_IStatusObj, &LIBID_MCSDCTWORKEROBJECTSLib>
  30. {
  31. public:
  32. CStatusObj()
  33. {
  34. m_pUnkMarshaler = NULL;
  35. m_Status = 0;
  36. }
  37. DECLARE_REGISTRY_RESOURCEID(IDR_STATUSOBJ)
  38. DECLARE_NOT_AGGREGATABLE(CStatusObj)
  39. DECLARE_GET_CONTROLLING_UNKNOWN()
  40. DECLARE_PROTECT_FINAL_CONSTRUCT()
  41. BEGIN_COM_MAP(CStatusObj)
  42. COM_INTERFACE_ENTRY(IStatusObj)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  45. END_COM_MAP()
  46. HRESULT FinalConstruct()
  47. {
  48. return CoCreateFreeThreadedMarshaler(
  49. GetControllingUnknown(), &m_pUnkMarshaler.p);
  50. }
  51. void FinalRelease()
  52. {
  53. m_pUnkMarshaler.Release();
  54. }
  55. CComPtr<IUnknown> m_pUnkMarshaler;
  56. // IStatusObj
  57. public:
  58. STDMETHOD(get_Status)(/*[out, retval]*/ LONG *pVal);
  59. STDMETHOD(put_Status)(/*[in]*/ LONG newVal);
  60. protected:
  61. LONG m_Status;
  62. CComAutoCriticalSection m_cs;
  63. };
  64. #endif //__STATUSOBJ_H_