Skip to content

Commit 2263e5a

Browse files
committed
use HKLM for HKCR when getting user key value name
1 parent 5ca4e75 commit 2263e5a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

FlashpointSecurePlayer/RegistryStates.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,15 @@ private string GetUserKeyValueName(string keyValueName, string activeCurrentUser
110110
keyValueName = AddTrailingSlash(keyValueName);
111111

112112
const string HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT\\";
113-
const string HKEY_CURRENT_USER_SOFTWARE_CLASSES = "HKEY_CURRENT_USER\\SOFTWARE\\CLASSES\\";
113+
const string HKEY_LOCAL_MACHINE_SOFTWARE_CLASSES = "HKEY_LOCAL_MACHINE\\SOFTWARE\\CLASSES\\";
114114

115-
// make this explicitly the current user
115+
// make this explicitly the machine
116+
// need this so reverting works across users on the same machine
117+
// we use HKEY_LOCAL_MACHINE not HKEY_CURRENT_USER because
118+
// current user settings may be ignored as admin
119+
// (but this might get changed again down below if not admin)
116120
if (keyValueName.StartsWith(HKEY_CLASSES_ROOT, StringComparison.OrdinalIgnoreCase)) {
117-
keyValueName = HKEY_CURRENT_USER_SOFTWARE_CLASSES + keyValueName.Substring(HKEY_CLASSES_ROOT.Length);
121+
keyValueName = HKEY_LOCAL_MACHINE_SOFTWARE_CLASSES + keyValueName.Substring(HKEY_CLASSES_ROOT.Length);
118122
}
119123

120124
const string HKEY_CURRENT_USER = "HKEY_CURRENT_USER\\";

0 commit comments

Comments
 (0)