windowssecurityinternalswinsxs

How windows side by side (WinSxS) mechanism works?


If I'm not wrong, if an application specifies dependency in its manifest, Windows loader will load the specified version of the DLL from C:\Windows\WinSxS\xxx\ folder.

While I was researching on C:\Windows\System32\dccw.exe - which is the "Display Color Calibration" app on windows, I saw this weird behavior:

Application manifest has only one dependency - "Microsoft.Windows.Common-Controls"
 which is basically the - comctl32.dll

However when you run dccw.exe, it loads two DLL from WinSXS folder; comctl32.dll as expected and also GdiPlus.dll.

Isn't a dependency for GdiPlus.dll should have been present in the manifest. Or did I not understand how WinSxS works correctly?


Solution

  • It is not required that all dependencies be specified in the application manifest. You can add some but leave out others.

    As Hans mentioned in a comment, gdiplus under WinSxS is a hardlink to the same file in system32:

        > C:\Windows\system32>fsutil.exe hardlink list GdiPlus.dll
    
        \Windows\WinSxS\amd64_microsoft.windows.gdiplus.systemcopy_31bf3856ad364e35_10.0.
             19041.1645_none_5b73408eab60fd9c\GdiPlus.dll
        \Windows\System32\GdiPlus.dll
    

    So functionally it doesn't matter which 'copy' of that file gets loaded.


    As to WHY the process seems to load from WinSxS ... the two hard links are indistinguishable. There is nothing documented to suggest that WinSxS would be used as a DLL search location by default.

    This may just be how Process Monitor chooses to report the file's location (?). If you compare to other tools like (archaic) Dependency Walker or Dependencies you get different results. One shows the WinSxS location, the other shows system32:

    enter image description here

    enter image description here