diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fdca1e..f05f56b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,220 +38,220 @@ jobs: runs-on: windows-latest steps: - - name: Print inputs - shell: bash - run: | - echo "ref: ${{ github.event.inputs.ref }}" - echo "config: ${{ github.event.inputs.config }}" - echo "build_dir: ${{ github.event.inputs.build_dir }}" + - name: Print inputs + shell: bash + run: | + echo "ref: ${{ github.event.inputs.ref }}" + echo "config: ${{ github.event.inputs.config }}" + echo "build_dir: ${{ github.event.inputs.build_dir }}" - - name: Checkout latest build and submodules - uses: actions/checkout@v4 - if: github.event.inputs.ref == '' - with: - submodules: recursive - - - name: Checkout specific build and submodules - uses: actions/checkout@v4 - if: github.event.inputs.ref != '' - with: - ref: ${{ github.event.inputs.ref }} - submodules: recursive + - name: Checkout latest build and submodules + uses: actions/checkout@v4 + if: github.event.inputs.ref == '' + with: + submodules: recursive - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 - - - name: Declare some variables - id: vars - shell: bash - run: | - echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT - echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Enable SimpleWindowSwitcher support for newer Windows SDKs - shell: cmd - run: | - cd libs/sws - C:\msys64\usr\bin\wget.exe https://github.com/valinet/sws/commit/972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch - C:\msys64\usr\bin\dos2unix.exe 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch - C:\msys64\usr\bin\dos2unix.exe SimpleWindowSwitcher/sws_def.h - C:\msys64\usr\bin\patch.exe -N SimpleWindowSwitcher/sws_def.h 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch - C:\msys64\usr\bin\unix2dos.exe SimpleWindowSwitcher/sws_def.h - exit /b 0 - - - name: Setup NuGet - uses: nuget/setup-nuget@v2 - - - name: Restore NuGet packages - run: | - nuget restore ExplorerPatcher.sln + - name: Checkout specific build and submodules + uses: actions/checkout@v4 + if: github.event.inputs.ref != '' + with: + ref: ${{ github.event.inputs.ref }} + submodules: recursive - - name: Download ep_taskbar - uses: robinraju/release-downloader@v1 - with: - repository: ExplorerPatcher/ep_taskbar_releases - fileName: ep_taskbar.*.dll - latest: true - out-file-path: build/Release + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 - # build/Release/ep_taskbar.*.amd64.dll -> build/Release/x64/ep_taskbar.*.dll - # build/Release/ep_taskbar.*.arm64.dll -> build/Release/ARM64/ep_taskbar.*.dll - - name: Move ep_taskbar - shell: bash - run: | - if ls build/Release/ep_taskbar.*.amd64.dll 1> /dev/null 2>&1; then - mkdir -p build/Release/x64 - for file in build/Release/ep_taskbar.*.amd64.dll; do - mv "$file" "build/Release/x64/$(basename "$file" .amd64.dll).dll" - done - fi + - name: Declare some variables + id: vars + shell: bash + run: | + echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT + echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - if ls build/Release/ep_taskbar.*.arm64.dll 1> /dev/null 2>&1; then - mkdir -p build/Release/ARM64 - for file in build/Release/ep_taskbar.*.arm64.dll; do - mv "$file" "build/Release/ARM64/$(basename "$file" .arm64.dll).dll" - done - fi + - name: Enable SimpleWindowSwitcher support for newer Windows SDKs + shell: cmd + run: | + cd libs/sws + C:\msys64\usr\bin\wget.exe https://github.com/valinet/sws/commit/972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch + C:\msys64\usr\bin\dos2unix.exe 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch + C:\msys64\usr\bin\dos2unix.exe SimpleWindowSwitcher/sws_def.h + C:\msys64\usr\bin\patch.exe -N SimpleWindowSwitcher/sws_def.h 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch + C:\msys64\usr\bin\unix2dos.exe SimpleWindowSwitcher/sws_def.h + exit /b 0 - - name: Build funchook amd64 - shell: powershell - run: | - cd libs/funchook - md build - cd build - cmake -G "Visual Studio 17 2022" -A x64 -DFUNCHOOK_CPU=x86 .. - (gc .\funchook-static.vcxproj) -replace 'MultiThreadedDLL', 'MultiThreaded' | Out-File .\funchook-static.vcxproj - cmake --build . --config Release + - name: Setup NuGet + uses: nuget/setup-nuget@v2 - - name: Build funchook arm64 - shell: powershell - run: | - cd libs/funchook - md build-arm64 - cd build-arm64 - cmake -G "Visual Studio 17 2022" -A ARM64 -DFUNCHOOK_CPU=arm64 -DFUNCHOOK_DISASM=capstone -DFUNCHOOK_BUILD_TESTS=OFF .. - (gc .\funchook-static.vcxproj) -replace 'MultiThreadedDLL', 'MultiThreaded' | Out-File .\funchook-static.vcxproj - cmake --build . --config Release - - - name: Build EP IA-32 - if: github.event.inputs.config == '' - working-directory: ${{env.GITHUB_WORKSPACE}} - run: | - msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}} + - name: Restore NuGet packages + run: | + nuget restore ExplorerPatcher.sln - - name: Build EP amd64 - if: github.event.inputs.config == '' - working-directory: ${{env.GITHUB_WORKSPACE}} - run: | - msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}} + # - name: Download ep_taskbar + # uses: robinraju/release-downloader@v1 + # with: + # repository: ExplorerPatcher/ep_taskbar_releases + # fileName: ep_taskbar.*.dll + # latest: true + # out-file-path: build/Release - - name: Build EP arm64 - if: github.event.inputs.config == '' - working-directory: ${{env.GITHUB_WORKSPACE}} - run: | - msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 /p:WithArm64XBinaries=true ${{env.SOLUTION_FILE_PATH}} + # build/Release/ep_taskbar.*.amd64.dll -> build/Release/x64/ep_taskbar.*.dll + # build/Release/ep_taskbar.*.arm64.dll -> build/Release/ARM64/ep_taskbar.*.dll + # - name: Move ep_taskbar + # shell: bash + # run: | + # if ls build/Release/ep_taskbar.*.amd64.dll 1> /dev/null 2>&1; then + # mkdir -p build/Release/x64 + # for file in build/Release/ep_taskbar.*.amd64.dll; do + # mv "$file" "build/Release/x64/$(basename "$file" .amd64.dll).dll" + # done + # fi + # + # if ls build/Release/ep_taskbar.*.arm64.dll 1> /dev/null 2>&1; then + # mkdir -p build/Release/ARM64 + # for file in build/Release/ep_taskbar.*.arm64.dll; do + # mv "$file" "build/Release/ARM64/$(basename "$file" .arm64.dll).dll" + # done + # fi - - name: Build EP custom - if: github.event.inputs.config != '' - working-directory: ${{env.GITHUB_WORKSPACE}} - run: | - msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{ github.event.inputs.config }} ${{env.SOLUTION_FILE_PATH}} + - name: Build funchook amd64 + shell: powershell + run: | + cd libs/funchook + md build + cd build + cmake -G "Visual Studio 17 2022" -A x64 -DFUNCHOOK_CPU=x86 .. + (gc .\funchook-static.vcxproj) -replace 'MultiThreadedDLL', 'MultiThreaded' | Out-File .\funchook-static.vcxproj + cmake --build . --config Release - - name: Create expected build directory - if: github.event.inputs.build_dir != '' - shell: bash - run: | - mkdir build - cp -r ${{ github.event.inputs.build_dir }}/Release build/Release - - - name: Generate dxgi.dll - shell: bash - run: | - if [[ -f "build/Release/x64/ExplorerPatcher.amd64.dll" ]]; then cp build/Release/x64/ExplorerPatcher.amd64.dll build/Release/x64/dxgi.dll; fi - if [[ -f "build/Release/ARM64/ExplorerPatcher.arm64.dll" ]]; then cp build/Release/ARM64/ExplorerPatcher.arm64.dll build/Release/ARM64/dxgi.dll; fi + - name: Build funchook arm64 + shell: powershell + run: | + cd libs/funchook + md build-arm64 + cd build-arm64 + cmake -G "Visual Studio 17 2022" -A ARM64 -DFUNCHOOK_CPU=arm64 -DFUNCHOOK_DISASM=capstone -DFUNCHOOK_BUILD_TESTS=OFF .. + (gc .\funchook-static.vcxproj) -replace 'MultiThreadedDLL', 'MultiThreaded' | Out-File .\funchook-static.vcxproj + cmake --build . --config Release - - name: Patch amd64 setup - shell: cmd - run: | - if exist "build\Release\x64\ExplorerPatcher.amd64.dll" ( - "build\Release\x64\ep_setup_patch.exe" "build\Release\x64\ExplorerPatcher.amd64.dll" "build\Release\x64\ep_setup.exe" - ) - exit /b 0 + - name: Build EP IA-32 + if: github.event.inputs.config == '' + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}} - - name: Patch arm64 setup - shell: cmd - run: | - if exist "build\Release\ARM64\ExplorerPatcher.arm64.dll" ( - "build\Release\x64\ep_setup_patch.exe" "build\Release\ARM64\ExplorerPatcher.arm64.dll" "build\Release\ARM64\ep_setup.exe" - ) - exit /b 0 + - name: Build EP amd64 + if: github.event.inputs.config == '' + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}} - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ep_bin_multi_${{ steps.vars.outputs.sha_short }}_${{ steps.vars.outputs.branch }} - path: | - build/Release/ + - name: Build EP arm64 + if: github.event.inputs.config == '' + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 /p:WithArm64XBinaries=true ${{env.SOLUTION_FILE_PATH}} - # build/Release/x64/ep_setup.exe -> build/Release/ep_setup.exe - # build/Release/ARM64/ep_setup.exe -> build/Release/ep_setup.arm64.exe - - name: Stage files for release - if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' - shell: bash - run: | - if [ -d "build/Release/x64" ] && ls build/Release/x64/ep_setup.exe 1> /dev/null 2>&1; then - cp build/Release/x64/ep_setup.exe build/Release/ep_setup.exe - fi - if [ -d "build/Release/ARM64" ] && ls build/Release/ARM64/ep_setup.exe 1> /dev/null 2>&1; then - cp build/Release/ARM64/ep_setup.exe build/Release/ep_setup.arm64.exe - fi + - name: Build EP custom + if: github.event.inputs.config != '' + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{ github.event.inputs.config }} ${{env.SOLUTION_FILE_PATH}} - - name: Generate release name - shell: bash - working-directory: build/Release/x64 - if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' - run: | - echo "data=$(./ep_generate_release_name.exe)" >> $GITHUB_OUTPUT - id: release_name - - - name: Generate release notes - shell: bash - working-directory: build/Release/x64 - if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' - run: | - echo "data<> $GITHUB_OUTPUT - echo "$(./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_OUTPUT - echo "EP_RELEASE_DESCRIPTION_DELIM" >> $GITHUB_OUTPUT - id: release_description - - - name: Create/update release (valinet) - uses: softprops/action-gh-release@v2 - if: github.repository_owner == 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == '' - id: create_release - with: - draft: false - prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }} - name: ${{ steps.release_name.outputs.data }} - tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }} - body: ${{ steps.release_description.outputs.data }} - files: | - build/Release/ep_setup.exe - build/Release/ep_setup.arm64.exe - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - - name: Create/update release (forks) - uses: softprops/action-gh-release@v2 - if: github.repository_owner != 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == '' - id: create_release_fork - with: - draft: false - prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }} - name: ${{ steps.release_name.outputs.data }} - tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }} - body: ${{ steps.release_description.outputs.data }} - files: | - build/Release/ep_setup.exe - build/Release/ep_setup.arm64.exe - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create expected build directory + if: github.event.inputs.build_dir != '' + shell: bash + run: | + mkdir build + cp -r ${{ github.event.inputs.build_dir }}/Release build/Release + + - name: Generate dxgi.dll + shell: bash + run: | + if [[ -f "build/Release/x64/ExplorerPatcher.amd64.dll" ]]; then cp build/Release/x64/ExplorerPatcher.amd64.dll build/Release/x64/dxgi.dll; fi + if [[ -f "build/Release/ARM64/ExplorerPatcher.arm64.dll" ]]; then cp build/Release/ARM64/ExplorerPatcher.arm64.dll build/Release/ARM64/dxgi.dll; fi + + - name: Patch amd64 setup + shell: cmd + run: | + if exist "build\Release\x64\ExplorerPatcher.amd64.dll" ( + "build\Release\x64\ep_setup_patch.exe" "build\Release\x64\ExplorerPatcher.amd64.dll" "build\Release\x64\ep_setup.exe" + ) + exit /b 0 + + - name: Patch arm64 setup + shell: cmd + run: | + if exist "build\Release\ARM64\ExplorerPatcher.arm64.dll" ( + "build\Release\x64\ep_setup_patch.exe" "build\Release\ARM64\ExplorerPatcher.arm64.dll" "build\Release\ARM64\ep_setup.exe" + ) + exit /b 0 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ep_bin_multi_${{ steps.vars.outputs.sha_short }}_${{ steps.vars.outputs.branch }} + path: | + build/Release/ + + # build/Release/x64/ep_setup.exe -> build/Release/ep_setup.exe + # build/Release/ARM64/ep_setup.exe -> build/Release/ep_setup.arm64.exe + - name: Stage files for release + if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' + shell: bash + run: | + if [ -d "build/Release/x64" ] && ls build/Release/x64/ep_setup.exe 1> /dev/null 2>&1; then + cp build/Release/x64/ep_setup.exe build/Release/ep_setup.exe + fi + if [ -d "build/Release/ARM64" ] && ls build/Release/ARM64/ep_setup.exe 1> /dev/null 2>&1; then + cp build/Release/ARM64/ep_setup.exe build/Release/ep_setup.arm64.exe + fi + + - name: Generate release name + shell: bash + working-directory: build/Release/x64 + if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' + run: | + echo "data=$(./ep_generate_release_name.exe)" >> $GITHUB_OUTPUT + id: release_name + + - name: Generate release notes + shell: bash + working-directory: build/Release/x64 + if: github.ref == 'refs/heads/master' && github.event.inputs.ref == '' + run: | + echo "data<> $GITHUB_OUTPUT + echo "$(./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_OUTPUT + echo "EP_RELEASE_DESCRIPTION_DELIM" >> $GITHUB_OUTPUT + id: release_description + + - name: Create/update release (valinet) + uses: softprops/action-gh-release@v2 + if: github.repository_owner == 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == '' + id: create_release + with: + draft: false + prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }} + name: ${{ steps.release_name.outputs.data }} + tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }} + body: ${{ steps.release_description.outputs.data }} + files: | + build/Release/ep_setup.exe + build/Release/ep_setup.arm64.exe + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + + - name: Create/update release (forks) + uses: softprops/action-gh-release@v2 + if: github.repository_owner != 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == '' + id: create_release_fork + with: + draft: false + prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }} + name: ${{ steps.release_name.outputs.data }} + tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }} + body: ${{ steps.release_description.outputs.data }} + files: | + build/Release/ep_setup.exe + build/Release/ep_setup.arm64.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1feed..9193a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,17 +2,23 @@ This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub. -## 22621.3810.66 - -##### 1 +## 22621.3880.66 Tested on OS builds 19045.4598, 22621.3296, 22621.3810, 26120.961, and 26244.5000. (Note: 22621 and 22631 share the same OS files) +##### 1 + * Taskbar10: Introduced a new taskbar implementation: Windows 10 (ExplorerPatcher). (146070d, 0b86e55) * You can try this implementation out by changing the "Taskbar style" to "Windows 10 (ExplorerPatcher)". * For now, this is **only available for builds 22621, 22631, and 22635.** Other builds will not have the option. * Refer to [this wiki article](https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation) for more information including important ones. +##### 2 + +* Taskbar10: Due to false positive antivirus detections, the new taskbar implementation is no longer bundled in the setup program. (48c2a75) + * If you want to use the new taskbar implementation, you can download the appropriate DLL for your system from the [Releases](https://github.com/ExplorerPatcher/ep_taskbar_releases/releases/latest) page of its releases repository, and then manually putting it in `C:\Program Files\ExplorerPatcher` without the architecture specifier. + * For example, for 226xx builds on x64-based systems, download `ep_taskbar.2.amd64.dll`, rename to `ep_taskbar.2.dll`, and lastly put it in `C:\Program Files\ExplorerPatcher`. + ## 22621.3527.65 Tested on OS builds 22621.3296, 22621.3447, 22621.3527, 22635.3566, 26058.1000, 26120.461, and 26200.5001. (Note: 22621 and 22631 share the same OS files) diff --git a/ExplorerPatcher/ImmersiveColor.h b/ExplorerPatcher/ImmersiveColor.h index 5c002fe..fe9840f 100644 --- a/ExplorerPatcher/ImmersiveColor.h +++ b/ExplorerPatcher/ImmersiveColor.h @@ -2,76 +2,7 @@ #include -enum IMMERSIVE_COLOR_TYPE -{ - // Defining only used ones - IMCLR_SystemAccentLight2 = 2, - IMCLR_SystemAccentDark2 = 6 -}; - -struct IMMERSIVE_COLOR_PREFERENCE -{ - DWORD crStartColor; - DWORD crAccentColor; -}; - -enum IMMERSIVE_HC_CACHE_MODE -{ - IHCM_USE_CACHED_VALUE = 0, - IHCM_REFRESH = 1 -}; - -typedef bool (*RefreshImmersiveColorPolicyState_t)(); // 104 -inline bool RefreshImmersiveColorPolicyState() -{ - static RefreshImmersiveColorPolicyState_t fn; - if (!fn) - { - HMODULE h = GetModuleHandleW(L"uxtheme.dll"); - if (h) - fn = (RefreshImmersiveColorPolicyState_t)GetProcAddress(h, MAKEINTRESOURCEA(104)); - } - return fn ? fn() : false; -} - -typedef bool (*GetIsImmersiveColorUsingHighContrast_t)(IMMERSIVE_HC_CACHE_MODE); // 106 -inline bool GetIsImmersiveColorUsingHighContrast(IMMERSIVE_HC_CACHE_MODE mode) -{ - static GetIsImmersiveColorUsingHighContrast_t fn; - if (!fn) - { - HMODULE h = GetModuleHandleW(L"uxtheme.dll"); - if (h) - fn = (GetIsImmersiveColorUsingHighContrast_t)GetProcAddress(h, MAKEINTRESOURCEA(106)); - } - return fn ? fn(mode) : false; -} - -typedef HRESULT (*GetUserColorPreference_t)(IMMERSIVE_COLOR_PREFERENCE*, bool); // 120 -inline HRESULT GetUserColorPreference(IMMERSIVE_COLOR_PREFERENCE* pcpColorPreference, bool fForceReload) -{ - static GetUserColorPreference_t fn; - if (!fn) - { - HMODULE h = GetModuleHandleW(L"uxtheme.dll"); - if (h) - fn = (GetUserColorPreference_t)GetProcAddress(h, MAKEINTRESOURCEA(120)); - } - return fn ? fn(pcpColorPreference, fForceReload) : E_FAIL; -} - -typedef DWORD (*GetColorFromPreference_t)(const IMMERSIVE_COLOR_PREFERENCE*, IMMERSIVE_COLOR_TYPE, bool, IMMERSIVE_HC_CACHE_MODE); // 121 -inline DWORD GetColorFromPreference(const IMMERSIVE_COLOR_PREFERENCE* cpcpPreference, IMMERSIVE_COLOR_TYPE colorType, bool fNoHighContrast, IMMERSIVE_HC_CACHE_MODE mode) -{ - static GetColorFromPreference_t fn; - if (!fn) - { - HMODULE h = GetModuleHandleW(L"uxtheme.dll"); - if (h) - fn = (GetColorFromPreference_t)GetProcAddress(h, MAKEINTRESOURCEA(121)); - } - return fn ? fn(cpcpPreference, colorType, fNoHighContrast, mode) : 0; -} +#include "utility.h" class CImmersiveColor { diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 6a86887..a36914e 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -2121,10 +2121,12 @@ INT64 ReBarWindow32SubclassProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wPar return DefSubclassProc(hWnd, uMsg, wParam, lParam); } +HMODULE g_hMyTaskbar; + HMENU explorer_LoadMenuW(HINSTANCE hInstance, LPCWSTR lpMenuName) { HMENU hMenu = LoadMenuW(hInstance, lpMenuName); - if (hInstance == GetModuleHandle(NULL) && lpMenuName == MAKEINTRESOURCEW(205)) + if ((hInstance == GetModuleHandle(NULL) || (g_hMyTaskbar && hInstance == g_hMyTaskbar)) && lpMenuName == MAKEINTRESOURCEW(205)) { HMENU hSubMenu = GetSubMenu(hMenu, 0); if (hSubMenu) @@ -12210,6 +12212,7 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const wprintf(L"[TB] '%s' not found\n", pszTaskbarDll); return NULL; } + g_hMyTaskbar = hMyTaskbar; typedef DWORD (*GetVersion_t)(); GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, "GetVersion"); @@ -12909,15 +12912,19 @@ DWORD Inject(BOOL bIsExplorer) HANDLE hUxtheme = LoadLibraryW(L"uxtheme.dll"); - SetPreferredAppMode = GetProcAddress(hUxtheme, (LPCSTR)0x87); - AllowDarkModeForWindow = GetProcAddress(hUxtheme, (LPCSTR)0x85); - ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x84); - ShouldSystemUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x8A); - GetThemeName = GetProcAddress(hUxtheme, (LPCSTR)0x4A); - PeopleBand_DrawTextWithGlowFunc = GetProcAddress(hUxtheme, (LPCSTR)0x7E); + GetThemeName = (GetThemeName_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(74)); + RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyState_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(104)); + GetIsImmersiveColorUsingHighContrast = (GetIsImmersiveColorUsingHighContrast_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(106)); + GetUserColorPreference = (GetUserColorPreference_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(120)); + GetColorFromPreference = (GetColorFromPreference_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(121)); + PeopleBand_DrawTextWithGlowFunc = GetProcAddress(hUxtheme, MAKEINTRESOURCEA(126)); + ShouldAppsUseDarkMode = (ShouldAppsUseDarkMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(132)); + AllowDarkModeForWindow = (AllowDarkModeForWindow_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133)); + SetPreferredAppMode = (SetPreferredAppMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135)); + ShouldSystemUseDarkMode = (ShouldSystemUseDarkMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(138)); if (bOldTaskbar) { - VnPatchIAT(hExplorer, "uxtheme.dll", (LPCSTR)0x7E, PeopleBand_DrawTextWithGlowHook); + VnPatchIAT(hExplorer, "uxtheme.dll", MAKEINTRESOURCEA(126), PeopleBand_DrawTextWithGlowHook); } // DwmExtendFrameIntoClientArea hooked in LoadSettings printf("Setup uxtheme functions done\n"); @@ -13117,6 +13124,11 @@ DWORD Inject(BOOL bIsExplorer) VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW); HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); + if (hMyTaskbar) + { + VnPatchIAT(hMyTaskbar, "user32.dll", "LoadMenuW", explorer_LoadMenuW); + VnPatchIAT(hMyTaskbar, "user32.dll", "TrackPopupMenuEx", explorer_TrackPopupMenuExHook); + } printf("Setup twinui.pcshell functions done\n"); diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index c3a189e..94358f6 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -32,6 +32,12 @@ #define WM_MSG_GUI_SECTION WM_USER + 1 #define WM_MSG_GUI_SECTION_GET 1 +#ifdef __cplusplus +#define EP_INLINE inline +#else +#define EP_INLINE +#endif + #ifdef __cplusplus extern "C" { #endif @@ -98,10 +104,7 @@ DEFINE_GUID(IID_ITrayUIComponent, 0x64, 0xb4, 0xc0, 0x9b, 0x21, 0x1b ); -#ifdef __cplusplus -inline -#endif -HRESULT(*explorer_TrayUI_CreateInstanceFunc)(ITrayUIHost* host, REFIID riid, void** ppv); +EP_INLINE HRESULT(*explorer_TrayUI_CreateInstanceFunc)(ITrayUIHost* host, REFIID riid, void** ppv); #pragma endregion inline int FileExistsW(wchar_t* file) @@ -144,10 +147,7 @@ typedef LSTATUS(*t_SHRegGetValueFromHKCUHKLM)( void* pvData, DWORD* pcbData ); -#ifdef __cplusplus -inline -#endif -t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLMFunc; +EP_INLINE t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLMFunc; inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt( PCWSTR pwszKey, @@ -217,10 +217,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt( return lRes; } -#ifdef __cplusplus -inline -#endif -HWND(WINAPI* CreateWindowInBand)( +EP_INLINE HWND(WINAPI* CreateWindowInBand)( _In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, @@ -236,30 +233,59 @@ HWND(WINAPI* CreateWindowInBand)( DWORD band ); -#ifdef __cplusplus -inline -#endif -BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); +EP_INLINE BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); -#ifdef __cplusplus -inline -#endif -BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); +EP_INLINE BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand); -#ifdef __cplusplus -inline -#endif -INT64(*SetWindowCompositionAttribute)(HWND, void*); +EP_INLINE INT64(*SetWindowCompositionAttribute)(HWND, void*); -static void(*SetPreferredAppMode)(BOOL bAllowDark); +// uxtheme.dll private functions -static void(*AllowDarkModeForWindow)(HWND hWnd, BOOL bAllowDark); +typedef enum IMMERSIVE_COLOR_TYPE +{ + // Defining only used ones + IMCLR_SystemAccentLight2 = 2, + IMCLR_SystemAccentDark2 = 6 +} IMMERSIVE_COLOR_TYPE; -static bool(*ShouldAppsUseDarkMode)(); +typedef struct IMMERSIVE_COLOR_PREFERENCE +{ + DWORD crStartColor; + DWORD crAccentColor; +} IMMERSIVE_COLOR_PREFERENCE; -static bool(*ShouldSystemUseDarkMode)(); +typedef enum IMMERSIVE_HC_CACHE_MODE +{ + IHCM_USE_CACHED_VALUE = 0, + IHCM_REFRESH = 1 +} IMMERSIVE_HC_CACHE_MODE; -static void(*GetThemeName)(void*, void*, void*); +typedef void(*GetThemeName_t)(void*, void*, void*); // 74 +EP_INLINE GetThemeName_t GetThemeName; + +typedef bool(*RefreshImmersiveColorPolicyState_t)(); // 104 +EP_INLINE RefreshImmersiveColorPolicyState_t RefreshImmersiveColorPolicyState; + +typedef bool(*GetIsImmersiveColorUsingHighContrast_t)(IMMERSIVE_HC_CACHE_MODE); // 106 +EP_INLINE GetIsImmersiveColorUsingHighContrast_t GetIsImmersiveColorUsingHighContrast; + +typedef HRESULT(*GetUserColorPreference_t)(IMMERSIVE_COLOR_PREFERENCE*, bool); // 120 +EP_INLINE GetUserColorPreference_t GetUserColorPreference; + +typedef DWORD(*GetColorFromPreference_t)(const IMMERSIVE_COLOR_PREFERENCE*, IMMERSIVE_COLOR_TYPE, bool, IMMERSIVE_HC_CACHE_MODE); // 121 +EP_INLINE GetColorFromPreference_t GetColorFromPreference; + +typedef bool(*ShouldAppsUseDarkMode_t)(); // 132 +EP_INLINE ShouldAppsUseDarkMode_t ShouldAppsUseDarkMode; + +typedef void(*AllowDarkModeForWindow_t)(HWND hWnd, BOOL bAllowDark); // 133 +EP_INLINE AllowDarkModeForWindow_t AllowDarkModeForWindow; + +typedef void(*SetPreferredAppMode_t)(BOOL bAllowDark); // 135 +EP_INLINE SetPreferredAppMode_t SetPreferredAppMode; + +typedef bool(*ShouldSystemUseDarkMode_t)(); // 138 +EP_INLINE ShouldSystemUseDarkMode_t ShouldSystemUseDarkMode; void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize); diff --git a/ep_gui/GUI.c b/ep_gui/GUI.c index c3fee54..e15912f 100644 --- a/ep_gui/GUI.c +++ b/ep_gui/GUI.c @@ -10,7 +10,6 @@ WCHAR wszThreadLanguage[LOCALE_NAME_MAX_LENGTH]; void* GUI_FileMapping = NULL; DWORD GUI_FileSize = 0; BOOL g_darkModeEnabled = FALSE; -static void(*RefreshImmersiveColorPolicyState)() = NULL; DWORD dwTaskbarPosition = 3; DWORD GUI_TaskbarStyle = 1; diff --git a/version.h b/version.h index 101bc10..f63f8ff 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22621 -#define VER_MINOR 3810 +#define VER_MINOR 3880 #define VER_BUILD_HI 66 -#define VER_BUILD_LO 1 +#define VER_BUILD_LO 2 #define VER_FLAGS VS_FF_PRERELEASE