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
Add a default for openvpnpath #197
Conversation
Allow the GUI to run without any registry keys present: the location of openvpn installation defaults to C:\Program Files\OpenVPN if not found in registry. Useful for testing builds or to display --help etc. See also: PR OpenVPN#147 Signed-off-by: Selva Nair <selva.nair@gmail.com>
ShowLocalizedMsg(IDS_ERR_READING_REGISTRY); | ||
RegCloseKey(regkey); | ||
return(false); | ||
if (regkey) |
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.
Just verifying the logic here: how do we get inside this "if" block? The conditions of the parent "if" block (line 99) seem contradictory to this one and nothing is explictly setting a value for "regkey". Am I missing something?
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.
@mattock: The block is entered under two conditions: either (i) regkey is NULL or (ii) GetRegistryValue() failed. (i) happens if the key is not present (ii) if its default value is not set. In case (ii) we show the error, in case (i) we have already shown an error saying key not found...
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.
Ah yes, I see it now. The "regkey" parameter can indeed be defined at this point if GetRegistryValue failed on line 99. I guess I did not realize that "||" was actually a logical OR. Sorry about the noise.
@chipitsine : Thanks for the approval. |
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.
Looks good as far as I can see.
Allow the GUI to run without any registry keys present:
the location of openvpn installation defaults to
C:\Program Files\OpenVPN if not found in registry.
Useful for testing builds or to display --help etc.
See also: PR #147
Signed-off-by: Selva Nair selva.nair@gmail.com