VirtualBox

Ignore:
Timestamp:
Apr 23, 2010 8:54:57 AM (15 years ago)
Author:
vboxsync
Message:

VBoxServiceVMInfo: don't destroy the property handle when leaving the worker loop, do this in the term function; some cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r28605 r28630  
    144144    char szInfo[256];
    145145    int rc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szInfo, sizeof(szInfo));
    146     if (RT_SUCCESS(rc))
    147         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product", "%s", szInfo);
    148     else
    149         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product", "");
     146    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product",
     147                          "%s", RT_FAILURE(rc) ? "" : szInfo);
    150148
    151149    rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo));
    152     if (RT_SUCCESS(rc))
    153         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release", "%s", szInfo);
    154     else
    155         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release", "");
     150    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release",
     151                          "%s", RT_FAILURE(rc) ? "" : szInfo);
    156152
    157153    rc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szInfo, sizeof(szInfo));
    158     if (RT_SUCCESS(rc))
    159         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version", "%s", szInfo);
    160     else
    161         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version", "");
     154    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version",
     155                          "%s", RT_FAILURE(rc) ? "" : szInfo);
    162156
    163157    rc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szInfo, sizeof(szInfo));
    164     if (RT_SUCCESS(rc))
    165         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack", "%s", szInfo);
    166     else
    167         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack", "");
     158    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack",
     159                          "%s", RT_FAILURE(rc) ? "" : szInfo);
    168160
    169161    /*
     
    173165    char *pszAddRev;
    174166    rc = VbglR3GetAdditionsVersion(&pszAddVer, &pszAddRev);
     167    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version",
     168                          "%s", RT_FAILURE(rc) ? "" : pszAddVer);
     169    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision",
     170                          "%s", RT_FAILURE(rc) ? "" : pszAddRev);
    175171    if (RT_SUCCESS(rc))
    176172    {
    177         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version",  "%s", pszAddVer);
    178         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", pszAddRev);
    179173        RTStrFree(pszAddVer);
    180174        RTStrFree(pszAddRev);
    181175    }
    182     else
    183     {
    184         /* information could not be retrieved, clear stale entries */
    185         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "");
    186         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "");
    187     }
    188176
    189177#ifdef RT_OS_WINDOWS
     
    193181    char *pszInstDir;
    194182    rc = VbglR3GetAdditionsInstallationPath(&pszInstDir);
     183    VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir",
     184                          "%s", RT_FAILURE(rc) ? "" :  pszInstDir);
    195185    if (RT_SUCCESS(rc))
    196     {
    197         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir", "%s", pszInstDir);
    198186        RTStrFree(pszInstDir);
    199     }
    200     else
    201         /* information could not be retrieved, clear stale entry */
    202         VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir", "");
    203187
    204188    VBoxServiceWinGetComponentVersions(g_VMInfoGuestPropSvcClientID);
     
    498482#endif
    499483
    500     RTSemEventMultiDestroy(g_VMInfoEvent);
    501     g_VMInfoEvent = NIL_RTSEMEVENTMULTI;
    502484    return rc;
    503485}
     
    522504         *        be replaced with "temporary properties" later.
    523505         *
    524          *  @todo r=bird: This code isn't called on non-Windows systems. We need
    525          *        a more formal way of shutting down the service for that to work.
     506         *        One idea is to introduce a (HGCM-)session guest property
     507         *        flag meaning that a guest property is only valid as long
     508         *        as the HGCM session isn't closed (e.g. guest application
     509         *        terminates).
    526510         */
    527511        rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
Note: See TracChangeset for help on using the changeset viewer.

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