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.

268 lines
7.9 KiB

  1. //***************************************************************************
  2. //
  3. // NTEVTINST.H
  4. //
  5. // Module:
  6. //
  7. // Purpose: Genral purpose include file.
  8. //
  9. // Copyright (c) 1996-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. #ifndef _NT_EVT_PROV_NTEVTINST_H
  13. #define _NT_EVT_PROV_NTEVTINST_H
  14. #define WBEM_CLASS_EXTENDEDSTATUS L"Win32_PrivilegesStatus"
  15. #define WBEM_TASKSTATE_START 0x0
  16. #define WBEM_TASKSTATE_ASYNCHRONOUSCOMPLETE 0x100000
  17. #define WBEM_TASKSTATE_ASYNCHRONOUSABORT 0x100001
  18. class WbemTaskObject
  19. {
  20. private:
  21. protected:
  22. ULONG m_State ;
  23. WbemProvErrorObject m_ErrorObject ;
  24. ULONG m_RequestHandle ;
  25. ULONG m_OperationFlag ;
  26. IWbemClassObject *m_ClassObject ;
  27. IWbemClassObject *m_AClassObject ;
  28. IWbemObjectSink *m_NotificationHandler ;
  29. IWbemContext *m_Ctx ;
  30. CImpNTEvtProv *m_Provider ;
  31. protected:
  32. void SetRequestHandle ( ULONG a_RequestHandle ) ;
  33. BOOL GetRequestHandle () ;
  34. BOOL GetExtendedNotifyStatusObject ( IWbemClassObject **a_NotifyObject ) ;
  35. BOOL GetNotifyStatusObject ( IWbemClassObject **a_NotifyObject ) ;
  36. BOOL GetClassObject ( BSTR a_Class ) ;
  37. public:
  38. static IWbemClassObject *g_ClassArray[NT_EVTLOG_MAX_CLASSES];
  39. static BOOL GetClassObject ( BSTR a_Class, BOOL a_bAmended, IWbemServices *a_Server, IWbemContext *a_Ctx, IWbemClassObject **a_pClass ) ;
  40. WbemTaskObject (
  41. CImpNTEvtProv *a_Provider ,
  42. IWbemObjectSink *a_NotificationHandler ,
  43. ULONG a_OperationFlag ,
  44. IWbemContext *a_Ctx
  45. ) ;
  46. virtual void Process() {}
  47. ~WbemTaskObject () ;
  48. WbemProvErrorObject &GetErrorObject () ;
  49. } ;
  50. class ExecQueryAsyncEventObject;
  51. class GetObjectAsyncEventObject : public WbemTaskObject
  52. {
  53. friend ExecQueryAsyncEventObject;
  54. private:
  55. wchar_t *m_ObjectPath ;
  56. wchar_t *m_Class ;
  57. ParsedObjectPath *m_ParsedObjectPath ;
  58. CObjectPathParser m_ObjectPathParser ;
  59. IWbemClassObject *m_Out;
  60. BOOL m_bIndicate;
  61. BOOL Dispatch_Record ( WbemProvErrorObject &a_ErrorObject );
  62. BOOL Get_Record ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_FileKey , KeyRef *a_RecordKey );
  63. BOOL Dispatch_EventLog ( WbemProvErrorObject &a_ErrorObject );
  64. BOOL Get_EventLog ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_FileKey);
  65. BOOL Dispatch_LogRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  66. BOOL Dispatch_UserRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  67. BOOL Dispatch_ComputerRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  68. BOOL Get_LogRecord ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_LogKey , KeyRef *a_RecordKey ) ;
  69. BOOL Get_UserRecord ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_UserKey , KeyRef *a_RecordKey ) ;
  70. BOOL Get_ComputerRecord ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_CompKey , KeyRef *a_RecordKey ) ;
  71. protected:
  72. BOOL GetObject ( WbemProvErrorObject &a_ErrorObject ) ;
  73. public:
  74. GetObjectAsyncEventObject (
  75. CImpNTEvtProv *a_Provider ,
  76. wchar_t *a_ObjectPath ,
  77. ULONG a_Flag ,
  78. IWbemObjectSink *a_NotificationHandler ,
  79. IWbemContext *pCtx ,
  80. BOOL a_bIndicate = TRUE
  81. ) ;
  82. ~GetObjectAsyncEventObject () ;
  83. void Process () ;
  84. } ;
  85. class ExecMethodAsyncEventObject : public WbemTaskObject
  86. {
  87. private:
  88. wchar_t *m_ObjectPath ;
  89. wchar_t *m_Class ;
  90. wchar_t *m_Method ;
  91. ParsedObjectPath *m_ParsedObjectPath ;
  92. CObjectPathParser m_ObjectPathParser ;
  93. IWbemClassObject* m_InParamObject;
  94. BOOL m_bIndicateOutParam;
  95. IWbemClassObject* m_pOutClass;
  96. BOOL Dispatch_EventLog ( WbemProvErrorObject &a_ErrorObject );
  97. BOOL ExecMethod_EventLog ( WbemProvErrorObject &a_ErrorObject , KeyRef *a_FileKey);
  98. protected:
  99. BOOL ExecMethod ( WbemProvErrorObject &a_ErrorObject ) ;
  100. public:
  101. ExecMethodAsyncEventObject (
  102. CImpNTEvtProv *a_Provider ,
  103. wchar_t *a_ObjectPath ,
  104. wchar_t *a_MethodName,
  105. ULONG a_Flag ,
  106. IWbemClassObject *a_InParams ,
  107. IWbemObjectSink *a_NotificationHandler ,
  108. IWbemContext *pCtx
  109. ) ;
  110. ~ExecMethodAsyncEventObject () ;
  111. void Process () ;
  112. } ;
  113. class PutInstanceAsyncEventObject : public WbemTaskObject
  114. {
  115. private:
  116. IWbemClassObject *m_InstObject ;
  117. BOOL Dispatch_EventLog ( WbemProvErrorObject &a_ErrorObject );
  118. protected:
  119. BOOL PutInstance ( WbemProvErrorObject &a_ErrorObject ) ;
  120. public:
  121. PutInstanceAsyncEventObject (
  122. CImpNTEvtProv *a_Provider ,
  123. IWbemClassObject *a_Inst ,
  124. ULONG a_Flag ,
  125. IWbemObjectSink *a_NotificationHandler ,
  126. IWbemContext *pCtx
  127. ) ;
  128. ~PutInstanceAsyncEventObject () ;
  129. void Process () ;
  130. } ;
  131. class ExecQueryAsyncEventObject : public WbemTaskObject, public QueryPreprocessor
  132. {
  133. private:
  134. wchar_t *m_QueryFormat ;
  135. wchar_t *m_Query ;
  136. wchar_t *m_Class ;
  137. SQL_LEVEL_1_RPN_EXPRESSION *m_RPNExpression ;
  138. QueryPreprocessor::QuadState Compare(wchar_t *a_Operand1, wchar_t *a_Operand2,
  139. DWORD a_Operand1Func, DWORD a_Operand2Func,
  140. WmiTreeNode &a_OperatorType);
  141. QueryPreprocessor::QuadState Compare(LONG a_Operand1, LONG a_Operand2 ,
  142. DWORD a_Operand1Func, DWORD a_Operand2Func,
  143. WmiTreeNode &a_OperatorType);
  144. QueryPreprocessor::QuadState CompareString(IWbemClassObject *a_ClassObject, BSTR a_PropertyName ,
  145. WmiTreeNode *a_Operator, WmiTreeNode *a_Operand);
  146. QueryPreprocessor::QuadState CompareInteger(IWbemClassObject *a_ClassObject, BSTR a_PropertyName,
  147. WmiTreeNode *a_Operator, WmiTreeNode *a_Operand);
  148. QueryPreprocessor :: QuadState CompareDateTime (IWbemClassObject *a_ClassObject, BSTR a_PropertyName,
  149. WmiTreeNode *a_Operator, WmiTreeNode *a_Operand);
  150. HRESULT GetRecordsBetweenTimes(WbemProvErrorObject &a_ErrorObject, LPCWSTR a_logname,
  151. BOOL a_Generated, DWORD a_dwUpper, DWORD a_dwLower);
  152. HRESULT RecurseLogFile (WbemProvErrorObject &a_ErrorObject, PartitionSet *a_PartitionSet, LPCWSTR a_logname);
  153. HRESULT RecurseRecord (WbemProvErrorObject &a_ErrorObject, PartitionSet *a_PartitionSet, LPCWSTR a_logname);
  154. HRESULT DoAllInLogfile(WbemProvErrorObject &a_ErrorObject, LPCWSTR a_logname, DWORD a_dwUpper, DWORD a_dwLower);
  155. HRESULT RecurseTime(WbemProvErrorObject &a_ErrorObject, PartitionSet *a_PartitionSet, LPCWSTR a_logname, BOOL a_Generated);
  156. BOOL CheckTime( const BSTR a_wszText, BOOL &a_IsLow, BOOL &a_IsHigh );
  157. protected:
  158. BOOL ExecQuery ( WbemProvErrorObject &a_ErrorObject ) ;
  159. BOOL DispatchQuery ( WbemProvErrorObject &a_ErrorObject ) ;
  160. BOOL Query_Record ( WbemProvErrorObject &a_ErrorObject ) ;
  161. BOOL Query_EventLog ( WbemProvErrorObject &a_ErrorObject ) ;
  162. BOOL Query_LogRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  163. BOOL Query_UserRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  164. BOOL Query_ComputerRecord ( WbemProvErrorObject &a_ErrorObject ) ;
  165. BOOL OptimizeAssocQuery ( WbemProvErrorObject &a_ErrorObject , BSTR *a_ObjectPath);
  166. BOOL GenerateLogAssocs( WbemProvErrorObject &a_ErrorObject, const wchar_t* logPath,
  167. const wchar_t* logName, BOOL bVerifyLogname, BOOL *pbContinue = NULL);
  168. BOOL GenerateCompUserAssocs ( WbemProvErrorObject &a_ErrorObject, BOOL bComp );
  169. wchar_t* GetClassFromPath(wchar_t* path);
  170. // Query Processing Functions
  171. //============================
  172. QuadState InvariantEvaluate(void *a_Context, WmiTreeNode *a_Operator, WmiTreeNode *a_Operand);
  173. WmiRangeNode *AllocInfiniteRangeNode(void *a_Context, BSTR a_PropertyName);
  174. virtual DWORD GetPriority ( BSTR a_PropertyName ) ;
  175. WmiTreeNode *AllocTypeNode (void *a_Context, BSTR a_PropertyName,
  176. VARIANT &a_Variant, WmiValueNode::WmiValueFunction a_PropertyFunction,
  177. WmiValueNode :: WmiValueFunction a_ConstantFunction, WmiTreeNode *a_Parent);
  178. public:
  179. ExecQueryAsyncEventObject (
  180. CImpNTEvtProv *a_Provider ,
  181. BSTR a_QueryFormat ,
  182. BSTR a_Query ,
  183. ULONG a_Flag ,
  184. IWbemObjectSink *a_NotificationHandler ,
  185. IWbemContext *pCtx
  186. ) ;
  187. ~ExecQueryAsyncEventObject () ;
  188. void Process () ;
  189. } ;
  190. #endif //_NT_EVT_PROV_NTEVTINST_H