Changeset 42129 in vbox
- Timestamp:
- Jul 12, 2012 5:32:31 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r41914 r42129 18 18 19 19 /* 20 * Copyright (C) 2007-201 1Oracle Corporation20 * Copyright (C) 2007-2012 Oracle Corporation 21 21 * 22 22 * This file is part of VirtualBox Open Source Edition (OSE), as … … 100 100 101 101 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap; 102 typedef std::list<com::Utf8Str> StringsList; 102 103 103 104 // ExtraDataItem (used by both VirtualBox.xml and machines XML) … … 1015 1016 uFaultToleranceInterval(0), 1016 1017 fRTCUseUTC(false) 1017 { } 1018 { 1019 llGroups.push_back("/"); 1020 } 1018 1021 1019 1022 bool operator==(const MachineUserData &c) const … … 1039 1042 bool fNameSync; 1040 1043 com::Utf8Str strDescription; 1044 StringsList llGroups; 1041 1045 com::Utf8Str strOsType; 1042 1046 com::Utf8Str strSnapshotFolder; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r42125 r42129 815 815 if (rc == VERR_GETOPT_UNKNOWN_OPTION) 816 816 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown option: %s", pValueUnion->psz); 817 if (rc == VERR_GETOPT_INVALID_ARGUMENT_FORMAT) 818 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid argument format: %s", pValueUnion->psz); 817 819 if (pValueUnion->pDef) 818 820 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "%s: %Rrs", pValueUnion->pDef->pszLong, rc); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r41915 r42129 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 382 382 } while (0) 383 383 384 #define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \ 385 do \ 386 { \ 387 SafeArray<BSTR> array; \ 388 CHECK_ERROR2_RET(a_pObj, COMGETTER(a_Prop)(ComSafeArrayAsOutParam(array)), hrcCheck); \ 389 Utf8Str str; \ 390 for (size_t i = 0; i < array.size(); i++) \ 391 { \ 392 if (i != 0) \ 393 str.append(","); \ 394 str.append(Utf8Str(array[i]).c_str()); \ 395 } \ 396 Bstr bstr(str); \ 397 if (details == VMINFO_MACHINEREADABLE) \ 398 outputMachineReadableString(a_szMachine, &bstr); \ 399 else \ 400 RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \ 401 } while (0) 402 384 403 #define SHOW_UUID_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \ 385 404 SHOW_STRING_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) … … 470 489 ComPtr<IGuestOSType> osType; 471 490 CHECK_ERROR2_RET(virtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck); 491 SHOW_STRINGARRAY_PROP( machine, Groups, "groups", "Groups"); 472 492 SHOW_STRING_PROP( osType, Description, "ostype", "Guest OS"); 473 493 SHOW_UUID_PROP( machine, Id, "UUID", "UUID"); … … 1320 1340 { 1321 1341 ULONG ulIRQ, ulIOBase; 1322 PortMode_T HostMode;1323 1342 Bstr path; 1324 BOOL fServer;1325 1343 lpt->COMGETTER(IRQ)(&ulIRQ); 1326 1344 lpt->COMGETTER(IOBase)(&ulIOBase); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
r39888 r42129 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 171 171 } 172 172 173 static const RTGETOPTDEF g_aCreateVMOptions[] = 174 { 175 { "--name", 'n', RTGETOPT_REQ_STRING }, 176 { "-name", 'n', RTGETOPT_REQ_STRING }, 177 { "--groups", 'g', RTGETOPT_REQ_STRING }, 178 { "--basefolder", 'p', RTGETOPT_REQ_STRING }, 179 { "-basefolder", 'p', RTGETOPT_REQ_STRING }, 180 { "--ostype", 'o', RTGETOPT_REQ_STRING }, 181 { "-ostype", 'o', RTGETOPT_REQ_STRING }, 182 { "--uuid", 'u', RTGETOPT_REQ_UUID }, 183 { "-uuid", 'u', RTGETOPT_REQ_UUID }, 184 { "--register", 'r', RTGETOPT_REQ_NOTHING }, 185 { "-register", 'r', RTGETOPT_REQ_NOTHING }, 186 }; 187 173 188 int handleCreateVM(HandlerArg *a) 174 189 { 175 190 HRESULT rc; 176 Bstr baseFolder; 177 Bstr name; 178 Bstr osTypeId; 179 RTUUID id; 191 Bstr bstrBaseFolder; 192 Bstr bstrName; 193 Bstr bstrGroups; 194 Bstr bstrOsTypeId; 195 Bstr bstrUuid; 180 196 bool fRegister = false; 181 197 182 RTUuidClear(&id); 183 for (int i = 0; i < a->argc; i++) 184 { 185 if ( !strcmp(a->argv[i], "--basefolder") 186 || !strcmp(a->argv[i], "-basefolder")) 187 { 188 if (a->argc <= i + 1) 189 return errorArgument("Missing argument to '%s'", a->argv[i]); 190 i++; 191 baseFolder = a->argv[i]; 192 } 193 else if ( !strcmp(a->argv[i], "--name") 194 || !strcmp(a->argv[i], "-name")) 195 { 196 if (a->argc <= i + 1) 197 return errorArgument("Missing argument to '%s'", a->argv[i]); 198 i++; 199 name = a->argv[i]; 200 } 201 else if ( !strcmp(a->argv[i], "--ostype") 202 || !strcmp(a->argv[i], "-ostype")) 203 { 204 if (a->argc <= i + 1) 205 return errorArgument("Missing argument to '%s'", a->argv[i]); 206 i++; 207 osTypeId = a->argv[i]; 208 } 209 else if ( !strcmp(a->argv[i], "--uuid") 210 || !strcmp(a->argv[i], "-uuid")) 211 { 212 if (a->argc <= i + 1) 213 return errorArgument("Missing argument to '%s'", a->argv[i]); 214 i++; 215 if (RT_FAILURE(RTUuidFromStr(&id, a->argv[i]))) 216 return errorArgument("Invalid UUID format %s\n", a->argv[i]); 217 } 218 else if ( !strcmp(a->argv[i], "--register") 219 || !strcmp(a->argv[i], "-register")) 220 { 221 fRegister = true; 222 } 223 else 224 return errorSyntax(USAGE_CREATEVM, "Invalid parameter '%s'", Utf8Str(a->argv[i]).c_str()); 198 int c; 199 RTGETOPTUNION ValueUnion; 200 RTGETOPTSTATE GetState; 201 // start at 0 because main() has hacked both the argc and argv given to us 202 RTGetOptInit(&GetState, a->argc, a->argv, g_aCreateVMOptions, RT_ELEMENTS(g_aCreateVMOptions), 203 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS); 204 while ((c = RTGetOpt(&GetState, &ValueUnion))) 205 { 206 switch (c) 207 { 208 case 'n': // --name 209 bstrName = ValueUnion.psz; 210 break; 211 212 case 'g': // --groups 213 bstrGroups = ValueUnion.psz; 214 /// @todo implement group string parsing to safearray 215 break; 216 217 case 'p': // --basefolder 218 bstrBaseFolder = ValueUnion.psz; 219 break; 220 221 case 'o': // --ostype 222 bstrOsTypeId = ValueUnion.psz; 223 break; 224 225 case 'u': // --uuid 226 bstrUuid = Guid(ValueUnion.Uuid).toUtf16().raw(); 227 break; 228 229 case 'r': // --register 230 fRegister = true; 231 break; 232 233 default: 234 return errorGetOpt(USAGE_CREATEVM, c, &ValueUnion); 235 } 225 236 } 226 237 227 238 /* check for required options */ 228 if ( name.isEmpty())239 if (bstrName.isEmpty()) 229 240 return errorSyntax(USAGE_CREATEVM, "Parameter --name is required"); 230 241 … … 233 244 Bstr bstrSettingsFile; 234 245 CHECK_ERROR_BREAK(a->virtualBox, 235 ComposeMachineFilename(name.raw(), 236 baseFolder.raw(), 246 ComposeMachineFilename(bstrName.raw(), 247 NULL /* aGroup */, 248 bstrBaseFolder.raw(), 237 249 bstrSettingsFile.asOutParam())); 238 250 ComPtr<IMachine> machine; 239 251 CHECK_ERROR_BREAK(a->virtualBox, 240 252 CreateMachine(bstrSettingsFile.raw(), 241 name.raw(), 242 osTypeId.raw(), 243 Guid(id).toUtf16().raw(), 253 bstrName.raw(), 254 NULL /* aGroups */, 255 bstrOsTypeId.raw(), 256 bstrUuid.raw(), 244 257 FALSE /* forceOverwrite */, 245 258 machine.asOutParam())); … … 257 270 "UUID: %s\n" 258 271 "Settings file: '%ls'\n", 259 name.raw(), fRegister ? " and registered" : "",272 bstrName.raw(), fRegister ? " and registered" : "", 260 273 Utf8Str(uuid).c_str(), settingsFile.raw()); 261 274 } … … 269 282 { "--snapshot", 's', RTGETOPT_REQ_STRING }, 270 283 { "--name", 'n', RTGETOPT_REQ_STRING }, 284 { "--groups", 'g', RTGETOPT_REQ_STRING }, 271 285 { "--mode", 'm', RTGETOPT_REQ_STRING }, 272 286 { "--options", 'o', RTGETOPT_REQ_STRING }, 273 287 { "--register", 'r', RTGETOPT_REQ_NOTHING }, 274 288 { "--basefolder", 'p', RTGETOPT_REQ_STRING }, 275 { "--uuid", 'u', RTGETOPT_REQ_ STRING},289 { "--uuid", 'u', RTGETOPT_REQ_UUID }, 276 290 }; 277 291 … … 332 346 com::SafeArray<CloneOptions_T> options; 333 347 const char *pszTrgName = NULL; 348 const char *pszTrgGroups = NULL; 334 349 const char *pszTrgBaseFolder = NULL; 335 350 bool fRegister = false; … … 350 365 break; 351 366 367 case 'n': // --name 368 pszTrgName = ValueUnion.psz; 369 break; 370 371 case 'g': // --groups 372 pszTrgGroups = ValueUnion.psz; 373 /// @todo implement group string parsing to safearray 374 break; 375 376 case 'p': // --basefolder 377 pszTrgBaseFolder = ValueUnion.psz; 378 break; 379 352 380 case 'm': // --mode 353 381 if (RT_FAILURE(parseCloneMode(ValueUnion.psz, &mode))) … … 360 388 break; 361 389 362 case 'n': // --name363 pszTrgName = ValueUnion.psz;364 break;365 366 case 'p': // --basefolder367 pszTrgBaseFolder = ValueUnion.psz;368 break;369 370 390 case 'u': // --uuid 371 RTUUID trgUuid; 372 if (RT_FAILURE(RTUuidFromStr(&trgUuid, ValueUnion.psz))) 373 return errorArgument("Invalid UUID format %s\n", ValueUnion.psz); 374 else 375 bstrUuid = Guid(trgUuid).toUtf16().raw(); 391 bstrUuid = Guid(ValueUnion.Uuid).toUtf16().raw(); 376 392 break; 377 393 … … 421 437 CHECK_ERROR_RET(a->virtualBox, 422 438 ComposeMachineFilename(Bstr(pszTrgName).raw(), 439 NULL /* aGroup */, 423 440 Bstr(pszTrgBaseFolder).raw(), 424 441 bstrSettingsFile.asOutParam()), … … 428 445 CHECK_ERROR_RET(a->virtualBox, CreateMachine(bstrSettingsFile.raw(), 429 446 Bstr(pszTrgName).raw(), 447 NULL /* aGroups */, 430 448 NULL, 431 449 bstrUuid.raw(), -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r41591 r42129 113 113 114 114 /* Create a new machine object. */ 115 const QString &strSettingsFile = vbox.ComposeMachineFilename(strName, QString::null );116 CMachine cloneMachine = vbox.CreateMachine(strSettingsFile, strName, Q String::null, QString::null, false);115 const QString &strSettingsFile = vbox.ComposeMachineFilename(strName, QString::null /**< @todo group support */, QString::null); 116 CMachine cloneMachine = vbox.CreateMachine(strSettingsFile, strName, QVector<QString>(), QString::null, QString::null, false); 117 117 if (!vbox.isOk()) 118 118 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
r41689 r42129 62 62 if (m_machine.isNull()) 63 63 { 64 m_machine = vbox.CreateMachine(QString(), field("name").toString(), strTypeId, QString(), false);64 m_machine = vbox.CreateMachine(QString(), field("name").toString(), QVector<QString>() /**< @todo group support */, strTypeId, QString(), false); 65 65 if (!vbox.isOk()) 66 66 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r41587 r42129 183 183 QString strDefaultMachinesFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 184 184 /* Compose machine filename: */ 185 QString strMachineFilename = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(), strDefaultMachinesFolder);185 QString strMachineFilename = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(), QString::null /**< @todo group support */, strDefaultMachinesFolder); 186 186 /* Compose machine folder/basename: */ 187 187 QFileInfo fileInfo(strMachineFilename); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r42125 r42129 1398 1398 <interface 1399 1399 name="IVirtualBox" extends="$unknown" 1400 uuid=" 867664ba-41ce-4099-a10d-b7a8e34057c7"1400 uuid="53789455-fad2-425a-94c8-eb6dc4ceaa05" 1401 1401 wsmap="managed" 1402 1402 > … … 1495 1495 </attribute> 1496 1496 1497 <attribute name="machineGroups" type="wstring" readonly="yes" safearray="yes"> 1498 <desc> 1499 Array of all machine group names which are used by the machines which 1500 are accessible. Each group is only listed once, however they are listed 1501 in no particular order and there is no guarantee that there are no gaps 1502 in the group hierarchy (i.e. "/", "/group/subgroup" is a valid result). 1503 </desc> 1504 </attribute> 1505 1497 1506 <attribute name="hardDisks" type="IMedium" readonly="yes" safearray="yes"> 1498 1507 <desc> … … 1582 1591 1583 1592 <ul> 1584 <li>It gets called by <link to="#createMachine" /> if NULL is specified 1585 for the @a settingsFile argument there, which means that API should use 1586 a recommended default file name.</li> 1593 <li>It gets called by <link to="#createMachine" /> if @c null or 1594 empty string (which is recommended) is specified for the 1595 @a settingsFile argument there, which means that API should use 1596 a recommended default file name.</li> 1587 1597 1588 1598 <li>It can be called manually by a client software before creating a machine, … … 1597 1607 details about the machine name. 1598 1608 1609 @a groupName defines which additional subdirectory levels should be 1610 included. It must be either a valid group name or @c null or empty 1611 string which designates that the machine will not be related to a 1612 machine group. 1613 1599 1614 If @a baseFolder is a @c null or empty string (which is recommended), the 1600 1615 default machine settings folder … … 1605 1620 1606 1621 This method does not access the host disks. In particular, it does not check 1607 for whether a machine ofthis name already exists.1622 for whether a machine with this name already exists. 1608 1623 </desc> 1609 1624 <param name="name" type="wstring" dir="in"> 1610 1625 <desc>Suggested machine name.</desc> 1626 </param> 1627 <param name="group" type="wstring" dir="in"> 1628 <desc>Machine group name for the new machine or machine group. It is 1629 used to determine the right subdirectory.</desc> 1611 1630 </param> 1612 1631 <param name="baseFolder" type="wstring" dir="in"> … … 1627 1646 and machine files can be created at arbitrary locations. 1628 1647 1629 However, it is is recommended that machines be created in the default1648 However, it is recommended that machines are created in the default 1630 1649 machine folder (e.g. "/home/user/VirtualBox VMs/name/name.vbox"; see 1631 1650 <link to="ISystemProperties::defaultMachineFolder" />). If you specify 1632 NULL for the @a settingsFile argument, <link to="#composeMachineFilename" /> 1633 is called automatically to have such a recommended name composed based 1634 on the machine name given in the @a name argument. 1651 @c null or empty string (which is recommended) for the @a settingsFile 1652 argument, <link to="#composeMachineFilename" /> is called automatically 1653 to have such a recommended name composed based on the machine name 1654 given in the @a name argument and the primary group. 1635 1655 1636 1656 If the resulting settings file already exists, this method will fail, … … 1693 1713 <param name="settingsFile" type="wstring" dir="in"> 1694 1714 <desc>Fully qualified path where the settings file should be created, 1695 or NULL for a default folder and file based on the @a name argument 1715 empty string or @c null for a default folder and file based on the 1716 @a name argument and the primary group. 1696 1717 (see <link to="#composeMachineFilename" />).</desc> 1697 1718 </param> 1698 1719 <param name="name" type="wstring" dir="in"> 1699 1720 <desc>Machine name.</desc> 1721 </param> 1722 <param name="groups" type="wstring" safearray="yes" dir="in"> 1723 <desc>Array of group names. @c null or an empty array have the same 1724 meaning as an array with just the empty string or "/", i.e. create a 1725 machine without group association.</desc> 1700 1726 </param> 1701 1727 <param name="osTypeId" type="wstring" dir="in"> … … 3711 3737 <interface 3712 3738 name="IMachine" extends="$unknown" 3713 uuid=" 019d7a7b-1e2d-4008-b954-4b5d72d103b8"3739 uuid="1d03031a-ce63-4641-9d67-3a16e03778d5" 3714 3740 wsmap="managed" 3715 3741 > … … 3865 3891 </attribute> 3866 3892 3893 <attribute name="groups" type="wstring" safearray="yes"> 3894 <desc> 3895 Array of machine group names of which this machine is a member. "" and 3896 "/" are synonyms for the toplevel group. Each group is only listed 3897 once, however they are listed in no particular order and there is no 3898 guarantee that there are no gaps in the group hierarchy 3899 (i.e. "/group", "/group/subgroup/subsubgroup" is a valid result). 3900 </desc> 3901 </attribute> 3902 3867 3903 <attribute name="OSTypeId" type="wstring"> 3868 3904 <desc> … … 3888 3924 properties. For most VMs this is the same as the @a id, but for VMs 3889 3925 which have been cloned or teleported it may be the same as the source 3890 VM. Thislatter is because the guest shouldn't notice that it was3926 VM. The latter is because the guest shouldn't notice that it was 3891 3927 cloned or teleported. 3892 3928 </desc> … … 4354 4390 Enables tracepoints in PDM devices and drivers to use the VMCPU or VM 4355 4391 structures when firing off trace points. This is especially useful 4356 with DTrace tracepoints, as it allow you to use the VMCPU or VM pointer4357 to obtailuseful information such as guest register state.4392 with DTrace tracepoints, as it allows you to use the VMCPU or VM 4393 pointer to obtain useful information such as guest register state. 4358 4394 4359 4395 This is disabled by default because devices and drivers normally has no … … 4574 4610 <li><tt>"emergencystop"</tt>: reserved value, used for aborting 4575 4611 the currently running VM or session owner. In this case the 4576 @a session parameter may be @c NULL(if it is non-null it isn't4612 @a session parameter may be @c null (if it is non-null it isn't 4577 4613 used in any way), and the @a progress return value will be always 4578 NULL. The operation completes immediately.</li>4614 @c null. The operation completes immediately.</li> 4579 4615 </ul> 4580 4616 </desc> … … 4745 4781 </param> 4746 4782 <param name="medium" type="IMedium" dir="in"> 4747 <desc>Medium to mount or NULLfor an empty drive.</desc>4783 <desc>Medium to mount or @c null for an empty drive.</desc> 4748 4784 </param> 4749 4785 </method> … … 4975 5011 </param> 4976 5012 <param name="bandwidthGroup" type="IBandwidthGroup" dir="in"> 4977 <desc>New value for the bandwidth group or NULLfor no group.</desc>5013 <desc>New value for the bandwidth group or @c null for no group.</desc> 4978 5014 </param> 4979 5015 </method> … … 5025 5061 </param> 5026 5062 <param name="medium" type="IMedium" dir="in"> 5027 <desc>Medium to mount or NULLfor an empty drive.</desc>5063 <desc>Medium to mount or @c null for an empty drive.</desc> 5028 5064 </param> 5029 5065 <param name="force" type="boolean" dir="in"> … … 7063 7099 Paused virtual machine. When the machine is PoweredOff, an 7064 7100 offline snapshot is created. When the machine is Running a live 7065 snapshot is created, and an online snapshot is iscreated when Paused.7101 snapshot is created, and an online snapshot is created when Paused. 7066 7102 7067 7103 The taken snapshot is always based on the … … 11531 11567 11532 11568 When deleting the current snapshot, the <link to="IMachine::currentSnapshot" /> 11533 attribute is set to the current snapshot's parent or NULLif it11569 attribute is set to the current snapshot's parent or @c null if it 11534 11570 has no parent. Otherwise the attribute is unchanged. 11535 11571 </li> … … 11736 11772 <const name="MultiAttach" value="5"> 11737 11773 <desc> 11738 A medium which is i s indirectly attached, so that one base medium can11774 A medium which is indirectly attached, so that one base medium can 11739 11775 be used for several VMs which have their own differencing medium to 11740 11776 store their modifications. In some sense a variant of Immutable -
trunk/src/VBox/Main/idl/midl.xsl
r35913 r42129 6 6 * from the generic interface definition expressed in XML. 7 7 8 Copyright (C) 2006-201 0Oracle Corporation8 Copyright (C) 2006-2012 Oracle Corporation 9 9 10 10 This file is part of VirtualBox Open Source Edition (OSE), as … … 288 288 <xsl:with-param name="str" select="@name"/> 289 289 </xsl:call-template> 290 <xsl:text> ([in</xsl:text> 291 <xsl:if test="@safearray='yes'"> 292 <!-- VB supports only [in, out], [out] and [out, retval] arrays --> 293 <xsl:text>, out</xsl:text> 294 </xsl:if> 295 <xsl:text>] </xsl:text> 290 <xsl:text> ([in] </xsl:text> 296 291 <xsl:if test="@safearray='yes'"> 297 292 <xsl:text>SAFEARRAY(</xsl:text> … … 299 294 <xsl:apply-templates select="@type"/> 300 295 <xsl:if test="@safearray='yes'"> 301 <xsl:text>) *</xsl:text>296 <xsl:text>)</xsl:text> 302 297 </xsl:if> 303 298 <xsl:text> a</xsl:text> -
trunk/src/VBox/Main/include/MachineImpl.h
r41925 r42129 342 342 const Utf8Str &strConfigFile, 343 343 const Utf8Str &strName, 344 const StringsList &llGroups, 344 345 GuestOSType *aOsType, 345 346 const Guid &aId, … … 381 382 STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription); 382 383 STDMETHOD(COMGETTER(Id))(BSTR *aId); 384 STDMETHOD(COMGETTER(Groups))(ComSafeArrayOut(BSTR, aGroups)); 385 STDMETHOD(COMSETTER(Groups))(ComSafeArrayIn(IN_BSTR, aGroups)); 383 386 STDMETHOD(COMGETTER(OSTypeId))(BSTR *aOSTypeId); 384 387 STDMETHOD(COMSETTER(OSTypeId))(IN_BSTR aOSTypeId); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r41214 r42129 52 52 class Medium; 53 53 class Host; 54 typedef std::list< ComObjPtr<Medium> > MediaList; 54 typedef std::list<ComObjPtr<Medium> > MediaList; 55 typedef std::list<Utf8Str> StringsList; 55 56 56 57 //////////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r42125 r42129 45 45 class AutostartDb; 46 46 47 typedef std::list< 47 typedef std::list<ComObjPtr<SessionMachine> > SessionMachinesList; 48 48 49 49 #ifdef RT_OS_WINDOWS … … 68 68 public: 69 69 70 typedef std::list< 70 typedef std::list<ComPtr<IInternalSessionControl> > InternalControlList; 71 71 72 72 class CallbackEvent; … … 111 111 STDMETHOD(COMGETTER(SystemProperties))(ISystemProperties **aSystemProperties); 112 112 STDMETHOD(COMGETTER(Machines))(ComSafeArrayOut(IMachine *, aMachines)); 113 STDMETHOD(COMGETTER(MachineGroups))(ComSafeArrayOut(BSTR, aMachineGroups)); 113 114 STDMETHOD(COMGETTER(HardDisks))(ComSafeArrayOut(IMedium *, aHardDisks)); 114 115 STDMETHOD(COMGETTER(DVDImages))(ComSafeArrayOut(IMedium *, aDVDImages)); … … 125 126 126 127 /* IVirtualBox methods */ 127 STDMETHOD(ComposeMachineFilename)(IN_BSTR aName, IN_BSTR a BaseFolder, BSTR *aFilename);128 STDMETHOD(ComposeMachineFilename)(IN_BSTR aName, IN_BSTR aGroup, IN_BSTR aBaseFolder, BSTR *aFilename); 128 129 STDMETHOD(CreateMachine)(IN_BSTR aSettingsFile, 129 130 IN_BSTR aName, 131 ComSafeArrayIn(IN_BSTR, aGroups), 130 132 IN_BSTR aOsTypeId, 131 133 IN_BSTR aId, … … 219 221 bool aSetError, 220 222 ComObjPtr<Machine> *machine = NULL); 223 224 HRESULT convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups), StringsList *pllMachineGroups); 221 225 222 226 HRESULT findHardDiskById(const Guid &id, -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r42038 r42129 205 205 Bstr bstrMachineFilename; 206 206 rc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(), 207 NULL, 207 NULL /* aGroup */, 208 NULL /* aBaseFolder */, 208 209 bstrMachineFilename.asOutParam()); 209 210 if (FAILED(rc)) throw rc; … … 1950 1951 rc = mVirtualBox->CreateMachine(NULL, /* machine name: use default */ 1951 1952 Bstr(stack.strNameVBox).raw(), 1953 NULL, /* no groups */ 1952 1954 Bstr(stack.strOsTypeVBox).raw(), 1953 1955 NULL, /* uuid */ … … 2864 2866 Bstr bstrMachineFilename; 2865 2867 rc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(), 2866 NULL, 2868 NULL /* aGroup */, 2869 NULL /* aBaseFolder */, 2867 2870 bstrMachineFilename.asOutParam()); 2868 2871 if (FAILED(rc)) throw rc; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r42123 r42129 271 271 * be relative to the VirtualBox config directory). 272 272 * @param strName name for the machine 273 * @param llGroups list of groups for the machine 274 * @param aOsType OS Type of this machine or NULL. 273 275 * @param aId UUID for the new machine. 274 * @param aOsType OS Type of this machine or NULL.275 276 * @param fForceOverwrite Whether to overwrite an existing machine settings file. 276 277 * … … 280 281 const Utf8Str &strConfigFile, 281 282 const Utf8Str &strName, 283 const StringsList &llGroups, 282 284 GuestOSType *aOsType, 283 285 const Guid &aId, … … 313 315 314 316 mUserData->s.strName = strName; 317 318 mUserData->s.llGroups = llGroups; 315 319 316 320 // the "name sync" flag determines whether the machine directory gets renamed along … … 1048 1052 } 1049 1053 1054 STDMETHODIMP Machine::COMGETTER(Groups)(ComSafeArrayOut(BSTR, aGroups)) 1055 { 1056 CheckComArgOutSafeArrayPointerValid(aGroups); 1057 1058 AutoCaller autoCaller(this); 1059 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1060 1061 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1062 SafeArray<BSTR> groups(mUserData->s.llGroups.size()); 1063 size_t i = 0; 1064 for (StringsList::const_iterator it = mUserData->s.llGroups.begin(); 1065 it != mUserData->s.llGroups.end(); 1066 ++it, i++) 1067 { 1068 Bstr tmp = *it; 1069 tmp.cloneTo(&groups[i]); 1070 } 1071 groups.detachTo(ComSafeArrayOutArg(aGroups)); 1072 1073 return S_OK; 1074 } 1075 1076 STDMETHODIMP Machine::COMSETTER(Groups)(ComSafeArrayIn(IN_BSTR, aGroups)) 1077 { 1078 AutoCaller autoCaller(this); 1079 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1080 1081 StringsList llGroups; 1082 HRESULT rc = mParent->convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups); 1083 if (FAILED(rc)) 1084 return rc; 1085 1086 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1087 1088 rc = checkStateDependency(MutableStateDep); 1089 if (FAILED(rc)) return rc; 1090 1091 setModified(IsModified_MachineData); 1092 mUserData.backup(); 1093 mUserData->s.llGroups = llGroups; 1094 1095 return S_OK; 1096 } 1097 1050 1098 STDMETHODIMP Machine::COMGETTER(OSTypeId)(BSTR *aOSTypeId) 1051 1099 { … … 1113 1161 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1114 1162 1115 intrc = checkStateDependency(MutableStateDep);1163 HRESULT rc = checkStateDependency(MutableStateDep); 1116 1164 if (FAILED(rc)) return rc; 1117 1165 … … 1143 1191 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1144 1192 1145 intrc = checkStateDependency(MutableStateDep);1193 HRESULT rc = checkStateDependency(MutableStateDep); 1146 1194 if (FAILED(rc)) return rc; 1147 1195 … … 1173 1221 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1174 1222 1175 intrc = checkStateDependency(MutableStateDep);1223 HRESULT rc = checkStateDependency(MutableStateDep); 1176 1224 if (FAILED(rc)) return rc; 1177 1225 … … 1203 1251 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1204 1252 1205 intrc = checkStateDependency(MutableStateDep);1253 HRESULT rc = checkStateDependency(MutableStateDep); 1206 1254 if (FAILED(rc)) return rc; 1207 1255 … … 1233 1281 STDMETHODIMP Machine::COMGETTER(HardwareVersion)(BSTR *aHWVersion) 1234 1282 { 1235 if (!aHWVersion) 1236 return E_POINTER; 1283 CheckComArgOutPointerValid(aHWVersion); 1237 1284 1238 1285 AutoCaller autoCaller(this); … … 1313 1360 STDMETHODIMP Machine::COMGETTER(MemorySize)(ULONG *memorySize) 1314 1361 { 1315 if (!memorySize) 1316 return E_POINTER; 1362 CheckComArgOutPointerValid(memorySize); 1317 1363 1318 1364 AutoCaller autoCaller(this); … … 1353 1399 STDMETHODIMP Machine::COMGETTER(CPUCount)(ULONG *CPUCount) 1354 1400 { 1355 if (!CPUCount) 1356 return E_POINTER; 1401 CheckComArgOutPointerValid(CPUCount); 1357 1402 1358 1403 AutoCaller autoCaller(this); … … 1406 1451 STDMETHODIMP Machine::COMGETTER(CPUExecutionCap)(ULONG *aExecutionCap) 1407 1452 { 1408 if (!aExecutionCap) 1409 return E_POINTER; 1453 CheckComArgOutPointerValid(aExecutionCap); 1410 1454 1411 1455 AutoCaller autoCaller(this); … … 1455 1499 STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *enabled) 1456 1500 { 1457 if (!enabled) 1458 return E_POINTER; 1501 CheckComArgOutPointerValid(enabled); 1459 1502 1460 1503 AutoCaller autoCaller(this); … … 1552 1595 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1553 1596 1554 intrc = checkStateDependency(MutableStateDep);1597 HRESULT rc = checkStateDependency(MutableStateDep); 1555 1598 if (FAILED(rc)) return rc; 1556 1599 … … 1612 1655 STDMETHODIMP Machine::COMGETTER(VRAMSize)(ULONG *memorySize) 1613 1656 { 1614 if (!memorySize) 1615 return E_POINTER; 1657 CheckComArgOutPointerValid(memorySize); 1616 1658 1617 1659 AutoCaller autoCaller(this); … … 1652 1694 STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize) 1653 1695 { 1654 if (!memoryBalloonSize) 1655 return E_POINTER; 1696 CheckComArgOutPointerValid(memoryBalloonSize); 1656 1697 1657 1698 AutoCaller autoCaller(this); … … 1699 1740 STDMETHODIMP Machine::COMGETTER(PageFusionEnabled) (BOOL *enabled) 1700 1741 { 1701 if (!enabled) 1702 return E_POINTER; 1742 CheckComArgOutPointerValid(enabled); 1703 1743 1704 1744 AutoCaller autoCaller(this); … … 1732 1772 STDMETHODIMP Machine::COMGETTER(Accelerate3DEnabled)(BOOL *enabled) 1733 1773 { 1734 if (!enabled) 1735 return E_POINTER; 1774 CheckComArgOutPointerValid(enabled); 1736 1775 1737 1776 AutoCaller autoCaller(this); … … 1767 1806 STDMETHODIMP Machine::COMGETTER(Accelerate2DVideoEnabled)(BOOL *enabled) 1768 1807 { 1769 if (!enabled) 1770 return E_POINTER; 1808 CheckComArgOutPointerValid(enabled); 1771 1809 1772 1810 AutoCaller autoCaller(this); … … 1801 1839 STDMETHODIMP Machine::COMGETTER(MonitorCount)(ULONG *monitorCount) 1802 1840 { 1803 if (!monitorCount) 1804 return E_POINTER; 1841 CheckComArgOutPointerValid(monitorCount); 1805 1842 1806 1843 AutoCaller autoCaller(this); … … 1839 1876 STDMETHODIMP Machine::COMGETTER(BIOSSettings)(IBIOSSettings **biosSettings) 1840 1877 { 1841 if (!biosSettings) 1842 return E_POINTER; 1878 CheckComArgOutPointerValid(biosSettings); 1843 1879 1844 1880 AutoCaller autoCaller(this); … … 1853 1889 STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal) 1854 1890 { 1855 if (!aVal) 1856 return E_POINTER; 1891 CheckComArgOutPointerValid(aVal); 1857 1892 1858 1893 AutoCaller autoCaller(this); … … 2111 2146 STDMETHODIMP Machine::GetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL *aVal) 2112 2147 { 2113 if (!aVal) 2114 return E_POINTER; 2148 CheckComArgOutPointerValid(aVal); 2115 2149 2116 2150 AutoCaller autoCaller(this); … … 2269 2303 STDMETHODIMP Machine::COMGETTER(MediumAttachments)(ComSafeArrayOut(IMediumAttachment*, aAttachments)) 2270 2304 { 2271 if (ComSafeArrayOutIsNull(aAttachments)) 2272 return E_POINTER; 2305 CheckComArgOutSafeArrayPointerValid(aAttachments); 2273 2306 2274 2307 AutoCaller autoCaller(this); … … 2285 2318 STDMETHODIMP Machine::COMGETTER(VRDEServer)(IVRDEServer **vrdeServer) 2286 2319 { 2287 if (!vrdeServer) 2288 return E_POINTER; 2320 CheckComArgOutPointerValid(vrdeServer); 2289 2321 2290 2322 AutoCaller autoCaller(this); … … 2301 2333 STDMETHODIMP Machine::COMGETTER(AudioAdapter)(IAudioAdapter **audioAdapter) 2302 2334 { 2303 if (!audioAdapter) 2304 return E_POINTER; 2335 CheckComArgOutPointerValid(audioAdapter); 2305 2336 2306 2337 AutoCaller autoCaller(this); … … 2419 2450 STDMETHODIMP Machine::COMGETTER(State)(MachineState_T *machineState) 2420 2451 { 2421 if (!machineState) 2422 return E_POINTER; 2452 CheckComArgOutPointerValid(machineState); 2423 2453 2424 2454 AutoCaller autoCaller(this); … … 4481 4511 STDMETHODIMP Machine::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys)) 4482 4512 { 4483 if (ComSafeArrayOutIsNull(aKeys)) 4484 return E_POINTER; 4513 CheckComArgOutSafeArrayPointerValid(aKeys); 4485 4514 4486 4515 AutoCaller autoCaller(this); … … 4803 4832 { 4804 4833 ComObjPtr<Machine> pMachine; 4805 RTCList< ComPtr<IMedium> >llMediums;4806 std::list<Utf8Str>llFilesToDelete;4834 RTCList<ComPtr<IMedium> > llMediums; 4835 StringsList llFilesToDelete; 4807 4836 ComObjPtr<Progress> pProgress; 4808 4837 }; … … 4969 4998 // medium storage files from the IMedium list passed in, and the 4970 4999 // machine XML file) 4971 std::list<Utf8Str>::const_iterator it = task.llFilesToDelete.begin();5000 StringsList::const_iterator it = task.llFilesToDelete.begin(); 4972 5001 while (it != task.llFilesToDelete.end()) 4973 5002 { … … 6589 6618 hrc = checkStateDependency(MutableStateDep); 6590 6619 if ( SUCCEEDED(hrc) 6591 && mHWData->mAutostart.fAutostartEnabled != fEnabled)6620 && mHWData->mAutostart.fAutostartEnabled != !!fEnabled) 6592 6621 { 6593 6622 AutostartDb *autostartDb = mParent->getAutostartDb(); … … 8907 8936 8908 8937 bool fSettingsFileIsNew = !mData->pMachineConfigFile->fileExists(); 8938 8939 /// @todo need to handle primary group change, too 8909 8940 8910 8941 /* attempt to rename the settings file if machine name is changed */ … … 12228 12259 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 12229 12260 12230 AssertReturn(!ComSafeArrayOutIsNull(aNames), E_POINTER);12231 AssertReturn(!ComSafeArrayOutIsNull(aValues), E_POINTER);12232 AssertReturn(!ComSafeArrayOutIsNull(aTimestamps), E_POINTER);12233 AssertReturn(!ComSafeArrayOutIsNull(aFlags), E_POINTER);12261 CheckComArgOutSafeArrayPointerValid(aNames); 12262 CheckComArgOutSafeArrayPointerValid(aValues); 12263 CheckComArgOutSafeArrayPointerValid(aTimestamps); 12264 CheckComArgOutSafeArrayPointerValid(aFlags); 12234 12265 12235 12266 size_t cEntries = mHWData->mGuestProperties.size(); … … 12596 12627 */ 12597 12628 12598 mParent->onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, aHostPort, aGuestIp,aGuestPort);12629 mParent->onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort); 12599 12630 return S_OK; 12600 12631 } -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r42125 r42129 930 930 VirtualBox::COMGETTER(Machines)(ComSafeArrayOut(IMachine *, aMachines)) 931 931 { 932 if (ComSafeArrayOutIsNull(aMachines)) 933 return E_POINTER; 932 CheckComArgOutSafeArrayPointerValid(aMachines); 934 933 935 934 AutoCaller autoCaller(this); … … 943 942 } 944 943 944 STDMETHODIMP 945 VirtualBox::COMGETTER(MachineGroups)(ComSafeArrayOut(BSTR, aMachineGroups)) 946 { 947 CheckComArgOutSafeArrayPointerValid(aMachineGroups); 948 949 AutoCaller autoCaller(this); 950 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 951 952 std::list<Bstr> allGroups; 953 954 /* get copy of all machine references, to avoid holding the list lock */ 955 MachinesOList::MyList allMachines; 956 { 957 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 958 allMachines = m->allMachines.getList(); 959 } 960 for (MachinesOList::MyList::const_iterator it = allMachines.begin(); 961 it != allMachines.end(); 962 ++it) 963 { 964 const ComObjPtr<Machine> &pMachine = *it; 965 AutoCaller autoMachineCaller(pMachine); 966 if (FAILED(autoMachineCaller.rc())) 967 continue; 968 AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS); 969 970 if (pMachine->isAccessible()) 971 { 972 SafeArray<BSTR> thisGroups; 973 HRESULT rc = pMachine->COMGETTER(Groups)(ComSafeArrayAsOutParam(thisGroups)); 974 if (FAILED(rc)) 975 continue; 976 977 for (size_t i = 0; i < thisGroups.size(); i++) 978 allGroups.push_back(thisGroups[i]); 979 } 980 } 981 982 /* throw out any duplicates */ 983 allGroups.sort(); 984 allGroups.unique(); 985 com::SafeArray<BSTR> machineGroups(allGroups.size()); 986 size_t i = 0; 987 for (std::list<Bstr>::const_iterator it = allGroups.begin(); 988 it != allGroups.end(); 989 ++it, i++) 990 { 991 const Bstr &tmp = *it; 992 tmp.cloneTo(&machineGroups[i]); 993 } 994 machineGroups.detachTo(ComSafeArrayOutArg(aMachineGroups)); 995 996 return S_OK; 997 } 998 945 999 STDMETHODIMP VirtualBox::COMGETTER(HardDisks)(ComSafeArrayOut(IMedium *, aHardDisks)) 946 1000 { 947 if (ComSafeArrayOutIsNull(aHardDisks)) 948 return E_POINTER; 1001 CheckComArgOutSafeArrayPointerValid(aHardDisks); 949 1002 950 1003 AutoCaller autoCaller(this); … … 960 1013 STDMETHODIMP VirtualBox::COMGETTER(DVDImages)(ComSafeArrayOut(IMedium *, aDVDImages)) 961 1014 { 962 if (ComSafeArrayOutIsNull(aDVDImages)) 963 return E_POINTER; 1015 CheckComArgOutSafeArrayPointerValid(aDVDImages); 964 1016 965 1017 AutoCaller autoCaller(this); … … 975 1027 STDMETHODIMP VirtualBox::COMGETTER(FloppyImages)(ComSafeArrayOut(IMedium *, aFloppyImages)) 976 1028 { 977 if (ComSafeArrayOutIsNull(aFloppyImages)) 978 return E_POINTER; 1029 CheckComArgOutSafeArrayPointerValid(aFloppyImages); 979 1030 980 1031 AutoCaller autoCaller(this); … … 1052 1103 VirtualBox::COMGETTER(DHCPServers)(ComSafeArrayOut(IDHCPServer *, aDHCPServers)) 1053 1104 { 1054 if (ComSafeArrayOutIsNull(aDHCPServers)) 1055 return E_POINTER; 1105 CheckComArgOutSafeArrayPointerValid(aDHCPServers); 1056 1106 1057 1107 AutoCaller autoCaller(this); … … 1101 1151 STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInternalNetworks)) 1102 1152 { 1103 if (ComSafeArrayOutIsNull(aInternalNetworks)) 1104 return E_POINTER; 1153 CheckComArgOutSafeArrayPointerValid(aInternalNetworks); 1105 1154 1106 1155 AutoCaller autoCaller(this); … … 1163 1212 STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR, aGenericNetworkDrivers)) 1164 1213 { 1165 if (ComSafeArrayOutIsNull(aGenericNetworkDrivers)) 1166 return E_POINTER; 1214 CheckComArgOutSafeArrayPointerValid(aGenericNetworkDrivers); 1167 1215 1168 1216 AutoCaller autoCaller(this); … … 1323 1371 1324 1372 STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName, 1373 IN_BSTR aGroup, 1325 1374 IN_BSTR aBaseFolder, 1326 1375 BSTR *aFilename) 1327 1376 { 1377 /// @todo implement aGroup 1378 NOREF(aGroup); 1328 1379 LogFlowThisFuncEnter(); 1329 1380 LogFlowThisFunc(("aName=\"%ls\",aBaseFolder=\"%ls\"\n", aName, aBaseFolder)); … … 1465 1516 STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile, 1466 1517 IN_BSTR aName, 1518 ComSafeArrayIn(IN_BSTR, aGroups), 1467 1519 IN_BSTR aOsTypeId, 1468 1520 IN_BSTR aId, … … 1480 1532 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1481 1533 1534 StringsList llGroups; 1535 HRESULT rc = convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups); 1536 if (FAILED(rc)) 1537 return rc; 1538 1482 1539 /* NULL settings file means compose automatically */ 1483 HRESULT rc;1484 1540 Bstr bstrSettingsFile(aSettingsFile); 1485 1541 if (bstrSettingsFile.isEmpty()) 1486 1542 { 1487 1543 rc = ComposeMachineFilename(aName, 1488 NULL, 1544 Bstr(llGroups.front()).raw(), 1545 NULL /* aBaseFolder */, 1489 1546 bstrSettingsFile.asOutParam()); 1490 1547 if (FAILED(rc)) return rc; … … 1509 1566 Utf8Str(bstrSettingsFile), 1510 1567 Utf8Str(aName), 1568 llGroups, 1511 1569 osType, 1512 1570 id, … … 1850 1908 using namespace settings; 1851 1909 1852 if (ComSafeArrayOutIsNull(aKeys)) 1853 return E_POINTER; 1910 CheckComArgOutSafeArrayPointerValid(aKeys); 1854 1911 1855 1912 AutoCaller autoCaller(this); … … 2963 3020 2964 3021 return rc; 3022 } 3023 3024 /** 3025 * Takes a list of machine groups, and sanitizes/validates it. 3026 * 3027 * @param aMachineGroups Safearray with the machine groups. 3028 * @param pllMachineGroups Pointer to list of strings for the result. 3029 * 3030 * @return S_OK or E_INVALIDARG 3031 */ 3032 3033 HRESULT VirtualBox::convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups), StringsList *pllMachineGroups) 3034 { 3035 pllMachineGroups->clear(); 3036 if (aMachineGroups) 3037 { 3038 com::SafeArray<BSTR> machineGroups(ComSafeArrayInArg(aMachineGroups)); 3039 for (size_t i = 0; i < machineGroups.size(); i++) 3040 pllMachineGroups->push_back(machineGroups[i]); 3041 pllMachineGroups->sort(); 3042 pllMachineGroups->unique(); 3043 if (pllMachineGroups->size() > 0) 3044 pllMachineGroups->push_back("/"); 3045 else if (pllMachineGroups->front().equals("")) 3046 { 3047 pllMachineGroups->pop_front(); 3048 if (pllMachineGroups->size() == 0 || !pllMachineGroups->front().equals("/")) 3049 pllMachineGroups->push_front("/"); 3050 } 3051 } 3052 else 3053 pllMachineGroups->push_back("/"); 3054 3055 for (StringsList::const_iterator it = pllMachineGroups->begin(); 3056 it != pllMachineGroups->end(); 3057 ++it) 3058 { 3059 const Utf8Str &str = *it; 3060 /* no empty strings (shouldn't happen after the translation above) */ 3061 if (str.length() == 0) 3062 return E_INVALIDARG; 3063 /* must start with a slash */ 3064 if (str.c_str()[0] != '/') 3065 return E_INVALIDARG; 3066 /* must not end with a slash */ 3067 if (str.c_str()[str.length() - 1] != '/') 3068 return E_INVALIDARG; 3069 3070 /** @todo validate each component of the group hierarchy */ 3071 } 3072 3073 return S_OK; 2965 3074 } 2966 3075 -
trunk/src/VBox/Main/webservice/websrv-cpp.xsl
r41040 r42129 534 534 <xsl:param name="safearray" /> 535 535 536 <xsl:value-of select="concat(' // convert input arg ', $name )" />536 <xsl:value-of select="concat(' // convert input arg ', $name, '(safearray: ', $safearray, ')')" /> 537 537 <xsl:call-template name="emitNewlineIndent8" /> 538 538 … … 709 709 710 710 <!-- 711 emitInParam: 712 --> 713 <xsl:template name="emitInParam"> 714 <xsl:param name="name" /> 715 <xsl:param name="type" /> 716 <xsl:param name="safearray" /> 717 <xsl:param name="varprefix" /> <!-- only with nested set-attribute calls --> 718 719 <xsl:variable name="varname" select="concat('comcall_', $varprefix, $name)" /> 720 721 <xsl:choose> 722 <xsl:when test="@safearray='yes'"> 723 <xsl:value-of select="concat('ComSafeArrayAsInParam(', $varname, ')')" /> 724 </xsl:when> 725 <xsl:otherwise> 726 <xsl:value-of select="$varname" /> 727 <xsl:if test="@type='wstring' or @type='uuid'"> 728 <xsl:text>.raw()</xsl:text> 729 </xsl:if> 730 </xsl:otherwise> 731 </xsl:choose> 732 </xsl:template> 733 734 <!-- 711 735 emitOutParam: 712 736 --> … … 768 792 <xsl:choose> 769 793 <xsl:when test="$attrdir='in'"> 770 <xsl:value-of select="concat('comcall_', $varprefix, @name)" /> 771 <xsl:if test="$attrtype='wstring' or $attrtype='uuid'"> 772 <xsl:text>.raw()</xsl:text> 773 </xsl:if> 794 <xsl:call-template name="emitInParam"> 795 <xsl:with-param name="name" select="$attrname" /> 796 <xsl:with-param name="type" select="$attrtype" /> 797 <xsl:with-param name="safearray" select="$attrsafearray" /> 798 <xsl:with-param name="varprefix" select="$varprefix" /> 799 </xsl:call-template> 774 800 </xsl:when> 775 801 <xsl:when test="$attrdir='return'"> … … 794 820 <xsl:choose> 795 821 <xsl:when test="@dir='in'"> 796 <xsl:choose> 797 <xsl:when test="@safearray='yes'"> 798 <xsl:value-of select="concat('ComSafeArrayAsInParam(comcall_', $varprefix, @name, ')')" /> 799 </xsl:when> 800 <xsl:otherwise> 801 <xsl:value-of select="concat('comcall_', $varprefix, @name)" /> 802 <xsl:if test="@type='wstring' or @type='uuid'"> 803 <xsl:text>.raw()</xsl:text> 804 </xsl:if> 805 </xsl:otherwise> 806 </xsl:choose> 822 <xsl:call-template name="emitInParam"> 823 <xsl:with-param name="name" select="@name" /> 824 <xsl:with-param name="type" select="@type" /> 825 <xsl:with-param name="safearray" select="@safearray" /> 826 <xsl:with-param name="varprefix" select="$varprefix" /> 827 </xsl:call-template> 807 828 </xsl:when> 808 829 <xsl:when test="@dir='out'"> … … 1204 1225 <xsl:param name="attrtype" select="$attrtype" /> 1205 1226 <xsl:param name="attrreadonly" select="$attrreadonly" /> 1227 <xsl:param name="attrsafearray" select="$attrsafearray" /> 1206 1228 1207 1229 <xsl:variable name="settername"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable> … … 1244 1266 <xsl:with-param name="attrname"><xsl:value-of select="$attrname" /></xsl:with-param> 1245 1267 <xsl:with-param name="attrtype"><xsl:value-of select="$attrtype" /></xsl:with-param> 1268 <xsl:with-param name="attrsafearray"><xsl:value-of select="$attrsafearray" /></xsl:with-param> 1246 1269 </xsl:call-template> 1247 1270 <!-- </xsl:otherwise> … … 1316 1339 <xsl:with-param name="attrtype" select="$attrtype" /> 1317 1340 <xsl:with-param name="attrreadonly" select="$attrreadonly" /> 1341 <xsl:with-param name="attrsafearray" select="$attrsafearray" /> 1318 1342 </xsl:call-template> 1319 1343 </xsl:if> -
trunk/src/VBox/Runtime/common/misc/getopt.cpp
r40598 r42129 791 791 else if (ch == VERR_GETOPT_UNKNOWN_OPTION) 792 792 RTMsgError("Unknown option: '%s'", pValueUnion->psz); 793 else if (ch == VERR_GETOPT_INVALID_ARGUMENT_FORMAT) 794 /** @todo r=klaus not really ideal, as the option isn't available */ 795 RTMsgError("Invalid argument format: '%s'", pValueUnion->psz); 793 796 else if (pValueUnion->pDef) 794 797 RTMsgError("%s: %Rrs\n", pValueUnion->pDef->pszLong, ch);
Note:
See TracChangeset
for help on using the changeset viewer.