VirtualBox

Changeset 70428 in vbox for trunk/src/VBox/Runtime/r3/nt


Ignore:
Timestamp:
Jan 2, 2018 3:01:20 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120033
Message:

IPRT: Changed the NT namespace passthru prefix from '
!\' to '
:iprtnt:\' to make it hard to use by mistake. Enabled it for everyone and all build types.

Location:
trunk/src/VBox/Runtime/r3/nt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/nt/internal-r3-nt.h

    r69795 r70428  
    3737
    3838
    39 #ifdef DEBUG_bird
     39#if 1
    4040/** Enables the "\\!\" NT path pass thru as well as hacks for listing NT object
    4141 * directories. */
    4242# define IPRT_WITH_NT_PATH_PASSTHRU 1
    4343#endif
     44
    4445
    4546
  • trunk/src/VBox/Runtime/r3/nt/pathint-nt.cpp

    r70200 r70428  
    226226        && pszPath[2])
    227227    {
     228#ifdef IPRT_WITH_NT_PATH_PASSTHRU
     229        /*
     230         * Special trick: The path starts with RTPATH_NT_PASSTHRU_PREFIX, we will skip past the bang and pass it thru.
     231         */
     232        if (   pszPath[2] == ':'
     233            && pszPath[3] == 'i'
     234            && pszPath[4] == 'p'
     235            && pszPath[5] == 'r'
     236            && pszPath[6] == 't'
     237            && pszPath[7] == 'n'
     238            && pszPath[8] == 't'
     239            && pszPath[9] == ':'
     240            && RTPATH_IS_SLASH(pszPath[10]))
     241            return rtNtPathUtf8ToUniStr(pNtName, phRootDir, pszPath + 10);
     242#endif
     243
    228244        if (   pszPath[2] == '?'
    229245            && RTPATH_IS_SLASH(pszPath[3]))
    230246            return rtNtPathFromWinUtf8PassThru(pNtName, phRootDir, pszPath);
    231 
    232 #ifdef IPRT_WITH_NT_PATH_PASSTHRU
    233         /* Special hack: The path starts with "\\\\!\\", we will skip past the bang and pass it thru. */
    234         if (   pszPath[2] == '!'
    235             && RTPATH_IS_SLASH(pszPath[3]))
    236             return rtNtPathUtf8ToUniStr(pNtName, phRootDir, pszPath + 3);
    237 #endif
    238247
    239248        if (   pszPath[2] == '.'
     
    331340        && !RTPATH_IS_SLASH(pwszWinPath[2]) )
    332341    {
    333         if (   pwszWinPath[2] == '?'
    334             && cwcWinPath >= 4
    335             && RTPATH_IS_SLASH(pwszWinPath[3]))
    336             return rtNtPathFromWinUtf16PassThru(pNtName, phRootDir, pwszWinPath, cwcWinPath);
    337 
    338342#ifdef IPRT_WITH_NT_PATH_PASSTHRU
    339         /* Special hack: The path starts with "\\\\!\\", we will skip past the bang and pass it thru. */
    340         if (   pwszWinPath[2] == '!'
    341             && cwcWinPath >= 4
    342             && RTPATH_IS_SLASH(pwszWinPath[3]))
    343         {
    344             pwszWinPath += 3;
    345             cwcWinPath  -= 3;
     343        /*
     344         * Special trick: The path starts with RTPATH_NT_PASSTHRU_PREFIX, we will skip past the bang and pass it thru.
     345         */
     346        if (   cwcWinPath >= sizeof(RTPATH_NT_PASSTHRU_PREFIX) - 1U
     347            && pwszWinPath[2] == ':'
     348            && pwszWinPath[3] == 'i'
     349            && pwszWinPath[4] == 'p'
     350            && pwszWinPath[5] == 'r'
     351            && pwszWinPath[6] == 't'
     352            && pwszWinPath[7] == 'n'
     353            && pwszWinPath[8] == 't'
     354            && pwszWinPath[9] == ':'
     355            && RTPATH_IS_SLASH(pwszWinPath[10]) )
     356        {
     357            pwszWinPath += 10;
     358            cwcWinPath  -= 10;
    346359            if (cwcWinPath < _32K - 1)
    347360            {
     
    364377        }
    365378#endif
     379
     380        if (   pwszWinPath[2] == '?'
     381            && cwcWinPath >= 4
     382            && RTPATH_IS_SLASH(pwszWinPath[3]))
     383            return rtNtPathFromWinUtf16PassThru(pNtName, phRootDir, pwszWinPath, cwcWinPath);
    366384
    367385        if (   pwszWinPath[2] == '.'
     
    866884            if (   !RTPATH_IS_SLASH(pszPath[0])
    867885                || !RTPATH_IS_SLASH(pszPath[1])
    868                 || pszPath[2] != '!'
    869                 || RTPATH_IS_SLASH(pszPath[3]))
     886                || pszPath[2] != ':'
     887                || pszPath[3] != 'i'
     888                || pszPath[4] != 'p'
     889                || pszPath[5] != 'r'
     890                || pszPath[6] != 't'
     891                || pszPath[7] != 'n'
     892                || pszPath[8] != 't'
     893                || pszPath[9] != ':'
     894                || !RTPATH_IS_SLASH(pszPath[10]) )
    870895#endif
    871896                pfObjDir = NULL;
     
    9881013        /* Rought conversion of the access flags. */
    9891014        ULONG fObjDesiredAccess = 0;
    990         if (fDesiredAccess & (GENERIC_ALL | STANDARD_RIGHTS_ALL))
     1015        if (   (fDesiredAccess & GENERIC_ALL)
     1016            || (fDesiredAccess & STANDARD_RIGHTS_ALL) == STANDARD_RIGHTS_ALL)
    9911017            fObjDesiredAccess = DIRECTORY_ALL_ACCESS;
    9921018        else
    9931019        {
    994             if (fDesiredAccess & (FILE_GENERIC_WRITE | GENERIC_WRITE | STANDARD_RIGHTS_WRITE))
    995                 fObjDesiredAccess |= DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_OBJECT;
     1020            if (fDesiredAccess & (GENERIC_WRITE | STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA))
     1021                fObjDesiredAccess |= DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_OBJECT | DIRECTORY_CREATE_SUBDIRECTORY;
    9961022            if (   (fDesiredAccess & (FILE_LIST_DIRECTORY | FILE_GENERIC_READ | GENERIC_READ | STANDARD_RIGHTS_READ))
    9971023                || !fObjDesiredAccess)
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