private IWbemQualifierSetFreeThreaded GetTypeQualifierSet(QualifierType qualifierSetType) { IWbemQualifierSetFreeThreaded wbemQualifierSetFreeThreaded = null; int qualifierSet_ = 0; QualifierType qualifierType = qualifierSetType; if (qualifierType == QualifierType.ObjectQualifier) { qualifierSet_ = this.parent.wbemObject.GetQualifierSet_(out wbemQualifierSetFreeThreaded); } else if (qualifierType == QualifierType.PropertyQualifier) { qualifierSet_ = this.parent.wbemObject.GetPropertyQualifierSet_(this.propertyOrMethodName, out wbemQualifierSetFreeThreaded); } else if (qualifierType == QualifierType.MethodQualifier) { qualifierSet_ = this.parent.wbemObject.GetMethodQualifierSet_(this.propertyOrMethodName, out wbemQualifierSetFreeThreaded); } else { throw new ManagementException(ManagementStatus.Unexpected, null, null); } if (qualifierSet_ < 0) { if (((long)qualifierSet_ & (long)-4096) != (long)-2147217408) { Marshal.ThrowExceptionForHR(qualifierSet_); } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)qualifierSet_); } } return(wbemQualifierSetFreeThreaded); }
private IWbemQualifierSetFreeThreaded GetTypeQualifierSet(QualifierType qualifierSetType) { IWbemQualifierSetFreeThreaded ppQualSet = null; int errorCode = 0; switch (qualifierSetType) { case QualifierType.ObjectQualifier: errorCode = this.parent.wbemObject.GetQualifierSet_(out ppQualSet); break; case QualifierType.PropertyQualifier: errorCode = this.parent.wbemObject.GetPropertyQualifierSet_(this.propertyOrMethodName, out ppQualSet); break; case QualifierType.MethodQualifier: errorCode = this.parent.wbemObject.GetMethodQualifierSet_(this.propertyOrMethodName, out ppQualSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); } if (errorCode < 0) { if ((errorCode & 0xfffff000L) == 0x80041000L) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)errorCode); return(ppQualSet); } Marshal.ThrowExceptionForHR(errorCode); } return(ppQualSet); }
/// <summary> /// Return the qualifier set associated with its type /// </summary> private IWbemQualifierSetFreeThreaded GetTypeQualifierSet(QualifierType qualifierSetType) { IWbemQualifierSetFreeThreaded qualifierSet = null; int status = qualifierSetType switch { QualifierType.ObjectQualifier => parent.wbemObject.GetQualifierSet_(out qualifierSet), QualifierType.PropertyQualifier => parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet), QualifierType.MethodQualifier => parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet), _ => throw new ManagementException(ManagementStatus.Unexpected, null, null), // Is this the best fit error ?? }; if (status < 0) { if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else { Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); } } return(qualifierSet); }
//This private function is used to refresh the information from the Wmi object before returning the requested data private void RefreshQualifierInfo() { qualifierSet = null; int status = qualifierType switch { QualifierType.ObjectQualifier => parent.wbemObject.GetQualifierSet_(out qualifierSet), QualifierType.PropertyQualifier => parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet), QualifierType.MethodQualifier => parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet), _ => throw new ManagementException(ManagementStatus.Unexpected, null, null), //is this the best fit error ?? }; if ((status & 0x80000000) == 0) //success { qualifierValue = null; //Make sure it's null so that we don't leak ! if (qualifierSet != null) { status = qualifierSet.Get_(qualifierName, 0, ref qualifierValue, ref qualifierFlavor); } } if ((status & 0xfffff000) == 0x80041000) //WMI error { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else if ((status & 0x80000000) != 0) //any failure { Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); } }
//This private function is used to refresh the information from the Wmi object before returning the requested data private void RefreshQualifierInfo() { int status = (int)ManagementStatus.Failed; qualifierSet = null; switch (qualifierType) { case QualifierType.ObjectQualifier : status = parent.wbemObject.GetQualifierSet_(out qualifierSet); break; case QualifierType.PropertyQualifier : status = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet); break; case QualifierType.MethodQualifier : status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet); break; default : throw new ManagementException(ManagementStatus.Unexpected, null, null); //is this the best fit error ?? } if ((status & 0x80000000) == 0) //success { qualifierValue = null; //Make sure it's null so that we don't leak ! if (qualifierSet != null) status = qualifierSet.Get_(qualifierName, 0, ref qualifierValue, ref qualifierFlavor); } if ((status & 0xfffff000) == 0x80041000) //WMI error ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); else if ((status & 0x80000000) != 0) //any failure Marshal.ThrowExceptionForHR(status); }
//This private function is used to refresh the information from the Wmi object before returning the requested data private void RefreshQualifierInfo() { int status = (int)ManagementStatus.Failed; qualifierSet = null; switch (qualifierType) { case QualifierType.ObjectQualifier: try { status = parent.wbemObject.GetQualifierSet_(out qualifierSet); } catch (Exception e) { ManagementException.ThrowWithExtendedInfo(e); } break; case QualifierType.PropertyQualifier: try { status = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet); } catch (Exception e) { ManagementException.ThrowWithExtendedInfo(e); } break; case QualifierType.MethodQualifier: try { status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet); } catch (Exception e) { ManagementException.ThrowWithExtendedInfo(e); } break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); //is this the best fit error ?? } if ((status & 0x80000000) == 0) { try { qualifierValue = null; //Make sure it's null so that we don't leak ! if (qualifierSet != null) { status = qualifierSet.Get_(qualifierName, 0, ref qualifierValue, ref qualifierFlavor); } } catch (Exception e) { ManagementException.ThrowWithExtendedInfo(e); } } if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else if ((status & 0x80000000) != 0) { Marshal.ThrowExceptionForHR(status); } }
//Internal constructor internal QualifierDataEnumerator(ManagementBaseObject parent, string propertyOrMethodName, QualifierType qualifierType) { this.parent = parent; this.propertyOrMethodName = propertyOrMethodName; this.qualifierType = qualifierType; this.qualifierNames = null; IWbemQualifierSetFreeThreaded qualifierSet = null; int status = (int)ManagementStatus.NoError; switch (qualifierType) { case QualifierType.ObjectQualifier: status = parent.wbemObject.GetQualifierSet_(out qualifierSet); break; case QualifierType.PropertyQualifier: status = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet); break; case QualifierType.MethodQualifier: status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ?? } // If we got an error code back, assume there are NO qualifiers for this object/property/method if (status < 0) { // TODO: Should we look at specific error codes. For example, if you ask // for the qualifier set on a system property, GetPropertyQualifierSet() returns // WBEM_E_SYSTEM_PROPERTY. qualifierNames = new String[] {}; } else { status = qualifierSet.GetNames_(0, out qualifierNames); if (status < 0) { if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else { Marshal.ThrowExceptionForHR(status); } } } }
//Internal constructor internal QualifierDataEnumerator(ManagementBaseObject parent, string propertyOrMethodName, QualifierType qualifierType) { this.parent = parent; this.propertyOrMethodName = propertyOrMethodName; this.qualifierType = qualifierType; this.qualifierNames = null; IWbemQualifierSetFreeThreaded qualifierSet = null; int status = (int)ManagementStatus.NoError; switch (qualifierType) { case QualifierType.ObjectQualifier: status = parent.wbemObject.GetQualifierSet_(out qualifierSet); break; case QualifierType.PropertyQualifier: status = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet); break; case QualifierType.MethodQualifier: status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ?? } // If we got an error code back, assume there are NO qualifiers for this object/property/method if (status < 0) { // qualifierNames = new String[] {}; } else { status = qualifierSet.GetNames_(0, out qualifierNames); if (status < 0) { if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else { Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); } } } }
internal QualifierDataEnumerator(ManagementBaseObject parent, string propertyOrMethodName, QualifierType qualifierType) { this.index = -1; this.parent = parent; this.propertyOrMethodName = propertyOrMethodName; this.qualifierType = qualifierType; this.qualifierNames = null; IWbemQualifierSetFreeThreaded wbemQualifierSetFreeThreaded = null; int qualifierSet_ = 0; QualifierType qualifierType1 = qualifierType; if (qualifierType1 == QualifierType.ObjectQualifier) { qualifierSet_ = parent.wbemObject.GetQualifierSet_(out wbemQualifierSetFreeThreaded); } else if (qualifierType1 == QualifierType.PropertyQualifier) { qualifierSet_ = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out wbemQualifierSetFreeThreaded); } else if (qualifierType1 == QualifierType.MethodQualifier) { qualifierSet_ = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out wbemQualifierSetFreeThreaded); } else { throw new ManagementException(ManagementStatus.Unexpected, null, null); } if (qualifierSet_ >= 0) { qualifierSet_ = wbemQualifierSetFreeThreaded.GetNames_(0, out this.qualifierNames); if (qualifierSet_ < 0) { if (((long)qualifierSet_ & (long)-4096) != (long)-2147217408) { Marshal.ThrowExceptionForHR(qualifierSet_); } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)qualifierSet_); return; } } return; } else { this.qualifierNames = new string[0]; return; } }
internal QualifierDataEnumerator(ManagementBaseObject parent, string propertyOrMethodName, QualifierType qualifierType) { this.parent = parent; this.propertyOrMethodName = propertyOrMethodName; this.qualifierType = qualifierType; this.qualifierNames = null; IWbemQualifierSetFreeThreaded ppQualSet = null; int errorCode = 0; switch (qualifierType) { case QualifierType.ObjectQualifier: errorCode = parent.wbemObject.GetQualifierSet_(out ppQualSet); break; case QualifierType.PropertyQualifier: errorCode = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out ppQualSet); break; case QualifierType.MethodQualifier: errorCode = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out ppQualSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); } if (errorCode < 0) { this.qualifierNames = new string[0]; } else { errorCode = ppQualSet.GetNames_(0, out this.qualifierNames); if (errorCode < 0) { if ((errorCode & 0xfffff000L) == 0x80041000L) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)errorCode); } else { Marshal.ThrowExceptionForHR(errorCode); } } } }
private void RefreshQualifierInfo() { int qualifierSet_ = -2147217407; this.qualifierSet = null; QualifierType qualifierType = this.qualifierType; if (qualifierType == QualifierType.ObjectQualifier) { qualifierSet_ = this.parent.wbemObject.GetQualifierSet_(out this.qualifierSet); } else if (qualifierType == QualifierType.PropertyQualifier) { qualifierSet_ = this.parent.wbemObject.GetPropertyQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); } else if (qualifierType == QualifierType.MethodQualifier) { qualifierSet_ = this.parent.wbemObject.GetMethodQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); } else { throw new ManagementException(ManagementStatus.Unexpected, null, null); } if (((long)qualifierSet_ & (long)-2147483648) == (long)0) { this.qualifierValue = null; if (this.qualifierSet != null) { qualifierSet_ = this.qualifierSet.Get_(this.qualifierName, 0, ref this.qualifierValue, ref this.qualifierFlavor); } } if (((long)qualifierSet_ & (long)-4096) != (long)-2147217408) { if (((long)qualifierSet_ & (long)-2147483648) != (long)0) { Marshal.ThrowExceptionForHR(qualifierSet_); } return; } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)qualifierSet_); return; } }
public int GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr ptr; if (this.pWbemClassObject == IntPtr.Zero) { throw new ObjectDisposedException(name); } int num = WmiNetUtilsHelper.GetQualifierSet_f(3, this.pWbemClassObject, out ptr); if (num < 0) { ppQualSet = null; } else { ppQualSet = new IWbemQualifierSetFreeThreaded(ptr); } GC.KeepAlive(this); return(num); }
private void RefreshQualifierInfo() { int errorCode = -2147217407; this.qualifierSet = null; switch (this.qualifierType) { case QualifierType.ObjectQualifier: errorCode = this.parent.wbemObject.GetQualifierSet_(out this.qualifierSet); break; case QualifierType.PropertyQualifier: errorCode = this.parent.wbemObject.GetPropertyQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); break; case QualifierType.MethodQualifier: errorCode = this.parent.wbemObject.GetMethodQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); } if ((errorCode & 0x80000000L) == 0L) { this.qualifierValue = null; if (this.qualifierSet != null) { errorCode = this.qualifierSet.Get_(this.qualifierName, 0, ref this.qualifierValue, ref this.qualifierFlavor); } } if ((errorCode & 0xfffff000L) == 0x80041000L) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)errorCode); } else if ((errorCode & 0x80000000L) != 0L) { Marshal.ThrowExceptionForHR(errorCode); } }
private void RefreshQualifierInfo() { int errorCode = -2147217407; this.qualifierSet = null; switch (this.qualifierType) { case QualifierType.ObjectQualifier: errorCode = this.parent.wbemObject.GetQualifierSet_(out this.qualifierSet); break; case QualifierType.PropertyQualifier: errorCode = this.parent.wbemObject.GetPropertyQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); break; case QualifierType.MethodQualifier: errorCode = this.parent.wbemObject.GetMethodQualifierSet_(this.propertyOrMethodName, out this.qualifierSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); } if ((errorCode & 0x80000000L) == 0L) { this.qualifierValue = null; if (this.qualifierSet != null) { errorCode = this.qualifierSet.Get_(this.qualifierName, 0, ref this.qualifierValue, ref this.qualifierFlavor); } } if ((errorCode & 0xfffff000L) == 0x80041000L) { ManagementException.ThrowWithExtendedInfo((ManagementStatus) errorCode); } else if ((errorCode & 0x80000000L) != 0L) { Marshal.ThrowExceptionForHR(errorCode); } }
public int GetPropertyQualifierSet_(string wszProperty, out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr intPtr; if (this.pWbemClassObject != IntPtr.Zero) { int num = WmiNetUtilsHelper.GetPropertyQualifierSet_f(11, this.pWbemClassObject, wszProperty, out intPtr); if (num >= 0) { ppQualSet = new IWbemQualifierSetFreeThreaded(intPtr); } else { ppQualSet = null; } GC.KeepAlive(this); return(num); } else { throw new ObjectDisposedException(IWbemClassObjectFreeThreaded.name); } }
public int GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr intPtr; if (this.pWbemClassObject != IntPtr.Zero) { int getQualifierSetF = WmiNetUtilsHelper.GetQualifierSet_f(3, this.pWbemClassObject, out intPtr); if (getQualifierSetF >= 0) { ppQualSet = new IWbemQualifierSetFreeThreaded(intPtr); } else { ppQualSet = null; } GC.KeepAlive(this); return(getQualifierSetF); } else { throw new ObjectDisposedException(IWbemClassObjectFreeThreaded.name); } }
/// <summary> /// Return the qualifier set associated with its type /// </summary> private IWbemQualifierSetFreeThreaded GetTypeQualifierSet(QualifierType qualifierSetType) { IWbemQualifierSetFreeThreaded qualifierSet = null; int status = (int)ManagementStatus.NoError; switch (qualifierSetType) { case QualifierType.ObjectQualifier: status = parent.wbemObject.GetQualifierSet_(out qualifierSet); break; case QualifierType.PropertyQualifier: status = parent.wbemObject.GetPropertyQualifierSet_(propertyOrMethodName, out qualifierSet); break; case QualifierType.MethodQualifier: status = parent.wbemObject.GetMethodQualifierSet_(propertyOrMethodName, out qualifierSet); break; default: throw new ManagementException(ManagementStatus.Unexpected, null, null); // Is this the best fit error ?? } if (status < 0) { if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else { Marshal.ThrowExceptionForHR(status); } } return(qualifierSet); }
public int GetMethodQualifierSet_(string wszMethod, out IWbemQualifierSetFreeThreaded ppQualSet) { if(pWbemClassObject == IntPtr.Zero) throw new ObjectDisposedException(name); IntPtr pQualSet; int hResult = WmiNetUtilsHelper.GetMethodQualifierSet_f(25, pWbemClassObject, wszMethod, out pQualSet); if(hResult < 0) ppQualSet = null; else ppQualSet = new IWbemQualifierSetFreeThreaded(pQualSet); GC.KeepAlive ( this ) ; return hResult; }
public int GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr ptr; if (this.pWbemClassObject == IntPtr.Zero) { throw new ObjectDisposedException(name); } int num = WmiNetUtilsHelper.GetQualifierSet_f(3, this.pWbemClassObject, out ptr); if (num < 0) { ppQualSet = null; } else { ppQualSet = new IWbemQualifierSetFreeThreaded(ptr); } GC.KeepAlive(this); return num; }
public int GetQualifierSet_(out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr intPtr; if (this.pWbemClassObject != IntPtr.Zero) { int getQualifierSetF = WmiNetUtilsHelper.GetQualifierSet_f(3, this.pWbemClassObject, out intPtr); if (getQualifierSetF >= 0) { ppQualSet = new IWbemQualifierSetFreeThreaded(intPtr); } else { ppQualSet = null; } GC.KeepAlive(this); return getQualifierSetF; } else { throw new ObjectDisposedException(IWbemClassObjectFreeThreaded.name); } }
public int GetPropertyQualifierSet_(string wszProperty, out IWbemQualifierSetFreeThreaded ppQualSet) { IntPtr intPtr; if (this.pWbemClassObject != IntPtr.Zero) { int num = WmiNetUtilsHelper.GetPropertyQualifierSet_f(11, this.pWbemClassObject, wszProperty, out intPtr); if (num >= 0) { ppQualSet = new IWbemQualifierSetFreeThreaded(intPtr); } else { ppQualSet = null; } GC.KeepAlive(this); return num; } else { throw new ObjectDisposedException(IWbemClassObjectFreeThreaded.name); } }