Skip to content

Poco::File crashed when handle windows very long path(\\?\C:) #5011

@siren186

Description

@siren186

Describe the bug

Poco::File f1("C:");
Poco::File f2("\\\\?\\C:"); // long path
bool b1 = f1.exists(); // ok
bool b2 = f2.exists(); // crash !!!!!!

std::string path = "C:\\abc\\def\\"; // folder [abc] and [def] are all not exists
Poco::File f3("\\\\?\\" + path); // long path
Poco::File f4(path);
f3.createDirectories(); // crash !!!!!!
f4.createDirectories(); // ok

Error occured here

DWORD attr = GetFileAttributesW(_upath.c_str());

DWORD dw1 = GetFileAttributesW(L"C:");          // dw1 = 0x10
DWORD dw2 = GetFileAttributesW(L"C:\\");        // dw2 = 0x16
DWORD dw3 = GetFileAttributesW(L"\\\\?\\C:\\"); // dw3 = 0x16

// Poco::File error here
DWORD dw4 = GetFileAttributesW(L"\\\\?\\C:");   // dw4 = -1, GetLastError = ERROR_INVALID_PARAMETER

Please add relevant environment information:

  • Visual studio 2022
  • POCO v1.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions