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.

157 lines
6.1 KiB

  1. // operation.h: interface for the CSceOperation class.
  2. //
  3. // Copyright (c)1997-1999 Microsoft Corporation
  4. //
  5. //////////////////////////////////////////////////////////////////////
  6. #if !defined(AFX_OPERATION_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_)
  7. #define AFX_OPERATION_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_
  8. #if _MSC_VER >= 1000
  9. #pragma once
  10. #endif // _MSC_VER >= 1000
  11. #include "Extbase.h"
  12. typedef std::map<BSTR, DWORD, strLessThan<BSTR> > MapExecutedClasses;
  13. /*
  14. Class description
  15. Naming:
  16. CSceOperation stands for Sce objects that executes Operation(s).
  17. Base class:
  18. CGenericClass, because it is a class representing two WMI
  19. objects - WMI class names are Sce_Operation
  20. Purpose of class:
  21. (1) Implement Sce_Operation WMI class, which is the only WMI class provided
  22. by SCE provider that can execute a method. This class has no other property
  23. other than the capability to execute some methods. See sceprov.mof file for detail.
  24. (2) Do all the hard work to start the extension classes' method execution. Currently,
  25. we have two different extension model (embedding being the one truly used, while Pod
  26. model is for history reasons).
  27. Design:
  28. (1) Almost trivial as a sub-class of CGenericClass. Even simpler than most other
  29. peers because this class doesn't support PutInstnace and GetInstance operations
  30. since it only implements several static methods.
  31. (2) To support our open extension model, this class does trigger all other extension
  32. classes to execute the method. The private methods are all design for that purpose.
  33. (3) ProcessAttachmentData/ExecutePodMethod is to trigger the Pod model extension classes.
  34. (4) The rest privates are to trigger the embedding model extension classes.
  35. Use:
  36. (1) Almost never used directly. Always through the common interface defined by
  37. CGenericClass.
  38. */
  39. class CSceOperation : public CGenericClass
  40. {
  41. public:
  42. CSceOperation (
  43. ISceKeyChain *pKeyChain,
  44. IWbemServices *pNamespace,
  45. IWbemContext *pCtx = NULL
  46. );
  47. virtual ~CSceOperation(){}
  48. virtual HRESULT PutInst (
  49. IN IWbemClassObject * pInst,
  50. IN IWbemObjectSink * pHandler,
  51. IN IWbemContext * pCtx
  52. )
  53. {
  54. return WBEM_E_NOT_SUPPORTED;
  55. }
  56. virtual HRESULT CreateObject (
  57. IN IWbemObjectSink * pHandler,
  58. IN ACTIONTYPE atAction
  59. )
  60. {
  61. return WBEM_E_NOT_SUPPORTED;
  62. }
  63. virtual HRESULT ExecMethod (
  64. BSTR bstrPath,
  65. BSTR bstrMethod,
  66. bool bIsInstance,
  67. IWbemClassObject *pInParams,
  68. IWbemObjectSink *pHandler,
  69. IWbemContext *pCtx
  70. );
  71. static CCriticalSection s_OperationCS;
  72. private:
  73. HRESULT ProcessAttachmentData (
  74. IWbemContext *pCtx,
  75. LPCWSTR pszDatabase,
  76. LPCWSTR pszLog,
  77. LPCWSTR pszMethod,
  78. DWORD Option,
  79. DWORD *dwStatus
  80. );
  81. HRESULT ExecMethodOnForeignObjects(IWbemContext *pCtx,
  82. LPCWSTR pszDatabase,
  83. LPCWSTR pszLog,
  84. LPCWSTR pszMethod,
  85. DWORD Option,
  86. DWORD *dwStatus
  87. );
  88. HRESULT ExeClassMethod(
  89. IWbemContext *pCtx,
  90. LPCWSTR pszDatabase,
  91. LPCWSTR pszLog OPTIONAL,
  92. LPCWSTR pszClsName,
  93. LPCWSTR pszMethod,
  94. DWORD Option,
  95. DWORD *pdwStatus,
  96. MapExecutedClasses* pExecuted
  97. );
  98. HRESULT ExecutePodMethod(
  99. IWbemContext *pCtx,
  100. LPCWSTR pszDatabase,
  101. LPCWSTR pszLog OPTIONAL,
  102. BSTR bstrClass,
  103. BSTR bstrMethod,
  104. IWbemClassObject* pInClass,
  105. DWORD *pdwStatus
  106. );
  107. HRESULT ExecuteExtensionClassMethod(
  108. IWbemContext *pCtx,
  109. LPCWSTR pszDatabase,
  110. LPCWSTR pszLog OPTIONAL,
  111. BSTR bstrClass,
  112. BSTR bstrMethod,
  113. IWbemClassObject* pInClass,
  114. DWORD *pdwStatus
  115. );
  116. //
  117. // will ignore the return result from m_clsResLog.LogResult because there is really nothing
  118. // we can do and we don't want to a diagnose helper to stop our normal function
  119. //
  120. CMethodResultRecorder m_clsResLog;
  121. };
  122. #endif // !defined(AFX_OPERATION_H__BD7570F7_9F0E_4C6B_B525_E078691B6D0E__INCLUDED_)