Skip to content
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

Merged
merged 1 commit into from Dec 5, 2017

Conversation

selvanair
Copy link
Collaborator

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

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)
Copy link
Member

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?

Copy link
Collaborator Author

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...

Copy link
Member

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.

@selvanair
Copy link
Collaborator Author

@chipitsine : Thanks for the approval.

Copy link
Member

@mattock mattock left a 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.

@selvanair selvanair merged commit cf2d1a8 into OpenVPN:master Dec 5, 2017
@selvanair selvanair deleted the registry-optional branch December 6, 2017 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants