VirtualBox

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


Ignore:
Timestamp:
Oct 16, 2009 10:24:40 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53593
Message:

VBoxClient/VBoxTray/VBgl: More bits for host version checking.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk

    r23452 r23835  
    8686        VBoxGuestR3LibDaemonize.cpp \
    8787        VBoxGuestR3LibGR.cpp \
    88         $(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestR3LibGuestProp.cpp,) \
     88        $(if $(VBOX_WITH_GUEST_PROPS), \
     89                VBoxGuestR3LibGuestProp.cpp \
     90                VBoxGuestR3LibHostVersion.cpp,) \
    8991        VBoxGuestR3LibMouse.cpp \
    9092        VBoxGuestR3LibMisc.cpp \
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp

    r21978 r23835  
    2626#include <iprt/mem.h>
    2727#include <VBox/log.h>
     28#ifdef RT_OS_WINDOWS
     29 #define WIN32_LEAN_AND_MEAN
     30 #include <windows.h>
     31#endif
    2832
    2933#include "VBGLR3Internal.h"
     
    194198}
    195199
     200
     201/** @todo Docs */
     202VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev)
     203{
     204    int rc;
     205#ifdef RT_OS_WINDOWS
     206    HKEY hKey;
     207
     208        /* Check the new path first. */
     209    rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     210#ifdef RT_ARCH_AMD64
     211    if (rc != ERROR_SUCCESS)
     212    {
     213        /* Check Wow6432Node (for new entries). */
     214        rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     215    }
     216#endif
     217
     218    /* Still no luck? Then try the old xVM paths ... */
     219    if (RT_FAILURE(rc))
     220    {
     221        rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     222#ifdef RT_ARCH_AMD64
     223        if (rc != ERROR_SUCCESS)
     224        {
     225            /* Check Wow6432Node (for new entries). */
     226            rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     227        }
     228#endif
     229    }
     230
     231    /* Did we get something worth looking at? */
     232    if (RT_SUCCESS(rc))
     233    {
     234        /* Version. */
     235        dwSize = 32;
     236        pszVer = (char*)RTMemAlloc(dwSize);
     237        rc = RegQueryValueEx(hKey, "Version", NULL, &dwType, (BYTE*)(LPCTSTR)*ppszVer, &dwSize);
     238        /* Revision. */
     239        if (ppszRev)
     240        {
     241                        dwSize = 32;
     242                        ppszRev = (char*)RTMemAlloc(dwSize);
     243                        rc = RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)*ppszRev, &dwSize);
     244                }
     245    }
     246
     247    if (NULL != hKey)
     248        RegCloseKey(hKey);
     249#else
     250#endif /* RT_OS_WINDOWS */
     251    return rc;
     252}
Note: See TracChangeset for help on using the changeset viewer.

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