internal MethodContext(WbemProvider.ParameterContext parms, string methodName, WbemNative.IWbemClassObject wbemInParms, WbemProvider.WbemInstance wbemInstance)
 {
     this.parms       = parms;
     this.methodName  = methodName;
     this.wbemInParms = wbemInParms;
     this.instance    = new WbemProvider.InstanceContext(wbemInstance);
     WbemNative.IWbemClassObject ppObject = null;
     WbemException.ThrowIfFail(parms.WbemServices.GetObject(parms.ClassName, 0, parms.WbemContext, ref ppObject, IntPtr.Zero));
     WbemNative.IWbemClassObject ppOutSignature = null;
     WbemException.ThrowIfFail(ppObject.GetMethod(methodName, 0, IntPtr.Zero, out ppOutSignature));
     WbemException.ThrowIfFail(ppOutSignature.SpawnInstance(0, out this.wbemOutParms));
 }
 internal WbemInstance(WbemProvider.ParameterContext parms, string className)
 {
     this.parms = parms;
     if (string.IsNullOrEmpty(className))
     {
         className = parms.ClassName;
     }
     this.className = className;
     WbemNative.IWbemClassObject ppObject = null;
     WbemException.ThrowIfFail(parms.WbemServices.GetObject(className, 0, parms.WbemContext, ref ppObject, IntPtr.Zero));
     if (ppObject != null)
     {
         WbemException.ThrowIfFail(ppObject.SpawnInstance(0, out this.wbemObject));
     }
 }
            internal WbemInstance(ParameterContext parms, string className)
            {
                this.parms = parms;
                if (String.IsNullOrEmpty(className))
                {
                    className = parms.ClassName;
                }
                this.className = className;
                WbemNative.IWbemClassObject tempObj = null;
                WbemException.ThrowIfFail(
                    parms.WbemServices.GetObject(className, 0, parms.WbemContext, ref tempObj, IntPtr.Zero)
                    );


                if (null != tempObj)
                {
                    WbemException.ThrowIfFail(tempObj.SpawnInstance(0, out this.wbemObject));
                }
            }