VirtualBox

Changeset 77498 in vbox for trunk


Ignore:
Timestamp:
Feb 28, 2019 9:50:12 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129090
Message:

HostServices/SharedFolders: fixed loading of shared folder mappings to make sure that they are not duplicated when two or more HGCM clients use the same mapping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r76553 r77498  
    9898int vbsfMappingLoaded(const MAPPING *pLoadedMapping, SHFLROOT root)
    9999{
    100     /* Mapping loaded from the saved state with the index. Which means
    101      * the guest uses the iMapping as root handle for this folder.
     100    /* Mapping loaded from the saved state with the 'root' index. Which means
     101     * the guest uses the 'root' as root handle for this folder.
    102102     * Check whether there is the same mapping in g_FolderMapping and
    103103     * update the g_aIndexFromRoot.
     
    120120            && memcmp(pLoadedMapping->pMapName, pMapping->pMapName, ShflStringSizeOfBuffer(pMapping->pMapName)) == 0)
    121121        {
     122            Log(("vbsfMappingLoaded: root=%u i=%u (was %u) (%ls)\n",
     123                 root, i, g_aIndexFromRoot[root], pLoadedMapping->pMapName->String.utf16));
     124
    122125            if (!pMapping->fLoadedRootId)
    123126            {
     127                /* First encounter. */
    124128                pMapping->fLoadedRootId = true;
    125                 Log(("vbsfMappingLoaded: root=%u i=%u (was %u) (%ls)\n",
    126                      root, i, g_aIndexFromRoot[root], pLoadedMapping->pMapName->String.utf16));
    127 
    128                 /* Actual index is i. */
    129                 /** @todo This will not work with global shared folders, as these can change
    130                  *        while state is saved and these blind assignments may hid new ones.  */
    131                 g_aIndexFromRoot[root] = i;
    132129
    133130                /* Update the mapping properties. */
    134131                pMapping->cMappings = pLoadedMapping->cMappings;
    135 
    136                 return VINF_SUCCESS;
    137132            }
     133            else
     134            {
     135                /* When pMapping->fLoadedRootId is already true it means that another HGCM client uses the same mapping. */
     136                Assert(pMapping->cMappings > 1);
     137            }
     138
     139            /* Actual index is i. Remember that when the guest uses 'root' it is actually 'i'. */
     140            /** @todo This will not work with global shared folders, as these can change
     141             *        while state is saved and these blind assignments may hid new ones.  */
     142            g_aIndexFromRoot[root] = i;
     143
     144            /* The mapping is known to the host and is used by the guest.
     145             * No need for a 'placeholder'.
     146             */
     147            return VINF_SUCCESS;
    138148        }
    139149    }
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