VBoxGuest2.cpp revision 31a693ce9a8a9ebbecdcea9f24ce7f912aef4cd1
/* $Id$ */
/** @file
* VBoxGuest - Guest Additions Driver, bits shared with the windows code.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <VBox/VBoxGuestLib.h>
#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
# include "revision-generated.h"
#endif
#include "VBoxGuest2.h"
/** @todo Remove and merge this file with VBoxGuest.cpp when the Windows driver
* also will be built from the common sources. */
/**
* Report the guest information to the host.
*
* @returns IPRT status code.
* @param enmOSType The OS type to report.
*/
{
/*
* Allocate and fill in the two guest info reports.
*/
int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
if (RT_SUCCESS(rc))
{
rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo1, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
if (RT_SUCCESS(rc))
{
/*
* There are two protocols here:
* 1. Info2 + Info1. Supported by >=3.2.51.
* 2. Info1 and optionally Info2. The old protocol.
*
* We try protocol 1 first. It will fail with VERR_NOT_SUPPORTED
* if not supported by the VMMDev (message ordering requirement).
*/
Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
if (RT_SUCCESS(rc))
{
Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
}
else if ( rc == VERR_NOT_SUPPORTED
|| rc == VERR_NOT_IMPLEMENTED)
{
Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
if (RT_SUCCESS(rc))
{
Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
if (rc == VERR_NOT_IMPLEMENTED)
rc = VINF_SUCCESS;
}
}
}
}
return rc;
}
/**
* Report the guest driver status to the host.
*
* @returns IPRT status code.
* @param fActive Flag whether the driver is now active or not.
*/
int VBoxGuestReportDriverStatus(bool fActive)
{
/*
* Report guest status of the VBox driver to the host.
*/
Log(("VBoxGuestReportDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
if (RT_SUCCESS(rc))
{
Log(("VBoxGuestReportDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
rc = VINF_SUCCESS;
}
return rc;
}