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.

209 lines
5.9 KiB

  1. /*++
  2. Copyright (C) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. //***************************************************************************
  8. //
  9. // CREP.H
  10. //
  11. // Wrappers for repository drivers
  12. //
  13. // raymcc 27-Apr-00 WMI Repository init & mapping layer
  14. //
  15. //***************************************************************************
  16. #ifndef _CREP_H_
  17. #define _CREP_H_
  18. class CRepository
  19. {
  20. static IWmiDbSession *m_pEseSession;
  21. static IWmiDbHandle *m_pEseRoot;
  22. static IWmiDbController *m_pEseController;
  23. static HRESULT EnsureDefault();
  24. static HRESULT UpgradeSystemClasses();
  25. static HRESULT GetListOfRootSystemClasses(CWStringArray &aListRootSystemClasses);
  26. static HRESULT RecursiveDeleteClassesFromNamespace(IWmiDbSession *pSession,
  27. const wchar_t *wszNamespace,
  28. CWStringArray &aListRootSystemClasses,
  29. bool bDeleteInThisNamespace);
  30. public:
  31. static HRESULT GetObject(
  32. IN IWmiDbSession *pSession,
  33. IN IWmiDbHandle *pNs,
  34. IN LPCWSTR pszObjectPath,
  35. IN ULONG uFlags,
  36. OUT IWbemClassObject **pObj
  37. );
  38. static HRESULT PutObject(
  39. IN IWmiDbSession *pSession,
  40. IN IWmiDbHandle *pNs,
  41. IN REFIID riid,
  42. IN LPVOID pObj,
  43. IN DWORD dwFlags
  44. );
  45. static HRESULT DeleteObject(
  46. IN IWmiDbSession *pSession,
  47. IN IWmiDbHandle *pNs,
  48. IN REFIID riid,
  49. IN LPVOID pObj,
  50. IN DWORD dwFlags
  51. );
  52. static HRESULT DeleteByPath(
  53. IN IWmiDbSession *pSession,
  54. IN IWmiDbHandle *pNs,
  55. IN LPCWSTR pszPath,
  56. IN DWORD uFlags
  57. );
  58. static HRESULT ExecQuery(
  59. IN IWmiDbSession *pSession,
  60. IN IWmiDbHandle *pNs,
  61. IN LPCWSTR pszQuery,
  62. IN IWbemObjectSink *pSink,
  63. IN LONG lFlags
  64. );
  65. static HRESULT QueryClasses(
  66. IN IWmiDbSession *pSession,
  67. IN IWmiDbHandle *pNs,
  68. IN ULONG uFlags, // WBEM_FLAG_DEEP = 0, WBEM_FLAG_SHALLOW = 1,
  69. IN LPCWSTR pszSuperclass,
  70. IN IWbemObjectSink *pSink
  71. );
  72. static HRESULT InheritsFrom(
  73. IN IWmiDbSession *pSession,
  74. IN IWmiDbHandle *pNs,
  75. IN LPCWSTR pszSuperclass,
  76. IN LPCWSTR pszSubclass
  77. );
  78. static HRESULT GetRefClasses(
  79. IN IWmiDbSession *pSession,
  80. IN IWmiDbHandle *pNs,
  81. IN LPCWSTR pszClass,
  82. IN BOOL bIncludeSubclasses,
  83. OUT CWStringArray &aClasses
  84. );
  85. static HRESULT GetInstanceRefs(
  86. IN IWmiDbSession *pSession,
  87. IN IWmiDbHandle *pNs,
  88. IN LPCWSTR pszTargetObject,
  89. IN IWbemObjectSink *pSink
  90. );
  91. static HRESULT GetClassesWithRefs(
  92. IN IWmiDbSession *pSession,
  93. IN IWmiDbHandle *pNs,
  94. IN IWbemObjectSink *pSink
  95. );
  96. // Gets all classes which have a [HasClassRefs] class qualifier
  97. static HRESULT BuildClassHierarchy(
  98. IN IWmiDbSession *pSession,
  99. IN IWmiDbHandle *pNs,
  100. IN LPCWSTR pBaseClassName,
  101. IN LONG lFlags,
  102. OUT wmilib::auto_ptr<CDynasty> & pDynasty // use operator delete
  103. );
  104. // WBEM_E_NOT_FOUND has special meaning; check lFlags too
  105. static HRESULT FindKeyRoot(
  106. IN IWmiDbSession *pSession,
  107. IN IWmiDbHandle *pNs,
  108. IN LPCWSTR wszClassName,
  109. OUT IWbemClassObject** ppKeyRootClass
  110. );
  111. static HRESULT TableScanQuery(
  112. IN IWmiDbSession *pSession,
  113. IN IWmiDbHandle *pNs,
  114. IN LPCWSTR pszClassName,
  115. IN QL_LEVEL_1_RPN_EXPRESSION *pExp,
  116. IN DWORD dwFlags,
  117. IN IWbemObjectSink *pSink
  118. );
  119. // Setup, startup, init, etc.
  120. // ==========================
  121. static HRESULT InitDriver(
  122. IN ULONG uFlags,
  123. IN IWbemClassObject *pMappedNs,
  124. OUT IWmiDbController **pResultController,
  125. OUT IWmiDbSession **pResultRootSession,
  126. OUT IWmiDbHandle **pResultVirtualRoot
  127. );
  128. static HRESULT OpenScope(
  129. IN IWmiDbSession *pParentSession, //Parent session to use to
  130. IN LPWSTR pszTargetScope, // NS or scope
  131. IN GUID *pTransGuid, // Transaction GUID for connection
  132. OUT IWmiDbController **pDriver, // Driver
  133. OUT IWmiDbSession **pSession, // Session
  134. OUT IWmiDbHandle **pScope, // Scope
  135. OUT IWmiDbHandle **pNs // Nearest NS
  136. );
  137. static HRESULT EnsureNsSystemInstances(
  138. IN IWmiDbSession *pSession,
  139. IN IWmiDbHandle *pNs,
  140. IN IWmiDbSession *pParentSession,
  141. IN IWmiDbHandle *pParentNs
  142. );
  143. static HRESULT CRepository::EnsureNsSystemRootObjects(
  144. IN IWmiDbSession *pSession,
  145. IN IWmiDbHandle *pNs,
  146. IN IWmiDbSession *pParentSession,
  147. IN IWmiDbHandle *pParentNs
  148. );
  149. static HRESULT CRepository::EnsureNsSystemSecurityObjects(
  150. IN IWmiDbSession *pSession,
  151. IN IWmiDbHandle *pNs,
  152. IN IWmiDbSession *pParentSession,
  153. IN IWmiDbHandle *pParentNs
  154. );
  155. static HRESULT Init();
  156. static HRESULT Shutdown(BOOL bIsSystemShutDown);
  157. static HRESULT GetDefaultSession(
  158. OUT IWmiDbSession **pSession
  159. );
  160. static HRESULT OpenEseNs(
  161. IN IWmiDbSession *pSession,
  162. IN LPCWSTR pszNamespace,
  163. OUT IWmiDbHandle **pHandle
  164. );
  165. static HRESULT CreateEseNs(
  166. IN IWmiDbSession *pSession,
  167. IN LPCWSTR pszNamespace,
  168. OUT IWmiDbHandle **pHandle
  169. );
  170. //Get a new session from the database that can hold transactioning states and anything else
  171. //needed for a particular session
  172. static HRESULT GetNewSession(OUT IWmiDbSession **ppSession);
  173. };
  174. #endif