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) { // 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()); } }