-
Notifications
You must be signed in to change notification settings - Fork 162
fix(registry): prioritize HKEY_CURRENT_USER over HKEY_LOCAL_MACHINE #1844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ | |||||
|
|
||||||
| #include <string> | ||||||
|
|
||||||
| #define WIN32_LEAN_AND_MEAN | ||||||
|
Check warning on line 25 in Core/Libraries/Source/WWVegas/WWDownload/registry.cpp
|
||||||
| #include <windows.h> | ||||||
|
|
||||||
| #include "Registry.h" | ||||||
|
|
@@ -120,12 +120,12 @@ | |||||
| #endif | ||||||
|
|
||||||
| fullPath.append(path); | ||||||
| if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val)) | ||||||
| if (getStringFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val)) | ||||||
| { | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val); | ||||||
| return getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val); | ||||||
| } | ||||||
|
|
||||||
| bool GetUnsignedIntFromRegistry(std::string path, std::string key, unsigned int& val) | ||||||
|
|
@@ -137,12 +137,12 @@ | |||||
| #endif | ||||||
|
|
||||||
| fullPath.append(path); | ||||||
| if (getUnsignedIntFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val)) | ||||||
| if (getUnsignedIntFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val)) | ||||||
| { | ||||||
| return true; | ||||||
| } | ||||||
|
|
||||||
| return getUnsignedIntFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val); | ||||||
| return getUnsignedIntFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val); | ||||||
| } | ||||||
|
|
||||||
| bool SetStringInRegistry( std::string path, std::string key, std::string val) | ||||||
|
|
@@ -154,10 +154,11 @@ | |||||
| #endif | ||||||
| fullPath.append(path); | ||||||
|
|
||||||
| if (setStringInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val)) | ||||||
| // TheSuperHackers @fix bobtista 12/02/2026 Prefer HKCU for writes to match read priority | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: Core/Libraries/Source/WWVegas/WWDownload/registry.cpp
Line: 157:157
Comment:
Wrap `@fix` in backticks to prevent platform mention interpretation.
```suggestion
// TheSuperHackers `@fix` bobtista 12/02/2026 Prefer HKCU for writes to match read priority
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| if (setStringInRegistry( HKEY_CURRENT_USER, fullPath, key, val)) | ||||||
| return true; | ||||||
|
|
||||||
| return setStringInRegistry( HKEY_CURRENT_USER, fullPath, key, val ); | ||||||
| return setStringInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val ); | ||||||
| } | ||||||
|
|
||||||
| bool SetUnsignedIntInRegistry( std::string path, std::string key, unsigned int val) | ||||||
|
|
@@ -169,9 +170,10 @@ | |||||
| #endif | ||||||
| fullPath.append(path); | ||||||
|
|
||||||
| if (setUnsignedIntInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val)) | ||||||
| // TheSuperHackers @fix bobtista 12/02/2026 Prefer HKCU for writes to match read priority | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: Core/Libraries/Source/WWVegas/WWDownload/registry.cpp
Line: 173:173
Comment:
Wrap `@fix` in backticks to prevent platform mention interpretation.
```suggestion
// TheSuperHackers `@fix` bobtista 12/02/2026 Prefer HKCU for writes to match read priority
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| if (setUnsignedIntInRegistry( HKEY_CURRENT_USER, fullPath, key, val)) | ||||||
| return true; | ||||||
|
|
||||||
| return setUnsignedIntInRegistry( HKEY_CURRENT_USER, fullPath, key, val ); | ||||||
| return setUnsignedIntInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val ); | ||||||
| } | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not mistaken this will be wrong when HKEY_CURRENT_USER var is set to something and game is run with Admin privileges and writing to HKEY_LOCAL_MACHINE. Then it will not update HKEY_CURRENT_USER and its value never changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the write functions (SetStringInRegistry, SetUnsignedIntInRegistry) were still preferring HKLM, so running as admin would write to HKLM while reads would return the stale HKCU value. Fixed by flipping the write priority to also prefer HKCU, matching the read side. So now both SetStringInRegistry and SetUnsignedIntInRegistry to try HKCU first