VirtualBox

Changeset 23856 in vbox


Ignore:
Timestamp:
Oct 19, 2009 11:57:22 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53624
Message:

VbglR3: Added host version checking routines.

Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestLib.h

    r23845 r23856  
    404404VBGLR3DECL(int)     VbglR3SetGuestCaps(uint32_t fOr, uint32_t fNot);
    405405VBGLR3DECL(int)     VbglR3WaitEvent(uint32_t fMask, uint32_t cMillies, uint32_t *pfEvents);
     406VBGLR3DECL(int)     VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev);
    406407/** @} */
    407408
     
    471472VBGLR3DECL(int)     VbglR3GuestPropWait(uint32_t u32ClientId, const char *pszPatterns, void *pvBuf, uint32_t cbBuf, uint64_t u64Timestamp, uint32_t cMillies, char ** ppszName, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);
    472473/** @}  */
     474
     475/** @name Host version handling
     476 * @{ */
     477VBGLR3DECL(int)     VbglR3HostVersionCompare(const char *pszVer1, const char *pszVer2);
     478VBGLR3DECL(bool)    VbglR3HostVersionCheckForUpdate(char **ppszHostVersion, char **ppszGuestVersion);
     479VBGLR3DECL(int)     VbglR3HostVersionStore(const char* pszVer);
     480/** @}  */
    473481# endif /* VBOX_WITH_GUEST_PROPS defined */
    474482
  • trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk

    r23845 r23856  
    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 \
     
    9698        VBoxGuestR3Lib.cpp \
    9799        VBoxGuestR3LibGR.cpp \
    98         $(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestR3LibGuestProp.cpp,) \
     100        $(if $(VBOX_WITH_GUEST_PROPS), \
     101                VBoxGuestR3LibGuestProp.cpp \
     102                VBoxGuestR3LibHostVersion.cpp,) \
    99103        VBoxGuestR3LibMisc.cpp \
    100104        VBoxGuestR3LibTime.cpp
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp

    r23845 r23856  
    2626#include <iprt/mem.h>
    2727#include <VBox/log.h>
    28 
    2928#include "VBGLR3Internal.h"
    3029
     
    194193}
    195194
     195
     196/** @todo Docs */
     197VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev)
     198{
     199    int rc;
     200#ifdef RT_OS_WINDOWS
     201    HKEY hKey;
     202    LONG r;
     203
     204    /* Check the new path first. */
     205    r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     206#ifdef RT_ARCH_AMD64
     207    if (r != ERROR_SUCCESS)
     208    {
     209        /* Check Wow6432Node (for new entries). */
     210        r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     211    }
     212#endif
     213
     214    /* Still no luck? Then try the old xVM paths ... */
     215    if (FAILED(r))
     216    {
     217        r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     218#ifdef RT_ARCH_AMD64
     219        if (r != ERROR_SUCCESS)
     220        {
     221            /* Check Wow6432Node (for new entries). */
     222            r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     223        }
     224#endif
     225    }
     226
     227    /* Did we get something worth looking at? */
     228    if (SUCCEEDED(r))
     229    {
     230        /* Version. */
     231        DWORD dwType;
     232        DWORD dwSize = 32;
     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        }
     239        /* Revision. */
     240        if (ppszRev)
     241        {
     242            dwSize = 32;
     243            char *pszRev = (char*)RTMemAlloc(dwSize);
     244            if (ERROR_SUCCESS == RegQueryValueEx(hKey, "Revision", NULL, &dwType, (BYTE*)(LPCTSTR)pszRev, &dwSize))
     245                *ppszRev = pszRev;
     246        }
     247    }
     248    rc = RTErrConvertFromWin32(r);
     249
     250    if (NULL != hKey)
     251        RegCloseKey(hKey);
     252#else
     253#endif /* RT_OS_WINDOWS */
     254    return rc;
     255}
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