Skip to content

directory_iterator fails on UNC paths with Windows Server 2016 or Windows Server 2012 R2  #245

@dlaugt

Description

@dlaugt

I've upgraded boost from 1.67.0 to 1.79.0. I compile the following example with Visual Studio 2017. When I run the program, it fails with Windows Server 2016 or Windows Server 2012 R2:

#include <boost/filesystem/operations.hpp>`
#include <iostream>

int main ()
{
  try
  {
    boost::filesystem::directory_iterator it ("\\\\host\\dir");
  }
  catch (std::exception& ex)
  {
    std::cout << "Exception: " << ex.what () << std::endl;
  }

  return 0;
}

Here is the output:
Exception: boost::filesystem::directory_iterator::construct: The parameter is incorrect [system:87]: "\\host\dir"

It's a valid UNC path (eg the directory exists). The same program works with Windows Server 2019 or Windows 10.

It doesn't work with Boost 1.79.0 and the latest code in develop branch. It works fine with Boost 1.67.0.

In dir_itr_create(), it iterates to the following paths without any success (error code = ERROR_INVALID_PARAMETER):

  • get_file_information_by_handle_ex with file_id_extd_directory_restart_info_class
  • get_file_information_by_handle_ex with file_full_directory_restart_info_class
  • get_file_information_by_handle_ex with file_id_both_directory_restart_info_class

Any idea of what could be wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions