1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using System.Collections;
6 using System.Runtime.InteropServices;
7 using System.Security;
8 using System.Runtime.Serialization;
9 using System.Threading;
10 using System.Security.Permissions;
11 using System.Runtime.Versioning;
12 
13 namespace WbemClient_v1 {}
14 namespace WbemUtilities_v1 {}
15 
16 namespace System.Management
17 {
18     #region FreeThreadedInterfaces
19     sealed class IWbemClassObjectFreeThreaded : IDisposable, ISerializable
20     {
21         //
22         // This is to force load wminet_utils.dll as a COM component. Since wminet_utils.dll
23         // lives in the version framework directory, a direct DllImport will try to load the
24         // wminet_utils.dll from the currently set environment path. In certain cases, such as
25         // redist install this path will not be set and we get a DllNotFound exception thrown.
26         // By forcing the DLL to be loaded as a COM DLL, mscoree will go to the registry and get
27         // the correct path and succeed in loading the DLL. Once the DllImport occurs, the DLL will
28         // already be in the cache.
29         //
30         const string SerializationBlobName = "flatWbemClassObject";
31         static readonly string name = typeof(IWbemClassObjectFreeThreaded).FullName;
32         public static Guid IID_IWbemClassObject = new Guid("DC12A681-737F-11CF-884D-00AA004B2E24");
33 
34         IntPtr pWbemClassObject = IntPtr.Zero;
35 
IWbemClassObjectFreeThreaded(IntPtr pWbemClassObject)36         public IWbemClassObjectFreeThreaded(IntPtr pWbemClassObject)
37         {
38             // This instance will now own a single ref count on pWbemClassObject
39             this.pWbemClassObject = pWbemClassObject;
40         }
41 
operator IntPtr(IWbemClassObjectFreeThreaded wbemClassObject)42         public static implicit operator IntPtr(IWbemClassObjectFreeThreaded wbemClassObject)
43         {
44             if(null == wbemClassObject)
45                 return IntPtr.Zero;
46             return wbemClassObject.pWbemClassObject;
47         }
48 
IWbemClassObjectFreeThreaded(SerializationInfo info, StreamingContext context)49         public IWbemClassObjectFreeThreaded(SerializationInfo info, StreamingContext context)
50         {
51             throw new PlatformNotSupportedException();
52         }
53 
ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)54         void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
55         {
56             throw new PlatformNotSupportedException();
57         }
58 
Dispose()59         public void Dispose()
60         {
61             Dispose_(false);
62         }
63 
Dispose_( bool finalization )64         private void Dispose_ ( bool finalization )
65         {
66             if(pWbemClassObject != IntPtr.Zero)
67             {
68                 Marshal.Release(pWbemClassObject);
69                 pWbemClassObject = IntPtr.Zero;
70             }
71             GC.SuppressFinalize(this);
72         }
73 
~IWbemClassObjectFreeThreaded()74         ~IWbemClassObjectFreeThreaded()
75         {
76             Dispose_(true);
77         }
78 
DeserializeFromBlob(Byte [] rg)79         void DeserializeFromBlob(Byte [] rg)
80         {
81             IntPtr hGlobal = IntPtr.Zero;
82             System.Runtime.InteropServices.ComTypes.IStream stream = null;
83             try
84             {
85                 // If something goes wrong, we want to make sure the object is invalidated
86                 pWbemClassObject = IntPtr.Zero;
87 
88                 hGlobal = Marshal.AllocHGlobal(rg.Length);
89                 Marshal.Copy(rg, 0, hGlobal, rg.Length);
90                 stream = CreateStreamOnHGlobal(hGlobal, 0);
91                 pWbemClassObject = CoUnmarshalInterface(stream, ref IID_IWbemClassObject);
92             }
93             finally
94             {
95                 if(stream != null)
96                     Marshal.ReleaseComObject(stream);
97                 if(hGlobal != IntPtr.Zero)
98                     Marshal.FreeHGlobal(hGlobal);
99             }
100         }
101 
SerializeToBlob()102         Byte[] SerializeToBlob()
103         {
104             Byte [] rg = null;
105             System.Runtime.InteropServices.ComTypes.IStream stream = null;
106             IntPtr pData = IntPtr.Zero;
107             try
108             {
109                 // Stream will own the HGlobal
110                 stream = CreateStreamOnHGlobal(IntPtr.Zero, 1);
111 
112                 CoMarshalInterface(stream, ref IID_IWbemClassObject, pWbemClassObject, (UInt32)MSHCTX.MSHCTX_DIFFERENTMACHINE, IntPtr.Zero, (UInt32)MSHLFLAGS.MSHLFLAGS_TABLEWEAK);
113 
114                 System.Runtime.InteropServices.ComTypes.STATSTG statstg;
115                 stream.Stat(out statstg, (int)STATFLAG.STATFLAG_DEFAULT);
116                 rg = new Byte[statstg.cbSize];
117                 pData = GlobalLock(GetHGlobalFromStream(stream));
118                 Marshal.Copy(pData, rg, 0, (int)statstg.cbSize);
119             }
120             finally
121             {
122                 if(pData != IntPtr.Zero)
123                     GlobalUnlock(pData);
124                 if(stream != null)
125                     Marshal.ReleaseComObject(stream);
126             }
127             GC.KeepAlive(this);
128             return rg;
129         }
130 
131         // Interface methods
GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet)132         public int GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet)
133         {
134             if(pWbemClassObject == IntPtr.Zero)
135                 throw new ObjectDisposedException(name);
136             IntPtr pQualSet;
137             int hResult = WmiNetUtilsHelper.GetQualifierSet_f(3, pWbemClassObject, out pQualSet);
138             if(hResult < 0)
139                 ppQualSet = null;
140             else
141                 ppQualSet = new IWbemQualifierSetFreeThreaded(pQualSet);
142             GC.KeepAlive ( this ) ;
143             return hResult;
144         }
Get_(string wszName, Int32 lFlags, ref object pVal, ref Int32 pType, ref Int32 plFlavor)145         public int Get_(string wszName, Int32 lFlags, ref object pVal, ref Int32 pType, ref Int32 plFlavor)
146         {
147             if(pWbemClassObject == IntPtr.Zero)
148                 throw new ObjectDisposedException(name);
149             int hr = WmiNetUtilsHelper.Get_f(4, pWbemClassObject, wszName, lFlags, ref pVal, ref pType, ref plFlavor);
150             // In certain cases some instances (events and out params from method invocations)
151             // do not have a __PATH property.  Unfortunately, GetNames says the object DOES have a __PATH
152             // property.  Going under the assumption that __PATH should always exist, we make a slight fixup
153             // if we detect a missing __PATH
154             if(hr == (int)ManagementStatus.InvalidObject)
155             {
156                 if(String.Compare(wszName, "__path", StringComparison.OrdinalIgnoreCase) == 0)
157                 {
158                     hr = 0;
159                     pType = (Int32)tag_CIMTYPE_ENUMERATION.CIM_STRING;
160                     plFlavor = (Int32)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_ORIGIN_SYSTEM;
161                     pVal = DBNull.Value;
162                 }
163             }
164             GC.KeepAlive ( this ) ;
165             return hr;
166         }
Put_(string wszName, Int32 lFlags, ref object pVal, Int32 Type)167         public int Put_(string wszName, Int32 lFlags, ref object pVal, Int32 Type)
168         {
169             if(pWbemClassObject == IntPtr.Zero)
170                 throw new ObjectDisposedException(name);
171             int res = WmiNetUtilsHelper.Put_f(5, pWbemClassObject, wszName, lFlags, ref pVal, Type);
172             GC.KeepAlive ( this ) ;
173             return res ;
174         }
Delete_(string wszName)175         public int Delete_(string wszName)
176         {
177             if(pWbemClassObject == IntPtr.Zero)
178                 throw new ObjectDisposedException(name);
179             int res = WmiNetUtilsHelper.Delete_f(6, pWbemClassObject, wszName);
180             GC.KeepAlive ( this ) ;
181             return res ;
182         }
GetNames_(string wszQualifierName, Int32 lFlags, ref object pQualifierVal, out string[] pNames)183         public int GetNames_(string wszQualifierName, Int32 lFlags, ref object pQualifierVal, out string[] pNames)
184         {
185             if(pWbemClassObject == IntPtr.Zero)
186                 throw new ObjectDisposedException(name);
187             int res = WmiNetUtilsHelper.GetNames_f(7, pWbemClassObject, wszQualifierName, lFlags, ref pQualifierVal, out pNames);
188             GC.KeepAlive ( this ) ;
189             return res ;
190 
191         }
BeginEnumeration_(Int32 lEnumFlags)192         public int BeginEnumeration_(Int32 lEnumFlags)
193         {
194             if(pWbemClassObject == IntPtr.Zero)
195                 throw new ObjectDisposedException(name);
196             int res = WmiNetUtilsHelper.BeginEnumeration_f(8, pWbemClassObject, lEnumFlags);
197             GC.KeepAlive ( this ) ;
198             return res ;
199         }
Next_(Int32 lFlags, ref string strName, ref object pVal, ref Int32 pType, ref Int32 plFlavor)200         public int Next_(Int32 lFlags, ref string strName, ref object pVal, ref Int32 pType, ref Int32 plFlavor)
201         {
202             if(pWbemClassObject == IntPtr.Zero)
203                 throw new ObjectDisposedException(name);
204             pVal = null;
205             strName = null;
206             int res = WmiNetUtilsHelper.Next_f(9, pWbemClassObject, lFlags, ref strName, ref pVal, ref pType, ref plFlavor);
207             GC.KeepAlive ( this ) ;
208             return res ;
209         }
EndEnumeration_()210         public int EndEnumeration_()
211         {
212             if(pWbemClassObject == IntPtr.Zero)
213                 throw new ObjectDisposedException(name);
214             int res = WmiNetUtilsHelper.EndEnumeration_f(10, pWbemClassObject);
215             GC.KeepAlive ( this ) ;
216             return res ;
217         }
GetPropertyQualifierSet_(string wszProperty, out IWbemQualifierSetFreeThreaded ppQualSet)218         public int GetPropertyQualifierSet_(string wszProperty, out IWbemQualifierSetFreeThreaded ppQualSet)
219         {
220             if(pWbemClassObject == IntPtr.Zero)
221                 throw new ObjectDisposedException(name);
222             IntPtr pQualSet;
223             int hResult = WmiNetUtilsHelper.GetPropertyQualifierSet_f(11, pWbemClassObject, wszProperty, out pQualSet);
224             if(hResult < 0)
225                 ppQualSet = null;
226             else
227                 ppQualSet = new IWbemQualifierSetFreeThreaded(pQualSet);
228 
229             GC.KeepAlive ( this ) ;
230             return hResult;
231         }
Clone_(out IWbemClassObjectFreeThreaded ppCopy)232         public int Clone_(out IWbemClassObjectFreeThreaded ppCopy)
233         {
234             if(pWbemClassObject == IntPtr.Zero)
235                 throw new ObjectDisposedException(name);
236             IntPtr pWbemClassObjectNew;
237             int hResult = WmiNetUtilsHelper.Clone_f(12, pWbemClassObject, out pWbemClassObjectNew);
238             if(hResult < 0)
239                 ppCopy = null;
240             else
241                 ppCopy = new IWbemClassObjectFreeThreaded(pWbemClassObjectNew);
242 
243             GC.KeepAlive ( this ) ;
244             return hResult;
245         }
GetObjectText_(Int32 lFlags, out string pstrObjectText)246         public int GetObjectText_(Int32 lFlags, out string pstrObjectText)
247         {
248             if(pWbemClassObject == IntPtr.Zero)
249                 throw new ObjectDisposedException(name);
250             int res = WmiNetUtilsHelper.GetObjectText_f(13, pWbemClassObject, lFlags, out pstrObjectText);
251             GC.KeepAlive ( this ) ;
252             return res ;
253         }
SpawnDerivedClass_(Int32 lFlags, out IWbemClassObjectFreeThreaded ppNewClass)254         public int SpawnDerivedClass_(Int32 lFlags, out IWbemClassObjectFreeThreaded ppNewClass)
255         {
256             if(pWbemClassObject == IntPtr.Zero)
257                 throw new ObjectDisposedException(name);
258             IntPtr pWbemClassObjectNew;
259             int hResult = WmiNetUtilsHelper.SpawnDerivedClass_f(14, pWbemClassObject, lFlags, out pWbemClassObjectNew);
260             if(hResult < 0)
261                 ppNewClass = null;
262             else
263                 ppNewClass = new IWbemClassObjectFreeThreaded(pWbemClassObjectNew);
264 
265             GC.KeepAlive ( this ) ;
266             return hResult;
267         }
SpawnInstance_(Int32 lFlags, out IWbemClassObjectFreeThreaded ppNewInstance)268         public int SpawnInstance_(Int32 lFlags, out IWbemClassObjectFreeThreaded ppNewInstance)
269         {
270             if(pWbemClassObject == IntPtr.Zero)
271                 throw new ObjectDisposedException(name);
272             IntPtr pWbemClassObjectNew;
273             int hResult = WmiNetUtilsHelper.SpawnInstance_f(15, pWbemClassObject, lFlags, out pWbemClassObjectNew);
274             if(hResult < 0)
275                 ppNewInstance = null;
276             else
277                 ppNewInstance = new IWbemClassObjectFreeThreaded(pWbemClassObjectNew);
278 
279             GC.KeepAlive ( this ) ;
280             return hResult;
281         }
CompareTo_(Int32 lFlags, IWbemClassObjectFreeThreaded pCompareTo)282         public int CompareTo_(Int32 lFlags, IWbemClassObjectFreeThreaded pCompareTo)
283         {
284             if(pWbemClassObject == IntPtr.Zero)
285                 throw new ObjectDisposedException(name);
286             int res = WmiNetUtilsHelper.CompareTo_f(16, pWbemClassObject, lFlags, pCompareTo.pWbemClassObject);
287             GC.KeepAlive ( this ) ;
288             return res ;
289         }
GetPropertyOrigin_(string wszName, out string pstrClassName)290         public int GetPropertyOrigin_(string wszName, out string pstrClassName)
291         {
292             if(pWbemClassObject == IntPtr.Zero)
293                 throw new ObjectDisposedException(name);
294             int res = WmiNetUtilsHelper.GetPropertyOrigin_f(17, pWbemClassObject, wszName, out pstrClassName);
295             GC.KeepAlive ( this ) ;
296             return res ;
297         }
InheritsFrom_(string strAncestor)298         public int InheritsFrom_(string strAncestor)
299         {
300             if(pWbemClassObject == IntPtr.Zero)
301                 throw new ObjectDisposedException(name);
302             int res = WmiNetUtilsHelper.InheritsFrom_f(18, pWbemClassObject, strAncestor);
303             GC.KeepAlive ( this ) ;
304             return res ;
305         }
GetMethod_(string wszName, Int32 lFlags, out IWbemClassObjectFreeThreaded ppInSignature, out IWbemClassObjectFreeThreaded ppOutSignature)306         public int GetMethod_(string wszName, Int32 lFlags, out IWbemClassObjectFreeThreaded ppInSignature, out IWbemClassObjectFreeThreaded ppOutSignature)
307         {
308             if(pWbemClassObject == IntPtr.Zero)
309                 throw new ObjectDisposedException(name);
310             IntPtr pInSignature;
311             IntPtr pOutSignature;
312             int hResult = WmiNetUtilsHelper.GetMethod_f(19, pWbemClassObject, wszName, lFlags, out pInSignature, out pOutSignature);
313             ppInSignature = null;
314             ppOutSignature = null;
315             if(hResult >= 0)
316             {
317                 // This can be NULL
318                 if(pInSignature != IntPtr.Zero)
319                     ppInSignature = new IWbemClassObjectFreeThreaded(pInSignature);
320                 if(pOutSignature != IntPtr.Zero)
321                     ppOutSignature = new IWbemClassObjectFreeThreaded(pOutSignature);
322             }
323 
324             GC.KeepAlive ( this ) ;
325             return hResult;
326         }
PutMethod_(string wszName, Int32 lFlags, IWbemClassObjectFreeThreaded pInSignature, IWbemClassObjectFreeThreaded pOutSignature)327         public int PutMethod_(string wszName, Int32 lFlags, IWbemClassObjectFreeThreaded pInSignature, IWbemClassObjectFreeThreaded pOutSignature)
328         {
329             if(pWbemClassObject == IntPtr.Zero)
330                 throw new ObjectDisposedException(name);
331             int res = WmiNetUtilsHelper.PutMethod_f(20, pWbemClassObject, wszName, lFlags, pInSignature, pOutSignature);
332             GC.KeepAlive ( this ) ;
333             return res ;
334         }
DeleteMethod_(string wszName)335         public int DeleteMethod_(string wszName)
336         {
337             if(pWbemClassObject == IntPtr.Zero)
338                 throw new ObjectDisposedException(name);
339             int res = WmiNetUtilsHelper.DeleteMethod_f(21, pWbemClassObject, wszName);
340             GC.KeepAlive ( this ) ;
341             return res ;
342         }
BeginMethodEnumeration_(Int32 lEnumFlags)343         public int BeginMethodEnumeration_(Int32 lEnumFlags)
344         {
345             if(pWbemClassObject == IntPtr.Zero)
346                 throw new ObjectDisposedException(name);
347             int res =  WmiNetUtilsHelper.BeginMethodEnumeration_f(22, pWbemClassObject, lEnumFlags);
348             GC.KeepAlive ( this ) ;
349             return res ;
350         }
NextMethod_(Int32 lFlags, out string pstrName, out IWbemClassObjectFreeThreaded ppInSignature, out IWbemClassObjectFreeThreaded ppOutSignature)351         public int NextMethod_(Int32 lFlags, out string pstrName, out IWbemClassObjectFreeThreaded ppInSignature, out IWbemClassObjectFreeThreaded ppOutSignature)
352         {
353             if(pWbemClassObject == IntPtr.Zero)
354                 throw new ObjectDisposedException(name);
355 
356             IntPtr pInSignature;
357             IntPtr pOutSignature;
358             int hResult = WmiNetUtilsHelper.NextMethod_f(23, pWbemClassObject, lFlags, out pstrName, out pInSignature, out pOutSignature);
359             ppInSignature = null;
360             ppOutSignature = null;
361             if(hResult >= 0)
362             {
363                 // This can be NULL
364                 if(pInSignature != IntPtr.Zero)
365                     ppInSignature = new IWbemClassObjectFreeThreaded(pInSignature);
366                 if(pOutSignature != IntPtr.Zero)
367                     ppOutSignature = new IWbemClassObjectFreeThreaded(pOutSignature);
368             }
369             GC.KeepAlive ( this ) ;
370             return hResult;
371         }
EndMethodEnumeration_()372         public int EndMethodEnumeration_()
373         {
374             if(pWbemClassObject == IntPtr.Zero)
375                 throw new ObjectDisposedException(name);
376             int res = WmiNetUtilsHelper.EndMethodEnumeration_f(24, pWbemClassObject);
377             GC.KeepAlive ( this ) ;
378             return res ;
379         }
GetMethodQualifierSet_(string wszMethod, out IWbemQualifierSetFreeThreaded ppQualSet)380         public int GetMethodQualifierSet_(string wszMethod, out IWbemQualifierSetFreeThreaded ppQualSet)
381         {
382             if(pWbemClassObject == IntPtr.Zero)
383                 throw new ObjectDisposedException(name);
384             IntPtr pQualSet;
385             int hResult = WmiNetUtilsHelper.GetMethodQualifierSet_f(25, pWbemClassObject, wszMethod, out pQualSet);
386             if(hResult < 0)
387                 ppQualSet = null;
388             else
389                 ppQualSet = new IWbemQualifierSetFreeThreaded(pQualSet);
390             GC.KeepAlive ( this ) ;
391             return hResult;
392         }
GetMethodOrigin_(string wszMethodName, out string pstrClassName)393         public int GetMethodOrigin_(string wszMethodName, out string pstrClassName)
394         {
395             if(pWbemClassObject == IntPtr.Zero)
396                 throw new ObjectDisposedException(name);
397             int res = WmiNetUtilsHelper.GetMethodOrigin_f(26, pWbemClassObject, wszMethodName, out pstrClassName);
398             GC.KeepAlive ( this ) ;
399             return res ;
400         }
401 
402         enum STATFLAG
403         {
404             STATFLAG_DEFAULT    = 0,
405             STATFLAG_NONAME     = 1
406         }
407 
408         enum MSHCTX
409         {
410             MSHCTX_LOCAL               = 0,
411             MSHCTX_NOSHAREDMEM         = 1,
412             MSHCTX_DIFFERENTMACHINE    = 2,
413             MSHCTX_INPROC              = 3
414         }
415 
416         enum MSHLFLAGS
417         {
418             MSHLFLAGS_NORMAL         = 0,
419             MSHLFLAGS_TABLESTRONG    = 1,
420             MSHLFLAGS_TABLEWEAK      = 2,
421             MSHLFLAGS_NOPING         = 3
422         }
423 
424         [ResourceExposure( ResourceScope.None),DllImport("ole32.dll", PreserveSig=false)]
CreateStreamOnHGlobal(IntPtr hGlobal, int fDeleteOnRelease)425         static extern System.Runtime.InteropServices.ComTypes.IStream CreateStreamOnHGlobal(IntPtr hGlobal, int fDeleteOnRelease);
426 
427         [ResourceExposure( ResourceScope.None),DllImport("ole32.dll", PreserveSig=false)]
GetHGlobalFromStream([In] System.Runtime.InteropServices.ComTypes.IStream pstm)428         static extern IntPtr GetHGlobalFromStream([In] System.Runtime.InteropServices.ComTypes.IStream pstm);
429 
430         [ResourceExposure( ResourceScope.None),DllImport("kernel32.dll", PreserveSig=true)]
GlobalLock([In] IntPtr hGlobal)431         static extern IntPtr GlobalLock([In] IntPtr hGlobal);
432 
433         [ResourceExposure( ResourceScope.None),DllImport("kernel32.dll", PreserveSig=true)]
GlobalUnlock([In] IntPtr pData)434         static extern int GlobalUnlock([In] IntPtr pData);
435 
436         [ResourceExposure( ResourceScope.None),DllImport("ole32.dll", PreserveSig=false)]
CoMarshalInterface( [In] System.Runtime.InteropServices.ComTypes.IStream pStm, [In] ref Guid riid, [In] IntPtr Unk, [In] UInt32 dwDestContext, [In] IntPtr pvDestContext, [In] UInt32 mshlflags )437         static extern void CoMarshalInterface(
438             [In] System.Runtime.InteropServices.ComTypes.IStream pStm,        //Pointer to the stream used for marshaling
439             [In] ref Guid riid,          //Reference to the identifier of the
440             [In] IntPtr Unk,      //Pointer to the interface to be marshaled
441             [In] UInt32 dwDestContext,  //Destination process
442             [In] IntPtr pvDestContext,   //Reserved for future use
443             [In] UInt32 mshlflags       //Reason for marshaling
444             );
445 
446         [ResourceExposure( ResourceScope.None),DllImport("ole32.dll", PreserveSig=false)]
CoUnmarshalInterface( [In] System.Runtime.InteropServices.ComTypes.IStream pStm, [In] ref Guid riid )447         static extern IntPtr CoUnmarshalInterface(
448             [In] System.Runtime.InteropServices.ComTypes.IStream pStm,  //Pointer to the stream
449             [In] ref Guid riid     //Reference to the identifier of the interface
450             );
451     }
452 
453     sealed class IWbemQualifierSetFreeThreaded : IDisposable
454     {
455         const string SerializationBlobName = "flatWbemClassObject";
456         static readonly string name = typeof(IWbemQualifierSetFreeThreaded).FullName;
457         public static Guid IID_IWbemClassObject = new Guid("DC12A681-737F-11CF-884D-00AA004B2E24");
458 
459         IntPtr pWbemQualifierSet = IntPtr.Zero;
IWbemQualifierSetFreeThreaded(IntPtr pWbemQualifierSet)460         public IWbemQualifierSetFreeThreaded(IntPtr pWbemQualifierSet)
461         {
462             // This instance will now own a single ref count on pWbemClassObject
463             this.pWbemQualifierSet = pWbemQualifierSet;
464         }
465 
Dispose()466         public void Dispose()
467         {
468             Dispose_(false) ;
469         }
470 
Dispose_( bool finalization )471         private void Dispose_( bool finalization )
472         {
473             if(pWbemQualifierSet != IntPtr.Zero)
474             {
475                 Marshal.Release(pWbemQualifierSet);
476                 pWbemQualifierSet = IntPtr.Zero;
477             }
478             if ( finalization == false )
479             {
480                 GC.KeepAlive(this);
481             }
482             GC.SuppressFinalize(this);
483         }
484 
485 
~IWbemQualifierSetFreeThreaded()486         ~IWbemQualifierSetFreeThreaded()
487         {
488             Dispose_(true);
489         }
490 
Get_(string wszName, Int32 lFlags, ref object pVal, ref Int32 plFlavor)491         public int Get_(string wszName, Int32 lFlags, ref object pVal, ref Int32 plFlavor)
492         {
493             if(pWbemQualifierSet == IntPtr.Zero)
494                 throw new ObjectDisposedException(name);
495             int res = WmiNetUtilsHelper.QualifierGet_f(3, pWbemQualifierSet, wszName, lFlags, ref pVal, ref plFlavor);
496             GC.KeepAlive ( this ) ;
497             return res ;
498 
499         }
Put_(string wszName, ref object pVal, Int32 lFlavor)500         public int Put_(string wszName, ref object pVal, Int32 lFlavor)
501         {
502             if(pWbemQualifierSet == IntPtr.Zero)
503                 throw new ObjectDisposedException(name);
504             int res =  WmiNetUtilsHelper.QualifierPut_f(4, pWbemQualifierSet, wszName, ref pVal, lFlavor);
505             GC.KeepAlive ( this ) ;
506             return res ;
507         }
Delete_(string wszName)508         public int Delete_(string wszName)
509         {
510             if(pWbemQualifierSet == IntPtr.Zero)
511                 throw new ObjectDisposedException(name);
512             int res = WmiNetUtilsHelper.QualifierDelete_f(5, pWbemQualifierSet, wszName);
513             GC.KeepAlive ( this ) ;
514             return res ;
515         }
GetNames_(Int32 lFlags, out string[] pNames)516         public int GetNames_(Int32 lFlags, out string[] pNames)
517         {
518             if(pWbemQualifierSet == IntPtr.Zero)
519                 throw new ObjectDisposedException(name);
520             int res = WmiNetUtilsHelper.QualifierGetNames_f(6, pWbemQualifierSet, lFlags, out pNames);
521             GC.KeepAlive ( this ) ;
522             return res ;
523         }
BeginEnumeration_(Int32 lFlags)524         public int BeginEnumeration_(Int32 lFlags)
525         {
526             if(pWbemQualifierSet == IntPtr.Zero)
527                 throw new ObjectDisposedException(name);
528             int res = WmiNetUtilsHelper.QualifierBeginEnumeration_f(7, pWbemQualifierSet, lFlags);
529             GC.KeepAlive ( this ) ;
530             return res ;
531         }
Next_(Int32 lFlags, out string pstrName, out object pVal, out Int32 plFlavor)532         public int Next_(Int32 lFlags, out string pstrName, out object pVal, out Int32 plFlavor)
533         {
534             if(pWbemQualifierSet == IntPtr.Zero)
535                 throw new ObjectDisposedException(name);
536             int res = WmiNetUtilsHelper.QualifierNext_f(8, pWbemQualifierSet, lFlags, out pstrName, out pVal, out plFlavor);
537             GC.KeepAlive ( this ) ;
538             return res ;
539         }
EndEnumeration_()540         public int EndEnumeration_()
541         {
542             if(pWbemQualifierSet == IntPtr.Zero)
543                 throw new ObjectDisposedException(name);
544             int res = WmiNetUtilsHelper.QualifierEndEnumeration_f(9, pWbemQualifierSet);
545             GC.KeepAlive ( this ) ;
546             return res ;
547         }
548     }
549 
550     class MarshalWbemObject : ICustomMarshaler
551     {
GetInstance(string cookie)552         public static ICustomMarshaler GetInstance(string cookie)
553         {
554             return new MarshalWbemObject(cookie);
555         }
556 
557         string cookie;
MarshalWbemObject(string cookie)558         MarshalWbemObject(string cookie)
559         {
560             this.cookie = cookie;
561         }
562 
CleanUpManagedData(object obj)563         public void CleanUpManagedData(object obj)
564         {
565         }
566 
CleanUpNativeData(IntPtr pObj)567         public void CleanUpNativeData(IntPtr pObj)
568         {
569         }
570 
GetNativeDataSize()571         public int GetNativeDataSize()
572         {
573             return -1; // not a value type, so use -1
574         }
575 
MarshalManagedToNative(object obj)576         public IntPtr MarshalManagedToNative(object obj)
577         {
578             return (IntPtr)obj;
579         }
580 
MarshalNativeToManaged(IntPtr pObj)581         public object MarshalNativeToManaged(IntPtr pObj)
582         {
583             return new IWbemClassObjectFreeThreaded(pObj);
584         }
585     }
586     #endregion
587 
588     #region Interfaces
589     [InterfaceTypeAttribute(0x0001)]
590     ///[TypeLibTypeAttribute(0x0200)]
591     [GuidAttribute("DC12A681-737F-11CF-884D-00AA004B2E24")]
592     [ComImport]
593     interface IWbemClassObject_DoNotMarshal
594     {
GetQualifierSet_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)595         [PreserveSig] int GetQualifierSet_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
Get_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor)596         [PreserveSig] int Get_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor);
Put_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In] ref object pVal, [In] Int32 Type)597         [PreserveSig] int Put_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In] ref object pVal, [In] Int32 Type);
Delete_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName)598         [PreserveSig] int Delete_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName);
GetNames_([In][MarshalAs(UnmanagedType.LPWStr)] string wszQualifierName, [In] Int32 lFlags, [In] ref object pQualifierVal, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)] out string[] pNames)599         [PreserveSig] int GetNames_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQualifierName, [In] Int32 lFlags, [In] ref object pQualifierVal, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]  out string[]   pNames);
BeginEnumeration_([In] Int32 lEnumFlags)600         [PreserveSig] int BeginEnumeration_([In] Int32 lEnumFlags);
Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)] ref string strName, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor)601         [PreserveSig] int Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)]  ref string   strName, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor);
EndEnumeration_()602         [PreserveSig] int EndEnumeration_();
GetPropertyQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)] string wszProperty, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)603         [PreserveSig] int GetPropertyQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszProperty, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
Clone_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppCopy)604         [PreserveSig] int Clone_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppCopy);
GetObjectText_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrObjectText)605         [PreserveSig] int GetObjectText_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrObjectText);
SpawnDerivedClass_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppNewClass)606         [PreserveSig] int SpawnDerivedClass_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppNewClass);
SpawnInstance_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppNewInstance)607         [PreserveSig] int SpawnInstance_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppNewInstance);
CompareTo_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pCompareTo)608         [PreserveSig] int CompareTo_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pCompareTo);
GetPropertyOrigin_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrClassName)609         [PreserveSig] int GetPropertyOrigin_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrClassName);
InheritsFrom_([In][MarshalAs(UnmanagedType.LPWStr)] string strAncestor)610         [PreserveSig] int InheritsFrom_([In][MarshalAs(UnmanagedType.LPWStr)]  string   strAncestor);
GetMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppInSignature, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppOutSignature)611         [PreserveSig] int GetMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppInSignature, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppOutSignature);
PutMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInSignature, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pOutSignature)612         [PreserveSig] int PutMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInSignature, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pOutSignature);
DeleteMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName)613         [PreserveSig] int DeleteMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName);
BeginMethodEnumeration_([In] Int32 lEnumFlags)614         [PreserveSig] int BeginMethodEnumeration_([In] Int32 lEnumFlags);
NextMethod_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)] ref string pstrName, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppInSignature, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppOutSignature)615         [PreserveSig] int NextMethod_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)]  ref string   pstrName, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppInSignature, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppOutSignature);
EndMethodEnumeration_()616         [PreserveSig] int EndMethodEnumeration_();
GetMethodQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMethod, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)617         [PreserveSig] int GetMethodQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMethod, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
GetMethodOrigin_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMethodName, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrClassName)618         [PreserveSig] int GetMethodOrigin_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMethodName, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrClassName);
619     }
620 
621     [InterfaceTypeAttribute(0x0001)]
622     [GuidAttribute("DC12A680-737F-11CF-884D-00AA004B2E24")]
623     ///[TypeLibTypeAttribute(0x0200)]
624     [ComImport]
625     interface IWbemQualifierSet_DoNotMarshal
626     {
Get_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 plFlavor)627         [PreserveSig] int Get_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 plFlavor);
Put_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] ref object pVal, [In] Int32 lFlavor)628         [PreserveSig] int Put_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] ref object pVal, [In] Int32 lFlavor);
Delete_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName)629         [PreserveSig] int Delete_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName);
GetNames_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)] out string[] pNames)630         [PreserveSig] int GetNames_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]  out string[]   pNames);
BeginEnumeration_([In] Int32 lFlags)631         [PreserveSig] int BeginEnumeration_([In] Int32 lFlags);
Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)] ref string pstrName, [In][Out] ref object pVal, [In][Out] ref Int32 plFlavor)632         [PreserveSig] int Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)]  ref string   pstrName, [In][Out] ref object pVal, [In][Out] ref Int32 plFlavor);
EndEnumeration_()633         [PreserveSig] int EndEnumeration_();
634     }
635 
636     [InterfaceTypeAttribute(0x0001)]
637     ///[TypeLibTypeAttribute(0x0200)]
638     [GuidAttribute("DC12A687-737F-11CF-884D-00AA004B2E24")]
639     [ComImport]
640     interface IWbemLocator
641     {
ConnectServer_([In][MarshalAs(UnmanagedType.BStr)] string strNetworkResource, [In][MarshalAs(UnmanagedType.BStr)] string strUser, [In]IntPtr strPassword, [In][MarshalAs(UnmanagedType.BStr)] string strLocale, [In] Int32 lSecurityFlags, [In][MarshalAs(UnmanagedType.BStr)] string strAuthority, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemServices ppNamespace)642         [PreserveSig] int ConnectServer_([In][MarshalAs(UnmanagedType.BStr)]  string   strNetworkResource, [In][MarshalAs(UnmanagedType.BStr)]  string   strUser, [In]IntPtr   strPassword, [In][MarshalAs(UnmanagedType.BStr)]  string   strLocale, [In] Int32 lSecurityFlags, [In][MarshalAs(UnmanagedType.BStr)]  string   strAuthority, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemServices   ppNamespace);
643     }
644 
645     [GuidAttribute("44ACA674-E8FC-11D0-A07C-00C04FB68820")]
646     ///[TypeLibTypeAttribute(0x0200)]
647     [InterfaceTypeAttribute(0x0001)]
648     [ComImport]
649     interface IWbemContext
650     {
Clone_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemContext ppNewCopy)651         [PreserveSig] int Clone_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemContext   ppNewCopy);
GetNames_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)] out string[] pNames)652         [PreserveSig] int GetNames_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]  out string[]   pNames);
BeginEnumeration_([In] Int32 lFlags)653         [PreserveSig] int BeginEnumeration_([In] Int32 lFlags);
Next_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrName, [Out] out object pValue)654         [PreserveSig] int Next_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrName, [Out] out object pValue);
EndEnumeration_()655         [PreserveSig] int EndEnumeration_();
SetValue_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In] ref object pValue)656         [PreserveSig] int SetValue_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In] ref object pValue);
GetValue_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [Out] out object pValue)657         [PreserveSig] int GetValue_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [Out] out object pValue);
DeleteValue_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags)658         [PreserveSig] int DeleteValue_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags);
DeleteAll_()659         [PreserveSig] int DeleteAll_();
660     }
661 
662     [InterfaceTypeAttribute(0x0001)]
663     ///[TypeLibTypeAttribute(0x0200)]
664     [GuidAttribute("9556DC99-828C-11CF-A37E-00AA003240C7")]
665     [ComImport]
666     interface IWbemServices
667     {
OpenNamespace_([In][MarshalAs(UnmanagedType.BStr)] string strNamespace, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemServices ppWorkingNamespace, [In] IntPtr ppCallResult)668         [PreserveSig] int OpenNamespace_([In][MarshalAs(UnmanagedType.BStr)]  string   strNamespace, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemServices   ppWorkingNamespace, [In] IntPtr ppCallResult);
CancelAsyncCall_([In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pSink)669         [PreserveSig] int CancelAsyncCall_([In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pSink);
QueryObjectSink_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemObjectSink ppResponseHandler)670         [PreserveSig] int QueryObjectSink_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemObjectSink   ppResponseHandler);
GetObject_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppObject, [In] IntPtr ppCallResult)671         [PreserveSig] int GetObject_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppObject, [In] IntPtr ppCallResult);
GetObjectAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)672         [PreserveSig] int GetObjectAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
PutClass_([In] IntPtr pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)673         [PreserveSig] int PutClass_([In] IntPtr pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
PutClassAsync_([In] IntPtr pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)674         [PreserveSig] int PutClassAsync_([In] IntPtr pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
DeleteClass_([In][MarshalAs(UnmanagedType.BStr)] string strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)675         [PreserveSig] int DeleteClass_([In][MarshalAs(UnmanagedType.BStr)]  string   strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
DeleteClassAsync_([In][MarshalAs(UnmanagedType.BStr)] string strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)676         [PreserveSig] int DeleteClassAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
CreateClassEnum_([In][MarshalAs(UnmanagedType.BStr)] string strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)677         [PreserveSig] int CreateClassEnum_([In][MarshalAs(UnmanagedType.BStr)]  string   strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
CreateClassEnumAsync_([In][MarshalAs(UnmanagedType.BStr)] string strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)678         [PreserveSig] int CreateClassEnumAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
PutInstance_([In] IntPtr pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)679         [PreserveSig] int PutInstance_([In] IntPtr pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
PutInstanceAsync_([In] IntPtr pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)680         [PreserveSig] int PutInstanceAsync_([In] IntPtr pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
DeleteInstance_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)681         [PreserveSig] int DeleteInstance_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
DeleteInstanceAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)682         [PreserveSig] int DeleteInstanceAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
CreateInstanceEnum_([In][MarshalAs(UnmanagedType.BStr)] string strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)683         [PreserveSig] int CreateInstanceEnum_([In][MarshalAs(UnmanagedType.BStr)]  string   strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
CreateInstanceEnumAsync_([In][MarshalAs(UnmanagedType.BStr)] string strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)684         [PreserveSig] int CreateInstanceEnumAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecQuery_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)685         [PreserveSig] int ExecQuery_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
ExecQueryAsync_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)686         [PreserveSig] int ExecQueryAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecNotificationQuery_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)687         [PreserveSig] int ExecNotificationQuery_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
ExecNotificationQueryAsync_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)688         [PreserveSig] int ExecNotificationQueryAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecMethod_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In][MarshalAs(UnmanagedType.BStr)] string strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr pInParams, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppOutParams, [In] IntPtr ppCallResult)689         [PreserveSig] int ExecMethod_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In][MarshalAs(UnmanagedType.BStr)]  string   strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr pInParams, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppOutParams, [In] IntPtr ppCallResult);
ExecMethodAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In][MarshalAs(UnmanagedType.BStr)] string strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr pInParams, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)690         [PreserveSig] int ExecMethodAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In][MarshalAs(UnmanagedType.BStr)]  string   strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr pInParams, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
691     }
692 
693     [InterfaceTypeAttribute(0x0001)]
694     ///[TypeLibTypeAttribute(0x0200)]
695     [GuidAttribute("9556DC99-828C-11CF-A37E-00AA003240C7")]
696     [ComImport]
697     interface IWbemServices_Old
698     {
OpenNamespace_([In][MarshalAs(UnmanagedType.BStr)] string strNamespace, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemServices ppWorkingNamespace, [In] IntPtr ppCallResult)699         [PreserveSig] int OpenNamespace_([In][MarshalAs(UnmanagedType.BStr)]  string   strNamespace, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemServices   ppWorkingNamespace, [In] IntPtr ppCallResult);
CancelAsyncCall_([In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pSink)700         [PreserveSig] int CancelAsyncCall_([In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pSink);
QueryObjectSink_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemObjectSink ppResponseHandler)701         [PreserveSig] int QueryObjectSink_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemObjectSink   ppResponseHandler);
GetObject_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppObject, [In] IntPtr ppCallResult)702         [PreserveSig] int GetObject_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppObject, [In] IntPtr ppCallResult);
GetObjectAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)703         [PreserveSig] int GetObjectAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
PutClass_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)704         [PreserveSig] int PutClass_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
PutClassAsync_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)705         [PreserveSig] int PutClassAsync_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pObject, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
DeleteClass_([In][MarshalAs(UnmanagedType.BStr)] string strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)706         [PreserveSig] int DeleteClass_([In][MarshalAs(UnmanagedType.BStr)]  string   strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
DeleteClassAsync_([In][MarshalAs(UnmanagedType.BStr)] string strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)707         [PreserveSig] int DeleteClassAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strClass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
CreateClassEnum_([In][MarshalAs(UnmanagedType.BStr)] string strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)708         [PreserveSig] int CreateClassEnum_([In][MarshalAs(UnmanagedType.BStr)]  string   strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
CreateClassEnumAsync_([In][MarshalAs(UnmanagedType.BStr)] string strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)709         [PreserveSig] int CreateClassEnumAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strSuperclass, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
PutInstance_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)710         [PreserveSig] int PutInstance_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
PutInstanceAsync_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)711         [PreserveSig] int PutInstanceAsync_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInst, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
DeleteInstance_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In] IntPtr ppCallResult)712         [PreserveSig] int DeleteInstance_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In] IntPtr ppCallResult);
DeleteInstanceAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)713         [PreserveSig] int DeleteInstanceAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
CreateInstanceEnum_([In][MarshalAs(UnmanagedType.BStr)] string strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)714         [PreserveSig] int CreateInstanceEnum_([In][MarshalAs(UnmanagedType.BStr)]  string   strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
CreateInstanceEnumAsync_([In][MarshalAs(UnmanagedType.BStr)] string strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)715         [PreserveSig] int CreateInstanceEnumAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strFilter, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecQuery_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)716         [PreserveSig] int ExecQuery_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
ExecQueryAsync_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)717         [PreserveSig] int ExecQueryAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecNotificationQuery_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)718         [PreserveSig] int ExecNotificationQuery_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
ExecNotificationQueryAsync_([In][MarshalAs(UnmanagedType.BStr)] string strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)] string strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)719         [PreserveSig] int ExecNotificationQueryAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strQueryLanguage, [In][MarshalAs(UnmanagedType.BStr)]  string   strQuery, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
ExecMethod_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In][MarshalAs(UnmanagedType.BStr)] string strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInParams, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppOutParams, [In] IntPtr ppCallResult)720         [PreserveSig] int ExecMethod_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In][MarshalAs(UnmanagedType.BStr)]  string   strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInParams, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppOutParams, [In] IntPtr ppCallResult);
ExecMethodAsync_([In][MarshalAs(UnmanagedType.BStr)] string strObjectPath, [In][MarshalAs(UnmanagedType.BStr)] string strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInParams, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pResponseHandler)721         [PreserveSig] int ExecMethodAsync_([In][MarshalAs(UnmanagedType.BStr)]  string   strObjectPath, [In][MarshalAs(UnmanagedType.BStr)]  string   strMethodName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInParams, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pResponseHandler);
722     }
723 
724     [GuidAttribute("44ACA675-E8FC-11D0-A07C-00C04FB68820")]
725     ///[TypeLibTypeAttribute(0x0200)]
726     [InterfaceTypeAttribute(0x0001)]
727     [ComImport]
728     interface IWbemCallResult
729     {
GetResultObject_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppResultObject)730         [PreserveSig] int GetResultObject_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(MarshalWbemObject))] out IWbemClassObjectFreeThreaded ppResultObject);
GetResultString_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrResultString)731         [PreserveSig] int GetResultString_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrResultString);
GetResultServices_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemServices ppServices)732         [PreserveSig] int GetResultServices_([In] Int32 lTimeout, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemServices   ppServices);
GetCallStatus_([In] Int32 lTimeout, [Out] out Int32 plStatus)733         [PreserveSig] int GetCallStatus_([In] Int32 lTimeout, [Out] out Int32 plStatus);
734     }
735 
736     ///[TypeLibTypeAttribute(0x0200)]
737     [GuidAttribute("7C857801-7381-11CF-884D-00AA004B2E24")]
738     [InterfaceTypeAttribute(0x0001)]
739     [ComImport]
740     interface IWbemObjectSink
741     {
Indicate_([In] Int32 lObjectCount, [In][MarshalAs(UnmanagedType.LPArray)] IntPtr[] apObjArray)742         [PreserveSig] int Indicate_([In] Int32 lObjectCount, [In][MarshalAs(UnmanagedType.LPArray)] IntPtr[] apObjArray);
SetStatus_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Error)] Int32 hResult, [In][MarshalAs(UnmanagedType.BStr)] string strParam, [In] IntPtr pObjParam)743         [PreserveSig] int SetStatus_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Error)]  Int32   hResult, [In][MarshalAs(UnmanagedType.BStr)]  string   strParam, [In] IntPtr pObjParam);
744     }
745 
746     [InterfaceTypeAttribute(0x0001)]
747     ///[TypeLibTypeAttribute(0x0200)]
748     [GuidAttribute("027947E1-D731-11CE-A357-000000000001")]
749     [ComImport]
750     interface IEnumWbemClassObject
751     {
Reset_()752         [PreserveSig] int Reset_();
Next_([In] Int32 lTimeout, [In] UInt32 uCount, [In][Out][MarshalAs(UnmanagedType.LPArray)] IWbemClassObject_DoNotMarshal[] apObjects, [Out] out UInt32 puReturned)753         [PreserveSig] int Next_([In] Int32 lTimeout, [In] UInt32 uCount, [In][Out][MarshalAs(UnmanagedType.LPArray)] IWbemClassObject_DoNotMarshal[] apObjects, [Out] out UInt32 puReturned);
NextAsync_([In] UInt32 uCount, [In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pSink)754         [PreserveSig] int NextAsync_([In] UInt32 uCount, [In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pSink);
Clone_([Out][MarshalAs(UnmanagedType.Interface)] out IEnumWbemClassObject ppEnum)755         [PreserveSig] int Clone_([Out][MarshalAs(UnmanagedType.Interface)]  out IEnumWbemClassObject   ppEnum);
Skip_([In] Int32 lTimeout, [In] UInt32 nCount)756         [PreserveSig] int Skip_([In] Int32 lTimeout, [In] UInt32 nCount);
757     }
758 
759     [InterfaceTypeAttribute(0x0001)]
760     [GuidAttribute("B7B31DF9-D515-11D3-A11C-00105A1F515A")]
761     [ComImport]
762     interface IWbemShutdown
763     {
Shutdown_([In] Int32 uReason, [In] UInt32 uMaxMilliseconds, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx)764         [PreserveSig] int Shutdown_([In] Int32 uReason, [In] UInt32 uMaxMilliseconds, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx);
765     }
766 
767     [InterfaceTypeAttribute(0x0001)]
768     ///[TypeLibTypeAttribute(0x0200)]
769     [GuidAttribute("BFBF883A-CAD7-11D3-A11B-00105A1F515A")]
770     [ComImport]
771     interface IWbemObjectTextSrc
772     {
GetText_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pObj, [In] UInt32 uObjTextFormat, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.BStr)] out string strText)773         [PreserveSig] int GetText_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pObj, [In] UInt32 uObjTextFormat, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.BStr)]  out string   strText);
CreateFromText_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)] string strText, [In] UInt32 uObjTextFormat, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal pNewObj)774         [PreserveSig] int CreateFromText_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)]  string   strText, [In] UInt32 uObjTextFormat, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   pNewObj);
775     }
776 
777     [GuidAttribute("49353C9A-516B-11D1-AEA6-00C04FB68820")]
778     ///[TypeLibTypeAttribute(0x0200)]
779     [InterfaceTypeAttribute(0x0001)]
780     [ComImport]
781     interface IWbemObjectAccess
782     {
GetQualifierSet_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)783         [PreserveSig] int GetQualifierSet_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
Get_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor)784         [PreserveSig] int Get_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor);
Put_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In] ref object pVal, [In] Int32 Type)785         [PreserveSig] int Put_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In] ref object pVal, [In] Int32 Type);
Delete_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName)786         [PreserveSig] int Delete_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName);
GetNames_([In][MarshalAs(UnmanagedType.LPWStr)] string wszQualifierName, [In] Int32 lFlags, [In] ref object pQualifierVal, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)] out string[] pNames)787         [PreserveSig] int GetNames_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQualifierName, [In] Int32 lFlags, [In] ref object pQualifierVal, [Out][MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]  out string[]   pNames);
BeginEnumeration_([In] Int32 lEnumFlags)788         [PreserveSig] int BeginEnumeration_([In] Int32 lEnumFlags);
Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)] ref string strName, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor)789         [PreserveSig] int Next_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)]  ref string   strName, [In][Out] ref object pVal, [In][Out] ref Int32 pType, [In][Out] ref Int32 plFlavor);
EndEnumeration_()790         [PreserveSig] int EndEnumeration_();
GetPropertyQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)] string wszProperty, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)791         [PreserveSig] int GetPropertyQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszProperty, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
Clone_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppCopy)792         [PreserveSig] int Clone_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppCopy);
GetObjectText_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrObjectText)793         [PreserveSig] int GetObjectText_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrObjectText);
SpawnDerivedClass_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppNewClass)794         [PreserveSig] int SpawnDerivedClass_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppNewClass);
SpawnInstance_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppNewInstance)795         [PreserveSig] int SpawnInstance_([In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppNewInstance);
CompareTo_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pCompareTo)796         [PreserveSig] int CompareTo_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pCompareTo);
GetPropertyOrigin_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrClassName)797         [PreserveSig] int GetPropertyOrigin_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrClassName);
InheritsFrom_([In][MarshalAs(UnmanagedType.LPWStr)] string strAncestor)798         [PreserveSig] int InheritsFrom_([In][MarshalAs(UnmanagedType.LPWStr)]  string   strAncestor);
GetMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppInSignature, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemClassObject_DoNotMarshal ppOutSignature)799         [PreserveSig] int GetMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppInSignature, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemClassObject_DoNotMarshal   ppOutSignature);
PutMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pInSignature, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pOutSignature)800         [PreserveSig] int PutMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pInSignature, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pOutSignature);
DeleteMethod_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName)801         [PreserveSig] int DeleteMethod_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName);
BeginMethodEnumeration_([In] Int32 lEnumFlags)802         [PreserveSig] int BeginMethodEnumeration_([In] Int32 lEnumFlags);
NextMethod_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)] ref string pstrName, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppInSignature, [In][Out][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal ppOutSignature)803         [PreserveSig] int NextMethod_([In] Int32 lFlags, [In][Out][MarshalAs(UnmanagedType.BStr)]  ref string   pstrName, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppInSignature, [In][Out][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   ppOutSignature);
EndMethodEnumeration_()804         [PreserveSig] int EndMethodEnumeration_();
GetMethodQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMethod, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemQualifierSet_DoNotMarshal ppQualSet)805         [PreserveSig] int GetMethodQualifierSet_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMethod, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemQualifierSet_DoNotMarshal   ppQualSet);
GetMethodOrigin_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMethodName, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrClassName)806         [PreserveSig] int GetMethodOrigin_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMethodName, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrClassName);
GetPropertyHandle_([In][MarshalAs(UnmanagedType.LPWStr)] string wszPropertyName, [Out] out Int32 pType, [Out] out Int32 plHandle)807         [PreserveSig] int GetPropertyHandle_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszPropertyName, [Out] out Int32 pType, [Out] out Int32 plHandle);
WritePropertyValue_([In] Int32 lHandle, [In] Int32 lNumBytes, [In] ref Byte aData)808         [PreserveSig] int WritePropertyValue_([In] Int32 lHandle, [In] Int32 lNumBytes, [In] ref Byte aData);
ReadPropertyValue_([In] Int32 lHandle, [In] Int32 lBufferSize, [Out] out Int32 plNumBytes, [Out] out Byte aData)809         [PreserveSig] int ReadPropertyValue_([In] Int32 lHandle, [In] Int32 lBufferSize, [Out] out Int32 plNumBytes, [Out] out Byte aData);
ReadDWORD_([In] Int32 lHandle, [Out] out UInt32 pdw)810         [PreserveSig] int ReadDWORD_([In] Int32 lHandle, [Out] out UInt32 pdw);
WriteDWORD_([In] Int32 lHandle, [In] UInt32 dw)811         [PreserveSig] int WriteDWORD_([In] Int32 lHandle, [In] UInt32 dw);
ReadQWORD_([In] Int32 lHandle, [Out] out UInt64 pqw)812         [PreserveSig] int ReadQWORD_([In] Int32 lHandle, [Out] out UInt64 pqw);
WriteQWORD_([In] Int32 lHandle, [In] UInt64 pw)813         [PreserveSig] int WriteQWORD_([In] Int32 lHandle, [In] UInt64 pw);
GetPropertyInfoByHandle_([In] Int32 lHandle, [Out][MarshalAs(UnmanagedType.BStr)] out string pstrName, [Out] out Int32 pType)814         [PreserveSig] int GetPropertyInfoByHandle_([In] Int32 lHandle, [Out][MarshalAs(UnmanagedType.BStr)]  out string   pstrName, [Out] out Int32 pType);
Lock_([In] Int32 lFlags)815         [PreserveSig] int Lock_([In] Int32 lFlags);
Unlock_([In] Int32 lFlags)816         [PreserveSig] int Unlock_([In] Int32 lFlags);
817     }
818 
819     [GuidAttribute("1CFABA8C-1523-11D1-AD79-00C04FD8FDFF")]
820     ///[TypeLibTypeAttribute(0x0200)]
821     [InterfaceTypeAttribute(0x0001)]
822     [ComImport]
823     interface IUnsecuredApartment
824     {
CreateObjectStub_([In][MarshalAs(UnmanagedType.IUnknown)] object pObject, [Out][MarshalAs(UnmanagedType.IUnknown)] out object ppStub)825         [PreserveSig] int CreateObjectStub_([In][MarshalAs(UnmanagedType.IUnknown)]  object   pObject, [Out][MarshalAs(UnmanagedType.IUnknown)]  out object   ppStub);
826     }
827 
828     [GuidAttribute("EB87E1BC-3233-11D2-AEC9-00C04FB68820")]
829     [InterfaceTypeAttribute(0x0001)]
830     [ComImport]
831     interface IWbemStatusCodeText
832     {
GetErrorCodeText_([In][MarshalAs(UnmanagedType.Error)] Int32 hRes, [In] UInt32 LocaleId, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)] out string MessageText)833         [PreserveSig] int GetErrorCodeText_([In][MarshalAs(UnmanagedType.Error)]  Int32   hRes, [In] UInt32 LocaleId, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)]  out string   MessageText);
GetFacilityCodeText_([In][MarshalAs(UnmanagedType.Error)] Int32 hRes, [In] UInt32 LocaleId, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)] out string MessageText)834         [PreserveSig] int GetFacilityCodeText_([In][MarshalAs(UnmanagedType.Error)]  Int32   hRes, [In] UInt32 LocaleId, [In] Int32 lFlags, [Out][MarshalAs(UnmanagedType.BStr)]  out string   MessageText);
835     }
836 
837     [InterfaceTypeAttribute(0x0001)]
838     ///[TypeLibTypeAttribute(0x0200)]
839     [GuidAttribute("E246107B-B06E-11D0-AD61-00C04FD8FDFF")]
840     [ComImport]
841     interface IWbemUnboundObjectSink
842     {
IndicateToConsumer_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pLogicalConsumer, [In] Int32 lNumObjects, [In][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal apObjects)843         [PreserveSig] int IndicateToConsumer_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pLogicalConsumer, [In] Int32 lNumObjects, [In][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   apObjects);
844     }
845 
846     [InterfaceTypeAttribute(0x0001)]
847     [GuidAttribute("CE61E841-65BC-11D0-B6BD-00AA003240C7")]
848     ///[TypeLibTypeAttribute(0x0200)]
849     [ComImport]
850     interface IWbemPropertyProvider
851     {
GetProperty_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)] string strLocale, [In][MarshalAs(UnmanagedType.BStr)] string strClassMapping, [In][MarshalAs(UnmanagedType.BStr)] string strInstMapping, [In][MarshalAs(UnmanagedType.BStr)] string strPropMapping, [Out] out object pvValue)852         [PreserveSig] int GetProperty_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)]  string   strLocale, [In][MarshalAs(UnmanagedType.BStr)]  string   strClassMapping, [In][MarshalAs(UnmanagedType.BStr)]  string   strInstMapping, [In][MarshalAs(UnmanagedType.BStr)]  string   strPropMapping, [Out] out object pvValue);
PutProperty_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)] string strLocale, [In][MarshalAs(UnmanagedType.BStr)] string strClassMapping, [In][MarshalAs(UnmanagedType.BStr)] string strInstMapping, [In][MarshalAs(UnmanagedType.BStr)] string strPropMapping, [In] ref object pvValue)853         [PreserveSig] int PutProperty_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.BStr)]  string   strLocale, [In][MarshalAs(UnmanagedType.BStr)]  string   strClassMapping, [In][MarshalAs(UnmanagedType.BStr)]  string   strInstMapping, [In][MarshalAs(UnmanagedType.BStr)]  string   strPropMapping, [In] ref object pvValue);
854     }
855 
856     [InterfaceTypeAttribute(0x0001)]
857     ///[TypeLibTypeAttribute(0x0200)]
858     [GuidAttribute("E245105B-B06E-11D0-AD61-00C04FD8FDFF")]
859     [ComImport]
860     interface IWbemEventProvider
861     {
ProvideEvents_([In][MarshalAs(UnmanagedType.Interface)] IWbemObjectSink pSink, [In] Int32 lFlags)862         [PreserveSig] int ProvideEvents_([In][MarshalAs(UnmanagedType.Interface)]  IWbemObjectSink   pSink, [In] Int32 lFlags);
863     }
864 
865     [GuidAttribute("580ACAF8-FA1C-11D0-AD72-00C04FD8FDFF")]
866     ///[TypeLibTypeAttribute(0x0200)]
867     [InterfaceTypeAttribute(0x0001)]
868     [ComImport]
869     interface IWbemEventProviderQuerySink
870     {
NewQuery_([In] UInt32 dwId, [In][MarshalAs(UnmanagedType.LPWStr)] string wszQueryLanguage, [In][MarshalAs(UnmanagedType.LPWStr)] string wszQuery)871         [PreserveSig] int NewQuery_([In] UInt32 dwId, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQueryLanguage, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQuery);
CancelQuery_([In] UInt32 dwId)872         [PreserveSig] int CancelQuery_([In] UInt32 dwId);
873     }
874 
875     [InterfaceTypeAttribute(0x0001)]
876     ///[TypeLibTypeAttribute(0x0200)]
877     [GuidAttribute("631F7D96-D993-11D2-B339-00105A1F4AAF")]
878     [ComImport]
879     interface IWbemEventProviderSecurity
880     {
AccessCheck_([In][MarshalAs(UnmanagedType.LPWStr)] string wszQueryLanguage, [In][MarshalAs(UnmanagedType.LPWStr)] string wszQuery, [In] Int32 lSidLength, [In] ref Byte pSid)881         [PreserveSig] int AccessCheck_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQueryLanguage, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszQuery, [In] Int32 lSidLength, [In] ref Byte pSid);
882     }
883 
884     [GuidAttribute("631F7D97-D993-11D2-B339-00105A1F4AAF")]
885     ///[TypeLibTypeAttribute(0x0200)]
886     [InterfaceTypeAttribute(0x0001)]
887     [ComImport]
888     interface IWbemProviderIdentity
889     {
SetRegistrationObject_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pProvReg)890         [PreserveSig] int SetRegistrationObject_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pProvReg);
891     }
892 
893     [InterfaceTypeAttribute(0x0001)]
894     ///[TypeLibTypeAttribute(0x0200)]
895     [GuidAttribute("E246107A-B06E-11D0-AD61-00C04FD8FDFF")]
896     [ComImport]
897     interface IWbemEventConsumerProvider
898     {
FindConsumer_([In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pLogicalConsumer, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemUnboundObjectSink ppConsumer)899         [PreserveSig] int FindConsumer_([In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pLogicalConsumer, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemUnboundObjectSink   ppConsumer);
900     }
901 
902     [GuidAttribute("1BE41571-91DD-11D1-AEB2-00C04FB68820")]
903     [InterfaceTypeAttribute(0x0001)]
904     [ComImport]
905     interface IWbemProviderInitSink
906     {
SetStatus_([In] Int32 lStatus, [In] Int32 lFlags)907         [PreserveSig] int SetStatus_([In] Int32 lStatus, [In] Int32 lFlags);
908     }
909 
910     [GuidAttribute("1BE41572-91DD-11D1-AEB2-00C04FB68820")]
911     [InterfaceTypeAttribute(0x0001)]
912     [ComImport]
913     interface IWbemProviderInit
914     {
Initialize_([In][MarshalAs(UnmanagedType.LPWStr)] string wszUser, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.LPWStr)] string wszNamespace, [In][MarshalAs(UnmanagedType.LPWStr)] string wszLocale, [In][MarshalAs(UnmanagedType.Interface)] IWbemServices pNamespace, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext pCtx, [In][MarshalAs(UnmanagedType.Interface)] IWbemProviderInitSink pInitSink)915         [PreserveSig] int Initialize_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszUser, [In] Int32 lFlags, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszNamespace, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszLocale, [In][MarshalAs(UnmanagedType.Interface)]  IWbemServices   pNamespace, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   pCtx, [In][MarshalAs(UnmanagedType.Interface)]  IWbemProviderInitSink   pInitSink);
916     }
917 
918     [InterfaceTypeAttribute(0x0001)]
919     [GuidAttribute("1005CBCF-E64F-4646-BCD3-3A089D8A84B4")]
920     [ComImport]
921     interface IWbemDecoupledRegistrar
922     {
Register_([In] Int32 flags, [In][MarshalAs(UnmanagedType.Interface)] IWbemContext context, [In][MarshalAs(UnmanagedType.LPWStr)] string user, [In][MarshalAs(UnmanagedType.LPWStr)] string locale, [In][MarshalAs(UnmanagedType.LPWStr)] string scope, [In][MarshalAs(UnmanagedType.LPWStr)] string registration, [In][MarshalAs(UnmanagedType.IUnknown)] object unknown)923         [PreserveSig] int Register_([In] Int32 flags, [In][MarshalAs(UnmanagedType.Interface)]  IWbemContext   context, [In][MarshalAs(UnmanagedType.LPWStr)]  string   user, [In][MarshalAs(UnmanagedType.LPWStr)]  string   locale, [In][MarshalAs(UnmanagedType.LPWStr)]  string   scope, [In][MarshalAs(UnmanagedType.LPWStr)]  string   registration, [In][MarshalAs(UnmanagedType.IUnknown)]  object   unknown);
UnRegister_()924         [PreserveSig] int UnRegister_();
925     }
926 
927     [InterfaceTypeAttribute(0x0001)]
928     ///[TypeLibTypeAttribute(0x0200)]
929     [GuidAttribute("3AE0080A-7E3A-4366-BF89-0FEEDC931659")]
930     [ComImport]
931     interface IWbemEventSink
932     {
Indicate_([In] Int32 lObjectCount, [In][MarshalAs(UnmanagedType.Interface)] ref IWbemClassObject_DoNotMarshal apObjArray)933         [PreserveSig] int Indicate_([In] Int32 lObjectCount, [In][MarshalAs(UnmanagedType.Interface)]  ref IWbemClassObject_DoNotMarshal   apObjArray);
SetStatus_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Error)] Int32 hResult, [In][MarshalAs(UnmanagedType.BStr)] string strParam, [In][MarshalAs(UnmanagedType.Interface)] IWbemClassObject_DoNotMarshal pObjParam)934         [PreserveSig] int SetStatus_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.Error)]  Int32   hResult, [In][MarshalAs(UnmanagedType.BStr)]  string   strParam, [In][MarshalAs(UnmanagedType.Interface)]  IWbemClassObject_DoNotMarshal   pObjParam);
IndicateWithSD_([In] Int32 lNumObjects, [In][MarshalAs(UnmanagedType.IUnknown)] ref object apObjects, [In] Int32 lSDLength, [In] ref Byte pSD)935         [PreserveSig] int IndicateWithSD_([In] Int32 lNumObjects, [In][MarshalAs(UnmanagedType.IUnknown)]  ref object   apObjects, [In] Int32 lSDLength, [In] ref Byte pSD);
SetSinkSecurity_([In] Int32 lSDLength, [In] ref Byte pSD)936         [PreserveSig] int SetSinkSecurity_([In] Int32 lSDLength, [In] ref Byte pSD);
IsActive_()937         [PreserveSig] int IsActive_();
GetRestrictedSink_([In] Int32 lNumQueries, [In][MarshalAs(UnmanagedType.LPWStr)] ref string awszQueries, [In][MarshalAs(UnmanagedType.IUnknown)] object pCallback, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemEventSink ppSink)938         [PreserveSig] int GetRestrictedSink_([In] Int32 lNumQueries, [In][MarshalAs(UnmanagedType.LPWStr)]  ref string   awszQueries, [In][MarshalAs(UnmanagedType.IUnknown)]  object   pCallback, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemEventSink   ppSink);
SetBatchingParameters_([In] Int32 lFlags, [In] UInt32 dwMaxBufferSize, [In] UInt32 dwMaxSendLatency)939         [PreserveSig] int SetBatchingParameters_([In] Int32 lFlags, [In] UInt32 dwMaxBufferSize, [In] UInt32 dwMaxSendLatency);
940     }
941 
942     [GuidAttribute("9AE62877-7544-4BB0-AA26-A13824659ED6")]
943     /*[ComConversionLossAttribute]*/
944     [InterfaceTypeAttribute(0x0001)]
945     [ComImport]
946     interface IWbemPathKeyList
947     {
GetCount_([Out] out UInt32 puKeyCount)948         [PreserveSig] int GetCount_([Out] out UInt32 puKeyCount);
SetKey_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] UInt32 uFlags, [In] UInt32 uCimType, [In] IntPtr pKeyVal)949         [PreserveSig] int SetKey_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] UInt32 uFlags, [In] UInt32 uCimType, [In] IntPtr pKeyVal);
SetKey2_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] UInt32 uFlags, [In] UInt32 uCimType, [In] ref object pKeyVal)950         [PreserveSig] int SetKey2_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] UInt32 uFlags, [In] UInt32 uCimType, [In] ref object pKeyVal);
GetKey_([In] UInt32 uKeyIx, [In] UInt32 uFlags, [In][Out] ref UInt32 puNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszKeyName, [In][Out] ref UInt32 puKeyValBufSize, [In][Out] IntPtr pKeyVal, [Out] out UInt32 puApparentCimType)951         [PreserveSig] int GetKey_([In] UInt32 uKeyIx, [In] UInt32 uFlags, [In][Out] ref UInt32 puNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszKeyName, [In][Out] ref UInt32 puKeyValBufSize, [In][Out] IntPtr pKeyVal, [Out] out UInt32 puApparentCimType);
GetKey2_([In] UInt32 uKeyIx, [In] UInt32 uFlags, [In][Out] ref UInt32 puNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszKeyName, [In][Out] ref object pKeyValue, [Out] out UInt32 puApparentCimType)952         [PreserveSig] int GetKey2_([In] UInt32 uKeyIx, [In] UInt32 uFlags, [In][Out] ref UInt32 puNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszKeyName, [In][Out] ref object pKeyValue, [Out] out UInt32 puApparentCimType);
RemoveKey_([In][MarshalAs(UnmanagedType.LPWStr)] string wszName, [In] UInt32 uFlags)953         [PreserveSig] int RemoveKey_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszName, [In] UInt32 uFlags);
RemoveAllKeys_([In] UInt32 uFlags)954         [PreserveSig] int RemoveAllKeys_([In] UInt32 uFlags);
MakeSingleton_([In] SByte bSet)955         [PreserveSig] int MakeSingleton_([In] SByte bSet);
GetInfo_([In] UInt32 uRequestedInfo, [Out] out UInt64 puResponse)956         [PreserveSig] int GetInfo_([In] UInt32 uRequestedInfo, [Out] out UInt64 puResponse);
GetText_([In] Int32 lFlags, [In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszText)957         [PreserveSig] int GetText_([In] Int32 lFlags, [In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszText);
958     }
959 
960     [GuidAttribute("3BC15AF2-736C-477E-9E51-238AF8667DCC")]
961     [InterfaceTypeAttribute(0x0001)]
962     [ComImport]
963     interface IWbemPath
964     {
SetText_([In] UInt32 uMode, [In][MarshalAs(UnmanagedType.LPWStr)] string pszPath)965         [PreserveSig] int SetText_([In] UInt32 uMode, [In][MarshalAs(UnmanagedType.LPWStr)]  string   pszPath);
GetText_([In] Int32 lFlags, [In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszText)966         [PreserveSig] int GetText_([In] Int32 lFlags, [In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszText);
GetInfo_([In] UInt32 uRequestedInfo, [Out] out UInt64 puResponse)967         [PreserveSig] int GetInfo_([In] UInt32 uRequestedInfo, [Out] out UInt64 puResponse);
SetServer_([In][MarshalAs(UnmanagedType.LPWStr)] string Name)968         [PreserveSig] int SetServer_([In][MarshalAs(UnmanagedType.LPWStr)]  string   Name);
GetServer_([In][Out] ref UInt32 puNameBufLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pName)969         [PreserveSig] int GetServer_([In][Out] ref UInt32 puNameBufLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pName);
GetNamespaceCount_([Out] out UInt32 puCount)970         [PreserveSig] int GetNamespaceCount_([Out] out UInt32 puCount);
SetNamespaceAt_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)] string pszName)971         [PreserveSig] int SetNamespaceAt_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)]  string   pszName);
GetNamespaceAt_([In] UInt32 uIndex, [In][Out] ref UInt32 puNameBufLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pName)972         [PreserveSig] int GetNamespaceAt_([In] UInt32 uIndex, [In][Out] ref UInt32 puNameBufLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pName);
RemoveNamespaceAt_([In] UInt32 uIndex)973         [PreserveSig] int RemoveNamespaceAt_([In] UInt32 uIndex);
RemoveAllNamespaces_()974         [PreserveSig] int RemoveAllNamespaces_();
GetScopeCount_([Out] out UInt32 puCount)975         [PreserveSig] int GetScopeCount_([Out] out UInt32 puCount);
SetScope_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)] string pszClass)976         [PreserveSig] int SetScope_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)]  string   pszClass);
SetScopeFromText_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)] string pszText)977         [PreserveSig] int SetScopeFromText_([In] UInt32 uIndex, [In][MarshalAs(UnmanagedType.LPWStr)]  string   pszText);
GetScope_([In] UInt32 uIndex, [In][Out] ref UInt32 puClassNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszClass, [Out][MarshalAs(UnmanagedType.Interface)] out IWbemPathKeyList pKeyList)978         [PreserveSig] int GetScope_([In] UInt32 uIndex, [In][Out] ref UInt32 puClassNameBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszClass, [Out][MarshalAs(UnmanagedType.Interface)]  out IWbemPathKeyList   pKeyList);
GetScopeAsText_([In] UInt32 uIndex, [In][Out] ref UInt32 puTextBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszText)979         [PreserveSig] int GetScopeAsText_([In] UInt32 uIndex, [In][Out] ref UInt32 puTextBufSize, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszText);
RemoveScope_([In] UInt32 uIndex)980         [PreserveSig] int RemoveScope_([In] UInt32 uIndex);
RemoveAllScopes_()981         [PreserveSig] int RemoveAllScopes_();
SetClassName_([In][MarshalAs(UnmanagedType.LPWStr)] string Name)982         [PreserveSig] int SetClassName_([In][MarshalAs(UnmanagedType.LPWStr)]  string   Name);
GetClassName_([In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)] string pszName)983         [PreserveSig] int GetClassName_([In][Out] ref UInt32 puBuffLength, [In][Out][MarshalAs(UnmanagedType.LPWStr)]  string   pszName);
GetKeyList_([Out][MarshalAs(UnmanagedType.Interface)] out IWbemPathKeyList pOut)984         [PreserveSig] int GetKeyList_([Out][MarshalAs(UnmanagedType.Interface)]  out IWbemPathKeyList   pOut);
CreateClassPart_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.LPWStr)] string Name)985         [PreserveSig] int CreateClassPart_([In] Int32 lFlags, [In][MarshalAs(UnmanagedType.LPWStr)]  string   Name);
DeleteClassPart_([In] Int32 lFlags)986         [PreserveSig] int DeleteClassPart_([In] Int32 lFlags);
IsRelative_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMachine, [In][MarshalAs(UnmanagedType.LPWStr)] string wszNamespace)987         [PreserveSig] int IsRelative_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMachine, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszNamespace);
IsRelativeOrChild_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMachine, [In][MarshalAs(UnmanagedType.LPWStr)] string wszNamespace, [In] Int32 lFlags)988         [PreserveSig] int IsRelativeOrChild_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMachine, [In][MarshalAs(UnmanagedType.LPWStr)]  string   wszNamespace, [In] Int32 lFlags);
IsLocal_([In][MarshalAs(UnmanagedType.LPWStr)] string wszMachine)989         [PreserveSig] int IsLocal_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszMachine);
IsSameClassName_([In][MarshalAs(UnmanagedType.LPWStr)] string wszClass)990         [PreserveSig] int IsSameClassName_([In][MarshalAs(UnmanagedType.LPWStr)]  string   wszClass);
991     }
992 
993     #endregion
994 
995     #region Enums
996     enum tag_WBEM_GENUS_TYPE
997     {
998         WBEM_GENUS_CLASS = unchecked((int)0x00000001),
999         WBEM_GENUS_INSTANCE = unchecked((int)0x00000002),
1000     }
1001 
1002     enum tag_WBEM_CHANGE_FLAG_TYPE
1003     {
1004         WBEM_FLAG_CREATE_OR_UPDATE = unchecked((int)0x00000000),
1005         WBEM_FLAG_UPDATE_ONLY = unchecked((int)0x00000001),
1006         WBEM_FLAG_CREATE_ONLY = unchecked((int)0x00000002),
1007         WBEM_FLAG_UPDATE_COMPATIBLE = unchecked((int)0x00000000),
1008         WBEM_FLAG_UPDATE_SAFE_MODE = unchecked((int)0x00000020),
1009         WBEM_FLAG_UPDATE_FORCE_MODE = unchecked((int)0x00000040),
1010         WBEM_MASK_UPDATE_MODE = unchecked((int)0x00000060),
1011         WBEM_FLAG_ADVISORY = unchecked((int)0x00010000),
1012     }
1013 
1014     enum tag_WBEM_GENERIC_FLAG_TYPE
1015     {
1016         WBEM_FLAG_RETURN_IMMEDIATELY = unchecked((int)0x00000010),
1017         WBEM_FLAG_RETURN_WBEM_COMPLETE = unchecked((int)0x00000000),
1018         WBEM_FLAG_BIDIRECTIONAL = unchecked((int)0x00000000),
1019         WBEM_FLAG_FORWARD_ONLY = unchecked((int)0x00000020),
1020         WBEM_FLAG_NO_ERROR_OBJECT = unchecked((int)0x00000040),
1021         WBEM_FLAG_RETURN_ERROR_OBJECT = unchecked((int)0x00000000),
1022         WBEM_FLAG_SEND_STATUS = unchecked((int)0x00000080),
1023         WBEM_FLAG_DONT_SEND_STATUS = unchecked((int)0x00000000),
1024         WBEM_FLAG_ENSURE_LOCATABLE = unchecked((int)0x00000100),
1025         WBEM_FLAG_DIRECT_READ = unchecked((int)0x00000200),
1026         WBEM_FLAG_SEND_ONLY_SELECTED = unchecked((int)0x00000000),
1027         WBEM_RETURN_WHEN_COMPLETE = unchecked((int)0x00000000),
1028         WBEM_RETURN_IMMEDIATELY = unchecked((int)0x00000010),
1029         WBEM_MASK_RESERVED_FLAGS = unchecked((int)0x0001F000),
1030         WBEM_FLAG_USE_AMENDED_QUALIFIERS = unchecked((int)0x00020000),
1031         WBEM_FLAG_STRONG_VALIDATION = unchecked((int)0x00100000),
1032     }
1033 
1034     enum tag_WBEM_STATUS_TYPE
1035     {
1036         WBEM_STATUS_COMPLETE = unchecked((int)0x00000000),
1037         WBEM_STATUS_REQUIREMENTS = unchecked((int)0x00000001),
1038         WBEM_STATUS_PROGRESS = unchecked((int)0x00000002),
1039     }
1040 
1041     enum tag_WBEM_TIMEOUT_TYPE
1042     {
1043         WBEM_NO_WAIT = unchecked((int)0x00000000),
1044         WBEM_INFINITE = unchecked((int)0xFFFFFFFF),
1045     }
1046 
1047     enum tag_WBEM_CONDITION_FLAG_TYPE
1048     {
1049         WBEM_FLAG_ALWAYS = unchecked((int)0x00000000),
1050         WBEM_FLAG_ONLY_IF_TRUE = unchecked((int)0x00000001),
1051         WBEM_FLAG_ONLY_IF_FALSE = unchecked((int)0x00000002),
1052         WBEM_FLAG_ONLY_IF_IDENTICAL = unchecked((int)0x00000003),
1053         WBEM_MASK_PRIMARY_CONDITION = unchecked((int)0x00000003),
1054         WBEM_FLAG_KEYS_ONLY = unchecked((int)0x00000004),
1055         WBEM_FLAG_REFS_ONLY = unchecked((int)0x00000008),
1056         WBEM_FLAG_LOCAL_ONLY = unchecked((int)0x00000010),
1057         WBEM_FLAG_PROPAGATED_ONLY = unchecked((int)0x00000020),
1058         WBEM_FLAG_SYSTEM_ONLY = unchecked((int)0x00000030),
1059         WBEM_FLAG_NONSYSTEM_ONLY = unchecked((int)0x00000040),
1060         WBEM_MASK_CONDITION_ORIGIN = unchecked((int)0x00000070),
1061         WBEM_FLAG_CLASS_OVERRIDES_ONLY = unchecked((int)0x00000100),
1062         WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES = unchecked((int)0x00000200),
1063         WBEM_MASK_CLASS_CONDITION = unchecked((int)0x00000300),
1064     }
1065     enum tag_WBEM_FLAVOR_TYPE
1066     {
1067         WBEM_FLAVOR_DONT_PROPAGATE = unchecked((int)0x00000000),
1068         WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE = unchecked((int)0x00000001),
1069         WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS = unchecked((int)0x00000002),
1070         WBEM_FLAVOR_MASK_PROPAGATION = unchecked((int)0x0000000F),
1071         WBEM_FLAVOR_OVERRIDABLE = unchecked((int)0x00000000),
1072         WBEM_FLAVOR_NOT_OVERRIDABLE = unchecked((int)0x00000010),
1073         WBEM_FLAVOR_MASK_PERMISSIONS = unchecked((int)0x00000010),
1074         WBEM_FLAVOR_ORIGIN_LOCAL = unchecked((int)0x00000000),
1075         WBEM_FLAVOR_ORIGIN_PROPAGATED = unchecked((int)0x00000020),
1076         WBEM_FLAVOR_ORIGIN_SYSTEM = unchecked((int)0x00000040),
1077         WBEM_FLAVOR_MASK_ORIGIN = unchecked((int)0x00000060),
1078         WBEM_FLAVOR_NOT_AMENDED = unchecked((int)0x00000000),
1079         WBEM_FLAVOR_AMENDED = unchecked((int)0x00000080),
1080         WBEM_FLAVOR_MASK_AMENDED = unchecked((int)0x00000080),
1081     }
1082 
1083     enum tag_WBEM_QUERY_FLAG_TYPE
1084     {
1085         WBEM_FLAG_DEEP = unchecked((int)0x00000000),
1086         WBEM_FLAG_SHALLOW = unchecked((int)0x00000001),
1087         WBEM_FLAG_PROTOTYPE = unchecked((int)0x00000002),
1088     }
1089 
1090     enum tag_WBEM_SECURITY_FLAGS
1091     {
1092         WBEM_ENABLE = unchecked((int)0x00000001),
1093         WBEM_METHOD_EXECUTE = unchecked((int)0x00000002),
1094         WBEM_FULL_WRITE_REP = unchecked((int)0x00000004),
1095         WBEM_PARTIAL_WRITE_REP = unchecked((int)0x00000008),
1096         WBEM_WRITE_PROVIDER = unchecked((int)0x00000010),
1097         WBEM_REMOTE_ACCESS = unchecked((int)0x00000020),
1098         WBEM_RIGHT_SUBSCRIBE = unchecked((int)0x00000001),
1099         WBEM_RIGHT_PUBLISH = unchecked((int)0x00000001),
1100     }
1101 
1102     enum tag_WBEM_LIMITATION_FLAG_TYPE
1103     {
1104         WBEM_FLAG_EXCLUDE_OBJECT_QUALIFIERS = unchecked((int)0x00000010),
1105         WBEM_FLAG_EXCLUDE_PROPERTY_QUALIFIERS = unchecked((int)0x00000020),
1106     }
1107 
1108     enum tag_WBEM_TEXT_FLAG_TYPE
1109     {
1110         WBEM_FLAG_NO_FLAVORS = unchecked((int)0x00000001),
1111     }
1112 
1113     enum tag_WBEM_COMPARISON_FLAG
1114     {
1115         WBEM_COMPARISON_INCLUDE_ALL = unchecked((int)0x00000000),
1116         WBEM_FLAG_IGNORE_QUALIFIERS = unchecked((int)0x00000001),
1117         WBEM_FLAG_IGNORE_OBJECT_SOURCE = unchecked((int)0x00000002),
1118         WBEM_FLAG_IGNORE_DEFAULT_VALUES = unchecked((int)0x00000004),
1119         WBEM_FLAG_IGNORE_CLASS = unchecked((int)0x00000008),
1120         WBEM_FLAG_IGNORE_CASE = unchecked((int)0x00000010),
1121         WBEM_FLAG_IGNORE_FLAVOR = unchecked((int)0x00000020),
1122     }
1123 
1124     enum tag_WBEM_LOCKING
1125     {
1126         WBEM_FLAG_ALLOW_READ = unchecked((int)0x00000001),
1127     }
1128 
1129     enum tag_CIMTYPE_ENUMERATION
1130     {
1131         CIM_ILLEGAL = unchecked((int)0x00000FFF),
1132         CIM_EMPTY = unchecked((int)0x00000000),
1133         CIM_SINT8 = unchecked((int)0x00000010),
1134         CIM_UINT8 = unchecked((int)0x00000011),
1135         CIM_SINT16 = unchecked((int)0x00000002),
1136         CIM_UINT16 = unchecked((int)0x00000012),
1137         CIM_SINT32 = unchecked((int)0x00000003),
1138         CIM_UINT32 = unchecked((int)0x00000013),
1139         CIM_SINT64 = unchecked((int)0x00000014),
1140         CIM_UINT64 = unchecked((int)0x00000015),
1141         CIM_REAL32 = unchecked((int)0x00000004),
1142         CIM_REAL64 = unchecked((int)0x00000005),
1143         CIM_BOOLEAN = unchecked((int)0x0000000B),
1144         CIM_STRING = unchecked((int)0x00000008),
1145         CIM_DATETIME = unchecked((int)0x00000065),
1146         CIM_REFERENCE = unchecked((int)0x00000066),
1147         CIM_CHAR16 = unchecked((int)0x00000067),
1148         CIM_OBJECT = unchecked((int)0x0000000D),
1149         CIM_FLAG_ARRAY = unchecked((int)0x00002000),
1150     }
1151 
1152     enum tag_WBEM_BACKUP_RESTORE_FLAGS
1153     {
1154         WBEM_FLAG_BACKUP_RESTORE_DEFAULT = unchecked((int)0x00000000),
1155         WBEM_FLAG_BACKUP_RESTORE_FORCE_SHUTDOWN = unchecked((int)0x00000001),
1156     }
1157 
1158     enum tag_WBEM_REFRESHER_FLAGS
1159     {
1160         WBEM_FLAG_REFRESH_AUTO_RECONNECT = unchecked((int)0x00000000),
1161         WBEM_FLAG_REFRESH_NO_AUTO_RECONNECT = unchecked((int)0x00000001),
1162     }
1163 
1164     enum tag_WBEM_SHUTDOWN_FLAGS
1165     {
1166         WBEM_SHUTDOWN_UNLOAD_COMPONENT = unchecked((int)0x00000001),
1167         WBEM_SHUTDOWN_WMI = unchecked((int)0x00000002),
1168         WBEM_SHUTDOWN_OS = unchecked((int)0x00000003),
1169     }
1170 
1171     enum tag_WBEMSTATUS_FORMAT
1172     {
1173         WBEMSTATUS_FORMAT_NEWLINE = unchecked((int)0x00000000),
1174         WBEMSTATUS_FORMAT_NO_NEWLINE = unchecked((int)0x00000001),
1175     }
1176 
1177     enum tag_WBEMSTATUS
1178     {
1179         WBEM_NO_ERROR = unchecked((int)0x00000000),
1180         WBEM_S_NO_ERROR = unchecked((int)0x00000000),
1181         WBEM_S_SAME = unchecked((int)0x00000000),
1182         WBEM_S_FALSE = unchecked((int)0x00000001),
1183         WBEM_S_ALREADY_EXISTS = unchecked((int)0x00040001),
1184         WBEM_S_RESET_TO_DEFAULT = unchecked((int)0x00040002),
1185         WBEM_S_DIFFERENT = unchecked((int)0x00040003),
1186         WBEM_S_TIMEDOUT = unchecked((int)0x00040004),
1187         WBEM_S_NO_MORE_DATA = unchecked((int)0x00040005),
1188         WBEM_S_OPERATION_CANCELLED = unchecked((int)0x00040006),
1189         WBEM_S_PENDING = unchecked((int)0x00040007),
1190         WBEM_S_DUPLICATE_OBJECTS = unchecked((int)0x00040008),
1191         WBEM_S_ACCESS_DENIED = unchecked((int)0x00040009),
1192         WBEM_S_PARTIAL_RESULTS = unchecked((int)0x00040010),
1193         WBEM_S_NO_POSTHOOK = unchecked((int)0x00040011),
1194         WBEM_S_POSTHOOK_WITH_BOTH = unchecked((int)0x00040012),
1195         WBEM_S_POSTHOOK_WITH_NEW = unchecked((int)0x00040013),
1196         WBEM_S_POSTHOOK_WITH_STATUS = unchecked((int)0x00040014),
1197         WBEM_S_POSTHOOK_WITH_OLD = unchecked((int)0x00040015),
1198         WBEM_S_REDO_PREHOOK_WITH_ORIGINAL_OBJECT = unchecked((int)0x00040016),
1199         WBEM_S_SOURCE_NOT_AVAILABLE = unchecked((int)0x00040017),
1200         WBEM_E_FAILED = unchecked((int)0x80041001),
1201         WBEM_E_NOT_FOUND = unchecked((int)0x80041002),
1202         WBEM_E_ACCESS_DENIED = unchecked((int)0x80041003),
1203         WBEM_E_PROVIDER_FAILURE = unchecked((int)0x80041004),
1204         WBEM_E_TYPE_MISMATCH = unchecked((int)0x80041005),
1205         WBEM_E_OUT_OF_MEMORY = unchecked((int)0x80041006),
1206         WBEM_E_INVALID_CONTEXT = unchecked((int)0x80041007),
1207         WBEM_E_INVALID_PARAMETER = unchecked((int)0x80041008),
1208         WBEM_E_NOT_AVAILABLE = unchecked((int)0x80041009),
1209         WBEM_E_CRITICAL_ERROR = unchecked((int)0x8004100A),
1210         WBEM_E_INVALID_STREAM = unchecked((int)0x8004100B),
1211         WBEM_E_NOT_SUPPORTED = unchecked((int)0x8004100C),
1212         WBEM_E_INVALID_SUPERCLASS = unchecked((int)0x8004100D),
1213         WBEM_E_INVALID_NAMESPACE = unchecked((int)0x8004100E),
1214         WBEM_E_INVALID_OBJECT = unchecked((int)0x8004100F),
1215         WBEM_E_INVALID_CLASS = unchecked((int)0x80041010),
1216         WBEM_E_PROVIDER_NOT_FOUND = unchecked((int)0x80041011),
1217         WBEM_E_INVALID_PROVIDER_REGISTRATION = unchecked((int)0x80041012),
1218         WBEM_E_PROVIDER_LOAD_FAILURE = unchecked((int)0x80041013),
1219         WBEM_E_INITIALIZATION_FAILURE = unchecked((int)0x80041014),
1220         WBEM_E_TRANSPORT_FAILURE = unchecked((int)0x80041015),
1221         WBEM_E_INVALID_OPERATION = unchecked((int)0x80041016),
1222         WBEM_E_INVALID_QUERY = unchecked((int)0x80041017),
1223         WBEM_E_INVALID_QUERY_TYPE = unchecked((int)0x80041018),
1224         WBEM_E_ALREADY_EXISTS = unchecked((int)0x80041019),
1225         WBEM_E_OVERRIDE_NOT_ALLOWED = unchecked((int)0x8004101A),
1226         WBEM_E_PROPAGATED_QUALIFIER = unchecked((int)0x8004101B),
1227         WBEM_E_PROPAGATED_PROPERTY = unchecked((int)0x8004101C),
1228         WBEM_E_UNEXPECTED = unchecked((int)0x8004101D),
1229         WBEM_E_ILLEGAL_OPERATION = unchecked((int)0x8004101E),
1230         WBEM_E_CANNOT_BE_KEY = unchecked((int)0x8004101F),
1231         WBEM_E_INCOMPLETE_CLASS = unchecked((int)0x80041020),
1232         WBEM_E_INVALID_SYNTAX = unchecked((int)0x80041021),
1233         WBEM_E_NONDECORATED_OBJECT = unchecked((int)0x80041022),
1234         WBEM_E_READ_ONLY = unchecked((int)0x80041023),
1235         WBEM_E_PROVIDER_NOT_CAPABLE = unchecked((int)0x80041024),
1236         WBEM_E_CLASS_HAS_CHILDREN = unchecked((int)0x80041025),
1237         WBEM_E_CLASS_HAS_INSTANCES = unchecked((int)0x80041026),
1238         WBEM_E_QUERY_NOT_IMPLEMENTED = unchecked((int)0x80041027),
1239         WBEM_E_ILLEGAL_NULL = unchecked((int)0x80041028),
1240         WBEM_E_INVALID_QUALIFIER_TYPE = unchecked((int)0x80041029),
1241         WBEM_E_INVALID_PROPERTY_TYPE = unchecked((int)0x8004102A),
1242         WBEM_E_VALUE_OUT_OF_RANGE = unchecked((int)0x8004102B),
1243         WBEM_E_CANNOT_BE_SINGLETON = unchecked((int)0x8004102C),
1244         WBEM_E_INVALID_CIM_TYPE = unchecked((int)0x8004102D),
1245         WBEM_E_INVALID_METHOD = unchecked((int)0x8004102E),
1246         WBEM_E_INVALID_METHOD_PARAMETERS = unchecked((int)0x8004102F),
1247         WBEM_E_SYSTEM_PROPERTY = unchecked((int)0x80041030),
1248         WBEM_E_INVALID_PROPERTY = unchecked((int)0x80041031),
1249         WBEM_E_CALL_CANCELLED = unchecked((int)0x80041032),
1250         WBEM_E_SHUTTING_DOWN = unchecked((int)0x80041033),
1251         WBEM_E_PROPAGATED_METHOD = unchecked((int)0x80041034),
1252         WBEM_E_UNSUPPORTED_PARAMETER = unchecked((int)0x80041035),
1253         WBEM_E_MISSING_PARAMETER_ID = unchecked((int)0x80041036),
1254         WBEM_E_INVALID_PARAMETER_ID = unchecked((int)0x80041037),
1255         WBEM_E_NONCONSECUTIVE_PARAMETER_IDS = unchecked((int)0x80041038),
1256         WBEM_E_PARAMETER_ID_ON_RETVAL = unchecked((int)0x80041039),
1257         WBEM_E_INVALID_OBJECT_PATH = unchecked((int)0x8004103A),
1258         WBEM_E_OUT_OF_DISK_SPACE = unchecked((int)0x8004103B),
1259         WBEM_E_BUFFER_TOO_SMALL = unchecked((int)0x8004103C),
1260         WBEM_E_UNSUPPORTED_PUT_EXTENSION = unchecked((int)0x8004103D),
1261         WBEM_E_UNKNOWN_OBJECT_TYPE = unchecked((int)0x8004103E),
1262         WBEM_E_UNKNOWN_PACKET_TYPE = unchecked((int)0x8004103F),
1263         WBEM_E_MARSHAL_VERSION_MISMATCH = unchecked((int)0x80041040),
1264         WBEM_E_MARSHAL_INVALID_SIGNATURE = unchecked((int)0x80041041),
1265         WBEM_E_INVALID_QUALIFIER = unchecked((int)0x80041042),
1266         WBEM_E_INVALID_DUPLICATE_PARAMETER = unchecked((int)0x80041043),
1267         WBEM_E_TOO_MUCH_DATA = unchecked((int)0x80041044),
1268         WBEM_E_SERVER_TOO_BUSY = unchecked((int)0x80041045),
1269         WBEM_E_INVALID_FLAVOR = unchecked((int)0x80041046),
1270         WBEM_E_CIRCULAR_REFERENCE = unchecked((int)0x80041047),
1271         WBEM_E_UNSUPPORTED_CLASS_UPDATE = unchecked((int)0x80041048),
1272         WBEM_E_CANNOT_CHANGE_KEY_INHERITANCE = unchecked((int)0x80041049),
1273         WBEM_E_CANNOT_CHANGE_INDEX_INHERITANCE = unchecked((int)0x80041050),
1274         WBEM_E_TOO_MANY_PROPERTIES = unchecked((int)0x80041051),
1275         WBEM_E_UPDATE_TYPE_MISMATCH = unchecked((int)0x80041052),
1276         WBEM_E_UPDATE_OVERRIDE_NOT_ALLOWED = unchecked((int)0x80041053),
1277         WBEM_E_UPDATE_PROPAGATED_METHOD = unchecked((int)0x80041054),
1278         WBEM_E_METHOD_NOT_IMPLEMENTED = unchecked((int)0x80041055),
1279         WBEM_E_METHOD_DISABLED = unchecked((int)0x80041056),
1280         WBEM_E_REFRESHER_BUSY = unchecked((int)0x80041057),
1281         WBEM_E_UNPARSABLE_QUERY = unchecked((int)0x80041058),
1282         WBEM_E_NOT_EVENT_CLASS = unchecked((int)0x80041059),
1283         WBEM_E_MISSING_GROUP_WITHIN = unchecked((int)0x8004105A),
1284         WBEM_E_MISSING_AGGREGATION_LIST = unchecked((int)0x8004105B),
1285         WBEM_E_PROPERTY_NOT_AN_OBJECT = unchecked((int)0x8004105C),
1286         WBEM_E_AGGREGATING_BY_OBJECT = unchecked((int)0x8004105D),
1287         WBEM_E_UNINTERPRETABLE_PROVIDER_QUERY = unchecked((int)0x8004105F),
1288         WBEM_E_BACKUP_RESTORE_WINMGMT_RUNNING = unchecked((int)0x80041060),
1289         WBEM_E_QUEUE_OVERFLOW = unchecked((int)0x80041061),
1290         WBEM_E_PRIVILEGE_NOT_HELD = unchecked((int)0x80041062),
1291         WBEM_E_INVALID_OPERATOR = unchecked((int)0x80041063),
1292         WBEM_E_LOCAL_CREDENTIALS = unchecked((int)0x80041064),
1293         WBEM_E_CANNOT_BE_ABSTRACT = unchecked((int)0x80041065),
1294         WBEM_E_AMENDED_OBJECT = unchecked((int)0x80041066),
1295         WBEM_E_CLIENT_TOO_SLOW = unchecked((int)0x80041067),
1296         WBEM_E_NULL_SECURITY_DESCRIPTOR = unchecked((int)0x80041068),
1297         WBEM_E_TIMED_OUT = unchecked((int)0x80041069),
1298         WBEM_E_INVALID_ASSOCIATION = unchecked((int)0x8004106A),
1299         WBEM_E_AMBIGUOUS_OPERATION = unchecked((int)0x8004106B),
1300         WBEM_E_QUOTA_VIOLATION = unchecked((int)0x8004106C),
1301         WBEM_E_RESERVED_001 = unchecked((int)0x8004106D),
1302         WBEM_E_RESERVED_002 = unchecked((int)0x8004106E),
1303         WBEM_E_UNSUPPORTED_LOCALE = unchecked((int)0x8004106F),
1304         WBEM_E_HANDLE_OUT_OF_DATE = unchecked((int)0x80041070),
1305         WBEM_E_CONNECTION_FAILED = unchecked((int)0x80041071),
1306         WBEM_E_INVALID_HANDLE_REQUEST = unchecked((int)0x80041072),
1307         WBEM_E_PROPERTY_NAME_TOO_WIDE = unchecked((int)0x80041073),
1308         WBEM_E_CLASS_NAME_TOO_WIDE = unchecked((int)0x80041074),
1309         WBEM_E_METHOD_NAME_TOO_WIDE = unchecked((int)0x80041075),
1310         WBEM_E_QUALIFIER_NAME_TOO_WIDE = unchecked((int)0x80041076),
1311         WBEM_E_RERUN_COMMAND = unchecked((int)0x80041077),
1312         WBEM_E_DATABASE_VER_MISMATCH = unchecked((int)0x80041078),
1313         WBEM_E_VETO_DELETE = unchecked((int)0x80041079),
1314         WBEM_E_VETO_PUT = unchecked((int)0x8004107A),
1315         WBEM_E_INVALID_LOCALE = unchecked((int)0x80041080),
1316         WBEM_E_PROVIDER_SUSPENDED = unchecked((int)0x80041081),
1317         WBEM_E_SYNCHRONIZATION_REQUIRED = unchecked((int)0x80041082),
1318         WBEM_E_NO_SCHEMA = unchecked((int)0x80041083),
1319         WBEM_E_PROVIDER_ALREADY_REGISTERED = unchecked((int)0x80041084),
1320         WBEM_E_PROVIDER_NOT_REGISTERED = unchecked((int)0x80041085),
1321         WBEM_E_FATAL_TRANSPORT_ERROR = unchecked((int)0x80041086),
1322         WBEM_E_ENCRYPTED_CONNECTION_REQUIRED = unchecked((int)0x80041087),
1323         WBEM_E_PROVIDER_TIMED_OUT = unchecked((int)0x80041088),
1324         WBEM_E_NO_KEY = unchecked((int)0x80041089),
1325         WBEMESS_E_REGISTRATION_TOO_BROAD = unchecked((int)0x80042001),
1326         WBEMESS_E_REGISTRATION_TOO_PRECISE = unchecked((int)0x80042002),
1327         WBEMMOF_E_EXPECTED_QUALIFIER_NAME = unchecked((int)0x80044001),
1328         WBEMMOF_E_EXPECTED_SEMI = unchecked((int)0x80044002),
1329         WBEMMOF_E_EXPECTED_OPEN_BRACE = unchecked((int)0x80044003),
1330         WBEMMOF_E_EXPECTED_CLOSE_BRACE = unchecked((int)0x80044004),
1331         WBEMMOF_E_EXPECTED_CLOSE_BRACKET = unchecked((int)0x80044005),
1332         WBEMMOF_E_EXPECTED_CLOSE_PAREN = unchecked((int)0x80044006),
1333         WBEMMOF_E_ILLEGAL_CONSTANT_VALUE = unchecked((int)0x80044007),
1334         WBEMMOF_E_EXPECTED_TYPE_IDENTIFIER = unchecked((int)0x80044008),
1335         WBEMMOF_E_EXPECTED_OPEN_PAREN = unchecked((int)0x80044009),
1336         WBEMMOF_E_UNRECOGNIZED_TOKEN = unchecked((int)0x8004400A),
1337         WBEMMOF_E_UNRECOGNIZED_TYPE = unchecked((int)0x8004400B),
1338         WBEMMOF_E_EXPECTED_PROPERTY_NAME = unchecked((int)0x8004400C),
1339         WBEMMOF_E_TYPEDEF_NOT_SUPPORTED = unchecked((int)0x8004400D),
1340         WBEMMOF_E_UNEXPECTED_ALIAS = unchecked((int)0x8004400E),
1341         WBEMMOF_E_UNEXPECTED_ARRAY_INIT = unchecked((int)0x8004400F),
1342         WBEMMOF_E_INVALID_AMENDMENT_SYNTAX = unchecked((int)0x80044010),
1343         WBEMMOF_E_INVALID_DUPLICATE_AMENDMENT = unchecked((int)0x80044011),
1344         WBEMMOF_E_INVALID_PRAGMA = unchecked((int)0x80044012),
1345         WBEMMOF_E_INVALID_NAMESPACE_SYNTAX = unchecked((int)0x80044013),
1346         WBEMMOF_E_EXPECTED_CLASS_NAME = unchecked((int)0x80044014),
1347         WBEMMOF_E_TYPE_MISMATCH = unchecked((int)0x80044015),
1348         WBEMMOF_E_EXPECTED_ALIAS_NAME = unchecked((int)0x80044016),
1349         WBEMMOF_E_INVALID_CLASS_DECLARATION = unchecked((int)0x80044017),
1350         WBEMMOF_E_INVALID_INSTANCE_DECLARATION = unchecked((int)0x80044018),
1351         WBEMMOF_E_EXPECTED_DOLLAR = unchecked((int)0x80044019),
1352         WBEMMOF_E_CIMTYPE_QUALIFIER = unchecked((int)0x8004401A),
1353         WBEMMOF_E_DUPLICATE_PROPERTY = unchecked((int)0x8004401B),
1354         WBEMMOF_E_INVALID_NAMESPACE_SPECIFICATION = unchecked((int)0x8004401C),
1355         WBEMMOF_E_OUT_OF_RANGE = unchecked((int)0x8004401D),
1356         WBEMMOF_E_INVALID_FILE = unchecked((int)0x8004401E),
1357         WBEMMOF_E_ALIASES_IN_EMBEDDED = unchecked((int)0x8004401F),
1358         WBEMMOF_E_NULL_ARRAY_ELEM = unchecked((int)0x80044020),
1359         WBEMMOF_E_DUPLICATE_QUALIFIER = unchecked((int)0x80044021),
1360         WBEMMOF_E_EXPECTED_FLAVOR_TYPE = unchecked((int)0x80044022),
1361         WBEMMOF_E_INCOMPATIBLE_FLAVOR_TYPES = unchecked((int)0x80044023),
1362         WBEMMOF_E_MULTIPLE_ALIASES = unchecked((int)0x80044024),
1363         WBEMMOF_E_INCOMPATIBLE_FLAVOR_TYPES2 = unchecked((int)0x80044025),
1364         WBEMMOF_E_NO_ARRAYS_RETURNED = unchecked((int)0x80044026),
1365         WBEMMOF_E_MUST_BE_IN_OR_OUT = unchecked((int)0x80044027),
1366         WBEMMOF_E_INVALID_FLAGS_SYNTAX = unchecked((int)0x80044028),
1367         WBEMMOF_E_EXPECTED_BRACE_OR_BAD_TYPE = unchecked((int)0x80044029),
1368         WBEMMOF_E_UNSUPPORTED_CIMV22_QUAL_VALUE = unchecked((int)0x8004402A),
1369         WBEMMOF_E_UNSUPPORTED_CIMV22_DATA_TYPE = unchecked((int)0x8004402B),
1370         WBEMMOF_E_INVALID_DELETEINSTANCE_SYNTAX = unchecked((int)0x8004402C),
1371         WBEMMOF_E_INVALID_QUALIFIER_SYNTAX = unchecked((int)0x8004402D),
1372         WBEMMOF_E_QUALIFIER_USED_OUTSIDE_SCOPE = unchecked((int)0x8004402E),
1373         WBEMMOF_E_ERROR_CREATING_TEMP_FILE = unchecked((int)0x8004402F),
1374         WBEMMOF_E_ERROR_INVALID_INCLUDE_FILE = unchecked((int)0x80044030),
1375         WBEMMOF_E_INVALID_DELETECLASS_SYNTAX = unchecked((int)0x80044031),
1376     }
1377 
1378     enum tag_WMI_OBJ_TEXT
1379     {
1380         WMI_OBJ_TEXT_CIM_DTD_2_0 = unchecked((int)0x00000001),
1381         WMI_OBJ_TEXT_WMI_DTD_2_0 = unchecked((int)0x00000002),
1382         WMI_OBJ_TEXT_WMI_EXT1 = unchecked((int)0x00000003),
1383         WMI_OBJ_TEXT_WMI_EXT2 = unchecked((int)0x00000004),
1384         WMI_OBJ_TEXT_WMI_EXT3 = unchecked((int)0x00000005),
1385         WMI_OBJ_TEXT_WMI_EXT4 = unchecked((int)0x00000006),
1386         WMI_OBJ_TEXT_WMI_EXT5 = unchecked((int)0x00000007),
1387         WMI_OBJ_TEXT_WMI_EXT6 = unchecked((int)0x00000008),
1388         WMI_OBJ_TEXT_WMI_EXT7 = unchecked((int)0x00000009),
1389         WMI_OBJ_TEXT_WMI_EXT8 = unchecked((int)0x0000000A),
1390         WMI_OBJ_TEXT_WMI_EXT9 = unchecked((int)0x0000000B),
1391         WMI_OBJ_TEXT_WMI_EXT10 = unchecked((int)0x0000000C),
1392         WMI_OBJ_TEXT_LAST = unchecked((int)0x0000000D),
1393     }
1394 
1395     enum tag_WBEM_COMPILER_OPTIONS
1396     {
1397         WBEM_FLAG_CHECK_ONLY = unchecked((int)0x00000001),
1398         WBEM_FLAG_AUTORECOVER = unchecked((int)0x00000002),
1399         WBEM_FLAG_WMI_CHECK = unchecked((int)0x00000004),
1400         WBEM_FLAG_CONSOLE_PRINT = unchecked((int)0x00000008),
1401         WBEM_FLAG_DONT_ADD_TO_LIST = unchecked((int)0x00000010),
1402         WBEM_FLAG_SPLIT_FILES = unchecked((int)0x00000020),
1403         WBEM_FLAG_CONNECT_REPOSITORY_ONLY = unchecked((int)0x00000040),
1404     }
1405 
1406     enum tag_WBEM_CONNECT_OPTIONS
1407     {
1408         WBEM_FLAG_CONNECT_REPOSITORY_ONLY = 0X40,
1409         WBEM_FLAG_CONNECT_USE_MAX_WAIT = 0X80,
1410     }
1411 
1412     enum tag_WBEM_PROVIDER_REQUIREMENTS_TYPE
1413     {
1414         WBEM_REQUIREMENTS_START_POSTFILTER = unchecked((int)0x00000000),
1415         WBEM_REQUIREMENTS_STOP_POSTFILTER = unchecked((int)0x00000001),
1416         WBEM_REQUIREMENTS_RECHECK_SUBSCRIPTIONS = unchecked((int)0x00000002),
1417     }
1418 
1419     enum tag_WBEM_EXTRA_RETURN_CODES
1420     {
1421         WBEM_S_INITIALIZED = unchecked((int)0x00000000),
1422         WBEM_S_LIMITED_SERVICE = unchecked((int)0x00043001),
1423         WBEM_S_INDIRECTLY_UPDATED = unchecked((int)0x00043002),
1424         WBEM_S_SUBJECT_TO_SDS = unchecked((int)0x00043003),
1425         WBEM_E_RETRY_LATER = unchecked((int)0x80043001),
1426         WBEM_E_RESOURCE_CONTENTION = unchecked((int)0x80043002),
1427     }
1428 
1429     enum tag_WBEM_PROVIDER_FLAGS
1430     {
1431         WBEM_FLAG_OWNER_UPDATE = unchecked((int)0x00010000),
1432     }
1433 
1434     enum tag_WBEM_INFORMATION_FLAG_TYPE
1435     {
1436         WBEM_FLAG_SHORT_NAME = unchecked((int)0x00000001),
1437         WBEM_FLAG_LONG_NAME = unchecked((int)0x00000002),
1438     }
1439 
1440     enum tag_WBEM_BATCH_TYPE
1441     {
1442         WBEM_FLAG_BATCH_IF_NEEDED = unchecked((int)0x00000000),
1443         WBEM_FLAG_MUST_BATCH = unchecked((int)0x00000001),
1444         WBEM_FLAG_MUST_NOT_BATCH = unchecked((int)0x00000002),
1445     }
1446 
1447     enum tag_WBEM_PATH_STATUS_FLAG
1448     {
1449         WBEMPATH_INFO_ANON_LOCAL_MACHINE = unchecked((int)0x00000001),
1450         WBEMPATH_INFO_HAS_MACHINE_NAME = unchecked((int)0x00000002),
1451         WBEMPATH_INFO_IS_CLASS_REF = unchecked((int)0x00000004),
1452         WBEMPATH_INFO_IS_INST_REF = unchecked((int)0x00000008),
1453         WBEMPATH_INFO_HAS_SUBSCOPES = unchecked((int)0x00000010),
1454         WBEMPATH_INFO_IS_COMPOUND = unchecked((int)0x00000020),
1455         WBEMPATH_INFO_HAS_V2_REF_PATHS = unchecked((int)0x00000040),
1456         WBEMPATH_INFO_HAS_IMPLIED_KEY = unchecked((int)0x00000080),
1457         WBEMPATH_INFO_CONTAINS_SINGLETON = unchecked((int)0x00000100),
1458         WBEMPATH_INFO_V1_COMPLIANT = unchecked((int)0x00000200),
1459         WBEMPATH_INFO_V2_COMPLIANT = unchecked((int)0x00000400),
1460         WBEMPATH_INFO_CIM_COMPLIANT = unchecked((int)0x00000800),
1461         WBEMPATH_INFO_IS_SINGLETON = unchecked((int)0x00001000),
1462         WBEMPATH_INFO_IS_PARENT = unchecked((int)0x00002000),
1463         WBEMPATH_INFO_SERVER_NAMESPACE_ONLY = unchecked((int)0x00004000),
1464         WBEMPATH_INFO_NATIVE_PATH = unchecked((int)0x00008000),
1465         WBEMPATH_INFO_WMI_PATH = unchecked((int)0x00010000),
1466         WBEMPATH_INFO_PATH_HAD_SERVER = unchecked((int)0x00020000),
1467     }
1468 
1469     enum tag_WBEM_PATH_CREATE_FLAG
1470     {
1471         WBEMPATH_CREATE_ACCEPT_RELATIVE = unchecked((int)0x00000001),
1472         WBEMPATH_CREATE_ACCEPT_ABSOLUTE = unchecked((int)0x00000002),
1473         WBEMPATH_CREATE_ACCEPT_ALL = unchecked((int)0x00000004),
1474         WBEMPATH_TREAT_SINGLE_IDENT_AS_NS = unchecked((int)0x00000008),
1475     }
1476 
1477     enum tag_WBEM_GET_TEXT_FLAGS
1478     {
1479         WBEMPATH_COMPRESSED = unchecked((int)0x00000001),
1480         WBEMPATH_GET_RELATIVE_ONLY = unchecked((int)0x00000002),
1481         WBEMPATH_GET_SERVER_TOO = unchecked((int)0x00000004),
1482         WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY = unchecked((int)0x00000008),
1483         WBEMPATH_GET_NAMESPACE_ONLY = unchecked((int)0x00000010),
1484         WBEMPATH_GET_ORIGINAL = unchecked((int)0x00000020),
1485     }
1486 
1487     enum tag_WBEM_GET_KEY_FLAGS
1488     {
1489         WBEMPATH_TEXT = unchecked((int)0x00000001),
1490         WBEMPATH_QUOTEDTEXT = unchecked((int)0x00000002),
1491     }
1492 
1493     enum WMIQ_ANALYSIS_TYPE
1494     {
1495         WMIQ_ANALYSIS_RPN_SEQUENCE = unchecked((int)0x00000001),
1496         WMIQ_ANALYSIS_ASSOC_QUERY = unchecked((int)0x00000002),
1497         WMIQ_ANALYSIS_PROP_ANALYSIS_MATRIX = unchecked((int)0x00000003),
1498         WMIQ_ANALYSIS_QUERY_TEXT = unchecked((int)0x00000004),
1499         WMIQ_ANALYSIS_RESERVED = unchecked((int)0x08000000),
1500     }
1501 
1502     enum __MIDL___MIDL_itf_wmi_0000_0001
1503     {
1504         WMIQ_ANALYSIS_RPN_SEQUENCE = unchecked((int)0x00000001),
1505         WMIQ_ANALYSIS_ASSOC_QUERY = unchecked((int)0x00000002),
1506         WMIQ_ANALYSIS_PROP_ANALYSIS_MATRIX = unchecked((int)0x00000003),
1507         WMIQ_ANALYSIS_QUERY_TEXT = unchecked((int)0x00000004),
1508         WMIQ_ANALYSIS_RESERVED = unchecked((int)0x08000000),
1509     }
1510 
1511     enum WMIQ_RPN_TOKEN_FLAGS
1512     {
1513         WMIQ_RPN_TOKEN_EXPRESSION = unchecked((int)0x00000001),
1514         WMIQ_RPN_TOKEN_AND = unchecked((int)0x00000002),
1515         WMIQ_RPN_TOKEN_OR = unchecked((int)0x00000003),
1516         WMIQ_RPN_TOKEN_NOT = unchecked((int)0x00000004),
1517         WMIQ_RPN_OP_UNDEFINED = unchecked((int)0x00000000),
1518         WMIQ_RPN_OP_EQ = unchecked((int)0x00000001),
1519         WMIQ_RPN_OP_NE = unchecked((int)0x00000002),
1520         WMIQ_RPN_OP_GE = unchecked((int)0x00000003),
1521         WMIQ_RPN_OP_LE = unchecked((int)0x00000004),
1522         WMIQ_RPN_OP_LT = unchecked((int)0x00000005),
1523         WMIQ_RPN_OP_GT = unchecked((int)0x00000006),
1524         WMIQ_RPN_OP_LIKE = unchecked((int)0x00000007),
1525         WMIQ_RPN_OP_ISA = unchecked((int)0x00000008),
1526         WMIQ_RPN_OP_ISNOTA = unchecked((int)0x00000009),
1527         WMIQ_RPN_LEFT_PROPERTY_NAME = unchecked((int)0x00000001),
1528         WMIQ_RPN_RIGHT_PROPERTY_NAME = unchecked((int)0x00000002),
1529         WMIQ_RPN_CONST2 = unchecked((int)0x00000004),
1530         WMIQ_RPN_CONST = unchecked((int)0x00000008),
1531         WMIQ_RPN_RELOP = unchecked((int)0x00000010),
1532         WMIQ_RPN_LEFT_FUNCTION = unchecked((int)0x00000020),
1533         WMIQ_RPN_RIGHT_FUNCTION = unchecked((int)0x00000040),
1534         WMIQ_RPN_GET_TOKEN_TYPE = unchecked((int)0x00000001),
1535         WMIQ_RPN_GET_EXPR_SHAPE = unchecked((int)0x00000002),
1536         WMIQ_RPN_GET_LEFT_FUNCTION = unchecked((int)0x00000003),
1537         WMIQ_RPN_GET_RIGHT_FUNCTION = unchecked((int)0x00000004),
1538         WMIQ_RPN_GET_RELOP = unchecked((int)0x00000005),
1539         WMIQ_RPN_NEXT_TOKEN = unchecked((int)0x00000001),
1540         WMIQ_RPN_FROM_UNARY = unchecked((int)0x00000001),
1541         WMIQ_RPN_FROM_PATH = unchecked((int)0x00000002),
1542         WMIQ_RPN_FROM_CLASS_LIST = unchecked((int)0x00000004),
1543     }
1544 
1545     enum __MIDL___MIDL_itf_wmi_0000_0002
1546     {
1547         WMIQ_RPN_TOKEN_EXPRESSION = unchecked((int)0x00000001),
1548         WMIQ_RPN_TOKEN_AND = unchecked((int)0x00000002),
1549         WMIQ_RPN_TOKEN_OR = unchecked((int)0x00000003),
1550         WMIQ_RPN_TOKEN_NOT = unchecked((int)0x00000004),
1551         WMIQ_RPN_OP_UNDEFINED = unchecked((int)0x00000000),
1552         WMIQ_RPN_OP_EQ = unchecked((int)0x00000001),
1553         WMIQ_RPN_OP_NE = unchecked((int)0x00000002),
1554         WMIQ_RPN_OP_GE = unchecked((int)0x00000003),
1555         WMIQ_RPN_OP_LE = unchecked((int)0x00000004),
1556         WMIQ_RPN_OP_LT = unchecked((int)0x00000005),
1557         WMIQ_RPN_OP_GT = unchecked((int)0x00000006),
1558         WMIQ_RPN_OP_LIKE = unchecked((int)0x00000007),
1559         WMIQ_RPN_OP_ISA = unchecked((int)0x00000008),
1560         WMIQ_RPN_OP_ISNOTA = unchecked((int)0x00000009),
1561         WMIQ_RPN_LEFT_PROPERTY_NAME = unchecked((int)0x00000001),
1562         WMIQ_RPN_RIGHT_PROPERTY_NAME = unchecked((int)0x00000002),
1563         WMIQ_RPN_CONST2 = unchecked((int)0x00000004),
1564         WMIQ_RPN_CONST = unchecked((int)0x00000008),
1565         WMIQ_RPN_RELOP = unchecked((int)0x00000010),
1566         WMIQ_RPN_LEFT_FUNCTION = unchecked((int)0x00000020),
1567         WMIQ_RPN_RIGHT_FUNCTION = unchecked((int)0x00000040),
1568         WMIQ_RPN_GET_TOKEN_TYPE = unchecked((int)0x00000001),
1569         WMIQ_RPN_GET_EXPR_SHAPE = unchecked((int)0x00000002),
1570         WMIQ_RPN_GET_LEFT_FUNCTION = unchecked((int)0x00000003),
1571         WMIQ_RPN_GET_RIGHT_FUNCTION = unchecked((int)0x00000004),
1572         WMIQ_RPN_GET_RELOP = unchecked((int)0x00000005),
1573         WMIQ_RPN_NEXT_TOKEN = unchecked((int)0x00000001),
1574         WMIQ_RPN_FROM_UNARY = unchecked((int)0x00000001),
1575         WMIQ_RPN_FROM_PATH = unchecked((int)0x00000002),
1576         WMIQ_RPN_FROM_CLASS_LIST = unchecked((int)0x00000004),
1577     }
1578 
1579     enum WMIQ_ASSOCQ_FLAGS
1580     {
1581         WMIQ_ASSOCQ_ASSOCIATORS = unchecked((int)0x00000001),
1582         WMIQ_ASSOCQ_REFERENCES = unchecked((int)0x00000002),
1583         WMIQ_ASSOCQ_RESULTCLASS = unchecked((int)0x00000004),
1584         WMIQ_ASSOCQ_ASSOCCLASS = unchecked((int)0x00000008),
1585         WMIQ_ASSOCQ_ROLE = unchecked((int)0x00000010),
1586         WMIQ_ASSOCQ_RESULTROLE = unchecked((int)0x00000020),
1587         WMIQ_ASSOCQ_REQUIREDQUALIFIER = unchecked((int)0x00000040),
1588         WMIQ_ASSOCQ_REQUIREDASSOCQUALIFIER = unchecked((int)0x00000080),
1589         WMIQ_ASSOCQ_CLASSDEFSONLY = unchecked((int)0x00000100),
1590         WMIQ_ASSOCQ_KEYSONLY = unchecked((int)0x00000200),
1591         WMIQ_ASSOCQ_SCHEMAONLY = unchecked((int)0x00000400),
1592         WMIQ_ASSOCQ_CLASSREFSONLY = unchecked((int)0x00000800),
1593     }
1594 
1595     enum __MIDL___MIDL_itf_wmi_0000_0003
1596     {
1597         WMIQ_ASSOCQ_ASSOCIATORS = unchecked((int)0x00000001),
1598         WMIQ_ASSOCQ_REFERENCES = unchecked((int)0x00000002),
1599         WMIQ_ASSOCQ_RESULTCLASS = unchecked((int)0x00000004),
1600         WMIQ_ASSOCQ_ASSOCCLASS = unchecked((int)0x00000008),
1601         WMIQ_ASSOCQ_ROLE = unchecked((int)0x00000010),
1602         WMIQ_ASSOCQ_RESULTROLE = unchecked((int)0x00000020),
1603         WMIQ_ASSOCQ_REQUIREDQUALIFIER = unchecked((int)0x00000040),
1604         WMIQ_ASSOCQ_REQUIREDASSOCQUALIFIER = unchecked((int)0x00000080),
1605         WMIQ_ASSOCQ_CLASSDEFSONLY = unchecked((int)0x00000100),
1606         WMIQ_ASSOCQ_KEYSONLY = unchecked((int)0x00000200),
1607         WMIQ_ASSOCQ_SCHEMAONLY = unchecked((int)0x00000400),
1608         WMIQ_ASSOCQ_CLASSREFSONLY = unchecked((int)0x00000800),
1609     }
1610 
1611     enum tag_WMIQ_LANGUAGE_FEATURES
1612     {
1613         WMIQ_LF1_BASIC_SELECT = unchecked((int)0x00000001),
1614         WMIQ_LF2_CLASS_NAME_IN_QUERY = unchecked((int)0x00000002),
1615         WMIQ_LF3_STRING_CASE_FUNCTIONS = unchecked((int)0x00000003),
1616         WMIQ_LF4_PROP_TO_PROP_TESTS = unchecked((int)0x00000004),
1617         WMIQ_LF5_COUNT_STAR = unchecked((int)0x00000005),
1618         WMIQ_LF6_ORDER_BY = unchecked((int)0x00000006),
1619         WMIQ_LF7_DISTINCT = unchecked((int)0x00000007),
1620         WMIQ_LF8_ISA = unchecked((int)0x00000008),
1621         WMIQ_LF9_THIS = unchecked((int)0x00000009),
1622         WMIQ_LF10_COMPEX_SUBEXPRESSIONS = unchecked((int)0x0000000A),
1623         WMIQ_LF11_ALIASING = unchecked((int)0x0000000B),
1624         WMIQ_LF12_GROUP_BY_HAVING = unchecked((int)0x0000000C),
1625         WMIQ_LF13_WMI_WITHIN = unchecked((int)0x0000000D),
1626         WMIQ_LF14_SQL_WRITE_OPERATIONS = unchecked((int)0x0000000E),
1627         WMIQ_LF15_GO = unchecked((int)0x0000000F),
1628         WMIQ_LF16_SINGLE_LEVEL_TRANSACTIONS = unchecked((int)0x00000010),
1629         WMIQ_LF17_QUALIFIED_NAMES = unchecked((int)0x00000011),
1630         WMIQ_LF18_ASSOCIATONS = unchecked((int)0x00000012),
1631         WMIQ_LF19_SYSTEM_PROPERTIES = unchecked((int)0x00000013),
1632         WMIQ_LF20_EXTENDED_SYSTEM_PROPERTIES = unchecked((int)0x00000014),
1633         WMIQ_LF21_SQL89_JOINS = unchecked((int)0x00000015),
1634         WMIQ_LF22_SQL92_JOINS = unchecked((int)0x00000016),
1635         WMIQ_LF23_SUBSELECTS = unchecked((int)0x00000017),
1636         WMIQ_LF24_UMI_EXTENSIONS = unchecked((int)0x00000018),
1637         WMIQ_LF25_DATEPART = unchecked((int)0x00000019),
1638         WMIQ_LF26_LIKE = unchecked((int)0x0000001A),
1639         WMIQ_LF27_CIM_TEMPORAL_CONSTRUCTS = unchecked((int)0x0000001B),
1640         WMIQ_LF28_STANDARD_AGGREGATES = unchecked((int)0x0000001C),
1641         WMIQ_LF29_MULTI_LEVEL_ORDER_BY = unchecked((int)0x0000001D),
1642         WMIQ_LF30_WMI_PRAGMAS = unchecked((int)0x0000001E),
1643         WMIQ_LF31_QUALIFIER_TESTS = unchecked((int)0x0000001F),
1644         WMIQ_LF32_SP_EXECUTE = unchecked((int)0x00000020),
1645         WMIQ_LF33_ARRAY_ACCESS = unchecked((int)0x00000021),
1646         WMIQ_LF34_UNION = unchecked((int)0x00000022),
1647         WMIQ_LF35_COMPLEX_SELECT_TARGET = unchecked((int)0x00000023),
1648         WMIQ_LF36_REFERENCE_TESTS = unchecked((int)0x00000024),
1649         WMIQ_LF37_SELECT_INTO = unchecked((int)0x00000025),
1650         WMIQ_LF38_BASIC_DATETIME_TESTS = unchecked((int)0x00000026),
1651         WMIQ_LF39_COUNT_COLUMN = unchecked((int)0x00000027),
1652         WMIQ_LF40_BETWEEN = unchecked((int)0x00000028),
1653         WMIQ_LF_LAST = unchecked((int)0x00000028),
1654     }
1655 
1656     enum tag_WMIQ_RPNQ_FEATURE
1657     {
1658         WMIQ_RPNF_WHERE_CLAUSE_PRESENT = unchecked((int)0x00000001),
1659         WMIQ_RPNF_QUERY_IS_CONJUNCTIVE = unchecked((int)0x00000002),
1660         WMIQ_RPNF_QUERY_IS_DISJUNCTIVE = unchecked((int)0x00000004),
1661         WMIQ_RPNF_PROJECTION = unchecked((int)0x00000008),
1662         WMIQ_RPNF_FEATURE_SELECT_STAR = unchecked((int)0x00000010),
1663         WMIQ_RPNF_EQUALITY_TESTS_ONLY = unchecked((int)0x00000020),
1664         WMIQ_RPNF_COUNT_STAR = unchecked((int)0x00000040),
1665         WMIQ_RPNF_QUALIFIED_NAMES_IN_SELECT = unchecked((int)0x00000080),
1666         WMIQ_RPNF_QUALIFIED_NAMES_IN_WHERE = unchecked((int)0x00000100),
1667         WMIQ_RPNF_PROP_TO_PROP_TESTS = unchecked((int)0x00000200),
1668         WMIQ_RPNF_ORDER_BY = unchecked((int)0x00000400),
1669         WMIQ_RPNF_ISA_USED = unchecked((int)0x00000800),
1670         WMIQ_RPNF_ISNOTA_USED = unchecked((int)0x00001000),
1671         WMIQ_RPNF_GROUP_BY_HAVING = unchecked((int)0x00002000),
1672         WMIQ_RPNF_WITHIN_INTERVAL = unchecked((int)0x00004000),
1673         WMIQ_RPNF_WITHIN_AGGREGATE = unchecked((int)0x00008000),
1674         WMIQ_RPNF_SYSPROP_CLASS = unchecked((int)0x00010000),
1675         WMIQ_RPNF_REFERENCE_TESTS = unchecked((int)0x00020000),
1676         WMIQ_RPNF_DATETIME_TESTS = unchecked((int)0x00040000),
1677         WMIQ_RPNF_ARRAY_ACCESS = unchecked((int)0x00080000),
1678         WMIQ_RPNF_QUALIFIER_FILTER = unchecked((int)0x00100000),
1679         WMIQ_RPNF_SELECTED_FROM_PATH = unchecked((int)0x00200000),
1680     }
1681     #endregion
1682 
1683     #region Structs
1684 
1685     #endregion
1686 
1687     #region Co Classes
1688     [ClassInterfaceAttribute((short)0x0000)]
1689     [GuidAttribute("4590F811-1D3A-11D0-891F-00AA004B2E24")]
1690     ///[TypeLibTypeAttribute(0x0202)]
1691     [ComImport]
1692     class WbemLocator
1693     {
1694     }
1695 
1696     [ClassInterfaceAttribute((short)0x0000)]
1697     [GuidAttribute("674B6698-EE92-11D0-AD71-00C04FD8FDFF")]
1698     ///[TypeLibTypeAttribute(0x0202)]
1699     [ComImport]
1700     class WbemContext
1701     {
1702     }
1703 
1704     [ClassInterfaceAttribute((short)0x0000)]
1705     [GuidAttribute("49BD2028-1523-11D1-AD79-00C04FD8FDFF")]
1706     ///[TypeLibTypeAttribute(0x0002)]
1707     [ComImport]
1708     class UnsecuredApartment
1709     {
1710     }
1711 
1712     [GuidAttribute("9A653086-174F-11D2-B5F9-00104B703EFD")]
1713     [ClassInterfaceAttribute((short)0x0000)]
1714     ///[TypeLibTypeAttribute(0x0002)]
1715     [ComImport]
1716     class WbemClassObject
1717     {
1718     }
1719 
1720     [ClassInterfaceAttribute((short)0x0000)]
1721     [GuidAttribute("6DAF9757-2E37-11D2-AEC9-00C04FB68820")]
1722     ///[TypeLibTypeAttribute(0x0002)]
1723     [ComImport]
1724     class MofCompiler
1725     {
1726     }
1727 
1728     [ClassInterfaceAttribute((short)0x0000)]
1729     ///[TypeLibTypeAttribute(0x0002)]
1730     [GuidAttribute("EB87E1BD-3233-11D2-AEC9-00C04FB68820")]
1731     [ComImport]
1732     class WbemStatusCodeText
1733     {
1734     }
1735 
1736     [GuidAttribute("C49E32C6-BC8B-11D2-85D4-00105A1F8304")]
1737     [ClassInterfaceAttribute((short)0x0000)]
1738     ///[TypeLibTypeAttribute(0x0002)]
1739     [ComImport]
1740     class WbemBackupRestore
1741     {
1742     }
1743 
1744     [ClassInterfaceAttribute((short)0x0000)]
1745     ///[TypeLibTypeAttribute(0x0202)]
1746     [GuidAttribute("8D1C559D-84F0-4BB3-A7D5-56A7435A9BA6")]
1747     [ComImport]
1748     class WbemObjectTextSrc
1749     {
1750     }
1751 
1752     [GuidAttribute("4CFC7932-0F9D-4BEF-9C32-8EA2A6B56FCB")]
1753     ///[TypeLibTypeAttribute(0x0002)]
1754     [ClassInterfaceAttribute((short)0x0000)]
1755     [ComImport]
1756     class WbemDecoupledRegistrar
1757     {
1758     }
1759 
1760     [GuidAttribute("F5F75737-2843-4F22-933D-C76A97CDA62F")]
1761     ///[TypeLibTypeAttribute(0x0002)]
1762     [ClassInterfaceAttribute((short)0x0000)]
1763     [ComImport]
1764     class WbemDecoupledBasicEventProvider
1765     {
1766     }
1767 
1768     [ClassInterfaceAttribute((short)0x0000)]
1769     [GuidAttribute("CF4CC405-E2C5-4DDD-B3CE-5E7582D8C9FA")]
1770     ///[TypeLibTypeAttribute(0x0202)]
1771     [ComImport]
1772     class WbemDefPath
1773     {
1774     }
1775 
1776     [GuidAttribute("EAC8A024-21E2-4523-AD73-A71A0AA2F56A")]
1777     [ClassInterfaceAttribute((short)0x0000)]
1778     ///[TypeLibTypeAttribute(0x0002)]
1779     [ComImport]
1780     class WbemQuery
1781     {
1782     }
1783     #endregion
1784 
1785     class MTAHelper
1786     {
1787 
1788         private class MTARequest
1789         {
1790             public AutoResetEvent evtDone = new AutoResetEvent(false);
1791             public Type typeToCreate = null;
1792             public object createdObject = null;
1793             public Exception exception = null;
1794 
MTARequest(Type typeToCreate)1795             public MTARequest(Type typeToCreate)
1796             {
1797                 this.typeToCreate = typeToCreate;
1798             }
1799         }
1800 
1801         static ArrayList reqList = new ArrayList(3);
1802         static object critSec = new object();
1803 
1804         static AutoResetEvent evtGo = new AutoResetEvent(false); // tells the worker to create an object on our behalf
1805 
1806         static bool workerThreadInitialized = false;
1807         // Initialize worker thread
1808         // This is not done in a static constructor so that we don't do this in an MTA only application
InitWorkerThread()1809         static void InitWorkerThread()
1810         {
1811             // Create the worker thread
1812             Thread thread = new Thread(new ThreadStart(WorkerThread));
1813             thread.SetApartmentState(ApartmentState.MTA);
1814             thread.IsBackground = true;
1815             thread.Start();
1816         }
1817 
1818         // This method will create an instance of the requeted type in the MTA
CreateInMTA(Type type)1819         public static object CreateInMTA(Type type)
1820         {
1821             // If we are currently in the MTA, we can directly create the object
1822             if(IsNoContextMTA())
1823                 return Activator.CreateInstance(type);
1824 
1825             // We need to create the object in the MTA by using a worker thread
1826             // that lives in the MTA.  Make sure only one person uses this worker
1827             // thread at a time
1828             MTARequest myReq = new MTARequest(type);
1829             int ndx;
1830 
1831             lock(critSec)
1832             {
1833                 // Make sure worker thread is initialized
1834                 if(workerThreadInitialized == false)
1835                 {
1836                     InitWorkerThread();
1837                     workerThreadInitialized = true;
1838                 }
1839 
1840                 ndx = reqList.Add(myReq);
1841 
1842                 if( evtGo.Set() == false )
1843                 {
1844                     reqList.RemoveAt(ndx);
1845                     throw new ManagementException(SR.WorkerThreadWakeupFailed);
1846                 }
1847             }
1848 
1849             // release the lock so that worker thread can work on the request
1850             myReq.evtDone.WaitOne();
1851 
1852             if (myReq.exception != null)
1853             {
1854                 throw myReq.exception;
1855             }
1856 
1857             return myReq.createdObject;
1858         }
1859 
WorkerThread()1860         static void WorkerThread()
1861         {
1862             // The worker thread will be a background thread, so we never have
1863             // to worry about killing it.  There is no chance that we will
1864             // be terminated inside the guts of the worker because we are
1865             // always waited on until we complete.  In other words, when the
1866             // process goes away, we are really assured that we will be in the
1867             // evtGo.WaitOne() block.
1868             while(true)
1869             {
1870                 // Wait for someone who wants us to create an object
1871                 evtGo.WaitOne();
1872 
1873                 // get requests from the request queue. Since two Set within short time on evtGo can wake this thread only once
1874                 // workerthread should check until we empty all the results. Even if we consume the request that is not set,
1875                 // workerthread will wake up one more time unnecessarily and do nothing
1876                 while(true)
1877                 {
1878                     MTARequest reqToProcess = null;
1879                     lock (critSec)
1880                     {
1881                         if (reqList.Count > 0)
1882                         {
1883                             reqToProcess = (MTARequest)reqList[0];
1884                             reqList.RemoveAt(0);
1885                         }
1886                         else
1887                         {
1888                             break;  // break the inner while true
1889                         }
1890                     }
1891 
1892                     try
1893                     {
1894                         reqToProcess.createdObject = Activator.CreateInstance(reqToProcess.typeToCreate);
1895                     }
1896                     catch (Exception e)
1897                     {
1898                         reqToProcess.exception = e;
1899                     }
1900                     finally
1901                     {
1902                         // Tell the caller that we are done creating the object
1903                         reqToProcess.evtDone.Set();
1904                     }
1905                 }
1906             }
1907         }
1908 
1909         // Interfaces that we need to use
1910         static Guid IID_IObjectContext = new Guid("51372AE0-CAE7-11CF-BE81-00AA00A2FA25");
1911         static Guid IID_IComThreadingInfo = new Guid("000001ce-0000-0000-C000-000000000046");
1912 
1913 
1914         // Import of CoGetObjectContext
1915         [ResourceExposure( ResourceScope.None), DllImport("ole32.dll")]
CoGetObjectContext([In] ref Guid riid, [Out] out IntPtr pUnk)1916         static extern int CoGetObjectContext([In] ref Guid riid, [Out] out IntPtr pUnk);
1917 
1918         // A variable that is initialized once to tell us if we are on
1919         // a Win2k platform or above.
1920         static bool CanCallCoGetObjectContext = IsWindows2000OrHigher();
1921 
1922         // This method will tell us if the calling thread is in the MTA and we are not in a 'context'
IsNoContextMTA()1923         public static bool IsNoContextMTA()
1924         {
1925             // If the runtime says we are not an MTA thread, we'll trust it and return false
1926             if(Thread.CurrentThread.GetApartmentState()  != ApartmentState.MTA)
1927                 return false;
1928 
1929             // We know that 'ApartmentState' says we are MTA
1930             // If we are not on Win2k or above, we don't have to worry about 'context' or the neutral apartment
1931             // We know we are safely in the MTA and return true
1932             if(!CanCallCoGetObjectContext)
1933                 return true;
1934 
1935 
1936             // We now will use IComThreadingInfo to make sure we are not in the neutral apartment, and
1937             // we check for IObjectContext to see if we have a 'context'
1938             IntPtr pComThreadingInfo = IntPtr.Zero;
1939             IntPtr pObjectContext = IntPtr.Zero;
1940             try
1941             {
1942                 // If we CANNOT call CoGetObjectContext, assume we are not in the 'no context MTA' for safety
1943                 // (NOTE: This call is expected to always succeed)
1944                 if(0 != CoGetObjectContext(ref IID_IComThreadingInfo, out pComThreadingInfo))
1945                     return false;
1946 
1947                 WmiNetUtilsHelper.APTTYPE aptType;
1948 
1949                 // If we CANNOT get the apartment type, assume we are not in the 'no context MTA' for safety
1950                 // (NOTE: This call is expected to always succeed)
1951                 if(0 != WmiNetUtilsHelper.GetCurrentApartmentType_f(3, pComThreadingInfo, out aptType))
1952                     return false;
1953 
1954                 // If we are not in the MTA, return false
1955                 if(aptType != WmiNetUtilsHelper.APTTYPE.APTTYPE_MTA)
1956                     return false;
1957 
1958                 // If we CAN get to the IObejctContext interface, we have a 'context'
1959                 if(0 == Marshal.QueryInterface(pComThreadingInfo, ref IID_IObjectContext, out pObjectContext))
1960                     return false;
1961             }
1962             finally
1963             {
1964                 if(pComThreadingInfo != IntPtr.Zero)
1965                     Marshal.Release(pComThreadingInfo);
1966                 if(pObjectContext != IntPtr.Zero)
1967                     Marshal.Release(pObjectContext);
1968             }
1969 
1970             // We made it past all the tests
1971             return true;
1972         }
1973 
IsWindows2000OrHigher()1974         static bool IsWindows2000OrHigher()
1975         {
1976             // If we are on Win2k or above, we are OK
1977             // - Platform == Win32NT and OS version >= 5.0.0.0
1978             OperatingSystem os = Environment.OSVersion;
1979             if(os.Platform==PlatformID.Win32NT && os.Version >= new Version(5, 0))
1980                 return true;
1981             return false;
1982         }
1983     }
1984 
1985 
1986     /// <summary>
1987     /// The ThreadDispatch class allows clients to very easily spawn a thread, specify a worker delegate to be called from the
1988     /// spawned thread and wait until thread finishes work. This is important in cases where a new thread needs to be spawned but
1989     /// the main thread has to wait until the spawned thread finishes. As an example of this, in WMI we spawn MTA threads and create
1990     /// various objects in these threads to make sure we avoid marshaling cost.
1991     /// If the worker thread returns a value it is stored in the ThreadDispatch object and accessible to clients via the Result property.
1992     /// Also, any exception thrown is propagated from worker thread to main thread (by rethrowing orinal exception):
1993     ///
1994     ///     ThreadDispatch disp = new ThreadDispatch ( new ThreadDispatch.ThreadWorkerMethod  ( Class1.Func ) ) ;
1995     ///     disp.Start ( ) ;
1996     ///
1997     /// Four different delegate types are supported:
1998     ///
1999     ///     1. Delegate with no parameter and no return value.
2000     ///     2. Delegate with no parameter and return value.
2001     ///     3. Delegate with parameter and no return value.
2002     ///     4. Delegate with parameter and return value.
2003     ///
2004     /// </summary>
2005     internal class ThreadDispatch
2006     {
2007         #region Private fields
2008         private     Thread                                  thread ;
2009         private     Exception                               exception ;                                 // Exception thrown from worker method (if any). Exposed as property.
2010         private     ThreadWorkerMethodWithReturn            threadWorkerMethodWithReturn ;              // Delegate to be called for worker method with return value
2011         private     ThreadWorkerMethodWithReturnAndParam    threadWorkerMethodWithReturnAndParam ;      // Delegate to be called for worker method with return value and parameter
2012         private     ThreadWorkerMethod                      threadWorkerMethod ;                        // Delegate to be called for worker method
2013         private     ThreadWorkerMethodWithParam             threadWorkerMethodWithParam ;               // Delegate to be called for worker method with parameter
2014         private     object                                  threadReturn ;                              // Return data from worker method.
2015         private     object                                  threadParams ;                              // Parameters to be passed to worker method
2016         private     bool                                    backgroundThread ;                          // Is this a background thread?
2017         private     ApartmentState                          apartmentType ;                             // Apartment type of thread
2018         #endregion
2019 
2020         #region Properties
2021         /// <summary>
2022         /// [Get] Gets the exception associated with the operation performed by thread.
2023         /// This can be null if no exception has been thrown.
2024         /// </summary>
2025         public System.Exception Exception
2026         {
2027             get
2028             {
2029                 return this.exception ;
2030             }
2031         }
2032 
2033         /// <summary>
2034         /// [Get/Set] The parameter to be used by worker thread. This will typically be a 'this' reference for access to instance members.
2035         /// </summary>
2036         public object Parameter
2037         {
2038             get
2039             {
2040                 return this.threadParams ;
2041             }
2042             set
2043             {
2044                 this.threadParams = value ;
2045             }
2046         }
2047 
2048         /// <summary>
2049         /// [Get/Set] The background property of a thread. Defaults to false.
2050         /// </summary>
2051         public bool IsBackgroundThread
2052         {
2053             get
2054             {
2055                 return this.backgroundThread ;
2056             }
2057             set
2058             {
2059                 this.backgroundThread = value ;
2060             }
2061         }
2062 
2063         /// <summary>
2064         /// [Get] The result of the worker method called.
2065         /// </summary>
2066         public object Result
2067         {
2068             get
2069             {
2070                 return this.threadReturn ;
2071             }
2072         }
2073 
2074 
2075         /// <summary>
2076         /// [Get/Set] The thread apartment type
2077         /// </summary>
2078         public ApartmentState ApartmentType
2079         {
2080             get
2081             {
2082                 return this.apartmentType ;
2083             }
2084             set
2085             {
2086                 this.apartmentType = value ;
2087             }
2088         }
2089         #endregion
2090 
2091         #region Public Delegates
2092         /// <summary>
2093         /// Delegate declaration representing signature of worker method with return value.
2094         /// </summary>
ThreadWorkerMethodWithReturn( )2095         public delegate object  ThreadWorkerMethodWithReturn (  ) ;
2096 
2097         /// <summary>
2098         /// Delegate declaration representing signature of worker method with return value and parameter.
2099         /// </summary>
ThreadWorkerMethodWithReturnAndParam( object param )2100         public delegate object  ThreadWorkerMethodWithReturnAndParam ( object param ) ;
2101 
2102         /// <summary>
2103         /// Delegate declaration representing signature of worker method with no return value and no parameter
2104         /// </summary>
ThreadWorkerMethod( )2105         public delegate void    ThreadWorkerMethod (  ) ;
2106 
2107         /// <summary>
2108         /// Delegate declaration representing signature of worker method with parameter.
2109         /// </summary>
ThreadWorkerMethodWithParam( object param )2110         public delegate void    ThreadWorkerMethodWithParam ( object param ) ;
2111         #endregion
2112 
2113         #region Public methods
2114         /// <summary>
2115         /// Constructs a ThreadDispatch object with the thread worker method.
2116         /// Default settings on the ThreadDispatch object are:
2117         ///     1. Parameter is null
2118         ///     2. Thread ApartmentState will be MTA
2119         ///     3. Background thread status will be false
2120         /// </summary>
2121         /// <param name="workerMethod">Delegate to be called to perform the work</param>
ThreadDispatch( ThreadWorkerMethodWithReturn workerMethod )2122         public ThreadDispatch ( ThreadWorkerMethodWithReturn workerMethod ) : this ( )
2123         {
2124             InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ;
2125         }
2126 
2127         /// <summary>
2128         /// Constructs a ThreadDispatch object with the thread worker method.
2129         /// Default settings on the ThreadDispatch object are:
2130         ///     1. Parameter is null
2131         ///     2. Thread ApartmentState will be MTA
2132         ///     3. Background thread status will be false
2133         /// </summary>
2134         /// <param name="workerMethod">Delegate to be called to perform the work</param>
ThreadDispatch( ThreadWorkerMethodWithReturnAndParam workerMethod )2135         public ThreadDispatch ( ThreadWorkerMethodWithReturnAndParam workerMethod ) : this ( )
2136         {
2137             InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ;
2138         }
2139 
2140         /// <summary>
2141         /// Constructs a ThreadDispatch object with the thread worker method.
2142         /// Default settings on the ThreadDispatch object are:
2143         ///     1. Parameter is null
2144         ///     2. Thread ApartmentState will be MTA
2145         ///     3. Background thread status will be false
2146         /// </summary>
2147         /// <param name="workerMethod">Delegate to be called to perform the work</param>
ThreadDispatch( ThreadWorkerMethodWithParam workerMethod )2148         public ThreadDispatch ( ThreadWorkerMethodWithParam workerMethod ) : this ( )
2149         {
2150             InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ;
2151         }
2152 
2153         /// <summary>
2154         /// Constructs a ThreadDispatch object with the thread worker method.
2155         /// Default settings on the ThreadDispatch object are:
2156         ///     1. Parameter is null
2157         ///     2. Thread ApartmentState will be MTA
2158         ///     3. Background thread status will be false
2159         /// </summary>
2160         /// <param name="workerMethod">Delegate to be called to perform the work</param>
ThreadDispatch( ThreadWorkerMethod workerMethod )2161         public ThreadDispatch ( ThreadWorkerMethod workerMethod ) : this ( )
2162         {
2163             InitializeThreadState ( null, workerMethod, ApartmentState.MTA, false ) ;
2164         }
2165 
2166         /// <summary>
2167         /// Starts the thread execution and waits for thread to finish. If an exception occurs in the worker method
2168         /// this method rethrows the exception.
2169         /// </summary>
Start( )2170         public void Start ( )
2171         {
2172             this.exception = null ;
2173             DispatchThread ( ) ;
2174             if ( this.Exception != null )
2175             {
2176                 throw this.Exception ;
2177             }
2178         }
2179         #endregion
2180 
2181         #region Private methods
2182         /// <summary>
2183         /// Initializes the ThreadDispatch instance with initial values. Note that this constructor is private to avoid
2184         /// declaring instances without specifying at least a worker delegate instance.
2185         /// </summary>
ThreadDispatch( )2186         private ThreadDispatch ( )
2187         {
2188             this.thread                                 = null ;
2189             this.exception                              = null ;
2190             this.threadParams                           = null ;
2191             this.threadWorkerMethodWithReturn           = null ;
2192             this.threadWorkerMethodWithReturnAndParam   = null ;
2193             this.threadWorkerMethod                     = null ;
2194             this.threadWorkerMethodWithParam            = null;
2195             this.threadReturn                           = null ;
2196             this.backgroundThread                       = false ;
2197             this.apartmentType                          = ApartmentState.MTA ;
2198         }
2199 
2200         /// <summary>
2201         /// Initializes the thread state members.
2202         /// </summary>
2203         /// <param name="threadParams">Parameters to be passed to thread</param>
2204         /// <param name="workerMethod">The delegate to be called from thread</param>
2205         /// <param name="aptState">The apartment of the thread created</param>
InitializeThreadState( object threadParams, ThreadWorkerMethodWithReturn workerMethod, ApartmentState aptState, bool background )2206         private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithReturn workerMethod, ApartmentState aptState, bool background )
2207         {
2208             this.threadParams = threadParams ;
2209             this.threadWorkerMethodWithReturn  = workerMethod ;
2210             this.thread = new Thread ( new ThreadStart ( ThreadEntryPointMethodWithReturn ) ) ;
2211             this.thread.SetApartmentState(aptState) ;
2212             this.backgroundThread = background ;
2213         }
2214 
2215         /// <summary>
2216         /// Initializes the thread state members.
2217         /// </summary>
2218         /// <param name="threadParams">Parameters to be passed to thread</param>
2219         /// <param name="workerMethod">The delegate to be called from thread</param>
2220         /// <param name="aptState">The apartment of the thread created</param>
InitializeThreadState( object threadParams, ThreadWorkerMethodWithReturnAndParam workerMethod, ApartmentState aptState, bool background )2221         private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithReturnAndParam workerMethod, ApartmentState aptState, bool background )
2222         {
2223             this.threadParams = threadParams ;
2224             this.threadWorkerMethodWithReturnAndParam = workerMethod ;
2225             this.thread = new Thread ( new ThreadStart ( ThreadEntryPointMethodWithReturnAndParam ) ) ;
2226             this.thread.SetApartmentState(aptState);
2227             this.backgroundThread = background ;
2228         }
2229 
2230         /// <summary>
2231         /// Initializes the thread state members.
2232         /// </summary>
2233         /// <param name="threadParams">Parameters to be passed to thread</param>
2234         /// <param name="workerMethod">The delegate to be called from thread</param>
2235         /// <param name="aptState">The apartment of the thread created</param>
InitializeThreadState( object threadParams, ThreadWorkerMethod workerMethod, ApartmentState aptState, bool background )2236         private void InitializeThreadState ( object threadParams, ThreadWorkerMethod workerMethod, ApartmentState aptState, bool background )
2237         {
2238             this.threadParams = threadParams ;
2239             this.threadWorkerMethod  = workerMethod ;
2240             this.thread = new Thread ( new ThreadStart ( ThreadEntryPoint ) ) ;
2241             this.thread.SetApartmentState(aptState );
2242             this.backgroundThread = background ;
2243         }
2244 
2245         /// <summary>
2246         /// Initializes the thread state members.
2247         /// </summary>
2248         /// <param name="threadParams">Parameters to be passed to thread</param>
2249         /// <param name="workerMethod">The delegate to be called from thread</param>
2250         /// <param name="aptState">The apartment of the thread created</param>
InitializeThreadState( object threadParams, ThreadWorkerMethodWithParam workerMethod, ApartmentState aptState, bool background )2251         private void InitializeThreadState ( object threadParams, ThreadWorkerMethodWithParam workerMethod, ApartmentState aptState, bool background )
2252         {
2253             this.threadParams = threadParams ;
2254             this.threadWorkerMethodWithParam = workerMethod ;
2255             this.thread = new Thread ( new ThreadStart ( ThreadEntryPointMethodWithParam ) ) ;
2256             this.thread.SetApartmentState( aptState );
2257             this.backgroundThread = background ;
2258         }
2259 
2260 
2261         /// <summary>
2262         /// Starts the execution of the thread and waits until the threadFinished event is signaled before continuing
2263         /// </summary>
DispatchThread( )2264         private void DispatchThread ( )
2265         {
2266             this.thread.Start ( ) ;
2267             this.thread.Join ( ) ;
2268         }
2269 
2270         /// <summary>
2271         /// Entry point for the newly created thread. This method is wrapped in a try/catch block and captures any
2272         /// exceptions thrown from the worker method and re-throws the exception.
2273         /// The worker method for this thread entry point has no parameter and no return value.
2274         /// </summary>
ThreadEntryPoint( )2275         private void ThreadEntryPoint ( )
2276         {
2277             try
2278             {
2279                 this.threadWorkerMethod ( ) ;
2280             }
2281             catch ( Exception e )
2282             {
2283                 this.exception = e ;
2284             }
2285         }
2286 
2287         /// <summary>
2288         /// Entry point for the newly created thread. This method is wrapped in a try/catch block and captures any
2289         /// exceptions thrown from the worker method and re-throws the exception.
2290         /// The worker method for this thread entry point takes a parameter and no return value.
2291         /// </summary>
2292 
ThreadEntryPointMethodWithParam( )2293         private void ThreadEntryPointMethodWithParam ( )
2294         {
2295             try
2296             {
2297                 this.threadWorkerMethodWithParam ( this.threadParams ) ;
2298             }
2299             catch ( Exception e )
2300             {
2301                 this.exception = e ;
2302             }
2303         }
2304 
2305         /// <summary>
2306         /// Entry point for the newly created thread. This method is wrapped in a try/catch block and captures any
2307         /// exceptions thrown from the worker method and re-throws the exception.
2308         /// The worker method for this thread entry point has no parameter but does return a value.
2309         /// </summary>
2310 
ThreadEntryPointMethodWithReturn( )2311         private void ThreadEntryPointMethodWithReturn ( )
2312         {
2313             try
2314             {
2315                 this.threadReturn = this.threadWorkerMethodWithReturn ( ) ;
2316             }
2317             catch ( Exception e )
2318             {
2319                 this.exception = e ;
2320             }
2321         }
2322 
2323         /// <summary>
2324         /// Entry point for the newly created thread. This method is wrapped in a try/catch block and captures any
2325         /// exceptions thrown from the worker method and re-throws the exception.
2326         /// The worker method for this thread entry point has a parameter and return value.
2327         /// </summary>
2328 
ThreadEntryPointMethodWithReturnAndParam( )2329         private void ThreadEntryPointMethodWithReturnAndParam ( )
2330         {
2331             try
2332             {
2333                 this.threadReturn = this.threadWorkerMethodWithReturnAndParam ( this.threadParams) ;
2334             }
2335             catch ( Exception e )
2336             {
2337                 this.exception = e ;
2338             }
2339         }
2340         #endregion
2341     }
2342 }
2343 
2344