diff options
Diffstat (limited to 'toolsrc/src/vcpkg-test/util.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg-test/util.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/toolsrc/src/vcpkg-test/util.cpp b/toolsrc/src/vcpkg-test/util.cpp index d754baec1..c615f6bb2 100644 --- a/toolsrc/src/vcpkg-test/util.cpp +++ b/toolsrc/src/vcpkg-test/util.cpp @@ -114,21 +114,21 @@ namespace vcpkg::Test #elif !defined(_WIN32) // FILESYSTEM_SYMLINK == FILESYSTEM_SYMLINK_STD return AllowSymlinks::Yes; #else - HKEY key; - bool allow_symlinks = true; - - const auto status = RegOpenKeyExW( - HKEY_LOCAL_MACHINE, LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)", 0, 0, &key); - - if (status == ERROR_FILE_NOT_FOUND) - { - allow_symlinks = false; + constexpr static const wchar_t regkey[] = + LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock)"; + constexpr static const wchar_t regkey_member[] = LR"(AllowDevelopmentWithoutDevLicense)"; + + DWORD data; + DWORD dataSize = sizeof(data); + const auto status = RegGetValueW( + HKEY_LOCAL_MACHINE, regkey, regkey_member, RRF_RT_DWORD, nullptr, &data, &dataSize); + + if (status == ERROR_SUCCESS && data == 1) { + return AllowSymlinks::Yes; + } else { std::clog << "Symlinks are not allowed on this system\n"; + return AllowSymlinks::No; } - - if (status == ERROR_SUCCESS) RegCloseKey(key); - - return allow_symlinks ? AllowSymlinks::Yes : AllowSymlinks::No; #endif } const static AllowSymlinks CAN_CREATE_SYMLINKS = internal_can_create_symlinks(); |
