@@ -137,6 +137,23 @@ public HRESULT Get(String wszName, int lFlags, VARIANT.ByReference pVal, IntByRe
137137 return Get (wszName == null ? null : new WString (wszName ), lFlags , pVal , pType , plFlavor );
138138 }
139139
140+ public HRESULT GetMethod (String wszName , int lFlags , PointerByReference ppInSignature , PointerByReference ppOutSignature ) {
141+ return GetMethod (wszName == null ? null : new WString (wszName ), lFlags , ppInSignature , ppOutSignature );
142+ }
143+
144+ public HRESULT GetMethod (WString wszName , int lFlags , PointerByReference ppInSignature , PointerByReference ppOutSignature ) {
145+ // 20th method in IWbemClassObjectVtbl
146+ return (HRESULT ) _invokeNativeObject (19 ,
147+ new Object []{ getPointer (), wszName , lFlags , ppInSignature , ppOutSignature }, HRESULT .class );
148+ }
149+
150+ public IWbemClassObject GetMethod (String wszName ) {
151+ PointerByReference ppInSignature = new PointerByReference ();
152+ HRESULT res = GetMethod (wszName , 0 , ppInSignature , null );
153+ COMUtils .checkRC (res );
154+ return new IWbemClassObject (ppInSignature .getValue ());
155+ }
156+
140157 public HRESULT GetNames (String wszQualifierName , int lFlags , VARIANT .ByReference pQualifierVal , PointerByReference pNames ) {
141158 return GetNames (wszQualifierName == null ? null : new WString (wszQualifierName ), lFlags , pQualifierVal , pNames );
142159 }
@@ -194,6 +211,42 @@ public IWbemQualifierSet GetPropertyQualifierSet(String strProperty) {
194211 IWbemQualifierSet qualifier = new IWbemQualifierSet (ppQualSet .getValue ());
195212 return qualifier ;
196213 }
214+
215+ public HRESULT Put (String wszName , int lFlags , Variant .VARIANT pVal , int Type ) {
216+ return Put (wszName == null ? null : new WString (wszName ), lFlags , pVal , Type );
217+ }
218+
219+ public HRESULT Put (WString wszName , int lFlags , Variant .VARIANT pVal , int Type ) {
220+ // 6th method in IWbemClassObjectVtbl
221+ return (HRESULT ) _invokeNativeObject (5 ,
222+ new Object []{ getPointer (), wszName , lFlags , pVal , Type }, HRESULT .class );
223+ }
224+
225+ public void Put (String wszName , String pValue ) {
226+ Variant .VARIANT aVariant = new Variant .VARIANT ();
227+ BSTR strValue = OleAuto .INSTANCE .SysAllocString (pValue );
228+ try {
229+ aVariant .setValue (Variant .VT_BSTR , strValue );
230+ HRESULT res = Put (wszName , 0 , aVariant , 0 );
231+ COMUtils .checkRC (res );
232+ }
233+ finally {
234+ OleAuto .INSTANCE .VariantClear (aVariant );
235+ }
236+ }
237+
238+ public HRESULT SpawnInstance (int lFlags , PointerByReference ppNewInstance ) {
239+ // 16th method in IWbemClassObjectVtbl
240+ return (HRESULT ) _invokeNativeObject (15 ,
241+ new Object []{ getPointer (), lFlags , ppNewInstance }, HRESULT .class );
242+ }
243+
244+ public IWbemClassObject SpawnInstance () {
245+ PointerByReference ppNewInstance = new PointerByReference ();
246+ HRESULT res = SpawnInstance (0 , ppNewInstance );
247+ COMUtils .checkRC (res );
248+ return new IWbemClassObject (ppNewInstance .getValue ());
249+ }
197250 }
198251
199252 class IWbemQualifierSet extends Unknown {
@@ -348,6 +401,31 @@ public IWbemServices(Pointer pvInstance) {
348401 super (pvInstance );
349402 }
350403
404+ public HRESULT ExecMethod (BSTR strObjectPath , BSTR strMethodName , int lFlags , IWbemContext pCtx ,
405+ Pointer pInParams , PointerByReference ppOutParams , PointerByReference ppCallResult ) {
406+ // ExecMethod is 25st method of IWbemServicesVtbl in WbemCli.h
407+ return (HRESULT ) _invokeNativeObject (24 ,
408+ new Object [] { getPointer (), strObjectPath , strMethodName , lFlags , pCtx , pInParams , ppOutParams , ppCallResult }, HRESULT .class );
409+ }
410+
411+ public IWbemClassObject ExecMethod (String strObjectPath , String strMethodName , int lFlags , IWbemContext pCtx ,
412+ IWbemClassObject inParams ) {
413+ BSTR strObjectPathBSTR = OleAuto .INSTANCE .SysAllocString (strObjectPath );
414+ BSTR strMethodNameBSTR = OleAuto .INSTANCE .SysAllocString (strMethodName );
415+ try {
416+ PointerByReference ppOutParams = new PointerByReference ();
417+
418+ HRESULT res = ExecMethod (strObjectPathBSTR , strMethodNameBSTR , lFlags , pCtx , inParams .getPointer (), ppOutParams , null );
419+
420+ COMUtils .checkRC (res );
421+
422+ return new IWbemClassObject (ppOutParams .getValue ());
423+ } finally {
424+ OleAuto .INSTANCE .SysFreeString (strObjectPathBSTR );
425+ OleAuto .INSTANCE .SysFreeString (strMethodNameBSTR );
426+ }
427+ }
428+
351429 public HRESULT ExecQuery (BSTR strQueryLanguage , BSTR strQuery , int lFlags , IWbemContext pCtx ,
352430 PointerByReference ppEnum ) {
353431 // ExecQuery is 21st method of IWbemServicesVtbl in WbemCli.h
0 commit comments