Changeset 52252 in vbox
- Timestamp:
- Aug 1, 2014 8:17:46 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95341
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r52251 r52252 177 177 HRESULT i_setGuestProperty(const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags); 178 178 HRESULT i_deleteGuestProperty(const Utf8Str &aName); 179 HRESULT i_enumerateGuestProperties( IN_BSTRaPatterns,180 ComSafeArrayOut(BSTR, aNames),181 ComSafeArrayOut(BSTR, aValues),182 ComSafeArrayOut(LONG64, aTimestamps),183 ComSafeArrayOut(BSTR, aFlags));179 HRESULT i_enumerateGuestProperties(const Utf8Str &aPatterns, 180 std::vector<Utf8Str> &aNames, 181 std::vector<Utf8Str> &aValues, 182 std::vector<LONG64> &aTimestamps, 183 std::vector<Utf8Str> &aFlags); 184 184 HRESULT i_onlineMergeMedium(IMediumAttachment *aMediumAttachment, 185 185 ULONG aSourceIdx, ULONG aTargetIdx, … … 820 820 #ifdef VBOX_WITH_GUEST_PROPS 821 821 static DECLCALLBACK(int) i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms); 822 HRESULT i_doEnumerateGuestProperties( CBSTRaPatterns,823 ComSafeArrayOut(BSTR, aNames),824 ComSafeArrayOut(BSTR, aValues),825 ComSafeArrayOut(LONG64, aTimestamps),826 ComSafeArrayOut(BSTR, aFlags));822 HRESULT i_doEnumerateGuestProperties(const Utf8Str &aPatterns, 823 std::vector<Utf8Str> &aNames, 824 std::vector<Utf8Str> &aValues, 825 std::vector<LONG64> &aTimestamps, 826 std::vector<Utf8Str> &aFlags); 827 827 828 828 void i_guestPropertiesHandleVMReset(void); -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r52251 r52252 827 827 void Console::i_guestPropertiesHandleVMReset(void) 828 828 { 829 com::SafeArray<BSTR> arrNames; 830 com::SafeArray<BSTR> arrValues; 831 com::SafeArray<LONG64> arrTimestamps; 832 com::SafeArray<BSTR> arrFlags; 833 HRESULT hrc = i_enumerateGuestProperties(Bstr("*").raw(), 834 ComSafeArrayAsOutParam(arrNames), 835 ComSafeArrayAsOutParam(arrValues), 836 ComSafeArrayAsOutParam(arrTimestamps), 837 ComSafeArrayAsOutParam(arrFlags)); 829 std::vector<Utf8Str> names; 830 std::vector<Utf8Str> values; 831 std::vector<LONG64> timestamps; 832 std::vector<Utf8Str> flags; 833 HRESULT hrc = i_enumerateGuestProperties("*", names, values, timestamps, flags); 838 834 if (SUCCEEDED(hrc)) 839 835 { 840 for (size_t i = 0; i < arrFlags.size(); i++)836 for (size_t i = 0; i < flags.size(); i++) 841 837 { 842 838 /* Delete all properties which have the flag "TRANSRESET". */ 843 if ( Utf8Str(arrFlags[i]).contains("TRANSRESET", Utf8Str::CaseInsensitive))839 if (flags[i].contains("TRANSRESET", Utf8Str::CaseInsensitive)) 844 840 { 845 hrc = mMachine->DeleteGuestProperty( arrNames[i]);841 hrc = mMachine->DeleteGuestProperty(Bstr(names[i]).raw()); 846 842 if (FAILED(hrc)) 847 LogRel(("RESET: Could not delete transient property \"% ls\", rc=%Rhrc\n",848 arrNames[i], hrc));843 LogRel(("RESET: Could not delete transient property \"%s\", rc=%Rhrc\n", 844 names[i].c_str(), hrc)); 849 845 } 850 846 } … … 1804 1800 } 1805 1801 1806 HRESULT Console::i_doEnumerateGuestProperties( CBSTRaPatterns,1807 ComSafeArrayOut(BSTR, aNames),1808 ComSafeArrayOut(BSTR, aValues),1809 ComSafeArrayOut(LONG64, aTimestamps),1810 ComSafeArrayOut(BSTR, aFlags))1802 HRESULT Console::i_doEnumerateGuestProperties(const Utf8Str &aPatterns, 1803 std::vector<Utf8Str> &aNames, 1804 std::vector<Utf8Str> &aValues, 1805 std::vector<LONG64> &aTimestamps, 1806 std::vector<Utf8Str> &aFlags) 1811 1807 { 1812 1808 AssertReturn(m_pVMMDev, E_FAIL); … … 1816 1812 VBOXHGCMSVCPARM parm[3]; 1817 1813 1818 Utf8Str utf8Patterns(aPatterns);1819 1814 parm[0].type = VBOX_HGCM_SVC_PARM_PTR; 1820 parm[0].u.pointer.addr = (void*) utf8Patterns.c_str();1821 parm[0].u.pointer.size = (uint32_t) utf8Patterns.length() + 1;1815 parm[0].u.pointer.addr = (void*)aPatterns.c_str(); 1816 parm[0].u.pointer.size = (uint32_t)aPatterns.length() + 1; 1822 1817 1823 1818 /* … … 1841 1836 return E_OUTOFMEMORY; 1842 1837 } 1838 1843 1839 parm[1].type = VBOX_HGCM_SVC_PARM_PTR; 1844 1840 parm[1].u.pointer.addr = Utf8Buf.mutableRaw(); 1845 1841 parm[1].u.pointer.size = (uint32_t)cchBuf + 1024; 1842 1843 parm[2].type = VBOX_HGCM_SVC_PARM_32BIT; 1844 parm[2].u.uint32 = 0; 1845 1846 1846 vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", ENUM_PROPS_HOST, 3, 1847 1847 &parm[0]); … … 1872 1872 } 1873 1873 1874 /* 1875 * And now we create the COM safe arrays and fill them in. 1876 */ 1877 com::SafeArray<BSTR> names(cEntries); 1878 com::SafeArray<BSTR> values(cEntries); 1879 com::SafeArray<LONG64> timestamps(cEntries); 1880 com::SafeArray<BSTR> flags(cEntries); 1874 1875 aNames.resize(cEntries); 1876 aValues.resize(cEntries); 1877 aTimestamps.resize(cEntries); 1878 aFlags.resize(cEntries); 1879 1881 1880 size_t iBuf = 0; 1882 1881 /* Rely on the service to have formated the data correctly. */ … … 1884 1883 { 1885 1884 size_t cchName = strlen(pszBuf + iBuf); 1886 Bstr(pszBuf + iBuf).detachTo(&names[i]);1885 aNames[i] = &pszBuf[iBuf]; 1887 1886 iBuf += cchName + 1; 1887 1888 1888 size_t cchValue = strlen(pszBuf + iBuf); 1889 Bstr(pszBuf + iBuf).detachTo(&values[i]);1889 aValues[i] = &pszBuf[iBuf]; 1890 1890 iBuf += cchValue + 1; 1891 1891 1892 size_t cchTimestamp = strlen(pszBuf + iBuf); 1892 timestamps[i] = RTStrToUInt64(pszBuf + iBuf);1893 aTimestamps[i] = RTStrToUInt64(&pszBuf[iBuf]); 1893 1894 iBuf += cchTimestamp + 1; 1895 1894 1896 size_t cchFlags = strlen(pszBuf + iBuf); 1895 Bstr(pszBuf + iBuf).detachTo(&flags[i]);1897 aFlags[i] = &pszBuf[iBuf]; 1896 1898 iBuf += cchFlags + 1; 1897 1899 } 1898 names.detachTo(ComSafeArrayOutArg(aNames)); 1899 values.detachTo(ComSafeArrayOutArg(aValues)); 1900 timestamps.detachTo(ComSafeArrayOutArg(aTimestamps)); 1901 flags.detachTo(ComSafeArrayOutArg(aFlags)); 1900 1902 1901 return S_OK; 1903 1902 } … … 5741 5740 * @note Temporarily locks this object for writing. 5742 5741 */ 5743 HRESULT Console::i_enumerateGuestProperties( IN_BSTRaPatterns,5744 ComSafeArrayOut(BSTR, aNames),5745 ComSafeArrayOut(BSTR, aValues),5746 ComSafeArrayOut(LONG64, aTimestamps),5747 ComSafeArrayOut(BSTR, aFlags))5742 HRESULT Console::i_enumerateGuestProperties(const Utf8Str &aPatterns, 5743 std::vector<Utf8Str> &aNames, 5744 std::vector<Utf8Str> &aValues, 5745 std::vector<LONG64> &aTimestamps, 5746 std::vector<Utf8Str> &aFlags) 5748 5747 { 5749 5748 #ifndef VBOX_WITH_GUEST_PROPS 5750 5749 ReturnComNotImplemented(); 5751 5750 #else /* VBOX_WITH_GUEST_PROPS */ 5752 if (!VALID_PTR(aPatterns) && (aPatterns != NULL))5753 return E_POINTER;5754 if (ComSafeArrayOutIsNull(aNames))5755 return E_POINTER;5756 if (ComSafeArrayOutIsNull(aValues))5757 return E_POINTER;5758 if (ComSafeArrayOutIsNull(aTimestamps))5759 return E_POINTER;5760 if (ComSafeArrayOutIsNull(aFlags))5761 return E_POINTER;5762 5751 5763 5752 AutoCaller autoCaller(this); … … 5772 5761 * autoVMCaller, so there is no need to hold a lock of this */ 5773 5762 5774 return i_doEnumerateGuestProperties(aPatterns, ComSafeArrayOutArg(aNames), 5775 ComSafeArrayOutArg(aValues), 5776 ComSafeArrayOutArg(aTimestamps), 5777 ComSafeArrayOutArg(aFlags)); 5763 return i_doEnumerateGuestProperties(aPatterns, aNames, aValues, aTimestamps, aFlags); 5778 5764 #endif /* VBOX_WITH_GUEST_PROPS */ 5779 5765 } -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r52251 r52252 883 883 return E_ACCESSDENIED; 884 884 885 com::SafeArray<BSTR> arrKeys; 886 com::SafeArray<BSTR> arrValues; 887 com::SafeArray<LONG64> arrTimestamps; 888 com::SafeArray<BSTR> arrFlags; 889 890 HRESULT hrc = mConsole->i_enumerateGuestProperties(Bstr(aPatterns).raw(), 891 ComSafeArrayAsOutParam(arrKeys), 892 ComSafeArrayAsOutParam(arrValues), 893 ComSafeArrayAsOutParam(arrTimestamps), 894 ComSafeArrayAsOutParam(arrFlags)); 895 896 size_t i = 0; 897 aKeys.resize(arrKeys.size()); 898 for(i = 0; i < arrKeys.size(); ++i) 899 aKeys[i] = arrKeys[i]; 900 aValues.resize(arrValues.size()); 901 for(i = 0; i < arrValues.size(); ++i) 902 aValues[i] = arrValues[i]; 903 aTimestamps.resize(arrTimestamps.size()); 904 for(i = 0; i < arrTimestamps.size(); ++i) 905 aTimestamps[i] = arrTimestamps[i]; 906 aFlags.resize(arrFlags.size()); 907 for(i = 0; i < arrFlags.size(); ++i) 908 aFlags[i] = arrFlags[i]; 909 910 return hrc; 885 return mConsole->i_enumerateGuestProperties(aPatterns, aKeys, aValues, aTimestamps, aFlags); 911 886 912 887 #else /* VBOX_WITH_GUEST_PROPS not defined */
Note:
See TracChangeset
for help on using the changeset viewer.