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.

97 lines
2.3 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: worker.h
  4. //
  5. // Synopsis: This file holds the declarations of the
  6. // SAShutdownTask COM class
  7. //
  8. //
  9. // History: 10/11/2000
  10. //
  11. // Copyright (C) 1999-2000 Microsoft Corporation
  12. // All rights reserved.
  13. //
  14. //#--------------------------------------------------------------
  15. #ifndef __WORKER_H_
  16. #define __WORKER_H_
  17. #include "resource.h" // main symbols
  18. #include "taskctx.h"
  19. #include "appsrvcs.h"
  20. class ATL_NO_VTABLE CWorker:
  21. public CComObjectRootEx<CComMultiThreadModel>,
  22. public CComCoClass<CWorker, &CLSID_SAShutdownTask>,
  23. public IDispatchImpl<IApplianceTask, &IID_IApplianceTask, &LIBID_ShutdownTaskLib>
  24. {
  25. public:
  26. CWorker() {}
  27. ~CWorker() {}
  28. DECLARE_REGISTRY_RESOURCEID(IDR_SAShutdownTask)
  29. DECLARE_PROTECT_FINAL_CONSTRUCT()
  30. BEGIN_COM_MAP(CWorker)
  31. COM_INTERFACE_ENTRY(IApplianceTask)
  32. COM_INTERFACE_ENTRY(IDispatch)
  33. END_COM_MAP()
  34. //
  35. // IApplianceTask interface methods
  36. //
  37. STDMETHOD(OnTaskExecute)(
  38. /*[in]*/ IUnknown* pTaskContext
  39. );
  40. STDMETHOD(OnTaskComplete)(
  41. /*[in]*/ IUnknown* pTaskContext,
  42. /*[in]*/ LONG lTaskResult
  43. );
  44. private:
  45. typedef enum
  46. {
  47. NO_TASK,
  48. SHUTDOWN
  49. } SA_TASK, *PSA_TASK;
  50. //
  51. //
  52. // supporting methods for the tasks;
  53. //
  54. HRESULT GetMethodName(
  55. /*[in]*/ ITaskContext *pTaskParameter,
  56. /*[out]*/ PSA_TASK pTaskName
  57. );
  58. //
  59. // method to carry out the shutdown
  60. //
  61. HRESULT InitTask (
  62. /*[in]*/ ITaskContext *pTaskParameter
  63. );
  64. //
  65. // method to check if the caller wants a power off
  66. //
  67. BOOL IsRebootRequested (
  68. /*[in]*/ ITaskContext *pTaskParameter
  69. );
  70. //
  71. // method to obtain the sleep time
  72. //
  73. DWORD GetSleepDuration (
  74. /*[in]*/ ITaskContext *pTaskParameter
  75. );
  76. //
  77. // method to give shutdown priviledges to this process
  78. //
  79. bool SetShutdownPrivilege(void);
  80. };
  81. #endif //_WORKER_H_