VBoxServiceControlExec.cpp revision 908de807ce469f0659d73de24dfd088abc1a16d0
/* $Id$ */
/** @file
* VBoxServiceControlExec - Utility functions for process execution.
*/
/*
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <iprt/semaphore.h>
#include <VBox/VBoxGuestLib.h>
#include "VBoxServiceInternal.h"
#include "VBoxServiceUtils.h"
using namespace guestControl;
extern RTLISTNODE g_GuestControlExecThreads;
/**
* Handle an error event on standard input.
*
* @returns IPRT status code.
* @param hPollSet The polling set.
* @param fPollEvt The event mask returned by RTPollNoResume.
* @param phStdInW The standard input pipe handle.
* @param pStdInBuf The standard input buffer.
*/
static int VBoxServiceControlExecProcHandleStdInErrorEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phStdInW,
{
if (RT_SUCCESS(rc))
{
*phStdInW = NIL_RTPIPE;
/* Mark the stdin buffer as dead; we're not using it anymore. */
if (RT_SUCCESS(rc))
}
return rc;
}
/**
* Try write some more data to the standard input of the child.
*
* @returns IPRT status code.
* @retval VINF_TRY_AGAIN if there is still data left in the buffer.
*
* @param pStdInBuf The standard input buffer.
* @param hStdInW The standard input pipe.
* @param pfClose Pointer to a flag whether the pipe needs to be closed afterwards.
*/
static int VBoxServiceControlExecProcWriteStdIn(PVBOXSERVICECTRLEXECPIPEBUF pStdInBuf, RTPIPE hStdInW,
{
if (RT_SUCCESS(rc))
{
*pfClose = false;
{
if (RT_SUCCESS(rc))
{
pStdInBuf->fNeedNotification = true;
if (rc == VINF_TRY_AGAIN)
{
//if (pStdInBuf->fNeedNotification)
}
else
{
}
/* Did somebody tell us that we should come to an end,
* e.g. no more data coming in? */
if (pStdInBuf->fPendingClose)
{
/* When we wrote out all data in the buffer we
* can finally shutdown. */
{
*pfClose = true;
}
else if (pStdInBuf->fNeedNotification)
{
/* Still data to push out - so we need another
* poll round! Write something into the notification pipe. */
/* Disable notification until it is set again on successful write. */
}
}
}
else
{
*pcbWritten = 0;
}
#ifdef DEBUG
VBoxServiceVerbose(1, "ControlExec: Written StdIn: cbOffset=%u, pcbWritten=%u, rc=%Rrc, cbAlloc=%u, cbSize=%u\n",
#endif
}
else
{
*pcbWritten = 0;
//rc = VERR_BAD_PIPE;
}
if (RT_SUCCESS(rc))
}
return rc;
}
/**
* Handle an event indicating we can write to the standard input pipe of the
* child process.
*
* @returns IPRT status code.
* @param hPollSet The polling set.
* @param fPollEvt The event mask returned by RTPollNoResume.
* @param phStdInW The standard input pipe.
* @param pStdInBuf The standard input buffer.
* @param pcbWritten Where to return the number of bytes written.
*/
static int VBoxServiceControlExecProcHandleStdInWritableEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phStdInW,
{
int rc;
if (!(fPollEvt & RTPOLL_EVT_ERROR))
{
bool fClose;
if (rc == VINF_TRY_AGAIN)
rc = VINF_SUCCESS;
if (RT_FAILURE(rc))
{
if ( rc == VERR_BAD_PIPE
|| rc == VERR_BROKEN_PIPE)
{
}
else
{
/** @todo Do we need to do something about this error condition? */
}
}
else if (fClose)
{
/* If the pipe needs to be closed, do so. */
}
}
else
{
*pcbWritten = 0;
}
return rc;
}
/**
* Handle a transport event or successful pfnPollIn() call.
*
* @returns IPRT status code from client send.
* @retval VINF_EOF indicates ABORT command.
*
* @param hPollSet The polling set.
* @param fPollEvt The event mask returned by RTPollNoResume.
* @param idPollHnd The handle ID.
* @param hStdInW The standard input pipe.
* @param pStdInBuf The standard input buffer.
*/
static int VBoxServiceControlExecProcHandleTransportEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, uint32_t idPollHnd,
{
return 0; //RTPollSetAddPipe(hPollSet, *phStdInW, RTPOLL_EVT_WRITE, 4 /*TXSEXECHNDID_STDIN_WRITABLE*/);
}
/**
* Handle pending output data or error on standard out, standard error or the
* test pipe.
*
* @returns IPRT status code from client send.
* @param pThread The thread specific data.
* @param hPollSet The polling set.
* @param fPollEvt The event mask returned by RTPollNoResume.
* @param phPipeR The pipe handle.
* @param uHandleId The handle ID.
*
* @todo Put the last 4 parameters into a struct!
*/
static int VBoxServiceControlExecProcHandleOutputEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phPipeR,
{
#ifdef DEBUG
#endif
/*
* Try drain the pipe before acting on any errors.
*/
int rc = VINF_SUCCESS;
{
#if 0
if (RT_FAILURE(rc))
{
VBoxServiceError("ControlExec: Error while sending real-time output data, rc=%Rrc, cbRead=%u, CID=%u, PID=%u\n",
}
else
{
#endif
if (RT_SUCCESS(rc))
{
/* Make sure we go another poll round in case there was too much data
for the buffer to hold. */
}
#if 0
}
#endif
}
else if (RT_FAILURE(rc2))
{
}
/*
*/
if (fPollEvt & RTPOLL_EVT_ERROR)
{
*phPipeR = NIL_RTPIPE;
}
return rc;
}
/**
* TODO
*
* @return IPRT status code.
* @param pThread
* @param hProcess
* @param cMillies
* @param hPollSet
* @param hStdInW
* @param hStdOutR
* @param hStdErrR
*/
{
int rc;
int rc2;
bool fProcessAlive = true;
bool fProcessTimedOut = false;
? 100 /* Need to poll for input. */
: 1000; /* Need only poll for process exit and aborts. */
RTMSINTERVAL cMsPollCur = 0;
/* Assign PID to thread data. */
/*
* Before entering the loop, tell the host that we've started the guest
* and that it's now OK to send input to the process.
*/
/*
* Process input, output, the test pipe and client requests.
*/
while ( RT_SUCCESS(rc)
{
/*
*/
continue;
cMsPollCur = 0; /* No rest until we've checked everything. */
if (RT_SUCCESS(rc2))
{
#ifdef DEBUG
#endif
switch (idPollHnd)
{
break;
{
/* Drain the notification pipe. */
}
/* Fall through. */
{
break;
}
break;
break;
default:
break;
}
break; /* Abort command, or client dead or something. */
continue;
}
/*
* Check for process death.
*/
if (fProcessAlive)
{
if (RT_SUCCESS_NP(rc2))
{
fProcessAlive = false;
continue;
}
continue;
{
fProcessAlive = false;
AssertFailed();
}
else
}
/*
* If the process has terminated, we're should head out.
*/
if (!fProcessAlive)
break;
/*
* Check for timed out, killing the process.
*/
if (cMsTimeout != RT_INDEFINITE_WAIT)
{
if (cMsElapsed >= cMsTimeout)
{
VBoxServiceVerbose(3, "ControlExec: Process timed out (%ums elapsed > %ums timeout), killing ...", cMsElapsed, cMsTimeout);
fProcessTimedOut = true;
if ( MsProcessKilled == UINT64_MAX
{
break; /* Give up after 20 mins. */
continue;
}
cMilliesLeft = 10000;
}
else
}
/* Reset the polling interval since we've done all pending work. */
/*
* Need to exit?
*/
break;
}
/*
* Try kill the process if it's still alive at this point.
*/
if (fProcessAlive)
{
if (MsProcessKilled == UINT64_MAX)
{
RTThreadSleep(500);
}
for (size_t i = 0; i < 10; i++)
{
if (RT_SUCCESS(rc2))
{
fProcessAlive = false;
break;
}
if (i >= 5)
{
}
}
if (fProcessAlive)
}
/*
* If we don't have a client problem (RT_FAILURE(rc) we'll reply to the
* clients exec packet now.
*/
if (RT_SUCCESS(rc))
{
/* Since the process is not alive anymore, destroy its local
* stdin pipe buffer - it's not used anymore and can eat up quite
* a bit of memory. */
{
}
{
}
{
VBoxServiceVerbose(3, "ControlExec: Process got terminated because system/service is about to shutdown\n");
}
else if (fProcessAlive)
{
VBoxServiceError("ControlExec: Process is alive when it should not!\n");
}
else if (MsProcessKilled != UINT64_MAX)
{
VBoxServiceError("ControlExec: Process has been killed when it should not!\n");
}
{
}
{
}
{
}
else
{
VBoxServiceError("ControlExec: Process has reached an undefined status!\n");
}
}
else
return rc;
}
/**
* Sets up the redirection / pipe / nothing for one of the standard handles.
*
* @returns IPRT status code. No client replies made.
* @param fd Which standard handle it is (0 == stdin, 1 ==
* stdout, 2 == stderr).
* @param ph The generic handle that @a pph may be set
* pointing to. Always set.
* @param pph Pointer to the RTProcCreateExec argument.
* Always set.
* @param phPipe Where to return the end of the pipe that we
* should service. Always set.
*/
{
*phPipe = NIL_RTPIPE;
int rc;
/*
* to represent the "other" end to phPipe.
*/
if (fd == 0) /* stdin? */
{
/* Connect a wrtie pipe specified by phPipe to stdin. */
}
else /* stdout or stderr? */
{
/* Connect a read pipe specified by phPipe to stdout or stderr. */
}
if (RT_FAILURE(rc))
return rc;
return rc;
}
/**
* Initializes a pipe buffer.
*
* @returns IPRT status code.
* @param pBuf The pipe buffer to initialize.
* @param fNeedNotificationPipe Whether the buffer needs a notification
* pipe or not.
*/
static int VBoxServiceControlExecInitPipeBuffer(PVBOXSERVICECTRLEXECPIPEBUF pBuf, bool fNeedNotificationPipe)
{
/** @todo Add allocation size as function parameter! */
pBuf->fPendingClose = false;
{
if (RT_FAILURE(rc))
}
return rc;
}
/**
* Deletes a pipe buffer.
*
* @param pBuf The pipe buffer.
*/
{
{
pBuf->cbAllocated = 0;
}
}
/**
* TODO
*
* @return IPRT status code.
* @param pBuf
* @param pbBuffer
* @param cbBuffer
* @param pcbToRead
*/
{
if (RT_SUCCESS(rc))
{
if (*pcbToRead > 0)
{
}
else
{
*pcbToRead = 0;
}
}
return rc;
}
/**
* TODO
*
* @return IPRT status code.
* @param pBuf
* @param pbData
* @param cbData
* @param fPendingClose
* @param pcbWritten
*/
{
int rc;
{
if (RT_SUCCESS(rc))
{
/* Rewind the buffer if it's empty. */
if (fAddToSet)
/* Try and see if we can simply append the data. */
{
}
else
{
/* Move any buffered data to the front. */
if (cbInBuf == 0)
{
}
/* Do we need to grow the buffer? */
{
if (pvNew)
{
}
else
rc = VERR_NO_MEMORY;
}
/* Finally, copy the data. */
if (RT_SUCCESS(rc))
{
{
}
else
}
}
if (RT_SUCCESS(rc))
{
/* Report back written bytes. */
*pcbWritten = cbData;
/*
* next time we have the chance to.
*/
if (fPendingClose)
/*
* Wake up the thread servicing the process so it can feed it
* (if we have a notification helper pipe).
*/
if (pBuf->fNeedNotification)
{
/* Disable notification until it is set again on successful write. */
}
}
if (RT_SUCCESS(rc))
}
}
else
rc = VERR_BAD_PIPE;
return rc;
}
/**
* Allocates and gives back a thread data struct which then can be used by the worker thread.
* Needs to be freed with VBoxServiceControlExecDestroyThreadData().
*
* @return IPRT status code.
* @param pThread
* @param u32ContextID
* @param pszCmd
* @param uFlags
* @param pszArgs
* @param uNumArgs
* @param pszEnv
* @param cbEnv
* @param uNumEnvVars
* @param pszUser
* @param pszPassword
* @param uTimeLimitMS
*/
{
/* General stuff. */
/* ClientID will be assigned when thread is started! */
/* Specific stuff. */
PVBOXSERVICECTRLTHREADDATAEXEC pData = (PVBOXSERVICECTRLTHREADDATAEXEC)RTMemAlloc(sizeof(VBOXSERVICECTRLTHREADDATAEXEC));
return VERR_NO_MEMORY;
pData->uNumEnvVars = 0;
/* Prepare argument list. */
/* Did we get the same result? */
if (RT_SUCCESS(rc))
{
/* Prepare environment list. */
if (uNumEnvVars)
{
uint32_t i = 0;
{
/* sanity check */
if (i >= uNumEnvVars)
{
break;
}
if (cbStr < 0)
{
break;
}
}
}
/* Adjust time limit value. */
|| uTimeLimitMS == 0)
/* Init buffers. */
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
}
}
if (RT_FAILURE(rc))
{
}
else
{
}
return rc;
}
/**
* Frees an allocated thread data structure along with all its allocated parameters.
*
* @param pData Pointer to thread data to free.
*/
{
if (pData)
{
if (pData->uNumEnvVars)
{
}
}
}
/** @todo Maybe we want to have an own IPRT function for that! */
{
int rc = VINF_SUCCESS;
#ifdef RT_OS_WINDOWS
#else
/* No expansion for non-Windows yet. */
#endif
#ifdef DEBUG
#endif
return rc;
}
int VBoxServiceControlExecResolveExecutable(const char *pszFileName, char *pszResolved, size_t cbResolved)
{
int rc = VINF_SUCCESS;
/* Search the path of our executable. */
char szVBoxService[RTPATH_MAX];
{
char *pszExecResolved = NULL;
{
/* We just want to execute VBoxService (no toolbox). */
}
#ifdef VBOXSERVICE_TOOLBOX
{
/* We want to use the internal toolbox (all internal
* tools are starting with "vbox_" (e.g. "vbox_cat"). */
}
#endif
else /* Nothing to resolve, copy original. */
#ifdef DEBUG
#endif
}
return rc;
}
#ifdef VBOXSERVICE_TOOLBOX
/**
* Constructs the argv command line of a VBoxService program
* by first appending the full path of VBoxService along with the given
* tool name (e.g. "vbox_cat") + the tool's actual command line parameters.
*
* @return IPRT status code.
* @param pszFileName File name (full path) of this process.
* @param papszArgs Original argv command line from the host.
* @param ppapszArgv Pointer to a pointer with the new argv command line.
* Needs to be freed with RTGetOptArgvFree.
*/
int VBoxServiceControlExecPrepareArgv(const char *pszFileName,
const char * const *papszArgs, char ***ppapszArgv)
{
bool fUseToolbox = false;
fUseToolbox = true;
/* Skip argv[0] (= file name) if we don't run an internal
* VBoxService toolbox command - we already have a resolved one in pszFileName. */
char *pszArgs;
RTGETOPTARGV_CNV_QUOTE_MS_CRT); /* RTGETOPTARGV_CNV_QUOTE_BOURNE_SH */
if ( RT_SUCCESS(rc)
&& pszArgs)
{
/*
* Construct the new command line by appending the actual
* tool name to new process' command line.
*/
char szArgsExp[RTPATH_MAX];
if (RT_SUCCESS(rc))
{
char *pszNewArgs;
{
#ifdef DEBUG
#endif
int iNumArgsIgnored;
}
}
}
else /* No arguments given, just use the resolved file name as argv[0]. */
{
int iNumArgsIgnored;
}
return rc;
}
#endif
/**
* TODO
*
* @return IPRT status code.
* @param pszExec
* @param papszArgs
* @param hEnv
* @param fFlags
* @param phStdIn
* @param phStdOut
* @param phStdErr
* @param pszAsUser
* @param pszPassword
* @param phProcess
*/
int VBoxServiceControlExecCreateProcess(const char *pszExec, const char * const *papszArgs, RTENV hEnv, uint32_t fFlags,
{
int rc = VINF_SUCCESS;
#ifdef RT_OS_WINDOWS
/*
* If sysprep should be executed do this in the context of VBoxService, which
* (usually, if started by SCM) has administrator rights. Because of that a UI
* won't be shown (doesn't have a desktop).
*/
{
/* Get the predefined path of sysprep.exe (depending on Windows OS). */
{
if (RT_SUCCESS(rc))
}
return rc;
}
#endif /* RT_OS_WINDOWS */
/*
* Do the environment variables expansion on executable and arguments.
*/
char szExecExp[RTPATH_MAX];
if (RT_SUCCESS(rc))
{
char **papszArgsExp;
if (RT_SUCCESS(rc))
{
uint32_t uProcFlags = 0;
if (fFlags)
{
/* Process Main flag "ExecuteProcessFlag_Hidden". */
}
/* If no user name specified run with current credentials (e.g.
*
* Otherwise use the RTPROC_FLAGS_SERVICE to use some special authentication
* code (at least on Windows) for running processes as different users
* started from our system service. */
/* Do normal execution. */
}
}
return rc;
}
/**
* The actual worker routine (lopp) for a started guest process.
*
* @return IPRT status code.
* @param PVBOXSERVICECTRLTHREAD Thread data associated with a started process.
*/
{
if (RT_FAILURE(rc))
{
VBoxServiceError("ControlExec: Thread failed to connect to the guest control service, aborted! Error: %Rrc\n", rc);
return rc;
}
bool fSignalled = false; /* Indicator whether we signalled the thread user event already. */
/*
* Create the environment.
*/
if (RT_SUCCESS(rc))
{
size_t i;
{
if (RT_FAILURE(rc))
break;
}
if (RT_SUCCESS(rc))
{
/*
* Setup the redirection of the standard stuff.
*/
/** @todo consider supporting: gcc stuff.c >file 2>&1. */
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
{
/*
* Create a poll set for the pipes and let the
* transport layer add stuff to it as well.
*/
if (RT_SUCCESS(rc))
{
rc = RTPollSetAddPipe(hPollSet, pData->pipeStdInW, RTPOLL_EVT_ERROR, VBOXSERVICECTRLPIPEID_STDIN_ERROR);
if (RT_SUCCESS(rc))
rc = RTPollSetAddPipe(hPollSet, hStdOutR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, VBOXSERVICECTRLPIPEID_STDOUT);
if (RT_SUCCESS(rc))
rc = RTPollSetAddPipe(hPollSet, hStdErrR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, VBOXSERVICECTRLPIPEID_STDERR);
if (RT_SUCCESS(rc))
rc = RTPollSetAddPipe(hPollSet, pData->pipeStdInW, RTPOLL_EVT_WRITE, VBOXSERVICECTRLPIPEID_STDIN_WRITABLE);
if (RT_SUCCESS(rc))
rc = RTPollSetAddPipe(hPollSet, pData->stdIn.hNotificationPipeR, RTPOLL_EVT_READ, VBOXSERVICECTRLPIPEID_STDIN_INPUT_NOTIFY);
if (RT_SUCCESS(rc))
{
&hProcess);
/*
* Tell the control thread that it can continue
* spawning services. This needs to be done after the new
* process has been started because otherwise signal handling
* on (Open) Solaris does not work correctly (see #5068).
*/
if (RT_FAILURE(rc2))
fSignalled = true;
if (RT_SUCCESS(rc))
{
/*
* Close the child ends of any pipes and redirected files.
*/
/* Enter the process loop. */
/*
* The handles that are no longer in the set have
* been closed by the above call in order to prevent
* the guest from getting stuck accessing them.
* So, NIL the handles to avoid closing them again.
*/
}
else /* Something went wrong; report error! */
{
VBoxServiceError("ControlExec: Could not start process '%s' (CID: %u)! Error: %Rrc\n",
if (RT_FAILURE(rc2))
VBoxServiceError("ControlExec: Could not report process start error! Error: %Rrc (process error %Rrc)\n",
}
}
}
}
}
}
}
}
/*
* If something went wrong signal the user event so that others don't wait
* forever on this thread.
*/
return rc;
}
/**
* Finds a (formerly) started process given by its PID.
*
* @return PVBOXSERVICECTRLTHREAD Process structure if found, otherwise NULL.
* @param uPID PID to search for.
*/
{
bool fFound = false;
{
{
{
return pNode;
}
}
}
return NULL;
}
/**
* Thread main routine for a started process.
*
* @return IPRT status code.
* @param RTTHREAD Pointer to the thread's data.
* @param void* User-supplied argument pointer.
*
*/
{
}
/**
* TODO
*
* @return int
* @param uContextID
* @param pszCmd
* @param uFlags
* @param pszArgs
* @param uNumArgs
* @param pszEnv
* @param cbEnv
* @param uNumEnvVars
* @param pszUser
* @param pszPassword
* @param uTimeLimitMS
*/
{
int rc;
if (pThread)
{
if (RT_SUCCESS(rc))
{
(void *)(PVBOXSERVICECTRLTHREAD*)pThread, 0,
if (RT_FAILURE(rc))
{
VBoxServiceError("ControlExec: RTThreadCreate failed, rc=%Rrc\n, pThread=%p\n",
}
else
{
/* Wait for the thread to initialize. */
{
}
else
{
}
}
if (RT_FAILURE(rc))
}
if (RT_FAILURE(rc))
}
else
rc = VERR_NO_MEMORY;
return rc;
}
/**
* TODO
*
* @return IPRT status code.
* @param u32ClientId
* @param uNumParms
*/
{
char szUser[128];
char szPassword[128];
#if 0 /* for valgrind */
#endif
if (uNumParms != 11)
return VERR_INVALID_PARAMETER;
/* Command */
/* Flags */
&uFlags,
/* Arguments */
/* Environment */
/* Credentials */
szPassword, sizeof(szPassword),
/* Timelimit */
&uTimeLimitMS);
#ifdef DEBUG
VBoxServiceVerbose(3, "ControlExec: Start process szCmd=%s, uFlags=%u, szArgs=%s, szEnv=%s, szUser=%s, szPW=%s, uTimeout=%u\n",
szCmd, uFlags, uNumArgs ? szArgs : "<None>", uNumEnvVars ? szEnv : "<None>", szUser, szPassword, uTimeLimitMS);
#endif
if (RT_SUCCESS(rc))
{
}
else
VBoxServiceVerbose(3, "ControlExec: VBoxServiceControlExecHandleCmdStartProcess returned with %Rrc\n", rc);
return rc;
}
/**
* Handles input for the started process by copying the received data into its
* stdin pipe.
*
* @returns IPRT status code.
* @param u32ClientId idClient The HGCM client session ID.
* @param uNumParms cParms The number of parameters the host is
* offering.
*/
int VBoxServiceControlExecHandleCmdSetInput(uint32_t u32ClientId, uint32_t uNumParms, size_t cbMaxBufSize)
{
/*
* Ask the host for the input data.
*/
if (RT_FAILURE(rc))
{
}
else if ( cbSize <= 0
|| cbSize > cbMaxBufSize)
{
}
else
{
/*
* Resolve the PID.
*/
#ifdef DEBUG
#endif
if (pNode)
{
/*
* Is this the last input block we need to deliver? Then let the pipe know ...
*/
bool fPendingClose = false;
if (uFlags & INPUT_FLAG_EOF)
fPendingClose = true;
#ifdef DEBUG
if (fPendingClose)
#endif
/*
* Feed the data to the pipe.
*/
rc = VBoxServiceControlExecWritePipeBuffer(&pData->stdIn, pabBuffer, cbSize, fPendingClose, &cbWritten);
#ifdef DEBUG
VBoxServiceVerbose(4, "ControlExec: Written to StdIn buffer (PID %u): rc=%Rrc, uFlags=0x%x, cbAlloc=%u, cbSize=%u, cbOffset=%u\n",
#endif
if (RT_SUCCESS(rc))
{
if (cbWritten) /* Did we write something? */
{
uFlags = 0;
}
}
else
{
if (rc == VERR_BAD_PIPE)
else if (rc == VERR_BUFFER_OVERFLOW)
else
{
}
}
if (uStatus > INPUT_STS_UNDEFINED)
{
/* Note: Since the context ID is unique the request *has* to be completed here,
* regardless whether we got data or not! Otherwise the progress object
* on the host never will get completed! */
}
}
else
}
VBoxServiceVerbose(3, "ControlExec: VBoxServiceControlExecHandleCmdSetInput returned with %Rrc\n", rc);
return rc;
}
/**
*
*
* @return IPRT status code.
* @param u32ClientId
* @param uNumParms
*/
{
if (RT_SUCCESS(rc))
{
if (pNode)
{
if (pBuf)
{
if (RT_SUCCESS(rc))
{
/* Note: Since the context ID is unique the request *has* to be completed here,
* regardless whether we got data or not! Otherwise the progress object
* on the host never will get completed! */
/* cbRead now contains actual size. */
}
}
else
rc = VERR_NO_MEMORY;
}
else
}
else
VBoxServiceVerbose(3, "ControlExec: VBoxServiceControlExecHandleCmdGetOutput returned with %Rrc\n", rc);
return rc;
}