VirtualBox

Ignore:
Timestamp:
Jul 23, 2010 12:10:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63977
Message:

Shared Folders/AutoMount: Update.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r31041 r31052  
    12741274    bool usageOK = true;
    12751275    bool fOnlyShowAutoMount = false;
    1276     if (   argc == 1
    1277         && (   RTStrICmp(argv[0], "-automount") == 0
     1276    if (argc == 1)
     1277    {
     1278        if (   RTStrICmp(argv[0], "-automount") == 0
    12781279            || RTStrICmp(argv[0], "/automount") == 0)
    1279        )
    1280     {
    1281         fOnlyShowAutoMount = true;
     1280        {
     1281            fOnlyShowAutoMount = true;
     1282        }
     1283        else
     1284            usageOK = false;
    12821285    }
    12831286    else if (argc > 1)
     
    12961299    else
    12971300    {
    1298         uint32_t cMappings = 64; /* See shflsvc.h for define; should be used later. */
    1299         uint32_t cbMappings = cMappings * sizeof(VBGLR3SHAREDFOLDERMAPPING);
    1300         VBGLR3SHAREDFOLDERMAPPING *paMappings = (PVBGLR3SHAREDFOLDERMAPPING)RTMemAlloc(cbMappings);
    1301 
    1302         if (paMappings)
    1303         {
    1304             rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount,
    1305                                                paMappings, cbMappings,
    1306                                                &cMappings);
    1307             if (RT_SUCCESS(rc))
     1301        PVBGLR3SHAREDFOLDERMAPPING paMappings;
     1302        uint32_t cMappings;
     1303        rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount,
     1304                                           &paMappings, &cMappings);
     1305        if (RT_SUCCESS(rc))
     1306        {
     1307            if (fOnlyShowAutoMount)
     1308                RTPrintf("Auto-mounted Shared Folder mappings (%u):\n\n", cMappings);
     1309            else
     1310                RTPrintf("Shared Folder mappings (%u):\n\n", cMappings);
     1311
     1312            for (uint32_t i = 0; i < cMappings; i++)
    13081313            {
    1309                 /* Maximum mappings, see shflsvc.h */
    1310                 if (cMappings > 64)
    1311                     cMappings = 64;
    1312                 RTPrintf("Shared Folder Mappings (%u):\n\n", cMappings);
    1313                 for (uint32_t i = 0; i < cMappings; i++)
     1314                char *pszName;
     1315                rc = VbglR3SharedFolderGetName(u32ClientId, paMappings[i].u32Root, &pszName);
     1316                if (RT_SUCCESS(rc))
    13141317                {
    1315                     char *pszName;
    1316                     rc = VbglR3SharedFolderGetName(u32ClientId, paMappings[i].u32Root, &pszName);
    1317                     if (RT_SUCCESS(rc))
    1318                     {
    1319                         RTPrintf("%02u - %s\n", i + 1, pszName);
    1320                         RTStrFree(pszName);
    1321                     }
    1322                     else
    1323                         VBoxControlError("Error while getting the shared folder name for root node = %u, rc = %Rrc\n",
    1324                                          paMappings[i].u32Root, rc);
     1318                    RTPrintf("%02u - %s\n", i + 1, pszName);
     1319                    RTStrFree(pszName);
    13251320                }
    1326                 if (cMappings == 0)
    1327                     RTPrintf("No Shared Folders available.\n");
     1321                else
     1322                    VBoxControlError("Error while getting the shared folder name for root node = %u, rc = %Rrc\n",
     1323                                     paMappings[i].u32Root, rc);
    13281324            }
    1329             else
    1330                 VBoxControlError("Error while getting the shared folder mappings, rc = %Rrc\n", rc);
    1331             RTMemFree(paMappings);
     1325            if (cMappings == 0)
     1326                RTPrintf("No Shared Folders available.\n");
     1327            VbglR3SharedFolderFreeMappings(paMappings);
    13321328        }
    13331329        else
    1334             rc = VERR_NO_MEMORY;
     1330            VBoxControlError("Error while getting the shared folder mappings, rc = %Rrc\n", rc);
    13351331        VbglR3SharedFolderDisconnect(u32ClientId);
    13361332    }
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