VirtualBox

Changeset 8690

Show
Ignore:
Timestamp:
05/08/08 01:00:06 (3 months ago)
Author:
vboxsync
Message:

UpdateGuestVersion? fixes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp

    r8689 r8690  
    19951995static DECLCALLBACK(int) vmmdevLoadState(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version) 
    19961996{ 
     1997    /** @todo The code load code is assuming we're always loaded into a fresh VM. */ 
    19971998    VMMDevState *pData = PDMINS2DATA(pDevIns, VMMDevState*); 
    19981999    if (   SSM_VERSION_MAJOR_CHANGED(u32Version, VMMDEV_SSM_VERSION) 
    19992000        || (SSM_VERSION_MINOR(u32Version) < 6)) 
    20002001        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 
     2002 
    20012003    SSMR3GetU32(pSSMHandle, &pData->hypervisorSize); 
    20022004    SSMR3GetU32(pSSMHandle, &pData->mouseCapabilities); 
     
    22962298{ 
    22972299    VMMDevState *pData = PDMINS2DATA(pDevIns, VMMDevState*); 
     2300 
    22982301    /* 
    22992302     * Reset the mouse integration feature bit 
     
    23272330 
    23282331    /* Reset means that additions will report again. */ 
     2332    const bool fVersionChanged = pData->fu32AdditionsOk 
     2333                              || pData->guestInfo.additionsVersion 
     2334                              || pData->guestInfo.osType != VBOXOSTYPE_Unknown; 
     2335    if (fVersionChanged) 
     2336        Log(("vmmdevReset: fu32AdditionsOk=%d additionsVersion=%x osType=%#x\n", 
     2337             pData->fu32AdditionsOk, pData->guestInfo.additionsVersion, pData->guestInfo.osType)); 
    23292338    pData->fu32AdditionsOk = false; 
    23302339    memset (&pData->guestInfo, 0, sizeof (pData->guestInfo)); 
    2331     pData->pDrv->pfnUpdateGuestVersion(pData->pDrv, &pData->guestInfo); 
    2332  
     2340 
     2341    /* clear pending display change request. */ 
    23332342    memset (&pData->lastReadDisplayChangeRequest, 0, sizeof (pData->lastReadDisplayChangeRequest)); 
    23342343 
     
    23422351    pData->u32LastStatIntervalSize = 0; 
    23432352 
    2344     /* Clear the event variables. 
     2353    /* 
     2354     * Clear the event variables. 
    23452355     * 
    23462356     *   Note: The pData->u32HostEventFlags is not cleared. 
     
    23522362    pData->fNewGuestFilterMask   = 0; 
    23532363 
    2354     /* This is the default, as Windows and OS/2 guests take this for granted. */ 
     2364    /* This is the default, as Windows and OS/2 guests take this for granted. (Actually, neither does...) */ 
    23552365    /** @todo change this when we next bump the interface version */ 
    2356     pData->guestCaps = VMMDEV_GUEST_SUPPORTS_GRAPHICS; 
    2357     pData->pDrv->pfnUpdateGuestCapabilities(pData->pDrv, pData->guestCaps); 
     2366    const bool fCapsChanged = pData->guestCaps != VMMDEV_GUEST_SUPPORTS_GRAPHICS; 
     2367    if (fCapsChanged) 
     2368        Log(("vmmdevReset: fCapsChanged=%#x -> %#x\n", pData->guestCaps, VMMDEV_GUEST_SUPPORTS_GRAPHICS)); 
     2369    pData->guestCaps = VMMDEV_GUEST_SUPPORTS_GRAPHICS; /** @todo r=bird: why? I cannot see this being done at construction?*/ 
     2370 
     2371    /* 
     2372     * Call the update functions as required. 
     2373     */ 
     2374    if (fVersionChanged) 
     2375        pData->pDrv->pfnUpdateGuestVersion(pData->pDrv, &pData->guestInfo); 
     2376    if (fCapsChanged) 
     2377        pData->pDrv->pfnUpdateGuestCapabilities(pData->pDrv, pData->guestCaps); 
    23582378} 
    23592379 
  • trunk/src/VBox/Main/GuestImpl.cpp

    r8425 r8690  
    323323///////////////////////////////////////////////////////////////////////////// 
    324324 
    325 void Guest::setAdditionsVersion (Bstr aVersion
    326 { 
    327     AssertReturnVoid (!aVersion.isEmpty()); 
     325void Guest::setAdditionsVersion (Bstr aVersion, VBOXOSTYPE aOsType
     326{ 
     327    Assert(aVersion.isNull() || !aVersion.isEmpty()); 
    328328 
    329329    AutoCaller autoCaller (this); 
     
    333333 
    334334    mData.mAdditionsVersion = aVersion; 
    335     /* this implies that Additions are active */ 
    336     mData.mAdditionsActive = TRUE; 
     335    mData.mAdditionsActive = !aVersion.isNull(); 
     336    /** @todo Translate aOsType to a string and assign it to mData.mOSTypeId. 
     337     * The problem is just that the VBOXOSTYPE -> string translation table is in VBoxSVC. :/ 
     338     * We need this fixed for correct session information! */ 
    337339} 
    338340 
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r8425 r8690  
    151151/** 
    152152 * Report guest OS version. 
    153  * Called whenever the Additions issue a guest version report request
     153 * Called whenever the Additions issue a guest version report request or the VM is reset
    154154 * 
    155155 * @param   pInterface          Pointer to this interface. 
     
    171171        return; 
    172172 
    173     char version[20]; 
    174     RTStrPrintf(version, sizeof(version), "%d", guestInfo->additionsVersion); 
    175     guest->setAdditionsVersion(Bstr(version)); 
     173    if (guestInfo->additionsVersion != 0) 
     174    { 
     175        char version[20]; 
     176        RTStrPrintf(version, sizeof(version), "%d", guestInfo->additionsVersion); 
     177        guest->setAdditionsVersion(Bstr(version), guestInfo->osType); 
     178 
     179        /* 
     180         * Tell the console interface about the event 
     181         * so that it can notify its consumers. 
     182         */ 
     183        pDrv->pVMMDev->getParent()->onAdditionsStateChange(); 
     184 
     185        if (guestInfo->additionsVersion < VMMDEV_VERSION) 
     186            pDrv->pVMMDev->getParent()->onAdditionsOutdated(); 
     187    } 
     188    else 
     189    { 
     190        /* 
     191         * The guest additions was disabled because of a reset 
     192         * or driver unload. 
     193         */ 
     194        guest->setAdditionsVersion (Bstr(), guestInfo->osType); 
     195        pDrv->pVMMDev->getParent()->onAdditionsStateChange(); 
     196    } 
     197
     198 
     199/** 
     200 * Update the guest additions capabilities. 
     201 * This is called when the guest additions capabilities change. The new capabilities 
     202 * are given and the connector should update its internal state. 
     203 * 
     204 * @param   pInterface          Pointer to this interface. 
     205 * @param   newCapabilities     New capabilities. 
     206 * @thread  The emulation thread. 
     207 */ 
     208DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities) 
     209
     210    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface); 
     211 
     212    /* store that information in IGuest */ 
     213    Guest* guest = pDrv->pVMMDev->getParent()->getGuest(); 
     214    Assert(guest); 
     215    if (!guest) 
     216        return; 
     217 
     218    guest->setSupportsSeamless(BOOL (newCapabilities & VMMDEV_GUEST_SUPPORTS_SEAMLESS)); 
     219    guest->setSupportsGraphics(BOOL (newCapabilities & VMMDEV_GUEST_SUPPORTS_GRAPHICS)); 
    176220 
    177221    /* 
     
    180224     */ 
    181225    pDrv->pVMMDev->getParent()->onAdditionsStateChange(); 
    182      
    183     if (guestInfo->additionsVersion < VMMDEV_VERSION) 
    184     { 
    185         pDrv->pVMMDev->getParent()->onAdditionsOutdated(); 
    186     } 
    187 
    188  
    189 /** 
    190  * Update the guest additions capabilities. 
    191  * This is called when the guest additions capabilities change. The new capabilities 
    192  * are given and the connector should update its internal state. 
    193  * 
    194  * @param   pInterface          Pointer to this interface. 
    195  * @param   newCapabilities     New capabilities. 
    196  * @thread  The emulation thread. 
    197  */ 
    198 DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities) 
    199 
    200     PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface); 
    201  
    202     /* store that information in IGuest */ 
    203     Guest* guest = pDrv->pVMMDev->getParent()->getGuest(); 
    204     Assert(guest); 
    205     if (!guest) 
    206         return; 
    207  
    208     guest->setSupportsSeamless(BOOL (newCapabilities & VMMDEV_GUEST_SUPPORTS_SEAMLESS)); 
    209     guest->setSupportsGraphics(BOOL (newCapabilities & VMMDEV_GUEST_SUPPORTS_GRAPHICS)); 
    210  
    211     /* 
    212      * Tell the console interface about the event 
    213      * so that it can notify its consumers. 
    214      */ 
    215     pDrv->pVMMDev->getParent()->onAdditionsStateChange(); 
    216      
     226 
    217227} 
    218228 
     
    458468    if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_MEM_SYSTEM_CACHE) 
    459469        guest->SetStatistic(pGuestStats->u32CpuId, GuestStatisticType_MemSystemCache, pGuestStats->u32MemSystemCache / (_1M/pGuestStats->u32PageSize)); 
    460      
     470 
    461471    if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_PAGE_FILE_SIZE) 
    462472        guest->SetStatistic(pGuestStats->u32CpuId, GuestStatisticType_PageFileSize, pGuestStats->u32PageFileSize / (_1M/pGuestStats->u32PageSize)); 
     
    501511 
    502512    PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface); 
    503      
     513 
    504514    if (    !pServiceLocation 
    505515        || (   pServiceLocation->type != VMMDevHGCMLoc_LocalHost 
  • trunk/src/VBox/Main/include/GuestImpl.h

    r8425 r8690  
    2424 
    2525#include "VirtualBoxBase.h" 
     26#include <VBox/ostypes.h> 
    2627 
    2728class Console; 
     
    7475 
    7576    // public methods that are not in IDL 
    76     void setAdditionsVersion (Bstr aVersion); 
     77    void setAdditionsVersion (Bstr aVersion, VBOXOSTYPE aOsType); 
    7778 
    7879    void setSupportsSeamless (BOOL aSupportsSeamless); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy