diff --git a/samples/vboxwrapper/vbox_common.h b/samples/vboxwrapper/vbox_common.h index 5a07efcb31c3bef81251f10788c15c1fb84b18c7..05ffdc7c70be356de7de78839887b67862183388 100644 --- a/samples/vboxwrapper/vbox_common.h +++ b/samples/vboxwrapper/vbox_common.h @@ -244,6 +244,7 @@ public: }; class VBOX_VM : public VBOX_BASE { +public: VBOX_VM(); ~VBOX_VM(); }; diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index 43d52f022bcf3bc91aa7ea2f46794d39c43242db..e08c2c7e20d385333045596606731302969f4fcf 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -454,19 +454,47 @@ int main(int argc, char** argv) { sscanf(vbox_version.c_str(), "%d.%d", &vbox_major, &vbox_minor); if ((4 == vbox_major) && (2 == vbox_minor)) { pVM = (VBOX_VM*) new vbox42::VBOX_VM(); + retval = pVM->initialize(); + if (retval) { + delete pVM; + pVM = NULL; + } } if ((4 == vbox_major) && (3 == vbox_minor)) { pVM = (VBOX_VM*) new vbox43::VBOX_VM(); + retval = pVM->initialize(); + if (retval) { + delete pVM; + pVM = NULL; + } } - if ((5 == vbox_major) && (0 == vbox_minor)) { + if ((5 == vbox_major) && (0 >= vbox_minor)) { pVM = (VBOX_VM*) new vbox50::VBOX_VM(); + retval = pVM->initialize(); + if (retval) { + delete pVM; + pVM = NULL; + } } } if (!pVM) { pVM = (VBOX_VM*) new vboxmanage::VBOX_VM(); + retval = pVM->initialize(); + if (retval) { + vboxlog_msg("Could not detect VM Hypervisor. Rescheduling execution for a later date."); + boinc_temporary_exit(86400, "Detection of VM Hypervisor failed."); + } } #else pVM = (VBOX_VM*) new vboxmanage::VBOX_VM(); + + // Initialize VM Hypervisor + // + retval = pVM->initialize(); + if (retval) { + vboxlog_msg("Could not detect VM Hypervisor. Rescheduling execution for a later date."); + boinc_temporary_exit(86400, "Detection of VM Hypervisor failed."); + } #endif // Parse command line parameters @@ -516,14 +544,6 @@ int main(int argc, char** argv) { } #endif - // Initialize VM Hypervisor - // - retval = pVM->initialize(); - if (retval) { - vboxlog_msg("Could not detect VM Hypervisor. Rescheduling execution for a later date."); - boinc_temporary_exit(86400, "Detection of VM Hypervisor failed."); - } - // Record what version of VirtualBox was used. // if (!pVM->virtualbox_version.empty()) {