VirtualBox

Changeset 55631 in vbox for trunk/src


Ignore:
Timestamp:
May 4, 2015 4:08:10 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100004
Message:

IGuestSession:

  • Added pathStyle attribute and associated enum.
  • Added a currentDirectory attribute (stub).
  • Introduced fsObjExists (earlier fsExists) which works on all fs obj types.
  • Combined directoryQueryInfo and fileQueryInfo into fsObjQueryInfo (earlier fsQueryInfo) which works on all fs obj types. Caller can check the type attribute.
  • Combined fileRemove and symlinkRemove* into fsObjRemove both on suggestion from Michael and because it's impossible to implement correctly with introducing races. Besides, our implementation was already doing the fsObjRemove job, no type checks.
  • Combined directoryRename, fileRename and symlinkRename into fsObjRename since we cannot implement type specific renames without introducing races on all platforms, and again, the current implementation already does the whole shebang.
  • Combined directorySetACL and fileSetACL into fsObjSetACL, adding a UNIX-style mode parameter for use when the ACL string is empty.
  • Stubbed the recursive directory copy methods directoryCopy, directoryCopyToGuest, and directoryCopyFromGuest. These replaces the proposed FileCopyFlag::Recursive flag.
  • Stubbed a generic move-anything-inside-the-guest method, fsObjMove, for future explotations. (Considered this on file/dir level, but it's the rename and type race problem. So, did the 'mv' approach instead.)
  • Renamed CopyFileFlag to FileCopyFlag.
  • Prefixed copyTo and copyFrom with 'file' and added 'Guest' postfix to clarify the direction (now: fileCopyToGuest, fileCopyFromGuest).
  • Added fileCopy method for copy a guest file to another guest location.
  • directoryExists got a followSymlinks parameter.
  • fileExist and fileQuerySize all got a followSymlinks parameter.
  • Retired directoryRename in favor of fsObjRename.
  • Retired directorySetACL in favor of fsObjSetACL.
  • Retired fileSetACL in favor of fsObjSetACL.
  • Retired fileRemove in favor of fsObjRemove - fileRemove was already removing everything except directories, no need for ambiguous duplications.
  • Retired symlinkRemoveDirectory and symlinkRemoveFile in favor of fsObjRemove.
  • replaced the openMode string parameter int fileOpen[Ex] methods with an enum FileAccessMode (we made some wrong design choices way back).
  • replaced the disposition string parameter in fileOpen[Ex] methods with an enum FileOpenAction. This one was more obvious, should've seen this way back.
  • replaced the sharingMode stirng parameter in the fileOpenEx method with an enum FileSharingMode.
  • Documented directoryRemoveRecursive flags issue.


IFile,IGuestFile:

  • Stubbed querySize
  • Stubbed setSize.
  • Renamed FileSeekType to FileSeekOrigin.
  • Implemented seek() relative to end, flag was forgotten.
  • Made seek() return the new offset.
  • Extended setACL with a UNIX-style file mode argument that should be used if the ACL string is empty (this way we can actually get something implemented without 2 months of cross platform ACL research).
  • The openMode and disposition attributes has been updated to match the fileOpenEx enum changes.
Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r55609 r55631  
    17221722
    17231723
     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. */
     1728enum gctlCopyFlags
     1729{
     1730    kGctlCopyFlags_None         = 0,
     1731    kGctlCopyFlags_Recursive    = RT_BIT(1),
     1732    kGctlCopyFlags_FollowLinks  = RT_BIT(2)
     1733};
     1734
     1735
    17241736/**
    17251737 * Creates a copy context structure which then can be used with various
     
    19771989    {
    19781990        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
    19811995            vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
    1982         else
    1983             *fExists = fDirExists ? true : false;
    19841996    }
    19851997    else
     
    20442056    {
    20452057        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
    20482062            vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
    2049         else
    2050             *fExists = fFileExists ? true : false;
    20512063    }
    20522064    else
     
    20962108 * @param   pszFileSource           Source file to copy to the destination.
    20972109 * @param   pszFileDest             Name of copied file on the destination.
    2098  * @param   fFlags                  Copy flags. No supported at the moment and needs
    2099  *                                  to be set to 0.
     2110 * @param   enmFlags                Copy flags. No supported at the moment and
     2111 *                                  needs to be set to 0.
    21002112 */
    21012113static int gctlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource,
    2102                               const char *pszFileDest, uint32_t fFlags)
     2114                              const char *pszFileDest, gctlCopyFlags enmFlags)
    21032115{
    21042116    AssertPtrReturn(pContext, VERR_INVALID_POINTER);
    21052117    AssertPtrReturn(pszFileSource, VERR_INVALID_POINTER);
    21062118    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. */
    21082120
    21092121    if (pContext->pCmdCtx->cVerbose > 1)
     
    21192131    if (pContext->fHostToGuest)
    21202132    {
    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());
    21252137    }
    21262138    else
    21272139    {
    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());
    21322144    }
    21332145
     
    21582170 * @param   pszFilter               DOS-style wildcard filter (?, *).  Optional.
    21592171 * @param   pszDest                 Destination directory on the guest.
    2160  * @param   fFlags                  Copy flags, such as recursive copying.
     2172 * @param   enmFlags                Copy flags, such as recursive copying.
    21612173 * @param   pszSubDir               Current sub directory to handle. Needs to NULL and only
    21622174 *                                  is needed for recursion.
     
    21642176static int gctlCopyDirToGuest(PCOPYCONTEXT pContext,
    21652177                              const char *pszSource, const char *pszFilter,
    2166                               const char *pszDest, uint32_t fFlags,
     2178                              const char *pszDest, enum gctlCopyFlags enmFlags,
    21672179                              const char *pszSubDir /* For recursion. */)
    21682180{
     
    22292241                        RTPrintf("Directory: %s\n", DirEntry.szName);
    22302242
    2231                     if (fFlags & CopyFileFlag_Recursive)
     2243                    if (enmFlags & kGctlCopyFlags_Recursive)
    22322244                    {
    22332245                        char *pszNewSub = NULL;
     
    22442256                            vrc = gctlCopyDirToGuest(pContext,
    22452257                                                     pszSource, pszFilter,
    2246                                                      pszDest, fFlags, pszNewSub);
     2258                                                     pszDest, enmFlags, pszNewSub);
    22472259                            RTStrFree(pszNewSub);
    22482260                        }
     
    22542266
    22552267                case RTDIRENTRYTYPE_SYMLINK:
    2256                     if (   (fFlags & CopyFileFlag_Recursive)
    2257                         && (fFlags & CopyFileFlag_FollowLinks))
     2268                    if (   (enmFlags & kGctlCopyFlags_Recursive)
     2269                        && (enmFlags & kGctlCopyFlags_FollowLinks))
    22582270                    {
    22592271                        /* Fall through to next case is intentional. */
     
    22982310                            {
    22992311                                vrc = gctlCopyFileToDest(pContext, pszFileSource,
    2300                                                         pszFileDest, 0 /* Flags */);
     2312                                                         pszFileDest, kGctlCopyFlags_None);
    23012313                                RTStrFree(pszFileDest);
    23022314                            }
     
    23272339 * @param   pszFilter               DOS-style wildcard filter (?, *).  Optional.
    23282340 * @param   pszDest                 Destination directory on the host.
    2329  * @param   fFlags                  Copy flags, such as recursive copying.
     2341 * @param   enmFlags                Copy flags, such as recursive copying.
    23302342 * @param   pszSubDir               Current sub directory to handle. Needs to NULL and only
    23312343 *                                  is needed for recursion.
     
    23332345static int gctlCopyDirToHost(PCOPYCONTEXT pContext,
    23342346                             const char *pszSource, const char *pszFilter,
    2335                              const char *pszDest, uint32_t fFlags,
     2347                             const char *pszDest, gctlCopyFlags enmFlags,
    23362348                             const char *pszSubDir /* For recursion. */)
    23372349{
     
    23962408                }
    23972409
    2398                 if (fFlags & CopyFileFlag_Recursive)
     2410                if (enmFlags & kGctlCopyFlags_Recursive)
    23992411                {
    24002412                    Utf8Str strDir(strName);
     
    24112423                        vrc = gctlCopyDirToHost(pContext,
    24122424                                                pszSource, pszFilter,
    2413                                                 pszDest, fFlags, pszNewSub);
     2425                                                pszDest, enmFlags, pszNewSub);
    24142426                        RTStrFree(pszNewSub);
    24152427                    }
     
    24212433
    24222434            case FsObjType_Symlink:
    2423                 if (   (fFlags & CopyFileFlag_Recursive)
    2424                     && (fFlags & CopyFileFlag_FollowLinks))
     2435                if (   (enmFlags & kGctlCopyFlags_Recursive)
     2436                    && (enmFlags & kGctlCopyFlags_FollowLinks))
    24252437                {
    24262438                    /* Fall through to next case is intentional. */
     
    24682480                        {
    24692481                            vrc = gctlCopyFileToDest(pContext, pszFileSource,
    2470                                                     pszFileDest, 0 /* Flags */);
     2482                                                     pszFileDest, kGctlCopyFlags_None);
    24712483                            RTStrFree(pszFileDest);
    24722484                        }
     
    25332545 * @param   pszDest                 Destination directory where to copy in the source
    25342546 *                                  source directory.
    2535  * @param   fFlags                  Copy flags, such as recursive copying.
     2547 * @param   enmFlags                Copy flags, such as recursive copying.
    25362548 */
    25372549static int gctlCopyDirToDest(PCOPYCONTEXT pContext,
    25382550                             const char *pszSource, const char *pszFilter,
    2539                              const char *pszDest, uint32_t fFlags)
     2551                             const char *pszDest, enum gctlCopyFlags enmFlags)
    25402552{
    25412553    if (pContext->fHostToGuest)
    25422554        return gctlCopyDirToGuest(pContext, pszSource, pszFilter,
    2543                                   pszDest, fFlags, NULL /* Sub directory, only for recursion. */);
     2555                                  pszDest, enmFlags, NULL /* Sub directory, only for recursion. */);
    25442556    return gctlCopyDirToHost(pContext, pszSource, pszFilter,
    2545                              pszDest, fFlags, NULL /* Sub directory, only for recursion. */);
     2557                             pszDest, enmFlags, NULL /* Sub directory, only for recursion. */);
    25462558}
    25472559
     
    26432655    Utf8Str strSource;
    26442656    const char *pszDst = NULL;
    2645     uint32_t fFlags = CopyFileFlag_None;
     2657    enum gctlCopyFlags enmFlags = kGctlCopyFlags_None;
    26462658    bool fCopyRecursive = false;
    26472659    bool fDryRun = false;
     
    26632675
    26642676            case GETOPTDEF_COPY_FOLLOW:
    2665                 fFlags |= CopyFileFlag_FollowLinks;
     2677                enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_FollowLinks);
    26662678                break;
    26672679
    26682680            case 'R': /* Recursive processing */
    2669                 fFlags |= CopyFileFlag_Recursive;
     2681                enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_Recursive);
    26702682                break;
    26712683
     
    28272839                    if (RT_SUCCESS(vrc))
    28282840                    {
    2829                         vrc = gctlCopyFileToDest(pContext, pszSource, pszDstFile, 0 /* Flags */);
     2841                        vrc = gctlCopyFileToDest(pContext, pszSource, pszDstFile, kGctlCopyFlags_None);
    28302842                        RTStrFree(pszDstFile);
    28312843                    }
     
    28362848                {
    28372849                    /* Directory (with filter?). */
    2838                     vrc = gctlCopyDirToDest(pContext, pszSource, pszFilter, pszDst, fFlags);
     2850                    vrc = gctlCopyDirToDest(pContext, pszSource, pszFilter, pszDst, enmFlags);
    28392851                }
    28402852            }
     
    31383150                try
    31393151                {
    3140                     /** @todo How does IGuestSession::FileRemove work with read-only files? Do we
     3152                    /** @todo How does IGuestSession::FsObjRemove work with read-only files? Do we
    31413153                     *        need to do some chmod or whatever to better emulate the --force flag? */
    31423154                    HRESULT rc;
    3143                     CHECK_ERROR(pCtx->pGuestSession, FileRemove(Bstr(ValueUnion.psz).raw()));
     3155                    CHECK_ERROR(pCtx->pGuestSession, FsObjRemove(Bstr(ValueUnion.psz).raw()));
    31443156                    if (FAILED(rc) && !fForce)
    31453157                        return RTEXITCODE_FAILURE;
     
    31803192    std::vector< Utf8Str > vecSources;
    31813193    const char *pszDst = NULL;
    3182     com::SafeArray<PathRenameFlag_T> aRenameFlags;
     3194    com::SafeArray<FsObjRenameFlag_T> aRenameFlags;
    31833195
    31843196    try
    31853197    {
    31863198        /** @todo Make flags configurable. */
    3187         aRenameFlags.push_back(PathRenameFlag_NoReplace);
     3199        aRenameFlags.push_back(FsObjRenameFlag_NoReplace);
    31883200
    31893201        while (   (ch = RTGetOpt(&GetState, &ValueUnion))
     
    32363248    if (cSources > 1)
    32373249    {
    3238         ComPtr<IGuestFsObjInfo> pFsObjInfo;
    3239         rc = pCtx->pGuestSession->DirectoryQueryInfo(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)
    32413253            return RTMsgErrorExit(RTEXITCODE_FAILURE, "Destination must be a directory when specifying multiple sources\n");
    32423254    }
     
    32523264           && !g_fGuestCtrlCanceled)
    32533265    {
    3254         bool fSourceIsDirectory = false;
    32553266        Utf8Str strCurSource = (*it);
    32563267
    3257         /** @todo Slooooow, but works for now. */
    3258         /** @todo r=bird: Need an interface for querying info on a file system
    3259          *        object, not just files or directories exclusively.  You also may
    3260          *        want to take symbolic links into account somewhere along the line,
    3261          *        though preferrably on the guest end of things... */
    32623268        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);
    32693273        if (FAILED(rc))
    32703274        {
     
    32783282        if (pCtx->cVerbose > 1)
    32793283            RTPrintf("Renaming %s \"%s\" to \"%s\" ...\n",
    3280                      fSourceIsDirectory ? "directory" : "file",
     3284                     enmObjType == FsObjType_Directory ? "directory" : "file",
    32813285                     strCurSource.c_str(), pszDst);
    32823286
    32833287        if (!fDryrun)
    32843288        {
    3285             if (fSourceIsDirectory)
    3286             {
    3287                 CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryRename(Bstr(strCurSource).raw(),
    3288                                                                        Bstr(pszDst).raw(),
    3289                                                                        ComSafeArrayAsInParam(aRenameFlags)));
     3289            if (enmObjType == FsObjType_Directory)
     3290            {
     3291                CHECK_ERROR_BREAK(pCtx->pGuestSession, FsObjRename(Bstr(strCurSource).raw(),
     3292                                                                   Bstr(pszDst).raw(),
     3293                                                                   ComSafeArrayAsInParam(aRenameFlags)));
    32903294
    32913295                /* Break here, since it makes no sense to rename mroe than one source to
     
    33003304            }
    33013305            else
    3302                 CHECK_ERROR_BREAK(pCtx->pGuestSession, FileRename(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)));
    33053309        }
    33063310
     
    34983502
    34993503        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());
    35043505        if (FAILED(rc))
    35053506        {
     
    35143515        {
    35153516            FsObjType_T objType;
    3516             pFsObjInfo->COMGETTER(Type)(&objType);
     3517            pFsObjInfo->COMGETTER(Type)(&objType); /** @todo What about error checking? */
    35173518            switch (objType)
    35183519            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55629 r55631  
    99809980
    99819981  <enum
    9982     name="FileSeekType"
    9983     uuid="1b73f4f3-3515-4073-a506-76878d9e2541"
     9982    name="FileSeekOrigin"
     9983    uuid="939ba94f-497a-4119-ebd3-d193e176c98e"
    99849984    >
    99859985    <desc>
    9986       File seeking types.
     9986      What a file seek (<link to="IFile::seek"/>) is relative to.
    99879987    </desc>
    99889988
     
    99929992    <const name="Current"               value="1">
    99939993      <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>
    99949998    </const>
    99959999  </enum>
     
    1011510119
    1011610120  <enum
    10117     name="CopyFileFlag"
    10118     uuid="23f79fdf-738a-493d-b80b-42d607c9b916"
     10121    name="FileCopyFlag"
     10122    uuid="791909d7-4c64-2fa4-4303-adb10658d347"
    1011910123    >
    1012010124    <desc>
    1012110125      File copying flags.
     10126      <note>Not flags are implemented yet.</note>
    1012210127    </desc>
    1012310128    <const name="None"                  value="0">
    1012410129      <desc>No flag set.</desc>
    1012510130    </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>
    1013710182    </const>
    1013810183  </enum>
     
    1015410199
    1015510200  <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
    1015610218    name="DirectoryRemoveRecFlag"
    1015710219    uuid="455aabf0-7692-48f6-9061-f21579b65769"
     
    1015910221    <desc>
    1016010222      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>
    1016110228    </desc>
    1016210229
     
    1017310240
    1017410241  <enum
    10175     name="PathRenameFlag"
    10176     uuid="f3baa09f-c758-453d-b91c-c7787d76351d"
     10242    name="FsObjRenameFlag"
     10243    uuid="59bbf3a1-4e23-d7cf-05d5-ccae32080ed2"
    1017710244    >
    1017810245    <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>
    1019310256    </const>
    1019410257  </enum>
     
    1026610329    >
    1026710330    <desc>
    10268       Symbolic link types.
     10331      Symbolic link types.  This is significant when creating links on the
     10332      Windows platform, ignored elsewhere.
    1026910333    </desc>
    1027010334
     
    1027610340    </const>
    1027710341    <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>
    1027910343    </const>
    1028010344  </enum>
     
    1038710451        aren't active yet.
    1038810452      </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>
    1038910557    </const>
    1039010558  </enum>
     
    1049710665      <desc>Don't allow symbolic links as part of the path.</desc>
    1049810666    </const>
     10667<!-- r=bird: need a "NoFollowSymlinks" value here.  IPRT probably needs that too. -->
    1049910668  </enum>
    1050010669
     
    1079910968  <interface
    1080010969    name="IGuestSession" extends="$unknown"
    10801     uuid="c003c35e-4dc4-4111-4771-51befc3c1d30"
     10970    uuid="91306653-4e3a-88cb-a809-85ae64ceb4fd"
    1080210971    wsmap="managed"
    1080310972    >
     
    1086611035        Returns the session timeout (in ms).
    1086711036        <result name="E_NOTIMPL">
    10868           The method is not implemented yet.
     11037          This attribute is not implemented yet.
    1086911038        </result>
    1087011039      </desc>
     
    1091811087      </desc>
    1091911088    </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>
    1092011097    <attribute name="directories" type="IGuestDirectory" readonly="yes" safearray="yes">
    1092111098      <desc>
     
    1094311120    </method>
    1094411121
    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.
    1095111130        </result>
    1095211131      </desc>
    1095311132      <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>
    1096111142      </param>
    1096211143      <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.
    1097311154        </result>
    1097411155      </desc>
    1097511156      <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>
    1098311167      </param>
    1098411168      <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>
    1098611195      </param>
    1098711196    </method>
     
    1098911198    <method name="directoryCreate">
    1099011199      <desc>
    10991         Create a directory in the guest.
     11200        Creates a directory in the guest.
    1099211201
    1099311202        <result name="VBOX_E_IPRT_ERROR">
     
    1099611205      </desc>
    1099711206      <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>
    1099911208      </param>
    1100011209      <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>
    1100211216      </param>
    1100311217      <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>
    1100511219      </param>
    1100611220    </method>
     
    1100811222    <method name="directoryCreateTemp">
    1100911223      <desc>
    11010         Create a temporary directory in the guest.
     11224        Creates a temporary directory in the guest.
    1101111225
    1101211226        <result name="VBOX_E_NOT_SUPPORTED">
     
    1103111245      </param>
    1103211246      <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>
    1103611256      </param>
    1103711257      <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>
    1103911260      </param>
    1104011261      <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.
    1104211264          Currently this means that another unprivileged user cannot
    1104311265          manipulate the path specified or remove the temporary directory
    1104411266          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>
    1104611269      </param>
    1104711270      <param name="directory" type="wstring" dir="return">
    11048         <desc>On success this will contain the name of the directory created
    11049           with full path.</desc>
     11271        <desc>On success this will contain the full path to the created
     11272          directory. Guest path style.</desc>
    1105011273      </param>
    1105111274    </method>
     
    1106011283      </desc>
    1106111284      <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>
    1106311294      </param>
    1106411295      <param name="exists" type="boolean" dir="return">
     
    1106911300    <method name="directoryOpen">
    1107011301      <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>
    1107311307
    1107411308        <result name="VBOX_E_OBJECT_NOT_FOUND">
     
    1108011314      </desc>
    1108111315      <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>
    1108311317      </param>
    1108411318      <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>
    1108611321      </param>
    1108711322      <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>
    1108911324      </param>
    1109011325      <param name="directory" type="IGuestDirectory" dir="return">
     
    1109311328    </method>
    1109411329
    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>
    1110511336      </desc>
    1110611337      <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>
    1111711359      </desc>
    1111811360      <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>
    1112911363      </param>
    1113011364      <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>
    1113211369      </param>
    1113311370      <param name="progress" type="IProgress" dir="return">
     
    1113711374    </method>
    1113811375
    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.  -->
    1116911377
    1117011378    <method name="environmentScheduleSet">
     
    1123911447    </method>
    1124011448
     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
    1124111531    <method name="fileCreateTemp">
    1124211532      <desc>
     
    1124511535        <result name="VBOX_E_NOT_SUPPORTED">
    1124611536          The operation is not possible as requested on this particular
    11247           guest type.
     11537          guest OS.
    1124811538        </result>
    1124911539        <result name="E_INVALIDARG">
     
    1126511555      </param>
    1126611556      <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>
    1127011566      </param>
    1127111567      <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>
    1127311570      </param>
    1127411571      <param name="secure" type="boolean" dir="in">
     
    1128811585    <method name="fileExists">
    1128911586      <desc>
    11290         Checks whether a file exists in the guest or not.
     11587        Checks whether a regular file exists in the guest or not.
    1129111588
    1129211589        <result name="VBOX_E_IPRT_ERROR">
     
    1129511592      </desc>
    1129611593      <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>
    1129811743      </param>
    1129911744      <param name="exists" type="boolean" dir="return">
     
    1130211747    </method>
    1130311748
    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">
    1152111750      <desc>
    1152211751        Queries information about a file system object (file, directory, etc)
     
    1153111760      </desc>
    1153211761      <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>
    1153411764      </param>
    1153511765      <param name="followSymlinks" type="boolean" dir="in">
     
    1154411774      </param>
    1154511775    </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 -->
    1154611884
    1154711885    <method name="processCreate">
     
    1170812046    </method>
    1170912047
     12048    <!-- Symbolic link methods -->
     12049
    1171012050    <method name="symlinkCreate">
    1171112051      <desc>
     
    1171612056        </result>
    1171712057      </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>
    1172012061      </param>
    1172112062      <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>
    1172312068      </param>
    1172412069      <param name="type" type="SymlinkType" dir="in">
    1172512070        <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.
    1172812073        </desc>
    1172912074      </param>
     
    1173912084      </desc>
    1174012085      <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>
    1174212087      </param>
    1174312088      <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>
    1174512095      </param>
    1174612096    </method>
     
    1174812098    <method name="symlinkRead">
    1174912099      <desc>
    11750         Reads a symbolic link in the guest.
     12100        Reads the target value of a symbolic link in the guest.
    1175112101
    1175212102        <result name="E_NOTIMPL">
     
    1175512105      </desc>
    1175612106      <param name="symlink" type="wstring" dir="in">
    11757         <desc>Full path to symbolic link to read.</desc>
     12107        <desc>Path to the symbolic link to read.</desc>
    1175812108      </param>
    1175912109      <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>
    1176312111      </param>
    1176412112      <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 -->
    1179612118
    1179712119    <method name="waitFor">
     
    1205712379
    1205812380    <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>
    1206212382    </attribute>
    1206312383
    1206412384    <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>
    1206812386    </attribute>
    1206912387
     
    1208712405      </param>
    1208812406    </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
    1208912412  </interface>
    1209012413
     
    1210312426  <interface
    1210412427    name="IFile" extends="$unknown"
    12105     uuid="5ec56ea3-b55d-4bdb-8c4f-5f9fb26b894b"
     12428    uuid="540804bf-4ca6-dd43-800c-bfb9765f96fe"
    1210612429    wsmap="managed"
    1210712430    >
     
    1210912432      Abstract parent interface for files handled by VirtualBox.
    1211012433    </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>
    1211112479    <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>
    1215512487    </attribute>
    1215612488
     
    1217612508    </method>
    1217712509
    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.
    1218112517
    1218212518        <result name="E_NOTIMPL">
     
    1218412520        </result>
    1218512521      </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>
    1218612535      <param name="toRead" type="unsigned long" dir="in">
    1218712536        <desc>Number of bytes to read.</desc>
     
    1222512574    <method name="seek">
    1222612575      <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.
    1222812599
    1222912600        <result name="E_NOTIMPL">
     
    1223112602        </result>
    1223212603      </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.
    1224612618
    1224712619        <result name="E_NOTIMPL">
     
    1224912621        </result>
    1225012622      </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>
    1225312625      </param>
    1225412626    </method>
     
    1230712679  <interface
    1230812680    name="IGuestFile" extends="IFile"
    12309     uuid="b68f642c-49db-d699-db5c-bcb01c08e95f"
     12681    uuid="92f21dc0-44de-1653-b717-2ebf0ca9b664"
    1231012682    wsmap="managed"
    1231112683    >
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r55594 r55631  
    599599    /** The filename. */
    600600    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;
    608611    /** Octal creation mode. */
    609612    uint32_t                mCreationMode;
  • trunk/src/VBox/Main/include/GuestFileImpl.h

    r51321 r55631  
    7272private:
    7373
    74     /** Wrapped @name IGuestFile properties.
     74    /** @name Wrapped IGuestFile properties.
    7575     * @{ */
    7676    HRESULT getCreationMode(ULONG *aCreationMode);
    77     HRESULT getDisposition(com::Utf8Str &aDisposition);
    7877    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
    79     HRESULT getFileName(com::Utf8Str &aFileName);
    8078    HRESULT getId(ULONG *aId);
    8179    HRESULT getInitialSize(LONG64 *aInitialSize);
    82     HRESULT getOpenMode(com::Utf8Str &aOpenMode);
    8380    HRESULT getOffset(LONG64 *aOffset);
    8481    HRESULT getStatus(FileStatus_T *aStatus);
     82    HRESULT getFileName(com::Utf8Str &aFileName);
     83    HRESULT getAccessMode(FileAccessMode_T *aAccessMode);
     84    HRESULT getOpenAction(FileOpenAction_T *aOpenAction);
    8585    /** @}  */
    8686
    87     /** Wrapped @name IGuestFile methods.
     87    /** @name Wrapped IGuestFile methods.
    8888     * @{ */
    8989    HRESULT close();
    9090    HRESULT queryInfo(ComPtr<IFsObjInfo> &aObjInfo);
     91    HRESULT querySize(LONG64 *aSize);
    9192    HRESULT read(ULONG aToRead,
    9293                 ULONG aTimeoutMS,
     
    9798                   std::vector<BYTE> &aData);
    9899    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);
    101105    HRESULT write(const std::vector<BYTE> &aData,
    102106                  ULONG aTimeoutMS,
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r55613 r55631  
    273273    HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
    274274    HRESULT getPathStyle(PathStyle_T *aPathStyle);
     275    HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
     276    HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
    275277    HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
    276278    HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
     
    281283     * @{ */
    282284    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);
    291298    HRESULT directoryCreate(const com::Utf8Str &aPath,
    292299                            ULONG aMode,
     
    298305                                com::Utf8Str &aDirectory);
    299306    HRESULT directoryExists(const com::Utf8Str &aPath,
     307                            BOOL aFollowSymlinks,
    300308                            BOOL *aExists);
    301309    HRESULT directoryOpen(const com::Utf8Str &aPath,
     
    303311                          const std::vector<DirectoryOpenFlag_T> &aFlags,
    304312                          ComPtr<IGuestDirectory> &aDirectory);
    305     HRESULT directoryQueryInfo(const com::Utf8Str &aPath,
    306                                ComPtr<IGuestFsObjInfo> &aInfo);
    307313    HRESULT directoryRemove(const com::Utf8Str &aPath);
    308314    HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
    309315                                     const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
    310316                                     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);
    316317    HRESULT environmentScheduleSet(const com::Utf8Str &aName,
    317318                                   const com::Utf8Str &aValue);
     
    321322    HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
    322323                                             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);
    323337    HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
    324338                           ULONG aMode,
     
    327341                           ComPtr<IGuestFile> &aFile);
    328342    HRESULT fileExists(const com::Utf8Str &aPath,
     343                       BOOL aFollowSymlinks,
    329344                       BOOL *aExists);
    330     HRESULT fileRemove(const com::Utf8Str &aPath);
    331345    HRESULT fileOpen(const com::Utf8Str &aPath,
    332                      const com::Utf8Str &aOpenMode,
    333                      const com::Utf8Str &aDisposition,
     346                     FileAccessMode_T aAccessMode,
     347                     FileOpenAction_T aOpenAction,
    334348                     ULONG aCreationMode,
    335349                     ComPtr<IGuestFile> &aFile);
    336350    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,
    340354                       ULONG aCreationMode,
    341355                       LONG64 aOffset,
    342356                       ComPtr<IGuestFile> &aFile);
    343     HRESULT fileQueryInfo(const com::Utf8Str &aPath,
    344                           ComPtr<IGuestFsObjInfo> &aInfo);
    345357    HRESULT fileQuerySize(const com::Utf8Str &aPath,
     358                          BOOL aFollowSymlinks,
    346359                          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,
    356361                        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);
    358378    HRESULT processCreate(const com::Utf8Str &aCommand,
    359379                          const std::vector<com::Utf8Str> &aArguments,
     
    380400                        const std::vector<SymlinkReadFlag_T> &aFlags,
    381401                        com::Utf8Str &aTarget);
    382     HRESULT symlinkRemoveDirectory(const com::Utf8Str &aPath);
    383     HRESULT symlinkRemoveFile(const com::Utf8Str &aFile);
    384402    HRESULT waitFor(ULONG aWaitFor,
    385403                    ULONG aTimeoutMS,
     
    422440    int                     i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
    423441    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);
    425443    int                     i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
    426444    const GuestCredentials &i_getCredentials(void);
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r52934 r55631  
    254254}
    255255
    256 HRESULT GuestFile::getDisposition(com::Utf8Str &aDisposition)
     256HRESULT GuestFile::getOpenAction(FileOpenAction_T *aOpenAction)
    257257{
    258258#ifndef VBOX_WITH_GUEST_CONTROL
     
    261261    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    262262
    263     aDisposition = mData.mOpenInfo.mDisposition;
     263    *aOpenAction = mData.mOpenInfo.mOpenAction;
    264264
    265265    return S_OK;
     
    331331}
    332332
    333 HRESULT GuestFile::getOpenMode(com::Utf8Str &aOpenMode)
     333HRESULT GuestFile::getAccessMode(FileAccessMode_T *aAccessMode)
    334334{
    335335#ifndef VBOX_WITH_GUEST_CONTROL
     
    338338    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    339339
    340     aOpenMode = mData.mOpenInfo.mOpenMode;
     340    *aAccessMode = mData.mOpenInfo.mAccessMode;
    341341
    342342    return S_OK;
     
    694694    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    695695
    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));
    699700    int vrc;
    700701
     
    721722    paParms[i++].setPointer((void*)mData.mOpenInfo.mFileName.c_str(),
    722723                            (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. */
    729727    paParms[i++].setUInt32(mData.mOpenInfo.mCreationMode);
    730728    paParms[i++].setUInt64(mData.mOpenInfo.mInitialOffset);
     
    12651263}
    12661264
     1265HRESULT 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
    12671274HRESULT GuestFile::read(ULONG aToRead, ULONG aTimeoutMS, std::vector<BYTE> &aData)
    12681275{
     
    13441351}
    13451352
    1346 HRESULT GuestFile::seek(LONG64 aOffset, FileSeekType_T aWhence)
     1353HRESULT GuestFile::seek(LONG64 aOffset, FileSeekOrigin_T aWhence, LONG64 *aNewOffset)
    13471354{
    13481355#ifndef VBOX_WITH_GUEST_CONTROL
     
    13561363    switch (aWhence)
    13571364    {
    1358         case FileSeekType_Set:
     1365        case FileSeekOrigin_Set:
    13591366            eSeekType = GUEST_FILE_SEEKTYPE_BEGIN;
    13601367            break;
    13611368
    1362         case FileSeekType_Current:
     1369        case FileSeekOrigin_Current:
    13631370            eSeekType = GUEST_FILE_SEEKTYPE_CURRENT;
     1371            break;
     1372
     1373        case FileSeekOrigin_End:
     1374            eSeekType = GUEST_FILE_SEEKTYPE_END;
    13641375            break;
    13651376
     
    13691380    }
    13701381
     1382    uint64_t uNewOffset;
    13711383    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
    13741388    {
    13751389        switch (vrc)
     
    13881402}
    13891403
    1390 HRESULT GuestFile::setACL(const com::Utf8Str &aAcl)
     1404HRESULT 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
     1413HRESULT GuestFile::setSize(LONG64 aSize)
    13911414{
    13921415#ifndef VBOX_WITH_GUEST_CONTROL
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r55614 r55631  
    574574}
    575575
     576HRESULT GuestSession::getCurrentDirectory(com::Utf8Str &aCurrentDirectory)
     577{
     578    ReturnComNotImplemented();
     579}
     580
     581HRESULT GuestSession::setCurrentDirectory(const com::Utf8Str &aCurrentDirectory)
     582{
     583    ReturnComNotImplemented();
     584}
     585
    576586HRESULT GuestSession::getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories)
    577587{
     
    12901300                                     ComObjPtr<GuestFile> &pFile, int *pGuestRc)
    12911301{
    1292     LogFlowThisFunc(("strPath=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, uOffset=%RU64\n",
    1293                      openInfo.mFileName.c_str(), openInfo.mOpenMode.c_str(), openInfo.mDisposition.c_str(),
    1294                      openInfo.mCreationMode, 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));
    12951305
    12961306    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    14041414}
    14051415
    1406 int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc)
     1416int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc)
    14071417{
    14081418    AssertPtrReturn(pllSize, VERR_INVALID_POINTER);
    14091419
    14101420    GuestFsObjData objData;
    1411     int vrc = i_fileQueryInfoInternal(strPath, false /*fFollowSymlinks*/, objData, pGuestRc);
     1421    int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
    14121422    if (RT_SUCCESS(vrc))
    14131423        *pllSize = objData.mObjectSize;
     
    24862496}
    24872497
    2488 HRESULT GuestSession::copyFrom(const com::Utf8Str &aSource, const com::Utf8Str &aDest,
    2489                                const std::vector<CopyFileFlag_T> &aFlags,
    2490                                ComPtr<IProgress> &aProgress)
     2498HRESULT 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
     2504HRESULT GuestSession::fileCopyFromGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest,
     2505                                        const std::vector<FileCopyFlag_T> &aFlags,
     2506                                        ComPtr<IProgress> &aProgress)
    24912507{
    24922508#ifndef VBOX_WITH_GUEST_CONTROL
     
    25012517        return setError(E_INVALIDARG, tr("No destination specified"));
    25022518
    2503     uint32_t fFlags = CopyFileFlag_None;
     2519    uint32_t fFlags = FileCopyFlag_None;
    25042520    if (aFlags.size())
    25052521    {
     
    25072523            fFlags |= aFlags[i];
    25082524    }
     2525/** @todo r=bird: fend off flags we don't implement here!  */
    25092526
    25102527    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    25352552}
    25362553
    2537 HRESULT GuestSession::copyTo(const com::Utf8Str &aSource, const com::Utf8Str &aDest, const std::vector<CopyFileFlag_T> &aFlags,
    2538                              ComPtr<IProgress> &aProgress)
     2554HRESULT GuestSession::fileCopyToGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest,
     2555                                      const std::vector<FileCopyFlag_T> &aFlags, ComPtr<IProgress> &aProgress)
    25392556{
    25402557#ifndef VBOX_WITH_GUEST_CONTROL
     
    25492566        return setError(E_INVALIDARG, tr("No destination specified"));
    25502567
    2551     uint32_t fFlags = CopyFileFlag_None;
     2568    uint32_t fFlags = FileCopyFlag_None;
    25522569    if (aFlags.size())
    25532570    {
     
    25552572            fFlags |= aFlags[i];
    25562573    }
     2574/** @todo r=bird: fend off flags we don't implement here!  */
    25572575
    25582576    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    25862604}
    25872605
     2606HRESULT 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
     2612HRESULT 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
     2618HRESULT 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
    25882624HRESULT GuestSession::directoryCreate(const com::Utf8Str &aPath, ULONG aMode,
    25892625                                      const std::vector<DirectoryCreateFlag_T> &aFlags)
     
    26772713}
    26782714
    2679 HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL *aExists)
     2715HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
    26802716{
    26812717#ifndef VBOX_WITH_GUEST_CONTROL
     
    26902726
    26912727    GuestFsObjData objData; int guestRc;
    2692     int rc = i_directoryQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc);
     2728    int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
    26932729    if (RT_SUCCESS(rc))
    26942730        *aExists = objData.mType == FsObjType_Directory;
    26952731    else
    26962732    {
     2733        /** @todo r=bird: Looks like this code raises errors if the directory doesn't
     2734         *        exist... That's of course not right. */
    26972735        switch (rc)
    26982736        {
     
    27732811}
    27742812
    2775 HRESULT GuestSession::directoryQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsObjInfo> &aInfo)
    2776 {
    2777 #ifndef VBOX_WITH_GUEST_CONTROL
    2778     ReturnComNotImplemented();
    2779 #else
    2780     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 
    28302813HRESULT GuestSession::directoryRemove(const com::Utf8Str &aPath)
    28312814{
     
    28812864    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
    28822865        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!! */
    28832869
    28842870    HRESULT hr = i_isReadyExternal();
     
    29332919
    29342920    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_CONTROL
    2943     ReturnComNotImplemented();
    2944 #else
    2945     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_CONTROL
    2990     ReturnComNotImplemented();
    2991 #else
    2992     LogFlowThisFuncEnter();
    2993 
    2994     ReturnComNotImplemented();
    29952921#endif /* VBOX_WITH_GUEST_CONTROL */
    29962922}
     
    31383064}
    31393065
    3140 HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL *aExists)
    3141 {
    3142 #ifndef VBOX_WITH_GUEST_CONTROL
    3143     ReturnComNotImplemented();
    3144 #else
    3145     LogFlowThisFuncEnter();
    3146 
     3066HRESULT 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. */
    31473074    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
    31483075        return setError(E_INVALIDARG, tr("No file to check existence for specified"));
    31493076
    31503077    GuestFsObjData objData; int guestRc;
    3151     int vrc = i_fileQueryInfoInternal(aPath, false /*fFollowSymlinks*/, objData, &guestRc);
     3078    int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
    31523079    if (RT_SUCCESS(vrc))
    31533080    {
     
    31643091            break;
    31653092
     3093/** @todo r=bird: what about VERR_PATH_NOT_FOUND and VERR_FILE_NOT_FOUND?
     3094 *        Where does that get converted to *aExists = FALSE? */
    31663095        case VERR_NOT_A_FILE:
    31673096            *aExists = FALSE;
     
    31783107}
    31793108
    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,
     3109HRESULT GuestSession::fileOpen(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
    32143110                               ULONG aCreationMode, ComPtr<IGuestFile> &aFile)
    32153111{
     
    32183114#else
    32193115    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
     3120HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
     3121                                 FileSharingMode_T aSharingMode, ULONG aCreationMode, LONG64 aOffset, ComPtr<IGuestFile> &aFile)
    32323122{
    32333123#ifndef VBOX_WITH_GUEST_CONTROL
     
    32383128    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
    32393129        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. */
    32453130
    32463131    HRESULT hr = i_isReadyExternal();
     
    32483133        return hr;
    32493134
    3250     /** @todo Validate creation mode. */
    3251     uint32_t uCreationMode = 0;
    3252 
    32533135    GuestFileOpenInfo openInfo;
    32543136    openInfo.mFileName = aPath;
    3255     openInfo.mOpenMode = aOpenMode;
    3256     openInfo.mDisposition = aDisposition;
    3257     openInfo.mSharingMode = aSharingMode;
    32583137    openInfo.mCreationMode = aCreationMode;
    32593138    openInfo.mInitialOffset = aOffset;
    32603139
    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);
    32713191    if (RT_SUCCESS(vrc))
    32723192        /* Return directory object to the caller. */
     
    32963216}
    32973217
    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)
     3218HRESULT GuestSession::fileQuerySize(const com::Utf8Str &aPath, BOOL aFollowSymlinks, LONG64 *aSize)
    33503219{
    33513220#ifndef VBOX_WITH_GUEST_CONTROL
     
    33603229
    33613230    int64_t llSize; int guestRc;
    3362     int vrc = i_fileQuerySizeInternal(aPath, &llSize, &guestRc);
     3231    int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE,  &llSize, &guestRc);
    33633232    if (RT_SUCCESS(vrc))
    33643233        *aSize = llSize;
     
    33813250}
    33823251
    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)
     3252HRESULT GuestSession::fsObjExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
    34443253{
    34453254#ifndef VBOX_WITH_GUEST_CONTROL
     
    34743283}
    34753284
    3476 HRESULT GuestSession::fsQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo)
     3285HRESULT GuestSession::fsObjQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo)
    34773286{
    34783287#ifndef VBOX_WITH_GUEST_CONTROL
     
    35113320#endif /* VBOX_WITH_GUEST_CONTROL */
    35123321}
     3322
     3323HRESULT 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
     3356HRESULT 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
     3418HRESULT 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
     3424HRESULT GuestSession::fsObjSetACL(const com::Utf8Str &aPath, BOOL aFollowSymlinks, const com::Utf8Str &aAcl, ULONG aMode)
     3425{
     3426    ReturnComNotImplemented();
     3427}
     3428
    35133429
    35143430HRESULT GuestSession::processCreate(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments,
     
    37043620}
    37053621
    3706 HRESULT GuestSession::symlinkRemoveDirectory(const com::Utf8Str &aPath)
    3707 {
    3708 #ifndef VBOX_WITH_GUEST_CONTROL
    3709     ReturnComNotImplemented();
    3710 #else
    3711     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_CONTROL
    3720     ReturnComNotImplemented();
    3721 #else
    3722     LogFlowThisFuncEnter();
    3723 
    3724     ReturnComNotImplemented();
    3725 #endif /* VBOX_WITH_GUEST_CONTROL */
    3726 }
    3727 
    37283622HRESULT GuestSession::waitFor(ULONG aWaitFor, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
    37293623{
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r55613 r55631  
    937937            SessionTaskCopyTo *pTask = new SessionTaskCopyTo(pSession /* GuestSession */,
    938938                                                             &pISO->file, cbOffset, cbSize,
    939                                                              strFileDest, CopyFileFlag_None);
     939                                                             strFileDest, FileCopyFlag_None);
    940940            AssertPtrReturn(pTask, VERR_NO_MEMORY);
    941941
     
    973973        GuestFsObjData objData;
    974974        int64_t cbSizeOnGuest; int guestRc;
    975         rc = pSession->i_fileQuerySizeInternal(strFileDest, &cbSizeOnGuest, &guestRc);
     975        rc = pSession->i_fileQuerySizeInternal(strFileDest, false /*fFollowSymlinks*/, &cbSizeOnGuest, &guestRc);
    976976        if (   RT_SUCCESS(rc)
    977977            && cbSize == (uint64_t)cbSizeOnGuest)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette