VirtualBox

Changeset 58440 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Oct 27, 2015 5:40:34 PM (9 years ago)
Author:
vboxsync
Message:

Runtime: pathint-nt.cpp Win32 to NT path prefix conversion fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/nt/pathint-nt.cpp

    r57978 r58440  
    4747/**
    4848 * Handles the pass thru case for UTF-8 input.
     49 * Win32 path uses "\\?\" prefix which is converted to "\??\" NT prefix.
    4950 *
    5051 * @returns IPRT status code.
     
    5758    PRTUTF16 pwszPath = NULL;
    5859    size_t   cwcLen;
    59     int rc = RTStrToUtf16Ex(pszPath + 1, RTSTR_MAX, &pwszPath, 0, &cwcLen);
     60    int rc = RTStrToUtf16Ex(pszPath, RTSTR_MAX, &pwszPath, 0, &cwcLen);
    6061    if (RT_SUCCESS(rc))
    6162    {
     
    6364        {
    6465            pwszPath[0] = '\\';
    65             pwszPath[1] = '.';
    66             pwszPath[2] = '\\';
     66            pwszPath[1] = '?';
     67            pwszPath[2] = '?';
     68            pwszPath[3] = '\\';
    6769
    6870            pNtName->Buffer = pwszPath;
     
    8284/**
    8385 * Handles the pass thru case for UTF-16 input.
     86 * Win32 path uses "\\?\" prefix which is converted to "\??\" NT prefix.
    8487 *
    8588 * @returns IPRT status code.
     
    9295                                        PCRTUTF16 pwszWinPath, size_t cwcWinPath)
    9396{
    94     /* Drop a character because: \\?\ -> \.\ */
    95     pwszWinPath++;
    96     cwcWinPath--;
    97 
    9897    /* Check length and allocate memory for it. */
    9998    int rc;
     
    105104            /* Intialize the path. */
    106105            pwszNtPath[0] = '\\';
    107             pwszNtPath[1] = '.';
    108             pwszNtPath[2] = '\\';
    109             memcpy(pwszNtPath + 3, pwszWinPath + 3, (cwcWinPath - 3) * sizeof(RTUTF16));
     106            pwszNtPath[1] = '?';
     107            pwszNtPath[2] = '?';
     108            pwszNtPath[3] = '\\';
     109            memcpy(pwszNtPath + 4, pwszWinPath + 4, (cwcWinPath - 4) * sizeof(RTUTF16));
    110110            pwszNtPath[cwcWinPath] = '\0';
    111111
Note: See TracChangeset for help on using the changeset viewer.

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