Changeset 1135 in vbox
- Timestamp:
- Mar 1, 2007 4:53:51 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r815 r1135 640 640 #ifdef __WIN__ 641 641 642 /** 643 * Returns TRUE if the Windows version is 6.0 or greater (i.e. it's Vista and 644 * later OSes) and it has the UAC (User Account Control) feature enabled. 645 */ 646 static BOOL IsUACEnabled() 647 { 648 LONG rc = 0; 649 650 OSVERSIONINFOEX info; 651 ZeroMemory (&info, sizeof (OSVERSIONINFOEX)); 652 info.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX); 653 rc = GetVersionEx ((OSVERSIONINFO *) &info); 654 AssertReturn (rc != 0, FALSE); 655 656 LogFlowFunc (("dwMajorVersion=%d, dwMinorVersion=%d\n", 657 info.dwMajorVersion, info.dwMinorVersion)); 658 659 /* we are interested only in Vista (and newer versions...). In all 660 * earlier versions UAC is not present. */ 661 if (info.dwMajorVersion < 6) 662 return FALSE; 663 664 /* the default EnableLUA value is 1 (Enabled) */ 665 DWORD dwEnableLUA = 1; 666 667 HKEY hKey; 668 rc = RegOpenKeyExA (HKEY_LOCAL_MACHINE, 669 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 670 0, KEY_QUERY_VALUE, &hKey); 671 672 Assert (rc == ERROR_SUCCESS || rc == ERROR_PATH_NOT_FOUND); 673 if (rc == ERROR_SUCCESS) 674 { 675 676 DWORD cbEnableLUA = sizeof (dwEnableLUA); 677 rc = RegQueryValueExA (hKey, "EnableLUA", NULL, NULL, 678 (LPBYTE) dwEnableLUA, &cbEnableLUA); 679 680 RegCloseKey (hKey); 681 682 Assert (rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND); 683 } 684 685 LogFlowFunc (("rc=%d, dwEnableLUA=%d\n", rc, dwEnableLUA)); 686 687 return dwEnableLUA == 1; 688 } 689 642 690 struct NetworkInterfaceHelperClientData 643 691 { … … 702 750 703 751 rc = mParent->startSVCHelperClient ( 704 true/* aPrivileged */,752 IsUACEnabled() == TRUE /* aPrivileged */, 705 753 networkInterfaceHelperClient, 706 754 static_cast <void *> (d.get()), … … 764 812 765 813 rc = mParent->startSVCHelperClient ( 766 true/* aPrivileged */,814 IsUACEnabled() == TRUE /* aPrivileged */, 767 815 networkInterfaceHelperClient, 768 816 static_cast <void *> (d.get()),
Note:
See TracChangeset
for help on using the changeset viewer.