Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-17480

NtOpenFile/IopCreateFile opens incorrect File Object when called with only a handle on original FAT driver.

    XMLWordPrintable

Details

    Description

      replacement of older FAT driver resolved this - (but failure may still be present in older driver)

      When NtOpenFile is called to 'reopen' a file using only the handle from a prior successful NtOpenFile call based on the path, the resulting call to IopCreateFile returns Success and a Handle, but does not open the correct file. This sequence has some specific dependencies including not sharing the same structures in the two NtOpenFile calls, but the first call opens the file properly, the second call opens the host volume when using the original FAT driver. The actual fault appears to be in the io manager file.c file. I have attached a test that can be added to ntdll_apitests to show the failure conditions. The root of the problem seems to be that IopCreateFile always attempts a name lookup even when a name is not present. I have also attached a patch that can be inserted into IopCreateFile just after it performs file validations that appears to resolve the problem. I am not a C programmer or Kernel programmer so the code is very preliminary but does build and work. the test was originally created by learn_more and has been patched to highlight this issue. Note this does not seem to occur with BtrFs and has not been tested with the ported MS FAT driver (yet).

      Attachments

        1. TestNtReadFile-1.exe
          2.96 MB
        2. ROS IopCreateFile patch.txt
          4 kB
        3. NtOpenFile.c
          7 kB
        4. names.tdb
          0.7 kB
        5. iomgr_file_c.patch
          5 kB
        6. file.c
          175 kB

        Activity

          People

            Heis Spiter Pierre Schweitzer
            bugdude bugdude
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: