-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
#379 expose 'samDesired' param to all methods #1001
Conversation
update fork
Update fork
…ional samDesired flags.
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.
In general the idea looks sound - I left one comment inline about the implementation.
The unittests for the extended rights require administrator rights - can you explain why that is and maybe circumvent it?
And please add an entry to the enhancements section in CHANGES.md for the next release. Refer to the existing entries for the desired structure.
@@ -593,9 +609,28 @@ public static boolean registryKeyExists(HKEY root, String key) { | |||
* @return True if the value exists. | |||
*/ | |||
public static boolean registryValueExists(HKEY root, String key, | |||
String value) { | |||
String value) { | |||
return registryValueExists(root, key, value, WinNT.REG_NONE); |
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.
Please don't use WinNT.REG_NONE
for this use-case. WinNT.REG_NONE
is a type, not an access level. There is no "NONE" access level for the registry. I would just use 0 here. I would not invent a constant.
I've switched out the bad WinNT.REG_NONEs with 0 as requested. The tests require admin rights because they're accessing HKLM. HKCU\Software isn't redirected as mentioned originally but HKCU\Software\Classes\CLSID is so I can use that instead. I've demonstrated the change in the testRegistryCreateDeleteKeySamExtra test in the latest commit. If you find that preferable, I can modify the others to match. |
Thank you for the change - I think using the The unittest |
In unit test |
Thank you - with the change the unittests run cleanly and also the appveyor build is happy. |
Exposes samDesired as discussed in the issue. Includes tests which use HKEY_LOCAL_MACHINE instead of HKEY_CURRENT_USER. This is because HKEY_LOCAL_MACHINE is redirected whereas HKEY_CURRENT_USER is shared. https://docs.microsoft.com/en-us/windows/desktop/winprog64/shared-registry-keys#redirected-shared-and-reflected-keys-under-wow64 Using HKEY_LOCAL_MACHINE allows for tests which ensure that the extra samDesired flags are applied by performing operations on the same registry keys across the 32 and 64 bit registry without conflict. Tests will only run on 64bit windows since WOW64 would be ignored on 32bit and break the tests.