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.

257 lines
8.0 KiB

  1. // RequestObject.h: interface for the CRequestObject class.
  2. // Copyright (c)1997-1999 Microsoft Corporation
  3. //
  4. //////////////////////////////////////////////////////////////////////
  5. #if !defined(AFX_REQUESTOBJECT_H__bd7570f7_9f0e_4c6b_b525_e078691b6d0e__INCLUDED_)
  6. #define AFX_REQUESTOBJECT_H__bd7570f7_9f0e_4c6b_b525_e078691b6d0e__INCLUDED_
  7. #if _MSC_VER >= 1000
  8. #pragma once
  9. #endif // _MSC_VER >= 1000
  10. //
  11. // make these Properties available to all those who included this header
  12. //
  13. extern const WCHAR * pPath;
  14. extern const WCHAR * pDescription;
  15. extern const WCHAR * pVersion;
  16. extern const WCHAR * pReadonly;
  17. extern const WCHAR * pDirty;
  18. extern const WCHAR * pStorePath;
  19. extern const WCHAR * pStoreType;
  20. extern const WCHAR * pMinAge;
  21. extern const WCHAR * pMaxAge;
  22. extern const WCHAR * pMinLength;
  23. extern const WCHAR * pHistory;
  24. extern const WCHAR * pComplexity;
  25. extern const WCHAR * pStoreClearText;
  26. extern const WCHAR * pForceLogoff;
  27. extern const WCHAR * pEnableAdmin;
  28. extern const WCHAR * pEnableGuest;
  29. extern const WCHAR * pLSAPol;
  30. extern const WCHAR * pThreshold;
  31. extern const WCHAR * pDuration;
  32. extern const WCHAR * pResetTimer;
  33. extern const WCHAR * pEvent;
  34. extern const WCHAR * pAuditSuccess;
  35. extern const WCHAR * pAuditFailure;
  36. extern const WCHAR * pType;
  37. extern const WCHAR * pData;
  38. extern const WCHAR * pDatabasePath;
  39. extern const WCHAR * pTemplatePath;
  40. extern const WCHAR * pLogFilePath;
  41. extern const WCHAR * pOverwrite;
  42. extern const WCHAR * pAreaMask;
  43. extern const WCHAR * pMaxTicketAge;
  44. extern const WCHAR * pMaxRenewAge;
  45. extern const WCHAR * pMaxServiceAge;
  46. extern const WCHAR * pMaxClockSkew;
  47. extern const WCHAR * pEnforceLogonRestrictions;
  48. extern const WCHAR * pCategory;
  49. extern const WCHAR * pSuccess;
  50. extern const WCHAR * pFailure;
  51. extern const WCHAR * pSize;
  52. extern const WCHAR * pOverwritePolicy;
  53. extern const WCHAR * pRetentionPeriod;
  54. extern const WCHAR * pRestrictGuestAccess;
  55. extern const WCHAR * pAdministratorAccountName;
  56. extern const WCHAR * pGuestAccountName;
  57. extern const WCHAR * pMode;
  58. extern const WCHAR * pSDDLString;
  59. extern const WCHAR * pService;
  60. extern const WCHAR * pStartupMode;
  61. extern const WCHAR * pUserRight;
  62. extern const WCHAR * pAddList;
  63. extern const WCHAR * pRemoveList;
  64. extern const WCHAR * pGroupName;
  65. extern const WCHAR * pPathName;
  66. extern const WCHAR * pDisplayName;
  67. extern const WCHAR * pDisplayDialog;
  68. extern const WCHAR * pDisplayChoice;
  69. extern const WCHAR * pDisplayChoiceResult;
  70. extern const WCHAR * pUnits;
  71. extern const WCHAR * pRightName;
  72. extern const WCHAR * pPodID;
  73. extern const WCHAR * pPodSection;
  74. extern const WCHAR * pKey;
  75. extern const WCHAR * pValue;
  76. extern const WCHAR * pLogArea;
  77. extern const WCHAR * pLogErrorCode;
  78. extern const WCHAR * pLogErrorType;
  79. extern const WCHAR * pLogVerbose;
  80. extern const WCHAR * pAction;
  81. extern const WCHAR * pErrorCause;
  82. extern const WCHAR * pObjectDetail;
  83. extern const WCHAR * pParameterDetail;
  84. extern const WCHAR * pLastAnalysis;
  85. extern const WCHAR * pLastConfiguration;
  86. extern const WCHAR * pAttachmentSections;
  87. extern const WCHAR * pClassOrder;
  88. extern const WCHAR * pTranxGuid;
  89. extern const WCHAR * pwMethodImport;
  90. extern const WCHAR * pwMethodExport;
  91. extern const WCHAR * pwMethodApply;
  92. extern const WCHAR * pwAuditSystemEvents;
  93. extern const WCHAR * pwAuditLogonEvents;
  94. extern const WCHAR * pwAuditObjectAccess;
  95. extern const WCHAR * pwAuditPrivilegeUse;
  96. extern const WCHAR * pwAuditPolicyChange;
  97. extern const WCHAR * pwAuditAccountManage;
  98. extern const WCHAR * pwAuditProcessTracking;
  99. extern const WCHAR * pwAuditDSAccess;
  100. extern const WCHAR * pwAuditAccountLogon;
  101. extern const WCHAR * pwApplication;
  102. extern const WCHAR * pwSystem;
  103. extern const WCHAR * pwSecurity;
  104. //
  105. // macro that calculates the size of the (input parameter) array
  106. //
  107. #define SCEPROV_SIZEOF_ARRAY(x) (sizeof(x)/sizeof(*x))
  108. //
  109. // forward declaration
  110. //
  111. class CGenericClass;
  112. /*
  113. Class description
  114. Naming:
  115. CRequestObject stands for Object that delegates Request from WMI.
  116. Base class:
  117. None
  118. Purpose of class:
  119. (1) This is the general delegator for any WMI calls into the provider. Basically
  120. any WMI action is sent to this class for further process. Its public functions
  121. thus defines the interface between our provider and what individual classes
  122. for the WMI classes interact.
  123. Design:
  124. (1) We know how to create a WMI object (representing our WMI classes).
  125. Implemented by CreateObject.
  126. (2) We know how to Put an instance. Implemented by PutObject.
  127. (3) We know how to execute a query. That is done by ExecQuery.
  128. (4) We know how to delete an instance (representing our WMI classes).
  129. That is done by DeleteObject.
  130. To facilitate these functionality, we designed the following private helpers:
  131. (5) We know how to create a C++ class that serves the need for the corresponding
  132. WMI class given the WMI class's name. That is implemented inside CreateClass function.
  133. (6) We know how to parse a WMI object path for critical information. That is done by
  134. CreateKeyChain.
  135. (7) We know how to parse a query for critical information. That is done by
  136. ParseQuery.
  137. Use:
  138. (1) Create an instance.
  139. (2) Call the appropriate function.
  140. (3) Actually, you very rarely need to use it in the above fashion. Most likely,
  141. what you need to do is the expand the WMI classes we are going to provide.
  142. And in that case, all you need to do is:
  143. (a) Implement a C++ class to fulfill the WMI obligation for the WMI class.
  144. Most obviously, you need to derive your C++ from CGenericClass.
  145. (b) Add an entry in the CreateClass function of this class.
  146. Everything else should happen automatically.
  147. */
  148. class CRequestObject
  149. {
  150. public:
  151. CRequestObject(IWbemServices *pNamespace) : m_srpNamespace(pNamespace)
  152. {
  153. }
  154. HRESULT CreateObject (
  155. BSTR bstrPath,
  156. IWbemObjectSink *pHandler,
  157. IWbemContext *pCtx,
  158. ACTIONTYPE ActType
  159. );
  160. HRESULT PutObject (
  161. IWbemClassObject *pInst,
  162. IWbemObjectSink *pHandler,
  163. IWbemContext *pCtx
  164. );
  165. HRESULT ExecMethod (
  166. BSTR bstrPath,
  167. BSTR bstrMethod,
  168. IWbemClassObject *pInParams,
  169. IWbemObjectSink *pHandler,
  170. IWbemContext *pCtx
  171. );
  172. HRESULT DeleteObject (
  173. BSTR bstrPath,
  174. IWbemObjectSink *pHandler,
  175. IWbemContext *pCtx
  176. );
  177. #ifdef _EXEC_QUERY_SUPPORT
  178. HRESULT ExecQuery (
  179. BSTR bstrQuery,
  180. IWbemObjectSink *pHandler,
  181. IWbemContext *pCtx
  182. );
  183. bool ParseQuery (
  184. BSTR bstrQuery
  185. );
  186. #endif
  187. private:
  188. HRESULT CreateKeyChain (
  189. LPCWSTR pszPath,
  190. ISceKeyChain** pKeyChain
  191. );
  192. HRESULT CreateClass (
  193. ISceKeyChain* pKeyChain,
  194. CGenericClass **pClass,
  195. IWbemContext *pCtx
  196. );
  197. HRESULT GetWbemObjectPath (
  198. IWbemClassObject* pInst,
  199. BSTR* pbstrPath
  200. );
  201. protected:
  202. CComPtr<IWbemServices> m_srpNamespace;
  203. };
  204. #endif // !defined(AFX_REQUESTOBJECT_H__bd7570f7_9f0e_4c6b_b525_e078691b6d0e__INCLUDED_)