VirtualBox

Changeset 40126 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Feb 14, 2012 11:53:03 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76270
Message:

VBoxSF: return correct status code for pipe open requests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/SharedFolders/redirector/sys/netroot.c

    r39814 r40126  
    180180    Log(("VBOXSF: VBoxMRxCreateVNetRoot: pNetRoot = %p, fTreeConnectOpen = %d\n", pNetRoot, pRxContext->Create.ThisIsATreeConnectOpen));
    181181
     182    Log(("VBOXSF: VBoxMRxCreateVNetRoot: name = [%.*ls]\n",
     183          pNetRoot->pNetRootName->Length / sizeof(WCHAR), pNetRoot->pNetRootName->Buffer));
     184
    182185    /* IMPORTANT:
    183186     *
     
    186189     */
    187190
    188     if (pNetRoot->Type == NET_ROOT_MAILSLOT || pNetRoot->Type == NET_ROOT_PIPE)
     191    if (pNetRoot->Type == NET_ROOT_PIPE)
     192    {
     193        /* VBoxSF claims everything which starts with '\vboxsrv'.
     194         *
     195         * So sometimes the system tries to open \vboxsrv\ipc$ pipe for DFS
     196         * and fails the application call if an unexpected code is returned.
     197         *
     198         * According to MSDN: The Windows client returns STATUS_MORE_PROCESSING_REQUIRED to the calling
     199         * application to indicate that the path does not correspond to a DFS Namespace.
     200         */
     201        pVNetRoot->Context = NULL;
     202
     203        if (pNetRoot->pNetRootName->Length >= 13 * sizeof (WCHAR)) /* Number of bytes in '\vboxsrv\ipc$' unicode string. */
     204        {
     205            const WCHAR *Suffix = &pNetRoot->pNetRootName->Buffer[8]; /* Number of chars in '\vboxsrv' */
     206
     207            if (   Suffix[0] == L'\\'
     208                && (Suffix[1] == L'I' || Suffix[1] == L'i')
     209                && (Suffix[2] == L'P' || Suffix[2] == L'p')
     210                && (Suffix[3] == L'C' || Suffix[3] == L'c')
     211                && Suffix[4] == L'$'
     212               )
     213            {
     214                if (   pNetRoot->pNetRootName->Length == 13 * sizeof (WCHAR)
     215                    || (Suffix[5] == L'\\' || Suffix[5] == 0)
     216                   )
     217                {
     218                    /* It is '\vboxsrv\IPC$[\*]'. */
     219                    Log(("VBOXSF: VBoxMRxCreateVNetRoot: IPC$\n"));
     220                    Status = STATUS_MORE_PROCESSING_REQUIRED;
     221                    goto l_Exit;
     222                }
     223            }
     224        }
     225
     226        /* Fail all other pipe open requests with the same status code as returned by DDK sample. */
     227        Log(("VBOXSF: VBoxMRxCreateVNetRoot: Pipe open not supported!\n"));
     228        Status = STATUS_NOT_SUPPORTED;
     229        goto l_Exit;
     230    }
     231    else if (pNetRoot->Type == NET_ROOT_MAILSLOT)
    189232    {
    190233        /* DDK sample returns this status code. And our driver does get such NetRoots. */
    191         Log(("VBOXSF: VBoxMRxCreateVNetRoot: Mailslot or Pipe open (%d) not supported!\n", pNetRoot->Type));
     234        Log(("VBOXSF: VBoxMRxCreateVNetRoot: Mailslot open not supported!\n"));
    192235        pVNetRoot->Context = NULL;
    193236
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