VirtualBox

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

最後變更 在這個檔案從95967是 95961,由 vboxsync 提交於 3 年 前

Additions/VBoxTray: Got rid of VBoxDisplay.h (renamed to VBoxTrayInternal.h, more stuff added later), as I also tripped over this several times in the past already, log include fixes.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.8 KB
 
1/* $Id: VBoxHostVersion.cpp 95961 2022-08-01 14:08:20Z 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-2022 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.alldomusa.eu.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#include <VBox/log.h>
20#include <VBox/VBoxGuestLib.h>
21
22#include "VBoxHostVersion.h"
23#include "VBoxTray.h"
24#include "VBoxHelpers.h"
25
26
27
28/** @todo Move this part in VbglR3 and just provide a callback for the platform-specific
29 notification stuff, since this is very similar to the VBoxClient code. */
30int VBoxCheckHostVersion(void)
31{
32 int rc;
33 uint32_t uGuestPropSvcClientID;
34
35 rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
36 if (RT_SUCCESS(rc))
37 {
38 char *pszHostVersion;
39 char *pszGuestVersion;
40 bool fUpdate;
41 rc = VbglR3HostVersionCheckForUpdate(uGuestPropSvcClientID, &fUpdate, &pszHostVersion, &pszGuestVersion);
42 if (RT_SUCCESS(rc))
43 {
44 if (fUpdate)
45 {
46 char szMsg[256]; /* Sizes according to MSDN. */
47 char szTitle[64];
48
49 /** @todo Add some translation macros here. */
50 RTStrPrintf(szTitle, sizeof(szTitle), "VirtualBox Guest Additions update available!");
51 RTStrPrintf(szMsg, sizeof(szMsg),
52 "Your guest is currently running the Guest Additions version %s. "
53 "We recommend updating to the latest version (%s) by choosing the "
54 "install option from the Devices menu.", pszGuestVersion, pszHostVersion);
55
56 rc = hlpShowBalloonTip(g_hInstance, g_hwndToolWindow, ID_TRAYICON,
57 szMsg, szTitle,
58 5000 /* Time to display in msec */, NIIF_INFO);
59 if (RT_FAILURE(rc))
60 LogFlowFunc(("Guest Additions update found; however: could not show version notifier balloon tooltip, rc=%Rrc\n", rc));
61 }
62
63 /* Store host version to not notify again. */
64 rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
65
66 VbglR3GuestPropReadValueFree(pszHostVersion);
67 VbglR3GuestPropReadValueFree(pszGuestVersion);
68 }
69 VbglR3GuestPropDisconnect(uGuestPropSvcClientID);
70 }
71 return rc;
72}
73
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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