VirtualBox

Changeset 23837 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Oct 16, 2009 10:54:47 PM (15 years ago)
Author:
vboxsync
Message:

VBoxClient/VBoxTray/VBgl: More Windows bits.

Location:
trunk/src/VBox/Additions/common/VBoxGuestLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibHostVersion.cpp

    r23835 r23837  
    198198
    199199        if (lRet != ERROR_SUCCESS)
    200                 rc = RTErrConvertFromWin32(lRet);
     200            rc = RTErrConvertFromWin32(lRet);
    201201#else
    202202#endif
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp

    r23836 r23837  
    200200#ifdef RT_OS_WINDOWS
    201201    HKEY hKey;
     202    LONG r;
    202203
    203204        /* Check the new path first. */
    204     rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     205    r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    205206#ifdef RT_ARCH_AMD64
    206     if (rc != ERROR_SUCCESS)
     207    if (r != ERROR_SUCCESS)
    207208    {
    208209        /* Check Wow6432Node (for new entries). */
    209         rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     210        r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    210211    }
    211212#endif
    212213
    213214    /* Still no luck? Then try the old xVM paths ... */
    214     if (RT_FAILURE(rc))
    215     {
    216         rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     215    if (FAILED(r))
     216    {
     217        r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    217218#ifdef RT_ARCH_AMD64
    218         if (rc != ERROR_SUCCESS)
     219        if (r != ERROR_SUCCESS)
    219220        {
    220221            /* Check Wow6432Node (for new entries). */
    221             rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     222            r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
    222223        }
    223224#endif
     
    225226
    226227    /* Did we get something worth looking at? */
    227     if (RT_SUCCESS(rc))
     228    if (SUCCEEDED(r))
    228229    {
    229230        /* Version. */
    230231        DWORD dwType;
    231232        DWORD dwSize = 32;
    232         ppszVer = (char*)RTMemAlloc(dwSize);
    233         rc = RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)*ppszVer, &dwSize);
     233        char *pszVer = (char*)RTMemAlloc(dwSize);
     234        if (pszVer)
     235        {
     236                        if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)pszVer, &dwSize))
     237                                ppszVer = pszVer;
     238                }
    234239        /* Revision. */
    235240        if (ppszRev)
    236241        {
    237242                        dwSize = 32;
    238                         ppszRev = (char*)RTMemAlloc(dwSize);
    239                         rc = RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)*ppszRev, &dwSize);
     243                        char pszRev = (char*)RTMemAlloc(dwSize);
     244                        if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize))
     245                                ppszRev = pszRev;
    240246                }
    241247    }
     248        rc = RTErrConvertFromWin32(r);
    242249
    243250    if (NULL != hKey)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette