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.

201 lines
4.0 KiB

  1. #ifndef _MWMIINSTANCE_H
  2. #define _MWMIINSTANCE_H
  3. //
  4. // Copyright (c) Microsoft. All Rights Reserved
  5. //
  6. // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Microsoft.
  7. // The copyright notice above does not evidence any
  8. // actual or intended publication of such source code.
  9. //
  10. // OneLiner : MWMIInstance interface.
  11. // DevUnit : wlbstest
  12. // Author : Murtaza Hakim
  13. //
  14. // Description:
  15. // -----------
  16. // include files
  17. //
  18. #include "MWmiInstance.h"
  19. #include "MWmiParameter.h"
  20. #include "MWmiDefs.h"
  21. #include <vector>
  22. #include <wbemidl.h>
  23. #include <comdef.h>
  24. class MWmiObject;
  25. using namespace std;
  26. class MWmiInstance
  27. {
  28. public:
  29. enum MWmiInstance_Error
  30. {
  31. MWmiInstance_SUCCESS = 0,
  32. NO_SUCH_OBJECT = 1,
  33. NO_SUCH_METHOD = 2,
  34. COM_FAILURE = 3,
  35. NO_SUCH_INPUT_PARAMETER = 4,
  36. NO_SUCH_OUTPUT_PARAMETER = 5,
  37. NO_SUCH_PARAMETER = 6,
  38. };
  39. //
  40. // Description:
  41. // -----------
  42. // default constructor is purposely left undefined. No one should use it.
  43. //
  44. // Parameters:
  45. // ----------
  46. // none
  47. //
  48. // Returns:
  49. // -------
  50. // none.
  51. MWmiInstance();
  52. //
  53. // Description:
  54. // -----------
  55. // copy constructor.
  56. //
  57. // Parameters:
  58. // ----------
  59. // obj IN : object to copy
  60. //
  61. // Returns:
  62. // -------
  63. // none.
  64. MWmiInstance( const MWmiInstance& obj);
  65. //
  66. // Description:
  67. // -----------
  68. // assignment operator.
  69. //
  70. // Parameters:
  71. // ----------
  72. // rhs IN : obj to assign.
  73. //
  74. // Returns:
  75. // -------
  76. // self.
  77. MWmiInstance&
  78. operator=( const MWmiInstance& rhs );
  79. //
  80. // Description:
  81. // -----------
  82. // destructor.
  83. //
  84. // Parameters:
  85. // ----------
  86. // none
  87. //
  88. // Returns:
  89. // -------
  90. // none
  91. ~MWmiInstance();
  92. //
  93. // Description:
  94. // -----------
  95. // executes a method on the instance.
  96. //
  97. // Parameters:
  98. // ----------
  99. // methodToRun IN : method to run
  100. // inputParameters IN : input parameters to method.
  101. // outputParameters IN : output parameters of interest.
  102. //
  103. // Returns:
  104. // -------
  105. // SUCCESS else error code.
  106. MWmiInstance_Error
  107. runMethod(
  108. const _bstr_t& methodToRun,
  109. const vector<MWmiParameter *>& inputParameters,
  110. vector<MWmiParameter *>& outputParameters
  111. );
  112. //
  113. // Description:
  114. // -----------
  115. // gets parameters of an instance.
  116. //
  117. // Parameters:
  118. // ----------
  119. // parametersToGet IN : parameters of interest to get.
  120. //
  121. // Returns:
  122. // -------
  123. // SUCCESS else error code.
  124. MWmiInstance_Error
  125. getParameters( vector<MWmiParameter *>& parametersToGet );
  126. //
  127. // Description:
  128. // -----------
  129. // sets parameters of an instance.
  130. //
  131. // Parameters:
  132. // ----------
  133. // parametersToSet IN : parameters of interest to set.
  134. //
  135. // Returns:
  136. // -------
  137. // SUCCESS else error code.
  138. MWmiInstance_Error
  139. setParameters( const vector<MWmiParameter *>& parametersToSet );
  140. private:
  141. _bstr_t _path;
  142. IWbemServicesPtr _pws;
  143. IWbemLocatorPtr _pwl;
  144. _bstr_t _objectName;
  145. //
  146. // Description:
  147. // -----------
  148. // private constructor. Only MWmiObject can construct us.
  149. //
  150. // Parameters:
  151. // ----------
  152. // objectName IN : name of class.
  153. // path IN : path to class
  154. // pwl IN : wmi locator
  155. // pws IN : wmi services
  156. //
  157. // Returns:
  158. // -------
  159. // none.
  160. MWmiInstance( const _bstr_t& objectName,
  161. const _bstr_t& path,
  162. IWbemLocatorPtr pwl,
  163. IWbemServicesPtr pws );
  164. friend MWmiObject;
  165. };
  166. //
  167. // Ensure type safety
  168. typedef class MWmiInstance WmiInstance;
  169. #endif