VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxHostVersion.cpp

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
RevLine 
[23069]1/* $Id: VBoxHostVersion.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBoxHostVersion - Checks the host's VirtualBox version and notifies
4 * the user in case of an update.
5 */
6
7/*
[98103]8 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
[23069]9 *
[96407]10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * SPDX-License-Identifier: GPL-3.0-only
[23069]27 */
28
[95961]29#include <VBox/log.h>
30#include <VBox/VBoxGuestLib.h>
31
[23069]32#include "VBoxHostVersion.h"
33#include "VBoxTray.h"
[33966]34#include "VBoxHelpers.h"
[23069]35
36
37
[26493]38/** @todo Move this part in VbglR3 and just provide a callback for the platform-specific
[23876]39 notification stuff, since this is very similar to the VBoxClient code. */
[57741]40int VBoxCheckHostVersion(void)
[23069]41{
[23836]42 int rc;
[23876]43 uint32_t uGuestPropSvcClientID;
44
45 rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
[23836]46 if (RT_SUCCESS(rc))
47 {
[23876]48 char *pszHostVersion;
49 char *pszGuestVersion;
[95866]50 bool fUpdate;
51 rc = VbglR3HostVersionCheckForUpdate(uGuestPropSvcClientID, &fUpdate, &pszHostVersion, &pszGuestVersion);
[23876]52 if (RT_SUCCESS(rc))
53 {
[95866]54 if (fUpdate)
[23876]55 {
56 char szMsg[256]; /* Sizes according to MSDN. */
57 char szTitle[64];
[26493]58
[31002]59 /** @todo Add some translation macros here. */
[95866]60 RTStrPrintf(szTitle, sizeof(szTitle), "VirtualBox Guest Additions update available!");
61 RTStrPrintf(szMsg, sizeof(szMsg),
62 "Your guest is currently running the Guest Additions version %s. "
63 "We recommend updating to the latest version (%s) by choosing the "
64 "install option from the Devices menu.", pszGuestVersion, pszHostVersion);
[26493]65
[57741]66 rc = hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,
[34025]67 szMsg, szTitle,
68 5000 /* Time to display in msec */, NIIF_INFO);
[23876]69 if (RT_FAILURE(rc))
[51469]70 LogFlowFunc(("Guest Additions update found; however: could not show version notifier balloon tooltip, rc=%Rrc\n", rc));
[23876]71 }
[23069]72
[31002]73 /* Store host version to not notify again. */
[23876]74 rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
[26493]75
[23876]76 VbglR3GuestPropReadValueFree(pszHostVersion);
77 VbglR3GuestPropReadValueFree(pszGuestVersion);
78 }
79 VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
[23836]80 }
[23069]81 return rc;
82}
83
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use