private void ClearKeys(bool setAsSingleton) { int errorCode = 0; try { if (this.wmiPath != null) { IWbemPathKeyList pOut = null; errorCode = this.wmiPath.GetKeyList_(out pOut); if (pOut != null) { errorCode = pOut.RemoveAllKeys_(0); if ((errorCode & 0x80000000L) == 0L) { sbyte bSet = setAsSingleton ? ((sbyte)(-1)) : ((sbyte)0); errorCode = pOut.MakeSingleton_(bSet); this.FireIdentifierChanged(); } } } } catch (COMException exception) { ManagementException.ThrowWithExtendedInfo(exception); } if ((errorCode & 0xfffff000L) == 0x80041000L) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)errorCode); } else if ((errorCode & 0x80000000L) != 0L) { Marshal.ThrowExceptionForHR(errorCode); } }
internal void ClearKeys(bool setAsSingleton) { int status = (int)ManagementStatus.NoError; try { if (null != wmiPath) { IWbemPathKeyList keyList = null; status = wmiPath.GetKeyList_(out keyList); if (null != keyList) { status = keyList.RemoveAllKeys_(0); if ((status & 0x80000000) == 0) { sbyte bSingleton = (setAsSingleton) ? (sbyte)(-1) : (sbyte)0; status = keyList.MakeSingleton_(bSingleton); FireIdentifierChanged(); // BUGBUG : RemoveAllKeys success? } } } } catch (Exception e) { ManagementException.ThrowWithExtendedInfo(e); } if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else if ((status & 0x80000000) != 0) { Marshal.ThrowExceptionForHR(status); } }
private void ClearKeys(bool setAsSingleton) { sbyte num; int keyList_ = 0; try { if (this.wmiPath != null) { IWbemPathKeyList wbemPathKeyList = null; keyList_ = this.wmiPath.GetKeyList_(out wbemPathKeyList); if (wbemPathKeyList != null) { keyList_ = wbemPathKeyList.RemoveAllKeys_(0); if (((long)keyList_ & (long)-2147483648) == (long)0) { if (setAsSingleton) { num = -1; } else { num = 0; } sbyte num1 = num; keyList_ = wbemPathKeyList.MakeSingleton_(num1); this.FireIdentifierChanged(); } } } } catch (COMException cOMException1) { COMException cOMException = cOMException1; ManagementException.ThrowWithExtendedInfo(cOMException); } if (((long)keyList_ & (long)-4096) != (long)-2147217408) { if (((long)keyList_ & (long)-2147483648) != (long)0) { Marshal.ThrowExceptionForHR(keyList_); } return; } else { ManagementException.ThrowWithExtendedInfo((ManagementStatus)keyList_); return; } }
private void ClearKeys(bool setAsSingleton) { // Test/utilize isWbemPathShared *only* on public + internal members! int status = (int)ManagementStatus.NoError; try { if (null != wmiPath) { IWbemPathKeyList keyList = null; status = wmiPath.GetKeyList_(out keyList); if (null != keyList) { status = keyList.RemoveAllKeys_(0); if ((status & 0x80000000) == 0) { sbyte bSingleton = (setAsSingleton) ? (sbyte)(-1) : (sbyte)0; status = keyList.MakeSingleton_(bSingleton); FireIdentifierChanged(); } } } } catch (COMException e) { ManagementException.ThrowWithExtendedInfo(e); } if ((status & 0xfffff000) == 0x80041000) { ManagementException.ThrowWithExtendedInfo((ManagementStatus)status); } else if ((status & 0x80000000) != 0) { Marshal.ThrowExceptionForHR(status, WmiNetUtilsHelper.GetErrorInfo_f()); } }