summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs')
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
index fe8b1b5896..a83c4fad9e 100644
--- a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
+++ b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
@@ -36,30 +36,30 @@ namespace System.Globalization
try
{
- using (RegistryKey key = Registry.LocalMachine.OpenSubKey(c_japaneseErasHive, writable: false))
+ // Need to access registry
+ RegistryKey key = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE).OpenSubKey(c_japaneseErasHive, false);
+
+ // Abort if we didn't find anything
+ if (key == null) return null;
+
+ // Look up the values in our reg key
+ String[] valueNames = key.GetValueNames();
+ if (valueNames != null && valueNames.Length > 0)
{
- // Abort if we didn't find anything
- if (key == null) return null;
+ registryEraRanges = new EraInfo[valueNames.Length];
- // Look up the values in our reg key
- String[] valueNames = key.GetValueNames();
- if (valueNames != null && valueNames.Length > 0)
+ // Loop through the registry and read in all the values
+ for (int i = 0; i < valueNames.Length; i++)
{
- registryEraRanges = new EraInfo[valueNames.Length];
-
- // Loop through the registry and read in all the values
- for (int i = 0; i < valueNames.Length; i++)
- {
- // See if the era is a valid date
- EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
+ // See if the era is a valid date
+ EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
- // continue if not valid
- if (era == null) continue;
+ // continue if not valid
+ if (era == null) continue;
- // Remember we found one.
- registryEraRanges[iFoundEras] = era;
- iFoundEras++;
- }
+ // Remember we found one.
+ registryEraRanges[iFoundEras] = era;
+ iFoundEras++;
}
}
}