mirror of https://github.com/BOINC/boinc.git
VBOX: Add support for VirtualBox 5.1 (MSCOM)
This commit is contained in:
parent
3765e54e4c
commit
0f3b0ccc8f
Binary file not shown.
|
@ -0,0 +1,69 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2010-2012 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#define _VIRTUALBOX51_
|
||||
#define _VIRTUALBOX_IMPORT_FUNCTIONS_
|
||||
|
||||
#include "boinc_win.h"
|
||||
#include "atlcomcli.h"
|
||||
#include "atlsafe.h"
|
||||
#include "atlcoll.h"
|
||||
#include "atlstr.h"
|
||||
#include "win_util.h"
|
||||
#include "diagnostics.h"
|
||||
#include "filesys.h"
|
||||
#include "parse.h"
|
||||
#include "str_util.h"
|
||||
#include "str_replace.h"
|
||||
#include "util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "procinfo.h"
|
||||
#include "network.h"
|
||||
#include "boinc_api.h"
|
||||
#include "floppyio.h"
|
||||
#include "vboxlogging.h"
|
||||
#include "vboxwrapper.h"
|
||||
#include "vbox_mscom51.h"
|
||||
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define stricmp _stricmp
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#import "file:vbox51.tlb" rename_namespace("vbox51"), named_guids, raw_interfaces_only
|
||||
|
||||
using std::string;
|
||||
using namespace vbox51;
|
||||
|
||||
namespace vbox51 {
|
||||
|
||||
class VBOX_PRIV {
|
||||
public:
|
||||
VBOX_PRIV() {};
|
||||
~VBOX_PRIV() {};
|
||||
|
||||
IVirtualBoxPtr m_pVirtualBox;
|
||||
ISessionPtr m_pSession;
|
||||
IMachinePtr m_pMachine;
|
||||
};
|
||||
|
||||
#include "vbox_mscom_impl.cpp"
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2010-2012 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef _VBOX_MSCOM51_H_
|
||||
#define _VBOX_MSCOM51_H_
|
||||
|
||||
#include "floppyio.h"
|
||||
#include "vbox_common.h"
|
||||
|
||||
namespace vbox51 {
|
||||
|
||||
#include "vbox_mscom_impl.h"
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -945,10 +945,10 @@ int VBOX_VM::deregister_vm(bool delete_media) {
|
|||
if (snapshots.size()) {
|
||||
for (size_t i = 0; i < snapshots.size(); i++) {
|
||||
CComPtr<IProgress> pProgress;
|
||||
#ifdef _VIRTUALBOX50_
|
||||
rc = pMachine->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#else
|
||||
#if defined(_VIRTUALBOX42_) || defined(_VIRTUALBOX43_)
|
||||
rc = pConsole->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#else
|
||||
rc = pMachine->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#endif
|
||||
if (SUCCEEDED(rc)) {
|
||||
pProgress->WaitForCompletion(-1);
|
||||
|
@ -1435,10 +1435,7 @@ int VBOX_VM::stop() {
|
|||
vboxlog_msg("Stopping VM.");
|
||||
if (online) {
|
||||
|
||||
#ifdef _VIRTUALBOX50_
|
||||
rc = m_pPrivate->m_pMachine->SaveState(&pProgress);
|
||||
if (CHECK_ERROR(rc)) goto CLEANUP;
|
||||
#else
|
||||
#if defined(_VIRTUALBOX42_) || defined(_VIRTUALBOX43_)
|
||||
CComPtr<IConsole> pConsole;
|
||||
// Get console object.
|
||||
rc = m_pPrivate->m_pSession->get_Console(&pConsole);
|
||||
|
@ -1447,6 +1444,9 @@ int VBOX_VM::stop() {
|
|||
// Save the state of the machine.
|
||||
rc = pConsole->SaveState(&pProgress);
|
||||
if (CHECK_ERROR(rc)) goto CLEANUP;
|
||||
#else
|
||||
rc = m_pPrivate->m_pMachine->SaveState(&pProgress);
|
||||
if (CHECK_ERROR(rc)) goto CLEANUP;
|
||||
#endif
|
||||
|
||||
// Wait until VM is powered down.
|
||||
|
@ -1619,16 +1619,8 @@ int VBOX_VM::create_snapshot(double elapsed_time) {
|
|||
|
||||
// Create new snapshot
|
||||
sprintf(buf, "%d", (int)elapsed_time);
|
||||
#ifdef _VIRTUALBOX50_
|
||||
CComBSTR strUUID;
|
||||
rc = m_pPrivate->m_pMachine->TakeSnapshot(CComBSTR(string(string("boinc_") + buf).c_str()), CComBSTR(""), true, &strUUID, &pProgress);
|
||||
if (CHECK_ERROR(rc)) {
|
||||
} else {
|
||||
rc = pProgress->WaitForCompletion(-1);
|
||||
if (CHECK_ERROR(rc)) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
#if defined(_VIRTUALBOX42_) || defined(_VIRTUALBOX43_)
|
||||
rc = m_pPrivate->m_pSession->get_Console(&pConsole);
|
||||
if (CHECK_ERROR(rc)) {
|
||||
} else {
|
||||
|
@ -1640,6 +1632,15 @@ int VBOX_VM::create_snapshot(double elapsed_time) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
CComBSTR strUUID;
|
||||
rc = m_pPrivate->m_pMachine->TakeSnapshot(CComBSTR(string(string("boinc_") + buf).c_str()), CComBSTR(""), true, &strUUID, &pProgress);
|
||||
if (CHECK_ERROR(rc)) {
|
||||
} else {
|
||||
rc = pProgress->WaitForCompletion(-1);
|
||||
if (CHECK_ERROR(rc)) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Resume VM
|
||||
|
@ -1698,11 +1699,10 @@ int VBOX_VM::cleanup_snapshots(bool delete_active) {
|
|||
CComPtr<IProgress> pProgress;
|
||||
|
||||
vboxlog_msg("Deleting stale snapshot.");
|
||||
|
||||
#ifdef _VIRTUALBOX50_
|
||||
rc = m_pPrivate->m_pMachine->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#else
|
||||
#if defined(_VIRTUALBOX42_) || defined(_VIRTUALBOX43_)
|
||||
rc = pConsole->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#else
|
||||
rc = m_pPrivate->m_pMachine->DeleteSnapshot(CComBSTR(snapshots[i].c_str()), &pProgress);
|
||||
#endif
|
||||
if (SUCCEEDED(rc)) {
|
||||
pProgress->WaitForCompletion(-1);
|
||||
|
@ -1747,10 +1747,10 @@ int VBOX_VM::restore_snapshot() {
|
|||
rc = pMachine->get_CurrentSnapshot(&pSnapshot);
|
||||
if (SUCCEEDED(rc)) {
|
||||
vboxlog_msg("Restore from previously saved snapshot.");
|
||||
#ifdef _VIRTUALBOX50_
|
||||
rc = pMachine->RestoreSnapshot(pSnapshot, &pProgress);
|
||||
#else
|
||||
#if defined(_VIRTUALBOX42_) || defined(_VIRTUALBOX43_)
|
||||
rc = pConsole->RestoreSnapshot(pSnapshot, &pProgress);
|
||||
#else
|
||||
rc = pMachine->RestoreSnapshot(pSnapshot, &pProgress);
|
||||
#endif
|
||||
if (CHECK_ERROR(rc)) goto CLEANUP;
|
||||
|
||||
|
|
|
@ -307,6 +307,7 @@
|
|||
<ClCompile Include="..\samples\vboxwrapper\vbox_mscom42.cpp" />
|
||||
<ClCompile Include="..\samples\vboxwrapper\vbox_mscom43.cpp" />
|
||||
<ClCompile Include="..\samples\vboxwrapper\vbox_mscom50.cpp" />
|
||||
<ClCompile Include="..\samples\vboxwrapper\vbox_mscom51.cpp" />
|
||||
<ClCompile Include="..\samples\vboxwrapper\vbox_mscom_impl.cpp" />
|
||||
<ClCompile Include="..\samples\vboxwrapper\vbox_vboxmanage.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -321,6 +322,7 @@
|
|||
<ClInclude Include="..\samples\vboxwrapper\vbox_mscom42.h" />
|
||||
<ClInclude Include="..\samples\vboxwrapper\vbox_mscom43.h" />
|
||||
<ClInclude Include="..\samples\vboxwrapper\vbox_mscom50.h" />
|
||||
<ClInclude Include="..\samples\vboxwrapper\vbox_mscom51.h" />
|
||||
<ClInclude Include="..\samples\vboxwrapper\vbox_mscom_impl.h" />
|
||||
<ClInclude Include="..\samples\vboxwrapper\vbox_vboxmanage.h" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue