Changeset 75993 in vbox
- Timestamp:
- Dec 5, 2018 9:38:00 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 127214
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r75951 r75993 1091 1091 /** Requires process elevation (UAC). */ 1092 1092 #define VERR_PROC_ELEVATION_REQUIRED (-22419) 1093 /** Incompatible configuration requested. */ 1094 #define VERR_INCOMPATIBLE_CONFIG (-22420) 1093 1095 /** @} */ 1094 1096 -
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r75498 r75993 32 32 #include <iprt/path.h> 33 33 #include <iprt/string.h> 34 #include <VBox/AssertGuest.h> 34 35 35 36 #ifdef UNITTEST … … 722 723 } 723 724 725 SHFLROOT RootTmp; 726 if (!pRoot) 727 pRoot = &RootTmp; 724 728 if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8)) 725 729 { … … 727 731 PRTUTF16 utf16Name; 728 732 729 rc = RTStrToUtf16 733 rc = RTStrToUtf16((const char *) pszMapName->String.utf8, &utf16Name); 730 734 if (RT_FAILURE (rc)) 731 735 return rc; 732 736 733 737 pFolderMapping = vbsfMappingGetByName(utf16Name, pRoot); 734 RTUtf16Free 738 RTUtf16Free(utf16Name); 735 739 } 736 740 else … … 744 748 } 745 749 750 /* 751 * Check for reference count overflows and settings compatibility. 752 * For paranoid reasons, we don't allow modifying the case sensitivity 753 * setting while there are other mappings of a folder. 754 */ 755 AssertLogRelReturn(*pRoot < RT_ELEMENTS(pClient->acMappings), VERR_INTERNAL_ERROR); 756 AssertLogRelReturn(!pClient->fHasMappingCounts || pClient->acMappings[*pRoot] < _32K, VERR_TOO_MANY_OPENS); 757 ASSERT_GUEST_LOGREL_MSG_RETURN( pFolderMapping->cMappings == 0 758 || pFolderMapping->fGuestCaseSensitive == fCaseSensitive, 759 ("Incompatible case sensitivity setting: %s: %u mappings, %ssenitive, requested %ssenitive!\n", 760 pFolderMapping->pszFolderName, pFolderMapping->cMappings, 761 pFolderMapping->fGuestCaseSensitive ? "" : "in", fCaseSensitive ? "" : "in"), 762 VERR_INCOMPATIBLE_CONFIG); 763 764 /* 765 * Go ahead and map it. 766 */ 767 if (pClient->fHasMappingCounts) 768 pClient->acMappings[*pRoot] += 1; 746 769 pFolderMapping->cMappings++; 747 Assert(pFolderMapping->cMappings == 1 || pFolderMapping->fGuestCaseSensitive == fCaseSensitive);748 770 pFolderMapping->fGuestCaseSensitive = fCaseSensitive; 771 Log(("vbsfMmapFolder (cMappings=%u, acMappings[%u]=%u)\n", pFolderMapping->cMappings, *pRoot, pClient->acMappings[*pRoot])); 749 772 return VINF_SUCCESS; 750 773 } … … 775 798 return VERR_FILE_NOT_FOUND; 776 799 } 777 778 800 Assert(pFolderMapping->fValid == true && pFolderMapping->cMappings > 0); 801 802 AssertLogRelReturn(root < RT_ELEMENTS(pClient->acMappings), VERR_INTERNAL_ERROR); 803 AssertLogRelReturn(!pClient->fHasMappingCounts || pClient->acMappings[root] > 0, VERR_INVALID_HANDLE); 804 805 if (pClient->fHasMappingCounts) 806 pClient->acMappings[root] -= 1; 807 779 808 if (pFolderMapping->cMappings > 0) 780 809 pFolderMapping->cMappings--; 781 810 782 if ( pFolderMapping->cMappings == 0 811 uint32_t const cMappings = pFolderMapping->cMappings; 812 if ( cMappings == 0 783 813 && pFolderMapping->fPlaceholder) 784 814 { … … 790 820 } 791 821 792 Log(("vbsfUnmapFolder \n"));822 Log(("vbsfUnmapFolder (cMappings=%u, acMappings[%u]=%u)\n", cMappings, root, pClient->acMappings[root])); 793 823 return rc; 794 824 } -
trunk/src/VBox/HostServices/SharedFolders/service.cpp
r75969 r75993 156 156 static DECLCALLBACK(int) svcConnect (void *, uint32_t u32ClientID, void *pvClient, uint32_t fRequestor, bool fRestoring) 157 157 { 158 RT_NOREF(u32ClientID, pvClient, fRequestor, fRestoring); 159 int rc = VINF_SUCCESS; 160 158 RT_NOREF(u32ClientID, fRequestor, fRestoring); 159 SHFLCLIENTDATA *pClient = (SHFLCLIENTDATA *)pvClient; 161 160 Log(("SharedFolders host service: connected, u32ClientID = %u\n", u32ClientID)); 162 161 163 return rc; 162 pClient->fHasMappingCounts = true; 163 return VINF_SUCCESS; 164 164 } 165 165 … … 264 264 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 265 265 266 /* Restore the client data (flags + path delimiter at the moment) */266 /* Restore the client data (flags + path delimiter + mapping counts (new) at the moment) */ 267 267 rc = SSMR3GetU32(pSSM, &len); 268 268 AssertRCReturn(rc, rc); 269 269 270 if (len != sizeof(*pClient)) 271 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 272 273 rc = SSMR3GetMem(pSSM, pClient, sizeof(*pClient)); 270 if (len == RT_UOFFSETOF(SHFLCLIENTDATA, acMappings)) 271 pClient->fHasMappingCounts = false; 272 else if (len != sizeof(*pClient)) 273 return SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS, 274 "Saved SHFLCLIENTDATA size %u differs from current %u!\n", len, sizeof(*pClient)); 275 276 rc = SSMR3GetMem(pSSM, pClient, len); 274 277 AssertRCReturn(rc, rc); 275 278 -
trunk/src/VBox/HostServices/SharedFolders/shfl.h
r75498 r75993 20 20 #include <VBox/err.h> 21 21 #include <VBox/hgcmsvc.h> 22 #include <VBox/shflsvc.h> 22 23 23 24 #include <VBox/log.h> … … 54 55 /** Path delimiter. */ 55 56 RTUTF16 PathDelimiter; 57 /** Currently unused. */ 58 uint8_t bPadding; 59 /** Set if the client has mapping usage counts. 60 * This is for helping with saved state. */ 61 uint8_t fHasMappingCounts; 62 /** Mapping counts for each root ID so we can unmap the folders when the 63 * session disconnects or the VM resets. */ 64 uint16_t acMappings[SHFL_MAX_MAPPINGS]; 56 65 } SHFLCLIENTDATA; 57 66 /** Pointer to a SHFLCLIENTDATA structure. */ -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r75653 r75993 2071 2071 } 2072 2072 } 2073 2074 for (uint32_t i = 0; i < RT_ELEMENTS(pClient->acMappings); i++) 2075 if (pClient->acMappings[i]) 2076 { 2077 uint16_t cMappings = pClient->acMappings[i]; 2078 while (cMappings-- > 0) 2079 vbsfUnmapFolder(pClient, i); 2080 } 2081 2073 2082 return VINF_SUCCESS; 2074 2083 }
Note:
See TracChangeset
for help on using the changeset viewer.