[vbox-dev] [PATCH] Fix for Guest "OS type" future-compatibility
Alexey Eromenko
al4321 at gmail.com
Thu May 7 22:08:27 UTC 2015
Hi,
Today if I revert to older VirtualBox (to 4.3.20) from newer (v5.0
BETA), I lose access to certain VMs, such as "Windows 10", because it
has a new guest OS type ID.
Those VMs become "inaccessible" for no good reason. I can understand a
VM becoming "inaccessible" if hard disk new format is coming or a disk
image is lacking, but Guest OS type ?
My patch allows to recognize and start VMs with future guest OS type
IDs. They will revert to "unknown" OS type.
This is particularly useful in combination with "vbox-unattended"
patch, that adds new OS types every now and then, but also for Oracle
VirtualBox itself.
I have tested it together with VirtualBox GUI and with VBoxManage commands.
Plus tested OVF, Import / Export appliance.
--
-Alexey Eromenko "Technologov"
-------------- next part --------------
diff -uNr -U 6 vbox-orig/VirtualBox-5.0.0_BETA3//src/VBox/Main/src-server/VirtualBoxImpl.cpp vbox-guest-os-type/VirtualBox-5.0.0_BETA3//src/VBox/Main/src-server/VirtualBoxImpl.cpp
--- vbox-orig/VirtualBox-5.0.0_BETA3//src/VBox/Main/src-server/VirtualBoxImpl.cpp 2015-05-07 21:37:02.000000000 +0300
+++ vbox-guest-os-type/VirtualBox-5.0.0_BETA3//src/VBox/Main/src-server/VirtualBoxImpl.cpp 2015-05-08 01:04:43.000000000 +0300
@@ -1888,30 +1888,31 @@
HRESULT VirtualBox::getGuestOSType(const com::Utf8Str &aId,
ComPtr<IGuestOSType> &aType)
{
aType = NULL;
AutoReadLock alock(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS);
- HRESULT rc = S_OK;
for (GuestOSTypesOList::iterator it = m->allGuestOSTypes.begin();
it != m->allGuestOSTypes.end();
++it)
{
const Bstr &typeId = (*it)->i_id();
AssertMsg(!typeId.isEmpty(), ("ID must not be NULL"));
if (typeId.compare(aId, Bstr::CaseInsensitive) == 0)
{
(*it).queryInterfaceTo(aType.asOutParam());
break;
}
}
- return (aType) ? S_OK :
- setError(E_INVALIDARG,
- tr("'%s' is not a valid Guest OS type"),
- aId.c_str());
- return rc;
+
+ // if Guest OS type is from future or devel version, we revert to "Other" or NULL.
+ if (!aType)
+ {
+ aType = m->allGuestOSTypes.front();
+ }
+ return S_OK;
}
HRESULT VirtualBox::createSharedFolder(const com::Utf8Str &aName,
const com::Utf8Str &aHostPath,
BOOL aWritable,
BOOL aAutomount)
More information about the vbox-dev
mailing list