- Timestamp:
- Apr 3, 2023 3:17:07 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156645
- Location:
- trunk/src/VBox
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestCtrl.cpp ¶
r99257 r99262 1260 1260 #ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS 1261 1261 /** 1262 * Retrieves a HOST_MSG_FS_QUERY_INFO message. 1263 * 1264 * @returns VBox status code. 1265 * @param pCtx Guest control command context to use. 1266 * @param pszPath Where to return the path of the file system object to query. 1267 * @param cbPath Size (in bytes) of \a pszPath. 1268 */ 1269 VBGLR3DECL(int) VbglR3GuestCtrlFsGetQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, char *pszPath, uint32_t cbPath) 1270 { 1271 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 1272 1273 AssertPtrReturn(pszPath, VERR_INVALID_POINTER); 1274 AssertReturn(cbPath, VERR_INVALID_PARAMETER); 1275 1276 int rc; 1277 do 1278 { 1279 HGCMMsgFsQueryInfo Msg; 1280 VBGL_HGCM_HDR_INIT(&Msg.hdr, pCtx->uClientID, vbglR3GuestCtrlGetMsgFunctionNo(pCtx->uClientID), pCtx->uNumParms); 1281 VbglHGCMParmUInt32Set(&Msg.context, HOST_MSG_FS_QUERY_INFO); 1282 VbglHGCMParmPtrSet(&Msg.path, pszPath, cbPath); 1283 1284 rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg)); 1285 if (RT_SUCCESS(rc)) 1286 Msg.context.GetUInt32(&pCtx->uContextID); 1287 1288 } while (rc == VERR_INTERRUPTED && g_fVbglR3GuestCtrlHavePeekGetCancel); 1289 return rc; 1290 } 1291 1292 /** 1262 1293 * Retrieves a HOST_MSG_FS_OBJ_QUERY_INFO message. 1263 1294 * … … 2683 2714 VBGL_HGCM_HDR_INIT(&Msg.reply_hdr.hdr, pCtx->uClientID, GUEST_MSG_FS_NOTIFY, GSTCTL_HGCM_REPLY_HDR_PARMS + 3); 2684 2715 VbglHGCMParmUInt32Set(&Msg.reply_hdr.context, pCtx->uContextID); 2685 VbglHGCMParmUInt32Set(&Msg.reply_hdr.type, GUEST_FS_NOTIFYTYPE_QUERY_ INFO);2716 VbglHGCMParmUInt32Set(&Msg.reply_hdr.type, GUEST_FS_NOTIFYTYPE_QUERY_OBJ_INFO); 2686 2717 VbglHGCMParmUInt32Set(&Msg.reply_hdr.rc, uRc); 2687 2718 2688 VbglHGCMParmPtrSet (&Msg.u.query info.obj_info, pFsObjInfo, sizeof(GSTCTLFSOBJINFO));2689 VbglHGCMParmPtrSetString(&Msg.u.query info.user, pszUser);2690 VbglHGCMParmPtrSetString(&Msg.u.query info.groups, pszGroups);2719 VbglHGCMParmPtrSet (&Msg.u.queryobjinfo.obj_info, pFsObjInfo, sizeof(GSTCTLFSOBJINFO)); 2720 VbglHGCMParmPtrSetString(&Msg.u.queryobjinfo.user, pszUser); 2721 VbglHGCMParmPtrSetString(&Msg.u.queryobjinfo.groups, pszGroups); 2691 2722 2692 2723 return VbglR3HGCMCall(&Msg.reply_hdr.hdr, RT_UOFFSET_AFTER(HGCMReplyFsNotify, u.queryinfo)); … … 2732 2763 2733 2764 return VbglR3HGCMCall(&Msg.reply_hdr.hdr, RT_UOFFSET_AFTER(HGCMReplyFsNotify, u.createtemp)); 2765 } 2766 2767 /** 2768 * Replies to a HOST_MSG_FS_QUERY_INFO message. 2769 * 2770 * @returns VBox status code. 2771 * @param pCtx Guest control command context to use. 2772 * @param uRc Guest rc of operation (note: IPRT-style signed int). 2773 * @param pFsInfo File system information to return. 2774 * @param cbFsInfo Size (in bytes) of \a pFsInfo. 2775 */ 2776 VBGLR3DECL(int) VbglR3GuestCtrlFsCbQueryInfo(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLFSINFO pFsInfo, uint32_t cbFsInfo) 2777 { 2778 AssertPtrReturn(pCtx, VERR_INVALID_POINTER); 2779 AssertPtrReturn(pFsInfo, VERR_INVALID_POINTER); 2780 AssertReturn(cbFsInfo, VERR_INVALID_PARAMETER); 2781 2782 HGCMReplyFsNotify Msg; 2783 VBGL_HGCM_HDR_INIT(&Msg.reply_hdr.hdr, pCtx->uClientID, GUEST_MSG_FS_NOTIFY, GSTCTL_HGCM_REPLY_HDR_PARMS + 1); 2784 VbglHGCMParmUInt32Set(&Msg.reply_hdr.context, pCtx->uContextID); 2785 VbglHGCMParmUInt32Set(&Msg.reply_hdr.type, GUEST_FS_NOTIFYTYPE_QUERY_INFO); 2786 VbglHGCMParmUInt32Set(&Msg.reply_hdr.rc, uRc); 2787 2788 VbglHGCMParmPtrSet(&Msg.u.queryinfo.fs_info, pFsInfo, cbFsInfo); 2789 2790 return VbglR3HGCMCall(&Msg.reply_hdr.hdr, RT_UOFFSET_AFTER(HGCMReplyFsNotify, u.queryinfo)); 2734 2791 } 2735 2792 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp ¶
r99257 r99262 1975 1975 1976 1976 #ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS 1977 static int vgsvcGstCtrlSessionHandleFsQueryInfo(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx) 1978 { 1979 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 1980 AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER); 1981 1982 /* 1983 * Retrieve the request. 1984 */ 1985 char szPath[RTPATH_MAX]; 1986 int rc = VbglR3GuestCtrlFsGetQueryInfo(pHostCtx, szPath, sizeof(szPath)); 1987 if (RT_SUCCESS(rc)) 1988 { 1989 GSTCTLFSINFO fsInfo; 1990 RT_ZERO(fsInfo); 1991 1992 /* Query as much as we can; ignore any errors and continue. */ 1993 int rc2 = RTFsQuerySizes(szPath, (RTFOFF *)&fsInfo.cbTotalSize, (RTFOFF *)&fsInfo.cbFree, 1994 &fsInfo.cbBlockSize, &fsInfo.cbSectorSize); 1995 if (RT_FAILURE(rc2)) 1996 VGSvcError("Error calling RTFsQuerySizes() for fsqueryinfo operation: %Rrc\n", rc2); 1997 1998 RTFSPROPERTIES fsProps; 1999 rc2 = RTFsQueryProperties(szPath, &fsProps); 2000 if (RT_SUCCESS(rc2)) 2001 { 2002 /* Regular (status) flags. */ 2003 fsInfo.cMaxComponent = fsProps.cbMaxComponent; 2004 if (fsProps.fRemote) 2005 fsInfo.fFlags |= GSTCTLFSINFO_F_IS_REMOTE; 2006 if (fsProps.fCaseSensitive) 2007 fsInfo.fFlags |= GSTCTLFSINFO_F_IS_CASE_SENSITIVE; 2008 if (fsProps.fReadOnly) 2009 fsInfo.fFlags |= GSTCTLFSINFO_F_IS_READ_ONLY; 2010 if (fsProps.fCompressed) 2011 fsInfo.fFlags |= GSTCTLFSINFO_F_IS_COMPRESSED; 2012 2013 /* Feature flags. */ 2014 if (fsProps.fSupportsUnicode) 2015 fsInfo.fFeatures |= GSTCTLFSINFO_FEATURE_F_UNICODE; 2016 if (fsProps.fFileCompression) 2017 fsInfo.fFeatures |= GSTCTLFSINFO_FEATURE_F_FILE_COMPRESSION; 2018 } 2019 else 2020 VGSvcError("Error calling RTFsQueryProperties() for fsqueryinfo operation: %Rrc\n", rc2); 2021 2022 rc2 = RTFsQuerySerial(szPath, &fsInfo.uSerialNumber); 2023 if (RT_FAILURE(rc2)) 2024 VGSvcError("Error calling RTFsQuerySerial() for fsqueryinfo operation: %Rrc\n", rc2); 2025 2026 #if 0 /** @todo Enable as soon as RTFsQueryLabel() is implemented. */ 2027 rc2 = RTFsQueryLabel(szPath, fsInfo.szLabel, sizeof(fsInfo.szLabel)); 2028 if (RT_FAILURE(rc2)) 2029 VGSvcError("Error calling RTFsQueryLabel() for fsqueryinfo operation: %Rrc\n", rc2); 2030 #endif 2031 2032 RTFSTYPE enmFsType; 2033 rc2 = RTFsQueryType(szPath, &enmFsType); 2034 if (RT_SUCCESS(rc2)) 2035 { 2036 if (RTStrPrintf2(fsInfo.szName, sizeof(fsInfo.szName), "%s", RTFsTypeName(enmFsType)) <= 0) 2037 VGSvcError("Error printing type returned by RTFsQueryType()\n"); 2038 } 2039 else 2040 VGSvcError("Error calling RTFsQueryType() for fsqueryinfo operation: %Rrc\n", rc2); 2041 2042 #if 0 /** @todo Enable as soon as RTFsQueryMountpoint() is implemented. */ 2043 char szMountpoint[RTPATH_MAX]; 2044 rc2 = RTFsQueryMountpoint(szPath, szMountpoint, sizeof(szMountpoint)); 2045 if (RT_SUCCESS(rc2)) 2046 { 2047 #error "Implement me" 2048 } 2049 else 2050 VGSvcError("Error calling RTFsQueryMountpoint() for fsqueryinfo operation: %Rrc\n", rc2); 2051 #endif 2052 2053 if (RT_SUCCESS(rc)) 2054 { 2055 VGSvcVerbose(3, "cbTotalSize=%RU64, cbFree=%RU64, cbBlockSize=%RU32, cbSectorSize=%RU32, fFlags=%#x, fFeatures=%#x\n", 2056 fsInfo.cbTotalSize, fsInfo.cbFree, fsInfo.cbBlockSize, fsInfo.cbSectorSize, 2057 fsInfo.fFlags, fsInfo.fFeatures); 2058 VGSvcVerbose(3, "szName=%s, szLabel=%s\n", fsInfo.szName, fsInfo.szLabel); 2059 } 2060 2061 uint32_t const cbFsInfo = sizeof(GSTCTLFSINFO); /** @todo Needs tweaking as soon as we resolve the mountpoint above. */ 2062 2063 rc2 = VbglR3GuestCtrlFsCbQueryInfo(pHostCtx, rc, &fsInfo, cbFsInfo); 2064 if (RT_FAILURE(rc2)) 2065 { 2066 VGSvcError("Failed to reply to fsobjquerinfo request %Rrc, rc=%Rrc\n", rc, rc2); 2067 if (RT_SUCCESS(rc)) 2068 rc = rc2; 2069 } 2070 } 2071 else 2072 { 2073 VGSvcError("Error fetching parameters for fsqueryinfo operation: %Rrc\n", rc); 2074 VbglR3GuestCtrlMsgSkip(pHostCtx->uClientID, rc, UINT32_MAX); 2075 } 2076 return rc; 2077 } 2078 1977 2079 static int vgsvcGstCtrlSessionHandleFsObjQueryInfo(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx) 1978 2080 { … … 2240 2342 if (fImpersonated) 2241 2343 rc = vgsvcGstCtrlSessionHandleFsCreateTemp(pSession, pHostCtx); 2344 break; 2345 2346 case HOST_MSG_FS_QUERY_INFO: 2347 if (fImpersonated) 2348 rc = vgsvcGstCtrlSessionHandleFsQueryInfo(pSession, pHostCtx); 2242 2349 break; 2243 2350 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */ -
trunk/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.cpp ¶
r99253 r99262 1665 1665 case HOST_MSG_FS_CREATE_TEMP: 1666 1666 RT_FALL_THROUGH(); 1667 case HOST_MSG_FS_QUERY_INFO: 1668 RT_FALL_THROUGH(); 1667 1669 case HOST_MSG_FILE_REMOVE: 1668 1670 RT_FALL_THROUGH(); -
trunk/src/VBox/Main/Makefile.kmk ¶
r99040 r99262 1203 1203 src-client/GuestDirectoryImpl.cpp \ 1204 1204 src-client/GuestFileImpl.cpp \ 1205 src-client/GuestFsInfoImpl.cpp \ 1205 1206 src-client/GuestFsObjInfoImpl.cpp \ 1206 1207 src-client/GuestProcessImpl.cpp \ -
trunk/src/VBox/Main/idl/VirtualBox.xidl ¶
r99150 r99262 15899 15899 <desc> 15900 15900 Returns the free space (in bytes) of a given path. 15901 15902 <result name="E_NOTIMPL">15903 The method is not implemented yet.15904 </result>15905 15901 </desc> 15906 15902 <param name="path" type="wstring" dir="in"> … … 15915 15911 <desc> 15916 15912 Returns file system information for a given path. 15917 15918 <result name="E_NOTIMPL">15919 The method is not implemented yet.15920 </result>15921 15913 </desc> 15922 15914 -
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h ¶
r99120 r99262 1713 1713 union 1714 1714 { 1715 /** Holds information for GUEST_FS_NOTIFYTYPE_CREATE_TEMP. */ 1716 struct 1717 { 1718 /** Path of created temporary file / directory. */ 1719 char *pszPath; 1720 /** Size (in bytes) of \a pszPath. */ 1721 uint32_t cbPath; 1722 } CreateTemp; 1723 /** Holds information for GUEST_FS_NOTIFYTYPE_QUERY_OBJ_INFO. */ 1715 1724 struct 1716 1725 { … … 1724 1733 /** Size (in bytes) of \a pszGroups. */ 1725 1734 uint32_t cbGroups; 1735 } QueryObjInfo; 1736 /** Holds information for GUEST_FS_NOTIFYTYPE_QUERY_INFO. */ 1737 struct 1738 { 1739 /** The actual filesystem information. */ 1740 GSTCTLFSINFO fsInfo; 1726 1741 } QueryInfo; 1727 struct1728 {1729 /** Path of created temporary file / directory. */1730 char *pszPath;1731 /** Size (in bytes) of \a pszPath. */1732 uint32_t cbPath;1733 } CreateTemp;1734 1742 } u; 1735 1743 } CALLBACKDATA_FS_NOTIFY; -
trunk/src/VBox/Main/include/GuestSessionImpl.h ¶
r99258 r99262 318 318 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, 319 319 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest); 320 int i_fsQueryInfo(const Utf8Str &strPath, PGSTCTLFSINFO pFsInfo, int *pvrcGuest); 320 321 int i_fsObjQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest); 321 322 const GuestCredentials &i_getCredentials(void); -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp ¶
r99258 r99262 39 39 #include "GuestSessionImpl.h" 40 40 #include "GuestSessionImplTasks.h" 41 #include "GuestFsInfoImpl.h" 41 42 #include "GuestCtrlImplPrivate.h" 42 43 #include "VirtualBoxErrorInfoImpl.h" … … 2071 2072 2072 2073 /** 2073 * Queries information of a file system object (file, directory, ...).2074 * Queries information of a guest file system. 2074 2075 * 2075 2076 * @return IPRT status code. 2076 2077 * @param strPath Path to file system object to query information for. 2077 * @param fFollowSymlinks Whether to follow symbolic links or not. 2078 * @param objData Where to return the file system object data, if found. 2078 * @param pFsInfo Where to return the file system information on success. 2079 2079 * @param pvrcGuest Guest VBox status code, when returning 2080 2080 * VERR_GSTCTL_GUEST_ERROR. Any other return code 2081 2081 * indicates some host side error. 2082 2082 */ 2083 int GuestSession::i_fs ObjQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest)2083 int GuestSession::i_fsQueryInfo(const Utf8Str &strPath, PGSTCTLFSINFO pFsInfo, int *pvrcGuest) 2084 2084 { 2085 2085 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); … … 2096 2096 return vrc; 2097 2097 2098 uint32_t const fFlags = fFollowSymlinks ? GSTCTL_PATH_F_FOLLOW_LINK : GSTCTL_PATH_F_ON_LINK;2099 2100 2098 /* Prepare HGCM call. */ 2101 VBOXHGCMSVCPARM paParms[ 4];2099 VBOXHGCMSVCPARM paParms[2]; 2102 2100 int i = 0; 2103 2101 HGCMSvcSetU32(&paParms[i++], pEvent->ContextID()); 2104 2102 HGCMSvcSetStr(&paParms[i++], strPath.c_str()); 2105 HGCMSvcSetU32(&paParms[i++], GSTCTLFSOBJATTRADD_UNIX /* Implicit */);2106 HGCMSvcSetU32(&paParms[i++], fFlags);2107 2103 2108 2104 alock.release(); /* Drop lock before sending. */ 2109 2105 2110 vrc = i_sendMessage(HOST_MSG_FS_ OBJ_QUERY_INFO, i, paParms);2106 vrc = i_sendMessage(HOST_MSG_FS_QUERY_INFO, i, paParms); 2111 2107 if (RT_SUCCESS(vrc)) 2112 2108 { … … 2120 2116 { 2121 2117 AssertReturn(pFsNotify->uType == GUEST_FS_NOTIFYTYPE_QUERY_INFO, VERR_INVALID_PARAMETER); 2122 objData.Init(strPath); 2123 vrc = objData.FromGuestFsObjInfo(&pFsNotify->u.QueryInfo.objInfo); 2124 RTStrFree(pFsNotify->u.QueryInfo.pszUser); 2125 RTStrFree(pFsNotify->u.QueryInfo.pszGroups); 2118 memcpy(pFsInfo, &pFsNotify->u.QueryInfo.fsInfo, sizeof(GSTCTLFSINFO)); 2126 2119 } 2127 2120 else … … 2143 2136 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */ 2144 2137 { 2138 vrc = VERR_NOT_SUPPORTED; 2139 } 2140 2141 LogFlowThisFunc(("Returning vrc=%Rrc, vrcGuest=%Rrc\n", vrc, pvrcGuest ? *pvrcGuest : VERR_IPE_UNINITIALIZED_STATUS)); 2142 return vrc; 2143 } 2144 2145 /** 2146 * Queries information of a file system object (file, directory, ...). 2147 * 2148 * @return IPRT status code. 2149 * @param strPath Path to file system object to query information for. 2150 * @param fFollowSymlinks Whether to follow symbolic links or not. 2151 * @param objData Where to return the file system object data, if found. 2152 * @param pvrcGuest Guest VBox status code, when returning 2153 * VERR_GSTCTL_GUEST_ERROR. Any other return code 2154 * indicates some host side error. 2155 */ 2156 int GuestSession::i_fsObjQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest) 2157 { 2158 LogFlowThisFunc(("strPath=%s\n", strPath.c_str())); 2159 2160 int vrc; 2161 #ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS 2162 if (mParent->i_getGuestControlFeatures0() & VBOX_GUESTCTRL_GF_0_TOOLBOX_AS_CMDS) 2163 { 2164 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2165 2166 GuestWaitEvent *pEvent = NULL; 2167 vrc = registerWaitEvent(mData.mSession.mID, mData.mObjectID, &pEvent); 2168 if (RT_FAILURE(vrc)) 2169 return vrc; 2170 2171 uint32_t const fFlags = fFollowSymlinks ? GSTCTL_PATH_F_FOLLOW_LINK : GSTCTL_PATH_F_ON_LINK; 2172 2173 /* Prepare HGCM call. */ 2174 VBOXHGCMSVCPARM paParms[4]; 2175 int i = 0; 2176 HGCMSvcSetU32(&paParms[i++], pEvent->ContextID()); 2177 HGCMSvcSetStr(&paParms[i++], strPath.c_str()); 2178 HGCMSvcSetU32(&paParms[i++], GSTCTLFSOBJATTRADD_UNIX /* Implicit */); 2179 HGCMSvcSetU32(&paParms[i++], fFlags); 2180 2181 alock.release(); /* Drop lock before sending. */ 2182 2183 vrc = i_sendMessage(HOST_MSG_FS_OBJ_QUERY_INFO, i, paParms); 2184 if (RT_SUCCESS(vrc)) 2185 { 2186 vrc = pEvent->Wait(30 * 1000); 2187 if (RT_SUCCESS(vrc)) 2188 { 2189 PCALLBACKDATA_FS_NOTIFY const pFsNotify = (PCALLBACKDATA_FS_NOTIFY)pEvent->Payload().Raw(); 2190 AssertPtrReturn(pFsNotify, VERR_INVALID_POINTER); 2191 int vrcGuest = (int)pFsNotify->rc; 2192 if (RT_SUCCESS(vrcGuest)) 2193 { 2194 AssertReturn(pFsNotify->uType == GUEST_FS_NOTIFYTYPE_QUERY_OBJ_INFO, VERR_INVALID_PARAMETER); 2195 objData.Init(strPath); 2196 vrc = objData.FromGuestFsObjInfo(&pFsNotify->u.QueryObjInfo.objInfo); 2197 RTStrFree(pFsNotify->u.QueryObjInfo.pszUser); 2198 RTStrFree(pFsNotify->u.QueryObjInfo.pszGroups); 2199 } 2200 else 2201 { 2202 if (pvrcGuest) 2203 *pvrcGuest = vrcGuest; 2204 vrc = VERR_GSTCTL_GUEST_ERROR; 2205 } 2206 } 2207 else 2208 { 2209 if (pEvent->HasGuestError() && pvrcGuest) 2210 *pvrcGuest = pEvent->GuestResult(); 2211 } 2212 } 2213 unregisterWaitEvent(pEvent); 2214 } 2215 else 2216 #endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */ 2217 { 2145 2218 vrc = i_fsObjQueryInfoViaToolbox(strPath, fFollowSymlinks, objData, pvrcGuest); 2146 2219 } … … 2348 2421 switch (dataCb.uType) 2349 2422 { 2350 case GUEST_FS_NOTIFYTYPE_QUERY_INFO:2351 {2352 AssertBreakStmt(pSvcCbData->mParms >= 6, vrc = VERR_INVALID_PARAMETER);2353 PGSTCTLFSOBJINFO pObjInfo;2354 uint32_t cbObjInfo;2355 vrc = HGCMSvcGetPv(&pSvcCbData->mpaParms[3], (void **)&pObjInfo, &cbObjInfo);2356 AssertRCBreak(vrc);2357 AssertBreakStmt(cbObjInfo == sizeof(GSTCTLFSOBJINFO), vrc = VERR_INVALID_PARAMETER);2358 memcpy(&dataCb.u.QueryInfo.objInfo, pObjInfo, sizeof(GSTCTLFSOBJINFO));2359 2360 char *pszUser;2361 uint32_t cbUser;2362 vrc = HGCMSvcGetStr(&pSvcCbData->mpaParms[4], &pszUser, &cbUser);2363 AssertRCBreak(vrc);2364 dataCb.u.QueryInfo.pszUser = RTStrDup(pszUser);2365 AssertPtrBreakStmt(dataCb.u.QueryInfo.pszUser, vrc = VERR_NO_MEMORY);2366 dataCb.u.QueryInfo.cbUser = cbUser;2367 2368 char *pszGroups;2369 uint32_t cbGroups;2370 vrc = HGCMSvcGetStr(&pSvcCbData->mpaParms[5], &pszGroups, &cbGroups);2371 AssertRCBreak(vrc);2372 dataCb.u.QueryInfo.pszGroups = RTStrDup(pszGroups);2373 AssertPtrBreakStmt(dataCb.u.QueryInfo.pszGroups, vrc = VERR_NO_MEMORY);2374 dataCb.u.QueryInfo.cbGroups = cbGroups;2375 break;2376 }2377 2378 2423 case GUEST_FS_NOTIFYTYPE_CREATE_TEMP: 2379 2424 { … … 2385 2430 AssertPtrBreakStmt(dataCb.u.CreateTemp.pszPath, vrc = VERR_NO_MEMORY); 2386 2431 dataCb.u.CreateTemp.cbPath = cbPath; 2432 break; 2433 } 2434 2435 case GUEST_FS_NOTIFYTYPE_QUERY_OBJ_INFO: 2436 { 2437 AssertBreakStmt(pSvcCbData->mParms >= 6, vrc = VERR_INVALID_PARAMETER); 2438 PGSTCTLFSOBJINFO pObjInfo; 2439 uint32_t cbObjInfo; 2440 vrc = HGCMSvcGetPv(&pSvcCbData->mpaParms[3], (void **)&pObjInfo, &cbObjInfo); 2441 AssertRCBreak(vrc); 2442 AssertBreakStmt(cbObjInfo == sizeof(GSTCTLFSOBJINFO), vrc = VERR_INVALID_PARAMETER); 2443 memcpy(&dataCb.u.QueryObjInfo.objInfo, pObjInfo, sizeof(GSTCTLFSOBJINFO)); 2444 2445 char *pszUser; 2446 uint32_t cbUser; 2447 vrc = HGCMSvcGetStr(&pSvcCbData->mpaParms[4], &pszUser, &cbUser); 2448 AssertRCBreak(vrc); 2449 dataCb.u.QueryObjInfo.pszUser = RTStrDup(pszUser); 2450 AssertPtrBreakStmt(dataCb.u.QueryObjInfo.pszUser, vrc = VERR_NO_MEMORY); 2451 dataCb.u.QueryObjInfo.cbUser = cbUser; 2452 2453 char *pszGroups; 2454 uint32_t cbGroups; 2455 vrc = HGCMSvcGetStr(&pSvcCbData->mpaParms[5], &pszGroups, &cbGroups); 2456 AssertRCBreak(vrc); 2457 dataCb.u.QueryObjInfo.pszGroups = RTStrDup(pszGroups); 2458 AssertPtrBreakStmt(dataCb.u.QueryObjInfo.pszGroups, vrc = VERR_NO_MEMORY); 2459 dataCb.u.QueryObjInfo.cbGroups = cbGroups; 2460 break; 2461 } 2462 2463 case GUEST_FS_NOTIFYTYPE_QUERY_INFO: 2464 { 2465 AssertBreakStmt(pSvcCbData->mParms >= 2, vrc = VERR_INVALID_PARAMETER); 2466 PGSTCTLFSINFO pFsInfo; 2467 uint32_t cbFsInfo; 2468 vrc = HGCMSvcGetPv(&pSvcCbData->mpaParms[3], (void **)&pFsInfo, &cbFsInfo); 2469 AssertRCBreak(vrc); 2470 AssertBreakStmt(cbFsInfo == sizeof(GSTCTLFSINFO), vrc = VERR_INVALID_PARAMETER); 2471 memcpy(&dataCb.u.QueryInfo.fsInfo, pFsInfo, sizeof(GSTCTLFSINFO)); 2387 2472 break; 2388 2473 } … … 4722 4807 HRESULT GuestSession::fsQueryFreeSpace(const com::Utf8Str &aPath, LONG64 *aFreeSpace) 4723 4808 { 4724 RT_NOREF(aPath, aFreeSpace); 4725 4726 return E_NOTIMPL; 4809 ComPtr<IGuestFsInfo> pFsInfo; 4810 HRESULT hrc = fsQueryInfo(aPath, pFsInfo); 4811 if (SUCCEEDED(hrc)) 4812 hrc = pFsInfo->COMGETTER(FreeSize)(aFreeSpace); 4813 4814 return hrc; 4727 4815 } 4728 4816 4729 4817 HRESULT GuestSession::fsQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsInfo> &aInfo) 4730 4818 { 4731 RT_NOREF(aPath, aInfo); 4732 4733 return E_NOTIMPL; 4819 if (aPath.isEmpty()) 4820 return setError(E_INVALIDARG, tr("No path specified")); 4821 4822 HRESULT hrc = i_isStartedExternal(); 4823 if (FAILED(hrc)) 4824 return hrc; 4825 4826 GSTCTLFSINFO fsInfo; 4827 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 4828 int vrc = i_fsQueryInfo(aPath, &fsInfo, &vrcGuest); 4829 if (RT_SUCCESS(vrc)) 4830 { 4831 ComObjPtr<GuestFsInfo> ptrFsInfo; 4832 hrc = ptrFsInfo.createObject(); 4833 if (SUCCEEDED(hrc)) 4834 { 4835 vrc = ptrFsInfo->init(&fsInfo); 4836 if (RT_SUCCESS(vrc)) 4837 hrc = ptrFsInfo.queryInterfaceTo(aInfo.asOutParam()); 4838 else 4839 hrc = setErrorVrc(vrc); 4840 } 4841 } 4842 else 4843 { 4844 if (GuestProcess::i_isGuestError(vrc)) 4845 { 4846 GuestErrorInfo ge(GuestErrorInfo::Type_Fs, vrcGuest, aPath.c_str()); 4847 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest filesystem information failed: %s"), 4848 GuestBase::getErrorAsString(ge).c_str()); 4849 } 4850 else 4851 hrc = setErrorVrc(vrc, tr("Querying guest filesystem information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 4852 } 4853 4854 return hrc; 4734 4855 } 4735 4856 … … 4807 4928 { 4808 4929 GuestErrorInfo ge(GuestErrorInfo::Type_Fs, vrcGuest, aPath.c_str()); 4809 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest file information failed: %s"),4930 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrcGuest, tr("Querying guest filesystem object information failed: %s"), 4810 4931 GuestBase::getErrorAsString(ge).c_str()); 4811 4932 } 4812 4933 else 4813 hrc = setErrorVrc(vrc, tr("Querying guest file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc);4934 hrc = setErrorVrc(vrc, tr("Querying guest filesystem object information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc); 4814 4935 } 4815 4936
Note:
See TracChangeset
for help on using the changeset viewer.