Skip to content

Commit 84e17cf

Browse files
committed
handle WOW64 nodes at end of key names
1 parent d8b3e36 commit 84e17cf

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ private string GetUserKeyValueName(string keyValueName, string activeCurrentUser
109109

110110
keyValueName = AddTrailingSlash(keyValueName);
111111

112+
const string HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT\\";
113+
const string HKEY_CURRENT_USER_SOFTWARE_CLASSES = "HKEY_CURRENT_USER\\SOFTWARE\\CLASSES\\";
114+
115+
// make this explicitly the current user
116+
if (keyValueName.StartsWith(HKEY_CLASSES_ROOT, StringComparison.OrdinalIgnoreCase)) {
117+
keyValueName = HKEY_CURRENT_USER_SOFTWARE_CLASSES + keyValueName.Substring(HKEY_CLASSES_ROOT.Length);
118+
}
119+
112120
const string HKEY_CURRENT_USER = "HKEY_CURRENT_USER\\";
113121
const string HKEY_LOCAL_MACHINE = "HKEY_LOCAL_MACHINE\\";
114122

@@ -459,15 +467,15 @@ private string GetRedirectedKeyValueName(string keyValueName, BINARY_TYPE binary
459467
redirected = false;
460468

461469
if (WOW64KeyList.TryGetValue(redirectedKeyValueName.ToString().ToUpperInvariant(), out List<string> wow64SubkeyList)) {
462-
if (wow64SubkeyList == null) {
470+
// if there's no subkey list or we are at the end
471+
if (wow64SubkeyList == null || wow64Node) {
463472
redirected = true;
464473
} else {
465-
if (!wow64Node) {
466-
for (int j = 0; j < wow64SubkeyList.Count; j++) {
467-
if (subkey.Equals(wow64SubkeyList[j], StringComparison.OrdinalIgnoreCase)) {
468-
redirected = true;
469-
break;
470-
}
474+
// must equal a subkey from the list
475+
for (int j = 0; j < wow64SubkeyList.Count; j++) {
476+
if (subkey.Equals(wow64SubkeyList[j], StringComparison.OrdinalIgnoreCase)) {
477+
redirected = true;
478+
break;
471479
}
472480
}
473481
}

0 commit comments

Comments
 (0)