public StringCollection GetSubKeyNames() { int ret = 0; int index = 0; StringCollection keyNames = new StringCollection(); do { int lengthInChars = 0; ret = SafeNativeMethods.RegEnumKey(this, index, null, ref lengthInChars); if (ret == SafeNativeMethods.ERROR_MORE_DATA) { StringBuilder keyName = new StringBuilder(lengthInChars + 1); ret = SafeNativeMethods.RegEnumKey(this, index, keyName, ref lengthInChars); if (ret == SafeNativeMethods.ERROR_SUCCESS) { keyNames.Add(keyName.ToString()); } } index++; }while (ret == SafeNativeMethods.ERROR_SUCCESS); return(keyNames); }
public StringCollection GetSubKeyNames() { int num = 0; int index = 0; StringCollection strings = new StringCollection(); do { int len = 0; num = SafeNativeMethods.RegEnumKey(this, index, null, ref len); if (num == 0xea) { StringBuilder lpName = new StringBuilder(len + 1); num = SafeNativeMethods.RegEnumKey(this, index, lpName, ref len); if (num == 0) { strings.Add(lpName.ToString()); } } index++; }while (num == 0); return(strings); }