VirtualBox

Changeset 6379 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 18, 2008 5:25:20 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27322
Message:

support read-only shared folders

Location:
trunk/src/VBox
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r6285 r6379  
    592592        RTPrintf("VBoxManage sharedfolder     add <vmname>|<uuid>\n"
    593593                 "                            -name <name> -hostpath <hostpath>\n"
    594                  "                            [-transient]\n"
     594                 "                            [-transient] [-readonly]\n"
    595595                 "\n");
    596596    }
     
    19071907            CHECK_ERROR_RET(sfEnum, GetNext(sf.asOutParam()), rc);
    19081908            Bstr name, hostPath;
     1909            BOOL writable;
    19091910            sf->COMGETTER(Name)(name.asOutParam());
    19101911            sf->COMGETTER(HostPath)(hostPath.asOutParam());
     1912            sf->COMGETTER(Writable)(&writable);
    19111913            if (!numSharedFolders && details != VMINFO_MACHINEREADABLE)
    19121914                RTPrintf("\n\n");
     
    19191921            }
    19201922            else
    1921                 RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping)\n", name.raw(), hostPath.raw());
     1923                RTPrintf("Name: '%lS', Host path: '%lS' (machine mapping), %s\n",
     1924                         name.raw(), hostPath.raw(), writable ? "writable" : "readonly");
    19221925            ++numSharedFolders;
    19231926            CHECK_ERROR_RET(sfEnum, HasMore(&fMore), rc);
     
    70227025        char *hostpath = NULL;
    70237026        bool fTransient = false;
     7027        bool fWritable = true;
    70247028
    70257029        for (int i = 2; i < argc; i++)
     
    70427046                i++;
    70437047                hostpath = argv[i];
    7044 
     7048            }
     7049            else if (strcmp(argv[i], "-readonly") == 0)
     7050            {
     7051                fWritable = false;
    70457052            }
    70467053            else if (strcmp(argv[i], "-transient") == 0)
     
    70717078            CHECK_ERROR_RET(aSession, COMGETTER(Console)(console.asOutParam()), 1);
    70727079
    7073             CHECK_ERROR(console, CreateSharedFolder(Bstr(name), Bstr(hostpath)));
     7080            CHECK_ERROR(console, CreateSharedFolder(Bstr(name), Bstr(hostpath), fWritable));
    70747081
    70757082            if (console)
     
    70847091            aSession->COMGETTER(Machine)(machine.asOutParam());
    70857092
    7086             CHECK_ERROR(machine, CreateSharedFolder(Bstr(name), Bstr(hostpath)));
     7093            CHECK_ERROR(machine, CreateSharedFolder(Bstr(name), Bstr(hostpath), fWritable));
    70877094
    70887095            if (SUCCEEDED(rc))
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui

    r6039 r6379  
    241241    <function returnType="int">dialogType() {return mDialogType;}</function>
    242242    <function access="private">removeSharedFolder( const QString &amp;, const QString &amp;, VBoxSharedFoldersSettings::SFDialogType )</function>
    243     <function access="private">createSharedFolder( const QString &amp;, const QString &amp;, VBoxSharedFoldersSettings::SFDialogType )</function>
     243    <function access="private">createSharedFolder( const QString &amp;, const QString &amp;, bool, VBoxSharedFoldersSettings::SFDialogType )</function>
    244244    <function>getFromGlobal()</function>
    245245    <function>getFromMachine( const CMachine &amp; )</function>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h

    r5999 r6379  
    404404void VBoxSharedFoldersSettings::createSharedFolder (const QString & aName,
    405405                                                    const QString & aPath,
     406                                                    bool aWritable,
    406407                                                    SFDialogType aType)
    407408{
     
    417418        {
    418419            Assert (!mMachine.isNull());
    419             mMachine.CreateSharedFolder (aName, aPath);
     420            mMachine.CreateSharedFolder (aName, aPath, aWritable);
    420421            if (!mMachine.isOk())
    421422                vboxProblem().cannotCreateSharedFolder (this, mMachine,
     
    426427        {
    427428            Assert (!mConsole.isNull());
    428             mConsole.CreateSharedFolder (aName, aPath);
     429            mConsole.CreateSharedFolder (aName, aPath, aWritable);
    429430            if (!mConsole.isOk())
    430431                vboxProblem().cannotCreateSharedFolder (this, mConsole,
     
    573574        if (item && !item->getText (0).isNull() && !item->getText (1).isNull()
    574575            && item->getText (2) == "edited")
    575             createSharedFolder (item->getText (0), item->getText (1), type);
     576            createSharedFolder (item->getText (0), item->getText (1), true, type);
    576577        iterator = iterator->nextSibling();
    577578    }
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r5999 r6379  
    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

    r5999 r6379  
    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

    r5999 r6379  
    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

    r5999 r6379  
    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            {
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r6375 r6379  
    882882        vrc = SSMR3PutStrZ (pSSM, hostPath);
    883883        AssertRC (vrc);
     884
     885//        XXX
     886//        vrc = SSMR3PutBool (pSSM, folder->writable());
     887//        AssertRC (vrc);
    884888    }
    885889
     
    953957        ComObjPtr <SharedFolder> sharedFolder;
    954958        sharedFolder.createObject();
    955         HRESULT rc = sharedFolder->init (that, name, hostPath);
     959        HRESULT rc = sharedFolder->init (that, name, hostPath, PR_TRUE); /* TODO: fWritable */
    956960        AssertComRCReturn (rc, VERR_INTERNAL_ERROR);
    957961
     
    13151319        for (SharedFolderMap::const_iterator it = mSharedFolders.begin();
    13161320             it != mSharedFolders.end(); ++ it)
    1317             sharedFolders [it->first] = it->second->hostPath();
     1321            sharedFolders [it->first] = SharedFolderData(it->second->hostPath(), it->second->writable());
    13181322    }
    13191323
     
    19911995
    19921996STDMETHODIMP
    1993 Console::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath)
     1997Console::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable)
    19941998{
    19951999    if (!aName || !aHostPath)
     
    20192023
    20202024    sharedFolder.createObject();
    2021     rc = sharedFolder->init (this, aName, aHostPath);
     2025    rc = sharedFolder->init (this, aName, aHostPath, aWritable);
    20222026    CheckComRCReturnRC (rc);
    20232027
     
    20472051
    20482052        /* second, create the given folder */
    2049         rc = createSharedFolder (aName, aHostPath);
     2053        rc = createSharedFolder (aName, SharedFolderData (aHostPath, aWritable));
    20502054        CheckComRCReturnRC (rc);
    20512055    }
     
    41954199            Bstr name;
    41964200            Bstr hostPath;
     4201            BOOL writable;
    41974202
    41984203            rc = folder->COMGETTER(Name) (name.asOutParam());
     
    42004205            rc = folder->COMGETTER(HostPath) (hostPath.asOutParam());
    42014206            CheckComRCBreakRC (rc);
    4202 
    4203             mMachineSharedFolders.insert (std::make_pair (name, hostPath));
     4207            rc = folder->COMGETTER(Writable) (&writable);
     4208
     4209            mMachineSharedFolders.insert (std::make_pair (name, SharedFolderData (hostPath, writable)));
    42044210
    42054211            /* send changes to HGCM if the VM is running */
     
    42084214            {
    42094215                SharedFolderDataMap::iterator it = oldFolders.find (name);
    4210                 if (it == oldFolders.end() || it->second != hostPath)
     4216                if (it == oldFolders.end() || it->second.mHostPath != hostPath)
    42114217                {
    42124218                    /* a new machine folder is added or
     
    42234229                            rc = removeSharedFolder (name);
    42244230                        /* create the new machine folder */
    4225                         rc = createSharedFolder (name, hostPath);
     4231                        rc = createSharedFolder (name, SharedFolderData (hostPath, writable));
    42264232                    }
    42274233                }
     
    43024308 *  @note Doesn't lock anything.
    43034309 */
    4304 HRESULT Console::createSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath)
     4310HRESULT Console::createSharedFolder (INPTR BSTR aName, SharedFolderData aData)
    43054311{
    43064312    ComAssertRet (aName && *aName, E_FAIL);
    4307     ComAssertRet (aHostPath && *aHostPath, E_FAIL);
     4313    ComAssertRet (aData.mHostPath && *aData.mHostPath, E_FAIL);
    43084314
    43094315    /* sanity checks */
     
    43114317    AssertReturn (mVMMDev->isShFlActive(), E_FAIL);
    43124318
    4313     VBOXHGCMSVCPARM  parms[2];
     4319    VBOXHGCMSVCPARM  parms[SHFL_CPARMS_ADD_MAPPING];
    43144320    SHFLSTRING      *pFolderName, *pMapName;
    43154321    size_t           cbString;
     
    43174323    Log (("Adding shared folder '%ls' -> '%ls'\n", aName, aHostPath));
    43184324
    4319     cbString = (RTStrUcs2Len (aHostPath) + 1) * sizeof (RTUCS2);
     4325    cbString = (RTStrUcs2Len (aData.mHostPath) + 1) * sizeof (RTUCS2);
    43204326    if (cbString >= UINT16_MAX)
    43214327        return setError (E_INVALIDARG, tr ("The name is too long"));
    43224328    pFolderName = (SHFLSTRING *) RTMemAllocZ (sizeof (SHFLSTRING) + cbString);
    43234329    Assert (pFolderName);
    4324     memcpy (pFolderName->String.ucs2, aHostPath, cbString);
     4330    memcpy (pFolderName->String.ucs2, aData.mHostPath, cbString);
    43254331
    43264332    pFolderName->u16Size   = (uint16_t)cbString;
     
    43484354    parms[1].u.pointer.size = sizeof (SHFLSTRING) + (uint16_t)cbString;
    43494355
     4356    parms[2].type = VBOX_HGCM_SVC_PARM_32BIT;
     4357    parms[2].u.uint32 = aData.mWritable;
     4358
    43504359    int vrc = mVMMDev->hgcmHostCall ("VBoxSharedFolders",
    43514360                                     SHFL_FN_ADD_MAPPING,
    4352                                      2, &parms[0]);
     4361                                     SHFL_CPARMS_ADD_MAPPING, &parms[0]);
    43534362    RTMemFree (pFolderName);
    43544363    RTMemFree (pMapName);
     
    43584367                         tr ("Could not create a shared folder '%ls' "
    43594368                             "mapped to '%ls' (%Vrc)"),
    4360                          aName, aHostPath, vrc);
     4369                         aName, aData.mHostPath.raw(), vrc);
    43614370
    43624371    return S_OK;
  • trunk/src/VBox/Main/MachineImpl.cpp

    r6367 r6379  
    23722372
    23732373STDMETHODIMP
    2374 Machine::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath)
     2374Machine::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable)
    23752375{
    23762376    if (!aName || !aHostPath)
     
    23922392
    23932393    sharedFolder.createObject();
    2394     rc = sharedFolder->init (machine(), aName, aHostPath);
     2394    rc = sharedFolder->init (machine(), aName, aHostPath, aWritable);
    23952395    CheckComRCReturnRC (rc);
    23962396
     
    43144314                Bstr hostPath = (*it).stringValue ("hostPath");
    43154315
    4316                 rc = CreateSharedFolder (name, hostPath);
     4316                bool writable = (*it).value <bool> ("writable");
     4317
     4318                rc = CreateSharedFolder (name, hostPath, writable);
    43174319                CheckComRCReturnRC (rc);
    43184320            }
     
    56615663            folderNode.setValue <Bstr> ("name", folder->name());
    56625664            folderNode.setValue <Bstr> ("hostPath", folder->hostPath());
     5665            folderNode.setValue <bool> ("writable", folder->writable());
    56635666        }
    56645667    }
  • trunk/src/VBox/Main/SharedFolderImpl.cpp

    r5999 r6379  
    5858 *  @param aName        logical name of the shared folder
    5959 *  @param aHostPath    full path to the shared folder on the host
     60 *  @param aWritable    writable if true, readonly otherwise
    6061 *
    6162 *  @return          COM result indicator
    6263 */
    6364HRESULT SharedFolder::init (Machine *aMachine,
    64                             const BSTR aName, const BSTR aHostPath)
     65                            const BSTR aName, const BSTR aHostPath, bool aWritable)
    6566{
    6667    /* Enclose the state transition NotReady->InInit->Ready */
     
    7071    unconst (mMachine) = aMachine;
    7172
    72     HRESULT rc = protectedInit (aMachine, aName, aHostPath);
     73    HRESULT rc = protectedInit (aMachine, aName, aHostPath, aWritable);
    7374
    7475    /* Confirm a successful initialization when it's the case */
     
    100101
    101102    HRESULT rc = protectedInit (aMachine, aThat->mData.mName,
    102                                 aThat->mData.mHostPath);
     103                                aThat->mData.mHostPath, aThat->mData.mWritable);
    103104
    104105    /* Confirm a successful initialization when it's the case */
     
    115116 *  @param aName        logical name of the shared folder
    116117 *  @param aHostPath    full path to the shared folder on the host
     118 *  @param aWritable    writable if true, readonly otherwise
    117119 *
    118120 *  @return          COM result indicator
    119121 */
    120122HRESULT SharedFolder::init (Console *aConsole,
    121                             const BSTR aName, const BSTR aHostPath)
     123                            const BSTR aName, const BSTR aHostPath, bool aWritable)
    122124{
    123125    /* Enclose the state transition NotReady->InInit->Ready */
     
    127129    unconst (mConsole) = aConsole;
    128130
    129     HRESULT rc = protectedInit (aConsole, aName, aHostPath);
     131    HRESULT rc = protectedInit (aConsole, aName, aHostPath, aWritable);
    130132
    131133    /* Confirm a successful initialization when it's the case */
     
    142144 *  @param aName        logical name of the shared folder
    143145 *  @param aHostPath    full path to the shared folder on the host
     146 *  @param aWritable    writable if true, readonly otherwise
    144147 *
    145148 *  @return          COM result indicator
    146149 */
    147150HRESULT SharedFolder::init (VirtualBox *aVirtualBox,
    148                             const BSTR aName, const BSTR aHostPath)
     151                            const BSTR aName, const BSTR aHostPath, bool aWritable)
    149152{
    150153    /* Enclose the state transition NotReady->InInit->Ready */
     
    154157    unconst (mVirtualBox) = aVirtualBox;
    155158
    156     HRESULT rc = protectedInit (aVirtualBox, aName, aHostPath);
     159    HRESULT rc = protectedInit (aVirtualBox, aName, aHostPath, aWritable);
    157160
    158161    /* Confirm a successful initialization when it's the case */
     
    170173 */
    171174HRESULT SharedFolder::protectedInit (VirtualBoxBaseWithChildrenNEXT *aParent,
    172                                      const BSTR aName, const BSTR aHostPath)
    173 {
    174     LogFlowThisFunc (("aName={%ls}, aHostPath={%ls}\n", aName, aHostPath));
     175                                     const BSTR aName, const BSTR aHostPath, bool aWritable)
     176{
     177    LogFlowThisFunc (("aName={%ls}, aHostPath={%ls}, aWritable={%d}\n",
     178                      aName, aHostPath, aWritable));
    175179
    176180    ComAssertRet (aParent && aName && aHostPath, E_INVALIDARG);
     
    216220    unconst (mData.mName) = aName;
    217221    unconst (mData.mHostPath) = hostPath;
     222    mData.mWritable = aWritable;
    218223
    219224    return S_OK;
     
    307312}
    308313
     314STDMETHODIMP SharedFolder::COMGETTER(Writable) (BOOL *aWritable)
     315{
     316    if (!aWritable)
     317        return E_POINTER;
     318
     319    *aWritable = mData.mWritable;
     320
     321    return S_OK;
     322}
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r6367 r6379  
    15751575
    15761576STDMETHODIMP
    1577 VirtualBox::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath)
     1577VirtualBox::CreateSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable)
    15781578{
    15791579    if (!aName || !aHostPath)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r6265 r6379  
    15731573        <desc>Full path to the shared folder in the host file system.</desc>
    15741574      </param>
     1575      <param name="writable" type="boolean" dir="in">
     1576        <desc>Whether the share is writable or readonly</desc>
     1577      </param>
    15751578    </method>
    15761579
     
    30463049        <desc>Full path to the shared folder in the host file system.</desc>
    30473050      </param>
     3051      <param name="writable" type="boolean" dir="in">
     3052        <desc>Whether the share is writable or readonly</desc>
     3053      </param>
    30483054    </method>
    30493055
     
    39013907      <param name="hostPath" type="wstring" dir="in">
    39023908        <desc>Full path to the shared folder in the host file system.</desc>
     3909      </param>
     3910      <param name="writable" type="boolean" dir="in">
     3911        <desc>Whether the share is writable or readonly</desc>
    39033912      </param>
    39043913    </method>
     
    90379046      </desc>
    90389047    </attribute>
     9048   
     9049    <attribute name="writable" type="boolean" readonly="yes">
     9050      <desc>
     9051        Whether the folder defined by the host path is writable or
     9052        not.
     9053      </desc>
     9054    </attribute>
    90399055
    90409056  </interface>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r6156 r6379  
    134134    STDMETHOD(AttachUSBDevice) (INPTR GUIDPARAM aId);
    135135    STDMETHOD(DetachUSBDevice) (INPTR GUIDPARAM aId, IUSBDevice **aDevice);
    136     STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath);
     136    STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable);
    137137    STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
    138138    STDMETHOD(TakeSnapshot) (INPTR BSTR aName, INPTR BSTR aDescription,
     
    353353    typedef SafeVMPtrBase <true> SafeVMPtrQuiet;
    354354
     355    class SharedFolderData
     356    {
     357    public:
     358        SharedFolderData() {}
     359        SharedFolderData(Bstr aHostPath, BOOL aWritable)
     360           : mHostPath (aHostPath)
     361           , mWritable (aWritable) {}
     362        SharedFolderData(const SharedFolderData& aThat)
     363           : mHostPath (aThat.mHostPath)
     364           , mWritable (aThat.mWritable) {}
     365        Bstr mHostPath;
     366        BOOL mWritable;
     367    };
    355368    typedef std::map <Bstr, ComObjPtr <SharedFolder> > SharedFolderMap;
    356     typedef std::map <Bstr, Bstr> SharedFolderDataMap;
     369    typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap;
    357370
    358371private:
     
    386399                                SharedFolderDataMap::const_iterator &aIt);
    387400
    388     HRESULT createSharedFolder (INPTR BSTR aName, INPTR BSTR aHostPath);
     401    HRESULT createSharedFolder (INPTR BSTR aName, SharedFolderData aData);
    389402    HRESULT removeSharedFolder (INPTR BSTR aName);
    390403
  • trunk/src/VBox/Main/include/MachineImpl.h

    r6076 r6379  
    498498    STDMETHOD(FindSnapshot) (INPTR BSTR aName, ISnapshot **aSnapshot);
    499499    STDMETHOD(SetCurrentSnapshot) (INPTR GUIDPARAM aId);
    500     STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath);
     500    STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable);
    501501    STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
    502502    STDMETHOD(CanShowConsoleWindow) (BOOL *aCanShow);
  • trunk/src/VBox/Main/include/SharedFolderImpl.h

    r5999 r6379  
    4141        const Bstr mName;
    4242        const Bstr mHostPath;
     43        bool       mWritable;
    4344    };
    4445
     
    6263
    6364    // public initializer/uninitializer for internal purposes only
    64     HRESULT init (Machine *aMachine, const BSTR aName, const BSTR aHostPath);
     65    HRESULT init (Machine *aMachine, const BSTR aName, const BSTR aHostPath, bool aWritable);
    6566    HRESULT initCopy (Machine *aMachine, SharedFolder *aThat);
    66     HRESULT init (Console *aConsole, const BSTR aName, const BSTR aHostPath);
    67     HRESULT init (VirtualBox *aVirtualBox, const BSTR aName, const BSTR aHostPath);
     67    HRESULT init (Console *aConsole, const BSTR aName, const BSTR aHostPath, bool aWritable);
     68    HRESULT init (VirtualBox *aVirtualBox, const BSTR aName, const BSTR aHostPath, bool aWritable);
    6869    void uninit();
    6970
     
    7273    STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
    7374    STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
     75    STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
    7476
    7577    // public methods for internal purposes only
     
    8183    const Bstr &name() const { return mData.mName; }
    8284    const Bstr &hostPath() const { return mData.mHostPath; }
     85    BOOL writable() const { return mData.mWritable; }
    8386
    8487    // for VirtualBoxSupportErrorInfoImpl
     
    8891
    8992    HRESULT protectedInit (VirtualBoxBaseWithChildrenNEXT *aParent,
    90                            const BSTR aName, const BSTR aHostPath);
     93                           const BSTR aName, const BSTR aHostPath, bool aWritable);
    9194
    9295private:
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r6076 r6379  
    161161
    162162    STDMETHOD(GetGuestOSType) (INPTR BSTR aId, IGuestOSType **aType);
    163     STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath);
     163    STDMETHOD(CreateSharedFolder) (INPTR BSTR aName, INPTR BSTR aHostPath, BOOL aWritable);
    164164    STDMETHOD(RemoveSharedFolder) (INPTR BSTR aName);
    165165    STDMETHOD(GetNextExtraDataKey) (INPTR BSTR aKey, BSTR *aNextKey, BSTR *aNextValue);
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r6173 r6379  
    630630  <xsd:attribute name="name" type="TNonEmptyString" use="required"/>
    631631  <xsd:attribute name="hostPath" type="TLocalFile" use="required"/>
     632  <xsd:attribute name="writable" type="xsd:boolean" default="true"/>
    632633</xsd:complexType>
    633634
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