GuestDirectoryImpl.cpp revision b8bb9c9f6b8ebfd0a7d6df0c0289f9fe80241750
/* $Id$ */
/** @file
* VirtualBox Main - XXX.
*/
/*
* Copyright (C) 2012 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "GuestDirectoryImpl.h"
#include "GuestSessionImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "Global.h"
#include "AutoCaller.h"
#ifdef LOG_GROUP
#endif
#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc(("\n"));
return BaseFinalConstruct();
}
void GuestDirectory::FinalRelease(void)
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc(("strPath=%s, strFilter=%s, uFlags=%x\n",
/* Enclose the state transition NotReady->InInit->Ready. */
AutoInitSpan autoInitSpan(this);
/* Start the directory process on the guest. */
/* We want the long output format which contains all the object details. */
#if 0 /* Flags are not supported yet. */
#endif
/** @todo Recursion support? */
/*
* Start the process asynchronously and keep it around so that we can use
* it later in subsequent read() calls.
* Note: No guest rc available because operation is asynchronous.
*/
if (RT_SUCCESS(rc))
{
/* Confirm a successful initialization when it's the case. */
return rc;
}
return rc;
}
/**
* Uninitializes the instance.
* Called from FinalRelease().
*/
void GuestDirectory::uninit(void)
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady. */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
/////////////////////////////////////////////////////////////////////////////
{
AutoCaller autoCaller(this);
return S_OK;
}
{
AutoCaller autoCaller(this);
return S_OK;
}
// private methods
/////////////////////////////////////////////////////////////////////////////
// implementation of public methods
/////////////////////////////////////////////////////////////////////////////
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
/*
* Release autocaller before calling uninit.
*/
uninit();
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
int guestRc;
/*
* Note: The guest process can still be around to serve the next
* upcoming stream block next time.
*/
if ( RT_SUCCESS(rc)
{
if (rc == VERR_NOT_EQUAL)
}
if (RT_SUCCESS(rc))
{
{
if (RT_FAILURE(rc))
if (RT_SUCCESS(rc))
{
/* Create the object. */
if (RT_SUCCESS(rc))
if (RT_SUCCESS(rc))
{
/* Return info object to the caller. */
}
}
}
else
{
/* Nothing to read anymore. Tell the caller. */
}
}
{
switch (rc)
{
case VERR_GSTCTL_GUEST_ERROR:
break;
case VERR_ACCESS_DENIED:
hr = setError(VBOX_E_IPRT_ERROR, tr("Reading directory \"%s\" failed: Unable to read / access denied"),
break;
case VERR_PATH_NOT_FOUND:
break;
case VERR_NO_MORE_FILES:
/* See SDK reference. */
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}