/* $Id$ */
/** @file
* VBoxAutostart - VirtualBox Autostart service, start machines during system boot.
* Utils used by the windows and posix frontends.
*/
/*
* 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.
*/
#include <algorithm>
#include <list>
#include <string>
#include "VBoxAutostart.h"
using namespace com;
{
switch (machineState)
{
case MachineState_PoweredOff:
case MachineState_Saved:
return "saved";
case MachineState_Teleported:
return "teleported";
case MachineState_Aborted:
return "aborted";
case MachineState_Running:
return "running";
case MachineState_Paused:
return "paused";
case MachineState_Stuck:
case MachineState_Teleporting:
return "teleporting";
case MachineState_Starting:
return "starting";
case MachineState_Stopping:
return "stopping";
case MachineState_Saving:
return "saving";
case MachineState_Restoring:
return "restoring";
case MachineState_SettingUp:
return "snapshotting";
default:
break;
}
return "unknown";
}
{
if (*pszFormat)
{
{
}
else
}
}
{
}
{
if (*pszFormat)
{
{
}
else
}
}
{
}
{
if (*pszFormat)
{
{
}
else
}
}
{
}
{
if (*pszFormat)
{
{
}
else
}
}
{
}
DECLHIDDEN(RTEXITCODE) autostartSvcLogGetOptError(const char *pszAction, int rc, int argc, char **argv, int iArg, PCRTGETOPTUNION pValue)
{
autostartSvcLogError("%s - RTGetOpt failure, %Rrc (%d): %s",
return RTEXITCODE_FAILURE;
}
DECLHIDDEN(RTEXITCODE) autostartSvcLogTooManyArgsError(const char *pszAction, int argc, char **argv, int iArg)
{
return RTEXITCODE_FAILURE;
}
{
}
{
}
DECLHIDDEN(RTEXITCODE) autostartSvcDisplayGetOptError(const char *pszAction, int rc, int argc, char **argv, int iArg, PCRTGETOPTUNION pValue)
{
autostartSvcDisplayError("%s - RTGetOpt failure, %Rrc (%d): %s\n",
return RTEXITCODE_FAILURE;
}
DECLHIDDEN(RTEXITCODE) autostartSvcDisplayTooManyArgsError(const char *pszAction, int argc, char **argv, int iArg)
{
return RTEXITCODE_FAILURE;
}
DECLHIDDEN(int) autostartSetup()
{
/*
* Initialize COM.
*/
using namespace com;
# ifdef VBOX_WITH_XPCOM
if (hrc == NS_ERROR_FILE_ACCESS_DENIED)
{
return RTMsgErrorExit(RTEXITCODE_FAILURE,
"Failed to initialize COM because the global settings directory '%s' is not accessible!", szHome);
}
# endif
{
{
RTMsgError("Most likely, the VirtualBox COM server is not running or failed to start.");
}
else
return RTEXITCODE_FAILURE;
}
/*
* Setup VirtualBox + session interfaces.
*/
{
}
else
return VERR_COM_OBJECT_NOT_FOUND;
return VINF_SUCCESS;
}
DECLHIDDEN(void) autostartShutdown()
{
}