- Timestamp:
- May 4, 2015 4:08:10 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100004
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r55609 r55631 1722 1722 1723 1723 1724 /** bird: This is just a code conversion tool, flags are better defined by 1725 * the preprocessor, in general. But the code was using obsoleted 1726 * main flags for internal purposes (in a uint32_t) without passing them 1727 * along, or it seemed that way. Enum means compiler checks types. */ 1728 enum gctlCopyFlags 1729 { 1730 kGctlCopyFlags_None = 0, 1731 kGctlCopyFlags_Recursive = RT_BIT(1), 1732 kGctlCopyFlags_FollowLinks = RT_BIT(2) 1733 }; 1734 1735 1724 1736 /** 1725 1737 * Creates a copy context structure which then can be used with various … … 1977 1989 { 1978 1990 BOOL fDirExists = FALSE; 1979 HRESULT rc = pContext->pCmdCtx->pGuestSession->DirectoryExists(Bstr(pszDir).raw(), &fDirExists); 1980 if (FAILED(rc)) 1991 HRESULT rc = pContext->pCmdCtx->pGuestSession->DirectoryExists(Bstr(pszDir).raw(), FALSE /*followSymlinks*/, &fDirExists); 1992 if (SUCCEEDED(rc)) 1993 *fExists = fDirExists != FALSE; 1994 else 1981 1995 vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession)); 1982 else1983 *fExists = fDirExists ? true : false;1984 1996 } 1985 1997 else … … 2044 2056 { 2045 2057 BOOL fFileExists = FALSE; 2046 HRESULT rc = pContext->pCmdCtx->pGuestSession->FileExists(Bstr(pszFile).raw(), &fFileExists); 2047 if (FAILED(rc)) 2058 HRESULT rc = pContext->pCmdCtx->pGuestSession->FileExists(Bstr(pszFile).raw(), FALSE /*followSymlinks*/, &fFileExists); 2059 if (SUCCEEDED(rc)) 2060 *fExists = fFileExists != FALSE; 2061 else 2048 2062 vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession)); 2049 else2050 *fExists = fFileExists ? true : false;2051 2063 } 2052 2064 else … … 2096 2108 * @param pszFileSource Source file to copy to the destination. 2097 2109 * @param pszFileDest Name of copied file on the destination. 2098 * @param fFlags Copy flags. No supported at the moment and needs2099 * to be set to 0.2110 * @param enmFlags Copy flags. No supported at the moment and 2111 * needs to be set to 0. 2100 2112 */ 2101 2113 static int gctlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource, 2102 const char *pszFileDest, uint32_t fFlags)2114 const char *pszFileDest, gctlCopyFlags enmFlags) 2103 2115 { 2104 2116 AssertPtrReturn(pContext, VERR_INVALID_POINTER); 2105 2117 AssertPtrReturn(pszFileSource, VERR_INVALID_POINTER); 2106 2118 AssertPtrReturn(pszFileDest, VERR_INVALID_POINTER); 2107 AssertReturn( !fFlags, VERR_INVALID_POINTER); /* No flags supported yet. */2119 AssertReturn(enmFlags == kGctlCopyFlags_None, VERR_INVALID_PARAMETER); /* No flags supported yet. */ 2108 2120 2109 2121 if (pContext->pCmdCtx->cVerbose > 1) … … 2119 2131 if (pContext->fHostToGuest) 2120 2132 { 2121 SafeArray< CopyFileFlag_T> copyFlags;2122 rc = pContext->pCmdCtx->pGuestSession-> CopyTo(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),2123 ComSafeArrayAsInParam(copyFlags),2124 pProgress.asOutParam());2133 SafeArray<FileCopyFlag_T> copyFlags; 2134 rc = pContext->pCmdCtx->pGuestSession->FileCopyToGuest(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(), 2135 ComSafeArrayAsInParam(copyFlags), 2136 pProgress.asOutParam()); 2125 2137 } 2126 2138 else 2127 2139 { 2128 SafeArray< CopyFileFlag_T> copyFlags;2129 rc = pContext->pCmdCtx->pGuestSession-> CopyFrom(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),2130 ComSafeArrayAsInParam(copyFlags),2131 pProgress.asOutParam());2140 SafeArray<FileCopyFlag_T> copyFlags; 2141 rc = pContext->pCmdCtx->pGuestSession->FileCopyFromGuest(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(), 2142 ComSafeArrayAsInParam(copyFlags), 2143 pProgress.asOutParam()); 2132 2144 } 2133 2145 … … 2158 2170 * @param pszFilter DOS-style wildcard filter (?, *). Optional. 2159 2171 * @param pszDest Destination directory on the guest. 2160 * @param fFlagsCopy flags, such as recursive copying.2172 * @param enmFlags Copy flags, such as recursive copying. 2161 2173 * @param pszSubDir Current sub directory to handle. Needs to NULL and only 2162 2174 * is needed for recursion. … … 2164 2176 static int gctlCopyDirToGuest(PCOPYCONTEXT pContext, 2165 2177 const char *pszSource, const char *pszFilter, 2166 const char *pszDest, uint32_t fFlags,2178 const char *pszDest, enum gctlCopyFlags enmFlags, 2167 2179 const char *pszSubDir /* For recursion. */) 2168 2180 { … … 2229 2241 RTPrintf("Directory: %s\n", DirEntry.szName); 2230 2242 2231 if ( fFlags & CopyFileFlag_Recursive)2243 if (enmFlags & kGctlCopyFlags_Recursive) 2232 2244 { 2233 2245 char *pszNewSub = NULL; … … 2244 2256 vrc = gctlCopyDirToGuest(pContext, 2245 2257 pszSource, pszFilter, 2246 pszDest, fFlags, pszNewSub);2258 pszDest, enmFlags, pszNewSub); 2247 2259 RTStrFree(pszNewSub); 2248 2260 } … … 2254 2266 2255 2267 case RTDIRENTRYTYPE_SYMLINK: 2256 if ( ( fFlags & CopyFileFlag_Recursive)2257 && ( fFlags & CopyFileFlag_FollowLinks))2268 if ( (enmFlags & kGctlCopyFlags_Recursive) 2269 && (enmFlags & kGctlCopyFlags_FollowLinks)) 2258 2270 { 2259 2271 /* Fall through to next case is intentional. */ … … 2298 2310 { 2299 2311 vrc = gctlCopyFileToDest(pContext, pszFileSource, 2300 pszFileDest, 0 /* Flags */);2312 pszFileDest, kGctlCopyFlags_None); 2301 2313 RTStrFree(pszFileDest); 2302 2314 } … … 2327 2339 * @param pszFilter DOS-style wildcard filter (?, *). Optional. 2328 2340 * @param pszDest Destination directory on the host. 2329 * @param fFlagsCopy flags, such as recursive copying.2341 * @param enmFlags Copy flags, such as recursive copying. 2330 2342 * @param pszSubDir Current sub directory to handle. Needs to NULL and only 2331 2343 * is needed for recursion. … … 2333 2345 static int gctlCopyDirToHost(PCOPYCONTEXT pContext, 2334 2346 const char *pszSource, const char *pszFilter, 2335 const char *pszDest, uint32_t fFlags,2347 const char *pszDest, gctlCopyFlags enmFlags, 2336 2348 const char *pszSubDir /* For recursion. */) 2337 2349 { … … 2396 2408 } 2397 2409 2398 if ( fFlags & CopyFileFlag_Recursive)2410 if (enmFlags & kGctlCopyFlags_Recursive) 2399 2411 { 2400 2412 Utf8Str strDir(strName); … … 2411 2423 vrc = gctlCopyDirToHost(pContext, 2412 2424 pszSource, pszFilter, 2413 pszDest, fFlags, pszNewSub);2425 pszDest, enmFlags, pszNewSub); 2414 2426 RTStrFree(pszNewSub); 2415 2427 } … … 2421 2433 2422 2434 case FsObjType_Symlink: 2423 if ( ( fFlags & CopyFileFlag_Recursive)2424 && ( fFlags & CopyFileFlag_FollowLinks))2435 if ( (enmFlags & kGctlCopyFlags_Recursive) 2436 && (enmFlags & kGctlCopyFlags_FollowLinks)) 2425 2437 { 2426 2438 /* Fall through to next case is intentional. */ … … 2468 2480 { 2469 2481 vrc = gctlCopyFileToDest(pContext, pszFileSource, 2470 pszFileDest, 0 /* Flags */);2482 pszFileDest, kGctlCopyFlags_None); 2471 2483 RTStrFree(pszFileDest); 2472 2484 } … … 2533 2545 * @param pszDest Destination directory where to copy in the source 2534 2546 * source directory. 2535 * @param fFlagsCopy flags, such as recursive copying.2547 * @param enmFlags Copy flags, such as recursive copying. 2536 2548 */ 2537 2549 static int gctlCopyDirToDest(PCOPYCONTEXT pContext, 2538 2550 const char *pszSource, const char *pszFilter, 2539 const char *pszDest, uint32_t fFlags)2551 const char *pszDest, enum gctlCopyFlags enmFlags) 2540 2552 { 2541 2553 if (pContext->fHostToGuest) 2542 2554 return gctlCopyDirToGuest(pContext, pszSource, pszFilter, 2543 pszDest, fFlags, NULL /* Sub directory, only for recursion. */);2555 pszDest, enmFlags, NULL /* Sub directory, only for recursion. */); 2544 2556 return gctlCopyDirToHost(pContext, pszSource, pszFilter, 2545 pszDest, fFlags, NULL /* Sub directory, only for recursion. */);2557 pszDest, enmFlags, NULL /* Sub directory, only for recursion. */); 2546 2558 } 2547 2559 … … 2643 2655 Utf8Str strSource; 2644 2656 const char *pszDst = NULL; 2645 uint32_t fFlags = CopyFileFlag_None;2657 enum gctlCopyFlags enmFlags = kGctlCopyFlags_None; 2646 2658 bool fCopyRecursive = false; 2647 2659 bool fDryRun = false; … … 2663 2675 2664 2676 case GETOPTDEF_COPY_FOLLOW: 2665 fFlags |= CopyFileFlag_FollowLinks;2677 enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_FollowLinks); 2666 2678 break; 2667 2679 2668 2680 case 'R': /* Recursive processing */ 2669 fFlags |= CopyFileFlag_Recursive;2681 enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_Recursive); 2670 2682 break; 2671 2683 … … 2827 2839 if (RT_SUCCESS(vrc)) 2828 2840 { 2829 vrc = gctlCopyFileToDest(pContext, pszSource, pszDstFile, 0 /* Flags */);2841 vrc = gctlCopyFileToDest(pContext, pszSource, pszDstFile, kGctlCopyFlags_None); 2830 2842 RTStrFree(pszDstFile); 2831 2843 } … … 2836 2848 { 2837 2849 /* Directory (with filter?). */ 2838 vrc = gctlCopyDirToDest(pContext, pszSource, pszFilter, pszDst, fFlags);2850 vrc = gctlCopyDirToDest(pContext, pszSource, pszFilter, pszDst, enmFlags); 2839 2851 } 2840 2852 } … … 3138 3150 try 3139 3151 { 3140 /** @todo How does IGuestSession::F ileRemove work with read-only files? Do we3152 /** @todo How does IGuestSession::FsObjRemove work with read-only files? Do we 3141 3153 * need to do some chmod or whatever to better emulate the --force flag? */ 3142 3154 HRESULT rc; 3143 CHECK_ERROR(pCtx->pGuestSession, F ileRemove(Bstr(ValueUnion.psz).raw()));3155 CHECK_ERROR(pCtx->pGuestSession, FsObjRemove(Bstr(ValueUnion.psz).raw())); 3144 3156 if (FAILED(rc) && !fForce) 3145 3157 return RTEXITCODE_FAILURE; … … 3180 3192 std::vector< Utf8Str > vecSources; 3181 3193 const char *pszDst = NULL; 3182 com::SafeArray< PathRenameFlag_T> aRenameFlags;3194 com::SafeArray<FsObjRenameFlag_T> aRenameFlags; 3183 3195 3184 3196 try 3185 3197 { 3186 3198 /** @todo Make flags configurable. */ 3187 aRenameFlags.push_back( PathRenameFlag_NoReplace);3199 aRenameFlags.push_back(FsObjRenameFlag_NoReplace); 3188 3200 3189 3201 while ( (ch = RTGetOpt(&GetState, &ValueUnion)) … … 3236 3248 if (cSources > 1) 3237 3249 { 3238 ComPtr<IGuestFsObjInfo> pFsObjInfo;3239 rc = pCtx->pGuestSession->Directory QueryInfo(Bstr(pszDst).raw(), pFsObjInfo.asOutParam());3240 if (FAILED(rc) )3250 BOOL fExists = FALSE; 3251 rc = pCtx->pGuestSession->DirectoryExists(Bstr(pszDst).raw(), FALSE /*followSymlinks*/, &fExists); 3252 if (FAILED(rc) || !fExists) 3241 3253 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Destination must be a directory when specifying multiple sources\n"); 3242 3254 } … … 3252 3264 && !g_fGuestCtrlCanceled) 3253 3265 { 3254 bool fSourceIsDirectory = false;3255 3266 Utf8Str strCurSource = (*it); 3256 3267 3257 /** @todo Slooooow, but works for now. */3258 /** @todo r=bird: Need an interface for querying info on a file system3259 * object, not just files or directories exclusively. You also may3260 * want to take symbolic links into account somewhere along the line,3261 * though preferrably on the guest end of things... */3262 3268 ComPtr<IGuestFsObjInfo> pFsObjInfo; 3263 rc = pCtx->pGuestSession->FileQueryInfo(Bstr(strCurSource).raw(), pFsObjInfo.asOutParam()); 3264 if (FAILED(rc)) 3265 { 3266 rc = pCtx->pGuestSession->DirectoryQueryInfo(Bstr(strCurSource).raw(), pFsObjInfo.asOutParam()); 3267 fSourceIsDirectory = SUCCEEDED(rc); 3268 } 3269 FsObjType enmObjType; 3270 rc = pCtx->pGuestSession->FsObjQueryInfo(Bstr(strCurSource).raw(), FALSE /*followSymlinks*/, pFsObjInfo.asOutParam()); 3271 if (SUCCEEDED(rc)) 3272 rc = pFsObjInfo->COMGETTER(Type)(&enmObjType); 3269 3273 if (FAILED(rc)) 3270 3274 { … … 3278 3282 if (pCtx->cVerbose > 1) 3279 3283 RTPrintf("Renaming %s \"%s\" to \"%s\" ...\n", 3280 fSourceIsDirectory ? "directory" : "file",3284 enmObjType == FsObjType_Directory ? "directory" : "file", 3281 3285 strCurSource.c_str(), pszDst); 3282 3286 3283 3287 if (!fDryrun) 3284 3288 { 3285 if ( fSourceIsDirectory)3286 { 3287 CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryRename(Bstr(strCurSource).raw(),3288 3289 3289 if (enmObjType == FsObjType_Directory) 3290 { 3291 CHECK_ERROR_BREAK(pCtx->pGuestSession, FsObjRename(Bstr(strCurSource).raw(), 3292 Bstr(pszDst).raw(), 3293 ComSafeArrayAsInParam(aRenameFlags))); 3290 3294 3291 3295 /* Break here, since it makes no sense to rename mroe than one source to … … 3300 3304 } 3301 3305 else 3302 CHECK_ERROR_BREAK(pCtx->pGuestSession, F ileRename(Bstr(strCurSource).raw(),3303 Bstr(pszDst).raw(),3304 ComSafeArrayAsInParam(aRenameFlags)));3306 CHECK_ERROR_BREAK(pCtx->pGuestSession, FsObjRename(Bstr(strCurSource).raw(), 3307 Bstr(pszDst).raw(), 3308 ComSafeArrayAsInParam(aRenameFlags))); 3305 3309 } 3306 3310 … … 3498 3502 3499 3503 ComPtr<IGuestFsObjInfo> pFsObjInfo; 3500 rc = pCtx->pGuestSession->FileQueryInfo(Bstr(it->first).raw(), pFsObjInfo.asOutParam()); 3501 if (FAILED(rc)) 3502 rc = pCtx->pGuestSession->DirectoryQueryInfo(Bstr(it->first).raw(), pFsObjInfo.asOutParam()); 3503 3504 rc = pCtx->pGuestSession->FsObjQueryInfo(Bstr(it->first).raw(), FALSE /*followSymlinks*/, pFsObjInfo.asOutParam()); 3504 3505 if (FAILED(rc)) 3505 3506 { … … 3514 3515 { 3515 3516 FsObjType_T objType; 3516 pFsObjInfo->COMGETTER(Type)(&objType); 3517 pFsObjInfo->COMGETTER(Type)(&objType); /** @todo What about error checking? */ 3517 3518 switch (objType) 3518 3519 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r55629 r55631 9980 9980 9981 9981 <enum 9982 name="FileSeek Type"9983 uuid=" 1b73f4f3-3515-4073-a506-76878d9e2541"9982 name="FileSeekOrigin" 9983 uuid="939ba94f-497a-4119-ebd3-d193e176c98e" 9984 9984 > 9985 9985 <desc> 9986 File seeking types.9986 What a file seek (<link to="IFile::seek"/>) is relative to. 9987 9987 </desc> 9988 9988 … … 9992 9992 <const name="Current" value="1"> 9993 9993 <desc>Seek from the current file position.</desc> 9994 </const> 9995 <const name="End" value="2"> 9996 <desc>Seek relative to the end of the file. To seek to the position two 9997 bytes from the end of the file, specify -2 as the seek offset.</desc> 9994 9998 </const> 9995 9999 </enum> … … 10115 10119 10116 10120 <enum 10117 name=" CopyFileFlag"10118 uuid=" 23f79fdf-738a-493d-b80b-42d607c9b916"10121 name="FileCopyFlag" 10122 uuid="791909d7-4c64-2fa4-4303-adb10658d347" 10119 10123 > 10120 10124 <desc> 10121 10125 File copying flags. 10126 <note>Not flags are implemented yet.</note> 10122 10127 </desc> 10123 10128 <const name="None" value="0"> 10124 10129 <desc>No flag set.</desc> 10125 10130 </const> 10126 <const name="Recursive" value="1"> 10127 <desc>Copy directories recursively. 10128 This flag is not implemented yet.</desc> 10129 </const> 10130 <const name="Update" value="2"> 10131 <desc>Only copy when the source file is newer than the destination file 10132 or when the destination file is missing. This flag is not implemented 10133 yet.</desc> 10134 </const> 10135 <const name="FollowLinks" value="4"> 10136 <desc>Follow symbolic links. This flag is not implemented yet.</desc> 10131 <const name="NoReplace" value="1"> 10132 <!-- Would make more sense to not replace by default, however we the GAs 10133 only supports replacing as of writing, so we currently have no choice. --> 10134 <desc> 10135 Do not replace the destination file if it exists. 10136 <note>This flag is not implemented yet.</note> 10137 </desc> 10138 </const> 10139 <const name="FollowLinks" value="2"> 10140 <desc> 10141 Follow symbolic links. 10142 <note>This flag is not implemented yet.</note> 10143 </desc> 10144 </const> 10145 <const name="Update" value="4"> 10146 <desc> 10147 Only copy when the source file is newer than the destination file 10148 or when the destination file is missing. 10149 <note>This flag is not implemented yet.</note> 10150 </desc> 10151 </const> 10152 </enum> 10153 10154 <enum 10155 name="FsObjMoveFlags" 10156 uuid="98fdd11f-4063-ac60-5737-e49092aab95f" 10157 > 10158 <desc> 10159 File moving flags. 10160 </desc> 10161 <const name="None" value="0"> 10162 <desc>No flag set.</desc> 10163 </const> 10164 <const name="Replace" value="1"> 10165 <desc> 10166 Replace the destination file, symlink, etc if it exists, however this 10167 does not allow replacing any directories. 10168 </desc> 10169 </const> 10170 <const name="FollowLinks" value="2"> 10171 <desc> 10172 Follow symbolic links in the final components or not (only applied to 10173 the given source and target paths, not to anything else). 10174 </desc> 10175 </const> 10176 <const name="AllowDirectoryMoves" value="4"> 10177 <desc> 10178 Allow moving directories accross file system boundraries. Because it 10179 is could be a big undertaking, we require extra assurance that we 10180 should do it when requested. 10181 </desc> 10137 10182 </const> 10138 10183 </enum> … … 10154 10199 10155 10200 <enum 10201 name="DirectoryCopyFlags" 10202 uuid="cc500f0c-4a54-88c9-56b3-7e9310416da7" 10203 > 10204 <desc> 10205 Directory copying flags. 10206 <note>Not flags are implemented yet.</note> 10207 </desc> 10208 <const name="None" value="0"> 10209 <desc>No flag set.</desc> 10210 </const> 10211 <const name="CopyIntoExisting" value="1"> 10212 <desc>Allow copying into an existing destination directory.</desc> 10213 </const> 10214 <!-- Later, basically have to see what cp and xcopy offers. --> 10215 </enum> 10216 10217 <enum 10156 10218 name="DirectoryRemoveRecFlag" 10157 10219 uuid="455aabf0-7692-48f6-9061-f21579b65769" … … 10159 10221 <desc> 10160 10222 Directory recursive removement flags. 10223 <note> 10224 WARNING!! THE FLAGS ARE CURRENTLY IGNORED. THE METHOD APPLIES 10225 <link to="DirectoryRemoveRecFlag_ContentAndDir"/> REGARDLESS 10226 OF THE INPUT. 10227 </note> 10161 10228 </desc> 10162 10229 … … 10173 10240 10174 10241 <enum 10175 name=" PathRenameFlag"10176 uuid=" f3baa09f-c758-453d-b91c-c7787d76351d"10242 name="FsObjRenameFlag" 10243 uuid="59bbf3a1-4e23-d7cf-05d5-ccae32080ed2" 10177 10244 > 10178 10245 <desc> 10179 Path renaming flags. 10180 </desc> 10181 10182 <const name="None" value="0"> 10183 <desc>No flag set.</desc> 10184 </const> 10185 <const name="NoReplace" value="1"> 10186 <desc>Do not replace anything.</desc> 10187 </const> 10188 <const name="Replace" value="2"> 10189 <desc>This will replace attempt any target which isn't a directory.</desc> 10190 </const> 10191 <const name="NoSymlinks" value="4"> 10192 <desc>Don't allow symbolic links as part of the path.</desc> 10246 Flags for use when renaming file system objects (files, directories, 10247 symlink, etc), see <link to="IGuestSession::fsObjRename"/>. 10248 </desc> 10249 10250 <const name="NoReplace" value="0"> 10251 <desc>Do not replace any destination object.</desc> 10252 </const> 10253 <const name="Replace" value="1"> 10254 <desc>This will attempt to replace any destination object other except 10255 directories. (The default is to fail if the destination exists.)</desc> 10193 10256 </const> 10194 10257 </enum> … … 10266 10329 > 10267 10330 <desc> 10268 Symbolic link types. 10331 Symbolic link types. This is significant when creating links on the 10332 Windows platform, ignored elsewhere. 10269 10333 </desc> 10270 10334 … … 10276 10340 </const> 10277 10341 <const name="File" value="2"> 10278 <desc>The link targets a file (or whatever else ).</desc>10342 <desc>The link targets a file (or whatever else except directories).</desc> 10279 10343 </const> 10280 10344 </enum> … … 10387 10451 aren't active yet. 10388 10452 </desc> 10453 </const> 10454 </enum> 10455 10456 <enum 10457 name="FileAccessMode" 10458 uuid="231a578f-47fb-ea30-3b3e-8489558227f0" 10459 > 10460 <desc> 10461 File open access mode for use with <link to="IGuestSession::fileOpen"/> 10462 and <link to="IGuestSession::fileOpenEx"/>. 10463 </desc> 10464 <const name="ReadOnly" value="1"> 10465 <desc>Open the file only with read access.</desc> 10466 </const> 10467 <const name="WriteOnly" value="2"> 10468 <desc>Open the file only with write access.</desc> 10469 </const> 10470 <const name="ReadWrite" value="3"> 10471 <desc>Open the file with both read and write access.</desc> 10472 </const> 10473 <const name="AppendOnly" value="4"> 10474 <desc>Open the file for appending only, no read or seek access. 10475 <note>Not yet implemented.</note> 10476 </desc> 10477 </const> 10478 <const name="AppendRead" value="5"> 10479 <desc>Open the file for appending and read. Writes always goes to the 10480 end of the file while reads are done at the current or specified file 10481 position. 10482 <note>Not yet implemented.</note> 10483 </desc> 10484 </const> 10485 </enum> 10486 10487 <enum 10488 name="FileOpenAction" 10489 uuid="12bc97e2-4fc6-a8b4-4f84-0cbf4ab970d2" 10490 > 10491 <desc> 10492 What action <link to="IGuestSession::fileOpen"/> and <link to="IGuestSession::fileOpenEx"/> 10493 should take whether the file being opened exists or not. 10494 </desc> 10495 <const name="OpenExisting" value="1"> 10496 <desc>Opens an existing file, fails if no file exists. (Was "oe".)</desc> 10497 </const> 10498 <const name="OpenOrCreate" value="2"> 10499 <desc>Opens an existing file, creates a new one if no file exists. (Was "oc".)</desc> 10500 </const> 10501 <const name="CreateNew" value="3"> 10502 <desc>Creates a new file is no file exists, fails if there is a file there already. (Was "ce".)</desc> 10503 </const> 10504 <const name="CreateOrReplace" value="4"> 10505 <desc> 10506 Creates a new file, replace any existing file. (Was "ca".) 10507 <note> 10508 Currently undefined whether we will inherit mode and ACLs from the 10509 existing file or replace them. 10510 </note> 10511 </desc> 10512 </const> 10513 <const name="OpenExistingTruncated" value="5"> 10514 <desc>Opens and truncate an existing file, fails if no file exists. (Was "ot".)</desc> 10515 </const> 10516 <const name="AppendOrCreate" value="99"> 10517 <desc>Opens an existing file and places the file pointer at the end of 10518 the file, creates the file if it does not exist. This action implies 10519 write access. (Was "ca".) 10520 <note> 10521 <!-- @todo r=bird: See iprt/file.h, RTFILE_O_APPEND - not an action/disposition! 10522 Moving the file pointer to the end, is almost fine, but impliying 'write' access 10523 isn't. That is something that is exclusively reserved for the opening mode. --> 10524 Deprecated. Only here for historical reasons. Do not use! 10525 </note> 10526 </desc> 10527 </const> 10528 </enum> 10529 10530 <enum 10531 name="FileSharingMode" 10532 uuid="f87dfe58-425b-c5ba-7d6d-22adeea25de1" 10533 > 10534 <desc> 10535 File sharing mode for <link to="IGuestSession::fileOpenEx"/>. 10536 </desc> 10537 <const name="Read" value="1"> 10538 <desc>Only share read access to the file.</desc> 10539 </const> 10540 <const name="Write" value="2"> 10541 <desc>Only share write access to the file.</desc> 10542 </const> 10543 <const name="ReadWrite" value="3"> 10544 <desc>Share both read and write access to the file, but deny deletion.</desc> 10545 </const> 10546 <const name="Delete" value="4"> 10547 <desc>Only share delete access, denying read and write.</desc> 10548 </const> 10549 <const name="ReadDelete" value="5"> 10550 <desc>Share read and delete access to the file, denying writing.</desc> 10551 </const> 10552 <const name="WriteDelete" value="6"> 10553 <desc>Share write and delete access to the file, denying reading.</desc> 10554 </const> 10555 <const name="All" value="7"> 10556 <desc>Share all access, i.e. read, write and delete, to the file.</desc> 10389 10557 </const> 10390 10558 </enum> … … 10497 10665 <desc>Don't allow symbolic links as part of the path.</desc> 10498 10666 </const> 10667 <!-- r=bird: need a "NoFollowSymlinks" value here. IPRT probably needs that too. --> 10499 10668 </enum> 10500 10669 … … 10799 10968 <interface 10800 10969 name="IGuestSession" extends="$unknown" 10801 uuid=" c003c35e-4dc4-4111-4771-51befc3c1d30"10970 uuid="91306653-4e3a-88cb-a809-85ae64ceb4fd" 10802 10971 wsmap="managed" 10803 10972 > … … 10866 11035 Returns the session timeout (in ms). 10867 11036 <result name="E_NOTIMPL"> 10868 Th e methodis not implemented yet.11037 This attribute is not implemented yet. 10869 11038 </result> 10870 11039 </desc> … … 10918 11087 </desc> 10919 11088 </attribute> 11089 <attribute name="currentDirectory" type="wstring"> 11090 <desc> 11091 The current directory of the session. Guest path style. 11092 <result name="E_NOTIMPL"> 11093 This attribute is not implemented yet. 11094 </result> 11095 </desc> 11096 </attribute> 10920 11097 <attribute name="directories" type="IGuestDirectory" readonly="yes" safearray="yes"> 10921 11098 <desc> … … 10943 11120 </method> 10944 11121 10945 <method name="copyFrom"> 10946 <desc> 10947 Copies a file from guest to the host. 10948 10949 <result name="VBOX_E_IPRT_ERROR"> 10950 Error starting the copy operation. 11122 <!-- Directory related methods. --> 11123 11124 <method name="directoryCopy"> 11125 <desc> 11126 Recursively copies a directory from one guest location to another. 11127 11128 <result name="E_NOTIMPL"> 11129 Not yet implemented. 10951 11130 </result> 10952 11131 </desc> 10953 11132 <param name="source" type="wstring" dir="in"> 10954 <desc>Source file in the guest to copy to the host.</desc> 10955 </param> 10956 <param name="dest" type="wstring" dir="in"> 10957 <desc>Destination file name on the host.</desc> 10958 </param> 10959 <param name="flags" type="CopyFileFlag" dir="in" safearray="yes"> 10960 <desc>Copy flags; see <link to="CopyFileFlag"/> for more information.</desc> 11133 <desc>The path to the directory to copy (in the guest). Guest path style.</desc> 11134 </param> 11135 <param name="destination" type="wstring" dir="in"> 11136 <desc>The path to the target directory (in the guest). Unless the 11137 <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the 11138 directory shall not already exist. Guest path style.</desc> 11139 </param> 11140 <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes"> 11141 <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc> 10961 11142 </param> 10962 11143 <param name="progress" type="IProgress" dir="return"> 10963 <desc>Progress object to track the operation completion.</desc>10964 </param> 10965 </method> 10966 10967 <method name=" copyTo">10968 <desc> 10969 Copies a file from host to the guest.10970 10971 <result name=" VBOX_E_IPRT_ERROR">10972 Error starting the copy operation.11144 <desc>Progress object to track the operation to completion.</desc> 11145 </param> 11146 </method> 11147 11148 <method name="directoryCopyFromGuest"> 11149 <desc> 11150 Recursively copies a directory from the guest to the host. 11151 11152 <result name="E_NOTIMPL"> 11153 Not yet implemented. 10973 11154 </result> 10974 11155 </desc> 10975 11156 <param name="source" type="wstring" dir="in"> 10976 <desc>Source file on the host to copy to the guest.</desc> 10977 </param> 10978 <param name="dest" type="wstring" dir="in"> 10979 <desc>Destination file name in the guest.</desc> 10980 </param> 10981 <param name="flags" type="CopyFileFlag" dir="in" safearray="yes"> 10982 <desc>Copy flags; see <link to="CopyFileFlag"/> for more information.</desc> 11157 <desc>Path to the directory on the guest side that should be copied to 11158 the host. Guest path style.</desc> 11159 </param> 11160 <param name="destination" type="wstring" dir="in"> 11161 <desc>Where to put the directory on the host. Unless the 11162 <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the 11163 directory shall not already exist. Host path style.</desc> 11164 </param> 11165 <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes"> 11166 <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc> 10983 11167 </param> 10984 11168 <param name="progress" type="IProgress" dir="return"> 10985 <desc>Progress object to track the operation completion.</desc> 11169 <desc>Progress object to track the operation to completion.</desc> 11170 </param> 11171 </method> 11172 11173 <method name="directoryCopyToGuest"> 11174 <desc> 11175 Recursively copies a directory from the host to the guest. 11176 11177 <result name="E_NOTIMPL"> 11178 Not yet implemented. 11179 </result> 11180 </desc> 11181 <param name="source" type="wstring" dir="in"> 11182 <desc>Path to the directory on the host side that should be copied to 11183 the guest. Host path style.</desc> 11184 </param> 11185 <param name="destination" type="wstring" dir="in"> 11186 <desc>Where to put the file in the guest. Unless the 11187 <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the 11188 directory shall not already exist. Guest style path.</desc> 11189 </param> 11190 <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes"> 11191 <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc> 11192 </param> 11193 <param name="progress" type="IProgress" dir="return"> 11194 <desc>Progress object to track the operation to completion.</desc> 10986 11195 </param> 10987 11196 </method> … … 10989 11198 <method name="directoryCreate"> 10990 11199 <desc> 10991 Create a directory in the guest.11200 Creates a directory in the guest. 10992 11201 10993 11202 <result name="VBOX_E_IPRT_ERROR"> … … 10996 11205 </desc> 10997 11206 <param name="path" type="wstring" dir="in"> 10998 <desc> Full path of directory to create.</desc>11207 <desc>Path to the directory directory to be created. Guest path style.</desc> 10999 11208 </param> 11000 11209 <param name="mode" type="unsigned long" dir="in"> 11001 <desc>File creation mode.</desc> 11210 <desc> 11211 The UNIX-style access mode mask to create the directory with. 11212 Whether/how all three access groups and associated access rights are 11213 realized is guest OS dependent. The API does the best it can on each 11214 OS. 11215 </desc> 11002 11216 </param> 11003 11217 <param name="flags" type="DirectoryCreateFlag" dir="in" safearray="yes"> 11004 <desc> Creation flags; see <link to="DirectoryCreateFlag"/> for more information.</desc>11218 <desc>Zero or more <link to="DirectoryCreateFlag"/> flags.</desc> 11005 11219 </param> 11006 11220 </method> … … 11008 11222 <method name="directoryCreateTemp"> 11009 11223 <desc> 11010 Create a temporary directory in the guest.11224 Creates a temporary directory in the guest. 11011 11225 11012 11226 <result name="VBOX_E_NOT_SUPPORTED"> … … 11031 11245 </param> 11032 11246 <param name="mode" type="unsigned long" dir="in"> 11033 <desc>The mode of the directory to create. Use 0700 unless there are 11034 reasons not to. This parameter is ignored if "secure" is specified. 11035 </desc> 11247 <desc> 11248 The UNIX-style access mode mask to create the directory with. 11249 Whether/how all three access groups and associated access rights are 11250 realized is guest OS dependent. The API does the best it can on each 11251 OS. 11252 11253 This parameter is ignore if the @a secure parameter is set to @c true. 11254 <note>It is strongly recommended to use 0700.</note> 11255 </desc> 11036 11256 </param> 11037 11257 <param name="path" type="wstring" dir="in"> 11038 <desc>The absolute path to create the temporary directory in.</desc> 11258 <desc>The path to the directory in which the temporary directory should 11259 be created. Guest path style.</desc> 11039 11260 </param> 11040 11261 <param name="secure" type="boolean" dir="in"> 11041 <desc>Whether to fail if the directory can not be securely created. 11262 <desc> 11263 Whether to fail if the directory can not be securely created. 11042 11264 Currently this means that another unprivileged user cannot 11043 11265 manipulate the path specified or remove the temporary directory 11044 11266 after it has been created. Also causes the mode specified to be 11045 ignored. May not be supported on all guest types.</desc> 11267 ignored. May not be supported on all guest types. 11268 </desc> 11046 11269 </param> 11047 11270 <param name="directory" type="wstring" dir="return"> 11048 <desc>On success this will contain the name of the directorycreated11049 with full path.</desc>11271 <desc>On success this will contain the full path to the created 11272 directory. Guest path style.</desc> 11050 11273 </param> 11051 11274 </method> … … 11060 11283 </desc> 11061 11284 <param name="path" type="wstring" dir="in"> 11062 <desc>Directory to check existence for.</desc> 11285 <desc>Path to the directory to check if exists. Guest path style.</desc> 11286 </param> 11287 <param name="followSymlinks" type="boolean" dir="in"> 11288 <desc> 11289 If @c true, symbolic links in the final component will be followed 11290 and the existance of the symlink target made the question for this method. 11291 If @c false, a symbolic link in the final component will make the 11292 method return @c false (because a symlink isn't a directory). 11293 </desc> 11063 11294 </param> 11064 11295 <param name="exists" type="boolean" dir="return"> … … 11069 11300 <method name="directoryOpen"> 11070 11301 <desc> 11071 Opens a directory and creates a <link to="IGuestDirectory"/> object that 11072 can be used for further operations. 11302 Opens a directory in the guest and creates a <link to="IGuestDirectory"/> 11303 object that can be used for further operations. 11304 11305 <note>This method follows symbolic links by default at the moment, this 11306 may change in the future.</note> 11073 11307 11074 11308 <result name="VBOX_E_OBJECT_NOT_FOUND"> … … 11080 11314 </desc> 11081 11315 <param name="path" type="wstring" dir="in"> 11082 <desc> Full path to file to open.</desc>11316 <desc>Path to the directory to open. Guest path style.</desc> 11083 11317 </param> 11084 11318 <param name="filter" type="wstring" dir="in"> 11085 <desc>Open filter to apply. This can include wildcards like ? and *.</desc> 11319 <desc>Optional directory listing filter to apply. This uses the DOS/NT 11320 style wildcard characters '?' and '*'.</desc> 11086 11321 </param> 11087 11322 <param name="flags" type="DirectoryOpenFlag" dir="in" safearray="yes"> 11088 <desc> Open flags; see <link to="DirectoryOpenFlag"/> for more information.</desc>11323 <desc>Zero or more <link to="DirectoryOpenFlag"/> flags.</desc> 11089 11324 </param> 11090 11325 <param name="directory" type="IGuestDirectory" dir="return"> … … 11093 11328 </method> 11094 11329 11095 <method name="directoryQueryInfo"> 11096 <desc> 11097 Queries information about a directory in the guest. 11098 11099 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11100 Directory to query information for was not found. 11101 </result> 11102 <result name="VBOX_E_IPRT_ERROR"> 11103 Error querying information. 11104 </result> 11330 <method name="directoryRemove"> 11331 <desc> 11332 Removes a guest directory if empty. 11333 11334 <note>Symbolic links in the final component will not be followed, 11335 instead an not-a-directory error is reported.</note> 11105 11336 </desc> 11106 11337 <param name="path" type="wstring" dir="in"> 11107 <desc>Directory to query information for.</desc> 11108 </param> 11109 <param name="info" type="IGuestFsObjInfo" dir="return"> 11110 <desc><link to="IGuestFsObjInfo"/> object containing the queried information.</desc> 11111 </param> 11112 </method> 11113 11114 <method name="directoryRemove"> 11115 <desc> 11116 Removes a guest directory if not empty. 11338 <desc>Path to the directory that should be removed. Guest path style.</desc> 11339 </param> 11340 </method> 11341 11342 <method name="directoryRemoveRecursive"> 11343 <desc> 11344 Removes a guest directory recursively. 11345 11346 <!-- Add this back when the warning can be removed: 11347 Unless <link to="DirectoryRemoveRecFlag_ContentAndDir"/> or 11348 <link to="DirectoryRemoveRecFlag_ContentOnly"/> is given, only the 11349 directory structure is removed. Which means it will fail if there are 11350 directories which are not empty in the directory tree @a path points to. 11351 --> 11352 11353 <note> WARNING!! THE FLAGS ARE NOT CURRENTLY IMPLEMENTED. THE IMPLEMENTATION 11354 WORKS AS IF FLAGS WAS SET TO <link to="DirectoryRemoveRecFlag_ContentAndDir"/>. 11355 </note> 11356 11357 <note>If the final path component is a symbolic link, this method will 11358 fail as it can only be applied to directories.</note> 11117 11359 </desc> 11118 11360 <param name="path" type="wstring" dir="in"> 11119 <desc>Full path of directory to remove.</desc> 11120 </param> 11121 </method> 11122 11123 <method name="directoryRemoveRecursive"> 11124 <desc> 11125 Removes a guest directory recursively. 11126 </desc> 11127 <param name="path" type="wstring" dir="in"> 11128 <desc>Full path of directory to remove recursively.</desc> 11361 <desc>Path of the directory that is to be removed recursively. Guest 11362 path style.</desc> 11129 11363 </param> 11130 11364 <param name="flags" type="DirectoryRemoveRecFlag" dir="in" safearray="yes"> 11131 <desc>Remove flags; see <link to="DirectoryRemoveRecFlag"/> for more information.</desc> 11365 <desc>Zero or more <link to="DirectoryRemoveRecFlag"/> flags. 11366 <note>WARNING! SPECIFYING <link to="DirectoryRemoveRecFlag::ContentAndDir"/> IS 11367 MANDATORY AT THE MOMENT!!</note> 11368 </desc> 11132 11369 </param> 11133 11370 <param name="progress" type="IProgress" dir="return"> … … 11137 11374 </method> 11138 11375 11139 <method name="directoryRename"> 11140 <desc> 11141 Renames a directory in the guest. 11142 </desc> 11143 <param name="source" type="wstring" dir="in"> 11144 <desc>Source directory to rename.</desc> 11145 </param> 11146 <param name="dest" type="wstring" dir="in"> 11147 <desc>Destination directory to rename the source to.</desc> 11148 </param> 11149 <param name="flags" type="PathRenameFlag" dir="in" safearray="yes"> 11150 <desc>Rename flags; see <link to="PathRenameFlag"/> for more information.</desc> 11151 </param> 11152 </method> 11153 11154 <method name="directorySetACL"> 11155 <desc> 11156 Sets the ACL (Access Control List) of a guest directory. 11157 11158 <result name="E_NOTIMPL"> 11159 The method is not implemented yet. 11160 </result> 11161 </desc> 11162 <param name="path" type="wstring" dir="in"> 11163 <desc>Full path of directory to set the ACL for.</desc> 11164 </param> 11165 <param name="acl" type="wstring" dir="in"> 11166 <desc>Actual ACL string to set. Must comply with the guest OS.</desc> 11167 </param> 11168 </method> 11376 <!-- Environment related methods. --> 11169 11377 11170 11378 <method name="environmentScheduleSet"> … … 11239 11447 </method> 11240 11448 11449 <!-- File related methods. --> 11450 11451 <method name="fileCopy"> 11452 <desc> 11453 Copies a file from one guest location to another. 11454 11455 <note>Will overwrite the destination file unless 11456 <link to="FileCopyFlag::NoReplace"/> is specified.</note> 11457 11458 <result name="E_NOTIMPL"> 11459 Not yet implemented. 11460 </result> 11461 </desc> 11462 <param name="source" type="wstring" dir="in"> 11463 <desc>The path to the file to copy (in the guest). Guest path style.</desc> 11464 </param> 11465 <param name="destination" type="wstring" dir="in"> 11466 <desc>The path to the target file (in the guest). This cannot be a 11467 directory. Guest path style.</desc> 11468 </param> 11469 <param name="flags" type="FileCopyFlag" dir="in" safearray="yes"> 11470 <desc>Zero or more <link to="FileCopyFlag"/> values.</desc> 11471 </param> 11472 <param name="progress" type="IProgress" dir="return"> 11473 <desc>Progress object to track the operation to completion.</desc> 11474 </param> 11475 </method> 11476 11477 <method name="fileCopyFromGuest"> 11478 <desc> 11479 Copies a file from the guest to the host. 11480 11481 <note>Will overwrite the destination file unless 11482 <link to="FileCopyFlag::NoReplace"/> is specified.</note> 11483 11484 <result name="VBOX_E_IPRT_ERROR"> 11485 Error starting the copy operation. 11486 </result> 11487 </desc> 11488 <param name="source" type="wstring" dir="in"> 11489 <desc>Path to the file on the guest side that should be copied to the 11490 host. Guest path style.</desc> 11491 </param> 11492 <param name="destination" type="wstring" dir="in"> 11493 <desc>Where to put the file on the host (file, not directory). Host 11494 path style.</desc> 11495 </param> 11496 <param name="flags" type="FileCopyFlag" dir="in" safearray="yes"> 11497 <desc>Zero or more <link to="FileCopyFlag"/> values.</desc> 11498 </param> 11499 <param name="progress" type="IProgress" dir="return"> 11500 <desc>Progress object to track the operation to completion.</desc> 11501 </param> 11502 </method> 11503 11504 <method name="fileCopyToGuest"> 11505 <desc> 11506 Copies a file from the host to the guest. 11507 11508 <note>Will overwrite the destination file unless 11509 <link to="FileCopyFlag::NoReplace"/> is specified.</note> 11510 11511 <result name="VBOX_E_IPRT_ERROR"> 11512 Error starting the copy operation. 11513 </result> 11514 </desc> 11515 <param name="source" type="wstring" dir="in"> 11516 <desc>Path to the file on the host side that should be copied to the 11517 guest. Host path style.</desc> 11518 </param> 11519 <param name="destination" type="wstring" dir="in"> 11520 <desc>Where to put the file in the guest (file, not directory). Guest 11521 style path.</desc> 11522 </param> 11523 <param name="flags" type="FileCopyFlag" dir="in" safearray="yes"> 11524 <desc>Zero or more <link to="FileCopyFlag"/> values.</desc> 11525 </param> 11526 <param name="progress" type="IProgress" dir="return"> 11527 <desc>Progress object to track the operation to completion.</desc> 11528 </param> 11529 </method> 11530 11241 11531 <method name="fileCreateTemp"> 11242 11532 <desc> … … 11245 11535 <result name="VBOX_E_NOT_SUPPORTED"> 11246 11536 The operation is not possible as requested on this particular 11247 guest type.11537 guest OS. 11248 11538 </result> 11249 11539 <result name="E_INVALIDARG"> … … 11265 11555 </param> 11266 11556 <param name="mode" type="unsigned long" dir="in"> 11267 <desc>The mode of the file to create. Use 0700 unless there are 11268 reasons not to. This parameter is ignored if "secure" is specified. 11269 </desc> 11557 <desc> 11558 The UNIX-style access mode mask to create the file with. 11559 Whether/how all three access groups and associated access rights are 11560 realized is guest OS dependent. The API does the best it can on each 11561 OS. 11562 11563 This parameter is ignore if the @a secure parameter is set to @c true. 11564 <note>It is strongly recommended to use 0600.</note> 11565 </desc> 11270 11566 </param> 11271 11567 <param name="path" type="wstring" dir="in"> 11272 <desc>The absolute path to create the temporary file in.</desc> 11568 <desc>The path to the directory in which the temporary file should be 11569 created.</desc> 11273 11570 </param> 11274 11571 <param name="secure" type="boolean" dir="in"> … … 11288 11585 <method name="fileExists"> 11289 11586 <desc> 11290 Checks whether a file exists in the guest or not.11587 Checks whether a regular file exists in the guest or not. 11291 11588 11292 11589 <result name="VBOX_E_IPRT_ERROR"> … … 11295 11592 </desc> 11296 11593 <param name="path" type="wstring" dir="in"> 11297 <desc>File to check existence for.</desc> 11594 <desc>Path to the alleged regular file. Guest path style.</desc> 11595 </param> 11596 <param name="followSymlinks" type="boolean" dir="in"> 11597 <desc> 11598 If @c true, symbolic links in the final component will be followed 11599 and the existance of the symlink target made the question for this method. 11600 If @c false, a symbolic link in the final component will make the 11601 method return @c false (because a symlink isn't a regular file). 11602 </desc> 11603 </param> 11604 <param name="exists" type="boolean" dir="return"> 11605 <desc>Returns @c true if the file exists, @c false if not. @c false is 11606 also return if this @a path does not point to a file object.</desc> 11607 </param> 11608 </method> 11609 11610 <method name="fileOpen"> 11611 <desc> 11612 Opens a file and creates a <link to="IGuestFile"/> object that 11613 can be used for further operations. 11614 11615 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11616 File to open was not found. 11617 </result> 11618 <result name="VBOX_E_IPRT_ERROR"> 11619 Error while opening the file. 11620 </result> 11621 </desc> 11622 <param name="path" type="wstring" dir="in"> 11623 <desc>Path to file to open. Guest path style.</desc> 11624 </param> 11625 <param name="accessMode" type="FileAccessMode" dir="in"> 11626 <desc>The file access mode (read, write and/or append). 11627 See <link to="FileAccessMode"/> for details.</desc> 11628 </param> 11629 <param name="openAction" type="FileOpenAction" dir="in"> 11630 <desc>What action to take depending on whether the file exists or not. 11631 See <link to="FileOpenAction"/> for details.</desc> 11632 </param> 11633 <param name="creationMode" type="unsigned long" dir="in"> 11634 <desc> 11635 The UNIX-style access mode mask to create the file with if @a openAction 11636 requested the file to be created (otherwise ignored). Whether/how all 11637 three access groups and associated access rights are realized is guest 11638 OS dependent. The API does the best it can on each OS. 11639 </desc> 11640 </param> 11641 <param name="file" type="IGuestFile" dir="return"> 11642 <desc><link to="IGuestFile"/> object representing the opened file.</desc> 11643 </param> 11644 </method> 11645 11646 <method name="fileOpenEx"> 11647 <desc> 11648 Opens a file and creates a <link to="IGuestFile"/> object that 11649 can be used for further operations, extended version. 11650 11651 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11652 File to open was not found. 11653 </result> 11654 <result name="VBOX_E_IPRT_ERROR"> 11655 Error while opening the file. 11656 </result> 11657 </desc> 11658 <param name="path" type="wstring" dir="in"> 11659 <desc>Path to file to open. Guest path style.</desc> 11660 </param> 11661 <param name="accessMode" type="FileAccessMode" dir="in"> 11662 <desc>The file access mode (read, write and/or append). 11663 See <link to="FileAccessMode"/> for details.</desc> 11664 </param> 11665 <param name="openAction" type="FileOpenAction" dir="in"> 11666 <desc>What action to take depending on whether the file exists or not. 11667 See <link to="FileOpenAction"/> for details.</desc> 11668 </param> 11669 <param name="sharingMode" type="FileSharingMode" dir="in"> 11670 <desc>The file sharing mode in the guest. This parameter is currently 11671 ignore for all guest OSes. It will in the future be implemented for 11672 Windows, OS/2 and maybe Solaris guests only, the others will ignore it. 11673 Use <link to="FileSharingMode::All"/>. 11674 </desc> 11675 </param> 11676 <param name="creationMode" type="unsigned long" dir="in"> 11677 <desc> 11678 The UNIX-style access mode mask to create the file with if @a openAction 11679 requested the file to be created (otherwise ignored). Whether/how all 11680 three access groups and associated access rights are realized is guest 11681 OS dependent. The API does the best it can on each OS. 11682 </desc> 11683 </param> 11684 <!-- r=bird: Use case for the 'offset' parameter, please? I see no possible rational, especially with readAt/writeAt/seek handy. 11685 Or is this an alternative way of doing "append" accessMode? Anyway, it's pretty harmless... --> 11686 <param name="offset" type="long long" dir="in"> 11687 <desc>The initial read/write offset (in bytes).</desc> 11688 </param> 11689 <param name="file" type="IGuestFile" dir="return"> 11690 <desc><link to="IGuestFile"/> object representing the opened file.</desc> 11691 </param> 11692 </method> 11693 11694 <method name="fileQuerySize"> 11695 <desc> 11696 Queries the size of a regular file in the guest. 11697 11698 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11699 File to was not found. 11700 </result> 11701 <result name="VBOX_E_IPRT_ERROR"> 11702 Error querying file size. 11703 </result> 11704 </desc> 11705 <param name="path" type="wstring" dir="in"> 11706 <desc>Path to the file which size is requested. Guest path style.</desc> 11707 </param> 11708 <param name="followSymlinks" type="boolean" dir="in"> 11709 <desc> 11710 It @c true, symbolic links in the final path component will be 11711 followed to their target, and the size of the target is returned. 11712 If @c false, symbolic links in the final path component will make 11713 the method call fail (symblink is not a regular file). 11714 </desc> 11715 </param> 11716 <param name="size" type="long long" dir="return"> 11717 <desc>Queried file size.</desc> 11718 </param> 11719 </method> 11720 11721 <!-- File System Object Level --> 11722 11723 <method name="fsObjExists"> 11724 <desc> 11725 Checks whether a file system object (file, directory, etc) exists in 11726 the guest or not. 11727 11728 <result name="VBOX_E_IPRT_ERROR"> 11729 Error while checking existence of the file specified. 11730 </result> 11731 </desc> 11732 <param name="path" type="wstring" dir="in"> 11733 <desc>Path to the file system object to check the existance of. Guest 11734 path style.</desc> 11735 </param> 11736 <param name="followSymlinks" type="boolean" dir="in"> 11737 <desc> 11738 If @c true, symbolic links in the final component will be followed 11739 and the method will instead check if the target exists. 11740 If @c false, symbolic links in the final component will satisfy the 11741 method and it will return @c true in @a exists. 11742 </desc> 11298 11743 </param> 11299 11744 <param name="exists" type="boolean" dir="return"> … … 11302 11747 </method> 11303 11748 11304 <method name="fileRemove"> 11305 <desc> 11306 Removes a single file in the guest. 11307 11308 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11309 File to remove was not found. 11310 </result> 11311 <result name="VBOX_E_IPRT_ERROR"> 11312 Error while removing the file. 11313 </result> 11314 </desc> 11315 <param name="path" type="wstring" dir="in"> 11316 <desc>Path to the file to remove.</desc> 11317 </param> 11318 </method> 11319 11320 <method name="fileOpen"> 11321 <desc> 11322 Opens a file and creates a <link to="IGuestFile"/> object that 11323 can be used for further operations. 11324 11325 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11326 File to open was not found. 11327 </result> 11328 <result name="VBOX_E_IPRT_ERROR"> 11329 Error while opening the file. 11330 </result> 11331 </desc> 11332 <param name="path" type="wstring" dir="in"> 11333 <desc>Full path to file to open.</desc> 11334 </param> 11335 <param name="openMode" type="wstring" dir="in"> 11336 <desc>The file opening mode. This describes the wanted access to a file, whereas 11337 the parameter must be one of the following: 11338 <ul> 11339 <li><tt>"r"</tt>: Opens a file for reading.</li> 11340 <li><tt>"r+"</tt>: Opens a file for reading and writing.</li> 11341 <li><tt>"w"</tt>: Opens a file for writing.</li> 11342 <li><tt>"w+"</tt>: Opens a file for writing and reading.</li> 11343 </ul> 11344 </desc> 11345 </param> 11346 <param name="disposition" type="wstring" dir="in"> 11347 <desc>The file disposition. This describes the action to take in case a 11348 file exists or does not exist, whereas the parameter must be one of the 11349 following: 11350 <ul> 11351 <li><tt>"ca"</tt>: Creates a new file, always. Overwrites an existing file.</li> 11352 <li><tt>"ce"</tt>: Creates a new file if it does not exist. Fail if exist.</li> 11353 <li><tt>"oa"</tt>: Opens an existing file and places the file pointer at the 11354 end of the file, if opened with write access. Create the file if it does not exist.</li> 11355 <li><tt>"oc"</tt>: Opens an existing file or create it if it does not exist.</li> 11356 <li><tt>"oe"</tt>: Opens an existing file or fail if it does not exist.</li> 11357 <li><tt>"ot"</tt>: Opens and truncate an existing file or fail if it does not exist.</li> 11358 </ul> 11359 </desc> 11360 </param> 11361 <param name="creationMode" type="unsigned long" dir="in"> 11362 <desc>The mode to create the file with. Must be a three-digit octal number which 11363 represents the access rights for the file.</desc> 11364 </param> 11365 <param name="file" type="IGuestFile" dir="return"> 11366 <desc><link to="IGuestFile"/> object representing the opened file.</desc> 11367 </param> 11368 </method> 11369 11370 <method name="fileOpenEx"> 11371 <desc> 11372 Opens a file and creates a <link to="IGuestFile"/> object that 11373 can be used for further operations, extended version. 11374 11375 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11376 File to open was not found. 11377 </result> 11378 <result name="VBOX_E_IPRT_ERROR"> 11379 Error while opening the file. 11380 </result> 11381 </desc> 11382 <param name="path" type="wstring" dir="in"> 11383 <desc>Full path to file to open.</desc> 11384 </param> 11385 <param name="openMode" type="wstring" dir="in"> 11386 <desc>The file opening mode. This describes the wanted access to a file, whereas 11387 the parameter must be one of the following: 11388 <ul> 11389 <li><tt>"r"</tt>: Opens a file for reading.</li> 11390 <li><tt>"r+"</tt>: Opens a file for reading and writing.</li> 11391 <li><tt>"w"</tt>: Opens a file for writing.</li> 11392 <li><tt>"w+"</tt>: Opens a file for writing and reading.</li> 11393 </ul> 11394 </desc> 11395 </param> 11396 <param name="disposition" type="wstring" dir="in"> 11397 <desc>The file disposition. This describes the action to take in case a 11398 file exists or does not exist, whereas the parameter must be one of the 11399 following: 11400 <ul> 11401 <li><tt>"ca"</tt>: Creates a new file, always. Overwrites an existing file.</li> 11402 <li><tt>"ce"</tt>: Creates a new file if it does not exist. Fail if exist.</li> 11403 <li><tt>"oa"</tt>: Opens an existing file and places the file pointer at the 11404 end of the file, if opened with write access. Create the file if it does not exist.</li> 11405 <li><tt>"oc"</tt>: Opens an existing file or create it if it does not exist.</li> 11406 <li><tt>"oe"</tt>: Opens an existing file or fail if it does not exist.</li> 11407 <li><tt>"ot"</tt>: Opens and truncate an existing file or fail if it does not exist.</li> 11408 </ul> 11409 </desc> 11410 </param> 11411 <param name="sharingMode" type="wstring" dir="in"> 11412 <desc>The file sharing mode in the guest. This parameter 11413 is not implemented yet. Pass an empty string here.</desc> 11414 </param> 11415 <param name="creationMode" type="unsigned long" dir="in"> 11416 <desc>The mode to create the file with. Must be a three-digit octal number which 11417 represents the access rights for the file.</desc> 11418 </param> 11419 <param name="offset" type="long long" dir="in"> 11420 <desc>The initial read/write offset (in bytes).</desc> 11421 </param> 11422 <param name="file" type="IGuestFile" dir="return"> 11423 <desc><link to="IGuestFile"/> object representing the opened file.</desc> 11424 </param> 11425 </method> 11426 11427 <method name="fileQueryInfo"> 11428 <desc> 11429 Queries information about a file in the guest. 11430 11431 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11432 File to query information for was not found. 11433 </result> 11434 <result name="VBOX_E_IPRT_ERROR"> 11435 Error querying information. 11436 </result> 11437 </desc> 11438 <param name="path" type="wstring" dir="in"> 11439 <desc>File to query information for.</desc> 11440 </param> 11441 <param name="info" type="IGuestFsObjInfo" dir="return"> 11442 <desc><link to="IGuestFsObjInfo"/> object containing the queried information.</desc> 11443 </param> 11444 </method> 11445 11446 <method name="fileQuerySize"> 11447 <desc> 11448 Queries the size of a file in the guest. 11449 11450 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11451 File to rename was not found. 11452 </result> 11453 <result name="VBOX_E_IPRT_ERROR"> 11454 Error querying file size. 11455 </result> 11456 </desc> 11457 <param name="path" type="wstring" dir="in"> 11458 <desc>File to query the size for.</desc> 11459 </param> 11460 <param name="size" type="long long" dir="return"> 11461 <desc>Queried file size.</desc> 11462 </param> 11463 </method> 11464 11465 <method name="fileRename"> 11466 <desc> 11467 Renames a file in the guest. 11468 </desc> 11469 <param name="source" type="wstring" dir="in"> 11470 <desc>Source file to rename.</desc> 11471 </param> 11472 <param name="dest" type="wstring" dir="in"> 11473 <desc>Destination file to rename the source to.</desc> 11474 </param> 11475 <param name="flags" type="PathRenameFlag" dir="in" safearray="yes"> 11476 <desc>Rename flags; see <link to="PathRenameFlag"/> for more information.</desc> 11477 </param> 11478 </method> 11479 11480 <method name="fileSetACL"> 11481 <desc> 11482 Sets the ACL (Access Control List) of a file in the guest. 11483 11484 <result name="E_NOTIMPL"> 11485 The method is not implemented yet. 11486 </result> 11487 </desc> 11488 <param name="file" type="wstring" dir="in"> 11489 <desc>Full path of file to set the ACL for.</desc> 11490 </param> 11491 <param name="acl" type="wstring" dir="in"> 11492 <desc>Actual ACL string to set. Must comply with the guest OS.</desc> 11493 </param> 11494 </method> 11495 11496 <method name="fsExists"> 11497 <desc> 11498 Checks whether a file system object (file, directory, etc) exists in 11499 the guest or not. 11500 11501 <result name="VBOX_E_IPRT_ERROR"> 11502 Error while checking existence of the file specified. 11503 </result> 11504 </desc> 11505 <param name="path" type="wstring" dir="in"> 11506 <desc>Path to the file system object to check the existance of.</desc> 11507 </param> 11508 <param name="followSymlinks" type="boolean" dir="in"> 11509 <desc> 11510 If @c true symbolic links will be followed and the target must 11511 exists and be accessible, otherwise, if @c false we'll be happy 11512 with a dangling symbolic link. 11513 </desc> 11514 </param> 11515 <param name="exists" type="boolean" dir="return"> 11516 <desc>Returns @c true if the file exists, @c false if not.</desc> 11517 </param> 11518 </method> 11519 11520 <method name="fsQueryInfo"> 11749 <method name="fsObjQueryInfo"> 11521 11750 <desc> 11522 11751 Queries information about a file system object (file, directory, etc) … … 11531 11760 </desc> 11532 11761 <param name="path" type="wstring" dir="in"> 11533 <desc>Path to the file system object to gather information about</desc> 11762 <desc>Path to the file system object to gather information about. 11763 Guest path style.</desc> 11534 11764 </param> 11535 11765 <param name="followSymlinks" type="boolean" dir="in"> … … 11544 11774 </param> 11545 11775 </method> 11776 11777 <method name="fsObjRemove"> 11778 <desc> 11779 Removes a file system object (file, symlink, etc) in the guest. Will 11780 not work on directories, use <link to="IGuestSession::directoryRemove"/> 11781 to remove directories. 11782 11783 <note>This method will remove symbolic links in the final path 11784 component, not follow them.</note> 11785 11786 <result name="E_NOTIMPL"> 11787 The method has not been implemented yet. 11788 </result> 11789 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11790 The file system object was not found. 11791 </result> 11792 <result name="VBOX_E_IPRT_ERROR"> 11793 For most other errors. We know this is unhelpful, will fix shortly... 11794 </result> 11795 </desc> 11796 <param name="path" type="wstring" dir="in"> 11797 <desc>Path to the file system object to remove. Guest style path.</desc> 11798 </param> 11799 </method> 11800 11801 <method name="fsObjRename"> 11802 <desc> 11803 Renames a file system object (file, directory, symlink, etc) in the 11804 guest. 11805 11806 <result name="VBOX_E_OBJECT_NOT_FOUND"> 11807 The file system object was not found. 11808 </result> 11809 <result name="VBOX_E_IPRT_ERROR"> 11810 For most other errors. We know this is unhelpful, will fix shortly... 11811 </result> 11812 </desc> 11813 <param name="oldPath" type="wstring" dir="in"> 11814 <desc>The current path to the object. Guest path style.</desc> 11815 </param> 11816 <param name="newPath" type="wstring" dir="in"> 11817 <desc>The new path to the object. Guest path style.</desc> 11818 </param> 11819 <param name="flags" type="FsObjRenameFlag" dir="in" safearray="yes"> 11820 <desc>Zero or more <link to="FsObjRenameFlag"/> values.</desc> 11821 </param> 11822 </method> 11823 11824 <method name="fsObjMove"> 11825 <desc> 11826 Moves a file system object (file, directory, symlink, etc) from one 11827 guest location to another. 11828 11829 This differs from <link to="IGuestSession::fsObjRename"/> in that it 11830 can move accross file system boundraries. In that case it will 11831 perform a copy and then delete the original. For directories, this 11832 can take a while and is subject to races. 11833 11834 <result name="E_NOTIMPL"> 11835 Not yet implemented. 11836 </result> 11837 </desc> 11838 <param name="source" type="wstring" dir="in"> 11839 <desc>Path to the file to move. Guest path style.</desc> 11840 </param> 11841 <param name="destination" type="wstring" dir="in"> 11842 <desc>Where to move the file to (file, not directory). Guest path 11843 style.</desc> 11844 </param> 11845 <param name="flags" type="FsObjMoveFlags" dir="in" safearray="yes"> 11846 <desc>Zero or more <link to="FsObjMoveFlags"/> values.</desc> 11847 </param> 11848 <param name="progress" type="IProgress" dir="return"> 11849 <desc>Progress object to track the operation to completion.</desc> 11850 </param> 11851 </method> 11852 11853 <method name="fsObjSetACL"> 11854 <desc> 11855 Sets the access control list (ACL) of a file system object (file, 11856 directory, etc) in the guest. 11857 11858 <result name="E_NOTIMPL"> 11859 The method is not implemented yet. 11860 </result> 11861 </desc> 11862 <param name="path" type="wstring" dir="in"> 11863 <desc>Full path of the file system object which ACL to set</desc> 11864 </param> 11865 <param name="followSymlinks" type="boolean" dir="in"> 11866 <desc> 11867 If @c true symbolic links in the final component will be followed, 11868 otherwise, if @c false, the method will work directly on a symbolic 11869 link in the final component. 11870 </desc> 11871 </param> 11872 <param name="acl" type="wstring" dir="in"> 11873 <desc>The ACL specification string. To-be-defined.</desc> 11874 </param> 11875 <param name="mode" type="unsigned long" dir="in"> 11876 <desc>UNIX-style mode mask to use if @a acl is empty. As mention in 11877 <link to="IGuestSession::directoryCreate"/> this is realized on 11878 a best effort basis and the exact behavior depends on the Guest OS. 11879 </desc> 11880 </param> 11881 </method> 11882 11883 <!-- Process methods --> 11546 11884 11547 11885 <method name="processCreate"> … … 11708 12046 </method> 11709 12047 12048 <!-- Symbolic link methods --> 12049 11710 12050 <method name="symlinkCreate"> 11711 12051 <desc> … … 11716 12056 </result> 11717 12057 </desc> 11718 <param name="source" type="wstring" dir="in"> 11719 <desc>The name of the symbolic link.</desc> 12058 <param name="symlink" type="wstring" dir="in"> 12059 <desc>Path to the symbolic link that should be created. Guest path 12060 style.</desc> 11720 12061 </param> 11721 12062 <param name="target" type="wstring" dir="in"> 11722 <desc>The path to the symbolic link target.</desc> 12063 <desc> 12064 The path to the symbolic link target. If not an absolute, this will 12065 be relative to the @a symlink location at access time. Guest path 12066 style. 12067 </desc> 11723 12068 </param> 11724 12069 <param name="type" type="SymlinkType" dir="in"> 11725 12070 <desc> 11726 The symbolic link type ;11727 see <link to="SymlinkReadFlag"/>for more information.12071 The symbolic link type (mainly for Windows). See <link to="SymlinkType"/> 12072 for more information. 11728 12073 </desc> 11729 12074 </param> … … 11739 12084 </desc> 11740 12085 <param name="symlink" type="wstring" dir="in"> 11741 <desc> Symbolic link to check existence for.</desc>12086 <desc>Path to the alleged symbolic link. Guest path style.</desc> 11742 12087 </param> 11743 12088 <param name="exists" type="boolean" dir="return"> 11744 <desc>Returns @c true if the symbolic link exists, @c false if not.</desc> 12089 <desc> 12090 Returns @c true if the symbolic link exists. Returns @c false if it 12091 does not exist, if the file system object identified by the path is 12092 not a symbolic link, or if the object type is inaccessible to the 12093 user, or if the @a symlink argument is empty. 12094 </desc> 11745 12095 </param> 11746 12096 </method> … … 11748 12098 <method name="symlinkRead"> 11749 12099 <desc> 11750 Reads a symbolic link in the guest.12100 Reads the target value of a symbolic link in the guest. 11751 12101 11752 12102 <result name="E_NOTIMPL"> … … 11755 12105 </desc> 11756 12106 <param name="symlink" type="wstring" dir="in"> 11757 <desc> Full path tosymbolic link to read.</desc>12107 <desc>Path to the symbolic link to read.</desc> 11758 12108 </param> 11759 12109 <param name="flags" type="SymlinkReadFlag" dir="in" safearray="yes"> 11760 <desc> 11761 Read flags; see <link to="SymlinkReadFlag"/> for more information. 11762 </desc> 12110 <desc>Zero or more <link to="SymlinkReadFlag"/> values.</desc> 11763 12111 </param> 11764 12112 <param name="target" type="wstring" dir="return"> 11765 <desc> 11766 Target of the symbolic link pointing to, if found. 11767 </desc> 11768 </param> 11769 </method> 11770 11771 <method name="symlinkRemoveDirectory"> 11772 <desc> 11773 Removes a symbolic link in the guest if it's a directory. 11774 11775 <result name="E_NOTIMPL"> 11776 The method is not implemented yet. 11777 </result> 11778 </desc> 11779 <param name="path" type="wstring" dir="in"> 11780 <desc>Symbolic link to remove.</desc> 11781 </param> 11782 </method> 11783 11784 <method name="symlinkRemoveFile"> 11785 <desc> 11786 Removes a symbolic link in the guest if it's a file. 11787 11788 <result name="E_NOTIMPL"> 11789 The method is not implemented yet. 11790 </result> 11791 </desc> 11792 <param name="file" type="wstring" dir="in"> 11793 <desc>Symbolic link to remove.</desc> 11794 </param> 11795 </method> 12113 <desc>Target value of the symbolic link. Guest path style.</desc> 12114 </param> 12115 </method> 12116 12117 <!-- Session wait methods --> 11796 12118 11797 12119 <method name="waitFor"> … … 12057 12379 12058 12380 <attribute name="directoryName" type="wstring" readonly="yes"> 12059 <desc> 12060 Full path of directory. 12061 </desc> 12381 <desc>The path specified when opening the directory.</desc> 12062 12382 </attribute> 12063 12383 12064 12384 <attribute name="filter" type="wstring" readonly="yes"> 12065 <desc> 12066 The open filter. 12067 </desc> 12385 <desc>Directory listing filter to (specified when opening the directory).</desc> 12068 12386 </attribute> 12069 12387 … … 12087 12405 </param> 12088 12406 </method> 12407 12408 <!-- Would be useful to add queryInfo() and setACL() here later, but at 12409 present IPRT isn't doing a race free job with the former and doesn't 12410 have the latter. So, let it be for now. --> 12411 12089 12412 </interface> 12090 12413 … … 12103 12426 <interface 12104 12427 name="IFile" extends="$unknown" 12105 uuid="5 ec56ea3-b55d-4bdb-8c4f-5f9fb26b894b"12428 uuid="540804bf-4ca6-dd43-800c-bfb9765f96fe" 12106 12429 wsmap="managed" 12107 12430 > … … 12109 12432 Abstract parent interface for files handled by VirtualBox. 12110 12433 </desc> 12434 12435 <attribute name="eventSource" type="IEventSource" readonly="yes"> 12436 <desc> 12437 Event source for file events. 12438 </desc> 12439 </attribute> 12440 <attribute name="id" type="unsigned long" readonly="yes"> 12441 <desc> 12442 The ID VirtualBox internally assigned to the open file. 12443 </desc> 12444 </attribute> 12445 <attribute name="initialSize" type="long long" readonly="yes"> 12446 <desc> 12447 The initial size in bytes when opened. 12448 </desc> 12449 </attribute> 12450 <attribute name="offset" type="long long" readonly="yes"> 12451 <desc> 12452 The current file position. 12453 12454 The file current position always applies to the <link to="IFile::read"/> 12455 method, which updates it upon return. Same goes for the <link to="IFile::write"/> 12456 method except when <link to="IFile::accessMode"/> is <link to="FileAccessMode::AppendOnly"/> 12457 or <link to="FileAccessMode::AppendRead"/>, where it will always write 12458 to the end of the file and will leave this attribute unchanged. 12459 12460 The <link to="IFile::seek"/> is used to change this attribute without 12461 transfering any file data like read and write does. 12462 </desc> 12463 </attribute> 12464 <attribute name="status" type="FileStatus" readonly="yes"> 12465 <desc> 12466 Current file status. 12467 </desc> 12468 </attribute> 12469 12470 <!-- The following attributes just remembers the fileOpen parameters for you. 12471 Nice for introspection and probably doesn't cost us much. --> 12472 <attribute name="fileName" type="wstring" readonly="yes"> 12473 <desc>Full path of the actual file name of this file. 12474 <!-- r=bird: The 'actual' file name is too tough, we cannot guarentee 12475 that on unix guests. Seeing how IGuestDirectory did things, 12476 I'm questioning the 'Full path' part too. Not urgent to check. --> 12477 </desc> 12478 </attribute> 12111 12479 <attribute name="creationMode" type="unsigned long" readonly="yes"> 12112 <desc> 12113 The creation mode. 12114 </desc> 12115 </attribute> 12116 <attribute name="disposition" type="wstring" readonly="yes"> 12117 <desc> 12118 The disposition mode. 12119 </desc> 12120 </attribute> 12121 <attribute name="eventSource" type="IEventSource" readonly="yes"> 12122 <desc> 12123 Event source for file events. 12124 </desc> 12125 </attribute> 12126 <attribute name="fileName" type="wstring" readonly="yes"> 12127 <desc> 12128 Full path of the actual file name of this file. 12129 </desc> 12130 </attribute> 12131 <attribute name="id" type="unsigned long" readonly="yes"> 12132 <desc> 12133 The file's ID. 12134 </desc> 12135 </attribute> 12136 <attribute name="initialSize" type="long long" readonly="yes"> 12137 <desc> 12138 The initial size in bytes when opened. 12139 </desc> 12140 </attribute> 12141 <attribute name="openMode" type="wstring" readonly="yes"> 12142 <desc> 12143 The open mode. 12144 </desc> 12145 </attribute> 12146 <attribute name="offset" type="long long" readonly="yes"> 12147 <desc> 12148 Current read/write offset in bytes. 12149 </desc> 12150 </attribute> 12151 <attribute name="status" type="FileStatus" readonly="yes"> 12152 <desc> 12153 Current file status. 12154 </desc> 12480 <desc>The UNIX-style creation mode specified when opening the file.</desc> 12481 </attribute> 12482 <attribute name="openAction" type="FileOpenAction" readonly="yes"> 12483 <desc>The opening action specified when opening the file.</desc> 12484 </attribute> 12485 <attribute name="accessMode" type="FileAccessMode" readonly="yes"> 12486 <desc>The file access mode.</desc> 12155 12487 </attribute> 12156 12488 … … 12176 12508 </method> 12177 12509 12178 <method name="read"> 12179 <desc> 12180 Reads data from this file. 12510 <method name="querySize"> 12511 <!-- Can also be gotten via seek(Current, 0), but this is easier to us. 12512 This is a query method both to match IGuestSession::fileQuerySize to 12513 highlight that it is a value that is not cacheable as others may be 12514 changing the file concurrently (image reading /var/log/messages). --> 12515 <desc> 12516 Queries the current file size. 12181 12517 12182 12518 <result name="E_NOTIMPL"> … … 12184 12520 </result> 12185 12521 </desc> 12522 <param name="size" type="long long" dir="return"> 12523 <desc>Queried file size.</desc> 12524 </param> 12525 </method> 12526 12527 <method name="read"> 12528 <desc> 12529 Reads data from this file. 12530 12531 <result name="E_NOTIMPL"> 12532 The method is not implemented yet. 12533 </result> 12534 </desc> 12186 12535 <param name="toRead" type="unsigned long" dir="in"> 12187 12536 <desc>Number of bytes to read.</desc> … … 12225 12574 <method name="seek"> 12226 12575 <desc> 12227 Changes the read and write position of this file. 12576 Changes the current file position of this file. 12577 12578 The file current position always applies to the <link to="IFile::read"/> 12579 method. Same for the <link to="IFile::write"/> method it except when 12580 the <link to="IFile::accessMode"/> is <link to="FileAccessMode::AppendOnly"/> 12581 or <link to="FileAccessMode::AppendRead"/>. 12582 </desc> 12583 <param name="offset" type="long long" dir="in"> 12584 <desc>Offset to seek relative to the position specified by @a whence.</desc> 12585 </param> 12586 <param name="whence" type="FileSeekOrigin" dir="in"> 12587 <desc> 12588 One of the <link to="FileSeekOrigin"/> seek starting points. 12589 </desc> 12590 </param> 12591 <param name="newOffset" type="long long" dir="return"> 12592 <desc>The new file offset after the seek operation.</desc> 12593 </param> 12594 </method> 12595 12596 <method name="setACL"> 12597 <desc> 12598 Sets the ACL of this file. 12228 12599 12229 12600 <result name="E_NOTIMPL"> … … 12231 12602 </result> 12232 12603 </desc> 12233 <param name="offset" type="long long" dir="in"> 12234 <desc>Offset to seek.</desc> 12235 </param> 12236 <param name="whence" type="FileSeekType" dir="in"> 12237 <desc> 12238 Seek mode; see <link to="FileSeekType"/> for more information. 12239 </desc> 12240 </param> 12241 </method> 12242 12243 <method name="setACL"> 12244 <desc> 12245 Sets the ACL of this file. 12604 <param name="acl" type="wstring" dir="in"> 12605 <desc>The ACL specification string. To-be-defined.</desc> 12606 </param> 12607 <param name="mode" type="unsigned long" dir="in"> 12608 <desc>UNIX-style mode mask to use if @a acl is empty. As mention in 12609 <link to="IGuestSession::directoryCreate"/> this is realized on 12610 a best effort basis and the exact behavior depends on the Guest OS. 12611 </desc> 12612 </param> 12613 </method> 12614 12615 <method name="setSize"> 12616 <desc> 12617 Changes the file size. 12246 12618 12247 12619 <result name="E_NOTIMPL"> … … 12249 12621 </result> 12250 12622 </desc> 12251 <param name=" acl" type="wstring" dir="in">12252 <desc> ACL string to set.</desc>12623 <param name="size" type="long long" dir="in"> 12624 <desc>The new file size.</desc> 12253 12625 </param> 12254 12626 </method> … … 12307 12679 <interface 12308 12680 name="IGuestFile" extends="IFile" 12309 uuid=" b68f642c-49db-d699-db5c-bcb01c08e95f"12681 uuid="92f21dc0-44de-1653-b717-2ebf0ca9b664" 12310 12682 wsmap="managed" 12311 12683 > -
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r55594 r55631 599 599 /** The filename. */ 600 600 Utf8Str mFileName; 601 /** Then file's opening mode. */ 602 Utf8Str mOpenMode; 603 /** The file's disposition mode. */ 604 Utf8Str mDisposition; 605 /** The file's sharing mode. 606 **@todo Not implemented yet.*/ 607 Utf8Str mSharingMode; 601 /** The file access mode. */ 602 FileAccessMode_T mAccessMode; 603 /** String translation of mFileAccessMode for the GAs. */ 604 const char *mpszAccessMode; 605 /** The file open action. */ 606 FileOpenAction_T mOpenAction; 607 /** String translation of mOpenAction for the GAs. */ 608 const char *mpszOpenAction; 609 /** The file sharing mode. */ 610 FileSharingMode_T mSharingMode; 608 611 /** Octal creation mode. */ 609 612 uint32_t mCreationMode; -
trunk/src/VBox/Main/include/GuestFileImpl.h
r51321 r55631 72 72 private: 73 73 74 /** Wrapped @nameIGuestFile properties.74 /** @name Wrapped IGuestFile properties. 75 75 * @{ */ 76 76 HRESULT getCreationMode(ULONG *aCreationMode); 77 HRESULT getDisposition(com::Utf8Str &aDisposition);78 77 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource); 79 HRESULT getFileName(com::Utf8Str &aFileName);80 78 HRESULT getId(ULONG *aId); 81 79 HRESULT getInitialSize(LONG64 *aInitialSize); 82 HRESULT getOpenMode(com::Utf8Str &aOpenMode);83 80 HRESULT getOffset(LONG64 *aOffset); 84 81 HRESULT getStatus(FileStatus_T *aStatus); 82 HRESULT getFileName(com::Utf8Str &aFileName); 83 HRESULT getAccessMode(FileAccessMode_T *aAccessMode); 84 HRESULT getOpenAction(FileOpenAction_T *aOpenAction); 85 85 /** @} */ 86 86 87 /** Wrapped @nameIGuestFile methods.87 /** @name Wrapped IGuestFile methods. 88 88 * @{ */ 89 89 HRESULT close(); 90 90 HRESULT queryInfo(ComPtr<IFsObjInfo> &aObjInfo); 91 HRESULT querySize(LONG64 *aSize); 91 92 HRESULT read(ULONG aToRead, 92 93 ULONG aTimeoutMS, … … 97 98 std::vector<BYTE> &aData); 98 99 HRESULT seek(LONG64 aOffset, 99 FileSeekType_T aWhence); 100 HRESULT setACL(const com::Utf8Str &aAcl); 100 FileSeekOrigin_T aWhence, 101 LONG64 *aNewOffset); 102 HRESULT setACL(const com::Utf8Str &aAcl, 103 ULONG aMode); 104 HRESULT setSize(LONG64 aSize); 101 105 HRESULT write(const std::vector<BYTE> &aData, 102 106 ULONG aTimeoutMS, -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r55613 r55631 273 273 HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses); 274 274 HRESULT getPathStyle(PathStyle_T *aPathStyle); 275 HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory); 276 HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory); 275 277 HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories); 276 278 HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles); … … 281 283 * @{ */ 282 284 HRESULT close(); 283 HRESULT copyFrom(const com::Utf8Str &aSource, 284 const com::Utf8Str &aDest, 285 const std::vector<CopyFileFlag_T> &aFlags, 286 ComPtr<IProgress> &aProgress); 287 HRESULT copyTo(const com::Utf8Str &aSource, 288 const com::Utf8Str &aDest, 289 const std::vector<CopyFileFlag_T> &aFlags, 290 ComPtr<IProgress> &aProgress); 285 286 HRESULT directoryCopy(const com::Utf8Str &aSource, 287 const com::Utf8Str &aDestination, 288 const std::vector<DirectoryCopyFlags_T> &aFlags, 289 ComPtr<IProgress> &aProgress); 290 HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource, 291 const com::Utf8Str &aDestination, 292 const std::vector<DirectoryCopyFlags_T> &aFlags, 293 ComPtr<IProgress> &aProgress); 294 HRESULT directoryCopyToGuest(const com::Utf8Str &aSource, 295 const com::Utf8Str &aDestination, 296 const std::vector<DirectoryCopyFlags_T> &aFlags, 297 ComPtr<IProgress> &aProgress); 291 298 HRESULT directoryCreate(const com::Utf8Str &aPath, 292 299 ULONG aMode, … … 298 305 com::Utf8Str &aDirectory); 299 306 HRESULT directoryExists(const com::Utf8Str &aPath, 307 BOOL aFollowSymlinks, 300 308 BOOL *aExists); 301 309 HRESULT directoryOpen(const com::Utf8Str &aPath, … … 303 311 const std::vector<DirectoryOpenFlag_T> &aFlags, 304 312 ComPtr<IGuestDirectory> &aDirectory); 305 HRESULT directoryQueryInfo(const com::Utf8Str &aPath,306 ComPtr<IGuestFsObjInfo> &aInfo);307 313 HRESULT directoryRemove(const com::Utf8Str &aPath); 308 314 HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath, 309 315 const std::vector<DirectoryRemoveRecFlag_T> &aFlags, 310 316 ComPtr<IProgress> &aProgress); 311 HRESULT directoryRename(const com::Utf8Str &aSource,312 const com::Utf8Str &aDest,313 const std::vector<PathRenameFlag_T> &aFlags);314 HRESULT directorySetACL(const com::Utf8Str &aPath,315 const com::Utf8Str &aAcl);316 317 HRESULT environmentScheduleSet(const com::Utf8Str &aName, 317 318 const com::Utf8Str &aValue); … … 321 322 HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName, 322 323 BOOL *aExists); 324 325 HRESULT fileCopy(const com::Utf8Str &aSource, 326 const com::Utf8Str &aDestination, 327 const std::vector<FileCopyFlag_T> &aFlags, 328 ComPtr<IProgress> &aProgress); 329 HRESULT fileCopyToGuest(const com::Utf8Str &aSource, 330 const com::Utf8Str &aDestination, 331 const std::vector<FileCopyFlag_T> &aFlags, 332 ComPtr<IProgress> &aProgress); 333 HRESULT fileCopyFromGuest(const com::Utf8Str &aSource, 334 const com::Utf8Str &aDestination, 335 const std::vector<FileCopyFlag_T> &aFlags, 336 ComPtr<IProgress> &aProgress); 323 337 HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName, 324 338 ULONG aMode, … … 327 341 ComPtr<IGuestFile> &aFile); 328 342 HRESULT fileExists(const com::Utf8Str &aPath, 343 BOOL aFollowSymlinks, 329 344 BOOL *aExists); 330 HRESULT fileRemove(const com::Utf8Str &aPath);331 345 HRESULT fileOpen(const com::Utf8Str &aPath, 332 const com::Utf8Str &aOpenMode,333 const com::Utf8Str &aDisposition,346 FileAccessMode_T aAccessMode, 347 FileOpenAction_T aOpenAction, 334 348 ULONG aCreationMode, 335 349 ComPtr<IGuestFile> &aFile); 336 350 HRESULT fileOpenEx(const com::Utf8Str &aPath, 337 const com::Utf8Str &aOpenMode,338 const com::Utf8Str &aDisposition,339 const com::Utf8Str &aSharingMode,351 FileAccessMode_T aAccessMode, 352 FileOpenAction_T aOpenAction, 353 FileSharingMode_T aSharingMode, 340 354 ULONG aCreationMode, 341 355 LONG64 aOffset, 342 356 ComPtr<IGuestFile> &aFile); 343 HRESULT fileQueryInfo(const com::Utf8Str &aPath,344 ComPtr<IGuestFsObjInfo> &aInfo);345 357 HRESULT fileQuerySize(const com::Utf8Str &aPath, 358 BOOL aFollowSymlinks, 346 359 LONG64 *aSize); 347 HRESULT fileRename(const com::Utf8Str &aSource, 348 const com::Utf8Str &aDest, 349 const std::vector<PathRenameFlag_T> &aFlags); 350 HRESULT fileSetACL(const com::Utf8Str &aFile, 351 const com::Utf8Str &aAcl); 352 HRESULT fsExists(const com::Utf8Str &aPath, 353 BOOL aFollowSymlinks, 354 BOOL *pfExists); 355 HRESULT fsQueryInfo(const com::Utf8Str &aPath, 360 HRESULT fsObjExists(const com::Utf8Str &aPath, 356 361 BOOL aFollowSymlinks, 357 ComPtr<IGuestFsObjInfo> &aInfo); 362 BOOL *pfExists); 363 HRESULT fsObjQueryInfo(const com::Utf8Str &aPath, 364 BOOL aFollowSymlinks, 365 ComPtr<IGuestFsObjInfo> &aInfo); 366 HRESULT fsObjRemove(const com::Utf8Str &aPath); 367 HRESULT fsObjRename(const com::Utf8Str &aOldPath, 368 const com::Utf8Str &aNewPath, 369 const std::vector<FsObjRenameFlag_T> &aFlags); 370 HRESULT fsObjMove(const com::Utf8Str &aSource, 371 const com::Utf8Str &aDestination, 372 const std::vector<FsObjMoveFlags_T> &aFlags, 373 ComPtr<IProgress> &aProgress); 374 HRESULT fsObjSetACL(const com::Utf8Str &aPath, 375 BOOL aFollowSymlinks, 376 const com::Utf8Str &aAcl, 377 ULONG aMode); 358 378 HRESULT processCreate(const com::Utf8Str &aCommand, 359 379 const std::vector<com::Utf8Str> &aArguments, … … 380 400 const std::vector<SymlinkReadFlag_T> &aFlags, 381 401 com::Utf8Str &aTarget); 382 HRESULT symlinkRemoveDirectory(const com::Utf8Str &aPath);383 HRESULT symlinkRemoveFile(const com::Utf8Str &aFile);384 402 HRESULT waitFor(ULONG aWaitFor, 385 403 ULONG aTimeoutMS, … … 422 440 int i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc); 423 441 int i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 424 int i_fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc);442 int i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc); 425 443 int i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc); 426 444 const GuestCredentials &i_getCredentials(void); -
trunk/src/VBox/Main/src-client/GuestFileImpl.cpp
r52934 r55631 254 254 } 255 255 256 HRESULT GuestFile::get Disposition(com::Utf8Str &aDisposition)256 HRESULT GuestFile::getOpenAction(FileOpenAction_T *aOpenAction) 257 257 { 258 258 #ifndef VBOX_WITH_GUEST_CONTROL … … 261 261 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 262 262 263 aDisposition = mData.mOpenInfo.mDisposition;263 *aOpenAction = mData.mOpenInfo.mOpenAction; 264 264 265 265 return S_OK; … … 331 331 } 332 332 333 HRESULT GuestFile::get OpenMode(com::Utf8Str &aOpenMode)333 HRESULT GuestFile::getAccessMode(FileAccessMode_T *aAccessMode) 334 334 { 335 335 #ifndef VBOX_WITH_GUEST_CONTROL … … 338 338 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 339 339 340 aOpenMode = mData.mOpenInfo.mOpenMode;340 *aAccessMode = mData.mOpenInfo.mAccessMode; 341 341 342 342 return S_OK; … … 694 694 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 695 695 696 LogFlowThisFunc(("strFile=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%RU32, uOffset=%RU64\n", 697 mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mOpenMode.c_str(), 698 mData.mOpenInfo.mDisposition.c_str(), mData.mOpenInfo.mCreationMode, mData.mOpenInfo.mInitialOffset)); 696 LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, uOffset=%RU64\n", 697 mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mAccessMode, mData.mOpenInfo.mpszAccessMode, 698 mData.mOpenInfo.mOpenAction, mData.mOpenInfo.mpszOpenAction, mData.mOpenInfo.mCreationMode, 699 mData.mOpenInfo.mInitialOffset)); 699 700 int vrc; 700 701 … … 721 722 paParms[i++].setPointer((void*)mData.mOpenInfo.mFileName.c_str(), 722 723 (ULONG)mData.mOpenInfo.mFileName.length() + 1); 723 paParms[i++].setPointer((void*)mData.mOpenInfo.mOpenMode.c_str(), 724 (ULONG)mData.mOpenInfo.mOpenMode.length() + 1); 725 paParms[i++].setPointer((void*)mData.mOpenInfo.mDisposition.c_str(), 726 (ULONG)mData.mOpenInfo.mDisposition.length() + 1); 727 paParms[i++].setPointer((void*)mData.mOpenInfo.mSharingMode.c_str(), 728 (ULONG)mData.mOpenInfo.mSharingMode.length() + 1); 724 paParms[i++].setString(mData.mOpenInfo.mpszAccessMode); 725 paParms[i++].setString(mData.mOpenInfo.mpszOpenAction); 726 paParms[i++].setString(""); /** @todo sharing mode. */ 729 727 paParms[i++].setUInt32(mData.mOpenInfo.mCreationMode); 730 728 paParms[i++].setUInt64(mData.mOpenInfo.mInitialOffset); … … 1265 1263 } 1266 1264 1265 HRESULT GuestFile::querySize(LONG64 *aSize) 1266 { 1267 #ifndef VBOX_WITH_GUEST_CONTROL 1268 ReturnComNotImplemented(); 1269 #else 1270 ReturnComNotImplemented(); 1271 #endif /* VBOX_WITH_GUEST_CONTROL */ 1272 } 1273 1267 1274 HRESULT GuestFile::read(ULONG aToRead, ULONG aTimeoutMS, std::vector<BYTE> &aData) 1268 1275 { … … 1344 1351 } 1345 1352 1346 HRESULT GuestFile::seek(LONG64 aOffset, FileSeek Type_T aWhence)1353 HRESULT GuestFile::seek(LONG64 aOffset, FileSeekOrigin_T aWhence, LONG64 *aNewOffset) 1347 1354 { 1348 1355 #ifndef VBOX_WITH_GUEST_CONTROL … … 1356 1363 switch (aWhence) 1357 1364 { 1358 case FileSeek Type_Set:1365 case FileSeekOrigin_Set: 1359 1366 eSeekType = GUEST_FILE_SEEKTYPE_BEGIN; 1360 1367 break; 1361 1368 1362 case FileSeek Type_Current:1369 case FileSeekOrigin_Current: 1363 1370 eSeekType = GUEST_FILE_SEEKTYPE_CURRENT; 1371 break; 1372 1373 case FileSeekOrigin_End: 1374 eSeekType = GUEST_FILE_SEEKTYPE_END; 1364 1375 break; 1365 1376 … … 1369 1380 } 1370 1381 1382 uint64_t uNewOffset; 1371 1383 int vrc = i_seekAt(aOffset, eSeekType, 1372 30 * 1000 /* 30s timeout */, NULL /* puOffset */); 1373 if (RT_FAILURE(vrc)) 1384 30 * 1000 /* 30s timeout */, &uNewOffset); 1385 if (RT_SUCCESS(vrc)) 1386 *aNewOffset = RT_MIN(uNewOffset, (uint64_t)INT64_MAX); 1387 else 1374 1388 { 1375 1389 switch (vrc) … … 1388 1402 } 1389 1403 1390 HRESULT GuestFile::setACL(const com::Utf8Str &aAcl) 1404 HRESULT GuestFile::setACL(const com::Utf8Str &aAcl, ULONG aMode) 1405 { 1406 #ifndef VBOX_WITH_GUEST_CONTROL 1407 ReturnComNotImplemented(); 1408 #else 1409 ReturnComNotImplemented(); 1410 #endif /* VBOX_WITH_GUEST_CONTROL */ 1411 } 1412 1413 HRESULT GuestFile::setSize(LONG64 aSize) 1391 1414 { 1392 1415 #ifndef VBOX_WITH_GUEST_CONTROL -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r55614 r55631 574 574 } 575 575 576 HRESULT GuestSession::getCurrentDirectory(com::Utf8Str &aCurrentDirectory) 577 { 578 ReturnComNotImplemented(); 579 } 580 581 HRESULT GuestSession::setCurrentDirectory(const com::Utf8Str &aCurrentDirectory) 582 { 583 ReturnComNotImplemented(); 584 } 585 576 586 HRESULT GuestSession::getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories) 577 587 { … … 1290 1300 ComObjPtr<GuestFile> &pFile, int *pGuestRc) 1291 1301 { 1292 LogFlowThisFunc(("str Path=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, uOffset=%RU64\n",1293 openInfo.mFileName.c_str(), openInfo.m OpenMode.c_str(), openInfo.mDisposition.c_str(),1294 openInfo.m CreationMode, openInfo.mInitialOffset));1302 LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, uOffset=%RU64\n", 1303 openInfo.mFileName.c_str(), openInfo.mAccessMode, openInfo.mpszAccessMode, 1304 openInfo.mOpenAction, openInfo.mpszOpenAction, openInfo.mCreationMode, openInfo.mInitialOffset)); 1295 1305 1296 1306 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1404 1414 } 1405 1415 1406 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc)1416 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc) 1407 1417 { 1408 1418 AssertPtrReturn(pllSize, VERR_INVALID_POINTER); 1409 1419 1410 1420 GuestFsObjData objData; 1411 int vrc = i_fileQueryInfoInternal(strPath, f alse /*fFollowSymlinks*/, objData, pGuestRc);1421 int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc); 1412 1422 if (RT_SUCCESS(vrc)) 1413 1423 *pllSize = objData.mObjectSize; … … 2486 2496 } 2487 2497 2488 HRESULT GuestSession::copyFrom(const com::Utf8Str &aSource, const com::Utf8Str &aDest, 2489 const std::vector<CopyFileFlag_T> &aFlags, 2490 ComPtr<IProgress> &aProgress) 2498 HRESULT GuestSession::fileCopy(const com::Utf8Str &aSource, const com::Utf8Str &aDestination, 2499 const std::vector<FileCopyFlag_T> &aFlags, ComPtr<IProgress> &aProgress) 2500 { 2501 ReturnComNotImplemented(); 2502 } 2503 2504 HRESULT GuestSession::fileCopyFromGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest, 2505 const std::vector<FileCopyFlag_T> &aFlags, 2506 ComPtr<IProgress> &aProgress) 2491 2507 { 2492 2508 #ifndef VBOX_WITH_GUEST_CONTROL … … 2501 2517 return setError(E_INVALIDARG, tr("No destination specified")); 2502 2518 2503 uint32_t fFlags = CopyFileFlag_None;2519 uint32_t fFlags = FileCopyFlag_None; 2504 2520 if (aFlags.size()) 2505 2521 { … … 2507 2523 fFlags |= aFlags[i]; 2508 2524 } 2525 /** @todo r=bird: fend off flags we don't implement here! */ 2509 2526 2510 2527 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2535 2552 } 2536 2553 2537 HRESULT GuestSession:: copyTo(const com::Utf8Str &aSource, const com::Utf8Str &aDest, const std::vector<CopyFileFlag_T> &aFlags,2538 ComPtr<IProgress> &aProgress)2554 HRESULT GuestSession::fileCopyToGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest, 2555 const std::vector<FileCopyFlag_T> &aFlags, ComPtr<IProgress> &aProgress) 2539 2556 { 2540 2557 #ifndef VBOX_WITH_GUEST_CONTROL … … 2549 2566 return setError(E_INVALIDARG, tr("No destination specified")); 2550 2567 2551 uint32_t fFlags = CopyFileFlag_None;2568 uint32_t fFlags = FileCopyFlag_None; 2552 2569 if (aFlags.size()) 2553 2570 { … … 2555 2572 fFlags |= aFlags[i]; 2556 2573 } 2574 /** @todo r=bird: fend off flags we don't implement here! */ 2557 2575 2558 2576 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2586 2604 } 2587 2605 2606 HRESULT GuestSession::directoryCopy(const com::Utf8Str &aSource, const com::Utf8Str &aDestination, 2607 const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress) 2608 { 2609 ReturnComNotImplemented(); 2610 } 2611 2612 HRESULT GuestSession::directoryCopyFromGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDestination, 2613 const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress) 2614 { 2615 ReturnComNotImplemented(); 2616 } 2617 2618 HRESULT GuestSession::directoryCopyToGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDestination, 2619 const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress) 2620 { 2621 ReturnComNotImplemented(); 2622 } 2623 2588 2624 HRESULT GuestSession::directoryCreate(const com::Utf8Str &aPath, ULONG aMode, 2589 2625 const std::vector<DirectoryCreateFlag_T> &aFlags) … … 2677 2713 } 2678 2714 2679 HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL *aExists)2715 HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists) 2680 2716 { 2681 2717 #ifndef VBOX_WITH_GUEST_CONTROL … … 2690 2726 2691 2727 GuestFsObjData objData; int guestRc; 2692 int rc = i_directoryQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc);2728 int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc); 2693 2729 if (RT_SUCCESS(rc)) 2694 2730 *aExists = objData.mType == FsObjType_Directory; 2695 2731 else 2696 2732 { 2733 /** @todo r=bird: Looks like this code raises errors if the directory doesn't 2734 * exist... That's of course not right. */ 2697 2735 switch (rc) 2698 2736 { … … 2773 2811 } 2774 2812 2775 HRESULT GuestSession::directoryQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsObjInfo> &aInfo)2776 {2777 #ifndef VBOX_WITH_GUEST_CONTROL2778 ReturnComNotImplemented();2779 #else2780 LogFlowThisFuncEnter();2781 2782 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))2783 return setError(E_INVALIDARG, tr("No directory to query information for specified"));2784 2785 HRESULT hr = S_OK;2786 2787 GuestFsObjData objData; int guestRc;2788 int vrc = i_directoryQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc);2789 if (RT_SUCCESS(vrc))2790 {2791 if (objData.mType == FsObjType_Directory)2792 {2793 ComObjPtr<GuestFsObjInfo> pFsObjInfo;2794 hr = pFsObjInfo.createObject();2795 if (FAILED(hr)) return hr;2796 2797 vrc = pFsObjInfo->init(objData);2798 if (RT_SUCCESS(vrc))2799 {2800 hr = pFsObjInfo.queryInterfaceTo(aInfo.asOutParam());2801 if (FAILED(hr)) return hr;2802 }2803 }2804 }2805 2806 if (RT_FAILURE(vrc))2807 {2808 switch (vrc)2809 {2810 case VERR_GSTCTL_GUEST_ERROR:2811 hr = GuestProcess::i_setErrorExternal(this, guestRc);2812 break;2813 2814 case VERR_NOT_A_DIRECTORY:2815 hr = setError(VBOX_E_IPRT_ERROR, tr("Element \"%s\" exists but is not a directory"),2816 aPath.c_str());2817 break;2818 2819 default:2820 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory information for \"%s\" failed: %Rrc"),2821 aPath.c_str(), vrc);2822 break;2823 }2824 }2825 2826 return hr;2827 #endif /* VBOX_WITH_GUEST_CONTROL */2828 }2829 2830 2813 HRESULT GuestSession::directoryRemove(const com::Utf8Str &aPath) 2831 2814 { … … 2881 2864 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 2882 2865 return setError(E_INVALIDARG, tr("No directory to remove recursively specified")); 2866 2867 /** @todo r=bird: Must check that the flags matches the hardcoded behavior 2868 * further down!! */ 2883 2869 2884 2870 HRESULT hr = i_isReadyExternal(); … … 2933 2919 2934 2920 return hr; 2935 #endif /* VBOX_WITH_GUEST_CONTROL */2936 }2937 2938 HRESULT GuestSession::directoryRename(const com::Utf8Str &aSource,2939 const com::Utf8Str &aDest,2940 const std::vector<PathRenameFlag_T> &aFlags)2941 {2942 #ifndef VBOX_WITH_GUEST_CONTROL2943 ReturnComNotImplemented();2944 #else2945 LogFlowThisFuncEnter();2946 2947 if (RT_UNLIKELY((aSource.c_str()) == NULL || *(aSource.c_str()) == '\0'))2948 return setError(E_INVALIDARG, tr("No source directory to rename specified"));2949 2950 if (RT_UNLIKELY((aDest.c_str()) == NULL || *(aDest.c_str()) == '\0'))2951 return setError(E_INVALIDARG, tr("No destination directory to rename the source to specified"));2952 2953 HRESULT hr = i_isReadyExternal();2954 if (FAILED(hr))2955 return hr;2956 2957 /* No flags; only remove the directory when empty. */2958 uint32_t uFlags = 0;2959 2960 int guestRc;2961 int vrc = i_pathRenameInternal(aSource, aDest, uFlags, &guestRc);2962 if (RT_FAILURE(vrc))2963 {2964 switch (vrc)2965 {2966 case VERR_NOT_SUPPORTED:2967 hr = setError(VBOX_E_IPRT_ERROR,2968 tr("Handling renaming guest directories not supported by installed Guest Additions"));2969 break;2970 2971 case VERR_GSTCTL_GUEST_ERROR:2972 hr = setError(VBOX_E_IPRT_ERROR,2973 tr("Renaming guest directory failed: %Rrc"), guestRc);2974 break;2975 2976 default:2977 hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),2978 aSource.c_str(), vrc);2979 break;2980 }2981 }2982 2983 return hr;2984 #endif /* VBOX_WITH_GUEST_CONTROL */2985 }2986 2987 HRESULT GuestSession::directorySetACL(const com::Utf8Str &aPath, const com::Utf8Str &aAcl)2988 {2989 #ifndef VBOX_WITH_GUEST_CONTROL2990 ReturnComNotImplemented();2991 #else2992 LogFlowThisFuncEnter();2993 2994 ReturnComNotImplemented();2995 2921 #endif /* VBOX_WITH_GUEST_CONTROL */ 2996 2922 } … … 3138 3064 } 3139 3065 3140 HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL *aExists) 3141 { 3142 #ifndef VBOX_WITH_GUEST_CONTROL 3143 ReturnComNotImplemented(); 3144 #else 3145 LogFlowThisFuncEnter(); 3146 3066 HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists) 3067 { 3068 #ifndef VBOX_WITH_GUEST_CONTROL 3069 ReturnComNotImplemented(); 3070 #else 3071 LogFlowThisFuncEnter(); 3072 3073 /** @todo r=bird: Treat empty file with a FALSE return. */ 3147 3074 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 3148 3075 return setError(E_INVALIDARG, tr("No file to check existence for specified")); 3149 3076 3150 3077 GuestFsObjData objData; int guestRc; 3151 int vrc = i_fileQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc);3078 int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc); 3152 3079 if (RT_SUCCESS(vrc)) 3153 3080 { … … 3164 3091 break; 3165 3092 3093 /** @todo r=bird: what about VERR_PATH_NOT_FOUND and VERR_FILE_NOT_FOUND? 3094 * Where does that get converted to *aExists = FALSE? */ 3166 3095 case VERR_NOT_A_FILE: 3167 3096 *aExists = FALSE; … … 3178 3107 } 3179 3108 3180 HRESULT GuestSession::fileRemove(const com::Utf8Str &aPath) 3181 { 3182 #ifndef VBOX_WITH_GUEST_CONTROL 3183 ReturnComNotImplemented(); 3184 #else 3185 LogFlowThisFuncEnter(); 3186 3187 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 3188 return setError(E_INVALIDARG, tr("No file to remove specified")); 3189 3190 HRESULT hr = S_OK; 3191 3192 int guestRc; 3193 int vrc = i_fileRemoveInternal(aPath, &guestRc); 3194 if (RT_FAILURE(vrc)) 3195 { 3196 switch (vrc) 3197 { 3198 case VERR_GSTCTL_GUEST_ERROR: 3199 hr = GuestProcess::i_setErrorExternal(this, guestRc); 3200 break; 3201 3202 default: 3203 hr = setError(VBOX_E_IPRT_ERROR, tr("Removing file \"%s\" failed: %Rrc"), 3204 aPath.c_str(), vrc); 3205 break; 3206 } 3207 } 3208 3209 return hr; 3210 #endif /* VBOX_WITH_GUEST_CONTROL */ 3211 } 3212 3213 HRESULT GuestSession::fileOpen(const com::Utf8Str &aPath, const com::Utf8Str &aOpenMode, const com::Utf8Str &aDisposition, 3109 HRESULT GuestSession::fileOpen(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 3214 3110 ULONG aCreationMode, ComPtr<IGuestFile> &aFile) 3215 3111 { … … 3218 3114 #else 3219 3115 LogFlowThisFuncEnter(); 3220 3221 Utf8Str strSharingMode = ""; /* Sharing mode is ignored. */ 3222 3223 return fileOpenEx(aPath, aOpenMode, aDisposition, strSharingMode, aCreationMode, 3224 0 /* aOffset */, aFile); 3225 #endif /* VBOX_WITH_GUEST_CONTROL */ 3226 } 3227 3228 HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, const com::Utf8Str &aOpenMode, const com::Utf8Str &aDisposition, 3229 const com::Utf8Str &aSharingMode, ULONG aCreationMode, LONG64 aOffset, 3230 ComPtr<IGuestFile> &aFile) 3231 3116 return fileOpenEx(aPath, aAccessMode, aOpenAction, FileSharingMode_All, aCreationMode, 0 /* aOffset */, aFile); 3117 #endif /* VBOX_WITH_GUEST_CONTROL */ 3118 } 3119 3120 HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction, 3121 FileSharingMode_T aSharingMode, ULONG aCreationMode, LONG64 aOffset, ComPtr<IGuestFile> &aFile) 3232 3122 { 3233 3123 #ifndef VBOX_WITH_GUEST_CONTROL … … 3238 3128 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 3239 3129 return setError(E_INVALIDARG, tr("No file to open specified")); 3240 if (RT_UNLIKELY((aOpenMode.c_str()) == NULL || *(aOpenMode.c_str()) == '\0'))3241 return setError(E_INVALIDARG, tr("No open mode specified"));3242 if (RT_UNLIKELY((aDisposition.c_str()) == NULL || *(aDisposition.c_str()) == '\0'))3243 return setError(E_INVALIDARG, tr("No disposition mode specified"));3244 /* aSharingMode is optional. */3245 3130 3246 3131 HRESULT hr = i_isReadyExternal(); … … 3248 3133 return hr; 3249 3134 3250 /** @todo Validate creation mode. */3251 uint32_t uCreationMode = 0;3252 3253 3135 GuestFileOpenInfo openInfo; 3254 3136 openInfo.mFileName = aPath; 3255 openInfo.mOpenMode = aOpenMode;3256 openInfo.mDisposition = aDisposition;3257 openInfo.mSharingMode = aSharingMode;3258 3137 openInfo.mCreationMode = aCreationMode; 3259 3138 openInfo.mInitialOffset = aOffset; 3260 3139 3261 uint64_t uFlagsIgnored; 3262 int vrc = RTFileModeToFlagsEx(openInfo.mOpenMode.c_str(), 3263 openInfo.mDisposition.c_str(), 3264 openInfo.mSharingMode.c_str(), 3265 &uFlagsIgnored); 3266 if (RT_FAILURE(vrc)) 3267 return setError(E_INVALIDARG, tr("Invalid open mode / disposition / sharing mode specified")); 3268 3269 ComObjPtr <GuestFile> pFile; int guestRc; 3270 vrc = i_fileOpenInternal(openInfo, pFile, &guestRc); 3140 /* convert + validate aAccessMode to the old format. */ 3141 openInfo.mAccessMode = aAccessMode; 3142 switch (aAccessMode) 3143 { 3144 case (FileAccessMode_T)FileAccessMode_ReadOnly: openInfo.mpszAccessMode = "r"; break; 3145 case (FileAccessMode_T)FileAccessMode_WriteOnly: openInfo.mpszAccessMode = "w"; break; 3146 case (FileAccessMode_T)FileAccessMode_ReadWrite: openInfo.mpszAccessMode = "r+"; break; 3147 case (FileAccessMode_T)FileAccessMode_AppendOnly: 3148 /* fall thru */ 3149 case (FileAccessMode_T)FileAccessMode_AppendRead: 3150 return setError(E_NOTIMPL, tr("Append access modes are not yet implemented")); 3151 default: 3152 return setError(E_INVALIDARG, tr("Unknown FileAccessMode value %u (%#x)"), aAccessMode, aAccessMode); 3153 } 3154 3155 /* convert + validate aOpenAction to the old format. */ 3156 openInfo.mOpenAction = aOpenAction; 3157 switch (aOpenAction) 3158 { 3159 case (FileOpenAction_T)FileOpenAction_OpenExisting: openInfo.mpszOpenAction = "oe"; break; 3160 case (FileOpenAction_T)FileOpenAction_OpenOrCreate: openInfo.mpszOpenAction = "oc"; break; 3161 case (FileOpenAction_T)FileOpenAction_CreateNew: openInfo.mpszOpenAction = "ce"; break; 3162 case (FileOpenAction_T)FileOpenAction_CreateOrReplace: openInfo.mpszOpenAction = "ca"; break; 3163 case (FileOpenAction_T)FileOpenAction_OpenExistingTruncated: openInfo.mpszOpenAction = "ot"; break; 3164 case (FileOpenAction_T)FileOpenAction_AppendOrCreate: 3165 openInfo.mpszOpenAction = "ca"; /** @todo get rid of this one and implement AppendOnly/AppendRead. */ 3166 break; 3167 default: 3168 return setError(E_INVALIDARG, tr("Unknown FileOpenAction value %u (%#x)"), aAccessMode, aAccessMode); 3169 } 3170 3171 /* validate aSharingMode */ 3172 openInfo.mSharingMode = aSharingMode; 3173 switch (aSharingMode) 3174 { 3175 case (FileSharingMode_T)FileSharingMode_All: /* OK */ break; 3176 case (FileSharingMode_T)FileSharingMode_Read: 3177 case (FileSharingMode_T)FileSharingMode_Write: 3178 case (FileSharingMode_T)FileSharingMode_ReadWrite: 3179 case (FileSharingMode_T)FileSharingMode_Delete: 3180 case (FileSharingMode_T)FileSharingMode_ReadDelete: 3181 case (FileSharingMode_T)FileSharingMode_WriteDelete: 3182 return setError(E_NOTIMPL, tr("Only FileSharingMode_All is currently implemented")); 3183 3184 default: 3185 return setError(E_INVALIDARG, tr("Unknown FileOpenAction value %u (%#x)"), aAccessMode, aAccessMode); 3186 } 3187 3188 ComObjPtr <GuestFile> pFile; 3189 int guestRc; 3190 int vrc = i_fileOpenInternal(openInfo, pFile, &guestRc); 3271 3191 if (RT_SUCCESS(vrc)) 3272 3192 /* Return directory object to the caller. */ … … 3296 3216 } 3297 3217 3298 HRESULT GuestSession::fileQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsObjInfo> &aInfo) 3299 3300 { 3301 #ifndef VBOX_WITH_GUEST_CONTROL 3302 ReturnComNotImplemented(); 3303 #else 3304 LogFlowThisFuncEnter(); 3305 3306 if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0')) 3307 return setError(E_INVALIDARG, tr("No file to query information for specified")); 3308 3309 HRESULT hr = S_OK; 3310 3311 GuestFsObjData objData; int guestRc; 3312 int vrc = i_fileQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc); 3313 if (RT_SUCCESS(vrc)) 3314 { 3315 ComObjPtr<GuestFsObjInfo> pFsObjInfo; 3316 hr = pFsObjInfo.createObject(); 3317 if (FAILED(hr)) return hr; 3318 3319 vrc = pFsObjInfo->init(objData); 3320 if (RT_SUCCESS(vrc)) 3321 { 3322 hr = pFsObjInfo.queryInterfaceTo(aInfo.asOutParam()); 3323 if (FAILED(hr)) return hr; 3324 } 3325 } 3326 3327 if (RT_FAILURE(vrc)) 3328 { 3329 switch (vrc) 3330 { 3331 case VERR_GSTCTL_GUEST_ERROR: 3332 hr = GuestProcess::i_setErrorExternal(this, guestRc); 3333 break; 3334 3335 case VERR_NOT_A_FILE: 3336 hr = setError(VBOX_E_IPRT_ERROR, tr("Element exists but is not a file")); 3337 break; 3338 3339 default: 3340 hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file information failed: %Rrc"), vrc); 3341 break; 3342 } 3343 } 3344 3345 return hr; 3346 #endif /* VBOX_WITH_GUEST_CONTROL */ 3347 } 3348 3349 HRESULT GuestSession::fileQuerySize(const com::Utf8Str &aPath, LONG64 *aSize) 3218 HRESULT GuestSession::fileQuerySize(const com::Utf8Str &aPath, BOOL aFollowSymlinks, LONG64 *aSize) 3350 3219 { 3351 3220 #ifndef VBOX_WITH_GUEST_CONTROL … … 3360 3229 3361 3230 int64_t llSize; int guestRc; 3362 int vrc = i_fileQuerySizeInternal(aPath, &llSize, &guestRc);3231 int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE, &llSize, &guestRc); 3363 3232 if (RT_SUCCESS(vrc)) 3364 3233 *aSize = llSize; … … 3381 3250 } 3382 3251 3383 HRESULT GuestSession::fileRename(const com::Utf8Str &aSource, const com::Utf8Str &aDest, 3384 const std::vector<PathRenameFlag_T> &aFlags) 3385 { 3386 #ifndef VBOX_WITH_GUEST_CONTROL 3387 ReturnComNotImplemented(); 3388 #else 3389 LogFlowThisFuncEnter(); 3390 3391 if (RT_UNLIKELY((aSource.c_str()) == NULL || *(aSource.c_str()) == '\0')) 3392 return setError(E_INVALIDARG, tr("No source file to rename specified")); 3393 3394 if (RT_UNLIKELY((aDest.c_str()) == NULL || *(aDest.c_str()) == '\0')) 3395 return setError(E_INVALIDARG, tr("No destination file to rename the source to specified")); 3396 3397 HRESULT hr = i_isReadyExternal(); 3398 if (FAILED(hr)) 3399 return hr; 3400 3401 /* No flags; only remove the directory when empty. */ 3402 uint32_t uFlags = 0; 3403 3404 int guestRc; 3405 int vrc = i_pathRenameInternal(aSource, aDest, uFlags, &guestRc); 3406 if (RT_FAILURE(vrc)) 3407 { 3408 switch (vrc) 3409 { 3410 case VERR_NOT_SUPPORTED: 3411 hr = setError(VBOX_E_IPRT_ERROR, 3412 tr("Handling renaming guest files not supported by installed Guest Additions")); 3413 break; 3414 3415 case VERR_GSTCTL_GUEST_ERROR: 3416 /** @todo Proper guestRc to text translation needed. */ 3417 hr = setError(VBOX_E_IPRT_ERROR, 3418 tr("Renaming guest file failed: %Rrc"), guestRc); 3419 break; 3420 3421 default: 3422 hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest file \"%s\" failed: %Rrc"), 3423 aSource.c_str(), vrc); 3424 break; 3425 } 3426 } 3427 3428 return hr; 3429 #endif /* VBOX_WITH_GUEST_CONTROL */ 3430 } 3431 3432 HRESULT GuestSession::fileSetACL(const com::Utf8Str &aFile, const com::Utf8Str &aAcl) 3433 { 3434 #ifndef VBOX_WITH_GUEST_CONTROL 3435 ReturnComNotImplemented(); 3436 #else 3437 LogFlowThisFuncEnter(); 3438 3439 ReturnComNotImplemented(); 3440 #endif /* VBOX_WITH_GUEST_CONTROL */ 3441 } 3442 3443 HRESULT GuestSession::fsExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists) 3252 HRESULT GuestSession::fsObjExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists) 3444 3253 { 3445 3254 #ifndef VBOX_WITH_GUEST_CONTROL … … 3474 3283 } 3475 3284 3476 HRESULT GuestSession::fs QueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo)3285 HRESULT GuestSession::fsObjQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo) 3477 3286 { 3478 3287 #ifndef VBOX_WITH_GUEST_CONTROL … … 3511 3320 #endif /* VBOX_WITH_GUEST_CONTROL */ 3512 3321 } 3322 3323 HRESULT GuestSession::fsObjRemove(const com::Utf8Str &aPath) 3324 { 3325 #ifndef VBOX_WITH_GUEST_CONTROL 3326 ReturnComNotImplemented(); 3327 #else 3328 LogFlowThisFuncEnter(); 3329 3330 if (RT_UNLIKELY(aPath.isEmpty())) 3331 return setError(E_INVALIDARG, tr("Empty path specified")); 3332 3333 HRESULT hr = S_OK; 3334 3335 int guestRc; 3336 int vrc = i_fileRemoveInternal(aPath, &guestRc); 3337 if (RT_FAILURE(vrc)) 3338 { 3339 switch (vrc) 3340 { 3341 case VERR_GSTCTL_GUEST_ERROR: 3342 hr = GuestProcess::i_setErrorExternal(this, guestRc); 3343 break; 3344 3345 default: 3346 hr = setError(VBOX_E_IPRT_ERROR, tr("Removing file \"%s\" failed: %Rrc"), 3347 aPath.c_str(), vrc); 3348 break; 3349 } 3350 } 3351 3352 return hr; 3353 #endif /* VBOX_WITH_GUEST_CONTROL */ 3354 } 3355 3356 HRESULT GuestSession::fsObjRename(const com::Utf8Str &aSource, 3357 const com::Utf8Str &aDestination, 3358 const std::vector<FsObjRenameFlag_T> &aFlags) 3359 { 3360 #ifndef VBOX_WITH_GUEST_CONTROL 3361 ReturnComNotImplemented(); 3362 #else 3363 LogFlowThisFuncEnter(); 3364 3365 if (RT_UNLIKELY(aSource.isEmpty())) 3366 return setError(E_INVALIDARG, tr("No source path specified")); 3367 3368 if (RT_UNLIKELY(aDestination.isEmpty())) 3369 return setError(E_INVALIDARG, tr("No destination path specified")); 3370 3371 HRESULT hr = i_isReadyExternal(); 3372 if (FAILED(hr)) 3373 return hr; 3374 3375 /* Combine, validate and convert flags. */ 3376 uint32_t fApiFlags = 0; 3377 for (size_t i = 0; i < aFlags.size(); i++) 3378 fApiFlags |= aFlags[i]; 3379 if (fApiFlags & ~((uint32_t)FsObjRenameFlag_NoReplace | (uint32_t)FsObjRenameFlag_Replace)) 3380 return setError(E_INVALIDARG, tr("Unknown rename flag: %#x"), fApiFlags); 3381 3382 AssertCompile(FsObjRenameFlag_NoReplace == 0); 3383 AssertCompile(FsObjRenameFlag_Replace != 0); 3384 uint32_t fBackend; 3385 if ((fApiFlags & ((uint32_t)FsObjRenameFlag_NoReplace | (uint32_t)FsObjRenameFlag_Replace)) == FsObjRenameFlag_Replace) 3386 fBackend = PATHRENAME_FLAG_REPLACE; 3387 else 3388 fBackend = PATHRENAME_FLAG_NO_REPLACE; 3389 3390 /* Call worker to do the job. */ 3391 int guestRc; 3392 int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, &guestRc); 3393 if (RT_FAILURE(vrc)) 3394 { 3395 switch (vrc) 3396 { 3397 case VERR_NOT_SUPPORTED: 3398 hr = setError(VBOX_E_IPRT_ERROR, 3399 tr("Handling renaming guest directories not supported by installed Guest Additions")); 3400 break; 3401 3402 case VERR_GSTCTL_GUEST_ERROR: 3403 hr = setError(VBOX_E_IPRT_ERROR, 3404 tr("Renaming guest directory failed: %Rrc"), guestRc); 3405 break; 3406 3407 default: 3408 hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"), 3409 aSource.c_str(), vrc); 3410 break; 3411 } 3412 } 3413 3414 return hr; 3415 #endif /* VBOX_WITH_GUEST_CONTROL */ 3416 } 3417 3418 HRESULT GuestSession::fsObjMove(const com::Utf8Str &aSource, const com::Utf8Str &aDestination, 3419 const std::vector<FsObjMoveFlags_T> &aFlags, ComPtr<IProgress> &aProgress) 3420 { 3421 ReturnComNotImplemented(); 3422 } 3423 3424 HRESULT GuestSession::fsObjSetACL(const com::Utf8Str &aPath, BOOL aFollowSymlinks, const com::Utf8Str &aAcl, ULONG aMode) 3425 { 3426 ReturnComNotImplemented(); 3427 } 3428 3513 3429 3514 3430 HRESULT GuestSession::processCreate(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments, … … 3704 3620 } 3705 3621 3706 HRESULT GuestSession::symlinkRemoveDirectory(const com::Utf8Str &aPath)3707 {3708 #ifndef VBOX_WITH_GUEST_CONTROL3709 ReturnComNotImplemented();3710 #else3711 LogFlowThisFuncEnter();3712 3713 ReturnComNotImplemented();3714 #endif /* VBOX_WITH_GUEST_CONTROL */3715 }3716 3717 HRESULT GuestSession::symlinkRemoveFile(const com::Utf8Str &aFile)3718 {3719 #ifndef VBOX_WITH_GUEST_CONTROL3720 ReturnComNotImplemented();3721 #else3722 LogFlowThisFuncEnter();3723 3724 ReturnComNotImplemented();3725 #endif /* VBOX_WITH_GUEST_CONTROL */3726 }3727 3728 3622 HRESULT GuestSession::waitFor(ULONG aWaitFor, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason) 3729 3623 { -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r55613 r55631 937 937 SessionTaskCopyTo *pTask = new SessionTaskCopyTo(pSession /* GuestSession */, 938 938 &pISO->file, cbOffset, cbSize, 939 strFileDest, CopyFileFlag_None);939 strFileDest, FileCopyFlag_None); 940 940 AssertPtrReturn(pTask, VERR_NO_MEMORY); 941 941 … … 973 973 GuestFsObjData objData; 974 974 int64_t cbSizeOnGuest; int guestRc; 975 rc = pSession->i_fileQuerySizeInternal(strFileDest, &cbSizeOnGuest, &guestRc);975 rc = pSession->i_fileQuerySizeInternal(strFileDest, false /*fFollowSymlinks*/, &cbSizeOnGuest, &guestRc); 976 976 if ( RT_SUCCESS(rc) 977 977 && cbSize == (uint64_t)cbSizeOnGuest)
Note:
See TracChangeset
for help on using the changeset viewer.