diff --git a/CHANGELOG.md b/CHANGELOG.md index f179b91ef..2a748bae9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ BUG FIXES: - core: fix crash when using invalid box checksum type [GH-6327] - core: don't check for metadata if the download URL is not HTTP [GH-6540] - core: don't make custom dotfile path if there is no Vagrantfile [GH-6542] + - core: more robust check for admin privs on Windows [GH-5616] - commands/rdp: prefer `xfreerdp` if it is available on Linux [GH-6475] - commands/up: the `--provision-with` flag works with provisioner names [GH-5981] - communicator/ssh: fix potential crash case with PTY [GH-6225] diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 706445c3b..85bca065c 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -45,10 +45,13 @@ module Vagrant # detect-if-running-with-administrator-privileges-under-windows-xp begin Win32::Registry::HKEY_USERS.open("S-1-5-19") {} - return true rescue Win32::Registry::Error return false end + + # If we made it this far then we try a fallback approach + # since the above doesn't seem to be bullet proof. See GH-5616 + (`reg query HKU\\S-1-5-19 2>&1` =~ /ERROR/).nil? end # This takes any path and converts it from a Windows path to a