VirtualBox

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

Last change on this file since 106945 was 106411, checked in by vboxsync, 8 weeks ago

Additions/VBoxTray: Implemented ability for easier user-controllable logging (also via verbose levels), support for running in foreground mode (with a console window attached to) and selective starting of sub services to easier pinpoint errors in release builds. Cleaned up initialization / termination code a little. See command line help for new options. bugref:10763

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: VBoxHostVersion.cpp 106411 2024-10-17 07:44:43Z 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-2024 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 "VBoxTrayInternal.h"
35#include "VBoxHelpers.h"
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 = VBoxTrayHlpShowBalloonTip(szMsg, szTitle, RT_MS_5SEC);
67
68 VBoxTrayInfo("Guest Additions update found: %s -> %s\n", pszGuestVersion, pszHostVersion);
69 }
70
71 /* Store host version to not notify again. */
72 rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
73
74 VbglR3GuestPropReadValueFree(pszHostVersion);
75 VbglR3GuestPropReadValueFree(pszGuestVersion);
76 }
77 VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
78 }
79 return rc;
80}
81
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette