Changeset 28630 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Apr 23, 2010 8:54:57 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r28605 r28630 144 144 char szInfo[256]; 145 145 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); 150 148 151 149 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); 156 152 157 153 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); 162 156 163 157 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); 168 160 169 161 /* … … 173 165 char *pszAddRev; 174 166 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); 175 171 if (RT_SUCCESS(rc)) 176 172 { 177 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "%s", pszAddVer);178 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", pszAddRev);179 173 RTStrFree(pszAddVer); 180 174 RTStrFree(pszAddRev); 181 175 } 182 else183 {184 /* information could not be retrieved, clear stale entries */185 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "");186 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "");187 }188 176 189 177 #ifdef RT_OS_WINDOWS … … 193 181 char *pszInstDir; 194 182 rc = VbglR3GetAdditionsInstallationPath(&pszInstDir); 183 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir", 184 "%s", RT_FAILURE(rc) ? "" : pszInstDir); 195 185 if (RT_SUCCESS(rc)) 196 {197 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir", "%s", pszInstDir);198 186 RTStrFree(pszInstDir); 199 }200 else201 /* information could not be retrieved, clear stale entry */202 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/InstallDir", "");203 187 204 188 VBoxServiceWinGetComponentVersions(g_VMInfoGuestPropSvcClientID); … … 498 482 #endif 499 483 500 RTSemEventMultiDestroy(g_VMInfoEvent);501 g_VMInfoEvent = NIL_RTSEMEVENTMULTI;502 484 return rc; 503 485 } … … 522 504 * be replaced with "temporary properties" later. 523 505 * 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). 526 510 */ 527 511 rc = VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.