- Timestamp:
- Mar 7, 2011 9:45:24 AM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp
r34406 r36178 105 105 * gets deleted when the property cache did not have the chance to 106 106 * gracefully clean it up (due to a hard VM reset etc), so set this 107 * guest property using the TRANSIENT flag.107 * guest property using the TRANSIENT and TRANSIENT_RESET flags. 108 108 */ 109 rc = VbglR3GuestPropWrite(u32ClientId, pszName, pszValue, "TRANSIENT"); 109 rc = VbglR3GuestPropWrite(u32ClientId, pszName, pszValue, "TRANSIENT,TRANSIENT_RESET"); 110 if (rc == VERR_PARSE_ERROR) 111 { 112 /* Host does not support the "TRANSIENT_RESET" flag, so only 113 * use the "TRANSIENT" flag* -- better than nothing :-). */ 114 rc = VbglR3GuestPropWrite(u32ClientId, pszName, pszValue, "TRANSIENT"); 115 } 110 116 } 111 117 else … … 377 383 /* 378 384 * When destroying the cache and we have a temporary value, remove the 379 * (eventually) set TRANSIENT flag from it so that it doesn't get deleted385 * (eventually) set TRANSIENT_RESET flag from it so that it doesn't get deleted 380 386 * by the host side in order to put the actual reset value in it. 381 387 */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h
r31925 r36178 21 21 #include "VBoxServiceInternal.h" 22 22 23 # ifdef VBOX_WITH_GUEST_PROPS23 # ifdef VBOX_WITH_GUEST_PROPS 24 24 25 /** Indicates wheter a guest property is temporary and either should 26 * get deleted when 27 * - a) the property cache gets destroyed, or 28 * - b) the VM gets a hard reset / shutdown 29 * or gets a default "reset" value (if specified via VBoxServicePropCacheUpdateEntry) 30 * when the property cache gets properly destroyed. 31 */ 25 32 #define VBOXSERVICEPROPCACHEFLAG_TEMPORARY RT_BIT(1) 33 /** Indicates whether a property every time needs to be updated, regardless 34 * if its real value changed or not. */ 26 35 #define VBOXSERVICEPROPCACHEFLAG_ALWAYS_UPDATE RT_BIT(2) 27 36 … … 32 41 int VBoxServicePropCacheFlush(PVBOXSERVICEVEPROPCACHE pCache); 33 42 void VBoxServicePropCacheDestroy(PVBOXSERVICEVEPROPCACHE pCache); 34 # endif43 # endif /* VBOX_WITH_GUEST_PROPS */ 35 44 36 #endif 45 #endif /* ___VBoxServicePropCache_h */ 37 46 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r36041 r36178 619 619 ComSafeArrayOut(BSTR, aFlags)); 620 620 621 bool enabledGuestPropertiesVRDP(void); 622 void updateGuestPropertiesVRDPLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain); 623 void updateGuestPropertiesVRDPDisconnect(uint32_t u32ClientId); 621 void guestPropertiesHandleVMReset(void); 622 bool guestPropertiesVRDPEnabled(void); 623 void guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain); 624 void guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId); 624 625 #endif 625 626 -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r36074 r36178 673 673 #ifdef VBOX_WITH_GUEST_PROPS 674 674 675 bool Console::enabledGuestPropertiesVRDP(void) 675 /** 676 * Handles guest properties on a VM reset. 677 * At the moment we only delete properties which have the flag 678 * "TRARESET". 679 */ 680 void Console::guestPropertiesHandleVMReset(void) 681 { 682 com::SafeArray<BSTR> arrNames; 683 com::SafeArray<BSTR> arrValues; 684 com::SafeArray<LONG64> arrTimestamps; 685 com::SafeArray<BSTR> arrFlags; 686 HRESULT hrc = enumerateGuestProperties(Bstr("*").raw(), 687 ComSafeArrayAsOutParam(arrNames), 688 ComSafeArrayAsOutParam(arrValues), 689 ComSafeArrayAsOutParam(arrTimestamps), 690 ComSafeArrayAsOutParam(arrFlags)); 691 if (SUCCEEDED(hrc)) 692 { 693 for (size_t i = 0; i < arrFlags.size(); i++) 694 { 695 /* Delete all properties which have the flag "TRARESET". */ 696 if (Utf8Str(arrFlags[i]).contains("TRANSIENT_RESET", Utf8Str::CaseInsensitive)) 697 { 698 hrc = mMachine->SetGuestProperty(arrNames[i], Bstr("").raw() /* Value */, 699 Bstr("").raw() /* Flags */); 700 if (FAILED(hrc)) 701 LogRel(("RESET: Could not delete transient property \"%ls\", rc=%Rhrc\n", 702 arrNames[i], hrc)); 703 } 704 } 705 } 706 else 707 LogRel(("RESET: Unable to enumerate guest properties, rc=%Rhrc\n", hrc)); 708 } 709 710 bool Console::guestPropertiesVRDPEnabled(void) 676 711 { 677 712 Bstr value; 678 713 HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableGuestPropertiesVRDP").raw(), 679 714 value.asOutParam()); 680 if (hrc == S_OK) 681 { 682 if (value == "1") 683 { 684 return true; 685 } 686 } 715 if ( hrc == S_OK 716 && value == "1") 717 return true; 687 718 return false; 688 719 } 689 720 690 void Console::updateGuestPropertiesVRDPLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain) 691 { 692 if (!enabledGuestPropertiesVRDP()) 693 { 721 void Console::guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain) 722 { 723 if (!guestPropertiesVRDPEnabled()) 694 724 return; 695 }696 725 697 726 char szPropNm[256]; … … 725 754 } 726 755 727 void Console:: updateGuestPropertiesVRDPDisconnect(uint32_t u32ClientId)728 { 729 if (! enabledGuestPropertiesVRDP())756 void Console::guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId) 757 { 758 if (!guestPropertiesVRDPEnabled()) 730 759 return; 731 760 … … 961 990 962 991 #ifdef VBOX_WITH_GUEST_PROPS 963 updateGuestPropertiesVRDPLogon(u32ClientId, pszUser, pszDomain);992 guestPropertiesVRDPUpdateLogon(u32ClientId, pszUser, pszDomain); 964 993 #endif /* VBOX_WITH_GUEST_PROPS */ 965 994 … … 1096 1125 1097 1126 #ifdef VBOX_WITH_GUEST_PROPS 1098 updateGuestPropertiesVRDPDisconnect(u32ClientId);1127 guestPropertiesVRDPUpdateDisconnect(u32ClientId); 1099 1128 #endif /* VBOX_WITH_GUEST_PROPS */ 1100 1129 … … 6768 6797 break; 6769 6798 } 6799 break; 6800 } 6801 6802 case VMSTATE_RESETTING: 6803 { 6804 #ifdef VBOX_WITH_GUEST_PROPS 6805 /* Do not take any read/write locks here! */ 6806 that->guestPropertiesHandleVMReset(); 6807 #endif 6770 6808 break; 6771 6809 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r36168 r36178 5009 5009 /** @todo Fix when adding DeleteGuestProperty(), 5010 5010 see defect. */ 5011 *aValue ? aValue : NULL, aFlags, true /* isSetter */, 5011 *aValue ? aValue : NULL, *aFlags ? aFlags : NULL, 5012 true /* isSetter */, 5012 5013 &dummy, &dummy64, &dummy); 5013 5014 } … … 8652 8653 || mData->mMachineState == MachineState_Aborted 8653 8654 || mData->mMachineState == MachineState_Teleported) 8654 && property.mFlags & guestProp::TRANSIENT) 8655 && ( property.mFlags & guestProp::TRANSIENT 8656 || property.mFlags & guestProp::TRANSIENT_RESET)) 8655 8657 continue; 8656 8658 settings::GuestProperty prop; … … 12217 12219 for (it = mHWData->mGuestProperties.begin(); 12218 12220 it != mHWData->mGuestProperties.end(); ++it) 12219 if (it->mFlags & guestProp::TRANSIENT) 12221 if ( (it->mFlags & guestProp::TRANSIENT) 12222 || (it->mFlags & guestProp::TRANSIENT_RESET)) 12220 12223 { 12221 12224 fNeedsSaving = true;
Note:
See TracChangeset
for help on using the changeset viewer.