Changeset 23655 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Oct 9, 2009 3:51:35 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 53366
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp
r23634 r23655 37 37 38 38 #ifdef VBOX_WITH_GUEST_PROPS 39 /** 40 * Wrapper around VbglR3GuestPropWriteValue that does value formatting and 41 * logging. 42 * 43 * @returns VBox status code. Errors will be logged. 44 * 45 * @param u32ClientId The HGCM client ID for the guest property session. 46 * @param pszName The property name. 47 * @param pszValueFormat The property format string. If this is NULL then 48 * the property will be removed. 49 * @param ... Format arguments. 50 */ 39 51 int VBoxServiceWritePropF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...) 40 52 { … … 42 54 if (pszValueFormat != NULL) 43 55 { 56 /** @todo Log the value as well? just copy the guts of 57 * VbglR3GuestPropWriteValueV. */ 44 58 VBoxServiceVerbose(3, "Writing guest property \"%s\"\n", pszName); 45 59 va_list va; … … 51 65 } 52 66 else 67 { 53 68 rc = VbglR3GuestPropWriteValue(u32ClientId, pszName, NULL); 69 if (RT_FAILURE(rc)) 70 VBoxServiceError("Error removing guest property \"%s\" (rc=%Rrc)\n", pszName, rc); 71 } 54 72 return rc; 55 73 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r23575 r23655 380 380 { 381 381 VBoxServiceError("Failed to query registry key (install directory)! Error: %Rrc\n", rc); 382 } 382 } 383 383 else 384 384 { … … 401 401 402 402 /* Write information to host. */ 403 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/InstallDir", szInstDir);404 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/Revision", szRev);405 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/Version", szVer);403 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/InstallDir", "%s", szInstDir); 404 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/Revision", "%s", szRev); 405 rc = VBoxServiceWritePropF(uiClientID, "/VirtualBox/GuestAdd/Version", "%s", szVer); 406 406 407 407 if (NULL != hKey) … … 494 494 rc = VBoxServiceGetFileVersionString(pTable->pszFilePath, pTable->pszFileName, szVer, sizeof(szVer)); 495 495 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestAdd/Components/%s", pTable->pszFileName); 496 rc = VBoxServiceWritePropF(uiClientID, szPropPath, szVer);496 rc = VBoxServiceWritePropF(uiClientID, szPropPath, "%s", szVer); 497 497 pTable++; 498 498 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r23575 r23655 159 159 char szInfo[256] = {0}; 160 160 rc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szInfo, sizeof(szInfo)); 161 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product", szInfo);161 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Product", "%s", szInfo); 162 162 163 163 rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo)); 164 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release", szInfo);164 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Release", "%s", szInfo); 165 165 166 166 rc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szInfo, sizeof(szInfo)); 167 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version", szInfo);167 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/Version", "%s", szInfo); 168 168 169 169 rc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szInfo, sizeof(szInfo)); 170 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack", szInfo);170 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/ServicePack", "%s", szInfo); 171 171 172 172 /* Retrieve version information about Guest Additions and installed files (components). */ … … 176 176 #else 177 177 /* VBoxServiceGetAddsVersion !RT_OS_WINDOWS */ 178 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", VBOX_VERSION_STRING);178 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Version", "%s", VBOX_VERSION_STRING); 179 179 180 180 char szRevision[32]; 181 181 RTStrPrintf(szRevision, sizeof(szRevision), "%u", VBOX_SVN_REV); 182 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", szRevision);182 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestAdd/Revision", "%s", szRevision); 183 183 #endif 184 184 … … 263 263 #endif /* !RT_OS_WINDOWS */ 264 264 265 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", (uiUserCount > 0) ? szUserList : NULL); 265 if (uiUserCount > 0) 266 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", "%s", szUserList); 267 else 268 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsersList", NULL); 266 269 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/OS/LoggedInUsers", "%u", uiUserCount); 267 270 if (g_VMInfoLoggedInUsers != uiUserCount || g_VMInfoLoggedInUsers == UINT32_MAX) … … 331 334 int iCurIface = 0; 332 335 333 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/Net/Count", "%d", (nNumInterfaces > 1 ? nNumInterfaces-1 : 0)); 336 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, "/VirtualBox/GuestInfo/Net/Count", "%d", 337 nNumInterfaces > 1 ? nNumInterfaces-1 : 0); 334 338 335 339 /** @todo Use GetAdaptersInfo() and GetAdapterAddresses (IPv4 + IPv6) for more information. */ … … 369 373 #endif 370 374 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/V4/Broadcast", iCurIface); 371 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, inet_ntoa(pAddress->sin_addr));375 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, "%s", inet_ntoa(pAddress->sin_addr)); 372 376 373 377 #ifdef RT_OS_WINDOWS … … 387 391 #endif 388 392 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/V4/Netmask", iCurIface); 389 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, inet_ntoa(pAddress->sin_addr)); 390 391 if (nFlags & IFF_UP) 392 RTStrPrintf(szTemp, sizeof(szTemp), "Up"); 393 else 394 RTStrPrintf(szTemp, sizeof(szTemp), "Down"); 393 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, "%s", inet_ntoa(pAddress->sin_addr)); 395 394 396 395 RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%d/Status", iCurIface); 397 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, szTemp); 396 VBoxServiceWritePropF(g_VMInfoGuestPropSvcClientID, szPropPath, 397 nFlags & IFF_UP ? "Up" : "Down"); 398 398 399 399 iCurIface++;
Note:
See TracChangeset
for help on using the changeset viewer.