VirtualBox

Changeset 107378 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Dec 19, 2024 12:51:59 PM (4 weeks ago)
Author:
vboxsync
Message:

IPRT/RTFileDelete-r3-nt.cpp: OBJ_CASE_INSENSITIVE must be set in the initial opening of the file/dir/whatever. bugref:10826

File:
1 edited

Legend:

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

    r107377 r107378  
    7676        IO_STATUS_BLOCK     Ios     = RTNT_IO_STATUS_BLOCK_INITIALIZER;
    7777        OBJECT_ATTRIBUTES   ObjAttr;
    78         InitializeObjectAttributes(&ObjAttr, &NtName, 0 /*fAttrib*/, hRootDir, NULL);
     78        InitializeObjectAttributes(&ObjAttr, &NtName, OBJ_CASE_INSENSITIVE /*fAttrib*/, hRootDir, NULL);
    7979
    8080        ULONG fOpenOptions = FILE_NON_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_REPARSE_POINT
     
    149149         * grok the reparse point stuff.
    150150         */
    151         else if (   rcNt == STATUS_INVALID_PARAMETER)
     151        else if (rcNt == STATUS_INVALID_PARAMETER)
    152152        {
    153153            fOpenOptions &= ~FILE_OPEN_REPARSE_POINT;
     
    166166                                0 /*EaLength*/);
    167167        }
    168         /*
    169          * When getting STATUS_OBJECT_PATH_NOT_FOUND we re-initialize the object attributes
    170          * with OBJ_CASE_INSENSITIVE and try again. This is necessary for older object managers (i.e. on NT4)
    171          * when trying to delete files with a path *and* leading spaces in the file name,
    172          * i.e. "c:\temp\ file_with_a_leading_space".
    173          *
    174          * See @bugref{10826}.
    175          */
    176         else if (   rcNt == STATUS_OBJECT_PATH_NOT_FOUND)
    177         {
    178             InitializeObjectAttributes(&ObjAttr, &NtName, OBJ_CASE_INSENSITIVE /*fAttrib*/, hRootDir, NULL);
    179 
    180             hPath = RTNT_INVALID_HANDLE_VALUE;
    181             RTNT_IO_STATUS_BLOCK_REINIT(&Ios);
    182             rcNt = NtCreateFile(&hPath,
    183                              DELETE | FILE_READ_ATTRIBUTES | SYNCHRONIZE,
    184                              &ObjAttr,
    185                              &Ios,
    186                              NULL /*AllocationSize*/,
    187                              FILE_ATTRIBUTE_NORMAL,
    188                              FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
    189                              FILE_OPEN,
    190                              fOpenOptions,
    191                              NULL /*EaBuffer*/,
    192                              0 /*EaLength*/);
    193         }
    194 
    195168        /* else:
    196169           DeleteFileW will retry opening the file w/o FILE_READ_ATTRIBUTES here when
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