Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetValueNames()

string[] Internal.Win32.RegistryKey.GetValueNames ( )
inline

Definition at line 94 of file RegistryKey.cs.

95 {
97 char[] array = ArrayPool<char>.Shared.Rent(100);
98 try
99 {
100 int lpcbValueName = array.Length;
101 int num;
102 while ((num = Interop.Advapi32.RegEnumValue(_hkey, list.Count, array, ref lpcbValueName, IntPtr.Zero, null, null, null)) != 259)
103 {
104 switch (num)
105 {
106 case 0:
107 list.Add(new string(array, 0, lpcbValueName));
108 break;
109 case 234:
110 {
111 char[] array2 = array;
112 int num2 = array2.Length;
113 array = null;
114 ArrayPool<char>.Shared.Return(array2);
115 array = ArrayPool<char>.Shared.Rent(checked(num2 * 2));
116 break;
117 }
118 default:
119 Win32Error(num, null);
120 break;
121 }
122 lpcbValueName = array.Length;
123 }
124 }
125 finally
126 {
127 if (array != null)
128 {
129 ArrayPool<char>.Shared.Return(array);
130 }
131 }
132 return list.ToArray();
133 }
readonly SafeRegistryHandle _hkey
static void Win32Error(int errorCode, string str)
static int RegEnumValue(SafeRegistryHandle hKey, int dwIndex, char[] lpValueName, ref int lpcbValueName, IntPtr lpReserved_MustBeZero, int[] lpType, byte[] lpData, int[] lpcbData)
void Add(TKey key, TValue value)
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Internal.Win32.RegistryKey._hkey, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.array, System.list, Interop.Advapi32.RegEnumValue(), Internal.Win32.RegistryKey.Win32Error(), and System.IntPtr.Zero.

Referenced by System.Environment.GetEnvironmentVariablesFromRegistry().