Menu

#1653 LoadLibraryEx with new flag fails on Windows 7 without KB2533623

Bug
closed-fixed
3
2017-03-21
2014-09-05
mberchtold
No

File: win32/PlatWin.cxx
LoadLibraryEx with the LOAD_LIBRARY_SEARCH_SYSTEM32 flag fails (returns NULL) if hotfix KB2533623 on Windows 7 is not installed.

Please see the attached patch which works for all supported operating systems.

I have already proposed a similar solution at the time I have originally reported the binary planting bug. It would have also been appreciated if credits for the security report & fix would have been given.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2014-09-05

    gcc supports neither #pragma comment(lib, "shlwapi.lib") nor _tcscpy_s.

    You did not respond to my 8/Oct "What problem?" message in the previous thread. I still can't work out why you think there is a problem with the LoadLibraryEx calls failing on unpatched Windows 7 since this just means falling back to GDI.

     
  • mberchtold

    mberchtold - 2014-09-05

    pragma:
    I guess you have to add it to gcc using the -l parameter then:
    -lshlwapi

    _tcscpy_s:

    #ifdef _MSC_VER
    #include <tchar.h>
    #pragma comment(lib, "shlwapi.lib")
    #endif
    #include <Shlwapi.h> // PathAppend
    
    ...
    
    #ifdef _MSC_VER
    _tcscpy_s(...)
    #else
    strcpy(...)
    #endif
    

    Windows 7:
    As a user of the scintilla component I'm expecting that the D2D init succeeds on Windows 7 regardless whether the mentioned hotfix is installed or not. For example if my application implements plugins which only work with D2D.
    I believe this is a reasonable guarantee Scintilla should provide.

    I also wish that such workarounds aren't necessary but unfortunately the reality is that there are still plenty of users with unpatched versions of Windows 7.

     

    Last edit: mberchtold 2014-09-05
    • Neil Hodgson

      Neil Hodgson - 2014-09-05

      Its a simple piece of string manipulation that doesn't need #ifdef or shlwapi and should be implemented to be portable between compilers.

       
  • Neil Hodgson

    Neil Hodgson - 2014-09-05
    • labels: --> scintilla, win32
    • status: open --> open-accepted
    • Priority: 5 --> 3
     
  • Neil Hodgson

    Neil Hodgson - 2017-03-10
    • status: open-accepted --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2017-03-10

    Should be fixed with [d488b9].

     

    Related

    Commit: [d488b9]

  • Neil Hodgson

    Neil Hodgson - 2017-03-21
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.