VirtualBox

Changeset 6384 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jan 18, 2008 9:15:20 PM (17 years ago)
Author:
vboxsync
Message:

next try

Location:
trunk/src/VBox/HostServices/SharedFolders
Files:
4 edited

Legend:

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

    r6382 r6384  
    2828 *
    2929 */
    30 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName)
     30int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable)
    3131{
    3232    int i;
     
    7373            FolderMapping[i].fValid    = true;
    7474            FolderMapping[i].cMappings = 0;
     75            FolderMapping[i].fWritable = fWritable;
    7576
    7677            /* Check if the host file system is case sensitive */
     
    232233}
    233234
     235int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable)
     236{
     237    int rc = VINF_SUCCESS;
     238
     239    LogFlow(("vbsfMappingsQueryWritable: pClient = %p, root = %d\n",
     240             pClient, root));
     241
     242    if (root >= SHFL_MAX_MAPPINGS)
     243        return VERR_INVALID_PARAMETER;
     244
     245    if (FolderMapping[root].fValid == true)
     246        *fWritable = FolderMapping[root].fWritable;
     247    else
     248        rc = VERR_FILE_NOT_FOUND;
     249
     250    LogFlow(("vbsfMappingsQuery:Writable return rc = %Vrc\n", rc));
     251
     252    return rc;
     253}
     254
    234255static int vbsfQueryMappingIndex (PRTUTF16 utf16Name, size_t *pIndex)
    235256{
  • trunk/src/VBox/HostServices/SharedFolders/mappings.h

    r6382 r6384  
    3131    bool        fHostCaseSensitive;
    3232    bool        fGuestCaseSensitive;
     33    bool        fWritable;
    3334} MAPPING, *PMAPPING;
    3435
     
    3738bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping);
    3839
    39 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName);
     40int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable);
    4041int vbsfMappingsRemove (PSHFLSTRING pMapName);
    4142
    4243int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings);
    4344int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString);
     45int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable);
    4446
    4547int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r6382 r6384  
    10971097        else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_PTR     /* host folder name */
    10981098                 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR     /* guest map name */
     1099                 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT   /* fWritable */
    10991100                )
    11001101        {
     
    11081109            SHFLSTRING *pMapName    = (SHFLSTRING *)paParms[1].u.pointer.addr;
    11091110            uint32_t cbStringMap    = paParms[1].u.pointer.size;
     1111            uint32_t fWritable      = paParms[2].u.uint32;
    11101112
    11111113            /* Verify parameters values. */
     
    11211123            {
    11221124                /* Execute the function. */
    1123                 rc = vbsfMappingsAdd (pFolderName, pMapName);
     1125                rc = vbsfMappingsAdd (pFolderName, pMapName, fWritable);
    11241126
    11251127                if (VBOX_SUCCESS(rc))
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r6382 r6384  
    10181018                }
    10191019            }
     1020
     1021            /* write access requested? */
     1022            if (pParms->CreateFlags & (  SHFL_CF_ACT_REPLACE_IF_EXISTS
     1023                                       | SHFL_CF_ACT_OVERWRITE_IF_EXISTS
     1024                                       | SHFL_CF_ACT_CREATE_IF_NEW
     1025                                       | SHFL_CF_ACCESS_WRITE))
     1026            {
     1027                /* is the guest allowed to write to this share? */
     1028                bool fWritable;
     1029                rc = vbsfMappingsQueryWritable (pClient, root, &fWritable);
     1030                if (RT_FAILURE(rc) || !fWritable)
     1031                    return VERR_WRITE_PROTECT;
     1032            }
     1033
    10201034            if (BIT_FLAG(pParms->CreateFlags, SHFL_CF_DIRECTORY))
    10211035            {
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