Skip to content

Openshell's taskbar doesn't properly show on latest version of Windows 11 (ExplorerPatcher) #2094

Closed

Description

@TehEpikBoi
image On Windows 11 24H2 the taskbar texture does not properly show with Explorer patcher's Windows 10 (explorerpatcher) settings which is the only way to make Openshell show it's start icon and taskbar correctly but in the new update it made the taskbar show like the image above. When I changed the taskbar skins or configured the settings the bug is still present. Please let me know if it's my fault, explorer patcher's fault, Windows's fault or try and fix it for the next versions. Thank you!

Area of issue

Taskbar

To reproduce

  1. Have Windows 24H2
  2. Have explorer patcher and has it settings on Windows 10 (Explorer patcher)
  3. Select any taskbar skins
  4. You will see the problem

Expected behavior

I expected just for it to work.

Open-Shell version

4_4_194

Windows version

Windows 11 24H2

Additional context

No response

Activity

  1. changed the title [-]Openshell's taskbar doesn't properly show on latest version of Windows 11[/-] [+]Openshell's taskbar doesn't properly show on latest version of Windows 11 (ExplorerPatcher)[/+] on Jan 6, 2025
  2. added
    app compatibilityIssues regarding compatibility with external programs.
    on Jan 6, 2025
  3. ge0rdi commented on Jan 6, 2025

    @ge0rdi
    Member

    This is because ExplorerPatcher's taskbar implementation differs from original Win10 taskbar.

    Win10 uses SHFillRectClr export (ordinal 197 from shlwapi.dll) to paint background of tasklist window.
    Open-Shell hooks that one and ignores it (so it won't overwrite background of task bar).

    ExplorerPatcher (ep_taskbar.5.dll) uses it own implementation of that API, so we cannot hook it.
    The implementation calls ExtTextOutW to fill background, so we can hook this API.

  4. TehEpikBoi commented on Jan 8, 2025

    @TehEpikBoi
    Author

    Thanks for the reply.

  5. Amrsatrio commented on Jan 19, 2025

    @Amrsatrio

    Hi, developer of the reimplemented taskbar here, sorry for just responding to this now. I've been packed with RE adventures on the very overengineered and architected 8.1 start screen.

    So yeah I know that this is a problem and I've dismissed two issues in EP's repo related to this. First I would admit that I looked at the XP code while doing the reimplementation. Because I know that function is private, exported by ordinal, and not in the public .lib files, I had to do dynamic linking or some other trick that would make it link statically to shlwapi.dll by ordinal. And then I looked at its code in the XP code, found out that the body is very simple (undoubtedly simpler than the excerpt below) so without knowing that Open-Shell or any other program makes use of it for their features, I decided to copy paste it into my codebase. Which works for unmodded, but won't be able to be made to work easily with your program.

    I have several things that I can do in mind:

    1. Export my own SHFillRectClr and mark it as noinline. You can perform GetProcAddress on my taskbar module (it can be ep_taskbar.<anything>.dll) and then you can hook it.
    2. Perform dynamic linking to the private SHFillRectClr by its ordinal. Much like this:
    // shlwapi.dll ordinal 279
    typedef HRESULT (*SHInvokeDefaultCommand_t)(HWND hwnd, IShellFolder* psf, LPCITEMIDLIST pidl);
    HRESULT SHInvokeDefaultCommand(HWND hwnd, IShellFolder* psf, LPCITEMIDLIST pidl)
    {
        static SHInvokeDefaultCommand_t fn = nullptr;
        if (!fn)
        {
            HMODULE h = GetModuleHandleW(L"shlwapi.dll");
            if (h)
                fn = (SHInvokeDefaultCommand_t)GetProcAddress(h, MAKEINTRESOURCEA(279));
        }
        return fn ? fn(hwnd, psf, pidl) : E_FAIL;
    }
    1. Find a way to statically link to that function so you only need to change the DLL handle to be targeting the custom taskbar.

    I'm not really familiar with Open-Shell's codebase, so apologies if some things are not feasible. I'm planning for a new EP release next week, so I hope we can find an agreement soon. Thanks!

  6. Amrsatrio commented on Jan 19, 2025

    @Amrsatrio

    Please let me know if it's my fault, explorer patcher's fault, Windows's fault

    • Not your fault (though honestly some will say that it's your fault for listening to Microsoft and using 24H2 despite the bugs and problems it has as well as compatibility with customization software such as this an EP).
    • ExplorerPatcher's fault for not being aware to how Open-Shell implements the taskbar texturing feature.
    • Windows's fault for nuking the classic taskbar in 24H2 so I had to reimplement the classic taskbar.
  7. ge0rdi commented on Jan 19, 2025

    @ge0rdi
    Member

    @Amrsatrio
    Thank you for reaching out 👍

    Because I know that function is private, exported by ordinal, and not in the public .lib files, I had to do dynamic linking or some other trick that would make it link statically to shlwapi.dll by ordinal.

    True that. Didn't realize it is not quite easy to statically import such undocumented function by ordinal.

    Export my own SHFillRectClr and mark it as noinline.
    Perform dynamic linking to the private SHFillRectClr by its ordinal.

    This won't work because we don't do inline hooking (patch code). We do IAT (import address table) hooking instead, where we change address of resolved API in given module we are hooking (ep_taskbar.5.dll in your case).

    So we can hook only directly imported API.

    Find a way to statically link to that function so you only need to change the DLL handle to be targeting the custom taskbar.

    This would work for us, though not sure if that will be feasible for you. Here is some info about importing by ordinal:
    https://stackoverflow.com/questions/48047497/how-to-statically-link-to-a-dll-function-that-is-exported-by-an-ordinal
    In theory you will need to create .lib from .def file and link with that. Though I didn't try that, so not sure what it involves exactly.

    Then there is other option, to hook ExtTextOutW that you are using in your implementation.
    I have PoC for that (I guess I'll share PR soon).
    I guess I'm fine with that (it will be done only in case of ExplorePatcher's taskbar, so hopefully it will be safe), though it would be better if we can hook just the same API as with original taskbar.

    Anyways, thank you for your insights and your hard work on taskbar reimplementation.

  8. added a commit that references this issue on Jan 19, 2025
    6fa1b9c
  9. ge0rdi commented on Jan 19, 2025

    @ge0rdi
    Member

    Build from #2107 PR should make taskbar texturing work with ExplorerPatcher.
    Anyone, feel free to test.

    I will wait for @Amrsatrio regarding static import of SHFillRectClr. And if that turns to be not feasible for them, I guess we can go with changes proposed in the PR.

  10. Amrsatrio commented on Jan 19, 2025

    @Amrsatrio

    Static importing SHFillRectClr would require me making a dummy "shlwapi.dll" project. But if the ExtTextOutW hook works for you I guess we can settle with it. Make sure you check options to be ETO_OPAQUE, lpString to be nullptr, c to be 0, and lpDx to be nullptr for extra safety.

    STDAPI_(void) SHFillRectClr(HDC hdc, LPRECT prc, COLORREF clr)
    {
        COLORREF clrSave = SetBkColor(hdc, clr);
        ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, prc, nullptr, 0, nullptr);
        SetBkColor(hdc, clrSave);
    }
  11. added a commit that references this issue on Jan 26, 2025
    8a3cf28
  12. ge0rdi commented on Jan 26, 2025

    @ge0rdi
    Member

    Static importing SHFillRectClr would require me making a dummy "shlwapi.dll" project.

    Actually you just need to create dummy shlwapi.lib file once.

    First create shlwapi.def:

    LIBRARY	shlwapi
    EXPORTS
    	SHFillRectClr	@197	NONAME
    

    Then convert it to shlwapi.lib using:
    lib /DEF:shlwapi.def /MACHINE:x64

    Then you just need to add the library to the list of additional dependencies in your project and create declaration of the API like this:
    extern "C" WINGDIAPI void WINAPI SHFillRectClr( HDC hdc, const RECT *pRect, COLORREF color );

    Imo it is rather simple, though ofc it is up to you whether to use it or not,

  13. MOON-STARDUST commented on Mar 12, 2025

    @MOON-STARDUST

    Hi, i'm a beginer and i don't know where do i go to fix this, can someone explain to me like i'm 5yo?

  14. added a commit that references this issue on Mar 13, 2025
    d5c5617
  15. ge0rdi commented on Mar 13, 2025

    @ge0rdi
    Member

    The change is not yet in official Open-Shell build.

    Though if you want to test it, feel free to use installer from PR build:
    https://ci.appveyor.com/project/passionate-coder/open-shell-menu/builds/51687136/artifacts

    Please, let us know if that version fixes the issue for you.

  16. MOON-STARDUST commented on Mar 13, 2025

    @MOON-STARDUST

    The change is not yet in official Open-Shell build.

    Though if you want to test it, feel free to use installer from PR build: https://ci.appveyor.com/project/passionate-coder/open-shell-menu/builds/51687136/artifacts

    Please, let us know if that version fixes the issue for you.

    It didn't work, but thanks for helping :)

  17. jcegan92 commented on Apr 3, 2025

    @jcegan92

    The change is not yet in official Open-Shell build.

    Though if you want to test it, feel free to use installer from PR build: https://ci.appveyor.com/project/passionate-coder/open-shell-menu/builds/51687136/artifacts

    Please, let us know if that version fixes the issue for you.

    This worked for me! I am on Windows 24H2 (because I am dumb). I was following a tutorial that used Explorer Patcher and Open Shell to make Windows 11 look like windows 7 when I discovered I had this bug. After downloading the posted version, The texture now goes all the way across the taskbar. Amazing 😭 thank you!

  18. ge0rdi commented on Apr 4, 2025

    @ge0rdi
    Member

    @jcegan92
    Thank you for letting us know.

    I think I'll merge those changes to master, so that they will be present in next official version.

  19. Amrsatrio commented on Aug 3, 2025

    @Amrsatrio

    @ge0rdi
    Hi, been a while, sorry for bumping. I have figured out how to statically link to private functions exported by ordinal. I will make ep_taskbar call SHFillRectClr instead of having its own implementation, so that you can use the original 10 taskbar hooking code on ep_taskbar

  20. ge0rdi commented on Aug 3, 2025

    @ge0rdi
    Member

    @Amrsatrio
    That's good to hear.
    When do you plan to release such version?

    And out of curiosity, how did you manage that?

  21. Amrsatrio commented on Aug 3, 2025

    @Amrsatrio

    Did it:
    Image
    Image

    When do you plan to release such version?

    Can't give you an ETA at the moment. I kept finding out bugs here and there.

    And out of curiosity, how did you manage that?

    Basically asked ChatGPT for an edit into my .vcxproj and corrected it myself.

    Add this to vcxproj:

      <ItemGroup Condition="'$(Platform)'=='Win32'">
        <_DefToLib Include="defs\Win32\*.def" />
      </ItemGroup>
      <ItemGroup Condition="'$(Platform)'!='Win32'">
        <_DefToLib Include="defs\Win64\*.def" />
      </ItemGroup>
      <Target Name="_GenerateDefLib"
              BeforeTargets="Link"
              Inputs="@(_DefToLib)"
              Outputs="@(_DefToLib->'$(IntDir)%(Filename).lib')">
        <Exec Command="lib /nologo /def:&quot;%(_DefToLib.Identity)&quot; /machine:$(PlatformShortName) /out:&quot;$(IntDir)%(Filename).lib&quot;"/>
      </Target>
      <PropertyGroup>
        <_GeneratedLibs>@(_DefToLib->'%(Filename).lib')</_GeneratedLibs>
      </PropertyGroup>
      <ItemDefinitionGroup>
        <Link>
          <AdditionalLibraryDirectories>$(IntDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
          <AdditionalDependencies>$(_GeneratedLibs);%(AdditionalDependencies)</AdditionalDependencies>
        </Link>
      </ItemDefinitionGroup>

    defs\Win64\shlwapip.def:

    LIBRARY SHLWAPI
    EXPORTS
        IUnknown_QueryStatus @163 NONAME
        IUnknown_Exec @164 NONAME
        SHLoadMenuPopup @177 NONAME
        SHFillRectClr @197 NONAME
        SHIsChildOrSelf @204 NONAME
        SHPinDllOfCLSID @236 NONAME
        SHInvokeDefaultCommand @279 NONAME
        SHGetMachineInfo @413 NONAME
        SHExpandEnvironmentStringsW @460 NONAME
        SHGetObjectCompatFlags @476 NONAME
        IUnknown_TranslateAcceleratorIO @478 NONAME
        IUnknown_UIActivateIO @479 NONAME
        IUnknown_HasFocusIO @481 NONAME
        IUnknown_QueryServiceExec @484 NONAME
        IUnknown_OnFocusChangeIS @509 NONAME
        SHAreIconsEqual @548 NONAME
    

    defs\Win32\shlwapip.def:

    LIBRARY SHLWAPI
    EXPORTS
        IUnknown_QueryStatus@20 @163 NONAME
        IUnknown_Exec@24 @164 NONAME
        SHLoadMenuPopup@8 @177 NONAME
        SHFillRectClr@12 @197 NONAME
        SHIsChildOrSelf@8 @204 NONAME
        SHPinDllOfCLSID@4 @236 NONAME
        SHInvokeDefaultCommand@12 @279 NONAME
        SHGetMachineInfo@4 @413 NONAME
        SHExpandEnvironmentStringsW@12 @460 NONAME
        SHGetObjectCompatFlags@8 @476 NONAME
        IUnknown_TranslateAcceleratorIO@8 @478 NONAME
        IUnknown_UIActivateIO@12 @479 NONAME
        IUnknown_HasFocusIO@4 @481 NONAME
        IUnknown_QueryServiceExec@28 @484 NONAME
        IUnknown_OnFocusChangeIS@12 @509 NONAME
        SHAreIconsEqual@8 @548 NONAME
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working right.app compatibilityIssues regarding compatibility with external programs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions