GuestCtrlImplFile.cpp revision a7014c99617f226a35a6a46a5b4bddcc6e0c17e0
/* $Id: */
/** @file
* VirtualBox Guest Control - Guest file handling.
*/
/*
* Copyright (C) 2011 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 "GuestImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "Global.h"
#include "ConsoleImpl.h"
#include "ProgressImpl.h"
#include "VMMDev.h"
#include "AutoCaller.h"
#include "Logging.h"
#ifdef VBOX_WITH_GUEST_CONTROL
#endif
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else /* VBOX_WITH_GUEST_CONTROL */
using namespace guestControl;
/* Do not allow anonymous executions (with system rights). */
/* If filename ends with a slash or backslash we assume it's a directory and
* call the appropriate function instead the regular one just for files. */
{
}
return fileExistsInternal(aFile,
#endif
}
#ifdef VBOX_WITH_GUEST_CONTROL
HRESULT Guest::fileExistsInternal(IN_BSTR aFile, IN_BSTR aUsername, IN_BSTR aPassword, BOOL *aExists)
{
using namespace guestControl;
AutoCaller autoCaller(this);
int rc;
NULL /* No RTFSOBJINFO needed */,
{
switch (rc)
{
case VINF_SUCCESS:
break;
case VERR_FILE_NOT_FOUND:
break;
default:
break;
}
}
return hr;
}
int *pRC)
{
using namespace guestControl;
/* aUsername is optional. */
/* aPassword is optional. */
/* aObjInfo is optional. */
try
{
/*
* Prepare tool command line.
*/
/* We need to get output which is machine-readable in form
* of "key=value\0..key=value\0\0". */
/* Only the actual file name to chekc is needed for now. */
/*
* Execute guest process.
*/
hr = executeAndWaitForTool(Bstr(VBOXSERVICE_TOOL_STAT).raw(), Bstr("Querying file information").raw(),
{
int rc = VINF_SUCCESS;
{
#if 0
/* Dump the parsed stream contents to Log(). */
#endif
if (!pszFsType) /* Attribute missing? */
rc = VERR_NOT_FOUND;
if ( RT_SUCCESS(rc)
{
/* This is not critical for Main, so don't set hr --
* we will take care of rc then. */
}
if ( RT_SUCCESS(rc)
&& aObjInfo) /* Do we want object details? */
{
}
}
else
rc = VERR_NO_DATA;
if (pRC)
}
}
{
hr = E_OUTOFMEMORY;
}
return hr;
}
#endif /* VBOX_WITH_GUEST_CONTROL */
STDMETHODIMP Guest::FileQuerySize(IN_BSTR aFile, IN_BSTR aUsername, IN_BSTR aPassword, LONG64 *aSize)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else /* VBOX_WITH_GUEST_CONTROL */
using namespace guestControl;
/* Do not allow anonymous executions (with system rights). */
AutoCaller autoCaller(this);
return fileQuerySizeInternal(aFile,
#endif
}
#ifdef VBOX_WITH_GUEST_CONTROL
HRESULT Guest::fileQuerySizeInternal(IN_BSTR aFile, IN_BSTR aUsername, IN_BSTR aPassword, LONG64 *aSize)
{
using namespace guestControl;
int rc;
{
switch (rc)
{
case VINF_SUCCESS:
break;
case VERR_FILE_NOT_FOUND:
break;
default:
break;
}
}
return hr;
}
#endif /* VBOX_WITH_GUEST_CONTROL */