VBoxManageMisc.cpp revision dc09cb937d0a66e030b4d7bef88dec429f41e060
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * VBoxManage - VirtualBox's command-line interface.
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * Copyright (C) 2006-2009 Oracle Corporation
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * available from http://www.virtualbox.org. This file is free software;
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * you can redistribute it and/or modify it under the terms of the GNU
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * General Public License (GPL) as published by the Free Software
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync/*******************************************************************************
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync* Header Files *
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync*******************************************************************************/
4bcaf5d320bf0d88910212509c37bdd634e0879evboxsync#endif /* !VBOX_ONLY_DOCS */
1d94ccd0c6d838a45dea3a79ba295adc4caabcf9vboxsyncusing namespace com;
218c5abcfe14c89d04353015e755a02447960018vboxsync return errorSyntax(USAGE_REGISTERVM, "Incorrect number of parameters");
9d508d63ddd8cbaa227c3e3176bb376ba98ffa53vboxsync /** @todo Ugly hack to get both the API interpretation of relative paths
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * and the client's interpretation of relative paths. Remove after the API
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync * has been redesigned. */
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync rc = a->virtualBox->OpenMachine(Bstr(a->argv[0]), machine.asOutParam());
e7e589ca404045e288030a4151e57b63976cb39dvboxsync int vrc = RTPathAbs(a->argv[0], szVMFileAbs, sizeof(szVMFileAbs));
9d508d63ddd8cbaa227c3e3176bb376ba98ffa53vboxsync RTPrintf("Cannot convert filename \"%s\" to absolute path\n", a->argv[0]);
df277f214bcaae98f80456ec998330eaa7460ecavboxsync CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(szVMFileAbs), machine.asOutParam()));
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(a->argv[0]), machine.asOutParam()));
b4514c911ccdb647c9c0f503f3cee0660f41104avboxsync CHECK_ERROR(a->virtualBox, RegisterMachine(machine));
b4514c911ccdb647c9c0f503f3cee0660f41104avboxsync { "-delete", 'd', RTGETOPT_REQ_NOTHING }, // deprecated
52f16f53a955f5b24bc2132c418a5fffb700f089vboxsync bool fDelete = false;
52f16f53a955f5b24bc2132c418a5fffb700f089vboxsync // start at 0 because main() has hacked both the argc and argv given to us
52f16f53a955f5b24bc2132c418a5fffb700f089vboxsync RTGetOptInit(&GetState, a->argc, a->argv, g_aUnregisterVMOptions, RT_ELEMENTS(g_aUnregisterVMOptions),
9d508d63ddd8cbaa227c3e3176bb376ba98ffa53vboxsync return errorSyntax(USAGE_UNREGISTERVM, "Invalid parameter '%s'", ValueUnion.psz);
e45e3ae4a834169539e689759ba6b3ac71bfe40fvboxsync return errorSyntax(USAGE_UNREGISTERVM, "Invalid option -%c", c);
else if (c == VERR_GETOPT_UNKNOWN_OPTION)
if (!VMName)
if (machine)
bool fRegister = false;
for (int i = 0; i < a->argc; i++)
fRegister = true;
if (!name)
if (fRegister)
#ifdef VBOX_WITH_VBOXSDL
#ifdef VBOX_WITH_VRDP
#ifdef VBOX_WITH_HEADLESS
case VINF_GETOPT_NOT_OPTION:
if (!VMName)
if (RT_C_IS_PRINT(c))
else if (c == VERR_GETOPT_UNKNOWN_OPTION)
if (!VMName)
if (machine)
if (pszDisplay)
if (pszXAuth)
if (machine)
if (machine)
for (size_t i = 0;
if (machine)
for (size_t i = 0;
if (machine)
int vrc;
if (!machine)
bool fTransient = false;
bool fWritable = true;
fWritable = false;
fTransient = true;
if (fTransient)
if (console)
bool fTransient = false;
fTransient = true;
if (!name)
if (fTransient)
if (console)
bool fReset = false;
bool fWithDescriptions = false;
if (pszPattern)
fWithDescriptions = true;
fReset = true;
if (fReset)