Changeset 11096 in vbox for trunk/src/VBox
- Timestamp:
- Aug 4, 2008 12:15:41 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34017
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r11093 r11096 2758 2758 } 2759 2759 2760 STDMETHODIMP Machine::SetGuestProperty (INPTR BSTR a Key, INPTR BSTR aValue, INPTR BSTR aFlags)2760 STDMETHODIMP Machine::SetGuestProperty (INPTR BSTR aName, INPTR BSTR aValue, INPTR BSTR aFlags) 2761 2761 { 2762 2762 #if !defined (VBOX_WITH_GUEST_PROPS) 2763 2763 return E_NOTIMPL; 2764 2764 #else 2765 if (!VALID_PTR (a Key))2765 if (!VALID_PTR (aName)) 2766 2766 return E_INVALIDARG; 2767 2767 if ((aValue != NULL) && !VALID_PTR (aValue)) … … 2790 2790 { 2791 2791 bool found = false; 2792 HWData::GuestProperty List::iterator targetIt = mHWData->mGuestProperties.end();2792 HWData::GuestProperty property; 2793 2793 for (HWData::GuestPropertyList::iterator it = mHWData->mGuestProperties.begin(); 2794 2794 (it != mHWData->mGuestProperties.end()) && !found; ++it) 2795 if (it->mName == a Key)2795 if (it->mName == aName) 2796 2796 { 2797 targetIt = it; 2797 property = *it; 2798 mHWData.backup(); 2799 /* The backup() operation invalidates our iterator, so get a 2800 * new one. */ 2801 for (it = mHWData->mGuestProperties.begin(); 2802 it->mName != aName; ++it); 2803 mHWData->mGuestProperties.erase(it); 2798 2804 found = true; 2799 2805 } 2800 if (targetIt != mHWData->mGuestProperties.end()) 2806 if (found) 2807 { 2808 if (NULL != aValue) 2809 { 2810 property.mValue = aValue; 2811 property.mTimestamp = RTTimeMilliTS(); 2812 if (aFlags != NULL) 2813 property.mFlags = aFlags; 2814 mHWData->mGuestProperties.push_back(property); 2815 } 2816 } 2817 else if (aValue != NULL) 2801 2818 { 2802 2819 mHWData.backup(); 2803 if (NULL == aValue) 2804 mHWData->mGuestProperties.erase(targetIt); 2805 else 2806 { 2807 targetIt->mValue = aValue; 2808 targetIt->mTimestamp = RTTimeMilliTS(); 2809 if (aFlags != NULL) 2810 targetIt->mFlags = aFlags; 2811 } 2812 } 2813 else if (aValue != NULL) 2814 { 2815 mHWData.backup(); 2816 HWData::GuestProperty property; 2817 property.mName = aKey; 2820 property.mName = aName; 2818 2821 property.mValue = aValue; 2819 2822 property.mTimestamp = RTTimeMilliTS(); … … 2833 2836 BSTR dummy = NULL; 2834 2837 ULONG64 dummy64; 2835 rc = directControl->AccessGuestProperty (a Key, aValue, aFlags,2838 rc = directControl->AccessGuestProperty (aName, aValue, aFlags, 2836 2839 true /* isSetter */, 2837 2840 &dummy, &dummy64, &dummy);
Note:
See TracChangeset
for help on using the changeset viewer.