VirtualBox

Changeset 31002 in vbox


Ignore:
Timestamp:
Jul 22, 2010 2:45:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63916
Message:

First support for auto-mounted Shared Folders (Windows only yet).

Location:
trunk
Files:
32 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestLib.h

    r30779 r31002  
    44
    55/*
    6  * Copyright (C) 2006-2009 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    507507/** @}  */
    508508# endif /* VBOX_WITH_GUEST_PROPS defined */
     509
     510# ifdef VBOX_WITH_SHARED_FOLDERS
     511/** @name Shared folders
     512 * @{ */
     513/**
     514 * Structure containing mapping information for a shared folder.
     515 */
     516struct VBGLR3SHAREDFOLDERMAPPING
     517{
     518    /** Mapping status. */
     519    uint32_t u32Status;
     520    /** Root handle. */
     521    uint32_t u32Root;
     522};
     523typedef VBGLR3SHAREDFOLDERMAPPING *PVBGLR3SHAREDFOLDERMAPPING;
     524/** @todo Docs. */
     525VBGLR3DECL(int)     VbglR3SharedFolderConnect(uint32_t *pu32ClientId);
     526VBGLR3DECL(int)     VbglR3SharedFolderDisconnect(uint32_t u32ClientId);
     527VBGLR3DECL(int)     VbglR3SharedFolderGetMappings(uint32_t                   u32ClientId,  bool      bAutoMountOnly,
     528                                                  VBGLR3SHAREDFOLDERMAPPING  paMappings[], uint32_t  cbMappings,
     529                                                  uint32_t                  *pcMapCount);
     530VBGLR3DECL(int)     VbglR3SharedFolderGetName(uint32_t   u32ClientId,uint32_t  u32Root,
     531                                              char     **ppszName,   uint32_t *pcbLen);
     532/** @}  */
     533# endif /* VBOX_WITH_SHARED_FOLDERS defined */
    509534
    510535# ifdef VBOX_WITH_GUEST_CONTROL
  • trunk/include/VBox/settings.h

    r30934 r31002  
    537537    SharedFolder()
    538538        : fWritable(false)
     539        , fAutoMount(false)
    539540    {}
    540541
     
    544545                    strHostPath;
    545546    bool            fWritable;
     547    bool            fAutoMount;
    546548};
    547549typedef std::list<SharedFolder> SharedFoldersList;
  • trunk/include/VBox/shflsvc.h

    r28800 r31002  
    11/** @file
    2  * Shared Folders: Common header for host service and guest clients. (ADD,HSvc)
     2 * Shared Folders: Common header for host service and guest clients.
    33 */
    44
    55/*
    6  * Copyright (C) 2006-2007 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    134134#define SHFL_HANDLE_ROOT ((SHFLHANDLE)0LL)
    135135
     136/** Hardcoded maximum length (in chars) of a shared folder name. */
     137#define SHFL_MAX_LEN         (256)
    136138/** Hardcoded maximum number of shared folder mapping available to the guest. */
    137139#define SHFL_MAX_MAPPINGS    (64)
     
    166168
    167169/** Calculate size of the string. */
    168 DECLINLINE(uint32_t) ShflStringSizeOfBuffer (PCSHFLSTRING pString)
     170DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString)
    169171{
    170172    return pString? sizeof (SHFLSTRING) - sizeof (pString->String) + pString->u16Size: 0;
    171173}
    172174
    173 DECLINLINE(uint32_t) ShflStringLength (PCSHFLSTRING pString)
     175DECLINLINE(uint32_t) ShflStringLength(PCSHFLSTRING pString)
    174176{
    175177    return pString? pString->u16Length: 0;
     
    420422 * SHFL_FN_QUERY_MAPPINGS
    421423 */
    422 
    423 #define SHFL_MF_UCS2 (0x00000000)
     424/** Validation mask.  Needs to be adjusted
     425  * whenever a new SHFL_MF_ flag is added. */
     426#define SHFL_MF_MASK       (0x00000011)
     427/** UC2 enconded strings. */
     428#define SHFL_MF_UCS2       (0x00000000)
    424429/** Guest uses UTF8 strings, if not set then the strings are unicode (UCS2). */
    425 #define SHFL_MF_UTF8 (0x00000001)
     430#define SHFL_MF_UTF8       (0x00000001)
     431/** Just handle the auto-mounted folders. */
     432#define SHFL_MF_AUTOMOUNT  (0x00000010)
    426433
    427434/** Type of guest system. For future system dependent features. */
     
    992999
    9931000/**
     1001 * SHFL_FN_ADD_MAPPING, with auto-mount flag.
     1002 * Host call, no guest structure is used.
     1003 */
     1004
     1005#define SHFL_CPARMS_ADD_MAPPING2 (4)
     1006
     1007/**
    9941008 * SHFL_FN_REMOVE_MAPPING
    9951009 * Host call, no guest structure is used.
  • trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk

    r29746 r31002  
    55
    66#
    7 # Copyright (C) 2006-2007 Oracle Corporation
     7# Copyright (C) 2006-2010 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    4242        VBoxHostVersion.cpp
    4343endif
     44ifdef VBOX_WITH_SHARED_FOLDERS
     45 VBoxTray_DEFS     +=  VBOX_WITH_SHARED_FOLDERS
     46 VBoxTray_SOURCES  += \
     47        VBoxSharedFolders.cpp
     48 VBoxTray_LIBS.win += \
     49        mpr.lib
     50endif
    4451
    4552VBoxTray_LIBS     = \
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxHostVersion.cpp

    r28800 r31002  
    66
    77/*
    8  * Copyright (C) 2009 Oracle Corporation
     8 * Copyright (C) 2010 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4545                char szTitle[64];
    4646
    47                 /** @todo add some translation macros here */
     47                /** @todo Add some translation macros here. */
    4848                _snprintf(szTitle, sizeof(szTitle), "VirtualBox Guest Additions update available!");
    4949                _snprintf(szMsg, sizeof(szMsg), "Your guest is currently running the Guest Additions version %s. "
     
    5656            }
    5757
    58             /* Store host version to not notify again */
     58            /* Store host version to not notify again. */
    5959            rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
    6060
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxHostVersion.h

    r28800 r31002  
    11/** @file
    2  * VBoxRestore - Restore notification
     2 * VBoxHostVersion - Checks the host's VirtualBox version and notifies
     3 *                   the user in case of an update.
    34 */
    45
    56/*
    6  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    78 *
    89 * This file is part of VirtualBox Open Source Edition (OSE), as
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp

    r30928 r31002  
    2222#include "VBoxVRDP.h"
    2323#include "VBoxHostVersion.h"
     24#include "VBoxSharedFolders.h"
    2425#include <VBoxHook.h>
    2526#include "resource.h"
     
    454455                 NULL       /* No timerproc */);
    455456    }
     457
     458    VBoxSharedFoldersAutoMount();
    456459
    457460    /* Boost thread priority to make sure we wake up early for seamless window notifications (not sure if it actually makes any difference though) */
  • trunk/src/VBox/Additions/WINNT/VBoxTray/helpers.cpp

    r28800 r31002  
    254254    return 0;
    255255}
     256
  • trunk/src/VBox/Additions/common/VBoxControl/Makefile.kmk

    r28800 r31002  
    55
    66#
    7 # Copyright (C) 2008 Oracle Corporation
     7# Copyright (C) 2010 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    3333endif
    3434VBoxControl_DEFS     += \
    35         $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS VBOX_WITH_HGCM,)
     35        $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) \
     36        $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS,) \
     37        $(if $(VBOX_WITH_SHARED_FOLDERS),VBOX_WITH_SHARED_FOLDERS,)
    3638VBoxControl_SOURCES = \
    3739        VBoxControl.cpp
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r28800 r31002  
    7878    GUEST_PROP,
    7979#endif
     80#ifdef VBOX_WITH_SHARED_FOLDERS
     81    GUEST_SHAREDFOLDERS,
     82#endif
    8083    USAGE_ALL = UINT32_MAX
    8184};
     
    113116        doUsage("[-timestamp <last timestamp>]");
    114117        doUsage("[-timeout <timeout in ms>");
     118    }
     119#endif
     120#ifdef VBOX_WITH_SHARED_FOLDERS
     121    if ((GUEST_SHAREDFOLDERS == eWhich) || (USAGE_ALL == eWhich))
     122    {
     123        doUsage("list [-automount]", g_pszProgName, "sharedfolder");
    115124    }
    116125#endif
     
    12551264    return 1;
    12561265}
    1257 
     1266#endif
     1267
     1268#ifdef VBOX_WITH_SHARED_FOLDERS
     1269/**
     1270 * Lists the Shared Folders provided by the host.
     1271 */
     1272int listSharedFolders(int argc, char **argv)
     1273{
     1274    bool usageOK = true;
     1275    bool fOnlyShowAutoMount = false;
     1276    if (   argc == 1
     1277        && (   RTStrICmp(argv[0], "-automount") == 0
     1278            || RTStrICmp(argv[0], "/automount") == 0)
     1279       )
     1280    {
     1281        fOnlyShowAutoMount = true;
     1282    }
     1283    else if (argc > 1)
     1284        usageOK = false;
     1285
     1286    if (!usageOK)
     1287    {
     1288        usage(GUEST_SHAREDFOLDERS);
     1289        return 1;
     1290    }
     1291
     1292    uint32_t u32ClientId;
     1293    int rc = VbglR3SharedFolderConnect(&u32ClientId);
     1294    if (!RT_SUCCESS(rc))
     1295        VBoxControlError("Failed to connect to the shared folder service, error %Rrc\n", rc);
     1296    else
     1297    {
     1298        uint32_t cMappings = 64; /* See shflsvc.h for define; should be used later. */
     1299        uint32_t cbMappings = cMappings * sizeof(VBGLR3SHAREDFOLDERMAPPING);
     1300        VBGLR3SHAREDFOLDERMAPPING *pMappings = (VBGLR3SHAREDFOLDERMAPPING*)RTMemAlloc(cbMappings);
     1301
     1302        if (pMappings)
     1303        {
     1304            rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount,
     1305                                               pMappings, cbMappings,
     1306                                               &cMappings);
     1307            if (RT_SUCCESS(rc))
     1308            {
     1309                RT_CLAMP(cMappings, 0, 64); /* Maximum mappings, see shflsvc.h */
     1310                RTPrintf("Shared Folder Mappings (%u):\n\n", cMappings);
     1311                for (uint32_t i = 0; i < cMappings; i++)
     1312                {
     1313                    char *ppszName = NULL;
     1314                    uint32_t pcbLen = 0;
     1315                    rc = VbglR3SharedFolderGetName(u32ClientId, pMappings[i].u32Root,
     1316                                                   &ppszName, &pcbLen);
     1317                    if (RT_SUCCESS(rc))
     1318                    {
     1319                        RTPrintf("%02u - %s\n", i + 1, ppszName);
     1320                        RTStrFree(ppszName);
     1321                    }
     1322                    else
     1323                        VBoxControlError("Error while getting the shared folder name for root node = %u, rc = %Rrc\n",
     1324                                         pMappings[i].u32Root, rc);
     1325                }
     1326                if (cMappings == 0)
     1327                    RTPrintf("No Shared Folders available.\n");
     1328            }
     1329            else
     1330                VBoxControlError("Error while getting the shared folder mappings, rc = %Rrc\n", rc);
     1331            RTMemFree(pMappings);
     1332        }
     1333        else
     1334            rc = VERR_NO_MEMORY;
     1335        VbglR3SharedFolderDisconnect(u32ClientId);
     1336    }
     1337    return RT_SUCCESS(rc) ? 0 : 1;
     1338}
     1339
     1340/**
     1341 * Handles Shared Folders control.
     1342 *
     1343 * @returns 0 on success, 1 on failure
     1344 * @note see the command line API description for parameters
     1345 */
     1346static int handleSharedFolder(int argc, char *argv[])
     1347{
     1348    if (0 == argc)
     1349    {
     1350        usage(GUEST_SHAREDFOLDERS);
     1351        return 1;
     1352    }
     1353    if (0 == strcmp(argv[0], "list"))
     1354        return listSharedFolders(argc - 1, argv + 1);
     1355    /* else */
     1356    usage(GUEST_SHAREDFOLDERS);
     1357    return 1;
     1358}
    12581359#endif
    12591360
     
    12791380#ifdef VBOX_WITH_GUEST_PROPS
    12801381    { "guestproperty", handleGuestProperty },
     1382#endif
     1383#ifdef VBOX_WITH_SHARED_FOLDERS
     1384    { "sharedfolder", handleSharedFolder },
    12811385#endif
    12821386    { NULL, NULL }  /* terminator */
  • trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk

    r29535 r31002  
    6161        VMMDev.cpp \
    6262        HGCM.cpp \
    63         VBoxCalls.c \
     63        VBoxGuestR0LibSharedFolders.c \
    6464        VbglR0CanUsePhysPageList.cpp
    6565
     
    8888        VBOX_WITH_HGCM \
    8989        $(if $(VBOX_WITH_GUEST_PROPS),VBOX_WITH_GUEST_PROPS,) \
     90        $(if $(VBOX_WITH_SHARED_FOLDERS),VBOX_WITH_SHARED_FOLDERS,) \
    9091        $(if $(VBOX_WITH_GUEST_CONTROL),VBOX_WITH_GUEST_CONTROL,)
    9192VBoxGuestR3Lib_SOURCES     = \
     
    114115        VBoxGuestR3LibGuestProp.cpp \
    115116        VBoxGuestR3LibHostVersion.cpp
     117endif
     118ifdef VBOX_WITH_SHARED_FOLDERS
     119 VBoxGuestR3Lib_SOURCES   += \
     120        VBoxGuestR3LibSharedFolders.cpp
    116121endif
    117122ifdef VBOX_WITH_GUEST_CONTROL
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.c

    r30907 r31002  
    11/* $Revision$ */
    22/** @file
    3  * VBoxGuestLibR0 - Central calls.
     3 * VBoxGuestR0LibSharedFolders - Ring 0 Shared Folders calls.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2929
    3030#ifdef RT_OS_LINUX
    31 # include "VBoxCalls.h"
     31# include "VBoxGuestR0LibSharedFolders.h"
    3232# define DbgPrint RTAssertMsg2Weak
    3333#else
    34 # include "VBoxCalls.h"
     34# include "VBoxGuestR0LibSharedFolders.h"
    3535#endif
    3636#include <iprt/time.h>
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r30976 r31002  
    602602        RTPrintf("VBoxManage sharedfolder     add <vmname>|<uuid>\n"
    603603                 "                            --name <name> --hostpath <hostpath>\n"
    604                  "                            [--transient] [--readonly]\n"
     604                 "                            [--transient] [--readonly] [--automount]\n"
    605605                 "\n");
    606606    }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r30956 r31002  
    684684        bool fTransient = false;
    685685        bool fWritable = true;
     686        bool fAutoMount = false;
    686687
    687688        for (int i = 2; i < a->argc; i++)
     
    712713            {
    713714                fTransient = true;
     715            }
     716            else if (   !strcmp(a->argv[i], "--automount")
     717                     || !strcmp(a->argv[i], "-automount"))
     718            {
     719                fAutoMount = true;
    714720            }
    715721            else
     
    737743            CHECK_ERROR_RET(a->session, COMGETTER(Console)(console.asOutParam()), 1);
    738744
    739             CHECK_ERROR(console, CreateSharedFolder(Bstr(name), Bstr(hostpath), fWritable));
    740 
     745            CHECK_ERROR(console, CreateSharedFolder(Bstr(name), Bstr(hostpath),
     746                                                    fWritable, fAutoMount));
    741747            if (console)
    742748                a->session->Close();
     
    750756            a->session->COMGETTER(Machine)(machine.asOutParam());
    751757
    752             CHECK_ERROR(machine, CreateSharedFolder(Bstr(name), Bstr(hostpath), fWritable));
    753 
     758            CHECK_ERROR(machine, CreateSharedFolder(Bstr(name), Bstr(hostpath),
     759                                                    fWritable, fAutoMount));
    754760            if (SUCCEEDED(rc))
    755761                CHECK_ERROR(machine, SaveSettings());
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSF.cpp

    r30193 r31002  
    77
    88/*
    9  * Copyright (C) 2008-2009 Oracle Corporation
     9 * Copyright (C) 2008-2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    345345    mTrFull = tr ("Full");
    346346    mTrReadOnly = tr ("Read-only");
     347    mTrYes = tr ("Yes"); /** @todo Need to figure out if this string is necessary at all! */
    347348}
    348349
     
    364365        QStringList fields;
    365366        fields << name /* name */ << path /* path */
     367               << (dlg.isAutoMounted() ? mTrYes : "" /* auto mount? */)
    366368               << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */)
    367369               << "edited" /* mark item as edited */;
     
    392394    dlg.setName (item->getText (0));
    393395    dlg.setPermanent ((SFDialogType)item->parent()->text (1).toInt() != ConsoleType);
    394     dlg.setWriteable (item->getText (2) == mTrFull);
     396    dlg.setAutoMount (item->getText (2) == mTrYes);
     397    dlg.setWriteable (item->getText (3) == mTrFull);
    395398    if (dlg.exec() == QDialog::Accepted)
    396399    {
     
    406409        QStringList fields;
    407410        fields << name /* name */ << path /* path */
     411               << (dlg.isAutoMounted() ? mTrYes : "" /* auto mount? */)
    408412               << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */)
    409413               << "edited" /* mark item as edited */;
     
    516520}
    517521
    518 void VBoxVMSettingsSF::createSharedFolder (const QString &aName, const QString &aPath, bool aWritable, SFDialogType aType)
     522void VBoxVMSettingsSF::createSharedFolder (const QString &aName, const QString &aPath,
     523                                           bool aWritable, bool aAutoMount, SFDialogType aType)
    519524{
    520525    switch (aType)
     
    529534        {
    530535            Assert (!mMachine.isNull());
    531             mMachine.CreateSharedFolder (aName, aPath, aWritable);
     536            mMachine.CreateSharedFolder (aName, aPath, aWritable, aAutoMount);
    532537            if (!mMachine.isOk())
    533538                vboxProblem().cannotCreateSharedFolder (this, mMachine, aName, aPath);
     
    537542        {
    538543            Assert (!mConsole.isNull());
    539             mConsole.CreateSharedFolder (aName, aPath, aWritable);
     544            mConsole.CreateSharedFolder (aName, aPath, aWritable, aAutoMount);
    540545            if (!mConsole.isOk())
    541546                vboxProblem().cannotCreateSharedFolder (this, mConsole, aName, aPath);
     
    589594        QStringList fields;
    590595        fields << sf.GetName() /* name */ << sf.GetHostPath() /* path */
    591                << (sf.GetWritable() ? mTrFull : mTrReadOnly /* writable? */)
     596               << (sf.GetAutoMount() ? mTrYes : "") /* auto mount? */
     597               << (sf.GetWritable() ? mTrFull : mTrReadOnly) /* writable? */
    592598               << "not edited" /* initially not edited */;
    593599        new SFTreeViewItem (aRoot, fields, SFTreeViewItem::EllipsisFile);
     
    604610    SFDialogType type = (SFDialogType) aRoot->text (1).toInt();
    605611
     612    /** @todo Use enums rather than numbers for the text fields (like  item->getText (4)). */
     613
    606614    /* Delete all changed folders from vm */
    607615    for (int idx = 0; idx < aVec.size(); ++ idx)
     
    614622        {
    615623            SFTreeViewItem *item = aRoot->child (i);
    616             if (item->getText (0) == sf.GetName() && item->getText (3) == "not edited")
     624            if (item->getText (0) == sf.GetName() && item->getText (4) == "not edited")
    617625                break;
    618626        }
     
    627635        SFTreeViewItem *item = aRoot->child (i);
    628636
    629         if (!item->getText (0).isNull() && !item->getText (1).isNull() && item->getText (3) == "edited")
    630             createSharedFolder (item->getText (0), item->getText (1), item->getText (2) == mTrFull ? true : false, type);
     637        if (!item->getText (0).isNull() && !item->getText (1).isNull() && item->getText (4) == "edited")
     638            createSharedFolder (item->getText (0), item->getText (1),
     639                                item->getText (3) == mTrFull ? true : false, item->getText (2) == mTrYes ? true : false,
     640                                type);
    631641    }
    632642}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSF.h

    r28800 r31002  
    8181    void showEvent (QShowEvent *aEvent);
    8282
    83     void createSharedFolder (const QString &aName, const QString &aPath, bool aWritable, SFDialogType aType);
     83    void createSharedFolder (const QString &aName, const QString &aPath, bool aWritable, bool aAutoMount, SFDialogType aType);
    8484    void removeSharedFolder (const QString &aName, const QString &aPath, SFDialogType aType);
    8585
     
    100100    QString   mTrFull;
    101101    QString   mTrReadOnly;
     102    QString   mTrYes;
    102103};
    103104
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSF.ui

    r28800 r31002  
    7777       <column>
    7878        <property name="text">
     79         <string>Auto-Mount</string>
     80        </property>
     81       </column>
     82       <column>
     83        <property name="text">
    7984         <string>Access</string>
    8085        </property>
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSFDetails.cpp

    r30990 r31002  
    77
    88/*
    9  * Copyright (C) 2008 Oracle Corporation
     9 * Copyright (C) 2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    100100}
    101101
     102void VBoxVMSettingsSFDetails::setAutoMount (bool aAutoMount)
     103{
     104    mCbAutoMount->setChecked (aAutoMount);
     105}
     106
     107bool VBoxVMSettingsSFDetails::isAutoMounted() const
     108{
     109    return mCbAutoMount->isChecked();
     110}
     111
    102112void VBoxVMSettingsSFDetails::setPermanent (bool aPermanent)
    103113{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSFDetails.h

    r28800 r31002  
    5252    bool isWriteable() const;
    5353
     54    void setAutoMount (bool aAutoMount);
     55    bool isAutoMounted() const;
     56
    5457    void setPermanent (bool aPermanent);
    5558    bool isPermanent() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsSFDetails.ui

    r28800 r31002  
    6868   </item>
    6969   <item row="3" column="1" >
     70    <widget class="QCheckBox" name="mCbAutoMount" >
     71     <property name="toolTip" >
     72      <string>When checked, the guest OS will try to automatically mount the shared folder on startup.</string>
     73     </property>
     74     <property name="text" >
     75      <string>&amp;Auto-mount</string>
     76     </property>
     77    </widget>
     78   </item>
     79   <item row="4" column="1" >
    7080    <widget class="QCheckBox" name="mCbPermanent" >
    7181     <property name="text" >
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r28800 r31002  
    171171
    172172/*
    173  *
    174173 * We are always executed from one specific HGCM thread. So thread safe.
    175  *
    176174 */
    177 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable)
     175int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName,
     176                     uint32_t    fWritable,   uint32_t    fAutoMount)
    178177{
    179178    unsigned i;
     
    218217            memcpy(FolderMapping[i].pMapName->String.ucs2, pMapName->String.ucs2, pMapName->u16Size);
    219218
    220             FolderMapping[i].fValid    = true;
    221             FolderMapping[i].cMappings = 0;
    222             FolderMapping[i].fWritable = !!fWritable;
     219            FolderMapping[i].fValid     = true;
     220            FolderMapping[i].cMappings  = 0;
     221            FolderMapping[i].fWritable  = !!fWritable;
     222            FolderMapping[i].fAutoMount = !!fAutoMount;
    223223
    224224            /* Check if the host file system is case sensitive */
     
    343343    {
    344344        MAPPING *pFolderMapping = vbsfMappingGetByRoot(i);
    345         if (pFolderMapping != NULL && pFolderMapping->fValid == true)
    346         {
     345        if (   pFolderMapping != NULL
     346            && pFolderMapping->fValid == true)
     347        {
     348            /* Skip mappings which are not marked for auto-mounting if
     349             * the SHFL_MF_AUTOMOUNT flag ist set. */
     350            if (   (pClient->fu32Flags & SHFL_MF_AUTOMOUNT)
     351                && !pFolderMapping->fAutoMount)
     352                continue;
     353
    347354            pMappings[*pcMappings].u32Status = SHFL_MS_NEW;
    348355            pMappings[*pcMappings].root = i;
     
    350357        }
    351358    }
    352 
    353359    LogFlow(("vbsfMappingsQuery: return rc = %Rrc\n", rc));
    354 
    355360    return rc;
    356361}
     
    371376    if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8))
    372377    {
    373         /* not implemented */
     378        /* Not implemented. */
    374379        AssertFailed();
    375380        return VERR_INVALID_PARAMETER;
     
    412417}
    413418
     419int vbsfMappingsQueryAutoMount (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fAutoMount)
     420{
     421    int rc = VINF_SUCCESS;
     422
     423    LogFlow(("vbsfMappingsQueryAutoMount: pClient = %p, root = %d\n",
     424             pClient, root));
     425
     426    MAPPING *pFolderMapping = vbsfMappingGetByRoot(root);
     427    if (pFolderMapping == NULL)
     428    {
     429        return VERR_INVALID_PARAMETER;
     430    }
     431
     432    if (pFolderMapping->fValid == true)
     433        *fAutoMount = pFolderMapping->fAutoMount;
     434    else
     435        rc = VERR_FILE_NOT_FOUND;
     436
     437    LogFlow(("vbsfMappingsQueryAutoMount:Writable return rc = %Rrc\n", rc));
     438
     439    return rc;
     440}
     441
    414442int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot)
    415443{
  • trunk/src/VBox/HostServices/SharedFolders/mappings.h

    r28800 r31002  
    44
    55/*
    6  * Copyright (C) 2006-2007 Oracle Corporation
     6 * Copyright (C) 2006-2010 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030    bool        fGuestCaseSensitive;
    3131    bool        fWritable;
     32    bool        fAutoMount;
    3233} MAPPING, *PMAPPING;
    3334
     
    3637bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping);
    3738
    38 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable);
    39 int vbsfMappingsRemove (PSHFLSTRING pMapName);
     39int vbsfMappingsAdd(PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable, uint32_t fAutoMount);
     40int vbsfMappingsRemove(PSHFLSTRING pMapName);
    4041
    41 int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings);
    42 int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString);
    43 int vbsfMappingsQueryWritable (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable);
     42int vbsfMappingsQuery(SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings);
     43int vbsfMappingsQueryName(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString);
     44int vbsfMappingsQueryWritable(SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable);
    4445
    45 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
    46 int vbsfUnmapFolder (SHFLCLIENTDATA *pClient, SHFLROOT root);
     46int vbsfMapFolder(SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot);
     47int vbsfUnmapFolder(SHFLCLIENTDATA *pClient, SHFLROOT root);
    4748
    48 PCRTUTF16     vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot);
    49 bool          vbsfIsGuestMappingCaseSensitive (SHFLROOT root);
    50 bool          vbsfIsHostMappingCaseSensitive (SHFLROOT root);
     49PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot);
     50bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root);
     51bool vbsfIsHostMappingCaseSensitive (SHFLROOT root);
    5152
    5253int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root);
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r30502 r31002  
    310310
    311311                /* Verify parameters values. */
    312                 if (   (fu32Flags & ~SHFL_MF_UTF8) != 0
    313                     || cbMappings / sizeof (SHFLMAPPING) < cMappings
     312                if (   (fu32Flags & ~SHFL_MF_MASK) != 0
     313                    || cbMappings / sizeof (SHFLMAPPING) != cMappings
    314314                   )
    315315                {
     
    320320                    /* Execute the function. */
    321321                    if (fu32Flags & SHFL_MF_UTF8)
    322                     {
    323322                        pClient->fu32Flags |= SHFL_CF_UTF8;
    324                     }
    325 
    326                     rc = vbsfMappingsQuery (pClient, pMappings, &cMappings);
    327 
    328                     if (RT_SUCCESS(rc))
    329                     {
    330                         /* Update parameters.*/
     323                    if (fu32Flags & SHFL_MF_AUTOMOUNT)
     324                        pClient->fu32Flags |= SHFL_MF_AUTOMOUNT;
     325
     326                    rc = vbsfMappingsQuery(pClient, pMappings, &cMappings);
     327                    if (RT_SUCCESS(rc))
     328                    {
     329                        /* Update parameters. */
    331330                        paParms[1].u.uint32 = cMappings;
    332331                    }
     
    346345                rc = VERR_INVALID_PARAMETER;
    347346            }
    348             else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* root */
    349                      || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR     /* name */
     347            else if (   paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* Root. */
     348                     || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR   /* Name. */
    350349                    )
    351350            {
     
    366365                {
    367366                    /* Execute the function. */
    368                     rc = vbsfMappingsQueryName (pClient, root, pString);
     367                    rc = vbsfMappingsQueryName(pClient, root, pString);
    369368
    370369                    if (RT_SUCCESS(rc))
    371370                    {
    372371                        /* Update parameters.*/
    373                         ; /* none */
     372                        ; /* None. */
    374373                    }
    375374                }
     
    11621161
    11631162        /* Verify parameter count and types. */
    1164         if (cParms != SHFL_CPARMS_ADD_MAPPING)
     1163        if (   (cParms != SHFL_CPARMS_ADD_MAPPING)
     1164            && (cParms != SHFL_CPARMS_ADD_MAPPING2) /* With auto-mount flag. */
     1165           )
    11651166        {
    11661167            rc = VERR_INVALID_PARAMETER;
     
    11691170                 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR     /* guest map name */
    11701171                 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT   /* fWritable */
    1171                 )
     1172                 /* With auto-mount flag? */
     1173                 || (   cParms == SHFL_CPARMS_ADD_MAPPING2
     1174                     && paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT))
    11721175        {
    11731176            rc = VERR_INVALID_PARAMETER;
     
    11791182            SHFLSTRING *pMapName    = (SHFLSTRING *)paParms[1].u.pointer.addr;
    11801183            uint32_t fWritable      = paParms[2].u.uint32;
     1184            uint32_t fAutoMount     = 0; /* Disabled by default. */
     1185
     1186            /* Handle auto-mount flag if present. */
     1187            if (cParms == SHFL_CPARMS_ADD_MAPPING2)
     1188                fAutoMount = paParms[3].u.uint32;
    11811189
    11821190            /* Verify parameters values. */
     
    11901198            {
    11911199                /* Execute the function. */
    1192                 rc = vbsfMappingsAdd (pFolderName, pMapName, fWritable);
    1193 
     1200                rc = vbsfMappingsAdd(pFolderName, pMapName, fWritable, fAutoMount);
    11941201                if (RT_SUCCESS(rc))
    11951202                {
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r30907 r31002  
    11741174        vrc = SSMR3PutBool(pSSM, !!folder->isWritable());
    11751175        AssertRC(vrc);
     1176
     1177        vrc = SSMR3PutBool(pSSM, !!folder->isAutoMounted());
     1178        AssertRC(vrc);
    11761179    }
    11771180
     
    12361239        Bstr hostPath;
    12371240        bool writable = true;
     1241        bool autoMount = false;
    12381242
    12391243        uint32_t szBuf = 0;
     
    12591263            SSMR3GetBool(pSSM, &writable);
    12601264
     1265        if (u32Version > 0x00010000) // ???
     1266            SSMR3GetBool(pSSM, &autoMount);
     1267
    12611268        ComObjPtr<SharedFolder> sharedFolder;
    12621269        sharedFolder.createObject();
    1263         HRESULT rc = sharedFolder->init(this, name, hostPath, writable);
     1270        HRESULT rc = sharedFolder->init(this, name, hostPath, writable, autoMount);
    12641271        AssertComRCReturn(rc, VERR_INTERNAL_ERROR);
    12651272
     
    26602667
    26612668STDMETHODIMP
    2662 Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
     2669Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
    26632670{
    26642671    CheckComArgStrNotEmptyOrNull(aName);
     
    26922699
    26932700    sharedFolder.createObject();
    2694     rc = sharedFolder->init(this, aName, aHostPath, aWritable);
     2701    rc = sharedFolder->init(this, aName, aHostPath, aWritable, aAutoMount);
    26952702    if (FAILED(rc)) return rc;
    26962703
     
    27122719
    27132720        /* second, create the given folder */
    2714         rc = createSharedFolder(aName, SharedFolderData(aHostPath, aWritable));
     2721        rc = createSharedFolder(aName, SharedFolderData(aHostPath, aWritable, aAutoMount));
    27152722        if (FAILED(rc)) return rc;
    27162723    }
     
    51235130        for (SharedFolderMap::const_iterator it = mSharedFolders.begin();
    51245131             it != mSharedFolders.end(); ++ it)
    5125             sharedFolders[it->first] = SharedFolderData(it->second->getHostPath(), it->second->isWritable());
     5132            sharedFolders[it->first] = SharedFolderData(it->second->getHostPath(),
     5133                                                        it->second->isWritable(),
     5134                                                        it->second->isAutoMounted());
    51265135    }
    51275136
     
    57515760            Bstr hostPath;
    57525761            BOOL writable;
     5762            BOOL autoMount;
    57535763
    57545764            rc = folder->COMGETTER(Name)(name.asOutParam());
     
    57575767            if (FAILED(rc)) break;
    57585768            rc = folder->COMGETTER(Writable)(&writable);
    5759 
    5760             mMachineSharedFolders.insert(std::make_pair(name, SharedFolderData(hostPath, writable)));
     5769            if (FAILED(rc)) break;
     5770            rc = folder->COMGETTER(AutoMount)(&autoMount);
     5771            if (FAILED(rc)) break;
     5772
     5773            mMachineSharedFolders.insert(std::make_pair(name, SharedFolderData(hostPath, writable, autoMount)));
    57615774
    57625775            /* send changes to HGCM if the VM is running */
     
    57805793                            rc = removeSharedFolder(name);
    57815794                        /* create the new machine folder */
    5782                         rc = createSharedFolder(name, SharedFolderData(hostPath, writable));
     5795                        rc = createSharedFolder(name, SharedFolderData(hostPath, writable, autoMount));
    57835796                    }
    57845797                }
     
    58685881    AssertReturn(mVMMDev->isShFlActive(), E_FAIL);
    58695882
    5870     VBOXHGCMSVCPARM parms[SHFL_CPARMS_ADD_MAPPING];
     5883    VBOXHGCMSVCPARM parms[SHFL_CPARMS_ADD_MAPPING2];
    58715884    SHFLSTRING *pFolderName, *pMapName;
    58725885    size_t cbString;
     
    59085921    parms[2].u.uint32 = aData.mWritable;
    59095922
     5923    /*
     5924     * Auto-mount flag; is indicated by using the SHFL_CPARMS_ADD_MAPPING2
     5925     * define below.  This shows the host service that we have supplied
     5926     * an additional parameter (auto-mount) and keeps the actual command
     5927     * backwards compatible.
     5928     */
     5929    parms[3].type = VBOX_HGCM_SVC_PARM_32BIT;
     5930    parms[3].u.uint32 = aData.mAutoMount;
     5931
    59105932    int vrc = mVMMDev->hgcmHostCall("VBoxSharedFolders",
    59115933                                    SHFL_FN_ADD_MAPPING,
    5912                                     SHFL_CPARMS_ADD_MAPPING, &parms[0]);
     5934                                    SHFL_CPARMS_ADD_MAPPING2, &parms[0]);
    59135935    RTMemFree(pFolderName);
    59145936    RTMemFree(pMapName);
  • trunk/src/VBox/Main/MachineImpl.cpp

    r30958 r31002  
    39383938}
    39393939
    3940 STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable)
     3940STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
    39413941{
    39423942    CheckComArgStrNotEmptyOrNull(aName);
     
    39593959
    39603960    sharedFolder.createObject();
    3961     rc = sharedFolder->init(getMachine(), aName, aHostPath, aWritable);
     3961    rc = sharedFolder->init(getMachine(), aName, aHostPath, aWritable, aAutoMount);
    39623962    if (FAILED(rc)) return rc;
    39633963
     
    68956895        {
    68966896            const settings::SharedFolder &sf = *it;
    6897             rc = CreateSharedFolder(Bstr(sf.strName), Bstr(sf.strHostPath), sf.fWritable);
     6897            rc = CreateSharedFolder(Bstr(sf.strName), Bstr(sf.strHostPath), sf.fWritable, sf.fAutoMount);
    68986898            if (FAILED(rc)) return rc;
    68996899        }
     
    79597959            sf.strHostPath = pFolder->getHostPath();
    79607960            sf.fWritable = !!pFolder->isWritable();
     7961            sf.fAutoMount = !!pFolder->isAutoMounted();
    79617962
    79627963            data.llSharedFolders.push_back(sf);
  • trunk/src/VBox/Main/SharedFolderImpl.cpp

    r28800 r31002  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    6363 *  @param aHostPath    full path to the shared folder on the host
    6464 *  @param aWritable    writable if true, readonly otherwise
     65 *  @param aAutoMount   if auto mounted by guest true, false otherwise
    6566 *
    6667 *  @return          COM result indicator
    6768 */
    6869HRESULT SharedFolder::init (Machine *aMachine,
    69                             CBSTR aName, CBSTR aHostPath, BOOL aWritable)
     70                            CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
    7071{
    7172    /* Enclose the state transition NotReady->InInit->Ready */
     
    7576    unconst(mMachine) = aMachine;
    7677
    77     HRESULT rc = protectedInit(aMachine, aName, aHostPath, aWritable);
     78    HRESULT rc = protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount);
    7879
    7980    /* Confirm a successful initialization when it's the case */
     
    105106
    106107    HRESULT rc = protectedInit (aMachine, aThat->m.name,
    107                                 aThat->m.hostPath, aThat->m.writable);
     108                                aThat->m.hostPath, aThat->m.writable, aThat->m.autoMount);
    108109
    109110    /* Confirm a successful initialization when it's the case */
     
    125126 */
    126127HRESULT SharedFolder::init(Console *aConsole,
    127                             CBSTR aName, CBSTR aHostPath, BOOL aWritable)
     128                            CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
    128129{
    129130    /* Enclose the state transition NotReady->InInit->Ready */
     
    133134    unconst(mConsole) = aConsole;
    134135
    135     HRESULT rc = protectedInit(aConsole, aName, aHostPath, aWritable);
     136    HRESULT rc = protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount);
    136137
    137138    /* Confirm a successful initialization when it's the case */
     
    153154 */
    154155HRESULT SharedFolder::init (VirtualBox *aVirtualBox,
    155                             CBSTR aName, CBSTR aHostPath, BOOL aWritable)
     156                            CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
    156157{
    157158    /* Enclose the state transition NotReady->InInit->Ready */
     
    161162    unconst(mVirtualBox) = aVirtualBox;
    162163
    163     HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable);
     164    HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount);
    164165
    165166    /* Confirm a successful initialization when it's the case */
     
    177178 */
    178179HRESULT SharedFolder::protectedInit(VirtualBoxBase *aParent,
    179                                     CBSTR aName,
    180                                     CBSTR aHostPath,
    181                                     BOOL aWritable)
    182 {
    183     LogFlowThisFunc(("aName={%ls}, aHostPath={%ls}, aWritable={%d}\n",
    184                       aName, aHostPath, aWritable));
     180                                    CBSTR           aName,
     181                                    CBSTR           aHostPath,
     182                                    BOOL            aWritable,
     183                                    BOOL            aAutoMount)
     184{
     185    LogFlowThisFunc(("aName={%ls}, aHostPath={%ls}, aWritable={%d}, aAutoMount={%d}\n",
     186                      aName, aHostPath, aWritable, aAutoMount));
    185187
    186188    ComAssertRet(aParent && aName && aHostPath, E_INVALIDARG);
     
    228230    unconst(m.hostPath) = hostPath;
    229231    m.writable = aWritable;
     232    m.autoMount = aAutoMount;
    230233
    231234    return S_OK;
     
    318321    CheckComArgOutPointerValid(aWritable);
    319322
     323    AutoCaller autoCaller(this);
     324    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     325
     326    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     327
    320328    *aWritable = m.writable;
    321329
     
    323331}
    324332
     333STDMETHODIMP SharedFolder::COMGETTER(AutoMount) (BOOL *aAutoMount)
     334{
     335    CheckComArgOutPointerValid(aAutoMount);
     336
     337    AutoCaller autoCaller(this);
     338    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     339
     340    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     341
     342    *aAutoMount = m.autoMount;
     343
     344    return S_OK;
     345}
     346
    325347STDMETHODIMP SharedFolder::COMGETTER(LastAccessError) (BSTR *aLastAccessError)
    326348{
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30956 r31002  
    17191719}
    17201720
    1721 STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL /* aWritable */)
     1721STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName,        IN_BSTR aHostPath,
     1722                                            BOOL /* aWritable */, BOOL /* aAutoMount */)
    17221723{
    17231724    CheckComArgStrNotEmptyOrNull(aName);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r30976 r31002  
    13241324  <interface
    13251325    name="IVirtualBox" extends="$unknown"
    1326     uuid="2275c97d-31b0-41c7-a138-c77d3c28406e"
     1326    uuid="ec6cc7e7-06a2-4c5d-8993-1e3619c53817"
    13271327    wsmap="managed"
    13281328  >
     
    21732173      <param name="writable" type="boolean" dir="in">
    21742174        <desc>Whether the share is writable or readonly</desc>
     2175      </param>
     2176      <param name="automount" type="boolean" dir="in">
     2177        <desc>Whether the share gets automatically mounted by the guest
     2178          or not.</desc>
    21752179      </param>
    21762180    </method>
     
    38763880  <interface
    38773881     name="IMachine" extends="$unknown"
    3878      uuid="276e0f43-889b-4b87-b05f-35f1db814700"
     3882     uuid="de8f0b23-f285-4779-acf4-08eddda7ec75"
    38793883     wsmap="managed"
    38803884     >
     
    53825386      </param>
    53835387      <param name="writable" type="boolean" dir="in">
    5384         <desc>Whether the share is writable or readonly</desc>
     5388        <desc>Whether the share is writable or readonly.</desc>
     5389      </param>
     5390      <param name="automount" type="boolean" dir="in">
     5391        <desc>Whether the share gets automatically mounted by the guest
     5392          or not.</desc>
    53855393      </param>
    53865394    </method>
     
    59575965  <interface
    59585966     name="IConsole" extends="$unknown"
    5959      uuid="6375231a-c17c-464b-92cb-ae9e128d71c3"
     5967     uuid="9e467cff-98fc-4f5b-83aa-048d903694c9"
    59605968     wsmap="managed"
    59615969     >
     
    64706478      <param name="writable" type="boolean" dir="in">
    64716479        <desc>Whether the share is writable or readonly</desc>
     6480      </param>
     6481      <param name="automount" type="boolean" dir="in">
     6482        <desc>Whether the share gets automatically mounted by the guest
     6483          or not.</desc>
    64726484      </param>
    64736485    </method>
     
    1225912271  <interface
    1226012272     name="ISharedFolder" extends="$unknown"
    12261      uuid="64637bb2-9e17-471c-b8f3-f8968dd9884e"
     12273     uuid="8388da11-b559-4574-a5b7-2bd7acd5cef8"
    1226212274     wsmap="struct"
    1226312275     >
     
    1233412346        Whether the folder defined by the host path is writable or
    1233512347        not.
     12348      </desc>
     12349    </attribute>
     12350
     12351    <attribute name="autoMount" type="boolean" readonly="yes">
     12352      <desc>
     12353        Whether the folder gets automatically mounted by the guest or not.
    1233612354      </desc>
    1233712355    </attribute>
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r30832 r31002  
    145145    STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IUSBDevice **aDevice);
    146146    STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IUSBDevice **aDevice);
    147     STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
     147    STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
    148148    STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
    149149    STDMETHOD(TakeSnapshot)(IN_BSTR aName, IN_BSTR aDescription,
     
    389389    public:
    390390        SharedFolderData() {}
    391         SharedFolderData(Bstr aHostPath, BOOL aWritable)
     391        SharedFolderData(Bstr aHostPath, BOOL aWritable, BOOL aAutoMount)
    392392           : mHostPath(aHostPath)
    393            , mWritable(aWritable) {}
     393           , mWritable(aWritable)
     394           , mAutoMount(aAutoMount) {}
    394395        SharedFolderData(const SharedFolderData& aThat)
    395396           : mHostPath(aThat.mHostPath)
    396            , mWritable(aThat.mWritable) {}
     397           , mWritable(aThat.mWritable)
     398           , mAutoMount(aThat.mAutoMount) {}
    397399        Bstr mHostPath;
    398400        BOOL mWritable;
     401        BOOL mAutoMount;
    399402    };
    400403    typedef std::map <Bstr, ComObjPtr<SharedFolder> > SharedFolderMap;
  • trunk/src/VBox/Main/include/MachineImpl.h

    r30956 r31002  
    487487    STDMETHOD(FindSnapshot)(IN_BSTR aName, ISnapshot **aSnapshot);
    488488    STDMETHOD(SetCurrentSnapshot)(IN_BSTR aId);
    489     STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
     489    STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
    490490    STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
    491491    STDMETHOD(CanShowConsoleWindow)(BOOL *aCanShow);
  • trunk/src/VBox/Main/include/SharedFolderImpl.h

    r30764 r31002  
    55
    66/*
    7  * Copyright (C) 2006-2009 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3737        const Bstr hostPath;
    3838        BOOL       writable;
     39        BOOL       autoMount;
    3940        Bstr       lastAccessError;
    4041    };
     
    5859
    5960    // public initializer/uninitializer for internal purposes only
    60     HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
     61    HRESULT init(Machine *aMachine, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
    6162    HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
    62     HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
    63     HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable);
     63    HRESULT init(Console *aConsole, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
     64    HRESULT init(VirtualBox *aVirtualBox, CBSTR aName, CBSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
    6465    void uninit();
    6566
     
    6970    STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
    7071    STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
     72    STDMETHOD(COMGETTER(AutoMount)) (BOOL *aAutoMount);
    7173    STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
    7274
     
    8082    const Bstr& getHostPath() const { return m.hostPath; }
    8183    BOOL isWritable() const { return m.writable; }
     84    BOOL isAutoMounted() const { return m.autoMount; }
    8285
    8386protected:
    8487
    8588    HRESULT protectedInit(VirtualBoxBase *aParent,
    86                           CBSTR aName, CBSTR aHostPath, BOOL aWritable);
    87 
     89                          CBSTR aName, CBSTR aHostPath,
     90                          BOOL aWritable, BOOL aAutoMount);
    8891private:
    8992
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r30956 r31002  
    150150
    151151    STDMETHOD(GetGuestOSType) (IN_BSTR aId, IGuestOSType **aType);
    152     STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable);
     152    STDMETHOD(CreateSharedFolder) (IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
    153153    STDMETHOD(RemoveSharedFolder) (IN_BSTR aName);
    154154    STDMETHOD(GetExtraDataKeys) (ComSafeArrayOut(BSTR, aKeys));
  • trunk/src/VBox/Main/xml/Settings.cpp

    r30983 r31002  
    14381438                  && (strHostPath   == g.strHostPath)
    14391439                  && (fWritable     == g.fWritable)
     1440                  && (fAutoMount    == g.fAutoMount)
    14401441                )
    14411442           );
     
    24972498                pelmFolder->getAttributeValue("hostPath", sf.strHostPath);
    24982499                pelmFolder->getAttributeValue("writable", sf.fWritable);
     2500                pelmFolder->getAttributeValue("autoMount", sf.fAutoMount);
    24992501                hw.llSharedFolders.push_back(sf);
    25002502            }
     
    35403542        pelmThis->setAttribute("hostPath", sf.strHostPath);
    35413543        pelmThis->setAttribute("writable", sf.fWritable);
     3544        pelmThis->setAttribute("autoMount", sf.fAutoMount);
    35423545    }
    35433546
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