VirtualBox

Ignore:
Timestamp:
May 10, 2011 8:20:35 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71634
Message:

Guest Additions: Also report extended version information to the host to "/VirtualBox/GuestAdd/VersionEx".

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

Legend:

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

    r37016 r37019  
    3939 * Fallback for vbglR3GetAdditionsVersion.
    4040 */
    41 static int vbglR3GetAdditionsCompileTimeVersion(char **ppszVer, char **ppszRev)
    42 {
     41static int vbglR3GetAdditionsCompileTimeVersion(char **ppszVer, char **ppszVerEx, char **ppszRev)
     42{
     43    /* Raw version string: major.minor.build. */
    4344    if (ppszVer)
    4445    {
    4546        *ppszVer = RTStrDup(VBOX_VERSION_STRING_RAW);
    4647        if (!*ppszVer)
     48            return VERR_NO_STR_MEMORY;
     49    }
     50
     51    /* Extended version string: major.minor.build (+ vendor [suffix(es)]). */
     52    if (ppszVerEx)
     53    {
     54        *ppszVerEx = RTStrDup(VBOX_VERSION_STRING);
     55        if (!*ppszVerEx)
    4756            return VERR_NO_STR_MEMORY;
    4857    }
     
    169178 *
    170179 * @returns IPRT status value
    171  * @param   ppszVer     Receives pointer of allocated version string. NULL is
     180 * @param   ppszVer     Receives pointer of allocated raw version string
     181 *                      (major.minor.build). NULL is accepted. The returned
     182 *                      pointer must be freed using RTStrFree().*
     183 * @param   ppszVerEx   Receives pointer of allocated full version string
     184 *                      (raw version + vendor suffix(es)). NULL is
    172185 *                      accepted. The returned pointer must be freed using
    173186 *                      RTStrFree().
     
    176189 *                      RTStrFree().
    177190 */
    178 VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszRev)
     191VBGLR3DECL(int) VbglR3GetAdditionsVersion(char **ppszVer, char **ppszVerEx, char **ppszRev)
    179192{
    180193#ifdef RT_OS_WINDOWS
     
    210223                rc = VERR_NO_MEMORY;
    211224        }
     225        if (ppszVerEx)
     226        {
     227            dwSize = 32; /* Reset */
     228            pszTmp = (char*)RTMemAlloc(dwSize);
     229            if (pszTmp)
     230            {
     231                l = RegQueryValueEx(hKey, "VersionEx", NULL, &dwType, (BYTE*)(LPCTSTR)pszTmp, &dwSize);
     232                if (l == ERROR_SUCCESS)
     233                {
     234                    if (dwType == REG_SZ)
     235                        rc = RTStrDupEx(ppszVerEx, pszTmp);
     236                    else
     237                        rc = VERR_INVALID_PARAMETER;
     238                }
     239                else
     240                {
     241                    rc = RTErrConvertFromWin32(l);
     242                }
     243                RTMemFree(pszTmp);
     244            }
     245            else
     246                rc = VERR_NO_MEMORY;
     247        }
    212248        /* Revision. */
    213249        if (ppszRev)
     
    248284         * into this binary.
    249285         */
    250         rc = vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszRev);
     286        rc = vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerEx, ppszRev);
    251287    }
    252288    return rc;
     
    256292     * On non-Windows platforms just return the compile-time version string.
    257293     */
    258     return vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszRev);
     294    return vbglR3GetAdditionsCompileTimeVersion(ppszVer, ppszVerEx, ppszRev);
    259295#endif /* !RT_OS_WINDOWS */
    260296}
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibHostVersion.cpp

    r28800 r37019  
    129129        if (RT_SUCCESS(rc))
    130130        {
    131             rc = VbglR3GetAdditionsVersion(ppszGuestVersion, NULL /* Revision not needed here */);
     131            rc = VbglR3GetAdditionsVersion(ppszGuestVersion, NULL /* Extended version not needed here */,
     132                                           NULL /* Revision not needed here */);
    132133            if (RT_FAILURE(rc))
    133134                LogFlow(("Could not read VBox guest version! rc = %Rrc\n", rc));
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