Source code of Windows XP (NT5)
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.

156 lines
4.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 CWdmClass
  14. {
  15. public:
  16. CWdmClass();
  17. ~CWdmClass();
  18. //
  19. // Linked list management routines for the benefit of the
  20. // provider
  21. //
  22. CWdmClass *GetNext();
  23. CWdmClass *GetPrev();
  24. void InsertSelf(CWdmClass **Head);
  25. BOOLEAN IsThisInitialized(void);
  26. HRESULT InitializeSelf(IWbemContext *pCtx,
  27. PWCHAR CimClass);
  28. HRESULT RemapToCimClass(IWbemContext *pCtx);
  29. BOOLEAN ClaimCimClassName(PWCHAR CimClassName);
  30. HRESULT GetIndexByCimRelPath(BSTR CimObjectPath,
  31. int *RelPathIndex);
  32. BOOLEAN IsInstancesAvailable() {return(MappingInProgress == 0);};
  33. void IncrementMappingInProgress() { InterlockedIncrement(&MappingInProgress); };
  34. void DecrementMappingInProgress() { InterlockedDecrement(&MappingInProgress); };
  35. HRESULT PutInstance(IWbemContext *pCtx,
  36. int RelPathIndex,
  37. IWbemClassObject *pCimInstance);
  38. //
  39. // Accessors
  40. //
  41. ULONG GetInstanceCount(void) { return(RelPathCount); };
  42. BSTR /* NOFREE */ GetWdmRelPath(int RelPathIndex);
  43. BSTR /* NOFREE */ GetCimRelPath(int RelPathIndex);
  44. IWbemClassObject *GetCimInstance(int RelPathIndex);
  45. IWbemServices *GetWdmServices(void);
  46. IWbemServices *GetCimServices(void);
  47. private:
  48. HRESULT WdmPropertyToCimProperty(
  49. IWbemClassObject *pCimClassInstance,
  50. IWbemClassObject *pWdmClassInstance,
  51. BSTR PropertyName,
  52. VARIANT *PropertyValue,
  53. CIMTYPE CimCimType,
  54. CIMTYPE WdmCimType
  55. );
  56. HRESULT CimPropertyToWdmProperty(
  57. IWbemClassObject *pWdmClassInstance,
  58. IWbemClassObject *pCimClassInstance,
  59. BSTR PropertyName,
  60. VARIANT *PropertyValue,
  61. CIMTYPE WdmCimType,
  62. CIMTYPE CimCimType
  63. );
  64. HRESULT CopyBetweenCimAndWdmClasses(
  65. IWbemClassObject *pDestinationClass,
  66. IWbemClassObject *pSourceClass,
  67. BOOLEAN WdmToCdm
  68. );
  69. HRESULT FillInCimInstance(
  70. IN IWbemContext *pCtx,
  71. IN int RelPathIndex,
  72. IN OUT IWbemClassObject *pCimInstance,
  73. IN IWbemClassObject *pWdmInstance
  74. );
  75. HRESULT GetWdmInstanceByIndex(IWbemContext *pCtx,
  76. int RelPathIndex,
  77. IWbemClassObject **Instance);
  78. HRESULT CreateCimInstance( IWbemContext *pCtx,
  79. int RelPathIndex,
  80. IWbemClassObject **Instance);
  81. HRESULT DiscoverPropertyTypes(IWbemContext *pCtx,
  82. IWbemClassObject *pClassObject);
  83. //
  84. // Data Members
  85. //
  86. LONG MappingInProgress;
  87. typedef enum
  88. {
  89. UnknownDerivation,
  90. NoDerivation,
  91. ConcreteDerivation,
  92. NonConcreteDerivation
  93. } DERIVATION_TYPE, *PDERIVATION_TYPE;
  94. DERIVATION_TYPE DerivationType;
  95. CBstrArray PropertyList;
  96. //
  97. // Link list management
  98. //
  99. CWdmClass *Next;
  100. CWdmClass *Prev;
  101. //
  102. // WDM/CIM Class Names
  103. //
  104. BSTR WdmShadowClassName; // Shadow class name
  105. BSTR CimClassName; // Current class name
  106. BSTR CimMappingClassName;
  107. BSTR CimMappingProperty;
  108. BSTR WdmMappingClassName;
  109. BSTR WdmMappingProperty;
  110. //
  111. // List of mappings between Cim and WDM.
  112. //
  113. int RelPathCount;
  114. CBstrArray *CimMapRelPaths;
  115. CBstrArray *WdmRelPaths;
  116. CWbemObjectList *CimInstances;
  117. //
  118. // Useful device information
  119. CBstrArray *PnPDeviceIds;
  120. CBstrArray *FriendlyName;
  121. CBstrArray *DeviceDesc;
  122. };