core: more robust WIndows admin check [GH-5616]

This commit is contained in:
Mitchell Hashimoto 2015-11-18 20:26:54 -08:00
parent 9e8b19b2b3
commit 2ffbe4e6e1
2 changed files with 5 additions and 1 deletions

View File

@ -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]

View File

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