Skip to content

UWP App undefined method PathMatchSpecA #492

@rh101

Description

@rh101

image

PathMatchSpecA is in shlwapi.h, but that entire code is disabled when compiling a Universal Windows application (WinRT/C++):

image

Due to this check:
image

I noticed that SocketOpenSSL::checkHost() is only used if OPENSSL_VERSION_NUMBER < 0x10100000L, and it's a private method, so not called from anywhere outside of SocketOpenSSL. In my case it's also not being called at all given that the OpenSSL version number is greater than 0x10100000L, so as a work-around, I've just changed it to this:

    /**
     * Check whether a hostname matches a pattern
     */
    bool SocketOpenSSL::checkHost(const std::string& host, const char* pattern)
    {
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
        return true;
#else

#ifdef _WIN32
        return PathMatchSpecA(host.c_str(), pattern);
#else
        return fnmatch(pattern, host.c_str(), 0) != FNM_NOMATCH;
#endif

#endif
    }

Can you see any issue with doing this?

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