Changeset 68134 in vbox
- Timestamp:
- Jul 27, 2017 10:07:38 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r68133 r68134 1270 1270 RTEXITCODE handleUnattendedInstall(HandlerArg *a) 1271 1271 { 1272 HRESULT hrc; 1273 char szAbsPath[RTPATH_MAX]; 1274 1272 1275 /* 1273 * Options. 1276 * Options. We work directly on an IUnattended instace while parsing 1277 * the options. This saves a lot of extra clutter. 1274 1278 */ 1275 Utf8Str strAbsIsoPath; 1276 const char *pszIsoPath = NULL; 1277 const char *pszUser = NULL; 1278 const char *pszPassword = NULL; 1279 const char *pszFullUserName = NULL; 1280 const char *pszProductKey = NULL; 1281 Utf8Str strAbsAdditionsIsoPath; 1282 const char *pszAdditionsIsoPath = NULL; 1283 int fInstallAdditions = -1; 1284 Utf8Str strAbsValidationKitIsoPath; 1285 const char *pszValidationKitIsoPath = NULL; 1286 int fInstallTxs = -1; 1287 const char *pszMachineName = NULL; 1288 bool fSetImageIdx = false; 1289 uint32_t idxImage = 0; 1290 const char *pszLocale = NULL; 1291 const char *pszCountry = NULL; 1292 const char *pszTimeZone = NULL; 1293 const char *pszProxy = NULL; 1294 const char *pszHostname = NULL; 1295 RTCList<RTCString> arrPackageSelectionAdjustments; 1296 // advance options: 1297 Utf8Str strAbsAuxiliaryBasePath; 1298 const char *pszAuxiliaryBasePath = NULL; 1299 Utf8Str strAbsScriptTemplatePath; 1300 const char *pszScriptTemplatePath = NULL; 1301 Utf8Str strAbsPostInstallScriptTemplatePath; 1302 const char *pszPostInstallScriptTemplatePath = NULL; 1303 const char *pszPostInstallCommand = NULL; 1304 const char *pszExtraInstallKernelParameters = NULL; 1305 // start vm related options: 1306 const char *pszSessionType = "headless"; 1279 ComPtr<IUnattended> ptrUnattended; 1280 CHECK_ERROR2_RET(hrc, a->virtualBox, CreateUnattendedInstaller(ptrUnattended.asOutParam()), RTEXITCODE_FAILURE); 1281 RTCList<RTCString> arrPackageSelectionAdjustments; 1282 ComPtr<IMachine> ptrMachine; 1283 const char *pszSessionType = "headless"; 1307 1284 1308 1285 /* … … 1353 1330 { 1354 1331 case VINF_GETOPT_NOT_OPTION: 1355 if (p szMachineName)1332 if (ptrMachine.isNotNull()) 1356 1333 return errorSyntax(USAGE_UNATTENDEDINSTALL, "VM name/UUID given more than once!"); 1357 pszMachineName = ValueUnion.psz; 1358 if (*pszMachineName == '\0') 1359 return errorSyntax(USAGE_UNATTENDEDINSTALL, "VM name/UUID is empty!"); 1334 CHECK_ERROR2_RET(hrc, a->virtualBox, FindMachine(Bstr(ValueUnion.psz).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE); 1335 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Machine)(ptrMachine), RTEXITCODE_FAILURE); 1360 1336 break; 1361 1337 1362 1338 case 'i': // --iso 1363 vrc = RTPathAbs Cxx(strAbsIsoPath, ValueUnion.psz);1339 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1364 1340 if (RT_FAILURE(vrc)) 1365 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1366 pszIsoPath = strAbsIsoPath.c_str();1341 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1342 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(IsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1367 1343 break; 1368 1344 1369 1345 case 'u': // --user 1370 pszUser = ValueUnion.psz;1346 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(User)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1371 1347 break; 1372 1348 1373 1349 case 'p': // --password 1374 pszPassword = ValueUnion.psz;1350 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Password)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1375 1351 break; 1376 1352 1377 1353 case 'U': // --full-user-name 1378 pszFullUserName = ValueUnion.psz;1354 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(FullUserName)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1379 1355 break; 1380 1356 1381 1357 case 'k': // --key 1382 pszProductKey = ValueUnion.psz;1358 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ProductKey)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1383 1359 break; 1384 1360 1385 1361 case 'A': // --install-additions 1386 fInstallAdditions = true;1362 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(InstallGuestAdditions)(TRUE), RTEXITCODE_FAILURE); 1387 1363 break; 1388 1364 case 'N': // --no-install-additions 1389 fInstallAdditions = false;1365 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(InstallGuestAdditions)(FALSE), RTEXITCODE_FAILURE); 1390 1366 break; 1391 1367 case 'a': // --additions-iso 1392 vrc = RTPathAbs Cxx(strAbsAdditionsIsoPath, ValueUnion.psz);1368 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1393 1369 if (RT_FAILURE(vrc)) 1394 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1395 pszAdditionsIsoPath = strAbsAdditionsIsoPath.c_str();1370 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1371 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AdditionsIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1396 1372 break; 1397 1373 1398 1374 case 't': // --install-txs 1399 fInstallTxs = true;1375 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(InstallTestExecService)(TRUE), RTEXITCODE_FAILURE); 1400 1376 break; 1401 1377 case 'T': // --no-install-txs 1402 fInstallTxs = false;1378 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(InstallTestExecService)(FALSE), RTEXITCODE_FAILURE); 1403 1379 break; 1404 1380 case 'K': // --valiation-kit-iso 1405 vrc = RTPathAbs Cxx(strAbsValidationKitIsoPath, ValueUnion.psz);1381 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1406 1382 if (RT_FAILURE(vrc)) 1407 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1408 pszValidationKitIsoPath = strAbsValidationKitIsoPath.c_str();1383 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1384 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ValidationKitIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1409 1385 break; 1410 1386 1411 1387 case 'l': // --locale 1412 pszLocale = ValueUnion.psz;1388 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Locale)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1413 1389 break; 1414 1390 1415 1391 case 'L': // --country 1416 pszCountry = ValueUnion.psz;1392 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Country)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1417 1393 break; 1418 1394 1419 1395 case 'z': // --time-zone; 1420 pszTimeZone = ValueUnion.psz;1396 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(TimeZone)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1421 1397 break; 1422 1398 1423 1399 case 'y': // --proxy 1424 pszProxy = ValueUnion.psz;1400 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Proxy)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1425 1401 break; 1426 1402 1427 1403 case 'H': // --hostname 1428 pszHostname = ValueUnion.psz;1404 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Hostname)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1429 1405 break; 1430 1406 … … 1434 1410 1435 1411 case 'x': // --auxiliary-base-path 1436 vrc = RTPathAbs Cxx(strAbsAuxiliaryBasePath, ValueUnion.psz);1412 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1437 1413 if (RT_FAILURE(vrc)) 1438 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1439 pszAuxiliaryBasePath = strAbsAuxiliaryBasePath.c_str();1414 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1415 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AuxiliaryBasePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1440 1416 break; 1441 1417 1442 1418 case 'm': // --image-index 1443 idxImage = ValueUnion.u32; 1444 fSetImageIdx = true; 1419 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ImageIndex)(ValueUnion.u32), RTEXITCODE_FAILURE); 1445 1420 break; 1446 1421 1447 1422 case 'c': // --script-template 1448 vrc = RTPathAbs Cxx(strAbsScriptTemplatePath, ValueUnion.psz);1423 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1449 1424 if (RT_FAILURE(vrc)) 1450 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1451 pszScriptTemplatePath = strAbsScriptTemplatePath.c_str();1425 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1426 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1452 1427 break; 1453 1428 1454 1429 case 'C': // --post-install-script-template 1455 vrc = RTPathAbs Cxx(strAbsPostInstallScriptTemplatePath, ValueUnion.psz);1430 vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath)); 1456 1431 if (RT_FAILURE(vrc)) 1457 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs Cxxfailed on '%s': %Rrc", ValueUnion.psz, vrc);1458 pszPostInstallScriptTemplatePath = strAbsPostInstallScriptTemplatePath.c_str();1432 return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc); 1433 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PostInstallScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE); 1459 1434 break; 1460 1435 1461 1436 case 'P': // --post-install-command. 1462 pszPostInstallCommand = ValueUnion.psz;1437 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PostInstallCommand)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1463 1438 break; 1464 1439 1465 1440 case 'I': // --extra-install-kernel-parameters 1466 pszExtraInstallKernelParameters = ValueUnion.psz;1441 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ExtraInstallKernelParameters)(Bstr(ValueUnion.psz).raw()), RTEXITCODE_FAILURE); 1467 1442 break; 1468 1443 … … 1479 1454 * Check for required stuff. 1480 1455 */ 1481 if (p szMachineName == NULL)1456 if (ptrMachine.isNull()) 1482 1457 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID"); 1483 1458 1484 if (!pszIsoPath) 1485 return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing required --iso option"); 1459 /* 1460 * Set accumulative attributes. 1461 */ 1462 if (arrPackageSelectionAdjustments.size() == 1) 1463 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PackageSelectionAdjustments)(Bstr(arrPackageSelectionAdjustments[0]).raw()), 1464 RTEXITCODE_FAILURE); 1465 else if (arrPackageSelectionAdjustments.size() > 1) 1466 { 1467 RTCString strAdjustments; 1468 strAdjustments.join(arrPackageSelectionAdjustments, ";"); 1469 CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PackageSelectionAdjustments)(Bstr(strAdjustments).raw()), RTEXITCODE_FAILURE); 1470 } 1471 1486 1472 1487 1473 /* 1488 1474 * Prepare. 1489 1475 */ 1490 1491 /* try to find the given machine */ 1476 Bstr bstrMachineName; 1477 CHECK_ERROR2_RET(hrc, ptrMachine, COMGETTER(Name)(bstrMachineName.asOutParam()), RTEXITCODE_FAILURE); 1478 Bstr bstrUuid; 1479 CHECK_ERROR2_RET(hrc, ptrMachine, COMGETTER(Id)(bstrUuid.asOutParam()), RTEXITCODE_FAILURE); 1480 BSTR bstrInstalledOS; 1481 CHECK_ERROR2_RET(hrc, ptrMachine, COMGETTER(OSTypeId)(&bstrInstalledOS), RTEXITCODE_FAILURE); 1482 Utf8Str strInstalledOS(bstrInstalledOS); 1483 1484 /* open a session for the VM */ 1485 CHECK_ERROR2_RET(hrc, ptrMachine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE); 1486 1487 /* get the associated console */ 1492 1488 HRESULT rc; 1493 ComPtr<IMachine> machine;1494 Bstr bstrMachineName = pszMachineName;1495 CHECK_ERROR(a->virtualBox, FindMachine(bstrMachineName.raw(), machine.asOutParam()));1496 if (FAILED(rc))1497 return RTEXITCODE_FAILURE;1498 1499 CHECK_ERROR_RET(machine, COMGETTER(Name)(bstrMachineName.asOutParam()), RTEXITCODE_FAILURE);1500 Bstr bstrUuid;1501 CHECK_ERROR_RET(machine, COMGETTER(Id)(bstrUuid.asOutParam()), RTEXITCODE_FAILURE);1502 /* open a session for the VM */1503 CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), RTEXITCODE_FAILURE);1504 1505 /* get the associated console */1506 1489 ComPtr<IConsole> console; 1507 1490 CHECK_ERROR(a->session, COMGETTER(Console)(console.asOutParam())); … … 1512 1495 ComPtr<IMachine> sessionMachine; 1513 1496 CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), RTEXITCODE_FAILURE); 1514 1515 /* Get the OS type name of the VM. */1516 BSTR bstrInstalledOS;1517 CHECK_ERROR_RET(sessionMachine, COMGETTER(OSTypeId)(&bstrInstalledOS), RTEXITCODE_FAILURE);1518 Utf8Str strInstalledOS(bstrInstalledOS);1519 1497 1520 1498 do … … 1526 1504 Utf8Str(bstrUuid).c_str()); 1527 1505 1528 { 1529 /* 1530 * Instantiate and configure the unattended installer. 1531 */ 1532 ComPtr<IUnattended> ptrUnattended; 1533 CHECK_ERROR_BREAK(a->virtualBox, CreateUnattendedInstaller(ptrUnattended.asOutParam())); 1534 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Machine)(machine)); 1535 1536 if (pszIsoPath) 1537 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(IsoPath)(Bstr(pszIsoPath).raw())); 1538 if (pszUser) 1539 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(User)(Bstr(pszUser).raw())); 1540 if (pszPassword) 1541 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Password)(Bstr(pszPassword).raw())); 1542 if (pszFullUserName) 1543 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(FullUserName)(Bstr(pszFullUserName).raw())); 1544 if (pszProductKey) 1545 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ProductKey)(Bstr(pszProductKey).raw())); 1546 if (pszAdditionsIsoPath) 1547 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(AdditionsIsoPath)(Bstr(pszAdditionsIsoPath).raw())); 1548 if (fInstallAdditions >= 0) 1549 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(InstallGuestAdditions)(fInstallAdditions != (int)false)); 1550 if (pszValidationKitIsoPath) 1551 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ValidationKitIsoPath)(Bstr(pszValidationKitIsoPath).raw())); 1552 if (fInstallTxs >= 0) 1553 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(InstallTestExecService)(fInstallTxs != (int)false)); 1554 if (pszLocale) 1555 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Locale)(Bstr(pszLocale).raw())); 1556 if (pszCountry) 1557 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Country)(Bstr(pszCountry).raw())); 1558 if (pszTimeZone) 1559 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(TimeZone)(Bstr(pszTimeZone).raw())); 1560 if (pszProxy) 1561 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Proxy)(Bstr(pszProxy).raw())); 1562 if (pszHostname) 1563 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(Hostname)(Bstr(pszHostname).raw())); 1564 if (arrPackageSelectionAdjustments.size() == 1) 1565 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(PackageSelectionAdjustments)(Bstr(arrPackageSelectionAdjustments[0]).raw())); 1566 else if (arrPackageSelectionAdjustments.size() > 1) 1567 { 1568 RTCString strAdjustments; 1569 strAdjustments.join(arrPackageSelectionAdjustments, ";"); 1570 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(PackageSelectionAdjustments)(Bstr(strAdjustments).raw())); 1571 } 1572 1573 // advanced options: 1574 if (fSetImageIdx) 1575 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ImageIndex)(idxImage)); 1576 if (pszScriptTemplatePath) 1577 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ScriptTemplatePath)(Bstr(pszScriptTemplatePath).raw())); 1578 if (pszPostInstallScriptTemplatePath) 1579 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(PostInstallScriptTemplatePath)(Bstr(pszPostInstallScriptTemplatePath).raw())); 1580 if (pszPostInstallCommand) 1581 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(PostInstallCommand)(Bstr(pszPostInstallCommand).raw())); 1582 if (pszAuxiliaryBasePath) 1583 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(AuxiliaryBasePath)(Bstr(pszAuxiliaryBasePath).raw())); 1584 if (pszExtraInstallKernelParameters) 1585 CHECK_ERROR_BREAK(ptrUnattended, COMSETTER(ExtraInstallKernelParameters)(Bstr(pszExtraInstallKernelParameters).raw())); 1586 1587 CHECK_ERROR_BREAK(ptrUnattended,Prepare()); 1588 CHECK_ERROR_BREAK(ptrUnattended,ConstructMedia()); 1589 CHECK_ERROR_BREAK(ptrUnattended,ReconfigureVM()); 1590 1591 /* 1592 * Retrieve and display the parameters actually used. 1593 */ 1594 RTPrintf("Using values:\n"); 1506 /* 1507 * Do the work. 1508 */ 1509 CHECK_ERROR_BREAK(ptrUnattended,Prepare()); 1510 CHECK_ERROR_BREAK(ptrUnattended,ConstructMedia()); 1511 CHECK_ERROR_BREAK(ptrUnattended,ReconfigureVM()); 1512 1513 /* 1514 * Retrieve and display the parameters actually used. 1515 */ 1516 RTPrintf("Using values:\n"); 1595 1517 #define SHOW_ATTR(a_Attr, a_szText, a_Type, a_szFmt) do { \ 1596 a_Type Value; \1597 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(&Value); \1598 if (SUCCEEDED(hrc2)) \1599 RTPrintf(" %32s = " a_szFmt "\n", a_szText, Value); \1600 else \1601 RTPrintf(" %32s = failed: %Rhrc\n", a_szText, hrc2); \1602 } while (0)1518 a_Type Value; \ 1519 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(&Value); \ 1520 if (SUCCEEDED(hrc2)) \ 1521 RTPrintf(" %32s = " a_szFmt "\n", a_szText, Value); \ 1522 else \ 1523 RTPrintf(" %32s = failed: %Rhrc\n", a_szText, hrc2); \ 1524 } while (0) 1603 1525 #define SHOW_STR_ATTR(a_Attr, a_szText) do { \ 1604 Bstr bstrString; \1605 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(bstrString.asOutParam()); \1606 if (SUCCEEDED(hrc2)) \1607 RTPrintf(" %32s = %ls\n", a_szText, bstrString.raw()); \1608 else \1609 RTPrintf(" %32s = failed: %Rhrc\n", a_szText, hrc2); \1610 } while (0)1611 1612 SHOW_STR_ATTR(IsoPath, "isoPath");1613 SHOW_STR_ATTR(User, "user");1614 SHOW_STR_ATTR(Password, "password");1615 SHOW_STR_ATTR(FullUserName, "fullUserName");1616 SHOW_STR_ATTR(ProductKey, "productKey");1617 SHOW_STR_ATTR(AdditionsIsoPath, "additionsIsoPath");1618 SHOW_ATTR( InstallGuestAdditions, "installGuestAdditions", BOOL, "%RTbool");1619 SHOW_STR_ATTR(ValidationKitIsoPath, "validationKitIsoPath");1620 SHOW_ATTR( InstallTestExecService, "installTestExecService", BOOL, "%RTbool");1621 SHOW_STR_ATTR(Locale, "locale");1622 SHOW_STR_ATTR(Country, "country");1623 SHOW_STR_ATTR(TimeZone, "timeZone");1624 SHOW_STR_ATTR(Proxy, "proxy");1625 SHOW_STR_ATTR(Hostname, "hostname");1626 SHOW_STR_ATTR(PackageSelectionAdjustments, "packageSelectionAdjustments");1627 SHOW_STR_ATTR(AuxiliaryBasePath, "auxiliaryBasePath");1628 SHOW_ATTR( ImageIndex, "imageIndex", ULONG, "%u");1629 SHOW_STR_ATTR(ScriptTemplatePath, "scriptTemplatePath");1630 SHOW_STR_ATTR(PostInstallScriptTemplatePath, "postInstallScriptTemplatePath");1631 SHOW_STR_ATTR(PostInstallCommand, "postInstallCommand");1632 SHOW_STR_ATTR(ExtraInstallKernelParameters, "extraInstallKernelParameters");1633 SHOW_STR_ATTR(DetectedOSTypeId, "detectedOSTypeId");1634 SHOW_STR_ATTR(DetectedOSVersion, "detectedOSVersion");1635 SHOW_STR_ATTR(DetectedOSFlavor, "detectedOSFlavor");1636 SHOW_STR_ATTR(DetectedOSHints, "detectedOSHints");1526 Bstr bstrString; \ 1527 HRESULT hrc2 = ptrUnattended->COMGETTER(a_Attr)(bstrString.asOutParam()); \ 1528 if (SUCCEEDED(hrc2)) \ 1529 RTPrintf(" %32s = %ls\n", a_szText, bstrString.raw()); \ 1530 else \ 1531 RTPrintf(" %32s = failed: %Rhrc\n", a_szText, hrc2); \ 1532 } while (0) 1533 1534 SHOW_STR_ATTR(IsoPath, "isoPath"); 1535 SHOW_STR_ATTR(User, "user"); 1536 SHOW_STR_ATTR(Password, "password"); 1537 SHOW_STR_ATTR(FullUserName, "fullUserName"); 1538 SHOW_STR_ATTR(ProductKey, "productKey"); 1539 SHOW_STR_ATTR(AdditionsIsoPath, "additionsIsoPath"); 1540 SHOW_ATTR( InstallGuestAdditions, "installGuestAdditions", BOOL, "%RTbool"); 1541 SHOW_STR_ATTR(ValidationKitIsoPath, "validationKitIsoPath"); 1542 SHOW_ATTR( InstallTestExecService, "installTestExecService", BOOL, "%RTbool"); 1543 SHOW_STR_ATTR(Locale, "locale"); 1544 SHOW_STR_ATTR(Country, "country"); 1545 SHOW_STR_ATTR(TimeZone, "timeZone"); 1546 SHOW_STR_ATTR(Proxy, "proxy"); 1547 SHOW_STR_ATTR(Hostname, "hostname"); 1548 SHOW_STR_ATTR(PackageSelectionAdjustments, "packageSelectionAdjustments"); 1549 SHOW_STR_ATTR(AuxiliaryBasePath, "auxiliaryBasePath"); 1550 SHOW_ATTR( ImageIndex, "imageIndex", ULONG, "%u"); 1551 SHOW_STR_ATTR(ScriptTemplatePath, "scriptTemplatePath"); 1552 SHOW_STR_ATTR(PostInstallScriptTemplatePath, "postInstallScriptTemplatePath"); 1553 SHOW_STR_ATTR(PostInstallCommand, "postInstallCommand"); 1554 SHOW_STR_ATTR(ExtraInstallKernelParameters, "extraInstallKernelParameters"); 1555 SHOW_STR_ATTR(DetectedOSTypeId, "detectedOSTypeId"); 1556 SHOW_STR_ATTR(DetectedOSVersion, "detectedOSVersion"); 1557 SHOW_STR_ATTR(DetectedOSFlavor, "detectedOSFlavor"); 1558 SHOW_STR_ATTR(DetectedOSHints, "detectedOSHints"); 1637 1559 1638 1560 #undef SHOW_STR_ATTR 1639 1561 #undef SHOW_ATTR 1640 } 1641 1562 1563 ptrUnattended.setNull(); 1642 1564 a->session->UnlockMachine(); 1643 1565 … … 1660 1582 #endif 1661 1583 ComPtr<IProgress> progress; 1662 CHECK_ERROR( machine, LaunchVMProcess(a->session, Bstr(pszSessionType).raw(), env.raw(), progress.asOutParam()));1584 CHECK_ERROR(ptrMachine, LaunchVMProcess(a->session, Bstr(pszSessionType).raw(), env.raw(), progress.asOutParam())); 1663 1585 if (SUCCEEDED(rc) && !progress.isNull()) 1664 1586 {
Note:
See TracChangeset
for help on using the changeset viewer.

