VBoxSharedFolders.cpp revision 3e6da1894f26075b74820b75bf5ef7e4a64070ed
/* $Id$ */
/** @file
* VBoxSharedFolders - Handling for shared folders
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "VBoxSharedFolders.h"
#include "VBoxTray.h"
#include "helpers.h"
#include <VBox/VBoxGuestLib.h>
int VBoxSharedFoldersAutoMount(void)
{
if (!RT_SUCCESS(rc))
else
{
&paMappings, &cMappings);
if (RT_SUCCESS(rc))
{
#if 0
{
Log(("VBoxTray: Hosts supports auto-mount root\n"));
}
else
{
#endif
{
if ( RT_SUCCESS(rc)
&& *pszName)
{
char *pszShareName = NULL;
&& pszShareName)
{
do
{
char szCurDrive[3];
/* Go straight to our network provider in order to get maximum lookup speed. */
/** @todo Figure out how to map the drives in a block (F,G,H, ...).
Save the mapping for later use. */
{
break;
}
else
{
LogRel(("VBoxTray: Mounting \"%s\" to \"%s\" resulted in dwErr = %ld\n", pszName, szCurDrive, dwErr));
switch (dwErr)
{
/*
* The local device specified by the lpLocalName member is already
* connected to a network resource. Try next drive ...
*/
case ERROR_ALREADY_ASSIGNED:
break;
default:
LogRel(("VBoxTray: Error while mounting shared folder \"%s\" to \"%s\", error = %ld\n",
break;
}
}
} while(cDrive <= 'Z');
if (cDrive > 'Z')
{
LogRel(("VBoxTray: No free driver letter found to assign shared folder \"%s\", aborting.\n", pszName));
break;
}
}
else
rc = VERR_NO_MEMORY;
}
else
Log(("VBoxTray: Error while getting the shared folder name for root node = %u, rc = %Rrc\n",
}
#if 0
}
#endif
}
else
}
return rc;
}
int VBoxSharedFoldersAutoUnmount(void)
{
if (!RT_SUCCESS(rc))
else
{
&paMappings, &cMappings);
if (RT_SUCCESS(rc))
{
{
if ( RT_SUCCESS(rc)
&& *pszName)
{
char *pszShareName = NULL;
&& pszShareName)
{
{
break;
}
else
{
switch (dwErr)
{
case ERROR_NOT_CONNECTED:
break;
default:
LogRel(("VBoxTray: Error while disconnecting shared folder \"%s\", error = %ld\n",
pszShareName, dwErr));
break;
}
}
}
else
rc = VERR_NO_MEMORY;
}
else
Log(("VBoxTray: Error while getting the shared folder name for root node = %u, rc = %Rrc\n",
}
}
else
}
return rc;
}