Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Possible error in BrowseCtrl module #51

logachev opened this Issue · 1 comment

2 participants



Please look into code of BrowseCtrl module.
Function GetNextPathName():

    // Make sure pos is a valid position
    if (pos == NULL)
        return _T("");

    if (IsEditManuallyChanged())
        // contents of the edit box has been changed by direct user input
        POSITION posOrig = pos;
        pos = NULL;
        return (DWORD)posOrig == (DWORD)(LPCTSTR)m_sEditText ? m_sEditText : _T("");

    if (m_lpszPathNames == NULL
        || m_nPathNamesLen == 0
        || m_nSelCount == 0
        || (DWORD)pos < (DWORD)m_lpszPathNames
        || (DWORD)pos >= (DWORD)m_lpszPathNames + (DWORD)m_nPathNamesLen)
        pos = NULL;
        return _T("");

But when you call this function from FileDoModal function, m_nSelCount equal to zero etc. So third if in GetNextPathName() function always will return empty string(except EditManuallyChanged situation).

    POSITION pos = dlg.GetStartPosition();

    // determine the string length
    m_nSelCount = 0;
    m_nPathNamesLen = 0;
    while (pos != NULL)
        m_nPathNamesLen += dlg.GetNextPathName(pos).GetLength() + 1;

Please correct me if I'm wrong..


Didn't dig through this yet, but appreciate if you could write a test that reproduces the bug and make a pull request with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.