Changeset 86876 in vbox for trunk/src/VBox/Additions/x11/VBoxClient
- Timestamp:
- Nov 12, 2020 4:38:00 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141332
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp
r86873 r86876 681 681 682 682 /** 683 * An abbreviated copy of the VGSvcReadProp from VBoxServiceUtils.cpp684 */685 static int readGuestProperty(uint32_t u32ClientId, const char *pszPropName)686 {687 AssertPtrReturn(pszPropName, VERR_INVALID_POINTER);688 689 uint32_t cbBuf = _1K;690 void *pvBuf = NULL;691 int rc = VINF_SUCCESS; /* MSC can't figure out the loop */692 693 for (unsigned cTries = 0; cTries < 10; cTries++)694 {695 /*696 * (Re-)Allocate the buffer and try read the property.697 */698 RTMemFree(pvBuf);699 pvBuf = RTMemAlloc(cbBuf);700 if (!pvBuf)701 {702 VBClLogError("Guest Property: Failed to allocate %zu bytes\n", cbBuf);703 rc = VERR_NO_MEMORY;704 break;705 }706 char *pszValue;707 char *pszFlags;708 uint64_t uTimestamp;709 rc = VbglR3GuestPropRead(u32ClientId, pszPropName, pvBuf, cbBuf, &pszValue, &uTimestamp, &pszFlags, NULL);710 if (RT_FAILURE(rc))711 {712 if (rc == VERR_BUFFER_OVERFLOW)713 {714 /* try again with a bigger buffer. */715 cbBuf *= 2;716 continue;717 }718 else719 break;720 }721 else722 break;723 }724 725 if (pvBuf)726 RTMemFree(pvBuf);727 return rc;728 }729 730 /**731 683 * We start VBoxDRMClient from VBoxService in case some guest property is set. 732 684 * We check the same guest property here and dont start this service in case … … 735 687 static bool checkDRMClient(void) 736 688 { 737 uint32_t uGuestPropSvcClientID; 738 int rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID); 739 if (RT_FAILURE(rc)) 740 return false; 741 rc = readGuestProperty(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/DRMResize" /*pszPropName*/); 742 if (RT_FAILURE(rc)) 743 return false; 744 return true; 689 bool fStartClient = false; 690 691 uint32_t idClient; 692 int rc = VbglR3GuestPropConnect(&idClient); 693 if (RT_SUCCESS(rc)) 694 { 695 fStartClient = VbglR3GuestPropExist(idClient, "/VirtualBox/GuestAdd/DRMResize" /*pszPropName*/); 696 VbglR3GuestPropDisconnect(idClient); 697 } 698 699 return fStartClient; 745 700 } 746 701
Note:
See TracChangeset
for help on using the changeset viewer.