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.

370 lines
8.9 KiB

  1. //***************************************************************************
  2. //
  3. // TestInfo.h
  4. //
  5. // Module: CDM Provider
  6. //
  7. // Purpose: Defines the CClassPro class. An object of this class is
  8. // created by the class factory for each connection.
  9. //
  10. // Copyright (c) 2000 Microsoft Corporation
  11. //
  12. //***************************************************************************
  13. class CResultList
  14. {
  15. public:
  16. CResultList();
  17. ~CResultList();
  18. HRESULT Add(IWbemClassObject *ResultInstance,
  19. BSTR ResultRelPath,
  20. BSTR ResultForMSERelPath,
  21. BSTR ResultForTestRelPath);
  22. void Clear(void);
  23. HRESULT GetResultsList(ULONG *Count,
  24. IWbemClassObject ***Objects);
  25. HRESULT GetResultByResultRelPath(PWCHAR ObjectPath,
  26. IWbemClassObject **ppResult);
  27. HRESULT GetResultByResultForMSERelPath(PWCHAR ObjectPath,
  28. IWbemClassObject **ppResult);
  29. HRESULT GetResultByResultForTestRelPath(PWCHAR ObjectPath,
  30. IWbemClassObject **ppResult);
  31. private:
  32. typedef struct
  33. {
  34. IWbemClassObject *ResultInstance;
  35. BSTR ResultRelPath;
  36. BSTR ResultForMSERelPath;
  37. BSTR ResultForTestRelPath;
  38. } RESULTENTRY, *PRESULTENTRY;
  39. ULONG ListSize;
  40. ULONG ListEntries;
  41. PRESULTENTRY List;
  42. };
  43. class CBstrArray
  44. {
  45. public:
  46. CBstrArray();
  47. ~CBstrArray();
  48. HRESULT Initialize(ULONG ListCount);
  49. void Set(ULONG Index, BSTR s);
  50. BSTR /* NOFREE */ Get(ULONG Index);
  51. ULONG GetListSize();
  52. private:
  53. BOOLEAN IsInitialized();
  54. BSTR *Array;
  55. ULONG ListSize;
  56. };
  57. class CWbemObjectList
  58. {
  59. public:
  60. CWbemObjectList();
  61. ~CWbemObjectList();
  62. HRESULT Initialize(ULONG ListCount);
  63. HRESULT Set(ULONG Index, IWbemClassObject *Pointer, BOOLEAN KeepRelPath);
  64. IWbemClassObject *Get(ULONG Index);
  65. BSTR /* NOFREE */ GetRelPath(ULONG Index);
  66. ULONG GetListSize(void);
  67. private:
  68. BOOLEAN IsInitialized(
  69. );
  70. ULONG ListSize;
  71. IWbemClassObject **List;
  72. BSTR *RelPaths;
  73. };
  74. class CTestServices
  75. {
  76. public:
  77. CTestServices();
  78. ~CTestServices();
  79. //
  80. // Linked list management routines for the benefit of the
  81. // provider
  82. //
  83. CTestServices *GetNext();
  84. CTestServices *GetPrev();
  85. void InsertSelf(CTestServices **Head);
  86. HRESULT QueryWdmTest(IWbemClassObject *pCdmTest,
  87. int RelPathIndex);
  88. HRESULT ExecuteWdmTest( IWbemClassObject *pCdmSettings,
  89. IWbemClassObject *pCdmResult,
  90. int RelPathIndex,
  91. ULONG *Result,
  92. BSTR *ExecutionID);
  93. HRESULT StopWdmTest( int RelPathIndex,
  94. ULONG *Result,
  95. BOOLEAN *TestingStopped);
  96. HRESULT GetRelPathIndex(BSTR CimRelPath,
  97. int *RelPathIndex);
  98. ULONG GetInstanceCount(void) { return(RelPathCount); };
  99. LONG GetTestEstimatedTime(int RelPathIndex) { return(0); };
  100. BOOLEAN GetTestIsExclusiveForMSE(int RelPathIndex) { return(FALSE); };
  101. HRESULT FillInCdmResult(
  102. IWbemClassObject *pCdmResult,
  103. IWbemClassObject *pCdmSettings,
  104. int RelPathIndex,
  105. BSTR ExecutionID
  106. );
  107. BOOLEAN IsThisInitialized(void);
  108. HRESULT InitializeCdmClasses(PWCHAR CdmClassName);
  109. BOOLEAN ClaimCdmClassName(PWCHAR CdmClassName);
  110. HRESULT AddResultToList(IWbemClassObject *pCdmResult,
  111. BSTR ExecutionID,
  112. int RelPathIndex);
  113. void ClearResultsList(int RelPathIndex);
  114. HRESULT GetResultsList(int RelPathIndex,
  115. ULONG *ResultsCount,
  116. IWbemClassObject ***Results);
  117. HRESULT GetCdmResultByResultRelPath(int RelPathIndex,
  118. PWCHAR ObjectPath,
  119. IWbemClassObject **ppCdmResult);
  120. HRESULT GetCdmResultByResultForMSERelPath(int RelPathIndex,
  121. PWCHAR ObjectPath,
  122. IWbemClassObject **ppCdmResult);
  123. HRESULT GetCdmResultByResultForTestRelPath(int RelPathIndex,
  124. PWCHAR ObjectPath,
  125. IWbemClassObject **ppCdmResult);
  126. //
  127. // Accessors
  128. BSTR GetCimRelPath(int RelPathIndex);
  129. BSTR GetCdmTestClassName(void);
  130. BSTR GetCdmTestRelPath(void);
  131. BSTR GetCdmResultClassName(void);
  132. BSTR GetCdmSettingClassName(void);
  133. BSTR GetCdmSettingRelPath(int RelPathIndex, ULONG SettingIndex);
  134. ULONG GetCdmSettingCount(int RelPathIndex);
  135. IWbemClassObject *GetCdmSettingObject(int RelPathIndex, ULONG SettingIndex);
  136. BSTR GetCdmTestForMSEClassName(void);
  137. BSTR GetCdmTestForMSERelPath(int RelPathIndex);
  138. BSTR GetCdmSettingForTestClassName(void);
  139. BSTR GetCdmSettingForTestRelPath(int RelPathIndex, ULONG SettingIndex);
  140. BSTR GetCdmResultForMSEClassName(void);
  141. BSTR GetCdmResultForMSERelPath(int RelPathIndex);
  142. BSTR GetCdmResultForTestClassName(void);
  143. BSTR GetCdmResultForTestRelPath(int RelPathIndex);
  144. BSTR GetCdmTestForSoftwareClassName(void);
  145. BSTR GetCdmTestForSoftwareRelPath(void);
  146. BSTR GetCdmTestInPackageClassName(void);
  147. BSTR GetCdmTestInPackageRelPath(void);
  148. BSTR GetCdmResultInPackageClassName(void);
  149. BSTR GetCdmResultInPackageRelPath(void);
  150. private:
  151. HRESULT WdmPropertyToCdmProperty(
  152. IWbemClassObject *pCdmClassInstance,
  153. IWbemClassObject *pWdmClassInstance,
  154. BSTR PropertyName,
  155. VARIANT *PropertyValue,
  156. CIMTYPE CdmCimType,
  157. CIMTYPE WdmCimType
  158. );
  159. HRESULT CdmPropertyToWdmProperty(
  160. IWbemClassObject *pWdmClassInstance,
  161. IWbemClassObject *pCdmClassInstance,
  162. BSTR PropertyName,
  163. VARIANT *PropertyValue,
  164. CIMTYPE WdmCimType,
  165. CIMTYPE CdmCimType
  166. );
  167. HRESULT CopyBetweenCdmAndWdmClasses(
  168. IWbemClassObject *pDestinationClass,
  169. IWbemClassObject *pSourceClass,
  170. BOOLEAN WdmToCdm
  171. );
  172. HRESULT ConnectToWdmClass(int RelPathIndex,
  173. IWbemClassObject **ppWdmClassObject);
  174. HRESULT GetCdmClassNamesFromOne(
  175. PWCHAR CdmClass
  176. );
  177. HRESULT BuildResultRelPaths(
  178. IN int RelPathIndex,
  179. IN BSTR ExecutionId,
  180. OUT BSTR *ResultRelPath,
  181. OUT BSTR *ResultForMSERelPath,
  182. OUT BSTR *ResultForTestRelPath
  183. );
  184. HRESULT BuildTestRelPaths(
  185. void
  186. );
  187. HRESULT ParseSettingList(
  188. VARIANT *SettingList,
  189. CWbemObjectList *CdmSettings,
  190. CBstrArray *CdmSettingForTestRelPath,
  191. int RelPathIndex
  192. );
  193. HRESULT BuildSettingForTestRelPath(
  194. OUT BSTR *RelPath,
  195. IN IWbemClassObject *pCdmSettingInstance
  196. );
  197. HRESULT GetCdmTestSettings(void);
  198. HRESULT QueryOfflineResult(
  199. OUT IWbemClassObject *pCdmResult,
  200. IN BSTR ExecutionID,
  201. IN int RelPathIndex
  202. );
  203. // @@BEGIN_DDKSPLIT
  204. HRESULT GatherRebootResults(
  205. void
  206. );
  207. HRESULT PersistResultInSchema(
  208. IWbemClassObject *pCdmResult,
  209. BSTR ExecutionID,
  210. int RelPathIndex
  211. );
  212. // @@END_DDKSPLIT
  213. HRESULT GetTestOutParams(
  214. IN IWbemClassObject *OutParams,
  215. OUT IWbemClassObject *pCdmResult,
  216. OUT ULONG *Result
  217. );
  218. HRESULT OfflineDeviceForTest(IWbemClassObject *pCdmResult,
  219. BSTR ExecutionID,
  220. int RelPathIndex);
  221. BSTR GetExecutionID(
  222. void
  223. );
  224. HRESULT FillTestInParams(
  225. OUT IWbemClassObject *pInParamInstance,
  226. IN IWbemClassObject *pCdmSettings,
  227. IN BSTR ExecutionID
  228. );
  229. IWbemServices *GetWdmServices(void);
  230. IWbemServices *GetCdmServices(void);
  231. CTestServices *Next;
  232. CTestServices *Prev;
  233. //
  234. // WDM Class Names
  235. //
  236. BSTR WdmTestClassName;
  237. BSTR WdmSettingClassName;
  238. BSTR WdmResultClassName;
  239. BSTR WdmOfflineResultClassName;
  240. BSTR WdmSettingListClassName;
  241. //
  242. // CDM Class and RelPath Names
  243. //
  244. BSTR CdmTestClassName;
  245. BSTR CdmTestRelPath;
  246. BSTR CdmResultClassName;
  247. BSTR CdmSettingClassName;
  248. BSTR CdmTestForMSEClassName;
  249. BSTR *CdmTestForMSERelPath;
  250. BSTR CdmSettingForTestClassName;
  251. CBstrArray **CdmSettingForTestRelPath;
  252. BSTR CdmResultForMSEClassName;
  253. BSTR CdmResultForTestClassName;
  254. BSTR CdmTestForSoftwareClassName;
  255. BSTR CdmTestForSoftwareRelPath;
  256. BSTR CdmTestInPackageClassName;
  257. BSTR CdmTestInPackageRelPath;
  258. BSTR CdmResultInPackageClassName;
  259. BSTR CdmResultInPackageRelPath;
  260. //
  261. // Mapping class from Cim to WDM
  262. //
  263. BSTR CimClassMappingClassName;
  264. //
  265. // List of mappings between Cim and WDM
  266. //
  267. int RelPathCount;
  268. BSTR *CimRelPaths;
  269. BSTR *WdmRelPaths;
  270. BSTR *WdmInstanceNames;
  271. BSTR *PnPDeviceIdsX;
  272. //
  273. // Results for test executions. Each relpathindex maintains a
  274. // list of results.
  275. //
  276. CResultList *CdmResultsList;
  277. //
  278. // Settings for test execution, we can have many settings for
  279. // each test.
  280. //
  281. CWbemObjectList **CdmSettingsList;
  282. };