VBoxGuestR3LibSharedFolders.cpp revision 6d22c1a25757a476158a4ed2b463f6baf09ae813
/* $Id$ */
/** @file
* VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "VBGLR3Internal.h"
/**
* Connects to the shared folder service.
*
* @returns VBox status code
* @param pu32ClientId Where to put the client id on success. The client id
* must be passed to all the other calls to the service.
*/
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
}
return rc;
}
/**
* Disconnect from the shared folder service.
*
* @returns VBox status code.
* @param u32ClientId The client id returned by VbglR3InfoSvcConnect().
*/
{
if (RT_SUCCESS(rc))
return rc;
}
/**
* Checks whether a shared folder share exists or not.
*
* @returns True if shared folder exists, false if not.
* @param u32ClientId The client id returned by VbglR3InfoSvcConnect().
* @param pszShareName Shared folder name to check.
*/
{
/** @todo Use some caching here? */
bool fFound = false;
&paMappings, &cMappings);
if (RT_SUCCESS(rc))
{
{
if ( RT_SUCCESS(rc)
&& *pszName)
{
fFound = true;
}
}
}
return fFound;
}
/**
* Get the list of available shared folders.
*
* @returns VBox status code.
* @param u32ClientId The client id returned by VbglR3SharedFolderConnect().
* @param fAutoMountOnly Flag whether only auto-mounted shared folders
* should be reported.
* @param ppaMappings Allocated array which will retrieve the mapping info. Needs
* to be freed with VbglR3SharedFolderFreeMappings() later.
* @param pcMappings The number of mappings returned in @a ppaMappings.
*/
{
/* Set the mapping flags. */
if (fAutoMountOnly) /* We only want the mappings which get auto-mounted. */
/*
* Prepare and get the actual mappings from the host service.
*/
int rc = VINF_SUCCESS;
if (ppaMappingsTemp == NULL)
rc = VERR_NO_MEMORY;
*pcMappings = 0;
do
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
/* Do we have more mappings than we have allocated space for? */
if (rc == VINF_BUFFER_OVERFLOW)
{
cMappings = *pcMappings;
}
else
}
}
} while (rc == VINF_BUFFER_OVERFLOW);
return rc;
}
/**
* Frees the shared folder mappings allocated by
* VbglR3SharedFolderGetMappings() before.
*
* @param paMappings What
*/
{
}
/**
* Get the real name of a shared folder.
*
* @returns VBox status code.
* @param u32ClientId The client id returned by VbglR3InvsSvcConnect().
* @param u32Root Root ID of shared folder to get the name for.
* @param ppszName Where to return the name string. This shall be
* freed by calling RTStrFree.
*/
{
int rc;
if (pString)
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
}
}
}
else
return rc;
}