VBoxManageControlVM.cpp revision cc74f15083bf80fbc96723a89faa06c15d0dead8
/* $Id$ */
/** @file
* VBoxManage - Implementation of controlvm command.
*/
/*
* Copyright (C) 2006-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 "VBoxManage.h"
#include <list>
/**
* Parses a number.
*
* @returns Valid number on success.
* @returns 0 if invalid number. All necessary bitching has been done.
* @param psz Pointer to the nic number.
*/
{
char *pszNext;
if ( RT_SUCCESS(rc)
&& *pszNext == '\0'
&& u32 >= 1
return (unsigned)u32;
return 0;
}
int handleControlVM(HandlerArg *a)
{
using namespace com;
if (a->argc < 2)
/* try to find the given machine */
machine.asOutParam()));
return 1;
/* open a session for the VM */
do
{
/* get the associated console */
/* ... and session machine */
/* which command? */
{
}
{
}
{
}
{
{
break;
}
}
{
{
break;
}
}
{
{
break;
}
}
{
{
if (info.isBasicAvailable())
else
RTMsgError("Failed to power off machine. No error message available!");
}
}
{
{
break;
}
{
if (info.isBasicAvailable())
else
RTMsgError("Failed to save machine state. No error message available!");
}
}
{
}
{
}
{
/* get the machine debugger. */
}
{
{
errorArgument("Missing argument to '%s'. Expected IBM PC AT set 2 keyboard scancode(s) as hex byte(s).", a->argv[1]);
break;
}
/* Process the command line. */
int i;
{
if ( RT_C_IS_XDIGIT (a->argv[i][0])
&& a->argv[i][2] == 0)
{
if (RT_FAILURE (irc))
{
break;
}
}
else
{
break;
}
}
break;
/* Send scancodes to the VM. */
ULONG codesStored = 0;
&codesStored));
{
break;
}
}
{
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
if (!n)
{
break;
}
{
break;
}
/* get the corresponding network adapter */
if (adapter)
{
{
}
{
}
else
{
break;
}
}
}
/* here the order in which strncmp is called is important
* cause nictracefile can be very well compared with
* nictrace and nic and thus everything will always fail
* if the order is changed
*/
{
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
if (!n)
{
break;
}
if (a->argc <= 2)
{
break;
}
/* get the corresponding network adapter */
if (adapter)
{
if (fEnabled)
{
if (a->argv[2])
{
}
else
{
errorArgument("Invalid filename or filename not specified for NIC %lu", n);
break;
}
}
else
RTMsgError("The NIC %d is currently disabled and thus can't change its tracefile", n);
}
}
{
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
if (!n)
{
break;
}
if (a->argc <= 2)
{
break;
}
/* get the corresponding network adapter */
if (adapter)
{
if (fEnabled)
{
{
}
{
}
else
{
break;
}
}
else
RTMsgError("The NIC %d is currently disabled and thus can't change its trace flag", n);
}
}
{
/* Get the number of network adapters */
ULONG NetworkAdapterCount = 0;
if (!n)
{
break;
}
if (a->argc <= 2)
{
break;
}
/* get the corresponding network adapter */
if (adapter)
{
if (fEnabled)
{
{
}
{
if (a->argc == 4)
}
{
if (a->argc <= 3)
{
break;
}
}
{
if (a->argc <= 3)
{
break;
}
}
#if defined(VBOX_WITH_NETFLT)
{
if (a->argc <= 3)
{
break;
}
}
#endif
else
{
break;
}
}
else
RTMsgError("The NIC %d is currently disabled and thus can't change its attachment type", n);
}
}
{
{
break;
}
if (vrdeServer)
{
{
}
{
}
else
{
break;
}
}
}
{
{
break;
}
if (vrdeServer)
{
ports = "0";
else
}
}
{
RTStrmPrintf(g_pStdErr, "Warning: 'vrdpvideochannelquality' is deprecated. Use 'vrdevideochannelquality'.\n");
{
break;
}
if (vrdeServer)
{
}
}
{
{
break;
}
if (vrdeServer)
{
/* Parse 'name=value' */
if (pszProperty)
{
if (pDelimiter)
{
*pDelimiter = '\0';
}
else
{
break;
}
}
else
{
}
}
{
break;
}
}
{
if (a->argc < 3)
{
break;
}
{
// assume address
if (attach)
{
dev.asOutParam()));
}
else
{
dev.asOutParam()));
}
}
if (attach)
else
{
dev.asOutParam()));
}
}
{
{
break;
}
uint32_t displayIdx = 0;
if (a->argc == 6)
}
{
bool fAllowLocalLogon = true;
if (a->argc == 7)
{
{
break;
}
fAllowLocalLogon = false;
}
else if (a->argc != 5)
{
break;
}
}
#if 0 /* TODO: review & remove */
{
if (a->argc != 3)
{
break;
}
/* unmount? */
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
{
if (!dvdMedium)
{
errorArgument("Invalid host DVD drive name \"%s\"",
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!dvdMedium)
{
}
}
if (!dvdMedium)
{
break;
}
}
/** @todo generalize this, allow arbitrary number of DVD drives
* and as a consequence multiple attachments and different
* storage controllers. */
if (dvdMedium)
else
}
{
if (a->argc != 3)
{
break;
}
/* unmount? */
{
/* nothing to do, NULL object will cause unmount */
}
/* host drive? */
{
if (!floppyMedium)
{
errorArgument("Invalid host floppy drive name \"%s\"",
break;
}
}
else
{
/* first assume it's a UUID */
{
/* must be a filename, check if it's in the collection */
/* not registered, do that on the fly */
if (!floppyMedium)
{
CHECK_ERROR(a->virtualBox, OpenFloppyImage(Bstr(a->argv[2]), emptyUUID, floppyMedium.asOutParam()));
}
}
if (!floppyMedium)
{
break;
}
}
}
#endif /* obsolete dvdattach/floppyattach */
{
if (a->argc != 3)
{
break;
}
int vrc;
if (vrc != VINF_SUCCESS)
{
break;
}
/* guest is running; update IGuest */
}
{
uint32_t cMsTimeout = 0;
static const RTGETOPTDEF s_aTeleportOptions[] =
{
};
RTGetOptInit(&GetOptState, a->argc, a->argv, s_aTeleportOptions, RT_ELEMENTS(s_aTeleportOptions), 2, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
int ch;
{
switch (ch)
{
case 'D': g_fDetailedProgress = true; break;
default:
break;
}
}
break;
bstrPassword.raw(),
progress.asOutParam()));
if (cMsTimeout)
{
}
{
if (info.isBasicAvailable())
else
RTMsgError("Teleportation failed. No error message available!");
}
}
else
{
}
} while (0);
a->session->UnlockMachine();
}