VirtualBox

Changeset 23115 in vbox


Ignore:
Timestamp:
Sep 18, 2009 8:27:42 AM (15 years ago)
Author:
vboxsync
Message:

VBoxTray: Added guest property option to disable host version check.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxHostVersion.cpp

    r23113 r23115  
    5959        Log(("VBoxTray: Failed to connect to the guest property service! Error: %d\n", rc));
    6060
     61    /* Do we need to do all this stuff? */
     62    char *pszCheckHostVersion;
     63    rc = VbglR3GuestPropReadValueAlloc(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/CheckHostVersion", &pszCheckHostVersion);
     64    if (RT_FAILURE(rc))   
     65    {
     66        if (rc == VERR_NOT_FOUND)
     67            rc = VERR_NOT_SUPPORTED; /* If we don't find the value above this is not critical */
     68        else
     69            Log(("VBoxTray: Could not read check host version flag! rc = %d\n", rc));
     70    }
     71    else
     72    {
     73        if (pszCheckHostVersion && atoi(pszCheckHostVersion) <= 0)
     74            rc = VERR_NOT_SUPPORTED;
     75        VbglR3GuestPropReadValueFree(pszCheckHostVersion);
     76    }
     77    if (rc == VERR_NOT_SUPPORTED)           
     78        Log(("VBoxTray: No host version check performed."));
     79
    6180    char szMsg[256] = "\0"; /* Sizes according to MSDN. */
    6281    char szTitle[64] = "\0";
     
    6887        rc = VbglR3GuestPropReadValueAlloc(uGuestPropSvcClientID, "/VirtualBox/HostInfo/VBoxVer", &pszVBoxHostVer);
    6988        if (RT_FAILURE(rc))
    70             Log(("VBoxTray: Could not read VBox host version! rc = %d\n", rc));
    71 
    72         if (RT_SUCCESS(rc))
     89        {
     90            Log(("VBoxTray: Could not read VBox host version! rc = %d\n", rc));   
     91        }
     92        else
    7393        {
    7494            Log(("VBoxTray: Host version: %s\n", pszVBoxHostVer));
     
    102122                }
    103123
    104                 /** @todo implement a special value of last informed host version (or a new flag) to disable this service. */
    105 
    106124                /* Compare both versions and prepare message */
    107125                if (   RT_SUCCESS(rc)
     
    129147                        if (lRet == ERROR_SUCCESS)
    130148                        {
    131                             lRet = RegSetValueEx(hKey, "HostVerLastChecked", 0, REG_SZ, (BYTE*)pszVBoxHostVer, strlen(pszVBoxHostVer)*sizeof(char));
     149                            lRet = RegSetValueEx(hKey, "HostVerLastChecked", 0, REG_SZ, (BYTE*)pszVBoxHostVer, (DWORD)(strlen(pszVBoxHostVer)*sizeof(char)));
    132150                            if (lRet != ERROR_SUCCESS)
    133151                                Log(("VBoxTray: Could not write HostVerLastChecked! Error = %ld\n", lRet));
     
    153171    }
    154172
     173    /* If we didn't have to check for the host version then this is not an error */
     174    if (rc == VERR_NOT_SUPPORTED)
     175        rc = VINF_SUCCESS;
     176
    155177    VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
    156178    return rc;
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