Skip to content

Commit c47a499

Browse files
committed
make WOW64KeyList read only member
1 parent 581ba7e commit c47a499

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

FlashpointSecurePlayer/EnvironmentVariables.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace FlashpointSecurePlayer {
1818
public class EnvironmentVariables : Modifications {
1919
private const string __COMPAT_LAYER = nameof(__COMPAT_LAYER);
2020

21-
private IList<string> UnmodifiableComparableNames { get; } = new List<string> { FP_STARTUP_PATH, FP_HTDOCS_FILE }.AsReadOnly();
21+
private IReadOnlyList<string> UnmodifiableComparableNames { get; } = new List<string> { FP_STARTUP_PATH, FP_HTDOCS_FILE }.AsReadOnly();
2222

2323
public EnvironmentVariables(EventHandler importStart, EventHandler importStop) : base(importStart, importStop) { }
2424

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
34
using System.ComponentModel;
45
using System.Configuration;
56
using System.Diagnostics;
@@ -72,26 +73,41 @@ public enum TYPE {
7273
// (but that's already handled, so it doesn't matter)
7374

7475
// note the trailing slashes on keys to make lookups easier
75-
private Dictionary<string, List<string>> WOW64KeyList = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase) {
76-
{"HKEY_LOCAL_MACHINE\\SOFTWARE\\", null},
77-
{"HKEY_LOCAL_MACHINE\\SOFTWARE\\CLASSES\\", new List<string>() {
78-
"APPID",
79-
"CLSID",
80-
"DIRECTSHOW",
81-
"INTERFACE",
82-
"MEDIA TYPE",
83-
"MEDIAFOUNDATION",
84-
"PROTOCOLS",
85-
"TYPELIB"
86-
}},
87-
{"HKEY_CURRENT_USER\\SOFTWARE\\CLASSES\\", new List<string>() {
88-
"CLSID",
89-
"DIRECTSHOW",
90-
"INTERFACE",
91-
"MEDIA TYPE",
92-
"MEDIAFOUNDATION"
93-
}}
94-
};
76+
private ReadOnlyDictionary<string, IReadOnlyList<string>> WOW64KeyList { get; } = new ReadOnlyDictionary<string, IReadOnlyList<string>>(
77+
new Dictionary<string, IReadOnlyList<string>>(StringComparer.OrdinalIgnoreCase) {
78+
{
79+
"HKEY_LOCAL_MACHINE\\SOFTWARE\\",
80+
null
81+
},
82+
83+
{
84+
"HKEY_LOCAL_MACHINE\\SOFTWARE\\CLASSES\\",
85+
86+
new List<string>() {
87+
"APPID",
88+
"CLSID",
89+
"DIRECTSHOW",
90+
"INTERFACE",
91+
"MEDIA TYPE",
92+
"MEDIAFOUNDATION",
93+
"PROTOCOLS",
94+
"TYPELIB"
95+
}.AsReadOnly()
96+
},
97+
98+
{
99+
"HKEY_CURRENT_USER\\SOFTWARE\\CLASSES\\",
100+
101+
new List<string>() {
102+
"CLSID",
103+
"DIRECTSHOW",
104+
"INTERFACE",
105+
"MEDIA TYPE",
106+
"MEDIAFOUNDATION"
107+
}.AsReadOnly()
108+
}
109+
}
110+
);
95111

96112
public RegistryStates(EventHandler importStart, EventHandler importStop) : base(importStart, importStop) { }
97113

@@ -512,7 +528,7 @@ private string GetRedirectedKeyValueName(string keyValueName, BINARY_TYPE binary
512528
&& wow64NodeSubkeys.Length > 0) {
513529
redirected = false;
514530

515-
if (WOW64KeyList.TryGetValue(redirectedKeyValueName.ToString(), out List<string> wow64SubkeyList)) {
531+
if (WOW64KeyList.TryGetValue(redirectedKeyValueName.ToString(), out IReadOnlyList<string> wow64SubkeyList)) {
516532
// if there's no subkey list or we are at the end
517533
if (wow64SubkeyList == null || wow64Node) {
518534
redirected = true;

0 commit comments

Comments
 (0)