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.

225 lines
5.6 KiB

  1. // Copyright (c) Microsoft. All rights reserved.
  2. //
  3. // This is unpublished source code of Microsoft.
  4. // The copyright notice above does not evidence any
  5. // actual or intended publication of such source code.
  6. // OneLiner : Implementation of MNLBExe
  7. // DevUnit : wlbstest
  8. // Author : Murtaza Hakim
  9. // include files
  10. #include "MNLBExe.h"
  11. MNLBExe::MNLBExe_Error
  12. MNLBExe::start( MWmiInstance& instance, unsigned long* retVal )
  13. {
  14. // input parameters are none.
  15. //
  16. vector<MWmiParameter *> inputParameters;
  17. // output parameters which are of interest.
  18. //
  19. vector<MWmiParameter *> outputParameters;
  20. MWmiParameter returnValue(L"ReturnValue");
  21. outputParameters.push_back( &returnValue );
  22. // execute the method.
  23. //
  24. instance.runMethod( L"Start",
  25. inputParameters,
  26. outputParameters );
  27. *retVal = long ( returnValue.getValue() );
  28. return MNLBExe_SUCCESS;
  29. }
  30. MNLBExe::MNLBExe_Error
  31. MNLBExe::stop( MWmiInstance& instance, unsigned long* retVal )
  32. {
  33. // input parameters are none.
  34. //
  35. vector<MWmiParameter *> inputParameters;
  36. // output parameters which are of interest.
  37. //
  38. vector<MWmiParameter *> outputParameters;
  39. MWmiParameter returnValue(L"ReturnValue");
  40. outputParameters.push_back( &returnValue );
  41. // execute the method.
  42. //
  43. instance.runMethod( L"Stop",
  44. inputParameters,
  45. outputParameters );
  46. *retVal = long ( returnValue.getValue() );
  47. return MNLBExe_SUCCESS;
  48. }
  49. MNLBExe::MNLBExe_Error
  50. MNLBExe::resume( MWmiInstance& instance, unsigned long* retVal )
  51. {
  52. // input parameters are none.
  53. //
  54. vector<MWmiParameter *> inputParameters;
  55. // output parameters which are of interest.
  56. //
  57. vector<MWmiParameter *> outputParameters;
  58. MWmiParameter returnValue(L"ReturnValue");
  59. outputParameters.push_back( &returnValue );
  60. // execute the method.
  61. //
  62. instance.runMethod( L"Resume",
  63. inputParameters,
  64. outputParameters );
  65. *retVal = long ( returnValue.getValue() );
  66. return MNLBExe_SUCCESS;
  67. }
  68. MNLBExe::MNLBExe_Error
  69. MNLBExe::suspend( MWmiInstance& instance, unsigned long* retVal )
  70. {
  71. // input parameters are none.
  72. //
  73. vector<MWmiParameter *> inputParameters;
  74. // output parameters which are of interest.
  75. //
  76. vector<MWmiParameter *> outputParameters;
  77. MWmiParameter returnValue(L"ReturnValue");
  78. outputParameters.push_back( &returnValue );
  79. // execute the method.
  80. //
  81. instance.runMethod( L"Suspend",
  82. inputParameters,
  83. outputParameters );
  84. *retVal = long ( returnValue.getValue() );
  85. return MNLBExe_SUCCESS;
  86. }
  87. MNLBExe::MNLBExe_Error
  88. MNLBExe::drainstop( MWmiInstance& instance, unsigned long* retVal )
  89. {
  90. // input parameters are none.
  91. //
  92. vector<MWmiParameter *> inputParameters;
  93. // output parameters which are of interest.
  94. //
  95. vector<MWmiParameter *> outputParameters;
  96. MWmiParameter returnValue(L"ReturnValue");
  97. outputParameters.push_back( &returnValue );
  98. // execute the method.
  99. //
  100. instance.runMethod( L"DrainStop",
  101. inputParameters,
  102. outputParameters );
  103. *retVal = long ( returnValue.getValue() );
  104. return MNLBExe_SUCCESS;
  105. }
  106. MNLBExe::MNLBExe_Error
  107. MNLBExe::enable( MWmiInstance& instance, unsigned long* retVal, unsigned long portToAffect )
  108. {
  109. // input parameters to set.
  110. //
  111. vector<MWmiParameter *> inputParameters;
  112. MWmiParameter port(L"Port");
  113. port.setValue( long (portToAffect) );
  114. inputParameters.push_back( &port );
  115. // output parameters which are of interest.
  116. //
  117. vector<MWmiParameter *> outputParameters;
  118. MWmiParameter returnValue(L"ReturnValue");
  119. outputParameters.push_back( &returnValue );
  120. // execute the method.
  121. //
  122. instance.runMethod( L"Enable",
  123. inputParameters,
  124. outputParameters );
  125. *retVal = long ( returnValue.getValue() );
  126. return MNLBExe_SUCCESS;
  127. }
  128. MNLBExe::MNLBExe_Error
  129. MNLBExe::disable( MWmiInstance& instance, unsigned long* retVal, unsigned long portToAffect )
  130. {
  131. // input parameters to set.
  132. //
  133. vector<MWmiParameter *> inputParameters;
  134. MWmiParameter port(L"Port");
  135. port.setValue( long (portToAffect) );
  136. inputParameters.push_back( &port );
  137. // output parameters which are of interest.
  138. //
  139. vector<MWmiParameter *> outputParameters;
  140. MWmiParameter returnValue(L"ReturnValue");
  141. outputParameters.push_back( &returnValue );
  142. // execute the method.
  143. //
  144. instance.runMethod( L"Disable",
  145. inputParameters,
  146. outputParameters );
  147. *retVal = long ( returnValue.getValue() );
  148. return MNLBExe_SUCCESS;
  149. }
  150. MNLBExe::MNLBExe_Error
  151. MNLBExe::drain( MWmiInstance& instance, unsigned long* retVal, unsigned long portToAffect )
  152. {
  153. // input parameters to set.
  154. //
  155. vector<MWmiParameter *> inputParameters;
  156. MWmiParameter port(L"Port");
  157. port.setValue( long (portToAffect) );
  158. inputParameters.push_back( &port );
  159. // output parameters which are of interest.
  160. //
  161. vector<MWmiParameter *> outputParameters;
  162. MWmiParameter returnValue(L"ReturnValue");
  163. outputParameters.push_back( &returnValue );
  164. // execute the method.
  165. //
  166. instance.runMethod( L"Drain",
  167. inputParameters,
  168. outputParameters );
  169. *retVal = long ( returnValue.getValue() );
  170. return MNLBExe_SUCCESS;
  171. }