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
Line 
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/*
8 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
9 *
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
27 */
28
29#include <VBox/log.h>
30#include <VBox/VBoxGuestLib.h>
31
32#include "VBoxHostVersion.h"
33#include "VBoxTray.h"
34#include "VBoxHelpers.h"
35
36
37
38/** @todo Move this part in VbglR3 and just provide a callback for the platform-specific
39 notification stuff, since this is very similar to the VBoxClient code. */
40int VBoxCheckHostVersion(void)
41{
42 int rc;
43 uint32_t uGuestPropSvcClientID;
44
45 rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
46 if (RT_SUCCESS(rc))
47 {
48 char *pszHostVersion;
49 char *pszGuestVersion;
50 bool fUpdate;
51 rc = VbglR3HostVersionCheckForUpdate(uGuestPropSvcClientID, &fUpdate, &pszHostVersion, &pszGuestVersion);
52 if (RT_SUCCESS(rc))
53 {
54 if (fUpdate)
55 {
56 char szMsg[256]; /* Sizes according to MSDN. */
57 char szTitle[64];
58
59 /** @todo Add some translation macros here. */
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);
65
66 rc = hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,
67 szMsg, szTitle,
68 5000 /* Time to display in msec */, NIIF_INFO);
69 if (RT_FAILURE(rc))
70 LogFlowFunc(("Guest Additions update found; however: could not show version notifier balloon tooltip, rc=%Rrc\n", rc));
71 }
72
73 /* Store host version to not notify again. */
74 rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
75
76 VbglR3GuestPropReadValueFree(pszHostVersion);
77 VbglR3GuestPropReadValueFree(pszGuestVersion);
78 }
79 VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
80 }
81 return rc;
82}
83
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use