[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "content": "name: Bug report\ndescription: Report the issue you have with ExplorerPatcher here\nlabels:\n  - bug\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        > [!WARNING]\n        > Issues regarding virus detections will be closed automatically. Discuss it in [Issue #3670](https://github.com/valinet/ExplorerPatcher/issues/3670) or [Issue #3228](https://github.com/valinet/ExplorerPatcher/issues/3228)\n\n  - type: checkboxes\n    attributes:\n      label: Before reporting your issue\n      description: Please ensure you meet the following criteria before reporting issues\n      options:\n        - label: I have confirmed that this issue does not happen when ExplorerPatcher is not installed\n        - label: I do not have \"register as shell extension\" enabled\n        - label: I have tried my best to check existing issues\n\n  - type: textarea\n    attributes:\n      label: Repro ExplorerPatcher versions\n      description: Provide the relevant versions of ExplorerPatcher for reproduction of the issue.\n      placeholder: |\n        Example:\n        ExplorerPatcher 67.1\n    validations:\n      required: true\n\n  - type: textarea\n    attributes:\n      label: Repro Windows Versions\n      description: Provide the relevant versions for reproduction of the issue. For example, Windows version, and architecture (e.g. x64 or ARM64).\n      placeholder: |\n        Example:\n        Windows 11 24H2 26100.1150 ARM64\n        Windows 11 24H2 26100.2314 ARM64\n    validations:\n      required: true\n      \n  - type: textarea\n    attributes:\n      label: 3rd party tweak software installed\n      description: A list of 3rd Party software that may modify the shell in someway.\n      placeholder: |\n        Example:\n        TranslucentTB\n        Windhawk (with disable grouping and vertical taskbar mods)\n        OpenShell\n        Nilesoft Shell\n        Wallpaper Engine\n    validations:\n      required: true\n      \n  - type: textarea\n    attributes:\n      label: Describe the bug\n      description: A clear and concise description of what the bug is. Please try to isolate the issue to ExplorerPatcher by disabling other customization software.\n      placeholder: |\n        Example:\n        1. Install EP 67.1.\n        2. Enable Windows 10 (ExplorerPatcher) taskbar and restart Explorer.\n        3. Make sure Ethernet (if available) is disconnected, and then disconnect Wi-Fi.\n        4. Turn on Personal Hotspot (iPhone) or Mobile Hotspot (Android).\n        5. Connect to the Personal Hotspot.\n        6. Observe icon changing from No Internet to Wi-Fi signal bars.\n        7. Turn off Personal Hotspot.\n        8. Observe icon staying in Wi-Fi signal bars state instead of changing to No Internet (globe icon).\n    validations:\n      required: true\n\n  - type: textarea\n    attributes:\n      label: Expected outcome\n      description: Describe what you expected to happen when performing the steps above.\n      placeholder: |\n        Example:\n        The icon of the Network tray icon changes from Wi-Fi signal bars to globe (no Internet) icon like it was on 11 23H2, 11 22H2, and previous versions.\n    validations:\n      required: true\n\n  - type: textarea\n    attributes:\n      label: Actual outcome\n      description: Describe what actually happens after performing the steps above.\n      placeholder: |\n        Example:\n        The icon is stuck in the Wi-Fi icon state, giving false impressions that the device is still connected to Wi-Fi. The icon will stay this way until Wi-Fi/Airplane Mode is toggled, or until the device is reconnected to a Wi-Fi router.\n    validations:\n      required: true\n\n  - type: textarea\n    attributes:\n      label: Additional info\n      description: Provide any additional information that may help in diagnosing the issue, such as logs, error messages, or links to related issues.\n      placeholder: |\n        Example:\n        Windows 11 build 25236 removed pnidui.dll, leaving the restoration-from-22621 method being the only option to have this icon. However, there may be interface mismatches or API updates that caused the 22621 (22H2) pnidui.dll to behave this way on 24H2. Patches to pnidui.dll may be needed in order to fix this.\n    validations:\n      required: false\n\n  - type: textarea\n    id: crashdumps\n    attributes:\n      label: Crash Dumps\n      description: In case of crashes, if possible, please upload the latest crash dumps relating to explorer.exe. Crash dumps can be found in %LOCALAPPDATA%\\CrashDumps.\n      placeholder: Drop or paste crash dumps to upload.\n    validations:\n      required: false\n\n  - type: textarea\n    id: screenshots\n    attributes:\n      label: Media\n      description: Add screenshots/videos to help illustrate the issue\n      placeholder: Drop or paste images or videos to upload.\n    validations:\n      required: false\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: Questions\n    about: Ask questions and receive support here\n    url: https://github.com/valinet/ExplorerPatcher/discussions/categories/q-a\n  - name: Feature requests\n    about: Suggestions for new features and enhancements here\n    url: https://github.com/valinet/ExplorerPatcher/discussions/categories/ideas\n  - name: Showcase\n    about: Show off your system or give tips and tricks here\n    url: https://github.com/valinet/ExplorerPatcher/discussions/categories/show-and-tell\n  - name: Wiki\n    about: Useful documentation on ExplorerPatcher\n    url: https://github.com/valinet/ExplorerPatcher/wiki"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "# references:\r\n# https://trstringer.com/github-actions-multiline-strings/\r\n# https://trstringer.com/github-actions-create-release-upload-artifacts/\r\n# https://github.com/Speedy37/sws/blob/444c67157a98652c4e7ffd3b6d6bbfb664071926/.github/workflows/msbuild.yml\r\n# https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action\r\n\r\nname: Build\r\n\r\non:\r\n  push:\r\n  pull_request:\r\n  workflow_dispatch:\r\n    inputs:\r\n      ref:\r\n        description: 'Commit'\r\n        required: true\r\n      config:\r\n        description: 'Configuration'\r\n        required: false\r\n      build_dir:\r\n        description: 'Build dir'\r\n        required: false\r\n\r\nenv:\r\n  SOLUTION_FILE_PATH: .\r\n  BUILD_CONFIGURATION: Release\r\n\r\npermissions:\r\n  contents: write\r\n\r\njobs:\r\n  build:\r\n    runs-on: windows-2025\r\n    timeout-minutes: 30\r\n    steps:\r\n      - name: Print inputs\r\n        shell: bash\r\n        run: |\r\n          echo \"ref: ${GITHUB_EVENT_INPUTS_REF}\"\r\n          echo \"config: ${GITHUB_EVENT_INPUTS_CONFIG}\"\r\n          echo \"build_dir: ${GITHUB_EVENT_INPUTS_BUILD_DIR}\"\r\n        env:\r\n          GITHUB_EVENT_INPUTS_REF: ${{ github.event.inputs.ref }}\r\n          GITHUB_EVENT_INPUTS_CONFIG: ${{ github.event.inputs.config }}\r\n          GITHUB_EVENT_INPUTS_BUILD_DIR: ${{ github.event.inputs.build_dir }}\r\n\r\n      - name: Checkout latest build and submodules\r\n        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2\r\n        if: github.event.inputs.ref == ''\r\n        with:\r\n          submodules: recursive\r\n          persist-credentials: false\r\n\r\n      - name: Checkout specific build and submodules\r\n        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2\r\n        if: github.event.inputs.ref != ''\r\n        with:\r\n          ref: ${{ github.event.inputs.ref }}\r\n          submodules: recursive\r\n          persist-credentials: false\r\n\r\n      - name: Add MSBuild to PATH\r\n        uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # 2.0.0\r\n\r\n      - name: Declare some variables\r\n        id: vars\r\n        shell: bash\r\n        run: |\r\n          echo \"branch=$(echo ${GITHUB_REF#refs/heads/})\" >> $GITHUB_OUTPUT\r\n          echo \"sha_short=$(git rev-parse --short HEAD)\" >> $GITHUB_OUTPUT\r\n\r\n      - name: Enable SimpleWindowSwitcher support for newer Windows SDKs\r\n        shell: cmd\r\n        run: |\r\n          cd libs/sws\r\n          C:\\msys64\\usr\\bin\\wget.exe https://github.com/valinet/sws/commit/972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch\r\n          C:\\msys64\\usr\\bin\\dos2unix.exe 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch\r\n          C:\\msys64\\usr\\bin\\dos2unix.exe SimpleWindowSwitcher/sws_def.h\r\n          C:\\msys64\\usr\\bin\\patch.exe -N SimpleWindowSwitcher/sws_def.h 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch\r\n          C:\\msys64\\usr\\bin\\unix2dos.exe SimpleWindowSwitcher/sws_def.h\r\n          exit /b 0\r\n\r\n      - name: Setup NuGet\r\n        uses: nuget/setup-nuget@323ab0502cd38fdc493335025a96c8fdb0edc71f # 2.0.1\r\n        with:\r\n          nuget-version: '7.x'\r\n\r\n      - name: Restore NuGet packages\r\n        run: |\r\n          nuget restore ExplorerPatcher.sln\r\n\r\n      - name: Build dependencies\r\n        shell: cmd\r\n        run: |\r\n          BuildDependencies%BUILD_CONFIGURATION%.bat\r\n\r\n      - name: Download ep_taskbar\r\n        uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # 1.12\r\n        with:\r\n          repository: ExplorerPatcher/ep_taskbar_releases\r\n          fileName: ep_taskbar.*.dll\r\n          latest: true\r\n          out-file-path: build/Release\r\n\r\n      # build/Release/ep_taskbar.*.amd64.dll -> build/Release/x64/ep_taskbar.*.dll\r\n      # build/Release/ep_taskbar.*.arm64.dll -> build/Release/ARM64/ep_taskbar.*.dll\r\n      - name: Move ep_taskbar\r\n        shell: bash\r\n        run: |\r\n          if ls build/Release/ep_taskbar.*.amd64.dll 1> /dev/null 2>&1; then\r\n            mkdir -p build/Release/x64\r\n            for file in build/Release/ep_taskbar.*.amd64.dll; do\r\n              mv \"$file\" \"build/Release/x64/$(basename \"$file\" .amd64.dll).dll\"\r\n            done\r\n          fi\r\n\r\n          if ls build/Release/ep_taskbar.*.arm64.dll 1> /dev/null 2>&1; then\r\n            mkdir -p build/Release/ARM64\r\n            for file in build/Release/ep_taskbar.*.arm64.dll; do\r\n              mv \"$file\" \"build/Release/ARM64/$(basename \"$file\" .arm64.dll).dll\"\r\n            done\r\n          fi\r\n\r\n      - name: Build ExplorerPatcher (IA-32)\r\n        if: github.event.inputs.config == ''\r\n        working-directory: ${{env.GITHUB_WORKSPACE}}\r\n        run: |\r\n          msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}}\r\n\r\n      - name: Build ExplorerPatcher (amd64)\r\n        if: github.event.inputs.config == ''\r\n        working-directory: ${{env.GITHUB_WORKSPACE}}\r\n        run: |\r\n          msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}\r\n\r\n      - name: Build ExplorerPatcher (arm64)\r\n        if: github.event.inputs.config == ''\r\n        working-directory: ${{env.GITHUB_WORKSPACE}}\r\n        run: |\r\n          msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=arm64 /p:WithArm64XBinaries=true ${{env.SOLUTION_FILE_PATH}}\r\n\r\n      - name: Build ExplorerPatcher (Custom Build)\r\n        if: github.event.inputs.config != ''\r\n        working-directory: ${{env.GITHUB_WORKSPACE}}\r\n        run: |\r\n          msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=$env:GITHUB_EVENT_INPUTS_CONFIG ${{env.SOLUTION_FILE_PATH}}\r\n        env:\r\n          GITHUB_EVENT_INPUTS_CONFIG: ${{ github.event.inputs.config }}\r\n\r\n      - name: Create expected build directory\r\n        if: github.event.inputs.build_dir != ''\r\n        shell: bash\r\n        run: |\r\n          mkdir build\r\n          cp -r ${GITHUB_EVENT_INPUTS_BUILD_DIR}/Release build/Release\r\n        env:\r\n          GITHUB_EVENT_INPUTS_BUILD_DIR: ${{ github.event.inputs.build_dir }}\r\n\r\n      - name: Generate dxgi.dll\r\n        shell: bash\r\n        run: |\r\n          if [[ -f \"build/Release/x64/ExplorerPatcher.amd64.dll\" ]]; then cp build/Release/x64/ExplorerPatcher.amd64.dll build/Release/x64/dxgi.dll; fi\r\n          if [[ -f \"build/Release/ARM64/ExplorerPatcher.arm64.dll\" ]]; then cp build/Release/ARM64/ExplorerPatcher.arm64.dll build/Release/ARM64/dxgi.dll; fi\r\n\r\n      - name: Patch amd64 setup\r\n        shell: cmd\r\n        run: |\r\n          if exist \"build\\Release\\x64\\ExplorerPatcher.amd64.dll\" (\r\n            \"build\\Release\\x64\\ep_setup_patch.exe\" \"build\\Release\\x64\\ExplorerPatcher.amd64.dll\" \"build\\Release\\x64\\ep_setup.exe\"\r\n          )\r\n          exit /b 0\r\n\r\n      - name: Patch arm64 setup\r\n        shell: cmd\r\n        run: |\r\n          if exist \"build\\Release\\ARM64\\ExplorerPatcher.arm64.dll\" (\r\n            \"build\\Release\\x64\\ep_setup_patch.exe\" \"build\\Release\\ARM64\\ExplorerPatcher.arm64.dll\" \"build\\Release\\ARM64\\ep_setup.exe\"\r\n          )\r\n          exit /b 0\r\n\r\n      - name: Delete intermediate files\r\n        shell: bash\r\n        run: |\r\n          rm -rf build/Release/x64/ep_setup_files\r\n          rm -f build/Release/x64/ep_setup_files.zip.bin\r\n          rm -rf build/Release/ARM64/ep_setup_files\r\n          rm -f build/Release/ARM64/ep_setup_files.zip.bin\r\n\r\n      - name: Upload artifacts\r\n        if: github.event_name != 'pull_request'\r\n        uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0\r\n        with:\r\n          name: ep_bin_multi_${{ steps.vars.outputs.sha_short }}_${{ steps.vars.outputs.branch }}\r\n          path: |\r\n            build/Release/\r\n          if-no-files-found: error\r\n\r\n      # build/Release/x64/ep_setup.exe -> build/Release/ep_setup.exe\r\n      # build/Release/ARM64/ep_setup.exe -> build/Release/ep_setup_arm64.exe\r\n      - name: Stage files for release\r\n        if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''\r\n        shell: bash\r\n        run: |\r\n          if [ -d \"build/Release/x64\" ] && ls build/Release/x64/ep_setup.exe 1> /dev/null 2>&1; then\r\n            cp build/Release/x64/ep_setup.exe build/Release/ep_setup.exe\r\n          fi\r\n          if [ -d \"build/Release/ARM64\" ] && ls build/Release/ARM64/ep_setup.exe 1> /dev/null 2>&1; then\r\n            cp build/Release/ARM64/ep_setup.exe build/Release/ep_setup_arm64.exe\r\n          fi\r\n\r\n      - name: Generate release name\r\n        shell: bash\r\n        working-directory: build/Release/x64\r\n        if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''\r\n        run: |\r\n          echo \"data=$(./ep_generate_release_name.exe)\" >> $GITHUB_OUTPUT\r\n        id: release_name\r\n\r\n      - name: Generate release notes\r\n        shell: bash\r\n        working-directory: build/Release/x64\r\n        if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''\r\n        run: |\r\n          echo \"data<<EP_RELEASE_DESCRIPTION_DELIM\" >> $GITHUB_OUTPUT\r\n          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\r\n          echo \"EP_RELEASE_DESCRIPTION_DELIM\" >> $GITHUB_OUTPUT\r\n        id: release_description\r\n        env:\r\n          STEPS_VARS_OUTPUTS_SHA_SHORT: ${{ steps.vars.outputs.sha_short }}\r\n          STEPS_VARS_OUTPUTS_BRANCH: ${{ steps.vars.outputs.branch }}\r\n\r\n      - name: Create/update release (valinet)\r\n        uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # 2.5.0\r\n        if: github.repository_owner == 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == ''\r\n        id: create_release\r\n        with:\r\n          draft: false\r\n          prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }}\r\n          name: ${{ steps.release_name.outputs.data }}\r\n          tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}\r\n          body: ${{ steps.release_description.outputs.data }}\r\n          files: |\r\n            build/Release/ep_setup.exe\r\n            build/Release/ep_setup_arm64.exe\r\n        env:\r\n          GITHUB_TOKEN: ${{ secrets.PAT }}\r\n\r\n      - name: Create/update release (forks)\r\n        uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # 2.5.0\r\n        if: github.repository_owner != 'valinet' && github.ref == 'refs/heads/master' && github.event.inputs.ref == ''\r\n        id: create_release_fork\r\n        with:\r\n          draft: false\r\n          prerelease: ${{ !startsWith(github.event.head_commit.message, 'rel_') }}\r\n          name: ${{ steps.release_name.outputs.data }}\r\n          tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}\r\n          body: ${{ steps.release_description.outputs.data }}\r\n          files: |\r\n            build/Release/ep_setup.exe\r\n            build/Release/ep_setup_arm64.exe\r\n        env:\r\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\r\n\r\n\r\n"
  },
  {
    "path": ".gitignore",
    "content": "ep_private.h\n.idea/\nep_taskbar*/\nb*.bat\nc*.bat\nbuild/\n*.dll\n*.exe\n\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\n\n# User-specific files\n*.rsuser\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Mono auto generated files\nmono_crash.*\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\n[Aa][Rr][Mm]/\n[Aa][Rr][Mm]64/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n[Ll]ogs/\n\n# Visual Studio 2015/2017 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# Visual Studio 2017 auto generated files\nGenerated\\ Files/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUnit\n*.VisualState.xml\nTestResult.xml\nnunit-*.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n# StyleCop\nStyleCopReport.xml\n\n# Files built by Visual Studio\n*_i.c\n*_p.c\n*_h.h\n*.ilk\n*.meta\n*.obj\n*.iobj\n*.pch\n*.pdb\n*.ipdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*_wpftmp.csproj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# Visual Studio Trace Files\n*.e2e\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# NuGet Symbol Packages\n*.snupkg\n# The packages folder can be ignored because of Package Restore\n**/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n!**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n*.appxbundle\n*.appxupload\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!?*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Including strong name files can present a security risk\n# (https://github.com/github/gitignore/pull/2483#issue-259490424)\n#*.snk\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\nServiceFabricBackup/\n*.rptproj.bak\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n*.rptproj.rsuser\n*- [Bb]ackup.rdl\n*- [Bb]ackup ([0-9]).rdl\n*- [Bb]ackup ([0-9][0-9]).rdl\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# CodeRush personal settings\n.cr/personal\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs\n\n# OpenCover UI analysis results\nOpenCover/\n\n# Azure Stream Analytics local run output\nASALocalRun/\n\n# MSBuild Binary and Structured Log\n*.binlog\n\n# NVidia Nsight GPU debugger configuration file\n*.nvuser\n\n# MFractors (Xamarin productivity tool) working folder\n.mfractor/\n\n# Local History for Visual Studio\n.localhistory/\n\n# BeatPulse healthcheck temp database\nhealthchecksdb\n\n# Backup folder for Package Reference Convert tool in Visual Studio 2017\nMigrationBackup/\n\n# Ionide (cross platform F# VS Code tools) working folder\n.ionide/\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"libs/libvalinet\"]\n\tpath = libs/libvalinet\n\turl = https://github.com/valinet/libvalinet\n[submodule \"libs/sws\"]\n\tpath = libs/sws\n\turl = https://github.com/valinet/sws\n[submodule \"libs/zlib\"]\n\tpath = libs/zlib\n\turl = https://github.com/madler/zlib\n[submodule \"ep_dwm\"]\n\tpath = ep_dwm\n\turl = https://github.com/valinet/ep_dwm\n[submodule \"ExplorerPatcher-L10N\"]\n\tpath = ExplorerPatcher-L10N\n\turl = https://github.com/valinet/ExplorerPatcher-L10N\n"
  },
  {
    "path": "BuildDependenciesDebug.bat",
    "content": "rmdir /s /q libs\\zlib\\build\r\n\r\nif \"%VSINSTALLDIR:~-1%\"==\"\\\" (\r\n    set \"EP_VSINSTALLDIR=%VSINSTALLDIR:~0,-1%\"\r\n) else (\r\n    set \"EP_VSINSTALLDIR=%VSINSTALLDIR%\"\r\n)\r\n\r\ncmake libs/zlib -Blibs/zlib/build/x64 -G \"Visual Studio 17 2022\" -A x64 -D\"CMAKE_GENERATOR_INSTANCE:PATH=%EP_VSINSTALLDIR%\" -D\"CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>\" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW\r\ncmake libs/zlib -Blibs/zlib/build/arm64 -G \"Visual Studio 17 2022\" -A ARM64 -D\"CMAKE_GENERATOR_INSTANCE:PATH=%EP_VSINSTALLDIR%\" -D\"CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>\" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW\r\n\r\ncmake --build libs/zlib/build/x64 --config Debug\r\ncmake --build libs/zlib/build/arm64 --config Debug\r\n"
  },
  {
    "path": "BuildDependenciesRelease.bat",
    "content": "rmdir /s /q libs\\zlib\\build\r\n\r\nif \"%VSINSTALLDIR:~-1%\"==\"\\\" (\r\n    set \"EP_VSINSTALLDIR=%VSINSTALLDIR:~0,-1%\"\r\n) else (\r\n    set \"EP_VSINSTALLDIR=%VSINSTALLDIR%\"\r\n)\r\n\r\ncmake libs/zlib -Blibs/zlib/build/x64 -G \"Visual Studio 17 2022\" -A x64 -D\"CMAKE_GENERATOR_INSTANCE:PATH=%EP_VSINSTALLDIR%\" -D\"CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>\" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW\r\ncmake libs/zlib -Blibs/zlib/build/arm64 -G \"Visual Studio 17 2022\" -A ARM64 -D\"CMAKE_GENERATOR_INSTANCE:PATH=%EP_VSINSTALLDIR%\" -D\"CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>\" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW\r\n\r\ncmake --build libs/zlib/build/x64 --config Release\r\ncmake --build libs/zlib/build/arm64 --config Release\r\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Explorer Patcher Change log\n\nThis document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.\n\n## 26100.4946.69\n\nTested on OS builds 26100.4946, 26100.5074, 26200.5751, and 26220.6682.\n\n##### 1\n\n* ep_weather: Fixed \"Unable to load weather information\" due to changes in Google's side. Thanks @davids5 for the fix! (#1334, #4351) (c3c83ff)\n* Start11: Fixed hiding of Recommended Section on recent builds of 24H2. Thanks @m-wigley for the fix! (#4476) (9106226)\n* GUI: File Explorer > Title bar is now available again on >= 22H2. Thanks @SandTechStuff! (583fa53)\n* Reduced the occurrences of the Windows 11 bug in Explorer windows where `WM_SETTINGCHANGE` would scroll the folder items list to the top. (fa19402b)\n* Changed hooking library to SlimDetours. (ff30457)\n  * On ARM64, fixes incompatibilities with certain Windhawk mods that hook `CreateWindowExW` such as [Taskbar Volume Control](https://windhawk.net/mods/taskbar-volume-control).\n  * On ARM64, fixes a very slim chance bug where hooked functions would cause a crash when called until a reboot.\n* ep_taskbar: Now statically links to private functions it uses. (ab99f26)\n* Taskbar10: Fixed folder toolbar menus and Toolbars > New toolbar not working on builds with `TrayThreadBSTA` (54481602) feature flag turned on, such as 26100.5074+. (#4542) (1bbe207)\n* GUI: Windows 8 Network flyout is now no longer an option on builds >= 25346 as van.dll was removed. Thanks @m-wigley for the fix! (#4478) (72c6983)\n* On Windows 11 22H2+, Windows 10 (ExplorerPatcher) taskbar a.k.a. ep_taskbar is now used by default. (ad2fa72)\n\n##### 2\n\n* Fixed weather button not having an icon. (#4545) (6959c69)\n  * You may need to perform \"Clear weather widget local data\" in EP properties > Weather.\n\n##### 3\n\n* File Explorer: Fixed \"Shrink address bar height\" resulting in broken graphics on recent 24H2 builds. (#4552) (6d946bd)\n* Start10: Fixed open/close animation patching on x64 27938+ and ARM64 27881+. (201a7e5, 79f8dd3, f873888, 465117e, 4434d10)\n* Start10: Fixed Windows 10 Start menu refusing to open when the new Windows 11 Start menu feature flag(s) are enabled. (#4523) (afd109f)\n* Fixed Windows 10 Alt+Tab and Windows 10 taskbar Win+X functionality on ARM64 226x1 and 27686+. (18dfcd0)\n\n##### 4\n\n* File Explorer: Corrected shrunk address bar toolbar button size when Servicing_CFDNavButtonsTheming (NI: 56845961, GE: 52061322) is enabled. (#4552) (9e91030)\n\n##### 5\n\n* Start10: Fixed Windows 10 Start menu not opening on 22H2/23H2 ARM64. (c08b0a6)\n\n##### 6\n\n* File Explorer: XAML folder views are now disabled when Windows 11 Command Bar is not used. (80414f5)\n  * This fixes crashes when navigating away and returning to Home/Gallery on 22H2/23H2 (#3447), and when opening Home on 26xxx.7015+.\n* File Explorer: Fixed Alt+D not working on builds with modern (XAML) navigation bar in File Explorer. (#2847) (a80d9dc)\n* File Explorer: Mitigated breakages on builds with tabs in File Explorer: (75178ec, df7d604)\n  * Fixed menu bar behavior when Windows 7 Command Bar is used. Pressing Alt will now summon the menu bar immediately like it used to. (#2676)\n  * Fixed window position and size saving when Windows 10 Ribbon is used. (#2243)\n* Taskbar10: These settings now take effect on ep_taskbar: (#4097) (48e1de3)\n  * Pinned items act as quick launch (don't group with active apps)\n  * When the taskbar shows button labels, remove the extra gap around pinned items\n\nKnown issues we will address in the short term:\n* Changing weather icon pack to \"Microsoft\" has no effect.\n* On Nickel (Windows 11 22H2/23H2), when the new Windows 11 Start menu is enabled, using Windows 10 or Windows 10 (ExplorerPatcher) taskbar will crashloop explorer.exe.\n\n## 22631.5335.68\n\nTested on OS builds 22621.3296, 22631.5189, 22631.5335, 26100.3476, 26100.4061, and 26100.4188.\n\n##### 1\n\n* Start10: Fixed Pin to Start on 226x1.4541+ and 261xx.2454+. (#3984) (4ef3667, 123ea8b)\n* sws: Added support for 24H2. (#3765)\n* ep_dwm: Added support for 24H2. (#3555)\n* `ep_dwm.exe` has been renamed to `ep_dwm_svc.exe` to get around 24H2 upgrade blocks. (115b462)\n* ep_dwm: Now always unregistered on uninstallation, regardless of whether it was running during the uninstallation or not. (858b634)\n* Setup: The failure message now displays the associated code line number that failed, to assist in troubleshooting. (c64a17e)\n* Taskbar10: Fixed disabling immersive menus on ARM64. (8b4d8db)\n* Taskbar10: Fixed Win+X menu still having Windows Terminal entries when Windows Terminal is not installed, that crashes Explorer when selected. (1b20cbd, 207f669)\n  * For now, if you want to have PowerShell entries, Windows Terminal must be uninstalled.\n* Taskbar10: Fixed Win+X entry clicks doing nothing on 26xxx.5551+ ARM64.\n* GUI: Added dropdown indicators to dropdown entries. (9f71a5c)\n* GUI: The language names now include the country name. (3f11766)\n* Localization: Added Czech translations. (Thanks @9hb, @andrewz1986, and @Panzimy!)\n* Localization: Added Spanish (Spain) translations. (Thanks @AlejandroMartiGisbert!)\n* ep_taskbar: Added support for \"Show desktop button: Hidden\" setting. (#4020) (1be6658)\n* ep_taskbar: Fixed a bug that prevented shortcut global hotkeys from working on 24H2. (#3777, #4016)\n* ep_taskbar: Fixed a bug that prevented the taskbar from resizing properly after DPI changes. (#3796)\n* ep_taskbar: Added the following languages: German, French, Hungarian, Indonesian, Italian, Korean, Lithuanian, Dutch, Polish, Portuguese (Brazil), Romanian, Spanish (Spain), Turkish, Ukrainian, Chinese (Simplified).\n* ep_taskbar: Fixed a number of memory leaks and code/behavior inaccuracies.\n\n##### 2\n\n* ❗ **ep_taskbar: Fixed incompatibility with 26200.5603 (Dev), 26120.4151 (Beta), and 26100.4188 (Release Preview).** (#4321)\n* ep_taskbar: Now supports all Windows 10 versions supported by EP (17763/1809+). (aec8c70, 1edb989)\n\n## 22621.4317.67\n\nTested on OS builds 22621.3296, 22631.4391, 26120.961, 26100.1150, and 26100.2161.\n\n##### 1\n\n* Taskbar10: Win+X now works again on 226xx.4317+. (cc9b6b3, #3837)\n* Start10: Fixed an issue where the resource loader failed when the drive letter of the boot drive is other than C:. Thanks @ittrgrey for pointing out! (fc25c25)\n* Start10: Fixed an issue where the Start menu crashes when summoning the context menu of an item that has jump list entries on builds 226xx.4391+ and 261xx.2130+. (4978024, #3842)\n* ep_taskbar: Fixed an issue where \"Not responding\" windows are not handled properly.\n* ep_taskbar: Flashing taskbar items are now animated.\n* ep_taskbar: Narrator now describes the \"Show desktop\" button.\n* ep_taskbar: `TrayUI` class is now exported.\n* Localization: Added translations for Portuguese (Brazil). Thanks @thiagojramos!\n\n## 22621.3880.66\n\nTested on OS builds 19045.4598, 22621.3296, 22621.3810, 26120.961, and 26244.5000. (Note: 22621 and 22631 share the same OS files)\n\n##### 1\n\n* Taskbar10: Introduced a new taskbar implementation: Windows 10 (ExplorerPatcher). (146070d, 0b86e55)\n  * You can try this implementation out by changing the \"Taskbar style\" to \"Windows 10 (ExplorerPatcher)\".\n  * For now, this is **only available for builds 22621, 22631, and 22635.** Other builds will not have the option.\n  * Refer to [this wiki article](https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation) for more information including important ones.\n\n##### 2\n\n<details>\n\n* Taskbar10: Due to false positive antivirus detections, the new taskbar implementation is no longer bundled in the setup program. (48c2a75)\n  * 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.\n  * 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`.\n\n</details>\n\n##### 3\n\n* Introduced support for ARM64 devices. (992b3a6, 2e4e4f5, b76c0e4, c9884b2, 57f63ad, 78788ec, 4799b4b, 5d0d218)\n  * These builds are only tested on and made to work with 24H2 ARM64 builds. Older ARM64 Windows versions than 24H2 may not work as expected.\n* Added an \"Update now\" button into update notifications for easier updating. (2b9c747, 8c16a9a)\n* Revised how files are packed in ep_setup for smaller size and easier maintenance. (30579b0, b253625, 04fd2b7, db54ce9, 126c024, c0201ff)\n* EP's taskbar implementation for 24H2 is now available in [its releases repository](https://github.com/ExplorerPatcher/ep_taskbar_releases/releases/latest), as `ep_taskbar.5.dll`. If you want to try this out, follow the steps explained above.\n\n##### 4\n\nWith this update, ExplorerPatcher is now officially compatible and supported on Windows 11 24H2 🥳🎉\n\n* Start10: Now works again on 24H2 and 226xx.3930+. (755f101, 7e0f7eb, b473114)\n* Taskbar10: EP's taskbar DLLs are now included again in the setup files. (d9595fc)\n* Taskbar10: Network icon now shows again on 24H2. (7e0f7eb, b473114)\n* Start10: Fixed positioning when the taskbar is not placed at the bottom, on 24H2 and latest 22H2/23H2 builds. (de2532d, ea5881f)\n* Taskbar10: Fixed taskbar jump list flyout positioning when the taskbar is not placed at the bottom, on latest 22H2/23H2/24H2 builds. (39609e4)\n* Setup: Updated the code for dealing with locked files, this should reduce the chances of getting setup failures due to locked files. (7e0f7eb)\n* ep_taskbar: Fixed tray icons not being saved.\n* ep_taskbar: Removed the Copilot button on 22H2.\n\n##### 5\n\n* Taskbar10: Fixed jump list positioning patch on latest builds with `TaskbarJumplistOnHover` feature flag. (#3615) (351a020)\n* Taskbar11: Fixed Task Manager menu entry doing nothing on 24H2+. (#3021, #3556) (060066c)\n* Start10: Fixed symbols mechanism when custom `StartUI_.dll` is used. (0f38628)\n* Start10: Increased reliability of ARM64 patterns for restoring the animations and fixing positioning. (#3566) (2ea3894)\n* ep_taskbar: Fixed the task band not having a handle when the taskbar is unlocked.\n* ep_taskbar: Fixed scroll arrows in window list popups (`ExtendedUI`) having weird appearance and behavior.\n\n##### 6\n\n* Updates: Fixed a bug where empty UpdateURL registry values would break the updates system. (#3668) (ac14c75)\n* Setup: Cleaned some unneeded stuff in the setup binary. (9811810)\n* Misc: Restored exported functions for launching/restarting Explorer: `ZZLaunchExplorer`, `ZZLaunchExplorerDelayed`, and `ZZRestartExplorer`. (9811810)\n\n##### 7\n\n* Taskbar10: The registry key for the \"Combine taskbar labels\" setting is no longer redirected. (eb1f1ec, 2a6fb15)\n  * This means you can now configure this reliably both from EP's Properties dialog and the Settings app.\n  * If you are using EP with Windows 11 taskbar on Windows 11 builds before 226x1.2361 (builds without the Never Combine option on the Windows 11 taskbar), please make sure that this is set to \"Always\" to prevent issues.\n* ep_taskbar: Now supports EP Weather. (#3546)\n* ep_taskbar: Disabled app icon animations in the notification center button due to crashes when receiving a large number of notifications. (#3605)\n* ep_taskbar: Fixed an issue where fallback UWP app icons do not show up, such as [Okular](https://okular.kde.org)'s. (#3754)\n* ep_taskbar: Fixed an issue where the primary taskbar's monitor location is not remembered. (#3719)\n* ep_taskbar: Implemented Win+X hotkey. (#3671)\n* ep_taskbar: Initial support for [Windhawk](https://windhawk.net) mods. The following classes are now exported: `ClockButton`, `CTaskListThumbnailWnd`, `CTaskBand`, `CTaskBand::CLauncherTask`, `CTaskBtnGroup`, `CWindowTaskItem`, `CImmersiveTaskItem`, `CTaskGroup`, `TaskItemFilter`, `CTaskListWnd`, and `CTaskThumbnail`. (#3769)\n  * Check [this list](https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation#windhawk-mods-support) for compatibility info.\n  * The mods themselves need to be manually updated to support ep_taskbar. Please contact the respective mod authors for this.\n\n## 22621.3527.65\n\nTested 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)\n\n##### 1\n\n* Taskbar10: The Windows 10 taskbar option is now no longer available on 26002+. (#3053, e57a6b0)\n  * This is to comply with Microsoft's removal of the stock Windows 10 taskbar in `explorer.exe` of said builds.\n* Start10: Fixed Pin to Start on 226xx.3420+ (22H2, 23H2) and 25169+ (24H2). (232fe6b)\n* Start10: Reverted the menu closing delay fix when EP is injected only into `StartMenuExperienceHost.exe` for now. (e59c34c)\n\n##### 2\n\n* Start10: Fixed a bug where the recently introduced \"account suggestions\" prevents the user tile menu from opening on later 22H2/23H2 builds and 24H2. (d11445a)\n\n##### 3\n\n* All: Updated some patterns to work with 22635.3430+ (Beta) and recent 24H2 builds. (6d22947)\n  * This should fix the Windows 10 start menu crashing and Win+X not working on both aforementioned builds when symbols are not yet downloaded.\n  \n##### 4\n\n* Updates: Support for `ep_make`, a new script which builds ExplorerPatcher locally on your computer. Read more [here](https://github.com/valinet/ep_make). (80592f6)\n* GUI: Reorganized \"About\" and \"Uninstall\" sections. (4794713)\n* ep_weather: Fixed alignment.\n\n##### 5\n\n* Weather: Layout fixes. (57b44d2, 2112a18)\n\n## 22621.3296.64\n\nTested on OS builds 22000.2538, 22621.1992, 22621.3155, 22621.3235, 22621.3296, 25951.1000, and 26058.1000.\n\n##### 1\n\n* Taskbar10: Fixed a bug where SCOOBE would repeatedly crash Explorer when Language Switcher is set to anything other than Windows 10 (the default). (fe7f800, 5c35f58)\n* Taskbar10: Refined the method for aligning the Windows 11 Start menu and Search flyouts when using the Windows 10 taskbar on 22621.2792+. (8f84a96)\n  * This should fix related crashes during logon and screen resolution change on 26063+.\n* Taskbar10: Revised the method for restoring acrylic to the Windows 10 taskbar on 22621+. (5e7bad2)\n  * This should fix the taskbar being fully transparent on recent builds such as 22635.3066 and 22621/22631.3296 despite not having any other customization software.\n* ExplorerPatcher should now avoid further injection when the system is in safe mode. (95ea9e7)\n* Setup: Moved uninstallation prompt dialog existence check to the GUI. (0589a25)\n* Various changes to prepare for the alternate taskbar reimplementation that will be released in the future. (a0885c6, 0791bd7, fc61884, 623ecee)\n\n##### 2\n\n* Taskbar10: Revised the method for disabling DisableWin10Taskbar present on 26002+. (913b2d0)\n\n##### 3\n\n* Start10: Support for OS builds 226xx.3420+ and 24H2, including fixed animations (5e25663, c286ab5).\n* Start10: Prevent menu closing delay when patching standalone (without ExplorerPatcher injecting `explorer.exe`) (45bd735).\n\n## 22621.3007.63\n\nTested on OS builds 22000.2538, 22621.1992, 22621.3007, 22621.3085, and 22621.3155.\n\n##### 1\n\n* **Fixed a bug where `explorer.exe` would crash repeatedly when the system is in OOBE.** (36ebe5a)\n  * ExplorerPatcher now no longer loads if it detects that the system is in OOBE or in credential reset.\n* Taskbar10: The Network and Battery flyouts on later 22621 builds onwards and Windows 10 now open instantly without issues. (97fd483)\n* Taskbar10: Allowed the use of search box (without highlights) on Windows 11. (0157ecc)\n  * **The behavior when the Start or Search menu is open is currently not the same as Windows 10, and we have no plans to fix this yet. Please do not make new Issues regarding this.**\n* Start10: Added proper handling when the Windows 10 start menu is not available (e.g. 24H2/Canary builds). (3c8809e)\n* Start10: Removed the original method for fixing Jump List (right click) views. (79b0f68)\n* File Explorer: The address bar shrinking is now more accurate with pixel-perfect height compared to Windows 7, 8.1, and 10 (without the modern search). (e0b97e2)\n* GUI: Added \"Uninstall\" section containing a button to launch the uninstaller. (0c5021b)\n* Setup: There should now be fewer .prev files, and uninstallation should be cleaner as well. (296c6a0)\n* Symbols: Added `explorer.exe` symbols for 22621+ and unified the method for Windows 10 Alt+Tab on 22000. (1f2e2c4)\n* Localization: Added translations for Lithuanian, Polish, Russian, and Turkish.\n\n##### 2\n\n* Taskbar10: Improved animation performance when centering and/or EP Weather is not enabled, also fixed search box positioning on small taskbar without centering. (22d9e3c)\n* Setup: Fixed a bug that placed `wincorlib.dll` on Windows 10 when it is not supposed to, causing the start menu to crash. (610ba7f)\n\n##### 3\n\n* Taskbar10: Fixed flyout positioning on Windows 11 26058+. (dfe340d)\n* Slightly improved performance when interacting with the taskbar, both new and old. (dfe340d)\n\n##### 4\n\n* Setup: Reverted the method for ending `explorer.exe` and its subprocesses. (fdc357b)\n\n## 22621.2861.62\n\nTested on OS builds 22621.2715, 22621.2861, 22631.2787, 22631.2861, 22635.2915, and 23590.1000.\n\n##### 1\n\n* Taskbar10: Various *important* fixes: (ec68783)\n  * Revised the method for enabling the old taskbar due to a very rare issue where the old taskbar couldn't be enabled with the previous method. (#2499)\n  * Fixed crash on 25921+ due to the removal of pnidui.dll. (#2558)\n  * Fixed potential stability issues when using the new taskbar on 22621.2787+.\n* Taskbar10: Fixed white boxes on submenus when context menu skinning is disabled. (72f1458)\n* File Explorer: Fixed crashes when using Windows 7/10 control interface on OS builds 22635.2915+. (3a1b8b8)\n* Localization: Added translations for French, German, Hungarian, Korean, Romanian, and Ukrainian.\n  * The properties window has been made slightly wider to accomodate the newly added languages. (#2574)\n* Localization: Added a language switcher to the About section of Properties window. (7c3be29, a7a3d27)\n\n##### 2\n\n* Symbols: Fixed languages with longer strings such as French crashing Explorer when attempting to download symbols. (ce9f973)\n\n**Note:** Due to the breakages as well as frequent changes happening in Canary builds, we strongly do not recommend using ExplorerPatcher on Canary builds for now.\n\n## 22621.2506.60\n\nTested on OS builds 22000.2416, 22000.2538, 22621.2361, 22621.2506, 22621.2715, 22631.2787, 23585.1001, and 23590.1000.\n\n#### Details\n\n##### 1\n\n* Taskbar10: Fixed Windows 11 Start menu and Search positioning on builds 22621.2787+ and 23545+ (Dev). (ac268b1, 7d0cdde)\n* File Explorer: Added option to disable the modern navigation bar of Moment 4. (2dc1340)\n* File Explorer: Restored \"Apply Mica\" functionality on OS builds 22621+. (f62c532)\n* Localization: Officially added translations for the following languages: Chinese (Simplified), Chinese (Traditional), Dutch, Indonesian, Japanese\n  * Thanks to [everyone involved](https://github.com/valinet/ExplorerPatcher-L10N#acknowledgements)!\n* GUI: Decoupled the Properties window into `ep_gui.dll` from the main DLL in order to reduce the main DLL size and to allow scalable localization. (f6f6d89, 639d7aa)\n  * `rundll32 C:\\Windows\\dxgi.dll,ZZGUI` will continue to work as before.\n\n#### ⚠️ Important notice for translators ⚠️\n\nIn this update, most if not all user-facing parts of ExplorerPatcher have been made localizable.\n\n* The English texts have been put together into [here](https://github.com/valinet/ExplorerPatcher/tree/master/ep_gui/resources/lang) and [here](https://github.com/valinet/ExplorerPatcher/tree/master/ep_setup/resources/lang).\n* Non-English texts have been designed to be put into [this separate repository](https://github.com/valinet/ExplorerPatcher-L10N). Feel free to make a PR there if you want to contribute to translations.\n* Some texts have been updated to be more concise and accurate, so for existing translation fork maintainers, please double check the translations before making a PR to the said repository.\n* Also for translation fork maintainers, a large number of conflicts will happen if you decide to continue merging changes from the main repository.\n* Please let us know through Issues if there are still user-facing parts of ExplorerPatcher that are not localizable.\n\nWe apologize for the additional work that this change might cause. We hope that this one-time change will make it easier for translators to localize ExplorerPatcher and also easier for both translators and users to keep ExplorerPatcher up to date.\n\n## 22621.2428.59\n\nTested on OS builds 22000.2416, 22621.2428, 23555.1000, and 23560.1000.\n\n#### Details\n\n##### 1\n\nNote: After updating to this version, the symbols will be re-downloaded even if they have been downloaded before.\n\n* Taskbar10: Fixed Control Center and Toast Center positioning on build 25951 (Canary). (dca0b3a)\n* Taskbar10: Fixed start menu position when the taskbar is at the left or right side on Moment 4 builds. (a57471f)\n* Taskbar10: Fixed the Windows 10 taskbar background patch to not crash anymore on build 25951 (Canary). (b52bd79)\n* Taskbar10: Made classic theme taskbar fonts more accurate. Thanks @aubymori! (8fc53a1)\n* Start10: Fixed a bug where certain texts in the Windows 10 Start menu stayed in English. (655e62c, 5321766)\n* Start10: Properly fixed start menu showing/hiding along with its original animations on builds 22000.65+. (7e2f768)\n* GUI: Fixed a bug where \"Remember last used section\" doesn't remember the current page after being enabled. (11160c8)\n* Symbols: Reworked how symbols are managed so that symbols don't need to be successfully downloaded in succession. (8412bd6)\n* Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix. (845d2b5, a7c87ce)\n\n## 22621.2361.58\n\nTested on OS builds 22000.2416, 22621.1, 22621.2134, 22621.2361, 22631.2338, and 23545.1000.\n\n#### Details\n\n##### 1\n\n* Taskbar10: Fixed Windows 10 taskbar not showing up on Windows 11 builds with \"Never combine\" on the new taskbar. (bc3bbc7)\n* Taskbar10: Fixed pen menu crashing `explorer.exe` on 22621.2134+. (1977d78)\n* Taskbar11: Fixed a bug that crashed `explorer.exe` when right clicking the new taskbar on Windows 11 builds with \"Never combine\" on the new taskbar. (6023718)\n* File Explorer: EP now tries to avoid crashes related to the new Windows App SDK views. (b426d2c)\n* On OS builds 22621+, fixed a bug that crashed `explorer.exe` when required functions in `twinui.pcshell.dll` (for Win+X and Windows 10 Alt+Tab) could not be found using the fallback method. (6023718)\n\n##### 2\n\n* Taskbar11: Fixed a bug that reset the \"never combine\" setting on OS builds 22621.2361+ (#2207) (085b3dd)\n* Taskbar10: Fixed Wi-Fi flyout buttons on OS build 22621 (0706393)\n* Start10: Fixed start menu folders, show recently added, and show frequently used apps settings not being applied on OS builds 22621.2134+ (e28940d)\n\n##### 3\n\n* Start10: Pin to Start/Unpin from Start has been properly fixed on Start Menu and Explorer (but not Search yet) of all Windows 11 builds. (15c07a0)\n* Start10: Fixed non-UWP apps not appearing on Dev channel builds 23545+. (a4f5bd0)\n* File Explorer: Fixed command bar settings not being applied on non-primary Explorer instances on Windows 11. (001e8d8)\n\n##### 4\n\n* Taskbar11: Restored the fix for the bug that reset the \"never combine\" setting on OS builds 22621.2361+, which was removed in 22621.2361.58.3 by accident. (9f04110)\n* Start: \"Start menu style\" now requires restart so that Pin to Start/Unpin from Start on Explorer works properly. (bdd71ef)\n* Taskbar10: Disabled the patch for proper acrylic background on Canary builds (25000+) for now. (4ee742f)\n\nMany thanks to @Amrsatrio for sustained efforts in maintaining and improving ExplorerPatcher.\n\nThanks to @ARestrepo228 for hints on fixing Pin to Start/Unpin from Start.\n\n## 22621.2283.57\n\nTested on OS build 22621.2283. Installer requires Internet connectivity.\n\n#### Details\n\n##### 1\n\n* Taskbar10: Fixed Action Center, Control Center, and notification toasts placements on OS builds 22621.2134+ (thanks @Amrsatrio).\n* Taskbar10: Fixed a bug that prevented Task View and/or the window switcher (`Alt`+`Tab`) from working on OS builds 22621.2134+ (thanks @Amrsatrio).\n* Taskbar10: Fixed a bug that prevented the volume and brightness flyouts from displaying (thanks @Amrsatrio).\n* Taskbar10: Fixed a bug that prevented the `Win`+`A` (Action Center), `Win`+`N` (Control Center), and `Win`+`B` (Focus on tray overflow button) shortcuts from working on OS builds 22621.2134+ (thanks @Amrsatrio).\n* Taskbar10: Fixed the context menu of the new IME button OS builds 22621.2134+ (thanks @Amrsatrio).\n* Taskbar11: Fixed a bug that crashed `explorer.exe` when right clicking the taskbar on OS builds 22621.2134+.\n* Quality of life improvements regarding symbol data (thanks @Amrsatrio).\n\nLearn about known issues and track the progress regarding this update [here](https://github.com/valinet/ExplorerPatcher/pull/2097). Special thanks to @Amrsatrio for providing support towards fixing ExplorerPatcher on newer OS builds.\n\n##### 2\n\n* Fixed a bug that crashed `explorer.exe` on OS builds lower than 22621 (Windows 11 22H2). (dfee1ae)\n\n## 22621.1992.56\n\nTested on OS build 22621.1992. Installer requires Internet connectivity.\n\n#### Details\n\n##### 1\n\n* Windows 10 Start menu: Fixed a bug that prevented the menu from working on OS builds 22621.1413 and newer (46c5041). Please read these important notes regarding the fix [here](https://github.com/valinet/ExplorerPatcher/discussions/1679).\n\n##### 2\n\n* Windows 10 Start menu: Fixed a bug that prevented centering on Windows 10 (275a91f).\n\n##### 3\n\n* Windows 10 taskbar: Correct centering of taskbar items when search box is enabled in Windows 10 (2e43c67).\n\n## 22621.1555.55\n\nTested on OS build 22621.1555. Installer requires Internet connectivity.\n\n#### Details\n\n##### 1\n\n* Weather: Fixed a bug that prevented the widget from loading when using the Microsoft icon pack. (968d969)\n\n##### 2\n\n* Simple Window Switcher\n\t* Support for individual list and grouping for UWP apps (implemented grouping and naming enhancements based on using information associated with `AppUserModelID`s)\n\t* Ability to switch between global and local window lists when the switcher is shown.\n\t* Maintain position in the list when certain events occur, like closing windows or switching between the global and local window lists.\n\t* `Del` key closes the currently selected window(s).\n\t* Fixed a bug that prevented newly spawned windows while the switcher is open from going to the back of the list.\n\t* Fixed a bug that prevented window lists from building properly when windows were slow to close.\n\t* Fixed a bug that prevented proper activation of pop-up windows under certain conditions. For example, the switcher is now able to correctly switch to the \"Error Checking\" window in This PC - right click C: - Properties - Tools - Error checking - Check.\n\n## 22621.1413.54\n\nTested on OS build 22621.1413.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Windows 10 taskbar: Fixed a bug that made the following functionalities have issues or stop working: Task View button, `Win-Tab`, `Alt-Tab` after pressing `Win-Tab`, flyouts alignment, notification center alignment, `Win` key shortcuts on OS build 22621.1413+ (thanks @CthRio for the heads up). (0ad140c)\n* Setup: Fixed a bug that prevented File Explorer from starting automatically after servicing the application if the installer run using different credentials than the logged on user (thanks @Abestanis). (1738b45)\n* Weather: Fixed widget icons when using Microsoft icon pack. (2a1aad2)\n* Implemented a mechanism to stop repeated crashes. (d7e5b7d)\n\n##### 2\n\n* Weather: Fixed a bug that prevented the widget from displaying correctly. (a5e5287)\n\n##### 3\n\n* Windows 11 Start menu: Better enforcement for disabling the \"Recommended\" section. (27a8fd9)\n\n##### 4\n\n* Windows 11 Start menu: Fixed a bug that prevented the menu from working when the setting \"Disable Recommended section\" is used and the display scaling is 125%. (5649a83)\n\n##### 5\n\n* Fixed a bug that could crash File Explorer on older OS builds, like 17763 (LTSC 2019). (6bc2ea5)\n\n## 22621.1344.53\n\nTested on OS builds 22621.1344, 22000.1574, and 19044.1466.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Windows 10 taskbar: Fixed a bug that crashed `explorer` on OS build 22621.1344. (f9d702e)\n* Weather: Fixed a bug that displayed the widget area using a different background color. (cc0af46)\n* Weather: Fixed a bug that might throw a script error when certain elements are not ready. (c083327)\n* Weather: Fixed a bug that could prevent the widget from properly loading. (a8c7fba)\n* ep_extra: Implemented a loadable module for Windows 7's Alt-Tab. (ca8ce13)\n* ep_extra: Implemented an `ep_extra`-based loader. (1f4b586)\n\n## 22621.819.52\n\nTested on OS builds 22621.819 and 22000.1098.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Windows 11 Start menu: Implemented centering on screen when taskbar is not at the bottom. (4212e35)\n* Windows 11 taskbar: Option to use the stock taskbar context menu. (451db3c)\n* Fixed a bug that could display the Start menu on a wrong monitor or outside the screen when the taskbar was moved to the top of the screen and the previous setting was at the right edge of the screen. (53fad19)\n\n##### 2\n\n* Windows 11 Start menu: Fixed a bug that prevented the disable \"Recommended\" section feature from working when the scaling level of the screen the Start menu is displayed on is set to 125% (120 DPI). (9f9d43e)\n\n## 22621.608.51\n\nTested on OS builds 22621.608 and 22000.1042.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Fixed a bug that could prevent the Windows 10 network or battery flyouts from showing on OS build 22000.\n* Fixed the Windows 10 network and battery flyouts on OS build 22621.\n* Weather: Fixed a bug that displayed the widget contents with incorrect left padding.\n\n##### 2\n\n* sws: Support for changing selection in window list using the mouse wheel (suggestion by andrewz).\n* Fix broken \"Cascade windows\", \"Show windows stacked\", \"Show windows side by side\", and \"Undo ...\" options in taskbar context menu (reported by iamk9008).\n\n##### 3\n\n* sws: Option to have the scroll wheel change the selection when using the switcher:\n  * \"Never\" (default), the same behavior as two versions ago, which means that, when the switcher is active, it does not react to the scroll wheel being used.\n  * \"When cursor is over the switcher\" has the switcher react to the scroll whell and advance/reverse the selection only when the cursor is above the switcher\n  * \"Always\" has the switcher react to the scroll whell and advance/reverse the selection regardless of where the cursor is placed. In this mode, background applications won't receive scroll wheel updates until the switcher is closed, regardless of the \"Scroll inactive windows when hovering over them\" setting from Windows.\n* sws: Fixed a bug that had the scroll wheel move selections in the opposite direction compared to Windows 7 Alt-Tab's behavior. When enabled, the scrolling up selects the previous window in the list, while scrolling down selects the next window in the list. To obtain the previous behavior, which is to scroll up to select the next window, and to scroll down to select the previous window, set `ScrollWheelInvert` to `1` in `HKCU\\Software\\ExplorerPatcher\\sws` (5cef3b1).\n* sws: Fixed a bug that could unexpectedly move the switcher to another monitor when your cursor was placed on the other monitor, the option to have the switcher display on the monitor the cursor is placed on is enabled and the switcher finished refreshing its data in the background (https://github.com/valinet/sws/commit/8b68539201102801367ef8f3716b9f1260e2dbe5).\n* sws: Fixed a bug that could prevent hotkey associations from being properly cleaned up when you disabled the setting to have a per-application window list (https://github.com/valinet/sws/commit/c5776e5a6a0c5495892a15e16a1def31b225fc51).\n* sws: Fixed a bug that could prevent correct reload of settings when entries were directly deleted from the registry (cbc5f19).\n\n##### 4\n\n* Windows 11 taskbar: Fixed a bug that could crash `explorer.exe` when right clicking certain system tray icons on 22621-based builds. Thanks for the reports about this issue. (a6a88b1)\n\n##### 5\n\n* Windows 11 Start menu: Fixed a bug that prevented the menu from taking into account the \"Layout\" setting from Windows Settings - Personalization - Taskbar on 22621-based builds. (2572a80)\n\n##### 6\n\n* Fixed a bug that could cause the host process of ExplorerPatcher to crash under certain circumstances. (d7a0385)\n\n## 22622.450.50\n\nTested on OS build 22622.450.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Support for OS builds 22621+. Read more [here](https://github.com/valinet/ExplorerPatcher/issues/1082#issuecomment-1206690333).\n* Added an option to shrink address bar height in File Explorer windows (thanks @krlvm).\n\n##### 2\n\n* Support for disabling the modern search bar in 32-bit applications as well (thanks @krlvm).\n* Fixed a bug that could prevent deleting registry keys when the application was supposed to (for example, when uninstalling or toggling certain settings).\n\n##### 3\n\n* Fixed incorrect check for running dwm instances in `ep_dwm`\n* Fixed a use-after-free bug in `ep_dwm` (thanks @ibhk)\n\n## 22000.795.48\n\nTested on OS build 22000.795.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Weather: Fixed a bug that could hang the widget and lead to an infinite loop with the program using an entire CPU core when the computer resumed from sleep or hibernation.\n* Weather: Fixed a bug that had the widget display the error page when the computer lost network connectivity; instead, now the widget continues to display the cached data from the previous refresh (if any).\n\n##### 2\n\n* Weather: Fixed a bug that could hang explorer and the weather widget host process under certain circumstances, for example, when explorer restarted.\n\n## 22000.778.47\n\nTested on OS build 22000.778.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Built-in support for OS build 22000.778.\n* Fixed a bug that had the Start button context menu / Win-X menu / power user menu fail to display and potentially lock the shell on OS builds 22000.778+ and 22621+\n\n##### 2\n\n* Fixed a system high DPI-related bug that caused wide Windows 10 taskbar buttons and incorrect (desktop) icon spacing\n\n## 22000.708.46\n\nTested on OS build 22000.708.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Built-in support for OS build 22000.708.\n* Added configuration options for the new Windows Spotlight desktop background feature, including:\n  * Hide the \"Learn about this picture\" icon\n  * Choose which items from the Windows spotlight icon context menu to have replicated in the desktop context menu (legacy context menu only)\n  * Set a schedule for \"Switch to next picture\"\n  * Manipulate the feature from the Properties UI, bypassing the desktop icon\n* The Properties UI hides sections that are not applicable to your current settings; for example, the \"Weather\" tab is not displayed if you've selected the Windows 11 taskbar, as none of the options in there apply when in this mode.\n\n##### 2\n\n* sws: Fixed a bug that created unnecessary paint events when a window was flashing and the switcher is not shown\n\n##### 3\n\n* Added option to hide the \"Show desktop\" button, but still retain its functionality, when using the Windows 10 taskbar\n* Fixed a bug in Windows 10 where the Start menu was displayed centered by default\n\n##### 4\n\n* Weather: Show \"Reload\" link when data fails to load (thanks Varun A. for the suggestion)\n* sws: Draw placeholder thumbnail when a proper thumbnail cannot be obtained (for example, due to a window having an invalid width or height)\n* sws: Fixed a bug that could prevent the switcher from identifying when the desktop is in the foreground\n* sws: Fixed a regression that could prevent the switcher from properly detecting foreground window changes\n* sws: Fixed a bug that made very small windows have a rectangle area too small for properly working with in the switcher\n\n##### 5\n\n* Fixed a bug that could prevent Control Panel link redirection from working correctly\n* Weather: Fixed a bug that prevented the widget from working when WebView2 Runtime >= 102.0.1245.33\n\n##### 6\n\n* Fix a bug in the Properties window that had the it fail to display some sections under default settings\n  \n## 22000.675.45\n\nTested on OS build 22000.675.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* sws: Fixed a bug that displayed a wrong window to switch to when a background application was denied the request to have the foreground window by the OS (#1084)\n\n##### 2\n\n* libvalinet: Fixed a memory leak in `toast.h`\n* sws: Fixed a bug that caused the switcher to display non-responsive (hung) immersive (UWP) windows twice in the list\n\n##### 3\n\n* sws: Fixed a bug that created unnecessary paint events when a window was flashing and the switcher is not shown\n\n## 22000.613.44\n\nTested on OS build 22000.613.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 1\n\n* Option to disable Win+F (Feedback Hub) hotkey\n* Built-in support for OS build 22000.613\n\n##### 2\n\n* Weather: Fixed a bug that had \"COM Surrogate\" display as a running app in Task Manager after the widget flyout was opened the first time\n* Weather: Fixed a bug that could hang or lock the shutdown/restart/sign out process when using the weather widget\n\n## 22000.556.43\n\nTested on OS build 22000.556.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Details\n\n##### 4\n\n* Option to enable legacy file transfer dialog\n\n##### 3\n\n* Option to enable classic drive groupings in This PC (thanks @lordmilko)\n* Choice of Windows 11 Command Bar, Windows 10 Ribbon or Windows 7 Command Bar for File Explorer windows\n\n##### 2\n\n* Fixed Windows 10 taskbar showing fully transparent instead of the acrylic effect on newer OS builds (22581+)\n\n##### 1\n\n* Option to disable window Snap quadrants in Windows 11 (thanks @lordmilko)\n\n## 22000.556.42\n\nTested on OS build 22000.556.\n\nPlease make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.\n\n#### Highlights\n\n* Implemented Weather widget for the classic taskbar, similar to what is available in the more recent updates to Windows 10. Read more about it [here](https://github.com/valinet/ExplorerPatcher/wiki/Weather).\n* Support for the Windows 10 Start menu in Windows 11. Read more about this [here](https://github.com/valinet/ExplorerPatcher/discussions/920).\n* Option to center Windows 10 Start menu and Windows 10 taskbar.\n* Support for Windows 10. Read more about this [here](https://github.com/valinet/ExplorerPatcher/discussions/898).\n\n#### Details\n\n##### 1\n\n* The weather widget recomputes its area automatically, by default, in order to fit its contents, instead of remaining at a fixed size; there is also an option to choose between the two behavior\n* Possibility to disable the icon in the weather widget\n* Fixed a bug that prevented the weather widget flyout from displaying correctly when the taskbar was using small icons (#741)\n* Fixed inconsistencies when displaying the weather widget and the system themes are disabled (aka the classic theme is used)\n* Screen readers now read the weather data when requested for the weather widget\n* Changing the Start button style or weather widget layout does not toggle taskbar auto-hide now; instead, the settings take effect immediately\n\n##### 2\n\n* The weather widget defaults to showing in the preferred language set in Windows, instead of English (#734)\n* Fixed a bug that could corrupt registry entries of type REG_SZ set via the Properties UI (#734)\n* Fixed a bug that reset the setting when pressing \"Cancel\" in an input box in the Properties UI (#734)\n\n##### 3\n\n* The weather widget shows an error screen when an error happens (like, using an incorrect location, or the network not working etc)\n* The weather widget adjusts its size vertically to accommodate the entire contents (#734)\n\n##### 4\n\n* The weather widget supports dark mode (thanks @krlvm) (#755)\n\n##### 5\n\n* Fixed a bug that prevented correct registration of the weather flyout on certain systems (26b6646)\n* Fixed a bug that made the weather flyout open with noticeable delay under certain circumstances\n* Fixed a bug that prevented correct operation on builds without built-in symbols (#783)\n\n##### 6\n\n* Fixed several race conditions that could lead to incorrect operation of the weather widget (for example, `explorer.exe` crashing when disabling or enabling the widget)\n\n##### 7\n\n* Implemented 2 features that help in replacing the functionality of the quick launch toolbar with pinned taskbar items. Read more about it [here](https://github.com/valinet/ExplorerPatcher/discussions/819)\n\n##### 8\n\n* Implemented option to have the Start menu open on a specific monitor (#821)\n* The weather widget supports setting window corner preference (rounded/not rounded)\n\n##### 10\n\n* Option to clear weather widget local data\n\n##### 11\n\n* Installer sets a Start menu shortcut for the \"Properties\" window\n\n##### 14\n\n* The weather widget positions and sizes itself with respect to the text size accessibility setting as well ([#734](https://github.com/valinet/ExplorerPatcher/discussions/734#discussioncomment-2190218))\n\n##### 15\n\n* Support for high contrast themes in the \"Properties\" window and in the weather widget (#885)\n* Fixed a bug that could lead to a crash when `explorer.exe` starts (#879)\n* Fixed a bug that could prevent the weather widget from launching under certain conditions\n\n##### 16\n\n* Initial support for Windows 10\n* Enabling the weather widget will automatically download and install the Microsoft WebView2 Runtime on computers where it is not installed\n\n##### 17\n\n* Fixed a bug in the Weather widget that could display an erroneous Google search pop-up (thanks @plofhaan) ([#734](https://github.com/valinet/ExplorerPatcher/discussions/734#discussioncomment-2216475))\n\n##### 18\n\n* Fixed a bug that resulted in an access violation on log off when EP runs alongside 7+TT (#894)\n\n##### 19\n\n* Option to enable dev tools for weather widget debugging (#934)\n* Fixed a bug that prevented the \"Skin menus\" setting from working in the `Win`+`X` menu on Windows 10\n\n##### 20\n\n* Fixed a bug that would display an information banner that obscured the weather widget in some occasions when displaying the widget in German (#934) (thanks @frederic2de)\n\n##### 21\n\n* Fixed program windows in older 22000-based OS builds\n\n##### 22\n\n* Added option to enable rounded corners on the Windows 10 Start menu (#937)\n* Added option to disable the \"Recommended\" section on the Windows 11 Start menu\n* Fixed a bug that prevented correct displaying of the weather widget contents when using a right-to-left language (#954)\n\n##### 23\n\n* Support for full screen Windows 10 Start menu\n\n##### 24\n\n* Support for \"Show more tiles\" option in the Windows 10 Start menu (#933)\n* Fixed a bug that prevented extraction of all files when running `ep_setup.exe /extract`\n\n##### 25\n\n* Implemented floating/docked rounded corners in the Windows 10 Start menu\n\n##### 26\n\n* Implemented centered Windows 10 taskbar\n* Option to hide the app list in the Windows 10 Start menu\n* Fixed a bug that presented the weather widget with a wrong height when using the taskbar vertically\n\n##### 27\n\n* Implemented centered Windows 10 Start menu\n* Fixed a bug that prevented the taskbar from displaying UWP icons when using the Windows 10 Start menu on newer Windows builds (#973)\n\n##### 28\n\n* Fixed a bug in the Windows 10 Start menu that prevented the menu from displaying when not using rounded corners\n* Fixed a bug in the Windows 10 Start menu that prevented the menu from updating its position when the settings changed\n* Fixed a bug in the Start menu that prevented the app from receiving settings change notifications when some registry keys were not available on the system\n* Fixed a crash at startup in `explorer.exe` (in module `sndvolsso.dll`) on OS build 22567+\n\n##### 29\n\n* Fixed a bug that prevented the weather widget from working on OS server SKUs\n* Enabled centered Start menu and taskbar in Windows 10\n* Prompt before updating when running on the built-in Administrator account and the `FilterAdministratorToken` policy (\"User Account Control: Use Admin Approval Mode for the built-in Administrator account\") is disabled or not configured\n* Reworked CHANGELOG format\n\n##### .30\n\n* Support for daytime/nighttime icons in the weather widget\n* Improved contrast between the weather icons and the taskbar using light theme\n* Implemented Mica effect for File Explorer windows (thanks @MishaTY) and option to hide the icon and title of File Explorer windows\n* Fixed a bug that made the search, Cortana and task view buttons display on the left even though the taskbar was set to center with Start menu (#999)\n* Disabling the \"Recommended\" section in the Windows 11 Start menu now works in newer OS builds as well (#995)\n\n##### .31\n\n* The Microsoft icon pack for the weather widget applies to the widget contents as well, in addition to the taskbar icon\n* Fixed a bug that slightly moved the taskbar buttons to the right when dragging to rearrange one of them over the first or last item when using the centered Windows 10 taskbar (#1009)\n* Fixed a bug that crashed the \"Properties\" window when accessing the \"System tray\" section in Windows 10 (#1013)\n* Fixed a bug that prevented the Mica effect from working on File Explorer windows when the \"Launch folder windows in a separate process\" setting was used (#1021)\n* Fixed a bug that made certain systems, under certain circumstances, to become stuck in \"tablet mode\"; symptoms included more spacing between taskbar icons, compact view permanently disabled in File Explorer, and/or item checkboxes permanently enabled in File Explorer (#1022). After installing this update, if you are still stuck with the tablet UI, open the Registry Editor, go to `HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\TabletTip\\ConvertibleSlateModeChanged` and delete the `ConvertibleSlateModeChanged` value which most likely is stuck to `1`.\n\n##### .32\n\n* Built-in support for 22000.556\n* Weather widget can now show on the left/top side of the taskbar\n* Weather widget can display condition on 2 lines\n* Reliability improvements for the centered Windows 10 taskbar which now also works along with other taskbar toolbars\n* Fixed a bug that had the Windows 10 Start menu default to being left-aligned on Windows 10\n* Fixed a bug that prevented the \"Centered, with Start button\" modes of the Windows 10 taskbar from working correctly when the taskbar was vertically aligned\n\n##### .33\n\n* Weather: Implemented manual zoom levels (#1033)\n* Weather: Fixed a bug that had the widget display, at startup, a day/night icon relating to time at the last hour change, instead of the actual current time\n* Weather: Fixed a bug that made the widget display a line at the top for some places\n* Fixed a bug that could make the centered taskbar not layout correctly when showing/hiding either of the search, Cortana or task view buttons the first time after the application started\n* Fixed a bug that prevented the centered taskbar from working when animations are turned off system-wide (for example, in usual remote sessions)\n* Fixed a bug that prevented the taskbar from displaying correctly when the weather widget is set to display at left/top (#1041)\n\n##### .34\n\n* Weather: Fixed a bug that prevented resizing other taskbar toolbars (#1043)\n* Weather: Fixed bugs regarding left/top positioning option (#1041)\n\n##### .35\n\n* Option to allow version downgrades when updating the application after switching the servicing channels (#1051)\n* ExplorerPatcher no longer sets the `MinWidth` registry entry automatically - this was used to mitigate an issue with `explorer.exe` where taskbar button labels were becoming too large. If you are affected by having this registry entry set, open the Registry Editor, go to `HKEY_CURRENT_USER\\Control Panel\\Desktop\\WindowMetrics` and remove the `MinWidth` entry (which is probably set to `38`). The same procedure can be used in order to have this option set up in the registry. For more information, see #664.\n* Setup will disable the `UndockingDisabled` registry entry at `HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Shell\\Update\\Packages` when servicing the application. Using `UndockingDisabled` with ExplorerPatcher is not necessary and can actually cause issues (for example, see #704).\n\n##### .36\n\n* Weather: Display time of last update in the Properties window\n\n##### .37\n\n* Fixed Windows 10 taskbar button thumbnails on newer OS builds (22572+)\n* Fixed Windows 10 taskbar showing fully transparent instead of the acrylic effect on newer OS builds (22572+)\n\n##### .38\n\n* Fixed a bug that made the disable window rounded corners feature not work after signing out and then back into a user account\n\n##### .39\n\n* Weather: Fixed a bug that prevented the widget from starting up on new installations due to the folder `%APPDATA%\\ExplorerPatcher` not existing\n\n## 22000.469.41\n\nTested on OS build 22000.434.\n\n#### New features\n\n* Built-in support for OS builds 22000.434, 22000.438, 22000.466, and 22000.469\n* Ability to choose a Windows 10 or Windows 11 Start button style for the Windows 10 taskbar (#436, thanks @krlvm)\n* Support for screen readers in the Properties window (#627) (.1)\n* Option to disable `Office` hotkeys (`Ctrl`+`Alt`+`Shift`+`Windows` key combinations) (#661) (.4)\n* Simple Window Switcher can switch applications instead of windows (#665) (.5, .6)\n* Option to disable rounded corners for windows (.7)\n* Ability to hide the \"Properties\" item from the taskbar context menu (.9)\n* Import/export functionality for program settings (.11)\n\n#### Feature enhancements\n\n* The option to toggle taskbar auto hide when double clicking the taskbar now works with the Windows 11 taskbar as well\n* Performing a memory leak dump now displays GDI, peak GDI, USER and peak USER object counts as well\n* The language switcher list displays only the options that work (previously, it showed some cryptic internal implementations, like \"LOGONUI\", \"UAC\", \"SETTINGPAGE\" and \"OOBE\"). Thus, the list of language switchers offers the following choices:\n  * Windows 11 (default)\n  * Windows 10 (with link to \"Language Preferences\")\n  * Windows 10\n* Simple Window Switcher now highlights windows that require user attention (windows that have their taskbar button flash and colored in orange) (.8)\n* Reliability improvements for the option that maps the `Win`+`C` shortcut to open the clock flyout instead of Microsoft Teams (eliminated dependency on symbol data) (.10)\n* When an update is available, the notification displays the version of the update (.12)\n* The updater correctly detects when the current version is a pre-release but the user has switched the update channel to stable and does not suggest the older stable version as an update anymore (multiple reports, #540, #710) (.12)\n* Import/export settings suggests a file name automatically (.15)\n\n\n#### Fixes\n\n* Fixed a bug that prevented the Properties UI's system menu from displaying and working correctly\n* Fixed a bug that displayed a wrong timestamp (29/08/2021) instead of the current date and time on the notifications generated by ExplorerPatcher\n* Fixed a wrong function prototype (5b4bd07#r62018175, thanks @Simplestas)\n* Protected some state variables from changing internally if modified in the registry until `explorer` is restarted\n* Fixed a bug that could unexpectedly prevent the [Win]+[Alt]+[D] shortcut from working properly\n* Windows 10 language switcher displays correctly when the taskbar is placed in some location other than the bottom of the screen (#629) (.2)\n* Available symbols download properly on Insider builds (tested on 22526.1000) (.3)\n* Mitigated an `explorer.exe` bug where Windows 10 taskbar buttons were becoming too large under certain circumstances when the setting to show labels/never combine is used and the screen resolution/DPI changes (#664) (.6)\n* Performance improvements and bug fixes for Simple Window Switcher (.8)\n\n## 22000.376.40\n\nTested on OS build 22000.376.\n\n#### Highlights\n\n* Built-in support for OS build 22000.376 (.12)\n* Hotfix: Windows 10 taskbar \"always combine\"/\"show labels\" setting is properly preserved when upgrading from an older release (multiple reports, #612, #614) (.21)\n* Primary taskbar remembers position when moved to a secondary monitor (multiple issues, like #504)\n* Ability to set Control Center as network icon action (merged #492)\n* Added possibility to use the original Windows 10 (Alt-Tab) window switcher; thus, the available options are now:\n  * Windows 11 switcher - full screeen, slow, tiny selection outline, slow opening times\n  * Windows 10 switcher - pretty good but lacks customization options\n  * Windows NT switcher - the classic simple icon-based interface hosted by `csrss`\n  * Simple Window Switcher - my own take on implementing this kind of functionality\n* Registry access in the \"Properties\" GUI is now virtualized; that means, the same lightweight infrastructure is maintained but more complex behaviors can be offered via the improved backend; as such, this version introduces the following new configuration options:\n  * Primary and secondary taskbar placement\n  * Automatically hide the taskbar\n* Proper activation of the \"Properties\" window when another instance is running and minimized\n* Symbols parsing success notification displays for longer\n* Debug builds are clearly indicated in the \"About\" page of \"Properties\"\n* Fixed solution to properly produce a debug setup program\n* Possibility to uninstall by renaming `ep_setup.exe` to `ep_uninstall.exe` and running that (.4)\n* Fixed a bug that crashed the \"Properties\" GUI when toggling certain settings (#527) (.6)\n* The \"Properties\" window is restarted unelevated if it was open when application servicing was performed (#528) (.7, .13)\n* Reliability improvements for File Explorer restarts (#529) (.7)\n* When changing the main taskbar position and restarting File Explorer, the new position is now correctly saved and applied when File Explorer restarts (#523) (.7)\n* Mitigation for the issue described in #416 (.7)\n* Fixed a bug that prevented the Windows 10 window switcher from displaying when it was enabled, instead falling back to the Windows NT window switcher (#548) (.8)\n* Fixed the \"Show People in the taskbar\" option and made it not require a restart to apply (#554) (.10)\n* Ability to choose look of Snap Assist (window list when snapping a window): Windows 11 or Windows 10 style (.11)\n* Fixed a bug that prevented the correct set up of \"DisplayVersion\" registry entry in the uninstall information registry key (.11)\n* Secondary taskbars' context menu is displayed similarly to the primary taskbar's context menu for Windows 10 style (.12)\n* Safeguards to prevent malicious executions on update mechanism hijacks for systems where User Account Control is disabled (#567) (.13)\n* Option to prevent certain Control Panel links from being redirected to the Settings app (.14), including in build 22523 (.15)\n* Settings are now stored in `HKEY_CURRENT_USER\\Software\\ExplorerPatcher` so that Windows does not reset them anymore across major OS updates (#576) (.16)\n* Improved Properties UI layout by reducing wasted space and eliminating redundant elements (#590) (.17)\n* Support for the `Win`+`Alt`+`D` shortcut to activate the clock flyout, as in Windows 10 (#591) (.17)\n* Fixes for Windows 11 taskbar:\n  * As shipped by Microsoft, a taskbar displayed on a secondary monitor does not react when the mouse is over it and auto hide is on; fixed this (#589) (.17)\n  * As shipped by Microsoft, under certain circumstances, the main taskbar does not show its system tray when `explorer` starts up and auto hide is on; fixed this (.17)\n  * As shipped by Microsoft, a taskbar displayed on a secondary monitor might display a wrong contextual menu when auto hide is on; fixed this (.17)\n  * The clock flyouts now display correctly when using this taskbar\n  * Fixed a bug that displayed wrong window previews when the combine taskbar buttons option was set to never combine (#564) (.17)\n  * Possibility to set position on screen (top/bottom) from the Properties UI\n* Restoring default settings only asks for elevation if required (for the moment, only if you have registered the application as shell extension) (.18)\n* Fixed the context menu not working (and a potential associated crash) of the new Microsoft IME (#598, #588) (.19) (huge thanks to @Simplestas)\n* GUI: Lock `ExplorerFrame` into memory (.20)\n\n\n#### Simple Window Switcher\n\n* Dramatically improved performance, refactored application; switched to building the window lists faster, on demand, so that the proper windows are always displayed (as far as I remember, the latest `IsAltTabWindow` is based on a function called `IsTaskedWindow` ripped straight from AltTab.dll from Windows 7 6.1.7600.16385)\n* Proper history of window activations is maintained internally\n* Implemented support for layered windows, thus making transparency possible when using the default theme (Acrylic and Mica brushes are still available, but those have the disadvantage that the system can disable them in certain scenarios, like saving energy when working on battery power)\n* Improved reliability of startup delay and window dismiss when quickly Alt-Tabbing\n* Window icons are retrieved async now\n* Better icon drawing using GDI+ flat API\n* Added some more debug messages\n* Fixed some rendering problems when themes are disabled\n* Fixed regression of [#161](https://github.com/valinet/ExplorerPatcher/issues/161#issuecomment-986234002) (.1)\n* Possibility to disable per-application window lists (`Alt`+`) ([#283](https://github.com/valinet/ExplorerPatcher/issues/283#issuecomment-986261712)) (.2)\n* Fixed bug that prevented proper loading of default settings (.3)\n* Implemented a mitigation for #516: gestures for switching apps on Windows Precision Touchpad devices trigger the Windows 10 switcher instead of the Windows 11 switcher, which is much closer to how Simple Window Switcher looks and behaves; ideally, a full solution for this should be provided in the future, in the form of support for activation and navigation using Windows Precision Touchpad gestures in the Simple Window Switcher (.5)\n* Fixed an issue that could hung the application and made window switchers unavailable (#525) (many thanks to @jdp1024) (.7)\n* Possibility to configure window padding (.7)\n* Support for closing window with middle button ([#110](https://github.com/valinet/ExplorerPatcher/discussions/110#discussioncomment-1793318)) (.9)\n* Mitigated an issue that may have prevented Explorer from launching correctly when Simple Window Switcher is set as window switcher (.9)\n* Fixed a crash that could make Explorer restart repeatedly at startup or even hang indefinitely (#525) (.15)\n\n## 22000.348.39\n\nTested on build 22000.348.\n\n#### New features\n\n* Built-in support for build 22000.348.\n* Implemented option to toggle taskbar auto-hide when double clicking the main taskbar (#389)\n* Running `ep_setup.exe` again while EP is already installed will now update the program to the latest version. To uninstall, as the previous behavior did, run `ep_setup.exe /uninstall`\n* Implemented absolute height and width parameters for the Windows 10 switcher. These are especially useful for ultra wide monitors, in a scenario similar to the one described in [this post](https://github.com/valinet/ExplorerPatcher/discussions/110#discussioncomment-1673007) - to configure, set `MaxWidthAbs` and/or `MaxHeightAbs` DWORD values in `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher\\sws` (#110)\n* Provides a simple mechanism for chainloading a custom library when the shell interface is created, from which you can execute your custom code (subject to change, see [this](https://github.com/valinet/ExplorerPatcher/discussions/408#discussioncomment-1674348) for more details) (#408)\n\n#### Feature enhancements\n\n* Option to receive pre-release versions, if available, when checking for updates\n* Improved behavior regarding symbol data information; please refer to https://github.com/valinet/ExplorerPatcher/wiki/Symbols for more information (.1)\n\n#### Fixes\n\n* Fixed mismatches between defaults from EP and Windows' defaults\n* Application starts with limited functionality on builds lacking hardcoded symbol information; symbol downloading is disabled for now, by default, but can be enabled in the \"Advanced\" settings section of \"Properties\"\n* Improvements to how hung windows are treated by the Windows 10 window switcher; fixed an issue that severely delayed the time it took the window switcher to display when a window hung on the screen (#449)\n* Clicking \"Close\" in the Windows 10 window switcher is now more tolerant to small mouse movements (#110) (.1)\n* The existing \"Properties\" window is properly displayed if opening it when another instance is already running and is minimized (.2)\n\n## 22000.318.38\n\nTested on build 22000.318.\n\n#### New features\n\n* Functional Windows 10 network flyout\n* Functional Windows 10 battery flyout\n* Implemented support for Windows 7 battery flyout (#274)\n* Implemented `/extract` switch which unpacks the files from `ep_setup.exe` to disk (#396) (.1):\n  * `ep_setup /extract` - extracts `ExplorerPatcher.IA-32.dll` and `ExplorerPatcher.amd64.dll` to current directory\n  * `ep_setup /extract test` - extracts to `test` folder in current directory\n  * `ep_setup /extract \"C:\\test with space\"` - extracts to `C:\\test with space` directory\n* Taskbar toolbar layouts are preserved when switching between Windows 10 and Windows 11 taskbars and in general (these will be reset when installing this update but should be subsequently remembered) (#395) (.2)\n* Implemented option to toggle taskbar auto-hide when double clicking the main taskbar (#389) (.3)\n* Running `ep_setup.exe` again while EP is already installed will now update the program to the latest version. To uninstall, as the previous behavior did, run `ep_setup.exe /uninstall` (.4)\n* Implemented absolute height and width parameters for the Windows 10 switcher. These are especially useful for ultra wide monitors, in a scenario similar to the one described in [this post](https://github.com/valinet/ExplorerPatcher/discussions/110#discussioncomment-1673007) - to configure, set `MaxWidthAbs` and/or `MaxHeightAbs` DWORD values in `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher\\sws` (#110) (.5)\n* Provides a simple mechanism for chainloading a custom library when the shell interface is created, from which you can execute your custom code (subject to change, see [this](https://github.com/valinet/ExplorerPatcher/discussions/408#discussioncomment-1674348) for more details) (#408) (.6)\n\n\n#### Feature enhancements\n\n* Improved reliability when invoking Control Center (`Win`+`A`) when the taskbar icon is disabled (the icon should now not reappear anymore sometimes) (#242)\n* Small reorganization of some options in \"Properties\"\n* Option to receive pre-release versions, if available, when checking for updates (.9)\n\n#### Fixes\n\n* Windows 10 network and battery flyout should now always launch when the tray icon is clicked (#410) (.1)\n* Fixed mismatches between defaults from EP and Windows' defaults (.3)\n* Application starts with limited functionality on builds lacking hardcoded symbol information; symbol downloading is disabled for now, by default, but can be enabled in the \"Advanced\" settings section of \"Properties\" (.7)\n* Improvements to how hung windows are treated by the Windows 10 window switcher; fixed an issue that severely delayed the time it took the window switcher to display when a window hung on the screen (#449) (.8)\n\n## 22000.318.37\n\nTested on build 22000.318 and 22000.346 (currently in Windows Insider beta and release preview channels).\n\n#### New features\n\n* The configuration interface is now accessed by right clicking on the taskbar and choosing \"Properties\" (previously, it was available in the `Win`+`X` menu). This behavior works when either the Windows 10 or Windows 11 taskbar is enabled. As well, you can launch the \"Properties\" window directly by pressing `Win`+`R` and typing `rundll32 C:\\Windows\\dxgi.dll,ZZGUI`, followed by `Enter`.\n* Implemented a setup program:\n  * To install, simply run `ep_setup.exe`. File Explorer will restart and the program will be enabled right away.\n  * To uninstall, there are 2 options:\n    * Run `ep_setup.exe` again.\n    * Via \"Programs and Features\" in Control Panel, or \"Apps and features\" in the Settings app.\n  * Learn more about the setup program [here](https://github.com/valinet/ExplorerPatcher/wiki/Installer-How-To)\n* Implemented automatic updates; there are 3 settings to choose from when File Explorer starts:\n  * Notify about available updates (default) - the program will check for updates and display a notification if a new build is available; you can go to \"Properties\" and install the update from there\n  * Prompt to install available updates - the program will check for updates, download them if any, and prompt you to install them automatically\n  * Do not check for updates - the program never checks for updates in the background\n  * Of course, you can manually check for updates at any point using \"Properties\" - \"Updates\" - \"Check for updates\". To install the update you were notified about, go to \"Properties\" - \"Updates\" - \"Install latest version\".\n  * When installing an update, you will be prompted using UAC to allow elevation - always check that the update originates from matches what you expect; official updates are currently served via https://github.com/valinet/ExplorerPatcher.\n  * Learn more about how to configure updates on your system, including how to set a custom endpoint [here](https://github.com/valinet/ExplorerPatcher/wiki/Configure-updates)\n* Implemented a proper right click menu for the Windows 11 taskbar - it displays the most common options, similar to previous Windows releases and the Windows 10 taskbar, including frequently accessed items like \"Taskbar settings\", \"Task Manager\" and \"Show the desktop\"\n* System tray icons are now left intact when switching between the Windows 10 and Windows 11 taskbars, or when switching builds, reinstalling the application etc. Basically, now, once you set a certain layout for the system tray with the Windows 10 taskbar, it will always be remembered, instead of the annoying behavior where Windows was discarding your choices in order to accommodate the Windows 11 taskbar\n\n#### Feature enhancements\n\n* Hardcoded symbols are now based on file hashes, not build numbers\n* Better organization for the settings in \"Properties\"\n* Update toast notifications are displayed only as long as they are required. Subsequent notifications no longer have to wait for the previous ones to timeout, but rather they replace the previous ones (#346) (.2)\n\n#### Fixes\n\n* Mitigated an issue that prevented the Windows 11 taskbar from displaying properly under certain circumstances\n* Fixed an issue that would crash the Windows 11 taskbar when it was enabled after positioning the Windows 10 taskbar on either side of the screen (left/right)\n* Fixed a bug in \"Windows 10 Window switcher\" that may have lead to `explorer.exe` crashing when more than 20 windows are opened on the screen (probably the cause for a lot of crashes)\n* Fixed numerous issues when injecting processes, including as shell extension; reliability improvements\n* Adjusted the padding of the system tray hidden icons indicator so that it is now properly centered vertically when using the classic theme mitigations\n* Fixed a memory leak in \"Settings Manager\"\n* Removed verbose output from \"Settings Manager\"\n* Corrected import from `dxgi.dll`\n* Fixed typo in configuration UI (#346) (.1)\n* Fixed typos and spelling in error message (#346) (.2)\n* Fixed bug that prevented \"Properties\" from working when invoked from Quick Launch or other toolbars (#349) (.2)\n* As you may have noticed, releases do not contain unpacked files anymore. Thus, for people looking for a quick way to get the unpacked files, the release notes now include a link to the artifacts generated during during the build process. The artifacts include the usual DLLs (including `dxgi.dll`), plus symbol files and all the helper executables generated during the build. (#351) (.2)\n* Setup program version is synchronized with the version of the application (.2)\n* Fixed a mismatch between the default value for the setting \"Add shortcut to program settings in Win+X menu\" displayed in the UI and actually used in the software (#352) (.2)\n* Fixed an issue that prevented \"Restore default settings\" in the \"Properties\" UI from working (#374) (.3)\n* Improved some wording in the Properties UI (#377) (.4)\n* Added option to show separators between toolbars in the taskbar (#379) (.4)\n* \"Properties\" is restarted when doing an install/update and closed when uninstalling the application (.5)\n* \"Properties\" can open the last used section when starting (.5)\n\n## 22000.318.36\n\nTested on build 22000.318.\n\n#### Fixes\n\n* Fixes an issue that prevented Explorer from starting up when Windows 10 taskbar was disabled and Windows 10 window switcher was enabled (#313) (.1)\n* Lots of bug and issue fixes for shell extension failing to work under certain circumstances (#259)\n\n## 22000.318.35\n\nTested on build 22000.318.\n\n#### Feature enhancements\n\n* Start menu position can now be changed without needing to restart File Explorer\n\n#### Fixes\n\n* Improved reliability of Start menu positioning when the monitor topology changes and at startup\n* Start menu injection returns error codes from the remote process in the debug console\n* Other Start menu quality of life improvements\n\n## 22000.318.34\n\nTested on build 22000.318.\n\n#### New features\n\n* Added option to enable legacy list view (\"SysListView32\") in File Explorer (credit @toiletflusher, @anixx from WinClassic) (.1)\n\n#### Feature enhancements\n\n* Built-in support for build 22000.318\n\n## 22000.282.33\n\nTested on build 22000.282.\n\n#### New features\n\n* Ability to choose language switcher flyout style (option available in the \"Properties\" - \"System tray\" section)\n\n#### Fixes\n\n* The key above the `Tab` key is now correctly identified for all keyboard layouts, so the per-application Windows 10 window switcher mode works correctly (#283)\n\n## 22000.282.32\n\nTested on build 22000.282.\n\n#### New features\n* Windows 10 window switcher features new configuration options:\n  * Always show switcher on primary monitor\n  * Show windows only from current monitor\n  * Theme selector: Mica, Acrylic and None\n  * Corner preference: Rounded, Rounded small, Not rounded\n  * More options for row height\n  * [Alt]+[\\`] shows the switcher only for windows of the foreground application\n  * `[Enter]` switches to selected window (same as `[Space]`) (#240) (.1)\n  * Navigation using arrow keys (#240) (.1)\n* Ability to choose behavior for Cortana button: hidden, shown and opens Cortana, shown and opens Widgets (#255) (.3)\n* Builds are now automatic, generated as soon as new content is pushed to the repository and compiled on GitHub's infrastructure (.6)\n\n#### Feature enhancements\n* Clock context menu options \"Adjust date/time\" and \"Customize notification icons\" open in Control Panel instead of Settings\n\n#### Fixes\n* Taskbar context menu not displaying properly when using classic theme mitigations should now be fixed\n* Reliability improvements, correct injection, avoid double patching\n* All windows should now be properly detected and included in the Windows 10 window switcher\n* Performance enhancements for Windows 10 window switcher: layouts are now precomputed when a window change occurs, so it should be very fast to open and consistent, no matter the current load; also, fast switching does not trigger the window, as it should\n* \"Show Cortana button\" taskbar menu entry now works again (#252) (.2)\n* Fixes a bug that prevented correct opening of some applications (like `powershell`) when EP was registered as shell extension (#256) (.4) - PLEASE NOTE THAT RUNNING AS SHELL EXTENSION IS STILL EXPERIMENTAL, UNSUPPORTED, AND ONLY RECOMMENDED FOR SPECIFIC USE CASES THAT YOU SHOULD KNOW ABOUT ALREADY; otherwise, just dropping the DLL in `C:\\Windows` is enough\n* Windows 10 window switcher switcher now correctly displays UWP apps immediately after launch (#266) (.5)\n* Selection and highlight rectangle are now correctly drawn when using light theme on Windows 10 window switcher (.5)\n* Keyboard selection (left, right, up, down, space, Return) also works when window switcher is shown by holding down the `ALT` key (#263) (.7)\n\n## 22000.282.31\n\nTested on build: 22000.282.\n\n#### New features\n\n* Cortana button now opens the Widgets panel\n* Ability to choose what happens when clicking the Network icon in the system tray\n* Possibility to use the legacy clock flyout\n* Possibility to use the legacy volume flyout\n* Fixes to fully support the classic theme, with a functional taskbar, system tray, Explorer windows, working context menus; read more about this feature [here](https://github.com/valinet/ExplorerPatcher/discussions/101)\n* Choose type of flyout for clock (.1)\n* Compatibility with build 22000.282 (.2)\n\n#### Feature enhancements\n\n* Reorganized settings in the GUI\n* Added option not to have an accelerator for the `Properties` menu entry in `Win`+`X` (#162)\n* The \"Adjust date/time\" and \"Customize notification icons\" links in the clock context menu now open the more versatile Control Panel applets (.4)\n* The console can now be disabled and then dismissed without causing the Explorer process to restart (.4)\n* Implemented a new exported function which restarts File Explorer cleanly, reloading your folder windows: `rundll32 C:\\Windows\\dxgi.dll,ZZRestartExplorer` (.4)\n\n#### Fixes\n\n* Fixed an issue where the Windows 10 window switcher failed to display some windows (#161)\n* Fixed an issue that prevented Start from opening again until Explorer was restarted after opening File Explorer via the Start menu Explorer icon (#145)\n* Fixed patching in libvalinet\n* Fixed GUI launch path; GUI now launches in an external process, survives Explorer restarts\n* Addresses an issue that prevented correct operation under certain circumstances and that could lead to a rare bug where Explorer would crash after a Control Panel window was opened (also related to Control Panel windows not always respecting preferences like \"disable navigation bar\") (.3)\n* Fixed a bug that caused the cursor to move when invoking `Win`+`X` (.4)\n* Fixed a bug that caused incorrect positioning of `Win`+`X` when the main taskbar was present on a monitor different than the primary one (.4)\n* The Start menu now automatically reloads in the background only when its settings change, instead of when any settings change (.4)\n* Improved the reliability of the \"Restart File Explorer\" link in the Properties GUI (.4)\n* Improved the detection of scenarios when the patcher should inject and apply the full set of patches to File Explorer (.4)\n* Other bug fixes (.4)\n\n#### Experimental\n\n**PLEASE NOTE THAT RUNNING AS SHELL EXTENSION IS STILL EXPERIMENTAL, UNSUPPORTED, AND ONLY RECOMMENDED FOR SPECIFIC USE CASES THAT YOU SHOULD KNOW ABOUT ALREADY. IT IS NOT REQUIRED FOR OBTAINING ANY OF THE CORE FUNCTIONALITY, IT IS AVAILABLE ONLY FOR SOME ADVANCED USE CASES AND IS STILL A BIGGER WORK-IN-PROGRESS THAN THE MAIN PROJECT.**\n\nThe application can now be registered as a shell extension. This will enable the Explorer related functionality to work in Open/Save file dialogs as well. This is especially useful for users wanting proper support of the classic theme in Windows 11.\n\nPlease note that this is experimental. For the moment, the preferred installation method remains dropping the DLL in `C:\\Windows`. For interested users, I invite you to test this functionality and report your findings in the discussions board.\n\nTo enable this, put the 2 DLLs (`ExplorerPatcher.amd64.dll` and `ExplorerPatcher.IA-32.dll`) in a secure folder (for example, `C:\\Program Files\\ExplorerPatcher`). Then, in that folder, run this command: `regsvr32 ExplorerPatcher.amd64.dll`. After elevation, a message will display informing you of the operation outcome, and if it went well, Explorer will restart displaying the old taskbar.\n\nTo uninstall, run `regsvr32 /u ExplorerPatcher.amd64.dll` in the same folder and preferably reboot the computer to unload the DLLs from all applications. Then, the files can be deleted just fine.\n\n\n## 22000.258.30.6\n\nTested on build: 22000.258.\n\n* Reworked settings framework\n  * More settings are available to customize\n  * Most setting changes take effect immediatly\n* Implemented Windows 10 window switcher (Alt+Tab)\n* GUI\n  * Revamped GUI, now the interface is split by categories and is displayed on two columns\n  * Regular items do not display a \"+\" sign anymore at the beginning of their label\n  * The current choice is ticked in the drop down menu\n  * Regions are now calculated correctly\n  * Solved memory leaks\n* Option to disable immersive context menus (#96)\n* General bug fixes\n* Window switcher is now disabled by default (.1)\n* Corrected typo in settings (.2)\n* Added option to set tray clock to display seconds (.3)\n* Added option to set the right click menu of the network system tray icon to launch either (.3):\n  * Network settings in the Settings app\n  * Network and Sharing Center in the Control Panel\n  * Network Connections in the Control Panel\n* Added preliminary support for advanced mitigations for correct rendering when using the classic theme (.3)\n* GUI optionally loads UI file from DLL folder (helps for easy debugging) (.4)\n* Small bug fix for symbols download (.5)\n* Better method for closing windows in window switcher (.6)\n\n## 22000.258.26.3\n\nTested on build: 22000.258.\n\n* Compatibility with OS build 22000.258\n* Option to open Network and Sharing Center instead if Network settings when right clicking the network icon in the system tray\n* Centered network and sound right click menus and made them toggle on right click\n* Reliability enhancements for Start menu positioning (#78) (.1)\n* Fixes #85 (.2)\n* Fixes #90 (added option to change taskbar icon size) (.3)\n\n## 22000.194.0.25\n\nTested on build: 22000.194.\n\n* Start menu is hooked from File Explorer; please remove the DLL from `C:\\Windows\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy` when using this new version\n* `Win`+`X` now opens even when the taskbar is set to autohide (fixes #63)\n* `Win`+`C` now opens even when the taskbar is set to autohide (fixes #63)\n* Bluetooth and Safe to Remove menus toggle their visibility when clicked\n* Bluetooth and Safe to Remove menus are centered relative to the icon they are invoked from\n* WiFi list now correctly toggles when clicking the Network icon in the taskbar\n* The settings GUI now supports dark mode and switches correctly when the system theme changes\n* The settings GUI draws correctly when themes are disabled (classic theme compatibility)\n* Removed interoperability with StartAllBack or StartIsBack\n\n## 22000.194.0.23\n\nTested on build: 22000.194.\n\n* Fixed a bug that showed`Win`+`X` on the wrong monitor in certain scenarios\n* `Win`+`X` shows in Windows 11 fashion (centered, above the Start button) if using a centered taskbar with centered Start button as well (using a program like [TaskbarX](https://github.com/valinet/TaskbarX))\n* Fixed the bug that prevented the application from loading in`StartMenuExperienceHost.exe` (thanks to @BraINstinct0 for the report)\n* Fixed padding and element sizes in GUI so it better fits on smaller screens (thanks to @Gaurav-Original-ClassicShellTester for the report)\n* GUI shows application title when run outside of File Explorer\n* GUI stays on screen and just reloads the settings when restoring defaults (instead of closing)\n* Keyboard (tab) support for GUI: `Esc` to close the window, `Tab` to select the next option, `Shift`+`Tab` to select the previous option, `Space` to toggle (or activate) the option\n* Possibility of running the GUI standalone; run this command: `rundll32.exe C:\\Windows\\dxgi.dll,ZZGUI`; this has the advantage that it stays on the screen after restarting File Explorer\n\n## 22000.194.0.22\n\nTested on build: 22000.194.\n\n* When the taskbar is located at the bottom of the screen, opening the power user menu (`Win`+`X`) now automatically highlights the \"Desktop\" entry in the list. Also, the menu items can be activated either with left click, either with right click. Thus, this enables a behavior where you can double click the Start button with the right mouse button in order to quickly show the desktop (thanks to @Gaurav-Original-ClassicShellTester for the suggestion)\n\n## 22000.194.0.21\n\nTested on build: 22000.194.\n\n* Implemented configuration GUI; to access it, right click the Start button (or press `Win`+`X`) and choose \"Properties\" (thanks to @BraINstinct0 for the suggestion)\n\n## 22000.194.0.20\n\nTested on build: 22000.194.\n\n* Huge code refactoring, improved memory patching\n* Updated README with better description of the software and how to use it\n* Drastically reduced the number of symbols required (around 40MB to download, instead of over 400MB previously)\n* Improved Start menu and search positioning, now it is not necessary to have the DLL in `C:\\Windows\\SystemApps\\MicrosoftWindows.Client.CBS_cw5n1h2txyewy`, please remove it from there.\n* Skin \"Bluetooth\" pop-up menu\n* Option to hide the search bar in File Explorer completely\n* Option to disable the control center button in the taskbar\n* Removed the option to disable the modern search box in File Explorer. Instead, you now run a command which disables it globally on your user account (works in \"Open\" dialogs as well); read [here](https://github.com/valinet/ExplorerPatcher#disable-the-modern-search-box-in-File-Explorer)\n* Removed the option to disable the immersive (new) context menu in File Explorer. Instead, you now run a command which disables it globally on your user account; read [here](https://github.com/valinet/ExplorerPatcher#disable-the-immersive-context-menu)\n* Ability to disable command bar is described [here](https://github.com/valinet/ExplorerPatcher#disable-the-command-bar-in-File-Explorer)\n* Option to apply Mica effect on File Explorer windows (requires `StartIsBack64.dll`), read [here](https://github.com/valinet/ExplorerPatcher#configuration)\n* Option to skin system tray icons to match Windows 11 style (requires `StartisBack64.dll`), read [here](https://github.com/valinet/ExplorerPatcher#configuration)\n\n## 22449.1000.0.18\n\nTested on the following builds: 22449.1000, 22000.176, 22000.1.\n\nNew in this version:\n\n* Ability to disable the \"modern search box\" in File Explorer and uses the classic functional search from early Windows 10 versions or Windows 7/8. To disable this and still use the new search, set `General\\AllowModernSearchBox = 1` in `settings.ini`\n\nFixes:\n\n* Much improved algorithm for enabling the classic taskbar after symbols have downloaded on newer builds\n* Restored compatibility with RTM build of Windows 11 (22000.1)\n* Fixes the \"modern search box\" not working correctly when the DLL is used in `C:\\Windows\\SystemApps\\MicrosoftWindows.Client.CBS_cw5n1h2txyewy`\n\n## 22449.1000.0.16\n\nNew in this version:\n\n- Compatibility with OS build 22449.1000.0.16.\n- Fixed bug that prevented console from showing when the `AllocConsole` setting was specified in `settings.ini`\n\n## 22000.168.0.14\n\n* Start menu and search now respect the taskbar alignment setting\n* Ability to customize the number of \"Most used\" apps in the Start menu apps list\n* Symbols are automatically downloaded for Start menu and search; to have the application work with those two, place the DLL in the following additional 2 locations:\n  * `C:\\Windows\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy`\n  * `C:\\Windows\\SystemApps\\MicrosoftWindows.Client.CBS_cw5n1h2txyewy`\n\n## 22000.168.0.12\n\n* Support for showing the app list by default in the Windows 11 Start menu; to enable this feature, copy the DLL to `C:\\Windows\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy` and restart Explorer (works only on 22000.168 for the moment, will be generally available after more testing is performed).\n* `Win+X` is now shown correctly on multi monitor setups\n* Other bug fixes\n\n## 22000.168.0.11\n\nFixes [#3](https://github.com/valinet/ExplorerPatcher/issues/3) and [#10](https://github.com/valinet/ExplorerPatcher/issues/10).\n\n## 22000.168.0.10\n\nImproved Explorer hooking.\n\nThe application now comes in the form of a single DLL file (`dxgi.dll`) which you have to place in `%windir%` (usually `C:\\Windows`). Restart Explorer and that's it.\n\nPlease make sure to uninstall the old version before using this new one.\n\n## 22000.168.0.9\n\nImplements [#6](https://github.com/valinet/ExplorerPatcher/issues/6) (option to revert to classic context menu). To disable this feature, add this to the settings.ini file:\n\n```\n[General]\nAllowImmersiveContextMenus=1\n```\n\n## 22000.168.0.8\n\nThe popup menu for \"Safe to Remove Hardware\" is now skinned in the same  style as the Win+X menu and the taskbar context menus, in order to  improve UI consistency.\n\n## 22000.168.0.7\n\nEnables compatibility with [ArchiveMenu](https://github.com/valinet/archivemenu).\n\n## 22000.168.0.6\n\nFixes [#5](https://github.com/valinet/ExplorerPatcher/issues/5) (removes the delay at logon on newer builds like 22000.168; the bug is similar to the effect introduced by `UndockingDisabled` on these newer builds).\n\n## 22000.1.0.5\n\nOffsets are now determined at runtime\n\nThe application was tested on builds 22000.1 and 22000.168.\n\n- Library downloads and parses symbols in order to determine function hooking offsets at runtime and saves the data in a \"settings.ini\" file located in the application folder for future use; the file is invalidated when a new OS build is detected\n- The main executable attempts to determine the location where a jump has to be patched out so that Explorer remains on the 'show old taskbar' code path; it will systematically patch each jz/jnz instruction and will check whether Explorer still runs fine, and, if it does so and does not crash, whether the old taskbar got actually shown; once the offset is determined, it is saved in the \"settings.ini\" file for future use\n- Please have an unmetered active working Internet connection when running for the first time\n- Messages from the patcher (i.e. install/uninstall successful message, symbol downloading message) will now display in a toast (Windows 10 notification) if possible; when Explorer is not running, it falls back to using standard MessageBox'es\n- Disabled the pre/post build command that restarted sihost.exe in Debug builds\n\n## 22000.1.0.4\n\nNew in this release\n\n- Win+X combination is now handled and opens the power user menu\n\nOf note from previous releases:\n\n- Start menu is now displayed on monitor containing the cursor when  invoked with the Windows key if the appropriate configuration is made  into the registry (enables a functionality which was previously  available in Windows 8.1). To activate this, follow this tutorial: https://www.tenforums.com/tutorials/5943-start-menu-open-main-last-display-windows-10-a.html\n- The power user menu (Win+X) is now skinned using the system theme, as it was in Windows 10\n\n## 22000.1.0.3\n\nStart menu is now displayed on monitor containing the cursor when  invoked with the Windows key if the appropriate configuration is made  into the registry (enables a functionality which was previously  available in Windows 8.1).\n\nTo activate this, follow this tutorial: https://www.tenforums.com/tutorials/5943-start-menu-open-main-last-display-windows-10-a.html\n\n## 22000.1.0.2\n\nFixes [#1](https://github.com/valinet/ExplorerPatcher/issues/1) (the menu is now skinned using the system theme, as it was in Windows 10).\n\n## 22000.1.0.1\n\nAdded functionality to bring back the power user menu (Win+X).\n\n## 22000.1.0.0\n\nInitial version of the application. Only x64 builds.\n"
  },
  {
    "path": "ExplorerPatcher/ArchiveMenu.c",
    "content": "#include \"ArchiveMenu.h\"\r\n\r\nDWORD ArchiveMenuThread(ArchiveMenuThreadParams* params)\r\n{\r\n    Sleep(1000);\r\n    printf(\"Started \\\"Archive menu\\\" thread.\\n\");\r\n\r\n    HRESULT hr = CoInitialize(NULL);\r\n    if (FAILED(hr))\r\n    {\r\n        return 0;\r\n    }\r\n\r\n    WNDCLASS wc = { 0 };\r\n    wc.style = CS_DBLCLKS;\r\n    wc.lpfnWndProc = params->wndProc;\r\n    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);\r\n    wc.hInstance = GetModuleHandle(NULL);\r\n    wc.lpszClassName = L\"ArchiveMenuWindowExplorer\";\r\n    wc.hCursor = LoadCursorW(NULL, IDC_ARROW);\r\n    RegisterClass(&wc);\r\n\r\n    *(params->hWnd) = params->CreateWindowInBand(\r\n        0,\r\n        L\"ArchiveMenuWindowExplorer\",\r\n        0,\r\n        WS_POPUP,\r\n        0,\r\n        0,\r\n        0,\r\n        0,\r\n        0,\r\n        0,\r\n        GetModuleHandle(NULL),\r\n        NULL,\r\n        7\r\n    );\r\n    if (!*(params->hWnd))\r\n    {\r\n        return 0;\r\n    }\r\n    ITaskbarList* pTaskList = NULL;\r\n    hr = CoCreateInstance(\r\n        &__uuidof_TaskbarList,\r\n        NULL,\r\n        CLSCTX_ALL,\r\n        &__uuidof_ITaskbarList,\r\n        (void**)(&pTaskList)\r\n    );\r\n    if (FAILED(hr))\r\n    {\r\n        return 0;\r\n    }\r\n    hr = pTaskList->lpVtbl->HrInit(pTaskList);\r\n    if (FAILED(hr))\r\n    {\r\n        return 0;\r\n    }\r\n    ShowWindow(*(params->hWnd), SW_SHOW);\r\n    hr = pTaskList->lpVtbl->DeleteTab(pTaskList, *(params->hWnd));\r\n    if (FAILED(hr))\r\n    {\r\n        return 0;\r\n    }\r\n    hr = pTaskList->lpVtbl->Release(pTaskList);\r\n    if (FAILED(hr))\r\n    {\r\n        return 0;\r\n    }\r\n\r\n    MSG msg = { 0 };\r\n    while (GetMessage(&msg, NULL, 0, 0))\r\n    {\r\n        TranslateMessage(&msg);\r\n        DispatchMessage(&msg);\r\n    }\r\n\r\n    printf(\"Ended \\\"Archive menu\\\" thread.\\n\");\r\n}\r\n\r\nLRESULT CALLBACK ArchiveMenuWndProc(\r\n    _In_ HWND   hWnd,\r\n    _In_ UINT   uMsg,\r\n    _In_ WPARAM wParam,\r\n    _In_ LPARAM lParam,\r\n    HRESULT(*ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)(HMENU hMenu, HWND hWnd, POINT* pPt, unsigned int options, void* data),\r\n    void(*ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)(HMENU hMenu, HWND hWnd)\r\n)\r\n{\r\n    LRESULT result;\r\n\r\n    if (uMsg == WM_COPYDATA)\r\n    {\r\n        COPYDATASTRUCT* st = lParam;\r\n        HWND srcWnd = wParam;\r\n\r\n        POINT pt;\r\n        GetCursorPos(&pt);\r\n\r\n        HWND prevhWnd = GetForegroundWindow();\r\n        SetForegroundWindow(hWnd);\r\n\r\n        HMENU hMenu = CreatePopupMenu();\r\n\r\n        TCHAR buffer[MAX_PATH + 100];\r\n        TCHAR filename[MAX_PATH];\r\n        ZeroMemory(filename, MAX_PATH * sizeof(TCHAR));\r\n        memcpy(filename, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));\r\n        PathUnquoteSpacesW(filename);\r\n        PathRemoveExtensionW(filename);\r\n        PathStripPathW(filename);\r\n        wsprintf(buffer, EXTRACT_NAME, filename);\r\n\r\n        InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, 1, buffer);\r\n        InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, 2, OPEN_NAME);\r\n\r\n        INT64* unknown_array = calloc(4, sizeof(INT64));\r\n        ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\r\n            hMenu,\r\n            hWnd,\r\n            &(pt),\r\n            0xc,\r\n            unknown_array\r\n        );\r\n\r\n        BOOL res = TrackPopupMenu(\r\n            hMenu,\r\n            TPM_RETURNCMD,\r\n            pt.x - 15,\r\n            pt.y - 15,\r\n            0,\r\n            hWnd,\r\n            0\r\n        );\r\n\r\n        ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\r\n            hMenu,\r\n            hWnd\r\n        );\r\n        free(unknown_array);\r\n        SetForegroundWindow(prevhWnd);\r\n\r\n        if (res == 1 || res == 2)\r\n        {\r\n            ZeroMemory(buffer, (MAX_PATH + 100) * sizeof(TCHAR));\r\n            if (res == 2)\r\n            {\r\n                wsprintf(buffer, OPEN_CMD, st->lpData);\r\n                //wprintf(L\"%s\\n%s\\n\\n\", st->lpData, buffer);\r\n            }\r\n            else if (res == 1)\r\n            {\r\n                TCHAR path[MAX_PATH + 1], path_orig[MAX_PATH + 1];\r\n                ZeroMemory(path, (MAX_PATH + 1) * sizeof(TCHAR));\r\n                ZeroMemory(path_orig, (MAX_PATH + 1) * sizeof(TCHAR));\r\n                memcpy(path, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));\r\n                memcpy(path_orig, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));\r\n                PathUnquoteSpacesW(path_orig);\r\n                PathRemoveExtensionW(path_orig);\r\n                wsprintf(buffer, EXTRACT_CMD, path_orig, path);\r\n                //wprintf(L\"%s\\n%s\\n\\n\", st->lpData, buffer);\r\n            }\r\n            STARTUPINFO si = { sizeof(si) };\r\n            PROCESS_INFORMATION pi;\r\n            BOOL b = CreateProcess(\r\n                NULL,\r\n                buffer,\r\n                NULL,\r\n                NULL,\r\n                TRUE,\r\n                CREATE_UNICODE_ENVIRONMENT,\r\n                NULL,\r\n                NULL,\r\n                &si,\r\n                &pi\r\n            );\r\n            CloseHandle(pi.hProcess);\r\n            CloseHandle(pi.hThread);\r\n        }\r\n        DestroyMenu(hMenu);\r\n        ShowWindow(hWnd, SW_HIDE);\r\n        return 0;\r\n    }\r\n    else if (uMsg == WM_CLOSE)\r\n    {\r\n        return 0;\r\n    }\r\n    return 1;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/ArchiveMenu.h",
    "content": "#ifndef _H_ARCHIVEMENU_H_\r\n#define _H_ARCHIVEMENU_H_\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n#include <Shlobj_core.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#define OPEN_NAME L\"&Open archive\"\r\n#define EXTRACT_NAME L\"&Extract to \\\"%s\\\\\\\"\"\r\n#define OPEN_CMD L\"\\\"C:\\\\Program Files\\\\7-Zip\\\\7zFM.exe\\\" %s\"\r\n#define EXTRACT_CMD L\"\\\"C:\\\\Program Files\\\\7-Zip\\\\7zG.exe\\\" x -o\\\"%s\\\" -spe %s\"\r\n\r\nDEFINE_GUID(__uuidof_TaskbarList,\r\n    0x56FDF344,\r\n    0xFD6D, 0x11d0, 0x95, 0x8A,\r\n    0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90\r\n);\r\nDEFINE_GUID(__uuidof_ITaskbarList,\r\n    0x56FDF342,\r\n    0xFD6D, 0x11d0, 0x95, 0x8A,\r\n    0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90\r\n);\r\n\r\ntypedef struct _ArchiveMenuThreadParams\r\n{\r\n    HWND* hWnd;\r\n\tWNDPROC wndProc;\r\n    HWND(WINAPI* CreateWindowInBand)(\r\n        _In_ DWORD dwExStyle,\r\n        _In_opt_ LPCWSTR lpClassName,\r\n        _In_opt_ LPCWSTR lpWindowName,\r\n        _In_ DWORD dwStyle,\r\n        _In_ int X,\r\n        _In_ int Y,\r\n        _In_ int nWidth,\r\n        _In_ int nHeight,\r\n        _In_opt_ HWND hWndParent,\r\n        _In_opt_ HMENU hMenu,\r\n        _In_opt_ HINSTANCE hInstance,\r\n        _In_opt_ LPVOID lpParam,\r\n        DWORD band\r\n        );\r\n} ArchiveMenuThreadParams;\r\nDWORD ArchiveMenuThread(ArchiveMenuThreadParams* params);\r\n\r\nLRESULT CALLBACK ArchiveMenuWndProc(\r\n    _In_ HWND   hWnd,\r\n    _In_ UINT   uMsg,\r\n    _In_ WPARAM wParam,\r\n    _In_ LPARAM lParam,\r\n    HRESULT(*ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)(HMENU hMenu, HWND hWnd, POINT* pPt, unsigned int options, void* data),\r\n    void(*ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)(HMENU hMenu, HWND hWnd)\r\n);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/ExplorerPatcher.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64EC\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64EC\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <ProjectGuid>{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}</ProjectGuid>\r\n    <RootNamespace>CenterTitlebarTextLibrary</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n    <ProjectName>ExplorerPatcher</ProjectName>\r\n    <WithArm64XBinaries>false</WithArm64XBinaries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)'=='Debug'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)'=='Release'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.IA-32</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.IA-32</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.amd64</TargetName>\r\n    <WithMainPatcher>true</WithMainPatcher>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.amd64</TargetName>\r\n    <WithMainPatcher>true</WithMainPatcher>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.arm64</TargetName>\r\n    <WithMainPatcher>true</WithMainPatcher>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.arm64</TargetName>\r\n    <WithMainPatcher>true</WithMainPatcher>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.arm64ec</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>ExplorerPatcher.arm64ec</TargetName>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup>\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <AdditionalIncludeDirectories>inc;$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <UseFullPaths>false</UseFullPaths>\r\n      <RuntimeTypeInfo>false</RuntimeTypeInfo>\r\n      <MultiProcessorCompilation>true</MultiProcessorCompilation>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <DelayLoadDLLs>Winmm.dll</DelayLoadDLLs>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)'=='Debug'\">\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)'=='Release'\">\r\n    <ClCompile>\r\n      <Optimization>MinSpace</Optimization>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>NDEBUG;WINRT_NO_SOURCE_LOCATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='Win32'\">\r\n    <ClCompile>\r\n      <CallingConvention>StdCall</CallingConvention>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='x64'\">\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>WITH_MAIN_PATCHER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <CallingConvention>Cdecl</CallingConvention>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='ARM64'\">\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>WITH_MAIN_PATCHER;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <CallingConvention>Cdecl</CallingConvention>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='ARM64EC'\">\r\n    <ClCompile>\r\n      <CallingConvention>Cdecl</CallingConvention>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_IconPainter.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_RegistryMonitor.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_vector.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_window.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcher.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayout.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayoutWindow.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ArchiveMenu.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"dllmain.c\" />\r\n    <ClCompile Include=\"dxgi_imp.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"fmemopen.c\" />\r\n    <ClCompile Include=\"getline.c\" />\r\n    <ClCompile Include=\"HideExplorerSearchBar.c\" />\r\n    <ClCompile Include=\"ImmersiveFlyouts.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"InputSwitch.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Localization.cpp\" />\r\n    <ClCompile Include=\"lvt.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"SettingsMonitor.c\" />\r\n    <ClCompile Include=\"ShellExperienceHostPatches.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartMenu.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartMenuSettings.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartupSound.cpp\" />\r\n    <ClCompile Include=\"symbols.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Taskbar10.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TaskbarCenter.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TwinUIPatches.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"updates.cpp\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n    <ClCompile Include=\"utility.c\">\r\n      <ExcludedFromBuild Condition=\"'$(WithMainPatcher)'!='true'\">true</ExcludedFromBuild>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_def.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_IconPainter.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_RegistryMonitor.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_utility.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_vector.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_window.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcher.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayout.h\" />\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayoutWindow.h\" />\r\n    <ClInclude Include=\"..\\version.h\" />\r\n    <ClInclude Include=\"ArchiveMenu.h\" />\r\n    <ClInclude Include=\"def.h\" />\r\n    <ClInclude Include=\"dxgi_imp.h\" />\r\n    <ClInclude Include=\"fmemopen.h\" />\r\n    <ClInclude Include=\"getline.h\" />\r\n    <ClInclude Include=\"HideExplorerSearchBar.h\" />\r\n    <ClInclude Include=\"hooking.h\" />\r\n    <ClInclude Include=\"ep_private.h\" />\r\n    <ClInclude Include=\"ImmersiveColor.h\" />\r\n    <ClInclude Include=\"ImmersiveFlyouts.h\" />\r\n    <ClInclude Include=\"InputSwitch.h\" />\r\n    <ClInclude Include=\"Localization.h\" />\r\n    <ClInclude Include=\"lvt.h\" />\r\n    <ClInclude Include=\"osutility.h\" />\r\n    <ClInclude Include=\"queryversion.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n    <ClInclude Include=\"SettingsMonitor.h\" />\r\n    <ClInclude Include=\"StartMenu.h\" />\r\n    <ClInclude Include=\"StartupSound.h\" />\r\n    <ClInclude Include=\"symbols.h\" />\r\n    <ClInclude Include=\"TaskbarCenter.h\" />\r\n    <ClInclude Include=\"updates.h\" />\r\n    <ClInclude Include=\"utility.h\" />\r\n    <ClInclude Include=\"inc\\ClassicWinRtForwardDecl.h\" />\r\n    <ClInclude Include=\"inc\\ContainerPolicies.h\" />\r\n    <ClInclude Include=\"inc\\memsafe.h\" />\r\n    <ClInclude Include=\"inc\\NativeString.h\" />\r\n    <ClInclude Include=\"inc\\PopNoWilResultMacrosLogging.h\" />\r\n    <ClInclude Include=\"inc\\PushNoWilResultMacrosLogging.h\" />\r\n    <ClInclude Include=\"inc\\RefCountedObject.h\" />\r\n    <ClInclude Include=\"inc\\ResultUtils.h\" />\r\n    <ClInclude Include=\"inc\\SimpleArray.h\" />\r\n    <ClInclude Include=\"inc\\SimpleBoxer.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ExplorerPatcher.rc\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"packages.config\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n    <Import Project=\"..\\packages\\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\\build\\native\\Microsoft.Windows.ImplementationLibrary.targets\" Condition=\"Exists('..\\packages\\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\\build\\native\\Microsoft.Windows.ImplementationLibrary.targets')\" />\r\n    <Import Project=\"..\\packages\\KNSoft.SlimDetours.1.1.4-beta\\build\\KNSoft.SlimDetours.targets\" Condition=\"Exists('..\\packages\\KNSoft.SlimDetours.1.1.4-beta\\build\\KNSoft.SlimDetours.targets')\" />\r\n  </ImportGroup>\r\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\r\n    <PropertyGroup>\r\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\r\n    </PropertyGroup>\r\n    <Error Condition=\"!Exists('..\\packages\\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\\build\\native\\Microsoft.Windows.ImplementationLibrary.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\Microsoft.Windows.ImplementationLibrary.1.0.250325.1\\build\\native\\Microsoft.Windows.ImplementationLibrary.targets'))\" />\r\n    <Error Condition=\"!Exists('..\\packages\\KNSoft.SlimDetours.1.1.4-beta\\build\\KNSoft.SlimDetours.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\KNSoft.SlimDetours.1.1.4-beta\\build\\KNSoft.SlimDetours.targets'))\" />\r\n  </Target>\r\n</Project>"
  },
  {
    "path": "ExplorerPatcher/ExplorerPatcher.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\\sws\">\r\n      <UniqueIdentifier>{bd0d631a-7170-49ec-94ef-70c77ec3a4ab}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\sws\">\r\n      <UniqueIdentifier>{4caf96b4-d282-4cad-a9c6-4d8d1374e5a6}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\\internal\">\r\n      <UniqueIdentifier>{2b202c30-7683-42d3-afc3-ddd3c38e1c8d}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\internal\">\r\n      <UniqueIdentifier>{08cd1a6f-9a8f-45ef-a50b-142a1725c106}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Settings\">\r\n      <UniqueIdentifier>{190d08ad-4a1d-4b58-81a1-6403eeb3cd2a}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"resource.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"hooking.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ArchiveMenu.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"StartupSound.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"dxgi_imp.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"SettingsMonitor.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"HideExplorerSearchBar.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"StartMenu.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"symbols.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"utility.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"TaskbarCenter.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"fmemopen.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"getline.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_private.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_def.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_vector.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcher.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayout.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayoutWindow.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_RegistryMonitor.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_window.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_utility.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"queryversion.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"updates.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\version.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ImmersiveFlyouts.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_IconPainter.h\">\r\n      <Filter>Header Files\\sws</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"def.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"lvt.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"osutility.h\">\r\n      <Filter>Header Files\\internal</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ImmersiveColor.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"InputSwitch.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Localization.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\ContainerPolicies.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\memsafe.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\NativeString.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\RefCountedObject.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\ResultUtils.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"inc\\SimpleArray.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ExplorerPatcher.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"dllmain.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ArchiveMenu.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"SettingsMonitor.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"HideExplorerSearchBar.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartMenu.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartMenuSettings.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"symbols.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"utility.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"fmemopen.c\">\r\n      <Filter>Source Files\\internal</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"getline.c\">\r\n      <Filter>Source Files\\internal</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_vector.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcher.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayout.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowSwitcherLayoutWindow.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_RegistryMonitor.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_window.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ImmersiveFlyouts.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_IconPainter.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.c\">\r\n      <Filter>Source Files\\sws</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"lvt.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"InputSwitch.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Localization.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"StartupSound.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Taskbar10.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TaskbarCenter.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"TwinUIPatches.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"updates.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"packages.config\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Natvis Include=\"$(MSBuildThisFileDirectory)..\\..\\natvis\\wil.natvis\" />\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ExplorerPatcher/HideExplorerSearchBar.c",
    "content": "#include \"HideExplorerSearchBar.h\"\r\n\r\nHWND FindChildWindow(\r\n    HWND hwndParent,\r\n    wchar_t* lpszClass\r\n)\r\n{\r\n    HWND hwnd = FindWindowEx(\r\n        hwndParent,\r\n        NULL,\r\n        lpszClass,\r\n        NULL\r\n    );\r\n    if (hwnd == NULL)\r\n    {\r\n        HWND hwndChild = FindWindowEx(\r\n            hwndParent,\r\n            NULL,\r\n            NULL,\r\n            NULL\r\n        );\r\n        while (hwndChild != NULL && hwnd == NULL)\r\n        {\r\n            hwnd = FindChildWindow(\r\n                hwndChild,\r\n                lpszClass\r\n            );\r\n            if (hwnd == NULL)\r\n            {\r\n                hwndChild = FindWindowEx(\r\n                    hwndParent,\r\n                    hwndChild,\r\n                    NULL,\r\n                    NULL\r\n                );\r\n            }\r\n        }\r\n    }\r\n    return hwnd;\r\n}\r\n\r\nVOID HideExplorerSearchBar(HWND hWnd)\r\n{\r\n    HWND band = NULL, rebar = NULL;\r\n    band = FindChildWindow(\r\n        hWnd,\r\n        (wchar_t*)L\"TravelBand\"\r\n    );\r\n    if (!band)\r\n    {\r\n        return;\r\n    }\r\n    rebar = GetParent(band);\r\n    if (!rebar)\r\n    {\r\n        return;\r\n    }\r\n    int idx = 0;\r\n    idx = (int)SendMessage(\r\n        rebar,\r\n        RB_IDTOINDEX,\r\n        4,\r\n        0\r\n    );\r\n    if (idx >= 0)\r\n    {\r\n        SendMessage(\r\n            rebar,\r\n            RB_SHOWBAND,\r\n            idx,\r\n            FALSE\r\n        );\r\n    }\r\n    idx = (int)SendMessage(\r\n        rebar,\r\n        RB_IDTOINDEX,\r\n        5,\r\n        0\r\n    );\r\n    if (idx >= 0)\r\n    {\r\n        SendMessage(\r\n            rebar,\r\n            RB_SHOWBAND,\r\n            idx,\r\n            TRUE\r\n        );\r\n    }\r\n    RedrawWindow(\r\n        rebar,\r\n        NULL,\r\n        NULL,\r\n        RDW_UPDATENOW | RDW_ALLCHILDREN\r\n    );\r\n}\r\n\r\nLRESULT CALLBACK HideExplorerSearchBarSubClass(\r\n    HWND hWnd,\r\n    UINT uMsg,\r\n    WPARAM wParam,\r\n    LPARAM lParam,\r\n    UINT_PTR uIdSubclass,\r\n    DWORD_PTR dwRefData\r\n)\r\n{\r\n    if (uMsg == WM_SIZE || uMsg == WM_PARENTNOTIFY)\r\n    {\r\n        if (uMsg == WM_SIZE && IsWindows11Version22H2OrHigher()) HideExplorerSearchBar(hWnd);\r\n        else if (uMsg == WM_PARENTNOTIFY && (WORD)wParam == 1) HideExplorerSearchBar(hWnd);\r\n    }\r\n    else if (uMsg == WM_DESTROY)\r\n    {\r\n        RemoveWindowSubclass(hWnd, HideExplorerSearchBarSubClass, (UINT_PTR)HideExplorerSearchBarSubClass);\r\n    }\r\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\r\n}"
  },
  {
    "path": "ExplorerPatcher/HideExplorerSearchBar.h",
    "content": "#ifndef _H_HIDEEXPLORERSEARCHBAR_H_\r\n#define _H_HIDEEXPLORERSEARCHBAR_H_\r\n#include <Windows.h>\r\n#include <commctrl.h>\r\n#pragma comment(lib, \"Comctl32.lib\")\r\n#include \"osutility.h\"\r\n\r\n// https://stackoverflow.com/questions/30141592/how-do-i-find-a-handle-inside-a-control\r\nHWND FindChildWindow(\r\n    HWND hwndParent,\r\n    wchar_t* lpszClass\r\n);\r\n\r\n// https://github.com/Open-Shell/Open-Shell-Menu/blob/master/Src/ClassicExplorer/ExplorerBHO.cpp\r\nVOID HideExplorerSearchBar(HWND hWnd);\r\n\r\nLRESULT CALLBACK HideExplorerSearchBarSubClass(\r\n    HWND hWnd,\r\n    UINT uMsg,\r\n    WPARAM wParam,\r\n    LPARAM lParam,\r\n    UINT_PTR uIdSubclass,\r\n    DWORD_PTR dwRefData\r\n);\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/ImmersiveColor.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\n#include \"utility.h\"\r\n\r\nclass CImmersiveColor\r\n{\r\npublic:\r\n    static DWORD GetColor(IMMERSIVE_COLOR_TYPE colorType)\r\n    {\r\n        IMMERSIVE_COLOR_PREFERENCE icp;\r\n        icp.crStartColor = 0;\r\n        icp.crAccentColor = 0;\r\n        GetUserColorPreference(&icp, false/*, true*/);\r\n        return GetColorFromPreference(&icp, colorType, false, IHCM_REFRESH);\r\n    }\r\n\r\n    static bool IsColorSchemeChangeMessage(UINT uMsg, LPARAM lParam)\r\n    {\r\n        bool bRet = false;\r\n        if (uMsg == WM_SETTINGCHANGE && lParam && CompareStringOrdinal((WCHAR*)lParam, -1, L\"ImmersiveColorSet\", -1, TRUE) == CSTR_EQUAL)\r\n        {\r\n            RefreshImmersiveColorPolicyState();\r\n            bRet = true;\r\n        }\r\n        GetIsImmersiveColorUsingHighContrast(IHCM_REFRESH);\r\n        return bRet;\r\n    }\r\n};\r\n\r\nclass CImmersiveColorImpl\r\n{\r\npublic:\r\n    static HRESULT GetColorPreferenceImpl(IMMERSIVE_COLOR_PREFERENCE* pcpPreference, bool fForceReload, bool fUpdateCached)\r\n    {\r\n        return GetUserColorPreference(pcpPreference, fForceReload);\r\n    }\r\n};\r\n"
  },
  {
    "path": "ExplorerPatcher/ImmersiveFlyouts.c",
    "content": "#include \"ImmersiveFlyouts.h\"\r\n\r\nvoid InvokeActionCenter()\r\n{\r\n    HRESULT hr = S_OK;\r\n    IUnknown* pImmersiveShell = NULL;\r\n    hr = CoCreateInstance(\r\n        &CLSID_ImmersiveShell,\r\n        NULL,\r\n        CLSCTX_NO_CODE_DOWNLOAD | CLSCTX_LOCAL_SERVER,\r\n        &IID_IServiceProvider,\r\n        &pImmersiveShell\r\n    );\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        IShellExperienceManagerFactory* pShellExperienceManagerFactory = NULL;\r\n        IUnknown_QueryService(\r\n            pImmersiveShell,\r\n            &CLSID_ShellExperienceManagerFactory,\r\n            &CLSID_ShellExperienceManagerFactory,\r\n            &pShellExperienceManagerFactory\r\n        );\r\n        if (pShellExperienceManagerFactory)\r\n        {\r\n            HSTRING_HEADER hstringHeader;\r\n            HSTRING hstring = NULL;\r\n            hr = WindowsCreateStringReference(\r\n                L\"Windows.Internal.ShellExperience.ControlCenter\",\r\n                (UINT32)(sizeof(L\"Windows.Internal.ShellExperience.ControlCenter\") / sizeof(wchar_t) - 1),\r\n                &hstringHeader,\r\n                &hstring\r\n            );\r\n            if (hstring)\r\n            {\r\n                IUnknown* pIntf = NULL;\r\n                pShellExperienceManagerFactory->lpVtbl->GetExperienceManager(\r\n                    pShellExperienceManagerFactory,\r\n                    hstring,\r\n                    &pIntf\r\n                );\r\n                if (pIntf)\r\n                {\r\n                    IActionCenterOrControlCenterExperienceManager* pControlCenterExperienceManager = NULL;\r\n                    pIntf->lpVtbl->QueryInterface(pIntf, &IID_ControlCenterExperienceManager, &pControlCenterExperienceManager);\r\n                    if (pControlCenterExperienceManager)\r\n                    {\r\n                        pControlCenterExperienceManager->lpVtbl->HotKeyInvoked(pControlCenterExperienceManager, 0);\r\n                        pControlCenterExperienceManager->lpVtbl->Release(pControlCenterExperienceManager);\r\n                    }\r\n                }\r\n                WindowsDeleteString(hstring);\r\n            }\r\n            pShellExperienceManagerFactory->lpVtbl->Release(pShellExperienceManagerFactory);\r\n        }\r\n        pImmersiveShell->lpVtbl->Release(pImmersiveShell);\r\n    }\r\n}\r\n\r\nHRESULT InvokeFlyoutRect(BOOL bAction, DWORD dwWhich, __x_ABI_CWindows_CFoundation_CRect* pRc)\r\n{\r\n    HRESULT hr = S_OK;\r\n    IUnknown* pImmersiveShell = NULL;\r\n    hr = CoCreateInstance(\r\n        &CLSID_ImmersiveShell,\r\n        NULL,\r\n        CLSCTX_NO_CODE_DOWNLOAD | CLSCTX_LOCAL_SERVER,\r\n        &IID_IServiceProvider,\r\n        &pImmersiveShell\r\n    );\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        IShellExperienceManagerFactory* pShellExperienceManagerFactory = NULL;\r\n        hr = IUnknown_QueryService(\r\n            pImmersiveShell,\r\n            &CLSID_ShellExperienceManagerFactory,\r\n            &CLSID_ShellExperienceManagerFactory,\r\n            &pShellExperienceManagerFactory\r\n        );\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            HSTRING_HEADER hstringHeader;\r\n            HSTRING hstring = NULL;\r\n            WCHAR* pwszStr = NULL;\r\n            switch (dwWhich)\r\n            {\r\n            case INVOKE_FLYOUT_NETWORK:\r\n                pwszStr = L\"Windows.Internal.ShellExperience.NetworkFlyout\";\r\n                break;\r\n            case INVOKE_FLYOUT_CLOCK:\r\n                pwszStr = L\"Windows.Internal.ShellExperience.TrayClockFlyout\";\r\n                break;\r\n            case INVOKE_FLYOUT_BATTERY:\r\n                pwszStr = L\"Windows.Internal.ShellExperience.TrayBatteryFlyout\";\r\n                break;\r\n            case INVOKE_FLYOUT_SOUND:\r\n                pwszStr = L\"Windows.Internal.ShellExperience.MtcUvc\";\r\n                break;\r\n            }\r\n            hr = WindowsCreateStringReference(\r\n                pwszStr,\r\n                pwszStr ? wcslen(pwszStr) : 0,\r\n                &hstringHeader,\r\n                &hstring\r\n            );\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                IUnknown* pIntf = NULL;\r\n                hr = pShellExperienceManagerFactory->lpVtbl->GetExperienceManager(\r\n                    pShellExperienceManagerFactory,\r\n                    hstring,\r\n                    &pIntf\r\n                );\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    IExperienceManager* pExperienceManager = NULL;\r\n                    hr = pIntf->lpVtbl->QueryInterface(\r\n                        pIntf,\r\n                        dwWhich == INVOKE_FLYOUT_NETWORK ? &IID_NetworkFlyoutExperienceManager :\r\n                        (dwWhich == INVOKE_FLYOUT_CLOCK ? &IID_TrayClockFlyoutExperienceManager :\r\n                            (dwWhich == INVOKE_FLYOUT_BATTERY ? &IID_TrayBatteryFlyoutExperienceManager :\r\n                                (dwWhich == INVOKE_FLYOUT_SOUND ? &IID_TrayMtcUvcFlyoutExperienceManager : &IID_IUnknown))),\r\n                        &pExperienceManager\r\n                    );\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        if (bAction == INVOKE_FLYOUT_SHOW)\r\n                        {\r\n                            hr = pExperienceManager->lpVtbl->ShowFlyout(pExperienceManager, pRc);\r\n                        }\r\n                        else if (bAction == INVOKE_FLYOUT_HIDE)\r\n                        {\r\n                            hr = pExperienceManager->lpVtbl->HideFlyout(pExperienceManager);\r\n                        }\r\n                        pExperienceManager->lpVtbl->Release(pExperienceManager);\r\n                    }\r\n\r\n                }\r\n                WindowsDeleteString(hstring);\r\n            }\r\n            pShellExperienceManagerFactory->lpVtbl->Release(pShellExperienceManagerFactory);\r\n        }\r\n        pImmersiveShell->lpVtbl->Release(pImmersiveShell);\r\n    }\r\n    return hr;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/ImmersiveFlyouts.h",
    "content": "#ifndef _H_IMMERSIVEFLYOUTS_H_\r\n#define _H_IMMERSIVEFLYOUTS_H_\r\n#include <Windows.h>\r\n#include <roapi.h>\r\n#include \"utility.h\"\r\n\r\nDEFINE_GUID(IID_TrayBatteryFlyoutExperienceManager,\r\n    0x0a73aedc,\r\n    0x1c68, 0x410d, 0x8d, 0x53,\r\n    0x63, 0xaf, 0x80, 0x95, 0x1e, 0x8f\r\n);\r\nDEFINE_GUID(IID_TrayClockFlyoutExperienceManager,\r\n    0xb1604325,\r\n    0x6b59, 0x427b, 0xbf, 0x1b,\r\n    0x80, 0xa2, 0xdb, 0x02, 0xd3, 0xd8\r\n);\r\nDEFINE_GUID(IID_TrayMtcUvcFlyoutExperienceManager,\r\n    0x7154c95d,\r\n    0xc519, 0x49bd, 0xa9, 0x7e,\r\n    0x64, 0x5b, 0xbf, 0xab, 0xE1, 0x11\r\n);\r\nDEFINE_GUID(IID_NetworkFlyoutExperienceManager,\r\n    0xC9DDC674,\r\n    0xB44B, 0x4C67, 0x9D, 0x79,\r\n    0x2B, 0x23, 0x7D, 0x9B, 0xE0, 0x5A\r\n);\r\ntypedef interface IExperienceManager IExperienceManager;\r\n\r\ntypedef struct IExperienceManagerVtbl // : IInspectable\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        IExperienceManager* This,\r\n        /* [in] */ REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        IExperienceManager* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        IExperienceManager* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        IExperienceManager* This,\r\n        ULONG* iidCount,\r\n        IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        IExperienceManager* This,\r\n        HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        IExperienceManager* This,\r\n        TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ShowFlyout)(\r\n        IExperienceManager* This,\r\n        /* [in] */ __x_ABI_CWindows_CFoundation_CRect* rect);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* HideFlyout)(\r\n        IExperienceManager* This);\r\n\r\n    END_INTERFACE\r\n} IExperienceManagerVtbl;\r\n\r\ninterface IExperienceManager\r\n{\r\n    CONST_VTBL struct IExperienceManagerVtbl* lpVtbl;\r\n};\r\n\r\nDEFINE_GUID(CLSID_ShellExperienceManagerFactory,\r\n    0x2E8FCB18,\r\n    0xA0EE, 0x41AD, 0x8E, 0xF8,\r\n    0x77, 0xFB, 0x3A, 0x37, 0x0C, 0xA5\r\n);\r\ntypedef interface IShellExperienceManagerFactory IShellExperienceManagerFactory;\r\n\r\ntypedef struct IShellExperienceManagerFactoryVtbl // : IInspectable\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        IShellExperienceManagerFactory* This,\r\n        /* [in] */ REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        IShellExperienceManagerFactory* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        IShellExperienceManagerFactory* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        IShellExperienceManagerFactory* This,\r\n        ULONG* iidCount,\r\n        IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        IShellExperienceManagerFactory* This,\r\n        HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        IShellExperienceManagerFactory* This,\r\n        TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetExperienceManager)(\r\n        IShellExperienceManagerFactory* This,\r\n        /* [in] */ HSTRING* experience,\r\n        _COM_Outptr_  IInspectable** ppvObject);\r\n\r\n    END_INTERFACE\r\n} IShellExperienceManagerFactoryVtbl;\r\n\r\ninterface IShellExperienceManagerFactory\r\n{\r\n    CONST_VTBL struct IShellExperienceManagerFactoryVtbl* lpVtbl;\r\n};\r\n\r\nDEFINE_GUID(IID_ActionCenterExperienceManager,\r\n    0xdec04b18,\r\n    0x357e, 0x41d8, 0x9b, 0x71,\r\n    0xb9, 0x91, 0x24, 0x3b, 0xea, 0x34\r\n);\r\nDEFINE_GUID(IID_ControlCenterExperienceManager,\r\n    0xd669a58e,\r\n    0x6b18, 0x4d1d, 0x90, 0x04,\r\n    0xa8, 0x86, 0x2a, 0xdb, 0x0a, 0x20\r\n);\r\ntypedef interface IActionCenterOrControlCenterExperienceManager IActionCenterOrControlCenterExperienceManager;\r\n\r\ntypedef struct IActionCenterOrControlCenterExperienceManagerVtbl // : IInspectable\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        /* [in] */ REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        IActionCenterOrControlCenterExperienceManager* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        IActionCenterOrControlCenterExperienceManager* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        ULONG* iidCount,\r\n        IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* HotKeyInvoked)(\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        /* [in] */ void* kind);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* Show)( // only in control center\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        HSTRING hstringUnknown,\r\n        void* bSupressAnimations,\r\n        void* dwUnknown_ShouldBeOne);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* Hide)( // only in control center\r\n        IActionCenterOrControlCenterExperienceManager* This,\r\n        HSTRING hstringUnknown,\r\n        void* bSupressAnimations);\r\n\r\n    END_INTERFACE\r\n} IActionCenterOrControlCenterExperienceManagerVtbl;\r\n\r\ninterface IActionCenterOrControlCenterExperienceManager\r\n{\r\n    CONST_VTBL struct IActionCenterOrControlCenterExperienceManagerVtbl* lpVtbl;\r\n};\r\n\r\nvoid InvokeActionCenter();\r\n\r\n#define INVOKE_FLYOUT_SHOW 1\r\n#define INVOKE_FLYOUT_HIDE 2\r\n#define INVOKE_FLYOUT_NETWORK 1\r\n#define INVOKE_FLYOUT_CLOCK 2\r\n#define INVOKE_FLYOUT_BATTERY 3\r\n#define INVOKE_FLYOUT_SOUND 4\r\n\r\nHRESULT InvokeFlyoutRect(BOOL bAction, DWORD dwWhich, __x_ABI_CWindows_CFoundation_CRect* pRc);\r\n\r\ninline HRESULT InvokeFlyout(BOOL bAction, DWORD dwWhich)\r\n{\r\n    __x_ABI_CWindows_CFoundation_CRect rc;\r\n    ZeroMemory(&rc, sizeof(rc));\r\n    return InvokeFlyoutRect(bAction, dwWhich, &rc);\r\n}\r\n\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/InputSwitch.cpp",
    "content": "﻿#include \"InputSwitch.h\"\r\n\r\n#include <shellscalingapi.h>\r\n#include <wrl/implements.h>\r\n#include <wil/result_macros.h>\r\n\r\n#define TB_POS_NOWHERE 0\r\n#define TB_POS_BOTTOM 1\r\n#define TB_POS_TOP 2\r\n#define TB_POS_LEFT 3\r\n#define TB_POS_RIGHT 4\r\nextern \"C\" UINT GetTaskbarLocationAndSize(POINT ptCursor, RECT* rc);\r\n\r\nextern \"C\" INPUT_SWITCH_IDL_CLIENT_TYPE dwIMEStyle;\r\nextern \"C\" HRESULT CInputSwitchControl_ModifyAnchor(UINT dwNumberOfProfiles, RECT* lpRect);\r\n\r\nHRESULT CInputSwitchControl_ModifyAnchor(UINT dwNumberOfProfiles, RECT* lpRect)\r\n{\r\n    if (!dwIMEStyle) // impossible case (this is not called for the Windows 11 language switcher), but just in case\r\n    {\r\n        return S_FALSE;\r\n    }\r\n\r\n    HWND hWndTaskbar = FindWindowW(L\"Shell_TrayWnd\", NULL);\r\n\r\n    UINT dpiX = 96, dpiY = 96;\r\n    HRESULT hr = GetDpiForMonitor(\r\n        MonitorFromWindow(hWndTaskbar, MONITOR_DEFAULTTOPRIMARY),\r\n        MDT_DEFAULT,\r\n        &dpiX,\r\n        &dpiY\r\n    );\r\n    double dpix = dpiX / 96.0;\r\n    double dpiy = dpiY / 96.0;\r\n\r\n    //printf(\"RECT %d %d %d %d - %d %d\\n\", lpRect->left, lpRect->right, lpRect->top, lpRect->bottom, dwNumberOfProfiles, a3);\r\n\r\n    RECT rc;\r\n    GetWindowRect(hWndTaskbar, &rc);\r\n    POINT pt;\r\n    pt.x = rc.left;\r\n    pt.y = rc.top;\r\n    UINT tbPos = GetTaskbarLocationAndSize(pt, &rc);\r\n    if (tbPos == TB_POS_BOTTOM)\r\n    {\r\n    }\r\n    else if (tbPos == TB_POS_TOP)\r\n    {\r\n        if (dwIMEStyle == 1) // Windows 10 (with Language preferences link)\r\n        {\r\n            lpRect->top = rc.top + (rc.bottom - rc.top) + (UINT)(((double)dwNumberOfProfiles * (60.0 * dpiy)) + (5.0 * dpiy * 4.0) + (dpiy) + (48.0 * dpiy));\r\n        }\r\n        else if (dwIMEStyle == 2 || dwIMEStyle == 3 || dwIMEStyle == 4 || dwIMEStyle == 5) // LOGONUI, UAC, Windows 10, OOBE\r\n        {\r\n            lpRect->top = rc.top + (rc.bottom - rc.top) + (UINT)(((double)dwNumberOfProfiles * (60.0 * dpiy)) + (5.0 * dpiy * 2.0));\r\n        }\r\n    }\r\n    else if (tbPos == TB_POS_LEFT)\r\n    {\r\n        if (dwIMEStyle == 1 || dwIMEStyle == 2 || dwIMEStyle == 3 || dwIMEStyle == 4 || dwIMEStyle == 5)\r\n        {\r\n            lpRect->right = rc.left + (rc.right - rc.left) + (UINT)((double)(300.0 * dpix));\r\n            lpRect->top += (lpRect->bottom - lpRect->top);\r\n        }\r\n    }\r\n    if (tbPos == TB_POS_RIGHT)\r\n    {\r\n        if (dwIMEStyle == 1 || dwIMEStyle == 2 || dwIMEStyle == 3 || dwIMEStyle == 4 || dwIMEStyle == 5)\r\n        {\r\n            lpRect->right = lpRect->right - (rc.right - rc.left);\r\n            lpRect->top += (lpRect->bottom - lpRect->top);\r\n        }\r\n    }\r\n\r\n    if (dwIMEStyle == 4)\r\n    {\r\n        lpRect->right -= (UINT)((double)(300.0 * dpix)) - (lpRect->right - lpRect->left);\r\n    }\r\n\r\n    return S_OK;\r\n}\r\n\r\nclass CInputSwitchControlProxy : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IInputSwitchControl>\r\n{\r\npublic:\r\n    CInputSwitchControlProxy()\r\n        : m_type((INPUT_SWITCH_IDL_CLIENT_TYPE)-1)\r\n    {\r\n    }\r\n\r\n    HRESULT RuntimeClassInitialize(IInputSwitchControl* original)\r\n    {\r\n        m_original = original;\r\n        return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP Init(INPUT_SWITCH_IDL_CLIENT_TYPE type) override\r\n    {\r\n        m_type = type;\r\n        return m_original->Init(type == ISCT_IDL_DESKTOP && dwIMEStyle != ISCT_IDL_DESKTOP ? dwIMEStyle : type);\r\n    }\r\n\r\n    STDMETHODIMP ShowInputSwitch(const RECT* rect) override\r\n    {\r\n        RECT myRect = *rect;\r\n        if (m_type == ISCT_IDL_DESKTOP)\r\n        {\r\n            UINT dwNumberOfProfiles = 0;\r\n            BOOL bImePresent = FALSE;\r\n            m_original->GetProfileCount(&dwNumberOfProfiles, &bImePresent);\r\n            CInputSwitchControl_ModifyAnchor(dwNumberOfProfiles, &myRect);\r\n        }\r\n        return m_original->ShowInputSwitch(&myRect);\r\n    }\r\n\r\n    STDMETHODIMP SetCallback(IInputSwitchCallback* callback) override { return m_original->SetCallback(callback); }\r\n    STDMETHODIMP GetProfileCount(UINT* count, BOOL* bOutImePresent) override { return m_original->GetProfileCount(count, bOutImePresent); }\r\n    STDMETHODIMP GetCurrentProfile(INPUT_SWITCH_IDL_PROFILE_DATA* data) override { return m_original->GetCurrentProfile(data); }\r\n    STDMETHODIMP RegisterHotkeys() override { return m_original->RegisterHotkeys(); }\r\n    STDMETHODIMP ClickImeModeItem(INPUT_SWITCH_IDL_IME_CLICK_TYPE type, POINT point, const RECT* rect) override { return m_original->ClickImeModeItem(type, point, rect); }\r\n    STDMETHODIMP ForceHide() override { return m_original->ForceHide(); }\r\n    STDMETHODIMP ShowTouchKeyboardInputSwitch(const RECT* rect, INPUT_SWITCH_IDL_ALIGNMENT align, int a3, DWORD a4, INPUT_SWITCH_IDL_MODALITY a5) override { return m_original->ShowTouchKeyboardInputSwitch(rect, align, a3, a4, a5); }\r\n    STDMETHODIMP GetContextFlags(DWORD* flags) override { return m_original->GetContextFlags(flags); }\r\n    STDMETHODIMP SetContextOverrideMode(INPUT_SWITCH_IDL_CFOM mode) override { return m_original->SetContextOverrideMode(mode); }\r\n    STDMETHODIMP GetCurrentImeModeItem(INPUT_SWITCH_IDL_IME_MODE_ITEM_DATA* data) override { return m_original->GetCurrentImeModeItem(data); }\r\n    STDMETHODIMP ActivateInputProfile(const WCHAR* profile) override { return m_original->ActivateInputProfile(profile); }\r\n    STDMETHODIMP SetUserSid(const WCHAR* sid) override { return m_original->SetUserSid(sid); }\r\n\r\nprivate:\r\n    Microsoft::WRL::ComPtr<IInputSwitchControl> m_original;\r\n    INPUT_SWITCH_IDL_CLIENT_TYPE m_type;\r\n};\r\n\r\nHRESULT CInputSwitchControlProxy_CreateInstance(IInputSwitchControl* original, REFIID riid, void** ppvObject)\r\n{\r\n    Microsoft::WRL::ComPtr<CInputSwitchControlProxy> proxy;\r\n    RETURN_IF_FAILED(Microsoft::WRL::MakeAndInitialize<CInputSwitchControlProxy>(&proxy, original));\r\n    RETURN_HR(proxy.CopyTo(riid, ppvObject));\r\n}\r\n\r\nclass CInputSwitchControlProxySV2 : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IInputSwitchControlSV2>\r\n{\r\npublic:\r\n    CInputSwitchControlProxySV2()\r\n        : m_type((INPUT_SWITCH_IDL_CLIENT_TYPE)-1)\r\n    {\r\n    }\r\n\r\n    HRESULT RuntimeClassInitialize(IInputSwitchControlSV2* original)\r\n    {\r\n        m_original = original;\r\n        return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP Init(INPUT_SWITCH_IDL_CLIENT_TYPE type) override\r\n    {\r\n        m_type = type;\r\n        return m_original->Init(type == ISCT_IDL_DESKTOP && dwIMEStyle != ISCT_IDL_DESKTOP ? dwIMEStyle : type);\r\n    }\r\n\r\n    STDMETHODIMP ShowInputSwitch(const RECT* rect) override\r\n    {\r\n        RECT myRect = *rect;\r\n        if (m_type == ISCT_IDL_DESKTOP)\r\n        {\r\n            UINT dwNumberOfProfiles = 0;\r\n            BOOL bImePresent = FALSE;\r\n            m_original->GetProfileCount(&dwNumberOfProfiles, &bImePresent);\r\n            CInputSwitchControl_ModifyAnchor(dwNumberOfProfiles, &myRect);\r\n        }\r\n        return m_original->ShowInputSwitch(&myRect);\r\n    }\r\n\r\n    STDMETHODIMP SetCallback(IInputSwitchCallback* callback) override { return m_original->SetCallback(callback); }\r\n    STDMETHODIMP GetProfileCount(UINT* count, BOOL* bOutImePresent) override { return m_original->GetProfileCount(count, bOutImePresent); }\r\n    STDMETHODIMP GetCurrentProfile(INPUT_SWITCH_IDL_PROFILE_DATA* data) override { return m_original->GetCurrentProfile(data); }\r\n    STDMETHODIMP RegisterHotkeys() override { return m_original->RegisterHotkeys(); }\r\n    STDMETHODIMP ClickImeModeItem(INPUT_SWITCH_IDL_IME_CLICK_TYPE type, POINT point, const RECT* rect) override { return m_original->ClickImeModeItem(type, point, rect); }\r\n    STDMETHODIMP ClickImeModeItemWithAnchor(INPUT_SWITCH_IDL_IME_CLICK_TYPE type, IUnknown* anchor) override { return m_original->ClickImeModeItemWithAnchor(type, anchor); }\r\n    STDMETHODIMP ForceHide() override { return m_original->ForceHide(); }\r\n    STDMETHODIMP ShowTouchKeyboardInputSwitch(const RECT* rect, INPUT_SWITCH_IDL_ALIGNMENT align, int a3, DWORD a4, INPUT_SWITCH_IDL_MODALITY a5) override { return m_original->ShowTouchKeyboardInputSwitch(rect, align, a3, a4, a5); }\r\n    STDMETHODIMP GetContextFlags(DWORD* flags) override { return m_original->GetContextFlags(flags); }\r\n    STDMETHODIMP SetContextOverrideMode(INPUT_SWITCH_IDL_CFOM mode) override { return m_original->SetContextOverrideMode(mode); }\r\n    STDMETHODIMP GetCurrentImeModeItem(INPUT_SWITCH_IDL_IME_MODE_ITEM_DATA* data) override { return m_original->GetCurrentImeModeItem(data); }\r\n    STDMETHODIMP ActivateInputProfile(const WCHAR* profile) override { return m_original->ActivateInputProfile(profile); }\r\n    STDMETHODIMP SetUserSid(const WCHAR* sid) override { return m_original->SetUserSid(sid); }\r\n\r\nprivate:\r\n    Microsoft::WRL::ComPtr<IInputSwitchControlSV2> m_original;\r\n    INPUT_SWITCH_IDL_CLIENT_TYPE m_type;\r\n};\r\n\r\nHRESULT CInputSwitchControlProxySV2_CreateInstance(IInputSwitchControlSV2* original, REFIID riid, void** ppvObject)\r\n{\r\n    Microsoft::WRL::ComPtr<CInputSwitchControlProxySV2> proxy;\r\n    RETURN_IF_FAILED(Microsoft::WRL::MakeAndInitialize<CInputSwitchControlProxySV2>(&proxy, original));\r\n    RETURN_HR(proxy.CopyTo(riid, ppvObject));\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/InputSwitch.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\nDEFINE_GUID(CLSID_InputSwitchControl, 0xb9bc2a50, 0x43c3, 0x41aa, 0xa0, 0x86, 0x5d, 0xb1, 0x4e, 0x18, 0x4b, 0xae);\r\nDEFINE_GUID(IID_IInputSwitchControl, 0xb9bc2a50, 0x43c3, 0x41aa, 0xa0, 0x82, 0x5d, 0xb1, 0x4e, 0x18, 0x4b, 0xae);\r\n\r\ntypedef enum __MIDL___MIDL_itf_inputswitchserver_0000_0000_0001\r\n{\r\n    ISCT_IDL_DESKTOP,\r\n    ISCT_IDL_TOUCHKEYBOARD,\r\n    ISCT_IDL_LOGONUI,\r\n    ISCT_IDL_UAC,\r\n    ISCT_IDL_SETTINGSPANE,\r\n    ISCT_IDL_OOBE,\r\n    ISCT_IDL_USEROOBE\r\n} INPUT_SWITCH_IDL_CLIENT_TYPE;\r\n\r\ntypedef struct __MIDL___MIDL_itf_inputswitchserver_0000_0000_0002\r\n{\r\n    int dummy; // We don't need its contents\r\n} INPUT_SWITCH_IDL_PROFILE_DATA;\r\n\r\ntypedef struct __MIDL___MIDL_itf_inputswitchserver_0000_0000_0003\r\n{\r\n    WCHAR* pszTooltip;\r\n    HICON hIcon;\r\n    BOOL fDisabled;\r\n    BOOL fHidden;\r\n    WCHAR* pszIconGlyph;\r\n    void* pUnk1; // @Note: Added in 22621.4974\r\n} INPUT_SWITCH_IDL_IME_MODE_ITEM_DATA;\r\n\r\ntypedef enum __MIDL___MIDL_itf_inputswitchserver_0000_0000_0004\r\n{\r\n    INPUT_SWITCH_IDL_IME_CLICK_TYPE_LEFT,\r\n    INPUT_SWITCH_IDL_IME_CLICK_TYPE_RIGHT,\r\n    INPUT_SWITCH_IDL_IME_CLICK_TYPE_LEFT_DISABLED\r\n} INPUT_SWITCH_IDL_IME_CLICK_TYPE;\r\n\r\ntypedef enum __MIDL___MIDL_itf_inputswitchserver_0000_0000_0005\r\n{\r\n    INPUT_SWITCH_IDL_MODALITY_STANDARDKEYBOARD = 0x1,\r\n    INPUT_SWITCH_IDL_MODALITY_SPLITKEYBOARD = 0x2,\r\n    INPUT_SWITCH_IDL_MODALITY_CLASSICKEYBOARD = 0x4,\r\n    INPUT_SWITCH_IDL_MODALITY_HANDWRITING = 0x8,\r\n    INPUT_SWITCH_IDL_MODALITY_HIDE = 0x10,\r\n    INPUT_SWITCH_IDL_MODALITY_ONEHANDEDKEYBOARD = 0x20,\r\n} INPUT_SWITCH_IDL_MODALITY;\r\n\r\nDEFINE_ENUM_FLAG_OPERATORS(INPUT_SWITCH_IDL_MODALITY);\r\n\r\ntypedef enum __MIDL___MIDL_itf_inputswitchserver_0000_0000_0006\r\n{\r\n    INPUT_SWITCH_IDL_ALIGN_DEFAULT,\r\n    INPUT_SWITCH_IDL_ALIGN_RIGHT_EDGE,\r\n    INPUT_SWITCH_IDL_ALIGN_LEFT_EDGE,\r\n} INPUT_SWITCH_IDL_ALIGNMENT;\r\n\r\ntypedef enum __MIDL___MIDL_itf_inputswitchserver_0000_0000_0008\r\n{\r\n    INPUT_SWITCH_IDL_CFOM_NO_OVERRIDE,\r\n    INPUT_SWITCH_IDL_CFOM_DESKTOP,\r\n    INPUT_SWITCH_IDL_CFOM_IMMERSIVE,\r\n} INPUT_SWITCH_IDL_CFOM;\r\n\r\ninterface IInputSwitchCallback;\r\n\r\n#ifdef __cplusplus\r\nMIDL_INTERFACE(\"b9bc2a50-43c3-41aa-a082-5db14e184bae\")\r\nIInputSwitchControl : IUnknown\r\n{\r\n    virtual HRESULT STDMETHODCALLTYPE Init(INPUT_SWITCH_IDL_CLIENT_TYPE) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetCallback(IInputSwitchCallback*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ShowInputSwitch(const RECT*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetProfileCount(UINT*, BOOL*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetCurrentProfile(INPUT_SWITCH_IDL_PROFILE_DATA*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE RegisterHotkeys() = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ClickImeModeItem(INPUT_SWITCH_IDL_IME_CLICK_TYPE, POINT, const RECT*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ForceHide() = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ShowTouchKeyboardInputSwitch(const RECT*, INPUT_SWITCH_IDL_ALIGNMENT, int, DWORD, INPUT_SWITCH_IDL_MODALITY) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetContextFlags(DWORD*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetContextOverrideMode(INPUT_SWITCH_IDL_CFOM) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetCurrentImeModeItem(INPUT_SWITCH_IDL_IME_MODE_ITEM_DATA*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ActivateInputProfile(const WCHAR*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetUserSid(const WCHAR*) = 0;\r\n};\r\n#else\r\ntypedef interface IInputSwitchControl IInputSwitchControl;\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nMIDL_INTERFACE(\"b9bc2a50-43c3-41aa-a082-5db14e184bae\")\r\nIInputSwitchControlSV2 : IUnknown\r\n{\r\n    virtual HRESULT STDMETHODCALLTYPE Init(INPUT_SWITCH_IDL_CLIENT_TYPE) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetCallback(IInputSwitchCallback*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ShowInputSwitch(const RECT*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetProfileCount(UINT*, BOOL*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetCurrentProfile(INPUT_SWITCH_IDL_PROFILE_DATA*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE RegisterHotkeys() = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ClickImeModeItem(INPUT_SWITCH_IDL_IME_CLICK_TYPE, POINT, const RECT*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ClickImeModeItemWithAnchor(INPUT_SWITCH_IDL_IME_CLICK_TYPE, IUnknown*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ForceHide() = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ShowTouchKeyboardInputSwitch(const RECT*, INPUT_SWITCH_IDL_ALIGNMENT, int, DWORD, INPUT_SWITCH_IDL_MODALITY) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetContextFlags(DWORD*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetContextOverrideMode(INPUT_SWITCH_IDL_CFOM) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE GetCurrentImeModeItem(INPUT_SWITCH_IDL_IME_MODE_ITEM_DATA*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE ActivateInputProfile(const WCHAR*) = 0;\r\n    virtual HRESULT STDMETHODCALLTYPE SetUserSid(const WCHAR*) = 0;\r\n};\r\n#else\r\ntypedef interface IInputSwitchControlSV2 IInputSwitchControlSV2;\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nHRESULT CInputSwitchControlProxy_CreateInstance(IInputSwitchControl* original, REFIID riid, void** ppvObject);\r\nHRESULT CInputSwitchControlProxySV2_CreateInstance(IInputSwitchControlSV2* original, REFIID riid, void** ppvObject);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/Localization.cpp",
    "content": "﻿#include \"Localization.h\"\r\n\r\n#include <algorithm>\r\n#include <vector>\r\n\r\n#include \"def.h\"\r\n\r\nextern \"C\"\r\n{\r\n\r\nEP_L10N_Language LangIDToEPLanguage(LANGID wLanguage)\r\n{\r\n    EP_L10N_Language language = {};\r\n    language.id = wLanguage;\r\n    GetLocaleInfoW(wLanguage, LOCALE_SNAME, language.wszId, ARRAYSIZE(language.wszId));\r\n    GetLocaleInfoW(wLanguage, LOCALE_SLOCALIZEDDISPLAYNAME, language.wszDisplayName, ARRAYSIZE(language.wszDisplayName));\r\n    return language;\r\n}\r\n\r\nBOOL EP_L10N_ApplyPreferredLanguageForCurrentThread()\r\n{\r\n    BOOL rv = FALSE;\r\n    HKEY hKey = nullptr;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH),\r\n        0,\r\n        nullptr,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_READ | KEY_WOW64_64KEY,\r\n        nullptr,\r\n        &hKey,\r\n        nullptr\r\n    );\r\n    if (hKey == nullptr || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        hKey = nullptr;\r\n    }\r\n    if (hKey)\r\n    {\r\n        DWORD dwPreferredLanguage = 0;\r\n        DWORD dwSize = sizeof(dwPreferredLanguage);\r\n        LSTATUS lres = RegQueryValueExW(\r\n            hKey,\r\n            TEXT(\"Language\"),\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)&dwPreferredLanguage,\r\n            &dwSize\r\n        );\r\n        if (lres == ERROR_SUCCESS && dwPreferredLanguage != 0)\r\n        {\r\n            EP_L10N_Language language = LangIDToEPLanguage((LANGID)dwPreferredLanguage);\r\n            rv = SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, language.wszId, nullptr);\r\n        }\r\n        else\r\n        {\r\n            rv = SetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, nullptr, nullptr);\r\n        }\r\n        RegCloseKey(hKey);\r\n    }\r\n    return rv;\r\n}\r\n\r\nBOOL EP_L10N_GetCurrentUserLanguage(wchar_t* wszLanguage, int cch)\r\n{\r\n    BOOL bOk = FALSE;\r\n    ULONG ulNumLanguages = 0;\r\n    ULONG cchLanguagesBuffer = 0;\r\n    if (GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, nullptr, &cchLanguagesBuffer))\r\n    {\r\n        wchar_t* wszLanguagesBuffer = (wchar_t*)malloc(cchLanguagesBuffer * sizeof(wchar_t));\r\n        if (wszLanguagesBuffer)\r\n        {\r\n            if (GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, wszLanguagesBuffer, &cchLanguagesBuffer))\r\n            {\r\n                wcscpy_s(wszLanguage, cch, wszLanguagesBuffer);\r\n                bOk = TRUE;\r\n            }\r\n            free(wszLanguagesBuffer);\r\n        }\r\n    }\r\n    if (!bOk)\r\n    {\r\n        wcscpy_s(wszLanguage, cch, L\"en-US\");\r\n    }\r\n    return TRUE;\r\n}\r\n\r\nBOOL EP_L10N_GetCurrentThreadLanguage(wchar_t* wszLanguage, int cch)\r\n{\r\n    BOOL bOk = FALSE;\r\n    ULONG ulNumLanguages = 0;\r\n    ULONG cchLanguagesBuffer = 0;\r\n    if (GetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, nullptr, &cchLanguagesBuffer))\r\n    {\r\n        wchar_t* wszLanguagesBuffer = (wchar_t*)malloc(cchLanguagesBuffer * sizeof(wchar_t));\r\n        if (wszLanguagesBuffer)\r\n        {\r\n            if (GetThreadPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, wszLanguagesBuffer, &cchLanguagesBuffer))\r\n            {\r\n                wcscpy_s(wszLanguage, cch, wszLanguagesBuffer);\r\n                bOk = TRUE;\r\n            }\r\n            free(wszLanguagesBuffer);\r\n        }\r\n    }\r\n    if (!bOk)\r\n    {\r\n        wcscpy_s(wszLanguage, cch, L\"en-US\");\r\n    }\r\n    return TRUE;\r\n}\r\n\r\nvoid EP_L10N_EnumerateLanguages(HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, EP_L10N_EnumerateLanguagesProc_t pfnProc, void* data)\r\n{\r\n    std::vector<EP_L10N_Language> languages;\r\n\r\n    // English (US) is our primary language\r\n    languages.push_back(LangIDToEPLanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)));\r\n\r\n    // Add the rest below it\r\n    EnumResourceLanguagesW(hModule, lpType, lpName, [](HMODULE, LPCWSTR, LPCWSTR, WORD wLanguage, LONG_PTR lParam) -> BOOL\r\n    {\r\n        if (wLanguage != MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US))\r\n        {\r\n            EP_L10N_Language language = LangIDToEPLanguage(wLanguage);\r\n            ((std::vector<EP_L10N_Language>*)lParam)->push_back(language);\r\n        }\r\n        return TRUE;\r\n    }, (LONG_PTR)&languages);\r\n\r\n    // Sort the non-primary languages by localized display name\r\n    std::sort(languages.begin() + 1, languages.end(), [](const EP_L10N_Language& a, const EP_L10N_Language& b) -> bool\r\n    {\r\n        return wcscmp(a.wszDisplayName, b.wszDisplayName) < 0;\r\n    });\r\n\r\n    // Call the callback for each language\r\n    for (const EP_L10N_Language& language : languages)\r\n    {\r\n        pfnProc(&language, data);\r\n    }\r\n}\r\n\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/Localization.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\ntypedef struct EP_L10N_Language\r\n{\r\n    LANGID id;\r\n    wchar_t wszId[LOCALE_NAME_MAX_LENGTH];\r\n    wchar_t wszDisplayName[LOCALE_NAME_MAX_LENGTH];\r\n} EP_L10N_Language;\r\n\r\ntypedef void(*EP_L10N_EnumerateLanguagesProc_t)(const EP_L10N_Language* language, void* data);\r\n\r\nBOOL EP_L10N_ApplyPreferredLanguageForCurrentThread();\r\nBOOL EP_L10N_GetCurrentUserLanguage(wchar_t* wszLanguage, int cch);\r\nBOOL EP_L10N_GetCurrentThreadLanguage(wchar_t* wszLanguage, int cch);\r\nvoid EP_L10N_EnumerateLanguages(HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, EP_L10N_EnumerateLanguagesProc_t pfnProc, void* data);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/SettingsMonitor.c",
    "content": "#include \"SettingsMonitor.h\"\r\n\r\nDWORD WINAPI MonitorSettings(SettingsChangeParameters* params)\r\n{\r\n\tBOOL bShouldExit = FALSE;\r\n\tHANDLE* handles = NULL;\r\n\twhile (TRUE)\r\n\t{\r\n\t\thandles = calloc(sizeof(HANDLE), params->size);\r\n\t\tif (handles)\r\n\t\t{\r\n\t\t\tfor (unsigned int i = 0; i < params->size; ++i)\r\n\t\t\t{\r\n\t\t\t\tif (i == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (params->settings[i].hEvent)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\thandles[i] = params->settings[i].hEvent;\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfree(handles);\r\n\t\t\t\t\t\tfree(params->settings);\r\n\t\t\t\t\t\tfree(params);\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tparams->settings[i].hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);\r\n\t\t\t\tif (!params->settings[i].hEvent)\r\n\t\t\t\t{\r\n\t\t\t\t\tfree(handles);\r\n\t\t\t\t\tfree(params->settings);\r\n\t\t\t\t\tfree(params);\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\thandles[i] = params->settings[i].hEvent;\r\n\t\t\t\tif (RegCreateKeyExW(\r\n\t\t\t\t\tparams->settings[i].origin,\r\n\t\t\t\t\tparams->settings[i].name,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tNULL,\r\n\t\t\t\t\tREG_OPTION_NON_VOLATILE,\r\n\t\t\t\t\tKEY_READ,\r\n\t\t\t\t\tNULL,\r\n\t\t\t\t\t&(params->settings[i].hKey),\r\n\t\t\t\t\tNULL\r\n\t\t\t\t) != ERROR_SUCCESS)\r\n\t\t\t\t{\r\n\t\t\t\t\tfree(handles);\r\n\t\t\t\t\tfree(params->settings);\r\n\t\t\t\t\tfree(params);\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\tif (RegNotifyChangeKeyValue(\r\n\t\t\t\t\tparams->settings[i].hKey,\r\n\t\t\t\t\tFALSE,\r\n\t\t\t\t\tREG_NOTIFY_CHANGE_LAST_SET,\r\n\t\t\t\t\tparams->settings[i].hEvent,\r\n\t\t\t\t\tTRUE\r\n\t\t\t\t) != ERROR_SUCCESS)\r\n\t\t\t\t{\r\n\t\t\t\t\tfree(handles);\r\n\t\t\t\t\tfree(params->settings);\r\n\t\t\t\t\tfree(params);\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tDWORD dwRes = WaitForMultipleObjects(\r\n\t\t\t\tparams->size,\r\n\t\t\t\thandles,\r\n\t\t\t\tFALSE,\r\n\t\t\t\tINFINITE\r\n\t\t\t);\r\n\t\t\tif (dwRes != WAIT_FAILED)\r\n\t\t\t{\r\n\t\t\t\tunsigned int i = dwRes - WAIT_OBJECT_0;\r\n\t\t\t\tif (i >= 1 && i < params->size)\r\n\t\t\t\t{\r\n\t\t\t\t\tparams->settings[i].callback(params->settings[i].data);\r\n\t\t\t\t}\r\n\t\t\t\telse if (i == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tbShouldExit = TRUE;\r\n\t\t\t\t}\r\n\t\t\t\tfor (unsigned int j = 1; j < params->size; ++j)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (WaitForSingleObject(handles[j], 0) == WAIT_OBJECT_0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tparams->settings[j].callback(params->settings[j].data);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfree(handles);\r\n\t\t\tfor (unsigned int i = 1; i < params->size; ++i)\r\n\t\t\t{\r\n\t\t\t\tif (params->settings[i].hEvent)\r\n\t\t\t\t{\r\n\t\t\t\t\tCloseHandle(params->settings[i].hEvent);\r\n\t\t\t\t}\r\n\t\t\t\tif (params->settings[i].hKey)\r\n\t\t\t\t{\r\n\t\t\t\t\tRegCloseKey(params->settings[i].hKey);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (bShouldExit)\r\n\t\t\t{\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tfree(params->settings);\r\n\t\t\tfree(params);\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\tfree(params->settings);\r\n\tfree(params);\r\n\treturn 0;\r\n}\r\n\r\n"
  },
  {
    "path": "ExplorerPatcher/SettingsMonitor.h",
    "content": "#ifndef _H_SETTINGSMONITOR_H_\r\n#define _H_SETTINGSMONITOR_H_\r\n#include <Windows.h>\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n#include <stdio.h>\r\n\r\ntypedef struct _Setting\r\n{\r\n    HKEY origin;\r\n    wchar_t name[MAX_PATH];\r\n    HKEY hKey;\r\n    HANDLE hEvent;\r\n    void(__stdcall *callback)(void*);\r\n    void* data;\r\n} Setting;\r\ntypedef struct _SettingsChangeParameters\r\n{\r\n    Setting* settings;\r\n    DWORD size;\r\n    HANDLE hThread;\r\n} SettingsChangeParameters;\r\nDWORD WINAPI MonitorSettings(SettingsChangeParameters*);\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/ShellExperienceHostPatches.cpp",
    "content": "﻿#include <windows.ui.xaml.h>\n\n#include <wrl/client.h>\n#include <wrl/implements.h>\n#include <wrl/wrappers/corewrappers.h>\n#include <wil/result_macros.h>\n\n// ReSharper disable once CppUnusedIncludeDirective\n#include \"ClassicWinRtForwardDecl.h\"\n#include \"def.h\"\n#include \"hooking.h\"\n#include \"osutility.h\"\n#include \"SimpleBoxer.h\"\n#include \"utility.h\"\n#include \"valinet/hooking/iatpatch.h\"\n\n// We don't need logging here\n#include \"inc/PushNoWilResultMacrosLogging.h\"\n\nusing namespace Microsoft::WRL;\n\nnamespace wf = ABI::Windows::Foundation;\nnamespace wfc = ABI::Windows::Foundation::Collections;\nnamespace wux = ABI::Windows::UI::Xaml;\n\nEXTERN_C_START\n\nvoid InjectShellExperienceHostFor22H2OrHigher();\n\nvoid* memmem(void* haystack, size_t haystacklen, void* needle, size_t needlelen);\n\nvoid InjectShellExperienceHost()\n{\n    if (!IsWindows11())\n    {\n        return;\n    }\n    if (IsWindows11Version22H2OrHigher())\n    {\n        InjectShellExperienceHostFor22H2OrHigher();\n        return;\n    }\n\n    HKEY hKey;\n    if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) != ERROR_SUCCESS)\n    {\n        return;\n    }\n    RegCloseKey(hKey);\n    HMODULE hQA = LoadLibraryW(L\"Windows.UI.QuickActions.dll\");\n    if (hQA)\n    {\n        PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hQA;\n        if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n        {\n            PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)((u_char*)dosHeader + dosHeader->e_lfanew);\n            if (ntHeader->Signature == IMAGE_NT_SIGNATURE)\n            {\n                PBYTE pSEHPatchArea = nullptr;\n                BYTE seh_pattern1[14] =\n                {\n                    // mov al, 1\n                    0xB0, 0x01,\n                    // jmp + 2\n                    0xEB, 0x02,\n                    // xor al, al\n                    0x32, 0xC0,\n                    // add rsp, 0x20\n                    0x48, 0x83, 0xC4, 0x20,\n                    // pop rdi\n                    0x5F,\n                    // pop rsi\n                    0x5E,\n                    // pop rbx\n                    0x5B,\n                    // ret\n                    0xC3\n                };\n                BYTE seh_off = 12;\n                BYTE seh_pattern2[5] =\n                {\n                    // mov r8b, 3\n                    0x41, 0xB0, 0x03,\n                    // mov dl, 1\n                    0xB2, 0x01\n                };\n                bool bTwice = false;\n                PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(ntHeader);\n                for (unsigned int i = 0; i < ntHeader->FileHeader.NumberOfSections; ++i)\n                {\n                    if (section->Characteristics & IMAGE_SCN_CNT_CODE)\n                    {\n                        if (section->SizeOfRawData && !bTwice)\n                        {\n                            PBYTE pSectionBegin = (PBYTE)hQA + section->VirtualAddress;\n                            //DWORD dwOldProtect;\n                            //VirtualProtect(pSectionBegin, section->SizeOfRawData, PAGE_EXECUTE_READWRITE, &dwOldProtect);\n                            PBYTE pCandidate = nullptr;\n                            while (true)\n                            {\n                                pCandidate = (PBYTE)memmem(\n                                    !pCandidate ? pSectionBegin : pCandidate,\n                                    !pCandidate ? section->SizeOfRawData : (uintptr_t)section->SizeOfRawData - (uintptr_t)(pCandidate - pSectionBegin),\n                                    seh_pattern1,\n                                    sizeof(seh_pattern1)\n                                );\n                                if (!pCandidate)\n                                {\n                                    break;\n                                }\n                                PBYTE pCandidate2 = pCandidate - seh_off - sizeof(seh_pattern2);\n                                if (pCandidate2 > (PBYTE)(UINT_PTR)section->VirtualAddress)\n                                {\n                                    if (memmem(pCandidate2, sizeof(seh_pattern2), seh_pattern2, sizeof(seh_pattern2)))\n                                    {\n                                        if (!pSEHPatchArea)\n                                        {\n                                            pSEHPatchArea = pCandidate;\n                                        }\n                                        else\n                                        {\n                                            bTwice = true;\n                                        }\n                                    }\n                                }\n                                pCandidate += sizeof(seh_pattern1);\n                            }\n                            //VirtualProtect(pSectionBegin, section->SizeOfRawData, dwOldProtect, &dwOldProtect);\n                        }\n                    }\n                    section++;\n                }\n                if (pSEHPatchArea && !bTwice)\n                {\n                    DWORD dwOldProtect;\n                    VirtualProtect(pSEHPatchArea, sizeof(seh_pattern1), PAGE_EXECUTE_READWRITE, &dwOldProtect);\n                    pSEHPatchArea[2] = 0x90;\n                    pSEHPatchArea[3] = 0x90;\n                    VirtualProtect(pSEHPatchArea, sizeof(seh_pattern1), dwOldProtect, &dwOldProtect);\n                }\n            }\n        }\n    }\n}\n\n// On 22H2 builds, the Windows 10 flyouts for network and battery can be enabled\n// by patching either of the following functions in ShellExperienceHost. I didn't\n// see any differences when patching with any of the 3 methods, although\n// `SharedUtilities::IsWindowsLite` seems to be invoked in more places, whereas `GetProductInfo`\n// and `RtlGetDeviceFamilyInfoEnum` are only called in `FlightHelper::CalculateRepaintEnabled`\n// and either seems to get the job done. YMMV\n\n/*LSTATUS WINAPI SEH_RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)\n{\n    if (!lstrcmpW(lpValue, L\"UseLiteLayout\")) { *(DWORD*)pvData = 1; return ERROR_SUCCESS; }\n    return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n}*/\n\n/*BOOL WINAPI SEH_RtlGetDeviceFamilyInfoEnum(INT64 u0, PDWORD u1, INT64 u2)\n{\n    *u1 = 10;\n    return TRUE;\n}*/\n\nBOOL WINAPI SEH_GetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType)\n{\n    *pdwReturnedProductType = 119;\n    return TRUE;\n}\n\nstatic bool g_bQuickActionControlTemplatesPatched;\n\n// Fix battery flyout crashing on 25951+\nvoid HandleLoadedQuickActions(HMODULE hModule)\n{\n    if (!hModule)\n    {\n        return;\n    }\n\n    static bool bPatched = false;\n    if (bPatched)\n    {\n        return;\n    }\n    bPatched = true;\n\n    PBYTE pSearch;\n    DWORD cbSearch;\n    if (TextSectionBeginAndSize(hModule, &pSearch, &cbSearch))\n    {\n#if defined(_M_X64)\n        // Note: These patterns will break when the class sizes change!\n\n        PBYTE pfn = nullptr;\n\n        // Find source\n        // 48 89 45 50 BA 90 00 00 00 8D 4A E8 FF 15 ?? ?? ?? ?? 48 89 45 58 48 8B C8 E8 ?? ?? ?? ?? 48 8B F0\n        //             ^^^^^^^^^^^^^^^^^^^^^^^                                        .  ^^^^^^^^^^^\n        // ref new QuickActions::QuickActionTemplates();\n        // Ref: QuickActions::QuickActionTemplates::Instance::get()\n        PBYTE matchSource = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\x48\\x89\\x45\\x50\\xBA\\x90\\x00\\x00\\x00\\x8D\\x4A\\xE8\\xFF\\x15\\x00\\x00\\x00\\x00\\x48\\x89\\x45\\x58\\x48\\x8B\\xC8\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\xF0\",\n            \"xxxxxxxxxxxxxx????xxxxxxxx????xxx\"\n        );\n        if (matchSource)\n        {\n            pfn = matchSource + 25;\n            pfn += 5 + *(int*)(pfn + 1);\n        }\n\n        // Find target\n        // 48 8B D0 48 8B CB E8 ?? ?? ?? ?? 90 4D 85 ?? 74 10 49 8B ?? 49 8B ?? 48 8B 40 10 E8 ?? ?? ?? ?? 90 49 8B CC\n        //                   xxxxxxxxxxxxxx nop\n        // E8 ?? ?? ?? ?? 48 8B D3 48 8B CE E8 ?? ?? ?? ?? BA B8 00 00 00 8D 4A E8 FF 15 ?? ?? ?? ?? 48 89 45 ??\n        //                                                 xxxxxxxxxxxxxxxxxxxxxxx mov edx & lea rcx\n        // 48 8B C8 E8 ?? ?? ?? ?? 4C 8B\n        //          .  xxxxxxxxxxx ctor call\n        // ref new QuickActions::ControlCenter::ControlCenterTemplates();\n        // Ref: QuickActions::QuickActionControl::QuickActionControl()\n        PBYTE matchTarget = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\x48\\x8B\\xD0\\x48\\x8B\\xCB\\xE8\\x00\\x00\\x00\\x00\\x90\\x4D\\x85\\x00\\x74\\x10\\x49\\x8B\\x00\\x49\\x8B\\x00\\x48\\x8B\\x40\\x10\\xE8\\x00\\x00\\x00\\x00\\x90\\x49\\x8B\\xCC\"\n            \"\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\xD3\\x48\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\xBA\\xB8\\x00\\x00\\x00\\x8D\\x4A\\xE8\\xFF\\x15\\x00\\x00\\x00\\x00\\x48\\x89\\x45\\x00\"\n            \"\\x48\\x8B\\xC8\\xE8\\x00\\x00\\x00\\x00\\x4C\\x8B\",\n            \"xxxxxxx????xxx?xxxx?xx?xxxxx????xxxx\"\n            \"x????xxxxxxx????xxxxxxxxxx????xxx?\"\n            \"xxxx????xx\"\n        );\n\n        if (matchSource && matchTarget && pfn)\n        {\n            PBYTE pinsnMovEdxLeaRcxSrc = matchSource + 4;\n\n            PBYTE pinsnCallLoadComponent = matchTarget + 6;\n            PBYTE pinsnMovEdxLeaRcxDst = matchTarget + 52;\n            PBYTE pinsnCallCtor = matchTarget + 73;\n\n            DWORD dwOldProtect;\n            if (VirtualProtect(matchTarget, 80, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                memset(pinsnCallLoadComponent, 0x90, 5); // nop\n                memcpy(pinsnMovEdxLeaRcxDst, pinsnMovEdxLeaRcxSrc, 8); // change Platform::Details::Heap::Allocate(x, x) args\n                *(int*)(pinsnCallCtor + 1) = (int)((INT_PTR)pfn - (INT_PTR)(pinsnCallCtor + 5)); // change ctor call target\n                g_bQuickActionControlTemplatesPatched = true;\n                VirtualProtect(matchTarget, 80, dwOldProtect, &dwOldProtect);\n            }\n        }\n#elif defined(_M_ARM64)\n        // Note: These patterns will break when the class sizes change!\n\n        PBYTE pfn = nullptr;\n\n        // Find source\n        // B7 17 00 F9 ?? ?? ?? ?? ?? ?? ?? ?? 01 12 80 D2 00 0F 80 D2 00 01 3F D6 A0 13 00 F9 ?? ?? ?? ?? ?? 03 00 AA\n        //                                     ^^^^^^^^^^^^^^^^^^^^^^^                         ^^^^^^^^^^^\n        // ref new QuickActions::QuickActionTemplates();\n        // Ref: QuickActions::QuickActionTemplates::Instance::get()\n        PBYTE matchSource = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\xB7\\x17\\x00\\xF9\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x12\\x80\\xD2\\x00\\x0F\\x80\\xD2\\x00\\x01\\x3F\\xD6\\xA0\\x13\\x00\\xF9\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\xAA\",\n            \"xxxx????????xxxxxxxxxxxxxxxx?????xxx\"\n        );\n        if (matchSource)\n        {\n            pfn = matchSource + 28;\n            pfn = (PBYTE)ARM64_FollowBL((DWORD*)pfn);\n        }\n\n        // Find target\n        // E1 03 ?? AA E0 03 ?? AA ?? ?? ?? ?? 1F 20 03 D5 E0 03 ?? AA ?? ?? ?? ?? 1F 20 03 D5 E0 03 ?? AA ?? ?? ?? ??\n        //                         xxxxxxxxxxx nop\n        // E1 03 ?? AA E0 03 ?? AA ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 01 17 80 D2 00 14 80 D2 00 01 3F D6 40 03 00 F9\n        //                                                             xxxxxxxxxxxxxxxxxxxxxxx mov x1 & mov x0\n        // ?? ?? ?? ?? ?? 03 00 AA\n        // xxxxxxxxxxx ctor call\n        // ref new QuickActions::ControlCenter::ControlCenterTemplates();\n        // Ref: QuickActions::QuickActionControl::QuickActionControl()\n        PBYTE matchTarget = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\xE1\\x03\\x00\\xAA\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x1F\\x20\\x03\\xD5\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x1F\\x20\\x03\\xD5\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\"\n            \"\\xE1\\x03\\x00\\xAA\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x17\\x80\\xD2\\x00\\x14\\x80\\xD2\\x00\\x01\\x3F\\xD6\\x40\\x03\\x00\\xF9\"\n            \"\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\xAA\",\n            \"xx?xxx?x????xxxxxx?x????xxxxxx?x????\"\n            \"xx?xxx?x????????????xxxxxxxxxxxxxxxx\"\n            \"?????xxx\"\n        );\n\n        if (matchSource && matchTarget && pfn)\n        {\n            DWORD* pinsnMovX1MovX0Src = (DWORD*)(matchSource + 12);\n\n            DWORD* pinsnBLLoadComponent = (DWORD*)(matchTarget + 8);\n            DWORD* pinsnMovX1MovX0Dst = (DWORD*)(matchTarget + 56);\n            DWORD* pinsnBLTemplatesCtor = (DWORD*)(matchTarget + 72);\n\n            DWORD insnBLNew = ARM64_MakeBL((int)(((UINT_PTR)pfn - (UINT_PTR)pinsnBLTemplatesCtor) / 4));\n\n            DWORD dwOldProtect;\n            if (insnBLNew && VirtualProtect(matchTarget, 80, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *pinsnBLLoadComponent = 0xD503201F; // nop\n                memcpy(pinsnMovX1MovX0Dst, pinsnMovX1MovX0Src, 8); // change Platform::Details::Heap::Allocate(x, x) args\n                *pinsnBLTemplatesCtor = insnBLNew; // change ctor call target\n                g_bQuickActionControlTemplatesPatched = true;\n                VirtualProtect(matchTarget, 80, dwOldProtect, &dwOldProtect);\n            }\n        }\n#endif\n    }\n}\n\n// Revert network flyout quick actions buttons to Cobalt-Nickel style\n// If we're doing the quick actions patch but not this, they will only appear as non-interactive text blocks.\nHRESULT WINAPI NetworkUX_WindowsCreateStringReference(\n    PCWSTR sourceString, UINT32 length, HSTRING_HEADER* hstringHeader, HSTRING* string)\n{\n    static constexpr WCHAR c_szToggleButtonWinuiFluentTemplate[] = L\"ToggleButtonWinuiFluentTemplate\";\n    static constexpr WCHAR c_szQuickToggleWinuiFluentTemplate[] = L\"QuickToggleWinuiFluentTemplate\";\n\n    switch (length)\n    {\n        case ARRAYSIZE(c_szToggleButtonWinuiFluentTemplate) - 1:\n            if (wcscmp(sourceString, c_szToggleButtonWinuiFluentTemplate) == 0 && g_bQuickActionControlTemplatesPatched)\n            {\n                sourceString = c_szQuickToggleWinuiFluentTemplate;\n                length = ARRAYSIZE(c_szQuickToggleWinuiFluentTemplate) - 1;\n            }\n            break;\n    }\n\n    return WindowsCreateStringReference(sourceString, length, hstringHeader, string);\n}\n\nHRESULT NetworkUX_PatchResourceDictionary()\n{\n    SimpleBoxer_WilInitVars();\n    ComPtr<IInspectable> spKey, spValue;\n\n    ComPtr<wfc::IMap<IInspectable*, IInspectable*>> spResourceDictionary_Map; // = wux::Application::Current().Resources();\n    {\n        ComPtr<wux::IApplicationStatics> spApplicationStatics;\n        RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(\n            Wrappers::HStringReference(RuntimeClass_Windows_UI_Xaml_Application).Get(), &spApplicationStatics));\n\n        ComPtr<wux::IApplication> spApplication;\n        RETURN_IF_FAILED(spApplicationStatics->get_Current(&spApplication));\n\n        ComPtr<wux::IResourceDictionary> spResourceDictionary;\n        RETURN_IF_FAILED(spApplication->get_Resources(&spResourceDictionary));\n        RETURN_IF_FAILED(spResourceDictionary.As(&spResourceDictionary_Map));\n    }\n\n    ComPtr<IInspectable> spQuickActionPanelMargin; // = spResourceDictionary.Lookup(L\"QuickActionPanelMargin\");\n    ComPtr<wux::IStyle> spQuickActionControlStyle; // = spResourceDictionary.Lookup(L\"QuickActionControlStyle\").try_as<wux::IStyle>();\n    {\n        {\n            RETURN_IF_FAILED(SimpleBoxer_BoxValue(L\"QuickActionPanelMargin\", &spKey));\n            spResourceDictionary_Map->Lookup(spKey.Get(), &spQuickActionPanelMargin);\n        }\n        {\n            ComPtr<IInspectable> spQuickActionControlStyle_Object;\n            RETURN_IF_FAILED(SimpleBoxer_BoxValue(L\"QuickActionControlStyle\", &spKey));\n            if (SUCCEEDED(spResourceDictionary_Map->Lookup(spKey.Get(), &spQuickActionControlStyle_Object)))\n            {\n                spQuickActionControlStyle_Object.As(&spQuickActionControlStyle);\n            }\n        }\n    }\n\n    // Old: <Thickness x:Key=\"QuickActionPanelMargin\" Value=\"12,0,0,12\" /> <-- change back to this\n    // New: <Thickness x:Key=\"QuickActionPanelMargin\" Value=\"12,0,24,0\" />\n    if (spQuickActionPanelMargin.Get())\n    {\n        boolean bReplaced;\n        RETURN_IF_FAILED(SimpleBoxer_BoxValue(L\"QuickActionPanelMargin\", &spKey));\n        RETURN_IF_FAILED(SimpleBoxer_BoxValue(wux::Thickness(12.0, 0.0, 0.0, 12.0), &spValue));\n        RETURN_IF_FAILED(spResourceDictionary_Map->Insert(spKey.Get(), spValue.Get(), &bReplaced));\n    }\n\n    // Old: Margin=(4,0,0,4) Width=90 Height=64 <-- change back to this\n    // New: Margin=(12,0,0,0) Width=96 Height=90\n    if (spQuickActionControlStyle.Get())\n    {\n        ComPtr<wfc::IVector<wux::SetterBase*>> spSetters_Vector; // = spQuickActionControlStyle.Setters();\n        {\n            ComPtr<wux::ISetterBaseCollection> spSetters;\n            RETURN_IF_FAILED(spQuickActionControlStyle->get_Setters(&spSetters));\n            RETURN_IF_FAILED(spSetters.As(&spSetters_Vector));\n        }\n\n        RETURN_IF_FAILED(spSetters_Vector->Clear());\n\n        ComPtr<wux::ISetterFactory> spSetterFactory;\n        RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(\n            Wrappers::HStringReference(RuntimeClass_Windows_UI_Xaml_Setter).Get(), &spSetterFactory));\n\n        ComPtr<wux::IDependencyProperty> spMarginProperty, spWidthProperty, spHeightProperty;\n        {\n            ComPtr<wux::IFrameworkElementStatics> spFrameworkElementStatics;\n            RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(\n                Wrappers::HStringReference(RuntimeClass_Windows_UI_Xaml_FrameworkElement).Get(), &spFrameworkElementStatics));\n\n            RETURN_IF_FAILED(spFrameworkElementStatics->get_MarginProperty(&spMarginProperty));\n            RETURN_IF_FAILED(spFrameworkElementStatics->get_WidthProperty(&spWidthProperty));\n            RETURN_IF_FAILED(spFrameworkElementStatics->get_HeightProperty(&spHeightProperty));\n        }\n\n        struct\n        {\n            wux::IDependencyProperty* pProperty;\n            ComPtr<IInspectable> spValue;\n        } rgSettersToAdd[] =\n        {\n            { spMarginProperty.Get(), SimpleBoxer_InlineBoxValue(wux::Thickness(4.0, 0.0, 0.0, 4.0)) },\n            { spWidthProperty.Get(), SimpleBoxer_InlineBoxValue(90.0) },\n            { spHeightProperty.Get(), SimpleBoxer_InlineBoxValue(64.0) },\n        };\n\n        for (const auto& entry : rgSettersToAdd)\n        {\n            RETURN_IF_NULL_ALLOC(entry.spValue);\n\n            ComPtr<wux::ISetter> spSetter;\n            RETURN_IF_FAILED(spSetterFactory->CreateInstance(entry.pProperty, entry.spValue.Get(), &spSetter));\n\n            ComPtr<wux::ISetterBase> spSetter_Base;\n            RETURN_IF_FAILED(spSetter.As(&spSetter_Base));\n            RETURN_IF_FAILED(spSetters_Vector->Append(spSetter_Base.Get()));\n        }\n    }\n\n    return S_OK;\n}\n\nvoid (*NetworkUX_App_LoadResourceDictionariesFunc)();\nvoid NetworkUX_App_LoadResourceDictionariesHook()\n{\n    NetworkUX_App_LoadResourceDictionariesFunc();\n\n    if (g_bQuickActionControlTemplatesPatched)\n    {\n        NetworkUX_PatchResourceDictionary();\n    }\n}\n\nvoid HandleLoadedNetworkUX(HMODULE hModule)\n{\n    if (!hModule)\n    {\n        return;\n    }\n\n    static bool bPatched = false;\n    if (bPatched)\n    {\n        return;\n    }\n    bPatched = true;\n\n    VnPatchIAT(hModule, (PSTR)\"api-ms-win-core-winrt-string-l1-1-0.dll\", (PSTR)\"WindowsCreateStringReference\", (uintptr_t)NetworkUX_WindowsCreateStringReference);\n\n    PBYTE pSearch;\n    DWORD cbSearch;\n    if (TextSectionBeginAndSize(hModule, &pSearch, &cbSearch))\n    {\n#if defined(_M_X64)\n        // NetworkUX::App::LoadResourceDictionaries()\n        // 48 8B 40 10 E8 ?? ?? ?? ?? E8 ?? ?? ?? ?? 80 3D ?? ?? ?? ?? 00 75 05 E8\n        //                            .  ^^^^^^^^^^^\n        // Ref: NetworkUX::App::StaticOnLaunched()\n        PBYTE match = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\x48\\x8B\\x40\\x10\\xE8\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x80\\x3D\\x00\\x00\\x00\\x00\\x00\\x75\\x05\\xE8\",\n            \"xxxxx????x????xx????xxxx\"\n        );\n        if (match)\n        {\n            match += 9;\n            match += 5 + *(int*)(match + 1);\n        }\n#elif defined(_M_ARM64)\n        // NetworkUX::App::LoadResourceDictionaries()\n        // E0 03 ?? AA ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 08 ?? ?? ?? 48 00 00 35\n        //                         ^^^^^^^^^^^\n        // Ref: NetworkUX::App::StaticOnLaunched()\n        PBYTE match = (PBYTE)FindPattern(\n            pSearch, cbSearch,\n            \"\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x00\\x48\\x00\\x00\\x35\",\n            \"xx?x????????????x???xxxx\"\n        );\n        if (match)\n        {\n            match += 8;\n            match = (PBYTE)ARM64_FollowBL((DWORD*)match);\n        }\n#endif\n        if (match)\n        {\n            NetworkUX_App_LoadResourceDictionariesFunc = reinterpret_cast<decltype(NetworkUX_App_LoadResourceDictionariesFunc)>(match);\n            funchook_prepare(funchook, (void**)&NetworkUX_App_LoadResourceDictionariesFunc, NetworkUX_App_LoadResourceDictionariesHook);\n        }\n    }\n}\n\ntypedef HRESULT (WINAPI* GetActivationFactoryByPCWSTR_t)(PCWSTR activatableClassId, REFIID riid, void** ppv);\nGetActivationFactoryByPCWSTR_t GetActivationFactoryByPCWSTRFunc;\nHRESULT WINAPI SEH_GetActivationFactoryByPCWSTR(PCWSTR activatableClassId, REFIID riid, void** ppv)\n{\n    HRESULT hr = GetActivationFactoryByPCWSTRFunc(activatableClassId, riid, ppv);\n\n    if (SUCCEEDED(hr))\n    {\n        if (wcscmp(activatableClassId, L\"QuickActions.quickactions_XamlTypeInfo.XamlMetaDataProvider\") == 0)\n        {\n            HandleLoadedQuickActions(GetModuleHandleW(L\"Windows.UI.QuickActions.dll\"));\n        }\n        else if (wcscmp(activatableClassId, L\"NetworkUX.networkux_XamlTypeInfo.XamlMetaDataProvider\") == 0)\n        {\n            HandleLoadedNetworkUX(GetModuleHandleW(L\"NetworkUX.dll\"));\n        }\n    }\n\n    return hr;\n}\n\nvoid InjectShellExperienceHostFor22H2OrHigher()\n{\n    if (!IsWindows11Version22H2Build1413OrHigher())\n    {\n        HKEY hKey;\n        if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) == ERROR_SUCCESS)\n        {\n            RegCloseKey(hKey);\n            HMODULE hQA = LoadLibraryW(L\"Windows.UI.QuickActions.dll\");\n            if (hQA)\n            {\n                VnPatchIAT(hQA, (PSTR)\"api-ms-win-core-sysinfo-l1-2-0.dll\", (PSTR)\"GetProductInfo\", (uintptr_t)SEH_GetProductInfo);\n                // VnPatchIAT(hQA, \"ntdll.dll\", \"RtlGetDeviceFamilyInfoEnum\", SEH_RtlGetDeviceFamilyInfoEnum);\n                // VnPatchIAT(hQA, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegGetValueW\", SEH_RegGetValueW);\n            }\n        }\n    }\n\n    if (global_rovi.dwBuildNumber >= 25951)\n    {\n        HMODULE hWincorlib = GetModuleHandleW(L\"wincorlib.DLL\");\n        if (hWincorlib)\n        {\n            GetActivationFactoryByPCWSTRFunc = (GetActivationFactoryByPCWSTR_t)GetProcAddress(hWincorlib, \"?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z\");\n        }\n\n        HMODULE hSEH = GetModuleHandleW(nullptr);\n        if (hSEH)\n        {\n            if (GetActivationFactoryByPCWSTRFunc)\n            {\n                VnPatchIAT(hSEH, (PSTR)\"wincorlib.DLL\", (PSTR)\"?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z\", (uintptr_t)SEH_GetActivationFactoryByPCWSTR);\n            }\n        }\n    }\n}\n\nEXTERN_C_END\n\n#include \"inc/PopNoWilResultMacrosLogging.h\"\n"
  },
  {
    "path": "ExplorerPatcher/StartMenu.c",
    "content": "#include \"StartMenu.h\"\r\n\r\nvoid OpenStartOnMonitor(HMONITOR monitor)\r\n{\r\n    HRESULT hr = S_OK;\r\n    IUnknown* pImmersiveShell = NULL;\r\n    hr = CoCreateInstance(\r\n        &CLSID_ImmersiveShell,\r\n        NULL,\r\n        CLSCTX_NO_CODE_DOWNLOAD | CLSCTX_LOCAL_SERVER,\r\n        &IID_IServiceProvider,\r\n        &pImmersiveShell\r\n    );\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        IImmersiveMonitorService* pMonitorService = NULL;\r\n        IUnknown_QueryService(\r\n            pImmersiveShell,\r\n            &SID_IImmersiveMonitorService,\r\n            &IID_IImmersiveMonitorService,\r\n            &pMonitorService\r\n        );\r\n        if (pMonitorService)\r\n        {\r\n            IUnknown* pMonitor = NULL;\r\n            pMonitorService->lpVtbl->GetFromHandle(\r\n                pMonitorService,\r\n                monitor,\r\n                &pMonitor\r\n            );\r\n            IImmersiveLauncher10RS* pLauncher = NULL;\r\n            IUnknown_QueryService(\r\n                pImmersiveShell,\r\n                &SID_ImmersiveLauncher,\r\n                &IID_IImmersiveLauncher10RS,\r\n                &pLauncher\r\n            );\r\n            if (pLauncher)\r\n            {\r\n                BOOL bIsVisible = FALSE;\r\n                pLauncher->lpVtbl->IsVisible(pLauncher, &bIsVisible);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    if (!bIsVisible)\r\n                    {\r\n                        if (pMonitor)\r\n                        {\r\n                            pLauncher->lpVtbl->ConnectToMonitor(pLauncher, pMonitor);\r\n                        }\r\n                        pLauncher->lpVtbl->ShowStartView(pLauncher, 11, 0);\r\n                    }\r\n                    else\r\n                    {\r\n                        pLauncher->lpVtbl->Dismiss(pLauncher);\r\n                    }\r\n                }\r\n                pLauncher->lpVtbl->Release(pLauncher);\r\n            }\r\n            if (pMonitor)\r\n            {\r\n                pMonitor->lpVtbl->Release(pMonitor);\r\n            }\r\n            pMonitorService->lpVtbl->Release(pMonitorService);\r\n        }\r\n        pImmersiveShell->lpVtbl->Release(pImmersiveShell);\r\n    }\r\n}\r\n\r\nLRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(\r\n    int code,\r\n    WPARAM wParam,\r\n    LPARAM lParam\r\n)\r\n{\r\n    if (code == HC_ACTION && wParam)\r\n    {\r\n        MSG* msg = (MSG*)lParam;\r\n        if (GetSystemMetrics(SM_CMONITORS) >= 2 && msg->message == WM_SYSCOMMAND && (msg->wParam & 0xFFF0) == SC_TASKLIST)\r\n        {\r\n            printf(\"Position Start\\n\");\r\n            if (bMonitorOverride == 1)\r\n            {\r\n                goto finish;\r\n            }\r\n\r\n            /*DWORD dwStatus = 0;\r\n            DWORD dwSize = sizeof(DWORD);\r\n            HMODULE hModule = GetModuleHandle(TEXT(\"Shlwapi.dll\"));\r\n            FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, \"SHRegGetValueFromHKCUHKLM\");\r\n            if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(\r\n                TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\"),\r\n                TEXT(\"MonitorOverride\"),\r\n                SRRF_RT_REG_DWORD,\r\n                NULL,\r\n                &dwStatus,\r\n                (LPDWORD)(&dwSize)\r\n            ) != ERROR_SUCCESS || dwStatus == 1)\r\n            {\r\n                goto finish;\r\n            }*/\r\n\r\n            HMONITOR monitor = NULL;\r\n            if (!bMonitorOverride)\r\n            {\r\n                DWORD pts = GetMessagePos();\r\n                POINT pt;\r\n                pt.x = GET_X_LPARAM(pts);\r\n                pt.y = GET_Y_LPARAM(pts);\r\n                printf(\"!! %d %d\\n\", pt.x, pt.y);\r\n                monitor = MonitorFromPoint(\r\n                    pt,\r\n                    MONITOR_DEFAULTTONULL\r\n                );\r\n            }\r\n            else\r\n            {\r\n                MonitorOverrideData mod;\r\n                mod.cbIndex = 2;\r\n                mod.dwIndex = bMonitorOverride;\r\n                mod.hMonitor = NULL;\r\n                EnumDisplayMonitors(NULL, NULL, ExtractMonitorByIndex, &mod);\r\n                if (mod.hMonitor == NULL)\r\n                {\r\n                    POINT pt; pt.x = 0; pt.y = 0;\r\n                    monitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);\r\n                }\r\n                else\r\n                {\r\n                    monitor = mod.hMonitor;\r\n                }\r\n            }\r\n            OpenStartOnMonitor(monitor);\r\n\r\n            msg->message = WM_NULL;\r\n        }\r\n    }\r\nfinish:\r\n    return CallNextHookEx(NULL, code, wParam, lParam);\r\n}\r\n\r\nDWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unused)\r\n{\r\n    HANDLE hEvent = CreateEventW(0, 0, 0, L\"ShellDesktopSwitchEvent\");\r\n    if (!hEvent)\r\n    {\r\n        printf(\"Failed to start \\\"Open Start on current monitor\\\" thread.\\n\");\r\n        return 0;\r\n    }\r\n    WaitForSingleObject(\r\n        hEvent,\r\n        INFINITE\r\n    );\r\n    printf(\"Started \\\"Open Start on current monitor\\\" thread.\\n\");\r\n    HWND g_ProgWin = NULL;\r\n    while (!g_ProgWin)\r\n    {\r\n        g_ProgWin = GetShellWindow();\r\n        if (!g_ProgWin)\r\n        {\r\n            Sleep(100);\r\n        }\r\n    }\r\n    printf(\"Progman: %d\\n\", g_ProgWin);\r\n    DWORD progThread = GetWindowThreadProcessId(\r\n        g_ProgWin,\r\n        NULL\r\n    );\r\n    HHOOK g_ProgHook = SetWindowsHookEx(\r\n        WH_GETMESSAGE,\r\n        OpenStartOnCurentMonitorThreadHook,\r\n        NULL,\r\n        progThread\r\n    );\r\n    printf(\"Progman hook: %d\\n\", g_ProgHook);\r\n    MSG msg = { 0 };\r\n    while (GetMessage(&msg, NULL, 0, 0))\r\n    {\r\n        TranslateMessage(&msg);\r\n        DispatchMessage(&msg);\r\n    }\r\n\r\n    printf(\"Ended \\\"Open Start on current monitor\\\" thread.\\n\");\r\n}\r\n\r\nDWORD OpenStartAtLogonThread(OpenStartAtLogonThreadParams* unused)\r\n{\r\n    HANDLE hEvent = CreateEvent(0, 0, 0, L\"ShellDesktopSwitchEvent\");\r\n    if (!hEvent)\r\n    {\r\n        printf(\"Failed to start \\\"Open Start at Logon\\\" thread.\\n\");\r\n        return 0;\r\n    }\r\n    WaitForSingleObject(\r\n        hEvent,\r\n        INFINITE\r\n    );\r\n    printf(\"Started \\\"Open Start at Logon\\\" thread.\\n\");\r\n\r\n    if (!bOpenAtLogon)\r\n    {\r\n        return 0;\r\n    }\r\n\r\n    /*DWORD dwStatus = 0;\r\n    DWORD dwSize = sizeof(DWORD);\r\n    HMODULE hModule = GetModuleHandle(TEXT(\"Shlwapi\"));\r\n    FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, \"SHRegGetValueFromHKCUHKLM\");\r\n    if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(\r\n        TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\"),\r\n        TEXT(\"OpenAtLogon\"),\r\n        SRRF_RT_REG_DWORD,\r\n        NULL,\r\n        &dwStatus,\r\n        (LPDWORD)(&dwSize)\r\n    ) != ERROR_SUCCESS || dwStatus == 0)\r\n    {\r\n        return 0;\r\n    }*/\r\n\r\n    POINT pt;\r\n    pt.x = 0;\r\n    pt.y = 0;\r\n    HMONITOR monitor = MonitorFromPoint(\r\n        pt,\r\n        MONITOR_DEFAULTTOPRIMARY\r\n    );\r\n    OpenStartOnMonitor(monitor);\r\n\r\n    printf(\"Ended \\\"Open Start at Logon\\\" thread.\\n\");\r\n}\r\n\r\nDWORD WINAPI HookStartMenu(HookStartMenuParams* params)\r\n{\r\n    printf(\"Started \\\"Hook Start Menu\\\" thread.\\n\");\r\n\r\n    TCHAR wszKnownPath[MAX_PATH];\r\n    GetWindowsDirectoryW(wszKnownPath, MAX_PATH);\r\n    wcscat_s(wszKnownPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartMenuExperienceHost.exe\");\r\n\r\n    while (TRUE)\r\n    {\r\n        unsigned int retry = 0;\r\n        HANDLE hProcess, hSnapshot;\r\n        PROCESSENTRY32 pe32;\r\n        while (TRUE)\r\n        {\r\n            hProcess = NULL;\r\n            hSnapshot = NULL;\r\n            ZeroMemory(&pe32, sizeof(PROCESSENTRY32));\r\n            pe32.dwSize = sizeof(PROCESSENTRY32);\r\n            hSnapshot = CreateToolhelp32Snapshot(\r\n                TH32CS_SNAPPROCESS,\r\n                0\r\n            );\r\n            if (Process32First(hSnapshot, &pe32) == TRUE)\r\n            {\r\n                do\r\n                {\r\n                    if (!wcscmp(pe32.szExeFile, TEXT(\"StartMenuExperienceHost.exe\")))\r\n                    {\r\n                        hProcess = OpenProcess(\r\n                            PROCESS_QUERY_LIMITED_INFORMATION |\r\n                            PROCESS_VM_OPERATION |\r\n                            PROCESS_VM_READ |\r\n                            PROCESS_VM_WRITE |\r\n                            PROCESS_CREATE_THREAD |\r\n                            SYNCHRONIZE,\r\n                            FALSE,\r\n                            pe32.th32ProcessID\r\n                        );\r\n                        if (!hProcess)\r\n                        {\r\n                            printf(\"Unable to open handle to StartMenuExperienceHost.exe.\\n\");\r\n                            CloseHandle(hSnapshot);\r\n                            Sleep(params->dwTimeout);\r\n                            continue;\r\n                        }\r\n                        TCHAR wszProcessPath[MAX_PATH];\r\n                        DWORD dwLength = MAX_PATH;\r\n                        QueryFullProcessImageNameW(\r\n                            hProcess,\r\n                            0,\r\n                            wszProcessPath,\r\n                            &dwLength\r\n                        );\r\n                        if (!_wcsicmp(wszProcessPath, wszKnownPath))\r\n                        {\r\n                            break;\r\n                        }\r\n                        else\r\n                        {\r\n                            CloseHandle(hProcess);\r\n                            hProcess = NULL;\r\n                        }\r\n                    }\r\n                } while (Process32Next(hSnapshot, &pe32) == TRUE);\r\n            }\r\n            if (hSnapshot)\r\n            {\r\n                CloseHandle(hSnapshot);\r\n            }\r\n            if (hProcess)\r\n            {\r\n                break;\r\n            }\r\n            else\r\n            {\r\n                retry++;\r\n                if (retry > 20) return 0;\r\n                Sleep(params->dwTimeout);\r\n            }\r\n        }\r\n        printf(\"[StartMenu] Process found.\\n\");\r\n        LPVOID lpRemotePath = VirtualAllocEx(\r\n            hProcess,\r\n            NULL,\r\n            MAX_PATH,\r\n            MEM_COMMIT | MEM_RESERVE,\r\n            PAGE_READWRITE\r\n        );\r\n        if (!lpRemotePath)\r\n        {\r\n            printf(\"[StartMenu] Unable to allocate path memory.\\n\");\r\n            Sleep(1000);\r\n            continue;\r\n        }\r\n        printf(\"[StartMenu] Allocated path memory.\\n\");\r\n        if (!WriteProcessMemory(\r\n            hProcess,\r\n            lpRemotePath,\r\n            (void*)params->wszModulePath,\r\n            MAX_PATH,\r\n            NULL\r\n        ))\r\n        {\r\n            printf(\"[StartMenu] Unable to write path.\\n\");\r\n            Sleep(params->dwTimeout);\r\n            continue;\r\n        }\r\n        wprintf(L\"[StartMenu] Wrote path: %s.\\n\", params->wszModulePath);\r\n        //Sleep(8000);\r\n\r\n        BYTE shellcode[] = {\r\n            // sub rsp, 28h\r\n            //// 0x48, 0x83, 0xec, 0x28,\r\n            // mov [rsp + 18h], rax\r\n            //// 0x48, 0x89, 0x44, 0x24, 0x18,\r\n            // mov [rsp + 10h], rcx\r\n            //// 0x48, 0x89, 0x4c, 0x24, 0x10,\r\n            // int 3\r\n            //0xcc,\r\n            \r\n            // sub rsp, 28h\r\n            0x48, 0x83, 0xec, 0x28,\r\n            // mov rcx, 1111111111111111h; placeholder for DLL path\r\n            0x48, 0xb9, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,\r\n            // mov rax, 2222222222222222h; placeholder for \"LoadLibraryW\" address\r\n            0x48, 0xb8, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,\r\n            // call rax\r\n            0xff, 0xd0,\r\n            // cmp rax, 0\r\n            0x48, 0x83, 0xF8, 0x00,\r\n            // jz; skip if LoadLibraryW failed\r\n            0x74, 0x14,\r\n            // mov rcx, 4444444444444444h; placeholder for entry point\r\n            0x48, 0xb9, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,\r\n            // add rax, rcx\r\n            0x48, 0x01, 0xc8,\r\n            // call rax\r\n            0xff, 0xd0,\r\n            // add rsp, 28h\r\n            0x48, 0x83, 0xc4, 0x28,\r\n            // ret\r\n            0xc3,\r\n            // mov rax, 5555555555555555h; placeholder for \"GetLastError\" address\r\n            0x48, 0xb8, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,\r\n            // call rax\r\n            0xff, 0xd0,\r\n            // add rsp, 28h\r\n            0x48, 0x83, 0xc4, 0x28,\r\n            // ret\r\n            0xc3,\r\n\r\n            // mov rcx, [rsp + 10h]\r\n            //// 0x48, 0x8b, 0x4c, 0x24, 0x10,\r\n            // mov rax, [rsp + 18h]\r\n            //// 0x48, 0x8b, 0x44, 0x24, 0x18,\r\n            // add rsp, 28h\r\n            //// 0x48, 0x83, 0xc4, 0x28,\r\n            // mov r11, 33333333333333333h; placeholder for the original RIP\r\n            0x49, 0xbb, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,\r\n            // jmp r11\r\n            0x41, 0xff, 0xe3\r\n        };\r\n        uintptr_t pattern = 0;\r\n        pattern = 0x1111111111111111;\r\n        *(LPVOID*)(memmem(shellcode, sizeof(shellcode), &pattern, sizeof(uintptr_t))) = lpRemotePath;\r\n        pattern = 0x2222222222222222;\r\n        *(LPVOID*)(memmem(shellcode, sizeof(shellcode), &pattern, sizeof(uintptr_t))) = LoadLibraryW;\r\n        pattern = 0x4444444444444444;\r\n        *(LPVOID*)(memmem(shellcode, sizeof(shellcode), &pattern, sizeof(uintptr_t))) = ((uintptr_t)params->proc - (uintptr_t)params->hModule);\r\n        pattern = 0x5555555555555555;\r\n        *(LPVOID*)(memmem(shellcode, sizeof(shellcode), &pattern, sizeof(uintptr_t))) = GetLastError;\r\n\r\n        LPVOID lpRemoteCode = VirtualAllocEx(\r\n            hProcess,\r\n            NULL,\r\n            sizeof(shellcode),\r\n            MEM_COMMIT | MEM_RESERVE,\r\n            PAGE_EXECUTE_READWRITE\r\n        );\r\n        if (!lpRemoteCode)\r\n        {\r\n            printf(\"[StartMenu] Unable to allocate shellcode memory.\\n\");\r\n            Sleep(1000);\r\n            continue;\r\n        }\r\n        printf(\"[StartMenu] Allocated shellcode memory %p.\\n\", lpRemoteCode);\r\n        if (!WriteProcessMemory(\r\n            hProcess,\r\n            lpRemoteCode,\r\n            shellcode,\r\n            sizeof(shellcode),\r\n            NULL\r\n        ))\r\n        {\r\n            printf(\"[StartMenu] Unable to write shellcode.\\n\");\r\n            Sleep(params->dwTimeout);\r\n            continue;\r\n        }\r\n        wprintf(L\"[StartMenu] Wrote shellcode.\\n\");\r\n\r\n        wprintf(L\"[StartMenu] Size of image: %d\\n\", RtlImageNtHeader(params->hModule)->OptionalHeader.SizeOfImage);\r\n\r\n        HANDLE hThread = CreateRemoteThread(\r\n            hProcess,\r\n            NULL,\r\n            0,\r\n            lpRemoteCode,\r\n            0,\r\n            0,\r\n            NULL\r\n        );\r\n        if (!hThread)\r\n        {\r\n            printf(\"[StartMenu] Unable to inject DLL.\\n\");\r\n            Sleep(params->dwTimeout);\r\n            continue;\r\n        }\r\n        printf(\"[StartMenu] Injected DLL.\\n\");\r\n        if (WaitForSingleObject(hThread, INFINITE) != WAIT_OBJECT_0)\r\n        {\r\n            printf(\"[StartMenu] Unable to determine LoadLibrary outcome.\\n\");\r\n            Sleep(params->dwTimeout);\r\n            continue;\r\n        }\r\n        DWORD dwExitCode = 10;\r\n        GetExitCodeThread(hThread, &dwExitCode);\r\n        CloseHandle(hThread);\r\n        printf(\"[StartMenu] Library initialization returned: 0x%x.\\n\", dwExitCode);\r\n\r\n        WaitForSingleObject(\r\n            hProcess,\r\n            INFINITE\r\n        );\r\n        CloseHandle(hProcess);\r\n    }\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented(void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings)\r\n{\r\n    return E_NOTIMPL;\r\n}\r\n\r\nstatic ULONG STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_AddRefRelease(void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings)\r\n{\r\n    return 1;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings6_GetEffectiveSearchMode(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6,\r\n    DWORD* pEffectiveSearchMode\r\n)\r\n{\r\n    *pEffectiveSearchMode = 1;\r\n    return 0;\r\n}\r\n\r\nstatic void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6Vtbl[41] = { // : IInspectableVtbl\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_AddRefRelease,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_AddRefRelease,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings6_GetEffectiveSearchMode,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented\r\n};\r\ntypedef struct instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6 // : IInspectable\r\n{\r\n    void* lpVtbl;\r\n} WindowsUdk_UI_Shell_ITaskbarSettings6;\r\nstatic const WindowsUdk_UI_Shell_ITaskbarSettings6 instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6 = { instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6Vtbl };\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_QueryInterface(void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings, REFIID riid, void** ppv)\r\n{\r\n    if (IsEqualIID(riid, &IID_WindowsUdk_UI_Shell_ITaskbarSettings6)) {\r\n        *ppv = &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings6;\r\n        return S_OK;\r\n    }\r\n    return E_NOTIMPL;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_GetAlignment_Left(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n    DWORD* pAlignment\r\n)\r\n{\r\n    *pAlignment = 0;\r\n    return 0;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_GetAlignment_Center(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n    DWORD* pAlignment\r\n)\r\n{\r\n    *pAlignment = 1;\r\n    return 0;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_GetLocation_Left(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n    DWORD* pLocation\r\n)\r\n{\r\n    *pLocation = 0;\r\n    return 0;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_GetLocation_Center(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n    DWORD* pLocation\r\n)\r\n{\r\n    *pLocation = 1;\r\n    return 0;\r\n}\r\n\r\nstatic HRESULT STDMETHODCALLTYPE WindowsUdk_UI_Shell_ITaskbarSettings_GetSearchMode(\r\n    void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n    DWORD* pSearchMode\r\n)\r\n{\r\n    *pSearchMode = 1;\r\n    return 0;\r\n}\r\n\r\nstatic void* instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[41] = { // : IInspectableVtbl\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_QueryInterface,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_AddRefRelease,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_AddRefRelease,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_GetAlignment_Left,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_GetLocation_Left,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_GetSearchMode,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented,\r\n    WindowsUdk_UI_Shell_ITaskbarSettings_NotImplemented\r\n};\r\ntypedef struct instanceof_WindowsUdk_UI_Shell_ITaskbarSettings // : IInspectable\r\n{\r\n    void* lpVtbl;\r\n} WindowsUdk_UI_Shell_ITaskbarSettings;\r\nstatic const WindowsUdk_UI_Shell_ITaskbarSettings instanceof_WindowsUdk_UI_Shell_ITaskbarSettings = { instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl };\r\n\r\nstatic unsigned __int64 FindTokenByHMONITOR(const StartMenuPositioningData* data, HMONITOR hMonitor)\r\n{\r\n    for (DWORD i = 0; i < *data->pMonitorCount; i++)\r\n    {\r\n        if (data->pMonitorList[i].hMonitor == hMonitor)\r\n        {\r\n            return data->pMonitorList[i].token;\r\n        }\r\n    }\r\n    return 0;\r\n}\r\n\r\nBOOL NeedsRo_PositionStartMenuForMonitor(\r\n    HMONITOR hMonitor,\r\n    HDC unused1,\r\n    LPRECT unused2,\r\n    StartMenuPositioningData* data\r\n)\r\n{\r\n    // For this to have any chance to succeed, the Windows Runtime has to be\r\n    // already initialized on the calling thread, concurrency model RO_INIT_MULTITHREADED\r\n\r\n    HRESULT hr = S_OK;\r\n    HSTRING_HEADER hstringHeader_of_WindowsUdk_UI_Shell_TaskbarLayout;\r\n    HSTRING hstring_of_WindowsUdk_UI_Shell_TaskbarLayout = NULL;\r\n    WindowsUdk_UI_Shell_TaskbarLayoutStatics* pTaskbarLayoutFactory = NULL;\r\n    IInspectable* pTaskbarLayout = NULL;\r\n    WindowsUdk_UI_Shell_TaskbarLayoutManager* pTaskbarLayoutManager = NULL;\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = WindowsCreateStringReference(\r\n            L\"WindowsUdk.UI.Shell.TaskbarLayout\",\r\n            33,\r\n            &hstringHeader_of_WindowsUdk_UI_Shell_TaskbarLayout,\r\n            &hstring_of_WindowsUdk_UI_Shell_TaskbarLayout\r\n        );\r\n    }\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = RoGetActivationFactory(\r\n            hstring_of_WindowsUdk_UI_Shell_TaskbarLayout,\r\n            &IID_WindowsUdk_UI_Shell_TaskbarLayoutStatics,\r\n            &pTaskbarLayoutFactory\r\n        );\r\n    }\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        //hr = (*(HRESULT(**)(INT64, INT64*))(*(INT64*)pTaskbarLayoutFactory + 48))(pTaskbarLayoutFactory, &v12);\r\n        hr = pTaskbarLayoutFactory->lpVtbl->get_Current(pTaskbarLayoutFactory, &pTaskbarLayout);\r\n    }\r\n    int interfaceVersion = 1;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        /*hr = (**(HRESULT(***)(INT64, GUID*, INT64*))v12)(\r\n            v12,\r\n            &IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,\r\n            (INT64*)&v13\r\n            );*/\r\n        hr = pTaskbarLayout->lpVtbl->QueryInterface(\r\n            pTaskbarLayout,\r\n            &IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,\r\n            &pTaskbarLayoutManager\r\n        );\r\n        if (hr == E_NOINTERFACE)\r\n        {\r\n            interfaceVersion = 2;\r\n            hr = pTaskbarLayout->lpVtbl->QueryInterface(\r\n                pTaskbarLayout,\r\n                &IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,\r\n                &pTaskbarLayoutManager\r\n            );\r\n        }\r\n    }\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        //hr = (*(HRESULT(**)(INT64, HMONITOR, INT64(***)(), INT64))(*v13 + 48 + (sizeof(uintptr_t) * data->operation)))(v13, hMonitor, &p, 0);\r\n\r\n        // Filling a vtable for a winrt::WindowsUdk::UI::Shell::ITaskbarSettings interface\r\n        // some info about it can be found in method:\r\n        // > WindowsUdk::UI::Shell::Bamo::TaskbarLayoutBamoPrincipal::SetSettings\r\n        // from windowsudk.shellcommon.dll\r\n        // useful refrences: https://blog.magnusmontin.net/2017/12/30/minimal-uwp-wrl-xaml-app/\r\n        // registry: HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\WindowsRuntime\\ActivatableClassId\\WindowsUdk.UI.Shell.TaskbarLayout\r\n        if (data->location)\r\n        {\r\n            instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[6] = WindowsUdk_UI_Shell_ITaskbarSettings_GetAlignment_Center;\r\n            instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[10] = WindowsUdk_UI_Shell_ITaskbarSettings_GetLocation_Center;\r\n        }\r\n        else\r\n        {\r\n            instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[6] = WindowsUdk_UI_Shell_ITaskbarSettings_GetAlignment_Left;\r\n            instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[10] = WindowsUdk_UI_Shell_ITaskbarSettings_GetLocation_Left;\r\n        }\r\n        instanceof_WindowsUdk_UI_Shell_ITaskbarSettingsVtbl[14] = WindowsUdk_UI_Shell_ITaskbarSettings_GetSearchMode;\r\n\r\n        if (data->operation == STARTMENU_POSITIONING_OPERATION_ADD)\r\n        {\r\n            unsigned __int64 token = 0;\r\n            if (interfaceVersion == 1)\r\n            {\r\n                hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded(\r\n                    pTaskbarLayoutManager,\r\n                    (unsigned __int64)hMonitor,\r\n                    &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n                    NULL\r\n                );\r\n            }\r\n            else\r\n            {\r\n                hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded2(\r\n                    pTaskbarLayoutManager,\r\n                    (unsigned __int64)hMonitor,\r\n                    &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n                    NULL,\r\n                    &token\r\n                );\r\n            }\r\n            MonitorListEntry entry = {\r\n                .hMonitor = hMonitor,\r\n                .token = token\r\n            };\r\n            data->pMonitorList[InterlockedIncrement(data->pMonitorCount) - 1] = entry;\r\n            printf(\"[Positioning] Added settings for monitor %p : %d\\n\", hMonitor, data->location);\r\n        }\r\n        else if (data->operation == STARTMENU_POSITIONING_OPERATION_CHANGE)\r\n        {\r\n            hr = E_FAIL;\r\n            unsigned __int64 arg = interfaceVersion == 1 ? (unsigned __int64)hMonitor : FindTokenByHMONITOR(data, hMonitor);\r\n            if (arg)\r\n            {\r\n                hr = pTaskbarLayoutManager->lpVtbl->ReportSettingsForMonitor(\r\n                   pTaskbarLayoutManager,\r\n                   arg,\r\n                   &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings\r\n               );\r\n            }\r\n            printf(\"[Positioning] Changed settings for monitor: %p : %d\\n\", hMonitor, data->location);\r\n        }\r\n        else if (data->operation == STARTMENU_POSITIONING_OPERATION_REMOVE)\r\n        {\r\n            hr = E_FAIL;\r\n            unsigned __int64 arg = interfaceVersion == 1 ? (unsigned __int64)hMonitor : data->pMonitorList[data->i].token;\r\n            if (arg)\r\n            {\r\n                hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorRemoved(\r\n                   pTaskbarLayoutManager,\r\n                   arg\r\n               );\r\n            }\r\n            printf(\"[Positioning] Removed settings for monitor: %p\\n\", hMonitor);\r\n        }\r\n    }\r\n    if (pTaskbarLayoutManager)\r\n    {\r\n        pTaskbarLayoutManager->lpVtbl->Release(pTaskbarLayoutManager);\r\n        pTaskbarLayoutManager = NULL;\r\n    }\r\n    if (pTaskbarLayout)\r\n    {\r\n        pTaskbarLayout->lpVtbl->Release(pTaskbarLayout);\r\n        pTaskbarLayout = NULL;\r\n    }\r\n    if (pTaskbarLayoutFactory)\r\n    {\r\n        pTaskbarLayoutFactory->lpVtbl->Release(pTaskbarLayoutFactory);\r\n        pTaskbarLayoutFactory = NULL;\r\n    }\r\n    if (hstring_of_WindowsUdk_UI_Shell_TaskbarLayout)\r\n    {\r\n        WindowsDeleteString(hstring_of_WindowsUdk_UI_Shell_TaskbarLayout);\r\n        hstring_of_WindowsUdk_UI_Shell_TaskbarLayout = NULL;\r\n    }\r\n\r\n    return TRUE;\r\n}\r\n\r\nDWORD GetStartMenuPosition(t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLMFunc)\r\n{\r\n    DWORD dwSize = sizeof(DWORD);\r\n\r\n    DWORD dwTaskbarAl = 1;\r\n    if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(\r\n        TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\"),\r\n        TEXT(\"TaskbarAl\"),\r\n        SRRF_RT_REG_DWORD,\r\n        NULL,\r\n        &dwTaskbarAl,\r\n        &dwSize\r\n    ) != ERROR_SUCCESS)\r\n    {\r\n        dwTaskbarAl = 1;\r\n    }\r\n\r\n    return dwTaskbarAl;\r\n}"
  },
  {
    "path": "ExplorerPatcher/StartMenu.h",
    "content": "#ifndef _H_STARTMENU_H_\r\n#define _H_STARTMENU_H_\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n#include <windowsx.h>\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n#include <TlHelp32.h>\r\n#include <roapi.h>\r\n#include <winstring.h>\r\n#include \"utility.h\"\r\n\r\n#pragma comment(lib, \"ntdll.lib\")\r\nEXTERN_C NTSYSAPI PIMAGE_NT_HEADERS NTAPI RtlImageNtHeader(PVOID);\r\n\r\nextern DWORD bMonitorOverride;\r\nextern DWORD bOpenAtLogon;\r\n\r\nDEFINE_GUID(SID_IImmersiveMonitorService,\r\n    0x47094e3a,\r\n    0x0cf2, 0x430f, 0x80, 0x6f,\r\n    0xcf, 0x9e, 0x4f, 0x0f, 0x12, 0xdd\r\n);\r\n\r\nDEFINE_GUID(IID_IImmersiveMonitorService,\r\n    0x4d4c1e64,\r\n    0xe410, 0x4faa, 0xba, 0xfa,\r\n    0x59, 0xca, 0x06, 0x9b, 0xfe, 0xc2\r\n);\r\n\r\nDEFINE_GUID(SID_ImmersiveLauncher,\r\n    0x6f86e01c,\r\n    0xc649, 0x4d61, 0xbe, 0x23,\r\n    0xf1, 0x32, 0x2d, 0xde, 0xca, 0x9d\r\n);\r\n\r\nDEFINE_GUID(IID_IImmersiveLauncher10RS,\r\n    0xd8d60399,\r\n    0xa0f1, 0xf987, 0x55, 0x51,\r\n    0x32, 0x1f, 0xd1, 0xb4, 0x98, 0x64\r\n);\r\n\r\nDEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarSettings6,\r\n    0x5CBF9899,\r\n    0x3E66, 0x5556, 0xA1, 0x31,\r\n    0x1E, 0x3E, 0xE8, 0x14, 0x85, 0x90\r\n);\r\n\r\ntypedef interface IImmersiveMonitorService IImmersiveMonitorService;\r\n\r\ntypedef struct IImmersiveMonitorServiceVtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        IImmersiveMonitorService* This,\r\n        /* [in] */ REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetCount)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetConnectedCount)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetAt)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetFromHandle)(\r\n        IImmersiveMonitorService* This,\r\n        /* [in] */ HMONITOR hMonitor,\r\n        _COM_Outptr_  IUnknown** ppvObject);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetFromIdentity)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetImmersiveProxyMonitor)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryService)(\r\n        IImmersiveMonitorService* This,\r\n        HMONITOR hMonitor,\r\n        GUID*,\r\n        GUID*,\r\n        void** ppvObject\r\n        );\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryServiceByIdentity)(\r\n        IImmersiveMonitorService* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryServiceFromWindow)(\r\n        IImmersiveMonitorService* This,\r\n        HWND hWnd,\r\n        GUID* a3,\r\n        GUID* a4,\r\n        void** ppvObject\r\n        );\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryServiceFromPoint)(\r\n        IImmersiveMonitorService* This,\r\n        POINT pt,\r\n        GUID* a3,\r\n        GUID* a4,\r\n        void** ppvObject\r\n        );\r\n\r\n    END_INTERFACE\r\n} IImmersiveMonitorServiceVtbl;\r\n\r\ninterface IImmersiveMonitorService\r\n{\r\n    CONST_VTBL struct IImmersiveMonitorServiceVtbl* lpVtbl;\r\n};\r\n\r\ntypedef interface IImmersiveLauncher10RS IImmersiveLauncher10RS;\r\n\r\ntypedef struct IImmersiveLauncher10RSVtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n        HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n            IImmersiveLauncher10RS* This,\r\n            /* [in] */ REFIID riid,\r\n            /* [annotation][iid_is][out] */\r\n            _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ShowStartView)(\r\n        IImmersiveLauncher10RS* This,\r\n        /* [in] */ int method,\r\n        /* [in] */ int flags);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* Dismiss)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* method5)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* method6)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* IsVisible)(\r\n        IImmersiveLauncher10RS* This,\r\n        /* [in] */ BOOL* ret);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* method8)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* method9)(\r\n        IImmersiveLauncher10RS* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ConnectToMonitor)(\r\n        IImmersiveLauncher10RS* This,\r\n        /* [in] */ IUnknown* monitor);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetMonitor)(\r\n        IImmersiveLauncher10RS* This,\r\n        /* [in] */ IUnknown** monitor);\r\n\r\n    END_INTERFACE\r\n} IImmersiveLauncher10RSVtbl;\r\n\r\ninterface IImmersiveLauncher10RS\r\n{\r\n    CONST_VTBL struct IImmersiveLauncher10RSVtbl* lpVtbl;\r\n};\r\n\r\nvoid OpenStartOnMonitor(HMONITOR monitor);\r\n\r\n// Slightly tweaked version of function available in Open Shell \r\n// (Open-Shell-Menu\\Src\\StartMenu\\StartMenuHelper\\StartMenuHelper.cpp)\r\nLRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(\r\n    int code,\r\n    WPARAM wParam,\r\n    LPARAM lParam\r\n);\r\n\r\ntypedef DWORD OpenStartOnCurentMonitorThreadParams;\r\nDWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unused);\r\n\r\ntypedef DWORD OpenStartAtLogonThreadParams;\r\nDWORD OpenStartAtLogonThread(OpenStartAtLogonThreadParams* unused);\r\n\r\ntypedef struct _HookStartMenuParams\r\n{\r\n    HMODULE hModule;\r\n    DWORD dwTimeout;\r\n    wchar_t wszModulePath[MAX_PATH];\r\n    FARPROC proc;\r\n} HookStartMenuParams;\r\nDWORD WINAPI HookStartMenu(HookStartMenuParams* params);\r\n\r\ntypedef interface WindowsUdk_UI_Shell_TaskbarLayoutStatics WindowsUdk_UI_Shell_TaskbarLayoutStatics;\r\ntypedef interface WindowsUdk_UI_Shell_TaskbarLayoutManager WindowsUdk_UI_Shell_TaskbarLayoutManager;\r\n\r\nDEFINE_GUID(IID_WindowsUdk_UI_Shell_TaskbarLayoutStatics,\r\n    0x4472FE8B,\r\n    0xF3B1, 0x5CC9, 0x81, 0xc1,\r\n    0x76, 0xf8, 0xc3, 0x38, 0x8a, 0xab\r\n);\r\n\r\ntypedef struct WindowsUdk_UI_Shell_TaskbarLayoutStaticsVtbl // : IInspectableVtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n        HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n            __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This,\r\n            /* [in] */ __RPC__in REFIID riid,\r\n            /* [annotation][iid_is][out] */\r\n            _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Current)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutStatics* This,\r\n        /* [out] */ __RPC__out void** _instanceof_winrt_WindowsUdk_UI_Shell_implementation_TaskbarLayout);\r\n\r\n    END_INTERFACE\r\n} WindowsUdk_UI_Shell_TaskbarLayoutStaticsVtbl;\r\n\r\ninterface WindowsUdk_UI_Shell_TaskbarLayoutStatics // : IInspectable\r\n{\r\n    CONST_VTBL struct WindowsUdk_UI_Shell_TaskbarLayoutStaticsVtbl* lpVtbl;\r\n};\r\n\r\nDEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,\r\n    0xFB10D7C4,\r\n    0x4F7F, 0x5DE5, 0xA5, 0x28,\r\n    0x7E, 0xFE, 0xF4, 0x18, 0xAA, 0x48\r\n);\r\n\r\n// Used in 23545+ (or maybe couple lower builds too). Still named ITaskbarLayoutManager but has different ReportMonitorAdded signature.\r\nDEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,\r\n    0x98F82ED2,\r\n    0x4791, 0x58A0, 0x8D, 0x2F,\r\n    0xDA, 0xBD, 0x7A, 0x2F, 0x18, 0x9F\r\n);\r\n\r\ntypedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n        HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n            __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n            /* [in] */ __RPC__in REFIID riid,\r\n            /* [annotation][iid_is][out] */\r\n            _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    union\r\n    {\r\n        HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)(\r\n            __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n            __RPC__in unsigned __int64 hMonitor,\r\n            __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n            __RPC__in void* _unknown_shellViewToRectMap);\r\n\r\n        HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded2)(\r\n            __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n            __RPC__in unsigned __int64 hMonitor,\r\n            __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,\r\n            __RPC__in void* _unknown_shellViewToRectMap,\r\n            /* [out] */ __RPC__out unsigned __int64* result);\r\n    };\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ReportMonitorRemoved)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        __RPC__in unsigned __int64 hMonitor);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ReportMonitorChanged)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        __RPC__in unsigned __int64 hMonitor,\r\n        __RPC__in LPRECT _unknown_lpGeometry);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ReportSettingsForMonitor)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        __RPC__in unsigned __int64 hMonitor,\r\n        __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ReportShellViewButtonBounds)(\r\n        __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,\r\n        __RPC__in unsigned __int64 hMonitor,\r\n        __RPC__in void* _instanceof_winrt_WindowsUdk_UI_Shell_Bamo_ShellViewButtonBounds);\r\n\r\n    END_INTERFACE\r\n} WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl;\r\n\r\ninterface WindowsUdk_UI_Shell_TaskbarLayoutManager // : IInspectable\r\n{\r\n    CONST_VTBL struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl* lpVtbl;\r\n};\r\n\r\ntypedef struct _MonitorListEntry\r\n{\r\n    HMONITOR hMonitor;\r\n    unsigned __int64 token;\r\n} MonitorListEntry;\r\n\r\ntypedef struct _StartMenuPositioningData\r\n{\r\n    DWORD location;\r\n    DWORD operation;\r\n    DWORD* pMonitorCount;\r\n    MonitorListEntry* pMonitorList;\r\n    DWORD i;\r\n} StartMenuPositioningData;\r\n\r\n#define STARTMENU_POSITIONING_OPERATION_ADD 0\r\n#define STARTMENU_POSITIONING_OPERATION_REMOVE 1\r\n#define STARTMENU_POSITIONING_OPERATION_CHANGE 3\r\n\r\nBOOL NeedsRo_PositionStartMenuForMonitor(\r\n    HMONITOR hMonitor,\r\n    HDC unused1,\r\n    LPRECT unused2,\r\n    StartMenuPositioningData* data\r\n);\r\n\r\nDWORD GetStartMenuPosition(FARPROC SHRegGetValueFromHKCUHKLMFunc);\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/StartMenuSettings.cpp",
    "content": "﻿#include \"utility.h\"\r\n#include \"hooking.h\"\r\n\r\n#include <windows.h>\r\n#include <windows.system.h>\r\n#include <windows.ui.shell.h>\r\n#include <winrt/windows.foundation.collections.h>\r\n#include <winrt/windows.system.h>\r\n#include <wil/winrt.h>\r\n\r\nusing namespace Microsoft::WRL;\r\n\r\nextern \"C\" extern DWORD dwStartShowClassicMode;\r\n\r\nstatic void EPWilLogCallback(wil::FailureInfo const &failure) noexcept\r\n{\r\n    wchar_t message[2048];\r\n    HRESULT hr = GetFailureLogString(message, ARRAYSIZE(message), failure);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        wprintf(L\"%s\", message); // message includes newline\r\n    }\r\n}\r\n\r\nextern \"C\" void InitializeWilLogCallback()\r\n{\r\n    SetResultLoggingCallback(EPWilLogCallback);\r\n}\r\n\r\nstatic std::vector<winrt::guid> GlobalStartData_GetPlacesFromRegistry()\r\n{\r\n    std::vector<winrt::guid> places;\r\n\r\n    DWORD dwSize;\r\n    LSTATUS lRes = RegGetValueW(\r\n        HKEY_CURRENT_USER,\r\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Start\",\r\n        L\"VisiblePlaces\",\r\n        RRF_RT_REG_BINARY,\r\n        nullptr,\r\n        nullptr,\r\n        &dwSize\r\n    );\r\n    if (lRes != ERROR_SUCCESS || dwSize == 0)\r\n        return places;\r\n\r\n    places.resize(dwSize / sizeof(winrt::guid));\r\n    lRes = RegGetValueW(\r\n        HKEY_CURRENT_USER,\r\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Start\",\r\n        L\"VisiblePlaces\",\r\n        RRF_RT_REG_BINARY,\r\n        nullptr,\r\n        places.data(),\r\n        &dwSize\r\n    );\r\n    if (lRes != ERROR_SUCCESS)\r\n        places.clear();\r\n\r\n    return places;\r\n}\r\n\r\nnamespace ABI::WindowsInternal::Shell::CDSProperties\r\n{\r\n    interface IStartGlobalProperties;\r\n\r\n    MIDL_INTERFACE(\"2c670963-f8a9-4bbb-9adf-683a3a89537e\")\r\n    IStartGlobalPropertiesFactory : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE Create(Windows::System::IUser* user, IStartGlobalProperties** result) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"ee807266-a2db-4c9a-a1b4-970d33f99c91\")\r\n    IStartGlobalProperties : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_FullScreenMode(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_FullScreenMode(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_HideAppList(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_HideAppList(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_HideRecentList(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_HideRecentList(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_HideFrequentList(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_HideFrequentList(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_StartMenuRelativeHeightPixels(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_StartMenuRelativeHeightPixels(UINT) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_PlacesInitialized(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_PlacesInitialized(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_PlacesInitializedVersion(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_PlacesInitializedVersion(UINT) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetVisiblePlaces(Windows::Foundation::Collections::IVectorView<GUID>**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE SetVisiblePlaces(Windows::Foundation::Collections::IVectorView<GUID>*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_StartViewRestoring(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_StartViewRestoring(BOOLEAN) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE add_PropertiesChanged(\r\n            /*Windows::Foundation::ITypedEventHandler<\r\n                StartGlobalProperties*,\r\n                StartGlobalPropertiesChangedArgs*\r\n            >*,\r\n            EventRegistrationToken**/\r\n        ) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE remove_PropertiesChanged(EventRegistrationToken) = 0;\r\n    };\r\n\r\n    enum ExtendedReconciliationRequirements\r\n    {\r\n    };\r\n}\r\n\r\nextern \"C\" BOOL NeedsRo_SyncSettingsFromRegToCDS()\r\n{\r\n    winrt::com_ptr<ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalPropertiesFactory> global_properties_factory;\r\n    winrt::param::hstring hstr = L\"WindowsInternal.Shell.CDSProperties.StartGlobalProperties\";\r\n    HRESULT hr = RoGetActivationFactory(\r\n        *(HSTRING*)&hstr,\r\n        __uuidof(ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalPropertiesFactory),\r\n        global_properties_factory.put_void()\r\n    );\r\n    if (FAILED(hr))\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    winrt::Windows::System::User user = winrt::Windows::System::User::FindAllAsync().get().GetAt(0);\r\n    winrt::com_ptr<ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalProperties> start_global_properties;\r\n    hr = global_properties_factory->Create(user.as<ABI::Windows::System::IUser>().get(), start_global_properties.put());\r\n    if (FAILED(hr))\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    DWORD dwValue, dwSize;\r\n\r\n    // ShowFrequentList\r\n    dwValue = 0; // Default off\r\n    dwSize = sizeof(DWORD);\r\n    RegGetValueW(\r\n        HKEY_CURRENT_USER,\r\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Start\",\r\n        L\"ShowFrequentList\",\r\n        RRF_RT_REG_DWORD,\r\n        nullptr,\r\n        &dwValue,\r\n        &dwSize\r\n    );\r\n    start_global_properties->put_HideFrequentList(!dwValue);\r\n\r\n    // ShowRecentList\r\n    dwValue = 1; // Default on\r\n    dwSize = sizeof(DWORD);\r\n    RegGetValueW(\r\n        HKEY_CURRENT_USER,\r\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Start\",\r\n        L\"ShowRecentList\",\r\n        RRF_RT_REG_DWORD,\r\n        nullptr,\r\n        &dwValue,\r\n        &dwSize\r\n    );\r\n    start_global_properties->put_HideRecentList(!dwValue);\r\n\r\n    // VisiblePlaces\r\n    auto places_view = single_threaded_vector<winrt::guid>(GlobalStartData_GetPlacesFromRegistry()).GetView();\r\n    start_global_properties->SetVisiblePlaces(places_view.as<ABI::Windows::Foundation::Collections::IVectorView<GUID>>().get());\r\n\r\n    return TRUE;\r\n}\r\n\r\nnamespace ABI::WindowsUdk::ApplicationModel::AppExtensions\r\n{\r\n    enum AppExtensionOptions {};\r\n\r\n    MIDL_INTERFACE(\"836da1ed-5be8-5365-8452-6af327aa427b\")\r\n    IExtensionFactoryStatics : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE IsExtensionAvailable(HSTRING, HSTRING, bool*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE IsExtensionAvailableWithOptions(HSTRING, HSTRING, AppExtensionOptions, bool*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetInstance(HSTRING, HSTRING, IInspectable**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetInstanceWithOptions(HSTRING, HSTRING, AppExtensionOptions, IInspectable**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetFactory(HSTRING, HSTRING, IInspectable**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetFactoryWithOptions(HSTRING, HSTRING, AppExtensionOptions, IInspectable**) = 0;\r\n    };\r\n}\r\n\r\nclass DummyExtensionFactory : ABI::WindowsUdk::ApplicationModel::AppExtensions::IExtensionFactoryStatics\r\n{\r\npublic:\r\n    HRESULT QueryInterface(REFIID riid, void** ppvObject) override { return E_NOINTERFACE; }\r\n    ULONG AddRef() override { return 1; }\r\n    ULONG Release() override { return 1; }\r\n    HRESULT GetIids(ULONG* iidCount, IID** iids) override { return E_NOTIMPL; }\r\n    HRESULT GetRuntimeClassName(HSTRING* className) override { return E_NOTIMPL; }\r\n    HRESULT GetTrustLevel(TrustLevel* trustLevel) override { return E_NOTIMPL; }\r\n\r\n    // Keep the value of result as zero (set by the caller) and return S_OK to make the Windows 10 code run\r\n    HRESULT IsExtensionAvailable(HSTRING, HSTRING, bool*) override { return S_OK; }\r\n    HRESULT IsExtensionAvailableWithOptions(HSTRING, HSTRING, ABI::WindowsUdk::ApplicationModel::AppExtensions::AppExtensionOptions, bool*) override { return S_OK; }\r\n    HRESULT GetInstance(HSTRING, HSTRING, IInspectable**) override { return S_OK; }\r\n    HRESULT GetInstanceWithOptions(HSTRING, HSTRING, ABI::WindowsUdk::ApplicationModel::AppExtensions::AppExtensionOptions, IInspectable**) override { return S_OK; }\r\n    HRESULT GetFactory(HSTRING, HSTRING, IInspectable**) override { return S_OK; }\r\n    HRESULT GetFactoryWithOptions(HSTRING, HSTRING, ABI::WindowsUdk::ApplicationModel::AppExtensions::AppExtensionOptions, IInspectable**) override { return S_OK; }\r\n};\r\n\r\nstatic const DummyExtensionFactory instanceof_WindowsUdk_ApplicationModel_AppExtensions_IExtensionFactoryStatics;\r\n\r\nextern \"C\" HRESULT AppResolver_StartTileData_RoGetActivationFactory(HSTRING activatableClassId, REFIID iid, void** factory)\r\n{\r\n    if (dwStartShowClassicMode && IsEqualGUID(iid, __uuidof(ABI::WindowsUdk::ApplicationModel::AppExtensions::IExtensionFactoryStatics)))\r\n    {\r\n        *factory = const_cast<DummyExtensionFactory*>(&instanceof_WindowsUdk_ApplicationModel_AppExtensions_IExtensionFactoryStatics);\r\n        return S_OK;\r\n    }\r\n    return RoGetActivationFactory(activatableClassId, iid, factory);\r\n}\r\n\r\nnamespace ABI::Windows::Internal::ApplicationModel\r\n{\r\n    namespace WindowManagement\r\n    {\r\n        struct WindowId\r\n        {\r\n            UINT Value;\r\n        };\r\n    }\r\n\r\n    MIDL_INTERFACE(\"1223aea2-547b-4d03-9e6c-388a4307a07e\")\r\n    IPinnableSurface : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE CanPinTile(HSTRING, ABI::Windows::UI::StartScreen::ISecondaryTile*, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RequestPinTile(HSTRING, HSTRING, Windows::UI::StartScreen::ISecondaryTile*, ABI::Windows::Internal::ApplicationModel::WindowManagement::WindowId, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE PinTile(HSTRING, ABI::Windows::UI::StartScreen::ISecondaryTile*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE IsTilePinned(HSTRING, HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CanUnpinTile(HSTRING, HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE UnpinTile(HSTRING, HSTRING) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"f27684e4-e634-4807-be9a-4838381fcbfc\")\r\n    IPinnableSurfaceFactory : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE GetCurrent(IPinnableSurface**);\r\n    };\r\n}\r\n\r\nnamespace ABI::Windows::Internal::UI::StartScreen\r\n{\r\n    enum SecondaryTileCreationBehaviors\r\n    {\r\n        SecondaryTileCreationBehaviors_None = 0x0,\r\n        SecondaryTileCreationBehaviors_SuppressPinToStart = 0x1,\r\n        SecondaryTileCreationBehaviors_SuppressBackgroundPolicyCheck = 0x2,\r\n        SecondaryTileCreationBehaviors_SuppressPinRequest = 0x4,\r\n    };\r\n\r\n    DEFINE_ENUM_FLAG_OPERATORS(SecondaryTileCreationBehaviors);\r\n\r\n    MIDL_INTERFACE(\"2d7f0d3b-ec36-463b-9f69-d7238d77c122\")\r\n    ISecondaryTilePrivate : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE PopulateIdentity(HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE SetTileCreationBehaviors(SecondaryTileCreationBehaviors) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RefreshPropertiesFromPrimaryTile() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetUniqueId(GUID*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetDefaultTileSize(ABI::Windows::UI::StartScreen::TileSize*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetAppUserModelId(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ValidatePropertiesForCreate() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CreateInTileStore() = 0;\r\n    };\r\n}\r\n\r\nnamespace ABI::WindowsInternal::Shell::UnifiedTile\r\n{\r\n    enum UnifiedTileIdentifierKind\r\n    {\r\n        UnifiedTileIdentifierKind_Unknown = 0x0,\r\n        UnifiedTileIdentifierKind_Packaged = 0x1,\r\n        UnifiedTileIdentifierKind_Win32 = 0x2,\r\n        UnifiedTileIdentifierKind_TargetedContent = 0x3,\r\n    };\r\n\r\n    MIDL_INTERFACE(\"d3653510-4fff-4bfa-905b-ea038b142fa5\")\r\n    IUnifiedTileIdentifier : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Kind(UnifiedTileIdentifierKind*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_SerializedIdentifier(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_NotificationId(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_TelemetryId(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE IsEqual(IUnifiedTileIdentifier*, BOOLEAN*) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"ec3e7864-aaab-4367-9c63-94d289545500\")\r\n    IPackagedUnifiedTileIdentifierFactory : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE Create(HSTRING, IUnifiedTileIdentifier**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CreateWithTileId(HSTRING, HSTRING, IUnifiedTileIdentifier**) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"87a52467-266a-4b20-a2c8-e316bfbaf64a\")\r\n    IUnifiedTileIdentifierStatics : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE DeserializeIdentifier(HSTRING, IUnifiedTileIdentifier**) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"0e7735be-a965-44a6-a75f-54b8bcd67bec\")\r\n    IWin32UnifiedTileIdentifierFactory : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE Create(HSTRING, IUnifiedTileIdentifier**) = 0;\r\n    };\r\n\r\n    interface IVisualTileInfo;\r\n    interface ILargeFormatVisualTileInfo;\r\n    interface IEnterpriseDataProtectionTileInfo;\r\n    interface IAppUsageInfo;\r\n    interface IAppLifecycleInfo;\r\n\r\n    MIDL_INTERFACE(\"861778d6-ac6c-456f-bd3c-32ab601245e1\")\r\n    IWin32ShortcutInfo : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_IsTargetFolder(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_TargetPath(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_ShortcutArguments(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_IsUserPinnedShortcut(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_IsManifested(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_PreventPinning(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_SuiteName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_SuiteSortName(HSTRING*) = 0;\r\n    };\r\n\r\n    interface IPackagedAppTileInfo;\r\n    interface ISuggestionTileInfo;\r\n    interface IMixedRealityTileInfo;\r\n    interface ITileActivationContext;\r\n    interface IVerbSource;\r\n\r\n    MIDL_INTERFACE(\"65b4e03e-a32e-40cf-8bab-b2d9c5287307\")\r\n    IUnifiedTile : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Id(IUnifiedTileIdentifier**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_VisualTileInfo(IVisualTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_LargeFormatVisualTileInfo(ILargeFormatVisualTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_EnterpriseDataProtectionTileInfo(IEnterpriseDataProtectionTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_AppUsageInfo(IAppUsageInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_AppLifecycleInfo(IAppLifecycleInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Win32ShortcutInfo(IWin32ShortcutInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_PackagedAppTileInfo(IPackagedAppTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_SuggestionTileInfo(ISuggestionTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_MixedRealityTileInfo(IMixedRealityTileInfo**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ActivateAsync(ABI::Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ActivateWithContextAsync(ITileActivationContext*, ABI::Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Verbs(IVerbSource**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE add_TileChanged(void*, EventRegistrationToken*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE remove_TileChanged(EventRegistrationToken) = 0;\r\n    };\r\n\r\n    namespace CuratedTileCollections\r\n    {\r\n        interface ICuratedTileCollection;\r\n        interface ICuratedTileGroup;\r\n    }\r\n\r\n    MIDL_INTERFACE(\"abaabd17-2d4e-43f0-b43c-60e699a32341\")\r\n    IUnifiedTileCollection : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_CollectionId(HSTRING*);\r\n        virtual HRESULT STDMETHODCALLTYPE GetAllTilesRecursive(void**);\r\n        virtual HRESULT STDMETHODCALLTYPE get_CuratedCollectionInfo(CuratedTileCollections::ICuratedTileCollection**);\r\n    };\r\n\r\n    interface ICuratedCollectionBatch;\r\n\r\n    MIDL_INTERFACE(\"6fe03efc-a8af-4faf-9c23-bc0cb5bf29d3\")\r\n    ITileCollectionContainer : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Id(GUID*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetContainers(void**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetTiles(void**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_DisplayName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_SortName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_ParentContainer(ITileCollectionContainer**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_CuratedGroupInfo(CuratedTileCollections::ICuratedTileGroup**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CreateCuratedCollectionBatch(ICuratedCollectionBatch**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE add_ContentsChanged(void*, EventRegistrationToken*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE remove_ContentsChanged(EventRegistrationToken) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE add_PropertyChanged(void*, EventRegistrationToken*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE remove_PropertyChanged(EventRegistrationToken) = 0;\r\n    };\r\n\r\n    enum CollectionProvider\r\n    {\r\n        CollectionProvider_AllTilesCollection = 0,\r\n        CollectionProvider_AppsListCollection = 1,\r\n        CollectionProvider_CuratedTileCollection = 2,\r\n        CollectionProvider_FlatAppsListCollection = 3,\r\n        CollectionProvider_FlatAppsListWithSecondaryAndUserPinnedTilesCollection = 4,\r\n    };\r\n\r\n    enum CollectionOptions\r\n    {\r\n        CollectionOptions_None = 0x0,\r\n        CollectionOptions_IncludeTombstones = 0x1,\r\n        CollectionOptions_UpdatedItemsOnly = 0x2,\r\n    };\r\n\r\n    // typedef ABI::Windows::Internal::Storage::Cloud::CollectionOptions CollectionOptions;\r\n\r\n    MIDL_INTERFACE(\"1048dc30-f4f7-4ff4-970e-5058ca17cc26\")\r\n    IUnifiedTileManager : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE GetTransformer(GUID, IInspectable**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCollection(CollectionProvider, HSTRING, IUnifiedTileCollection**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCollectionWithOptions(CollectionProvider, HSTRING, CollectionOptions, IUnifiedTileCollection**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE FindTile(IUnifiedTileIdentifier*, IUnifiedTile**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE WaitForDataStoreReconciliationCompleteAsync(ABI::Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE WaitForSecondaryDataReconciliationCompleteAsync(ABI::Windows::Foundation::IAsyncAction**) = 0;\r\n    };\r\n\r\n    interface ICollectionTile;\r\n    interface IContentsChangedEventArgs;\r\n\r\n    enum TileVerbFlags\r\n    {\r\n        TileVerbFlags_None = 0x0,\r\n        TileVerbFlags_CanExecute = 0x1,\r\n        TileVerbFlags_IsMetadata = 0x2,\r\n        TileVerbFlags_IsGroup = 0x4,\r\n        TileVerbFlags_IsSeparator = 0x8,\r\n        TileVerbFlags_IsDefault = 0x10,\r\n    };\r\n\r\n    DEFINE_ENUM_FLAG_OPERATORS(TileVerbFlags);\r\n\r\n    MIDL_INTERFACE(\"e98fc955-cda1-4ae8-ae08-292531bc6bb2\")\r\n    IVerbExecutionArgs : IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Position(void**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_Position(void*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_KeyModifiers(ABI::Windows::System::VirtualKeyModifiers*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_KeyModifiers(ABI::Windows::System::VirtualKeyModifiers) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE SetCallerWindow(ABI::Windows::UI::Core::ICoreWindow*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_CallerWindowId(unsigned int*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_CallerWindowId(unsigned int) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"f9ad7985-244a-4e61-8ba2-55a3f5e1c665\")\r\n    ITileVerb : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_VerbProviderId(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_GroupPath(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_CanonicalName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_DisplayName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Glyph(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_GlyphFontFamily(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_AccessKey(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_ShortcutText(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Flags(TileVerbFlags*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE Execute(IVerbExecutionArgs*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ExecuteAsync(IVerbExecutionArgs*, ABI::Windows::Foundation::IAsyncOperation<bool>**) = 0;\r\n    };\r\n\r\n    enum VerbEnumerationOptions\r\n    {\r\n        VerbEnumerationOptions_None = 0x0,\r\n        VerbEnumerationOptions_ExcludeNonExecutable = 0x1,\r\n        VerbEnumerationOptions_ExcludeResources = 0x2,\r\n        VerbEnumerationOptions_IncludeExtendedVerbs = 0x4,\r\n    };\r\n\r\n    MIDL_INTERFACE(\"a9d9c0b6-c84b-4010-8202-7c23b17dc148\")\r\n    IVerbEnumerationArgs : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Options(VerbEnumerationOptions*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_Options(VerbEnumerationOptions) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_VerbProviderId(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_VerbProviderId(HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_GroupPathPrefix(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_GroupPathPrefix(HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_VerbCanonicalName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_VerbCanonicalName(HSTRING) = 0;\r\n    };\r\n}\r\n\r\nnamespace ABI::WindowsInternal::Shell::UnifiedTile::Private\r\n{\r\n    MIDL_INTERFACE(\"0083831c-82d6-4e8f-bcc2-a8ac2691be49\")\r\n    IUnifiedTileUserPinHelperStatics : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE CreateUserPinnedShortcutTile(IUnifiedTileIdentifier*) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"7813d04d-61d5-40e7-8d6d-781c5603a891\")\r\n    ITileContainerPrivate : public IInspectable\r\n    {\r\n        virtual void* STDMETHODCALLTYPE GetGroups(void* retstr) = 0;\r\n        virtual void* STDMETHODCALLTYPE GetTiles(void* retstr) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetContainer(const GUID*, ITileCollectionContainer**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE AddContainer(ITileCollectionContainer*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RemoveContainer(const GUID*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetTile(const GUID*, ICollectionTile**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE AddTile(ICollectionTile*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RemoveTile(const GUID*) = 0;\r\n        virtual bool STDMETHODCALLTYPE TryFindTileByUnifiedTileIdRecursive(IUnifiedTileIdentifier*, ICollectionTile**, ITileCollectionContainer**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE InvokeContentsChangedEventSource(IContentsChangedEventArgs*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE InvokePropertiesChangedEventSource(IInspectable*) = 0;\r\n    };\r\n\r\n    enum UnifiedTileKind\r\n    {\r\n    };\r\n\r\n    MIDL_INTERFACE(\"de10b7d8-bebd-4599-925d-759462d1c1b1\")\r\n    IUnifiedTilePrivate : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_IsVisibleInAppList(BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Kind(UnifiedTileKind*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_ExtendedReconciliationRequirements(ABI::WindowsInternal::Shell::CDSProperties::ExtendedReconciliationRequirements*) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"3b8c9be7-fc8c-42e2-a6b5-7005aa719c35\")\r\n    IVerbEnumerationArgsPrivate : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE IsMatchingVerbProviderId(HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE IsMatchingGroupPath(HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE IsMatchingVerbCanonicalName(HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_User(ABI::Windows::System::IUser**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_User(ABI::Windows::System::IUser*) = 0;\r\n    };\r\n}\r\n\r\nnamespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections\r\n{\r\n    enum CollectionAttributes {};\r\n    enum PackageStatusChangeType {};\r\n    enum StartCollectionCustomizationRestrictionType {};\r\n\r\n    enum TilePinSize\r\n    {\r\n        TilePinSize_Tile2x2 = 0,\r\n        TilePinSize_Tile4x2 = 1,\r\n    };\r\n\r\n    namespace DataStoreCache::CuratedTileCollectionTransformer\r\n    {\r\n        class CuratedTile;\r\n    }\r\n\r\n    MIDL_INTERFACE(\"354cba6d-19ab-490c-97b6-8d4d9862e052\")\r\n    ICuratedTileGroup : public IInspectable\r\n    {\r\n    };\r\n\r\n    MIDL_INTERFACE(\"bb4b31ed-0705-432e-bf3d-24bf54bee10d\")\r\n    ICuratedTile : public IInspectable\r\n    {\r\n    };\r\n\r\n    MIDL_INTERFACE(\"51a07090-3a1f-49ef-9932-a971b8154790\")\r\n    ICuratedTileCollection : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_CollectionName(HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Attributes(CollectionAttributes*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_Attributes(CollectionAttributes) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_Version(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_Version(UINT) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetGroups(Windows::Foundation::Collections::IMapView<GUID, ICuratedTileGroup*>**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetTiles(Windows::Foundation::Collections::IMapView<GUID, ICuratedTile*>**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetAllTilesInCollection(Windows::Foundation::Collections::IMapView<GUID, ICuratedTile*>**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE DoesCollectionContainTile(IUnifiedTileIdentifier*, ICuratedTile**, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE FindTileAndParentGroup(IUnifiedTileIdentifier*, ICuratedTile**, ICuratedTileGroup**, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE MoveExistingGroupToNewParent(ICuratedTileGroup*, ICuratedTileGroup*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CreateNewGroup(ICuratedTileGroup**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetGroup(GUID, ICuratedTileGroup**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE DeleteGroup(GUID) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RemoveGroup(GUID) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE MoveExistingTileToNewParent(ICuratedTile*, ICuratedTileGroup*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE AddTile(IUnifiedTileIdentifier*, ICuratedTile**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE AddTileWithId(IUnifiedTileIdentifier*, GUID, ICuratedTile**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetTile(GUID, ICuratedTile**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE DeleteTile(GUID) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RemoveTile(GUID) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE Commit() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CommitAsync(Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CommitAsyncWithTimerBypass(Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ResetToDefault() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ResetToDefaultAsync(Windows::Foundation::IAsyncAction**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CheckForUpdate() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCustomProperty(const HSTRING, HSTRING*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE HasCustomProperty(const HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE RemoveCustomProperty(const HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE SetCustomProperty(const HSTRING, HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE EnsureTileRegistration() = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ResurrectTile(std::shared_ptr<DataStoreCache::CuratedTileCollectionTransformer::CuratedTile>, const GUID&) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE OnTileAddedWithinCollection(IUnifiedTileIdentifier*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE OnTileRemovedWithinCollection(IUnifiedTileIdentifier*) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"adbf8965-6056-4126-ab26-6660af4661ce\")\r\n    IStartTileCollection : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE PinToStart(IUnifiedTileIdentifier*, TilePinSize) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE PinToStartAtLocation(IUnifiedTileIdentifier*, ICuratedTileGroup*, Windows::Foundation::Point, Windows::Foundation::Size) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE UnpinFromStart(IUnifiedTileIdentifier*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE ReplaceTinyOrMediumTile(IUnifiedTileIdentifier*, IUnifiedTileIdentifier*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_LastGroupId(GUID*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_LastGroupId(GUID) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_CustomizationRestriction(StartCollectionCustomizationRestrictionType*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_CustomizationRestriction(StartCollectionCustomizationRestrictionType) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_GroupCellWidth(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_GroupCellWidth(UINT) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_PreferredColumnCount(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_PreferredColumnCount(UINT) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE get_CurrentColumnCount(UINT*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE put_CurrentColumnCount(UINT) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"a680369c-0862-41a0-b7cd-bb35e3c497eb\")\r\n    ICuratedTileCollectionOptions : public IInspectable\r\n    {\r\n    };\r\n\r\n    MIDL_INTERFACE(\"899ee71b-5c01-438f-b12e-61d49f6b4083\")\r\n    ICuratedTileCollectionManager : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE NotifyPackageStatusChanged(HSTRING, PackageStatusChangeType) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCollection(HSTRING, ICuratedTileCollection**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCollectionWithOptions(HSTRING, ICuratedTileCollectionOptions*, ICuratedTileCollection**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE DeleteCollection(HSTRING) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE CollectionExists(HSTRING, BOOLEAN*) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE InitializeCollection(HSTRING) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"15f254ac-49b3-4e6e-9c62-806ffaf554f9\")\r\n    ICuratedTileCollectionManagerStatics : public IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE CreateWithUser(Windows::System::IUser*, ICuratedTileCollectionManager**) = 0;\r\n    };\r\n}\r\n\r\n#if 0\r\nHRESULT StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__GetUnifiedIdentifierForAumid(\r\n    void* _this,\r\n    const WCHAR* pszAumid,\r\n    const WCHAR* pszTileId,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTileIdentifier** out)\r\n{\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n\r\n    ComPtr<IUnifiedTileIdentifierStatics> pUnifiedTileIdentifierStatics;\r\n    RETURN_IF_FAILED(RoGetActivationFactory(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.UnifiedTileIdentifier\").Get(),\r\n        IID_PPV_ARGS(&pUnifiedTileIdentifierStatics)\r\n    ));\r\n\r\n    ComPtr<IPackagedUnifiedTileIdentifierFactory> pPackagedUnifiedTileIdentifierFactory;\r\n    RETURN_IF_FAILED(pUnifiedTileIdentifierStatics.As(&pPackagedUnifiedTileIdentifierFactory));\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pUnifiedTileIdentifier;\r\n    RETURN_IF_FAILED(pPackagedUnifiedTileIdentifierFactory->CreateWithTileId(\r\n        Wrappers::HStringReference(pszAumid).Get(),\r\n        Wrappers::HStringReference(pszTileId).Get(),\r\n        &pUnifiedTileIdentifier\r\n    ));\r\n\r\n    *out = pUnifiedTileIdentifier.Detach();\r\n    return S_OK;\r\n}\r\n\r\nHRESULT (*StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTileFunc)(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    ABI::Windows::UI::StartScreen::ISecondaryTile* tile);\r\n\r\nHRESULT StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTile(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    ABI::Windows::UI::StartScreen::ISecondaryTile* tile)\r\n{\r\n    using namespace ABI::Windows::UI::StartScreen;\r\n    using namespace ABI::Windows::Internal::UI::StartScreen;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections;\r\n\r\n    if (!dwStartShowClassicMode)\r\n        return StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTileFunc(_this, hstrAumid, tile);\r\n\r\n    /*if (RtlIsMultiUsersInSessionSku())\r\n        return S_OK;*/\r\n\r\n    Wrappers::HString hstrTileId;\r\n    if (tile)\r\n    {\r\n        RETURN_IF_FAILED(tile->get_TileId(hstrTileId.ReleaseAndGetAddressOf()));\r\n    }\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pUnifiedTileIdentifier;\r\n    RETURN_IF_FAILED(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__GetUnifiedIdentifierForAumid(\r\n        _this,\r\n        WindowsGetStringRawBuffer(hstrAumid, nullptr),\r\n        hstrTileId.GetRawBuffer(nullptr),\r\n        &pUnifiedTileIdentifier\r\n    ));\r\n\r\n    // Windows 10 start menu-specific code begins here\r\n    ComPtr<ICuratedTileCollectionManager> pTileCollectionManager;\r\n    RETURN_IF_FAILED(RoActivateInstance(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.CuratedTileCollections.CuratedTileCollectionManager\").Get(),\r\n        &pTileCollectionManager\r\n    ));\r\n\r\n    ComPtr<ICuratedTileCollection> pTileCollection;\r\n    RETURN_IF_FAILED(pTileCollectionManager->GetCollection(\r\n        Wrappers::HStringReference(L\"Start.TileGrid\").Get(),\r\n        &pTileCollection\r\n    ));\r\n\r\n    ComPtr<IStartTileCollection> pStartTileCollection;\r\n    RETURN_IF_FAILED(pTileCollection.As(&pStartTileCollection));\r\n\r\n    TileSize defaultTileSize = TileSize_Square150x150;\r\n    if (tile)\r\n    {\r\n        ComPtr<ISecondaryTilePrivate> pSecondaryTilePrivate;\r\n        RETURN_IF_FAILED(tile->QueryInterface(IID_PPV_ARGS(&pSecondaryTilePrivate)));\r\n        RETURN_IF_FAILED(pSecondaryTilePrivate->GetDefaultTileSize(&defaultTileSize));\r\n    }\r\n\r\n    RETURN_IF_FAILED(pStartTileCollection->PinToStart(\r\n        pUnifiedTileIdentifier.Get(),\r\n        defaultTileSize == TileSize_Wide310x150 ? TilePinSize_Tile4x2 : TilePinSize_Tile2x2\r\n    ));\r\n\r\n    return S_OK;\r\n}\r\n\r\nHRESULT (*StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinnedFunc)(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    HSTRING hstrTileId,\r\n    BOOLEAN* out);\r\n\r\nHRESULT StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinned(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    HSTRING hstrTileId,\r\n    BOOLEAN* out)\r\n{\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections;\r\n\r\n    if (!dwStartShowClassicMode)\r\n        return StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinnedFunc(_this, hstrAumid, hstrTileId, out);\r\n\r\n    *out = FALSE;\r\n\r\n    /*if (RtlIsMultiUsersInSessionSku())\r\n        return S_OK;*/\r\n\r\n    // Windows 10 start menu-specific code begins here\r\n    ComPtr<ICuratedTileCollectionManager> pTileCollectionManager;\r\n    RETURN_IF_FAILED(RoActivateInstance(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.CuratedTileCollections.CuratedTileCollectionManager\").Get(),\r\n        &pTileCollectionManager\r\n    ));\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pUnifiedTileIdentifier;\r\n    RETURN_IF_FAILED(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__GetUnifiedIdentifierForAumid(\r\n        _this,\r\n        WindowsGetStringRawBuffer(hstrAumid, nullptr),\r\n        WindowsGetStringRawBuffer(hstrTileId, nullptr),\r\n        &pUnifiedTileIdentifier\r\n    ));\r\n\r\n    ComPtr<ICuratedTileCollection> pTileCollection;\r\n    RETURN_IF_FAILED(pTileCollectionManager->GetCollection(\r\n        Wrappers::HStringReference(L\"Start.TileGrid\").Get(),\r\n        &pTileCollection\r\n    ));\r\n\r\n    RETURN_IF_FAILED(pTileCollection->DoesCollectionContainTile(pUnifiedTileIdentifier.Get(), nullptr, out));\r\n\r\n    return S_OK;\r\n}\r\n\r\nHRESULT (*StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTileFunc)(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    HSTRING hstrTileId);\r\n\r\nHRESULT StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTile(\r\n    void* _this,\r\n    HSTRING hstrAumid,\r\n    HSTRING hstrTileId)\r\n{\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::Private;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections;\r\n\r\n    if (!dwStartShowClassicMode)\r\n        return StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTileFunc(_this, hstrAumid, hstrTileId);\r\n\r\n    /*if (RtlIsMultiUsersInSessionSku())\r\n        return S_OK;*/\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pUnifiedTileIdentifier;\r\n    RETURN_IF_FAILED(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__GetUnifiedIdentifierForAumid(\r\n        _this,\r\n        WindowsGetStringRawBuffer(hstrAumid, nullptr),\r\n        WindowsGetStringRawBuffer(hstrTileId, nullptr),\r\n        &pUnifiedTileIdentifier\r\n    ));\r\n\r\n    // Windows 10 start menu-specific code begins here\r\n    ComPtr<ICuratedTileCollectionManager> pTileCollectionManager;\r\n    RETURN_IF_FAILED(RoActivateInstance(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.CuratedTileCollections.CuratedTileCollectionManager\").Get(),\r\n        &pTileCollectionManager\r\n    ));\r\n\r\n    ComPtr<ICuratedTileCollection> pTileCollection;\r\n    RETURN_IF_FAILED(pTileCollectionManager->GetCollection(\r\n        Wrappers::HStringReference(L\"Start.TileGrid\").Get(),\r\n        &pTileCollection\r\n    ));\r\n\r\n    ComPtr<IStartTileCollection> pStartTileCollection;\r\n    RETURN_IF_FAILED(pTileCollection.As(&pStartTileCollection));\r\n\r\n    RETURN_IF_FAILED(pStartTileCollection->UnpinFromStart(pUnifiedTileIdentifier.Get()));\r\n\r\n    return S_OK;\r\n}\r\n\r\nHRESULT PatchStartPinnableSurface(HMODULE hModule, ABI::Windows::Internal::ApplicationModel::IPinnableSurfaceFactory** outPinnableSurfaceFactory)\r\n{\r\n    using namespace ABI::Windows::Internal::ApplicationModel;\r\n\r\n    if (outPinnableSurfaceFactory)\r\n        *outPinnableSurfaceFactory = nullptr;\r\n\r\n    typedef HRESULT (WINAPI* DllGetActivationFactory_t)(HSTRING, IActivationFactory**);\r\n    DllGetActivationFactory_t pfnGetActivationFactory = (DllGetActivationFactory_t)GetProcAddress(hModule, \"DllGetActivationFactory\");\r\n    RETURN_HR_IF_NULL(E_FAIL, pfnGetActivationFactory);\r\n\r\n    ComPtr<IActivationFactory> activationFactory;\r\n    RETURN_IF_FAILED(pfnGetActivationFactory(\r\n        Wrappers::HStringReference(L\"Windows.Internal.ApplicationModel.StartPinnableSurface\").Get(),\r\n        activationFactory.ReleaseAndGetAddressOf())\r\n    );\r\n\r\n    ComPtr<IPinnableSurfaceFactory> pinnableSurfaceFactory;\r\n    RETURN_IF_FAILED(activationFactory.As(&pinnableSurfaceFactory));\r\n\r\n    if (outPinnableSurfaceFactory)\r\n        pinnableSurfaceFactory.CopyTo(outPinnableSurfaceFactory);\r\n\r\n    ComPtr<IPinnableSurface> pinnableSurface;\r\n    RETURN_IF_FAILED(pinnableSurfaceFactory->GetCurrent(pinnableSurface.ReleaseAndGetAddressOf()));\r\n\r\n    DWORD dwOldProtect = 0;\r\n\r\n    void** vtable = *(void***)pinnableSurface.Get();\r\n    void** p_PinTile = &vtable[8];\r\n    void** p_IsTilePinned = &vtable[9];\r\n    void** p_UnpinTile = &vtable[11];\r\n\r\n    // PinTile\r\n    if (*p_PinTile != StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTile)\r\n    {\r\n        StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTileFunc =\r\n            (decltype(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTileFunc))*p_PinTile;\r\n        if (VirtualProtect(p_PinTile, sizeof(void*), PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n        {\r\n            *p_PinTile = StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__PinTile;\r\n            VirtualProtect(p_PinTile, sizeof(void*), dwOldProtect, &dwOldProtect);\r\n        }\r\n    }\r\n\r\n    // IsTilePinned\r\n    if (*p_IsTilePinned != StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinned)\r\n    {\r\n        StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinnedFunc =\r\n            (decltype(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinnedFunc))*p_IsTilePinned;\r\n        if (VirtualProtect(p_IsTilePinned, sizeof(void*), PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n        {\r\n            *p_IsTilePinned = StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__IsTilePinned;\r\n            VirtualProtect(p_IsTilePinned, sizeof(void*), dwOldProtect, &dwOldProtect);\r\n        }\r\n    }\r\n\r\n    // UnpinTile\r\n    if (*p_UnpinTile != StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTile)\r\n    {\r\n        StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTileFunc =\r\n            (decltype(StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTileFunc))*p_UnpinTile;\r\n        if (VirtualProtect(p_UnpinTile, sizeof(void*), PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n        {\r\n            *p_UnpinTile = StartTileData_Windows__Internal__ApplicationModel__StartPinnableSurface__UnpinTile;\r\n            VirtualProtect(p_UnpinTile, sizeof(void*), dwOldProtect, &dwOldProtect);\r\n        }\r\n    }\r\n\r\n    return S_OK;\r\n}\r\n#endif\r\n\r\nnamespace VerbGlyphs::SegoeMDL2Assets\r\n{\r\n    const WCHAR* const Pin   = L\"\\uE718\";\r\n    const WCHAR* const Unpin = L\"\\uE77A\";\r\n}\r\n\r\nclass EPStartPinUnpinTileVerb : public RuntimeClass<RuntimeClassFlags<WinRt>, ABI::WindowsInternal::Shell::UnifiedTile::ITileVerb, FtmBase>\r\n{\r\npublic:\r\n    EPStartPinUnpinTileVerb() :\r\n        m_flags(ABI::WindowsInternal::Shell::UnifiedTile::TileVerbFlags_None)\r\n    {\r\n    }\r\n\r\n    HRESULT RuntimeClassInitialize(\r\n        ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTileIdentifier* unifiedTileIdentifier,\r\n        bool bShowPin,\r\n        ABI::WindowsInternal::Shell::UnifiedTile::IVerbEnumerationArgs* verbEnumerationArgs,\r\n        HSTRING verbProviderId,\r\n        HSTRING groupPath)\r\n    {\r\n        using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n        using namespace ABI::WindowsInternal::Shell::UnifiedTile::Private;\r\n\r\n        m_unifiedTileIdentifier = unifiedTileIdentifier;\r\n\r\n        VerbEnumerationOptions options;\r\n        RETURN_IF_FAILED(verbEnumerationArgs->get_Options(&options));\r\n\r\n        ComPtr<IVerbEnumerationArgsPrivate> pVerbEnumerationArgsPrivate;\r\n        RETURN_IF_FAILED(verbEnumerationArgs->QueryInterface(IID_PPV_ARGS(&pVerbEnumerationArgsPrivate)));\r\n        RETURN_IF_FAILED(pVerbEnumerationArgsPrivate->get_User(&m_user));\r\n\r\n        if (bShowPin)\r\n        {\r\n            RETURN_IF_FAILED(m_canonicalName.Set(L\"StartPin\"));\r\n            if ((options & VerbEnumerationOptions_ExcludeResources) == 0)\r\n            {\r\n                RETURN_IF_FAILED(m_glyph.Set(VerbGlyphs::SegoeMDL2Assets::Pin));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            RETURN_IF_FAILED(m_canonicalName.Set(L\"StartUnpin\"));\r\n            if ((options & VerbEnumerationOptions_ExcludeResources) == 0)\r\n            {\r\n                RETURN_IF_FAILED(m_glyph.Set(VerbGlyphs::SegoeMDL2Assets::Unpin));\r\n            }\r\n        }\r\n\r\n        if ((options & VerbEnumerationOptions_ExcludeResources) == 0)\r\n        {\r\n            WCHAR szDisplayName[260];\r\n            int written = LoadStringW(GetModuleHandleW(L\"StartTileData.dll\"), bShowPin ? 1007 : 1008, szDisplayName, ARRAYSIZE(szDisplayName));\r\n            if (written > 0 && written < ARRAYSIZE(szDisplayName))\r\n            {\r\n                RETURN_IF_FAILED(m_displayName.Set(szDisplayName));\r\n            }\r\n            else\r\n            {\r\n                RETURN_IF_FAILED(m_displayName.Set(m_canonicalName));\r\n            }\r\n            RETURN_IF_FAILED(m_glyphFontFamily.Set(L\"Segoe Fluent Icons\"));\r\n        }\r\n\r\n        RETURN_IF_FAILED(m_verbProviderId.Set(verbProviderId));\r\n        RETURN_IF_FAILED(m_groupPath.Set(groupPath));\r\n\r\n        m_flags |= TileVerbFlags_CanExecute;\r\n\r\n        return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP get_VerbProviderId(HSTRING* out) override { RETURN_HR(m_verbProviderId.CopyTo(out)); }\r\n    STDMETHODIMP get_GroupPath(HSTRING* out) override { RETURN_HR(m_groupPath.CopyTo(out)); }\r\n    STDMETHODIMP get_CanonicalName(HSTRING* out) override { RETURN_HR(m_canonicalName.CopyTo(out)); }\r\n    STDMETHODIMP get_DisplayName(HSTRING* out) override { RETURN_HR(m_displayName.CopyTo(out)); }\r\n    STDMETHODIMP get_Glyph(HSTRING* out) override { RETURN_HR(m_glyph.CopyTo(out)); }\r\n    STDMETHODIMP get_GlyphFontFamily(HSTRING* out) override { RETURN_HR(m_glyphFontFamily.CopyTo(out)); }\r\n    STDMETHODIMP get_AccessKey(HSTRING* out) override { RETURN_HR(m_accessKey.CopyTo(out)); }\r\n    STDMETHODIMP get_ShortcutText(HSTRING* out) override { RETURN_HR(m_shortcutText.CopyTo(out)); }\r\n    STDMETHODIMP get_Flags(ABI::WindowsInternal::Shell::UnifiedTile::TileVerbFlags* out) override { *out = m_flags; return S_OK; }\r\n\r\n    STDMETHODIMP Execute(ABI::WindowsInternal::Shell::UnifiedTile::IVerbExecutionArgs* verbExecutionArgs) override\r\n    {\r\n        using namespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections;\r\n\r\n        ComPtr<ICuratedTileCollectionManagerStatics> pCuratedTileCollectionManagerStatics;\r\n        RETURN_IF_FAILED(RoGetActivationFactory(\r\n            Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.CuratedTileCollections.CuratedTileCollectionManager\").Get(),\r\n            IID_PPV_ARGS(&pCuratedTileCollectionManagerStatics)\r\n        ));\r\n\r\n        ComPtr<ICuratedTileCollectionManager> pCuratedTileCollectionManager;\r\n        RETURN_IF_FAILED(pCuratedTileCollectionManagerStatics->CreateWithUser(m_user.Get(), &pCuratedTileCollectionManager));\r\n\r\n        ComPtr<ICuratedTileCollection> pTileCollection;\r\n        RETURN_IF_FAILED(pCuratedTileCollectionManager->GetCollection(\r\n            Wrappers::HStringReference(L\"Start.TileGrid\").Get(),\r\n            &pTileCollection\r\n        ));\r\n\r\n        BOOLEAN bCollectionContainsTile;\r\n        RETURN_IF_FAILED(pTileCollection->DoesCollectionContainTile(m_unifiedTileIdentifier.Get(), nullptr, &bCollectionContainsTile));\r\n        bool bPinned = bCollectionContainsTile != FALSE;\r\n\r\n        bool bPin = m_canonicalName == Wrappers::HStringReference(L\"StartPin\").Get();\r\n        if (bPin != bPinned)\r\n        {\r\n            ComPtr<IStartTileCollection> pStartTileCollection;\r\n            RETURN_IF_FAILED(pTileCollection.As(&pStartTileCollection));\r\n\r\n            if (bPin)\r\n            {\r\n                RETURN_IF_FAILED(pStartTileCollection->PinToStart(m_unifiedTileIdentifier.Get(), TilePinSize_Tile2x2));\r\n            }\r\n            else\r\n            {\r\n                RETURN_IF_FAILED(pStartTileCollection->UnpinFromStart(m_unifiedTileIdentifier.Get()));\r\n            }\r\n        }\r\n\r\n        return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP ExecuteAsync(ABI::WindowsInternal::Shell::UnifiedTile::IVerbExecutionArgs* verbExecutionArgs, ABI::Windows::Foundation::IAsyncOperation<bool>** out) override\r\n    {\r\n        winrt::Windows::Foundation::IAsyncOperation<bool> asyncOp = InternalExecuteAsync(verbExecutionArgs);\r\n        *out = (ABI::Windows::Foundation::IAsyncOperation<bool>*)winrt::detach_abi(asyncOp);\r\n        return S_OK;\r\n    }\r\n\r\n    winrt::Windows::Foundation::IAsyncOperation<bool> InternalExecuteAsync(ABI::WindowsInternal::Shell::UnifiedTile::IVerbExecutionArgs* verbExecutionArgs)\r\n    {\r\n        co_await winrt::resume_background();\r\n        co_return SUCCEEDED(Execute(verbExecutionArgs));\r\n    }\r\n\r\n    Wrappers::HString m_verbProviderId;\r\n    Wrappers::HString m_groupPath;\r\n    Wrappers::HString m_canonicalName;\r\n    Wrappers::HString m_displayName;\r\n    Wrappers::HString m_glyph;\r\n    Wrappers::HString m_glyphFontFamily;\r\n    Wrappers::HString m_accessKey;\r\n    Wrappers::HString m_shortcutText;\r\n    ComPtr<ABI::Windows::System::IUser> m_user;\r\n    ABI::WindowsInternal::Shell::UnifiedTile::TileVerbFlags m_flags;\r\n\r\n    ComPtr<ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTileIdentifier> m_unifiedTileIdentifier;\r\n};\r\n\r\nnamespace ABI::Windows::Foundation::Collections\r\n{\r\n    template <>\r\n    struct __declspec(uuid(\"22e86da4-c5d3-50e2-b649-dd5a9e58fd26\"))\r\n    IVector<ABI::WindowsInternal::Shell::UnifiedTile::ITileVerb*> : IVector_impl<ABI::WindowsInternal::Shell::UnifiedTile::ITileVerb*>\r\n    {\r\n    };\r\n}\r\n\r\nHRESULT (*WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicableFunc)(\r\n    void* _this,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTile* tile,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTileManager* manager,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IVerbEnumerationArgs* verbEnumerationArgs,\r\n    ABI::Windows::Foundation::Collections::IVector<ABI::WindowsInternal::Shell::UnifiedTile::ITileVerb*>* verbs);\r\n\r\nHRESULT WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicable(\r\n    void* _this,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTile* tile,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IUnifiedTileManager* manager,\r\n    ABI::WindowsInternal::Shell::UnifiedTile::IVerbEnumerationArgs* verbEnumerationArgs,\r\n    ABI::Windows::Foundation::Collections::IVector<ABI::WindowsInternal::Shell::UnifiedTile::ITileVerb*>* verbs)\r\n{\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::Private;\r\n\r\n    if (!dwStartShowClassicMode)\r\n        return WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicableFunc(_this, tile, manager, verbEnumerationArgs, verbs);\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pUnifiedTileIdentifier;\r\n    THROW_IF_FAILED(tile->get_Id(&pUnifiedTileIdentifier));\r\n\r\n    UnifiedTileIdentifierKind kind;\r\n    THROW_IF_FAILED(pUnifiedTileIdentifier->get_Kind(&kind));\r\n\r\n    ComPtr<IVerbEnumerationArgsPrivate> pVerbEnumerationArgsPrivate;\r\n    THROW_IF_FAILED(verbEnumerationArgs->QueryInterface(IID_PPV_ARGS(&pVerbEnumerationArgsPrivate)));\r\n\r\n    bool bCanProceed = false;\r\n\r\n    BOOLEAN bIsStartPin;\r\n    if (SUCCEEDED_LOG(pVerbEnumerationArgsPrivate->IsMatchingVerbCanonicalName(Wrappers::HStringReference(L\"StartPin\").Get(), &bIsStartPin)) && bIsStartPin)\r\n    {\r\n        bCanProceed = kind != UnifiedTileIdentifierKind_Unknown;\r\n    }\r\n    else\r\n    {\r\n        BOOLEAN bIsStartUnpin;\r\n        if (SUCCEEDED_LOG(pVerbEnumerationArgsPrivate->IsMatchingVerbCanonicalName(Wrappers::HStringReference(L\"StartUnpin\").Get(), &bIsStartUnpin)) && bIsStartUnpin)\r\n        {\r\n            bCanProceed = kind != UnifiedTileIdentifierKind_Unknown;\r\n        }\r\n    }\r\n\r\n    if (!bCanProceed)\r\n        return S_OK;\r\n\r\n    // Windows 10 start menu-specific code begins here\r\n    ComPtr<IUnifiedTileCollection> pTileCollection;\r\n    THROW_IF_FAILED(manager->GetCollection(CollectionProvider_CuratedTileCollection, Wrappers::HStringReference(L\"Start.TileGrid\").Get(), &pTileCollection)); // @MOD Not accessing field_58\r\n\r\n    ComPtr<ITileContainerPrivate> pTileContainerPrivate;\r\n    THROW_IF_FAILED(pTileCollection.As(&pTileContainerPrivate));\r\n\r\n    bool bPreventPinning;\r\n\r\n    ComPtr<ITileCollectionContainer> pTileCollectionContainer;\r\n    bool bCollectionFound = pTileContainerPrivate->TryFindTileByUnifiedTileIdRecursive(pUnifiedTileIdentifier.Get(), nullptr, &pTileCollectionContainer);\r\n\r\n    if (bCollectionFound)\r\n    {\r\n        bPreventPinning = false;\r\n    }\r\n    else if (kind == UnifiedTileIdentifierKind_TargetedContent)\r\n    {\r\n        bPreventPinning = true;\r\n    }\r\n    else\r\n    {\r\n        ComPtr<IUnifiedTilePrivate> pUnifiedTilePrivate;\r\n        THROW_IF_FAILED(tile->QueryInterface(IID_PPV_ARGS(&pUnifiedTilePrivate)));\r\n\r\n        BOOLEAN bVisibleInAppList;\r\n        THROW_IF_FAILED(pUnifiedTilePrivate->get_IsVisibleInAppList(&bVisibleInAppList));\r\n\r\n        if (bVisibleInAppList)\r\n        {\r\n            bPreventPinning = false;\r\n            if (kind == UnifiedTileIdentifierKind_Win32)\r\n            {\r\n                ComPtr<IWin32ShortcutInfo> pWin32ShortcutInfo;\r\n                THROW_IF_FAILED(tile->get_Win32ShortcutInfo(&pWin32ShortcutInfo));\r\n\r\n                if (pWin32ShortcutInfo.Get())\r\n                {\r\n                    BOOLEAN bLocalPreventPinning;\r\n                    if (SUCCEEDED_LOG(pWin32ShortcutInfo->get_PreventPinning(&bLocalPreventPinning)))\r\n                        bPreventPinning = bLocalPreventPinning != FALSE;\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            bPreventPinning = true;\r\n        }\r\n    }\r\n\r\n    if (!bPreventPinning)\r\n    {\r\n        // We are not playing around with policies for now\r\n    }\r\n\r\n    ComPtr<ITileVerb> pTileVerb;\r\n    THROW_IF_FAILED(MakeAndInitialize<EPStartPinUnpinTileVerb>(&pTileVerb, pUnifiedTileIdentifier.Get(), !bCollectionFound, verbEnumerationArgs, *(HSTRING*)((PBYTE)_this + 0x40), nullptr));\r\n    THROW_IF_FAILED(verbs->Append(pTileVerb.Get()));\r\n\r\n    return S_OK;\r\n}\r\n\r\nHRESULT PatchUnifiedTilePinUnpinProvider(HMODULE hModule)\r\n{\r\n    PBYTE pText;\r\n    DWORD cbText;\r\n    RETURN_HR_IF(E_NOT_SET, !TextSectionBeginAndSize(hModule, &pText, &cbText));\r\n\r\n#if defined(_M_X64)\r\n    PBYTE match;\r\n    SIZE_T offset = (SIZE_T)pText;\r\n    while (true)\r\n    {\r\n        // 48 89 ?? 24 ?? 4C 8B ?? 4C 8B 44 24 ?? 49 8B ?? ?? 8B ?? E8 ?? ?? ?? ??\r\n        //                                                             ^^^^^^^^^^^\r\n        match = (PBYTE)FindPattern(\r\n            (PVOID)offset,\r\n            cbText - (DWORD)(offset - (SIZE_T)pText),\r\n            \"\\x48\\x89\\x00\\x24\\x00\\x4C\\x8B\\x00\\x4C\\x8B\\x44\\x24\\x00\\x49\\x8B\\x00\\x00\\x8B\\x00\\xE8\",\r\n            \"xx?x?xx?xxxx?xx??x?x\"\r\n        );\r\n        if (!match)\r\n        {\r\n            // We tried our best, but we found nothing...\r\n            break;\r\n        }\r\n\r\n        // Possible match, prepare the start offset for the next search\r\n        offset += ((SIZE_T)match - offset) + 24 /*first pattern size*/;\r\n\r\n        // Check the referred function's preamble to see if this is what we're looking for\r\n        match += 19;\r\n        match += 5 + *(int*)(match + 1);\r\n\r\n        // 41 54 41 55 41 56 41 57 48\r\n        PBYTE matchPreambleTest = (PBYTE)FindPattern(\r\n            match,\r\n            9 /*second pattern size*/ + 8 /*should start within these first bytes*/,\r\n            \"\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\",\r\n            \"xxxxxxxxx\"\r\n        );\r\n\r\n        if (matchPreambleTest)\r\n        {\r\n            // Got it!\r\n            break;\r\n        }\r\n    }\r\n#elif defined(_M_ARM64)\r\n    // 40 F9 E3 03 15 AA ?? ?? 40 F9 E1 03 ?? AA E0 03 ?? AA ?? ?? ?? ?? E3 03 00 2A // NI, GE\r\n    //                                                       ^^^^^^^^^^^\r\n    // Ref: WindowsInternal::Shell::UnifiedTile::Private::UnifiedTilePinUnpinVerbProvider::GetVerbs()\r\n    PBYTE match = (PBYTE)FindPattern(\r\n        pText,\r\n        cbText,\r\n        \"\\x40\\xF9\\xE3\\x03\\x15\\xAA\\x00\\x00\\x40\\xF9\\xE1\\x03\\x00\\xAA\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\xE3\\x03\\x00\\x2A\",\r\n        \"xxxxxx??xxxx?xxx?x????xxxx\"\r\n    );\r\n    if (match)\r\n    {\r\n        match += 18;\r\n        match = (PBYTE)ARM64_FollowBL((DWORD*)match);\r\n    }\r\n    else\r\n    {\r\n        // E4 8A 40 A9 E3 03 ?? AA E1 03 ?? AA E0 03 ?? AA ?? ?? ?? ?? ?? ?? ?? F9 E3 03 00 2A // BR\r\n        //                                                 ^^^^^^^^^^^\r\n        // Ref: WindowsInternal::Shell::UnifiedTile::Private::UnifiedTilePinUnpinVerbProvider::GetVerbs()\r\n        match = (PBYTE)FindPattern(\r\n            pText,\r\n            cbText,\r\n            \"\\xE4\\x8A\\x40\\xA9\\xE3\\x03\\x00\\xAA\\xE1\\x03\\x00\\xAA\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xF9\\xE3\\x03\\x00\\x2A\",\r\n            \"xxxxxx?xxx?xxx?x???????xxxxx\"\r\n        );\r\n        if (match)\r\n        {\r\n            match += 16;\r\n            match = (PBYTE)ARM64_FollowBL((DWORD*)match);\r\n        }\r\n    }\r\n#endif\r\n\r\n    int rv = -1;\r\n    if (match)\r\n    {\r\n        WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicableFunc =\r\n            (decltype(WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicableFunc))match;\r\n        rv = funchook_prepare(\r\n            funchook,\r\n            (void**)&WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicableFunc,\r\n            WindowsInternal__Shell__UnifiedTile__Private__UnifiedTilePinUnpinVerbProvider__AddStartPinUnpinVerbIfApplicable\r\n        );\r\n    }\r\n    if (rv != 0)\r\n    {\r\n        printf(\"Failed to hook UnifiedTilePinUnpinVerbProvider::GetVerbs(). rv = %d\\n\", rv);\r\n    }\r\n\r\n    return S_OK;\r\n}\r\n\r\nextern \"C\" {\r\n\r\nvoid PatchStartTileDataFurther(HMODULE hModule, BOOL bSMEH)\r\n{\r\n    // ComPtr<ABI::Windows::Internal::ApplicationModel::IPinnableSurfaceFactory> pPinnableSurfaceFactory;\r\n    // PatchStartPinnableSurface(hModule, nullptr /*&pPinnableSurfaceFactory*/);\r\n\r\n    // if (bSMEH)\r\n        // pPinnableSurfaceFactory->AddRef(); // Pin in memory so that StartTileData.dll doesn't get unloaded\r\n\r\n    PatchUnifiedTilePinUnpinProvider(hModule);\r\n}\r\n\r\n} // extern \"C\"\r\n\r\nstruct CCacheShortcut\r\n{\r\n    const wchar_t* GetAppID(const void* a2) const\r\n    {\r\n        DWORD dwOffset = *(DWORD*)((PBYTE)this + 44); // Same offset in Windows 10 and 11\r\n        return dwOffset != -1 ? (wchar_t*)((char*)a2 + dwOffset) : nullptr;\r\n    }\r\n};\r\n\r\nextern \"C\"\r\n{\r\n\r\nHRESULT(*AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc)(void* _this, const CCacheShortcut* a2, const void* a3);\r\nHRESULT AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStart(void* _this, const CCacheShortcut* a2, const void* a3)\r\n{\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::Private;\r\n    using namespace ABI::WindowsInternal::Shell::UnifiedTile::CuratedTileCollections;\r\n\r\n    if (!dwStartShowClassicMode)\r\n        return AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc(_this, a2, a3);\r\n\r\n    ComPtr<IWin32UnifiedTileIdentifierFactory> pTileIdentifierFactory;\r\n    RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.UnifiedTileIdentifier\").Get(),\r\n        &pTileIdentifierFactory\r\n    ));\r\n\r\n    ComPtr<IUnifiedTileIdentifier> pTileIdentifier;\r\n    const wchar_t* pwszAppId = a2->GetAppID(a3);\r\n    RETURN_IF_FAILED(pTileIdentifierFactory->Create(\r\n        Wrappers::HStringReference(pwszAppId).Get(),\r\n        &pTileIdentifier\r\n    ));\r\n\r\n    ComPtr<IUnifiedTileUserPinHelperStatics> pTileUserPinHelper;\r\n    RETURN_IF_FAILED(Windows::Foundation::GetActivationFactory(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.Private.UnifiedTileUserPinHelper\").Get(),\r\n        &pTileUserPinHelper\r\n    ));\r\n\r\n    RETURN_IF_FAILED(pTileUserPinHelper->CreateUserPinnedShortcutTile(pTileIdentifier.Get()));\r\n\r\n    // Windows 10 start menu-specific code begins here\r\n    ComPtr<ICuratedTileCollectionManager> pTileCollectionManager;\r\n    RETURN_IF_FAILED(RoActivateInstance(\r\n        Wrappers::HStringReference(L\"WindowsInternal.Shell.UnifiedTile.CuratedTileCollections.CuratedTileCollectionManager\").Get(),\r\n        &pTileCollectionManager\r\n    ));\r\n\r\n    ComPtr<ICuratedTileCollection> pTileCollection;\r\n    RETURN_IF_FAILED(pTileCollectionManager->GetCollection(\r\n        Wrappers::HStringReference(L\"Start.TileGrid\").Get(),\r\n        &pTileCollection\r\n    ));\r\n\r\n    ComPtr<IStartTileCollection> pStartTileCollection;\r\n    RETURN_IF_FAILED(pTileCollection.As(&pStartTileCollection));\r\n\r\n    RETURN_IF_FAILED(pStartTileCollection->PinToStart(pTileIdentifier.Get(), TilePinSize_Tile2x2));\r\n\r\n    RETURN_IF_FAILED(pTileCollection->Commit());\r\n\r\n    return S_OK;\r\n}\r\n\r\n} // extern \"C\"\r\n"
  },
  {
    "path": "ExplorerPatcher/StartupSound.cpp",
    "content": "﻿#include \"StartupSound.h\"\r\n\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n#include <stdio.h>\r\n#include <strsafe.h>\r\n#pragma comment(lib, \"Winmm.lib\")\r\n#include <Wtsapi32.h>\r\n#pragma comment(lib, \"Wtsapi32.lib\")\r\n#include <tchar.h>\r\n#include <wrl/client.h>\r\n#include <wil/result_macros.h>\r\n\r\n#include \"def.h\"\r\n\r\nBOOL AreLogonLogoffShutdownSoundsEnabled()\r\n{\r\n#if 0\r\n    DWORD dwValue = 0;\r\n    DWORD dwSize = sizeof(dwValue);\r\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"LogonLogoffShutdownSounds\", RRF_RT_DWORD, nullptr, &dwValue, &dwSize);\r\n    return dwValue != 0;\r\n#else\r\n    return FALSE;\r\n#endif\r\n}\r\n\r\nDWORD GetLastErrorError()\r\n{\r\n    DWORD result = GetLastError();\r\n    return result == ERROR_SUCCESS ? 1 : result;\r\n}\r\n\r\nHRESULT HRESULTFromLastErrorError()\r\n{\r\n    DWORD error = GetLastError();\r\n    if (error != ERROR_SUCCESS && (int)error <= 0)\r\n        return (HRESULT)GetLastErrorError();\r\n    else\r\n        return (HRESULT)((GetLastErrorError() & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000);\r\n}\r\n\r\nDWORD PlaySoundFileThreadProc(LPVOID pvData)\r\n{\r\n    PlaySoundW((LPCWSTR)pvData, nullptr, SND_NODEFAULT | SND_MEMORY | SND_SYSTEM);\r\n    LocalFree(pvData);\r\n    return 0;\r\n}\r\n\r\nHRESULT PlaySoundFile(HANDLE* phThread, const WCHAR* pszPath)\r\n{\r\n    HRESULT hr;\r\n\r\n    void* pvData = nullptr;\r\n    HANDLE hFile = CreateFileW(\r\n        pszPath,\r\n        GENERIC_READ,\r\n        FILE_SHARE_READ | FILE_SHARE_DELETE,\r\n        nullptr,\r\n        OPEN_EXISTING,\r\n        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,\r\n        nullptr\r\n    );\r\n    if (hFile != INVALID_HANDLE_VALUE)\r\n    {\r\n        DWORD dwSize = GetFileSize(hFile, nullptr);\r\n        hr = E_OUTOFMEMORY;\r\n        if (dwSize != (DWORD)-1 && dwSize)\r\n        {\r\n            if (dwSize < 0x400000)\r\n            {\r\n                pvData = LocalAlloc(0, dwSize);\r\n                if (pvData)\r\n                {\r\n                    DWORD dwRead;\r\n                    if (ReadFile(hFile, pvData, dwSize, &dwRead, nullptr))\r\n                        hr = dwSize == dwRead ? S_OK : HRESULT_FROM_WIN32(ERROR_IO_PENDING);\r\n                    else\r\n                        hr = HRESULTFromLastErrorError();\r\n                }\r\n            }\r\n        }\r\n        else\r\n        {\r\n            hr = HRESULTFromLastErrorError();\r\n        }\r\n        CloseHandle(hFile);\r\n    }\r\n    else\r\n    {\r\n        hr = HRESULTFromLastErrorError();\r\n    }\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HANDLE hThread = CreateThread(nullptr, 0, PlaySoundFileThreadProc, pvData, 0, nullptr);\r\n        if (hThread)\r\n        {\r\n            if (phThread)\r\n                *phThread = hThread;\r\n            else\r\n                CloseHandle(hThread);\r\n            return hr;\r\n        }\r\n        hr = HRESULTFromLastErrorError();\r\n    }\r\n    if (pvData)\r\n        LocalFree(pvData);\r\n    return hr;\r\n}\r\n\r\ntypedef enum LOGONOFFSOUNDTYPE\r\n{\r\n    LOGONOFFSOUNDTYPE_LOGON,\r\n    LOGONOFFSOUNDTYPE_LOGOFF,\r\n    LOGONOFFSOUNDTYPE_EXIT,\r\n} LOGONOFFSOUNDTYPE;\r\n\r\nHRESULT PlayLogonLogoffSound(HANDLE* phThread, LOGONOFFSOUNDTYPE type)\r\n{\r\n    const WCHAR* szEventName;\r\n    switch (type)\r\n    {\r\n        case LOGONOFFSOUNDTYPE_LOGON:\r\n            szEventName = L\"WindowsLogon\";\r\n            break;\r\n        case LOGONOFFSOUNDTYPE_LOGOFF:\r\n            szEventName = L\"WindowsLogoff\";\r\n            break;\r\n        default:\r\n            szEventName = L\"SystemExit\";\r\n            break;\r\n    }\r\n\r\n    WCHAR szSubKey[MAX_PATH];\r\n    HRESULT hr = StringCchPrintfW(szSubKey, ARRAYSIZE(szSubKey), L\"AppEvents\\\\Schemes\\\\Apps\\\\.Default\\\\%ws\\\\.Current\", szEventName);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    WCHAR szPath[MAX_PATH];\r\n    DWORD cbData = sizeof(szPath);\r\n    LSTATUS lStat = RegGetValueW(HKEY_CURRENT_USER, szSubKey, nullptr, REG_EXPAND_SZ, nullptr, szPath, &cbData);\r\n    if (lStat != ERROR_SUCCESS)\r\n        return HRESULT_FROM_WIN32(lStat);\r\n\r\n    return PlaySoundFile(phThread, szPath);\r\n}\r\n\r\n// https://stackoverflow.com/a/59810748\r\nbool IsSessionLocked()\r\n{\r\n    WTSINFOEXW* pInfo = NULL;\r\n    WTS_INFO_CLASS wtsic = WTSSessionInfoEx;\r\n    LPTSTR ppBuffer = NULL;\r\n    DWORD dwBytesReturned = 0;\r\n    LONG sessionFlags = WTS_SESSIONSTATE_UNKNOWN;\r\n\r\n    DWORD dwSessionID = WTSGetActiveConsoleSessionId();\r\n\r\n    if (WTSQuerySessionInformationW(WTS_CURRENT_SERVER_HANDLE, dwSessionID, wtsic, &ppBuffer, &dwBytesReturned))\r\n    {\r\n        if (dwBytesReturned > 0)\r\n        {\r\n            pInfo = (WTSINFOEXW*)ppBuffer;\r\n            if (pInfo->Level == 1)\r\n            {\r\n                sessionFlags = pInfo->Data.WTSInfoExLevel1.SessionFlags;\r\n            }\r\n        }\r\n        WTSFreeMemory(ppBuffer);\r\n        ppBuffer = NULL;\r\n    }\r\n\r\n    return (sessionFlags == WTS_SESSIONSTATE_LOCK);\r\n}\r\n\r\nHRESULT (*CLogonSound_PlayIfNecessaryFunc)(void* _this, LOGON_SOUND_CLIENT client);\r\nHRESULT CLogonSound_PlayIfNecessaryHook(void* _this, LOGON_SOUND_CLIENT client)\r\n{\r\n    HRESULT hr = CLogonSound_PlayIfNecessaryFunc(_this, client);\r\n    if (hr != S_OK && client == LSC_EXPLORER)\r\n    {\r\n        if (!IsSessionLocked())\r\n            PlayLogonLogoffSound(nullptr, LOGONOFFSOUNDTYPE_LOGON);\r\n    }\r\n    return hr;\r\n}\r\n\r\nHRESULT HookLogonSound()\r\n{\r\n    RETURN_IF_FAILED(CoInitialize(nullptr));\r\n\r\n    Microsoft::WRL::ComPtr<IAuthUILogonSound> logonSound;\r\n    RETURN_IF_FAILED(CoCreateInstance(__uuidof_AuthUILogonSound, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&logonSound)));\r\n\r\n    void** vtable = *(void***)logonSound.Get();\r\n    DWORD flOldProtect;\r\n    RETURN_HR_IF(E_FAIL, !VirtualProtect(&vtable[3], sizeof(void*), PAGE_EXECUTE_READWRITE, &flOldProtect));\r\n\r\n    CLogonSound_PlayIfNecessaryFunc = (decltype(CLogonSound_PlayIfNecessaryFunc))vtable[3];\r\n    vtable[3] = (void*)CLogonSound_PlayIfNecessaryHook;\r\n    VirtualProtect(&vtable[3], sizeof(void*), flOldProtect, &flOldProtect);\r\n\r\n    return S_OK;\r\n}\r\n\r\nLRESULT SHDefWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r\n{\r\n    if (IsWindowUnicode(hwnd))\r\n    {\r\n        return DefWindowProcW(hwnd, uMsg, wParam, lParam);\r\n    }\r\n    else\r\n    {\r\n        return DefWindowProcA(hwnd, uMsg, wParam, lParam);\r\n    }\r\n}\r\n\r\nHWND g_hwndSound;\r\n\r\nclass CSoundWnd\r\n{\r\npublic:\r\n    CSoundWnd();\r\n\r\n    BOOL Init();\r\n    DWORD Release();\r\n\r\nprotected:\r\n    static LRESULT CALLBACK s_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\r\n    LRESULT v_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\r\n\r\nprivate:\r\n    static DWORD s_CreateWindow(void* pvParam);\r\n    static DWORD s_ThreadProc(void* pvParam);\r\n\r\n    LONG m_refCount;\r\n    HWND m_hwnd;\r\n    HANDLE m_thread;\r\n};\r\n\r\nCSoundWnd::CSoundWnd()\r\n    : m_refCount(1)\r\n    , m_hwnd(nullptr)\r\n    , m_thread(nullptr)\r\n{\r\n}\r\n\r\nBOOL CSoundWnd::Init()\r\n{\r\n    SHCreateThread(s_ThreadProc, this, CTF_THREAD_REF | CTF_COINIT_STA | CTF_REF_COUNTED | CTF_NOADDREFLIB, s_CreateWindow);\r\n    g_hwndSound = m_hwnd;\r\n    return m_hwnd != nullptr;\r\n}\r\n\r\nDWORD CSoundWnd::Release()\r\n{\r\n    LONG refCount = InterlockedDecrement(&m_refCount);\r\n    if (refCount == 0 && this)\r\n        operator delete(this);\r\n    return refCount;\r\n}\r\n\r\nLRESULT CSoundWnd::s_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r\n{\r\n    CSoundWnd* pThis = (CSoundWnd*)GetWindowLongPtrW(hwnd, 0);\r\n    if (pThis)\r\n        return pThis->v_WndProc(hwnd, uMsg, wParam, lParam);\r\n    else\r\n        return SHDefWindowProc(hwnd, uMsg, wParam, lParam);\r\n}\r\n\r\nLRESULT CSoundWnd::v_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r\n{\r\n    switch (uMsg)\r\n    {\r\n        case WM_QUERYENDSESSION:\r\n        {\r\n            if ((lParam & ENDSESSION_CRITICAL) == 0)\r\n            {\r\n                WCHAR sz[256];\r\n                LoadStringW(GetModuleHandleW(nullptr), 731, sz, ARRAYSIZE(sz)); // Playing logoff sound...\r\n                ShutdownBlockReasonCreate(m_hwnd, sz);\r\n                PlayLogonLogoffSound(&m_thread, (lParam & ENDSESSION_LOGOFF) != 0 ? LOGONOFFSOUNDTYPE_LOGOFF : LOGONOFFSOUNDTYPE_EXIT);\r\n                if (m_thread)\r\n                {\r\n                    WaitForSingleObject(m_thread, INFINITE); // @MOD\r\n                    CloseHandle(m_thread); // @MOD\r\n                }\r\n            }\r\n            return 1;\r\n        }\r\n        case WM_ENDSESSION:\r\n        {\r\n            /*if (wParam && (lParam & ENDSESSION_CRITICAL) == 0 && m_thread) // @MOD This doesn't work\r\n            {\r\n                WaitForSingleObject(m_thread, INFINITE);\r\n                CloseHandle(m_thread);\r\n            }*/\r\n            DestroyWindow(m_hwnd);\r\n            break;\r\n        }\r\n        case WM_NCDESTROY:\r\n        {\r\n            SetWindowLongPtrW(hwnd, 0, 0);\r\n            g_hwndSound = nullptr;\r\n            m_hwnd = nullptr;\r\n            PostQuitMessage(0);\r\n            return 0;\r\n        }\r\n    }\r\n    return SHDefWindowProc(hwnd, uMsg, wParam, lParam);\r\n}\r\n\r\nextern \"C\" HWND (__stdcall *explorerframe_SHCreateWorkerWindowFunc)(\r\n    WNDPROC wndProc,\r\n    HWND hWndParent,\r\n    DWORD dwExStyle,\r\n    DWORD dwStyle,\r\n    HMENU hMenu,\r\n    LONG_PTR wnd_extra\r\n);\r\n\r\nDWORD CSoundWnd::s_CreateWindow(void* pvParam)\r\n{\r\n    CSoundWnd* pThis = (CSoundWnd*)pvParam;\r\n    InterlockedIncrement(&pThis->m_refCount);\r\n    pThis->m_hwnd = explorerframe_SHCreateWorkerWindowFunc(s_WndProc, nullptr, 0, 0, nullptr, (LONG_PTR)pThis);\r\n    return 0;\r\n}\r\n\r\nDWORD CSoundWnd::s_ThreadProc(void* pvParam)\r\n{\r\n    CSoundWnd* pThis = (CSoundWnd*)pvParam;\r\n    if (pThis->m_hwnd)\r\n    {\r\n        MSG Msg;\r\n        while (GetMessageW(&Msg, nullptr, 0, 0))\r\n        {\r\n            TranslateMessage(&Msg);\r\n            DispatchMessageW(&Msg);\r\n        }\r\n    }\r\n    pThis->Release();\r\n    return 0;\r\n}\r\n\r\nBOOL InitSoundWindow()\r\n{\r\n    BOOL bSuccess = FALSE;\r\n    CSoundWnd* soundWnd = new CSoundWnd();\r\n    if (soundWnd)\r\n    {\r\n        bSuccess = soundWnd->Init();\r\n        soundWnd->Release();\r\n    }\r\n    return bSuccess;\r\n}\r\n\r\nvoid TermSoundWindow()\r\n{\r\n    if (g_hwndSound)\r\n    {\r\n        PostMessageW(g_hwndSound, WM_CLOSE, 0, 0);\r\n        g_hwndSound = nullptr;\r\n    }\r\n}\r\n\r\nHRESULT SHPlaySound(LPCWSTR pszSound, DWORD dwFlags)\r\n{\r\n    HRESULT hr;\r\n    BOOL bDefault = (dwFlags & 1) != 0;\r\n    BOOL bSecondAttempt = FALSE;\r\n    while (true)\r\n    {\r\n        WCHAR szKey[MAX_PATH];\r\n        hr = StringCchPrintfW(szKey, MAX_PATH, L\"AppEvents\\\\Schemes\\\\Apps\\\\%s\\\\%s\\\\.current\", bDefault ? L\".Default\" : L\"Explorer\", pszSound);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            WCHAR pvData[MAX_PATH];\r\n            DWORD cbData = sizeof(pvData);\r\n            if (SHGetValueW(HKEY_CURRENT_USER, szKey, nullptr, nullptr, pvData, &cbData) == ERROR_SUCCESS && cbData && pvData[0])\r\n                hr = PlaySoundW(pszSound, nullptr, (!bDefault ? 0x400000 : 0) | (SND_ASYNC | SND_NODEFAULT | SND_NOSTOP | SND_NOWAIT | SND_ALIAS | SND_SENTRY | SND_SYSTEM)) ? S_OK : S_FALSE;\r\n        }\r\n        if (hr == S_OK || (dwFlags & 2) == 0 || bSecondAttempt)\r\n            break;\r\n        bDefault = !bDefault;\r\n        bSecondAttempt = TRUE;\r\n    }\r\n    return hr;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/StartupSound.h",
    "content": "#ifndef _H_STARTUPSOUND_H_\r\n#define _H_STARTUPSOUND_H_\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n\r\nDEFINE_GUID(__uuidof_AuthUILogonSound,\r\n    0x0A0D018EE,\r\n    0x1100, 0x4389, 0xAB, 0x44,\r\n    0x46, 0x4F, 0xAF, 0x00, 0x12, 0x88\r\n);\r\n\r\n#ifdef __cplusplus\r\nenum LOGON_SOUND_CLIENT\r\n{\r\n    LSC_LOGONUI,\r\n    LSC_EXPLORER,\r\n};\r\n\r\nMIDL_INTERFACE(\"c35243ea-4cfc-435a-91c2-9dbdecbffc95\")\r\nIAuthUILogonSound : IUnknown\r\n{\r\n    virtual HRESULT STDMETHODCALLTYPE PlayIfNecessary(LOGON_SOUND_CLIENT client) = 0;\r\n};\r\n#endif\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nBOOL AreLogonLogoffShutdownSoundsEnabled();\r\nHRESULT HookLogonSound();\r\nBOOL InitSoundWindow();\r\nvoid TermSoundWindow();\r\n__declspec(dllexport) HRESULT SHPlaySound(LPCWSTR pszSound, DWORD dwFlags);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/Taskbar10.cpp",
    "content": "﻿#include \"utility.h\"\r\n#include \"ImmersiveColor.h\"\r\n\r\n#include <dcomptypes.h>\r\n\r\n#include <wrl/implements.h>\r\n#include <wrl/wrappers/corewrappers.h>\r\n#include <wil/result_macros.h>\r\n\r\n#pragma region \"Enable old taskbar\"\r\n/***\r\nOur target is in `CTray::Init()`. It constructs either the Windows 11 or the Windows 10 taskbar based on the result of\r\n`winrt::WindowsUdk::ApplicationModel::AppExtensions::XamlExtensions::IsExtensionAvailable()`. We can to make the last\r\nargument of that function be set to false, so that we'll get the Windows 10 taskbar instead of the Windows 11 one that\r\ngets constructed through `CTray::InitializeTrayUIComponent()`.\r\n\r\nAlternatively, we can modify the behavior of `CTray::InitializeTrayUIComponent`. It contains the code to call\r\n`TrayUI_CreateInstance()` that resides in `Taskbar.dll` (checked through HKLM\\SOFTWARE\\Classes\\CLSID\\<the CLSID>) which\r\nis a copy of the Windows 10 taskbar code but modified over the time to support the Windows 11 taskbar. We see that it\r\ncalls `CoCreateInstance` to get an `ITrayUIComponent` interface to an instance of `TrayUIComponent`. We hook that\r\nfunction to make it return our own custom `ITrayUIComponent` instance. Our `ITrayUIComponent::InitializeWithTray()`\r\nfunction calls `TrayUI_CreateInstance()` of `explorer.exe` that is also called when the last argument of\r\n`IsExtensionAvailable()` after the call is false.\r\n\r\nThis way, we can get the Windows 10 taskbar which resides in explorer.exe without hooking LoadLibraryExW() in order to\r\nperform our initial method which has been known to be inconsistent on some systems. (Thanks feature flags!)\r\n***/\r\n\r\nMIDL_INTERFACE(\"27775f88-01d3-46ec-a1c1-64b4c09b211b\")\r\nITrayUIComponent : IUnknown\r\n{\r\n    virtual HRESULT STDMETHODCALLTYPE InitializeWithTray(ITrayUIHost* host, ITrayUI** result) = 0;\r\n};\r\n\r\nclass EPTrayUIComponent : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, ITrayUIComponent>\r\n{\r\npublic:\r\n    STDMETHODIMP InitializeWithTray(ITrayUIHost* host, ITrayUI** result) override\r\n    {\r\n        RETURN_IF_FAILED(explorer_TrayUI_CreateInstanceFunc(host, IID_ITrayUI, (void**)result));\r\n\r\n        // Fix delayed logon when using the Windows 10 taskbar on Windows 11 21H2.\r\n        // Not present in 51, present in 120 onwards. 65, 71, and 100 are not checked yet.\r\n        if (global_rovi.dwBuildNumber == 22000 && global_ubr >= 120)\r\n        {\r\n            void** vtable = *(void***)host;\r\n            void (*FireDesktopSwitchIfReady)(ITrayUIHost*, int) = (decltype(FireDesktopSwitchIfReady))vtable[78];\r\n            FireDesktopSwitchIfReady(host, 8);\r\n        }\r\n\r\n        return S_OK;\r\n    }\r\n};\r\n\r\nextern \"C\" HRESULT EPTrayUIComponent_CreateInstance(REFIID riid, void** ppvObject)\r\n{\r\n    Microsoft::WRL::ComPtr<EPTrayUIComponent> instance;\r\n    RETURN_IF_FAILED(Microsoft::WRL::MakeAndInitialize<EPTrayUIComponent>(&instance));\r\n    RETURN_HR(instance.CopyTo(riid, ppvObject));\r\n}\r\n#pragma endregion\r\n\r\n#pragma region \"Restore acrylic background\"\r\ntypedef enum WINDOWCOMPOSITIONATTRIB\r\n{\r\n    WCA_UNDEFINED = 0,\r\n    WCA_NCRENDERING_ENABLED = 1,\r\n    WCA_NCRENDERING_POLICY = 2,\r\n    WCA_TRANSITIONS_FORCEDISABLED = 3,\r\n    WCA_ALLOW_NCPAINT = 4,\r\n    WCA_CAPTION_BUTTON_BOUNDS = 5,\r\n    WCA_NONCLIENT_RTL_LAYOUT = 6,\r\n    WCA_FORCE_ICONIC_REPRESENTATION = 7,\r\n    WCA_EXTENDED_FRAME_BOUNDS = 8,\r\n    WCA_HAS_ICONIC_BITMAP = 9,\r\n    WCA_THEME_ATTRIBUTES = 10,\r\n    WCA_NCRENDERING_EXILED = 11,\r\n    WCA_NCADORNMENTINFO = 12,\r\n    WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,\r\n    WCA_VIDEO_OVERLAY_ACTIVE = 14,\r\n    WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,\r\n    WCA_DISALLOW_PEEK = 16,\r\n    WCA_CLOAK = 17,\r\n    WCA_CLOAKED = 18,\r\n    WCA_ACCENT_POLICY = 19,\r\n    WCA_FREEZE_REPRESENTATION = 20,\r\n    WCA_EVER_UNCLOAKED = 21,\r\n    WCA_VISUAL_OWNER = 22,\r\n    WCA_HOLOGRAPHIC = 23,\r\n    WCA_EXCLUDED_FROM_DDA = 24,\r\n    WCA_PASSIVEUPDATEMODE = 25,\r\n    WCA_USEDARKMODECOLORS = 26,\r\n    WCA_CORNER_STYLE = 27,\r\n    WCA_PART_COLOR = 28,\r\n    WCA_DISABLE_MOVESIZE_FEEDBACK = 29,\r\n    WCA_SYSTEMBACKDROP_TYPE = 30,\r\n    WCA_SET_TAGGED_WINDOW_RECT = 31,\r\n    WCA_CLEAR_TAGGED_WINDOW_RECT = 32,\r\n    WCA_LAST = 33,\r\n} WINDOWCOMPOSITIONATTRIB;\r\n\r\ntypedef struct tagWINDOWCOMPOSITIONATTRIBDATA\r\n{\r\n    WINDOWCOMPOSITIONATTRIB Attrib;\r\n    void* pvData;\r\n    unsigned int cbData;\r\n} WINDOWCOMPOSITIONATTRIBDATA;\r\n\r\ntypedef enum ACCENT_STATE\r\n{\r\n    ACCENT_DISABLED = 0,\r\n    ACCENT_ENABLE_GRADIENT = 1,\r\n    ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,\r\n    ACCENT_ENABLE_BLURBEHIND = 3,\r\n    ACCENT_ENABLE_ACRYLICBLURBEHIND = 4,\r\n    ACCENT_ENABLE_HOSTBACKDROP = 5,\r\n    ACCENT_INVALID_STATE = 6,\r\n} ACCENT_STATE;\r\n\r\ntypedef struct ACCENT_POLICY\r\n{\r\n    ACCENT_STATE AccentState;\r\n    unsigned int AccentFlags;\r\n    unsigned long GradientColor;\r\n    long AnimationId;\r\n} ACCENT_POLICY;\r\n\r\nnamespace ABI::WindowsUdk::UI::Themes\r\n{\r\n    enum class VisualTheme\r\n    {\r\n        Dark = 0,\r\n        Light = 1,\r\n        HighContrastBlack = 2,\r\n        HighContrastWhite = 3,\r\n    };\r\n\r\n    MIDL_INTERFACE(\"8f0a6c35-72ca-5f4a-a5fb-1a731ec8b514\")\r\n    ISystemVisualThemeStatics : IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE get_Current(VisualTheme* value) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE add_Changed(void* handler, EventRegistrationToken* token) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE remove_Changed(EventRegistrationToken token) = 0;\r\n    };\r\n}\r\n\r\nstruct TaskbarTheme\r\n{\r\n    bool bColorPrevalence;\r\n    bool bEnableTransparency;\r\n    ABI::WindowsUdk::UI::Themes::VisualTheme visualTheme;\r\n\r\n    bool IsHighContrast() const\r\n    {\r\n        using namespace ABI::WindowsUdk::UI::Themes;\r\n        return visualTheme == VisualTheme::HighContrastBlack || visualTheme == VisualTheme::HighContrastWhite;\r\n    }\r\n\r\n    bool IsDark() const\r\n    {\r\n        using namespace ABI::WindowsUdk::UI::Themes;\r\n        return visualTheme == VisualTheme::Dark || visualTheme == VisualTheme::HighContrastBlack;\r\n    }\r\n};\r\n\r\nenum D3D_FEATURE_LEVEL : int;\r\n\r\nstruct COMPOSITION_CAPABILITY_INFO\r\n{\r\n    D3D_FEATURE_LEVEL minSafeFeatureLevel;\r\n    D3D_FEATURE_LEVEL maxHardwareFeatureLevel;\r\n    int usingSoftwareDevice;\r\n    int areEffectsSupported;\r\n    int boostCompositorClockSupported; // Valid on 11 21H2+\r\n};\r\n\r\ntypedef NTSTATUS (*NtDCompositionGetFrameStatistics_t)(DCOMPOSITION_FRAME_STATISTICS*, COMPOSITION_CAPABILITY_INFO*);\r\n\r\ninline NTSTATUS NtDCompositionGetFrameStatistics(DCOMPOSITION_FRAME_STATISTICS* pStatistics, COMPOSITION_CAPABILITY_INFO* pCapabilities)\r\n{\r\n    static NtDCompositionGetFrameStatistics_t f = nullptr;\r\n    if (!f)\r\n    {\r\n        HMODULE h = GetModuleHandleW(L\"dcomp.dll\");\r\n        if (h)\r\n            f = (NtDCompositionGetFrameStatistics_t)GetProcAddress(h, MAKEINTRESOURCEA(1046));\r\n    }\r\n    return f ? f(pStatistics, pCapabilities) : (NTSTATUS)0xC0000002L; // STATUS_NOT_IMPLEMENTED\r\n}\r\n\r\nbool ShouldApplyBlur()\r\n{\r\n    DCOMPOSITION_FRAME_STATISTICS statistics;\r\n    COMPOSITION_CAPABILITY_INFO capabilities;\r\n    return NtDCompositionGetFrameStatistics(&statistics, &capabilities) >= 0 && capabilities.areEffectsSupported && !capabilities.usingSoftwareDevice;\r\n}\r\n\r\nTaskbarTheme GetTaskbarTheme()\r\n{\r\n    TaskbarTheme rv;\r\n    // rv.visualTheme = winrt::WindowsUdk::UI::Themes::SystemVisualTheme::Current();\r\n\r\n    rv.visualTheme = ABI::WindowsUdk::UI::Themes::VisualTheme::Light;\r\n    Microsoft::WRL::ComPtr<ABI::WindowsUdk::UI::Themes::ISystemVisualThemeStatics> systemVisualTheme;\r\n    HRESULT hr = RoGetActivationFactory(\r\n        Microsoft::WRL::Wrappers::HStringReference(L\"WindowsUdk.UI.Themes.SystemVisualTheme\").Get(),\r\n        IID_PPV_ARGS(&systemVisualTheme)\r\n    );\r\n    if (SUCCEEDED_LOG(hr))\r\n    {\r\n        ABI::WindowsUdk::UI::Themes::VisualTheme theme;\r\n        if (SUCCEEDED_LOG(systemVisualTheme->get_Current(&theme)))\r\n        {\r\n            rv.visualTheme = theme;\r\n        }\r\n    }\r\n\r\n    DWORD bColorPrevalence = 0;\r\n    rv.bColorPrevalence =\r\n        SUCCEEDED(SHRegGetDWORD(\r\n            HKEY_CURRENT_USER,\r\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Themes\\\\Personalize\",\r\n            L\"ColorPrevalence\",\r\n            &bColorPrevalence\r\n        )) && bColorPrevalence;\r\n\r\n    bool bApplyBlur = ShouldApplyBlur();\r\n    DWORD bEnableTransparency;\r\n    rv.bEnableTransparency = !rv.IsHighContrast() && bApplyBlur\r\n        && SUCCEEDED(SHRegGetDWORD(\r\n            HKEY_CURRENT_USER,\r\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Themes\\\\Personalize\",\r\n            L\"EnableTransparency\",\r\n            &bEnableTransparency\r\n        )) && bEnableTransparency;\r\n\r\n    return rv;\r\n}\r\n\r\nDWORD GetTaskbarColor()\r\n{\r\n    TaskbarTheme tt = GetTaskbarTheme();\r\n\r\n    if (tt.IsHighContrast())\r\n        return GetSysColor(COLOR_WINDOW);\r\n\r\n    if (tt.bColorPrevalence)\r\n    {\r\n        DWORD result = CImmersiveColor::GetColor(tt.IsDark() ? IMCLR_SystemAccentDark2 : IMCLR_SystemAccentLight2);\r\n        if (tt.bEnableTransparency)\r\n            return (result & 0xFFFFFF) | 0xCC000000;\r\n        return result;\r\n    }\r\n\r\n    if (tt.IsDark())\r\n        return tt.bEnableTransparency ? 0x80202020 : 0xFF202020;\r\n\r\n    return tt.bEnableTransparency ? 0xF3F3F3 : 0xFFF3F3F3;\r\n}\r\n\r\nextern \"C\" void UpdateWindowAccentProperties_PatchAttribData(WINDOWCOMPOSITIONATTRIBDATA* pAttrData)\r\n{\r\n    ACCENT_POLICY* pAccentPolicy = (ACCENT_POLICY*)pAttrData->pvData;\r\n    if (false) // STTest makes it like this:\r\n    {\r\n        pAccentPolicy->AccentState = ACCENT_ENABLE_TRANSPARENTGRADIENT;\r\n        pAccentPolicy->GradientColor = 0;\r\n        pAccentPolicy->AnimationId = 0;\r\n    }\r\n    else\r\n    {\r\n        pAccentPolicy->AccentState = GetTaskbarTheme().bEnableTransparency ? ACCENT_ENABLE_ACRYLICBLURBEHIND : ACCENT_ENABLE_GRADIENT;\r\n        pAccentPolicy->GradientColor = GetTaskbarColor();\r\n        pAccentPolicy->AnimationId = 0;\r\n    }\r\n\r\n    pAccentPolicy->AccentFlags = 0x1 | 0x2 | 0x10;\r\n}\r\n#pragma endregion\r\n"
  },
  {
    "path": "ExplorerPatcher/TaskbarCenter.cpp",
    "content": "#include \"TaskbarCenter.h\"\r\n\r\n#include \"../ep_weather_host/ep_weather_host_h.h\"\r\n#include <intrin.h>\r\n\r\nextern \"C\"\r\n{\r\n\r\nDEFINE_GUID(POLID_TurnOffSPIAnimations, 0xD7AF00A, 0xB468, 0x4A39, 0xB0, 0x16, 0x33, 0x3E, 0x22, 0x77, 0xAB, 0xED);\r\nextern int(*SHWindowsPolicy)(REFIID);\r\nextern HWND PeopleButton_LastHWND;\r\nextern DWORD dwWeatherToLeft;\r\nextern DWORD dwOldTaskbarAl;\r\nextern DWORD dwMMOldTaskbarAl;\r\nextern DWORD dwSearchboxTaskbarMode;\r\nextern wchar_t* EP_TASKBAR_LENGTH_PROP_NAME;\r\nextern IEPWeather* epw;\r\n#define EP_TASKBAR_LENGTH_TOO_SMALL 20\r\nBOOL bTaskbarCenterHasPatchedSHWindowsPolicy = FALSE;\r\nUINT atomPeopleBand = 0;\r\nUINT atomMSTaskListWClass = 0;\r\nUINT atomMSTaskSwWClass = 0;\r\n\r\nHRESULT TaskbarCenter_Center(HWND hWnd, HWND hWndTaskbar, RECT rc, BOOL bIsTaskbarHorizontal)\r\n{\r\n\tHRESULT hr = S_OK;\r\n\tVARIANT vtChild[10];\r\n\tVARIANT vt;\r\n\tlong k = 0, kk = 0;\r\n\r\n\tIAccessible* pAccessible = nullptr;\r\n\tAccessibleObjectFromWindow(hWnd, 0, IID_PPV_ARGS(&pAccessible));\r\n\tif (pAccessible)\r\n\t{\r\n\t\tpAccessible->get_accChildCount(&kk);\r\n\t\tif (kk <= 10)\r\n\t\t{\r\n\t\t\tAccessibleChildren(pAccessible, 0, kk, vtChild, &k);\r\n\t\t\tfor (int i = 0; i < k; ++i)\r\n\t\t\t{\r\n\t\t\t\tif (vtChild[i].vt == VT_DISPATCH)\r\n\t\t\t\t{\r\n\t\t\t\t\tIDispatch* pDisp = vtChild[i].pdispVal;\r\n\t\t\t\t\tIAccessible* pChild = nullptr;\r\n\t\t\t\t\tpDisp->QueryInterface(IID_PPV_ARGS(&pChild));\r\n\t\t\t\t\tif (pChild)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvt.vt = VT_I4;\r\n\t\t\t\t\t\tvt.lVal = CHILDID_SELF;\r\n\t\t\t\t\t\tpChild->get_accRole(vt, &vt);\r\n\t\t\t\t\t\tif (vt.lVal == ROLE_SYSTEM_TOOLBAR)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tIAccessible* pLast = nullptr;\r\n\t\t\t\t\t\t\tkk = 0;\r\n\t\t\t\t\t\t\tpChild->get_accChildCount(&kk);\r\n\t\t\t\t\t\t\tif (kk <= 1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tSetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (HANDLE)-1);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse if (kk >= 2)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvt.vt = VT_I4;\r\n\t\t\t\t\t\t\t\tvt.lVal = kk - 1;\r\n\t\t\t\t\t\t\t\tlong x = 0, y = 0, w = 0, h = 0, d = 0;\r\n\t\t\t\t\t\t\t\tpChild->accLocation(&x, &y, &w, &h, vt);\r\n\t\t\t\t\t\t\t\tif (bIsTaskbarHorizontal ? (x == -1 || w < EP_TASKBAR_LENGTH_TOO_SMALL) : (y == -1 || h < EP_TASKBAR_LENGTH_TOO_SMALL))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\thr = E_FAIL;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif (kk >= 3)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\td = (bIsTaskbarHorizontal ? ((x - rc.left) + w) : ((y - rc.top) + h));\r\n\t\t\t\t\t\t\t\t\t\tvt.vt = VT_I4;\r\n\t\t\t\t\t\t\t\t\t\tvt.lVal = 1;\r\n\t\t\t\t\t\t\t\t\t\tx = 0, y = 0, w = 0, h = 0;\r\n\t\t\t\t\t\t\t\t\t\tpChild->accLocation(&x, &y, &w, &h, vt);\r\n\t\t\t\t\t\t\t\t\t\tif (bIsTaskbarHorizontal ? w == 0 : h == 0)\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tvt.vt = VT_I4;\r\n\t\t\t\t\t\t\t\t\t\t\tvt.lVal = 2;\r\n\t\t\t\t\t\t\t\t\t\t\tx = 0, y = 0, w = 0, h = 0;\r\n\t\t\t\t\t\t\t\t\t\t\tpChild->accLocation(&x, &y, &w, &h, vt);\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tif (bIsTaskbarHorizontal ? (x == -1 || w < EP_TASKBAR_LENGTH_TOO_SMALL) : (y == -1 || h < EP_TASKBAR_LENGTH_TOO_SMALL))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\thr = E_FAIL;\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tif (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))\r\n\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\tSetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (HANDLE)(UINT_PTR)(bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top))));\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\tif (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))\r\n\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\tSetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (HANDLE)(UINT_PTR)(bIsTaskbarHorizontal ? w : h));\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tpChild->Release();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpDisp->Release();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tpAccessible->Release();\r\n\t}\r\n\treturn hr;\r\n}\r\n\r\nBOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)\r\n{\r\n\tBOOL bWasCalled = FALSE;\r\n\tif (!atomMSTaskListWClass) atomMSTaskListWClass = RegisterWindowMessageW(L\"MSTaskListWClass\");\r\n\tif (GetClassWord(hWnd, GCW_ATOM) == atomMSTaskListWClass)\r\n\t{\r\n\t\tif (!atomMSTaskSwWClass) atomMSTaskSwWClass = RegisterWindowMessageW(L\"MSTaskSwWClass\");\r\n\t\tHWND hwndParent = GetParent(hWnd);\r\n\t\tBOOL bIsPrimaryTaskbar = (GetClassWord(hwndParent, GCW_ATOM) == atomMSTaskSwWClass);\r\n\t\tDWORD dwSetting = (bIsPrimaryTaskbar ? dwOldTaskbarAl : dwMMOldTaskbarAl);\r\n\t\tBOOL bCenteringEnabled = TaskbarCenter_ShouldCenter(dwSetting);\r\n\t\tif (!bCenteringEnabled && GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME))\r\n\t\t{\r\n\t\t\tRemovePropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME);\r\n\t\t}\r\n\t\tif (!bCenteringEnabled && !epw)\r\n\t\t{\r\n\t\t\treturn GetClientRect(hWnd, lpRect); // Early out\r\n\t\t}\r\n\t\tHWND hWndStart = nullptr;\r\n\t\tRECT rcStart = { 0, 0, 0, 0 };\r\n\t\tHWND hWndTaskbar = nullptr;\r\n\t\tif (bIsPrimaryTaskbar)\r\n\t\t{\r\n\t\t\thWndTaskbar = GetParent(GetParent(hwndParent));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\thWndTaskbar = GetParent(hwndParent);\r\n\t\t}\r\n\t\thWndStart = FindWindowExW(hWndTaskbar, nullptr, L\"Start\", nullptr);\r\n\t\tBOOL bIsTaskbarHorizontal = TaskbarCenter_IsTaskbarHorizontal(hWnd);\r\n\t\tHWND hReBarWindow32 = nullptr;\r\n\t\tif (bIsPrimaryTaskbar) hReBarWindow32 = FindWindowExW(hWndTaskbar, nullptr, L\"ReBarWindow32\", nullptr);\r\n\t\tHWND hPeopleBand = nullptr;\r\n\t\tif (bIsPrimaryTaskbar) hPeopleBand = FindWindowExW(hReBarWindow32, nullptr, L\"PeopleBand\", nullptr);\r\n\t\tBOOL bIsWeatherAvailable = hPeopleBand && dwWeatherToLeft;\r\n\t\tBOOL bWasLeftAlignedDueToSpaceConstraints = FALSE;\r\n\t\tif (bCenteringEnabled)\r\n\t\t{\r\n\t\t\tif (hWndStart)\r\n\t\t\t{\r\n\t\t\t\tGetClientRect(hWndStart, &rcStart);\r\n\t\t\t\tHWND hTrayButton = nullptr;\r\n\t\t\t\tconst wchar_t* pCn = L\"TrayButton\";\r\n\t\t\t\tif (/*!IsWindows11() &&*/ dwSearchboxTaskbarMode == 2) pCn = L\"TrayDummySearchControl\";\r\n\t\t\t\twhile ((hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, nullptr)))\r\n\t\t\t\t{\r\n\t\t\t\t\tif (pCn == L\"TrayButton\" && !IsWindowVisible(hTrayButton)) continue;\r\n\t\t\t\t\tRECT rcTrayButton;\r\n\t\t\t\t\tGetClientRect(hTrayButton, &rcTrayButton);\r\n\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trcStart.right += (rcTrayButton.right - rcTrayButton.left);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\trcStart.bottom += (rcTrayButton.bottom - rcTrayButton.top);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (pCn == L\"TrayDummySearchControl\") {\r\n\t\t\t\t\t\tpCn = L\"TrayButton\";\r\n\t\t\t\t\t\thTrayButton = nullptr;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tRECT rc;\r\n\t\t\tGetWindowRect(hWnd, &rc);\r\n\t\t\tMONITORINFO mi;\r\n\t\t\tZeroMemory(&mi, sizeof(MONITORINFO));\r\n\t\t\tmi.cbSize = sizeof(MONITORINFO);\r\n\t\t\tGetMonitorInfoW(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mi);\r\n\t\t\tlong dwLength = 0;\r\n\t\t\tTaskbarCenter_Center(hWnd, hWndTaskbar, mi.rcMonitor, bIsTaskbarHorizontal);\r\n\t\t\tif ((dwLength = (long)(UINT_PTR)GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME)))\r\n\t\t\t{\r\n\t\t\t\tif (dwLength == -1)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSetWindowPos(hWndStart, nullptr, ((mi.rcMonitor.right - mi.rcMonitor.left) - (rcStart.right - rcStart.left)) / 2, rcStart.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\r\n\t\t\t\t\t\t\tRECT rcTrayButton;\r\n\t\t\t\t\t\t\tGetClientRect(hWndStart, &rcTrayButton);\r\n\t\t\t\t\t\t\tDWORD dwDim = (rcTrayButton.right - rcTrayButton.left);\r\n\t\t\t\t\t\t\tHWND hTrayButton = nullptr;\r\n\t\t\t\t\t\t\tconst wchar_t* pCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\tif (/*!IsWindows11() &&*/ dwSearchboxTaskbarMode == 2) pCn = L\"TrayDummySearchControl\";\r\n\t\t\t\t\t\t\twhile ((hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, nullptr)))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayButton\" && !IsWindowVisible(hTrayButton)) continue;\r\n\t\t\t\t\t\t\t\tGetClientRect(hTrayButton, &rcTrayButton);\r\n\t\t\t\t\t\t\t\tMoveWindow(hTrayButton, ((mi.rcMonitor.right - mi.rcMonitor.left) - (rcStart.right - rcStart.left)) / 2 + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);\r\n\t\t\t\t\t\t\t\tif (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, nullptr, TRUE);\r\n\t\t\t\t\t\t\t\tdwDim += (rcTrayButton.right - rcTrayButton.left);\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayDummySearchControl\") {\r\n\t\t\t\t\t\t\t\t\tpCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\t\t\thTrayButton = nullptr;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSetWindowPos(hWndStart, nullptr, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\r\n\t\t\t\t\t\t\tRECT rcTrayButton;\r\n\t\t\t\t\t\t\tGetClientRect(hWndStart, &rcTrayButton);\r\n\t\t\t\t\t\t\tDWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);\r\n\t\t\t\t\t\t\tHWND hTrayButton = nullptr;\r\n\t\t\t\t\t\t\tconst wchar_t* pCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\tif (/*!IsWindows11() &&*/ dwSearchboxTaskbarMode == 2) pCn = L\"TrayDummySearchControl\";\r\n\t\t\t\t\t\t\twhile ((hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, nullptr)))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayButton\" && !IsWindowVisible(hTrayButton)) continue;\r\n\t\t\t\t\t\t\t\tGetClientRect(hTrayButton, &rcTrayButton);\r\n\t\t\t\t\t\t\t\tMoveWindow(hTrayButton, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2 + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);\r\n\t\t\t\t\t\t\t\tInvalidateRect(hTrayButton, nullptr, TRUE);\r\n\t\t\t\t\t\t\t\tdwDim += (rcTrayButton.bottom - rcTrayButton.top);\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayDummySearchControl\") {\r\n\t\t\t\t\t\t\t\t\tpCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\t\t\thTrayButton = nullptr;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, nullptr, TRUE);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tRECT rcPeopleBand = { 0, 0, 0, 0 };\r\n\t\t\t\t\tRECT rcReBarWindow32 = { 0, 0, 0, 0 };\r\n\t\t\t\t\tif (hPeopleBand)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tGetClientRect(hPeopleBand, &rcPeopleBand);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (hReBarWindow32)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tGetClientRect(hReBarWindow32, &rcReBarWindow32);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tRECT rc;\r\n\t\t\t\t\tGetWindowRect(hWnd, &rc);\r\n\t\t\t\t\t//MARGINS mBand;\r\n\t\t\t\t\t//mBand.cxLeftWidth = 0; mBand.cxRightWidth = 0; mBand.cyBottomHeight = 0; mBand.cyTopHeight = 0;\r\n\t\t\t\t\t//if (bIsPrimaryTaskbar) SendMessageW(hReBarWindow32, RB_GETBANDMARGINS, 0, &mBand);\r\n\t\t\t\t\t//if (TaskbarCenter_ShouldStartBeCentered(dwSetting))\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t//\trc.left -= mBand.cxLeftWidth;\r\n\t\t\t\t\t//}\r\n\t\t\t\t\t//else\r\n\t\t\t\t\t//{\r\n\t\t\t\t\t//\trc.left += mBand.cxLeftWidth;\r\n\t\t\t\t\t//}\r\n\r\n\t\t\t\t\tlong dwAdd = 0;\r\n\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdwAdd += (bIsTaskbarHorizontal ? (rcStart.right - rcStart.left) : (rcStart.bottom - rcStart.top));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbWasCalled = GetClientRect(hWnd, lpRect);\r\n\t\t\t\t\tlong res = 0;\r\n\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tres = ((mi.rcMonitor.right - mi.rcMonitor.left) - dwLength - dwAdd) / 2 - (rc.left - mi.rcMonitor.left);\r\n\t\t\t\t\t\tif (res < 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdwLength -= abs(res) * 2;\r\n\t\t\t\t\t\t\tres = ((mi.rcMonitor.right - mi.rcMonitor.left) - dwLength - dwAdd) / 2 - (rc.left - mi.rcMonitor.left);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tres += (rcStart.right - rcStart.left);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tres = ((mi.rcMonitor.bottom - mi.rcMonitor.top) - dwLength - dwAdd) / 2 - (rc.top - mi.rcMonitor.top);\r\n\t\t\t\t\t\tif (res < 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdwLength -= abs(res) * 2;\r\n\t\t\t\t\t\t\tres = ((mi.rcMonitor.bottom - mi.rcMonitor.top) - dwLength - dwAdd) / 2 - (rc.top - mi.rcMonitor.top);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tres += (rcStart.bottom - rcStart.top);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ((res + dwLength + 50 >= (bIsTaskbarHorizontal ? lpRect->right : lpRect->bottom)))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(dwSetting) || !bIsTaskbarHorizontal)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbWasLeftAlignedDueToSpaceConstraints = TRUE;\r\n\t\t\t\t\t\t\tres = 0;\r\n\t\t\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tres += (rcStart.right - rcStart.left);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting))\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tres += (rcStart.bottom - rcStart.top);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlpRect->left = res;\r\n\t\t\t\t\t\t//lpRect->right = MIN(MAX(lpRect->right, MIN_DIM), MAX(res + dwLength + 100, MIN_DIM));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlpRect->top = res;\r\n\t\t\t\t\t\t//lpRect->bottom = MIN(MAX(lpRect->bottom, MIN_DIM), MAX(res + dwLength + 100, MIN_DIM));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (TaskbarCenter_ShouldStartBeCentered(dwSetting) && hWndStart)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSetWindowPos(hWndStart, nullptr, (rc.left - mi.rcMonitor.left) + lpRect->left - (rcStart.right - rcStart.left), rcStart.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\r\n\t\t\t\t\t\t\tRECT rcTrayButton;\r\n\t\t\t\t\t\t\tGetClientRect(hWndStart, &rcTrayButton);\r\n\t\t\t\t\t\t\tDWORD dwDim = (rcTrayButton.right - rcTrayButton.left);\r\n\t\t\t\t\t\t\tHWND hTrayButton = nullptr;\r\n\t\t\t\t\t\t\tconst wchar_t* pCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\tif (/*!IsWindows11() &&*/ dwSearchboxTaskbarMode == 2) pCn = L\"TrayDummySearchControl\";\r\n\t\t\t\t\t\t\twhile ((hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, nullptr)))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayButton\" && !IsWindowVisible(hTrayButton)) continue;\r\n\t\t\t\t\t\t\t\tGetClientRect(hTrayButton, &rcTrayButton);\r\n\t\t\t\t\t\t\t\tMoveWindow(hTrayButton, (rc.left - mi.rcMonitor.left) + lpRect->left - (rcStart.right - rcStart.left) + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);\r\n\t\t\t\t\t\t\t\tif (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, nullptr, TRUE);\r\n\t\t\t\t\t\t\t\tdwDim += (rcTrayButton.right - rcTrayButton.left);\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayDummySearchControl\") {\r\n\t\t\t\t\t\t\t\t\tpCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\t\t\thTrayButton = nullptr;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSetWindowPos(hWndStart, nullptr, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\r\n\t\t\t\t\t\t\tRECT rcTrayButton;\r\n\t\t\t\t\t\t\tGetClientRect(hWndStart, &rcTrayButton);\r\n\t\t\t\t\t\t\tDWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);\r\n\t\t\t\t\t\t\tHWND hTrayButton = nullptr;\r\n\t\t\t\t\t\t\tconst wchar_t* pCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\tif (/*!IsWindows11() &&*/ dwSearchboxTaskbarMode == 2) pCn = L\"TrayDummySearchControl\";\r\n\t\t\t\t\t\t\twhile ((hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, nullptr)))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayButton\" && !IsWindowVisible(hTrayButton)) continue;\r\n\t\t\t\t\t\t\t\tGetClientRect(hTrayButton, &rcTrayButton);\r\n\t\t\t\t\t\t\t\tMoveWindow(hTrayButton, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top) + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);\r\n\t\t\t\t\t\t\t\tInvalidateRect(hTrayButton, nullptr, TRUE);\r\n\t\t\t\t\t\t\t\tdwDim += (rcTrayButton.bottom - rcTrayButton.top);\r\n\t\t\t\t\t\t\t\tif (pCn == L\"TrayDummySearchControl\") {\r\n\t\t\t\t\t\t\t\t\tpCn = L\"TrayButton\";\r\n\t\t\t\t\t\t\t\t\thTrayButton = nullptr;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, nullptr, TRUE);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (bIsPrimaryTaskbar && epw)\r\n\t\t{\r\n\t\t\tBOOL bWeatherAlignment = FALSE;\r\n\t\t\tif (bIsWeatherAvailable)\r\n\t\t\t{\r\n\t\t\t\tbWeatherAlignment = TRUE;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tbWeatherAlignment = FALSE;\r\n\t\t\t}\r\n\t\t\t/*if (bIsWeatherAvailable && bWasLeftAlignedDueToSpaceConstraints && dwWeatherToLeft == 2)\r\n\t\t\t{\r\n\t\t\t\tbWeatherAlignment = FALSE;\r\n\t\t\t}*/\r\n\t\t\tif (!atomPeopleBand) atomPeopleBand = RegisterWindowMessageW(L\"PeopleBand\");\r\n\t\t\tREBARBANDINFOW rbi;\r\n\t\t\tZeroMemory(&rbi, sizeof(REBARBANDINFOW));\r\n\t\t\trbi.cbSize = sizeof(REBARBANDINFOW);\r\n\t\t\trbi.fMask = RBBIM_CHILD;\r\n\t\t\tSendMessageW(hReBarWindow32, RB_GETBANDINFOW, 0, (LPARAM)&rbi);\r\n\t\t\tBOOL bIsFirstBandPeopleBand = (GetClassWord(rbi.hwndChild, GCW_ATOM) == atomPeopleBand);\r\n\t\t\tif (bWeatherAlignment ? !bIsFirstBandPeopleBand : bIsFirstBandPeopleBand)\r\n\t\t\t{\r\n\t\t\t\tint s = 0;\r\n\t\t\t\tint k = (int)SendMessageW(hReBarWindow32, RB_GETBANDCOUNT, 0, 0);\r\n\t\t\t\tif (bWeatherAlignment)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor (int i = k - 1; i >= 0; i--)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (s == 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tZeroMemory(&rbi, sizeof(REBARBANDINFOW));\r\n\t\t\t\t\t\t\trbi.cbSize = sizeof(REBARBANDINFOW);\r\n\t\t\t\t\t\t\trbi.fMask = RBBIM_CHILD;\r\n\t\t\t\t\t\t\tSendMessageW(hReBarWindow32, RB_GETBANDINFOW, i, (LPARAM)&rbi);\r\n\t\t\t\t\t\t\tif (rbi.hwndChild && (GetClassWord(rbi.hwndChild, GCW_ATOM) == atomPeopleBand))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\ts = 1;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (s == 1 && i >= 1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tSendMessageW(hReBarWindow32, RB_MOVEBAND, i, i - 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tfor (int i = 0; i < k - 1; ++i)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tSendMessageW(hReBarWindow32, RB_MOVEBAND, i, i + 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tint k = (int)SendMessageW(hReBarWindow32, RB_GETBANDCOUNT, 0, 0);\r\n\t\t\tfor (int i = 0; i < k - 1; ++i)\r\n\t\t\t{\r\n\t\t\t\tZeroMemory(&rbi, sizeof(REBARBANDINFOW));\r\n\t\t\t\trbi.cbSize = sizeof(REBARBANDINFOW);\r\n\t\t\t\trbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE;\r\n\t\t\t\tSendMessageW(hReBarWindow32, RB_GETBANDINFOW, i, (LPARAM)&rbi);\r\n\t\t\t\tif (rbi.hwndChild && (GetClassWord(rbi.hwndChild, GCW_ATOM) == atomPeopleBand))\r\n\t\t\t\t{\r\n\t\t\t\t\tRECT rcpp = { 0, 0, 0, 0 };\r\n\t\t\t\t\tGetClientRect(rbi.hwndChild, &rcpp);\r\n\t\t\t\t\tif (rcpp.right && rcpp.bottom)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (bIsTaskbarHorizontal)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (rcpp.right - rcpp.left != rbi.cxMinChild) SendMessageW(hReBarWindow32, RB_MINIMIZEBAND, i, 0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif (rcpp.bottom - rcpp.top != rbi.cxMinChild) SendMessageW(hReBarWindow32, RB_MINIMIZEBAND, i, 0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (bWasCalled) return bWasCalled;\r\n\treturn GetClientRect(hWnd, lpRect);\r\n}\r\n\r\nBOOL TaskbarCenter_SHWindowsPolicy(REFIID riid)\r\n{\r\n\tif (IsEqualIID(riid, POLID_TurnOffSPIAnimations) && (TaskbarCenter_ShouldCenter(dwOldTaskbarAl) || TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl)))\r\n\t{\r\n\t\tDWORD flOldProtect = 0;\r\n\t\tif (!bTaskbarCenterHasPatchedSHWindowsPolicy && *((unsigned char*)_ReturnAddress() + 7) == 0x0F)\r\n\t\t{\r\n\t\t\tif (*((unsigned char*)_ReturnAddress() + 8) == 0x85 && VirtualProtect((unsigned char*)_ReturnAddress() + 9, 1, PAGE_EXECUTE_READWRITE, &flOldProtect))\r\n\t\t\t{\r\n\t\t\t\t*((unsigned char*)_ReturnAddress() + 9) += 2;\r\n\t\t\t\tVirtualProtect((unsigned char*)_ReturnAddress() + 9, 1, flOldProtect, &flOldProtect);\r\n\t\t\t}\r\n\t\t\telse if (*((unsigned char*)_ReturnAddress() + 8) == 0x84 && VirtualProtect((unsigned char*)_ReturnAddress() + 13, 2, PAGE_EXECUTE_READWRITE, &flOldProtect))\r\n\t\t\t{\r\n\t\t\t\t*((unsigned char*)_ReturnAddress() + 13) = 0x90;\r\n\t\t\t\t*((unsigned char*)_ReturnAddress() + 14) = 0x90;\r\n\t\t\t\tVirtualProtect((unsigned char*)_ReturnAddress() + 13, 2, flOldProtect, &flOldProtect);\r\n\t\t\t}\r\n\t\t\tbTaskbarCenterHasPatchedSHWindowsPolicy = TRUE;\r\n\t\t}\r\n\t\treturn 1;\r\n\t}\r\n\treturn SHWindowsPolicy(riid);\r\n}\r\n\r\n} // extern \"C\"\r\n"
  },
  {
    "path": "ExplorerPatcher/TaskbarCenter.h",
    "content": "#pragma once\r\n\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n#include <oleacc.h>\r\n#include <tchar.h>\r\n#pragma comment(lib, \"Oleacc.lib\")\r\n#include <CommCtrl.h>\r\n#include <uxtheme.h>\r\n#include <valinet/hooking/iatpatch.h>\r\n#define MAX(a,b) ((a) > (b) ? (a) : (b))\r\n#define MIN(a,b) ((a) < (b) ? (a) : (b))\r\n#define MIN_DIM 600\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#ifdef __cplusplus\r\ninterface ITaskGroup;\r\ninterface ITaskItem;\r\ninterface ITaskBtnGroup;\r\n\r\nMIDL_INTERFACE(\"e587c396-8ac9-49b7-a16c-e2acfd140399\")\r\nITaskListSite : IUnknown\r\n{\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetGroupLocation(ITaskGroup*, ITaskItem*, int, RECT*) = 0;\r\n\tvirtual DWORD STDMETHODCALLTYPE GetStuckPlace() const = 0;\r\n\tvirtual void STDMETHODCALLTYPE SwitchToItem(ITaskItem*) = 0;\r\n\tvirtual void STDMETHODCALLTYPE CloseItem(ITaskItem*) = 0;\r\n\tvirtual void STDMETHODCALLTYPE OnContextMenu(POINT, HWND, bool, ITaskGroup*, ITaskItem*) = 0;\r\n\tvirtual void STDMETHODCALLTYPE SetHotItem(ITaskItem*) = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleMouseEnter(int) = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleMouseLeave(int) = 0;\r\n\tvirtual void STDMETHODCALLTYPE NotifyExtendedUIDismissed(int, ITaskItem*) = 0;\r\n\tvirtual void STDMETHODCALLTYPE DisableToolTip(int) = 0;\r\n\tvirtual int STDMETHODCALLTYPE GetIconId(ITaskGroup*, ITaskItem*) = 0;\r\n\tvirtual int STDMETHODCALLTYPE IsContextMenuActive() = 0;\r\n\tvirtual HWND STDMETHODCALLTYPE GetWindow() = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE ShowLivePreview(ITaskItem*, DWORD) = 0;\r\n\tvirtual int STDMETHODCALLTYPE IsLivePreviewActive() = 0;\r\n\tvirtual int STDMETHODCALLTYPE IsTaskTopLevelUI(ITaskItem*) = 0;\r\n\tvirtual int STDMETHODCALLTYPE IsTaskExtendedUI(ITaskBtnGroup*, ITaskItem*) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetHost(const GUID&, void**) = 0;\r\n};\r\n\r\nMIDL_INTERFACE(\"2be43f49-c23d-40d8-8092-2fb6577ee134\")\r\nITaskListWndSite : IUnknown\r\n{\r\n\tvirtual void STDMETHODCALLTYPE CheckSize(int) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetStuckPlace(DWORD*) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetTaskListUITheme(const WCHAR**) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetUserPreferences(DWORD*) = 0;\r\n\tvirtual int STDMETHODCALLTYPE HitTestForSizeableBorder(int, int) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE UnhideTray() = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE SetScrollInfo(int, const SCROLLINFO&) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE GetScrollInfo(int, SCROLLINFO*) = 0;\r\n\tvirtual HRESULT STDMETHODCALLTYPE HandleScroll(int, UINT, int) = 0;\r\n\tvirtual int STDMETHODCALLTYPE IsHorizontal() = 0;\r\n\t/*virtual int STDMETHODCALLTYPE IsFullHeightOfTray() = 0;\r\n\tvirtual void STDMETHODCALLTYPE UpdateTheme() = 0;\r\n\tvirtual SyncDisplayChangeFlags STDMETHODCALLTYPE SyncDisplayChange(SyncDisplayChangeFlags, CCoSimpleArray<UINT>&) = 0;\r\n\tvirtual void STDMETHODCALLTYPE ImmersiveShow() = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleImmersiveLauncherVisibilityChange(HMONITOR, bool) = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleSearchAppVisibilityChange(HMONITOR, bool) = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleTaskViewVisibilityChange(bool) = 0;\r\n\tvirtual bool STDMETHODCALLTYPE IsDesktopVisibleOnTrayMonitor() = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleJumpViewVisibilityChange(bool) = 0;\r\n\tvirtual void STDMETHODCALLTYPE HandleHoverUIVisibilityChange(bool) = 0;\r\n\tvirtual void STDMETHODCALLTYPE NotifyFeedsAboutTaskListUpdated() = 0;*/\r\n};\r\n\r\ninline BOOL TaskbarCenter_IsTaskbarHorizontal(HWND hWnd)\r\n{\r\n\tBOOL bRet = FALSE;\r\n\r\n\tvoid* pTaskListWnd = (void*)GetWindowLongPtrW(hWnd, 0);\r\n\tif (pTaskListWnd)\r\n\t{\r\n\t\t// Shift by sizeof(CImpWndProc)\r\n\t\tIUnknown* punkTaskListWnd = (IUnknown*)((PBYTE)pTaskListWnd + sizeof(void*) /*vtable*/ + sizeof(HWND) /*_hwnd*/);\r\n\r\n\t\tITaskListSite* pTaskListSite = nullptr;\r\n\t\tif (SUCCEEDED(punkTaskListWnd->QueryInterface(IID_PPV_ARGS(&pTaskListSite))))\r\n\t\t{\r\n\t\t\tITaskListWndSite* pHost = nullptr;\r\n\t\t\tif (SUCCEEDED(pTaskListSite->GetHost(IID_PPV_ARGS(&pHost))))\r\n\t\t\t{\r\n\t\t\t\tbRet = pHost->IsHorizontal() != 0;\r\n\t\t\t\tpHost->Release();\r\n\t\t\t}\r\n\t\t\tpTaskListSite->Release();\r\n\t\t}\r\n\t}\r\n\r\n\treturn bRet;\r\n}\r\n#endif\r\n\r\ninline BOOL TaskbarCenter_ShouldCenter(DWORD dwSetting)\r\n{\r\n\treturn (dwSetting & 0b001);\r\n}\r\n\r\ninline BOOL TaskbarCenter_ShouldStartBeCentered(DWORD dwSetting)\r\n{\r\n\treturn (dwSetting & 0b010);\r\n}\r\n\r\ninline BOOL TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(DWORD dwSetting)\r\n{\r\n\treturn (dwSetting & 0b100);\r\n}\r\n\r\nBOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect);\r\n\r\nBOOL TaskbarCenter_SHWindowsPolicy(REFIID riid);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/TwinUIPatches.cpp",
    "content": "﻿#include <Windows.h>\n#include <Shlwapi.h>\n#include <ShellScalingApi.h>\n#include <initguid.h>\n#include <knownfolders.h>\n\n#include <wrl/client.h>\n#include <wil/resource.h>\n#include <wil/result_macros.h>\n\n#include <valinet/utility/memmem.h>\n#include <wrl/wrappers/corewrappers.h>\n\n#include \"ArchiveMenu.h\"\n#include \"utility.h\"\n#include \"hooking.h\"\n#include \"symbols.h\"\n#include \"NativeString.h\"\n#include \"RefCountedObject.h\"\n#include \"SimpleArray.h\"\n\n// #define USE_REIMPLEMENTED_CLauncherTipContextMenu\n\nusing namespace Microsoft::WRL;\n\n\n#pragma region \"Types and utilities\"\n\nenum ContextMenuPaddingType\n{\n    CMPT_NONE = 0x0,\n    CMPT_TOP_PADDING = 0x1,\n    CMPT_BOTTOM_PADDING = 0x2,\n    CMPT_TOUCH_INPUT = 0x4,\n};\n\nDEFINE_ENUM_FLAG_OPERATORS(ContextMenuPaddingType);\n\nnamespace DPIToPPIHelpers\n{\nenum class ScaleType\n{\n    DPI,\n    PPI\n};\n\nenum class ScaleModifier\n{\n    None,\n    CorrectBadDPI\n};\n}\n\nstruct ContextMenuRenderingData\n{\n    CoTaskMemNativeString spszText;\n    DWORD uMenuFlags;\n    SHSTOCKICONID siid = SIID_MAX_ICONS;\n    HBITMAP hbmpItem;\n    HBITMAP hbmpChecked;\n    HBITMAP hbmpUnchecked;\n    ContextMenuPaddingType cmpt;\n    DPIToPPIHelpers::ScaleType scaletype;\n    UINT xDpi;\n    bool fUseDarkTheme;\n    bool fUseSystemPadding;\n    BOOL fForceAccelerators;\n    CSimplePointerArrayNewMem<ContextMenuRenderingData>* prgParentArray;\n\n#ifdef _DEBUG\nprivate:\n    void* operator new(size_t stAllocateBlock) = delete;\n\npublic:\n    void* operator new(size_t stAllocateBlock, const std::nothrow_t&)\n    {\n        return HeapAlloc(GetProcessHeap(), 0, stAllocateBlock);\n    }\n\n    void operator delete(void* pvMem)\n    {\n        operator delete(pvMem, std::nothrow);\n    }\n\n    void operator delete(void* pvMem, const std::nothrow_t&)\n    {\n        if (pvMem)\n        {\n            HeapFree(GetProcessHeap(), 0, pvMem);\n        }\n    }\n#endif\n};\n\nenum ImmersiveContextMenuOptions\n{\n    ICMO_NONE = 0x0,\n    ICMO_USEPPI = 0x1,\n    ICMO_OVERRIDECOMPATCHECK = 0x2,\n    ICMO_FORCEMOUSESTYLING = 0x4,\n    ICMO_USESYSTEMTHEME = 0x8,\n    ICMO_ICMBRUSHAPPLIED = 0x10,\n};\n\nDEFINE_ENUM_FLAG_OPERATORS(ImmersiveContextMenuOptions);\n\nDEFINE_GUID(SID_EdgeUi, 0x0D189B30, 0xF12B, 0x4B13, 0x94, 0xCF, 0x53, 0xCB, 0x0E, 0x0E, 0x24, 0x0D); // 0d189b30-f12b-4b13-94cf-53cb0e0e240d\n\ninterface IImmersiveApplication;\ninterface IEdgeUiInvocationProvider;\n\nenum EDGEUI_COMPONENT\n{\n    EUICMP_UNKNOWN = -1,\n    EUICMP_SWITCHER = 0,\n    EUICMP_CHARMSBAR,\n    EUICMP_APPBAR,\n    EUICMP_TASKBAR,\n    EUICMP_TITLEBAR,\n    EUICMP_TABLETMODEVIEWMANAGER,\n    EUICMP_ACTIONCENTER,\n    EUICMP_TOTALCOUNT,\n};\n\nenum DISMISSED_UI_FLAGS\n{\n    DUF_NONE = 0x0,\n    DUF_FORCEOBSERVATIONOFF = 0x1,\n};\n\nenum EDGEUI_TRAYSTUCKPLACE\n{\n    EUITSP_UNKNOWN = -1,\n    EUITSP_LEFT = 0,\n    EUITSP_TOP,\n    EUITSP_RIGHT,\n    EUITSP_BOTTOM,\n};\n\nMIDL_INTERFACE(\"6e6c3c52-5a5e-4b4b-a0f8-7fe12621a93e\")\nIEdgeUiManager : IUnknown\n{\n    virtual HRESULT STDMETHODCALLTYPE GetTargetApplicationFromPoint(POINT, int, IImmersiveApplication**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE DismissedUI(EDGEUI_COMPONENT, DISMISSED_UI_FLAGS) = 0;\n    virtual HRESULT STDMETHODCALLTYPE HandleEdgeGesturePrefChanged(HWND) = 0;\n    virtual HRESULT STDMETHODCALLTYPE DiscreteInvokeForApp(EDGEUI_COMPONENT, IImmersiveApplication*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE BeginInputObservation(EDGEUI_COMPONENT) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetRegionForCornerOrEdge(EDGEUI_COMPONENT, HRGN*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE NotifyTrayStuckPlaceChanged(EDGEUI_TRAYSTUCKPLACE) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetTrayStuckPlace(EDGEUI_TRAYSTUCKPLACE*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE NotifyTraySearchBoxVisibilityChanged(BOOL) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetTraySearchBoxVisibility(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE NotifyPearlRectChanged(RECT) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetPearlRect(RECT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE UpdateEdgeWindowZorder() = 0;\n    virtual HRESULT STDMETHODCALLTYPE ShowStandardSystemOverlays(IImmersiveApplication*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE OverrideInvocation(IEdgeUiInvocationProvider*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE NotifyAutohideImmuneWorkAreaMayHaveChanged(RECT) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetAutohideImmuneWorkArea(RECT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE TaskbarRaised() = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetTrayRect(RECT*) = 0;\n};\n\nenum IMMERSIVE_MONITOR_FILTER_FLAGS\n{\n    IMMERSIVE_MONITOR_FILTER_FLAGS_NONE = 0x0,\n    IMMERSIVE_MONITOR_FILTER_FLAGS_DISABLE_TRAY = 0x1,\n};\n\nDEFINE_ENUM_FLAG_OPERATORS(IMMERSIVE_MONITOR_FILTER_FLAGS);\n\nMIDL_INTERFACE(\"880b26f8-9197-43d0-8045-8702d0d72000\")\nIImmersiveMonitor : IUnknown\n{\n    virtual HRESULT STDMETHODCALLTYPE GetIdentity(DWORD*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE ConnectObject(IUnknown*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetHandle(HMONITOR*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsConnected(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsPrimary(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsImmersiveDisplayDevice(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetDisplayRect(RECT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetOrientation(DWORD*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetWorkArea(RECT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsEqual(IImmersiveMonitor*, BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsImmersiveCapable(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetEffectiveDpi(UINT*, UINT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetFilterFlags(IMMERSIVE_MONITOR_FILTER_FLAGS*) = 0;\n};\n\nDEFINE_GUID(SID_IImmersiveMonitorService, 0x47094E3A, 0x0CF2, 0x430F, 0x80, 0x6F, 0xCF, 0x9E, 0x4F, 0x0F, 0x12, 0xDD); // 47094e3a-0cf2-430f-806f-cf9e4f0f12dd\n\nenum IMMERSIVE_MONITOR_MOVE_DIRECTION\n{\n    IMMD_PREVIOUS,\n    IMMD_NEXT,\n};\n\ninterface IImmersiveMonitorFilter;\n\nMIDL_INTERFACE(\"4d4c1e64-e410-4faa-bafa-59ca069bfec2\")\nIImmersiveMonitorManager : IUnknown\n{\n    virtual HRESULT STDMETHODCALLTYPE GetCount(UINT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetConnectedCount(UINT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetAt(UINT, IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetFromHandle(HMONITOR, IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetFromIdentity(DWORD, IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetImmersiveProxyMonitor(IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE QueryService(HMONITOR, REFGUID, REFGUID, void**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE QueryServiceByIdentity(DWORD, REFGUID, REFGUID, void**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE QueryServiceFromWindow(HWND, REFGUID, REFGUID, void**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE QueryServiceFromPoint(const POINT*, REFGUID, REFGUID, void**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetNextImmersiveMonitor(IMMERSIVE_MONITOR_MOVE_DIRECTION, IImmersiveMonitor*, IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetMonitorArray(IObjectArray**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE SetFilter(IImmersiveMonitorFilter*) = 0;\n};\n\nDEFINE_GUID(SID_ImmersiveLauncher, 0x6F86E01C, 0xC649, 0x4D61, 0xBE, 0x23, 0xF1, 0x32, 0x2D, 0xDE, 0xCA, 0x9D); // 6f86e01c-c649-4d61-be23-f1322ddeca9d\n\nenum IMMERSIVELAUNCHERSHOWMETHOD\n{\n    ILSM_INVALID = 0,\n    ILSM_HSHELLTASKMAN = 1,\n    ILSM_IMMERSIVEBACKGROUND = 4,\n    ILSM_APPCLOSED = 6,\n    ILSM_STARTBUTTON = 11,\n    ILSM_RETAILDEMO_EDUCATIONAPP = 12,\n    ILSM_BACK = 13,\n    ILSM_SESSIONONUNLOCK = 14,\n};\n\nenum IMMERSIVELAUNCHERSHOWFLAGS\n{\n    ILSF_NONE = 0x0,\n    ILSF_IGNORE_SET_FOREGROUND_ERROR = 0x4,\n};\n\nDEFINE_ENUM_FLAG_OPERATORS(IMMERSIVELAUNCHERSHOWFLAGS);\n\nenum IMMERSIVELAUNCHERDISMISSMETHOD\n{\n    ILDM_INVALID = 0,\n    ILDM_HSHELLTASKMAN = 1,\n    ILDM_STARTCHARM = 2,\n    ILDM_BACKGESTURE = 3,\n    ILDM_ESCAPEKEY = 4,\n    ILDM_SHOWDESKTOP = 5,\n    ILDM_STARTTIP = 6,\n    ILDM_GENERIC_NONANIMATING = 7,\n    ILDM_SEARCH_OPENING = 8,\n    ILDM_DRAG = 9,\n};\n\nMIDL_INTERFACE(\"d8d60399-a0f1-f987-5551-321fd1b49864\")\nIImmersiveLauncher : IUnknown\n{\n    virtual HRESULT STDMETHODCALLTYPE ShowStartView(IMMERSIVELAUNCHERSHOWMETHOD, IMMERSIVELAUNCHERSHOWFLAGS) = 0;\n    virtual HRESULT STDMETHODCALLTYPE Dismiss(IMMERSIVELAUNCHERDISMISSMETHOD) = 0;\n    virtual HRESULT STDMETHODCALLTYPE DismissToLastDesktopApplication(IMMERSIVELAUNCHERDISMISSMETHOD) = 0;\n    virtual HRESULT STDMETHODCALLTYPE DismissSynchronouslyWithoutTransition() = 0;\n    virtual HRESULT STDMETHODCALLTYPE IsVisible(BOOL*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE OnStartButtonPressed(IMMERSIVELAUNCHERSHOWMETHOD, IMMERSIVELAUNCHERDISMISSMETHOD) = 0;\n    virtual HRESULT STDMETHODCALLTYPE SetForeground() = 0;\n    virtual HRESULT STDMETHODCALLTYPE ConnectToMonitor(IImmersiveMonitor*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetMonitor(IImmersiveMonitor**) = 0;\n    virtual HRESULT STDMETHODCALLTYPE OnFirstSignAnimationFinished() = 0;\n    virtual HRESULT STDMETHODCALLTYPE Prelaunch() = 0;\n};\n\nMIDL_INTERFACE(\"b8c1db5f-cbb3-48bc-afd9-ce6b880c79ed\")\nILauncherTipContextMenu : IUnknown\n{\n    virtual HRESULT STDMETHODCALLTYPE ShowLauncherTipContextMenu(POINT*) = 0;\n    virtual HRESULT STDMETHODCALLTYPE GetMenuItemsAsync(RECT, IUnknown**) = 0; // New in 11 21H2, no GUID change\n};\n\ninline BOOL IsBiDiLocale(LCID locale)\n{\n    int info;\n    int charsRead = GetLocaleInfoW(\n        locale,\n        LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER,\n        (LPWSTR)&info,\n        sizeof(info) / sizeof(WCHAR)\n    );\n    return charsRead > 0 ? info == 1 : false;\n}\n\nBOOL Mirror_IsThreadRTL()\n{\n    return IsBiDiLocale(GetThreadUILanguage());\n}\n\nenum ZBID : int;\nenum ACCENT_STATE : int;\n\nclass CSingleViewShellExperience;\n\nclass SingleViewShellExperiencePersonality;\n\nclass CSingleViewShellExperience\n{\npublic:\n    enum class Border\n    {\n        None = 0,\n        Left = 1,\n        Top = 2,\n        Right = 4,\n        Bottom = 8\n    };\n\n    HRESULT SetPosition(const RECT* rect);\n\n    Wrappers::HString _args;\n    Wrappers::HString _aumid;\n    Wrappers::HString _experience;\n    void* _viewWrapper;\n    ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> _propertySet;\n    int _viewState;\n    ABI::Windows::Foundation::Size _desiredSize;\n    BOOLEAN _fullScreen;\n    bool _isSessionIdle;\n    DWORD _pid;\n    ZBID _zbidDefault;\n    int _pendingViewAction;\n    int _pendingViewShowFlags;\n    int _navLevelOverrideHelper[2];\n    wistd::unique_ptr<SingleViewShellExperiencePersonality> m_personality;\n    // ...\n};\n\nclass SingleViewShellExperiencePersonality\n{\npublic:\n    virtual ~SingleViewShellExperiencePersonality() = 0;\n    virtual bool IsPersonality(void*) = 0;\n    virtual HRESULT Initialize(IServiceProvider*) = 0;\n    virtual HRESULT EnableSessionIdleNotifications(IServiceProvider*) = 0;\n    virtual HRESULT OnViewWrapperChanged() = 0;\n    virtual HRESULT ShowView() = 0;\n    virtual HRESULT HideView() = 0;\n    virtual HRESULT IsViewVisible(bool*) = 0;\n    virtual HRESULT SetWindowBand(ZBID) = 0;\n    virtual HRESULT BringToForeground() = 0;\n    virtual HRESULT BringToFocus() = 0;\n    virtual HRESULT ShowBorder(CSingleViewShellExperience::Border, ACCENT_STATE, DWORD, const RECT*) = 0;\n    virtual HRESULT SetPosition(const RECT*) = 0;\n};\n\nHRESULT CSingleViewShellExperience::SetPosition(const RECT* rect)\n{\n    RETURN_HR(m_personality->SetPosition(rect));\n}\n\nnamespace ExperienceManagerUtils\n{\n    void ScaleByDPI(const ABI::Windows::Foundation::Size* size, int dpi, int* outWidth, int* outHeight)\n    {\n        *outWidth = MulDiv((int)size->Width, dpi, 96);\n        *outHeight = MulDiv((int)size->Height, dpi, 96);\n    }\n}\n\n// Before using this, please make sure that the vtable is in the real module not a stub.\n#define REPLACE_VTABLE_ENTRY(vtable, index, name) \\\n    { \\\n        auto ppfn = (decltype(&name##Func))&vtable[index]; \\\n        if (*ppfn != name##Hook) \\\n        { \\\n            name##Func = *ppfn; \\\n            DWORD dwOldProtectLocal; \\\n            if (VirtualProtect(ppfn, sizeof(void*), PAGE_EXECUTE_READWRITE, &dwOldProtectLocal)) \\\n            { \\\n                *ppfn = name##Hook; \\\n                VirtualProtect(ppfn, sizeof(void*), dwOldProtectLocal, &dwOldProtectLocal); \\\n            } \\\n        } \\\n    }\n\n#pragma endregion\n\n\n#pragma region \"Stuff from dllmain\"\n\nextern \"C\"\n{\n\nextern HMODULE hModule;\nextern HWND archivehWnd;\nextern DWORD bOldTaskbar;\nextern DWORD bSkinMenus;\nextern DWORD bClockFlyoutOnWinC;\nextern DWORD bPropertiesInWinX;\nextern DWORD bNoMenuAccelerator;\nextern DWORD dwAltTabSettings;\nextern DWORD dwSnapAssistSettings;\nextern DWORD dwStartShowClassicMode;\nextern HANDLE hWin11AltTabInitialized;\n\ntypedef HRESULT(*ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t)(HMENU hmenu, HWND hWnd, POINT* pptOrigin, unsigned int icmoFlags, void* srgRenderingData);\nextern ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc;\ntypedef void(*ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenu_t)(HMENU hmenu, HWND hwnd);\nextern ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenu_t ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc;\ntypedef LRESULT(*CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc_t)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\nextern CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc_t CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc;\n\nBOOL VnPatchIAT_NonInline(HMODULE hMod, const char* libName, const char* funcName, uintptr_t hookAddr);\nPOINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust, BOOL bToRight);\nBOOL InvokeClockFlyout();\nvoid ReportSuccessfulAnimationPatching();\nBOOL IsCrashCounterEnabled();\n\n} // extern \"C\"\n\n#pragma endregion\n\n\n#pragma region \"twinui.pcshell.dll hooks\"\n\n#define LAUNCHERTIP_CLASS_NAME L\"LauncherTipWnd\"\n#define WINX_ADJUST_X 5\n#define WINX_ADJUST_Y 5\n\nclass DECLSPEC_UUID(\"51d1268c-d0a5-47cc-a514-547f346f45e8\")\nCLauncherTipContextMenu;\n\nenum LTCMITEMFLAGS\n{\n    LTCMIF_DEFAULT = 0x0,\n    LTCMIF_RUNAS = 0x1,\n    LTCMIF_SWITCHTODESKTOP = 0x2,\n    LTCMIF_INVOKEARGS = 0x4,\n    LTCMIF_SHOWDESKTOPCOMMAND = 0x8,\n    LTCMIF_MOBILITYCENTER = 0x10,\n    LTCMIF_SEARCHCOMMAND = 0x20,\n    LTCMIF_PRIMARY_CMD = 0x40,\n    LTCMIF_SECONDARY_CMD = 0x80,\n    LTCMIF_POWERSHELLCOMMAND = 0x100,\n    LTCMIF_SUPPRESSONCLOUD = 0x200,\n    LTCMIF_ACTIVITIESCOMMAND = 0x400,\n    LTCMIF_TERMINALCOMMAND = 0x800, // Cobalt\n};\n\nstruct LauncherTipMenuCommand\n{\n    LauncherTipMenuCommand();\n\n    bool fSeparator;\n    CoTaskMemNativeString spszCommandName;\n    CoTaskMemNativeString spszCommandPath;\n    CoTaskMemNativeString spszCommandTargetArguments;\n    CoTaskMemNativeString spszVerb;\n    DWORD ltcmif;\n};\n\nstruct LauncherTipShutdownMenuCommand\n{\n    DWORD choice;\n    CoTaskMemNativeString spszCommandName;\n};\n\nstatic HRESULT(*winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc)(void* _this, UINT uMsg, WPARAM wParam, LPARAM lParam) = nullptr;\nstatic HRESULT(*CLauncherTipContextMenu_ShowLauncherTipContextMenuFunc)(ILauncherTipContextMenu* _this, POINT* pptLocation) = nullptr;\nstatic void(*CLauncherTipContextMenu_ExecuteCommandFunc)(void* _this, ComPtr<CRefCountedObject<LauncherTipMenuCommand>> spCommand) = nullptr;\nstatic void(*CLauncherTipContextMenu_ExecuteShutdownCommandFunc)(void* _this, ComPtr<CRefCountedObject<LauncherTipShutdownMenuCommand>> spCommand, const RECT* prcDockTo) = nullptr;\n\nHWND hWinXWnd;\nHANDLE hIsWinXShown;\nHANDLE hWinXThread;\n\nHRESULT CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(ILauncherTipContextMenu* _this, POINT* pt);\n\nHRESULT (STDMETHODCALLTYPE *CLauncherTipContextMenu_CreateInstance_IClassFactory_Func)(\n    IClassFactory* This, IUnknown* pUnkOuter, REFIID riid, void** ppvObject);\nHRESULT STDMETHODCALLTYPE CLauncherTipContextMenu_CreateInstance_IClassFactory_Hook(\n    IClassFactory* This, IUnknown* pUnkOuter, REFIID riid, void** ppvObject)\n{\n#if defined(USE_REIMPLEMENTED_CLauncherTipContextMenu)\n    *ppvObject = nullptr;\n    ComPtr<CLauncherTipContextMenu> spLTCM;\n    HRESULT hr = MakeAndInitialize<CLauncherTipContextMenu>(&spLTCM);\n    if (SUCCEEDED(hr))\n    {\n        hr = spLTCM.CopyTo(riid, ppvObject);\n    }\n    return hr;\n#else\n    HRESULT hr = CLauncherTipContextMenu_CreateInstance_IClassFactory_Func(This, pUnkOuter, riid, ppvObject);\n    if (SUCCEEDED(hr))\n    {\n        ILauncherTipContextMenu* pLTCM = nullptr;\n        if (SUCCEEDED(((IUnknown*)*ppvObject)->QueryInterface(IID_PPV_ARGS(&pLTCM)))) // Don't influence hr: if this fails, black screen\n        {\n            void** vtable = *(void***)pLTCM;\n            REPLACE_VTABLE_ENTRY(vtable, 3, CLauncherTipContextMenu_ShowLauncherTipContextMenu);\n            pLTCM->Release();\n        }\n    }\n    return hr;\n#endif\n}\n\nextern \"C\" LRESULT CALLBACK CLauncherTipContextMenu_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\n{\n    LRESULT result;\n\n    if (hWnd == archivehWnd && !ArchiveMenuWndProc(\n        hWnd, uMsg, wParam, lParam,\n        ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc,\n        ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc\n    ))\n    {\n        return 0;\n    }\n\n    if (uMsg == WM_NCCREATE)\n    {\n        CREATESTRUCT* pCs = (CREATESTRUCT*)lParam;\n        if (pCs->lpCreateParams)\n        {\n            *((HWND*)((char*)pCs->lpCreateParams + 0x78)) = hWnd;\n            SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pCs->lpCreateParams);\n            result = DefWindowProcW(hWnd, uMsg, wParam, lParam);\n        }\n        else\n        {\n            result = DefWindowProcW(hWnd, uMsg, wParam, lParam);\n            //result = 0;\n        }\n    }\n    else\n    {\n        void* _this = (void*)GetWindowLongPtrW(hWnd, GWLP_USERDATA);\n        if ((uMsg == WM_DRAWITEM || uMsg == WM_MEASUREITEM) &&\n            CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc &&\n            CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc(hWnd, uMsg, wParam, lParam))\n        {\n            result = 0;\n        }\n        else\n        {\n            result = DefWindowProcW(hWnd, uMsg, wParam, lParam);\n        }\n        if (_this)\n        {\n            if (uMsg == WM_NCDESTROY)\n            {\n                SetWindowLongPtrW(hWnd, GWLP_USERDATA, 0);\n                *((HWND*)((char*)_this + 0x78)) = nullptr;\n            }\n        }\n    }\n    return result;\n}\n\nstruct ShowLauncherTipContextMenuParameters\n{\n    ILauncherTipContextMenu* _this;\n    POINT point;\n    ComPtr<IUnknown> spOperation;\n    bool bShouldCenterWinXHorizontally;\n\n    ShowLauncherTipContextMenuParameters(ILauncherTipContextMenu* _this, POINT point, IUnknown* pOperation, bool bShouldCenterWinXHorizontally)\n        : _this(_this)\n        , point(point)\n        , spOperation(pOperation)\n        , bShouldCenterWinXHorizontally(bShouldCenterWinXHorizontally)\n    {\n    }\n};\n\nDWORD ShowLauncherTipContextMenu(LPVOID lpParams)\n{\n    ShowLauncherTipContextMenuParameters* params = (ShowLauncherTipContextMenuParameters*)lpParams;\n\n    // Adjust this based on info from: CLauncherTipContextMenu::SetSite\n    // and CLauncherTipContextMenu::CLauncherTipContextMenu\n    // 22000.739: 0xe8\n    // 22000.778: 0xf0\n    // What has happened, between .739 and .778 is that the launcher tip\n    // context menu object now implements a new interface, ILauncherTipContextMenuMigration;\n    // thus, members have shifted 8 bytes (one 64-bit value which will hold the\n    // address of the vtable for this intf at runtime) to the right;\n    // all this intf seems to do, as of now, is to remove some \"obsolete\" links\n    // from the menu (check out \"CLauncherTipContextMenu::RunMigrationTasks\"); it\n    // seems you can disable this by setting a DWORD \"WinXMigrationLevel\" = 1 in\n    // HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\n    int offset_in_class = 0;\n    if (global_rovi.dwBuildNumber >= 22621 || (global_rovi.dwBuildNumber == 22000 && global_ubr >= 778))\n    {\n        offset_in_class = 8;\n    }\n\n    char* pClassBase = (char*)params->_this - 0x58;\n\n    struct\n    {\n        // ComPtr<IShellTaskScheduler> _spScheduler;\n        // ComPtr<IImmersiveWindowMessageService> _spWindowMessageService;\n        // ComPtr<IImmersiveLauncher> _spLauncher;\n        // ComPtr<IImmersiveSystemMode> _spSystemMode;\n        // ComPtr<IImmersiveMonitorManager> _spMonitorManager;\n        CCoSimpleArray<ComPtr<CRefCountedObject<LauncherTipMenuCommand>>> _rgCommands;\n        CCoSimpleArray<ComPtr<CRefCountedObject<LauncherTipShutdownMenuCommand>>> _rgShutdownCommands;\n        RTL_CRITICAL_SECTION _csEnumeration;\n        RTL_CRITICAL_SECTION _csContextMenuDisplay;\n        bool _fAreCommandsPopulated;\n        bool _fCommandPopulationInProgress;\n        bool _fTasksCancelled;\n        HMENU _hMenu;\n        HMENU _hMenuShutdown;\n        bool _fIsRTL;\n        bool _fReplacePrimaryCommandsWithSecondary;\n    }& fields = *(std::remove_reference_t<decltype(fields)>*)(pClassBase + offset_in_class + 0xA8); // Begin at _rgCommands\n\n    static ATOM windowRegistrationAtom = 0;\n    if (windowRegistrationAtom == 0)\n    {\n        WNDCLASS wc = {\n            .style = CS_DBLCLKS,\n            .lpfnWndProc = CLauncherTipContextMenu_WndProc,\n            .hInstance = GetModuleHandleW(nullptr),\n            .hCursor = LoadCursorW(nullptr, IDC_ARROW),\n            .hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH),\n            .lpszClassName = LAUNCHERTIP_CLASS_NAME\n        };\n        ATOM atom = RegisterClassW(&wc);\n        if (atom)\n            windowRegistrationAtom = atom;\n    }\n\n    hWinXWnd = CreateWindowInBand(\n        0,\n        MAKEINTATOM(windowRegistrationAtom),\n        nullptr,\n        WS_POPUP,\n        0, 0, 0, 0,\n        nullptr, nullptr,\n        GetModuleHandle(nullptr),\n        pClassBase,\n        7 // ZBID_IMMERSIVE_EDGY\n    );\n    // DO NOT USE ShowWindow here; it breaks the window order\n    // and renders the desktop toggle unusable; but leave\n    // SetForegroundWindow as is so that the menu gets dismissed\n    // when the user clicks outside it\n    //\n    // ShowWindow(hWinXWnd, SW_SHOW);\n    SetForegroundWindow(hWinXWnd);\n\n    while (!fields._fAreCommandsPopulated)\n    {\n        Sleep(1);\n    }\n    auto finalize = wil::scope_exit([&]() -> void\n    {\n        SendMessageW(hWinXWnd, WM_CLOSE, 0, 0);\n        hIsWinXShown = nullptr;\n        delete params;\n    });\n    if (!fields._rgCommands.GetSize())\n    {\n        return 0;\n    }\n\n    // Check if Windows Terminal is installed\n    bool fHasTerminal = false;\n    {\n        ComPtr<IShellItem> spLocalAppDataItem;\n        HRESULT hr = SHGetKnownFolderItem(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, IID_PPV_ARGS(&spLocalAppDataItem));\n        if (SUCCEEDED(hr))\n        {\n            ComPtr<IShellItem> spTerminalFolderItem;\n            if (SUCCEEDED(SHCreateItemFromRelativeName(spLocalAppDataItem.Get(), L\"Microsoft\\\\WindowsApps\\\\wt.exe\", nullptr, IID_PPV_ARGS(&spTerminalFolderItem))))\n            {\n                fHasTerminal = true;\n            }\n        }\n    }\n\n    // Do not use the _hMenu built by CLauncherTipContextMenu, it contains *both* PowerShell and Terminal entries.\n    // When Windows Terminal gets installed/uninstalled, the menu entries should be shown/hidden accordingly without\n    // restarting Explorer. Win32 does not support hiding menu entries. If we DeleteMenuW the Terminal entries in the\n    // provided menu due to Terminal not being installed, it will not reappear after Terminal is reinstalled.\n    //\n    // We build the menu ourselves to avoid those issues.\n    //\n    // Implementation based on:\n    // - CLauncherTipContextMenu::_EnumerateAndBuildMenu()\n    // - CLauncherTipContextMenu::_EnumerateAndBuildShutdownMenu()\n\n    wil::unique_hmenu hMenu(CreatePopupMenu());\n    wil::unique_hmenu hMenuShutdown;\n    HRESULT hr = ResultFromWin32Bool(hMenu.is_valid());\n    if (SUCCEEDED(hr))\n    {\n        size_t iPlusOne = fields._rgCommands.GetSize();\n        if (iPlusOne)\n        {\n            for (; iPlusOne; --iPlusOne)\n            {\n                size_t iContextMenuCommand = iPlusOne - 1;\n                ComPtr<CRefCountedObject<LauncherTipMenuCommand>>& spCommand = fields._rgCommands[iContextMenuCommand];\n\n                if ((spCommand->ltcmif & LTCMIF_POWERSHELLCOMMAND) != 0 && fHasTerminal\n                    || (spCommand->ltcmif & LTCMIF_TERMINALCOMMAND) != 0 && !fHasTerminal)\n                {\n                    // Skip if this is PowerShell and Windows Terminal is installed\n                    // or if this is Windows Terminal and Windows Terminal is not installed\n                    continue;\n                }\n\n                AppendMenuW(hMenu.get(), spCommand->fSeparator ? MF_SEPARATOR : 0, iContextMenuCommand + 1, spCommand->spszCommandName.Get());\n                if (iContextMenuCommand == 1)\n                {\n                    hMenuShutdown.reset(CreatePopupMenu());\n                    hr = ResultFromWin32Bool(hMenuShutdown != nullptr);\n                    if (SUCCEEDED(hr))\n                    {\n                        CoTaskMemNativeString spShutdownName;\n                        hr = spShutdownName.Initialize(GetModuleHandleW(L\"twinui.pcshell.dll\"), 10930); // Sh&ut down or sign out\n                        if (SUCCEEDED(hr))\n                        {\n                            AppendMenuW(hMenu.get(), MF_POPUP, (DWORD)(UINT_PTR)hMenuShutdown.get(), spShutdownName.Get());\n                        }\n\n                        UINT_PTR uIDNewItem = 4000;\n                        for (size_t i = 0; i < fields._rgShutdownCommands.GetSize(); ++i)\n                        {\n                            ComPtr<CRefCountedObject<LauncherTipShutdownMenuCommand>>& spShutdownCommand = fields._rgShutdownCommands[i];\n                            AppendMenuW(hMenuShutdown.get(), MF_STRING, uIDNewItem++, spShutdownCommand->spszCommandName.Get());\n                        }\n                    }\n                }\n            }\n            /*if (ShouldPowershellReplaceCmd())\n            {\n                LauncherTipContextMenuTelemetry::LauncherTipContextMenuDefaultConsole(!_fReplacePrimaryCommandsWithSecondary);\n            }*/\n        }\n    }\n\n    TCHAR buffer[260];\n    LoadStringW(GetModuleHandleW(L\"ExplorerFrame.dll\"), 50222, buffer + (bNoMenuAccelerator ? 0 : 1), 260);\n    if (!bNoMenuAccelerator)\n    {\n        buffer[0] = L'&';\n    }\n    wchar_t* p = wcschr(buffer, L'(');\n    if (p)\n    {\n        p--;\n        if (*p == L' ')\n        {\n            *p = 0;\n        }\n        else\n        {\n            p++;\n            *p = 0;\n        }\n    }\n\n    BOOL bCreatedMenu = FALSE;\n    MENUITEMINFOW menuInfo;\n    ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n    menuInfo.cbSize = sizeof(MENUITEMINFOW);\n    menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA;\n    menuInfo.wID = 3999;\n    menuInfo.dwItemData = 0;\n    menuInfo.fType = MFT_STRING;\n    menuInfo.dwTypeData = buffer;\n    menuInfo.cch = (UINT)wcslen(buffer);\n    if (bPropertiesInWinX)\n    {\n        InsertMenuItemW(\n            hMenu.get(),\n            GetMenuItemCount(hMenu.get()) - 1,\n            TRUE,\n            &menuInfo\n        );\n        bCreatedMenu = TRUE;\n    }\n\n    CSimplePointerArrayNewMem<ContextMenuRenderingData> srgRenderingData;\n    if (bSkinMenus && ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)\n    {\n        ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\n            hMenu.get(),\n            hWinXWnd,\n            &params->point,\n            ICMO_FORCEMOUSESTYLING | ICMO_USESYSTEMTHEME,\n            &srgRenderingData\n        );\n    }\n\n    BOOL res = TrackPopupMenu(\n        hMenu.get(),\n        TPM_RETURNCMD | TPM_RIGHTBUTTON | (params->bShouldCenterWinXHorizontally ? TPM_CENTERALIGN : 0),\n        params->point.x,\n        params->point.y,\n        0,\n        hWinXWnd,\n        nullptr\n    );\n\n    if (bSkinMenus && ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n    {\n        ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(hMenu.get(), hWinXWnd);\n    }\n\n    if (bCreatedMenu)\n    {\n        RemoveMenu(hMenu.get(), 3999, MF_BYCOMMAND);\n    }\n\n    if (res > 0)\n    {\n        if (bCreatedMenu && res == 3999)\n        {\n            LaunchPropertiesGUI(hModule);\n        }\n        else if (res >= 4000)\n        {\n            if (CLauncherTipContextMenu_ExecuteShutdownCommandFunc)\n            {\n                RECT rcAnchor;\n                rcAnchor.left   = params->point.x;\n                rcAnchor.top    = params->point.y - 1;\n                rcAnchor.right  = rcAnchor.left + 1;\n                rcAnchor.bottom = rcAnchor.top  + 1;\n                CLauncherTipContextMenu_ExecuteShutdownCommandFunc(pClassBase, fields._rgShutdownCommands[res - 4000], &rcAnchor);\n            }\n        }\n        else\n        {\n            if (CLauncherTipContextMenu_ExecuteCommandFunc)\n            {\n                CLauncherTipContextMenu_ExecuteCommandFunc(pClassBase, fields._rgCommands[res - 1]);\n            }\n        }\n    }\n\n    return 0;\n}\n\nHRESULT CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(ILauncherTipContextMenu* _this, POINT* pt)\n{\n    HRESULT hr = S_OK;\n\n    if (hWinXThread)\n    {\n        WaitForSingleObject(hWinXThread, INFINITE);\n        CloseHandle(hWinXThread);\n        hWinXThread = nullptr;\n    }\n\n    if (!hIsWinXShown)\n    {\n        bool bShouldCenterWinXHorizontally = false;\n        POINT point;\n        if (pt)\n        {\n            point = *pt;\n            BOOL bBottom, bRight;\n            POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight, FALSE, FALSE);\n            POINT posCursor;\n            GetCursorPos(&posCursor);\n            RECT rcHitZone;\n            rcHitZone.left = pt->x - 5;\n            rcHitZone.right = pt->x + 5;\n            rcHitZone.top = pt->y - 5;\n            rcHitZone.bottom = pt->y + 5;\n            //printf(\"%d %d = %d %d %d %d\\n\", posCursor.x, posCursor.y, rcHitZone.left, rcHitZone.right, rcHitZone.top, rcHitZone.bottom);\n            if (bBottom && IsThemeActive() && PtInRect(&rcHitZone, posCursor) && GetClassWord(WindowFromPoint(point), GCW_ATOM) == RegisterWindowMessageW(L\"Start\"))\n            {\n                HMONITOR hMonitor = MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY);\n                MONITORINFO mi;\n                mi.cbSize = sizeof(MONITORINFO);\n                GetMonitorInfoW(hMonitor, &mi);\n                HWND hWndUnder = WindowFromPoint(*pt);\n                TCHAR wszClassName[100];\n                ZeroMemory(wszClassName, 100);\n                GetClassNameW(hWndUnder, wszClassName, 100);\n                if (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\"))\n                {\n                    hWndUnder = FindWindowExW(hWndUnder, nullptr, L\"Start\", nullptr);\n                }\n                RECT rcUnder;\n                GetWindowRect(hWndUnder, &rcUnder);\n                if (mi.rcMonitor.left != rcUnder.left)\n                {\n                    bShouldCenterWinXHorizontally = true;\n                    point.x = rcUnder.left + (rcUnder.right - rcUnder.left) / 2;\n                    point.y = rcUnder.top;\n                }\n                else\n                {\n                    UINT dpiX, dpiY;\n                    GetDpiForMonitor(hMonitor, MDT_DEFAULT, &dpiX, &dpiY);\n                    double dx = dpiX / 96.0, dy = dpiY / 96.0;\n                    BOOL xo = FALSE, yo = FALSE;\n                    if ((int)(point.x - WINX_ADJUST_X * dx) < mi.rcMonitor.left)\n                    {\n                        xo = TRUE;\n                    }\n                    if ((int)(point.y + WINX_ADJUST_Y * dy) > mi.rcMonitor.bottom)\n                    {\n                        yo = TRUE;\n                    }\n                    POINT ptCursor;\n                    GetCursorPos(&ptCursor);\n                    if (xo)\n                    {\n                        ptCursor.x += (int)((WINX_ADJUST_X * 2) * dx);\n                    }\n                    else\n                    {\n                        point.x -= (int)(WINX_ADJUST_X * dx);\n                    }\n                    if (yo)\n                    {\n                        ptCursor.y -= (int)((WINX_ADJUST_Y * 2) * dy);\n                    }\n                    else\n                    {\n                        point.y += (int)(WINX_ADJUST_Y * dy);\n                    }\n                    SetCursorPos(ptCursor.x, ptCursor.y);\n                }\n            }\n        }\n        else\n        {\n            point = GetDefaultWinXPosition(FALSE, nullptr, nullptr, TRUE, FALSE);\n        }\n\n        RECT rc = {};\n        ComPtr<IUnknown> spOperation;\n        hr = _this->GetMenuItemsAsync(rc, &spOperation);\n        if (SUCCEEDED(hr))\n        {\n            ShowLauncherTipContextMenuParameters* params = new(std::nothrow) ShowLauncherTipContextMenuParameters(_this, point, spOperation.Get(), bShouldCenterWinXHorizontally);\n            hIsWinXShown = CreateThread(nullptr, 0, ShowLauncherTipContextMenu, params, 0, nullptr);\n            hWinXThread = hIsWinXShown;\n        }\n    }\n\n    if (SUCCEEDED(hr) && CLauncherTipContextMenu_ShowLauncherTipContextMenuFunc)\n    {\n        hr = CLauncherTipContextMenu_ShowLauncherTipContextMenuFunc(_this, pt);\n    }\n\n    return hr;\n}\n\nextern \"C\" void ToggleLauncherTipContextMenu()\n{\n    if (hIsWinXShown)\n    {\n        SendMessageW(hWinXWnd, WM_CLOSE, 0, 0);\n        return;\n    }\n\n    HWND hWnd = FindWindowExW(nullptr, nullptr, L\"Shell_TrayWnd\", nullptr);\n    if (!hWnd)\n        return;\n\n    hWnd = FindWindowExW(hWnd, nullptr, L\"Start\", nullptr);\n    if (!hWnd)\n        return;\n\n    POINT pt = GetDefaultWinXPosition(FALSE, nullptr, nullptr, TRUE, FALSE);\n    // Finally implemented a variation of\n    // https://github.com/valinet/ExplorerPatcher/issues/3\n    // inspired by how the real Start button activates this menu\n    // (CPearl::_GetLauncherTipContextMenu)\n    // This also works when auto hide taskbar is on (#63)\n    ComPtr<IServiceProvider> pImmersiveShell;\n    if (SUCCEEDED(CoCreateInstance(CLSID_ImmersiveShell, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pImmersiveShell))))\n    {\n        ComPtr<IImmersiveMonitorManager> pMonitorService;\n        if (SUCCEEDED(pImmersiveShell->QueryService(SID_IImmersiveMonitorService, IID_PPV_ARGS(&pMonitorService))))\n        {\n            ComPtr<ILauncherTipContextMenu> pMenu;\n            if (SUCCEEDED(pMonitorService->QueryServiceFromWindow(hWnd, __uuidof(ILauncherTipContextMenu), IID_PPV_ARGS(&pMenu))))\n            {\n                pMenu->ShowLauncherTipContextMenu(&pt);\n            }\n        }\n    }\n}\n\nLSTATUS twinuipcshell_RegGetValueW(\n    HKEY    hkey,\n    LPCWSTR lpSubKey,\n    LPCWSTR lpValue,\n    DWORD   dwFlags,\n    LPDWORD pdwType,\n    PVOID   pvData,\n    LPDWORD pcbData\n)\n{\n    LSTATUS lRes = RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n\n    if (!lstrcmpW(lpValue, L\"AltTabSettings\"))\n    {\n        if (lRes == ERROR_SUCCESS && *(DWORD*)pvData)\n        {\n            if (*(DWORD*)pvData == 3)\n            {\n                *(DWORD*)pvData = 0;\n            }\n            else\n            {\n                *(DWORD*)pvData = 1;\n            }\n        }\n\n        if (!bOldTaskbar && hWin11AltTabInitialized)\n        {\n            SetEvent(hWin11AltTabInitialized);\n            CloseHandle(hWin11AltTabInitialized);\n            hWin11AltTabInitialized = nullptr;\n        }\n\n        lRes = ERROR_SUCCESS;\n    }\n\n    return lRes;\n}\n\nHRESULT winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHook(void* _this, UINT uMsg, WPARAM wParam, LPARAM lParam)\n{\n    if (!bClockFlyoutOnWinC)\n    {\n        if (winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc)\n        {\n            return winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc(_this, uMsg, wParam, lParam);\n        }\n        return S_OK;\n    }\n    if (uMsg == 0x2C2 && wParam == 107)\n    {\n        InvokeClockFlyout();\n    }\n    return S_OK;\n}\n\n#pragma endregion\n\n\n#pragma region \"Enable old Alt+Tab\"\n\nINT64(*twinui_pcshell_IsUndockedAssetAvailableFunc)(INT a1, INT64 a2, INT64 a3, const char* a4);\nINT64 twinui_pcshell_IsUndockedAssetAvailableHook(INT a1, INT64 a2, INT64 a3, const char* a4)\n{\n    // if IsAltTab and AltTabSettings == Windows 10 or sws (Precision Touchpad gesture)\n    if (a1 == 1 && (dwAltTabSettings == 3 || dwAltTabSettings == 2))\n    {\n        return 0;\n    }\n    // if IsSnapAssist and SnapAssistSettings == Windows 10\n    else if (a1 == 4 && dwSnapAssistSettings == 3 && !IsWindows11Version22H2OrHigher())\n    {\n        return 0;\n    }\n    // else, show Windows 11 style basically\n    else\n    {\n        if (twinui_pcshell_IsUndockedAssetAvailableFunc)\n            return twinui_pcshell_IsUndockedAssetAvailableFunc(a1, a2, a3, a4);\n        return 1;\n    }\n}\n\nINT64(*twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc)(INT64 _this, unsigned int a2, INT64 a3, INT64 a4, INT64* a5);\nINT64(*twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc)(INT64 _this, unsigned int a2, INT64 a3, INT64 a4, INT64* a5);\nINT64 twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook(INT64 _this, unsigned int a2, INT64 a3, INT64 a4, INT64* a5)\n{\n    if (!twinui_pcshell_IsUndockedAssetAvailableHook(a2, 0, 0, nullptr))\n        return twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc(_this, a2, a3, a4, a5);\n    return twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc(_this, a2, a3, a4, a5);\n}\n\n#pragma endregion\n\n\n#pragma region \"Fixes related to the removal of STTest feature flag (22621.2134+)\"\n\nHRESULT(*twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc)(IInspectable* _this, HMONITOR hMonitor, float* outHeight);\nHRESULT twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorHook(IInspectable* _this, HMONITOR hMonitor, float* outHeight)\n{\n    if (bOldTaskbar)\n    {\n        MONITORINFO mi;\n        mi.cbSize = sizeof(MONITORINFO);\n        GetMonitorInfoW(hMonitor, &mi);\n        *outHeight = (float)(mi.rcMonitor.bottom - mi.rcWork.bottom);\n        return S_OK;\n    }\n    return twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc(_this, hMonitor, outHeight);\n}\n\nstatic struct\n{\n    int coroInstance_rcOut; // 22621.1992: 0x10\n    int coroInstance_pHardwareConfirmatorHost; // 22621.1992: 0xFD\n    int hardwareConfirmatorHost_bIsInLockScreen; // 22621.1992: 0xEC\n} g_Moment2PatchOffsets;\n\n#if defined(_M_X64)\ninline PBYTE GetTargetOfJzBeforeMe(PBYTE anchor)\n{\n    // Check big jz\n    if (*(anchor - 6) == 0x0F && *(anchor - 5) == 0x84)\n        return anchor + *(int*)(anchor - 4);\n    // Check small jz\n    if (*(anchor - 2) == 0x74)\n        return anchor + *(char*)(anchor - 1);\n    return nullptr;\n}\n#endif\n\n// CActionCenterExperienceManager::GetViewPosition() patcher\nBOOL Moment2PatchActionCenter(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n#if defined(_M_X64)\n    // Step 1:\n    // Scan within the DLL for `*a2 = mi.rcMonitor`.\n    // ```0F 10 45 ?? F3 0F 7F ?? 80 ?? ?? ?? 00 00 00 // movups - movdqu - cmp```\n    // 22621.1992: 7E2F0\n    // 22621.2283: 140D5\n    PBYTE rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x45\\x00\\xF3\\x0F\\x7F\\x00\\x80\\x00\\x00\\x00\\x00\\x00\\x00\", \"xxx?xxx?x???xxx\");\n    if (!rcMonitorAssignment) return FALSE;\n    printf(\"[AC] rcMonitorAssignment = %llX\\n\", rcMonitorAssignment - (PBYTE)hTwinuiPcshell);\n\n    // 22621.1992 has a different compiled code structure than 22621.2283 therefore we have to use a different approach:\n    // Short circuiting the `if (26008830 is enabled)`.\n    // 22621.1992: 7E313\n    if (!IsWindows11Version22H2Build2134OrHigher()) // We're on 1413-1992\n    {\n#if USE_MOMENT_3_FIXES_ON_MOMENT_2\n        PBYTE featureCheckJz = rcMonitorAssignment + 35;\n        if (*featureCheckJz != 0x0F && *(featureCheckJz + 1) != 0x84) return FALSE;\n\n        DWORD dwOldProtect = 0;\n        PBYTE jzAddr = featureCheckJz + 6 + *(DWORD*)(featureCheckJz + 2);\n        if (!VirtualProtect(featureCheckJz, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n        featureCheckJz[0] = 0xE9;\n        *(DWORD*)(featureCheckJz + 1) = (DWORD)(jzAddr - featureCheckJz - 5);\n        VirtualProtect(featureCheckJz, 5, dwOldProtect, &dwOldProtect);\n        goto done;\n#else\n        return FALSE;\n#endif\n    }\n\n    // Step 2:\n    // Copy `*a2 = mi.rcMonitor` into right after the first jz starting from step 1.\n    // Find within couple bytes from step 1:\n    // ```48 8D // lea```\n    // Then offset the first ?? so that it points to mi.rcWork which is 16 bytes after mi.rcMonitor.\n    // 22621.2283: 140E6\n    PBYTE blockBegin = (PBYTE)FindPattern(rcMonitorAssignment + 1, 32, \"\\x48\\x8D\", \"xx\");\n    if (!blockBegin) return FALSE;\n    printf(\"[AC] blockBegin = %llX\\n\", blockBegin - (PBYTE)hTwinuiPcshell);\n\n    // Step 3:\n    // Exit the block by writing a long jmp into the address referenced by the jz right before step 3, into right after\n    // the 8 bytes `rcMonitor = mi.rcWork` we've written.\n    PBYTE blockEnd = GetTargetOfJzBeforeMe(blockBegin);\n    if (!blockEnd) return FALSE;\n    printf(\"[AC] blockEnd = %llX\\n\", blockEnd - (PBYTE)hTwinuiPcshell);\n\n    // Execution\n    DWORD dwOldProtect = 0;\n    if (!VirtualProtect(blockBegin, 8 /**a2 = mi.rcWork*/ + 5 /*jmp*/, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n\n    // Step 2\n    memcpy(blockBegin, rcMonitorAssignment, 8);\n    blockBegin[3] += offsetof(MONITORINFO, rcWork) - offsetof(MONITORINFO, rcMonitor);\n\n    // Step 3\n    PBYTE jmpToEnd = blockBegin + 8;\n    jmpToEnd[0] = 0xE9;\n    *(DWORD*)(jmpToEnd + 1) = (DWORD)(blockEnd - jmpToEnd - 5);\n\n    VirtualProtect(blockBegin, 8 + 5, dwOldProtect, &dwOldProtect);\n    goto done;\n\ndone:\n    printf(\"[AC] Patched!\\n\");\n    return TRUE;\n#else\n    return FALSE;\n#endif\n}\n\n// CControlCenterExperienceManager::PositionView() patcher\nBOOL Moment2PatchControlCenter(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n#if defined(_M_X64)\n    // Step 1:\n    // Scan within the DLL for `rcMonitor = mi.rcMonitor`.\n    // ```0F 10 44 24 ?? F3 0F 7F 44 24 ?? 80 // movups - movdqu - cmp```\n    // 22621.1992: 4B35B\n    // 22621.2283: 65C5C\n    PBYTE rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x44\\x24\\x00\\xF3\\x0F\\x7F\\x44\\x24\\x00\\x80\", \"xxxx?xxxxx?x\");\n    if (!rcMonitorAssignment) return FALSE;\n    printf(\"[CC] rcMonitorAssignment = %llX\\n\", rcMonitorAssignment - (PBYTE)hTwinuiPcshell);\n\n    // Step 2:\n    // Scan within the function for the 10 bytes long `rcMonitor = mi.rcWork`.\n    // This pattern applies to both ControlCenter and ToastCenter.\n    // ```0F 10 45 ?? F3 0F 7F 44 24 ?? 48 // movups - movdqu - test```\n    // 22621.1992: 4B3FD and 4B418 (The second one is compiled out in later builds)\n    // 22621.2283: 65CE6\n    PBYTE rcWorkAssignment = (PBYTE)FindPattern(rcMonitorAssignment + 1, 256, \"\\x0F\\x10\\x45\\x00\\xF3\\x0F\\x7F\\x44\\x24\\x00\\x48\", \"xxx?xxxxx?x\");\n    if (!rcWorkAssignment) return FALSE;\n    printf(\"[CC] rcWorkAssignment = %llX\\n\", rcWorkAssignment - (PBYTE)hTwinuiPcshell);\n\n    // Step 3:\n    // Copy the `rcMonitor = mi.rcWork` into right after the first jz starting from step 1.\n    // Find within couple bytes from step 1:\n    // ```48 8D // lea```\n    // 22621.1992: 4B373\n    // 22621.2283: 65C74\n    PBYTE blockBegin = (PBYTE)FindPattern(rcMonitorAssignment + 1, 32, \"\\x48\\x8D\", \"xx\");\n    if (!blockBegin) return FALSE;\n    printf(\"[CC] blockBegin = %llX\\n\", blockBegin - (PBYTE)hTwinuiPcshell);\n\n    // Step 4:\n    // Exit the block by writing a long jmp into the address referenced by the jz right before step 3, into right after\n    // the 10 bytes `rcMonitor = mi.rcWork` we've written.\n    PBYTE blockEnd = GetTargetOfJzBeforeMe(blockBegin);\n    if (!blockEnd) return FALSE;\n    printf(\"[CC] blockEnd = %llX\\n\", blockEnd - (PBYTE)hTwinuiPcshell);\n\n    // Execution\n    DWORD dwOldProtect = 0;\n    if (!VirtualProtect(blockBegin, 10 /*rcMonitor = mi.rcWork*/ + 5 /*jmp*/, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n\n    // Step 2\n    memcpy(blockBegin, rcWorkAssignment, 10);\n\n    // Step 3\n    PBYTE jmpToEnd = blockBegin + 10;\n    jmpToEnd[0] = 0xE9;\n    *(DWORD*)(jmpToEnd + 1) = (DWORD)(blockEnd - jmpToEnd - 5);\n\n    VirtualProtect(blockBegin, 10 + 5, dwOldProtect, &dwOldProtect);\n\n    printf(\"[CC] Patched!\\n\");\n    return TRUE;\n#else\n    return FALSE;\n#endif\n}\n\n// CToastCenterExperienceManager::PositionView() patcher\nBOOL Moment2PatchToastCenter(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n#if defined(_M_X64)\n    // Step 1:\n    // Scan within the DLL for `rcMonitor = mi.rcMonitor`.\n    //\n    // Pattern 1:\n    // Will have a match if CToastCenterExperienceManager::ShouldShowWithinWorkArea() is present.\n    // ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 48 8B CF // movups - movdqu - mov```\n    // 22621.1992: 40CE8\n    // 22621.2283: 501DB\n    //\n    // Pattern 2:\n    // Will have a match if CToastCenterExperienceManager::ShouldShowWithinWorkArea() is inlined.\n    // ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 44 38 // movups - movdqu - cmp```\n    // 25951.1000: 36B2C4\n    //\n    // Pattern 3:\n    // Same as pattern 1, but different length of the movdqu instruction.\n    // ```0F 10 45 ?? ?? 0F 7F 45 ?? 48 8B CF // movups - movdqu - mov```\n    // 22621.3066: 3DC340\n    //\n    // Pattern 4:\n    // Same as pattern 2, but different length of the movdqu instruction.\n    // ```0F 10 45 ?? ?? 0F 7F 45 ?? 44 38 // movups - movdqu - cmp```\n    // No matches yet, just in case.\n    int assignmentSize = 10;\n    PBYTE rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x45\\x00\\x00\\x0F\\x7F\\x44\\x24\\x00\\x48\\x8B\\xCF\", \"xxx??xxxx?xxx\");\n    if (!rcMonitorAssignment)\n    {\n        rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x45\\x00\\x00\\x0F\\x7F\\x44\\x24\\x00\\x44\\x38\", \"xxx??xxxx?xx\");\n        if (!rcMonitorAssignment)\n        {\n            assignmentSize = 9;\n            rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x45\\x00\\x00\\x0F\\x7F\\x45\\x00\\x48\\x8B\\xCF\", \"xxx??xxx?xxx\");\n            if (!rcMonitorAssignment)\n            {\n                rcMonitorAssignment = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x45\\x00\\x00\\x0F\\x7F\\x45\\x00\\x44\\x38\", \"xxx??xxx?xx\");\n                if (!rcMonitorAssignment) return FALSE;\n            }\n        }\n    }\n    printf(\"[TC] rcMonitorAssignment = %llX\\n\", rcMonitorAssignment - (PBYTE)hTwinuiPcshell);\n\n    // Step 2:\n    // Copy the `rcMonitor = mi.rcMonitor` into right after the first jz starting from step 1.\n    // Find within couple bytes from step 1:\n    // ```48 8D // lea```\n    // Then offset the first ?? so that it points to mi.rcWork which is 16 bytes after mi.rcMonitor.\n    // 22621.1992: 40D02\n    // 22621.2283: 501F5\n    PBYTE blockBegin = (PBYTE)FindPattern(rcMonitorAssignment + 1, 32, \"\\x48\\x8D\", \"xx\");\n    if (!blockBegin) return FALSE;\n    printf(\"[TC] blockBegin = %llX\\n\", blockBegin - (PBYTE)hTwinuiPcshell);\n\n    // Step 3:\n    // Exit the block by writing a long jmp into the address referenced by the jz right before step 3, into right after\n    // the <assignmentSize> bytes `rcMonitor = mi.rcWork` we've written.\n    //\n    // Note: We are skipping EdgeUI calls here.\n    PBYTE blockEnd = GetTargetOfJzBeforeMe(blockBegin);\n    if (!blockEnd) return FALSE;\n    printf(\"[TC] blockEnd = %llX\\n\", blockEnd - (PBYTE)hTwinuiPcshell);\n\n    // Execution\n    DWORD dwOldProtect = 0;\n    if (!VirtualProtect(blockBegin, assignmentSize /*rcMonitor = mi.rcWork*/ + 5 /*jmp*/, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n\n    // Step 2\n    memcpy(blockBegin, rcMonitorAssignment, assignmentSize);\n    blockBegin[3] += offsetof(MONITORINFO, rcWork) - offsetof(MONITORINFO, rcMonitor);\n\n    // Step 3\n    PBYTE jmpToEnd = blockBegin + assignmentSize;\n    jmpToEnd[0] = 0xE9;\n    *(DWORD*)(jmpToEnd + 1) = (DWORD)(blockEnd - jmpToEnd - 5);\n\n    VirtualProtect(blockBegin, assignmentSize + 5, dwOldProtect, &dwOldProtect);\n\n    printf(\"[TC] Patched!\\n\");\n    return TRUE;\n#else\n    return FALSE;\n#endif\n}\n\n// TaskViewFrame::RuntimeClassInitialize() patcher\nBOOL Moment2PatchTaskView(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n#if defined(_M_X64)\n    /***\n    If we're using the old taskbar, it'll be stuck in an infinite loading since it's waiting for the new one to respond.\n    Let's safely skip those by NOPing the `TaskViewFrame::UpdateWorkAreaAsync()` and `WaitForCompletion()` calls, and\n    turning off the COM object cleanup.\n\n    Step 1:\n    Scan within the DLL to find the beginning, which is the preparation of the 1st call.\n    It should be 4C 8B or 4D 8B (mov r8, ...).\n    For the patterns, they're +1 from the result since it can be either of those.\n\n    Pattern 1:\n    ```8B ?? 48 8D 55 ??    48 8B ?? E8 ?? ?? ?? ?? 48 8B 08 E8```\n    22621.1992: 7463C\n    22621.2134: 3B29C\n\n    Pattern 2:\n    ```8B ?? 48 8D 54 24 ?? 48 8B ?? E8 ?? ?? ?? ?? 48 8B 08 E8```\n    22621.2283: 24A1D2\n\n    Step 2:\n    In place of the 1st call's call op (E8), overwrite it with a code to set the value of the com_ptr passed into the\n    2nd argument (rdx) to 0. This is to skip the cleanup that happens right after the 2nd call.\n    ```48 C7 02 00 00 00 00 mov qword ptr [rdx], 0```\n    Start from -13 of the byte after 2nd call's end.\n    22621.1992: 74646\n    22621.2134: 3B2A6\n    22621.2283: 24A1DD\n\n    Step 3:\n    NOP the rest of the 2nd call.\n\n    Summary:\n    ```\n       48 8B ?? 48 8D 55 ??    48 8B ?? E8 ?? ?? ?? ?? 48 8B 08 E8 ?? ?? ?? ?? // Pattern 1\n       48 8B ?? 48 8D 54 24 ?? 48 8B ?? E8 ?? ?? ?? ?? 48 8B 08 E8 ?? ?? ?? ?? // Pattern 2\n       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^\n       1st: TaskViewFrame::UpdateWorkAreaAsync()       2nd: WaitForCompletion()\n       48 8B ?? 48 8D 54 24 ?? 48 8B ?? 48 C7 02 00 00 00 00 90 90 90 90 90 90 // Result according to Pattern 2\n       -------------------------------- xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx\n       We need rdx                      Step 2               Step 3\n    ```\n\n    Notes:\n    - In 22621.1992 and 22621.2134, `~AsyncOperationCompletedHandler()` is inlined, while it is not in 22621.2283. We\n      can see `unconditional_release_ref()` calls right in `RuntimeClassInitialize()` of 1992 and 2134.\n    - In 22621.2134, there is `33 FF xor edi, edi` before the jz for the inlined cleanup. The value of edi is used in\n      two more cleanup calls after our area of interest (those covered by twoCallsLength), therefore we can't just NOP\n      everything. And I think detecting such things is too much work.\n    ***/\n\n    int twoCallsLength = 1 + 18 + 4; // 4C/4D + pattern length + 4 bytes for the 2nd call's call address\n    PBYTE firstCallPrep = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x8B\\x00\\x48\\x8D\\x55\\x00\\x48\\x8B\\x00\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\x08\\xE8\", \"x?xxx?xx?x????xxxx\");\n    if (!firstCallPrep)\n    {\n        twoCallsLength += 1; // Add 1 to the pattern length\n        firstCallPrep = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x8B\\x00\\x48\\x8D\\x54\\x24\\x00\\x48\\x8B\\x00\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\x08\\xE8\", \"x?xxxx?xx?x????xxxx\");\n        if (!firstCallPrep) return FALSE;\n    }\n    firstCallPrep -= 1; // Point to the 4C/4D\n    printf(\"[TV] firstCallPrep = %llX\\n\", firstCallPrep - (PBYTE)hTwinuiPcshell);\n\n    PBYTE firstCallCall = firstCallPrep + twoCallsLength - 13;\n    printf(\"[TV] firstCallCall = %llX\\n\", firstCallCall - (PBYTE)hTwinuiPcshell);\n\n    PBYTE nopBegin = firstCallCall + 7;\n\n    // Execution\n    DWORD dwOldProtect = 0;\n    if (!VirtualProtect(firstCallPrep, twoCallsLength, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n    const BYTE step2Payload[] = { 0x48, 0xC7, 0x02, 0x00, 0x00, 0x00, 0x00 };\n    memcpy(firstCallCall, step2Payload, sizeof(step2Payload));\n    memset(nopBegin, 0x90, twoCallsLength - (nopBegin - firstCallPrep));\n    VirtualProtect(firstCallPrep, twoCallsLength, dwOldProtect, &dwOldProtect);\n\n    printf(\"[TV] Patched!\\n\");\n    return TRUE;\n#else\n    return FALSE;\n#endif\n}\n\n// Reimplementation of HardwareConfirmatorHost::GetDisplayRect()\nvoid WINAPI HardwareConfirmatorShellcode(PBYTE pCoroInstance)\n{\n    PBYTE pHardwareConfirmatorHost = *(PBYTE*)(pCoroInstance + g_Moment2PatchOffsets.coroInstance_pHardwareConfirmatorHost);\n\n    RECT rc;\n    HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTOPRIMARY);\n\n    ComPtr<IServiceProvider> pImmersiveShell;\n    if (SUCCEEDED(CoCreateInstance(CLSID_ImmersiveShell, nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&pImmersiveShell))))\n    {\n        ComPtr<IImmersiveMonitorManager> pMonitorService;\n        if (SUCCEEDED(pImmersiveShell->QueryService(SID_IImmersiveMonitorService, IID_PPV_ARGS(&pMonitorService))))\n        {\n            ComPtr<IEdgeUiManager> pEdgeUiManager;\n            if (SUCCEEDED(pMonitorService->QueryService(hMonitor, SID_EdgeUi, IID_PPV_ARGS(&pEdgeUiManager))))\n            {\n                if (*(pHardwareConfirmatorHost + g_Moment2PatchOffsets.hardwareConfirmatorHost_bIsInLockScreen))\n                {\n                    // Lock screen\n                    MONITORINFO mi;\n                    mi.cbSize = sizeof(MONITORINFO);\n                    if (GetMonitorInfoW(hMonitor, &mi))\n                        rc = mi.rcMonitor;\n                }\n                else\n                {\n                    // Desktop\n                    LOG_IF_FAILED(pEdgeUiManager->GetAutohideImmuneWorkArea(&rc));\n                }\n\n                ABI::Windows::Foundation::Rect* out = (ABI::Windows::Foundation::Rect*)(pCoroInstance + g_Moment2PatchOffsets.coroInstance_rcOut);\n                out->X = (float)rc.left;\n                out->Y = (float)rc.top;\n                out->Width = (float)(rc.right - rc.left);\n                out->Height = (float)(rc.bottom - rc.top);\n            }\n        }\n    }\n}\n\n// [HardwareConfirmatorHost::GetDisplayRectAsync$_ResumeCoro$1() patcher\nBOOL Moment2PatchHardwareConfirmator(HMODULE hHardwareConfirmator, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n#if defined(_M_X64)\n    // Find required offsets\n\n    // pHardwareConfirmatorHost and bIsInLockScreen:\n    // Find in GetDisplayRectAsync$_ResumeCoro$1, inside `case 4:`\n    //\n    // 48 8B 83 ED 00 00 00     mov     rax, [rbx+0EDh]\n    //          ^^^^^^^^^^^ pHardwareConfirmatorHost\n    // 8A 80 EC 00 00 00        mov     al, [rax+0ECh]\n    //       ^^^^^^^^^^^ bIsInLockScreen\n    //\n    // if ( ADJ(this)->pHardwareConfirmatorHost->bIsInLockScreen )\n    // if ( *(_BYTE *)(*(_QWORD *)(this + 237) + 236i64) ) // 22621.2283\n    //                                    ^ HCH  ^ bIsInLockScreen\n    //\n    // 22621.2134: 1D55D\n    PBYTE match1 = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x48\\x8B\\x83\\x00\\x00\\x00\\x00\\x8A\\x80\", \"xxx????xx\");\n    printf(\"[HC] match1 = %llX\\n\", match1 - (PBYTE)hHardwareConfirmator);\n    if (!match1) return FALSE;\n    g_Moment2PatchOffsets.coroInstance_pHardwareConfirmatorHost = *(int*)(match1 + 3);\n    g_Moment2PatchOffsets.hardwareConfirmatorHost_bIsInLockScreen = *(int*)(match1 + 9);\n\n    // coroInstance_rcOut:\n    // Also in GetDisplayRectAsync$_ResumeCoro$1, through `case 4:`\n    // We also use this as the point to jump to, which is the code to set the rect and finish the coroutine.\n    //\n    // v27 = *(_OWORD *)(this + 16);\n    // *(_OWORD *)(this - 16) = v27;\n    // if ( winrt_suspend_handler ) ...\n    //\n    // 0F 10 43 10              movups  xmm0, xmmword ptr [rbx+10h]\n    //          ^^ coroInstance_rcOut\n    // 0F 11 84 24 D0 00 00 00  movups  [rsp+158h+var_88], xmm0\n    //\n    // 22621.2134: 1D624\n    PBYTE match2 = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x0F\\x10\\x43\\x00\\x0F\\x11\\x84\\x24\", \"xxx?xxxx\");\n    printf(\"[HC] match2 = %llX\\n\", match2 - (PBYTE)hHardwareConfirmator);\n    if (!match2) return FALSE;\n    g_Moment2PatchOffsets.coroInstance_rcOut = *(match2 + 3);\n\n    // Find where to put the shellcode\n    // We'll overwrite from this position:\n    //\n    // *(_OWORD *)(this + 32) = 0i64;\n    // *(_QWORD *)(this + 48) = MonitorFromRect((LPCRECT)(this + 32), 1u);\n    //\n    // 22621.2134: 1D21E\n    PBYTE writeAt = (PBYTE)FindPattern(pSearchBegin, cbSearch, \"\\x48\\x8D\\x4B\\x00\\x0F\", \"xxx?x\");\n    if (!writeAt) return FALSE;\n    printf(\"[HC] writeAt = %llX\\n\", writeAt - (PBYTE)hHardwareConfirmator);\n\n    // In 22621.2134+, after our jump location there is a cleanup for something we skipped. NOP them.\n    // From match2, bytes +17 until +37, which is 21 bytes to be NOP'd.\n    // 22621.2134: 1D635-1D64A\n    PBYTE cleanupBegin = nullptr, cleanupEnd = nullptr;\n    if (IsWindows11Version22H2Build2134OrHigher())\n    {\n        cleanupBegin = match2 + 17;\n        cleanupEnd = match2 + 38; // Exclusive\n        printf(\"[HC] cleanup = %llX-%llX\\n\", cleanupBegin - (PBYTE)hHardwareConfirmator, cleanupEnd - (PBYTE)hHardwareConfirmator);\n        if (*cleanupBegin != 0x49 || *cleanupEnd != 0x90 /*Already NOP here*/) return FALSE;\n    }\n\n    // Craft the shellcode\n    BYTE shellcode[] = {\n        // lea rcx, [rbx+0] ; rbx is the `this` which is the instance of the coro, we pass it to our function\n        0x48, 0x8D, 0x0B,\n        // mov rax, 1111111111111111h ; placeholder for the address of HardwareConfirmatorShellcode\n        0x48, 0xB8, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,\n        // call rax\n        0xFF, 0xD0\n    };\n\n    uintptr_t pattern = 0x1111111111111111;\n    *(uintptr_t*)(memmem(shellcode, sizeof(shellcode), &pattern, sizeof(uintptr_t))) = (uintptr_t)HardwareConfirmatorShellcode;\n\n    // Execution\n    DWORD dwOldProtect = 0;\n    SIZE_T totalSize = sizeof(shellcode) + 5;\n    if (!VirtualProtect(writeAt, totalSize, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n    memcpy(writeAt, shellcode, sizeof(shellcode));\n    PBYTE jmpLoc = writeAt + sizeof(shellcode);\n    jmpLoc[0] = 0xE9;\n    *(DWORD*)(jmpLoc + 1) = (DWORD)(match2 - jmpLoc - 5);\n    VirtualProtect(writeAt, totalSize, dwOldProtect, &dwOldProtect);\n\n    if (cleanupBegin)\n    {\n        dwOldProtect = 0;\n        if (!VirtualProtect(cleanupBegin, cleanupEnd - cleanupBegin, PAGE_EXECUTE_READWRITE, &dwOldProtect)) return FALSE;\n        memset(cleanupBegin, 0x90, cleanupEnd - cleanupBegin);\n        VirtualProtect(cleanupBegin, cleanupEnd - cleanupBegin, dwOldProtect, &dwOldProtect);\n    }\n\n    printf(\"[HC] Patched!\\n\");\n    return TRUE;\n#else\n    return FALSE;\n#endif\n}\n\n#pragma endregion\n\n\n#pragma region \"Fix broken Windows 10 start menu positioning issues caused by 44656322\"\n\n// Reverts 44656322's effects on the start menu\nextern \"C\" HRESULT CStartExperienceManager_GetMonitorInformationHook(void* _this, CSingleViewShellExperience* experience, RECT* rcOutWorkArea, EDGEUI_TRAYSTUCKPLACE* outTrayStuckPlace, bool* bOutRtl, HMONITOR* hOutMonitor)\n{\n    *rcOutWorkArea = {};\n    *outTrayStuckPlace = EUITSP_BOTTOM;\n    *bOutRtl = false;\n    if (hOutMonitor)\n        *hOutMonitor = nullptr;\n\n    ComPtr<IServiceProvider> spImmersiveShellServiceProvider;\n    RETURN_IF_FAILED(CoCreateInstance(CLSID_ImmersiveShell, nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&spImmersiveShellServiceProvider)));\n\n    ComPtr<IImmersiveLauncher> spImmersiveLauncher;\n    RETURN_IF_FAILED(spImmersiveShellServiceProvider->QueryService(SID_ImmersiveLauncher, IID_PPV_ARGS(&spImmersiveLauncher)));\n\n    ComPtr<IImmersiveMonitor> spImmersiveMonitor;\n    HRESULT hr = spImmersiveLauncher->GetMonitor(&spImmersiveMonitor);\n    if (FAILED(hr))\n        return hr;\n\n    HMONITOR hMonitor = nullptr;\n    if (hOutMonitor)\n        hr = spImmersiveMonitor->GetHandle(&hMonitor);\n\n    if (FAILED(hr))\n        return hr;\n\n    ComPtr<IEdgeUiManager> spEdgeUiManager;\n    hr = IUnknown_QueryService(spImmersiveMonitor.Get(), SID_EdgeUi, IID_PPV_ARGS(&spEdgeUiManager));\n    if (FAILED(hr))\n        return hr;\n\n    EDGEUI_TRAYSTUCKPLACE trayStuckPlace;\n    RETURN_IF_FAILED(spEdgeUiManager->GetTrayStuckPlace(&trayStuckPlace));\n\n    HWND hwndTray = FindWindowW(L\"Shell_TrayWnd\", nullptr);\n\n    RECT rcWork;\n    if (hwndTray && GetPropW(hwndTray, L\"IsAutoHideEnabled\"))\n    {\n        RETURN_IF_FAILED(spEdgeUiManager->GetAutohideImmuneWorkArea(&rcWork));\n    }\n    else\n    {\n        RETURN_IF_FAILED(spImmersiveMonitor->GetWorkArea(&rcWork));\n    }\n\n    *rcOutWorkArea = rcWork;\n    *outTrayStuckPlace = trayStuckPlace;\n    *bOutRtl = Mirror_IsThreadRTL() != FALSE;\n    if (hOutMonitor)\n        *hOutMonitor = hMonitor;\n\n    return S_OK;\n}\n\n#pragma endregion\n\n\n#pragma region \"Fix Windows 10 start menu animation on 22000.65+\"\n\nstatic struct\n{\n    int startExperienceManager_IStartExperienceManager;\n    int startExperienceManager_SingleViewShellExperienceEventHandler;\n    int startExperienceManager_singleViewShellExperience;\n    int startExperienceManager_openingAnimation;\n    int startExperienceManager_closingAnimation;\n    int startExperienceManager_bTransitioningToCortana;\n} g_SMAnimationPatchOffsets;\n\n// Names taken from Windows.UI.Xaml.pdb, only defining the used ones\nenum DWMTRANSITION_TARGET\n{\n    DWMTARGET_LAUNCHERFLYOUTTOLEFT = 0x4D,\n    DWMTARGET_LAUNCHERFLYOUTTORIGHT = 0x4E,\n    DWMTARGET_LAUNCHERFLYOUTTOTOP = 0x4F,\n    DWMTARGET_LAUNCHERFLYOUTTOBOTTOM = 0x50,\n    DWMTARGET_LAUNCHERFLYOUT = 0x51,\n    DWMTARGET_LAUNCHERFULLSCREEN = 0x52,\n};\n\nDEFINE_ENUM_FLAG_OPERATORS(DWMTRANSITION_TARGET);\n\nextern HRESULT CStartExperienceManager_GetMonitorInformationHook(void* _this, CSingleViewShellExperience* experience, RECT* rcOutWorkArea, EDGEUI_TRAYSTUCKPLACE* outTrayStuckPlace, bool* bOutRtl, HMONITOR* hOutMonitor);\nHRESULT(*CStartExperienceManager_GetMonitorInformationFunc)(void* _this, void* experience, RECT* rcOutWorkArea, EDGEUI_TRAYSTUCKPLACE* outTrayStuckPlace, bool* bOutRtl, HMONITOR* hOutMonitor);\nHRESULT(*CExperienceManagerAnimationHelper_BeginFunc)(void* _this, void* pViewWrapper, DWMTRANSITION_TARGET target, const RECT* prcBeginSource, const RECT* prcBeginDestination, const RECT* prcEndSource, const RECT* prcEndDestination, const RECT* prcClip);\nHRESULT(*CExperienceManagerAnimationHelper_EndFunc)(void* _this);\n\nHRESULT(*CStartExperienceManager_OnViewUncloakingFunc)(void* eventHandler, CSingleViewShellExperience* pSender);\nHRESULT CStartExperienceManager_OnViewUncloakingHook(void* eventHandler, CSingleViewShellExperience* pSender)\n{\n    PBYTE _this = (PBYTE)eventHandler - g_SMAnimationPatchOffsets.startExperienceManager_SingleViewShellExperienceEventHandler;\n\n    RECT rcWorkArea;\n    EDGEUI_TRAYSTUCKPLACE tsp;\n    bool bRtl;\n    if (SUCCEEDED(CStartExperienceManager_GetMonitorInformationHook(_this, pSender, &rcWorkArea, &tsp, &bRtl, NULL)) && dwStartShowClassicMode)\n    {\n        DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;\n        if (pSender->_fullScreen)\n            target = DWMTARGET_LAUNCHERFULLSCREEN;\n        else if (tsp == EUITSP_LEFT)\n            target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;\n        else if (tsp == EUITSP_TOP)\n            target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;\n        else if (tsp == EUITSP_RIGHT)\n            target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;\n        else if (tsp == EUITSP_BOTTOM)\n            target = DWMTARGET_LAUNCHERFLYOUTTOTOP;\n\n        CExperienceManagerAnimationHelper_BeginFunc(\n            _this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation,\n            pSender->_viewWrapper,\n            (DWMTRANSITION_TARGET)(target | 0x200000), nullptr, nullptr, nullptr, nullptr, &rcWorkArea);\n    }\n\n    if (global_rovi.dwBuildNumber >= 25169)\n    {\n        // Patch hardcoded EUITSP_BOTTOM present in the original function with the correct value\n#if defined(_M_X64)\n        static int* rgpConstants[2];\n        if (!rgpConstants[0] && rgpConstants[0] != (int*)-1)\n        {\n            // 03 00 00 00\n            PBYTE match = (PBYTE)FindPattern(CStartExperienceManager_OnViewUncloakingFunc, 80, \"\\x03\\x00\\x00\\x00\", \"xxxx\");\n            rgpConstants[0] = match ? (int*)match : (int*)-1;\n            if (match)\n            {\n                match = (PBYTE)FindPattern(match + 4, 40, \"\\x03\\x00\\x00\\x00\", \"xxxx\");\n                rgpConstants[1] = match ? (int*)match : (int*)-1;\n            }\n        }\n        for (int i = 0; i < ARRAYSIZE(rgpConstants); i++)\n        {\n            if (rgpConstants[i] && rgpConstants[i] != (int*)-1)\n            {\n                DWORD dwOldProtect;\n                if (VirtualProtect(rgpConstants[i], 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n                {\n                    *rgpConstants[i] = tsp;\n                    VirtualProtect(rgpConstants[i], 4, dwOldProtect, &dwOldProtect);\n                }\n            }\n        }\n#elif defined(_M_ARM64)\n        static DWORD* rgpInsnMovs[2];\n        if (!rgpInsnMovs[0] && rgpInsnMovs[0] != (DWORD*)-1)\n        {\n            // 68 00 80 52\n            PBYTE match = (PBYTE)FindPattern(CStartExperienceManager_OnViewUncloakingFunc, 160, \"\\x68\\x00\\x80\\x52\", \"xxxx\");\n            rgpInsnMovs[0] = match ? (DWORD*)match : (DWORD*)-1;\n            if (match)\n            {\n                match = (PBYTE)FindPattern(match + 4, 40, \"\\x68\\x00\\x80\\x52\", \"xxxx\");\n                rgpInsnMovs[1] = match ? (DWORD*)match : (DWORD*)-1;\n            }\n        }\n        for (int i = 0; i < ARRAYSIZE(rgpInsnMovs); i++)\n        {\n            if (rgpInsnMovs[i] && rgpInsnMovs[i] != (DWORD*)-1)\n            {\n                DWORD dwOldProtect;\n                if (VirtualProtect(rgpInsnMovs[i], 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n                {\n                    if (ARM64_IsInRange(tsp, 16))\n                    {\n                        DWORD insn = *rgpInsnMovs[i];\n                        int imm16Mask = ((1 << 16) - 1) << 5;\n                        insn &= ~imm16Mask; // clear imm16\n                        insn |= (tsp << 5) & imm16Mask; // set imm16\n                        *rgpInsnMovs[i] = insn;\n                    }\n                    VirtualProtect(rgpInsnMovs[i], 4, dwOldProtect, &dwOldProtect);\n                }\n            }\n        }\n#endif\n    }\n\n    return CStartExperienceManager_OnViewUncloakingFunc(eventHandler, pSender);\n}\n\nHRESULT(*CStartExperienceManager_OnViewUncloakedFunc)(void* eventHandler, CSingleViewShellExperience* pSender);\nHRESULT CStartExperienceManager_OnViewUncloakedHook(void* eventHandler, CSingleViewShellExperience* pSender)\n{\n    PBYTE _this = (PBYTE)eventHandler - g_SMAnimationPatchOffsets.startExperienceManager_SingleViewShellExperienceEventHandler;\n\n    if (dwStartShowClassicMode)\n    {\n        CExperienceManagerAnimationHelper_EndFunc(_this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation);\n    }\n\n    return CStartExperienceManager_OnViewUncloakedFunc(eventHandler, pSender);\n}\n\nHRESULT(*CStartExperienceManager_OnViewCloakingFunc)(void* eventHandler, CSingleViewShellExperience* pSender);\nHRESULT CStartExperienceManager_OnViewCloakingHook(void* eventHandler, CSingleViewShellExperience* pSender)\n{\n    PBYTE _this = (PBYTE)eventHandler - g_SMAnimationPatchOffsets.startExperienceManager_SingleViewShellExperienceEventHandler;\n\n    bool bTransitioningToCortana = *(_this + g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana);\n    if (!bTransitioningToCortana && dwStartShowClassicMode)\n    {\n        RECT rcWorkArea;\n        EDGEUI_TRAYSTUCKPLACE tsp;\n        bool bRtl;\n        HMONITOR hMonitor;\n        if (SUCCEEDED(CStartExperienceManager_GetMonitorInformationHook(_this, pSender, &rcWorkArea, &tsp, &bRtl, &hMonitor)))\n        {\n            DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;\n            if (pSender->_fullScreen)\n                target = DWMTARGET_LAUNCHERFULLSCREEN;\n            else if (tsp == EUITSP_LEFT)\n                target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;\n            else if (tsp == EUITSP_TOP)\n                target = DWMTARGET_LAUNCHERFLYOUTTOTOP;\n            else if (tsp == EUITSP_RIGHT)\n                target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;\n            else if (tsp == EUITSP_BOTTOM)\n                target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;\n\n            CExperienceManagerAnimationHelper_BeginFunc(\n                _this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation,\n                pSender->_viewWrapper,\n                (DWMTRANSITION_TARGET)(target | 0x200000), nullptr, nullptr, nullptr, nullptr, &rcWorkArea);\n        }\n    }\n\n    return CStartExperienceManager_OnViewCloakingFunc(eventHandler, pSender);\n}\n\nHRESULT(*CStartExperienceManager_OnViewHiddenFunc)(void* eventHandler, CSingleViewShellExperience* pSender);\nHRESULT CStartExperienceManager_OnViewHiddenHook(void* eventHandler, CSingleViewShellExperience* pSender)\n{\n    PBYTE _this = (PBYTE)eventHandler - g_SMAnimationPatchOffsets.startExperienceManager_SingleViewShellExperienceEventHandler;\n\n    bool bTransitioningToCortana = *(_this + g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana);\n    if (!bTransitioningToCortana && dwStartShowClassicMode)\n    {\n        CExperienceManagerAnimationHelper_EndFunc(_this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation);\n    }\n\n    return CStartExperienceManager_OnViewHiddenFunc(eventHandler, pSender);\n}\n\nBOOL FixStartMenuAnimation(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n    // The idea here is to re-add the code that got removed in 22000.65+. We can see that \"STest03\" is the feature flag\n    // that experiments with the new start menu. So, because in 22000.51 one can enable the old start menu with proper\n    // behavior by setting the Start_ShowClassicMode registry value to 1, and there is a convenient function called\n    // `StartDocked::ShouldUseStartDocked()`, we crosscheck the removed code and piece together a patch for proper\n    // animations on 22000.65+.\n\n    g_SMAnimationPatchOffsets.startExperienceManager_IStartExperienceManager = 0x28;\n    g_SMAnimationPatchOffsets.startExperienceManager_SingleViewShellExperienceEventHandler = 0x60;\n\n    // ### CStartExperienceManager::`vftable'{for `SingleViewShellExperienceEventHandler'}\n#if defined(_M_X64)\n    // ```\n    // 48 89 46 48 48 8D 05 ?? ?? ?? ?? 48 89 46 60 48 8D 4E 68 E8\n    //                      ^^^^^^^^^^^\n    // ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    PBYTE matchVtable = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x48\\x89\\x46\\x48\\x48\\x8D\\x05\\x00\\x00\\x00\\x00\\x48\\x89\\x46\\x60\\x48\\x8D\\x4E\\x68\\xE8\",\n        \"xxxxxxx????xxxxxxxxx\"\n    );\n    if (matchVtable)\n    {\n        matchVtable += 4;\n        matchVtable += 7 + *(int*)(matchVtable + 3);\n    }\n#elif defined(_M_ARM64)\n    // * Pattern for Nickel\n    //   ```\n    //   69 A2 03 A9 ?? ?? 00 ?? 08 ?? ?? 91 ?? ?? 00 ?? 29 ?? ?? 91 68 32 00 F9\n    //               ^^^^^^^^^^^+^^^^^^^^^^^\n    //   ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    PBYTE matchVtable = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x69\\xA2\\x03\\xA9\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x91\\x00\\x00\\x00\\x00\\x29\\x00\\x00\\x91\\x68\\x32\\x00\\xF9\",\n        \"xxxx??x?x??x??x?x??xxxxx\"\n    );\n    if (matchVtable)\n    {\n        matchVtable += 4;\n        matchVtable = (PBYTE)ARM64_DecodeADRL((UINT_PTR)matchVtable, *(DWORD*)matchVtable, *(DWORD*)(matchVtable + 4));\n    }\n    else\n    {\n        // * Pattern for Germanium\n        //   ```\n        //   ?? 22 04 A9 ?? ?? 00 ?? 08 ?? ?? 91 ?? A2 01 91 ?? 32 00 F9\n        //               ^^^^^^^^^^^+^^^^^^^^^^^\n        //   ```\n        // Ref: CStartExperienceManager::CStartExperienceManager()\n        matchVtable = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x22\\x04\\xA9\\x00\\x00\\x00\\x00\\x08\\x00\\x00\\x91\\x00\\xA2\\x01\\x91\\x00\\x32\\x00\\xF9\",\n            \"xxx??x?x??x?xxx?xxx\"\n        );\n        if (matchVtable)\n        {\n            matchVtable += 3;\n            matchVtable = (PBYTE)ARM64_DecodeADRL((UINT_PTR)matchVtable, *(DWORD*)matchVtable, *(DWORD*)(matchVtable + 4));\n        }\n    }\n#endif\n    if (matchVtable)\n    {\n        printf(\"[SMA] matchVtable = %llX\\n\", matchVtable - (PBYTE)hTwinuiPcshell);\n    }\n\n    // ### Offset of SingleViewShellExperience instance and its event handler\n#if defined(_M_X64)\n    // ```\n    // 48 8D 8E ?? ?? ?? ?? 44 8D 45 41 48 8D 56 60 E8\n    //          ^^^^^^^^^^^ SVSE                 ^^ SVSEEH (hardcoded to 0x60, included in pattern for sanity check)\n    // ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    PBYTE matchSingleViewShellExperienceFields = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x48\\x8D\\x8E\\x00\\x00\\x00\\x00\\x44\\x8D\\x45\\x41\\x48\\x8D\\x56\\x60\\xE8\",\n        \"xxx????xxxxxxxxx\"\n    );\n    if (matchSingleViewShellExperienceFields)\n    {\n        g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience = *(int*)(matchSingleViewShellExperienceFields + 3);\n    }\n#elif defined(_M_ARM64)\n    // ```\n    // 22 08 80 52 ?? 82 01 91 ?? ?? ?? 91 ?? ?? ?? ?? 1F 20 03 D5\n    //             ^^^SVSEEH^^ ^^^^^^^^^^^ SVSE\n    // ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    PBYTE matchSingleViewShellExperienceFields = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x22\\x08\\x80\\x52\\x00\\x82\\x01\\x91\\x00\\x00\\x00\\x91\\x00\\x00\\x00\\x00\\x1F\\x20\\x03\\xD5\",\n        \"xxxx?xxx???x????xxxx\"\n    );\n    if (matchSingleViewShellExperienceFields)\n    {\n        g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience = (int)ARM64_DecodeADD(*(DWORD*)(matchSingleViewShellExperienceFields + 8));\n    }\n#endif\n    if (matchSingleViewShellExperienceFields)\n    {\n        printf(\"[SMA] matchSingleViewShellExperienceFields = %llX\\n\", matchSingleViewShellExperienceFields - (PBYTE)hTwinuiPcshell);\n    }\n\n    // ### Offsets of Animation Helpers\n    PBYTE matchAnimationHelperFields = nullptr;\n#if defined(_M_X64)\n    // ```\n    // 40 88 AE ?? ?? ?? ?? C7 86 ?? ?? ?? ?? 38 00 00 00\n    //          ^^^^^^^^^^^ AH1\n    // ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    // AH2 is located right after AH1. AH is 32 bytes\n    if (matchSingleViewShellExperienceFields)\n    {\n        matchAnimationHelperFields = (PBYTE)FindPattern(\n            matchSingleViewShellExperienceFields + 16,\n            128,\n            \"\\x40\\x88\\xAE\\x00\\x00\\x00\\x00\\xC7\\x86\\x00\\x00\\x00\\x00\\x38\\x00\\x00\\x00\",\n            \"xxx????xx????xxxx\"\n        );\n    }\n    if (matchAnimationHelperFields)\n    {\n        g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation = *(int*)(matchAnimationHelperFields + 3);\n        g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation = g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation + 32;\n    }\n#elif defined(_M_ARM64)\n    // ```\n    // 08 07 80 52 ?? ?? ?? 39 ?? ?? ?? B9\n    //             ^^^^^^^^^^^ AH1\n    // ```\n    // Ref: CStartExperienceManager::CStartExperienceManager()\n    // AH2 is located right after AH1. AH is 32 bytes\n    if (matchSingleViewShellExperienceFields)\n    {\n        matchAnimationHelperFields = (PBYTE)FindPattern(\n            matchSingleViewShellExperienceFields + 20,\n            128,\n            \"\\x08\\x07\\x80\\x52\\x00\\x00\\x00\\x39\\x00\\x00\\x00\\xB9\",\n            \"xxxx???x???x\"\n        );\n    }\n    if (matchAnimationHelperFields)\n    {\n        int openingAnimation = (int)ARM64_DecodeSTRBIMM(*(DWORD*)(matchAnimationHelperFields + 4));\n        if (openingAnimation != -1)\n        {\n            g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation = openingAnimation;\n            g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation = g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation + 32;\n        }\n        else\n        {\n            matchAnimationHelperFields = nullptr;\n        }\n    }\n#endif\n    if (matchAnimationHelperFields)\n    {\n        printf(\n            \"[SMA] matchAnimationHelperFields = %llX, +0x%X, +0x%X\\n\",\n            matchAnimationHelperFields - (PBYTE)hTwinuiPcshell,\n            g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation,\n            g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation\n        );\n    }\n\n    // ### Offset of bTransitioningToCortana\n#if defined(_M_X64)\n    // `(CStartExperienceManager *)((char *)this - 40)` after field access\n    // ```\n    // 80 B9 ?? ?? ?? ?? 00 75 ?? 48 83 C1 D8\n    //       ^^^^^^^^^^^ bTransitioningToCortana\n    // ```\n    // Ref: CStartExperienceManager::DimStart()\n    PBYTE matchTransitioningToCortanaField = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x80\\xB9\\x00\\x00\\x00\\x00\\x00\\x75\\x00\\x48\\x83\\xC1\\xD8\",\n        \"xx????xx?xxxx\"\n        );\n    if (matchTransitioningToCortanaField)\n    {\n        g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana = g_SMAnimationPatchOffsets.startExperienceManager_IStartExperienceManager + *(int*)(matchTransitioningToCortanaField + 2);\n    }\n    else\n    {\n        // `(CStartExperienceManager *)((char *)this - 40)` before field access\n        // ```\n        // 48 83 C1 ?? 80 B9 ?? ?? ?? ?? 00 75 ?? 41 B0 01\n        //                   ^^^^^^^^^^^ bTransitioningToCortana\n        // ```\n        // Ref: CStartExperienceManager::DimStart()\n        matchTransitioningToCortanaField = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x48\\x83\\xC1\\x00\\x80\\xB9\\x00\\x00\\x00\\x00\\x00\\x75\\x00\\x41\\xB0\\x01\",\n            \"xxx?xx????xx?xxx\"\n        );\n        if (matchTransitioningToCortanaField)\n        {\n            g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana = *(int*)(matchTransitioningToCortanaField + 6);\n        }\n    }\n#elif defined(_M_ARM64)\n    // ```\n    // ?? ?? ?? 39 E8 00 00 35 ?? ?? ?? ?? 01 ?? ?? 91 22 00 80 52\n    // ^^^^^^^^^^^ bTransitioningToCortana\n    // ```\n    // Ref: CStartExperienceManager::DimStart()\n    PBYTE matchTransitioningToCortanaField = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x39\\xE8\\x00\\x00\\x35\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x91\\x22\\x00\\x80\\x52\",\n        \"xxxxx????x??xxxxx\"\n    );\n    if (matchTransitioningToCortanaField)\n    {\n        int off = (int)ARM64_DecodeLDRBIMM(*(DWORD*)(matchTransitioningToCortanaField - 3));\n        if (off != -1)\n        {\n            g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana = g_SMAnimationPatchOffsets.startExperienceManager_IStartExperienceManager + off;\n        }\n        else\n        {\n            matchTransitioningToCortanaField = nullptr;\n        }\n    }\n#endif\n    if (matchTransitioningToCortanaField)\n    {\n        printf(\"[SMA] matchTransitioningToCortanaField = %llX, +0x%X\\n\", matchTransitioningToCortanaField - (PBYTE)hTwinuiPcshell, g_SMAnimationPatchOffsets.startExperienceManager_bTransitioningToCortana);\n    }\n\n    // ### Offset of CStartExperienceManager::GetMonitorInformation()\n#if defined(_M_X64)\n    // ```\n    // 48 8B ?? E8 ?? ?? ?? ?? 8B ?? 85 C0 0F 88 ?? ?? ?? ?? C6 44 24 ?? 01\n    //             ^^^^^^^^^^^\n    // ```\n    // Ref: CStartExperienceManager::PositionMenu()\n    PBYTE matchGetMonitorInformation = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x48\\x8B\\x00\\xE8\\x00\\x00\\x00\\x00\\x8B\\x00\\x85\\xC0\\x0F\\x88\\x00\\x00\\x00\\x00\\xC6\\x44\\x24\\x00\\x01\",\n        \"xx?x????x?xxxx????xxx?x\"\n    );\n    if (matchGetMonitorInformation)\n    {\n        matchGetMonitorInformation += 3;\n        matchGetMonitorInformation += 5 + *(int*)(matchGetMonitorInformation + 1);\n    }\n#elif defined(_M_ARM64)\n    // * Pattern for 22000 and 226xx, CSingleViewShellExperience* first arg *not* passed (E1 03 14 AA)\n    //   ```\n    //   A9 E4 ?? ?? ?? E3 ?? ?? 91 E2 ?? ?? 91 E0 03 ?? AA ?? ?? ?? ?? ?? 03 00 2A\n    //                                                      ^^^^^^^^^^^\n    //   ```\n    // Ref: CStartExperienceManager::PositionMenu()\n    PBYTE matchGetMonitorInformation = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\xA9\\xE4\\x00\\x00\\x00\\xE3\\x00\\x00\\x91\\xE2\\x00\\x00\\x91\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x2A\",\n        \"xx???x??xx??xxx?x?????xxx\"\n    );\n    if (matchGetMonitorInformation)\n    {\n        matchGetMonitorInformation += 17;\n        matchGetMonitorInformation = (PBYTE)ARM64_FollowBL((DWORD*)matchGetMonitorInformation);\n    }\n    if (!matchGetMonitorInformation)\n    {\n        // * Pattern for 226xx, CSingleViewShellExperience* first arg passed (E1 03 14 AA)\n        //   ```\n        //   A9 E4 ?? ?? ?? E3 ?? ?? 91 E2 ?? ?? 91 E1 03 14 AA E0 03 13 AA ?? ?? ?? ?? ?? 03 00 2A\n        //                                                                  ^^^^^^^^^^^\n        //   ```\n        // Ref: CStartExperienceManager::PositionMenu()\n        matchGetMonitorInformation = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\xA9\\xE4\\x00\\x00\\x00\\xE3\\x00\\x00\\x91\\xE2\\x00\\x00\\x91\\xE1\\x03\\x14\\xAA\\xE0\\x03\\x13\\xAA\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x2A\",\n            \"xx???x??xx??xxxxxxxxx?????xxx\"\n        );\n        if (matchGetMonitorInformation)\n        {\n            matchGetMonitorInformation += 21;\n            matchGetMonitorInformation = (PBYTE)ARM64_FollowBL((DWORD*)matchGetMonitorInformation);\n        }\n    }\n    if (!matchGetMonitorInformation)\n    {\n        // * Pattern for 26100.1, 265, 470, 560, 670, 712, 751, 863, 1000, 1150\n        //   ```\n        //   E2 82 00 91 E1 03 13 AA E0 03 14 AA ?? ?? ?? ??\n        //                                       ^^^^^^^^^^^\n        //   ```\n        // Ref: CStartExperienceManager::PositionMenu()\n        matchGetMonitorInformation = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\xE2\\x82\\x00\\x91\\xE1\\x03\\x13\\xAA\\xE0\\x03\\x14\\xAA\",\n            \"xxxxxxxxxxxx\"\n        );\n        if (matchGetMonitorInformation)\n        {\n            matchGetMonitorInformation += 12;\n            matchGetMonitorInformation = (PBYTE)ARM64_FollowBL((DWORD*)matchGetMonitorInformation);\n        }\n    }\n    if (!matchGetMonitorInformation)\n    {\n        // * Pattern for 26100.961, 1252, 1301, 1330, 1340, 1350, 1591, ...\n        //   ```\n        //   FF 02 00 39 E2 82 00 91 E0 03 13 AA ?? ?? ?? ??\n        //                                       ^^^^^^^^^^^\n        //   ```\n        // Ref: CStartExperienceManager::PositionMenu()\n        matchGetMonitorInformation = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\xFF\\x02\\x00\\x39\\xE2\\x82\\x00\\x91\\xE0\\x03\\x13\\xAA\",\n            \"xxxxxxxxxxx\"\n        );\n        if (matchGetMonitorInformation)\n        {\n            matchGetMonitorInformation += 12;\n            matchGetMonitorInformation = (PBYTE)ARM64_FollowBL((DWORD*)matchGetMonitorInformation);\n        }\n    }\n#endif\n    if (matchGetMonitorInformation)\n    {\n        CStartExperienceManager_GetMonitorInformationFunc = (decltype(CStartExperienceManager_GetMonitorInformationFunc))matchGetMonitorInformation;\n        printf(\"[SMA] CStartExperienceManager::GetMonitorInformation() = %llX\\n\", matchGetMonitorInformation - (PBYTE)hTwinuiPcshell);\n    }\n\n    // ### Offset of CExperienceManagerAnimationHelper::Begin()\n#if defined(_M_X64)\n    // * Pattern 1, used when all arguments are available:\n    //   ```\n    //   44 8B C7                      E8 ?? ?? ?? ?? 85 C0 79 19\n    //                                    ^^^^^^^^^^^\n    //   ```\n    // * Pattern 2, used when a4, a5, and a6 are optimized out (e.g. 26020, 26058):\n    //   ```\n    //   44 8B C7 48 8D 8B ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0 79 19\n    //                                    ^^^^^^^^^^^\n    //   ```\n    // Ref: CJumpViewExperienceManager::OnViewUncloaking()\n    PBYTE matchAnimationBegin = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x44\\x8B\\xC7\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\\x79\\x19\",\n        \"xxxx????xxxx\"\n    );\n    if (matchAnimationBegin)\n    {\n        matchAnimationBegin += 3;\n        matchAnimationBegin += 5 + *(int*)(matchAnimationBegin + 1);\n    }\n    else\n    {\n        matchAnimationBegin = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x44\\x8B\\xC7\\x48\\x8D\\x8B\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\\x79\\x19\",\n            \"xxxxxx????x????xxxx\"\n        );\n        if (matchAnimationBegin)\n        {\n            matchAnimationBegin += 10;\n            matchAnimationBegin += 5 + *(int*)(matchAnimationBegin + 1);\n        }\n    }\n#elif defined(_M_ARM64)\n    // * Pattern 1, used when all arguments are available:\n    //   ```\n    //   04 00 80 D2 03 00 80 D2 60 C2 05 91 ?? ?? ?? ?? E3 03 00 2A\n    //                                       ^^^^^^^^^^^\n    //   ```\n    // Ref: CJumpViewExperienceManager::OnViewUncloaking()\n    PBYTE matchAnimationBegin = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x04\\x00\\x80\\xD2\\x03\\x00\\x80\\xD2\\x60\\xC2\\x05\\x91\\x00\\x00\\x00\\x00\\xE3\\x03\\x00\\x2A\",\n        \"xxxxxxxxxxxx????xxxx\"\n    );\n    if (matchAnimationBegin)\n    {\n        matchAnimationBegin += 12;\n        matchAnimationBegin = (PBYTE)ARM64_FollowBL((DWORD*)matchAnimationBegin);\n    }\n    else\n    {\n        // * Pattern 2, used when a4, a5, and a6 are optimized out (e.g. 26020, 26058):\n        //   ```\n        //   ?? 02 0B 32 ?? ?? ?? 91 ?? ?? ?? 91 ?? ?? ?? ?? E3 03 00 2A\n        //                                       ^^^^^^^^^^^\n        //   ```\n        // Ref: CJumpViewExperienceManager::OnViewUncloaking()\n        matchAnimationBegin = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x02\\x0B\\x32\\00\\x00\\x00\\x91\\x00\\x00\\x00\\x91\\x00\\x00\\x00\\x00\\xE3\\x03\\x00\\x2A\",\n            \"xxx???x???x????xxxx\"\n        );\n        if (matchAnimationBegin)\n        {\n            matchAnimationBegin += 11;\n            matchAnimationBegin = (PBYTE)ARM64_FollowBL((DWORD*)matchAnimationBegin);\n        }\n    }\n#endif\n    if (matchAnimationBegin)\n    {\n        CExperienceManagerAnimationHelper_BeginFunc = (decltype(CExperienceManagerAnimationHelper_BeginFunc))matchAnimationBegin;\n        printf(\"[SMA] CExperienceManagerAnimationHelper::Begin() = %llX\\n\", matchAnimationBegin - (PBYTE)hTwinuiPcshell);\n    }\n\n    // ### Offset of CExperienceManagerAnimationHelper::End()\n#if defined(_M_X64)\n    // ```\n    // 40 53 48 83 EC 20 80 39 00 74\n    // ```\n    PBYTE matchAnimationEnd = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x40\\x53\\x48\\x83\\xEC\\x20\\x80\\x39\\x00\\x74\",\n        \"xxxxxxxxxx\"\n    );\n#elif defined(_M_ARM64)\n    // ```\n    // 7F 23 03 D5 F3 0F 1F F8 FD 7B BF A9 FD 03 00 91 08 00 40 39\n    // ----------- PACIBSP, don't scan for this because it's everywhere\n    // ```\n    PBYTE matchAnimationEnd = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\xF3\\x0F\\x1F\\xF8\\xFD\\x7B\\xBF\\xA9\\xFD\\x03\\x00\\x91\\x08\\x00\\x40\\x39\",\n        \"xxxxxxxxxxxxxxxx\"\n    );\n    if (matchAnimationEnd)\n    {\n        matchAnimationEnd -= 4;\n    }\n#endif\n    if (matchAnimationEnd)\n    {\n        CExperienceManagerAnimationHelper_EndFunc = (decltype(CExperienceManagerAnimationHelper_EndFunc))matchAnimationEnd;\n        printf(\"[SMA] CExperienceManagerAnimationHelper::End() = %llX\\n\", matchAnimationEnd - (PBYTE)hTwinuiPcshell);\n    }\n\n    // ### CStartExperienceManager::Hide()\n#if defined(_M_X64)\n    // * Pattern 1, mov [rbx+2A3h], r12b:\n    //   ```\n    //   74 ?? ?? 03 00 00 00 44 88\n    //   ^^ Turn jz into jmp\n    //   ```\n    // * Pattern 2, mov byte ptr [rbx+2A3h], 1:\n    //   ```\n    //   74 ?? ?? 03 00 00 00 C6 83\n    //   ^^ Turn jz into jmp\n    //   ```\n    // Perform on exactly two matches\n    PBYTE matchHideA = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x74\\x00\\x00\\x03\\x00\\x00\\x00\\x44\\x88\",\n        \"x??xxxxxx\"\n    );\n    PBYTE matchHideB = nullptr;\n    if (matchHideA)\n    {\n        printf(\"[SMA] matchHideA in CStartExperienceManager::Hide() = %llX\\n\", matchHideA - (PBYTE)hTwinuiPcshell);\n        matchHideB = (PBYTE)FindPattern(\n            matchHideA + 14,\n            cbSearch - (matchHideA + 14 - (PBYTE)pSearchBegin),\n            \"\\x74\\x00\\x00\\x03\\x00\\x00\\x00\\x44\\x88\",\n            \"x??xxxxxx\"\n        );\n        if (matchHideB)\n        {\n            printf(\"[SMA] matchHideB in CStartExperienceManager::Hide() = %llX\\n\", matchHideB - (PBYTE)hTwinuiPcshell);\n        }\n    }\n\n    if (!matchHideA || !matchHideB)\n    {\n        matchHideA = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x74\\x00\\x00\\x03\\x00\\x00\\x00\\xC6\\x83\",\n            \"x??xxxxxx\"\n        );\n        matchHideB = nullptr;\n        if (matchHideA)\n        {\n            printf(\"[SMA] matchHideA in CStartExperienceManager::Hide() = %llX\\n\", matchHideA - (PBYTE)hTwinuiPcshell);\n            matchHideB = (PBYTE)FindPattern(\n                matchHideA + 14,\n                cbSearch - (matchHideA + 14 - (PBYTE)pSearchBegin),\n                \"\\x74\\x00\\x00\\x03\\x00\\x00\\x00\\xC6\\x83\",\n                \"x??xxxxxx\"\n            );\n            if (matchHideB)\n            {\n                printf(\"[SMA] matchHideB in CStartExperienceManager::Hide() = %llX\\n\", matchHideB - (PBYTE)hTwinuiPcshell);\n            }\n        }\n    }\n#elif defined(_M_ARM64)\n    // ```\n    // E1 03 ?? 2A ?? ?? 04 91 ?? ?? ?? ?? ?? 03 00 2A\n    // ```\n    // Check two instructions before, and NOP these:\n    // ```\n    // MOV             W??, #3\n    // STRB            W??, [X??,#0x???]\n    // ```\n    // Perform on exactly two matches\n    PBYTE matchHideA = nullptr;\n    PBYTE matchHideB = nullptr;\n    auto findTheIfBody = [](PBYTE pAnchor) -> PBYTE\n    {\n        // 27881.1000+ has CBNZ before us, follow it if it is.\n        // Otherwise, just check the two instructions before.\n        PBYTE pMaybeFollowed = (PBYTE)ARM64_FollowCBNZW((DWORD*)(pAnchor - 4));\n        PBYTE pIfBlockBegin = pMaybeFollowed ? pMaybeFollowed : pAnchor - 8;\n\n        DWORD insnMovzw = *(DWORD*)pIfBlockBegin;\n        if (!ARM64_IsMOVZW(insnMovzw))\n            return nullptr;\n\n        DWORD movzwImm16 = ARM64_ReadBitsSignExtend(insnMovzw, 20, 5);\n        if (movzwImm16 != 3)\n            return nullptr;\n\n        DWORD insnStrbimm = *(DWORD*)(pIfBlockBegin + 4);\n        if (!ARM64_IsSTRBIMM(insnStrbimm))\n            return nullptr;\n\n        return pIfBlockBegin;\n    };\n    PBYTE matchHideAAfter = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\xE1\\x03\\x00\\x2A\\x00\\x00\\x04\\x91\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x2A\",\n        \"xx?x??xx?????xxx\"\n    );\n    if (matchHideAAfter)\n    {\n        matchHideA = findTheIfBody(matchHideAAfter);\n    }\n    if (matchHideA)\n    {\n        printf(\"[SMA] matchHideA in CStartExperienceManager::Hide() = %llX\\n\", matchHideA - (PBYTE)hTwinuiPcshell);\n        PBYTE matchHideBAfter = (PBYTE)FindPattern(\n            matchHideAAfter + 16,\n            1024,\n            \"\\xE1\\x03\\x00\\x2A\\x00\\x00\\x04\\x91\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x2A\",\n            \"xx?x??xx?????xxx\"\n        );\n        if (matchHideBAfter)\n        {\n            matchHideB = findTheIfBody(matchHideBAfter);\n        }\n        if (matchHideB)\n        {\n            printf(\"[SMA] matchHideB in CStartExperienceManager::Hide() = %llX\\n\", matchHideB - (PBYTE)hTwinuiPcshell);\n        }\n    }\n#endif\n\n    if (!matchVtable\n        || !matchSingleViewShellExperienceFields\n        || !matchAnimationHelperFields\n        || !matchTransitioningToCortanaField\n        || !matchGetMonitorInformation\n        || !matchAnimationBegin\n        || !matchAnimationEnd\n        || !matchHideA\n        || !matchHideB)\n    {\n        printf(\"[SMA] Not all offsets were found, cannot perform patch\\n\");\n        return FALSE;\n    }\n\n    void** vtable = (void**)matchVtable;\n    REPLACE_VTABLE_ENTRY(vtable, 4, CStartExperienceManager_OnViewUncloaking);\n    REPLACE_VTABLE_ENTRY(vtable, 5, CStartExperienceManager_OnViewUncloaked);\n    REPLACE_VTABLE_ENTRY(vtable, 6, CStartExperienceManager_OnViewCloaking);\n    REPLACE_VTABLE_ENTRY(vtable, 10, CStartExperienceManager_OnViewHidden);\n\n    if (dwStartShowClassicMode)\n    {\n        DWORD dwOldProtect = 0;\n#if defined(_M_X64)\n        if (VirtualProtect(matchHideA, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            matchHideA[0] = 0xEB;\n            VirtualProtect(matchHideA, 1, dwOldProtect, &dwOldProtect);\n\n            dwOldProtect = 0;\n            if (VirtualProtect(matchHideB, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                matchHideB[0] = 0xEB;\n                VirtualProtect(matchHideB, 1, dwOldProtect, &dwOldProtect);\n            }\n        }\n#elif defined(_M_ARM64)\n        if (VirtualProtect(matchHideA, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            *(DWORD*)(matchHideA + 0) = 0xD503201F; // NOP\n            *(DWORD*)(matchHideA + 4) = 0xD503201F; // NOP\n            VirtualProtect(matchHideA, 8, dwOldProtect, &dwOldProtect);\n\n            dwOldProtect = 0;\n            if (VirtualProtect(matchHideB, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(DWORD*)(matchHideB + 0) = 0xD503201F; // NOP\n                *(DWORD*)(matchHideB + 4) = 0xD503201F; // NOP\n                VirtualProtect(matchHideB, 8, dwOldProtect, &dwOldProtect);\n            }\n        }\n#endif\n    }\n\n    int rv = -1;\n    if (CStartExperienceManager_GetMonitorInformationFunc)\n    {\n        rv = funchook_prepare(\n            funchook,\n            (void**)&CStartExperienceManager_GetMonitorInformationFunc,\n            CStartExperienceManager_GetMonitorInformationHook\n        );\n    }\n    if (rv != 0)\n    {\n        printf(\"Failed to hook CStartExperienceManager::GetMonitorInformation(). rv = %d\\n\", rv);\n    }\n\n    return TRUE;\n}\n\n#pragma endregion\n\n\n#pragma region \"Fix broken taskbar jump list positioning caused by 40874676\"\n\nclass RoVariant\n{\n    enum States\n    {\n        StateIsNull = 0,\n        StateIsObjNoRef = 1,\n        StateIsObj = 3,\n        StateIsPV = 7\n    };\n\n    static bool StateHasRefcount(HRESULT hrState)\n    {\n        return hrState == StateIsPV || hrState == StateIsObj;\n    }\n\n    class Accessor\n    {\n        IInspectable* _pI;\n        HRESULT _hrState;\n\n        ABI::Windows::Foundation::IPropertyValue* _PV() const\n        {\n            return (ABI::Windows::Foundation::IPropertyValue*)_pI;\n        }\n\n        HRESULT VerifyPV() const\n        {\n            if (_hrState == StateIsPV)\n                return S_OK;\n            if (SUCCEEDED(_hrState))\n                return TYPE_E_TYPEMISMATCH;\n            return _hrState;\n        }\n\n    public:\n        Accessor(IInspectable* pI, HRESULT hr) : _pI(pI), _hrState(hr) {}\n        Accessor* operator->() { return this; }\n        HRESULT get_Type(ABI::Windows::Foundation::PropertyType* type) const;\n\n        #define GETTER(name, type) HRESULT Get##name(type* value) const \\\n        { \\\n            if (!value) \\\n                return E_POINTER; \\\n            *value = {}; \\\n            HRESULT hr = VerifyPV(); \\\n            if (SUCCEEDED(hr)) \\\n                hr = _PV()->Get##name(value); \\\n            return hr; \\\n        }\n\n        GETTER(UInt8, UINT8);\n        GETTER(Int16, INT16);\n        GETTER(UInt16, UINT16);\n        GETTER(Int32, INT32);\n        GETTER(UInt32, UINT32);\n        GETTER(Int64, INT64);\n        GETTER(UInt64, UINT64);\n        GETTER(Single, float);\n        GETTER(Double, double);\n        GETTER(Char16, WCHAR);\n        GETTER(Boolean, BOOLEAN);\n        GETTER(String, HSTRING);\n        GETTER(Guid, GUID);\n        GETTER(DateTime, ABI::Windows::Foundation::DateTime);\n        GETTER(TimeSpan, ABI::Windows::Foundation::TimeSpan);\n        GETTER(Point, ABI::Windows::Foundation::Point);\n        GETTER(Size, ABI::Windows::Foundation::Size);\n        GETTER(Rect, ABI::Windows::Foundation::Rect);\n\n        #undef GETTER\n\n        HRESULT GetInspectable(IInspectable** value) const\n        {\n            if (!value)\n                return E_POINTER;\n            *value = nullptr;\n            HRESULT hr = _hrState;\n            if (SUCCEEDED(hr))\n            {\n                if (hr != StateIsNull && (hr == StateIsObj || hr == StateIsObjNoRef))\n                {\n                    *value = _pI;\n                    _pI->AddRef();\n                    hr = S_OK;\n                }\n                else\n                {\n                    hr = TYPE_E_TYPEMISMATCH;\n                }\n            }\n            return hr;\n        }\n\n        #define GETTER_ARRAY(name, type) HRESULT Get##name##Array(UINT* length, type** value) const \\\n        { \\\n            if (!length || !value) \\\n                return E_POINTER; \\\n            *length = 0; \\\n            *value = nullptr; \\\n            HRESULT hr = VerifyPV(); \\\n            if (SUCCEEDED(hr)) \\\n                hr = _PV()->Get##name##Array(length, value); \\\n            return hr; \\\n        }\n\n        GETTER_ARRAY(UInt8, UINT8);\n        GETTER_ARRAY(Int16, INT16);\n        GETTER_ARRAY(UInt16, UINT16);\n        GETTER_ARRAY(Int32, INT32);\n        GETTER_ARRAY(UInt32, UINT32);\n        GETTER_ARRAY(Int64, INT64);\n        GETTER_ARRAY(UInt64, UINT64);\n        GETTER_ARRAY(Single, float);\n        GETTER_ARRAY(Double, double);\n        GETTER_ARRAY(Char16, WCHAR);\n        GETTER_ARRAY(Boolean, BOOLEAN);\n        GETTER_ARRAY(String, HSTRING);\n        GETTER_ARRAY(Inspectable, IInspectable*);\n        GETTER_ARRAY(Guid, GUID);\n        GETTER_ARRAY(DateTime, ABI::Windows::Foundation::DateTime);\n        GETTER_ARRAY(TimeSpan, ABI::Windows::Foundation::TimeSpan);\n        GETTER_ARRAY(Point, ABI::Windows::Foundation::Point);\n        GETTER_ARRAY(Size, ABI::Windows::Foundation::Size);\n        GETTER_ARRAY(Rect, ABI::Windows::Foundation::Rect);\n\n        #undef GETTER_ARRAY\n    };\n\n    class OutRef\n    {\n        RoVariant* _pOwner;\n        IInspectable* _pI;\n\n    public:\n        OutRef(RoVariant* pOwner) : _pOwner(pOwner), _pI(nullptr) {}\n        operator ABI::Windows::Foundation::IPropertyValue**() { return (ABI::Windows::Foundation::IPropertyValue**)&_pI; }\n        operator IInspectable**() { return &_pI; }\n        ~OutRef() { _pOwner->Attach(_pI); }\n    };\n\n    IInspectable* _pI = nullptr;\n    HRESULT _hrState = StateIsNull;\n\npublic:\n    RoVariant() = default;\n    RoVariant(RoVariant*);\n    RoVariant(RoVariant&);\n    RoVariant(ABI::Windows::Foundation::IPropertyValue*, bool);\n\nprivate:\n    RoVariant(IInspectable* pI, bool fAddRefInspectable, bool attach)\n    {\n        if (pI)\n        {\n            ABI::Windows::Foundation::IPropertyValue* pPV;\n            HRESULT hr = pI->QueryInterface(IID_PPV_ARGS(&pPV));\n            if (SUCCEEDED(hr))\n            {\n                _pI = pPV;\n                if (attach)\n                    pI->Release();\n                _hrState = StateIsPV;\n            }\n            else if (hr != E_NOINTERFACE)\n            {\n                _pI = nullptr;\n                _hrState = hr;\n                if (attach)\n                    pI->Release();\n            }\n            else\n            {\n                _pI = pI;\n                if (fAddRefInspectable && !attach)\n                    _pI->AddRef();\n                _hrState = fAddRefInspectable ? StateIsObj : StateIsObjNoRef;\n            }\n        }\n        else\n        {\n            _pI = nullptr;\n            _hrState = StateIsNull;\n        }\n    }\n\npublic:\n    RoVariant(IInspectable* pI, bool attach)\n    {\n        RoVariant tmp(pI, true, attach);\n        Swap(tmp);\n    }\n\n    RoVariant(void*);\n\n    ~RoVariant()\n    {\n        if (_pI && StateHasRefcount(_hrState))\n            _pI->Release();\n    }\n\n    RoVariant& operator=(RoVariant other)\n    {\n        Swap(other);\n        return *this;\n    }\n\n    void Swap(RoVariant& other)\n    {\n        IInspectable* pI = _pI;\n        _pI = other._pI;\n        other._pI = pI;\n\n        HRESULT hrState = _hrState;\n        _hrState = other._hrState;\n        other._hrState = hrState;\n    }\n\n    operator IInspectable*() const { return Get(); }\n    IInspectable* Get() const { return _pI; }\n    IInspectable* Detach();\n    void Attach(ABI::Windows::Foundation::IPropertyValue*);\n\n    void Attach(IInspectable* pI)\n    {\n        RoVariant tmp = RoVariant(pI, true, true);\n        Swap(tmp);\n    }\n\n    Accessor operator*() const { return Accessor(_pI, _hrState); }\n    Accessor operator->() const { return Accessor(_pI, _hrState); }\n    OutRef operator&() { return ReleaseAndGetAddressOf(); }\n\n    struct USE_INSTEAD_ReleaseAndGetAddressOf\n    {\n    };\n\n    USE_INSTEAD_ReleaseAndGetAddressOf GetAddressOf() { return USE_INSTEAD_ReleaseAndGetAddressOf(); }\n    OutRef ReleaseAndGetAddressOf() { return OutRef(this); }\n    bool operator!();\n    static RoVariant Wrap(ABI::Windows::Foundation::IPropertyValue*);\n    static RoVariant Wrap(IInspectable* pI) { return RoVariant(pI, false, false); }\n    HRESULT CopyTo(ABI::Windows::Foundation::IPropertyValue**);\n    HRESULT CopyTo(IInspectable**);\n};\n\nnamespace ABI::Windows::UI::Xaml\n{\n    enum HorizontalAlignment\n    {\n        HorizontalAlignment_Left = 0,\n        HorizontalAlignment_Center = 1,\n        HorizontalAlignment_Right = 2,\n        HorizontalAlignment_Stretch = 3,\n    };\n\n    enum VerticalAlignment\n    {\n        VerticalAlignment_Top = 0,\n        VerticalAlignment_Center = 1,\n        VerticalAlignment_Bottom = 2,\n        VerticalAlignment_Stretch = 3,\n    };\n}\n\nstatic struct\n{\n    int jumpViewExperienceManager_rcWorkArea;\n} g_JVPositioningPatchOffsets;\n\nHRESULT CJumpViewExperienceManager_CalcWindowPosition(\n    RECT rcWork,\n    POINT ptAnchor,\n    int width,\n    int height,\n    ABI::Windows::UI::Xaml::HorizontalAlignment hAlign,\n    ABI::Windows::UI::Xaml::VerticalAlignment vAlign,\n    RECT& result)\n{\n    using namespace ABI::Windows::UI::Xaml;\n\n    if (false) // Feature_40874676\n    {\n        result.bottom = max(min(ptAnchor.y, rcWork.bottom), rcWork.top);\n        int desiredTop = result.bottom - height;\n        result.top = max(desiredTop, rcWork.top);\n        int desiredLeft = ptAnchor.x - (width / 2);\n        result.left = min(max(desiredLeft, rcWork.left), rcWork.right);\n        result.right = min(result.left + width, rcWork.right);\n        return S_OK;\n    }\n\n    switch (vAlign)\n    {\n        case VerticalAlignment_Center:\n        {\n            int desiredTopPre = (height / -2) + ptAnchor.y;\n            result.bottom = min(height + max(desiredTopPre, rcWork.top), rcWork.bottom);\n            int desiredTop = result.bottom - height;\n            result.top = max(desiredTop, rcWork.top);\n            break;\n        }\n        case VerticalAlignment_Top:\n        {\n            int desiredTopPre = ptAnchor.y;\n            result.bottom = min(height + max(desiredTopPre, rcWork.top), rcWork.bottom);\n            int desiredTop = result.bottom - height;\n            result.top = max(desiredTop, rcWork.top);\n            break;\n        }\n        case VerticalAlignment_Bottom:\n        {\n            int top = max(min(ptAnchor.y, rcWork.bottom) - height, rcWork.top);\n            result.bottom = min(top + height, rcWork.bottom);\n            result.top = top;\n            break;\n        }\n        default:\n        {\n            RETURN_HR(E_NOTIMPL);\n        }\n    }\n\n    switch (hAlign)\n    {\n        case HorizontalAlignment_Center:\n        {\n            int desiredLeftPre = (width / -2) + ptAnchor.x;\n            result.right = min(width + max(desiredLeftPre, rcWork.left), rcWork.right);\n            int desiredLeft = result.right - width;\n            result.left = max(desiredLeft, rcWork.left);\n            break;\n        }\n        case HorizontalAlignment_Left:\n        {\n            int desiredLeftPre = ptAnchor.x;\n            result.right = min(width + max(desiredLeftPre, rcWork.left), rcWork.right);\n            int desiredLeft = result.right - width;\n            result.left = max(desiredLeft, rcWork.left);\n            break;\n        }\n        case HorizontalAlignment_Right:\n        {\n            result.left = max(min(ptAnchor.x, rcWork.right) - width, rcWork.left);\n            result.right = min(result.left + width, rcWork.right);\n            break;\n        }\n        default:\n        {\n            RETURN_HR(E_NOTIMPL);\n        }\n    }\n\n    return S_OK;\n}\n\nHRESULT CJumpViewExperienceManager_GetMonitorInformation(void* _this, POINT ptAnchor, RECT* prcOutWorkArea, UINT* outDpi, EDGEUI_TRAYSTUCKPLACE* outStuckPlace)\n{\n    HMONITOR hMonitor = MonitorFromPoint(ptAnchor, MONITOR_DEFAULTTONEAREST);\n    RETURN_LAST_ERROR_IF(hMonitor == INVALID_HANDLE_VALUE);\n\n    MONITORINFO mi = { sizeof(mi) };\n    RETURN_IF_WIN32_BOOL_FALSE(GetMonitorInfoW(hMonitor, &mi));\n    *prcOutWorkArea = mi.rcWork;\n\n    UINT dpiY;\n    RETURN_IF_FAILED(GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, outDpi, &dpiY)); // 884\n\n    ComPtr<IServiceProvider> spImmersiveShellServiceProvider;\n    RETURN_IF_FAILED(CoCreateInstance(CLSID_ImmersiveShell, nullptr, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&spImmersiveShellServiceProvider)));\n\n    ComPtr<IImmersiveMonitorManager> spImmersiveMonitorManager;\n    RETURN_IF_FAILED(spImmersiveShellServiceProvider->QueryService(SID_IImmersiveMonitorService, IID_PPV_ARGS(&spImmersiveMonitorManager))); // 886\n\n    ComPtr<IEdgeUiManager> spEdgeUiManager;\n    RETURN_IF_FAILED(spImmersiveMonitorManager->QueryService(hMonitor, SID_EdgeUi, IID_PPV_ARGS(&spEdgeUiManager))); // 887\n    RETURN_IF_FAILED(spEdgeUiManager->GetTrayStuckPlace(outStuckPlace)); // 888\n\n    return S_OK;\n}\n\nHRESULT(*CJumpViewExperienceManager_EnsureWindowPositionFunc)(void* _this, CSingleViewShellExperience* experience);\nHRESULT CJumpViewExperienceManager_EnsureWindowPositionHook(void* _this, CSingleViewShellExperience* experience)\n{\n    if (!experience->_viewWrapper)\n        return S_OK;\n\n    ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> properties;\n    RETURN_IF_FAILED(experience->_propertySet.As(&properties)); // 813\n\n    POINT ptAnchor;\n    {\n        RoVariant variant;\n        RETURN_IF_FAILED(properties->Lookup(Wrappers::HStringReference(L\"Position\").Get(), &variant)); // 816\n\n        ABI::Windows::Foundation::Point value;\n        RETURN_IF_FAILED(variant->GetPoint(&value)); // 819\n\n        ptAnchor.x = (int)value.X;\n        ptAnchor.y = (int)value.Y;\n    }\n\n    ABI::Windows::UI::Xaml::HorizontalAlignment hAlign;\n    {\n        RoVariant variant;\n        RETURN_IF_FAILED(properties->Lookup(Wrappers::HStringReference(L\"HorizontalAlign\").Get(), &variant)); // 828\n\n        int value;\n        RETURN_IF_FAILED(variant->GetInt32(&value)); // 831\n        hAlign = (ABI::Windows::UI::Xaml::HorizontalAlignment)value;\n    }\n\n    ABI::Windows::UI::Xaml::VerticalAlignment vAlign;\n    {\n        RoVariant variant;\n        RETURN_IF_FAILED(properties->Lookup(Wrappers::HStringReference(L\"VerticalAlign\").Get(), &variant)); // 838\n\n        int value;\n        RETURN_IF_FAILED(variant->GetInt32(&value)); // 841\n        vAlign = (ABI::Windows::UI::Xaml::VerticalAlignment)value;\n    }\n\n    RECT rcWorkArea;\n    UINT dpi;\n    RETURN_IF_FAILED(CJumpViewExperienceManager_GetMonitorInformation(\n        _this, ptAnchor, &rcWorkArea, &dpi,\n        (EDGEUI_TRAYSTUCKPLACE*)((PBYTE)_this + 0x1F0))); // 850\n    *((RECT*)((PBYTE)_this + g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea)) = rcWorkArea;\n\n    int width, height;\n    ExperienceManagerUtils::ScaleByDPI(&experience->_desiredSize, dpi, &width, &height);\n    RETURN_HR_IF(E_INVALIDARG, width <= 0 || height <= 0); // 860\n\n    RECT rcPosition;\n    RETURN_IF_FAILED(CJumpViewExperienceManager_CalcWindowPosition(rcWorkArea, ptAnchor, width, height, hAlign, vAlign, rcPosition));\n    RETURN_IF_FAILED(experience->SetPosition(&rcPosition));\n\n    return S_OK;\n}\n\nBOOL FixJumpViewPositioning(HMODULE hTwinuiPcshell, PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return FALSE;\n\n    // Offset sanity checks\n\n    // EDGEUI_TRAYSTUCKPLACE CJumpViewExperienceManager::m_trayStuckPlace\n#if defined(_M_X64)\n    // 8B 8B B0 01 00 00 BF 5C 00 00 00 85 C9\n    //       ^^^^^^^^^^^\n    // Ref: CJumpViewExperienceManager::OnViewUncloaking()\n    PBYTE matchOffsetTrayStuckPlace = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x8B\\x8B\\xB0\\x01\\x00\\x00\\xBF\\x5C\\x00\\x00\\x00\\x85\\xC9\",\n        \"xxxxxxxxxxxxx\"\n    );\n#elif defined(_M_ARM64)\n    // ?? ?? 41 B9 89 0B 80 52 A8 01 00 34 1F 05 00 71 20 01 00 54 1F 09 00 71 A0 00 00 54 1F 0D 00 71 01 01 00 54 69 0B 80 52\n    // ^^^^^^^^^^^       Important instr. to distinguish from MeetNowExperienceManager::OnViewUncloaking() in GE > !!!!!!!!!!!\n    // Ref: CJumpViewExperienceManager::OnViewCloaking()\n    PBYTE matchOffsetTrayStuckPlace = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x41\\xB9\\x89\\x0B\\x80\\x52\\xA8\\x01\\x00\\x34\\x1F\\x05\\x00\\x71\\x20\\x01\\x00\\x54\\x1F\\x09\\x00\\x71\\xA0\\x00\\x00\\x54\\x1F\\x0D\\x00\\x71\\x01\\x01\\x00\\x54\\x69\\x0B\\x80\\x52\",\n        \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n    );\n#endif\n    if (matchOffsetTrayStuckPlace)\n    {\n        printf(\"[JVP] matchOffsetTrayStuckPlace = %llX\\n\", matchOffsetTrayStuckPlace - (PBYTE)hTwinuiPcshell);\n    }\n\n    // RECT CJumpViewExperienceManager::m_rcWorkArea\n    PBYTE matchOffsetRcWorkArea = nullptr;\n#if defined(_M_X64)\n    // 48 8B 53 70 48 8D 83 ?? ?? ?? ??\n    //          --          ^^^^^^^^^^^\n    // Ref: CJumpViewExperienceManager::OnViewUncloaking()\n    // Note: The ref function belongs to SingleViewShellExperienceEventHandler so `this` is +0x40.\n    //       As long as the above sanity check passes, hardcoding it should be fine.\n    if (matchOffsetTrayStuckPlace)\n    {\n        matchOffsetRcWorkArea = (PBYTE)FindPattern(\n            matchOffsetTrayStuckPlace + 13,\n            256,\n            \"\\x48\\x8B\\x53\\x70\\x48\\x8D\\x83\",\n            \"xxxxxxx\"\n        );\n        if (matchOffsetRcWorkArea)\n        {\n            g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x40 + *(int*)(matchOffsetRcWorkArea + 7);\n        }\n    }\n#elif defined(_M_ARM64)\n    if (matchOffsetTrayStuckPlace)\n    {\n        // Without Feature_TaskbarJumplistOnHover (48980211)\n        // 01 38 40 F9 07 00 07 91\n        // ----------- ^^^^^^^^^^^\n        // If this matches then the offset of m_rcWorkArea is +0x200\n        // Ref: CJumpViewExperienceManager::OnViewCloaking()\n        matchOffsetRcWorkArea = (PBYTE)FindPattern(\n            matchOffsetTrayStuckPlace + 38,\n            128,\n            \"\\x01\\x38\\x40\\xF9\\x07\\x00\\x07\\x91\",\n            \"xxxxxxxx\"\n        );\n        if (matchOffsetRcWorkArea)\n        {\n            g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x200;\n        }\n        if (!matchOffsetRcWorkArea)\n        {\n            // With Feature_TaskbarJumplistOnHover (48980211)\n            // 22 01 03 32 67 32 07 91\n            //             ^^^^^^^^^^^\n            // If this matches then the offset of m_rcWorkArea is +0x20C\n            // Ref: CJumpViewExperienceManager::OnViewCloaking()\n            matchOffsetRcWorkArea = (PBYTE)FindPattern(\n                matchOffsetTrayStuckPlace + 38,\n                128,\n                \"\\x22\\x01\\x03\\x32\\x67\\x32\\x07\\x91\",\n                \"xxxxxxxx\"\n            );\n            if (matchOffsetRcWorkArea)\n            {\n                g_JVPositioningPatchOffsets.jumpViewExperienceManager_rcWorkArea = 0x20C;\n            }\n        }\n    }\n#endif\n    if (matchOffsetRcWorkArea)\n    {\n        printf(\"[JVP] matchOffsetRcWorkArea = %llX\\n\", matchOffsetRcWorkArea - (PBYTE)hTwinuiPcshell);\n    }\n\n    // CJumpViewExperienceManager::EnsureWindowPosition()\n#if defined(_M_X64)\n    // Base Nickel and Germanium\n    // 8D 4E C0 48 8B ?? E8 ?? ?? ?? ?? 8B\n    //                      ^^^^^^^^^^^\n    // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging()\n    PBYTE matchEnsureWindowPosition = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x8D\\x4E\\xC0\\x48\\x8B\\x00\\xE8\\x00\\x00\\x00\\x00\\x8B\",\n        \"xxxxx?x????x\"\n    );\n    if (matchEnsureWindowPosition)\n    {\n        matchEnsureWindowPosition += 6;\n        matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1);\n    }\n    if (!matchEnsureWindowPosition)\n    {\n        // Nickel with Feature_TaskbarJumplistOnHover (48980211)\n        // - 22621.3930, 3936, 4000, 4010, 4076, 4082, 4110, 4145, ...\n        // 4C 8D 76 C0 48 8B D3 49 8B CE E8 ?? ?? ?? ?? 8B\n        //                                  ^^^^^^^^^^^\n        // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging()\n        matchEnsureWindowPosition = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x4C\\x8D\\x76\\xC0\\x48\\x8B\\xD3\\x49\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x8B\",\n            \"xxxxxxxxxxx????x\"\n        );\n        if (matchEnsureWindowPosition)\n        {\n            matchEnsureWindowPosition += 10;\n            matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1);\n        }\n    }\n    if (!matchEnsureWindowPosition)\n    {\n        // Germanium with Feature_TaskbarJumplistOnHover (48980211)\n        // - 26100.1350, 1591, ...\n        // 48 8B D7 49 8D 4E C0 E8 ?? ?? ?? ?? 8B\n        //                         ^^^^^^^^^^^\n        // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging()\n        matchEnsureWindowPosition = (PBYTE)FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x48\\x8B\\xD7\\x49\\x8D\\x4E\\xC0\\xE8\\x00\\x00\\x00\\x00\\x8B\",\n            \"xxxxxxxx????x\"\n        );\n        if (matchEnsureWindowPosition)\n        {\n            matchEnsureWindowPosition += 7;\n            matchEnsureWindowPosition += 5 + *(int*)(matchEnsureWindowPosition + 1);\n        }\n    }\n#elif defined(_M_ARM64)\n    // E1 03 ?? AA ?? 02 01 D1 ?? ?? ?? ?? ?? 03 00 2A\n    //                !!       ^^^^^^^^^^^\n    //                Do not change this to a wildcard, this byte is important\n    // Ref: CJumpViewExperienceManager::OnViewPropertiesChanging()\n    PBYTE matchEnsureWindowPosition = (PBYTE)FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\xE1\\x03\\x00\\xAA\\x00\\x02\\x01\\xD1\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x2A\",\n        \"xx?x?xxx?????xxx\"\n    );\n    if (matchEnsureWindowPosition)\n    {\n        matchEnsureWindowPosition += 8;\n        matchEnsureWindowPosition = (PBYTE)ARM64_FollowBL((DWORD*)matchEnsureWindowPosition);\n    }\n#endif\n    if (matchEnsureWindowPosition)\n    {\n        printf(\"[JVP] matchEnsureWindowPosition = %llX\\n\", matchEnsureWindowPosition - (PBYTE)hTwinuiPcshell);\n    }\n\n    if (!matchOffsetTrayStuckPlace\n        || !matchOffsetRcWorkArea\n        || !matchEnsureWindowPosition)\n    {\n        printf(\"[JVP] Not all offsets were found, cannot perform patch\\n\");\n        return FALSE;\n    }\n\n    CJumpViewExperienceManager_EnsureWindowPositionFunc = (decltype(CJumpViewExperienceManager_EnsureWindowPositionFunc))matchEnsureWindowPosition;\n    funchook_prepare(\n        funchook,\n        (void**)&CJumpViewExperienceManager_EnsureWindowPositionFunc,\n        CJumpViewExperienceManager_EnsureWindowPositionHook\n    );\n\n    return TRUE;\n}\n\n#pragma endregion\n\n\nvoid TryToFindTwinuiPCShellOffsets(DWORD* pOffsets)\n{\n    // We read from the file instead of from memory because other tweak software might've modified the functions we're looking for\n    WCHAR wszPath[MAX_PATH];\n    GetSystemDirectoryW(wszPath, MAX_PATH);\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\twinui.pcshell.dll\");\n    HANDLE hFile = CreateFileW(wszPath, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);\n    if (hFile == INVALID_HANDLE_VALUE)\n    {\n        return;\n    }\n\n    DWORD dwSize = GetFileSize(hFile, nullptr);\n    PBYTE pFile = (PBYTE)malloc(dwSize);\n    DWORD dwRead = 0;\n    if (!ReadFile(hFile, pFile, dwSize, &dwRead, nullptr) || dwRead != dwSize)\n    {\n        goto cleanup;\n    }\n\n    PBYTE pSearchBegin;\n    DWORD cbSearch;\n    if (!TextSectionBeginAndSizePEFile(pFile, dwSize, &pSearchBegin, &cbSearch))\n    {\n        goto cleanup;\n    }\n\n    if (IsWindows11())\n    {\n        // All patterns here have been tested to work on:\n        // - 22621.1, 22621.1992, 22621.2134, 22621.2283, 22621.2359 (RP)\n        // - 23545.1000\n        // - 25951.1000\n\n        if (!pOffsets[0] || pOffsets[0] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // 48 8B 49 08 E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8B 89\n            //                ^^^^^^^^^^^\n            // Ref: CMultitaskingViewFrame::v_WndProc()\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x48\\x8B\\x49\\x08\\xE8\\x00\\x00\\x00\\x00\\xE9\\x00\\x00\\x00\\x00\\x48\\x8B\\x89\",\n                \"xxxxx????x????xxx\"\n            );\n            if (match)\n            {\n                match += 4;\n                pOffsets[0] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n            }\n#elif defined(_M_ARM64)\n            // ?? ?? 00 71 ?? ?? 00 54 ?? ?? 40 F9 E3 03 ?? AA E2 03 ?? AA E1 03 ?? 2A ?? ?? ?? ??\n            //                                                                         ^^^^^^^^^^^\n            // Ref: CMultitaskingViewFrame::v_WndProc()\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x00\\x71\\x00\\x00\\x00\\x54\\x00\\x00\\x40\\xF9\\xE3\\x03\\x00\\xAA\\xE2\\x03\\x00\\xAA\\xE1\\x03\\x00\\x2A\",\n                \"xx??xx??xxxx?xxx?xxx?x\"\n            );\n            if (match)\n            {\n                match += 22;\n                pOffsets[0] = (DWORD)FileOffsetToRVA(pFile, (PBYTE)ARM64_FollowBL((DWORD*)match) - pFile);\n            }\n#endif\n            if (pOffsets[0] && pOffsets[0] != 0xFFFFFFFF)\n            {\n                printf(\"CImmersiveContextMenuOwnerDrawHelper::s_ContextMenuWndProc() = %lX\\n\", pOffsets[0]);\n            }\n        }\n        if (!pOffsets[1] || pOffsets[1] == 0xFFFFFFFF)\n        {\n            // Don't forget to sync with HookImmersiveMenuFunctions in dllmain.c!\n#if defined(_M_X64)\n            // Don't worry if this is too long, this works on 17763 ~ 27943\n            // 40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B ? ? ? ? ? 41 8B C1\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x40\\x55\\x53\\x56\\x57\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\\x8D\\xAC\\x24\\x00\\x00\\x00\\x00\\x48\\x81\\xEC\\x00\\x00\\x00\\x00\\x48\\x8B\\x05\\x00\\x00\\x00\\x00\\x48\\x33\\xC4\\x48\\x89\\x85\\x00\\x00\\x00\\x00\\x4C\\x8B\\x00\\x00\\x00\\x00\\x00\\x41\\x8B\\xC1\",\n                \"xxxxxxxxxxxxxxxxx????xxx????xxx????xxxxxx????xx?????xxx\"\n            );\n            if (match)\n            {\n                pOffsets[1] = (DWORD)(match - pFile);\n            }\n#elif defined(_M_ARM64)\n            // 40 F9 43 03 1C 32 E4 03 ?? AA ?? ?? FF 97\n            //                               ^^^^^^^^^^^\n            // Ref: ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu()\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x40\\xF9\\x43\\x03\\x1C\\x32\\xE4\\x03\\x00\\xAA\\x00\\x00\\xFF\\x97\",\n                \"xxxxxxxx?x??xx\"\n            );\n            if (match)\n            {\n                match += 10;\n                pOffsets[1] = (DWORD)FileOffsetToRVA(pFile, (PBYTE)ARM64_FollowBL((DWORD*)match) - pFile);\n            }\n            else\n            {\n                // 43 03 1C 32 E4 03 ?? AA E2 03 ?? AA ?? ?? FF 97 // 27938\n                //                                     ^^^^^^^^^^^\n                // Ref: ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu()\n                match = (PBYTE)FindPattern(\n                    pSearchBegin, cbSearch,\n                    \"\\x43\\x03\\x1C\\x32\\xE4\\x03\\x00\\xAA\\xE2\\x03\\x00\\xAA\\x00\\x00\\xFF\\x97\",\n                    \"xxxxxx?xxx?x??xx\"\n                );\n                if (match)\n                {\n                    match += 12;\n                    pOffsets[1] = (DWORD)FileOffsetToRVA(pFile, (PBYTE)ARM64_FollowBL((DWORD*)match) - pFile);\n                }\n            }\n#endif\n            if (pOffsets[1] && pOffsets[1] != 0xFFFFFFFF)\n            {\n                printf(\"ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu() = %lX\\n\", pOffsets[1]);\n            }\n        }\n        if (!pOffsets[2] || pOffsets[2] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // 48 89 5C 24 ? 48 89 7C 24 ? 55 48 8B EC 48 83 EC 60 48 8B FA 48 8B D9 E8\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x48\\x89\\x5C\\x24\\x00\\x48\\x89\\x7C\\x24\\x00\\x55\\x48\\x8B\\xEC\\x48\\x83\\xEC\\x60\\x48\\x8B\\xFA\\x48\\x8B\\xD9\\xE8\",\n                \"xxxx?xxxx?xxxxxxxxxxxxxxx\"\n            );\n            if (match)\n            {\n                pOffsets[2] = (DWORD)(match - pFile);\n            }\n#elif defined(_M_ARM64)\n            // 7F 23 03 D5 F3 53 BF A9 FD 7B BB A9 FD 03 00 91 ?? 03 00 AA ?? 03 01 AA ?? ?? ?? ?? FF ?? 03 A9\n            // ----------- PACIBSP, don't scan for this because it's everywhere\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\xF3\\x53\\xBF\\xA9\\xFD\\x7B\\xBB\\xA9\\xFD\\x03\\x00\\x91\\x00\\x03\\x00\\xAA\\x00\\x03\\x01\\xAA\\x00\\x00\\x00\\x00\\xFF\\x00\\x03\\xA9\",\n                \"xxxxxxxxxxxx?xxx?xxx????x?xx\"\n            );\n            if (match)\n            {\n                match -= 4;\n                pOffsets[2] = (DWORD)FileOffsetToRVA(pFile, match - pFile);\n            }\n#endif\n            if (pOffsets[2] && pOffsets[2] != 0xFFFFFFFF)\n            {\n                printf(\"ImmersiveContextMenuHelper::RemoveOwnerDrawFromMenu() = %lX\\n\", pOffsets[2]);\n            }\n        }\n        if (!pOffsets[3] || pOffsets[3] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // 48 8B ? E8 ? ? ? ? 4C 8B ? 48 8B ? 48 8B CE E8 ? ? ? ? 90\n            //                                                ^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x48\\x8B\\x00\\xE8\\x00\\x00\\x00\\x00\\x4C\\x8B\\x00\\x48\\x8B\\x00\\x48\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x90\",\n                \"xx?x????xx?xx?xxxx????x\"\n            );\n            if (match)\n            {\n                match += 17;\n                pOffsets[3] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n            }\n            else\n            {\n                // 48 8B ? E8 ? ? ? ? 4C 8D 47 ? 48 8B ? 48 8B CE E8 ? ? ? ? 90\n                //                                                   ^^^^^^^\n                match = (PBYTE)FindPattern(\n                    pSearchBegin, cbSearch,\n                    \"\\x48\\x8B\\xCB\\xE8\\x00\\x00\\x00\\x00\\x4C\\x8D\\x47\\x00\\x48\\x8B\\x00\\x48\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x90\",\n                    \"xx?x????xxx?xx?xxxx????x\"\n                );\n                if (match)\n                {\n                    match += 18;\n                    pOffsets[3] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n                }\n            }\n#elif defined(_M_ARM64)\n            // ?? 0A 40 F9 ?? 02 40 F9 ?? ?? 00 F9 ?? ?? ?? ?? ?? 62 00 91 ?? ?? 00 91 E0 03 ?? AA ?? ?? ?? ?? 1F 20 03 D5\n            //                                                                                     ^^^^^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x0A\\x40\\xF9\\x00\\x02\\x40\\xF9\\x00\\x00\\x00\\xF9\\x00\\x00\\x00\\x00\\x00\\x62\\x00\\x91\\x00\\x00\\x00\\x91\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x1F\\x20\\x03\\xD5\",\n                \"xxx?xxx??xx?????xxx??xxxx?x????xxxx\"\n            );\n            if (match)\n            {\n                match += 27;\n                pOffsets[3] = (DWORD)FileOffsetToRVA(pFile, (PBYTE)ARM64_FollowBL((DWORD*)match) - pFile);\n            }\n#endif\n            if (pOffsets[3] && pOffsets[3] != 0xFFFFFFFF)\n            {\n                printf(\"CLauncherTipContextMenu::_ExecuteShutdownCommand() = %lX\\n\", pOffsets[3]);\n            }\n        }\n        if (!pOffsets[4] || pOffsets[4] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // Cobalt:\n            // 48 89 46 ? 48 8B CB E8 ? ? ? ? 48 8B D3 48 8B CF E8 ? ? ? ? 90\n            //                                                     ^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x48\\x89\\x46\\x00\\x48\\x8B\\xCB\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\xD3\\x48\\x8B\\xCF\\xE8\\x00\\x00\\x00\\x00\\x90\",\n                \"xxx?xxxx????xxxxxxx????x\"\n            );\n            if (match)\n            {\n                match += 18;\n                pOffsets[4] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n            }\n            else\n            {\n                // Nickel+:\n                // 48 89 03 48 8B CB E8 ? ? ? ? 48 8B D3 48 8B CF E8 ? ? ? ? 90\n                //                                                   ^^^^^^^\n                match = (PBYTE)FindPattern(\n                    pSearchBegin, cbSearch,\n                    \"\\x48\\x89\\x03\\x48\\x8B\\xCB\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\xD3\\x48\\x8B\\xCF\\xE8\\x00\\x00\\x00\\x00\\x90\",\n                    \"xxxxxxx????xxxxxxx????x\"\n                );\n                if (match)\n                {\n                    match += 17;\n                    pOffsets[4] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n                }\n            }\n#elif defined(_M_ARM64)\n            // 08 09 40 F9 ?? ?? 00 F9 ?? ?? ?? ?? ?? ?? 00 91 E0 03 ?? AA ?? ?? ?? ?? 1F 20 03 D5\n            //                                                             ^^^^^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x08\\x09\\x40\\xF9\\x00\\x00\\x00\\xF9\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x91\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x00\\x1F\\x20\\x03\\xD5\",\n                \"xxxx??xx??????xxxx?x????xxxx\"\n            );\n            if (match)\n            {\n                match += 20;\n                pOffsets[4] = (DWORD)FileOffsetToRVA(pFile, (PBYTE)ARM64_FollowBL((DWORD*)match) - pFile);\n            }\n#endif\n            if (pOffsets[4] && pOffsets[4] != 0xFFFFFFFF)\n            {\n                printf(\"CLauncherTipContextMenu::_ExecuteCommand() = %lX\\n\", pOffsets[4]);\n            }\n        }\n        if (!pOffsets[5] || pOffsets[5] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // Ref: CMultitaskingViewManager::_CreateMTVHost()\n            // Inlined GetMTVHostKind()\n            // 4C 89 74 24 ?? ?? 8B ?? ?? 8B ?? 8B D7 48 8B CE E8 ?? ?? ?? ?? 8B\n            //                                                    ^^^^^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x4C\\x89\\x74\\x24\\x00\\x00\\x8B\\x00\\x00\\x8B\\x00\\x8B\\xD7\\x48\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x8B\",\n                \"xxxx??x??x?xxxxxx????x\"\n            );\n            if (match)\n            {\n                match += 16;\n                pOffsets[5] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n            }\n            else\n            {\n                // Non-inlined GetMTVHostKind()\n                // 8B CF E8 ?? ?? ?? ?? ?? 89 ?? 24 ?? ?? 8B ?? ?? 8B ?? 8B D7 48 8B CE 83 F8 01 <jnz>\n                match = (PBYTE)FindPattern(\n                    pSearchBegin, cbSearch,\n                    \"\\x8B\\xCF\\xE8\\x00\\x00\\x00\\x00\\x00\\x89\\x00\\x24\\x00\\x00\\x8B\\x00\\x00\\x8B\\x00\\x8B\\xD7\\x48\\x8B\\xCE\\x83\\xF8\\x01\",\n                    \"xxx?????x?x??x??x?xxxxxxxx\"\n                );\n                if (match)\n                {\n                    PBYTE target = nullptr;\n                    DWORD jnzSize = 0;\n                    if (FollowJnz(match + 26, &target, &jnzSize))\n                    {\n                        match += 26 + jnzSize;\n                        if (match[0] == 0xE8)\n                        {\n                            pOffsets[5] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n                        }\n                    }\n                }\n            }\n#elif defined(_M_ARM64)\n            // F3 53 BE A9  F5 5B 01 A9  FD 7B ?? A9  FD 03 00 91  30 00 80 92  ?? 03 04 AA  B0 ?? 00 F9  ?? 03 00 AA  ?? 02 00 F9  ?? 2E 40 F9  ?? 03 03 AA  ?? 23 02 A9  ?? ?? ?? B5\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\xF3\\x53\\xBE\\xA9\\xF5\\x5B\\x01\\xA9\\xFD\\x7B\\x00\\xA9\\xFD\\x03\\x00\\x91\\x30\\x00\\x80\\x92\\x00\\x03\\x04\\xAA\\xB0\\x00\\x00\\xF9\\x00\\x03\\x00\\xAA\\x00\\x02\\x00\\xF9\\x00\\x2E\\x40\\xF9\\x00\\x03\\x03\\xAA\\x00\\x23\\x02\\xA9\\x00\\x00\\x00\\xB5\",\n                \"xxxxxxxxxx?xxxxxxxxx?xxxx?xx?xxx?xxx?xxx?xxx?xxx???x\"\n            );\n            if (match)\n            {\n                pOffsets[5] = (DWORD)FileOffsetToRVA(pFile, match - 4 - pFile);\n            }\n#endif\n            if (pOffsets[5] && pOffsets[5] != 0xFFFFFFFF)\n            {\n                printf(\"CMultitaskingViewManager::_CreateXamlMTVHost() = %lX\\n\", pOffsets[5]);\n            }\n        }\n        if (!pOffsets[6] || pOffsets[6] == 0xFFFFFFFF)\n        {\n#if defined(_M_X64)\n            // Ref: CMultitaskingViewManager::_CreateMTVHost()\n            // Inlined GetMTVHostKind()\n            // 4C 89 74 24 ?? ?? 8B ?? ?? 8B ?? 8B D7 48 8B CE E8 ?? ?? ?? ?? 90\n            //                                                    ^^^^^^^^^^^\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x4C\\x89\\x74\\x24\\x00\\x00\\x8B\\x00\\x00\\x8B\\x00\\x8B\\xD7\\x48\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x90\",\n                \"xxxx??x??x?xxxxxx????x\"\n            );\n            if (match)\n            {\n                match += 16;\n                pOffsets[6] = (DWORD)(match + 5 + *(int*)(match + 1) - pFile);\n            }\n            else\n            {\n                // Non-inlined GetMTVHostKind()\n                // 8B CF E8 ?? ?? ?? ?? ?? 89 ?? 24 ?? ?? 8B ?? ?? 8B ?? 8B D7 48 8B CE 83 F8 01 <jnz>\n                match = (PBYTE)FindPattern(\n                    pSearchBegin, cbSearch,\n                    \"\\x8B\\xCF\\xE8\\x00\\x00\\x00\\x00\\x00\\x89\\x00\\x24\\x00\\x00\\x8B\\x00\\x00\\x8B\\x00\\x8B\\xD7\\x48\\x8B\\xCE\\x83\\xF8\\x01\",\n                    \"xxx?????x?x??x??x?xxxxxxxx\"\n                );\n                if (match)\n                {\n                    PBYTE target = nullptr;\n                    DWORD jnzSize = 0;\n                    if (FollowJnz(match + 26, &target, &jnzSize) && target[0] == 0xE8)\n                    {\n                        pOffsets[6] = (DWORD)(target + 5 + *(int*)(target + 1) - pFile);\n                    }\n                }\n            }\n#elif defined(_M_ARM64)\n            // F3 53 BC A9  F5 5B 01 A9  F7 13 00 F9  F9 17 00 F9  FB 1B 00 F9  FD 7B BC A9  FD 03 00 91  FF ?? 00 D1  30 00 80 92  ?? 03 04 AA\n            PBYTE match = (PBYTE)FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\xF3\\x53\\xBC\\xA9\\xF5\\x5B\\x01\\xA9\\xF7\\x13\\x00\\xF9\\xF9\\x17\\x00\\xF9\\xFB\\x1B\\x00\\xF9\\xFD\\x7B\\xBC\\xA9\\xFD\\x03\\x00\\x91\\xFF\\x00\\x00\\xD1\\x30\\x00\\x80\\x92\\x00\\x03\\x04\\xAA\",\n                \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx?xxxxxx?xxx\"\n            );\n            if (match)\n            {\n                pOffsets[6] = (DWORD)FileOffsetToRVA(pFile, match - 4 - pFile);\n            }\n#endif\n            if (pOffsets[6] && pOffsets[6] != 0xFFFFFFFF)\n            {\n                printf(\"CMultitaskingViewManager::_CreateDCompMTVHost() = %lX\\n\", pOffsets[6]);\n            }\n        }\n    }\n\ncleanup:\n    free(pFile);\n    CloseHandle(hFile);\n}\n\nextern \"C\" void RunTwinUIPCShellPatches(symbols_addr* symbols_PTRS)\n{\n    HMODULE hTwinuiPcshell = LoadLibraryW(L\"twinui.pcshell.dll\");\n\n    PBYTE pTwinuiPcshellText;\n    DWORD cbTwinuiPcshellText;\n    if (!TextSectionBeginAndSize(hTwinuiPcshell, &pTwinuiPcshellText, &cbTwinuiPcshellText))\n        return;\n\n    // ZeroMemory(symbols_PTRS->twinui_pcshell_PTRS, sizeof(symbols_PTRS->twinui_pcshell_PTRS)); // Uncomment for testing\n    TryToFindTwinuiPCShellOffsets(symbols_PTRS->twinui_pcshell_PTRS);\n\n    if (symbols_PTRS->twinui_pcshell_PTRS[0] && symbols_PTRS->twinui_pcshell_PTRS[0] != 0xFFFFFFFF)\n    {\n        CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc = (decltype(CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[0]);\n    }\n\n    if (symbols_PTRS->twinui_pcshell_PTRS[1] && symbols_PTRS->twinui_pcshell_PTRS[1] != 0xFFFFFFFF)\n    {\n        ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc = (decltype(ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[1]);\n    }\n\n    if (symbols_PTRS->twinui_pcshell_PTRS[2] && symbols_PTRS->twinui_pcshell_PTRS[2] != 0xFFFFFFFF)\n    {\n        ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc = (decltype(ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[2]);\n    }\n\n    if (symbols_PTRS->twinui_pcshell_PTRS[3] && symbols_PTRS->twinui_pcshell_PTRS[3] != 0xFFFFFFFF)\n    {\n        CLauncherTipContextMenu_ExecuteShutdownCommandFunc = (decltype(CLauncherTipContextMenu_ExecuteShutdownCommandFunc))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[3]);\n    }\n\n    if (symbols_PTRS->twinui_pcshell_PTRS[4] && symbols_PTRS->twinui_pcshell_PTRS[4] != 0xFFFFFFFF)\n    {\n        CLauncherTipContextMenu_ExecuteCommandFunc = (decltype(CLauncherTipContextMenu_ExecuteCommandFunc))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[4]);\n    }\n\n    int rv;\n\n    if (IsWindows11())\n    {\n        if (bOldTaskbar)\n        {\n            typedef HRESULT (WINAPI *DllGetClassObject_t)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);\n            DllGetClassObject_t pfnDllGetClassObject = (DllGetClassObject_t)GetProcAddress(hTwinuiPcshell, \"DllGetClassObject\");\n            if (pfnDllGetClassObject)\n            {\n                IClassFactory* pFactory;\n                HRESULT hr = pfnDllGetClassObject(__uuidof(CLauncherTipContextMenu), IID_PPV_ARGS(&pFactory));\n                if (SUCCEEDED(hr))\n                {\n                    void** vtable = *(void***)pFactory;\n                    REPLACE_VTABLE_ENTRY(vtable, 3, CLauncherTipContextMenu_CreateInstance_IClassFactory_);\n                    pFactory->Release();\n                }\n            }\n        }\n\n        rv = -1;\n        if (symbols_PTRS->twinui_pcshell_PTRS[5] && symbols_PTRS->twinui_pcshell_PTRS[5] != 0xFFFFFFFF)\n        {\n            twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc = (decltype(twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc))\n                ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[6]);\n            twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc = (decltype(twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc))\n                ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[5]);\n            rv = funchook_prepare(\n                funchook,\n                (void**)&twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc,\n                twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook\n            );\n        }\n        if (rv != 0)\n        {\n            printf(\"Failed to hook CMultitaskingViewManager::_CreateXamlMTVHost(). rv = %d\\n\", rv);\n        }\n    }\n\n    /*rv = -1;\n    if (symbols_PTRS->twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT - 1] && symbols_PTRS->twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT - 1] != 0xFFFFFFFF)\n    {\n        winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc = (INT64(*)(void*, POINT*))\n            ((uintptr_t)hTwinuiPcshell + symbols_PTRS->twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT - 1]);\n        rv = funchook_prepare(\n            funchook,\n            (void**)&winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageFunc,\n            winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHook\n        );\n    }\n    if (rv != 0)\n    {\n        printf(\"Failed to hook winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessage(). rv = %d\\n\", rv);\n    }*/\n\n#if USE_MOMENT_3_FIXES_ON_MOMENT_2\n    // Use this only for testing, since the RtlQueryFeatureConfiguration() hook is perfect.\n    // Only tested on 22621.1992.\n    BOOL bPerformMoment2Patches = IsWindows11Version22H2Build1413OrHigher();\n#else\n    // This is the only way to fix stuff since the flag \"26008830\" and the code when it's not enabled are gone.\n    // Tested on:\n    // - 22621.2134, 22621.2283, 22621.2359 (RP)\n    // - 23545.1000\n    BOOL bPerformMoment2Patches = IsWindows11Version22H2Build2134OrHigher();\n#endif\n    if (bOldTaskbar != 1)\n    {\n        bPerformMoment2Patches = FALSE;\n    }\n    if (bPerformMoment2Patches)\n    {\n        // Fix flyout placement: Our goal with these patches is to get `mi.rcWork` assigned\n        Moment2PatchActionCenter(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText);\n        Moment2PatchControlCenter(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText);\n        Moment2PatchToastCenter(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText);\n\n        // Fix task view\n        Moment2PatchTaskView(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText);\n\n        // Fix volume and brightness popups\n        HMODULE hHardwareConfirmator = LoadLibraryExW(L\"Windows.Internal.HardwareConfirmator.dll\", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);\n\n        PBYTE pHardwareConfirmatorText;\n        DWORD cbHardwareConfirmatorText;\n        if (TextSectionBeginAndSize(hHardwareConfirmator, &pHardwareConfirmatorText, &cbHardwareConfirmatorText))\n        {\n            Moment2PatchHardwareConfirmator(hHardwareConfirmator, pHardwareConfirmatorText, cbHardwareConfirmatorText);\n        }\n\n        // Fix pen menu\n#if defined(_M_X64)\n        // 48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 50 49 8B ? 48 81 C1\n        PBYTE match = (PBYTE)FindPattern(\n            pTwinuiPcshellText,\n            cbTwinuiPcshellText,\n            \"\\x48\\x89\\x5C\\x24\\x00\\x48\\x89\\x74\\x24\\x00\\x57\\x48\\x83\\xEC\\x50\\x49\\x8B\\x00\\x48\\x81\\xC1\",\n            \"xxxx?xxxx?xxxxxxx?xxx\"\n        );\n#elif defined(_M_ARM64)\n        PBYTE match = nullptr;\n#endif\n        rv = -1;\n        if (match)\n        {\n            twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc = (decltype(twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc))match;\n            printf(\"PenMenuSystemTrayManager::GetDynamicSystemTrayHeightForMonitor() = %llX\\n\", match - (PBYTE)hTwinuiPcshell);\n            rv = funchook_prepare(\n               funchook,\n               (void**)&twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorFunc,\n               twinui_pcshell_PenMenuSystemTrayManager__GetDynamicSystemTrayHeightForMonitorHook\n           );\n        }\n        if (rv != 0)\n        {\n            printf(\"Failed to hook PenMenuSystemTrayManager::GetDynamicSystemTrayHeightForMonitor(). rv = %d\\n\", rv);\n        }\n    }\n\n    if ((global_rovi.dwBuildNumber > 22000 || global_rovi.dwBuildNumber == 22000 && global_ubr >= 65) // Allow on 22000.65+\n        && (bOldTaskbar || dwStartShowClassicMode))\n    {\n        // Make sure crash counter is enabled. If one of the patches make Explorer crash while the start menu is open,\n        // we don't want to softlock the user. The system reopens the start menu if Explorer terminates while it's open.\n        if (IsCrashCounterEnabled())\n        {\n            if (FixStartMenuAnimation(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText))\n            {\n                ReportSuccessfulAnimationPatching();\n            }\n        }\n    }\n\n    if (IsWindows11Version22H2OrHigher() && bOldTaskbar)\n    {\n        // Fix broken taskbar jump list positioning caused by 40874676\n        FixJumpViewPositioning(hTwinuiPcshell, pTwinuiPcshellText, cbTwinuiPcshellText);\n    }\n\n    VnPatchIAT_NonInline(hTwinuiPcshell, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegGetValueW\", (uintptr_t)twinuipcshell_RegGetValueW);\n    printf(\"Setup twinui.pcshell functions done\\n\");\n}\n"
  },
  {
    "path": "ExplorerPatcher/def.h",
    "content": "#ifndef _H_DEF_H_\r\n#define _H_DEF_H_\r\n#define APPID L\"Microsoft.Windows.Explorer\"\r\n#define REGPATH \"Software\\\\ExplorerPatcher\"\r\n#define REGPATH_OLD \"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\ExplorerPatcher\"\r\n#define REGPATH_STARTMENU REGPATH_OLD\r\n#define SPECIAL_FOLDER CSIDL_PROGRAM_FILES\r\n#define SPECIAL_FOLDER_LEGACY CSIDL_APPDATA\r\n#define PRODUCT_NAME \"ExplorerPatcher\"\r\n#define PRODUCT_PUBLISHER \"VALINET Solutions SRL\"\r\n#define APP_RELATIVE_PATH \"\\\\\" PRODUCT_NAME\r\n#define EP_CLSID_LITE \"D17F1E1A-5919-4427-8F89-A1A8503CA3EB\"\r\n#define EP_CLSID \"{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}\"\r\n#define DOSMODE_OFFSET 78\r\n#ifndef _M_ARM64\r\n#define SETUP_UTILITY_NAME \"ep_setup.exe\"\r\n#else\r\n#define SETUP_UTILITY_NAME \"ep_setup_arm64.exe\"\r\n#endif\r\n#define TOAST_BUFSIZ 1536\r\n#define SEH_REGPATH \"Control Panel\\\\Quick Actions\\\\Control Center\\\\QuickActionsStateCapture\\\\ExplorerPatcher\"\r\n#define EP_SETUP_HELPER_SWITCH \"/CreateExplorerShellUnelevatedAfterServicing\"\r\n#define EP_DWM_SERVICENAME \"ep_dwm_\" EP_CLSID_LITE\r\n#define EP_DWM_EVENTNAME \"Global\\\\ep_dwm_2_\" EP_CLSID_LITE\r\n#define EP_SETUP_EVENTNAME \"Global\\\\ep_setup_\" EP_CLSID_LITE\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/dllmain.c",
    "content": "#if WITH_MAIN_PATCHER\n#include \"hooking.h\"\n#endif\n#include <initguid.h>\n#include <stdio.h>\n#include <stdbool.h>\n#include <Windows.h>\n#include <Shlwapi.h>\n#pragma comment(lib, \"Shlwapi.lib\")\n#include <windowsx.h>\n#include <Uxtheme.h>\n#pragma comment(lib, \"UxTheme.lib\")\n#include <Shlobj_core.h>\n#include <propvarutil.h>\n#pragma comment(lib, \"Propsys.lib\")\n#include <commctrl.h>\n#pragma comment(lib, \"Comctl32.lib\")\n#include <dwmapi.h>\n#pragma comment(lib, \"Dwmapi.lib\")\n#include <roapi.h>\n#include <ShellScalingApi.h>\n#include <DbgHelp.h>\n#pragma comment(lib, \"Dbghelp.lib\")\n#include <tlhelp32.h>\n#include <UIAutomationClient.h>\n#include <math.h>\n#include \"lvt.h\"\n#if WITH_MAIN_PATCHER\n#include <valinet/pdb/pdb.h>\n#endif\n#if defined(DEBUG) | defined(_DEBUG)\n#define _LIBVALINET_DEBUG_HOOKING_IATPATCH\n#endif\n#include <valinet/hooking/iatpatch.h>\n#include <valinet/utility/memmem.h>\n#include \"../ep_weather_host/ep_weather.h\"\n#if WITH_MAIN_PATCHER\n#include \"../ep_weather_host/ep_weather_host_h.h\"\nIEPWeather* epw = NULL;\nCRITICAL_SECTION lock_epw;\nint prev_total_h = 0;\nHWND PeopleButton_LastHWND = NULL;\n#endif\n#include \"osutility.h\"\nHANDLE hServiceWindowThread = NULL;\n//#pragma comment(lib, \"Winmm.lib\")\n#if !WITH_MAIN_PATCHER\nRTL_OSVERSIONINFOW global_rovi;\nDWORD32 global_ubr;\n#endif\n#include <featurestagingapi.h>\n#ifndef WITH_SMA_PATCH_REPORT\n#define WITH_SMA_PATCH_REPORT 1\n#endif\n#if WITH_SMA_PATCH_REPORT\n#include <userenv.h>\n#pragma comment(lib, \"Userenv.lib\")\n#endif\n\n#define CHECKFOREGROUNDELAPSED_TIMEOUT 300\n#define POPUPMENU_SAFETOREMOVE_TIMEOUT 300\n#define POPUPMENU_BLUETOOTH_TIMEOUT 700\n#define POPUPMENU_PNIDUI_TIMEOUT 300\n#define POPUPMENU_SNDVOLSSO_TIMEOUT 300\n#define POPUPMENU_INPUTSWITCH_TIMEOUT 700\n#define POPUPMENU_WINX_TIMEOUT 700\n#define POPUPMENU_EX_ELAPSED 300\n\n// Only use this for developing fixes for 22621.2134+ using 22621.1413-1992.\n#define USE_MOMENT_3_FIXES_ON_MOMENT_2 0\n\nBOOL bIsExplorerProcess = FALSE;\nBOOL bInstanced = FALSE;\nHWND archivehWnd;\nDWORD bOldTaskbar = -1;\nDWORD bWasOldTaskbarSet = FALSE;\nDWORD bAllocConsole = FALSE;\nDWORD bHideExplorerSearchBar = FALSE;\nDWORD bShrinkExplorerAddressBar = FALSE;\nDWORD bMicaEffectOnTitlebar = FALSE;\nDWORD bHideIconAndTitleInExplorer = FALSE;\nDWORD bHideControlCenterButton = FALSE;\nDWORD bFlyoutMenus = TRUE;\nDWORD bCenterMenus = TRUE;\nDWORD bSkinMenus = TRUE;\nDWORD bSkinIcons = TRUE;\nDWORD bReplaceNetwork = FALSE;\nDWORD bEnableArchivePlugin = FALSE;\nDWORD bMonitorOverride = TRUE;\nDWORD bOpenAtLogon = FALSE;\nDWORD bClockFlyoutOnWinC = FALSE;\nDWORD bUseClassicDriveGrouping = FALSE;\nDWORD dwFileExplorerCommandUI = 9999;\nDWORD bLegacyFileTransferDialog = FALSE;\nDWORD bDisableImmersiveContextMenu = FALSE;\nDWORD bClassicThemeMitigations = FALSE;\nDWORD bWasClassicThemeMitigationsSet = FALSE;\nDWORD bHookStartMenu = TRUE;\nDWORD bPropertiesInWinX = FALSE;\nDWORD bNoMenuAccelerator = FALSE;\nDWORD dwIMEStyle = 0;\nDWORD dwTaskbarAl = 1;\nDWORD bShowUpdateToast = FALSE;\nDWORD bToolbarSeparators = FALSE;\nDWORD bTaskbarAutohideOnDoubleClick = FALSE;\nDWORD dwOrbStyle = 0;\nDWORD bEnableSymbolDownload = TRUE;\nDWORD dwAltTabSettings = 0;\nDWORD bDisableAeroSnapQuadrants = FALSE;\nDWORD dwSnapAssistSettings = 0;\nDWORD dwStartShowClassicMode = 0;\nBOOL bDoNotRedirectSystemToSettingsApp = FALSE;\nBOOL bDoNotRedirectProgramsAndFeaturesToSettingsApp = FALSE;\nBOOL bDoNotRedirectDateAndTimeToSettingsApp = FALSE;\nBOOL bDoNotRedirectNotificationIconsToSettingsApp = FALSE;\nBOOL bDisableOfficeHotkeys = FALSE;\nBOOL bDisableWinFHotkey = FALSE;\nDWORD bNoPropertiesInContextMenu = FALSE;\nHMODULE hModule = NULL;\nHANDLE hShell32 = NULL;\n// HANDLE hDelayedInjectionThread = NULL;\nHANDLE hSwsSettingsChanged = NULL;\nHANDLE hSwsOpacityMaybeChanged = NULL;\nHANDLE hWin11AltTabInitialized = NULL;\nBYTE* lpShouldDisplayCCButton = NULL;\nHANDLE hCanStartSws = NULL;\nDWORD dwWeatherViewMode = EP_WEATHER_VIEW_ICONTEXT;\nDWORD dwWeatherTemperatureUnit = EP_WEATHER_TUNIT_CELSIUS;\nDWORD dwWeatherUpdateSchedule = EP_WEATHER_UPDATE_NORMAL;\nDWORD bWeatherFixedSize = FALSE;\nDWORD dwWeatherTheme = 0;\nDWORD dwWeatherGeolocationMode = 0;\nDWORD dwWeatherWindowCornerPreference = DWMWCP_ROUND;\nDWORD dwWeatherDevMode = FALSE;\nDWORD dwWeatherIconPack = EP_WEATHER_ICONPACK_MICROSOFT;\nDWORD dwWeatherToLeft = 0;\nDWORD dwWeatherContentsMode = 0;\nDWORD dwWeatherZoomFactor = 0;\nWCHAR* wszWeatherTerm = NULL;\nWCHAR* wszWeatherLanguage = NULL;\nWCHAR* wszEPWeatherKillswitch = NULL;\nHANDLE hEPWeatherKillswitch = NULL;\nDWORD bWasPinnedItemsActAsQuickLaunch = FALSE;\nDWORD bPinnedItemsActAsQuickLaunch = FALSE;\nDWORD bWasRemoveExtraGapAroundPinnedItems = FALSE;\nDWORD bRemoveExtraGapAroundPinnedItems = FALSE;\nDWORD dwUndeadStartCorner = FALSE;\nDWORD dwOldTaskbarAl = 0b110;\nDWORD dwMMOldTaskbarAl = 0b110;\nDWORD dwTaskbarSmallIcons = FALSE;\nDWORD dwShowTaskViewButton = FALSE;\nDWORD dwSearchboxTaskbarMode = FALSE;\nDWORD dwTaskbarDa = FALSE;\nDWORD bDisableSpotlightIcon = FALSE;\nDWORD dwSpotlightDesktopMenuMask = 0;\nDWORD dwSpotlightUpdateSchedule = 0;\nint Code = 0;\nHRESULT InjectStartFromExplorer();\nBOOL InvokeClockFlyout();\nvoid WINAPI Explorer_RefreshUI(int unused);\nint (*SHWindowsPolicy)(REFIID);\n\n#define ORB_STYLE_WINDOWS10 0\n#define ORB_STYLE_WINDOWS11 1\n#define ORB_STYLE_TRANSPARENT 2\ntypedef struct _OrbInfo\n{\n    HTHEME hTheme;\n    UINT dpi;\n} OrbInfo;\n\nvoid* P_Icon_Light_Search = NULL;\nDWORD S_Icon_Light_Search = 0;\n\nvoid* P_Icon_Light_TaskView = NULL;\nDWORD S_Icon_Light_TaskView = 0;\n\nvoid* P_Icon_Light_Widgets = NULL;\nDWORD S_Icon_Light_Widgets = 0;\n\nvoid* P_Icon_Dark_Search = NULL;\nDWORD S_Icon_Dark_Search = 0;\n\nvoid* P_Icon_Dark_TaskView = NULL;\nDWORD S_Icon_Dark_TaskView = 0;\n\nvoid* P_Icon_Dark_Widgets = NULL;\nDWORD S_Icon_Dark_Widgets = 0;\n\nBOOL g_bIsDesktopRaised = FALSE;\n\n#include \"utility.h\"\n#include \"Localization.h\"\n#include \"resource.h\"\n#include \"../ep_gui/resources/EPSharedResources.h\"\n#ifdef USE_PRIVATE_INTERFACES\n#include \"ep_private.h\"\n#endif\n#if WITH_MAIN_PATCHER\n#include \"symbols.h\"\n#include \"dxgi_imp.h\"\n#include \"ArchiveMenu.h\"\n#include \"InputSwitch.h\"\n#include \"StartupSound.h\"\n#include \"StartMenu.h\"\n#include \"TaskbarCenter.h\"\n#include \"../libs/sws/SimpleWindowSwitcher/sws_WindowSwitcher.h\"\n#endif\n#include \"SettingsMonitor.h\"\n#include \"HideExplorerSearchBar.h\"\n#include \"ImmersiveFlyouts.h\"\n#include \"updates.h\"\nDWORD dwUpdatePolicy = UPDATE_POLICY_DEFAULT;\nwchar_t* EP_TASKBAR_LENGTH_PROP_NAME = L\"EPTBLEN\";\n\n#if WITH_MAIN_PATCHER\n#define MAX_NUM_MONITORS 30\nMonitorListEntry hMonitorList[MAX_NUM_MONITORS];\nDWORD dwMonitorCount = 0;\n#endif\n\nHRESULT WINAPI _DllRegisterServer();\nHRESULT WINAPI _DllUnregisterServer();\nHRESULT WINAPI _DllCanUnloadNow();\nHRESULT WINAPI _DllGetClassObject(\n    REFCLSID rclsid,\n    REFIID   riid,\n    LPVOID* ppv\n);\n\n// {09717D01-5D10-4FB5-BD05-46380B5165AA}\n#define CLSID_EPStart10_TEXT \"{A6EA9C2D-4982-4827-9204-0AC532959F6D}\"\n#define EPStart10_AnimationsPatched \"EPStart10_AnimationsPatched_\" CLSID_EPStart10_TEXT\nDEFINE_GUID(CLSID_EPStart10,\n    0x9717d01, 0x5d10, 0x4fb5, 0xbd, 0x5, 0x46, 0x38, 0xb, 0x51, 0x65, 0xaa);\n\n#pragma region \"Generics\"\n#if WITH_MAIN_PATCHER\nHWND GetMonitorInfoFromPointForTaskbarFlyoutActivation(POINT ptCursor, DWORD dwFlags, LPMONITORINFO lpMi)\n{\n    HMONITOR hMonitor = MonitorFromPoint(ptCursor, dwFlags);\n    HWND hWnd = NULL;\n    do\n    {\n        hWnd = FindWindowEx(\n            NULL,\n            hWnd,\n            L\"Shell_SecondaryTrayWnd\",\n            NULL\n        );\n        if (MonitorFromWindow(hWnd, dwFlags) == hMonitor)\n        {\n            if (lpMi)\n            {\n                GetMonitorInfo(\n                    MonitorFromPoint(\n                        ptCursor,\n                        dwFlags\n                    ),\n                    lpMi\n                );\n            }\n            break;\n        }\n    } while (hWnd);\n    if (!hWnd)\n    {\n        hWnd = FindWindowEx(\n            NULL,\n            NULL,\n            L\"Shell_TrayWnd\",\n            NULL\n        );\n        //ptCursor.x = 0;\n        //ptCursor.y = 0;\n        if (lpMi)\n        {\n            GetMonitorInfo(\n                MonitorFromWindow(\n                    hWnd,\n                    dwFlags\n                ),\n                lpMi\n            );\n        }\n    }\n    return hWnd;\n}\n\nPOINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust, BOOL bToRight)\n{\n    if (lpBottom) *lpBottom = FALSE;\n    if (lpRight) *lpRight = FALSE;\n    POINT point;\n    point.x = 0;\n    point.y = 0;\n    POINT ptCursor;\n    GetCursorPos(&ptCursor);\n    MONITORINFO mi;\n    mi.cbSize = sizeof(MONITORINFO);\n    HWND hWnd = GetMonitorInfoFromPointForTaskbarFlyoutActivation(\n        ptCursor,\n        MONITOR_DEFAULTTOPRIMARY,\n        &mi\n    );\n    if (hWnd)\n    {\n        RECT rc;\n        GetWindowRect(hWnd, &rc);\n        if (rc.left - mi.rcMonitor.left <= 0)\n        {\n            if (bUseRcWork)\n            {\n                point.x = mi.rcWork.left;\n            }\n            else\n            {\n                point.x = mi.rcMonitor.left;\n            }\n            if (bToRight)\n            {\n                point.x = mi.rcMonitor.right;\n            }\n            if (bAdjust)\n            {\n                point.x++;\n            }\n            if (rc.top - mi.rcMonitor.top <= 0)\n            {\n                if (bUseRcWork)\n                {\n                    point.y = mi.rcWork.top;\n                }\n                else\n                {\n                    point.y = mi.rcMonitor.top;\n                }\n                if (bAdjust)\n                {\n                    point.y++;\n                }\n            }\n            else\n            {\n                if (lpBottom) *lpBottom = TRUE;\n                if (bUseRcWork)\n                {\n                    point.y = mi.rcWork.bottom;\n                }\n                else\n                {\n                    point.y = mi.rcMonitor.bottom;\n                }\n                if (bAdjust)\n                {\n                    point.y--;\n                }\n            }\n        }\n        else\n        {\n            if (lpRight) *lpRight = TRUE;\n            if (bUseRcWork)\n            {\n                point.x = mi.rcWork.right;\n            }\n            else\n            {\n                point.x = mi.rcMonitor.right;\n            }\n            if (bAdjust)\n            {\n                point.x--;\n            }\n            if (rc.top - mi.rcMonitor.top <= 0)\n            {\n                if (bUseRcWork)\n                {\n                    point.y = mi.rcWork.top;\n                }\n                else\n                {\n                    point.y = mi.rcMonitor.top;\n                }\n                if (bAdjust)\n                {\n                    point.y++;\n                }\n            }\n            else\n            {\n                if (lpBottom) *lpBottom = TRUE;\n                if (bUseRcWork)\n                {\n                    point.y = mi.rcWork.bottom;\n                }\n                else\n                {\n                    point.y = mi.rcMonitor.bottom;\n                }\n                if (bAdjust)\n                {\n                    point.y--;\n                }\n            }\n        }\n    }\n    return point;\n}\n\nBOOL TerminateShellExperienceHost()\n{\n    BOOL bRet = FALSE;\n    WCHAR wszKnownPath[MAX_PATH];\n    GetWindowsDirectoryW(wszKnownPath, MAX_PATH);\n    wcscat_s(wszKnownPath, MAX_PATH, L\"\\\\SystemApps\\\\ShellExperienceHost_cw5n1h2txyewy\\\\ShellExperienceHost.exe\");\n    HANDLE hSnapshot = NULL;\n    PROCESSENTRY32 pe32;\n    ZeroMemory(&pe32, sizeof(PROCESSENTRY32));\n    pe32.dwSize = sizeof(PROCESSENTRY32);\n    hSnapshot = CreateToolhelp32Snapshot(\n        TH32CS_SNAPPROCESS,\n        0\n    );\n    if (Process32First(hSnapshot, &pe32) == TRUE)\n    {\n        do\n        {\n            if (!wcscmp(pe32.szExeFile, TEXT(\"ShellExperienceHost.exe\")))\n            {\n                HANDLE hProcess = OpenProcess(\n                    PROCESS_QUERY_LIMITED_INFORMATION |\n                    PROCESS_TERMINATE,\n                    FALSE,\n                    pe32.th32ProcessID\n                );\n                if (hProcess)\n                {\n                    TCHAR wszProcessPath[MAX_PATH];\n                    DWORD dwLength = MAX_PATH;\n                    QueryFullProcessImageNameW(\n                        hProcess,\n                        0,\n                        wszProcessPath,\n                        &dwLength\n                    );\n                    if (!_wcsicmp(wszProcessPath, wszKnownPath))\n                    {\n                        TerminateProcess(hProcess, 0);\n                        bRet = TRUE;\n                    }\n                    CloseHandle(hProcess);\n                    hProcess = NULL;\n                }\n            }\n        } while (Process32Next(hSnapshot, &pe32) == TRUE);\n        if (hSnapshot)\n        {\n            CloseHandle(hSnapshot);\n        }\n    }\n    return bRet;\n}\n\nlong long elapsedCheckForeground = 0;\nHANDLE hCheckForegroundThread = NULL;\nDWORD CheckForegroundThread(DWORD dwMode)\n{\n    printf(\"Started \\\"Check foreground window\\\" thread.\\n\");\n    UINT i = 0;\n    while (TRUE)\n    {\n        wchar_t text[200];\n        ZeroMemory(text, 200);\n        GetClassNameW(GetForegroundWindow(), text, 200);\n        if (!wcscmp(text, L\"Windows.UI.Core.CoreWindow\"))\n        {\n            break;\n        }\n        i++;\n        if (i >= 15) break;\n        Sleep(100);\n    }\n    while (TRUE)\n    {\n        wchar_t text[200];\n        ZeroMemory(text, 200);\n        GetClassNameW(GetForegroundWindow(), text, 200);\n        if (wcscmp(text, L\"Windows.UI.Core.CoreWindow\"))\n        {\n            break;\n        }\n        Sleep(100);\n    }\n    elapsedCheckForeground = milliseconds_now();\n    if (!dwMode)\n    {\n        RegDeleteTreeW(HKEY_CURRENT_USER, _T(SEH_REGPATH));\n        TerminateShellExperienceHost();\n        Sleep(100);\n    }\n    printf(\"Ended \\\"Check foreground window\\\" thread.\\n\");\n    return 0;\n}\n\nvoid LaunchNetworkTargets(DWORD dwTarget)\n{\n    // very helpful: https://www.tenforums.com/tutorials/3123-clsid-key-guid-shortcuts-list-windows-10-a.html\n    if (!dwTarget)\n    {\n        InvokeFlyout(INVOKE_FLYOUT_SHOW, INVOKE_FLYOUT_NETWORK);\n    }\n    else if (dwTarget == 5)\n    {\n        ShellExecuteW(\n            NULL,\n            L\"open\",\n            L\"ms-availablenetworks:\",\n            NULL,\n            NULL,\n            SW_SHOWNORMAL\n        );\n    }\n    else if (dwTarget == 6)\n    {\n        InvokeActionCenter();\n        // ShellExecuteW(\n        //     NULL,\n        //     L\"open\",\n        //     L\"ms-actioncenter:controlcenter/&showFooter=true\",\n        //     NULL,\n        //     NULL,\n        //     SW_SHOWNORMAL\n        // );\n    }\n    else if (dwTarget == 1)\n    {\n        ShellExecuteW(\n            NULL,\n            L\"open\",\n            L\"ms-settings:network\",\n            NULL,\n            NULL,\n            SW_SHOWNORMAL\n        );\n    }\n    else if (dwTarget == 2)\n    {\n        HMODULE hVan = LoadLibraryExW(L\"van.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n        if (hVan)\n        {\n            long(*ShowVAN)(BOOL, BOOL, void*) = GetProcAddress(hVan, \"ShowVAN\");\n            if (ShowVAN)\n            {\n                ShowVAN(0, 0, 0);\n            }\n            FreeLibrary(hVan);\n        }\n    }\n    else if (dwTarget == 3)\n    {\n        ShellExecuteW(\n            NULL,\n            L\"open\",\n            L\"shell:::{8E908FC9-BECC-40f6-915B-F4CA0E70D03D}\",\n            NULL,\n            NULL,\n            SW_SHOWNORMAL\n        );\n    }\n    else if (dwTarget == 4)\n    {\n        ShellExecuteW(\n            NULL,\n            L\"open\",\n            L\"shell:::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\",\n            NULL,\n            NULL,\n            SW_SHOWNORMAL\n        );\n    }\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Service Window\"\n#if WITH_MAIN_PATCHER\nHWND hWndServiceWindow = NULL;\n\nvoid FixUpCenteredTaskbar()\n{\n    HWND hwndPrimaryTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n    PostMessageW(hwndPrimaryTray, WM_DWMCOMPOSITIONCHANGED, 0, 0); // uMsg = 0x31E in explorer!TrayUI::WndProc\n    if (!TaskbarCenter_ShouldStartBeCentered(dwOldTaskbarAl) && hwndPrimaryTray)\n    {\n        HWND hwndStart = FindWindowExW(hwndPrimaryTray, NULL, L\"Start\", NULL);\n        SetWindowPos(hwndStart, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n        InvalidateRect(hwndStart, NULL, TRUE);\n    }\n    if (!TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl))\n    {\n        HWND hWnd = NULL;\n        do\n        {\n            hWnd = FindWindowEx(\n                NULL,\n                hWnd,\n                L\"Shell_SecondaryTrayWnd\",\n                NULL\n            );\n            if (hWnd)\n            {\n                HWND hwndStart = FindWindowExW(hWnd, NULL, L\"Start\", NULL);\n                SetWindowPos(hwndStart, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                InvalidateRect(hwndStart, NULL, TRUE);\n            }\n        } while (hWnd);\n    }\n}\n\n#define EP_SERVICE_WINDOW_CLASS_NAME L\"EP_Service_Window_\" _T(EP_CLSID)\nLRESULT CALLBACK EP_Service_Window_WndProc(\n    HWND hWnd,\n    UINT uMsg,\n    WPARAM wParam,\n    LPARAM lParam)\n{\n    static UINT s_uTaskbarRestart = 0;\n    if (uMsg == WM_CREATE)\n    {\n        s_uTaskbarRestart = RegisterWindowMessageW(L\"TaskbarCreated\");\n    }\n    else if (uMsg == WM_HOTKEY && (wParam == 1 || wParam == 2))\n    {\n        InvokeClockFlyout();\n        return 0;\n    }\n    else if (uMsg == s_uTaskbarRestart && bOldTaskbar && (dwOldTaskbarAl || dwMMOldTaskbarAl))\n    {\n        SetTimer(hWnd, 1, 1000, NULL);\n    }\n    else if (uMsg == WM_TIMER && wParam < 3)\n    {\n        FixUpCenteredTaskbar();\n        if (wParam != 3 - 1) SetTimer(hWnd, wParam + 1, 1000, NULL);\n        KillTimer(hWnd, wParam);\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == 10)\n    {\n        if (GetClassWord(GetForegroundWindow(), GCW_ATOM) != RegisterWindowMessageW(L\"Windows.UI.Core.CoreWindow\"))\n        {\n            DWORD dwVal = 1;\n            RegSetKeyValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"TaskbarAl\", REG_DWORD, &dwVal, sizeof(DWORD));\n            KillTimer(hWnd, 10);\n        }\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == 100)\n    {\n        if (IsSpotlightEnabled()) SpotlightHelper(SPOP_CLICKMENU_NEXTPIC, hWnd, NULL, NULL);\n        printf(\"Refreshed Spotlight\\n\");\n    }\n    return DefWindowProcW(hWnd, uMsg, wParam, lParam);\n}\nDWORD EP_ServiceWindowThread(DWORD unused)\n{\n    WNDCLASS wc = { 0 };\n    wc.style = CS_DBLCLKS;\n    wc.lpfnWndProc = EP_Service_Window_WndProc;\n    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);\n    wc.hInstance = GetModuleHandle(NULL);\n    wc.lpszClassName = EP_SERVICE_WINDOW_CLASS_NAME;\n    wc.hCursor = LoadCursorW(NULL, IDC_ARROW);\n    RegisterClassW(&wc);\n\n    hWndServiceWindow = CreateWindowExW(\n        0,\n        EP_SERVICE_WINDOW_CLASS_NAME,\n        0,\n        WS_POPUP,\n        0,\n        0,\n        0,\n        0,\n        0,\n        0,\n        GetModuleHandle(NULL),\n        NULL\n    );\n    if (hWndServiceWindow)\n    {\n        if (IsSpotlightEnabled() && dwSpotlightUpdateSchedule) SetTimer(hWndServiceWindow, 100, dwSpotlightUpdateSchedule * 1000, NULL);\n        if (bClockFlyoutOnWinC)\n        {\n            RegisterHotKey(hWndServiceWindow, 1, MOD_WIN | MOD_NOREPEAT, 'C');\n        }\n        RegisterHotKey(hWndServiceWindow, 2, MOD_WIN | MOD_ALT, 'D');\n        MSG msg;\n        BOOL bRet;\n        while ((bRet = GetMessageW(&msg, NULL, 0, 0)) != 0)\n        {\n            if (bRet == -1)\n            {\n                break;\n            }\n            else if (!msg.hwnd)\n            {\n                if (msg.message == WM_USER + 1)\n                {\n                    EnterCriticalSection(&lock_epw);\n                    if (epw)\n                    {\n                        epw->lpVtbl->Release(epw);\n                        epw = NULL;\n                        prev_total_h = 0;\n                        if (PeopleButton_LastHWND) InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);\n                        //PlaySoundA((LPCTSTR)SND_ALIAS_SYSTEMASTERISK, NULL, SND_ALIAS_ID);\n                    }\n                    LeaveCriticalSection(&lock_epw);\n                }\n            }\n            else\n            {\n                TranslateMessage(&msg);\n                DispatchMessageW(&msg);\n            }\n        }\n        DestroyWindow(hWndServiceWindow);\n    }\n    SetEvent(hCanStartSws);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Toggle shell features\"\n// More details in explorer.exe!CTray::_HandleGlobalHotkey\n\nBOOL CALLBACK ToggleImmersiveCallback(HWND hWnd, LPARAM lParam)\n{\n    WORD ClassWord;\n\n    ClassWord = GetClassWord(hWnd, GCW_ATOM);\n    if (ClassWord == RegisterWindowMessageW(L\"WorkerW\"))\n    {\n        PostMessageW(hWnd, WM_HOTKEY, lParam, 0);\n    }\n\n    return TRUE;\n}\n\nBOOL ToggleHelp()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 505, 0);\n}\n\nBOOL ToggleRunDialog()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 502, MAKELPARAM(MOD_WIN, 0x52));\n}\n\nBOOL ToggleSystemProperties()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 512, 0);\n}\n\nBOOL FocusSystray()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 514, 0);\n}\n\nBOOL TriggerAeroShake()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 515, 0);\n}\n\nBOOL PeekDesktop()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 516, 0);\n}\n\nBOOL ToggleEmojiPanel()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 579, 0);\n}\n\nBOOL ShowDictationPanel()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 577, 0);\n}\n\nBOOL ToggleClipboardViewer()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 578, 0);\n}\n\nBOOL ToggleSearch()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 507, MAKELPARAM(MOD_WIN, 0x53));\n}\n\nBOOL ToggleTaskView()\n{\n    return EnumThreadWindows(GetWindowThreadProcessId(FindWindowExW(NULL, NULL, L\"ApplicationManager_ImmersiveShellWindow\", NULL), NULL), ToggleImmersiveCallback, 11);\n}\n\nBOOL ToggleWidgetsPanel()\n{\n    return EnumThreadWindows(GetWindowThreadProcessId(FindWindowExW(NULL, NULL, L\"ApplicationManager_ImmersiveShellWindow\", NULL), NULL), ToggleImmersiveCallback, 0x66);\n}\n\nBOOL ToggleMainClockFlyout()\n{\n    return EnumThreadWindows(GetWindowThreadProcessId(FindWindowExW(NULL, NULL, L\"ApplicationManager_ImmersiveShellWindow\", NULL), NULL), ToggleImmersiveCallback, 0x6B);\n}\n\nBOOL ToggleNotificationsFlyout()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 591, 0);\n}\n\nBOOL ToggleActionCenter()\n{\n    return PostMessageW(FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL), WM_HOTKEY, 500, MAKELPARAM(MOD_WIN, 0x41));\n}\n#pragma endregion\n\n\n#pragma region \"windowsudk.shellcommon Hooks\"\n\nstatic HRESULT(WINAPI *SLGetWindowsInformationDWORDFunc)(PCWSTR pwszValueName, DWORD* pdwValue) = NULL;\n\nHRESULT WINAPI windowsudkshellcommon_SLGetWindowsInformationDWORDHook(PCWSTR pwszValueName, DWORD* pdwValue)\n{\n    HRESULT hr = SLGetWindowsInformationDWORDFunc(pwszValueName, pdwValue);\n\n    if (bDisableAeroSnapQuadrants && !wcsncmp(pwszValueName, L\"Shell-Windowing-LimitSnappedWindows\", 35))\n        *pdwValue = 1;\n\n    return hr;\n}\n\n#pragma endregion\n\n\n#pragma region \"twinui.pcshell.dll hooks\"\n#if WITH_MAIN_PATCHER\ntypedef HRESULT(*ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t)(HMENU hmenu, HWND hWnd, POINT* pptOrigin, unsigned int icmoFlags, void* srgRenderingData);\nImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc;\ntypedef void(*ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenu_t)(HMENU hmenu, HWND hwnd);\nImmersiveContextMenuHelper_RemoveOwnerDrawFromMenu_t ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc;\ntypedef LRESULT(*CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc_t)(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\nCImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc_t CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc;\n\nextern void ToggleLauncherTipContextMenu();\nextern LRESULT CALLBACK CLauncherTipContextMenu_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\nextern void RunTwinUIPCShellPatches(symbols_addr* symbols_PTRS);\n\nBOOL VnPatchIAT_NonInline(HMODULE hMod, const char* libName, const char* funcName, uintptr_t hookAddr)\n{\n    return VnPatchIAT(hMod, (PSTR)libName, (PSTR)funcName, hookAddr);\n}\n\nvoid ReportSuccessfulAnimationPatching()\n{\n#if WITH_SMA_PATCH_REPORT\n    PSID pMainSid = NULL;\n    GetLogonSid(&pMainSid);\n    PSID pSecondaySid = NULL;\n    DeriveAppContainerSidFromAppContainerName(L\"Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\", &pSecondaySid);\n    PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL;\n    if (PrepareSecurityDescriptor(pMainSid, STANDARD_RIGHTS_ALL | MUTEX_ALL_ACCESS, pSecondaySid, SYNCHRONIZE, &pSecurityDescriptor))\n    {\n        SECURITY_ATTRIBUTES SecurityAttributes;\n        ZeroMemory(&SecurityAttributes, sizeof(SecurityAttributes));\n        SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);\n        SecurityAttributes.bInheritHandle = FALSE;\n        SecurityAttributes.lpSecurityDescriptor = pSecurityDescriptor;\n        if (CreateMutexW(&SecurityAttributes, FALSE, _T(EPStart10_AnimationsPatched)))\n        {\n            printf(\"[SMA] Advertising successful animations patching.\\n\");\n        }\n        free(pSecurityDescriptor);\n    }\n    if (pMainSid) free(pMainSid);\n    if (pSecondaySid) FreeSid(pSecondaySid);\n#endif\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Windows 10 Taskbar Hooks\"\n#if WITH_MAIN_PATCHER\n// credits: https://github.com/m417z/7-Taskbar-Tweaker\n\nDEFINE_GUID(IID_ITaskGroup,\n    0x3af85589, 0x678f, 0x4fb5, 0x89, 0x25, 0x5a, 0x13, 0x4e, 0xbf, 0x57, 0x2c);\n\ntypedef interface ITaskGroup ITaskGroup;\n\ntypedef struct ITaskGroupVtbl\n{\n    BEGIN_INTERFACE\n\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\n        ITaskGroup* This,\n        /* [in] */ REFIID riid,\n        /* [annotation][iid_is][out] */\n        _COM_Outptr_  void** ppvObject);\n\n    ULONG(STDMETHODCALLTYPE* AddRef)(\n        ITaskGroup* This);\n\n    ULONG(STDMETHODCALLTYPE* Release)(\n        ITaskGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* Initialize)(\n        ITaskGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* AddTaskItem)(\n        ITaskGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* RemoveTaskItem)(\n        ITaskGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* EnumTaskItems)(\n        ITaskGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* DoesWindowMatch)(\n        ITaskGroup* This,\n        HWND hCompareWnd,\n        ITEMIDLIST* pCompareItemIdList,\n        WCHAR* pCompareAppId,\n        int* pnMatch,\n        LONG** p_task_item);\n    // ...\n\n    END_INTERFACE\n} ITaskGroupVtbl;\n\ninterface ITaskGroup\n{\n    CONST_VTBL struct ITaskGroupVtbl* lpVtbl;\n};\n\ntypedef enum tagWINDOWMATCHCONFIDENCE\n{\n    WMC_None,\n    WMC_MatchAppID,\n    WMC_MatchShortcutIDListByAppID,\n    WMC_MatchShortcutIDList,\n    WMC_MatchWindow,\n} WINDOWMATCHCONFIDENCE;\n\nHRESULT(STDMETHODCALLTYPE *CTaskGroup_DoesWindowMatchFunc)(ITaskGroup* pTaskGroup, HWND hCompareWnd, ITEMIDLIST* pCompareItemIdList,\n    WCHAR* pCompareAppId, WINDOWMATCHCONFIDENCE* pnMatch, LONG_PTR** p_task_item) = NULL;\nHRESULT STDMETHODCALLTYPE CTaskGroup_DoesWindowMatchHook(ITaskGroup* pTaskGroup, HWND hCompareWnd, ITEMIDLIST* pCompareItemIdList,\n    WCHAR* pCompareAppId, WINDOWMATCHCONFIDENCE* pnMatch, LONG_PTR** p_task_item)\n{\n    wprintf(L\"CTaskGroup_DoesWindowMatchHook called for hwnd 0x%p\\n\", hCompareWnd);\n    HRESULT hr = CTaskGroup_DoesWindowMatchFunc(pTaskGroup, hCompareWnd, pCompareItemIdList, pCompareAppId, pnMatch, p_task_item);\n    if (bPinnedItemsActAsQuickLaunch && SUCCEEDED(hr)\n        && (*pnMatch == WMC_MatchAppID || *pnMatch == WMC_MatchShortcutIDListByAppID || *pnMatch == WMC_MatchShortcutIDList))\n    {\n        BOOL bDontGroup = FALSE;\n        PBYTE _this = (PBYTE)pTaskGroup - 16 /*sizeof(CTaskUnknown)*/;\n        HDPA hdpaItems = *(HDPA*)(_this + 48 /*offsetof(CTaskGroup, m_hdpaItems)*/);\n        BOOL bPinned = !hdpaItems || !DPA_GetPtrCount(hdpaItems);\n        if (bPinned)\n        {\n            bDontGroup = TRUE;\n        }\n        if (bDontGroup)\n        {\n            hr = E_FAIL;\n        }\n    }\n    return hr;\n}\n\nDEFINE_GUID(IID_ITaskBtnGroup,\n    0x2e52265d, 0x1a3b, 0x4e46, 0x94, 0x17, 0x51, 0xa5, 0x9c, 0x47, 0xd6, 0x0b);\n\ntypedef interface ITaskBtnGroup ITaskBtnGroup;\n\ntypedef struct ITaskBtnGroupVtbl\n{\n    BEGIN_INTERFACE\n\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\n        ITaskBtnGroup* This,\n        /* [in] */ REFIID riid,\n        /* [annotation][iid_is][out] */\n        _COM_Outptr_  void** ppvObject);\n\n    ULONG(STDMETHODCALLTYPE* AddRef)(\n        ITaskBtnGroup* This);\n\n    ULONG(STDMETHODCALLTYPE* Release)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* Shutdown)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetGroupType)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* UpdateGroupType)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetGroup)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* AddTaskItem)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* IndexOfTaskItem)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* RemoveTaskItem)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* RealityCheck)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* IsItemBeingRemoved)(\n        ITaskBtnGroup* This);\n\n    HRESULT(STDMETHODCALLTYPE* CancelRemoveItem)(\n        ITaskBtnGroup* This);\n\n    int(STDMETHODCALLTYPE* GetIdealSpan)(\n        ITaskBtnGroup* This,\n        int var2,\n        int var3,\n        int var4,\n        int var5,\n        int var6);\n    // ...\n\n    END_INTERFACE\n} ITaskBtnGroupVtbl;\n\ninterface ITaskBtnGroup\n{\n    CONST_VTBL struct ITaskBtnGroupVtbl* lpVtbl;\n};\n\ntypedef enum eTBGROUPTYPE\n{\n    TBGROUPTYPE_Unknown,\n    TBGROUPTYPE_Normal,\n    TBGROUPTYPE_Pinned,\n    TBGROUPTYPE_Stacked,\n    TBGROUPTYPE_Invisible,\n} TBGROUPTYPE;\n\nint (STDMETHODCALLTYPE *CTaskBtnGroup_GetIdealSpanFunc)(ITaskBtnGroup* pTaskBtnGroup, int var2, int var3,\n    int var4, int var5, int* var6) = NULL;\nint STDMETHODCALLTYPE CTaskBtnGroup_GetIdealSpanHook(ITaskBtnGroup* pTaskBtnGroup, int var2, int var3,\n    int var4, int var5, int* var6)\n{\n    BOOL bTypeModified = FALSE;\n    PBYTE _this = (PBYTE)pTaskBtnGroup - 16 /*sizeof(CTaskUnknown)*/;\n    TBGROUPTYPE* pGroupType = (TBGROUPTYPE*)(_this + 80 /*offsetof(CTaskBtnGroup, m_groupType)*/);\n    TBGROUPTYPE lastGroupType = *pGroupType;\n    if (bRemoveExtraGapAroundPinnedItems && lastGroupType == TBGROUPTYPE_Pinned)\n    {\n        *pGroupType = TBGROUPTYPE_Invisible;\n        bTypeModified = TRUE;\n    }\n    int ret = CTaskBtnGroup_GetIdealSpanFunc(pTaskBtnGroup, var2, var3, var4, var5, var6);\n    if (bRemoveExtraGapAroundPinnedItems && bTypeModified)\n    {\n        *pGroupType = lastGroupType;\n    }\n    return ret;\n}\n\nvoid Win10TaskbarHooks_ConditionalPatchITaskGroupVtbl(ITaskGroupVtbl* pVtbl)\n{\n    if (bPinnedItemsActAsQuickLaunch)\n    {\n        DWORD flOldProtect = 0;\n        if (VirtualProtect(pVtbl, sizeof(ITaskGroupVtbl), PAGE_EXECUTE_READWRITE, &flOldProtect))\n        {\n            if (!CTaskGroup_DoesWindowMatchFunc)\n            {\n                CTaskGroup_DoesWindowMatchFunc = pVtbl->DoesWindowMatch;\n            }\n            pVtbl->DoesWindowMatch = CTaskGroup_DoesWindowMatchHook;\n            VirtualProtect(pVtbl, sizeof(ITaskGroupVtbl), flOldProtect, &flOldProtect);\n        }\n    }\n}\n\nvoid Win10TaskbarHooks_ConditionalPatchITaskBtnGroupVtbl(ITaskBtnGroupVtbl* pVtbl)\n{\n    if (bRemoveExtraGapAroundPinnedItems)\n    {\n        DWORD flOldProtect = 0;\n        if (VirtualProtect(pVtbl, sizeof(ITaskBtnGroupVtbl), PAGE_EXECUTE_READWRITE, &flOldProtect))\n        {\n            if (!CTaskBtnGroup_GetIdealSpanFunc)\n            {\n                CTaskBtnGroup_GetIdealSpanFunc = pVtbl->GetIdealSpan;\n            }\n            pVtbl->GetIdealSpan = CTaskBtnGroup_GetIdealSpanHook;\n            VirtualProtect(pVtbl, sizeof(ITaskBtnGroupVtbl), flOldProtect, &flOldProtect);\n        }\n    }\n}\n\nHRESULT explorer_QISearch(void* that, LPCQITAB pqit, REFIID riid, void** ppv)\n{\n    HRESULT hr = QISearch(that, pqit, riid, ppv);\n    if (SUCCEEDED(hr))\n    {\n        if (IsEqualGUID(pqit[0].piid, &IID_ITaskGroup))\n        {\n            ITaskGroup* pTaskGroup = (char*)that + pqit[0].dwOffset;\n            Win10TaskbarHooks_ConditionalPatchITaskGroupVtbl(pTaskGroup->lpVtbl);\n        }\n        else if (IsEqualGUID(pqit[0].piid, &IID_ITaskBtnGroup))\n        {\n            ITaskBtnGroup* pTaskBtnGroup = (char*)that + pqit[0].dwOffset;\n            Win10TaskbarHooks_ConditionalPatchITaskBtnGroupVtbl(pTaskBtnGroup->lpVtbl);\n        }\n    }\n    return hr;\n}\n\nvoid Win10TaskbarHooks_PatchEPTaskbarVtables(HMODULE hModule)\n{\n    ITaskGroupVtbl* pTaskGroupVtbl = (ITaskGroupVtbl*)GetProcAddress(hModule, \"??_7CTaskGroup@@6BITaskGroup@@@\");\n    if (pTaskGroupVtbl)\n    {\n        Win10TaskbarHooks_ConditionalPatchITaskGroupVtbl(pTaskGroupVtbl);\n    }\n\n    ITaskBtnGroupVtbl* pTaskBtnGroupVtbl = (ITaskBtnGroupVtbl*)GetProcAddress(hModule, \"??_7CTaskBtnGroup@@6BITaskBtnGroup@@@\");\n    if (pTaskBtnGroupVtbl)\n    {\n        Win10TaskbarHooks_ConditionalPatchITaskBtnGroupVtbl(pTaskBtnGroupVtbl);\n    }\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Show Start in correct location according to TaskbarAl\"\n#if WITH_MAIN_PATCHER\nvoid UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize)\n{\n    BOOL bShouldInitialize = LOWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize);\n    BOOL bShouldRoInitialize = HIWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize);\n\n    if (!bOldTaskbar)\n    {\n        return;\n    }\n\n    DWORD dwPosCurrent = GetStartMenuPosition(SHRegGetValueFromHKCUHKLMFunc);\n    if (bShouldInitialize || InterlockedAdd(&dwTaskbarAl, 0) != dwPosCurrent)\n    {\n        HRESULT hr = S_OK;\n        if (bShouldRoInitialize)\n        {\n            hr = RoInitialize(RO_INIT_MULTITHREADED);\n        }\n        if (SUCCEEDED(hr))\n        {\n            InterlockedExchange(&dwTaskbarAl, dwPosCurrent);\n            StartMenuPositioningData spd;\n            spd.pMonitorCount = &dwMonitorCount;\n            spd.pMonitorList = hMonitorList;\n            spd.location = dwPosCurrent;\n            spd.i = (DWORD)-1;\n            if (bShouldInitialize)\n            {\n                spd.operation = STARTMENU_POSITIONING_OPERATION_REMOVE;\n                unsigned int k = InterlockedAdd(&dwMonitorCount, 0);\n                for (unsigned int i = 0; i < k; ++i)\n                {\n                    spd.i = i;\n                    NeedsRo_PositionStartMenuForMonitor(hMonitorList[i].hMonitor, NULL, NULL, &spd);\n                }\n                InterlockedExchange(&dwMonitorCount, 0);\n                spd.i = (DWORD)-1;\n                spd.operation = STARTMENU_POSITIONING_OPERATION_ADD;\n            }\n            else\n            {\n                spd.operation = STARTMENU_POSITIONING_OPERATION_CHANGE;\n            }\n            EnumDisplayMonitors(NULL, NULL, NeedsRo_PositionStartMenuForMonitor, &spd);\n            if (bShouldRoInitialize)\n            {\n                RoUninitialize();\n            }\n        }\n    }\n}\n\n__declspec(dllexport) unsigned __int64 FindTaskbarLayoutTokenByHMONITOR(HMONITOR hMonitor)\n{\n    for (DWORD i = 0; i < dwMonitorCount; i++)\n    {\n        if (hMonitorList[i].hMonitor == hMonitor)\n        {\n            return hMonitorList[i].token;\n        }\n    }\n    return 0;\n}\n#else\nvoid UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize) {}\n#endif\n#pragma endregion\n\n\n#pragma region \"Fix Windows 11 taskbar not showing tray when auto hide is on\"\n#if WITH_MAIN_PATCHER\n#define FIXTASKBARAUTOHIDE_CLASS_NAME L\"FixTaskbarAutohide_\" _T(EP_CLSID)\nLRESULT CALLBACK FixTaskbarAutohide_WndProc(\n    HWND hWnd,\n    UINT uMessage,\n    WPARAM wParam,\n    LPARAM lParam)\n{\n    static UINT s_uTaskbarRestart;\n\n    switch (uMessage)\n    {\n    case WM_CREATE:\n        s_uTaskbarRestart = RegisterWindowMessageW(TEXT(\"TaskbarCreated\"));\n        break;\n\n    default:\n        if (uMessage == s_uTaskbarRestart)\n            PostQuitMessage(0);\n        break;\n    }\n\n    return DefWindowProcW(hWnd, uMessage, wParam, lParam);\n}\nDWORD FixTaskbarAutohide(DWORD unused)\n{\n    WNDCLASS wc = { 0 };\n    wc.style = CS_DBLCLKS;\n    wc.lpfnWndProc = FixTaskbarAutohide_WndProc;\n    wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);\n    wc.hInstance = GetModuleHandle(NULL);\n    wc.lpszClassName = FIXTASKBARAUTOHIDE_CLASS_NAME;\n    wc.hCursor = LoadCursorW(NULL, IDC_ARROW);\n    RegisterClassW(&wc);\n\n    HWND hWnd = CreateWindowExW(\n        0,\n        FIXTASKBARAUTOHIDE_CLASS_NAME,\n        0,\n        WS_POPUP,\n        0,\n        0,\n        0,\n        0,\n        0,\n        0,\n        GetModuleHandle(NULL),\n        NULL\n    );\n    if (hWnd)\n    {\n        MSG msg;\n        BOOL bRet;\n        while ((bRet = GetMessageW(&msg, NULL, 0, 0)) != 0)\n        {\n            if (bRet == -1)\n            {\n                break;\n            }\n            else\n            {\n                TranslateMessage(&msg);\n                DispatchMessageW(&msg);\n            }\n        }\n        DestroyWindow(hWnd);\n\n        APPBARDATA abd;\n        abd.cbSize = sizeof(APPBARDATA);\n        if (SHAppBarMessage(ABM_GETSTATE, &abd) == ABS_AUTOHIDE)\n        {\n            abd.lParam = 0;\n            SHAppBarMessage(ABM_SETSTATE, &abd);\n            Sleep(1000);\n            abd.lParam = ABS_AUTOHIDE;\n            SHAppBarMessage(ABM_SETSTATE, &abd);\n        }\n    }\n    SetEvent(hCanStartSws);\n\n    return 0;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Allow enabling XAML sounds\"\n#if WITH_MAIN_PATCHER\nvoid ForceEnableXamlSounds(HMODULE hWindowsUIXaml)\n{\n    if (!hWindowsUIXaml)\n        return;\n\n    PBYTE pWindowsUIXamlText;\n    DWORD cbWindowsUIXamlText;\n    if (!TextSectionBeginAndSize(hWindowsUIXaml, &pWindowsUIXamlText, &cbWindowsUIXamlText))\n        return;\n\n    // Patch DirectUI::ElementSoundPlayerService::ShouldPlaySound() to disregard XboxUtility::IsOnXbox() check\n\n#if defined(_M_X64)\n    // 74 ?? 39 59 ?? 75 ?? E8 ?? ?? ?? ?? 84 C0 75\n    //                                           ^^ change jnz to jmp\n    PBYTE match = FindPattern(\n        pWindowsUIXamlText,\n        cbWindowsUIXamlText,\n        \"\\x74\\x00\\x39\\x59\\x00\\x75\\x00\\xE8\\x00\\x00\\x00\\x00\\x84\\xC0\\x75\",\n        \"x?xx?x?x????xxx\"\n    );\n    if (match)\n    {\n        PBYTE jnz = match + 14;\n        DWORD flOldProtect = 0;\n        if (VirtualProtect(jnz, 1, PAGE_EXECUTE_READWRITE, &flOldProtect))\n        {\n            *jnz = 0xEB;\n            VirtualProtect(jnz, 1, flOldProtect, &flOldProtect);\n        }\n    }\n#elif defined(_M_ARM64)\n    // 1F 09 00 71 ?? ?? ?? 54 ?? 00 00 35 ?? ?? ?? ?? 08 1C 00 53 ?? ?? ?? ??\n    //                                                             ^^^^^^^^^^^ CBNZ -> B, CBZ -> NOP\n    PBYTE match = FindPattern(\n        pWindowsUIXamlText,\n        cbWindowsUIXamlText,\n        \"\\x1F\\x09\\x00\\x71\\x00\\x00\\x00\\x54\\x00\\x00\\x00\\x35\\x00\\x00\\x00\\x00\\x08\\x1C\\x00\\x53\",\n        \"xxxx???x?xxx????xxxx\"\n    );\n    if (match)\n    {\n        match += 20;\n        DWORD currentInsn = *(DWORD*)match;\n        DWORD newInsn = ARM64_CBNZWToB(currentInsn);\n        if (!newInsn && ARM64_IsCBZW(currentInsn))\n        {\n            newInsn = 0xD503201F; // NOP\n        }\n        if (newInsn)\n        {\n            DWORD flOldProtect = 0;\n            if (VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &flOldProtect))\n            {\n                *(DWORD*)match = newInsn;\n                VirtualProtect(match, 4, flOldProtect, &flOldProtect);\n            }\n        }\n    }\n#endif\n}\n\nBOOL IsXamlSoundsEnabled()\n{\n    DWORD dwRes = 0, dwSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, TEXT(REGPATH_OLD), L\"XamlSounds\", RRF_RT_DWORD, NULL, &dwRes, &dwSize);\n    return dwRes != 0;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"EnsureXAML on OS builds 22621+\"\n#if WITH_MAIN_PATCHER\nDEFINE_GUID(uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics,\n    0xECC13292,\n    0x27EF, 0x547A, 0xAC, 0x8B,\n    0x76, 0xCD, 0x17, 0x32, 0x21, 0x86\n);\n\n// 22621.2134+. Still named IXamlApplicationStatics.\nDEFINE_GUID(uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics2,\n    0x5148D7B1,\n    0x800E, 0x5C86, 0x8F, 0x69,\n    0x55, 0x81, 0x97, 0x48, 0x31, 0x23\n);\n\nDEFINE_GUID(uuidof_Windows_UI_Core_ICoreWindow5,\n    0x28258A12,\n    0x7D82, 0x505B, 0xB2, 0x10,\n    0x71, 0x2B, 0x04, 0xA5, 0x88, 0x82\n);\n\nBOOL bIsXAMLEnsured = FALSE;\nvoid EnsureXAML()\n{\n    if (bIsXAMLEnsured)\n        return;\n    bIsXAMLEnsured = TRUE;\n    ULONGLONG initTime = GetTickCount64();\n    HRESULT hr;\n\n    HSTRING_HEADER hstringheaderXamlApplication;\n    HSTRING hstringXamlApplication = NULL;\n    hr = WindowsCreateStringReference(L\"Windows.Internal.Shell.XamlExplorerHost.XamlApplication\", 55, &hstringheaderXamlApplication, &hstringXamlApplication);\n    if (FAILED(hr))\n    {\n        printf(\"[EnsureXAML] WindowsCreateStringReference(XamlApplication) failed. 0x%lX\\n\", hr);\n        goto cleanup;\n    }\n\n    IInspectable* pXamlApplicationStatics = NULL;\n    hr = RoGetActivationFactory(hstringXamlApplication, &uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics, &pXamlApplicationStatics);\n    if (FAILED(hr))\n    {\n        hr = RoGetActivationFactory(hstringXamlApplication, &uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics2, &pXamlApplicationStatics);\n        if (FAILED(hr))\n        {\n            printf(\"[EnsureXAML] RoGetActivationFactory(IXamlApplicationStatics) failed. 0x%lX\\n\", hr);\n            goto cleanup0;\n        }\n    }\n\n    IUnknown* pXamlApplication = NULL;\n    HRESULT (*IXamlApplicationStatics_get_Current)(IInspectable*, void**) = ((void**)pXamlApplicationStatics->lpVtbl)[6];\n    hr = IXamlApplicationStatics_get_Current(pXamlApplicationStatics, &pXamlApplication);\n    if (FAILED(hr))\n    {\n        printf(\"[EnsureXAML] IXamlApplicationStatics::get_Current() failed. 0x%lX\\n\", hr);\n        goto cleanup1;\n    }\n    pXamlApplication->lpVtbl->Release(pXamlApplication);\n\n    HSTRING_HEADER hstringheaderWindowsXamlManager;\n    HSTRING hstringWindowsXamlManager = NULL;\n    hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Hosting.WindowsXamlManager\", 42, &hstringheaderWindowsXamlManager, &hstringWindowsXamlManager);\n    if (FAILED(hr))\n    {\n        printf(\"[EnsureXAML] WindowsCreateStringReference(WindowsXamlManager) failed. 0x%lX\\n\", hr);\n        goto cleanup1;\n    }\n\n    __x_ABI_CWindows_CUI_CCore_CICoreWindow5* pCoreWindow5 = NULL;\n    hr = RoGetActivationFactory(hstringWindowsXamlManager, &uuidof_Windows_UI_Core_ICoreWindow5, &pCoreWindow5);\n    if (FAILED(hr))\n    {\n        printf(\"[EnsureXAML] RoGetActivationFactory(ICoreWindow5) failed. 0x%lX\\n\", hr);\n        goto cleanup2;\n    }\n\n    if (pCoreWindow5)\n    {\n        __x_ABI_CWindows_CSystem_CIDispatcherQueue* pDispatcherQueue = NULL;\n        hr = pCoreWindow5->lpVtbl->get_DispatcherQueue(pCoreWindow5, &pDispatcherQueue);\n        if (FAILED(hr))\n        {\n            printf(\"[EnsureXAML] ICoreWindow5::get_DispatcherQueue() failed. 0x%lX\\n\", hr);\n            goto cleanup3;\n        }\n        // Keep pDispatcherQueue referenced in memory\n    }\n\n    ULONGLONG finalTime = GetTickCount64();\n    printf(\"[EnsureXAML] %lld ms.\\n\", finalTime - initTime);\n\ncleanup3:\n    if (pCoreWindow5) pCoreWindow5->lpVtbl->Release(pCoreWindow5);\ncleanup2:\n    if (hstringWindowsXamlManager) WindowsDeleteString(hstringWindowsXamlManager);\ncleanup1:\n    if (pXamlApplicationStatics) pXamlApplicationStatics->lpVtbl->Release(pXamlApplicationStatics);\ncleanup0:\n    if (hstringXamlApplication) WindowsDeleteString(hstringXamlApplication);\ncleanup:\n    ;\n}\n\nHRESULT(*ICoreWindow5_get_DispatcherQueueFunc)(INT64, INT64);\nHRESULT WINAPI ICoreWindow5_get_DispatcherQueueHook(void* _this, void** ppValue)\n{\n    SendMessageTimeoutW(FindWindowW(L\"Shell_TrayWnd\", NULL), WM_SETTINGCHANGE, 0, L\"EnsureXAML\", SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL);\n    return ICoreWindow5_get_DispatcherQueueFunc(_this, ppValue);\n}\n\nHMODULE __fastcall Windows11v22H2_combase_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)\n{\n    HMODULE hModule = LoadLibraryExW(lpLibFileName, hFile, dwFlags);\n    if (hModule && hModule == GetModuleHandleW(L\"Windows.UI.Xaml.dll\"))\n    {\n        if (IsXamlSoundsEnabled())\n        {\n            ForceEnableXamlSounds(hModule);\n        }\n        DWORD flOldProtect = 0;\n        IActivationFactory* pWindowsXamlManagerFactory = NULL;\n        HSTRING_HEADER hstringHeaderWindowsXamlManager;\n        HSTRING hstringWindowsXamlManager = NULL;\n        FARPROC DllGetActivationFactory = GetProcAddress(hModule, \"DllGetActivationFactory\");\n        if (!DllGetActivationFactory)\n        {\n            printf(\"Error in Windows11v22H2_combase_LoadLibraryExW on DllGetActivationFactory\\n\");\n            return hModule;\n        }\n        if (FAILED(WindowsCreateStringReference(L\"Windows.UI.Xaml.Hosting.WindowsXamlManager\", 0x2Au, &hstringHeaderWindowsXamlManager, &hstringWindowsXamlManager)))\n        {\n            printf(\"Error in Windows11v22H2_combase_LoadLibraryExW on WindowsCreateStringReference\\n\");\n            return hModule;\n        }\n        ((void(__fastcall*)(HSTRING, __int64*))DllGetActivationFactory)(hstringWindowsXamlManager, &pWindowsXamlManagerFactory);\n        if (pWindowsXamlManagerFactory)\n        {\n            IInspectable* pCoreWindow5 = NULL;\n            pWindowsXamlManagerFactory->lpVtbl->QueryInterface(pWindowsXamlManagerFactory, &uuidof_Windows_UI_Core_ICoreWindow5, &pCoreWindow5);\n            if (pCoreWindow5)\n            {\n                INT64* pCoreWindow5Vtbl = pCoreWindow5->lpVtbl;\n                if (VirtualProtect(pCoreWindow5->lpVtbl, sizeof(IInspectableVtbl) + sizeof(INT64), PAGE_EXECUTE_READWRITE, &flOldProtect))\n                {\n                    ICoreWindow5_get_DispatcherQueueFunc = pCoreWindow5Vtbl[6];\n                    pCoreWindow5Vtbl[6] = ICoreWindow5_get_DispatcherQueueHook;\n                    VirtualProtect(pCoreWindow5->lpVtbl, sizeof(IInspectableVtbl) + sizeof(INT64), flOldProtect, &flOldProtect);\n                }\n                pCoreWindow5->lpVtbl->Release(pCoreWindow5);\n            }\n            pWindowsXamlManagerFactory->lpVtbl->Release(pWindowsXamlManagerFactory);\n        }\n        WindowsDeleteString(hstringWindowsXamlManager);\n    }\n    return hModule;\n}\n\nHMODULE __fastcall combase_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)\n{\n    HMODULE hModule = LoadLibraryExW(lpLibFileName, hFile, dwFlags);\n    if (hModule && hModule == GetModuleHandleW(L\"Windows.UI.Xaml.dll\"))\n    {\n        ForceEnableXamlSounds(hModule);\n    }\n    return hModule;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Shell_TrayWnd subclass\"\n#if WITH_MAIN_PATCHER\nint HandleTaskbarCornerInteraction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\n{\n    POINT pt; pt.x = 0; pt.y = 0;\n    if (uMsg == WM_RBUTTONUP || uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONDOWN || uMsg == WM_LBUTTONDOWN)\n    {\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n        ClientToScreen(hWnd, &pt);\n    }\n    else if (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP || uMsg == WM_NCLBUTTONDOWN || uMsg == WM_NCRBUTTONDOWN)\n    {\n        DWORD dwPos = GetMessagePos();\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n    }\n    HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);\n    MONITORINFO mi;\n    ZeroMemory(&mi, sizeof(MONITORINFO));\n    mi.cbSize = sizeof(MONITORINFO);\n    GetMonitorInfoW(hMonitor, &mi);\n    int t = 2;\n    BOOL bOk = FALSE;\n    if (pt.x < mi.rcMonitor.left + t && pt.y > mi.rcMonitor.bottom - t)\n    {\n        //printf(\"bottom left\\n\");\n        bOk = TRUE;\n    }\n    else if (pt.x < mi.rcMonitor.left + t && pt.y < mi.rcMonitor.top + t)\n    {\n        //printf(\"top left\\n\");\n        bOk = TRUE;\n    }\n    else if (pt.x > mi.rcMonitor.right - t && pt.y < mi.rcMonitor.top + t)\n    {\n        //printf(\"top right\\n\");\n        bOk = TRUE;\n    }\n    if (bOk)\n    {\n        if (uMsg == WM_RBUTTONUP || uMsg == WM_NCRBUTTONUP || uMsg == WM_RBUTTONDOWN || uMsg == WM_NCRBUTTONDOWN)\n        {\n            ToggleLauncherTipContextMenu();\n            return 1;\n        }\n        else if (uMsg == WM_LBUTTONUP || uMsg == WM_NCLBUTTONUP || uMsg == WM_LBUTTONDOWN || uMsg == WM_NCLBUTTONDOWN)\n        {\n            if (!dwUndeadStartCorner)\n            {\n                return 1;\n            }\n            if (dwUndeadStartCorner != 2)\n            {\n                OpenStartOnMonitor(hMonitor);\n                return 1;\n            }\n            DWORD dwVal = 1, dwSize = sizeof(DWORD);\n            RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"TaskbarAl\", RRF_RT_DWORD, NULL, &dwVal, &dwSize);\n            if (dwVal)\n            {\n                dwVal = 0;\n                RegSetKeyValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"TaskbarAl\", REG_DWORD, &dwVal, sizeof(DWORD));\n                if (hWndServiceWindow) SetTimer(hWndServiceWindow, 10, 1000, NULL);\n            }\n            OpenStartOnMonitor(hMonitor);\n            return 1;\n        }\n    }\n    return 0;\n}\n\nINT64 ReBarWindow32SubclassProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwUnused)\n{\n    if (uMsg == WM_NCDESTROY)\n    {\n        RemoveWindowSubclass(hWnd, ReBarWindow32SubclassProc, ReBarWindow32SubclassProc);\n    }\n    if (TaskbarCenter_ShouldCenter(dwOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwOldTaskbarAl) && uMsg == WM_WINDOWPOSCHANGING)\n    {\n        LPWINDOWPOS lpWP = lParam;\n        lpWP->cx += lpWP->x;\n        lpWP->x = 0;\n        lpWP->cy += lpWP->y;\n        lpWP->y = 0;\n    }\n    else if (uMsg == RB_INSERTBANDW)\n    {\n        REBARBANDINFOW* lpRbi = lParam;\n    }\n    else if (uMsg == RB_SETBANDINFOW)\n    {\n        REBARBANDINFOW* lpRbi = lParam;\n        if (GetClassWord(lpRbi->hwndChild, GCW_ATOM) == RegisterWindowMessageW(L\"PeopleBand\"))\n        {\n            lpRbi->fMask |= RBBIM_STYLE;\n            lpRbi->fStyle &= ~RBBS_FIXEDSIZE;\n            //lpRbi->fStyle &= ~RBBS_NOGRIPPER;\n        }\n    }\n    else if (TaskbarCenter_ShouldCenter(dwOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwOldTaskbarAl) && (uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam))\n    {\n        return 0;\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n\nHMODULE g_hMyTaskbar;\n\nHMENU explorer_LoadMenuW(HINSTANCE hInstance, LPCWSTR lpMenuName)\n{\n    HMENU hMenu = LoadMenuW(hInstance, lpMenuName);\n    if ((hInstance == GetModuleHandle(NULL) || (g_hMyTaskbar && hInstance == g_hMyTaskbar)) && lpMenuName == MAKEINTRESOURCEW(205))\n    {\n        HMENU hSubMenu = GetSubMenu(hMenu, 0);\n        if (hSubMenu)\n        {\n            TCHAR buffer[260];\n            LoadStringW(GetModuleHandleW(L\"ExplorerFrame.dll\"), 50222, buffer + (bNoMenuAccelerator ? 0 : 1), 260);\n            if (!bNoMenuAccelerator)\n            {\n                buffer[0] = L'&';\n            }\n            wchar_t* p = wcschr(buffer, L'(');\n            if (p)\n            {\n                p--;\n                if (*p == L' ')\n                {\n                    *p = 0;\n                }\n                else\n                {\n                    p++;\n                    *p = 0;\n                }\n            }\n            MENUITEMINFOW menuInfo;\n            ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n            menuInfo.cbSize = sizeof(MENUITEMINFOW);\n            menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA;\n            menuInfo.wID = 12100;\n            menuInfo.dwItemData = CheckForUpdatesThread;\n            menuInfo.fType = MFT_STRING;\n            menuInfo.dwTypeData = buffer;\n            menuInfo.cch = wcslen(buffer);\n            if (!bNoPropertiesInContextMenu)\n            {\n                InsertMenuItemW(\n                    hSubMenu,\n                    GetMenuItemCount(hSubMenu) - 4,\n                    TRUE,\n                    &menuInfo\n                );\n            }\n        }\n    }\n    return hMenu;\n}\n\nHHOOK Shell_TrayWndMouseHook = NULL;\n\nBOOL IsPointOnEmptyAreaOfNewTaskbar(POINT pt)\n{\n    HRESULT hr = S_OK;\n    IUIAutomation2* pIUIAutomation2 = NULL;\n    IUIAutomationElement* pIUIAutomationElement = NULL;\n    HWND hWnd = NULL;\n    BOOL bRet = FALSE;\n    BSTR elemName = NULL;\n    BSTR elemType = NULL;\n    BOOL bIsWindows11Version22H2OrHigher = IsWindows11Version22H2OrHigher();\n    \n    if (SUCCEEDED(hr))\n    {\n        hr = CoCreateInstance(&CLSID_CUIAutomation8, NULL, CLSCTX_INPROC_SERVER, &IID_IUIAutomation2, &pIUIAutomation2);\n    }\n    if (SUCCEEDED(hr))\n    {\n        hr = pIUIAutomation2->lpVtbl->ElementFromPoint(pIUIAutomation2, pt, &pIUIAutomationElement);\n    }\n    if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)\n    {\n        hr = pIUIAutomationElement->lpVtbl->get_CurrentName(pIUIAutomationElement, &elemName);\n    }\n    if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)\n    {\n        hr = pIUIAutomationElement->lpVtbl->get_CurrentClassName(pIUIAutomationElement, &elemType);\n    }\n    if (SUCCEEDED(hr) && bIsWindows11Version22H2OrHigher)\n    {\n        bRet = elemName && elemType && (!wcscmp(elemName, L\"\") && !wcscmp(elemType, L\"Taskbar.TaskbarFrameAutomationPeer\"));\n    }\n    if (SUCCEEDED(hr) && !bIsWindows11Version22H2OrHigher)\n    {\n        hr = pIUIAutomationElement->lpVtbl->get_CurrentNativeWindowHandle(pIUIAutomationElement, &hWnd);\n    }\n    if (SUCCEEDED(hr) && !bIsWindows11Version22H2OrHigher)\n    {\n        WCHAR wszClassName[200];\n        GetClassNameW(hWnd, wszClassName, 200);\n        if (IsWindow(hWnd))\n        {\n            if (!wcscmp(wszClassName, L\"Windows.UI.Input.InputSite.WindowClass\"))\n            {\n                HWND hAncestor = GetAncestor(hWnd, GA_ROOT);\n                HWND hWindow = FindWindowExW(hAncestor, NULL, L\"Windows.UI.Composition.DesktopWindowContentBridge\", NULL);\n                if (IsWindow(hWindow))\n                {\n                    hWindow = FindWindowExW(hWindow, NULL, L\"Windows.UI.Input.InputSite.WindowClass\", NULL);\n                    if (IsWindow(hWindow))\n                    {\n                        if (hWindow == hWnd)\n                        {\n                            bRet = TRUE;\n                        }\n                    }\n                }\n            }\n            else if (!wcscmp(wszClassName, L\"MSTaskListWClass\"))\n            {\n                IUIAutomationTreeWalker* pControlWalker = NULL;\n                IUIAutomationElement* pTaskbarButton = NULL;\n                IUIAutomationElement* pNextTaskbarButton = NULL;\n                RECT rc;\n                if (SUCCEEDED(hr))\n                {\n                    hr = pIUIAutomation2->lpVtbl->get_RawViewWalker(pIUIAutomation2, &pControlWalker);\n                }\n                if (SUCCEEDED(hr) && pControlWalker)\n                {\n                    hr = pControlWalker->lpVtbl->GetFirstChildElement(pControlWalker, pIUIAutomationElement, &pTaskbarButton);\n                }\n                BOOL bValid = TRUE, bFirst = TRUE;\n                while (SUCCEEDED(hr) && pTaskbarButton)\n                {\n                    pControlWalker->lpVtbl->GetNextSiblingElement(pControlWalker, pTaskbarButton, &pNextTaskbarButton);\n                    SetRect(&rc, 0, 0, 0, 0);\n                    pTaskbarButton->lpVtbl->get_CurrentBoundingRectangle(pTaskbarButton, &rc);\n                    if (bFirst)\n                    {\n                        // Account for Start button as well\n                        rc.left -= (rc.right - rc.left);\n                        bFirst = FALSE;\n                    }\n                    //printf(\"PT %d %d RECT %d %d %d %d\\n\", pt.x, pt.y, rc.left, rc.top, rc.right, rc.bottom);\n                    if (pNextTaskbarButton && PtInRect(&rc, pt))\n                    {\n                        bValid = FALSE;\n                    }\n                    pTaskbarButton->lpVtbl->Release(pTaskbarButton);\n                    pTaskbarButton = pNextTaskbarButton;\n                }\n                //printf(\"IS VALID %d\\n\", bValid);\n                //printf(\"\\n\");\n                if (pControlWalker)\n                {\n                    pControlWalker->lpVtbl->Release(pControlWalker);\n                }\n                if (bValid)\n                {\n                    HWND hAncestor = GetAncestor(hWnd, GA_ROOT);\n                    HWND hWindow = FindWindowExW(hAncestor, NULL, L\"WorkerW\", NULL);\n                    if (IsWindow(hWindow))\n                    {\n                        hWindow = FindWindowExW(hWindow, NULL, L\"MSTaskListWClass\", NULL);\n                        if (IsWindow(hWindow))\n                        {\n                            if (hWindow == hWnd)\n                            {\n                                bRet = TRUE;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n    if (elemName)\n    {\n        SysFreeString(elemName);\n    }\n    if (elemType)\n    {\n        SysFreeString(elemType);\n    }\n    if (pIUIAutomationElement)\n    {\n        pIUIAutomationElement->lpVtbl->Release(pIUIAutomationElement);\n    }\n    if (pIUIAutomation2)\n    {\n        pIUIAutomation2->lpVtbl->Release(pIUIAutomation2);\n    }\n    return bRet;\n}\n\nlong long TaskbarLeftClickTime = 0;\nBOOL bTaskbarLeftClickEven = FALSE;\nLRESULT CALLBACK Shell_TrayWndMouseProc(\n    _In_ int    nCode,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam\n)\n{\n    if (!bOldTaskbar &&\n        !bNoPropertiesInContextMenu &&\n        nCode == HC_ACTION && \n        wParam == WM_RBUTTONUP && \n        IsPointOnEmptyAreaOfNewTaskbar(((MOUSEHOOKSTRUCT*)lParam)->pt)\n        )\n    {\n        PostMessageW(\n            FindWindowW(L\"Shell_TrayWnd\", NULL),\n            RegisterWindowMessageW(L\"Windows11ContextMenu_\" _T(EP_CLSID)),\n            0,\n            MAKELPARAM(((MOUSEHOOKSTRUCT*)lParam)->pt.x, ((MOUSEHOOKSTRUCT*)lParam)->pt.y)\n        );\n        return 1;\n    }\n    if (!bOldTaskbar &&\n        bTaskbarAutohideOnDoubleClick && \n        nCode == HC_ACTION && \n        wParam == WM_LBUTTONUP &&\n        IsPointOnEmptyAreaOfNewTaskbar(((MOUSEHOOKSTRUCT*)lParam)->pt)\n        )\n    {\n        /*BOOL bShouldCheck = FALSE;\n        if (bOldTaskbar)\n        {\n            WCHAR cn[200];\n            GetClassNameW(((MOUSEHOOKSTRUCT*)lParam)->hwnd, cn, 200);\n            wprintf(L\"%s\\n\", cn);\n            bShouldCheck = !wcscmp(cn, L\"Shell_SecondaryTrayWnd\"); // !wcscmp(cn, L\"Shell_TrayWnd\")\n        }\n        else\n        {\n            bShouldCheck = IsPointOnEmptyAreaOfNewTaskbar(((MOUSEHOOKSTRUCT*)lParam)->pt);\n        }\n        if (bShouldCheck)\n        {*/\n            if (bTaskbarLeftClickEven)\n            {\n                if (TaskbarLeftClickTime != 0)\n                {\n                    TaskbarLeftClickTime = milliseconds_now() - TaskbarLeftClickTime;\n                }\n                if (TaskbarLeftClickTime != 0 && TaskbarLeftClickTime < GetDoubleClickTime())\n                {\n                    TaskbarLeftClickTime = 0;\n                    ToggleTaskbarAutohide();\n                }\n                else\n                {\n                    TaskbarLeftClickTime = milliseconds_now();\n                }\n            }\n            bTaskbarLeftClickEven = !bTaskbarLeftClickEven;\n        //}\n    }\n    return CallNextHookEx(Shell_TrayWndMouseHook, nCode, wParam, lParam);\n}\n\nITrayUIHost* g_pTrayUIHost;\n\nINT64 Shell_TrayWndSubclassProc(\n    _In_ HWND   hWnd,\n    _In_ UINT   uMsg,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam,\n    UINT_PTR    uIdSubclass,\n    DWORD_PTR   bIsPrimaryTaskbar\n)\n{\n    switch (uMsg)\n    {\n        case WM_NCDESTROY:\n        {\n            if (bIsPrimaryTaskbar)\n            {\n                UnhookWindowsHookEx(Shell_TrayWndMouseHook);\n            }\n            RemoveWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc);\n            break;\n        }\n        case WM_NCLBUTTONDOWN:\n        case WM_NCRBUTTONUP:\n        {\n            if (bOldTaskbar && !bIsPrimaryTaskbar && TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam))\n                return 0;\n            break;\n        }\n        case WM_CONTEXTMENU:\n        {\n            if (!bIsPrimaryTaskbar)\n            {\n                // Received some times when right clicking a secondary taskbar button, and it would\n                // show the classic taskbar context menu but containing only \"Show desktop\" instead\n                // of ours or a button's jump list, so we cancel it and that seems to properly invoke\n                // the right menu\n                return 0;\n            }\n            break;\n        }\n        case WM_SETCURSOR:\n        {\n            if (!bOldTaskbar && !bIsPrimaryTaskbar)\n            {\n                // Received when mouse is over taskbar edge and autohide is on\n                PostMessageW(hWnd, WM_ACTIVATE, WA_ACTIVE, NULL);\n            }\n            break;\n        }\n        case WM_LBUTTONDBLCLK:\n        {\n            if (bOldTaskbar && bTaskbarAutohideOnDoubleClick)\n            {\n                ToggleTaskbarAutohide();\n                return 0;\n            }\n            break;\n        }\n        case WM_HOTKEY:\n        {\n            if (wParam == 500 && lParam == MAKELPARAM(MOD_WIN, 'A') && (bOldTaskbar && bHideControlCenterButton || global_rovi.dwBuildNumber >= 25921 && bOldTaskbar == 1))\n            {\n                InvokeActionCenter();\n                return 0;\n            }\n            break;\n        }\n        case WM_DISPLAYCHANGE:\n        {\n            if (bIsPrimaryTaskbar)\n            {\n                UpdateStartMenuPositioning(MAKELPARAM(TRUE, FALSE));\n            }\n            break;\n        }\n        /*case WM_PARENTNOTIFY:\n        {\n            if (!bOldTaskbar && wParam == WM_RBUTTONDOWN && !Shell_TrayWndMouseHook) // && !IsUndockingDisabled\n            {\n                DWORD dwThreadId = GetCurrentThreadId();\n                Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, dwThreadId);\n            }\n            break;\n        }*/\n        case WM_SETTINGCHANGE:\n        {\n            if (IsWindows11Version22H2OrHigher() && (*((WORD*)&(lParam)+1)) && !wcscmp(lParam, L\"EnsureXAML\"))\n            {\n                EnsureXAML();\n                return 0;\n            }\n            break;\n        }\n        case 0x558:\n        {\n            g_bIsDesktopRaised = (lParam & 1) == 0;\n            break;\n        }\n        case WM_QUIT:\n        {\n            if (AreLogonLogoffShutdownSoundsEnabled())\n            {\n                TermSoundWindow();\n            }\n            break;\n        }\n        case 0x581:\n        {\n            if (AreLogonLogoffShutdownSoundsEnabled())\n            {\n                BOOL bLogoff = wParam != 0;\n                SHPlaySound(bLogoff ? L\"WindowsLogoff\" : L\"WindowsLogon\", 1);\n            }\n            break;\n        }\n        case 0x590:\n        {\n            if (AreLogonLogoffShutdownSoundsEnabled())\n            {\n                InitSoundWindow();\n            }\n            break;\n        }\n        case 0x5B4:\n        {\n            if (AreLogonLogoffShutdownSoundsEnabled())\n            {\n                TermSoundWindow();\n            }\n            break;\n        }\n    }\n\n    if (uMsg >= 0xC000 && uMsg <= 0xFFFF && uMsg == RegisterWindowMessageW(L\"Windows11ContextMenu_\" _T(EP_CLSID)))\n    {\n        POINT pt;\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n\n        HMENU hMenu = LoadMenuW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(205));\n        if (!hMenu && g_hMyTaskbar)\n        {\n            hMenu = LoadMenuW(g_hMyTaskbar, MAKEINTRESOURCEW(205));\n        }\n        if (hMenu)\n        {\n            HMENU hSubMenu = GetSubMenu(hMenu, 0);\n            if (hSubMenu)\n            {\n                if (GetAsyncKeyState(VK_SHIFT) >= 0 || GetAsyncKeyState(VK_CONTROL) >= 0)\n                {\n                    DeleteMenu(hSubMenu, 518, MF_BYCOMMAND); // Exit Explorer\n                }\n                DeleteMenu(hSubMenu, 424, MF_BYCOMMAND); // Lock the taskbar\n                DeleteMenu(hSubMenu, 425, MF_BYCOMMAND); // Lock all taskbars\n                if (g_pTrayUIHost)\n                {\n                    void** pTrayUIHostVtbl = *(void***)g_pTrayUIHost;\n                    BOOL(*ShouldDeleteContextMenuUndo)(ITrayUIHost*) = pTrayUIHostVtbl[13];\n                    UINT(*GetContextMenuUndoResourceId)(ITrayUIHost*) = pTrayUIHostVtbl[14];\n\n                    if (ShouldDeleteContextMenuUndo(g_pTrayUIHost))\n                    {\n                        DeleteMenu(hSubMenu, 416, MF_BYCOMMAND);\n                    }\n                    else\n                    {\n                        WCHAR wszTemplate[64];\n                        WCHAR wszCommand[96];\n                        WCHAR wszMenu[160];\n                        LoadStringW(GetModuleHandleW(NULL), 534, wszTemplate, 64);\n                        LoadStringW(GetModuleHandleW(NULL), GetContextMenuUndoResourceId(g_pTrayUIHost), wszCommand, 96);\n                        swprintf_s(wszMenu, 160, wszTemplate, wszCommand);\n                        ModifyMenuW(hSubMenu, 416, MF_BYCOMMAND, 416, wszMenu);\n                    }\n                }\n                else\n                {\n                    DeleteMenu(hSubMenu, 416, MF_BYCOMMAND); // Undo\n                }\n                DeleteMenu(hSubMenu, 437, MF_BYCOMMAND); // Show Pen button\n                DeleteMenu(hSubMenu, 438, MF_BYCOMMAND); // Show touchpad button\n                DeleteMenu(hSubMenu, 435, MF_BYCOMMAND); // Show People on the taskbar\n                DeleteMenu(hSubMenu, 430, MF_BYCOMMAND); // Show Task View button\n                DeleteMenu(hSubMenu, 449, MF_BYCOMMAND); // Show Cortana button\n                DeleteMenu(hSubMenu, 621, MF_BYCOMMAND); // News and interests\n                DeleteMenu(hSubMenu, 445, MF_BYCOMMAND); // Cortana\n                DeleteMenu(hSubMenu, 431, MF_BYCOMMAND); // Search\n                DeleteMenu(hSubMenu, 421, MF_BYCOMMAND); // Customize notification icons\n                DeleteMenu(hSubMenu, 408, MF_BYCOMMAND); // Adjust date/time\n                DeleteMenu(hSubMenu, 436, MF_BYCOMMAND); // Show touch keyboard button\n                DeleteMenu(hSubMenu, 0, MF_BYPOSITION); // Separator\n                DeleteMenu(hSubMenu, 0, MF_BYPOSITION); // Separator\n\n                TCHAR buffer[260];\n                LoadStringW(GetModuleHandleW(L\"ExplorerFrame.dll\"), 50222, buffer + (bNoMenuAccelerator ? 0 : 1), 260);\n                if (!bNoMenuAccelerator)\n                {\n                    buffer[0] = L'&';\n                }\n                wchar_t* p = wcschr(buffer, L'(');\n                if (p)\n                {\n                    p--;\n                    if (*p == L' ')\n                    {\n                        *p = 0;\n                    }\n                    else\n                    {\n                        p++;\n                        *p = 0;\n                    }\n                }\n                MENUITEMINFOW menuInfo;\n                ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n                menuInfo.cbSize = sizeof(MENUITEMINFOW);\n                menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;\n                menuInfo.wID = 3999;\n                menuInfo.dwItemData = 0;\n                menuInfo.fType = MFT_STRING;\n                menuInfo.dwTypeData = buffer;\n                menuInfo.cch = wcslen(buffer);\n                if (!bNoPropertiesInContextMenu)\n                {\n                    InsertMenuItemW(\n                        hSubMenu,\n                        GetMenuItemCount(hSubMenu) - 1,\n                        TRUE,\n                        &menuInfo\n                    );\n                }\n\n                INT64* unknown_array = NULL;\n                if (bSkinMenus)\n                {\n                    unknown_array = calloc(4, sizeof(INT64));\n                    if (ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)\n                    {\n                        ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\n                            hSubMenu,\n                            hWnd,\n                            &pt,\n                            0xc,\n                            unknown_array\n                        );\n                    }\n                }\n\n                BOOL res = TrackPopupMenu(\n                    hSubMenu,\n                    TPM_RETURNCMD | TPM_RIGHTBUTTON,\n                    pt.x,\n                    pt.y,\n                    0,\n                    hWnd,\n                    0\n                );\n                if (res == 3999)\n                {\n                    LaunchPropertiesGUI(hModule);\n                }\n                else if (res == 420)\n                {\n                    // Restore Task Manager context menu item action on 24H2+\n                    SHELLEXECUTEINFOW sei = { sizeof(sei) };\n                    sei.fMask = SEE_MASK_DOENVSUBST;\n                    sei.lpFile = L\"%SystemRoot%\\\\system32\\\\taskmgr.exe\";\n                    sei.lpParameters = L\"/4\";\n                    sei.nShow = SW_SHOWNORMAL;\n                    ShellExecuteExW(&sei);\n                }\n                else\n                {\n                    PostMessageW(hWnd, WM_COMMAND, res, 0);\n                }\n\n                if (bSkinMenus)\n                {\n                    if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                    {\n                        ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                            hSubMenu,\n                            hWnd\n                        );\n                    }\n                    free(unknown_array);\n                }\n\n                DestroyMenu(hSubMenu);\n            }\n            DestroyMenu(hMenu);\n        }\n    }\n\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Allow legacy volume applet\"\n#if WITH_MAIN_PATCHER\nLSTATUS sndvolsso_RegGetValueW(\n    HKEY    hkey,\n    LPCWSTR lpSubKey,\n    LPCWSTR lpValue,\n    DWORD   dwFlags,\n    LPDWORD pdwType,\n    PVOID   pvData,\n    LPDWORD pcbData\n)\n{\n    if (SHRegGetValueFromHKCUHKLMFunc &&\n        hkey == HKEY_LOCAL_MACHINE &&\n        !_wcsicmp(lpSubKey, L\"Software\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\MTCUVC\") &&\n        !_wcsicmp(lpValue, L\"EnableMTCUVC\"))\n    {\n        return SHRegGetValueFromHKCUHKLMFunc(\n            lpSubKey,\n            lpValue,\n            SRRF_RT_REG_DWORD,\n            pdwType,\n            pvData,\n            pcbData\n        );\n    }\n    return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Allow legacy date and time\"\n#if WITH_MAIN_PATCHER\nDEFINE_GUID(GUID_Win32Clock,\n    0x0A323554A,\n    0x0FE1, 0x4E49, 0xae, 0xe1,\n    0x67, 0x22, 0x46, 0x5d, 0x79, 0x9f\n);\nDEFINE_GUID(IID_Win32Clock,\n    0x7A5FCA8A,\n    0x76B1, 0x44C8, 0xa9, 0x7c,\n    0xe7, 0x17, 0x3c, 0xca, 0x5f, 0x4f\n);\ntypedef interface Win32Clock Win32Clock;\n\ntypedef struct Win32ClockVtbl\n{\n    BEGIN_INTERFACE\n\n        HRESULT(STDMETHODCALLTYPE* QueryInterface)(\n            Win32Clock* This,\n            /* [in] */ REFIID riid,\n            /* [annotation][iid_is][out] */\n            _COM_Outptr_  void** ppvObject);\n\n    ULONG(STDMETHODCALLTYPE* AddRef)(\n        Win32Clock* This);\n\n    ULONG(STDMETHODCALLTYPE* Release)(\n        Win32Clock* This);\n\n    HRESULT(STDMETHODCALLTYPE* ShowWin32Clock)(\n        Win32Clock* This,\n        /* [in] */ HWND hWnd,\n        /* [in] */ LPRECT lpRect);\n\n    END_INTERFACE\n} Win32ClockVtbl;\n\ninterface Win32Clock\n{\n    CONST_VTBL struct Win32ClockVtbl* lpVtbl;\n};\nDWORD ShouldShowLegacyClockExperience()\n{\n    DWORD dwVal = 0, dwSize = sizeof(DWORD);\n    if (SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(\n        TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\ImmersiveShell\"),\n        TEXT(\"UseWin32TrayClockExperience\"),\n        SRRF_RT_REG_DWORD,\n        NULL,\n        &dwVal,\n        (LPDWORD)(&dwSize)\n    ) == ERROR_SUCCESS)\n    {\n        return dwVal;\n    }\n    return 0;\n}\nBOOL ShowLegacyClockExperience(HWND hWnd)\n{\n    if (!hWnd)\n    {\n        return FALSE;\n    }\n    HRESULT hr = S_OK;\n    Win32Clock* pWin32Clock = NULL;\n    hr = CoCreateInstance(\n        &GUID_Win32Clock,\n        NULL,\n        CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,\n        &IID_Win32Clock,\n        &pWin32Clock\n    );\n    if (SUCCEEDED(hr))\n    {\n        RECT rc;\n        GetWindowRect(hWnd, &rc);\n        pWin32Clock->lpVtbl->ShowWin32Clock(pWin32Clock, hWnd, &rc);\n        pWin32Clock->lpVtbl->Release(pWin32Clock);\n    }\n    return TRUE;\n}\n\nINT64 ClockButtonSubclassProc(\n    _In_ HWND   hWnd,\n    _In_ UINT   uMsg,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam,\n    UINT_PTR    uIdSubclass,\n    DWORD_PTR   dwRefData\n)\n{\n    if (uMsg == WM_NCDESTROY)\n    {\n        RemoveWindowSubclass(hWnd, ClockButtonSubclassProc, ClockButtonSubclassProc);\n    }\n    else if (uMsg == WM_LBUTTONDOWN || (uMsg == WM_KEYDOWN && wParam == VK_RETURN))\n    {\n        if (ShouldShowLegacyClockExperience() == 1)\n        {\n            if (!FindWindowW(L\"ClockFlyoutWindow\", NULL))\n            {\n                return ShowLegacyClockExperience(hWnd);\n            }\n            else\n            {\n                return 1;\n            }\n        }\n        else if (ShouldShowLegacyClockExperience() == 2)\n        {\n            if (FindWindowW(L\"Windows.UI.Core.CoreWindow\", NULL))\n            {\n                if (IsWindows11())\n                {\n                    ToggleNotificationsFlyout();\n                }\n                else\n                {\n                    ToggleActionCenter();\n                }\n            }\n            return 1;\n        }\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Popup menu hooks\"\nBOOL IsImmersiveMenu = FALSE;\nBOOL CheckIfImmersiveContextMenu(\n    HWND unnamedParam1,\n    LPCSTR unnamedParam2,\n    HANDLE unnamedParam3\n)\n{\n    if ((*((WORD*)&(unnamedParam2)+1)))\n    {\n        if (!strncmp(unnamedParam2, \"ImmersiveContextMenuArray\", 25))\n        {\n            IsImmersiveMenu = TRUE;\n            return FALSE;\n        }\n    }\n    return TRUE;\n}\nvoid RemoveOwnerDrawFromMenu(int level, HMENU hMenu)\n{\n    if (hMenu)\n    {\n        int k = GetMenuItemCount(hMenu);\n        for (int i = 0; i < k; ++i)\n        {\n            MENUITEMINFO mii;\n            mii.cbSize = sizeof(MENUITEMINFO);\n            mii.fMask = MIIM_FTYPE | MIIM_SUBMENU;\n            if (GetMenuItemInfoW(hMenu, i, TRUE, &mii) && (mii.fType & MFT_OWNERDRAW))\n            {\n                mii.fType &= ~MFT_OWNERDRAW;\n                printf(\"[ROD]: Level %d Position %d/%d Status %d\\n\", level, i, k, SetMenuItemInfoW(hMenu, i, TRUE, &mii));\n                RemoveOwnerDrawFromMenu(level + 1, mii.hSubMenu);\n            }\n        }\n    }\n}\nBOOL CheckIfMenuContainsOwnPropertiesItem(HMENU hMenu)\n{\n#if WITH_MAIN_PATCHER\n    if (hMenu)\n    {\n        int k = GetMenuItemCount(hMenu);\n        for (int i = k - 1; i >= 0; i--)\n        {\n            MENUITEMINFO mii;\n            mii.cbSize = sizeof(MENUITEMINFO);\n            mii.fMask = MIIM_DATA | MIIM_ID;\n            BOOL b = GetMenuItemInfoW(hMenu, i, TRUE, &mii);\n            if (b && (mii.wID >= 12000 && mii.wID <= 12200) && mii.dwItemData == (ULONG_PTR)CheckForUpdatesThread)\n            {\n                return TRUE;\n            }\n        }\n    }\n#endif\n    return FALSE;\n}\n\n#if WITH_MAIN_PATCHER\n#define DEFINE_IMMERSIVE_MENU_HOOK(name) \\\n    static ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t name##_ApplyOwnerDrawToMenuFunc = NULL; \\\n    static HRESULT name##_ApplyOwnerDrawToMenuHook(HMENU hMenu, HWND hWnd, POINT* pPt, unsigned int options, void* data) \\\n    { \\\n        wchar_t wszClassName[200]; \\\n        ZeroMemory(wszClassName, 200); \\\n        GetClassNameW(hWnd, wszClassName, 200); \\\n        \\\n        BOOL bDisableSkinning = (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")) ? !bSkinMenus : bDisableImmersiveContextMenu; \\\n        if (bDisableSkinning) \\\n        { \\\n            return S_OK; \\\n        } \\\n        return name##_ApplyOwnerDrawToMenuFunc(hMenu, hWnd, pPt, options, data); \\\n    }\n\n#define DEFINE_IMMERSIVE_MENU_HOOK_TB(name) \\\n    static ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t name##_ApplyOwnerDrawToMenuFunc = NULL; \\\n    static HRESULT name##_ApplyOwnerDrawToMenuHook(HMENU hMenu, HWND hWnd, POINT* pPt, unsigned int options, void* data) \\\n    { \\\n        BOOL bDisableSkinning = !bSkinMenus; \\\n        if (bDisableSkinning) \\\n        { \\\n            return S_OK; \\\n        } \\\n        return name##_ApplyOwnerDrawToMenuFunc(hMenu, hWnd, pPt, options, data); \\\n    }\n\nDEFINE_IMMERSIVE_MENU_HOOK_TB(Sndvolsso);\nDEFINE_IMMERSIVE_MENU_HOOK(Shell32);\nDEFINE_IMMERSIVE_MENU_HOOK(ExplorerFrame);\nDEFINE_IMMERSIVE_MENU_HOOK(Explorer);\nDEFINE_IMMERSIVE_MENU_HOOK_TB(Pnidui);\nDEFINE_IMMERSIVE_MENU_HOOK_TB(InputSwitch);\n\nstatic void HookImmersiveMenuFunctions(\n    funchook_t* funchook,\n    HMODULE module,\n    ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t* applyFunc,\n    ImmersiveContextMenuHelper_ApplyOwnerDrawToMenu_t applyHook)\n{\n    PBYTE pText;\n    DWORD cbText;\n    if (!TextSectionBeginAndSize(module, &pText, &cbText))\n        return;\n\n    // Don't forget to sync with TryToFindTwinuiPCShellOffsets in TwinUIPatches.cpp!\n#if defined(_M_X64)\n    // 40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B ? ? ? ? ? 41 8B C1\n    PBYTE match = (PBYTE)FindPattern(\n        pText, cbText,\n        \"\\x40\\x55\\x53\\x56\\x57\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\\x8D\\xAC\\x24\\x00\\x00\\x00\\x00\\x48\\x81\\xEC\\x00\\x00\\x00\\x00\\x48\\x8B\\x05\\x00\\x00\\x00\\x00\\x48\\x33\\xC4\\x48\\x89\\x85\\x00\\x00\\x00\\x00\\x4C\\x8B\\x00\\x00\\x00\\x00\\x00\\x41\\x8B\\xC1\",\n        \"xxxxxxxxxxxxxxxxx????xxx????xxx????xxxxxx????xx?????xxx\"\n    );\n#elif defined(_M_ARM64)\n    // 40 F9 43 03 1C 32 E4 03 ?? AA ?? ?? FF 97\n    //                               ^^^^^^^^^^^\n    // Ref: ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu()\n    PBYTE match = (PBYTE)FindPattern(\n        pText, cbText,\n        \"\\x40\\xF9\\x43\\x03\\x1C\\x32\\xE4\\x03\\x00\\xAA\\x00\\x00\\xFF\\x97\",\n        \"xxxxxxxx?x??xx\"\n    );\n    if (match)\n    {\n        match += 10;\n        match = (PBYTE)ARM64_FollowBL((DWORD*)match);\n    }\n    else\n    {\n        // 43 03 1C 32 E4 03 ?? AA E2 03 ?? AA ?? ?? FF 97 // 27938\n        //                                     ^^^^^^^^^^^\n        // Ref: ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu()\n        match = (PBYTE)FindPattern(\n            pText, cbText,\n            \"\\x43\\x03\\x1C\\x32\\xE4\\x03\\x00\\xAA\\xE2\\x03\\x00\\xAA\\x00\\x00\\xFF\\x97\",\n            \"xxxxxx?xxx?x??xx\"\n        );\n        if (match)\n        {\n            match += 12;\n            match = (PBYTE)ARM64_FollowBL((DWORD*)match);\n        }\n    }\n#endif\n    if (match)\n    {\n        *applyFunc = match;\n        funchook_prepare(\n            funchook,\n            (void**)applyFunc,\n            applyHook\n        );\n    }\n}\n\n#define HOOK_IMMERSIVE_MENUS(name) \\\n    HookImmersiveMenuFunctions( \\\n        funchook, \\\n        h##name, \\\n        &name##_ApplyOwnerDrawToMenuFunc, \\\n        name##_ApplyOwnerDrawToMenuHook \\\n    )\n#else\n#define HOOK_IMMERSIVE_MENUS(name)\n#endif\n\nBOOL TrackPopupMenuHookEx(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    IsImmersiveMenu = FALSE;\n\n    wchar_t wszClassName[200];\n    ZeroMemory(wszClassName, 200);\n    GetClassNameW(hWnd, wszClassName, 200);\n\n    BOOL bIsTaskbar = (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")) ? !bSkinMenus : bDisableImmersiveContextMenu;\n    //wprintf(L\">> %s %d %d\\n\", wszClassName, bIsTaskbar, bIsExplorerProcess);\n\n    BOOL bContainsOwn = FALSE;\n    if (bIsExplorerProcess && (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")))\n    {\n        bContainsOwn = CheckIfMenuContainsOwnPropertiesItem(hMenu);\n    }\n\n    if (bIsTaskbar && (bIsExplorerProcess ? 1 : (!wcscmp(wszClassName, L\"SHELLDLL_DefView\") || !wcscmp(wszClassName, L\"SysTreeView32\"))))\n    {\n        EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n        if (IsImmersiveMenu)\n        {\n            IsImmersiveMenu = FALSE;\n#if !WITH_MAIN_PATCHER\n            if (bIsExplorerProcess)\n            {\n#else\n            if (bIsExplorerProcess && ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n            {\n                POINT pt;\n                pt.x = x;\n                pt.y = y;\n                ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                    hMenu,\n                    hWnd\n                );\n#endif\n            }\n            else\n            {\n                RemoveOwnerDrawFromMenu(0, hMenu);\n            }\n\n            BOOL bRet = TrackPopupMenuEx(\n                hMenu,\n                uFlags,\n                x,\n                y,\n                hWnd,\n                lptpm\n            );\n#if WITH_MAIN_PATCHER\n            if (bContainsOwn && (bRet >= 12000 && bRet <= 12200))\n            {\n                LaunchPropertiesGUI(hModule);\n                return FALSE;\n            }\n#endif\n            return bRet;\n        }\n        IsImmersiveMenu = FALSE;\n    }\n    BOOL b = TrackPopupMenuEx(\n        hMenu,\n        uFlags,\n        x,\n        y,\n        hWnd,\n        lptpm\n    );\n#if WITH_MAIN_PATCHER\n    if (bContainsOwn && (b >= 12000 && b <= 12200))\n    {\n        LaunchPropertiesGUI(hModule);\n        return FALSE;\n    }\n#endif\n    return b;\n}\nBOOL TrackPopupMenuHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    int         nReserved,\n    HWND        hWnd,\n    const RECT* prcRect\n)\n{\n    IsImmersiveMenu = FALSE;\n\n    wchar_t wszClassName[200];\n    ZeroMemory(wszClassName, 200);\n    GetClassNameW(hWnd, wszClassName, 200);\n\n    BOOL bIsTaskbar = (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")) ? !bSkinMenus : bDisableImmersiveContextMenu;\n    //wprintf(L\">> %s %d %d\\n\", wszClassName, bIsTaskbar, bIsExplorerProcess);\n\n    BOOL bContainsOwn = FALSE;\n    if (bIsExplorerProcess && (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")))\n    {\n        bContainsOwn = CheckIfMenuContainsOwnPropertiesItem(hMenu);\n    }\n\n    if (bIsTaskbar && (bIsExplorerProcess ? 1 : (!wcscmp(wszClassName, L\"SHELLDLL_DefView\") || !wcscmp(wszClassName, L\"SysTreeView32\"))))\n    {\n        EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n        if (IsImmersiveMenu)\n        {\n            IsImmersiveMenu = FALSE;\n\n#if !WITH_MAIN_PATCHER\n            if (bIsExplorerProcess)\n            {\n#else\n            if (bIsExplorerProcess && ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n            {\n                POINT pt;\n                pt.x = x;\n                pt.y = y;\n                ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                    hMenu,\n                    hWnd\n                );\n#endif\n            }\n            else\n            {\n                RemoveOwnerDrawFromMenu(0, hMenu);\n            }\n\n            BOOL bRet = TrackPopupMenu(\n                hMenu,\n                uFlags,\n                x,\n                y,\n                0,\n                hWnd,\n                prcRect\n            );\n#if WITH_MAIN_PATCHER\n            if (bContainsOwn && (bRet >= 12000 && bRet <= 12200))\n            {\n                LaunchPropertiesGUI(hModule);\n                return FALSE;\n            }\n#endif\n            return bRet;\n        }\n        IsImmersiveMenu = FALSE;\n    }\n    BOOL b = TrackPopupMenu(\n        hMenu,\n        uFlags,\n        x,\n        y,\n        0,\n        hWnd,\n        prcRect\n    );\n#if WITH_MAIN_PATCHER\n    if (bContainsOwn && (b >= 12000 && b <= 12200))\n    {\n        LaunchPropertiesGUI(hModule);\n        return FALSE;\n    }\n#endif\n    return b;\n}\n#if WITH_MAIN_PATCHER\n#define TB_POS_NOWHERE 0\n#define TB_POS_BOTTOM 1\n#define TB_POS_TOP 2\n#define TB_POS_LEFT 3\n#define TB_POS_RIGHT 4\nUINT GetTaskbarLocationAndSize(POINT ptCursor, RECT* rc)\n{\n    MONITORINFO mi;\n    mi.cbSize = sizeof(MONITORINFO);\n    HWND hWnd = GetMonitorInfoFromPointForTaskbarFlyoutActivation(\n        ptCursor,\n        MONITOR_DEFAULTTOPRIMARY,\n        &mi\n    );\n    if (hWnd)\n    {\n        GetWindowRect(hWnd, rc);\n        RECT rcC = *rc;\n        rcC.left -= mi.rcMonitor.left;\n        rcC.right -= mi.rcMonitor.left;\n        rcC.top -= mi.rcMonitor.top;\n        rcC.bottom -= mi.rcMonitor.top;\n        if (rcC.left < 5 && rcC.top > 5)\n        {\n            return TB_POS_BOTTOM;\n        }\n        else if (rcC.left < 5 && rcC.top < 5 && rcC.right > rcC.bottom)\n        {\n            return TB_POS_TOP;\n        }\n        else if (rcC.left < 5 && rcC.top < 5 && rcC.right < rcC.bottom)\n        {\n            return TB_POS_LEFT;\n        }\n        else if (rcC.left > 5 && rcC.top < 5)\n        {\n            return TB_POS_RIGHT;\n        }\n    }\n    return TB_POS_NOWHERE;\n}\nvoid PopupMenuAdjustCoordinatesAndFlags(int* x, int* y, UINT* uFlags)\n{\n    POINT pt;\n    GetCursorPos(&pt);\n    RECT rc;\n    UINT tbPos = GetTaskbarLocationAndSize(pt, &rc);\n    if (tbPos == TB_POS_BOTTOM)\n    {\n        *y = MIN(*y, rc.top);\n        *uFlags |= TPM_CENTERALIGN | TPM_BOTTOMALIGN;\n    }\n    else if (tbPos == TB_POS_TOP)\n    {\n        *y = MAX(*y, rc.bottom);\n        *uFlags |= TPM_CENTERALIGN | TPM_TOPALIGN;\n    }\n    else if (tbPos == TB_POS_LEFT)\n    {\n        *x = MAX(*x, rc.right);\n        *uFlags |= TPM_VCENTERALIGN | TPM_LEFTALIGN;\n    }\n    if (tbPos == TB_POS_RIGHT)\n    {\n        *x = MIN(*x, rc.left);\n        *uFlags |= TPM_VCENTERALIGN | TPM_RIGHTALIGN;\n    }\n}\nINT64 OwnerDrawSubclassProc(\n    _In_ HWND   hWnd,\n    _In_ UINT   uMsg,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam,\n    UINT_PTR    uIdSubclass,\n    DWORD_PTR   dwRefData\n)\n{\n    if ((uMsg == WM_DRAWITEM || uMsg == WM_MEASUREITEM) &&\n        CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc &&\n        CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc(hWnd, uMsg, wParam, lParam))\n    {\n        return 0;\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\nlong long explorer_TrackPopupMenuExElapsed = 0;\nBOOL explorer_TrackPopupMenuExHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    long long elapsed = milliseconds_now() - explorer_TrackPopupMenuExElapsed;\n    BOOL b = FALSE;\n\n    wchar_t wszClassName[200];\n    ZeroMemory(wszClassName, 200);\n    GetClassNameW(hWnd, wszClassName, 200);\n    BOOL bContainsOwn = FALSE;\n    if (bIsExplorerProcess && (!wcscmp(wszClassName, L\"Shell_TrayWnd\") || !wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\")))\n    {\n        bContainsOwn = CheckIfMenuContainsOwnPropertiesItem(hMenu);\n    }\n    \n    wchar_t wszClassNameOfWindowUnderCursor[200];\n    ZeroMemory(wszClassNameOfWindowUnderCursor, 200);\n    POINT p; p.x = x; p.y = y;\n    GetClassNameW(WindowFromPoint(p), wszClassNameOfWindowUnderCursor, 200);\n    BOOL bIsSecondaryTaskbar = (!wcscmp(wszClassName, L\"Shell_SecondaryTrayWnd\") && !wcscmp(wszClassNameOfWindowUnderCursor, L\"Shell_SecondaryTrayWnd\"));\n\n    if (elapsed > POPUPMENU_EX_ELAPSED || !bFlyoutMenus || bIsSecondaryTaskbar)\n    {\n        if (bCenterMenus && !bIsSecondaryTaskbar)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        IsImmersiveMenu = FALSE;\n        if (!bSkinMenus)\n        {\n            EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n            if (IsImmersiveMenu)\n            {\n                if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                {\n                    POINT pt;\n                    pt.x = x;\n                    pt.y = y;\n                    ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                        hMenu,\n                        hWnd\n                    );\n                }\n                else\n                {\n                    RemoveOwnerDrawFromMenu(0, hMenu);\n                }\n            }\n            IsImmersiveMenu = FALSE;\n        }\n        b = TrackPopupMenuEx(\n            hMenu,\n            uFlags,\n            x,\n            y,\n            hWnd,\n            lptpm\n        );\n        if (bContainsOwn && (b >= 12000 && b <= 12200))\n        {\n            LaunchPropertiesGUI(hModule);\n            return FALSE;\n        }\n        if (!bIsSecondaryTaskbar)\n        {\n            explorer_TrackPopupMenuExElapsed = milliseconds_now();\n        }\n    }\n    return b;\n}\nlong long pnidui_TrackPopupMenuElapsed = 0;\nBOOL pnidui_TrackPopupMenuHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    int         nReserved,\n    HWND        hWnd,\n    const RECT* prcRect\n)\n{\n    long long elapsed = milliseconds_now() - pnidui_TrackPopupMenuElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_PNIDUI_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        IsImmersiveMenu = FALSE;\n        if (!bSkinMenus)\n        {\n            EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n            if (IsImmersiveMenu)\n            {\n                if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                {\n                    POINT pt;\n                    pt.x = x;\n                    pt.y = y;\n                    ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                        hMenu,\n                        hWnd\n                    );\n                }\n                else\n                {\n                    RemoveOwnerDrawFromMenu(0, hMenu);\n                }\n            }\n            IsImmersiveMenu = FALSE;\n        }\n        b = TrackPopupMenu(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            0,\n            hWnd,\n            prcRect\n        );\n        if (bReplaceNetwork && b == 3109)\n        {\n            LaunchNetworkTargets(bReplaceNetwork + 2);\n            b = 0;\n        }\n        pnidui_TrackPopupMenuElapsed = milliseconds_now();\n    }\n    return b;\n}\nlong long sndvolsso_TrackPopupMenuExElapsed = 0;\nBOOL sndvolsso_TrackPopupMenuExHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    long long elapsed = milliseconds_now() - sndvolsso_TrackPopupMenuExElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_SNDVOLSSO_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        IsImmersiveMenu = FALSE;\n        if (!bSkinMenus)\n        {\n            EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n            if (IsImmersiveMenu)\n            {\n                if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                {\n                    POINT pt;\n                    pt.x = x;\n                    pt.y = y;\n                    ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                        hMenu,\n                        hWnd\n                    );\n                }\n                else\n                {\n                    RemoveOwnerDrawFromMenu(0, hMenu);\n                }\n            }\n            IsImmersiveMenu = FALSE;\n        }\n\n        /*MENUITEMINFOW menuInfo;\n        ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n        menuInfo.cbSize = sizeof(MENUITEMINFOW);\n        menuInfo.fMask = MIIM_ID | MIIM_STRING;\n        printf(\"GetMenuItemInfoW %d\\n\", GetMenuItemInfoW(\n            hMenu,\n            GetMenuItemCount(hMenu) - 1,\n            TRUE,\n            &menuInfo\n        ));\n        menuInfo.dwTypeData = malloc(menuInfo.cch + sizeof(wchar_t));\n        menuInfo.cch++;\n        printf(\"GetMenuItemInfoW %d\\n\", GetMenuItemInfoW(\n            hMenu,\n            GetMenuItemCount(hMenu) - 1,\n            TRUE,\n            &menuInfo\n        ));\n        wcscpy_s(menuInfo.dwTypeData, menuInfo.cch, L\"test\");\n        menuInfo.fMask = MIIM_STRING;\n        wprintf(L\"SetMenuItemInfoW %s %d\\n\", menuInfo.dwTypeData, SetMenuItemInfoW(\n            hMenu,\n            GetMenuItemCount(hMenu) - 1,\n            TRUE,\n            &menuInfo\n        ));\n        wcscpy_s(menuInfo.dwTypeData, menuInfo.cch, L\"\");\n        printf(\"GetMenuItemInfoW %d\\n\", GetMenuItemInfoW(\n            hMenu,\n            GetMenuItemCount(hMenu) - 1,\n            TRUE,\n            &menuInfo\n        ));\n        wprintf(L\"%s\\n\", menuInfo.dwTypeData);\n        free(menuInfo.dwTypeData);*/\n\n        b = TrackPopupMenuEx(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            hWnd,\n            lptpm\n        );\n        sndvolsso_TrackPopupMenuExElapsed = milliseconds_now();\n    }\n    return b;\n}\nvoid PatchSndvolsso()\n{\n    HANDLE hSndvolsso = LoadLibraryExW(L\"sndvolsso.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    VnPatchIAT(hSndvolsso, \"user32.dll\", \"TrackPopupMenuEx\", sndvolsso_TrackPopupMenuExHook);\n\n    // Create a local funchook because we can get called after the global one is installed\n    funchook_t* funchook = funchook_create();\n    HOOK_IMMERSIVE_MENUS(Sndvolsso);\n    funchook_install(funchook, 0);\n    funchook_destroy(funchook);\n    funchook = NULL;\n\n    VnPatchIAT(hSndvolsso, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegGetValueW\", sndvolsso_RegGetValueW);\n#ifdef USE_PRIVATE_INTERFACES\n    if (bSkinIcons)\n    {\n        VnPatchIAT(hSndvolsso, \"user32.dll\", \"LoadImageW\", SystemTray_LoadImageWHook);\n    }\n#endif\n    printf(\"Setup sndvolsso functions done\\n\");\n}\nlong long stobject_TrackPopupMenuExElapsed = 0;\nBOOL stobject_TrackPopupMenuExHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    long long elapsed = milliseconds_now() - stobject_TrackPopupMenuExElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_SAFETOREMOVE_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        INT64* unknown_array = NULL;\n        POINT pt;\n        if (bSkinMenus)\n        {\n            unknown_array = calloc(4, sizeof(INT64));\n            pt.x = x;\n            pt.y = y;\n            if (ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)\n            {\n                ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\n                    hMenu,\n                    hWnd,\n                    &(pt),\n                    0xc,\n                    unknown_array\n                );\n            }\n            SetWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc, 0);\n        }\n        b = TrackPopupMenuEx(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            hWnd,\n            lptpm\n        );\n        stobject_TrackPopupMenuExElapsed = milliseconds_now();\n        if (bSkinMenus)\n        {\n            RemoveWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc);\n            if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n            {\n                ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                    hMenu,\n                    hWnd\n                );\n            }\n            free(unknown_array);\n        }\n    }\n    return b;\n}\nlong long stobject_TrackPopupMenuElapsed = 0;\nBOOL stobject_TrackPopupMenuHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    int         nReserved,\n    HWND        hWnd,\n    const RECT* prcRect\n)\n{\n    long long elapsed = milliseconds_now() - stobject_TrackPopupMenuElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_SAFETOREMOVE_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        INT64* unknown_array = NULL;\n        POINT pt;\n        if (bSkinMenus)\n        {\n            unknown_array = calloc(4, sizeof(INT64));\n            pt.x = x;\n            pt.y = y;\n            if (ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)\n            {\n                ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\n                    hMenu,\n                    hWnd,\n                    &(pt),\n                    0xc,\n                    unknown_array\n                );\n            }\n            SetWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc, 0);\n        }\n        b = TrackPopupMenu(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            0,\n            hWnd,\n            prcRect\n        );\n        stobject_TrackPopupMenuElapsed = milliseconds_now();\n        if (bSkinMenus)\n        {\n            RemoveWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc);\n            if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n            {\n                ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                    hMenu,\n                    hWnd\n                );\n            }\n            free(unknown_array);\n        }\n    }\n    return b;\n}\nlong long bthprops_TrackPopupMenuExElapsed = 0;\nBOOL bthprops_TrackPopupMenuExHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    long long elapsed = milliseconds_now() - bthprops_TrackPopupMenuExElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_BLUETOOTH_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        INT64* unknown_array = NULL;\n        POINT pt;\n        if (bSkinMenus)\n        {\n            unknown_array = calloc(4, sizeof(INT64));\n            pt.x = x;\n            pt.y = y;\n            if (ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc)\n            {\n                ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(\n                    hMenu,\n                    hWnd,\n                    &(pt),\n                    0xc,\n                    unknown_array\n                );\n            }\n            SetWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc, 0);\n        }\n        b = TrackPopupMenuEx(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            hWnd,\n            lptpm\n        );\n        bthprops_TrackPopupMenuExElapsed = milliseconds_now();\n        if (bSkinMenus)\n        {\n            RemoveWindowSubclass(hWnd, OwnerDrawSubclassProc, OwnerDrawSubclassProc);\n            if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n            {\n                ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                    hMenu,\n                    hWnd\n                );\n            }\n            free(unknown_array);\n        }\n    }\n    return b;\n}\nlong long inputswitch_TrackPopupMenuExElapsed = 0;\nBOOL inputswitch_TrackPopupMenuExHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    HWND        hWnd,\n    LPTPMPARAMS lptpm\n)\n{\n    long long elapsed = milliseconds_now() - inputswitch_TrackPopupMenuExElapsed;\n    BOOL b = FALSE;\n    if (elapsed > POPUPMENU_INPUTSWITCH_TIMEOUT || !bFlyoutMenus)\n    {\n        if (bCenterMenus)\n        {\n            PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        IsImmersiveMenu = FALSE;\n        if (!bSkinMenus)\n        {\n            EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n            if (IsImmersiveMenu)\n            {\n                if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                {\n                    POINT pt;\n                    pt.x = x;\n                    pt.y = y;\n                    ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                        hMenu,\n                        hWnd\n                    );\n                }\n                else\n                {\n                    RemoveOwnerDrawFromMenu(0, hMenu);\n                }\n            }\n            IsImmersiveMenu = FALSE;\n        }\n        b = TrackPopupMenuEx(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            hWnd,\n            lptpm\n        );\n        inputswitch_TrackPopupMenuExElapsed = milliseconds_now();\n    }\n    return b;\n}\nlong long twinui_TrackPopupMenuElapsed = 0;\nBOOL twinui_TrackPopupMenuHook(\n    HMENU       hMenu,\n    UINT        uFlags,\n    int         x,\n    int         y,\n    int         nReserved,\n    HWND        hWnd,\n    const RECT* prcRect\n)\n{\n    //long long elapsed = milliseconds_now() - twinui_TrackPopupMenuElapsed;\n    BOOL b = FALSE;\n    if (1 /*elapsed > POPUPMENU_WINX_TIMEOUT || !bFlyoutMenus*/)\n    {\n        if (bCenterMenus)\n        {\n            //PopupMenuAdjustCoordinatesAndFlags(&x, &y, &uFlags);\n        }\n        IsImmersiveMenu = FALSE;\n        if (!bSkinMenus)\n        {\n            EnumPropsA(hWnd, CheckIfImmersiveContextMenu);\n            if (IsImmersiveMenu)\n            {\n                if (ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc)\n                {\n                    POINT pt;\n                    pt.x = x;\n                    pt.y = y;\n                    ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(\n                        hMenu,\n                        hWnd\n                    );\n                }\n                else\n                {\n                    RemoveOwnerDrawFromMenu(0, hMenu);\n                }\n            }\n            IsImmersiveMenu = FALSE;\n        }\n        b = TrackPopupMenu(\n            hMenu,\n            uFlags | TPM_RIGHTBUTTON,\n            x,\n            y,\n            0,\n            hWnd,\n            prcRect\n        );\n        //twinui_TrackPopupMenuElapsed = milliseconds_now();\n    }\n    return b;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Disable immersive menus\"\nBOOL WINAPI DisableImmersiveMenus_SystemParametersInfoW(\n    UINT  uiAction,\n    UINT  uiParam,\n    PVOID pvParam,\n    UINT  fWinIni\n)\n{\n    if (bDisableImmersiveContextMenu && uiAction == SPI_GETSCREENREADER)\n    {\n        *(BOOL*)pvParam = TRUE;\n        return TRUE;\n    }\n    return SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni);\n}\n#pragma endregion\n\n\n#pragma region \"Explorer: Hide search bar, hide icon and/or title, Mica effect, hide navigation bar\"\ninline BOOL IsRibbonEnabled(HWND hWnd)\n{\n    return GetPropW(hWnd, (LPCWSTR)0xA91C);\n}\n\ninline BOOL ShouldApplyMica(HWND hWnd)\n{\n    if (!IsRibbonEnabled(hWnd)) return TRUE;\n    return FindWindowExW(hWnd, NULL, L\"Windows.UI.Composition.DesktopWindowContentBridge\", NULL);\n}\n\nHRESULT ApplyMicaToExplorerTitlebar(HWND hWnd, DWORD_PTR bMicaEffectOnTitleBarOrig)\n{\n    RECT Rect;\n    GetWindowRect(hWnd, &Rect);\n    HWND hWndRoot = GetAncestor(hWnd, GA_ROOT);\n    MapWindowPoints(NULL, hWndRoot, (LPPOINT)&Rect, 2);\n    MARGINS pMarInset;\n    ZeroMemory(&pMarInset, sizeof(MARGINS));\n    pMarInset.cyTopHeight = Rect.bottom;\n    wchar_t wszParentText[100];\n    GetWindowTextW(GetParent(hWnd), wszParentText, 100);\n    if (!_wcsicmp(wszParentText, L\"FloatingWindow\")) pMarInset.cyTopHeight = 0;\n    BOOL bShouldApplyMica;\n    if (bMicaEffectOnTitleBarOrig == 2) bShouldApplyMica = FALSE;\n    else bShouldApplyMica = ShouldApplyMica(GetAncestor(hWnd, GA_ROOT));\n    if (bShouldApplyMica)\n    {\n        DwmExtendFrameIntoClientArea(hWndRoot, &pMarInset);\n        SetPropW(hWndRoot, L\"EP_METB\", TRUE);\n    }\n    else\n    {\n        RemovePropW(hWndRoot, L\"EP_METB\");\n    }\n    return SetMicaMaterialForThisWindow(hWndRoot, bShouldApplyMica);\n}\n\nLRESULT RebarWindow32MicaTitlebarSubclassproc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)\n{\n    if (uMsg == RB_SETWINDOWTHEME && !wcsncmp(lParam, L\"DarkMode\", 8) && dwRefData != 2 && ShouldApplyMica(GetAncestor(hWnd, GA_ROOT)))\n    {\n        lParam = wcsstr(lParam, L\"NavbarComposited\");\n    }\n    else if (uMsg == WM_DESTROY)\n    {\n        RemoveWindowSubclass(hWnd, RebarWindow32MicaTitlebarSubclassproc, RebarWindow32MicaTitlebarSubclassproc);\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n\nLRESULT ExplorerMicaTitlebarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)\n{\n    if (uMsg == WM_DESTROY)\n    {\n        RemoveWindowSubclass(hWnd, ExplorerMicaTitlebarSubclassProc, ExplorerMicaTitlebarSubclassProc);\n    }\n    if (uMsg == WM_ERASEBKGND)\n    {\n        wchar_t wszParentText[100];\n        GetWindowTextW(GetParent(hWnd), wszParentText, 100);\n        if (_wcsicmp(wszParentText, L\"FloatingWindow\") && dwRefData != 2 && ShouldApplyMica(GetAncestor(hWnd, GA_ROOT))) return TRUE;\n    }\n    else if (uMsg == WM_WINDOWPOSCHANGED)\n    {\n        WINDOWPOS* lpWp = (WINDOWPOS*)lParam;\n        if (lpWp->flags & SWP_NOMOVE)\n        {\n            ApplyMicaToExplorerTitlebar(hWnd, dwRefData);\n        }\n        else\n        {\n            PostMessageW(hWnd, WM_APP, 0, 0);\n        }\n    }\n    else if (uMsg == WM_APP)\n    {\n        ApplyMicaToExplorerTitlebar(hWnd, dwRefData);\n    }\n    else if (uMsg == WM_PARENTNOTIFY)\n    {\n        if (LOWORD(wParam) == WM_CREATE)\n        {\n            ATOM atom = GetClassWord(lParam, GCW_ATOM);\n            if (atom == RegisterWindowMessageW(L\"ReBarWindow32\"))\n            {\n                SetWindowSubclass(lParam, RebarWindow32MicaTitlebarSubclassproc, RebarWindow32MicaTitlebarSubclassproc, dwRefData);\n            }\n        }\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n\nLRESULT CALLBACK HideIconAndTitleInExplorerSubClass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)\n{\n    if (uMsg == WM_DESTROY)\n    {\n        RemoveWindowSubclass(hWnd, HideIconAndTitleInExplorerSubClass, HideIconAndTitleInExplorerSubClass);\n    }\n    else if (uMsg == WM_PARENTNOTIFY)\n    {\n        if (LOWORD(wParam) == WM_CREATE)\n        {\n            WTA_OPTIONS ops;\n            ops.dwFlags = bHideIconAndTitleInExplorer;\n            ops.dwMask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;\n            SetWindowThemeAttribute(hWnd, WTA_NONCLIENT, &ops, sizeof(WTA_OPTIONS));\n        }\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n\nHRESULT uxtheme_DwmExtendFrameIntoClientAreaHook(HWND hWnd, MARGINS* m)\n{\n    if (GetPropW(hWnd, L\"EP_METB\"))\n    {\n        return S_OK;\n    }\n    return DwmExtendFrameIntoClientArea(hWnd, m);\n}\n\nHWND(__stdcall *explorerframe_SHCreateWorkerWindowFunc)(\n    WNDPROC  \twndProc,\n    HWND  \thWndParent,\n    DWORD  \tdwExStyle,\n    DWORD  \tdwStyle,\n    HMENU  \thMenu,\n    LONG_PTR  \twnd_extra\n    );\n\nHWND WINAPI explorerframe_SHCreateWorkerWindowHook(\n    WNDPROC  \twndProc,\n    HWND  \thWndParent,\n    DWORD  \tdwExStyle,\n    DWORD  \tdwStyle,\n    HMENU  \thMenu,\n    LONG_PTR  \twnd_extra\n)\n{\n    HWND result;\n    LSTATUS lRes = ERROR_FILE_NOT_FOUND;\n    DWORD dwSize = 0;\n    \n    printf(\"%x %x\\n\", dwExStyle, dwStyle);\n\n    if (SHRegGetValueFromHKCUHKLMWithOpt(\n        TEXT(\"SOFTWARE\\\\Classes\\\\CLSID\\\\{056440FD-8568-48e7-A632-72157243B55B}\\\\InProcServer32\"),\n        TEXT(\"\"),\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        (LPDWORD)(&dwSize)\n    ) == ERROR_SUCCESS && (dwSize < 4) && dwExStyle == 0x10000 && dwStyle == 0x46000000)\n    {\n        result = 0;\n    }\n    else\n    {\n        result = explorerframe_SHCreateWorkerWindowFunc(\n            wndProc,\n            hWndParent,\n            dwExStyle,\n            dwStyle,\n            hMenu,\n            wnd_extra\n        );\n    }\n    if (dwExStyle == 0x10000 && dwStyle == 0x46000000 && result)\n    {\n        if (bHideIconAndTitleInExplorer)\n        {\n            SetWindowSubclass(hWndParent, HideIconAndTitleInExplorerSubClass, HideIconAndTitleInExplorerSubClass, 0);\n        }\n        if ((!bIsExplorerProcess || dwFileExplorerCommandUI == 2) && bMicaEffectOnTitlebar)\n        {\n            SetWindowSubclass(result, ExplorerMicaTitlebarSubclassProc, ExplorerMicaTitlebarSubclassProc, bMicaEffectOnTitlebar);\n        }\n        if (bHideExplorerSearchBar)\n        {\n            SetWindowSubclass(hWndParent, HideExplorerSearchBarSubClass, HideExplorerSearchBarSubClass, 0);\n        }\n        if (bIsExplorerProcess && (dwFileExplorerCommandUI == 1 || dwFileExplorerCommandUI == 2 || dwFileExplorerCommandUI == 3) && IsWindows11Version22H2OrHigher())\n        {\n            // Fix initial title bar style after disabling TIFE\n            // If we don't do this, it will only fix itself once the user changes the system color scheme or toggling transparency effects\n            if (!ShouldAppsUseDarkMode)\n            {\n                HANDLE hUxtheme = LoadLibraryExW(L\"uxtheme.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n                ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x84);\n            }\n            if (ShouldAppsUseDarkMode)\n            {\n                BOOL bDarkMode = ShouldAppsUseDarkMode() && !IsHighContrast();\n                DwmSetWindowAttribute(hWndParent, DWMWA_USE_IMMERSIVE_DARK_MODE, &bDarkMode, sizeof(BOOL));\n            }\n        }\n    }\n    return result;\n}\n#pragma endregion\n\n\n#pragma region \"Fix battery flyout\"\n#if WITH_MAIN_PATCHER\nLSTATUS stobject_RegGetValueW(\n    HKEY    hkey,\n    LPCWSTR lpSubKey,\n    LPCWSTR lpValue,\n    DWORD   dwFlags,\n    LPDWORD pdwType,\n    PVOID   pvData,\n    LPDWORD pcbData\n)\n{\n    if (!lstrcmpW(lpValue, L\"UseWin32BatteryFlyout\"))\n    {\n        if (SHRegGetValueFromHKCUHKLMFunc)\n        {\n            return SHRegGetValueFromHKCUHKLMFunc(\n                lpSubKey,\n                lpValue,\n                SRRF_RT_REG_DWORD,\n                pdwType,\n                pvData,\n                pcbData\n            );\n        }\n    }\n    return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n}\n\nDEFINE_GUID(CLSID_NetworkTraySSO, 0xC2796011, 0x81BA, 0x4148, 0x8F, 0xCA, 0xC6, 0x64, 0x32, 0x45, 0x11, 0x3F);\nDEFINE_GUID(CLSID_WindowsToGoSSO, 0x4DC9C264, 0x730E, 0x4CF6, 0x83, 0x74, 0x70, 0xF0, 0x79, 0xE4, 0xF8, 0x2B);\n\ntypedef HRESULT(WINAPI* DllGetClassObject_t)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);\n\nvoid PatchPnidui(HMODULE hPnidui);\n\nHRESULT stobject_CoCreateInstanceHook(\n    REFCLSID  rclsid,\n    LPUNKNOWN pUnkOuter,\n    DWORD     dwClsContext,\n    REFIID    riid,\n    LPVOID* ppv\n)\n{\n    if (global_rovi.dwBuildNumber >= 25236 && IsEqualGUID(rclsid, &CLSID_NetworkTraySSO) && bOldTaskbar)\n    {\n        wchar_t szPath[MAX_PATH];\n        ZeroMemory(szPath, sizeof(szPath));\n        SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, szPath);\n        wcscat_s(szPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\pnidui.dll\");\n        HMODULE hPnidui = LoadLibraryW(szPath);\n        DllGetClassObject_t pfnDllGetClassObject = hPnidui ? (DllGetClassObject_t)GetProcAddress(hPnidui, \"DllGetClassObject\") : NULL;\n        if (!pfnDllGetClassObject)\n        {\n            return REGDB_E_CLASSNOTREG;\n        }\n        PatchPnidui(hPnidui);\n        IClassFactory* pClassFactory = NULL;\n        HRESULT hr = pfnDllGetClassObject(rclsid, &IID_IClassFactory, (LPVOID*)&pClassFactory);\n        if (SUCCEEDED(hr))\n        {\n            hr = pClassFactory->lpVtbl->CreateInstance(pClassFactory, pUnkOuter, riid, ppv);\n            pClassFactory->lpVtbl->Release(pClassFactory);\n        }\n        return hr;\n    }\n\n    DWORD dwVal = 0, dwSize = sizeof(DWORD);\n    if (IsEqualGUID(rclsid, &CLSID_ImmersiveShell) &&\n        IsEqualGUID(riid, &IID_IServiceProvider) &&\n        SHRegGetValueFromHKCUHKLMFunc)\n    {\n        SHRegGetValueFromHKCUHKLMFunc(\n            TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\ImmersiveShell\"),\n            TEXT(\"UseWin32BatteryFlyout\"),\n            SRRF_RT_REG_DWORD,\n            NULL,\n            &dwVal,\n            (LPDWORD)(&dwSize)\n        );\n        if (!dwVal && IsWindows11() && !IsWindows11Version22H2Build2134OrHigher())\n        {\n            if (hCheckForegroundThread)\n            {\n                if (WaitForSingleObject(hCheckForegroundThread, 0) == WAIT_TIMEOUT)\n                {\n                    return E_NOINTERFACE;\n                }\n                WaitForSingleObject(hCheckForegroundThread, INFINITE);\n                CloseHandle(hCheckForegroundThread);\n                hCheckForegroundThread = NULL;\n            }\n            HKEY hKey = NULL;\n            if (RegCreateKeyExW(\n                HKEY_CURRENT_USER,\n                _T(SEH_REGPATH),\n                0,\n                NULL,\n                REG_OPTION_VOLATILE,\n                KEY_READ,\n                NULL,\n                &hKey,\n                NULL\n            ) == ERROR_SUCCESS)\n            {\n                RegCloseKey(hKey);\n            }\n            TerminateShellExperienceHost();\n            InvokeFlyout(0, INVOKE_FLYOUT_BATTERY);\n            Sleep(100);\n            hCheckForegroundThread = CreateThread(\n                0,\n                0,\n                CheckForegroundThread,\n                dwVal,\n                0,\n                0\n            );\n        }\n    }\n    return CoCreateInstance(\n        rclsid,\n        pUnkOuter,\n        dwClsContext,\n        riid,\n        ppv\n    );\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Show WiFi networks on network icon click\"\n#if WITH_MAIN_PATCHER\nHRESULT pnidui_CoCreateInstanceHook(\n    REFCLSID  rclsid,\n    LPUNKNOWN pUnkOuter,\n    DWORD     dwClsContext,\n    REFIID    riid,\n    LPVOID* ppv\n)\n{\n    DWORD dwVal = 0, dwSize = sizeof(DWORD);\n    if (IsEqualGUID(rclsid, &CLSID_ImmersiveShell) && \n        IsEqualGUID(riid, &IID_IServiceProvider) &&\n        SHRegGetValueFromHKCUHKLMFunc)\n    {\n        SHRegGetValueFromHKCUHKLMFunc(\n            TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Control Panel\\\\Settings\\\\Network\"),\n            TEXT(\"ReplaceVan\"),\n            SRRF_RT_REG_DWORD,\n            NULL,\n            &dwVal,\n            (LPDWORD)(&dwSize)\n        );\n        if (dwVal)\n        {\n            if ((dwVal == 5 || dwVal == 6) && IsWindows11() && !IsWindows11Version22H2Build1413OrHigher())\n            {\n                if (hCheckForegroundThread)\n                {\n                    WaitForSingleObject(hCheckForegroundThread, INFINITE);\n                    CloseHandle(hCheckForegroundThread);\n                    hCheckForegroundThread = NULL;\n                }\n                if (milliseconds_now() - elapsedCheckForeground > CHECKFOREGROUNDELAPSED_TIMEOUT)\n                {\n                    LaunchNetworkTargets(dwVal);\n                    hCheckForegroundThread = CreateThread(\n                        0,\n                        0,\n                        CheckForegroundThread,\n                        dwVal,\n                        0,\n                        0\n                    );\n                }\n            }\n            else\n            {\n                LaunchNetworkTargets(dwVal);\n            }\n            return E_NOINTERFACE;\n        }\n        else if (IsWindows11() && !IsWindows11Version22H2Build1413OrHigher())\n        {\n            if (hCheckForegroundThread)\n            {\n                if (WaitForSingleObject(hCheckForegroundThread, 0) == WAIT_TIMEOUT)\n                {\n                    return E_NOINTERFACE;\n                }\n                WaitForSingleObject(hCheckForegroundThread, INFINITE);\n                CloseHandle(hCheckForegroundThread);\n                hCheckForegroundThread = NULL;\n            }\n            HKEY hKey = NULL;\n            if (RegCreateKeyExW(\n                HKEY_CURRENT_USER,\n                _T(SEH_REGPATH),\n                0,\n                NULL,\n                REG_OPTION_NON_VOLATILE,\n                KEY_READ,\n                NULL,\n                &hKey,\n                NULL\n            ) == ERROR_SUCCESS)\n            {\n                RegCloseKey(hKey);\n            }\n            TerminateShellExperienceHost();\n            InvokeFlyout(0, INVOKE_FLYOUT_NETWORK);\n            Sleep(100);\n            hCheckForegroundThread = CreateThread(\n                0,\n                0,\n                CheckForegroundThread,\n                dwVal,\n                0,\n                0\n            );\n        }\n    }\n    return CoCreateInstance(\n        rclsid,\n        pUnkOuter,\n        dwClsContext,\n        riid,\n        ppv\n    );\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Clock flyout helper\"\n#if WITH_MAIN_PATCHER\ntypedef struct _ClockButton_ToggleFlyoutCallback_Params\n{\n    void* TrayUIInstance;\n    unsigned int CLOCKBUTTON_OFFSET_IN_TRAYUI;\n    void* oldClockButtonInstance;\n} ClockButton_ToggleFlyoutCallback_Params;\nvoid ClockButton_ToggleFlyoutCallback(\n    HWND hWnd,\n    UINT uMsg,\n    ClockButton_ToggleFlyoutCallback_Params* params,\n    LRESULT lRes\n)\n{\n    *((INT64*)params->TrayUIInstance + params->CLOCKBUTTON_OFFSET_IN_TRAYUI) = params->oldClockButtonInstance;\n    free(params);\n}\nBOOL InvokeClockFlyout()\n{\n    POINT ptCursor;\n    GetCursorPos(&ptCursor);\n    HWND hWnd = GetMonitorInfoFromPointForTaskbarFlyoutActivation(\n        ptCursor,\n        MONITOR_DEFAULTTOPRIMARY,\n        NULL\n    );\n    HWND prev_hWnd = hWnd;\n    HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n    const unsigned int WM_TOGGLE_CLOCK_FLYOUT = 1486;\n    if (hWnd == hShellTray_Wnd)\n    {\n        if (ShouldShowLegacyClockExperience() == 1)\n        {\n            if (!FindWindowW(L\"ClockFlyoutWindow\", NULL))\n            {\n                if (bOldTaskbar)\n                {\n                    return ShowLegacyClockExperience(FindWindowExW(FindWindowExW(hShellTray_Wnd, NULL, L\"TrayNotifyWnd\", NULL), NULL, L\"TrayClockWClass\", NULL));\n                }\n                else\n                {\n                    POINT pt;\n                    pt.x = 0;\n                    pt.y = 0;\n                    GetCursorPos(&pt);\n                    BOOL bBottom, bRight;\n                    POINT dPt = GetDefaultWinXPosition(FALSE, NULL, NULL, FALSE, TRUE);\n                    SetCursorPos(dPt.x - 1, dPt.y);\n                    BOOL bRet = ShowLegacyClockExperience(hShellTray_Wnd);\n                    SetCursorPos(pt.x, pt.y);\n                    return bRet;\n                }\n            }\n            else\n            {\n                return PostMessageW(FindWindowW(L\"ClockFlyoutWindow\", NULL), WM_CLOSE, 0, 0);\n            }\n        }\n        else if (ShouldShowLegacyClockExperience() == 2)\n        {\n            return ToggleNotificationsFlyout();\n        }\n        // On the main monitor, the TrayUI component of CTray handles this\n        // message and basically does a `ClockButton::ToggleFlyout`; that's\n        // the only place in code where that is used, otherwise, clicking and\n        // dismissing the clock flyout probably involves 2 separate methods\n        return PostMessageW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0);\n    }\n    else\n    {\n        // Of course, on secondary monitors, the situation is much more\n        // complicated; there is no simple way to do this, afaik; the way I do it\n        // is to obtain a pointer to TrayUI from CTray (pointers to the classes\n        // that created the windows are always available at location 0 in the hWnd)\n        // and from there issue a \"show clock flyout\" message manually, taking care to temporarly\n        // change the internal clock button pointer of the class to point\n        // to the clock button on the secondary monitor.\n        if (bOldTaskbar)\n        {\n            hWnd = FindWindowExW(hWnd, NULL, L\"ClockButton\", NULL);\n        }\n        if (hWnd)\n        {\n            if (ShouldShowLegacyClockExperience() == 1)\n            {\n                if (!FindWindowW(L\"ClockFlyoutWindow\", NULL))\n                {\n                    if (bOldTaskbar)\n                    {\n                        return ShowLegacyClockExperience(hWnd);\n                    }\n                    else\n                    {\n                        POINT pt;\n                        pt.x = 0;\n                        pt.y = 0;\n                        GetCursorPos(&pt);\n                        BOOL bBottom, bRight;\n                        POINT dPt = GetDefaultWinXPosition(FALSE, NULL, NULL, FALSE, TRUE);\n                        SetCursorPos(dPt.x, dPt.y);\n                        BOOL bRet = ShowLegacyClockExperience(hWnd);\n                        SetCursorPos(pt.x, pt.y);\n                        return bRet;\n                    }\n                }\n                else\n                {\n                    return PostMessageW(FindWindowW(L\"ClockFlyoutWindow\", NULL), WM_CLOSE, 0, 0);\n                }\n            }\n            else if (ShouldShowLegacyClockExperience() == 2)\n            {\n                return ToggleNotificationsFlyout();\n            }\n            if (bOldTaskbar)\n            {\n                INT64* CTrayInstance = (BYTE*)(GetWindowLongPtrW(hShellTray_Wnd, 0)); // -> CTray\n                void* ClockButtonInstance = (BYTE*)(GetWindowLongPtrW(hWnd, 0)); // -> ClockButton\n\n                // inspect CTray::v_WndProc, look for mentions of\n                // CTray::_HandlePowerStatus or patterns like **((_QWORD **)this + 110) + 184i64\n                const unsigned int TRAYUI_OFFSET_IN_CTRAY = 110;\n                // simply inspect vtable of TrayUI\n                const unsigned int TRAYUI_WNDPROC_POSITION_IN_VTABLE = 4;\n                // inspect TrayUI::WndProc, specifically this section\n                /*\n                    {\n                      if ( (_DWORD)a3 == 1486 )\n                      {\n                        v80 = (ClockButton *)*((_QWORD *)this + 100);\n                        if ( v80 )\n                          ClockButton::ToggleFlyout(v80);\n                */\n                const unsigned int CLOCKBUTTON_OFFSET_IN_TRAYUI = 100;\n                void* TrayUIInstance = *((INT64*)CTrayInstance + TRAYUI_OFFSET_IN_CTRAY);\n                void* oldClockButtonInstance = *((INT64*)TrayUIInstance + CLOCKBUTTON_OFFSET_IN_TRAYUI);\n                ClockButton_ToggleFlyoutCallback_Params* params = malloc(sizeof(ClockButton_ToggleFlyoutCallback_Params));\n                if (params)\n                {\n                    *((INT64*)TrayUIInstance + CLOCKBUTTON_OFFSET_IN_TRAYUI) = ClockButtonInstance;\n                    params->TrayUIInstance = TrayUIInstance;\n                    params->CLOCKBUTTON_OFFSET_IN_TRAYUI = CLOCKBUTTON_OFFSET_IN_TRAYUI;\n                    params->oldClockButtonInstance = oldClockButtonInstance;\n                    return SendMessageCallbackW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0, ClockButton_ToggleFlyoutCallback, params);\n                }\n            }\n            else\n            {\n                return PostMessageW(hShellTray_Wnd, WM_TOGGLE_CLOCK_FLYOUT, 0, 0);\n            }\n        }\n    }\n    return FALSE;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Open power user menu on Win+X\"\n#if WITH_MAIN_PATCHER\nLRESULT explorer_SendMessageW(HWND hWndx, UINT uMsg, WPARAM wParam, LPARAM lParam)\n{\n    if (uMsg == TB_GETTEXTROWS)\n    {\n        HWND hWnd = FindWindowEx(\n            NULL,\n            NULL,\n            L\"Shell_TrayWnd\",\n            NULL\n        );\n        if (hWnd)\n        {\n            hWnd = FindWindowEx(\n                hWnd,\n                NULL,\n                L\"RebarWindow32\",\n                NULL\n            );\n            if (hWnd)\n            {\n                hWnd = FindWindowEx(\n                    hWnd,\n                    NULL,\n                    L\"MSTaskSwWClass\",\n                    NULL\n                );\n                if (hWnd && hWnd == hWndx && wParam == -1)\n                {\n                    ToggleLauncherTipContextMenu();\n                    return 0;\n                }\n            }\n        }\n    }\n    return SendMessageW(hWndx, uMsg, wParam, lParam);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Set up taskbar button hooks, implement Weather widget\"\n#if WITH_MAIN_PATCHER\n\nDWORD ShouldShowWidgetsInsteadOfCortana()\n{\n    DWORD dwVal = 0, dwSize = sizeof(DWORD);\n    if (SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(\n        TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\"),\n        TEXT(\"TaskbarDa\"),\n        SRRF_RT_REG_DWORD,\n        NULL,\n        &dwVal,\n        (LPDWORD)(&dwSize)\n    ) == ERROR_SUCCESS)\n    {\n        return dwVal;\n    }\n    return 0;\n}\n\n__int64 (*Widgets_OnClickFunc)(__int64 a1, __int64 a2) = 0;\n__int64 Widgets_OnClickHook(__int64 a1, __int64 a2)\n{\n    if (ShouldShowWidgetsInsteadOfCortana() == 1)\n    {\n        ToggleWidgetsPanel();\n        return 0;\n    }\n    else\n    {\n        if (Widgets_OnClickFunc)\n        {\n            return Widgets_OnClickFunc(a1, a2);\n        }\n        return 0;\n    }\n}\n\nHRESULT (*Widgets_GetTooltipTextFunc)(__int64 a1, __int64 a2, __int64 a3, WCHAR* a4, UINT a5) = 0;\nHRESULT WINAPI Widgets_GetTooltipTextHook(__int64 a1, __int64 a2, __int64 a3, WCHAR* a4, UINT a5)\n{\n    if (ShouldShowWidgetsInsteadOfCortana() == 1)\n    {\n        return SHLoadIndirectString(\n            L\"@{windows?ms-resource://Windows.UI.SettingsAppThreshold/SystemSettings/Resources/SystemSettings_DesktopTaskbar_Da2/DisplayName}\",\n            a4,\n            a5,\n            0\n        );\n    }\n    else\n    {\n        if (Widgets_GetTooltipTextFunc)\n        {\n            return Widgets_GetTooltipTextFunc(a1, a2, a3, a4, a5);\n        }\n        return 0;\n    }\n}\n\n/*int WINAPI explorer_LoadStringWHook(HINSTANCE hInstance, UINT uID, WCHAR* lpBuffer, UINT cchBufferMax)\n{\n    WCHAR wszBuffer[MAX_PATH];\n    if (hInstance == GetModuleHandle(NULL) && uID == 912)// && SUCCEEDED(epw->lpVtbl->GetTitle(epw, MAX_PATH, wszBuffer)))\n    {\n        //sws_error_PrintStackTrace();\n        int rez = LoadStringW(hInstance, uID, lpBuffer, cchBufferMax);\n        //wprintf(L\"%s\\n\", lpBuffer);\n        return rez;\n    }\n    else\n    {\n        return LoadStringW(hInstance, uID, lpBuffer, cchBufferMax);\n    }\n}*/\n\nvoid stub1(void* i)\n{\n}\n\n#define WEATHER_FIXEDSIZE2_MAXWIDTH 192\nBOOL explorer_DeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags)\n{\n    if (uPosition == 621 && uFlags == 0) // when removing News and interests\n    {\n        DeleteMenu(hMenu, 449, 0); // remove Cortana menu\n        DeleteMenu(hMenu, 435, 0); // remove People menu\n    }\n    if (!IsWindows11() && uPosition == 445 && uFlags == 0) // when removing Cortana in Windows 10\n    {\n        DeleteMenu(hMenu, 435, 0);\n    }\n    return DeleteMenu(hMenu, uPosition, uFlags);\n}\n\nHWND hWndWeatherFlyout;\nvoid RecomputeWeatherFlyoutLocation(HWND hWnd)\n{\n    RECT rcButton;\n    GetWindowRect(PeopleButton_LastHWND, &rcButton);\n    POINT pButton;\n    pButton.x = rcButton.left;\n    pButton.y = rcButton.top;\n\n    RECT rcWeatherFlyoutWindow;\n    GetWindowRect(hWnd, &rcWeatherFlyoutWindow);\n\n    POINT pNewWindow;\n\n    RECT rc;\n    UINT tbPos = GetTaskbarLocationAndSize(pButton, &rc);\n    if (tbPos == TB_POS_BOTTOM)\n    {\n        pNewWindow.y = rcButton.top - (rcWeatherFlyoutWindow.bottom - rcWeatherFlyoutWindow.top);\n    }\n    else if (tbPos == TB_POS_TOP)\n    {\n        pNewWindow.y = rcButton.bottom;\n    }\n    else if (tbPos == TB_POS_LEFT)\n    {\n        pNewWindow.x = rcButton.right;\n    }\n    if (tbPos == TB_POS_RIGHT)\n    {\n        pNewWindow.x = rcButton.left - (rcWeatherFlyoutWindow.right - rcWeatherFlyoutWindow.left);\n    }\n\n    if (tbPos == TB_POS_BOTTOM || tbPos == TB_POS_TOP)\n    {\n        pNewWindow.x = rcButton.left + ((rcButton.right - rcButton.left) / 2) - ((rcWeatherFlyoutWindow.right - rcWeatherFlyoutWindow.left) / 2);\n\n        HMONITOR hMonitor = MonitorFromPoint(pButton, MONITOR_DEFAULTTOPRIMARY);\n        if (hMonitor)\n        {\n            MONITORINFO mi;\n            mi.cbSize = sizeof(MONITORINFO);\n            if (GetMonitorInfoW(hMonitor, &mi))\n            {\n                if (mi.rcWork.right < pNewWindow.x + (rcWeatherFlyoutWindow.right - rcWeatherFlyoutWindow.left))\n                {\n                    pNewWindow.x = mi.rcWork.right - (rcWeatherFlyoutWindow.right - rcWeatherFlyoutWindow.left);\n                }\n                if (mi.rcWork.left > pNewWindow.x)\n                {\n                    pNewWindow.x = mi.rcWork.left;\n                }\n            }\n        }\n    }\n    else if (tbPos == TB_POS_LEFT || tbPos == TB_POS_RIGHT)\n    {\n        pNewWindow.y = rcButton.top + ((rcButton.bottom - rcButton.top) / 2) - ((rcWeatherFlyoutWindow.bottom - rcWeatherFlyoutWindow.top) / 2);\n\n        HMONITOR hMonitor = MonitorFromPoint(pButton, MONITOR_DEFAULTTOPRIMARY);\n        if (hMonitor)\n        {\n            MONITORINFO mi;\n            mi.cbSize = sizeof(MONITORINFO);\n            if (GetMonitorInfoW(hMonitor, &mi))\n            {\n                if (mi.rcWork.bottom < pNewWindow.y + (rcWeatherFlyoutWindow.bottom - rcWeatherFlyoutWindow.top))\n                {\n                    pNewWindow.y = mi.rcWork.bottom - (rcWeatherFlyoutWindow.bottom - rcWeatherFlyoutWindow.top);\n                }\n                if (mi.rcWork.top > pNewWindow.y)\n                {\n                    pNewWindow.y = mi.rcWork.top;\n                }\n            }\n        }\n    }\n\n    SetWindowPos(hWnd, NULL, pNewWindow.x, pNewWindow.y, 0, 0, SWP_NOSIZE | SWP_NOSENDCHANGING);\n}\n\nBOOL people_has_ellipsed = FALSE;\nSIZE (*PeopleButton_CalculateMinimumSizeFunc)(void*, SIZE*);\nSIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)\n{\n    SIZE ret = PeopleButton_CalculateMinimumSizeFunc(_this, pSz);\n    BOOL bHasLocked = TryEnterCriticalSection(&lock_epw);\n    if (bHasLocked && epw)\n    {\n        if (bWeatherFixedSize == 1)\n        {\n            int mul = 1;\n            switch (dwWeatherViewMode)\n            {\n            case EP_WEATHER_VIEW_ICONTEXT:\n                mul = 4;\n                break;\n            case EP_WEATHER_VIEW_TEXTONLY:\n                mul = 3;\n                break;\n            case EP_WEATHER_VIEW_ICONTEMP:\n                mul = 2;\n                break;\n            case EP_WEATHER_VIEW_ICONONLY:\n            case EP_WEATHER_VIEW_TEMPONLY:\n                mul = 1;\n                break;\n            }\n            pSz->cx = pSz->cx * mul;\n        }\n        else\n        {\n            if (!prev_total_h)\n            {\n                pSz->cx = 10000;\n            }\n            else\n            {\n                pSz->cx = prev_total_h;\n            }\n        }\n        //printf(\"[CalculateMinimumSize] %d %d\\n\", pSz->cx, pSz->cy);\n        if (pSz->cy)\n        {\n            BOOL bIsInitialized = TRUE;\n            HRESULT hr = epw->lpVtbl->IsInitialized(epw, &bIsInitialized);\n            if (SUCCEEDED(hr))\n            {\n                int rt = MulDiv(48, pSz->cy, 60);\n                if (!bIsInitialized)\n                {\n                    epw->lpVtbl->SetTerm(epw, MAX_PATH * sizeof(WCHAR), wszWeatherTerm);\n                    epw->lpVtbl->SetLanguage(epw, MAX_PATH * sizeof(WCHAR), wszWeatherLanguage);\n                    epw->lpVtbl->SetDevMode(epw, dwWeatherDevMode, FALSE);\n                    epw->lpVtbl->SetIconPack(epw, dwWeatherIconPack, FALSE);\n                    UINT dpiX = 0, dpiY = 0;\n                    HMONITOR hMonitor = MonitorFromWindow(PeopleButton_LastHWND, MONITOR_DEFAULTTOPRIMARY);\n                    HRESULT hr = GetDpiForMonitor(hMonitor, MDT_DEFAULT, &dpiX, &dpiY);\n                    MONITORINFO mi;\n                    ZeroMemory(&mi, sizeof(MONITORINFO));\n                    mi.cbSize = sizeof(MONITORINFO);\n                    if (GetMonitorInfoW(hMonitor, &mi))\n                    {\n                        DWORD dwTextScaleFactor = 0, dwSize = sizeof(DWORD);\n                        if (SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(\n                            TEXT(\"SOFTWARE\\\\Microsoft\\\\Accessibility\"),\n                            TEXT(\"TextScaleFactor\"),\n                            SRRF_RT_REG_DWORD,\n                            NULL,\n                            &dwTextScaleFactor,\n                            (LPDWORD)(&dwSize)\n                        ) != ERROR_SUCCESS)\n                        {\n                            dwTextScaleFactor = 100;\n                        }\n\n                        RECT rcWeatherFlyoutWindow;\n                        rcWeatherFlyoutWindow.left = mi.rcWork.left;\n                        rcWeatherFlyoutWindow.top = mi.rcWork.top;\n                        rcWeatherFlyoutWindow.right = rcWeatherFlyoutWindow.left + MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), dwTextScaleFactor, 100), dwWeatherZoomFactor, 100);\n                        rcWeatherFlyoutWindow.bottom = rcWeatherFlyoutWindow.top + MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpiX, 96), dwTextScaleFactor, 100), dwWeatherZoomFactor, 100);\n                        int k = 0;\n                        while (FAILED(hr = epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, rcWeatherFlyoutWindow, dwWeatherTheme, dwWeatherGeolocationMode, &hWndWeatherFlyout, dwWeatherZoomFactor ? dwWeatherZoomFactor : 100, dpiX, dpiY)))\n                        {\n                            BOOL bFailed = FALSE;\n                            if (k == 0 && hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))\n                            {\n                                if (DownloadAndInstallWebView2Runtime())\n                                {\n                                    k++;\n                                }\n                                else\n                                {\n                                    bFailed = TRUE;\n                                }\n                            }\n                            else\n                            {\n                                bFailed = TRUE;\n                            }\n                            if (bFailed)\n                            {\n                                prev_total_h = 0;\n                                PostMessageW(FindWindowW(L\"Shell_TrayWnd\", NULL), WM_COMMAND, 435, 0);\n                                //PostMessageW(FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), NULL), WM_USER + 1, 0, 0);\n                                if (hServiceWindowThread) PostThreadMessageW(GetThreadId(hServiceWindowThread), WM_USER + 1, NULL, NULL);\n                                break;\n                            }\n                        }\n                        if (SUCCEEDED(hr))\n                        {\n                            epw->lpVtbl->SetWindowCornerPreference(epw, dwWeatherWindowCornerPreference);\n                        }\n                    }\n                }\n                else\n                {\n                    epw->lpVtbl->SetIconSize(epw, rt, rt);\n                }\n            }\n            else\n            {\n                if (hr == 0x800706ba) // RPC server is unavailable\n                {\n                    //ReleaseSRWLockShared(&lock_epw);\n                    /*AcquireSRWLockExclusive(&lock_epw);\n                    epw = NULL;\n                    prev_total_h = 0;\n                    InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);\n                    ReleaseSRWLockExclusive(&lock_epw);*/\n                    if (hServiceWindowThread) PostThreadMessageW(GetThreadId(hServiceWindowThread), WM_USER + 1, NULL, NULL);\n                    //AcquireSRWLockShared(&lock_epw);\n                }\n            }\n        }\n        LeaveCriticalSection(&lock_epw);\n    }\n    else\n    {\n        if (bHasLocked)\n        {\n            LeaveCriticalSection(&lock_epw);\n        }\n    }\n    return ret;\n}\n\nint PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator)\n{\n    if (nNumber != 46) // 46 = vertical taskbar, 48 = horizontal taskbar\n    {\n        //printf(\"[MulDivHook] %d %d %d\\n\", nNumber, nNumerator, nDenominator);\n        BOOL bHasLocked = TryEnterCriticalSection(&lock_epw);\n        if (bHasLocked && epw)\n        {\n            if (bWeatherFixedSize == 1)\n            {\n                int mul = 1;\n                switch (dwWeatherViewMode)\n                {\n                case EP_WEATHER_VIEW_ICONTEXT:\n                    mul = 4;\n                    break;\n                case EP_WEATHER_VIEW_TEXTONLY:\n                    mul = 3;\n                    break;\n                case EP_WEATHER_VIEW_ICONTEMP:\n                    mul = 2;\n                    break;\n                case EP_WEATHER_VIEW_ICONONLY:\n                case EP_WEATHER_VIEW_TEMPONLY:\n                    mul = 1;\n                    break;\n                }\n                LeaveCriticalSection(&lock_epw);\n                return MulDiv(nNumber * mul, nNumerator, nDenominator);\n            }\n            else\n            {\n                if (prev_total_h)\n                {\n                    LeaveCriticalSection(&lock_epw);\n                    return prev_total_h;\n                }\n                else\n                {\n                    prev_total_h = MulDiv(nNumber, nNumerator, nDenominator);\n                    LeaveCriticalSection(&lock_epw);\n                    return prev_total_h;\n                }\n            }\n            LeaveCriticalSection(&lock_epw);\n        }\n        else\n        {\n            if (bHasLocked)\n            {\n                LeaveCriticalSection(&lock_epw);\n            }\n        }\n    }\n    return MulDiv(nNumber, nNumerator, nDenominator);\n}\n\nDWORD epw_cbTemperature = 0;\nDWORD epw_cbUnit = 0;\nDWORD epw_cbCondition = 0;\nDWORD epw_cbImage = 0;\nWCHAR* epw_wszTemperature = NULL;\nWCHAR* epw_wszUnit = NULL;\nWCHAR* epw_wszCondition = NULL;\nchar* epw_pImage = NULL;\nHRESULT (STDAPICALLTYPE *PeopleBand_DrawTextWithGlowFunc)(\n    HDC hdc,\n    LPCWSTR pszText,\n    UINT cch,\n    LPRECT prc,\n    DWORD dwFlags,\n    COLORREF crText,\n    COLORREF crGlow,\n    UINT nGlowRadius,\n    UINT nGlowIntensity,\n    BOOL fPreMultiply,\n    DTT_CALLBACK_PROC pfnDrawTextCallback,\n    LPARAM lParam);\nHRESULT STDAPICALLTYPE PeopleBand_DrawTextWithGlowHook(\n    HDC hdc,\n    LPCWSTR pszText,\n    UINT cch,\n    LPRECT prc,\n    DWORD dwFlags,\n    COLORREF crText,\n    COLORREF crGlow,\n    UINT nGlowRadius,\n    UINT nGlowIntensity,\n    BOOL fPreMultiply,\n    DTT_CALLBACK_PROC pfnDrawTextCallback,\n    LPARAM lParam)\n{\n    BOOL bHasLocked = FALSE;\n    if (cch == 1 && pszText[0] == L'\\uE716' && dwFlags == (DT_CENTER | DT_SINGLELINE) && (bHasLocked = TryEnterCriticalSection(&lock_epw)) && epw)\n    {\n        people_has_ellipsed = FALSE;\n\n        BOOL bUseCachedData = InSendMessage();\n        BOOL bIsThemeActive = TRUE;\n        if (!IsThemeActive() || IsHighContrast())\n        {\n            bIsThemeActive = FALSE;\n        }\n        HRESULT hr = S_OK;\n        if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->LockData(epw)))\n        {\n            UINT dpiX = 0, dpiY = 0;\n            HRESULT hr = GetDpiForMonitor(MonitorFromWindow(PeopleButton_LastHWND, MONITOR_DEFAULTTOPRIMARY), MDT_DEFAULT, &dpiX, &dpiY);\n            BOOL bShouldUnlockData = TRUE;\n            DWORD cbTemperature = 0;\n            DWORD cbUnit = 0;\n            DWORD cbCondition = 0;\n            DWORD cbImage = 0;\n            BOOL bEmptyData = FALSE;\n            if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->GetDataSizes(epw, &cbTemperature, &cbUnit, &cbCondition, &cbImage)))\n            {\n                if (cbTemperature && cbUnit && cbCondition && cbImage)\n                {\n                    epw_cbTemperature = cbTemperature;\n                    epw_cbUnit = cbUnit;\n                    epw_cbCondition = cbCondition;\n                    epw_cbImage = cbImage;\n                }\n                else\n                {\n                    if (!bUseCachedData)\n                    {\n                        bEmptyData = TRUE;\n                        if (bShouldUnlockData)\n                        {\n                            epw->lpVtbl->UnlockData(epw);\n                            bShouldUnlockData = FALSE;\n                        }\n                    }\n                    else\n                    {\n                        bEmptyData = !epw_wszTemperature || !epw_wszUnit || !epw_wszCondition;\n                    }\n                    bUseCachedData = TRUE;\n                }\n                if (!bUseCachedData)\n                {\n                    if (epw_wszTemperature)\n                    {\n                        free(epw_wszTemperature);\n                    }\n                    epw_wszTemperature = calloc(1, epw_cbTemperature);\n                    if (epw_wszUnit)\n                    {\n                        free(epw_wszUnit);\n                    }\n                    epw_wszUnit = calloc(1, epw_cbUnit);\n                    if (epw_wszCondition)\n                    {\n                        free(epw_wszCondition);\n                    }\n                    epw_wszCondition = calloc(1, epw_cbCondition);\n                    if (epw_pImage)\n                    {\n                        free(epw_pImage);\n                    }\n                    epw_pImage = calloc(1, epw_cbImage);\n                }\n                if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->GetData(epw, epw_cbTemperature, epw_wszTemperature, epw_cbUnit, epw_wszUnit, epw_cbCondition, epw_wszCondition, epw_cbImage, epw_pImage)))\n                {\n                    if (!bUseCachedData)\n                    {\n                        WCHAR wszBuffer[MAX_PATH];\n                        ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);\n                        swprintf_s(wszBuffer, MAX_PATH, L\"%s %s, %s, \", epw_wszTemperature, epw_wszUnit, epw_wszCondition);\n                        int len = wcslen(wszBuffer);\n                        epw->lpVtbl->GetTitle(epw, sizeof(WCHAR) * (MAX_PATH - len), wszBuffer + len, dwWeatherViewMode);\n                        SetWindowTextW(PeopleButton_LastHWND, wszBuffer);\n\n                        epw->lpVtbl->UnlockData(epw);\n                        bShouldUnlockData = FALSE;\n                    }\n\n                    LOGFONTW logFont;\n                    ZeroMemory(&logFont, sizeof(logFont));\n                    LOGFONTW logFont2;\n                    ZeroMemory(&logFont2, sizeof(logFont2));\n                    NONCLIENTMETRICS ncm;\n                    ZeroMemory(&ncm, sizeof(NONCLIENTMETRICS));\n                    ncm.cbSize = sizeof(NONCLIENTMETRICS);\n                    SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0, dpiX);\n                    logFont = ncm.lfCaptionFont;\n                    logFont.lfWeight = FW_NORMAL;\n                    logFont2 = ncm.lfCaptionFont;\n                    logFont2.lfWeight = FW_NORMAL;\n                    logFont2.lfHeight += 1;\n                    if (bEmptyData)\n                    {\n                        if (!dwTaskbarSmallIcons)\n                        {\n                            logFont.lfHeight *= 1.6;\n                        }\n                    }\n                    else\n                    {\n                        if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT)\n                        {\n                            //logFont.lfHeight = -12 * (dpiX / 96.0);\n                        }\n                    }\n                    HFONT hFont = CreateFontIndirectW(&logFont);\n                    HFONT hFont2 = CreateFontIndirectW(&logFont2);\n                    if (hFont)\n                    {\n                        HDC hDC = CreateCompatibleDC(0);\n                        if (hDC)\n                        {\n                            COLORREF rgbColor = RGB(0, 0, 0);\n                            if (bIsThemeActive)\n                            {\n                                if ((global_rovi.dwBuildNumber < 18985) || (ShouldSystemUseDarkMode && ShouldSystemUseDarkMode()))\n                                {\n                                    rgbColor = RGB(255, 255, 255);\n                                }\n                            }\n                            else\n                            {\n                                rgbColor = GetSysColor(COLOR_BTNTEXT);\n                            }\n                            HFONT hOldFont = SelectFont(hDC, hFont);\n                            if (bEmptyData)\n                            {\n                                RECT rcText;\n                                SetRect(&rcText, 0, 0, prc->right, prc->bottom);\n                                SIZE size;\n                                size.cx = rcText.right - rcText.left;\n                                size.cy = rcText.bottom - rcText.top;\n                                DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER | DT_HIDEPREFIX | DT_CENTER;\n                                HBITMAP hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(L\"\\U0001f4f0\", hFont, dwTextFlags, size, rgbColor);\n                                if (hBitmap)\n                                {\n                                    HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);\n                                    BITMAP BMInf;\n                                    GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);\n\n                                    BLENDFUNCTION bf;\n                                    bf.BlendOp = AC_SRC_OVER;\n                                    bf.BlendFlags = 0;\n                                    bf.SourceConstantAlpha = 0xFF;\n                                    bf.AlphaFormat = AC_SRC_ALPHA;\n                                    GdiAlphaBlend(hdc, 0, 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);\n\n                                    SelectBitmap(hDC, hOldBMP);\n                                    DeleteBitmap(hBitmap);\n                                }\n                            }\n                            else\n                            {\n                                DWORD dwWeatherSplit = (dwWeatherContentsMode && (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT || dwWeatherViewMode == EP_WEATHER_VIEW_TEXTONLY) && !dwTaskbarSmallIcons);\n\n                                DWORD dwTextFlags = DT_SINGLELINE | DT_HIDEPREFIX;\n\n                                WCHAR wszText1[MAX_PATH];\n                                swprintf_s(wszText1, MAX_PATH, L\"%s%s %s\", bIsThemeActive ? L\"\" : L\" \", epw_wszTemperature, dwWeatherTemperatureUnit == EP_WEATHER_TUNIT_FAHRENHEIT ? L\"\\u00B0F\" : L\"\\u00B0C\");// epw_wszUnit);\n                                RECT rcText1;\n                                SetRect(&rcText1, 0, 0, prc->right, dwWeatherSplit ? (prc->bottom / 2) : prc->bottom);\n                                DrawTextW(hDC, wszText1, -1, &rcText1, dwTextFlags | DT_CALCRECT | (dwWeatherSplit ? DT_BOTTOM : DT_VCENTER));\n                                rcText1.bottom = dwWeatherSplit ? (prc->bottom / 2) : prc->bottom;\n                                WCHAR wszText2[MAX_PATH];\n                                swprintf_s(wszText2, MAX_PATH, L\"%s%s\", bIsThemeActive ? L\"\" : L\" \", epw_wszCondition);\n                                RECT rcText2;\n                                SetRect(&rcText2, 0, 0, prc->right, dwWeatherSplit ? (prc->bottom / 2) : prc->bottom);\n                                DrawTextW(hDC, wszText2, -1, &rcText2, dwTextFlags | DT_CALCRECT | (dwWeatherSplit ? DT_TOP : DT_VCENTER));\n                                rcText2.bottom = dwWeatherSplit ? (prc->bottom / 2) : prc->bottom;\n\n                                if (bWeatherFixedSize)\n                                {\n                                    dwTextFlags |= DT_END_ELLIPSIS;\n                                }\n\n                                int addend = 0;\n                                //int rt = MulDiv(48, a4->bottom, 60);\n                                int rt = sqrt(epw_cbImage / 4);\n                                int p = 0;// MulDiv(rt, 4, 64);\n                                int margin_h = MulDiv(12, dpiX, 144);\n\n                                BOOL bIsIconMode = (\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEMP ||\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT ||\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_ICONONLY);\n                                switch (dwWeatherViewMode)\n                                {\n                                case EP_WEATHER_VIEW_ICONTEXT:\n                                case EP_WEATHER_VIEW_TEXTONLY:\n                                    if (dwWeatherSplit)\n                                        addend = MAX((rcText1.right - rcText1.left), (rcText2.right - rcText2.left)) + margin_h;\n                                    else\n                                        addend = (rcText1.right - rcText1.left) + margin_h + (rcText2.right - rcText2.left) + margin_h;\n                                    break;\n                                case EP_WEATHER_VIEW_ICONTEMP:\n                                case EP_WEATHER_VIEW_TEMPONLY:\n                                    addend = (rcText1.right - rcText1.left) + margin_h;\n                                    break;\n                                case EP_WEATHER_VIEW_ICONONLY:\n                                    addend = 0;\n                                    break;\n                                }\n                                int margin_v = (prc->bottom - rt) / 2;\n                                int total_h = (bIsIconMode ? ((margin_h - p) + rt + (margin_h - p)) : margin_h) + addend;\n                                if (bWeatherFixedSize == 1)\n                                {\n                                    if (total_h > prc->right)\n                                    {\n                                        int diff = total_h - prc->right;\n                                        rcText2.right -= diff - 2;\n                                        people_has_ellipsed = TRUE;\n                                        switch (dwWeatherViewMode)\n                                        {\n                                        case EP_WEATHER_VIEW_ICONTEXT:\n                                        case EP_WEATHER_VIEW_TEXTONLY:\n                                            if (dwWeatherSplit)\n                                                addend = MAX((rcText1.right - rcText1.left), (rcText2.right - rcText2.left)) + margin_h;\n                                            else\n                                                addend = (rcText1.right - rcText1.left) + margin_h + (rcText2.right - rcText2.left) + margin_h;\n                                            break;\n                                        case EP_WEATHER_VIEW_ICONTEMP:\n                                        case EP_WEATHER_VIEW_TEMPONLY: // should be impossible\n                                            addend = (rcText1.right - rcText1.left) + margin_h;\n                                            break;\n                                        case EP_WEATHER_VIEW_ICONONLY:\n                                            addend = 0;\n                                            break;\n                                        }\n                                        total_h = (margin_h - p) + rt + (margin_h - p) + addend;\n                                    }\n                                }\n                                int start_x = 0; // prev_total_h - total_h;\n                                if (bWeatherFixedSize == 1)\n                                {\n                                    start_x = (prc->right - total_h) / 2;\n                                }\n                                if (bWeatherFixedSize == 2 && (total_h > MulDiv(192, dpiX, 96)))\n                                {\n                                    int diff = total_h - MulDiv(WEATHER_FIXEDSIZE2_MAXWIDTH, dpiX, 96);\n                                    rcText2.right -= diff - 2;\n                                    total_h = MulDiv(WEATHER_FIXEDSIZE2_MAXWIDTH, dpiX, 96);\n                                    people_has_ellipsed = TRUE;\n                                }\n\n                                HBITMAP hBitmap = NULL, hOldBitmap = NULL;\n                                void* pvBits = NULL;\n                                SIZE size;\n\n                                if (bIsIconMode)\n                                {\n                                    BITMAPINFOHEADER BMIH;\n                                    ZeroMemory(&BMIH, sizeof(BITMAPINFOHEADER));\n                                    BMIH.biSize = sizeof(BITMAPINFOHEADER);\n                                    BMIH.biWidth = rt;\n                                    BMIH.biHeight = -rt;\n                                    BMIH.biPlanes = 1;\n                                    BMIH.biBitCount = 32;\n                                    BMIH.biCompression = BI_RGB;\n                                    hBitmap = CreateDIBSection(hDC, &BMIH, 0, &pvBits, NULL, 0);\n                                    if (hBitmap)\n                                    {\n                                        memcpy(pvBits, epw_pImage, epw_cbImage);\n                                        hOldBitmap = SelectBitmap(hDC, hBitmap);\n\n                                        BLENDFUNCTION bf;\n                                        bf.BlendOp = AC_SRC_OVER;\n                                        bf.BlendFlags = 0;\n                                        bf.SourceConstantAlpha = 0xFF;\n                                        bf.AlphaFormat = AC_SRC_ALPHA;\n                                        GdiAlphaBlend(hdc, start_x + (margin_h - p), margin_v, rt, rt, hDC, 0, 0, rt, rt, bf);\n\n                                        SelectBitmap(hDC, hOldBitmap);\n                                        DeleteBitmap(hBitmap);\n                                    }\n                                }\n\n                                if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEMP || \n                                    dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT ||\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_TEMPONLY ||\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_TEXTONLY\n                                    )\n                                {\n                                    size.cx = rcText1.right - rcText1.left;\n                                    size.cy = rcText1.bottom - rcText1.top;\n                                    hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(wszText1, hFont, dwTextFlags | (dwWeatherSplit ? DT_BOTTOM : DT_VCENTER), size, rgbColor);\n                                    if (hBitmap)\n                                    {\n                                        HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);\n                                        BITMAP BMInf;\n                                        GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);\n\n                                        BLENDFUNCTION bf;\n                                        bf.BlendOp = AC_SRC_OVER;\n                                        bf.BlendFlags = 0;\n                                        bf.SourceConstantAlpha = 0xFF;\n                                        bf.AlphaFormat = AC_SRC_ALPHA;\n                                        GdiAlphaBlend(hdc, start_x + (bIsIconMode ? ((margin_h - p) + rt + (margin_h - p)) : margin_h), 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);\n\n                                        SelectBitmap(hDC, hOldBMP);\n                                        DeleteBitmap(hBitmap);\n                                    }\n                                }\n\n                                if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT ||\n                                    dwWeatherViewMode == EP_WEATHER_VIEW_TEXTONLY\n                                    )\n                                {\n                                    size.cx = rcText2.right - rcText2.left;\n                                    size.cy = rcText2.bottom - rcText2.top;\n                                    hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(wszText2, (dwWeatherSplit && hFont2 ? hFont2 : hFont), dwTextFlags | (dwWeatherSplit ? DT_TOP : DT_VCENTER), size, rgbColor);\n                                    if (hBitmap)\n                                    {\n                                        HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);\n                                        BITMAP BMInf;\n                                        GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);\n\n                                        BLENDFUNCTION bf;\n                                        bf.BlendOp = AC_SRC_OVER;\n                                        bf.BlendFlags = 0;\n                                        bf.SourceConstantAlpha = 0xFF;\n                                        bf.AlphaFormat = AC_SRC_ALPHA;\n                                        GdiAlphaBlend(hdc, start_x + (bIsIconMode ? ((margin_h - p) + rt + (margin_h - p)) : margin_h) + (dwWeatherSplit ? -1 : (rcText1.right - rcText1.left) + margin_h), dwWeatherSplit ? (prc->bottom / 2 - 1) : 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);\n\n                                        SelectBitmap(hDC, hOldBMP);\n                                        DeleteBitmap(hBitmap);\n                                    }\n                                }\n\n                                if (bWeatherFixedSize == 1)\n                                {\n\n                                }\n                                else\n                                {\n                                    if (total_h != prev_total_h)\n                                    {\n                                        prev_total_h = total_h;\n                                        SendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\n                                    }\n                                }\n\n                                /*\n                                SetLastError(0);\n                                LONG_PTR oldStyle = GetWindowLongPtrW(PeopleButton_LastHWND, GWL_EXSTYLE);\n                                if (!GetLastError())\n                                {\n                                    LONG_PTR style;\n                                    if (bIsThemeActive)\n                                    {\n                                        style = oldStyle & ~WS_EX_DLGMODALFRAME;\n                                    }\n                                    else\n                                    {\n                                        style = oldStyle | WS_EX_DLGMODALFRAME;\n                                    }\n                                    if (style != oldStyle)\n                                    {\n                                        SetWindowLongPtrW(PeopleButton_LastHWND, GWL_EXSTYLE, style);\n                                    }\n                                }\n                                */\n                            }\n                            SelectFont(hDC, hOldFont);\n                            DeleteDC(hDC);\n                        }\n                        DeleteFont(hFont);\n                    }\n                    if (hFont2)\n                    {\n                        DeleteFont(hFont2);\n                    }\n                    if (IsWindowVisible(hWndWeatherFlyout))\n                    {\n                        RecomputeWeatherFlyoutLocation(hWndWeatherFlyout);\n                    }\n                }\n                /*free(epw_pImage);\n                free(epw_wszCondition);\n                free(epw_wszUnit);\n                free(epw_wszTemperature);*/\n            }\n            if (!bUseCachedData && bShouldUnlockData)\n            {\n                epw->lpVtbl->UnlockData(epw);\n            }\n        }\n        else\n        {\n            //printf(\"444444444444 0x%x\\n\", hr);\n            if (hr == 0x800706ba) // RPC server is unavailable\n            {\n                //ReleaseSRWLockShared(&lock_epw);\n                /*AcquireSRWLockExclusive(&lock_epw);\n                epw = NULL;\n                prev_total_h = 0;\n                InvalidateRect(PeopleButton_LastHWND, NULL, TRUE); \n                ReleaseSRWLockExclusive(&lock_epw);*/\n                if (hServiceWindowThread) PostThreadMessageW(GetThreadId(hServiceWindowThread), WM_USER + 1, NULL, NULL);\n                //AcquireSRWLockShared(&lock_epw);\n            }\n        }\n\n        //printf(\"hr %x\\n\", hr);\n\n        LeaveCriticalSection(&lock_epw);\n        return S_OK;\n    }\n    else\n    {\n        if (bHasLocked)\n        {\n            LeaveCriticalSection(&lock_epw);\n        }\n        return PeopleBand_DrawTextWithGlowFunc(hdc, pszText, cch, prc, dwFlags, crText, crGlow, nGlowRadius, nGlowIntensity, fPreMultiply, pfnDrawTextCallback, lParam);\n    }\n}\n\nvoid(*PeopleButton_ShowTooltipFunc)(__int64 a1, unsigned __int8 bShow) = 0;\nvoid WINAPI PeopleButton_ShowTooltipHook(__int64 _this, unsigned __int8 bShow)\n{\n    BOOL bHasLocked = TryEnterCriticalSection(&lock_epw);\n    if (bHasLocked && epw)\n    {\n        if (bShow)\n        {\n            HRESULT hr = epw->lpVtbl->LockData(epw);\n            if (SUCCEEDED(hr))\n            {\n                WCHAR wszBuffer[MAX_PATH];\n                ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);\n                DWORD mode = dwWeatherViewMode;\n                if (bWeatherFixedSize && people_has_ellipsed)\n                {\n                    mode = EP_WEATHER_VIEW_ICONTEMP;\n                }\n                epw->lpVtbl->GetTitle(epw, sizeof(WCHAR) * MAX_PATH, wszBuffer, mode);\n                if (wcsstr(wszBuffer, L\"(null)\"))\n                {\n                    HMODULE hModule = GetModuleHandleW(L\"pnidui.dll\");\n                    if (hModule)\n                    {\n                        LoadStringW(hModule, 35, wszBuffer, MAX_PATH);\n                    }\n                }\n                TTTOOLINFOW ti;\n                ZeroMemory(&ti, sizeof(TTTOOLINFOW));\n                ti.cbSize = sizeof(TTTOOLINFOW);\n                ti.hwnd = *((INT64*)_this + 1);\n                ti.uId = *((INT64*)_this + 1);\n                ti.lpszText = wszBuffer;\n                SendMessageW((HWND) * ((INT64*)_this + 10), TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);\n                epw->lpVtbl->UnlockData(epw);\n            }\n        }\n        LeaveCriticalSection(&lock_epw);\n    }\n    else\n    {\n        if (bHasLocked)\n        {\n            LeaveCriticalSection(&lock_epw);\n        }\n        WCHAR wszBuffer[MAX_PATH];\n        ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);\n        LoadStringW(GetModuleHandle(NULL), 912, wszBuffer, MAX_PATH);\n        if (wszBuffer[0])\n        {\n            TTTOOLINFOW ti;\n            ZeroMemory(&ti, sizeof(TTTOOLINFOW));\n            ti.cbSize = sizeof(TTTOOLINFOW);\n            ti.hwnd = *((INT64*)_this + 1);\n            ti.uId = *((INT64*)_this + 1);\n            ti.lpszText = wszBuffer;\n            SendMessageW((HWND) * ((INT64*)_this + 10), TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);\n        }\n    }\n    if (PeopleButton_ShowTooltipFunc)\n    {\n        return PeopleButton_ShowTooltipFunc(_this, bShow);\n    }\n    return 0;\n}\n\n__int64 (*PeopleButton_OnClickFunc)(__int64 a1, __int64 a2) = 0;\n__int64 PeopleButton_OnClickHook(__int64 a1, __int64 a2)\n{\n    BOOL bHasLocked = TryEnterCriticalSection(&lock_epw);\n    if (bHasLocked && epw)\n    {\n        if (!hWndWeatherFlyout)\n        {\n            epw->lpVtbl->GetWindowHandle(epw, &hWndWeatherFlyout);\n        }\n        if (hWndWeatherFlyout)\n        {\n            if (IsWindowVisible(hWndWeatherFlyout))\n            {\n                if (GetForegroundWindow() != hWndWeatherFlyout)\n                {\n                    SwitchToThisWindow(hWndWeatherFlyout, TRUE);\n                }\n                else\n                {\n                    epw->lpVtbl->Hide(epw);\n                    //printf(\"HR %x\\n\", PostMessageW(hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0));\n                }\n            }\n            else\n            {\n                RecomputeWeatherFlyoutLocation(hWndWeatherFlyout);\n\n                epw->lpVtbl->Show(epw);\n\n                SwitchToThisWindow(hWndWeatherFlyout, TRUE);\n            }\n        }\n        LeaveCriticalSection(&lock_epw);\n        return 0;\n    }\n    else\n    {\n        if (bHasLocked)\n        {\n            LeaveCriticalSection(&lock_epw);\n        }\n        if (PeopleButton_OnClickFunc)\n        {\n            return PeopleButton_OnClickFunc(a1, a2);\n        }\n        return 0;\n    }\n}\n\nINT64 PeopleButton_SubclassProc(\n    _In_ HWND   hWnd,\n    _In_ UINT   uMsg,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam,\n    UINT_PTR    uIdSubclass,\n    DWORD_PTR   dwRefData\n)\n{\n    if (uMsg == WM_NCDESTROY)\n    {\n        RemoveWindowSubclass(hWnd, PeopleButton_SubclassProc, PeopleButton_SubclassProc);\n        /*AcquireSRWLockExclusive(&lock_epw);\n        if (epw)\n        {\n            epw->lpVtbl->Release(epw);\n            epw = NULL;\n            PeopleButton_LastHWND = NULL;\n            prev_total_h = 0;\n        }\n        ReleaseSRWLockExclusive(&lock_epw);*/\n        if (hServiceWindowThread) PostThreadMessageW(GetThreadId(hServiceWindowThread), WM_USER + 1, NULL, NULL);\n    }\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n\nstatic BOOL(*SetChildWindowNoActivateFunc)(HWND);\nBOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)\n{\n    TCHAR className[100];\n    ZeroMemory(className, 100);\n    GetClassNameW(hWnd, className, 100);\n    if (!wcscmp(className, L\"ControlCenterButton\"))\n    {\n        if (bOldTaskbar < 2)\n        {\n            lpShouldDisplayCCButton = (BYTE*)(GetWindowLongPtrW(hWnd, 0) + 120);\n            if (*lpShouldDisplayCCButton)\n            {\n                *lpShouldDisplayCCButton = !bHideControlCenterButton;\n            }\n        }\n    }\n    // get a look at vtable by searching for v_IsEnabled\n    if (!wcscmp(className, L\"TrayButton\"))\n    {\n        uintptr_t Instance = *(uintptr_t*)GetWindowLongPtrW(hWnd, 0);\n        if (Instance)\n        {\n            uintptr_t TrayButton_GetComponentName = *(INT_PTR(WINAPI**)())(Instance + 304); // 280 in versions of Windows 10 where this method exists\n            wchar_t* wszComponentName = NULL;\n            if (IsWindows11() && !IsBadCodePtr(TrayButton_GetComponentName))\n            {\n                wszComponentName = (const WCHAR*)(*(uintptr_t(**)(void))(Instance + 304))();\n            }\n            else\n            {\n                WCHAR title[MAX_PATH];\n                GetWindowTextW(hWnd, title, MAX_PATH);\n                WCHAR pbtitle[MAX_PATH];\n                HMODULE hPeopleBand = LoadLibraryExW(L\"PeopleBand.dll\", NULL, LOAD_LIBRARY_AS_DATAFILE);\n                if (hPeopleBand)\n                {\n                    LoadStringW(hPeopleBand, 256, pbtitle, 260);\n                    FreeLibrary(hPeopleBand);\n                }\n                if (!wcscmp(pbtitle, title))\n                {\n                    wszComponentName = L\"PeopleButton\";\n                }\n            }\n            if (wszComponentName)\n            {\n                if (!wcscmp(wszComponentName, L\"CortanaButton\"))\n                {\n                    if (bOldTaskbar < 2)\n                    {\n                        DWORD dwOldProtect;\n                        VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                        if (!Widgets_OnClickFunc) Widgets_OnClickFunc = *(uintptr_t*)(Instance + 160);\n                        *(uintptr_t*)(Instance + 160) = Widgets_OnClickHook;    // OnClick\n                        VirtualProtect(Instance + 160, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n                        VirtualProtect(Instance + 216, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                        if (!Widgets_GetTooltipTextFunc) Widgets_GetTooltipTextFunc = *(uintptr_t*)(Instance + 216);\n                        *(uintptr_t*)(Instance + 216) = Widgets_GetTooltipTextHook; // OnTooltipShow\n                        VirtualProtect(Instance + 216, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n                    }\n                }\n                else if (!wcscmp(wszComponentName, L\"MultitaskingButton\"))\n                {\n                    if (bOldTaskbar < 2)\n                    {\n                        DWORD dwOldProtect;\n                        VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                        *(uintptr_t*)(Instance + 160) = ToggleTaskView;    // OnClick\n                        VirtualProtect(Instance + 160, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n                    }\n                }\n                else if (!wcscmp(wszComponentName, L\"PeopleButton\"))\n                {\n                    DWORD dwOldProtect;\n\n                    uintptr_t PeopleButton_Instance = *((uintptr_t*)GetWindowLongPtrW(hWnd, 0) + 17);\n\n                    VirtualProtect(PeopleButton_Instance + 32, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                    if (!PeopleButton_CalculateMinimumSizeFunc) PeopleButton_CalculateMinimumSizeFunc = *(uintptr_t*)(PeopleButton_Instance + 32);\n                    *(uintptr_t*)(PeopleButton_Instance + 32) = PeopleButton_CalculateMinimumSizeHook; // CalculateMinimumSize\n                    VirtualProtect(PeopleButton_Instance + 32, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n\n                    uintptr_t off_PeopleButton_ShowTooltip = 0;\n                    if (bOldTaskbar >= 2 || IsWindows11())\n                    {\n                        off_PeopleButton_ShowTooltip = 224;\n                    }\n                    else\n                    {\n                        off_PeopleButton_ShowTooltip = 200;\n                    }\n                    VirtualProtect(Instance + off_PeopleButton_ShowTooltip, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                    if (!PeopleButton_ShowTooltipFunc) PeopleButton_ShowTooltipFunc = *(uintptr_t*)(Instance + off_PeopleButton_ShowTooltip);\n                    *(uintptr_t*)(Instance + off_PeopleButton_ShowTooltip) = PeopleButton_ShowTooltipHook; // OnTooltipShow\n                    VirtualProtect(Instance + off_PeopleButton_ShowTooltip, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n\n                    uintptr_t off_PeopleButton_OnClick = 0;\n                    if (bOldTaskbar >= 2 || IsWindows11())\n                    {\n                        off_PeopleButton_OnClick = 160;\n                    }\n                    else\n                    {\n                        off_PeopleButton_OnClick = 136;\n                    }\n                    VirtualProtect(Instance + off_PeopleButton_OnClick, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);\n                    if (!PeopleButton_OnClickFunc) PeopleButton_OnClickFunc = *(uintptr_t*)(Instance + off_PeopleButton_OnClick);\n                    *(uintptr_t*)(Instance + off_PeopleButton_OnClick) = PeopleButton_OnClickHook;    // OnClick\n                    VirtualProtect(Instance + off_PeopleButton_OnClick, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);\n\n                    PeopleButton_LastHWND = hWnd;\n                    SetWindowSubclass(hWnd, PeopleButton_SubclassProc, PeopleButton_SubclassProc, 0);\n\n                    EnterCriticalSection(&lock_epw);\n                    if (!epw)\n                    {\n                        if (SUCCEEDED(CoCreateInstance(&CLSID_EPWeather, NULL, CLSCTX_LOCAL_SERVER, &IID_IEPWeather, &epw)) && epw)\n                        {\n                            epw->lpVtbl->SetNotifyWindow(epw, hWnd);\n\n                            WCHAR wszBuffer[MAX_PATH];\n                            ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);\n                            HMODULE hModule = GetModuleHandleW(L\"pnidui.dll\");\n                            if (hModule)\n                            {\n                                LoadStringW(hModule, 35, wszBuffer, MAX_PATH);\n                            }\n                            SetWindowTextW(hWnd, wszBuffer);\n                        }\n                    }\n                    LeaveCriticalSection(&lock_epw);\n                }\n            }\n        }\n    }\n    return SetChildWindowNoActivateFunc(hWnd);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Hide Show desktop button\"\n#if WITH_MAIN_PATCHER\nDWORD GetTaskbarSd()\n{\n    DWORD dwVal = 1, dwSize = sizeof(DWORD);\n    if (SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(\n        TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\"),\n        TEXT(\"TaskbarSd\"),\n        SRRF_RT_REG_DWORD,\n        NULL,\n        &dwVal,\n        &dwSize\n    ) == ERROR_SUCCESS)\n    {\n        return dwVal;\n    }\n    return 1; // Visible\n}\n\nINT64 ShowDesktopSubclassProc(\n    _In_ HWND   hWnd,\n    _In_ UINT   uMsg,\n    _In_ WPARAM wParam,\n    _In_ LPARAM lParam,\n    UINT_PTR    uIdSubclass,\n    DWORD_PTR   dwRefData\n)\n{\n    switch (uMsg)\n    {\n        case WM_NCDESTROY:\n        {\n            RemoveWindowSubclass(hWnd, ShowDesktopSubclassProc, ShowDesktopSubclassProc);\n            break;\n        }\n        case WM_PAINT:\n        case WM_PRINTCLIENT:\n        {\n            HANDLE h_dwTaskbarSd = GetPropW(hWnd, L\"EP_TaskbarSd\");\n            if (h_dwTaskbarSd)\n            {\n                DWORD dwTaskbarSd = (DWORD)h_dwTaskbarSd - 1;\n                if (dwTaskbarSd == 2) // Invisible\n                {\n                    PAINTSTRUCT ps;\n                    HDC hdc = BeginPaint(hWnd, &ps);\n                    if (hdc)\n                    {\n                        HDC hdcPaint;\n                        HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hdc, &ps.rcPaint, BPBF_TOPDOWNDIB, NULL, &hdcPaint);\n                        if (hBufferedPaint)\n                        {\n                            if (IsThemeActive())\n                            {\n                                DrawThemeParentBackground(hWnd, hdcPaint, NULL);\n                            }\n                            else\n                            {\n                                RECT rc;\n                                GetClientRect(hWnd, &rc);\n                                FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE + 1));\n                            }\n                            EndBufferedPaint(hBufferedPaint, TRUE);\n                        }\n                        EndPaint(hWnd, &ps);\n                    }\n                    return 0;\n                }\n            }\n            break;\n        }\n        case WM_THEMECHANGED:\n        case WM_SETTINGCHANGE:\n        {\n            LRESULT lRes = DefSubclassProc(hWnd, uMsg, wParam, lParam);\n            DWORD dwTaskbarSd = GetTaskbarSd();\n            SetPropW(hWnd, L\"EP_TaskbarSd\", (HANDLE)(dwTaskbarSd + 1));\n            ShowWindow(hWnd, dwTaskbarSd != 0 ? SW_SHOW : SW_HIDE);\n            return lRes;\n        }\n    }\n\n    return DefSubclassProc(hWnd, uMsg, wParam, lParam);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Notify shell ready\"\n#if WITH_MAIN_PATCHER\nDWORD SignalShellReady(DWORD wait)\n{\n    printf(\"Started \\\"Signal shell ready\\\" thread.\\n\");\n    //UpdateStartMenuPositioning(MAKELPARAM(TRUE, TRUE));\n\n    while (!wait && TRUE)\n    {\n        HWND hShell_TrayWnd = FindWindowEx(\n            NULL,\n            NULL,\n            L\"Shell_TrayWnd\",\n            NULL\n        );\n        if (hShell_TrayWnd)\n        {\n            HWND hWnd = FindWindowEx(\n                hShell_TrayWnd,\n                NULL,\n                L\"Start\",\n                NULL\n            );\n            if (hWnd)\n            {\n                if (IsWindowVisible(hWnd))\n                {\n                    UpdateStartMenuPositioning(MAKELPARAM(TRUE, TRUE));\n                    break;\n                }\n            }\n        }\n        Sleep(100);\n    }\n\n    Sleep(600);\n\n    SetEvent(hCanStartSws);\n    if (bOldTaskbar && (global_rovi.dwBuildNumber >= 22567))\n    {\n        PatchSndvolsso();\n    }\n\n    printf(\"Ended \\\"Signal shell ready\\\" thread.\\n\");\n    return 0;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Window Switcher\"\n#if WITH_MAIN_PATCHER\nDWORD sws_IsEnabled = FALSE;\n\nvoid sws_ReadSettings(sws_WindowSwitcher* sws)\n{\n    HKEY hKey = NULL;\n    DWORD dwSize = 0;\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        DWORD val = 0;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"AltTabSettings\"),\n            0,\n            NULL,\n            &val,\n            &dwSize\n        );\n        sws_IsEnabled = (val == 2);\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH) L\"\\\\sws\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        if (sws)\n        {\n            sws_WindowSwitcher_InitializeDefaultSettings(sws);\n            sws->dwWallpaperSupport = SWS_WALLPAPERSUPPORT_EXPLORER;\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"IncludeWallpaper\"),\n                0,\n                NULL,\n                &(sws->bIncludeWallpaper),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"RowHeight\"),\n                0,\n                NULL,\n                &(sws->dwRowHeight),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"MaxWidth\"),\n                0,\n                NULL,\n                &(sws->dwMaxWP),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"MaxHeight\"),\n                0,\n                NULL,\n                &(sws->dwMaxHP),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"ColorScheme\"),\n                0,\n                NULL,\n                &(sws->dwColorScheme),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"Theme\"),\n                0,\n                NULL,\n                &(sws->dwTheme),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"CornerPreference\"),\n                0,\n                NULL,\n                &(sws->dwCornerPreference),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"ShowDelay\"),\n                0,\n                NULL,\n                &(sws->dwShowDelay),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"PrimaryOnly\"),\n                0,\n                NULL,\n                &(sws->bPrimaryOnly),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"PerMonitor\"),\n                0,\n                NULL,\n                &(sws->bPerMonitor),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"MaxWidthAbs\"),\n                0,\n                NULL,\n                &(sws->dwMaxAbsoluteWP),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"MaxHeightAbs\"),\n                0,\n                NULL,\n                &(sws->dwMaxAbsoluteHP),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"NoPerApplicationList\"),\n                0,\n                NULL,\n                &(sws->bNoPerApplicationList),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"MasterPadding\"),\n                0,\n                NULL,\n                &(sws->dwMasterPadding),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"SwitcherIsPerApplication\"),\n                0,\n                NULL,\n                &(sws->bSwitcherIsPerApplication),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"AlwaysUseWindowTitleAndIcon\"),\n                0,\n                NULL,\n                &(sws->bAlwaysUseWindowTitleAndIcon),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"ScrollWheelBehavior\"),\n                0,\n                NULL,\n                &(sws->dwScrollWheelBehavior),\n                &dwSize\n            );\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"ScrollWheelInvert\"),\n                0,\n                NULL,\n                &(sws->bScrollWheelInvert),\n                &dwSize\n            );\n            if (sws->bIsInitialized)\n            {\n                sws_WindowSwitcher_UnregisterHotkeys(sws);\n                sws_WindowSwitcher_RegisterHotkeys(sws, NULL);\n                sws_WindowSwitcher_RefreshTheme(sws);\n            }\n        }\n        RegCloseKey(hKey);\n    }\n}\n\nDWORD WindowSwitcher(DWORD unused)\n{\n    if (IsWindows11())\n    {\n        WaitForSingleObject(hCanStartSws, INFINITE);\n    }\n    if (!bOldTaskbar)\n    {\n        WaitForSingleObject(hWin11AltTabInitialized, INFINITE);\n    }\n    Sleep(1000);\n\n    while (TRUE)\n    {\n        //Sleep(5000);\n        while (!FindWindowExW(\n            NULL,\n            NULL,\n            L\"Shell_TrayWnd\",\n            NULL\n        ))\n        {\n            printf(\"[sws] Waiting for taskbar...\\n\");\n            Sleep(100);\n        }\n        Sleep(100);\n        sws_ReadSettings(NULL);\n        if (sws_IsEnabled)\n        {\n            sws_error_t err;\n            sws_WindowSwitcher* sws = calloc(1, sizeof(sws_WindowSwitcher));\n            if (!sws)\n            {\n                return 0;\n            }\n            sws_ReadSettings(sws);\n            err = sws_error_Report(sws_error_GetFromInternalError(sws_WindowSwitcher_Initialize(&sws, FALSE)), NULL);\n            if (err == SWS_ERROR_SUCCESS)\n            {\n                sws_WindowSwitcher_RefreshTheme(sws);\n                HANDLE hEvents[3];\n                hEvents[0] = sws->hEvExit;\n                hEvents[1] = hSwsSettingsChanged;\n                hEvents[2] = hSwsOpacityMaybeChanged;\n                while (TRUE)\n                {\n                    DWORD dwRes = MsgWaitForMultipleObjectsEx(\n                        3,\n                        hEvents,\n                        INFINITE,\n                        QS_ALLINPUT,\n                        MWMO_INPUTAVAILABLE\n                    );\n                    if (dwRes == WAIT_OBJECT_0 + 0)\n                    {\n                        break;\n                    }\n                    if (dwRes == WAIT_OBJECT_0 + 1)\n                    {\n                        sws_ReadSettings(sws);\n                        if (!sws_IsEnabled)\n                        {\n                            break;\n                        }\n                    }\n                    else if (dwRes == WAIT_OBJECT_0 + 2)\n                    {\n                        sws_WindowSwitcher_RefreshTheme(sws);\n                    }\n                    else if (dwRes == WAIT_OBJECT_0 + 3)\n                    {\n                        MSG msg;\n                        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {\n                            TranslateMessage(&msg);\n                            DispatchMessage(&msg);\n                        }\n                    }\n                    else\n                    {\n                        break;\n                    }\n                }\n                sws_WindowSwitcher_Clear(sws);\n                free(sws);\n            }\n            else\n            {\n                free(sws);\n                return 0;\n            }\n        }\n        else\n        {\n            WaitForSingleObject(\n                hSwsSettingsChanged,\n                INFINITE\n            );\n        }\n    }\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Load Settings from registry\"\n#define REFRESHUI_NONE         0b000000\n#define REFRESHUI_GLOM         0b000001\n#define REFRESHUI_ORB          0b000010\n#define REFRESHUI_PEOPLE       0b000100\n#define REFRESHUI_TASKBAR      0b001000\n#define REFRESHUI_CENTER       0b010000\n#define REFRESHUI_SPOTLIGHT    0b100000\nvoid WINAPI LoadSettings(LPARAM lParam)\n{\n    BOOL bIsExplorer = LOWORD(lParam);\n    BOOL bIsRefreshAllowed = HIWORD(lParam);\n    DWORD dwRefreshUIMask = REFRESHUI_NONE;\n\n    HKEY hKey = NULL;\n    DWORD dwSize = 0, dwTemp = 0;\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH),\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_ALL_ACCESS | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n#if WITH_MAIN_PATCHER\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MigratedFromOldSettings\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (!dwTemp)\n        {\n            HKEY hOldKey = NULL;\n            RegOpenKeyExW(\n                HKEY_CURRENT_USER,\n                TEXT(REGPATH_OLD),\n                REG_OPTION_NON_VOLATILE,\n                KEY_ALL_ACCESS | KEY_WOW64_64KEY,\n                &hOldKey\n            );\n            if (hOldKey == NULL || hOldKey == INVALID_HANDLE_VALUE)\n            {\n                hOldKey = NULL;\n            }\n            if (hOldKey)\n            {\n                dwSize = sizeof(DWORD);\n                DWORD dw1 = 0;\n                RegQueryValueExW(\n                    hKey,\n                    TEXT(\"OpenPropertiesAtNextStart\"),\n                    0,\n                    NULL,\n                    &dw1,\n                    &dwSize\n                );\n                dwSize = sizeof(DWORD);\n                DWORD dw2 = 0;\n                RegQueryValueExW(\n                    hKey,\n                    TEXT(\"IsUpdatePending\"),\n                    0,\n                    NULL,\n                    &dw2,\n                    &dwSize\n                );\n                if (RegCopyTreeW(hOldKey, NULL, hKey) == ERROR_SUCCESS)\n                {\n                    RegSetValueExW(\n                        hKey,\n                        TEXT(\"OpenPropertiesAtNextStart\"),\n                        0,\n                        REG_DWORD,\n                        &dw1,\n                        sizeof(DWORD)\n                    );\n                    RegSetValueExW(\n                        hKey,\n                        TEXT(\"IsUpdatePending\"),\n                        0,\n                        REG_DWORD,\n                        &dw2,\n                        sizeof(DWORD)\n                    );\n                    RegDeleteKeyExW(hKey, TEXT(STARTDOCKED_SB_NAME), KEY_WOW64_64KEY, 0);\n                }\n            }\n            dwTemp = TRUE;\n            RegSetValueExW(\n                hKey,\n                TEXT(\"MigratedFromOldSettings\"),\n                0,\n                REG_DWORD,\n                &dwTemp,\n                sizeof(DWORD)\n            );\n        }\n#endif\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"AllocConsole\"),\n            0,\n            NULL,\n            &bAllocConsole,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"Memcheck\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp)\n        {\n#if defined(DEBUG) | defined(_DEBUG)\n            printf(\"[Memcheck] Dumping memory leaks...\\n\");\n            _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\n            _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);\n            _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\n            _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);\n            _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\n            _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);\n            _CrtDumpMemoryLeaks();\n            printf(\"[Memcheck] Memory leak dump complete.\\n\");\n            printf(\n                \"[Memcheck] Objects in use:\\nGDI\\tGDIp\\tUSER\\tUSERp\\n%d\\t%d\\t%d\\t%d\\n\",\n                GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS),\n                GetGuiResources(GetCurrentProcess(), GR_GDIOBJECTS_PEAK),\n                GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS),\n                GetGuiResources(GetCurrentProcess(), GR_USEROBJECTS_PEAK)\n            );\n#endif\n            dwTemp = 0;\n            RegSetValueExW(\n                hKey,\n                TEXT(\"Memcheck\"),\n                0,\n                REG_DWORD,\n                &dwTemp,\n                sizeof(DWORD)\n            );\n        }\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"OldTaskbarAl\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp != dwOldTaskbarAl)\n        {\n            dwOldTaskbarAl = dwTemp;\n            dwRefreshUIMask |= REFRESHUI_CENTER;\n        }\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MMOldTaskbarAl\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp != dwMMOldTaskbarAl)\n        {\n            dwMMOldTaskbarAl = dwTemp;\n            dwRefreshUIMask |= REFRESHUI_CENTER;\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"HideExplorerSearchBar\"),\n            0,\n            NULL,\n            &bHideExplorerSearchBar,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ShrinkExplorerAddressBar\"),\n            0,\n            NULL,\n            &bShrinkExplorerAddressBar,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"UseClassicDriveGrouping\"),\n            0,\n            NULL,\n            &bUseClassicDriveGrouping,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"FileExplorerCommandUI\"),\n            0,\n            NULL,\n            &dwFileExplorerCommandUI,\n            &dwSize\n        );\n        if (dwFileExplorerCommandUI == 9999)\n        {\n            if (IsWindows11())\n            {\n                DWORD bIsWindows11CommandBarDisabled = (RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\\\InProcServer32\", L\"\", RRF_RT_REG_SZ, NULL, NULL, NULL) == ERROR_SUCCESS);\n                RegSetValueExW(hKey, L\"FileExplorerCommandUI\", 0, REG_DWORD, &bIsWindows11CommandBarDisabled, sizeof(DWORD));\n                dwFileExplorerCommandUI = bIsWindows11CommandBarDisabled;\n            }\n            else\n            {\n                dwFileExplorerCommandUI = 0;\n            }\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"LegacyFileTransferDialog\"),\n            0,\n            NULL,\n            &bLegacyFileTransferDialog,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DisableImmersiveContextMenu\"),\n            0,\n            NULL,\n            &bDisableImmersiveContextMenu,\n            &dwSize\n        );\n        dwTemp = FALSE;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ClassicThemeMitigations\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (!bWasClassicThemeMitigationsSet)\n        {\n            bClassicThemeMitigations = dwTemp;\n            bWasClassicThemeMitigationsSet = TRUE;\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SkinMenus\"),\n            0,\n            NULL,\n            &bSkinMenus,\n            &dwSize\n        );\n        if (bIsExplorerProcess)\n        {\n            if (bAllocConsole)\n            {\n                FILE* conout;\n                AllocConsole();\n                freopen_s(\n                    &conout,\n                    \"CONOUT$\",\n                    \"w\",\n                    stdout\n                );\n            }\n            else\n            {\n                FreeConsole();\n            }\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DoNotRedirectSystemToSettingsApp\"),\n            0,\n            NULL,\n            &bDoNotRedirectSystemToSettingsApp,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DoNotRedirectProgramsAndFeaturesToSettingsApp\"),\n            0,\n            NULL,\n            &bDoNotRedirectProgramsAndFeaturesToSettingsApp,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MicaEffectOnTitlebar\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp != bMicaEffectOnTitlebar)\n        {\n            bMicaEffectOnTitlebar = dwTemp;\n            HMODULE hUxtheme = GetModuleHandleW(L\"uxtheme.dll\");\n            if (hUxtheme)\n            {\n                if (bMicaEffectOnTitlebar)\n                {\n                    VnPatchDelayIAT(hUxtheme, \"dwmapi.dll\", \"DwmExtendFrameIntoClientArea\", uxtheme_DwmExtendFrameIntoClientAreaHook);\n                }\n                else\n                {\n                    //VnPatchDelayIAT(hUxtheme, \"dwmapi.dll\", \"DwmExtendFrameIntoClientArea\", DwmExtendFrameIntoClientArea);\n                }\n            }\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"HideIconAndTitleInExplorer\"),\n            0,\n            NULL,\n            &bHideIconAndTitleInExplorer,\n            &dwSize\n        );\n        if (!bIsExplorer)\n        {\n            RegCloseKey(hKey);\n            return;\n        }\n        dwTemp = IsWindows11() ? 2 : 1;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"OldTaskbar\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (!bWasOldTaskbarSet)\n        {\n            bOldTaskbar = dwTemp;\n            AdjustTaskbarStyleValue(&bOldTaskbar);\n            bWasOldTaskbarSet = TRUE;\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"HideControlCenterButton\"),\n            0,\n            NULL,\n            &bHideControlCenterButton,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"FlyoutMenus\"),\n            0,\n            NULL,\n            &bFlyoutMenus,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"CenterMenus\"),\n            0,\n            NULL,\n            &bCenterMenus,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SkinIcons\"),\n            0,\n            NULL,\n            &bSkinIcons,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ReplaceNetwork\"),\n            0,\n            NULL,\n            &bReplaceNetwork,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ArchiveMenu\"),\n            0,\n            NULL,\n            &bEnableArchivePlugin,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ClockFlyoutOnWinC\"),\n            0,\n            NULL,\n            &bClockFlyoutOnWinC,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DisableImmersiveContextMenu\"),\n            0,\n            NULL,\n            &bDisableImmersiveContextMenu,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"HookStartMenu\"),\n            0,\n            NULL,\n            &bHookStartMenu,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"PropertiesInWinX\"),\n            0,\n            NULL,\n            &bPropertiesInWinX,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"NoPropertiesInContextMenu\"),\n            0,\n            NULL,\n            &bNoPropertiesInContextMenu,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"NoMenuAccelerator\"),\n            0,\n            NULL,\n            &bNoMenuAccelerator,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"IMEStyle\"),\n            0,\n            NULL,\n            &dwIMEStyle,\n            &dwSize\n        );\n        if (IsWindows11Version22H2OrHigher())\n        {\n            if (!dwIMEStyle) dwIMEStyle = 7;\n            else if (dwIMEStyle == 7) dwIMEStyle = 0;\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"UpdatePolicy\"),\n            0,\n            NULL,\n            &dwUpdatePolicy,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"IsUpdatePending\"),\n            0,\n            NULL,\n            &bShowUpdateToast,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ToolbarSeparators\"),\n            0,\n            NULL,\n            &bToolbarSeparators,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"TaskbarAutohideOnDoubleClick\"),\n            0,\n            NULL,\n            &bTaskbarAutohideOnDoubleClick,\n            &dwSize\n        );\n        dwTemp = ORB_STYLE_WINDOWS10;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"OrbStyle\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (bOldTaskbar && (dwTemp != dwOrbStyle))\n        {\n            dwOrbStyle = dwTemp;\n            dwRefreshUIMask |= REFRESHUI_ORB;\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"EnableSymbolDownload\"),\n            0,\n            NULL,\n            &bEnableSymbolDownload,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        dwTemp = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"OpenPropertiesAtNextStart\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (!IsAppRunningAsAdminMode() && dwTemp)\n        {\n#if WITH_MAIN_PATCHER\n            LaunchPropertiesGUI(hModule);\n#endif\n        }\n\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DisableAeroSnapQuadrants\"),\n            0,\n            NULL,\n            &bDisableAeroSnapQuadrants,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SnapAssistSettings\"),\n            0,\n            NULL,\n            &dwSnapAssistSettings,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DoNotRedirectDateAndTimeToSettingsApp\"),\n            0,\n            NULL,\n            &bDoNotRedirectDateAndTimeToSettingsApp,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DoNotRedirectNotificationIconsToSettingsApp\"),\n            0,\n            NULL,\n            &bDoNotRedirectNotificationIconsToSettingsApp,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DisableOfficeHotkeys\"),\n            0,\n            NULL,\n            &bDisableOfficeHotkeys,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"DisableWinFHotkey\"),\n            0,\n            NULL,\n            &bDisableWinFHotkey,\n            &dwSize\n        );\n        dwTemp = FALSE;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SpotlightDisableIcon\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp != bDisableSpotlightIcon)\n        {\n            bDisableSpotlightIcon = dwTemp;\n#if WITH_MAIN_PATCHER\n            if (IsSpotlightEnabled()) dwRefreshUIMask |= REFRESHUI_SPOTLIGHT;\n#endif\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SpotlightDesktopMenuMask\"),\n            0,\n            NULL,\n            &dwSpotlightDesktopMenuMask,\n            &dwSize\n        );\n        dwTemp = 0;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"SpotlightUpdateSchedule\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (dwTemp != dwSpotlightUpdateSchedule)\n        {\n            dwSpotlightUpdateSchedule = dwTemp;\n#if WITH_MAIN_PATCHER\n            if (IsSpotlightEnabled() && hWndServiceWindow)\n            {\n                if (dwSpotlightUpdateSchedule)\n                {\n                    SetTimer(hWndServiceWindow, 100, dwSpotlightUpdateSchedule * 1000, NULL);\n                }\n                else\n                {\n                    KillTimer(hWndServiceWindow, 100);\n                }\n            }\n#endif\n        }\n        dwTemp = FALSE;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"PinnedItemsActAsQuickLaunch\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        if (!bWasPinnedItemsActAsQuickLaunch)\n        {\n            //if (dwTemp != bPinnedItemsActAsQuickLaunch)\n            {\n                bPinnedItemsActAsQuickLaunch = dwTemp;\n                bWasPinnedItemsActAsQuickLaunch = TRUE;\n                //dwRefreshUIMask |= REFRESHUI_TASKBAR;\n            }\n        }\n        dwTemp = FALSE;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"RemoveExtraGapAroundPinnedItems\"),\n            0,\n            NULL,\n            &dwTemp,\n            &dwSize\n        );\n        //if (!bWasRemoveExtraGapAroundPinnedItems)\n        {\n            if (dwTemp != bRemoveExtraGapAroundPinnedItems)\n            {\n                bRemoveExtraGapAroundPinnedItems = dwTemp;\n                bWasRemoveExtraGapAroundPinnedItems = TRUE;\n                dwRefreshUIMask |= REFRESHUI_TASKBAR;\n            }\n        }\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"UndeadStartCorner\"),\n            0,\n            NULL,\n            &dwUndeadStartCorner,\n            &dwSize\n        );\n\n#if WITH_MAIN_PATCHER\n        EnterCriticalSection(&lock_epw);\n\n        DWORD dwOldWeatherTemperatureUnit = dwWeatherTemperatureUnit;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherTemperatureUnit\"),\n            0,\n            NULL,\n            &dwWeatherTemperatureUnit,\n            &dwSize\n        );\n        if (dwWeatherTemperatureUnit != dwOldWeatherTemperatureUnit && epw)\n        {\n            epw->lpVtbl->SetTemperatureUnit(epw, dwWeatherTemperatureUnit);\n            HWND hWnd = NULL;\n            if (SUCCEEDED(epw->lpVtbl->GetWindowHandle(epw, &hWnd)) && hWnd)\n            {\n                SendMessageW(hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n            }\n        }\n\n        DWORD dwOldWeatherViewMode = dwWeatherViewMode;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherViewMode\"),\n            0,\n            NULL,\n            &dwWeatherViewMode,\n            &dwSize\n        );\n        if (dwWeatherViewMode != dwOldWeatherViewMode && PeopleButton_LastHWND)\n        {\n            dwRefreshUIMask |= REFRESHUI_PEOPLE;\n        }\n\n        DWORD dwOldUpdateSchedule = dwWeatherUpdateSchedule;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherContentUpdateMode\"),\n            0,\n            NULL,\n            &dwWeatherUpdateSchedule,\n            &dwSize\n        );\n        if (dwWeatherUpdateSchedule != dwOldUpdateSchedule && epw)\n        {\n            epw->lpVtbl->SetUpdateSchedule(epw, dwWeatherUpdateSchedule * 1000);\n        }\n\n        dwSize = MAX_PATH * sizeof(WCHAR);\n        if (RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherLocation\"),\n            0,\n            NULL,\n            wszWeatherTerm,\n            &dwSize\n        ))\n        {\n            wcscpy_s(wszWeatherTerm, MAX_PATH, L\"\");\n        }        \n        else\n        {\n            if (wszWeatherTerm[0] == 0)\n            {\n                wcscpy_s(wszWeatherTerm, MAX_PATH, L\"\");\n            }\n        }\n        if (epw)\n        {\n            epw->lpVtbl->SetTerm(epw, MAX_PATH * sizeof(WCHAR), wszWeatherTerm);\n        }\n\n        dwSize = MAX_PATH * sizeof(WCHAR);\n        if (RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherLanguage\"),\n            0,\n            NULL,\n            wszWeatherLanguage,\n            &dwSize\n        ) != ERROR_SUCCESS || wszWeatherLanguage[0] == 0)\n        {\n            EP_L10N_GetCurrentUserLanguage(wszWeatherLanguage, MAX_PATH);\n        }\n        if (epw)\n        {\n            epw->lpVtbl->SetLanguage(epw, MAX_PATH * sizeof(WCHAR), wszWeatherLanguage);\n        }\n\n        DWORD bOldWeatherFixedSize = bWeatherFixedSize;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherFixedSize\"),\n            0,\n            NULL,\n            &bWeatherFixedSize,\n            &dwSize\n        );\n        if (bWeatherFixedSize != bOldWeatherFixedSize && epw)\n        {\n            dwRefreshUIMask |= REFRESHUI_PEOPLE;\n        }\n\n        DWORD dwOldWeatherTheme = dwWeatherTheme;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherTheme\"),\n            0,\n            NULL,\n            &dwWeatherTheme,\n            &dwSize\n        );\n        if (dwWeatherTheme != dwOldWeatherTheme && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetDarkMode(epw, (LONG64)dwWeatherTheme, TRUE);\n            }\n        }\n\n        DWORD dwOldWeatherGeolocationMode = dwWeatherGeolocationMode;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherLocationType\"),\n            0,\n            NULL,\n            &dwWeatherGeolocationMode,\n            &dwSize\n        );\n        if (dwWeatherGeolocationMode != dwOldWeatherGeolocationMode && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetGeolocationMode(epw, (LONG64)dwWeatherGeolocationMode);\n            }\n        }\n\n        DWORD dwOldWeatherWindowCornerPreference = dwWeatherWindowCornerPreference;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherWindowCornerPreference\"),\n            0,\n            NULL,\n            &dwWeatherWindowCornerPreference,\n            &dwSize\n        );\n        if (dwWeatherWindowCornerPreference != dwOldWeatherWindowCornerPreference && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetWindowCornerPreference(epw, (LONG64)dwWeatherWindowCornerPreference);\n            }\n        }\n\n        DWORD dwOldWeatherDevMode = dwWeatherDevMode;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherDevMode\"),\n            0,\n            NULL,\n            &dwWeatherDevMode,\n            &dwSize\n        );\n        if (dwWeatherDevMode != dwOldWeatherDevMode && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetDevMode(epw, (LONG64)dwWeatherDevMode, TRUE);\n            }\n        }\n\n        DWORD dwOldWeatherIconPack = dwWeatherIconPack;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherIconPack\"),\n            0,\n            NULL,\n            &dwWeatherIconPack,\n            &dwSize\n        );\n        if (dwWeatherIconPack != dwOldWeatherIconPack && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetIconPack(epw, (LONG64)dwWeatherIconPack, TRUE);\n            }\n        }\n\n        DWORD dwOldWeatherToLeft = dwWeatherToLeft;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherToLeft\"),\n            0,\n            NULL,\n            &dwWeatherToLeft,\n            &dwSize\n        );\n        if (dwWeatherToLeft != dwOldWeatherToLeft && PeopleButton_LastHWND)\n        {\n            dwRefreshUIMask |= REFRESHUI_CENTER;\n        }\n\n        DWORD dwOldWeatherContentsMode = dwWeatherContentsMode;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherContentsMode\"),\n            0,\n            NULL,\n            &dwWeatherContentsMode,\n            &dwSize\n        );\n        if (dwWeatherContentsMode != dwOldWeatherContentsMode && PeopleButton_LastHWND)\n        {\n            dwRefreshUIMask |= REFRESHUI_CENTER;\n        }\n\n        DWORD dwOldWeatherZoomFactor = dwWeatherZoomFactor;\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"WeatherZoomFactor\"),\n            0,\n            NULL,\n            &dwWeatherZoomFactor,\n            &dwSize\n        );\n        if (dwWeatherZoomFactor != dwOldWeatherZoomFactor && PeopleButton_LastHWND)\n        {\n            if (epw)\n            {\n                epw->lpVtbl->SetZoomFactor(epw, dwWeatherZoomFactor ? (LONG64)dwWeatherZoomFactor : 100);\n            }\n        }\n\n        LeaveCriticalSection(&lock_epw);\n#endif\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"AltTabSettings\"),\n            0,\n            NULL,\n            &dwAltTabSettings,\n            &dwSize\n        );\n        RegCloseKey(hKey);\n    }\n\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MonitorOverride\"),\n            0,\n            NULL,\n            &bMonitorOverride,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"OpenAtLogon\"),\n            0,\n            NULL,\n            &bOpenAtLogon,\n            &dwSize\n        );\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH) L\"\\\\sws\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\MultitaskingView\\\\AltTabViewHost\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Search\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\\\\People\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\TabletTip\\\\1.7\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    if (bIsRefreshAllowed && dwRefreshUIMask)\n    {\n        if (dwRefreshUIMask & REFRESHUI_GLOM)\n        {\n            Explorer_RefreshUI(0);\n        }\n        if ((dwRefreshUIMask & REFRESHUI_ORB) || (dwRefreshUIMask & REFRESHUI_PEOPLE))\n        {\n            HWND hwndTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n            if (hwndTray)\n            {\n                SendMessageW(hwndTray, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\n            }\n            if (dwRefreshUIMask & REFRESHUI_ORB)\n            {\n                InvalidateRect(FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), NULL), NULL, FALSE);\n            }\n            if (dwRefreshUIMask & REFRESHUI_PEOPLE)\n            {\n                //if (epw_dummytext[0] == 0) epw_dummytext = L\"\\u2009\";\n                //else epw_dummytext = L\"\";\n#if WITH_MAIN_PATCHER\n                InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);\n#endif\n            }\n        }\n        if (dwRefreshUIMask & REFRESHUI_TASKBAR)\n        {\n        }\n        if (dwRefreshUIMask & REFRESHUI_CENTER)\n        {\n#if WITH_MAIN_PATCHER\n            //ToggleTaskbarAutohide();\n            //Sleep(1000);\n            //ToggleTaskbarAutohide();\n            FixUpCenteredTaskbar();\n#endif\n        }\n        if (dwRefreshUIMask & REFRESHUI_SPOTLIGHT)\n        {\n            DWORD dwAttributes = 0; dwTemp = sizeof(DWORD);\n            RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\\\\ShellFolder\", L\"Attributes\", RRF_RT_DWORD, NULL, &dwAttributes, &dwTemp);\n            if (bDisableSpotlightIcon) dwAttributes |= SFGAO_NONENUMERATED;\n            else dwAttributes &= ~SFGAO_NONENUMERATED;\n            RegSetKeyValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\\\\ShellFolder\", L\"Attributes\", REG_DWORD, &dwAttributes, sizeof(DWORD));\n            SHFlushSFCache();\n            SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);\n        }\n    }\n}\n\nvoid Explorer_RefreshClockHelper(HWND hClockButton)\n{\n    INT64* ClockButtonInstance = (BYTE*)(GetWindowLongPtrW(hClockButton, 0)); // -> ClockButton\n    // we call v_Initialize because all it does is to query the\n    // registry and update the internal state to display seconds or not\n    // to get the offset, simply inspect the vtable of ClockButton\n    if (ClockButtonInstance)\n    {\n        ((void(*)(void*))(*(INT64*)((*(INT64*)ClockButtonInstance) + 6 * sizeof(uintptr_t))))(ClockButtonInstance); // v_Initialize\n        // we need to refresh the button; for the text to actually change, we need to set this:\n        // inspect ClockButton::v_OnTimer\n        *((BYTE*)ClockButtonInstance + 547) = 1;\n        // then, we simply invalidate the area\n        InvalidateRect(hClockButton, NULL, TRUE);\n    }\n}\n\nvoid Explorer_RefreshClock(int unused)\n{\n    HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n    if (hShellTray_Wnd)\n    {\n        HWND hTrayNotifyWnd = FindWindowExW(hShellTray_Wnd, NULL, L\"TrayNotifyWnd\", NULL);\n        if (hTrayNotifyWnd)\n        {\n            HWND hClockButton = FindWindowExW(hTrayNotifyWnd, NULL, L\"TrayClockWClass\", NULL);\n            if (hClockButton)\n            {\n                Explorer_RefreshClockHelper(hClockButton);\n            }\n        }\n    }\n\n    HWND hWnd = NULL;\n    do\n    {\n        hWnd = FindWindowExW(\n            NULL,\n            hWnd,\n            L\"Shell_SecondaryTrayWnd\",\n            NULL\n        );\n        if (hWnd)\n        {\n            HWND hClockButton = FindWindowExW(hWnd, NULL, L\"ClockButton\", NULL);\n            if (hClockButton)\n            {\n                Explorer_RefreshClockHelper(hClockButton);\n            }\n        }\n    } while (hWnd);\n}\n\nvoid* TrayUI__UpdatePearlSizeFunc;\n\nvoid UpdateSearchBox()\n{\n#if defined(_M_X64)\n    if (!IsWindows11Version22H2OrHigher() || bOldTaskbar != 1)\n        return;\n\n    if (!TrayUI__UpdatePearlSizeFunc)\n        return;\n\n    PBYTE searchBegin = TrayUI__UpdatePearlSizeFunc;\n    // 0F 84 ?? ?? ?? ?? 48 8B 81 ?? ?? ?? ?? 48 85 C0 74 04\n    PBYTE match = FindPattern(\n        searchBegin,\n        256,\n        \"\\x0F\\x84\\x00\\x00\\x00\\x00\\x48\\x8B\\x81\\x00\\x00\\x00\\x00\\x48\\x85\\xC0\\x74\\x04\",\n        \"xx????xxx????xxxxx\"\n    );\n    if (match)\n    {\n        PBYTE overwriteBegin = match + 18;\n        DWORD dwOldProtect;\n        if (VirtualProtect(overwriteBegin, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            // Overwrite right after the pattern with\n            // mov byte ptr [rax+58h], 0 // C6 40 58 00\n            overwriteBegin[0] = 0xC6;\n            overwriteBegin[1] = 0x40;\n            overwriteBegin[2] = 0x58; // Offset to m_bEnabled\n            overwriteBegin[3] = dwSearchboxTaskbarMode == 2 && !dwTaskbarSmallIcons; // Enable the search box?\n            VirtualProtect(overwriteBegin, 4, dwOldProtect, &dwOldProtect);\n        }\n    }\n#endif\n}\n\nint numTBButtons = 0;\nvoid WINAPI Explorer_RefreshUI(int src)\n{\n    HKEY hKey = NULL;\n    DWORD dwSize = 0, dwTemp = 0, dwRefreshMask = 0;\n    if (src == 99 || src == 1)\n    {\n        RegCreateKeyExW(\n            HKEY_CURRENT_USER,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\",\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwTemp = 0;\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"TaskbarSmallIcons\"),\n                0,\n                NULL,\n                &dwTemp,\n                &dwSize\n            );\n            if (dwTemp != dwTaskbarSmallIcons)\n            {\n                dwTaskbarSmallIcons = dwTemp;\n                UpdateSearchBox();\n            }\n            dwTemp = 0;\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"ShowTaskViewButton\"),\n                0,\n                NULL,\n                &dwTemp,\n                &dwSize\n            );\n            if (dwTemp != dwShowTaskViewButton)\n            {\n                dwShowTaskViewButton = dwTemp;\n                dwRefreshMask |= REFRESHUI_CENTER;\n            }\n            dwTemp = 0;\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"TaskbarDa\"),\n                0,\n                NULL,\n                &dwTemp,\n                &dwSize\n            );\n            if (dwTemp != dwTaskbarDa)\n            {\n                dwTaskbarDa = dwTemp;\n                dwRefreshMask |= REFRESHUI_CENTER;\n            }\n            RegCloseKey(hKey);\n            //SearchboxTaskbarMode\n        }\n    }\n    if (src == 99 || src == 2)\n    {\n        RegCreateKeyExW(\n            HKEY_CURRENT_USER,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Search\",\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwTemp = 0;\n            dwSize = sizeof(DWORD);\n            RegQueryValueExW(\n                hKey,\n                TEXT(\"SearchboxTaskbarMode\"),\n                0,\n                NULL,\n                &dwTemp,\n                &dwSize\n            );\n            if (dwTemp != dwSearchboxTaskbarMode)\n            {\n                dwSearchboxTaskbarMode = dwTemp;\n                dwRefreshMask |= REFRESHUI_CENTER;\n                UpdateSearchBox();\n            }\n        }\n    }\n    if (src == 99) return;\n    HWND hwndTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n    if (hwndTray)\n    {\n        SendMessageW(hwndTray, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\n    }\n    Explorer_RefreshClock(0);\n    if (dwRefreshMask & REFRESHUI_CENTER)\n    {\n#if WITH_MAIN_PATCHER\n        FixUpCenteredTaskbar();\n#endif\n    }\n}\n\nvoid Explorer_TogglePeopleButton(int unused)\n{\n    HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n    if (hShellTray_Wnd)\n    {\n        INT64* CTrayInstance = (BYTE*)(GetWindowLongPtrW(hShellTray_Wnd, 0)); // -> CTray\n        if (CTrayInstance)\n        {\n            const unsigned int TRAYUI_OFFSET_IN_CTRAY = 110;\n            INT64* TrayUIInstance = *((INT64*)CTrayInstance + TRAYUI_OFFSET_IN_CTRAY);\n            if (TrayUIInstance)\n            {\n                ((void(*)(void*))(*(INT64*)((*(INT64*)TrayUIInstance) + 57 * sizeof(uintptr_t))))(TrayUIInstance);\n            }\n        }\n    }\n}\n\nvoid Explorer_ToggleTouchpad(int unused)\n{\n    HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n    if (hShellTray_Wnd)\n    {\n        INT64* CTrayInstance = (BYTE*)(GetWindowLongPtrW(hShellTray_Wnd, 0)); // -> CTray\n        if (CTrayInstance)\n        {\n            const unsigned int TRAYUI_OFFSET_IN_CTRAY = 110;\n            INT64* TrayUIInstance = *((INT64*)CTrayInstance + TRAYUI_OFFSET_IN_CTRAY);\n            if (TrayUIInstance)\n            {\n                ((void(*)(void*))(*(INT64*)((*(INT64*)TrayUIInstance) + 60 * sizeof(uintptr_t))))(TrayUIInstance);\n            }\n        }\n    }\n}\n#pragma endregion\n\n\n#pragma region \"Fix taskbar for classic theme and set Explorer window hooks\"\nHWND(*CreateWindowExWFunc)(\n    DWORD     dwExStyle,\n    LPCWSTR   lpClassName,\n    LPCWSTR   lpWindowName,\n    DWORD     dwStyle,\n    int       X,\n    int       Y,\n    int       nWidth,\n    int       nHeight,\n    HWND      hWndParent,\n    HMENU     hMenu,\n    HINSTANCE hInstance,\n    LPVOID    lpParam\n    );\nHWND CreateWindowExWHook(\n    DWORD     dwExStyle,\n    LPCWSTR   lpClassName,\n    LPCWSTR   lpWindowName,\n    DWORD     dwStyle,\n    int       X,\n    int       Y,\n    int       nWidth,\n    int       nHeight,\n    HWND      hWndParent,\n    HMENU     hMenu,\n    HINSTANCE hInstance,\n    LPVOID    lpParam\n)\n{\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"TrayNotifyWnd\"))\n    {\n        dwExStyle |= WS_EX_STATICEDGE;\n    }\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"NotifyIconOverflowWindow\"))\n    {\n        dwExStyle |= WS_EX_STATICEDGE;\n    }\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L\"SysListView32\") || !wcscmp(lpClassName, L\"SysTreeView32\"))) // !wcscmp(lpClassName, L\"FolderView\")\n    {\n        wchar_t wszClassName[200];\n        ZeroMemory(wszClassName, 200);\n        GetClassNameW(GetAncestor(hWndParent, GA_ROOT), wszClassName, 200);\n        if (!wcscmp(wszClassName, L\"CabinetWClass\"))\n        {\n            dwExStyle |= WS_EX_CLIENTEDGE;\n        }\n    }\n    if (bIsExplorerProcess && bToolbarSeparators && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"ReBarWindow32\"))\n    {\n        wchar_t wszClassName[200];\n        ZeroMemory(wszClassName, 200);\n        GetClassNameW(hWndParent, wszClassName, 200);\n        if (!wcscmp(wszClassName, L\"Shell_TrayWnd\"))\n        {\n            dwStyle |= RBS_BANDBORDERS;\n        }\n    }\n    HWND hWnd = CreateWindowExWFunc(\n        dwExStyle,\n        lpClassName,\n        lpWindowName,\n        dwStyle,\n        X,\n        Y,\n        nWidth,\n        nHeight,\n        hWndParent,\n        hMenu,\n        hInstance,\n        lpParam\n    );\n#if WITH_MAIN_PATCHER\n    if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L\"TrayClockWClass\") || !wcscmp(lpClassName, L\"ClockButton\")))\n    {\n        SetWindowSubclass(hWnd, ClockButtonSubclassProc, ClockButtonSubclassProc, 0);\n    }\n    else if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"TrayShowDesktopButtonWClass\"))\n    {\n        SetWindowSubclass(hWnd, ShowDesktopSubclassProc, ShowDesktopSubclassProc, 0);\n    }\n    else if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"Shell_TrayWnd\"))\n    {\n        SetWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc, TRUE);\n        Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, GetCurrentThreadId());\n    }\n    else if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"Shell_SecondaryTrayWnd\"))\n    {\n        SetWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc, FALSE);\n    }\n    else if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !_wcsicmp(lpClassName, L\"ReBarWindow32\") && hWndParent == FindWindowW(L\"Shell_TrayWnd\", NULL))\n    {\n        SetWindowSubclass(hWnd, ReBarWindow32SubclassProc, ReBarWindow32SubclassProc, FALSE);\n    }\n#endif\n    /*\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L\"FolderView\")))\n    {\n        wchar_t wszClassName[200];\n        GetClassNameW(GetAncestor(hWndParent, GA_ROOT), wszClassName, 200);\n        if (!wcscmp(wszClassName, L\"CabinetWClass\"))\n        {\n            SendMessageW(hWnd, 0x108, 0, 0);\n        }\n    }\n    */\n    //SetWindowTheme(hWnd, L\" \", L\" \");\n    return hWnd;\n}\n\nLONG_PTR(*SetWindowLongPtrWFunc)(\n    HWND     hWnd,\n    int      nIndex,\n    LONG_PTR dwNewLong\n    );\nLONG_PTR SetWindowLongPtrWHook(\n    HWND     hWnd,\n    int      nIndex,\n    LONG_PTR dwNewLong\n)\n{\n    WCHAR lpClassName[200];\n    ZeroMemory(lpClassName, 200);\n    GetClassNameW(hWnd, lpClassName, 200);\n    HWND hWndParent = GetParent(hWnd);\n\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"TrayNotifyWnd\"))\n    {\n        if (nIndex == GWL_EXSTYLE)\n        {\n            dwNewLong |= WS_EX_STATICEDGE;\n        }\n    }\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"NotifyIconOverflowWindow\"))\n    {\n        if (nIndex == GWL_EXSTYLE)\n        {\n            dwNewLong |= WS_EX_STATICEDGE;\n        }\n    }\n    if (bClassicThemeMitigations && (*((WORD*)&(lpClassName)+1)) && (!wcscmp(lpClassName, L\"SysListView32\") || !wcscmp(lpClassName, L\"SysTreeView32\"))) // !wcscmp(lpClassName, L\"FolderView\")\n    {\n        wchar_t wszClassName[200];\n        ZeroMemory(wszClassName, 200);\n        GetClassNameW(GetAncestor(hWndParent, GA_ROOT), wszClassName, 200);\n        if (!wcscmp(wszClassName, L\"CabinetWClass\"))\n        {\n            if (nIndex == GWL_EXSTYLE)\n            {\n                dwNewLong |= WS_EX_CLIENTEDGE;\n            }\n        }\n    }\n    if (bIsExplorerProcess && bToolbarSeparators && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"ReBarWindow32\"))\n    {\n        wchar_t wszClassName[200];\n        ZeroMemory(wszClassName, 200);\n        GetClassNameW(hWndParent, wszClassName, 200);\n        if (!wcscmp(wszClassName, L\"Shell_TrayWnd\"))\n        {\n            if (nIndex == GWL_STYLE)\n            {\n                dwNewLong |= RBS_BANDBORDERS;\n            }\n        }\n    }\n    return SetWindowLongPtrWFunc(hWnd, nIndex, dwNewLong);\n}\n\n#if WITH_MAIN_PATCHER\nHRESULT (*explorer_SetWindowThemeFunc)(\n    HWND    hwnd,\n    LPCWSTR pszSubAppName,\n    LPCWSTR pszSubIdList\n);\nHRESULT explorer_SetWindowThemeHook(\n    HWND    hwnd,\n    LPCWSTR pszSubAppName,\n    LPCWSTR pszSubIdList\n)\n{\n    if (bClassicThemeMitigations)\n    {\n        printf(\"SetWindowTheme\\n\");\n        return explorer_SetWindowThemeFunc(hwnd, L\" \", L\" \");\n    }\n    return explorer_SetWindowThemeFunc(hwnd, pszSubAppName, pszSubIdList);\n}\n\nHDPA hOrbCollection = NULL;\nHRESULT explorer_DrawThemeBackground(\n    HTHEME  hTheme,\n    HDC     hdc,\n    int     iPartId,\n    int     iStateId,\n    LPCRECT pRect,\n    LPCRECT pClipRect\n)\n{\n    if (dwOrbStyle && hOrbCollection)\n    {\n        for (unsigned int i = 0; i < DPA_GetPtrCount(hOrbCollection); ++i)\n        {\n            OrbInfo* oi = DPA_FastGetPtr(hOrbCollection, i);\n            if (oi->hTheme == hTheme)\n            {\n                BITMAPINFO bi;\n                ZeroMemory(&bi, sizeof(BITMAPINFO));\n                bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);\n                bi.bmiHeader.biWidth = 1;\n                bi.bmiHeader.biHeight = 1;\n                bi.bmiHeader.biPlanes = 1;\n                bi.bmiHeader.biBitCount = 32;\n                bi.bmiHeader.biCompression = BI_RGB;\n                RGBQUAD transparent = { 0, 0, 0, 0 };\n                RGBQUAD color = { 0xFF, 0xFF, 0xFF, 0xFF };\n\n                if (dwOrbStyle == ORB_STYLE_WINDOWS11)\n                {\n                    UINT separator = oi->dpi / 96;\n                    //printf(\">>> SEPARATOR %p %d %d\\n\", oi->hTheme, oi->dpi, separator);\n\n                    // Background\n                    StretchDIBits(hdc,\n                        pRect->left + (separator % 2),\n                        pRect->top + (separator % 2),\n                        pRect->right - pRect->left - (separator % 2),\n                        pRect->bottom - pRect->top - (separator % 2),\n                        0, 0, 1, 1, &color, &bi,\n                        DIB_RGB_COLORS, SRCCOPY);\n                    // Middle vertical line\n                    StretchDIBits(hdc,\n                        pRect->left + ((pRect->right - pRect->left) / 2) - (separator / 2),\n                        pRect->top,\n                        separator,\n                        pRect->bottom - pRect->top,\n                        0, 0, 1, 1, &transparent, &bi,\n                        DIB_RGB_COLORS, SRCCOPY);\n                    // Middle horizontal line\n                    StretchDIBits(hdc,\n                        pRect->left,\n                        pRect->top + ((pRect->bottom - pRect->top) / 2) - (separator / 2),\n                        pRect->right - pRect->left,\n                        separator,\n                        0, 0, 1, 1, &transparent, &bi,\n                        DIB_RGB_COLORS, SRCCOPY);\n                }\n                else if (dwOrbStyle == ORB_STYLE_TRANSPARENT)\n                {\n                    StretchDIBits(hdc,\n                        pRect->left,\n                        pRect->top,\n                        pRect->right - pRect->left,\n                        pRect->bottom - pRect->top,\n                        0, 0, 1, 1, &transparent, &bi,\n                        DIB_RGB_COLORS, SRCCOPY);\n                }\n                return S_OK;\n            }\n        }\n    }\n    if (bClassicThemeMitigations)\n    {\n        if (iPartId == 4 && iStateId == 1)\n        {\n            COLORREF bc = GetBkColor(hdc);\n            COLORREF fc = GetTextColor(hdc);\n            int mode = SetBkMode(hdc, TRANSPARENT);\n\n            SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));\n\n            NONCLIENTMETRICSW ncm;\n            ncm.cbSize = sizeof(NONCLIENTMETRICSW);\n            SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0);\n\n            HFONT hFont = CreateFontIndirectW(&(ncm.lfCaptionFont));\n\n            UINT dpiX, dpiY;\n            HRESULT hr = GetDpiForMonitor(\n                MonitorFromWindow(WindowFromDC(hdc), MONITOR_DEFAULTTOPRIMARY),\n                MDT_DEFAULT,\n                &dpiX,\n                &dpiY\n            );\n            double dx = dpiX / 96.0, dy = dpiY / 96.0;\n\n            HGDIOBJ hOldFont = SelectObject(hdc, hFont);\n            DWORD dwTextFlags = DT_SINGLELINE | DT_CENTER | DT_VCENTER;\n            RECT rc = *pRect;\n            rc.bottom -= 7 * dy;\n            DrawTextW(\n                hdc,\n                L\"\\u2026\",\n                -1, \n                &rc,\n                dwTextFlags\n            );\n            SelectObject(hdc, hOldFont);\n            DeleteObject(hFont);\n            SetBkColor(hdc, bc);\n            SetTextColor(hdc, fc);\n            SetBkMode(hdc, mode);\n        }\n        return S_OK;\n    }\n    return DrawThemeBackground(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);\n}\n\nHRESULT explorer_CloseThemeData(HTHEME hTheme)\n{\n    HRESULT hr = CloseThemeData(hTheme);\n    if (SUCCEEDED(hr) && hOrbCollection)\n    {\n        for (unsigned int i = 0; i < DPA_GetPtrCount(hOrbCollection); ++i)\n        {\n            OrbInfo* oi = DPA_FastGetPtr(hOrbCollection, i);\n            if (oi->hTheme == hTheme)\n            {\n                //printf(\">>> DELETE DPA %p %d\\n\", oi->hTheme, oi->dpi);\n                DPA_DeletePtr(hOrbCollection, i);\n                free(oi);\n                break;\n            }\n        }\n    }\n    return hr;\n}\n\nHTHEME explorer_OpenThemeDataForDpi(\n    HWND    hwnd,\n    LPCWSTR pszClassList,\n    UINT    dpi\n)\n{\n    if ((*((WORD*)&(pszClassList)+1)) && !wcscmp(pszClassList, L\"TaskbarPearl\"))\n    {\n        if (!hOrbCollection)\n        {\n            hOrbCollection = DPA_Create(MAX_NUM_MONITORS);\n        }\n\n        HTHEME hTheme = OpenThemeDataForDpi(hwnd, pszClassList, dpi);\n        if (hTheme && hOrbCollection)\n        {\n            OrbInfo* oi = malloc(sizeof(OrbInfo));\n            if (oi)\n            {\n                oi->hTheme = hTheme;\n                oi->dpi = dpi;\n                //printf(\">>> APPEND DPA %p %d\\n\", oi->hTheme, oi->dpi);\n                DPA_AppendPtr(hOrbCollection, oi);\n            }\n        }\n        return hTheme;\n    }\n\n    // task list - Taskband2 from CTaskListWnd::_HandleThemeChanged\n    if (bClassicThemeMitigations && (*((WORD*)&(pszClassList)+1)) && !wcscmp(pszClassList, L\"Taskband2\"))\n    {\n        return 0xDeadBeef;\n    }\n    // system tray notification area more icons\n    else if (bClassicThemeMitigations && (*((WORD*)&(pszClassList)+1)) && !wcscmp(pszClassList, L\"TrayNotifyFlyout\"))\n    {\n        return 0xABadBabe;\n    }\n    /*else if (bClassicThemeMitigations && (*((WORD*)&(pszClassList)+1)) && wcsstr(pszClassList, L\"::Taskband2\"))\n    {\n        wprintf(L\"%s\\n\", pszClassList);\n        return 0xB16B00B5;\n    }*/\n    return OpenThemeDataForDpi(hwnd, pszClassList, dpi);\n}\n\nHRESULT explorer_GetThemeMetric(\n    HTHEME hTheme,\n    HDC    hdc,\n    int    iPartId,\n    int    iStateId,\n    int    iPropId,\n    int* piVal\n)\n{\n    if (!bClassicThemeMitigations || (hTheme != 0xABadBabe))\n    {\n        return GetThemeMetric(\n            hTheme,\n            hdc,\n            iPartId,\n            iStateId,\n            iPropId,\n            piVal\n        );\n    }\n    const int TMT_WIDTH = 2416;\n    const int TMT_HEIGHT = 2417;\n    if (hTheme == 0xABadBabe && iPropId == TMT_WIDTH && iPartId == 3 && iStateId == 0)\n    {\n        *piVal = GetSystemMetrics(SM_CXICON);\n    }\n    else if (hTheme == 0xABadBabe && iPropId == TMT_HEIGHT && iPartId == 3 && iStateId == 0)\n    {\n        *piVal = GetSystemMetrics(SM_CYICON);\n    }\n    return S_OK;\n}\n\nHRESULT explorer_GetThemeMargins(\n    HTHEME  hTheme,\n    HDC     hdc,\n    int     iPartId,\n    int     iStateId,\n    int     iPropId,\n    LPCRECT prc,\n    MARGINS* pMargins\n)\n{\n    if (!bClassicThemeMitigations || (hTheme != 0xDeadBeef && hTheme != 0xABadBabe))\n    {\n        HRESULT hr = GetThemeMargins(\n            hTheme,\n            hdc,\n            iPartId,\n            iStateId,\n            iPropId,\n            prc,\n            pMargins\n        );\n        return hr;\n    }\n    const int TMT_SIZINGMARGINS = 3601;\n    const int TMT_CONTENTMARGINS = 3602;\n    HRESULT hr = S_OK;\n    if (hTheme)\n    {\n        hr = GetThemeMargins(\n            hTheme,\n            hdc,\n            iPartId,\n            iStateId,\n            iPropId,\n            prc,\n            pMargins\n        );\n    }\n    /*if (hTheme == 0xB16B00B5)\n    {\n        printf(\n            \"GetThemeMargins %d %d %d - %d %d %d %d\\n\", \n            iPartId, \n            iStateId, \n            iPropId, \n            pMargins->cxLeftWidth, \n            pMargins->cyTopHeight, \n            pMargins->cxRightWidth, \n            pMargins->cyBottomHeight\n        );\n    }*/\n    if (hTheme == 0xDeadBeef && iPropId == TMT_CONTENTMARGINS && iPartId == 5 && iStateId == 1)\n    {\n        // task list button measurements\n        pMargins->cxLeftWidth = 4;\n        pMargins->cyTopHeight = 3;\n        pMargins->cxRightWidth = 4;\n        pMargins->cyBottomHeight = 3;\n    }\n    else if (hTheme == 0xDeadBeef && iPropId == TMT_CONTENTMARGINS && iPartId == 1 && iStateId == 0)\n    {\n        // task list measurements\n        pMargins->cxLeftWidth = 0;\n        pMargins->cyTopHeight = 0;\n        pMargins->cxRightWidth = 4;\n        pMargins->cyBottomHeight = 0;\n    }\n    else if (hTheme == 0xDeadBeef && iPropId == TMT_SIZINGMARGINS && iPartId == 5 && iStateId == 1)\n    {\n        pMargins->cxLeftWidth = 0;\n        pMargins->cyTopHeight = 10;\n        pMargins->cxRightWidth = 0;\n        pMargins->cyBottomHeight = 10;\n    }\n    else if (hTheme = 0xABadBabe && iPropId == TMT_CONTENTMARGINS && iPartId == 3 && iStateId == 0)\n    {\n        pMargins->cxLeftWidth = 6;// GetSystemMetrics(SM_CXICONSPACING);\n        pMargins->cyTopHeight = 6;// GetSystemMetrics(SM_CYICONSPACING);\n        pMargins->cxRightWidth = 6;//GetSystemMetrics(SM_CXICONSPACING);\n        pMargins->cyBottomHeight = 6;// GetSystemMetrics(SM_CYICONSPACING);\n    }\n    HWND hShell_TrayWnd = FindWindowEx(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n    if (hShell_TrayWnd)\n    {\n        LONG dwStyle = 0;\n        dwStyle = GetWindowLongW(hShell_TrayWnd, GWL_STYLE);\n        dwStyle |= WS_DLGFRAME;\n        SetWindowLongW(hShell_TrayWnd, GWL_STYLE, dwStyle);\n        dwStyle &= ~WS_DLGFRAME;\n        SetWindowLongW(hShell_TrayWnd, GWL_STYLE, dwStyle);\n    }\n    HWND hWnd = NULL;\n    do\n    {\n        hWnd = FindWindowEx(\n            NULL,\n            hWnd,\n            L\"Shell_SecondaryTrayWnd\",\n            NULL\n        );\n        if (hWnd)\n        {\n            LONG dwStyle = 0;\n            dwStyle = GetWindowLongW(hWnd, GWL_STYLE);\n            dwStyle |= WS_DLGFRAME;\n            SetWindowLongW(hWnd, GWL_STYLE, dwStyle);\n            dwStyle &= ~WS_DLGFRAME;\n            SetWindowLongW(hWnd, GWL_STYLE, dwStyle);\n        }\n    } while (hWnd);\n    return S_OK;\n}\n\nHRESULT explorer_DrawThemeTextEx(\n    HTHEME        hTheme,\n    HDC           hdc,\n    int           iPartId,\n    int           iStateId,\n    LPCWSTR       pszText,\n    int           cchText,\n    DWORD         dwTextFlags,\n    LPRECT        pRect,\n    const DTTOPTS* pOptions\n)\n{\n    if (!bClassicThemeMitigations)\n    {\n        return DrawThemeTextEx(\n            hTheme,\n            hdc,\n            iPartId,\n            iStateId,\n            pszText,\n            cchText,\n            dwTextFlags,\n            pRect,\n            pOptions\n        );\n    }\n\n    COLORREF bc = GetBkColor(hdc);\n    COLORREF fc = GetTextColor(hdc);\n    int mode = SetBkMode(hdc, TRANSPARENT);\n    \n    wchar_t text[200];\n    GetWindowTextW(GetForegroundWindow(), text, 200);\n\n    BOOL bIsActiveUnhovered = (iPartId == 5 && iStateId == 5);\n    BOOL bIsInactiveUnhovered = (iPartId == 5 && iStateId == 1);\n    BOOL bIsInactiveHovered = (iPartId == 5 && iStateId == 2);\n    BOOL bIsActiveHovered = bIsInactiveHovered && !wcscmp(text, pszText);\n\n    SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));\n\n    NONCLIENTMETRICSW ncm;\n    ncm.cbSize = sizeof(NONCLIENTMETRICSW);\n    SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0);\n\n    HFONT hFont = NULL;\n    if (bIsActiveUnhovered || bIsActiveHovered)\n    {\n        ncm.lfCaptionFont.lfWeight = FW_BOLD;\n    }\n    else\n    {\n        ncm.lfCaptionFont.lfWeight = FW_NORMAL;\n    }\n    hFont = CreateFontIndirectW(&(ncm.lfCaptionFont));\n\n    if (iPartId == 5 && iStateId == 0) // clock\n    {\n        pRect->top += 2;\n    }\n\n    HGDIOBJ hOldFont = SelectObject(hdc, hFont);\n    DrawTextW(\n        hdc,\n        pszText,\n        cchText, \n        pRect,\n        dwTextFlags\n    );\n    SelectObject(hdc, hOldFont);\n    DeleteObject(hFont);\n    SetBkColor(hdc, bc);\n    SetTextColor(hdc, fc);\n    SetBkMode(hdc, mode);\n    return S_OK;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Change links\"\nint ExplorerFrame_CompareStringOrdinal(const WCHAR* a1, int a2, const WCHAR* a3, int a4, BOOL bIgnoreCase)\n{\n    void* pRedirects[10] =\n    {\n        L\"::{BB06C0E4-D293-4F75-8A90-CB05B6477EEE}\", // System                     (default: redirected to Settings app)\n        L\"::{7B81BE6A-CE2B-4676-A29E-EB907A5126C5}\", // Programs and Features      (default: not redirected)\n        NULL,\n        // The following are unused but available for the future\n        L\"::{D450A8A1-9568-45C7-9C0E-B4F9FB4537BD}\", // Installed Updates          (default: not redirected)\n        L\"::{17CD9488-1228-4B2F-88CE-4298E93E0966}\", // Default Programs           (default: not redirected)\n        L\"::{8E908FC9-BECC-40F6-915B-F4CA0E70D03D}\", // Network and Sharing Center (default: not redirected)\n        L\"::{7007ACC7-3202-11D1-AAD2-00805FC1270E}\", // Network Connections        (default: not redirected)\n        L\"Advanced\",                                 // Network and Sharing Center -> Change advanced sharing options (default: not redirected)\n        L\"::{A8A91A66-3A7D-4424-8D24-04E180695C7A}\", // Devices and Printers       (default: not redirected)\n        NULL\n    };\n    int ret = CompareStringOrdinal(a1, a2, a3, a4, bIgnoreCase);\n    if (ret != CSTR_EQUAL)\n    {\n        return ret;\n    }\n\n    int i = 0;\n    while (1)\n    {\n        BOOL bCond = FALSE;\n        if (i == 0) bCond = bDoNotRedirectSystemToSettingsApp;\n        else if (i == 1) bCond = bDoNotRedirectProgramsAndFeaturesToSettingsApp;\n        if (CompareStringOrdinal(a3, -1, pRedirects[i], -1, FALSE) == CSTR_EQUAL && bCond) break;\n        i++;\n        if (pRedirects[i] == NULL)\n        {\n            return ret;\n        }\n    }\n\n    return CSTR_GREATER_THAN;\n}\n\n#if WITH_MAIN_PATCHER\nDEFINE_GUID(IID_EnumExplorerCommand,\n    0xA88826F8,\n    0x186F, 0x4987, 0xAA, 0xDE,\n    0xEA, 0x0C, 0xEF, 0x8F, 0xBF, 0xE8\n);\n\ntypedef interface EnumExplorerCommand EnumExplorerCommand;\n\ntypedef struct EnumExplorerCommandVtbl\n{\n    BEGIN_INTERFACE\n\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\n        EnumExplorerCommand* This,\n        /* [in] */ REFIID riid,\n        /* [annotation][iid_is][out] */\n        _COM_Outptr_  void** ppvObject);\n\n    ULONG(STDMETHODCALLTYPE* AddRef)(\n        EnumExplorerCommand* This);\n\n    ULONG(STDMETHODCALLTYPE* Release)(\n        EnumExplorerCommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* Next)(\n        EnumExplorerCommand* This,\n        unsigned int a2,\n        void** a3,\n        void* a4);\n\n    END_INTERFACE\n} EnumExplorerCommandVtbl;\n\ninterface EnumExplorerCommand\n{\n    CONST_VTBL struct EnumExplorerCommandVtbl* lpVtbl;\n};\n\ntypedef interface UICommand UICommand;\n\ntypedef struct UICommandVtbl\n{\n    BEGIN_INTERFACE\n\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\n        UICommand* This,\n        /* [in] */ REFIID riid,\n        /* [annotation][iid_is][out] */\n        _COM_Outptr_  void** ppvObject);\n\n    ULONG(STDMETHODCALLTYPE* AddRef)(\n        UICommand* This);\n\n    ULONG(STDMETHODCALLTYPE* Release)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetTitle)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetIcon)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetTooltip)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* GetCanonicalName)(\n        UICommand* This,\n        GUID* guid);\n\n    HRESULT(STDMETHODCALLTYPE* GetState)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* Invoke)(\n        UICommand* This,\n        void* a2,\n        void* a3);\n\n    HRESULT(STDMETHODCALLTYPE* GetFlags)(\n        UICommand* This);\n\n    HRESULT(STDMETHODCALLTYPE* EnumSubCommands)(\n        UICommand* This);\n\n    END_INTERFACE\n} UICommandVtbl;\n\ninterface UICommand\n{\n    CONST_VTBL struct UICommandVtbl* lpVtbl;\n};\n\nDEFINE_GUID(GUID_UICommand_System,\n    0x4C202CF0,\n    0xC4DC, 0x4251, 0xA3, 0x71,\n    0xB6, 0x22, 0xB4, 0x3D, 0x59, 0x2B\n);\nDEFINE_GUID(GUID_UICommand_ProgramsAndFeatures,\n    0xA2E6D9CC,\n    0xF866, 0x40B6, 0xA4, 0xB2,\n    0xEE, 0x9E, 0x10, 0x04, 0xBD, 0xFC\n);\nHRESULT(*shell32_UICommand_InvokeFunc)(UICommand*, void*, void*);\nHRESULT shell32_UICommand_InvokeHook(UICommand* _this, void* a2, void* a3)\n{\n    // Guid = {A2E6D9CC-F866-40B6-A4B2-EE9E1004BDFC} Programs and Features\n    // Guid = {4C202CF0-C4DC-4251-A371-B622B43D592B} System\n    GUID guid;\n    ZeroMemory(&guid, sizeof(GUID));\n    _this->lpVtbl->GetCanonicalName(_this, &guid);\n    BOOL bIsSystem = bDoNotRedirectSystemToSettingsApp && IsEqualGUID(&guid, &GUID_UICommand_System);\n    BOOL bIsProgramsAndFeatures = bDoNotRedirectProgramsAndFeaturesToSettingsApp && IsEqualGUID(&guid, &GUID_UICommand_ProgramsAndFeatures);\n    if (bIsSystem || bIsProgramsAndFeatures)\n    {\n        IOpenControlPanel* pOpenControlPanel = NULL;\n        CoCreateInstance(\n            &CLSID_OpenControlPanel,\n            NULL,\n            CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,\n            &IID_OpenControlPanel,\n            &pOpenControlPanel\n        );\n        if (pOpenControlPanel)\n        {\n            WCHAR* pszWhat = L\"\";\n            if (bIsSystem)\n            {\n                pszWhat = L\"Microsoft.System\";\n            }\n            else if (bIsProgramsAndFeatures)\n            {\n                pszWhat = L\"Microsoft.ProgramsAndFeatures\";\n            }\n            pOpenControlPanel->lpVtbl->Open(pOpenControlPanel, pszWhat, NULL, NULL);\n            pOpenControlPanel->lpVtbl->Release(pOpenControlPanel);\n            return S_OK;\n        }\n    }\n    return shell32_UICommand_InvokeFunc(_this, a2, a3);\n}\n\nBOOL explorer_ShellExecuteExW(SHELLEXECUTEINFOW* pExecInfo)\n{\n    if (bDoNotRedirectSystemToSettingsApp && pExecInfo && pExecInfo->lpFile && !wcscmp(pExecInfo->lpFile, L\"ms-settings:about\"))\n    {\n        IOpenControlPanel* pOpenControlPanel = NULL;\n        CoCreateInstance(\n            &CLSID_OpenControlPanel,\n            NULL,\n            CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,\n            &IID_OpenControlPanel,\n            &pOpenControlPanel\n        );\n        if (pOpenControlPanel)\n        {\n            pOpenControlPanel->lpVtbl->Open(pOpenControlPanel, L\"Microsoft.System\", NULL, NULL);\n            pOpenControlPanel->lpVtbl->Release(pOpenControlPanel);\n            return 1;\n        }\n    }\n    return ShellExecuteExW(pExecInfo);\n}\n\nHINSTANCE explorer_ShellExecuteW(\n    HWND    hwnd,\n    LPCWSTR lpOperation,\n    LPCWSTR lpFile,\n    LPCWSTR lpParameters,\n    LPCWSTR lpDirectory,\n    INT     nShowCmd\n)\n{\n    if (bDoNotRedirectNotificationIconsToSettingsApp && !wcscmp(lpFile, L\"ms-settings:notifications\"))\n    {\n        return ShellExecuteW(\n            hwnd, lpOperation,\n            L\"shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\",\n            lpParameters, lpDirectory, nShowCmd\n        );\n    }\n    else if (bDoNotRedirectDateAndTimeToSettingsApp && !wcscmp(lpFile, L\"ms-settings:dateandtime\"))\n    {\n        return ShellExecuteW(\n            hwnd, lpOperation,\n            L\"shell:::{E2E7934B-DCE5-43C4-9576-7FE4F75E7480}\",\n            lpParameters, lpDirectory, nShowCmd\n        );\n    }\n    /*else if (!wcscmp(lpFile, L\"ms-settings:taskbar\"))\n    {\n        LaunchPropertiesGUI(hModule);\n        return 0;\n    }*/\n    return ShellExecuteW(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Classic Drive Grouping\"\n#if WITH_MAIN_PATCHER\nconst struct { DWORD dwDescriptionId; UINT uResourceId; } driveCategoryMap[] = {\n    { SHDID_FS_DIRECTORY,        9338 }, //shell32\n    { SHDID_COMPUTER_SHAREDDOCS, 9338 }, //shell32\n    { SHDID_COMPUTER_FIXED,      IDS_DRIVECATEGORY_HARDDISKDRIVES },\n    { SHDID_COMPUTER_DRIVE35,    IDS_DRIVECATEGORY_REMOVABLESTORAGE },\n    { SHDID_COMPUTER_REMOVABLE,  IDS_DRIVECATEGORY_REMOVABLESTORAGE },\n    { SHDID_COMPUTER_CDROM,      IDS_DRIVECATEGORY_REMOVABLESTORAGE },\n    { SHDID_COMPUTER_DRIVE525,   IDS_DRIVECATEGORY_REMOVABLESTORAGE },\n    { SHDID_COMPUTER_NETDRIVE,   9340 }, //shell32\n    { SHDID_COMPUTER_OTHER,      IDS_DRIVECATEGORY_OTHER },\n    { SHDID_COMPUTER_RAMDISK,    IDS_DRIVECATEGORY_OTHER },\n    { SHDID_COMPUTER_IMAGING,    IDS_DRIVECATEGORY_IMAGING },\n    { SHDID_COMPUTER_AUDIO,      IDS_DRIVECATEGORY_PORTABLEMEDIADEVICE },\n    { SHDID_MOBILE_DEVICE,       IDS_DRIVECATEGORY_PORTABLEDEVICE }\n};\n\n//Represents the true data structure that is returned from shell32!DllGetClassObject\ntypedef struct {\n    const IClassFactoryVtbl* lpVtbl;\n    ULONG flags;\n    REFCLSID rclsid;\n    HRESULT(*pfnCreateInstance)(IUnknown*, REFIID, void**);\n} Shell32ClassFactoryEntry;\n\n//Represents a custom ICategorizer/IShellExtInit\ntypedef struct _EPCategorizer\n{\n    ICategorizerVtbl* categorizer;\n    IShellExtInitVtbl* shellExtInit;\n\n    ULONG ulRefCount;\n    IShellFolder2* pShellFolder;\n} EPCategorizer;\n\n#pragma region \"EPCategorizer: ICategorizer\"\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_ICategorizer_QueryInterface(ICategorizer* _this, REFIID riid, void** ppvObject)\n{\n    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ICategorizer))\n    {\n        *ppvObject = _this;\n    }\n    else if (IsEqualIID(riid, &IID_IShellExtInit))\n    {\n        *ppvObject = &((EPCategorizer*) _this)->shellExtInit;\n    }\n    else\n    {\n        ppvObject = NULL;\n        return E_NOINTERFACE;\n    }\n\n    _this->lpVtbl->AddRef(_this);\n\n    return S_OK;\n}\n\nULONG STDMETHODCALLTYPE EPCategorizer_ICategorizer_AddRef(ICategorizer* _this)\n{\n    return InterlockedIncrement(&((EPCategorizer*)_this)->ulRefCount);\n}\n\nULONG STDMETHODCALLTYPE EPCategorizer_ICategorizer_Release(ICategorizer* _this)\n{\n    ULONG ulNewCount = InterlockedDecrement(&((EPCategorizer*)_this)->ulRefCount);\n\n    //When the window is closed or refreshed the object is finally freed\n    if (ulNewCount == 0)\n    {\n        EPCategorizer* epCategorizer = (EPCategorizer*)_this;\n\n        if (epCategorizer->pShellFolder != NULL)\n        {\n            epCategorizer->pShellFolder->lpVtbl->Release(epCategorizer->pShellFolder);\n            epCategorizer->pShellFolder = NULL;\n        }\n\n        free(epCategorizer);\n    }\n\n    return ulNewCount;\n}\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_ICategorizer_GetDescription(ICategorizer* _this, LPWSTR pszDesc, UINT cch)\n{\n    //As of writing returns the string \"Type\". Same implementation as shell32!CStorageSystemTypeCategorizer::GetDescription\n    LoadStringW(hShell32, 0x3105, pszDesc, cch);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_ICategorizer_GetCategory(ICategorizer* _this, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD* rgCategoryIds)\n{\n    EPCategorizer* epCategorizer = (EPCategorizer*)_this;\n\n    HRESULT hr = S_OK;\n\n    for (UINT i = 0; i < cidl; i++)\n    {\n        rgCategoryIds[i] = IDS_DRIVECATEGORY_OTHER;\n\n        PROPERTYKEY key = { FMTID_ShellDetails, PID_DESCRIPTIONID };\n        VARIANT variant;\n        VariantInit(&variant);\n\n        hr = epCategorizer->pShellFolder->lpVtbl->GetDetailsEx(epCategorizer->pShellFolder, apidl[i], &key, &variant);\n\n        if (SUCCEEDED(hr))\n        {\n            SHDESCRIPTIONID did;\n\n            if (SUCCEEDED(VariantToBuffer(&variant, &did, sizeof(did))))\n            {\n                for (int j = 0; j < ARRAYSIZE(driveCategoryMap); j++)\n                {\n                    if (did.dwDescriptionId == driveCategoryMap[j].dwDescriptionId)\n                    {\n                        rgCategoryIds[i] = driveCategoryMap[j].uResourceId;\n                        break;\n                    }\n                }\n            }\n\n            VariantClear(&variant);\n        }\n    }\n\n    return hr;\n}\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_ICategorizer_GetCategoryInfo(ICategorizer* _this, DWORD dwCategoryId, CATEGORY_INFO* pci)\n{\n    //Now retrieve the display name to use for the resource ID dwCategoryId.\n    //pci is already populated with most of the information it needs, we just need to fill in the wszName\n    if (!LoadStringW(hModule, dwCategoryId, pci->wszName, ARRAYSIZE(pci->wszName)))\n        LoadStringW(hShell32, dwCategoryId, pci->wszName, ARRAYSIZE(pci->wszName));\n\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_ICategorizer_CompareCategory(ICategorizer* _this, CATSORT_FLAGS csfFlags, DWORD dwCategoryId1, DWORD dwCategoryId2)\n{\n    //Typically a categorizer would use the resource IDs containing the names of each category as the \"category ID\" as well. In our case however, we're using\n    //a combination of resource/category IDs provided by shell32 and resource/category IDs we're overriding ourselves. As a result, we are forced to compare\n    //not by the value of the category/resource IDs themselves, but by their _position_ within our category ID map\n\n    int categoryArraySize = ARRAYSIZE(driveCategoryMap);\n\n    int firstPos = -1;\n    int secondPos = -1;\n\n    for (int i = 0; i < categoryArraySize; i++)\n    {\n        if (driveCategoryMap[i].uResourceId == dwCategoryId1)\n        {\n            firstPos = i;\n            break;\n        }\n    }\n\n    for (int i = 0; i < categoryArraySize; i++)\n    {\n        if (driveCategoryMap[i].uResourceId == dwCategoryId2)\n        {\n            secondPos = i;\n            break;\n        }\n    }\n\n    int diff = firstPos - secondPos;\n\n    if (diff < 0)\n        return 0xFFFF;\n\n    return diff > 0;\n}\n\n#pragma endregion\n#pragma region \"EPCategorizer: IShellExtInit\"\n\n//Adjustor Thunks: https://devblogs.microsoft.com/oldnewthing/20040206-00/?p=40723\nHRESULT STDMETHODCALLTYPE EPCategorizer_IShellExtInit_QueryInterface(IShellExtInit* _this, REFIID riid, void** ppvObject)\n{\n    return EPCategorizer_ICategorizer_QueryInterface((ICategorizer*)((char*)_this - sizeof(IShellExtInitVtbl*)), riid, ppvObject);\n}\n\nULONG STDMETHODCALLTYPE EPCategorizer_IShellExtInit_AddRef(IShellExtInit* _this)\n{\n    return EPCategorizer_ICategorizer_AddRef((ICategorizer*)((char*)_this - sizeof(IShellExtInitVtbl*)));\n}\n\nULONG STDMETHODCALLTYPE EPCategorizer_IShellExtInit_Release(IShellExtInit* _this)\n{\n    return EPCategorizer_ICategorizer_Release((ICategorizer*)((char*)_this - sizeof(IShellExtInitVtbl*)));\n}\n\nHRESULT STDMETHODCALLTYPE EPCategorizer_IShellExtInit_Initialize(IShellExtInit* _this, PCIDLIST_ABSOLUTE pidlFolder, IDataObject* pdtobj, HKEY hkeyProgID)\n{\n    EPCategorizer* epCategorizer = (EPCategorizer*)((char*)_this - sizeof(IShellExtInitVtbl*));\n\n    return SHBindToObject(NULL, pidlFolder, NULL, &IID_IShellFolder2, (void**)&epCategorizer->pShellFolder);\n}\n\n#pragma endregion\n\nconst ICategorizerVtbl EPCategorizer_categorizerVtbl = {\n    EPCategorizer_ICategorizer_QueryInterface,\n    EPCategorizer_ICategorizer_AddRef,\n    EPCategorizer_ICategorizer_Release,\n    EPCategorizer_ICategorizer_GetDescription,\n    EPCategorizer_ICategorizer_GetCategory,\n    EPCategorizer_ICategorizer_GetCategoryInfo,\n    EPCategorizer_ICategorizer_CompareCategory\n};\n\nconst IShellExtInitVtbl EPCategorizer_shellExtInitVtbl = {\n    EPCategorizer_IShellExtInit_QueryInterface,\n    EPCategorizer_IShellExtInit_AddRef,\n    EPCategorizer_IShellExtInit_Release,\n    EPCategorizer_IShellExtInit_Initialize\n};\n\nHRESULT(STDMETHODCALLTYPE *shell32_DriveTypeCategorizer_CreateInstanceFunc)(IUnknown* pUnkOuter, REFIID riid, void** ppvObject);\n\nHRESULT shell32_DriveTypeCategorizer_CreateInstanceHook(IUnknown* pUnkOuter, REFIID riid, void** ppvObject)\n{\n    if (bUseClassicDriveGrouping && IsEqualIID(riid, &IID_ICategorizer))\n    {\n        EPCategorizer* epCategorizer = (EPCategorizer*) malloc(sizeof(EPCategorizer));\n        epCategorizer->categorizer = &EPCategorizer_categorizerVtbl;\n        epCategorizer->shellExtInit = &EPCategorizer_shellExtInitVtbl;\n        epCategorizer->ulRefCount = 1;\n        epCategorizer->pShellFolder = NULL;\n\n        *ppvObject = epCategorizer;\n\n        return S_OK;\n    }\n\n    return shell32_DriveTypeCategorizer_CreateInstanceFunc(pUnkOuter, riid, ppvObject);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"File Explorer command bar and ribbon support\"\nDEFINE_GUID(CLSID_XamlIslandViewAdapter,\n    0x6480100B,\n    0x5A83, 0x4D1E, 0x9F, 0x69,\n    0x8A, 0xE5, 0xA8, 0x8E, 0x9A, 0x33\n);\n\nDEFINE_GUID(CLSID_FileExplorerFolderView,\n    0x2AA9162E,\n    0xC906, 0x4DD9, 0xAD, 0x0B,\n    0x3D, 0x24, 0xA8, 0xEE, 0xF5, 0xA0\n);\n\nDEFINE_GUID(CLSID_UIRibbonFramework,\n    0x926749FA,\n    0x2615, 0x4987, 0x88, 0x45,\n    0xC3, 0x3E, 0x65, 0xF2, 0xB9, 0x57\n);\n\nDEFINE_GUID(IID_IUIRibbonFramework,\n    0xF4F0385D,\n    0x6872, 0x43A8, 0xAD, 0x09,\n    0x4C, 0x33, 0x9C, 0xB3, 0xF5, 0xC5\n);\n\nHRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv)\n{\n    if (IsEqualCLSID(rclsid, &CLSID_XamlIslandViewAdapter))\n    {\n        if (dwFileExplorerCommandUI != 0 && dwFileExplorerCommandUI != 3 && dwFileExplorerCommandUI != 4)\n            return REGDB_E_CLASSNOTREG;\n    }\n    else if (IsEqualCLSID(rclsid, &CLSID_UIRibbonFramework) && IsEqualIID(riid, &IID_IUIRibbonFramework))\n    {\n        if (dwFileExplorerCommandUI == 2)\n            return REGDB_E_CLASSNOTREG;\n    }\n    return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);\n}\n\nHRESULT shell32_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv)\n{\n    if (IsEqualCLSID(rclsid, &CLSID_FileExplorerFolderView))\n    {\n        if (dwFileExplorerCommandUI != 0 && dwFileExplorerCommandUI != 3 && dwFileExplorerCommandUI != 4)\n            return REGDB_E_CLASSNOTREG;\n    }\n    return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);\n}\n\nHACCEL WINAPI ExplorerFrame_LoadAcceleratorsW(HINSTANCE hInstance, LPCWSTR lpTableName)\n{\n    if (IS_INTRESOURCE(lpTableName))\n    {\n        UINT uID = (UINT)(UINT_PTR)lpTableName;\n        if (uID == 262)\n        {\n            // When FEMNB (File Explorer Modern Navigation Bar) feature flag is enabled, restore Alt+D functionality\n            // when it is not used\n            if (dwFileExplorerCommandUI != 0)\n                return NULL;\n        }\n    }\n    return LoadAcceleratorsW(hInstance, lpTableName);\n}\n\n/**\n * When TIFE feature flag is enabled:\n * - Fixes menu bar behavior on Windows 7 Command Bar\n * - Fixes window position and size not being saved on Windows 8/10 Ribbon\n */\nvoid FixTIFEBreakagesForLegacyControlInterfaces(PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return;\n\n#if defined(_M_X64)\n    // No TIFE feature flag\n    // 8B 8B ?? ?? 00 00 8B 83 ?? ?? 00 00 89 8B ?? ?? 00 00 89 83 ?? ?? 00 00 F6 C1 10 <jz/jnz>\n    // Ref: CInternetToolbar::_CreateBands()\n    PBYTE match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x8B\\x8B\\x00\\x00\\x00\\x00\\x8B\\x83\\x00\\x00\\x00\\x00\\x89\\x8B\\x00\\x00\\x00\\x00\\x89\\x83\\x00\\x00\\x00\\x00\\xF6\\xC1\\x10\",\n        \"xx??xxxx??xxxx??xxxx??xxxxx\"\n    );\n    if (match)\n    {\n        match += 27; // Point to jump\n    }\n    else\n    {\n        // TIFE feature flag present (pattern is fragile!)\n        // 8B 83 ?? ?? 00 00 A8 10 <jz>\n        // Ref: CInternetToolbar::_CreateBands()\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x8B\\x83\\x00\\x00\\x00\\x00\\xA8\\x10\",\n            \"xx??xxxx\"\n        );\n        if (match)\n        {\n            match += 8; // Point to jump\n        }\n    }\n    if (match) // Should be pointed to jump at this point\n    {\n        PBYTE target = NULL;\n        DWORD jmpInstrSize = 0;\n        if (FollowJnz(match, &target, &jmpInstrSize))\n        {\n            // Nop the jnz\n            DWORD dwOldProtect;\n            if (VirtualProtect(match, jmpInstrSize, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                memset(match, 0x90, jmpInstrSize);\n                VirtualProtect(match, jmpInstrSize, dwOldProtect, &dwOldProtect);\n            }\n        }\n        else if (FollowJz(match, &target, &jmpInstrSize))\n        {\n            if (jmpInstrSize == 2)\n            {\n                // Change short jz to short jmp\n                DWORD dwOldProtect;\n                if (VirtualProtect(match, jmpInstrSize, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n                {\n                    match[0] = 0xEB; // jmp\n                    VirtualProtect(match, jmpInstrSize, dwOldProtect, &dwOldProtect);\n                }\n            }\n            else if (jmpInstrSize == 6)\n            {\n                // Change long jz to long jmp\n                DWORD dwOldProtect;\n                if (VirtualProtect(match, jmpInstrSize, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n                {\n                    match[0] = 0xE9; // jmp rel32\n                    *(int*)(match + 1) = (int)(target - (match + 5));\n                    match[5] = 0x90; // nop\n                    VirtualProtect(match, jmpInstrSize, dwOldProtect, &dwOldProtect);\n                }\n            }\n        }\n    }\n#elif defined(_M_ARM64)\n    // No TIFE feature flag\n    // 69 ?? ?? B9 68 ?? ?? B9 69 ?? ?? 29 <TBZ/TBNZ>\n    // Ref: CInternetToolbar::_CreateBands()\n    PBYTE match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x69\\x00\\x00\\xB9\\x68\\x00\\x00\\xB9\\x69\\x00\\x00\\x29\",\n        \"x??xx??xx??x\"\n    );\n    if (match)\n    {\n        match += 12; // Point to TBZ/TBNZ\n    }\n    else\n    {\n        // TIFE feature flag present\n        // 68 ?? ?? B9 68 00 20 36 08 79 1B 12 68 ?? ?? B9\n        //             ^^^^^^^^^^^ <TBZ>\n        // Ref: CInternetToolbar::_CreateBands()\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x68\\x00\\x00\\xB9\\x68\\x00\\x20\\x36\\x08\\x79\\x1B\\x12\\x68\\x00\\x00\\xB9\",\n            \"x??xxxxxxxxxx??x\"\n        );\n        if (match)\n        {\n            match += 4; // Point to TBZ\n        }\n    }\n    if (match) // Should be pointed to TBZ/TBNZ at this point\n    {\n        DWORD insnCurrent = *(DWORD*)match;\n        DWORD insnNew = 0;\n        if (ARM64_IsTBZ(insnCurrent))\n        {\n            insnNew = ARM64_TBZToB(insnCurrent);\n        }\n        else if (ARM64_IsTBNZ(insnCurrent))\n        {\n            insnNew = 0xD503201F; // NOP\n        }\n        if (insnNew != 0)\n        {\n            DWORD dwOldProtect;\n            if (VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(DWORD*)match = insnNew;\n                VirtualProtect(match, 4, dwOldProtect, &dwOldProtect);\n            }\n        }\n    }\n#endif\n}\n#pragma endregion\n\n\n#pragma region \"Change language UI style + Enable old taskbar\"\n#if WITH_MAIN_PATCHER\nDEFINE_GUID(CLSID_TrayUIComponent,\n    0x88FC85D3,\n    0x7090, 0x4F53, 0x8F, 0x7A,\n    0xEB, 0x02, 0x68, 0x16, 0x27, 0x88\n);\n\nHRESULT EPTrayUIComponent_CreateInstance(REFIID riid, void** ppvObject);\n\n__declspec(dllexport) HRESULT explorer_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, void** ppv)\n{\n    if (IsEqualCLSID(rclsid, &CLSID_InputSwitchControl) && IsEqualIID(riid, &IID_IInputSwitchControl))\n    {\n        HRESULT hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);\n        if (SUCCEEDED(hr) && bOldTaskbar && dwIMEStyle)\n        {\n            // The commented method below is no longer required as I have now came to creating a wrapper class.\n            // Also, make sure to read the explanation below as well, it's useful for understanding how this worked.\n            // Note: Other than in explorer.exe!CTrayInputIndicator::_RegisterInputSwitch, we're also called by\n            // explorer.exe!HostAppEnvironment::_SetupInputSwitchServer which passes ISCT_IDL_USEROOBE (6) as the style.\n            if (IsWindows11Version22H2OrHigher())\n            {\n                hr = CInputSwitchControlProxySV2_CreateInstance(*ppv, riid, ppv);\n            }\n            else\n            {\n                hr = CInputSwitchControlProxy_CreateInstance(*ppv, riid, ppv);\n            }\n            // Pff... how this works:\n            // \n            // * This `CoCreateInstance` call will get a pointer to an IInputSwitchControl interface\n            // (the call to here is made from `explorer!CTrayInputIndicator::_RegisterInputSwitch`);\n            // the next call on this pointer will be on the `IInputSwitchControl::Init` function.\n            // \n            // * `IInputSwitchControl::Init`'s second parameter is a number (x) which tells which\n            // language switcher UI to prepare (check `IsUtil::MapClientTypeToString` in\n            // `InputSwitch.dll`). \"explorer\" requests the \"DESKTOP\" UI (x = 0), which is the new\n            // Windows 11 UI; if we replace that number with something else, some other UI will\n            // be created\n            // \n            // * ~~We cannot patch the vtable of the COM object because the executable is protected\n            // by control flow guard and we would make a jump to an invalid site (maybe there is\n            // some clever workaround fpr this as well, somehow telling the compiler to place a certain\n            // canary before our trampoline, so it matches with what the runtime support for CFG expects,\n            // but we'd have to keep that canary in sync with the one in explorer.exe, so not very\n            // future proof).~~ Edit: Not true after all.\n            // \n            // * Taking advantage of the fact that the call to `IInputSwitchControl::Init` is the thing\n            // that happens right after we return from here, and looking on the disassembly, we see nothing\n            // else changes `rdx` (which is the second argument to a function call), basically x, besides the\n            // very `xor edx, edx` instruction before the call. Thus, we patch that out, and we also do\n            // `mov edx, whatever` here; afterwards, we do NOTHING else, but just return and hope that\n            // edx will stick\n            // \n            // * Needless to say this is **HIGHLY** amd64\n            /*\n            char pattern[2] = {0x33, 0xD2};\n            DWORD dwOldProtect;\n            char* p_mov_edx_val = mov_edx_val;\n            if (!ep_pf)\n            {\n                ep_pf = memmem(_ReturnAddress(), 200, pattern, 2);\n                if (ep_pf)\n                {\n                    // Cancel out `xor edx, edx`\n                    VirtualProtect(ep_pf, 2, PAGE_EXECUTE_READWRITE, &dwOldProtect);\n                    memset(ep_pf, 0x90, 2);\n                    VirtualProtect(ep_pf, 2, dwOldProtect, &dwOldProtect);\n                }\n                VirtualProtect(p_mov_edx_val, 6, PAGE_EXECUTE_READWRITE, &dwOldProtect);\n            }\n            if (ep_pf)\n            {\n                // Craft a \"function\" which does `mov edx, whatever; ret` and call it\n                DWORD* pVal = mov_edx_val + 1;\n                *pVal = dwIMEStyle;\n                void(*pf_mov_edx_val)() = p_mov_edx_val;\n                pf_mov_edx_val();\n            }\n            */\n        }\n        return hr;\n    }\n    else if (IsEqualCLSID(rclsid, &CLSID_TrayUIComponent) && IsEqualIID(riid, &IID_ITrayUIComponent))\n    {\n        if (bOldTaskbar && explorer_TrayUI_CreateInstanceFunc)\n        {\n            return EPTrayUIComponent_CreateInstance(riid, ppv);\n        }\n    }\n    return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Explorer Registry Hooks\"\nLSTATUS explorer_RegCreateKeyExW(\n    HKEY hKey,\n    LPCWSTR lpSubKey,\n    DWORD Reserved,\n    LPWSTR lpClass,\n    DWORD dwOptions,\n    REGSAM samDesired,\n    const LPSECURITY_ATTRIBUTES lpSecurityAttributes,\n    PHKEY phkResult,\n    LPDWORD lpdwDisposition\n)\n{\n    if (!lstrcmpW(lpSubKey, L\"MMStuckRects3\"))\n    {\n        lpSubKey = L\"MMStuckRectsLegacy\";\n    }\n    else if (!lstrcmpW(lpSubKey, L\"StuckRects3\"))\n    {\n        lpSubKey = L\"StuckRectsLegacy\";\n    }\n\n    return RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);\n}\n\nLSTATUS explorer_SHGetValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD* pdwType, void* pvData, DWORD* pcbData)\n{\n    if (!lstrcmpW(pszSubKey, L\"MMStuckRects3\"))\n    {\n        pszSubKey = L\"MMStuckRectsLegacy\";\n    }\n    else if (!lstrcmpW(pszSubKey, L\"StuckRects3\"))\n    {\n        pszSubKey = L\"StuckRectsLegacy\";\n    }\n\n    return SHGetValueW(hkey, pszSubKey, pszValue, pdwType, pvData, pcbData);\n}\n\nIStream* explorer_OpenRegStream(HKEY hkey, PCWSTR pszSubkey, PCWSTR pszValue, DWORD grfMode)\n{\n    DWORD flOldProtect;\n\n    if (!lstrcmpiW(pszValue, L\"TaskbarWinXP\")\n        && VirtualProtect(pszValue, 0xC8, PAGE_EXECUTE_READWRITE, &flOldProtect))\n    {\n        lstrcpyW(pszValue, L\"TaskbarWinEP\");\n        VirtualProtect(pszValue, 0xC8, flOldProtect, &flOldProtect);\n    }\n\n    return OpenRegStream(hkey, pszSubkey, pszValue, grfMode);\n}\n\nLSTATUS explorer_RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, HKEY* phkResult)\n{\n    DWORD flOldProtect;\n\n    if (!lstrcmpiW(lpSubKey, L\"Software\\\\Classes\\\\Local Settings\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\TrayNotify\")\n        && VirtualProtect(lpSubKey, 0xC8ui64, 0x40u, &flOldProtect))\n    {\n        lstrcpyW(lpSubKey, L\"Software\\\\Classes\\\\Local Settings\\\\Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\TrayNotSIB\");\n        VirtualProtect(lpSubKey, 0xC8ui64, flOldProtect, &flOldProtect);\n    }\n\n    return RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);\n}\n\nLSTATUS explorer_RegSetValueExW(\n    HKEY       hKey,\n    LPCWSTR    lpValueName,\n    DWORD      Reserved,\n    DWORD      dwType,\n    const BYTE* lpData,\n    DWORD      cbData\n)\n{\n    if (IsWindows11() && !lstrcmpW(lpValueName, L\"ShowCortanaButton\"))\n    {\n        if (cbData == sizeof(DWORD) && *(DWORD*)lpData == 1)\n        {\n            DWORD dwData = 2;\n            return RegSetValueExW(hKey, L\"TaskbarDa\", Reserved, dwType, &dwData, cbData);\n        }\n        return RegSetValueExW(hKey, L\"TaskbarDa\", Reserved, dwType, lpData, cbData);\n    }\n\n    return RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);\n}\n\nLSTATUS explorer_RegGetValueW(\n    HKEY    hkey,\n    LPCWSTR lpSubKey,\n    LPCWSTR lpValue,\n    DWORD   dwFlags,\n    LPDWORD pdwType,\n    PVOID   pvData,\n    LPDWORD pcbData\n)\n{\n    BOOL bShowTaskViewButton = FALSE;\n    LSTATUS lRes;\n\n    if (IsWindows11() && !lstrcmpW(lpValue, L\"ShowCortanaButton\"))\n    {\n        lRes = RegGetValueW(hkey, lpSubKey, L\"TaskbarDa\", dwFlags, pdwType, pvData, pcbData);\n        if (*(DWORD*)pvData == 2)\n        {\n            *(DWORD*)pvData = 1;\n        }\n    }\n    /*else if (!lstrcmpW(lpValue, L\"PeopleBand\"))\n    {\n        lRes = RegGetValueW(hkey, lpSubKey, L\"TaskbarMn\", dwFlags, pdwType, pvData, pcbData);\n    }*/\n    else\n    {\n        lRes = RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n    }\n\n    /*if (IsWindows11() && !lstrcmpW(lpValue, L\"SearchboxTaskbarMode\"))\n    {\n        if (*(DWORD*)pvData)\n        {\n            *(DWORD*)pvData = 1;\n        }\n\n        lRes = ERROR_SUCCESS;\n    }*/\n\n    return lRes;\n}\n\nHRESULT (*explorer_SHCreateStreamOnModuleResourceWFunc)(\n    HMODULE hModule,\n    LPCWSTR pwszName,\n    LPCWSTR pwszType,\n    IStream** ppStream\n);\n\nHRESULT WINAPI explorer_SHCreateStreamOnModuleResourceWHook(\n    HMODULE hModule,\n    LPCWSTR pwszName,\n    LPCWSTR pwszType,\n    IStream** ppStream\n)\n{\n    wchar_t path[MAX_PATH];\n    GetModuleFileNameW(hModule, path, MAX_PATH);\n    if ((*((WORD*)&(pwszName)+1)))\n    {\n        wprintf(L\"%s - %s %s\\n\", path, pwszName, pwszType);\n    }\n    else\n    {\n        UINT uId = (UINT)(UINT_PTR)pwszName;\n        wprintf(L\"%s - %d %s\\n\", path, uId, pwszType);\n\n        IStream* pStream = NULL;\n        if (uId < 124)\n        {\n            if (S_Icon_Dark_TaskView)\n            {\n                pStream = SHCreateMemStream(P_Icon_Dark_TaskView, S_Icon_Dark_TaskView);\n                if (pStream)\n                {\n                    *ppStream = pStream;\n                    return S_OK;\n                }\n            }\n        }\n        else if (uId >= 151)\n        {\n            if (uId < 163)\n            {\n                if (S_Icon_Dark_Search)\n                {\n                    pStream = SHCreateMemStream(P_Icon_Dark_Search, S_Icon_Dark_Search);\n                    if (pStream)\n                    {\n                        *ppStream = pStream;\n                        return S_OK;\n                    }\n                }\n            }\n\n            if (uId < 201)\n            {\n                if (S_Icon_Light_Search)\n                {\n                    pStream = SHCreateMemStream(P_Icon_Light_Search, S_Icon_Light_Search);\n                    if (pStream)\n                    {\n                        *ppStream = pStream;\n                        return S_OK;\n                    }\n                }\n            }\n\n            if (uId < 213)\n            {\n                if (S_Icon_Dark_Widgets)\n                {\n                    printf(\">>> %p %d\\n\", P_Icon_Dark_Widgets, S_Icon_Dark_Widgets);\n                    pStream = SHCreateMemStream(P_Icon_Dark_Widgets, S_Icon_Dark_Widgets);\n                    if (pStream)\n                    {\n                        *ppStream = pStream;\n                        return S_OK;\n                    }\n                }\n            }\n\n            if (uId < 251)\n            {\n                if (S_Icon_Light_Widgets)\n                {\n                    pStream = SHCreateMemStream(P_Icon_Light_Widgets, S_Icon_Light_Widgets);\n                    if (pStream)\n                    {\n                        *ppStream = pStream;\n                        return S_OK;\n                    }\n                }\n            }\n        }\n        else if (uId < 307)\n        {\n            if (S_Icon_Light_TaskView)\n            {\n                pStream = SHCreateMemStream(P_Icon_Light_TaskView, S_Icon_Light_TaskView);\n                if (pStream)\n                {\n                    *ppStream = pStream;\n                    return S_OK;\n                }\n            }\n        }\n    }\n    return explorer_SHCreateStreamOnModuleResourceWFunc(hModule, pwszName, pwszType, ppStream);\n}\n#pragma endregion\n\n\n#pragma region \"Remember primary taskbar positioning\"\nBOOL bTaskbarFirstTimePositioning = FALSE;\nBOOL bTaskbarSet = FALSE;\n\nBOOL explorer_SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)\n{\n    BOOL bIgnore = FALSE;\n    if (bTaskbarFirstTimePositioning)\n    {\n        bIgnore = bTaskbarSet;\n    }\n    else\n    {\n        bTaskbarFirstTimePositioning = TRUE;\n        bIgnore = (GetSystemMetrics(SM_CMONITORS) == 1);\n        bTaskbarSet = bIgnore;\n    }\n\n    if (bIgnore)\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n    if (xLeft)\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n    if (yTop)\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n    if (xRight != GetSystemMetrics(SM_CXSCREEN))\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n    if (yBottom != GetSystemMetrics(SM_CYSCREEN))\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n\n    bTaskbarSet = TRUE;\n    \n    StuckRectsData srd;\n    DWORD pcbData = sizeof(StuckRectsData);\n    RegGetValueW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StuckRectsLegacy\",\n        L\"Settings\",\n        REG_BINARY,\n        NULL,\n        &srd,\n        &pcbData);\n\n    if (pcbData != sizeof(StuckRectsData))\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n\n    if (srd.pvData[0] != sizeof(StuckRectsData))\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n\n    if (srd.pvData[1] != -2)\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n\n    HMONITOR hMonitor = MonitorFromRect(&(srd.rc), MONITOR_DEFAULTTOPRIMARY);\n    MONITORINFO mi;\n    ZeroMemory(&mi, sizeof(MONITORINFO));\n    mi.cbSize = sizeof(MONITORINFO);\n    if (!GetMonitorInfoW(hMonitor, &mi))\n    {\n        return SetRect(lprc, xLeft, yTop, xRight, yBottom);\n    }\n\n    if (lprc)\n    {\n        *lprc = mi.rcMonitor;\n        return TRUE;\n    }\n\n    return FALSE;\n}\n#pragma endregion\n\n\n#pragma region \"Disable Office Hotkeys\"\nconst UINT office_hotkeys[10] = { 0x57, 0x54, 0x59, 0x4F, 0x50, 0x44, 0x4C, 0x58, 0x4E, 0x20 };\nBOOL explorer_RegisterHotkeyHook(HWND hWnd, int id, UINT fsModifiers, UINT vk)\n{\n    if (bDisableOfficeHotkeys && fsModifiers == (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN | MOD_NOREPEAT) && (\n        vk == office_hotkeys[0] ||\n        vk == office_hotkeys[1] ||\n        vk == office_hotkeys[2] ||\n        vk == office_hotkeys[3] ||\n        vk == office_hotkeys[4] ||\n        vk == office_hotkeys[5] ||\n        vk == office_hotkeys[6] ||\n        vk == office_hotkeys[7] ||\n        vk == office_hotkeys[8] ||\n        vk == office_hotkeys[9] ||\n        !vk))\n    {\n        SetLastError(ERROR_HOTKEY_ALREADY_REGISTERED);\n        return FALSE;\n    }\n\n    BOOL result = RegisterHotKey(hWnd, id, fsModifiers, vk);\n\n    static BOOL bWinBHotkeyRegistered = FALSE;\n    if (!bWinBHotkeyRegistered && fsModifiers == (MOD_WIN | MOD_NOREPEAT) && vk == 'D') // right after Win+D\n    {\n#if USE_MOMENT_3_FIXES_ON_MOMENT_2\n        BOOL bPerformMoment2Patches = IsWindows11Version22H2Build1413OrHigher() && bOldTaskbar;\n#else\n        BOOL bPerformMoment2Patches = bOldTaskbar ? bOldTaskbar == 1 ? IsWindows11Version22H2Build2134OrHigher() : IsWindows11Version22H2Build1413OrHigher() : FALSE;\n#endif\n        if (bPerformMoment2Patches)\n        {\n            // Might be better if we scan the GlobalKeylist array to prevent hardcoded numbers?\n            RegisterHotKey(hWnd, 500, MOD_WIN | MOD_NOREPEAT, 'A');\n            RegisterHotKey(hWnd, 514, MOD_WIN | MOD_NOREPEAT, 'B');\n            RegisterHotKey(hWnd, 591, MOD_WIN | MOD_NOREPEAT, 'N');\n            printf(\"Registered Win+A, Win+B, and Win+N\\n\");\n        }\n        bWinBHotkeyRegistered = TRUE;\n    }\n\n    return result;\n}\n\nBOOL twinui_RegisterHotkeyHook(HWND hWnd, int id, UINT fsModifiers, UINT vk)\n{\n    if (fsModifiers == (MOD_WIN | MOD_NOREPEAT) && vk == 'F')\n    {\n        SetLastError(ERROR_HOTKEY_ALREADY_REGISTERED);\n        return FALSE;\n    }\n    return RegisterHotKey(hWnd, id, fsModifiers, vk);\n}\n#pragma endregion\n\n\n#pragma region \"Fix taskbar thumbnails and acrylic in newer OS builds (22572+)\"\n#if WITH_MAIN_PATCHER\nHRESULT explorer_DwmUpdateThumbnailPropertiesHook(HTHUMBNAIL hThumbnailId, DWM_THUMBNAIL_PROPERTIES* ptnProperties)\n{\n    if (ptnProperties->dwFlags == 0 || ptnProperties->dwFlags == DWM_TNP_RECTSOURCE)\n    {\n        ptnProperties->dwFlags |= DWM_TNP_SOURCECLIENTAREAONLY;\n        ptnProperties->fSourceClientAreaOnly = TRUE;\n    }\n    return DwmUpdateThumbnailProperties(hThumbnailId, ptnProperties);\n}\n\nvoid UpdateWindowAccentProperties_PatchAttribData(WINCOMPATTRDATA* pAttrData);\n\nBOOL WINAPI explorer_SetWindowCompositionAttribute(HWND hWnd, WINCOMPATTRDATA* pData)\n{\n    if (bClassicThemeMitigations)\n    {\n        return TRUE;\n    }\n    if (bOldTaskbar && global_rovi.dwBuildNumber >= 22581 &&\n        (GetClassWord(hWnd, GCW_ATOM) == RegisterWindowMessageW(L\"Shell_TrayWnd\") || \n         GetClassWord(hWnd, GCW_ATOM) == RegisterWindowMessageW(L\"Shell_SecondaryTrayWnd\")) && \n        pData->nAttribute == 19 && pData->pData && pData->ulDataSize == sizeof(ACCENTPOLICY))\n    {\n        UpdateWindowAccentProperties_PatchAttribData(pData);\n    }\n    return SetWindowCompositionAttribute(hWnd, pData);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Revert legacy copy dialog\"\nBOOL(*SHELL32_CanDisplayWin8CopyDialogFunc)();\nBOOL SHELL32_CanDisplayWin8CopyDialogHook()\n{\n    if (bLegacyFileTransferDialog) return FALSE;\n    return SHELL32_CanDisplayWin8CopyDialogFunc();\n}\n#pragma endregion\n\n\n#pragma region \"Windows Spotlight customization\"\n#if WITH_MAIN_PATCHER\n\nHKEY hKeySpotlight1 = NULL;\nHKEY hKeySpotlight2 = NULL;\nBOOL bSpotlightIsDesktopContextMenu = FALSE;\n\nLSTATUS shell32_RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition)\n{\n    if (bDisableSpotlightIcon && hKey == HKEY_CURRENT_USER && !_wcsicmp(lpSubKey, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\"))\n    {\n        LSTATUS lRes = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);\n        if (lRes == ERROR_SUCCESS) hKeySpotlight1 = *phkResult;\n        return lRes;\n    }\n    else if (hKeySpotlight1 && hKey == hKeySpotlight1 && !_wcsicmp(lpSubKey, L\"ShellFolder\"))\n    {\n        LSTATUS lRes = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);\n        if (lRes == ERROR_SUCCESS) hKeySpotlight2 = *phkResult;\n        return lRes;\n    }\n    return RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);\n}\n\nLSTATUS shell32_RegSetValueExW(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE* lpData, DWORD cbData)\n{\n    if (hKeySpotlight1 && hKeySpotlight2 && hKey == hKeySpotlight2 && !_wcsicmp(lpValueName, L\"Attributes\"))\n    {\n        hKeySpotlight1 = NULL;\n        hKeySpotlight2 = NULL;\n        DWORD dwAttributes = *(DWORD*)lpData | SFGAO_NONENUMERATED;\n        SHFlushSFCache();\n        return RegSetValueExW(hKey, lpValueName, Reserved, dwType, &dwAttributes, cbData);\n    }\n    return RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);\n}\n\nBOOL shell32_DeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags)\n{\n    if (uPosition == 0x7053 && IsSpotlightEnabled() && dwSpotlightDesktopMenuMask) bSpotlightIsDesktopContextMenu = TRUE;\n    return DeleteMenu(hMenu, uPosition, uFlags);\n}\n\nBOOL shell32_TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, const RECT* prcRect)\n{\n    if (IsSpotlightEnabled() && dwSpotlightDesktopMenuMask && (GetPropW(GetParent(hWnd), L\"DesktopWindow\") && (RegisterWindowMessageW(L\"WorkerW\") == GetClassWord(GetParent(hWnd), GCW_ATOM) || RegisterWindowMessageW(L\"Progman\") == GetClassWord(GetParent(hWnd), GCW_ATOM))) && bSpotlightIsDesktopContextMenu)\n    {\n        SpotlightHelper(dwSpotlightDesktopMenuMask, hWnd, hMenu, NULL);\n    }\n    bSpotlightIsDesktopContextMenu = FALSE;\n    BOOL bRet = TrackPopupMenuHook(hMenu, uFlags, x, y, nReserved, hWnd, prcRect);\n    if (IsSpotlightEnabled() && dwSpotlightDesktopMenuMask)\n    {\n        MENUITEMINFOW mii;\n        mii.cbSize = sizeof(MENUITEMINFOW);\n        mii.fMask = MIIM_FTYPE | MIIM_DATA;\n        if (GetMenuItemInfoW(hMenu, bRet, FALSE, &mii) && mii.dwItemData >= SPOP_CLICKMENU_FIRST && mii.dwItemData <= SPOP_CLICKMENU_LAST)\n        {\n            SpotlightHelper(mii.dwItemData, hWnd, hMenu, NULL);\n        }\n    }\n    return bRet;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Fix Windows 10 taskbar high DPI button width bug\"\n#if WITH_MAIN_PATCHER\nint patched_GetSystemMetrics(int nIndex)\n{\n    if ((bOldTaskbar && nIndex == SM_CXMINIMIZED) || nIndex == SM_CXICONSPACING || nIndex == SM_CYICONSPACING)\n    {\n        wchar_t wszDim[MAX_PATH + 4];\n        ZeroMemory(wszDim, sizeof(wchar_t) * (MAX_PATH + 4));\n        DWORD dwSize = MAX_PATH;\n        wchar_t* pVal = L\"MinWidth\";\n        if (nIndex == SM_CXICONSPACING) pVal = L\"IconSpacing\";\n        else if (nIndex == SM_CYICONSPACING) pVal = L\"IconVerticalSpacing\";\n        RegGetValueW(HKEY_CURRENT_USER, L\"Control Panel\\\\Desktop\\\\WindowMetrics\", pVal, SRRF_RT_REG_SZ, NULL, wszDim, &dwSize);\n        int dwDim = _wtoi(wszDim);\n        if (dwDim <= 0)\n        {\n            if (nIndex == SM_CXMINIMIZED) return 160;\n            else if (dwDim < 0) return MulDiv(dwDim, GetDpiForSystem(), -1440);\n        }\n    }\n    return GetSystemMetrics(nIndex);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Fix Windows 10 taskbar redraw problem on OS builds 22621+\"\nHWND Windows11v22H2_explorer_CreateWindowExW(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)\n{\n    if ((*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L\"Shell_TrayWnd\")) dwStyle |= WS_CLIPCHILDREN;\n    return CreateWindowExW(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);\n}\n#pragma endregion\n\n\n#pragma region \"Shrink File Explorer address bar height\"\nint explorerframe_GetSystemMetricsForDpi(int nIndex, UINT dpi)\n{\n    if (bShrinkExplorerAddressBar && nIndex == SM_CYFIXEDFRAME) return IsWindows11() ? -3 : -1;\n    return GetSystemMetricsForDpi(nIndex, dpi);\n}\n\nstatic void PatchAddressBarSizing(PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return;\n\n    // <- means inlined\n\n    PBYTE match;\n    DWORD dwOldProtect;\n\n#if defined(_M_X64)\n    // Patch address bar positioning\n    if (IsWindows11())\n    {\n        // CAddressBand::_PositionChildWindows()\n        // 83 45 ?? ?? 83 6D ?? ?? 48\n        //          xx To 03    xx To 01\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\x45\\x00\\x00\\x83\\x6D\\x00\\x00\\x48\",\n            \"xx??xx??x\"\n        );\n        if (match && VirtualProtect(match, 9, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            match[3] = 3;\n            match[7] = 1;\n            VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);\n        }\n\n        // CAddressBand::_AddressBandWndProc() <- CAddressBand::_GetAdjustedClientRect()\n        // 83 45 ?? ?? 83 6D ?? ?? 0F\n        //          xx To 03    xx To 01\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\x45\\x00\\x00\\x83\\x6D\\x00\\x00\\x0F\",\n            \"xx??xx??x\"\n        );\n        if (match)\n        {\n            if (VirtualProtect(match, 9, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                match[3] = 3;\n                match[7] = 1;\n                VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);\n            }\n        }\n        else\n        {\n            // CAddressBand::_GetAdjustedClientRect()\n            // 0F 1F 44 00 00 83 43 04 ?? 83 43 0C ??\n            //                         xx To 03    xx To FF (-1)\n            match = FindPattern(\n                pSearchBegin,\n                cbSearch,\n                \"\\x0F\\x1F\\x44\\x00\\x00\\x83\\x43\\x04\\x00\\x83\\x43\\x0C\",\n                \"xxxxxxxx?xxx\"\n            );\n            if (match && VirtualProtect(match + 5, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                match[8] = 3;\n                match[12] = (BYTE)-1;\n                VirtualProtect(match + 5, 8, dwOldProtect, &dwOldProtect);\n            }\n        }\n    }\n    else\n    {\n        // Contaminated with some remnants of the ReportUsage of \"SearchSuggestions\" feature\n        // CAddressBand::_PositionChildWindows()\n        // 83 45 ?? ?? 48 8D 0D ?? ?? ?? ?? 45 33 C0 B2 01 E8 ?? ?? ?? ?? 83 6D ?? ?? 48\n        //          xx To 03                                                       xx To 01\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\x45\\x00\\x00\\x48\\x8D\\x0D\\x00\\x00\\x00\\x00\\x45\\x33\\xC0\\xB2\\x01\\xE8\\x00\\x00\\x00\\x00\\x83\\x6D\\x00\\x00\\x48\",\n            \"xx??xxx????xxxxxx????xx??x\"\n        );\n        if (match && VirtualProtect(match, 25, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            match[3] = 3;\n            match[24] = 1;\n            VirtualProtect(match, 25, dwOldProtect, &dwOldProtect);\n        }\n\n        // 83 45 ?? ?? 45 33 C0 B2 01 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 83 6D ?? ?? 0F\n        //          xx To 03                                                       xx To 01\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\x45\\x00\\x00\\x45\\x33\\xC0\\xB2\\x01\\x48\\x8D\\x0D\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x83\\x6D\\x00\\x00\\x0F\",\n            \"xx??xxxxxxxx????x????xx??x\"\n        );\n        if (match && VirtualProtect(match, 25, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            match[3] = 3;\n            match[24] = 1;\n            VirtualProtect(match, 25, dwOldProtect, &dwOldProtect);\n        }\n    }\n\n    // Patch address bar height\n    // CAddressBand::GetBandInfo() <- CAddressBand::CalculateBandHeight() <- BandSizing::BandSizingHelper::GetCalculatedBandHeight()\n    // 41 8D 48 AA 48 FF 15 ?? ?? ?? ?? 0F 1F 44 00 ?? 03 F8 // 22621.2506/2715\n    //          xx To 9E\n    /*match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x41\\x8D\\x48\\xAA\\x48\\xFF\\x15\\x00\\x00\\x00\\x00\\x0F\\x1F\\x44\\x00\\x00\\x03\\xF8\",\n        \"xxxxxxx????xxxx?xx\"\n    );\n    if (match && VirtualProtect(match, 7, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n    {\n        match[3] = IsWindows11() ? 0x9E : 0xA0; // -98 : -96 -- -2 on Windows 11, 0 on Windows 10\n        VirtualProtect(match, 7, dwOldProtect, &dwOldProtect);\n    }\n    else\n    {\n        // CAddressBand::GetBandInfo() <- CAddressBand::CalculateBandHeight() <- BandSizing::BandSizingHelper::GetCalculatedBandHeight()\n    }\n\n    // CAddressBand::CalculateBandHeight() <- BandSizing::BandSizingHelper::GetCalculatedBandHeight()\n    // 41 8D 48 AA 48 FF 15 ?? ?? ?? ?? 0F 1F 44 00 ?? 48 8B // 22621.2506/2715\n    //          xx To 9E\n    match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x41\\x8D\\x48\\xAA\\x48\\xFF\\x15\\x00\\x00\\x00\\x00\\x0F\\x1F\\x44\\x00\\x00\\x03\\xF8\",\n        \"xxxxxxx????xxxx?xx\"\n    );\n    if (match && VirtualProtect(match, 7, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n    {\n        match[3] = IsWindows11() ? 0x9E : 0xA0; // -98 : -96 -- -2 on Windows 11, 0 on Windows 10\n        VirtualProtect(match, 7, dwOldProtect, &dwOldProtect);\n    }*/\n\n    // Patch address band height\n    match = NULL;\n    if (!match)\n    {\n        // CAddressBand::GetBandHeight()\n        // 8D 43 ?? 48 8B 4C 24 ?? 48 33 CC E8 // 25951\n        //       xx To 04\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x8D\\x43\\x00\\x48\\x8B\\x4C\\x24\\x00\\x48\\x33\\xCC\\xE8\",\n            \"xx?xxxx?xxxx\"\n        );\n    }\n    if (!match)\n    {\n        // CAddressBand::GetBandInfo() <- CAddressBand::GetBandHeight()\n        // 83 C7 ?? 83 7C 24 ?? ?? 0F 85 // 23560.1000\n        //       xx To 04          ^^^^^ long jnz\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\xC7\\x00\\x83\\x7C\\x24\\x00\\x00\\x0F\\x85\",\n            \"xx?xxx??xx\"\n        );\n    }\n    if (!match)\n    {\n        // CAddressBand::GetBandInfo() <- CAddressBand::GetBandHeight()\n        // 83 C7 10 45 85 ED 4C 8B 6C 24 // 22621.2506/2715\n        // 83 C7 07 45 85 E4 4C 8B A4 24 // 19045.3393\n        // 83 C7 ?? 45 85 ?? 4C 8B ?? 24\n        //       xx To 04\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\xC7\\x00\\x45\\x85\\x00\\x4C\\x8B\\x00\\x24\",\n            \"xx?xx?xx?x\"\n        );\n    }\n    if (!match)\n    {\n        // CAddressBand::GetBandInfo() <- CAddressBand::GetBandHeight()\n        // 83 C7 ?? 83 7C 24 ?? ?? 74 // 22621.1992\n        //       xx To 04          ^^ short jnz\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\xC7\\x00\\x83\\x7C\\x24\\x00\\x00\\x74\",\n            \"xx?xxx??x\"\n        );\n    }\n    if (!match)\n    {\n        // CAddressBand::GetBandInfo() <- CAddressBand::GetBandHeight()\n        // 83 C7 xx 45 33 F6 44 39 74 24 // 22621.317\n        //       xx To 04\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x83\\xC7\\x00\\x45\\x33\\xF6\\x44\\x39\\x74\\x24\",\n            \"xx?xxxxxxx\"\n        );\n    }\n    if (match)\n    {\n        if (VirtualProtect(match, 3, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            match[2] = 4;\n            VirtualProtect(match, 3, dwOldProtect, &dwOldProtect);\n        }\n    }\n\n    /*// Patch search box height\n    // BandSizing::BandSizingHelper::GetCalculatedBandHeight()\n    // 8D 4D AA 44 8B C5 48 FF 15\n    //       xx To 9E\n    match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x8D\\x4D\\xAA\\x44\\x8B\\xC5\\x48\\xFF\\x15\",\n        \"xxxxxxxxx\"\n    );\n    if (match)\n    {\n        if (VirtualProtect(match, 9, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            match[2] = IsWindows11() ? 0x9E : 0xA0; // -98 : -96 -- -2 on Windows 11, 0 on Windows 10\n            VirtualProtect(match, 9, dwOldProtect, &dwOldProtect);\n        }\n    }\n    else\n    {\n        // B9 0A 00 00 00 48 FF 15 // Windows 10 and Windows 11 25951\n        //    xxxxxxxxxxx To 0\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\xB9\\x0A\\x00\\x00\\x00\\x48\\xFF\\x15\",\n            \"xxxxxxxx\"\n        );\n        if (match && VirtualProtect(match, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            *(int*)(match + 1) = IsWindows11() ? -2 : 0;\n            VirtualProtect(match, 8, dwOldProtect, &dwOldProtect);\n        }\n    }*/\n#endif\n\n    if (IsWindows11())\n    {\n        // Windows 11 - Patch Up button size\n        // CUpBand::ScaleAndSetPadding()\n        // Inlined SHLogicalToPhysicalDPI()\n        // 41 B8 60 00 00 00 41 8D 58 B1\n        //                            xx To A8\n#if defined(_M_X64)\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x41\\xB8\\x60\\x00\\x00\\x00\\x41\\x8D\\x58\\xB1\",\n            \"xxxxxxxxxx\"\n        );\n        if (match)\n        {\n            if (VirtualProtect(match, 10, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                match[9] = 0xA8; // -88: 96 - 88 = 8\n                VirtualProtect(match, 10, dwOldProtect, &dwOldProtect);\n            }\n        }\n        else\n        {\n            // Non-inlined SHLogicalToPhysicalDPI()\n            // 48 8B F1 48 8B 49 70 ?? ?? ?? ?? B8 ?? ?? ?? ?? // 23590, 25951\n            //                                     xxxxxxxxxxx To 8\n            match = FindPattern(\n                pSearchBegin,\n                cbSearch,\n                \"\\x48\\x8B\\xF1\\x48\\x8B\\x49\\x70\\x00\\x00\\x00\\x00\\xB8\",\n                \"xxxxxxx????x\"\n            );\n            if (match && VirtualProtect(match, 16, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(int*)(match + 12) = 8;\n                VirtualProtect(match, 16, dwOldProtect, &dwOldProtect);\n            }\n        }\n#endif\n\n        // Windows 11 - Revert feature flag Servicing_CFDNavButtonsTheming's effect on toolbar button size\n        // Nickel: 56845961, Germanium: 52061322\n#if defined(_M_X64)\n        // Feature flag present, Nickel\n        // CAddressBand::_PositionChildWindows() <- CAddressBand::ResizeToolbarButtons()\n        // BA 04 00 00 00 0F 95 C0 84 C0 75 02 8B D6\n        //    xxxxxxxxxxx To 01 00 00 00\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\xBA\\x04\\x00\\x00\\x00\\x0F\\x95\\xC0\\x84\\xC0\\x75\\x02\\x8B\\xD6\",\n            \"xxxxxxxxxxxxxx\"\n        );\n        if (match && VirtualProtect(match, 5, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        {\n            *(int*)(match + 1) = 1;\n            VirtualProtect(match, 5, dwOldProtect, &dwOldProtect);\n        }\n        else\n        {\n            // Feature flag present, Germanium+\n            // CAddressBand::ResizeToolbarButtons()\n            // C7 44 24 ?? 04 00 00 00 84 C0 75 08 C7 44 24 ?? 01 00 00 00\n            //             xxxxxxxxxxx To 01 00 00 00\n            match = FindPattern(\n                pSearchBegin,\n                cbSearch,\n                \"\\xC7\\x44\\x24\\x00\\x04\\x00\\x00\\x00\\x84\\xC0\\x75\\x08\\xC7\\x44\\x24\\x00\\x01\\x00\\x00\\x00\",\n                \"xxx?xxxxxxxxxxx?xxxx\"\n            );\n            if (match && VirtualProtect(match, 8, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(int*)(match + 4) = 1;\n                VirtualProtect(match, 8, dwOldProtect, &dwOldProtect);\n            }\n        }\n        // TODO Revisit once forced-on\n#elif defined(_M_ARM64)\n        // Feature flag present, target register W1 (Nickel)\n        // CAddressBand::ResizeToolbarButtons()\n        // CAddressBand::_PositionChildWindows() <- CAddressBand::ResizeToolbarButtons()\n        // 81 00 80 52 02 00 00 14 21 00 80 52\n        // xxxxxxxxxxx To 21 00 80 52\n        match = FindPattern(\n            pSearchBegin,\n            cbSearch,\n            \"\\x81\\x00\\x80\\x52\\x02\\x00\\x00\\x14\\x21\\x00\\x80\\x52\",\n            \"xxxxxxxxxxxx\"\n        );\n        if (match)\n        {\n            if (VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(DWORD*)(match + 0) = 0x52800021; // MOV W1, #1\n                VirtualProtect(match, 4, dwOldProtect, &dwOldProtect);\n            }\n        }\n        else\n        {\n            // Feature flag present, target register W8 (Germanium+)\n            // CAddressBand::ResizeToolbarButtons()\n            // 88 00 80 52 02 00 00 14 28 00 80 52\n            // xxxxxxxxxxx To 28 00 80 52\n            match = FindPattern(\n                pSearchBegin,\n                cbSearch,\n                \"\\x88\\x00\\x80\\x52\\x02\\x00\\x00\\x14\\x28\\x00\\x80\\x52\",\n                \"xxxxxxxxxxxx\"\n            );\n            if (match && VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n            {\n                *(DWORD*)(match + 0) = 0x52800028; // MOV W8, #1\n                VirtualProtect(match, 4, dwOldProtect, &dwOldProtect);\n            }\n        }\n        // TODO Revisit once forced-on\n#endif\n    }\n}\n#pragma endregion\n\n\n#pragma region \"Fix taskbar cascade and tile windows options not working\"\nWORD explorer_TileWindows(\n    HWND hwndParent,\n    UINT wHow,\n    const RECT* lpRect,\n    UINT cKids,\n    const HWND* lpKids\n)\n{\n    return TileWindows((hwndParent == GetShellWindow()) ? GetDesktopWindow() : hwndParent, wHow, lpRect, cKids, lpKids);\n}\n\nWORD explorer_CascadeWindows(\n    HWND hwndParent,\n    UINT wHow,\n    const RECT* lpRect,\n    UINT cKids,\n    const HWND* lpKids\n)\n{\n    return CascadeWindows((hwndParent == GetShellWindow()) ? GetDesktopWindow() : hwndParent, wHow, lpRect, cKids, lpKids);\n}\n#pragma endregion\n\n\n#pragma region \"Fix explorer crashing on Windows builds lower than 25158\"\nHWND(*NtUserFindWindowEx)(HWND hWndParent, HWND hWndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow, DWORD dwType);\nHWND user32_NtUserFindWindowExHook(HWND hWndParent, HWND hWndChildAfter, LPCWSTR lpszClass, LPCWSTR lpszWindow, DWORD dwType) {\n    if (!NtUserFindWindowEx) NtUserFindWindowEx = GetProcAddress(GetModuleHandleW(L\"win32u.dll\"), \"NtUserFindWindowEx\");\n    HWND hWnd = NULL;\n    for (int i = 0; i < 5; ++i) {\n        if (hWnd) break;\n        hWnd = NtUserFindWindowEx(hWndParent, hWndChildAfter, lpszClass, lpszWindow, dwType);\n    }\n    return hWnd;\n}\n#pragma endregion\n\n\n#pragma region \"Infrastructure for reporting which OS features are enabled\"\n#pragma pack(push, 1)\nstruct RTL_FEATURE_CONFIGURATION {\n    unsigned int featureId;\n    unsigned __int32 group : 4;\n    unsigned __int32 enabledState : 2;\n    unsigned __int32 enabledStateOptions : 1;\n    unsigned __int32 unused1 : 1;\n    unsigned __int32 variant : 6;\n    unsigned __int32 variantPayloadKind : 2;\n    unsigned __int32 unused2 : 16;\n    unsigned int payload;\n};\n#pragma pack(pop)\n\nint (*RtlQueryFeatureConfigurationFunc)(UINT32 featureId, int sectionType, INT64* changeStamp, struct RTL_FEATURE_CONFIGURATION* buffer);\nint RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* changeStamp, struct RTL_FEATURE_CONFIGURATION* buffer) {\n    int rv = RtlQueryFeatureConfigurationFunc(featureId, sectionType, changeStamp, buffer);\n    switch (featureId)\n    {\n#if !USE_MOMENT_3_FIXES_ON_MOMENT_2\n        case 26008830: // STTest\n        {\n            if (bOldTaskbar == 1)\n            {\n                // Disable tablet optimized taskbar feature when using the Windows 10 taskbar\n                //\n                // For now, this fixes Task View and Win-Tab, Alt-Tab breaking after pressing Win-Tab,\n                // flyouts alignment, notification center alignment, Windows key shortcuts on\n                // OS builds 22621.1413+\n                //\n                // Removed in 22621.2134+\n                //\n                buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;\n            }\n            break;\n        }\n#endif\n        case 37634385: // TIFE \"Tabs in File Explorer\"\n        {\n            if (dwFileExplorerCommandUI == 3) // Windows 11 Command Bar (no Tabs, classic Address Bar) <-- provides option to disable tabs in File Explorer\n            {\n                // Removed in 23575.1000+\n                // Crashing on 22635.2915\n                if ((global_rovi.dwBuildNumber >= 22621 && global_rovi.dwBuildNumber <= 22635) && global_ubr >= 2915)\n                    break;\n                buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;\n            }\n            break;\n        }\n        case 40950262: // FEMNB \"File Explorer Modern Navigation Bar\"\n        {\n            if (dwFileExplorerCommandUI == 3     // Windows 11 Command Bar (no Tabs, classic Address Bar)\n                || dwFileExplorerCommandUI == 4) // Windows 11 Command Bar (classic Address Bar)\n            {\n                // Option to disable the new navigation bar\n                // Crashing on 22635.2915\n                if ((global_rovi.dwBuildNumber >= 22621 && global_rovi.dwBuildNumber <= 22635) && global_ubr >= 2915)\n                    break;\n                buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;\n            }\n            break;\n        }\n#if 0\n        case 42537950: // DisableWin10Taskbar\n        {\n            if (bOldTaskbar)\n            {\n                // Sorry Microsoft, but we need more time. Peace ✌️\n                buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;\n            }\n            break;\n        }\n#endif\n        case 44656322: // ID44656322\n        {\n            if (bOldTaskbar)\n            {\n                // This feature flag when enabled makes the flyouts disregard the left and right offsets, so that they\n                // appear over the Copilot sidebar instead of beside it. Disabling this fixes start menu positioning\n                // when the taskbar is at the left or right side, but it will make that behavior occur again.\n                buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;\n            }\n            break;\n        }\n    }\n    return rv;\n}\n#pragma endregion\n\n\nDWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)\n{\n    //Sleep(150);\n\n    HMODULE hShlwapi = LoadLibraryExW(L\"Shlwapi.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hShlwapi)\n    {\n        if (bInstall)\n        {\n            SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hShlwapi, \"SHRegGetValueFromHKCUHKLM\");\n        }\n        else\n        {\n            FreeLibrary(hShlwapi);\n            FreeLibrary(hShlwapi);\n        }\n    }\n\n    HANDLE hShell32 = LoadLibraryExW(L\"shell32.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hShell32)\n    {\n        if (bInstall)\n        {\n#if WITH_MAIN_PATCHER\n            if (DoesOSBuildSupportSpotlight())\n            {\n                VnPatchIAT(hShell32, \"user32.dll\", \"TrackPopupMenu\", shell32_TrackPopupMenu);\n            }\n            else\n#endif\n            {\n                VnPatchIAT(hShell32, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenuHook);\n            }\n            if (bIsExplorerProcess)\n            {\n                HOOK_IMMERSIVE_MENUS(Shell32);\n                VnPatchDelayIAT(hShell32, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", shell32_CoCreateInstanceHook);\n            }\n            VnPatchIAT(hShell32, \"user32.dll\", \"SystemParametersInfoW\", DisableImmersiveMenus_SystemParametersInfoW);\n            if (!bIsExplorer)\n            {\n                CreateWindowExWFunc = CreateWindowExW;\n                VnPatchIAT(hShell32, \"user32.dll\", \"CreateWindowExW\", CreateWindowExWHook);\n                SetWindowLongPtrWFunc = SetWindowLongPtrW;\n                VnPatchIAT(hShell32, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrWHook);\n            }\n        }\n        else\n        {\n            VnPatchIAT(hShell32, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenu);\n            VnPatchIAT(hShell32, \"user32.dll\", \"SystemParametersInfoW\", SystemParametersInfoW);\n            if (!bIsExplorer)\n            {\n                VnPatchIAT(hShell32, \"user32.dll\", \"CreateWindowExW\", CreateWindowExW);\n                VnPatchIAT(hShell32, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrW);\n            }\n            FreeLibrary(hShell32);\n            FreeLibrary(hShell32);\n        }\n    }\n\n    HANDLE hShcore = LoadLibraryExW(L\"shcore.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hShcore)\n    {\n        if (bInstall)\n        {\n            explorerframe_SHCreateWorkerWindowFunc = GetProcAddress(hShcore, (LPCSTR)188);\n        }\n        else\n        {\n            FreeLibrary(hShcore);\n            FreeLibrary(hShcore);\n        }\n    }\n\n    HANDLE hExplorerFrame = LoadLibraryExW(L\"ExplorerFrame.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hExplorerFrame)\n    {\n        if (bInstall)\n        {\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenuHook);\n            if (bIsExplorerProcess)\n            {\n                HOOK_IMMERSIVE_MENUS(ExplorerFrame);\n            }\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"SystemParametersInfoW\", DisableImmersiveMenus_SystemParametersInfoW);\n            VnPatchIAT(hExplorerFrame, \"shcore.dll\", (LPCSTR)188, explorerframe_SHCreateWorkerWindowHook);  // <<<SAB>>>\n            if (!bIsExplorer)\n            {\n                CreateWindowExWFunc = CreateWindowExW;\n                VnPatchIAT(hExplorerFrame, \"user32.dll\", \"CreateWindowExW\", CreateWindowExWHook);\n                SetWindowLongPtrWFunc = SetWindowLongPtrW;\n                VnPatchIAT(hExplorerFrame, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrWHook);\n            }\n            VnPatchIAT(hExplorerFrame, \"API-MS-WIN-CORE-STRING-L1-1-0.DLL\", \"CompareStringOrdinal\", ExplorerFrame_CompareStringOrdinal);\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"LoadAcceleratorsW\", ExplorerFrame_LoadAcceleratorsW);\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"GetSystemMetricsForDpi\", explorerframe_GetSystemMetricsForDpi);\n#if WITH_MAIN_PATCHER\n            PBYTE pExplorerFrameText;\n            DWORD cbExplorerFrameText;\n            if (TextSectionBeginAndSize(hExplorerFrame, &pExplorerFrameText, &cbExplorerFrameText))\n            {\n                if (bShrinkExplorerAddressBar)\n                {\n                    if ((global_rovi.dwBuildNumber >= 19041 && global_rovi.dwBuildNumber <= 19045 && global_ubr < 3754) || IsWindows11())\n                    {\n                        PatchAddressBarSizing(pExplorerFrameText, cbExplorerFrameText);\n                    }\n                }\n                if ((dwFileExplorerCommandUI == 1 || dwFileExplorerCommandUI == 2)\n                    && ((global_rovi.dwBuildNumber >= 22621 && global_rovi.dwBuildNumber <= 22635 && global_ubr >= 160)\n                        || global_rovi.dwBuildNumber >= 25136))\n                {\n                    FixTIFEBreakagesForLegacyControlInterfaces(pExplorerFrameText, cbExplorerFrameText);\n                }\n            }\n#endif\n            VnPatchIAT(hExplorerFrame, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", ExplorerFrame_CoCreateInstanceHook);\n        }\n        else\n        {\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenu);\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"SystemParametersInfoW\", SystemParametersInfoW);\n            VnPatchIAT(hExplorerFrame, \"shcore.dll\", (LPCSTR)188, explorerframe_SHCreateWorkerWindowFunc);\n            if (!bIsExplorer)\n            {\n                VnPatchIAT(hExplorerFrame, \"user32.dll\", \"CreateWindowExW\", CreateWindowExW);\n                VnPatchIAT(hExplorerFrame, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrW);\n            }\n            VnPatchIAT(hExplorerFrame, \"API-MS-WIN-CORE-STRING-L1-1-0.DLL\", \"CompareStringOrdinal\", CompareStringOrdinal);\n            VnPatchIAT(hExplorerFrame, \"user32.dll\", \"GetSystemMetricsForDpi\", GetSystemMetricsForDpi);\n            VnPatchIAT(hExplorerFrame, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", CoCreateInstance);\n            FreeLibrary(hExplorerFrame);\n            FreeLibrary(hExplorerFrame);\n        }\n    }\n\n    HANDLE hWindowsUIFileExplorer = LoadLibraryW(L\"Windows.UI.FileExplorer.dll\");\n    if (hWindowsUIFileExplorer)\n    {\n        if (bInstall)\n        {\n            VnPatchDelayIAT(hWindowsUIFileExplorer, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenuHook);\n            VnPatchDelayIAT(hWindowsUIFileExplorer, \"user32.dll\", \"SystemParametersInfoW\", DisableImmersiveMenus_SystemParametersInfoW);\n            if (!bIsExplorer)\n            {\n                CreateWindowExWFunc = CreateWindowExW;\n                VnPatchIAT(hWindowsUIFileExplorer, \"user32.dll\", \"CreateWindowExW\", CreateWindowExWHook);\n                SetWindowLongPtrWFunc = SetWindowLongPtrW;\n                VnPatchIAT(hWindowsUIFileExplorer, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrWHook);\n            }\n        }\n        else\n        {\n            VnPatchDelayIAT(hWindowsUIFileExplorer, \"user32.dll\", \"TrackPopupMenu\", TrackPopupMenu);\n            VnPatchDelayIAT(hWindowsUIFileExplorer, \"user32.dll\", \"SystemParametersInfoW\", SystemParametersInfoW);\n            if (!bIsExplorer)\n            {\n                VnPatchIAT(hWindowsUIFileExplorer, \"user32.dll\", \"CreateWindowExW\", CreateWindowExW);\n                VnPatchIAT(hWindowsUIFileExplorer, \"user32.dll\", \"SetWindowLongPtrW\", SetWindowLongPtrW);\n            }\n            FreeLibrary(hWindowsUIFileExplorer);\n            FreeLibrary(hWindowsUIFileExplorer);\n        }\n    }\n\n    if (bInstall)\n    {\n        DWORD dwSize = sizeof(DWORD);\n        RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"Start_ShowClassicMode\", RRF_RT_DWORD, NULL, &dwStartShowClassicMode, &dwSize);\n        if (!DoesWindows10StartMenuExist())\n        {\n            dwStartShowClassicMode = 0;\n        }\n    }\n\n#if WITH_MAIN_PATCHER\n    // As of writing, this function is never invoked with bInstall=TRUE, so we don't handle the case if it's false for now\n    if (bIsExplorerProcess)\n    {\n        RtlQueryFeatureConfigurationFunc = GetProcAddress(GetModuleHandleW(L\"ntdll.dll\"), \"RtlQueryFeatureConfiguration\");\n        int rv = -1;\n        if (RtlQueryFeatureConfigurationFunc)\n        {\n            rv = funchook_prepare(\n                funchook,\n                (void**)&RtlQueryFeatureConfigurationFunc,\n                RtlQueryFeatureConfigurationHook\n            );\n        }\n        if (rv != 0)\n        {\n            printf(\"Failed to hook RtlQueryFeatureConfiguration(). rv = %d\\n\", rv);\n        }\n\n        if (!bIsExplorer && IsXamlSoundsEnabled())\n        {\n            HANDLE hCombase = LoadLibraryExW(L\"combase.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n            VnPatchIAT(hCombase, \"api-ms-win-core-libraryloader-l1-2-0.dll\", \"LoadLibraryExW\", combase_LoadLibraryExW);\n        }\n    }\n#endif\n\n    return 0;\n}\n\n\n#pragma region \"Enable EP weather on Windows Server SKUs\"\n#if WITH_MAIN_PATCHER\nBOOL PeopleBand_IsOS(DWORD dwOS)\n{\n    if (dwOS == OS_ANYSERVER) return FALSE;\n    return IsOS(dwOS);\n}\n\nBOOL explorer_IsOS(DWORD dwOS)\n{\n    if (dwOS == OS_ANYSERVER)\n    {\n        unsigned char buf[16];\n        memcpy(buf, (uintptr_t)_ReturnAddress() - 16, 16);\n        // check if call is made from explorer!PeopleBarPolicy::IsPeopleBarDisabled\n        if (buf[0] == 0x48 && buf[1] == 0x83 && buf[2] == 0xec && buf[3] == 0x28 && buf[4] == 0xb9 &&\n            buf[5] == 0x1d && buf[6] == 0x00 && buf[7] == 0x00 && buf[8] == 0x00) // sub rsp, 28h; mov ecx, 1dh\n        {\n            buf[0] = 0x48; buf[1] = 0x31; buf[2] = 0xc0; buf[3] = 0xc3; // xor rax, rax; ret\n            DWORD flOldProtect = 0;\n            if (VirtualProtect((uintptr_t)_ReturnAddress() - 16, 4, PAGE_EXECUTE_READWRITE, &flOldProtect))\n            {\n                memcpy((uintptr_t)_ReturnAddress() - 16, buf, 4);\n                VirtualProtect((uintptr_t)_ReturnAddress() - 16, 4, flOldProtect, &flOldProtect);\n                VnPatchIAT(GetModuleHandleW(NULL), \"api-ms-win-shcore-sysinfo-l1-1-0.dll\", \"IsOS\", IsOS);\n                return FALSE;\n            }\n        }\n    }\n    return IsOS(dwOS);\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Find offsets of needed functions when symbols are not available\"\n#if WITH_MAIN_PATCHER\nvoid TryToFindExplorerOffsets(HANDLE hExplorer, PBYTE pSearchBegin, size_t cbSearch, DWORD* pOffsets)\n{\n    if (!pSearchBegin || !cbSearch)\n        return;\n\n    if (!pOffsets[0] || pOffsets[0] == 0xFFFFFFFF)\n    {\n        // ImmersiveTray::AttachWindowToTray()\n#if defined(_M_X64)\n        // 48 8B 93 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 4B\n        //                                              ^^^^^^^^^^^\n        // Ref: CTaskListThumbnailWnd::SetSite()\n        PBYTE match = FindPattern(\n            pSearchBegin, cbSearch,\n            \"\\x48\\x8B\\x93\\x00\\x00\\x00\\x00\\x48\\x8B\\x8B\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\x4B\",\n            \"xxx????xxx????x????xxx\"\n        );\n        if (match)\n        {\n            match += 14;\n            pOffsets[0] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n            printf(\"explorer.exe!ImmersiveTray::AttachWindowToTray() = %lX\\n\", pOffsets[0]);\n        }\n#endif\n    }\n\n    if (!pOffsets[1] || pOffsets[1] == 0xFFFFFFFF)\n    {\n        // ImmersiveTray::RaiseWindow()\n#if defined(_M_X64)\n        // 41 B9 02 00 00 00 48 8B 8B ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0\n        //                                           ^^^^^^^^^^^\n        // Ref: CTaskListThumbnailWnd::_RaiseWindowForLivePreviewIfNeeded()\n        PBYTE match = FindPattern(\n            pSearchBegin, cbSearch,\n            \"\\x41\\xB9\\x02\\x00\\x00\\x00\\x48\\x8B\\x8B\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\",\n            \"xxxxxxxxx????x????xx\"\n        );\n        if (match)\n        {\n            match += 13;\n            pOffsets[1] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n            printf(\"explorer.exe!ImmersiveTray::RaiseWindow() = %lX\\n\", pOffsets[1]);\n        }\n#endif\n    }\n\n    if (!pOffsets[2] || pOffsets[2] == 0xFFFFFFFF)\n    {\n        // CTaskBand_CreateInstance()\n#if defined(_M_X64)\n        // Pre-24H2 (output variable uninitialized)\n        // Tested: 19041.3758, 22000.51, 22621.1992\n        // 48 8B F1 4C 8D 44 24 ?? 48 8B 49 ?? 33 D2 E8 ?? ?? ?? ??\n        //                                              ^^^^^^^^^^^\n        // Ref: CTrayBandSite::_AddRequiredBands()\n        PBYTE match = FindPattern(\n            pSearchBegin, cbSearch,\n            \"\\x48\\x8B\\xF1\\x4C\\x8D\\x44\\x24\\x00\\x48\\x8B\\x49\\x00\\x33\\xD2\\xE8\",\n            \"xxxxxxx?xxx?xxx\"\n        );\n        if (match)\n        {\n            match += 14;\n            pOffsets[2] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n        }\n        else\n        {\n            // 24H2 (output variable initialized to 0)\n            // Tested: 25951, 26080\n            // 4C 8D 40 ?? 48 8B F1 33 D2 48 8B 49 ?? E8 ?? ?? ?? ??\n            //                                           ^^^^^^^^^^^\n            // Ref: CTrayBandSite::_AddRequiredBands()\n            match = FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x4C\\x8D\\x40\\x00\\x48\\x8B\\xF1\\x33\\xD2\\x48\\x8B\\x49\\x00\\xE8\",\n                \"xxx?xxxxxxxx?x\"\n            );\n            if (match)\n            {\n                match += 13;\n                pOffsets[2] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n            }\n        }\n        if (match)\n        {\n            printf(\"explorer.exe!CTaskBand_CreateInstance() = %lX\\n\", pOffsets[2]);\n        }\n#endif\n    }\n\n    if (!pOffsets[3] || pOffsets[3] == 0xFFFFFFFF)\n    {\n        // HandleFirstTimeLegacy()\n#if defined(_M_X64)\n        // Short Jump\n        // Tested: 19045.3758, 22000.51, 25951, 26080\n        // 4D 85 ?? 74 ?? 49 83 ?? 01 75 ??             E8 ?? ?? ?? ??\n        //                                                 ^^^^^^^^^^^\n        // Ref: TrayUI::WndProc()\n        PBYTE match = FindPattern(\n            pSearchBegin, cbSearch,\n            \"\\x4D\\x85\\x00\\x74\\x00\\x49\\x83\\x00\\x01\\x75\\x00\\xE8\",\n            \"xx?x?xx?xx?x\"\n        );\n        if (match)\n        {\n            match += 11;\n            pOffsets[3] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n        }\n        else\n        {\n            // Long Jump\n            // Tested: 22621.1992\n            // 4D 85 ?? 74 ?? 49 83 ?? 01 0F 85 ?? ?? ?? ?? E8 ?? ?? ?? ??\n            //                                                 ^^^^^^^^^^^\n            match = FindPattern(\n                pSearchBegin, cbSearch,\n                \"\\x4D\\x85\\x00\\x74\\x00\\x49\\x83\\x00\\x01\\x0F\\x85\\x00\\x00\\x00\\x00\\xE8\",\n                \"xx?x?xx?xxx????x\"\n            );\n            if (match)\n            {\n                match += 15;\n                pOffsets[3] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n            }\n        }\n        if (match)\n        {\n            printf(\"explorer.exe!HandleFirstTimeLegacy() = %lX\\n\", pOffsets[3]);\n        }\n#endif\n    }\n\n    if (!pOffsets[4] || pOffsets[4] == 0xFFFFFFFF)\n    {\n#if defined(_M_X64)\n        // SetColorPreferenceForLogonUI()\n        // Ref: TrayUI::_HandleSettingChange()\n        // 48 8B F9 E8 ?? ?? ?? ?? 8B D8 85 C0 78 ?? 48 8B CF E8 ?? ?? ?? ??\n        //                                                       ^^^^^^^^^^^\n        PBYTE match = FindPattern(\n            pSearchBegin, cbSearch,\n            \"\\x48\\x8B\\xF9\\xE8\\x00\\x00\\x00\\x00\\x8B\\xD8\\x85\\xC0\\x78\\x00\\x48\\x8B\\xCF\\xE8\",\n            \"xxxx????xxxxx?xxxx\"\n        );\n        if (match)\n        {\n            match += 17;\n            pOffsets[4] = match + 5 + *(int*)(match + 1) - (PBYTE)hExplorer;\n            printf(\"explorer.exe!SetColorPreferenceForLogonUI() = %lX\\n\", pOffsets[4]);\n        }\n#endif\n    }\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Fix Pin to Start from Explorer not working when using Windows 10 start menu\"\n#if WITH_MAIN_PATCHER\nextern HRESULT AppResolver_StartTileData_RoGetActivationFactory(HSTRING activatableClassId, REFIID iid, void** factory);\n\ntypedef struct CCacheShortcut CCacheShortcut;\nextern HRESULT(*AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc)(void* _this, const CCacheShortcut* a2, const void* a3);\nextern HRESULT AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStart(void* _this, const CCacheShortcut* a2, const void* a3);\n\nstatic void PatchAppResolver()\n{\n    HANDLE hAppResolver = LoadLibraryExW(L\"AppResolver.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n\n    PBYTE pAppResolverText;\n    DWORD cbAppResolverText;\n    if (!TextSectionBeginAndSize(hAppResolver, &pAppResolverText, &cbAppResolverText))\n        return;\n\n    VnPatchDelayIAT(hAppResolver, \"api-ms-win-core-winrt-l1-1-0.dll\", \"RoGetActivationFactory\", AppResolver_StartTileData_RoGetActivationFactory);\n\n    // CAppResolverCacheBuilder::_AddUserPinnedShortcutToStart()\n#if defined(_M_X64)\n    // 8B ? 48 8B D3 E8 ? ? ? ? 48 8B 8D\n    //                  ^^^^^^^\n    // Ref: CAppResolverCacheBuilder::_AddShortcutToCache()\n    PBYTE match = FindPattern(\n        pAppResolverText,\n        cbAppResolverText,\n        \"\\x8B\\x00\\x48\\x8B\\xD3\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\x8D\",\n        \"x?xxxx????xxx\"\n    );\n    if (match)\n    {\n        match += 5;\n        match += 5 + *(int*)(match + 1);\n    }\n#elif defined(_M_ARM64)\n    // 7F 23 03 D5  FD 7B BC A9  F3 53 01 A9  F5 5B 02 A9  F7 1B 00 F9  FD 03 00 91  ?? ?? ?? ??  FF 43 01 D1  F7 03 00 91  30 00 80 92  F0 1A 00 F9  ?? 03 01 AA  ?? 03 02 AA  FF ?? 00 F9\n    // ----------- PACIBSP, don't scan for this because it's everywhere\n    PBYTE match = FindPattern(\n        pAppResolverText,\n        cbAppResolverText,\n        \"\\xFD\\x7B\\xBC\\xA9\\xF3\\x53\\x01\\xA9\\xF5\\x5B\\x02\\xA9\\xF7\\x1B\\x00\\xF9\\xFD\\x03\\x00\\x91\\x00\\x00\\x00\\x00\\xFF\\x43\\x01\\xD1\\xF7\\x03\\x00\\x91\\x30\\x00\\x80\\x92\\xF0\\x1A\\x00\\xF9\\x00\\x03\\x01\\xAA\\x00\\x03\\x02\\xAA\\xFF\\x00\\x00\\xF9\",\n        \"xxxxxxxxxxxxxxxxxxxx????xxxxxxxxxxxxxxxx?xxx?xxxx?xx\"\n    );\n    if (match)\n    {\n        match -= 4;\n    }\n#endif\n    if (match)\n    {\n        AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc = match;\n        printf(\"CAppResolverCacheBuilder::_AddUserPinnedShortcutToStart() = %llX\\n\", match - (PBYTE)hAppResolver);\n    }\n\n    int rv = -1;\n    if (AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc)\n    {\n        rv = funchook_prepare(\n            funchook,\n            (void**)&AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStartFunc,\n            AppResolver_CAppResolverCacheBuilder__AddUserPinnedShortcutToStart\n        );\n    }\n    if (rv != 0)\n    {\n        printf(\"Failed to hook CAppResolverCacheBuilder::_AddUserPinnedShortcutToStart(). rv = %d\\n\", rv);\n    }\n}\n\nextern HRESULT PatchStartTileDataFurther(HMODULE hModule, BOOL bSMEH);\n\nstatic void PatchStartTileData(BOOL bSMEH)\n{\n    HANDLE hStartTileData = LoadLibraryExW(L\"StartTileData.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n\n    VnPatchIAT(hStartTileData, \"api-ms-win-core-winrt-l1-1-0.dll\", \"RoGetActivationFactory\", AppResolver_StartTileData_RoGetActivationFactory);\n\n    if (!bSMEH)\n        return;\n\n    if ((global_rovi.dwBuildNumber >= 22621 && global_rovi.dwBuildNumber <= 22635) && global_ubr >= 3420\n        || global_rovi.dwBuildNumber >= 25169)\n    {\n        PatchStartTileDataFurther(hStartTileData, bSMEH);\n        /*HRESULT hr = CoInitialize(NULL);\n        if (SUCCEEDED(hr))\n        {\n            PatchStartTileDataFurther(hStartTileData, bSMEH);\n        }\n        if (hr == S_OK)\n        {\n            CoUninitialize();\n        }*/\n    }\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Crash counter system\"\n#if WITH_MAIN_PATCHER\ntypedef struct CrashCounterSettings\n{\n    BOOL bDisabled;\n    int counter;\n    int thresholdTime;\n    int threshold;\n} CrashCounterSettings;\n\nvoid GetCrashCounterSettings(CrashCounterSettings* out)\n{\n    out->bDisabled = FALSE;\n    out->counter = 0;\n    out->thresholdTime = 10000;\n    out->threshold = 3;\n\n    DWORD dwTCSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounterDisabled\", RRF_RT_DWORD, NULL, &out->bDisabled, &dwTCSize);\n    if (out->bDisabled != FALSE && out->bDisabled != TRUE) out->bDisabled = FALSE;\n\n    dwTCSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounter\", RRF_RT_DWORD, NULL, &out->counter, &dwTCSize);\n    if (out->counter < 0) out->counter = 0;\n\n    dwTCSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashThresholdTime\", RRF_RT_DWORD, NULL, &out->thresholdTime, &dwTCSize);\n    if (out->thresholdTime < 100 || out->thresholdTime > 60000) out->thresholdTime = 10000;\n\n    dwTCSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounterThreshold\", RRF_RT_DWORD, NULL, &out->threshold, &dwTCSize);\n    if (out->threshold <= 1 || out->threshold >= 10) out->threshold = 3;\n}\n\nBOOL IsCrashCounterEnabled()\n{\n    CrashCounterSettings cfg;\n    GetCrashCounterSettings(&cfg);\n    return !cfg.bDisabled;\n}\n\nHRESULT InformUserAboutCrashCallback(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData)\n{\n    if (msg == TDN_HYPERLINK_CLICKED)\n    {\n        wchar_t* link = (wchar_t*)lParam;\n        if (wcschr(link, L'\\''))\n        {\n            size_t len = wcslen(link);\n            for (size_t i = 0; i < len; ++i)\n            {\n                if (link[i] == L'\\'')\n                    link[i] = L'\"';\n            }\n            STARTUPINFO si;\n            PROCESS_INFORMATION pi;\n            ZeroMemory(&si, sizeof(si));\n            si.cb = sizeof(si);\n            ZeroMemory(&pi, sizeof(pi));\n            if (CreateProcessW(NULL, link, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))\n            {\n                CloseHandle(pi.hProcess);\n                CloseHandle(pi.hThread);\n            }\n            for (size_t i = 0; i < len; ++i)\n            {\n                if (link[i] == L'\"')\n                    link[i] = L'\\'';\n            }\n        }\n        else if (!wcsncmp(link, L\"eplink://update\", 15))\n        {\n            if (!wcsncmp(link, L\"eplink://update/stable\", 22))\n            {\n                DWORD no = 0;\n                RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"UpdatePreferStaging\", REG_DWORD, &no, sizeof(DWORD));\n            }\n            else if (!wcsncmp(link, L\"eplink://update/staging\", 23))\n            {\n                DWORD yes = 1;\n                RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"UpdatePreferStaging\", REG_DWORD, &yes, sizeof(DWORD));\n            }\n            SetLastError(0);\n            HANDLE sigInstallUpdates = CreateEventW(NULL, FALSE, FALSE, L\"EP_Ev_InstallUpdates_\" _T(EP_CLSID));\n            if (sigInstallUpdates && GetLastError() == ERROR_ALREADY_EXISTS)\n            {\n                SetEvent(sigInstallUpdates);\n            }\n            else\n            {\n                CreateThread(NULL, 0, CheckForUpdatesThread, 0, 0, NULL);\n                Sleep(100);\n                SetLastError(0);\n                sigInstallUpdates = CreateEventW(NULL, FALSE, FALSE, L\"EP_Ev_InstallUpdates_\" _T(EP_CLSID));\n                if (sigInstallUpdates && GetLastError() == ERROR_ALREADY_EXISTS)\n                {\n                    SetEvent(sigInstallUpdates);\n                }\n            }\n        }\n        else\n        {\n            ShellExecuteW(NULL, L\"open\", link, L\"\", NULL, SW_SHOWNORMAL);\n        }\n        return S_FALSE;\n    }\n    return S_OK;\n\n}\n\nDWORD InformUserAboutCrash(LPVOID unused)\n{\n    CrashCounterSettings cfg;\n    GetCrashCounterSettings(&cfg);\n\n    EP_L10N_ApplyPreferredLanguageForCurrentThread();\n    HMODULE hEPGui = LoadGuiModule();\n    if (!hEPGui)\n    {\n        return 0; // Can't load the strings, nothing to display\n    }\n\n    wchar_t title[100];\n    LoadStringW(hEPGui, IDS_CRASH_TITLE, title, ARRAYSIZE(title));\n\n    wchar_t times[32];\n    ZeroMemory(times, sizeof(times));\n    if (cfg.threshold == 1)\n    {\n        LoadStringW(hEPGui, IDS_CRASH_ONCE, times, ARRAYSIZE(times));\n    }\n    else\n    {\n        wchar_t format[32];\n        if (LoadStringW(hEPGui, IDS_CRASH_MULTIPLE, format, ARRAYSIZE(format)) != 0)\n        {\n            swprintf_s(times, ARRAYSIZE(times), format, cfg.threshold);\n        }\n    }\n\n    wchar_t uninstallLink[MAX_PATH];\n    ZeroMemory(uninstallLink, sizeof(uninstallLink));\n    uninstallLink[0] = L'\\'';\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, uninstallLink + 1);\n    wcscat_s(uninstallLink, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(SETUP_UTILITY_NAME) L\"' /uninstall\");\n\n    wchar_t bodyFormat[10000];\n    if (LoadStringW(hEPGui, IDS_CRASH_BODY, bodyFormat, ARRAYSIZE(bodyFormat)) == 0)\n    {\n        FreeLibrary(hEPGui);\n        return 0;\n    }\n\n    wchar_t msg[10000];\n    _swprintf_p(msg, ARRAYSIZE(msg), bodyFormat,\n        times, cfg.thresholdTime / 1000,                                // 1 & 2: (once|X times) in less than Y seconds\n        L\"eplink://update\",                                             // 3: [update ExplorerPatcher and restart File Explorer]\n        L\"https://github.com/valinet/ExplorerPatcher/releases\",         // 4: [view releases]\n        L\"https://github.com/valinet/ExplorerPatcher/discussions/1102\", // 5: [check the current status]\n        L\"https://github.com/valinet/ExplorerPatcher/discussions\",      // 6: [discuss]\n        L\"https://github.com/valinet/ExplorerPatcher/issues\",           // 7: [review the latest issues]\n        uninstallLink                                                   // 8: [uninstall ExplorerPatcher]\n    );\n\n    wchar_t dismiss[32];\n    LoadStringW(hEPGui, IDS_CRASH_DISMISS, dismiss, ARRAYSIZE(dismiss));\n\n    TASKDIALOG_BUTTON buttons[1];\n    buttons[0].nButtonID = IDNO;\n    buttons[0].pszButtonText = dismiss;\n\n    TASKDIALOGCONFIG td;\n    ZeroMemory(&td, sizeof(td));\n    td.cbSize = sizeof(TASKDIALOGCONFIG);\n    td.hInstance = hModule;\n    td.hwndParent = NULL;\n    td.dwFlags = TDF_SIZE_TO_CONTENT | TDF_ENABLE_HYPERLINKS;\n    td.pszWindowTitle = L\"ExplorerPatcher\";\n    td.pszMainInstruction = title;\n    td.pszContent = msg;\n    td.cButtons = ARRAYSIZE(buttons);\n    td.pButtons = buttons;\n    td.cRadioButtons = 0;\n    td.pRadioButtons = NULL;\n    td.cxWidth = 0;\n    td.pfCallback = InformUserAboutCrashCallback;\n\n    HMODULE hComCtl32 = NULL;\n    HRESULT(*pfTaskDialogIndirect)(const TASKDIALOGCONFIG*, int*, int*, BOOL*) = NULL;\n    int res = td.nDefaultButton;\n    if (!(hComCtl32 = GetModuleHandleA(\"Comctl32.dll\")) ||\n        !(pfTaskDialogIndirect = GetProcAddress(hComCtl32, \"TaskDialogIndirect\")) ||\n        FAILED(pfTaskDialogIndirect(&td, &res, NULL, NULL)))\n    {\n        wcscat_s(msg, 10000, L\" Would you like to open the ExplorerPatcher status web page on GitHub in your default browser?\");\n        res = MessageBoxW(NULL, msg, L\"ExplorerPatcher\", MB_ICONASTERISK | MB_YESNO);\n    }\n    if (res == IDYES)\n    {\n        ShellExecuteW(NULL, L\"open\", L\"https://github.com/valinet/ExplorerPatcher/discussions/1102\", L\"\", NULL, SW_SHOWNORMAL);\n    }\n    FreeLibrary(hEPGui);\n    return 0;\n}\n\nDWORD WINAPI ClearCrashCounter(INT64 timeout)\n{\n    Sleep(timeout);\n    DWORD zero = 0;\n    RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounter\", REG_DWORD, &zero, sizeof(DWORD));\n    return 0;\n}\n\nBOOL CrashCounterHandleEntryPoint()\n{\n    CrashCounterSettings cfg;\n    GetCrashCounterSettings(&cfg);\n    if (!cfg.bDisabled)\n    {\n        // Ctrl + Shift + Alt\n        BOOL bKeyCombinationTriggered = GetAsyncKeyState(VK_CONTROL) & 0x8000 && GetAsyncKeyState(VK_SHIFT) & 0x8000 && GetAsyncKeyState(VK_MENU) & 0x8000;\n        if (cfg.counter >= cfg.threshold || bKeyCombinationTriggered)\n        {\n            cfg.counter = 0;\n            RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounter\", REG_DWORD, &cfg.counter, sizeof(DWORD));\n            SHCreateThread(InformUserAboutCrash, NULL, 0, NULL);\n            return TRUE;\n        }\n        cfg.counter++;\n        RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"CrashCounter\", REG_DWORD, &cfg.counter, sizeof(DWORD));\n        SHCreateThread(ClearCrashCounter, cfg.thresholdTime, 0, NULL);\n    }\n    return FALSE;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Loader for alternate taskbar implementation\"\n#if WITH_MAIN_PATCHER\nBOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS)\n{\n    BOOL bAllValid = TRUE;\n    /*for (SIZE_T j = 0; j < ARRAYSIZE(symbols_PTRS->explorer_PTRS) - 1; ++j)\n    {\n        DWORD i = symbols_PTRS->explorer_PTRS[j];\n        bAllValid &= i && i != 0xFFFFFFFF;\n        if (!bAllValid)\n            break;\n    }*/\n    return bAllValid;\n}\n\nconst WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)\n{\n    const WCHAR* pszTaskbarDll = PickTaskbarDll();\n    if (!pszTaskbarDll)\n    {\n        wprintf(L\"[TB] Unsupported build\\n\");\n        return NULL;\n    }\n    if (!CheckExplorerSymbols(symbols_PTRS))\n    {\n        wprintf(L\"[TB] Missing offsets\\n\");\n        return NULL;\n    }\n    return pszTaskbarDll;\n}\n\n// Behavior based on selected Taskbar style:\n// - Windows 11: Load our taskbar DLL with LOAD_LIBRARY_AS_DATAFILE for the old context menu\n// - Windows 10: Skip loading\n// - Windows 10 (ExplorerPatcher): Load it fully\ntypedef enum _EP_TASKBAR_FEATURES\n{\n    EPTF_None,\n    EPTF_Taskbar = 0x1,\n    EPTF_ClassicContextMenu = 0x2,\n    EPTF_WinBlueLauncher = 0x4,\n    EPTF_AudioFlyout = 0x8,\n\n    EPTF_FullLoad =\n        EPTF_Taskbar\n      | EPTF_WinBlueLauncher\n      | EPTF_AudioFlyout\n} EP_TASKBAR_FEATURES;\n\nEP_TASKBAR_FEATURES GetEPTaskbarFeatures()\n{\n    EP_TASKBAR_FEATURES eptf = EPTF_None;\n\n    if (IsWindows11() && bOldTaskbar == 0)\n    {\n        eptf |= EPTF_ClassicContextMenu;\n    }\n    if (bOldTaskbar >= 2)\n    {\n        eptf |= EPTF_Taskbar;\n    }\n\n    BOOL fValue = FALSE;\n    if (SUCCEEDED(SHRegGetBOOLWithREGSAM(HKEY_CURRENT_USER, L\"Software\\\\ExplorerPatcher\", L\"UseImmersiveLauncher\", 0, &fValue)) && fValue)\n    {\n        eptf |= EPTF_WinBlueLauncher;\n    }\n\n    DWORD dwValue = 0;\n    if (SUCCEEDED(SHRegGetDWORD(HKEY_CURRENT_USER, L\"Software\\\\ExplorerPatcher\", L\"AudioFlyoutStyle\", &dwValue)) && dwValue == 1)\n    {\n        eptf |= EPTF_AudioFlyout;\n    }\n\n    return eptf;\n}\n\nHMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll)\n{\n    if (!symbols_PTRS || !pszTaskbarDll)\n    {\n        return NULL;\n    }\n\n    EP_TASKBAR_FEATURES eptf = GetEPTaskbarFeatures();\n    if (eptf == EPTF_None)\n    {\n        return NULL;\n    }\n\n    wchar_t szPath[MAX_PATH];\n    ZeroMemory(szPath, sizeof(szPath));\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, szPath);\n    wcscat_s(szPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\");\n    wcscat_s(szPath, MAX_PATH, pszTaskbarDll);\n    BOOL bFullLoad = (eptf & EPTF_FullLoad) != 0;\n    HMODULE hMyTaskbar = bFullLoad ? LoadLibraryW(szPath) : LoadLibraryExW(szPath, NULL, LOAD_LIBRARY_AS_DATAFILE);\n    if (!hMyTaskbar)\n    {\n        wprintf(L\"[TB] '%s' not found\\n\", pszTaskbarDll);\n        return NULL;\n    }\n    g_hMyTaskbar = hMyTaskbar;\n\n    if (!bFullLoad)\n    {\n        return NULL; // Prevent IAT hooks from being carried out\n    }\n\n    typedef DWORD (*GetVersion_t)();\n    GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, \"GetVersion\");\n    DWORD version = GetVersion ? GetVersion() : 0;\n    if (version != 2)\n    {\n        wprintf(L\"[TB] '%s' with version %d is not compatible\\n\", pszTaskbarDll, version);\n        FreeLibrary(hMyTaskbar);\n        return NULL;\n    }\n\n    if ((eptf & EPTF_Taskbar) != 0)\n    {\n        TrayUI_CreateInstance_t pfnMyTrayUICreateInstance = (TrayUI_CreateInstance_t)GetProcAddress(hMyTaskbar, \"EP_TrayUI_CreateInstance\");\n        if (pfnMyTrayUICreateInstance)\n        {\n            if (IsWindows11())\n            {\n                explorer_TrayUI_CreateInstanceFunc = pfnMyTrayUICreateInstance;\n            }\n            else if (explorer_TrayUI_CreateInstanceFunc)\n            {\n                funchook_prepare(\n                    funchook,\n                    (void**)&explorer_TrayUI_CreateInstanceFunc,\n                    pfnMyTrayUICreateInstance\n                );\n            }\n            else\n            {\n                printf(\"[TB] Failed to hook TrayUI_CreateInstance()\\n\");\n                FreeLibrary(hMyTaskbar);\n                return NULL;\n            }\n        }\n    }\n\n    if ((eptf & EPTF_WinBlueLauncher) != 0)\n    {\n        typedef HRESULT (WINAPI *EP_Launcher_PatchTwinUIPCShell_t)();\n        EP_Launcher_PatchTwinUIPCShell_t pfnEP_Launcher_PatchTwinUIPCShell = (EP_Launcher_PatchTwinUIPCShell_t)GetProcAddress(hMyTaskbar, \"EP_Launcher_PatchTwinUIPCShell\");\n        if (pfnEP_Launcher_PatchTwinUIPCShell)\n        {\n            HRESULT hr = pfnEP_Launcher_PatchTwinUIPCShell();\n            if (FAILED(hr))\n            {\n                printf(\"[TB] EP_Launcher_PatchTwinUIPCShell failed\\n\");\n            }\n        }\n    }\n\n    if ((eptf & EPTF_AudioFlyout) != 0)\n    {\n        typedef HRESULT (WINAPI *EP_AudioFlyout_PatchTwinUI_t)();\n        EP_AudioFlyout_PatchTwinUI_t pfnEP_AudioFlyout_PatchTwinUI = (EP_AudioFlyout_PatchTwinUI_t)GetProcAddress(hMyTaskbar, \"EP_AudioFlyout_PatchTwinUI\");\n        if (pfnEP_AudioFlyout_PatchTwinUI)\n        {\n            HRESULT hr = pfnEP_AudioFlyout_PatchTwinUI();\n            if (FAILED(hr))\n            {\n                printf(\"[TB] EP_AudioFlyout_PatchTwinUI failed\\n\");\n            }\n        }\n    }\n\n    typedef void (*CopyExplorerSymbols_t)(symbols_addr* symbols);\n    CopyExplorerSymbols_t CopyExplorerSymbols = (CopyExplorerSymbols_t)GetProcAddress(hMyTaskbar, \"CopyExplorerSymbols\");\n    if (CopyExplorerSymbols)\n    {\n        CopyExplorerSymbols(symbols_PTRS);\n    }\n\n    typedef void (*SetImmersiveMenuFunctions_t)(void* a, void* b, void* c);\n    SetImmersiveMenuFunctions_t SetImmersiveMenuFunctions = (SetImmersiveMenuFunctions_t)GetProcAddress(hMyTaskbar, \"SetImmersiveMenuFunctions\");\n    if (SetImmersiveMenuFunctions)\n    {\n        SetImmersiveMenuFunctions(\n            CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc,\n            ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc,\n            ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc\n        );\n    }\n\n    wprintf(L\"[TB] Using '%s'\\n\", pszTaskbarDll);\n    return hMyTaskbar;\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Restore network icon on builds without pnidui.dll shipped\"\n#if WITH_MAIN_PATCHER\ntypedef struct SSOEntry\n{\n    GUID* pguid;\n    int sharedThread;\n    DWORD dwFlags;\n    bool (*pfnCheckEnabled)();\n} SSOEntry;\n\nvoid PatchStobject(HANDLE hStobject)\n{\n    if (!hStobject)\n        return;\n\n    PBYTE beginRData = NULL;\n    DWORD sizeRData = 0;\n\n    // Our target is in .rdata\n    PIMAGE_DOS_HEADER dosHeader = hStobject;\n    if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n    {\n        PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)((u_char*)dosHeader + dosHeader->e_lfanew);\n        if (ntHeader->Signature == IMAGE_NT_SIGNATURE)\n        {\n            for (unsigned int i = 0; i < ntHeader->FileHeader.NumberOfSections; ++i)\n            {\n                PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(ntHeader) + i;\n                if (!strncmp(section->Name, \".rdata\", 6))\n                {\n                    beginRData = (PBYTE)dosHeader + section->VirtualAddress;\n                    sizeRData = section->SizeOfRawData;\n                    break;\n                }\n            }\n        }\n    }\n    if (!beginRData || !sizeRData)\n    {\n        return;\n    }\n\n    // We'll sacrifice the Windows To Go SSO for this\n    GUID* pguidTarget = memmem(beginRData, sizeRData, &CLSID_WindowsToGoSSO, sizeof(GUID));\n    if (!pguidTarget)\n    {\n        return;\n    }\n    printf(\"[SSO] pguidTarget = %llX\\n\", (PBYTE)pguidTarget - (PBYTE)hStobject);\n\n    // Find where it's used\n    SSOEntry* pssoEntryTarget = NULL;\n    SIZE_T searchSize = (SIZE_T)sizeRData - sizeof(SSOEntry);\n    for (SIZE_T i = 0; i < searchSize; i += 8) // We know the struct is aligned, save some iterations\n    {\n        SSOEntry* current = (SSOEntry*)(beginRData + i);\n        if (current->pguid == pguidTarget && current->sharedThread == 0 && current->dwFlags == 0 && current->pfnCheckEnabled)\n        {\n            pssoEntryTarget = current;\n            break;\n        }\n    }\n    if (!pssoEntryTarget)\n    {\n        return;\n    }\n    printf(\"[SSO] pssoEntryTarget = %llX\\n\", (PBYTE)pssoEntryTarget - (PBYTE)hStobject);\n\n    // Make sure it's really not used\n    if (pssoEntryTarget->pfnCheckEnabled && pssoEntryTarget->pfnCheckEnabled())\n    {\n        return;\n    }\n\n    // Modify the GUID\n    DWORD dwOldProtect = 0;\n    if (VirtualProtect(pguidTarget, sizeof(GUID), PAGE_EXECUTE_READWRITE, &dwOldProtect))\n    {\n        *pguidTarget = CLSID_NetworkTraySSO;\n        VirtualProtect(pguidTarget, sizeof(GUID), dwOldProtect, &dwOldProtect);\n    }\n\n    // Modify the SSOEntry\n    if (VirtualProtect(pssoEntryTarget, sizeof(SSOEntry), PAGE_EXECUTE_READWRITE, &dwOldProtect))\n    {\n        pssoEntryTarget->sharedThread = 1;\n        pssoEntryTarget->dwFlags = 0;\n        pssoEntryTarget->pfnCheckEnabled = NULL;\n        VirtualProtect(pssoEntryTarget, sizeof(SSOEntry), dwOldProtect, &dwOldProtect);\n    }\n}\n\nLSTATUS pnidui_RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)\n{\n    LSTATUS status = RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);\n    if (!lstrcmpW(lpValue, L\"ReplaceVan\") && status == ERROR_FILE_NOT_FOUND)\n    {\n        *(DWORD*)pvData = 0;\n        status = ERROR_SUCCESS;\n    }\n    return status;\n}\n\nvoid PatchPnidui(HMODULE hPnidui)\n{\n    VnPatchIAT(hPnidui, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", pnidui_CoCreateInstanceHook);\n    if (global_rovi.dwBuildNumber >= 25236)\n    {\n        VnPatchIAT(hPnidui, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegGetValueW\", pnidui_RegGetValueW);\n    }\n    VnPatchIAT(hPnidui, \"user32.dll\", \"TrackPopupMenu\", pnidui_TrackPopupMenuHook);\n    HOOK_IMMERSIVE_MENUS(Pnidui);\n#ifdef USE_PRIVATE_INTERFACES\n    if (bSkinIcons)\n    {\n        VnPatchIAT(hPnidui, \"user32.dll\", \"LoadImageW\", SystemTray_LoadImageWHook);\n    }\n#endif\n    printf(\"Setup pnidui functions done\\n\");\n}\n#endif\n#pragma endregion\n\n\n#pragma region \"Fix TrayThreadBSTA (54481602) taskbar thread flags for compatibility with taskbar toolbars\"\n#if WITH_MAIN_PATCHER\nBOOL STDAPICALLTYPE explorer_SHCreateThread(\n    LPTHREAD_START_ROUTINE pfnThreadProc, void* pData, SHCT_FLAGS flags, LPTHREAD_START_ROUTINE pfnCallback)\n{\n    static BOOL bPatched;\n    if (!bPatched && flags == CTF_THREAD_REF | CTF_REF_COUNTED | CTF_NOADDREFLIB)\n    {\n        bPatched = TRUE;\n        flags |= CTF_COINIT_STA | CTF_OLEINITIALIZE; // Add back the removed flags\n    }\n    return SHCreateThread(pfnThreadProc, pData, flags, pfnCallback);\n}\n#endif\n#pragma endregion\n\n\nDWORD Inject(BOOL bIsExplorer)\n{\n#if defined(DEBUG) | defined(_DEBUG)\n    FILE* conout;\n    AllocConsole();\n    freopen_s(\n        &conout, \n        \"CONOUT$\",\n        \"w\", \n        stdout\n    );\n#endif\n\n    int rv;\n\n    if (bIsExplorer)\n    {\n#if WITH_MAIN_PATCHER\n        InitializeCriticalSection(&lock_epw);\n#endif\n        wszWeatherLanguage = malloc(sizeof(WCHAR) * MAX_PATH);\n        wszWeatherTerm = malloc(sizeof(WCHAR) * MAX_PATH);\n    }\n\n    LoadSettings(MAKELPARAM(bIsExplorer, FALSE));\n    Explorer_RefreshUI(99);\n\n#if WITH_MAIN_PATCHER\n    if (bIsExplorerProcess)\n    {\n        funchook = funchook_create();\n        // printf(\"funchook create %d\\n\", funchook != 0);\n    }\n#endif\n\n    if (bIsExplorer)\n    {\n        hSwsSettingsChanged = CreateEventW(NULL, FALSE, FALSE, NULL);\n        hSwsOpacityMaybeChanged = CreateEventW(NULL, FALSE, FALSE, NULL);\n    }\n\n    unsigned int numSettings = bIsExplorer ? 12 : 2;\n    Setting* settings = calloc(numSettings, sizeof(Setting));\n    if (settings)\n    {\n        unsigned int cs = 0;\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = NULL;\n            settings[cs].data = NULL;\n            settings[cs].hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);\n            settings[cs].hKey = NULL;\n            ZeroMemory(settings[cs].name, MAX_PATH);\n            settings[cs].origin = NULL;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = LoadSettings;\n            settings[cs].data = MAKELPARAM(bIsExplorer, TRUE);\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, TEXT(REGPATH));\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = LoadSettings;\n            settings[cs].data = MAKELPARAM(bIsExplorer, FALSE);\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = SetEvent;\n            settings[cs].data = hSwsSettingsChanged;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, TEXT(REGPATH) L\"\\\\sws\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = SetEvent;\n            settings[cs].data = hSwsOpacityMaybeChanged;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\MultitaskingView\\\\AltTabViewHost\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = Explorer_RefreshUI;\n            settings[cs].data = 1;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = Explorer_RefreshUI;\n            settings[cs].data = 2;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Search\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = Explorer_RefreshUI;\n            settings[cs].data = NULL;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\\\\People\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = Explorer_RefreshUI;\n            settings[cs].data = NULL;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\TabletTip\\\\1.7\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = SetEvent;\n            settings[cs].data = hSwsSettingsChanged;\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = UpdateStartMenuPositioning;\n            settings[cs].data = MAKELPARAM(FALSE, TRUE);\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        if (cs < numSettings)\n        {\n            settings[cs].callback = LoadSettings;\n            settings[cs].data = MAKELPARAM(bIsExplorer, FALSE);\n            settings[cs].hEvent = NULL;\n            settings[cs].hKey = NULL;\n            wcscpy_s(settings[cs].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\");\n            settings[cs].origin = HKEY_CURRENT_USER;\n            cs++;\n        }\n\n        SettingsChangeParameters* settingsParams = calloc(1, sizeof(SettingsChangeParameters));\n        if (settingsParams)\n        {\n            settingsParams->settings = settings;\n            settingsParams->size = numSettings;\n            settingsParams->hThread = CreateThread(\n                0,\n                0,\n                MonitorSettings,\n                settingsParams,\n                0,\n                0\n            );\n        }\n        else\n        {\n            if (numSettings && settings[0].hEvent)\n            {\n                CloseHandle(settings[0].hEvent);\n            }\n            free(settings);\n            settings = NULL;\n        }\n    }\n\n    InjectBasicFunctions(bIsExplorer, TRUE);\n    //if (!hDelayedInjectionThread)\n    //{\n    //    hDelayedInjectionThread = CreateThread(0, 0, InjectBasicFunctions, 0, 0, 0);\n    //}\n\n    if (!bIsExplorer)\n    {\n#if WITH_MAIN_PATCHER\n        if (bIsExplorerProcess)\n        {\n            rv = funchook_install(funchook, 0);\n            if (rv != 0)\n            {\n                printf(\"Failed to install hooks. rv = %d\\n\", rv);\n            }\n            funchook_destroy(funchook);\n            funchook = NULL;\n        }\n#endif\n        return 0;\n    }\n\n#if WITH_MAIN_PATCHER\n    extern void InitializeWilLogCallback();\n    InitializeWilLogCallback();\n    wprintf(L\"Running on Windows %d, OS Build %d.%d.%d.%d.\\n\", IsWindows11() ? 11 : 10, global_rovi.dwMajorVersion, global_rovi.dwMinorVersion, global_rovi.dwBuildNumber, global_ubr);\n#endif\n\n    WCHAR wszPath[MAX_PATH];\n    SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wszPath);\n    wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\n    if (!PathFileExistsW(wszPath))\n    {\n        CreateDirectoryW(wszPath, NULL);\n    }\n\n#if WITH_MAIN_PATCHER\n    wszEPWeatherKillswitch = calloc(sizeof(WCHAR), MAX_PATH);\n    srand(time(NULL));\n    rand_string(wszEPWeatherKillswitch, MAX_PATH / 2 - 1);\n    swprintf_s(wszEPWeatherKillswitch, sizeof(_T(EP_Weather_Killswitch)) / sizeof(WCHAR), L\"%s\", _T(EP_Weather_Killswitch));\n    wszEPWeatherKillswitch[wcslen(wszEPWeatherKillswitch)] = L'_';\n    //wprintf(L\"%s\\n\", wszEPWeatherKillswitch);\n    hEPWeatherKillswitch = CreateMutexW(NULL, TRUE, wszEPWeatherKillswitch);\n    /*while (TRUE)\n    {\n        hEPWeatherKillswitch = CreateMutexW(NULL, TRUE, wszEPWeatherKillswitch);\n        if (GetLastError() == ERROR_ALREADY_EXISTS)\n        {\n            WaitForSingleObject(hEPWeatherKillswitch, INFINITE);\n            CloseHandle(hEPWeatherKillswitch);\n        }\n        else\n        {\n            break;\n        }\n    }*/\n#endif\n\n\n#if WITH_MAIN_PATCHER\n    hCanStartSws = CreateEventW(NULL, FALSE, FALSE, NULL);\n    hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);\n    CreateThread(\n        0,\n        0,\n        WindowSwitcher,\n        0,\n        0,\n        0\n    );\n\n\n#ifdef USE_PRIVATE_INTERFACES\n    P_Icon_Dark_Search = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\Search_Dark\\\\png\\\\32.png\", &S_Icon_Dark_Search);\n    P_Icon_Light_Search = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\Search_Light\\\\png\\\\32.png\", &S_Icon_Light_Search);\n    P_Icon_Dark_TaskView = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\TaskView_Dark\\\\png\\\\32.png\", &S_Icon_Dark_TaskView);\n    P_Icon_Light_TaskView = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\TaskView_Light\\\\png\\\\32.png\", &S_Icon_Light_TaskView);\n    P_Icon_Dark_Widgets = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\Widgets_Dark\\\\png\\\\32.png\", &S_Icon_Dark_Widgets);\n    P_Icon_Light_Widgets = ReadFromFile(L\"C:\\\\Users\\\\root\\\\Downloads\\\\pri\\\\resources\\\\Widgets_Light\\\\png\\\\32.png\", &S_Icon_Dark_Widgets);\n#endif\n\n\n    symbols_addr symbols_PTRS;\n    ZeroMemory(\n        &symbols_PTRS,\n        sizeof(symbols_addr)\n    );\n    LoadSymbolsResult loadSymbolsResult = LoadSymbols(&symbols_PTRS);\n    if (loadSymbolsResult.bSuccess)\n    {\n        if (NeedToDownloadSymbols(&loadSymbolsResult))\n        {\n            if (bEnableSymbolDownload)\n            {\n                printf(\"Attempting to download symbol data; for now, the program may have limited functionality.\\n\");\n                DownloadSymbolsParams* params = malloc(sizeof(DownloadSymbolsParams));\n                params->hModule = hModule;\n                params->bVerbose = FALSE;\n                params->loadResult = loadSymbolsResult;\n                CreateThread(0, 0, DownloadSymbols, params, 0, 0);\n            }\n        }\n        else\n        {\n            printf(\"Loaded symbols\\n\");\n        }\n    }\n\n\n    HANDLE hUser32 = LoadLibraryExW(L\"user32.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    CreateWindowInBand = GetProcAddress(hUser32, \"CreateWindowInBand\");\n    GetWindowBand = GetProcAddress(hUser32, \"GetWindowBand\");\n    SetWindowBand = GetProcAddress(hUser32, \"SetWindowBand\");\n    SetWindowCompositionAttribute = GetProcAddress(hUser32, \"SetWindowCompositionAttribute\");\n    if (!IsWindows11BuildHigherThan25158()) {\n        VnPatchIAT(hUser32, \"win32u.dll\", \"NtUserFindWindowEx\", user32_NtUserFindWindowExHook);\n    }\n    printf(\"Setup user32 functions done\\n\");\n\n\n    HANDLE hExplorer = GetModuleHandleW(NULL);\n\n    PBYTE pExplorerText;\n    DWORD cbExplorerText;\n    TextSectionBeginAndSize(hExplorer, &pExplorerText, &cbExplorerText);\n\n    if (IsWindows11Version22H2OrHigher())\n    {\n        TryToFindExplorerOffsets(hExplorer, pExplorerText, cbExplorerText, symbols_PTRS.explorer_PTRS);\n    }\n\n    const WCHAR* pszTaskbarDll = GetTaskbarDllChecked(&symbols_PTRS);\n    if (bOldTaskbar >= 2 && !pszTaskbarDll)\n    {\n        bOldTaskbar = 1;\n        AdjustTaskbarStyleValue(&bOldTaskbar);\n    }\n\n    SetChildWindowNoActivateFunc = GetProcAddress(GetModuleHandleW(L\"user32.dll\"), (LPCSTR)2005);\n    if (bOldTaskbar)\n    {\n        VnPatchIAT(hExplorer, \"user32.dll\", (LPCSTR)2005, explorer_SetChildWindowNoActivateHook);\n        VnPatchDelayIAT(hExplorer, \"ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll\", \"SendMessageW\", explorer_SendMessageW);\n        VnPatchIAT(hExplorer, \"shell32.dll\", \"ShellExecuteW\", explorer_ShellExecuteW);\n        VnPatchIAT(hExplorer, \"shell32.dll\", \"ShellExecuteExW\", explorer_ShellExecuteExW);\n        VnPatchIAT(hExplorer, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegGetValueW\", explorer_RegGetValueW);\n        VnPatchIAT(hExplorer, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegSetValueExW\", explorer_RegSetValueExW);\n        VnPatchIAT(hExplorer, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegCreateKeyExW\", explorer_RegCreateKeyExW);\n        VnPatchIAT(hExplorer, \"API-MS-WIN-SHCORE-REGISTRY-L1-1-0.DLL\", \"SHGetValueW\", explorer_SHGetValueW);\n        VnPatchIAT(hExplorer, \"user32.dll\", \"LoadMenuW\", explorer_LoadMenuW);\n        if (bOldTaskbar == 1)\n        {\n            VnPatchIAT(hExplorer, \"api-ms-win-core-shlwapi-obsolete-l1-1-0.dll\", \"QISearch\", explorer_QISearch);\n        }\n        if (IsOS(OS_ANYSERVER)) VnPatchIAT(hExplorer, \"api-ms-win-shcore-sysinfo-l1-1-0.dll\", \"IsOS\", explorer_IsOS);\n        if (IsWindows11Version22H2OrHigher()) VnPatchDelayIAT(hExplorer, \"ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll\", \"CreateWindowExW\", Windows11v22H2_explorer_CreateWindowExW);\n    }\n    VnPatchIAT(hExplorer, \"user32.dll\", \"TileWindows\", explorer_TileWindows);\n    VnPatchIAT(hExplorer, \"user32.dll\", \"CascadeWindows\", explorer_CascadeWindows);\n    VnPatchIAT(hExplorer, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegOpenKeyExW\", explorer_RegOpenKeyExW);\n    VnPatchIAT(hExplorer, \"shell32.dll\", (LPCSTR)85, explorer_OpenRegStream);\n    VnPatchIAT(hExplorer, \"user32.dll\", \"TrackPopupMenuEx\", explorer_TrackPopupMenuExHook);\n    HOOK_IMMERSIVE_MENUS(Explorer);\n    VnPatchIAT(hExplorer, \"uxtheme.dll\", \"OpenThemeDataForDpi\", explorer_OpenThemeDataForDpi);\n    VnPatchIAT(hExplorer, \"uxtheme.dll\", \"DrawThemeBackground\", explorer_DrawThemeBackground);\n    VnPatchIAT(hExplorer, \"uxtheme.dll\", \"CloseThemeData\", explorer_CloseThemeData);\n    if (IsWindows11())\n    {\n        // Fix Windows 10 taskbar high DPI button width bug\n        VnPatchIAT(hExplorer, \"api-ms-win-ntuser-sysparams-l1-1-0.dll\", \"GetSystemMetrics\", patched_GetSystemMetrics);\n\n        // Fix Pin to Start/Unpin from Start\n        PatchAppResolver();\n        PatchStartTileData(FALSE);\n    }\n    //VnPatchIAT(hExplorer, \"api-ms-win-core-libraryloader-l1-2-0.dll\", \"LoadStringW\", explorer_LoadStringWHook);\n    if (bClassicThemeMitigations)\n    {\n        /*explorer_SetWindowThemeFunc = SetWindowTheme;\n        rv = funchook_prepare(\n            funchook,\n            (void**)&explorer_SetWindowThemeFunc,\n            explorer_SetWindowThemeHook\n        );\n        if (rv != 0)\n        {\n            FreeLibraryAndExitThread(hModule, rv);\n            return rv;\n        }*/\n        VnPatchIAT(hExplorer, \"uxtheme.dll\", \"DrawThemeTextEx\", explorer_DrawThemeTextEx);\n        VnPatchIAT(hExplorer, \"uxtheme.dll\", \"GetThemeMargins\", explorer_GetThemeMargins);\n        VnPatchIAT(hExplorer, \"uxtheme.dll\", \"GetThemeMetric\", explorer_GetThemeMetric);\n        //VnPatchIAT(hExplorer, \"uxtheme.dll\", \"OpenThemeDataForDpi\", explorer_OpenThemeDataForDpi);\n        //VnPatchIAT(hExplorer, \"uxtheme.dll\", \"DrawThemeBackground\", explorer_DrawThemeBackground);\n        VnPatchIAT(hExplorer, \"user32.dll\", \"SetWindowCompositionAttribute\", explorer_SetWindowCompositionAttribute);\n    }\n    //VnPatchDelayIAT(hExplorer, \"ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll\", \"CreateWindowExW\", explorer_CreateWindowExW);\n    if (bOldTaskbar)\n    {\n        VnPatchIAT(hExplorer, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", explorer_CoCreateInstanceHook);\n        VnPatchIAT(hExplorer, \"API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL\", \"SetRect\", explorer_SetRect);\n        VnPatchIAT(hExplorer, \"USER32.DLL\", \"DeleteMenu\", explorer_DeleteMenu);\n        if (global_rovi.dwBuildNumber >= 22572)\n        {\n            VnPatchIAT(hExplorer, \"dwmapi.dll\", \"DwmUpdateThumbnailProperties\", explorer_DwmUpdateThumbnailPropertiesHook);\n            if (!bClassicThemeMitigations)\n            {\n                VnPatchIAT(hExplorer, \"user32.dll\", \"SetWindowCompositionAttribute\", explorer_SetWindowCompositionAttribute);\n            }\n        }\n        if (global_rovi.dwBuildNumber >= 26100)\n        {\n            VnPatchIAT(hExplorer, \"api-ms-win-shcore-thread-l1-1-0.dll\", \"SHCreateThread\", explorer_SHCreateThread);\n        }\n    }\n    if (IsWindows11())\n    {\n        // Find pointers to various stuff needed to have a working Windows 10 taskbar and Windows 10 taskbar context menu on Windows 11 taskbar\n#if defined(_M_X64)\n        // 4C 8D 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B\n        //                               ^^^^^^^^^^^    ^^^^^^^^^^^\n        // Ref: CTray::Init()\n        PBYTE match = FindPattern(\n            pExplorerText,\n            cbExplorerText,\n            \"\\x4C\\x8D\\x05\\x00\\x00\\x00\\x00\\x48\\x8D\\x0D\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\",\n            \"xxx????xxx????x????xx\"\n        );\n        if (match)\n        {\n            match += 7; // Point to 48\n            g_pTrayUIHost = (ITrayUIHost*)(match + 7 + *(int*)(match + 3));\n            match += 7; // Point to E8\n            explorer_TrayUI_CreateInstanceFunc = (TrayUI_CreateInstance_t)(match + 5 + *(int*)(match + 1));\n        }\n#elif defined(_M_ARM64)\n        // TODO Add support for ARM64\n#endif\n    }\n    else\n    {\n#if defined(_M_X64)\n        // 4C 8D 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0\n        //                               ^^^^^^^^^^^    ^^^^^^^^^^^\n        // Ref: CTray::Init()\n        PBYTE match = FindPattern(\n            pExplorerText,\n            cbExplorerText,\n            \"\\x4C\\x8D\\x05\\x00\\x00\\x00\\x00\\x48\\x8D\\x0D\\x00\\x00\\x00\\x00\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\",\n            \"xxx????xxx????x????xx\"\n        );\n        if (match)\n        {\n            match += 7; // Point to 48\n            g_pTrayUIHost = (ITrayUIHost*)(match + 7 + *(int*)(match + 3));\n            match += 7; // Point to E8\n            explorer_TrayUI_CreateInstanceFunc = (TrayUI_CreateInstance_t)(match + 5 + *(int*)(match + 1));\n        }\n#endif\n    }\n    if (g_pTrayUIHost)\n    {\n        printf(\"ITrayUIHost = %llX\\n\", (PBYTE)g_pTrayUIHost - (PBYTE)hExplorer);\n    }\n    if (explorer_TrayUI_CreateInstanceFunc)\n    {\n        printf(\"explorer.exe!TrayUI_CreateInstance() = %llX\\n\", (PBYTE)explorer_TrayUI_CreateInstanceFunc - (PBYTE)hExplorer);\n    }\n\n    // Enable Windows 10 taskbar search box on 22621+\n    if (IsWindows11Version22H2OrHigher())\n    {\n        if (symbols_PTRS.explorer_PTRS[5] && symbols_PTRS.explorer_PTRS[5] != 0xFFFFFFFF)\n        {\n            TrayUI__UpdatePearlSizeFunc = (PBYTE)hExplorer + symbols_PTRS.explorer_PTRS[5];\n        }\n        UpdateSearchBox();\n    }\n\n    HANDLE hShcore = LoadLibraryExW(L\"shcore.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    SHWindowsPolicy = GetProcAddress(hShcore, (LPCSTR)190);\n#ifdef USE_PRIVATE_INTERFACES\n    explorer_SHCreateStreamOnModuleResourceWFunc = GetProcAddress(hShcore, (LPCSTR)109);\n    VnPatchIAT(hExplorer, \"shcore.dll\", (LPCSTR)0x6D, explorer_SHCreateStreamOnModuleResourceWHook);\n#endif\n\n    printf(\"Setup explorer functions done\\n\");\n\n\n\n\n    CreateWindowExWFunc = CreateWindowExW;\n    rv = funchook_prepare(\n        funchook,\n        (void**)&CreateWindowExWFunc,\n        CreateWindowExWHook\n    );\n    if (rv != 0)\n    {\n        FreeLibraryAndExitThread(hModule, rv);\n        return rv;\n    }\n    SetWindowLongPtrWFunc = SetWindowLongPtrW;\n    rv = funchook_prepare(\n        funchook,\n        (void**)&SetWindowLongPtrWFunc,\n        SetWindowLongPtrWHook\n    );\n    if (rv != 0)\n    {\n        FreeLibraryAndExitThread(hModule, rv);\n        return rv;\n    }\n\n\n\n\n    HANDLE hUxtheme = LoadLibraryExW(L\"uxtheme.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    GetThemeName = (GetThemeName_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(74));\n    RefreshImmersiveColorPolicyState = (RefreshImmersiveColorPolicyState_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(104));\n    GetIsImmersiveColorUsingHighContrast = (GetIsImmersiveColorUsingHighContrast_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(106));\n    GetUserColorPreference = (GetUserColorPreference_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(120));\n    GetColorFromPreference = (GetColorFromPreference_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(121));\n    PeopleBand_DrawTextWithGlowFunc = GetProcAddress(hUxtheme, MAKEINTRESOURCEA(126));\n    ShouldAppsUseDarkMode = (ShouldAppsUseDarkMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(132));\n    AllowDarkModeForWindow = (AllowDarkModeForWindow_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133));\n    SetPreferredAppMode = (SetPreferredAppMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135));\n    ShouldSystemUseDarkMode = (ShouldSystemUseDarkMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(138));\n    if (bOldTaskbar)\n    {\n        VnPatchIAT(hExplorer, \"uxtheme.dll\", MAKEINTRESOURCEA(126), PeopleBand_DrawTextWithGlowHook);\n    }\n    // DwmExtendFrameIntoClientArea hooked in LoadSettings\n    printf(\"Setup uxtheme functions done\\n\");\n\n    RunTwinUIPCShellPatches(&symbols_PTRS);\n\n    HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll);\n    if (hMyTaskbar)\n    {\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", \"DeleteMenu\", explorer_DeleteMenu);\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", \"LoadMenuW\", explorer_LoadMenuW);\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", \"SendMessageW\", explorer_SendMessageW);\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", \"SetRect\", explorer_SetRect);\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", \"TrackPopupMenuEx\", explorer_TrackPopupMenuExHook);\n        VnPatchIAT(hMyTaskbar, \"user32.dll\", MAKEINTRESOURCEA(2005), explorer_SetChildWindowNoActivateHook);\n\n        VnPatchIAT(hMyTaskbar, \"uxtheme.dll\", MAKEINTRESOURCEA(126), PeopleBand_DrawTextWithGlowHook);\n\n        Win10TaskbarHooks_PatchEPTaskbarVtables(hMyTaskbar);\n    }\n\n    HANDLE hCombase = LoadLibraryExW(L\"combase.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (IsWindows11())\n    {\n        if (IsWindows11Version22H2OrHigher())\n        {\n            // Fixed a bug that crashed Explorer when a folder window was opened after a first one was closed on OS builds 22621+\n            VnPatchIAT(hCombase, \"api-ms-win-core-libraryloader-l1-2-0.dll\", \"LoadLibraryExW\", Windows11v22H2_combase_LoadLibraryExW);\n        }\n    }\n    if (!IsWindows11Version22H2OrHigher() && IsXamlSoundsEnabled())\n    {\n        VnPatchIAT(hCombase, \"api-ms-win-core-libraryloader-l1-2-0.dll\", \"LoadLibraryExW\", combase_LoadLibraryExW);\n    }\n    printf(\"Setup combase functions done\\n\");\n\n\n    HANDLE hTwinui = LoadLibraryExW(L\"twinui.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (!IsWindows11())\n    {\n        VnPatchIAT(hTwinui, \"user32.dll\", \"TrackPopupMenu\", twinui_TrackPopupMenuHook);\n    }\n    if (bDisableWinFHotkey)\n    {\n        VnPatchIAT(hTwinui, \"user32.dll\", \"RegisterHotKey\", twinui_RegisterHotkeyHook);\n    }\n    printf(\"Setup twinui functions done\\n\");\n\n\n    HANDLE hStobject = LoadLibraryExW(L\"stobject.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hStobject)\n    {\n        VnPatchIAT(hStobject, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegGetValueW\", stobject_RegGetValueW);\n        VnPatchIAT(hStobject, \"api-ms-win-core-com-l1-1-0.dll\", \"CoCreateInstance\", stobject_CoCreateInstanceHook);\n        if (IsWindows11())\n        {\n            VnPatchDelayIAT(hStobject, \"user32.dll\", \"TrackPopupMenu\", stobject_TrackPopupMenuHook);\n            VnPatchDelayIAT(hStobject, \"user32.dll\", \"TrackPopupMenuEx\", stobject_TrackPopupMenuExHook);\n        }\n        else\n        {\n            VnPatchIAT(hStobject, \"user32.dll\", \"TrackPopupMenu\", stobject_TrackPopupMenuHook);\n            VnPatchIAT(hStobject, \"user32.dll\", \"TrackPopupMenuEx\", stobject_TrackPopupMenuExHook);\n        }\n        if (global_rovi.dwBuildNumber >= 25236 && bOldTaskbar)\n        {\n            PatchStobject(hStobject);\n        }\n    }\n#ifdef USE_PRIVATE_INTERFACES\n    if (bSkinIcons)\n    {\n        VnPatchDelayIAT(hStobject, \"user32.dll\", \"LoadImageW\", SystemTray_LoadImageWHook);\n    }\n#endif\n    printf(\"Setup stobject functions done\\n\");\n\n\n\n    HANDLE hBthprops = LoadLibraryW(L\"bthprops.cpl\");\n    VnPatchIAT(hBthprops, \"user32.dll\", \"TrackPopupMenuEx\", bthprops_TrackPopupMenuExHook);\n#ifdef USE_PRIVATE_INTERFACES\n    if (bSkinIcons)\n    {\n        VnPatchIAT(hBthprops, \"user32.dll\", \"LoadImageW\", SystemTray_LoadImageWHook);\n    }\n#endif\n    printf(\"Setup bthprops functions done\\n\");\n\n\n\n    if (global_rovi.dwBuildNumber < 25236)\n    {\n        HANDLE hPnidui = LoadLibraryExW(L\"pnidui.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n        if (hPnidui)\n        {\n            PatchPnidui(hPnidui);\n        }\n    }\n\n\n#if WITH_MAIN_PATCHER\n    if (global_rovi.dwBuildNumber < 22567)\n    {\n        PatchSndvolsso();\n    }\n#endif\n\n\n    hShell32 = GetModuleHandleW(L\"shell32.dll\");\n    if (hShell32)\n    {\n        // Patch ribbon to handle redirects to classic CPLs\n        HRESULT(*SHELL32_Create_IEnumUICommand)(IUnknown*, int*, int, IUnknown**) = GetProcAddress(hShell32, (LPCSTR)0x2E8);\n        if (SHELL32_Create_IEnumUICommand)\n        {\n            char WVTASKITEM[80];\n            ZeroMemory(WVTASKITEM, 80);\n            IUnknown* pEnumUICommand = NULL;\n            SHELL32_Create_IEnumUICommand(NULL, WVTASKITEM, 1, &pEnumUICommand);\n            if (pEnumUICommand)\n            {\n                EnumExplorerCommand* pEnumExplorerCommand = NULL;\n                pEnumUICommand->lpVtbl->QueryInterface(pEnumUICommand, &IID_EnumExplorerCommand, &pEnumExplorerCommand);\n                pEnumUICommand->lpVtbl->Release(pEnumUICommand);\n                if (pEnumExplorerCommand)\n                {\n                    UICommand* pUICommand = NULL;\n                    pEnumExplorerCommand->lpVtbl->Next(pEnumExplorerCommand, 1, &pUICommand, NULL);\n                    pEnumExplorerCommand->lpVtbl->Release(pEnumExplorerCommand);\n                    if (pUICommand)\n                    {\n                        DWORD flOldProtect = 0;\n                        if (VirtualProtect(pUICommand->lpVtbl, sizeof(UICommandVtbl), PAGE_EXECUTE_READWRITE, &flOldProtect))\n                        {\n                            shell32_UICommand_InvokeFunc = pUICommand->lpVtbl->Invoke;\n                            pUICommand->lpVtbl->Invoke = shell32_UICommand_InvokeHook;\n                            VirtualProtect(pUICommand->lpVtbl, sizeof(UICommandVtbl), flOldProtect, &flOldProtect);\n                        }\n                        pUICommand->lpVtbl->Release(pUICommand);\n                    }\n                }\n            }\n        }\n\n        // Allow clasic drive groupings in This PC\n        DllGetClassObject_t SHELL32_DllGetClassObject = (DllGetClassObject_t)GetProcAddress(hShell32, \"DllGetClassObject\");\n        if (SHELL32_DllGetClassObject)\n        {\n            IClassFactory* pClassFactory = NULL;\n            SHELL32_DllGetClassObject(&CLSID_DriveTypeCategorizer, &IID_IClassFactory, (LPVOID*)&pClassFactory);\n\n            if (pClassFactory)\n            {\n                //DllGetClassObject hands out a unique \"factory entry\" data structure for each type of CLSID, containing a pointer to an IClassFactoryVtbl as well as some other members including\n                //the _true_ create instance function that should be called (in this instance, shell32!CDriveTypeCategorizer_CreateInstance). When the IClassFactory::CreateInstance method is called,\n                //shell32!ECFCreateInstance will cast the IClassFactory* passed to it back into a factory entry, and then invoke the pfnCreateInstance function defined in that entry directly.\n                //Thus, rather than hooking the shared shell32!ECFCreateInstance function found on the IClassFactoryVtbl* shared by all class objects returned by shell32!DllGetClassObject, we get the real\n                //CreateInstance function that will be called and hook that instead\n                Shell32ClassFactoryEntry* pClassFactoryEntry = (Shell32ClassFactoryEntry*)pClassFactory;\n\n                DWORD flOldProtect = 0;\n\n                if (VirtualProtect(pClassFactoryEntry, sizeof(Shell32ClassFactoryEntry), PAGE_EXECUTE_READWRITE, &flOldProtect))\n                {\n                    shell32_DriveTypeCategorizer_CreateInstanceFunc = pClassFactoryEntry->pfnCreateInstance;\n                    pClassFactoryEntry->pfnCreateInstance = shell32_DriveTypeCategorizer_CreateInstanceHook;\n                    VirtualProtect(pClassFactoryEntry, sizeof(Shell32ClassFactoryEntry), flOldProtect, &flOldProtect);\n                }\n\n                pClassFactory->lpVtbl->Release(pClassFactory);\n            }\n        }\n\n        // Disable Windows Spotlight icon\n        if (DoesOSBuildSupportSpotlight())\n        {\n            VnPatchIAT(hShell32, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegCreateKeyExW\", shell32_RegCreateKeyExW);\n            VnPatchIAT(hShell32, \"API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL\", \"RegSetValueExW\", shell32_RegSetValueExW);\n            VnPatchIAT(hShell32, \"user32.dll\", \"DeleteMenu\", shell32_DeleteMenu);\n        }\n\n        // Fix high DPI wrong (desktop) icon spacing bug\n        if (IsWindows11())\n        {\n            VnPatchIAT(hShell32, \"user32.dll\", \"GetSystemMetrics\", patched_GetSystemMetrics);\n        }\n    }\n    printf(\"Setup shell32 functions done\\n\");\n\n\n    HANDLE hWindowsStorage = LoadLibraryW(L\"windows.storage.dll\");\n    SHELL32_CanDisplayWin8CopyDialogFunc = GetProcAddress(hShell32, \"SHELL32_CanDisplayWin8CopyDialog\");\n    if (SHELL32_CanDisplayWin8CopyDialogFunc) VnPatchDelayIAT(hWindowsStorage, \"ext-ms-win-shell-exports-internal-l1-1-0.dll\", \"SHELL32_CanDisplayWin8CopyDialog\", SHELL32_CanDisplayWin8CopyDialogHook);\n    printf(\"Setup windows.storage functions done\\n\");\n\n\n    if (IsWindows11())\n    {\n        HANDLE hInputSwitch = LoadLibraryExW(L\"InputSwitch.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n        if (bOldTaskbar)\n        {\n            printf(\"[IME] Context menu patch status: %d\\n\", PatchContextMenuOfNewMicrosoftIME(NULL));\n        }\n        if (hInputSwitch)\n        {\n            VnPatchIAT(hInputSwitch, \"user32.dll\", \"TrackPopupMenuEx\", inputswitch_TrackPopupMenuExHook);\n            HOOK_IMMERSIVE_MENUS(InputSwitch);\n            printf(\"Setup inputswitch functions done\\n\");\n        }\n\n        HANDLE hWindowsudkShellcommon = LoadLibraryW(L\"windowsudk.shellcommon.dll\");\n        if (hWindowsudkShellcommon)\n        {\n            HANDLE hSLC = LoadLibraryExW(L\"slc.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n            if (hSLC)\n            {\n                SLGetWindowsInformationDWORDFunc = GetProcAddress(hSLC, \"SLGetWindowsInformationDWORD\");\n\n                if (SLGetWindowsInformationDWORDFunc)\n                {\n                    VnPatchDelayIAT(hWindowsudkShellcommon, \"ext-ms-win-security-slc-l1-1-0.dll\", \"SLGetWindowsInformationDWORD\", windowsudkshellcommon_SLGetWindowsInformationDWORDHook);\n                }\n            }\n        }\n    }\n\n\n\n    HANDLE hPeopleBand = LoadLibraryExW(L\"PeopleBand.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hPeopleBand)\n    {\n        if (IsOS(OS_ANYSERVER)) VnPatchIAT(hPeopleBand, \"SHLWAPI.dll\", (LPCSTR)437, PeopleBand_IsOS);\n        VnPatchIAT(hPeopleBand, \"api-ms-win-core-largeinteger-l1-1-0.dll\", \"MulDiv\", PeopleBand_MulDivHook);\n        printf(\"Setup peopleband functions done\\n\");\n    }\n\n\n\n    if (AreLogonLogoffShutdownSoundsEnabled())\n    {\n        HookLogonSound();\n    }\n\n    rv = funchook_install(funchook, 0);\n    if (rv != 0)\n    {\n        FreeLibraryAndExitThread(hModule, rv);\n        return rv;\n    }\n    // funchook_destroy(funchook);\n    // funchook = NULL;\n    printf(\"Installed hooks.\\n\");\n\n\n\n\n    if (IsWindows11())\n    {\n        if (bOldTaskbar)\n        {\n            CreateThread(0, 0, SignalShellReady, 0, 0, 0);\n        }\n        else\n        {\n            BOOL bStockTaskbarAutohideOk = global_rovi.dwBuildNumber > 22000\n                || (global_rovi.dwBuildNumber == 22000 && global_ubr >= 318);\n            if (!bStockTaskbarAutohideOk)\n            {\n                CreateThread(0, 0, FixTaskbarAutohide, 0, 0, 0);\n            }\n        }\n    }\n\n    /*if (IsWindows11Version22H2OrHigher() && bOldTaskbar)\n    {\n        DWORD dwRes = 1;\n        DWORD dwSize = sizeof(DWORD);\n        if (RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Search\", L\"SearchboxTaskbarMode\", RRF_RT_DWORD, NULL, &dwRes, &dwSize) != ERROR_SUCCESS)\n        {\n            RegSetKeyValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Search\", L\"SearchboxTaskbarMode\", REG_DWORD, &dwRes, sizeof(DWORD));\n        }\n    }*/\n\n\n    /*\n    if (IsWindows11())\n    {\n        DWORD dwSize = 0;\n        if (SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(\n            L\"Control Panel\\\\Desktop\\\\WindowMetrics\",\n            L\"MinWidth\",\n            SRRF_RT_REG_SZ,\n            NULL,\n            NULL,\n            (LPDWORD)(&dwSize)\n        ) != ERROR_SUCCESS)\n        {\n            RegSetKeyValueW(\n                HKEY_CURRENT_USER,\n                L\"Control Panel\\\\Desktop\\\\WindowMetrics\",\n                L\"MinWidth\",\n                REG_SZ,\n                L\"38\",\n                sizeof(L\"38\")\n            );\n        }\n    }\n    */\n\n\n\n    CreateThread(\n        0,\n        0,\n        OpenStartOnCurentMonitorThread,\n        0,\n        0,\n        0\n    );\n    printf(\"Open Start on monitor thread\\n\");\n\n\n\n    hServiceWindowThread = CreateThread(\n        0,\n        0,\n        EP_ServiceWindowThread,\n        0,\n        0,\n        0\n    );\n    printf(\"EP Service Window thread\\n\");\n\n\n\n    // if (bDisableOfficeHotkeys)\n    {\n        VnPatchIAT(hExplorer, \"user32.dll\", \"RegisterHotKey\", explorer_RegisterHotkeyHook);\n    }\n\n\n\n    if (bEnableArchivePlugin)\n    {\n        ArchiveMenuThreadParams* params = calloc(1, sizeof(ArchiveMenuThreadParams));\n        params->CreateWindowInBand = CreateWindowInBand;\n        params->hWnd = &archivehWnd;\n        params->wndProc = CLauncherTipContextMenu_WndProc;\n        CreateThread(\n            0,\n            0,\n            ArchiveMenuThread,\n            params,\n            0,\n            0\n        );\n    }\n\n\n\n    CreateThread(NULL, 0, CheckForUpdatesThread, 5000, 0, NULL);\n\n\n\n    WCHAR wszExtraLibPath[MAX_PATH];\n    if (GetWindowsDirectoryW(wszExtraLibPath, MAX_PATH))\n    {\n        wcscat_s(wszExtraLibPath, MAX_PATH, L\"\\\\ep_extra.dll\");\n        if (FileExistsW(wszExtraLibPath))\n        {\n            HMODULE hExtra = LoadLibraryW(wszExtraLibPath);\n            if (hExtra)\n            {\n                printf(\"[Extra] Found library: %p.\\n\", hExtra);\n                FARPROC ep_extra_entrypoint = GetProcAddress(hExtra, \"ep_extra_EntryPoint\");\n                if (ep_extra_entrypoint)\n                {\n                    printf(\"[Extra] Running entry point...\\n\");\n                    ep_extra_entrypoint();\n                    printf(\"[Extra] Finished running entry point.\\n\");\n                }\n            }\n            else\n            {\n                printf(\"[Extra] LoadLibraryW failed with 0x%x.\", GetLastError());\n            }\n        }\n    }\n\n\n\n    /*if (bHookStartMenu)\n    {\n        HookStartMenuParams* params2 = calloc(1, sizeof(HookStartMenuParams));\n        params2->dwTimeout = 1000;\n        params2->hModule = hModule;\n        params2->proc = InjectStartFromExplorer;\n        GetModuleFileNameW(hModule, params2->wszModulePath, MAX_PATH);\n        CreateThread(0, 0, HookStartMenu, params2, 0, 0);\n    }*/\n\n\n\n\n    VnPatchDelayIAT(hExplorer, \"ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll\", \"GetClientRect\", TaskbarCenter_GetClientRectHook);\n    if (hMyTaskbar)\n        VnPatchIAT(hMyTaskbar, \"USER32.dll\", \"GetClientRect\", TaskbarCenter_GetClientRectHook);\n    VnPatchIAT(hExplorer, \"SHCORE.dll\", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy);\n    printf(\"Initialized taskbar centering module.\\n\");\n\n\n\n\n    //CreateThread(0, 0, PositionStartMenuTimeout, 0, 0, 0);\n\n    /*else\n    {\n        if (bIsExplorer)\n        {\n            // deinject all\n\n            rv = funchook_uninstall(funchook, 0);\n            if (rv != 0)\n            {\n                FreeLibraryAndExitThread(hModule, rv);\n                return rv;\n            }\n\n            rv = funchook_destroy(funchook);\n            if (rv != 0)\n            {\n                FreeLibraryAndExitThread(hModule, rv);\n                return rv;\n            }\n        }\n\n        //SetEvent(hExitSettingsMonitor);\n        //WaitForSingleObject(hSettingsMonitorThread, INFINITE);\n        //CloseHandle(hExitSettingsMonitor);\n        //free(settingsParams);\n        //free(settings);\n        //InjectBasicFunctions(FALSE, FALSE);\n        FreeLibraryAndExitThread(hModule, 0);\n    }*/\n#endif\n    return 0;\n}\n\n#if WITH_MAIN_PATCHER\nchar VisibilityChangedEventArguments_GetVisible(__int64 a1)\n{\n    int v1;\n    char v3[8];\n    ZeroMemory(v3, 8);\n\n    v1 = (*(__int64(__fastcall**)(__int64, char*))(*(INT64*)a1 + 48))(a1, v3);\n    if (v1 < 0)\n        return 0;\n\n    return v3[0];\n}\n\nDWORD Start_NoStartMenuMorePrograms = 0;\nDWORD Start_ForceStartSize = 0;\nDWORD StartMenu_maximumFreqApps = 6;\nDWORD StartMenu_ShowAllApps = 0;\nDWORD StartDocked_DisableRecommendedSection = FALSE;\nDWORD StartDocked_DisableRecommendedSectionApply = TRUE;\nDWORD StartUI_EnableRoundedCorners = FALSE;\nDWORD StartUI_EnableRoundedCornersApply = TRUE;\nDWORD StartUI_ShowMoreTiles = FALSE;\nHKEY hKey_StartUI_TileGrid = NULL;\n\nvoid StartMenu_LoadSettings(BOOL bRestartIfChanged)\n{\n    HKEY hKey = NULL;\n    DWORD dwSize, dwVal;\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MakeAllAppsDefault\"),\n            0,\n            NULL,\n            &StartMenu_ShowAllApps,\n            &dwSize\n        );\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"MonitorOverride\"),\n            0,\n            NULL,\n            &bMonitorOverride,\n            &dwSize\n        );\n        RegCloseKey(hKey);\n    }\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH_STARTMENU),\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        dwVal = 6;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"Start_MaximumFrequentApps\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (bRestartIfChanged && dwVal != StartMenu_maximumFreqApps)\n        {\n            exit(0);\n        }\n        StartMenu_maximumFreqApps = dwVal;\n\n        dwSize = sizeof(DWORD);\n        dwVal = FALSE;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"StartDocked_DisableRecommendedSection\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (dwVal != StartDocked_DisableRecommendedSection)\n        {\n            StartDocked_DisableRecommendedSectionApply = TRUE;\n        }\n        StartDocked_DisableRecommendedSection = dwVal;\n\n        dwSize = sizeof(DWORD);\n        dwVal = FALSE;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"StartUI_EnableRoundedCorners\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (dwVal != StartUI_EnableRoundedCorners)\n        {\n            StartUI_EnableRoundedCornersApply = TRUE;\n        }\n        StartUI_EnableRoundedCorners = dwVal;\n\n        dwSize = sizeof(DWORD);\n        dwVal = FALSE;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"StartUI_ShowMoreTiles\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (bRestartIfChanged && dwStartShowClassicMode && dwVal != StartUI_ShowMoreTiles)\n        {\n            exit(0);\n        }\n        StartUI_ShowMoreTiles = dwVal;\n\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        if (IsWindows11()) dwVal = 0;\n        else dwVal = 1;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"Start_ShowClassicMode\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (!DoesWindows10StartMenuExist())\n        {\n            dwVal = 0;\n        }\n        if (bRestartIfChanged && dwVal != dwStartShowClassicMode)\n        {\n            exit(0);\n        }\n        dwStartShowClassicMode = dwVal;\n\n        dwSize = sizeof(DWORD);\n        if (IsWindows11()) dwVal = 1;\n        else dwVal = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"TaskbarAl\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (InterlockedExchange(&dwTaskbarAl, dwVal) != dwVal)\n        {\n            StartUI_EnableRoundedCornersApply = TRUE;\n            StartDocked_DisableRecommendedSectionApply = TRUE;\n        }\n\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Explorer\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        dwVal = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"ForceStartSize\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (bRestartIfChanged && dwVal != Start_ForceStartSize)\n        {\n            exit(0);\n        }\n        Start_ForceStartSize = dwVal;\n\n        RegCloseKey(hKey);\n    }\n\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\Explorer\",\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        dwVal = 0;\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"NoStartMenuMorePrograms\"),\n            0,\n            NULL,\n            &dwVal,\n            &dwSize\n        );\n        if (bRestartIfChanged && dwVal != Start_NoStartMenuMorePrograms)\n        {\n            exit(0);\n        }\n        Start_NoStartMenuMorePrograms = dwVal;\n\n        RegCloseKey(hKey);\n    }\n}\n\nstatic INT64(*StartDocked_LauncherFrame_OnVisibilityChangedFunc)(void*, INT64, void*) = NULL;\n\nstatic INT64(*StartDocked_LauncherFrame_ShowAllAppsFunc)(void* _this) = NULL;\n\nINT64 StartDocked_LauncherFrame_OnVisibilityChangedHook(void* _this, INT64 a2, void* VisibilityChangedEventArguments)\n{\n    INT64 r = 0;\n    if (StartDocked_LauncherFrame_OnVisibilityChangedFunc)\n    {\n        r = StartDocked_LauncherFrame_OnVisibilityChangedFunc(_this, a2, VisibilityChangedEventArguments);\n    }\n    if (StartMenu_ShowAllApps)\n    {\n        //if (VisibilityChangedEventArguments_GetVisible(VisibilityChangedEventArguments))\n        {\n            if (StartDocked_LauncherFrame_ShowAllAppsFunc)\n            {\n                StartDocked_LauncherFrame_ShowAllAppsFunc(_this);\n            }\n        }\n    }\n    return r;\n}\n\nINT64(*StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsFunc)(void*) = NULL;\n\nINT64 StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsHook(void* _this)\n{\n    return StartMenu_maximumFreqApps;\n}\n\nINT64(*StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsFunc)(void*) = NULL;\n\nINT64 StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsHook(void* _this)\n{\n    return StartMenu_maximumFreqApps;\n}\n\nINT64(*StartDocked_StartSizingFrame_StartSizingFrameFunc)(void* _this) = NULL;\n\nINT64 StartDocked_StartSizingFrame_StartSizingFrameHook(void* _this)\n{\n    INT64 rv = StartDocked_StartSizingFrame_StartSizingFrameFunc(_this);\n    HMODULE hModule = LoadLibraryExW(L\"Shlwapi.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hModule)\n    {\n        DWORD dwStatus = 0, dwSize = sizeof(DWORD);\n        t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, \"SHRegGetValueFromHKCUHKLM\");\n        if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(\n            TEXT(\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\"),\n            TEXT(\"TaskbarAl\"),\n            SRRF_RT_REG_DWORD,\n            NULL,\n            &dwStatus,\n            &dwSize\n        ) != ERROR_SUCCESS)\n        {\n            dwStatus = 0;\n        }\n        FreeLibrary(hModule);\n        *(((char*)_this + 387)) = dwStatus;\n    }\n    return rv;\n}\n\ntypedef enum Parser_XamlBufferType\n{\n    XBT_Text,\n    XBT_Binary,\n    XBT_MemoryMappedResource\n} Parser_XamlBufferType;\n\ntypedef struct Parser_XamlBuffer\n{\n    unsigned int m_count;\n    Parser_XamlBufferType m_bufferType;\n    const unsigned __int8* m_buffer;\n} Parser_XamlBuffer;\n\nstatic BOOL StartMenu_FillParserBuffer(Parser_XamlBuffer* pBuffer, int resourceId)\n{\n    HRSRC hRscr = FindResource(hModule, MAKEINTRESOURCE(resourceId), RT_RCDATA);\n    if (!hRscr)\n        return FALSE;\n\n    HGLOBAL hgRscr = LoadResource(hModule, hRscr);\n    if (!hgRscr)\n        return FALSE;\n\n    pBuffer->m_buffer = LockResource(hgRscr);\n    pBuffer->m_count = SizeofResource(hModule, hRscr);\n    pBuffer->m_bufferType = XBT_Binary;\n    return TRUE;\n}\n\nParser_XamlBuffer g_EmptyRefreshedStylesXbfBuffer;\n\nHRESULT(*CCoreServices_TryLoadXamlResourceHelperFunc)(void* _this, void* pUri, bool* pfHasBinaryFile, void** ppMemory, Parser_XamlBuffer* pBuffer, void** ppPhysicalUri);\nHRESULT CCoreServices_TryLoadXamlResourceHelperHook(void* _this, void* pUri, bool* pfHasBinaryFile, void** ppMemory, Parser_XamlBuffer* pBuffer, void** ppPhysicalUri)\n{\n    HRESULT(*Clone)(void* _this, void** ppUri); // index 3\n    HRESULT(*GetCanonical)(void* _this, unsigned int* pBufferLength, wchar_t* pszBuffer); // index 7\n    void** vtable = *(void***)pUri;\n    Clone = vtable[3];\n    GetCanonical = vtable[7];\n    wchar_t szCanonical[MAX_PATH];\n    unsigned int len = MAX_PATH;\n    GetCanonical(pUri, &len, szCanonical);\n    // OutputDebugStringW(szCanonical); OutputDebugStringW(L\"<<<<<\\n\");\n\n    if (!wcscmp(szCanonical, L\"ms-appx://Windows.UI.ShellCommon/JumpViewUI/RefreshedStyles.xaml\"))\n    {\n        *pfHasBinaryFile = true;\n        *pBuffer = g_EmptyRefreshedStylesXbfBuffer;\n        if (ppPhysicalUri)\n            Clone(pUri, ppPhysicalUri);\n        return pBuffer->m_buffer ? S_OK : E_FAIL;\n    }\n\n    return CCoreServices_TryLoadXamlResourceHelperFunc(_this, pUri, pfHasBinaryFile, ppMemory, pBuffer, ppPhysicalUri);\n}\n\nstatic BOOL StartMenu_FixContextMenuXbfHijackMethod()\n{\n    HANDLE hWindowsUIXaml = LoadLibraryW(L\"Windows.UI.Xaml.dll\");\n    if (!hWindowsUIXaml)\n        return FALSE;\n\n    PBYTE pWindowsUIXamlText;\n    DWORD cbWindowsUIXamlText;\n    if (!TextSectionBeginAndSize(hWindowsUIXaml, &pWindowsUIXamlText, &cbWindowsUIXamlText))\n        return FALSE;\n\n    if (!StartMenu_FillParserBuffer(&g_EmptyRefreshedStylesXbfBuffer, IDR_REFRESHEDSTYLES_XBF))\n        return FALSE;\n\n#if defined(_M_X64)\n    // 49 89 43 C8 E8 ?? ?? ?? ?? 85 C0\n    //                ^^^^^^^^^^^\n    // Ref: CCoreServices::LoadXamlResource()\n    PBYTE match = FindPattern(\n        pWindowsUIXamlText,\n        cbWindowsUIXamlText,\n        \"\\x49\\x89\\x43\\xC8\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\",\n        \"xxxxx????xx\"\n    );\n    if (!match)\n        return FALSE;\n\n    match += 4;\n    match += 5 + *(int*)(match + 1);\n#elif defined(_M_ARM64)\n    // E1 0B 40 F9 05 00 80 D2 04 00 80 D2 E3 03 ?? AA E2 03 ?? AA E0 03 ?? AA ?? ?? ?? 97\n    //                                                                         ^^^^^^^^^^^\n    // Ref: CoreServices_TryGetApplicationResource()\n    PBYTE match = FindPattern(\n        pWindowsUIXamlText,\n        cbWindowsUIXamlText,\n        \"\\xE1\\x0B\\x40\\xF9\\x05\\x00\\x80\\xD2\\x04\\x00\\x80\\xD2\\xE3\\x03\\x00\\xAA\\xE2\\x03\\x00\\xAA\\xE0\\x03\\x00\\xAA\\x00\\x00\\x00\\x97\",\n        \"xxxxxxxxxxxxxx?xxx?xxx?x???x\"\n    );\n    if (!match)\n        return FALSE;\n\n    match += 24;\n    match = (PBYTE)ARM64_FollowBL((DWORD*)match);\n    if (!match)\n        return FALSE;\n#endif\n\n    CCoreServices_TryLoadXamlResourceHelperFunc = match;\n    funchook_prepare(\n        funchook,\n        (void**)&CCoreServices_TryLoadXamlResourceHelperFunc,\n        CCoreServices_TryLoadXamlResourceHelperHook\n    );\n    return TRUE;\n}\n\n// void StartUI::UserTileView::AppendMenuFlyoutItemCommand(class Windows::UI::Xaml::Controls::MenuFlyout^, class Windows::Internal::Shell::StartUI::UserTileCommand^, enum Windows::Internal::Shell::StartUI::UserTileCommandId)\nvoid (*StartUI_UserTileView_AppendMenuFlyoutItemCommandFunc)(void* _this, void* menuFlyout, void* userTileCommand, int id);\nvoid StartUI_UserTileView_AppendMenuFlyoutItemCommandHook(void* _this, void* menuFlyout, void* userTileCommand, int id)\n{\n    // 4 = UserTile_LaunchAccountBadging\n    // 5 = UserTile_AccountBadgingSecondary\n    if (id == 4 || id == 5)\n    {\n        return;\n    }\n    StartUI_UserTileView_AppendMenuFlyoutItemCommandFunc(_this, menuFlyout, userTileCommand, id);\n}\n\nstatic void StartMenu_FixUserTileMenu(PBYTE pSearchBegin, size_t cbSearch)\n{\n    if (!pSearchBegin || !cbSearch)\n        return;\n\n#if defined(_M_X64)\n    // 41 B9 03 00 00 00 4D 8B C4 ?? 8B D6 49 8B CD E8 ?? ?? ?? ??\n    //                                                 ^^^^^^^^^^^\n    // Ref: <lambda_3a9b433356e31b02e54fffbca0ecf3fa>::operator()\n    PBYTE match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x41\\xB9\\x03\\x00\\x00\\x00\\x4D\\x8B\\xC4\\x00\\x8B\\xD6\\x49\\x8B\\xCD\\xE8\",\n        \"xxxxxxxxx?xxxxxx\"\n    );\n    if (match)\n    {\n        match += 15;\n        match += 5 + *(int*)(match + 1);\n    }\n#elif defined(_M_ARM64)\n    // 63 00 80 52 E2 03 1B AA E1 03 14 AA E0 03 19 AA ?? ?? ?? 94\n    //                                                 ^^^^^^^^^^^\n    // Ref: <lambda_3a9b433356e31b02e54fffbca0ecf3fa>::operator()\n    PBYTE match = FindPattern(\n        pSearchBegin,\n        cbSearch,\n        \"\\x63\\x00\\x80\\x52\\xE2\\x03\\x1B\\xAA\\xE1\\x03\\x14\\xAA\\xE0\\x03\\x19\\xAA\\x00\\x00\\x00\\x94\",\n        \"xxxxxxxxxxxxxxxx???x\"\n    );\n    if (match)\n    {\n        match += 16;\n        match = (PBYTE)ARM64_FollowBL((DWORD*)match);\n    }\n#endif\n\n    if (match)\n    {\n        StartUI_UserTileView_AppendMenuFlyoutItemCommandFunc = match;\n        funchook_prepare(\n            funchook,\n            (void**)&StartUI_UserTileView_AppendMenuFlyoutItemCommandFunc,\n            StartUI_UserTileView_AppendMenuFlyoutItemCommandHook\n        );\n    }\n}\n\nLSTATUS StartUI_RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)\n{\n    if (wcsstr(lpSubKey, L\"$start.tilegrid$windows.data.curatedtilecollection.tilecollection\\\\Current\"))\n    {\n        LSTATUS lRes = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);\n        if (lRes == ERROR_SUCCESS)\n        {\n            hKey_StartUI_TileGrid = *phkResult;\n        }\n        return lRes;\n    }\n    return RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);\n}\n\nLSTATUS StartUI_RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)\n{\n    if (hKey == hKey_StartUI_TileGrid)\n    {\n        if (!_wcsicmp(lpValueName, L\"Data\"))\n        {\n            LSTATUS lRes = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);\n            if (lRes == ERROR_SUCCESS && lpData && *lpcbData >= 26)\n            {\n                lpData[25] = (StartUI_ShowMoreTiles ? 16 : 12);\n            }\n            return lRes;\n        }\n    }\n    return RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);\n}\n\nLSTATUS StartUI_RegCloseKey(HKEY hKey)\n{\n    if (hKey == hKey_StartUI_TileGrid)\n    {\n        hKey_StartUI_TileGrid = NULL;\n    }\n    return RegCloseKey(hKey);\n}\n\nint Start_SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)\n{\n    WCHAR wszDebug[MAX_PATH];\n    BOOL bIsWindowVisible = FALSE;\n    HRESULT hr = IsThreadCoreWindowVisible(&bIsWindowVisible);\n    if (SUCCEEDED(hr))\n    {\n#if WITH_SMA_PATCH_REPORT\n        if (dwStartShowClassicMode && IsWindows11())\n        {\n            HANDLE hAnimationsPatched = OpenMutexW(SYNCHRONIZE, FALSE, _T(EPStart10_AnimationsPatched));\n            if (hAnimationsPatched)\n            {\n                CloseHandle(hAnimationsPatched);\n            }\n            else\n            {\n                ShowWindow(hWnd, bIsWindowVisible ? SW_SHOW : SW_HIDE);\n            }\n        }\n#endif\n        DWORD TaskbarAl = InterlockedAdd(&dwTaskbarAl, 0);\n        if (bIsWindowVisible && (!TaskbarAl ? (dwStartShowClassicMode ? StartUI_EnableRoundedCornersApply : StartDocked_DisableRecommendedSectionApply) : 1))\n        {\n            HWND hWndTaskbar = NULL;\n            if (TaskbarAl)\n            {\n                HMONITOR hMonitorOfStartMenu = NULL;\n                if (bMonitorOverride == 1 || !bMonitorOverride) {\n                    POINT pt;\n                    if (!bMonitorOverride) GetCursorPos(&pt);\n                    else {\n                        pt.x = 0; pt.y = 0;\n                    }\n                    hMonitorOfStartMenu = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);\n                }\n                else {\n                    MonitorOverrideData mod;\n                    mod.cbIndex = 2;\n                    mod.dwIndex = bMonitorOverride;\n                    mod.hMonitor = NULL;\n                    EnumDisplayMonitors(NULL, NULL, ExtractMonitorByIndex, &mod);\n                    if (mod.hMonitor == NULL)\n                    {\n                        POINT pt; pt.x = 0; pt.y = 0;\n                        hMonitorOfStartMenu = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);\n                    }\n                    else\n                    {\n                        hMonitorOfStartMenu = mod.hMonitor;\n                    }\n                }\n\n                HWND hWndTemp = NULL;\n\n                HWND hShellTray_Wnd = FindWindowExW(NULL, NULL, L\"Shell_TrayWnd\", NULL);\n                if (hShellTray_Wnd && !hWndTaskbar && hMonitorOfStartMenu == MonitorFromWindow(hShellTray_Wnd, MONITOR_DEFAULTTOPRIMARY) && dwOldTaskbarAl)\n                {\n                    hWndTaskbar = hShellTray_Wnd;\n                }\n\n                if (!hWndTaskbar)\n                {\n                    do\n                    {\n                        hWndTemp = FindWindowExW(\n                            NULL,\n                            hWndTemp,\n                            L\"Shell_SecondaryTrayWnd\",\n                            NULL\n                        );\n                        if (hWndTemp && !hWndTaskbar && hMonitorOfStartMenu == MonitorFromWindow(hWndTemp, MONITOR_DEFAULTTOPRIMARY) && dwMMOldTaskbarAl)\n                        {\n                            hWndTaskbar = hWndTemp;\n                            break;\n                        }\n                    } while (hWndTemp);\n                }\n\n                if(!hWndTaskbar)\n                {\n                    hWndTaskbar = hShellTray_Wnd;\n                }\n            }\n            MONITORINFO mi;\n            ZeroMemory(&mi, sizeof(MONITORINFO));\n            mi.cbSize = sizeof(MONITORINFO);\n            GetMonitorInfoW(MonitorFromWindow(hWndTaskbar ? hWndTaskbar : hWnd, MONITOR_DEFAULTTOPRIMARY), &mi);\n            DWORD dwPos = 0;\n            RECT rcC;\n            if (hWndTaskbar)\n            {\n                GetWindowRect(hWndTaskbar, &rcC);\n                rcC.left -= mi.rcMonitor.left;\n                rcC.right -= mi.rcMonitor.left;\n                rcC.top -= mi.rcMonitor.top;\n                rcC.bottom -= mi.rcMonitor.top;\n                if (rcC.left < 5 && rcC.top > 5)\n                {\n                    dwPos = TB_POS_BOTTOM;\n                }\n                else if (rcC.left < 5 && rcC.top < 5 && rcC.right > rcC.bottom)\n                {\n                    dwPos = TB_POS_TOP;\n                }\n                else if (rcC.left < 5 && rcC.top < 5 && rcC.right < rcC.bottom)\n                {\n                    dwPos = TB_POS_LEFT;\n                }\n                else if (rcC.left > 5 && rcC.top < 5)\n                {\n                    dwPos = TB_POS_RIGHT;\n                }\n            }\n            RECT rc;\n            if (dwStartShowClassicMode)\n            {\n                LVT_StartUI_EnableRoundedCorners(hWnd, StartUI_EnableRoundedCorners, dwPos, hWndTaskbar, &rc);\n                if (!StartUI_EnableRoundedCorners)\n                {\n                    StartUI_EnableRoundedCornersApply = FALSE;\n                }\n            }\n            else\n            {\n                LVT_StartDocked_DisableRecommendedSection(hWnd, StartDocked_DisableRecommendedSection, &rc);\n                //StartDocked_DisableRecommendedSectionApply = FALSE;\n            }\n            if (hWndTaskbar)\n            {\n                if (rcC.left < 5 && rcC.top > 5)\n                {\n                    if (dwStartShowClassicMode)\n                    {\n                        SetWindowPos(hWnd, NULL, mi.rcMonitor.left + (((mi.rcMonitor.right - mi.rcMonitor.left) - (rc.right - rc.left)) / 2), mi.rcMonitor.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                    }\n                    else\n                    {\n                        // Windows 11 Start menu knows how to center itself when the taskbar is at the bottom of the screen\n                        SetWindowPos(hWnd, NULL, mi.rcMonitor.left, mi.rcMonitor.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                    }\n                }\n                else if (rcC.left < 5 && rcC.top < 5 && rcC.right > rcC.bottom)\n                {\n                    SetWindowPos(hWnd, NULL, mi.rcMonitor.left + (((mi.rcMonitor.right - mi.rcMonitor.left) - (rc.right - rc.left)) / 2), mi.rcMonitor.top + (rcC.bottom - rcC.top), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                }\n                else if (rcC.left < 5 && rcC.top < 5 && rcC.right < rcC.bottom)\n                {\n                    SetWindowPos(hWnd, NULL, mi.rcMonitor.left + (rcC.right - rcC.left), mi.rcMonitor.top + (((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rc.bottom - rc.top)) / 2), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                }\n                else if (rcC.left > 5 && rcC.top < 5)\n                {\n                    SetWindowPos(hWnd, NULL, mi.rcMonitor.left, mi.rcMonitor.top + (((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rc.bottom - rc.top)) / 2), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n                }\n            }\n            else\n            {\n                SetWindowPos(hWnd, NULL, mi.rcWork.left, mi.rcWork.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);\n            }\n        }\n        if (bIsWindowVisible && dwStartShowClassicMode && IsWindows11Version22H2Build2134OrHigher())\n        {\n            extern void NeedsRo_SyncSettingsFromRegToCDS();\n            NeedsRo_SyncSettingsFromRegToCDS();\n        }\n    }\n    return SetWindowRgn(hWnd, hRgn, bRedraw);\n}\n\nint WINAPI SetupMessage(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)\n{\n    return 0;\n    LPCWSTR lpOldText = lpText;\n    LPCWSTR lpOldCaption = lpCaption;\n    wchar_t wszText[MAX_PATH];\n    ZeroMemory(wszText, MAX_PATH * sizeof(wchar_t));\n    wchar_t wszCaption[MAX_PATH];\n    ZeroMemory(wszCaption, MAX_PATH * sizeof(wchar_t));\n    LoadStringW(hModule, IDS_PRODUCTNAME, wszCaption, MAX_PATH);\n    switch (Code)\n    {\n    case 1:\n        LoadStringW(hModule, IDS_INSTALL_SUCCESS_TEXT, wszText, MAX_PATH);\n        break;\n    case -1:\n        LoadStringW(hModule, IDS_INSTALL_ERROR_TEXT, wszText, MAX_PATH);\n        break;\n    case 2:\n        LoadStringW(hModule, IDS_UNINSTALL_SUCCESS_TEXT, wszText, MAX_PATH);\n        break;\n    case -2:\n        LoadStringW(hModule, IDS_UNINSTALL_ERROR_TEXT, wszText, MAX_PATH);\n        break;\n    default:\n        LoadStringW(hModule, IDS_OPERATION_NONE, wszText, MAX_PATH);\n        break;\n    }\n    int ret = MessageBoxW(hWnd, wszText, wszCaption, uType);\n    lpText = lpOldText;\n    lpOldCaption = lpOldCaption;\n    return ret;\n}\n\nvoid Setup_Regsvr32(BOOL bInstall)\n{\n    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);\n\n    if (!IsAppRunningAsAdminMode())\n    {\n        wchar_t wszPath[MAX_PATH];\n        ZeroMemory(wszPath, ARRAYSIZE(wszPath));\n        wchar_t wszCurrentDirectory[MAX_PATH];\n        ZeroMemory(wszCurrentDirectory, ARRAYSIZE(wszCurrentDirectory));\n        if (GetModuleFileNameW(NULL, wszPath, ARRAYSIZE(wszPath)) &&\n            GetCurrentDirectoryW(ARRAYSIZE(wszCurrentDirectory), wszCurrentDirectory + (bInstall ? 1 : 4)))\n        {\n            wszCurrentDirectory[0] = L'\"';\n            if (!bInstall)\n            {\n                wszCurrentDirectory[0] = L'/';\n                wszCurrentDirectory[1] = L'u';\n                wszCurrentDirectory[2] = L' ';\n                wszCurrentDirectory[3] = L'\"';\n            }\n#if defined(_M_X64)\n            wcscat_s(wszCurrentDirectory, ARRAYSIZE(wszCurrentDirectory), L\"\\\\ExplorerPatcher.amd64.dll\\\"\");\n#elif defined(_M_ARM64)\n            wcscat_s(wszCurrentDirectory, ARRAYSIZE(wszCurrentDirectory), L\"\\\\ExplorerPatcher.arm64.dll\\\"\");\n#else\n#error \"Unsupported architecture\"\n#endif\n            SHELLEXECUTEINFOW sei;\n            ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\n            sei.cbSize = sizeof(sei);\n            sei.lpVerb = L\"runas\";\n            sei.lpFile = wszPath;\n            sei.lpParameters = wszCurrentDirectory;\n            sei.hwnd = NULL;\n            sei.nShow = SW_NORMAL;\n            if (!ShellExecuteExW(&sei))\n            {\n                DWORD dwError = GetLastError();\n                if (dwError == ERROR_CANCELLED)\n                {\n                    wchar_t wszText[MAX_PATH];\n                    ZeroMemory(wszText, MAX_PATH * sizeof(wchar_t));\n                    wchar_t wszCaption[MAX_PATH];\n                    ZeroMemory(wszCaption, MAX_PATH * sizeof(wchar_t));\n                    LoadStringW(hModule, IDS_PRODUCTNAME, wszCaption, MAX_PATH);\n                    LoadStringW(hModule, IDS_INSTALL_ERROR_TEXT, wszText, MAX_PATH);\n                    MessageBoxW(0, wszText, wszCaption, MB_ICONINFORMATION);\n                }\n            }\n            exit(0);\n        }\n    }\n\n    VnPatchDelayIAT(GetModuleHandle(NULL), \"ext-ms-win-ntuser-dialogbox-l1-1-0.dll\", \"MessageBoxW\", SetupMessage);\n}\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllRegisterServer=_DllRegisterServer\")\n#endif\nHRESULT WINAPI _DllRegisterServer()\n{\n    DWORD dwLastError = ERROR_SUCCESS;\n    HKEY hKey = NULL;\n    DWORD dwSize = 0;\n    wchar_t wszFilename[MAX_PATH];\n    wchar_t wszInstallPath[MAX_PATH];\n\n    Setup_Regsvr32(TRUE);\n\n    if (!dwLastError)\n    {\n        if (!GetModuleFileNameW(hModule, wszFilename, MAX_PATH))\n        {\n            dwLastError = GetLastError();\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID) L\"\\\\InProcServer32\",\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                wszFilename,\n                (wcslen(wszFilename) + 1) * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"ThreadingModel\",\n                0,\n                REG_SZ,\n                L\"Apartment\",\n                10 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n    }\n    if (!dwLastError)\n    {\n        PathRemoveExtensionW(wszFilename);\n        PathRemoveExtensionW(wszFilename);\n        wcscat_s(wszFilename, MAX_PATH, L\".IA-32.dll\");\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\WOW6432Node\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID) L\"\\\\InProcServer32\",\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                wszFilename,\n                (wcslen(wszFilename) + 1) * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"ThreadingModel\",\n                0,\n                REG_SZ,\n                L\"Apartment\",\n                10 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Classes\\\\Drive\\\\shellex\\\\FolderExtensions\\\\\" TEXT(EP_CLSID),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            DWORD dwDriveMask = 255;\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"DriveMask\",\n                0,\n                REG_DWORD,\n                &dwDriveMask,\n                sizeof(DWORD)\n            );\n            RegCloseKey(hKey);\n        }\n    }\n    /*if (!dwLastError)\n    {\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Browser Helper Objects\\\\\" TEXT(EP_CLSID),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            DWORD dwNoInternetExplorer = 1;\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"NoInternetExplorer\",\n                0,\n                REG_DWORD,\n                &dwNoInternetExplorer,\n                sizeof(DWORD)\n            );\n            RegCloseKey(hKey);\n        }\n    }*/\n    Code = 1;\n    if (dwLastError) Code = -Code;\n\n    //ZZRestartExplorer(0, 0, 0, 0);\n\n    return dwLastError == 0 ? S_OK : HRESULT_FROM_WIN32(dwLastError);\n}\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllUnregisterServer=_DllUnregisterServer\")\n#endif\nHRESULT WINAPI _DllUnregisterServer()\n{\n    DWORD dwLastError = ERROR_SUCCESS;\n    HKEY hKey = NULL;\n    DWORD dwSize = 0;\n    wchar_t wszFilename[MAX_PATH];\n\n    Setup_Regsvr32(FALSE);\n\n    if (!dwLastError)\n    {\n        if (!GetModuleFileNameW(hModule, wszFilename, MAX_PATH))\n        {\n            dwLastError = GetLastError();\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    L\"SOFTWARE\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID)\n                );\n            }\n        }\n    }\n    if (!dwLastError)\n    {\n        PathRemoveExtensionW(wszFilename);\n        PathRemoveExtensionW(wszFilename);\n        wcscat_s(wszFilename, MAX_PATH, L\".IA-32.dll\");\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\WOW6432Node\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    L\"SOFTWARE\\\\WOW6432Node\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID)\n                );\n            }\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Classes\\\\Drive\\\\shellex\\\\FolderExtensions\\\\\" TEXT(EP_CLSID),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    L\"SOFTWARE\\\\Classes\\\\Drive\\\\shellex\\\\FolderExtensions\\\\\" TEXT(EP_CLSID)\n                );\n            }\n        }\n    }\n    /*if (!dwLastError)\n    {\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Browser Helper Objects\\\\\" TEXT(EP_CLSID),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Browser Helper Objects\\\\\" TEXT(EP_CLSID)\n                );\n            }\n        }\n    }*/\n    Code = 2;\n    if (dwLastError) Code = -Code;\n\n    //ZZRestartExplorer(0, 0, 0, 0);\n\n    return dwLastError == 0 ? S_OK : HRESULT_FROM_WIN32(dwLastError);\n}\n#endif\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllCanUnloadNow=_DllCanUnloadNow\")\n#else\n#pragma comment(linker, \"/export:DllCanUnloadNow=__DllCanUnloadNow@0\")\n#endif\nHRESULT WINAPI _DllCanUnloadNow()\n{\n    return S_FALSE;\n}\n\nDWORD InjectStartMenu()\n{\n#if WITH_MAIN_PATCHER\n    funchook = funchook_create();\n\n    HANDLE hStartDocked = NULL;\n    HANDLE hStartUI = NULL;\n\n    if (!IsWindows11()) dwTaskbarAl = 0;\n\n    StartMenu_LoadSettings(FALSE);\n\n    if (dwStartShowClassicMode || !IsWindows11())\n    {\n        hStartUI = LoadLibraryW(L\"StartUI.dll\");\n        if (!hStartUI)\n            hStartUI = LoadLibraryW(L\"StartUI_.dll\");\n\n        // Fixes hang when Start menu closes\n        VnPatchDelayIAT(hStartUI, \"ext-ms-win-ntuser-draw-l1-1-0.dll\", \"SetWindowRgn\", Start_SetWindowRgn);\n\n        if (IsWindows11())\n        {\n            // Fixes Pin to Start/Unpin from Start\n            PatchAppResolver();\n            PatchStartTileData(TRUE);\n\n            // Fixes context menu crashes\n            StartMenu_FixContextMenuXbfHijackMethod();\n\n            // Fixes user tile menu\n            PBYTE pStartUIText;\n            DWORD cbStartUIText;\n            if (TextSectionBeginAndSize(hStartUI, &pStartUIText, &cbStartUIText))\n            {\n                StartMenu_FixUserTileMenu(pStartUIText, cbStartUIText);\n            }\n\n            // Enables \"Show more tiles\" setting\n            LoadLibraryW(L\"Windows.CloudStore.dll\");\n            HANDLE hWindowsCloudStore = GetModuleHandleW(L\"Windows.CloudStore.dll\");\n            VnPatchIAT(hWindowsCloudStore, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegOpenKeyExW\", StartUI_RegOpenKeyExW);\n            VnPatchIAT(hWindowsCloudStore, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegQueryValueExW\", StartUI_RegQueryValueExW);\n            VnPatchIAT(hWindowsCloudStore, \"api-ms-win-core-registry-l1-1-0.dll\", \"RegCloseKey\", StartUI_RegCloseKey);\n        }\n    }\n    else\n    {\n        LoadLibraryW(L\"StartDocked.dll\");\n        hStartDocked = GetModuleHandleW(L\"StartDocked.dll\");\n\n        VnPatchDelayIAT(hStartDocked, \"ext-ms-win-ntuser-draw-l1-1-0.dll\", \"SetWindowRgn\", Start_SetWindowRgn);\n    }\n\n    Setting* settings = calloc(6, sizeof(Setting));\n    settings[0].callback = NULL;\n    settings[0].data = NULL;\n    settings[0].hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);\n    settings[0].hKey = NULL;\n    ZeroMemory(settings[0].name, MAX_PATH);\n    settings[0].origin = NULL;\n    settings[1].callback = StartMenu_LoadSettings;\n    settings[1].data = FALSE;\n    settings[1].hEvent = NULL;\n    settings[1].hKey = NULL;\n    wcscpy_s(settings[1].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StartPage\");\n    settings[1].origin = HKEY_CURRENT_USER;\n    settings[2].callback = StartMenu_LoadSettings;\n    settings[2].data = TRUE;\n    settings[2].hEvent = NULL;\n    settings[2].hKey = NULL;\n    wcscpy_s(settings[2].name, MAX_PATH, TEXT(REGPATH_STARTMENU));\n    settings[2].origin = HKEY_CURRENT_USER;\n    settings[3].callback = StartMenu_LoadSettings;\n    settings[3].data = TRUE;\n    settings[3].hEvent = NULL;\n    settings[3].hKey = NULL;\n    wcscpy_s(settings[3].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\");\n    settings[3].origin = HKEY_CURRENT_USER;\n    settings[4].callback = StartMenu_LoadSettings;\n    settings[4].data = TRUE;\n    settings[4].hEvent = NULL;\n    settings[4].hKey = NULL;\n    wcscpy_s(settings[4].name, MAX_PATH, L\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Explorer\");\n    settings[4].origin = HKEY_CURRENT_USER;\n    settings[5].callback = StartMenu_LoadSettings;\n    settings[5].data = TRUE;\n    settings[5].hEvent = NULL;\n    settings[5].hKey = NULL;\n    wcscpy_s(settings[5].name, MAX_PATH, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\Explorer\");\n    settings[5].origin = HKEY_CURRENT_USER;\n\n    SettingsChangeParameters* params = calloc(1, sizeof(SettingsChangeParameters));\n    params->settings = settings;\n    params->size = 6;\n    CreateThread(\n        0,\n        0,\n        MonitorSettings,\n        params,\n        0,\n        0\n    );\n\n    int rv;\n    DWORD dwVal0 = 0, dwVal1 = 0, dwVal2 = 0, dwVal3 = 0, dwVal4 = 0;\n\n    HMODULE hModule = LoadLibraryExW(L\"Shlwapi.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hModule)\n    {\n        DWORD dwStatus = 0, dwSize = sizeof(DWORD);\n        t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLM = GetProcAddress(hModule, \"SHRegGetValueFromHKCUHKLM\");\n\n        if (SHRegGetValueFromHKCUHKLM)\n        {\n            dwSize = sizeof(DWORD);\n            SHRegGetValueFromHKCUHKLM(\n                TEXT(REGPATH_STARTMENU) TEXT(\"\\\\\") TEXT(STARTDOCKED_SB_NAME),\n                TEXT(STARTDOCKED_SB_0),\n                SRRF_RT_REG_DWORD,\n                NULL,\n                &dwVal0,\n                &dwSize\n            );\n            SHRegGetValueFromHKCUHKLM(\n                TEXT(REGPATH_STARTMENU) TEXT(\"\\\\\") TEXT(STARTDOCKED_SB_NAME),\n                TEXT(STARTDOCKED_SB_1),\n                SRRF_RT_REG_DWORD,\n                NULL,\n                &dwVal1,\n                &dwSize\n            );\n            SHRegGetValueFromHKCUHKLM(\n                TEXT(REGPATH_STARTMENU) TEXT(\"\\\\\") TEXT(STARTDOCKED_SB_NAME),\n                TEXT(STARTDOCKED_SB_2),\n                SRRF_RT_REG_DWORD,\n                NULL,\n                &dwVal2,\n                &dwSize\n            );\n            SHRegGetValueFromHKCUHKLM(\n                TEXT(REGPATH_STARTMENU) TEXT(\"\\\\\") TEXT(STARTDOCKED_SB_NAME),\n                TEXT(STARTDOCKED_SB_3),\n                SRRF_RT_REG_DWORD,\n                NULL,\n                &dwVal3,\n                &dwSize\n            );\n            SHRegGetValueFromHKCUHKLM(\n                TEXT(REGPATH_STARTMENU) TEXT(\"\\\\\") TEXT(STARTUI_SB_NAME),\n                TEXT(STARTUI_SB_0),\n                SRRF_RT_REG_DWORD,\n                NULL,\n                &dwVal4,\n                &dwSize\n            );\n        }\n        FreeLibrary(hModule);\n    }\n\n    if (dwVal1 && dwVal1 != 0xFFFFFFFF && hStartDocked)\n    {\n        StartDocked_LauncherFrame_ShowAllAppsFunc = (INT64(*)(void*))\n            ((uintptr_t)hStartDocked + dwVal1);\n    }\n    if (dwVal2 && dwVal2 != 0xFFFFFFFF && hStartDocked)\n    {\n        StartDocked_LauncherFrame_OnVisibilityChangedFunc = (INT64(*)(void*, INT64, void*))\n            ((uintptr_t)hStartDocked + dwVal2);\n        rv = funchook_prepare(\n            funchook,\n            (void**)&StartDocked_LauncherFrame_OnVisibilityChangedFunc,\n            StartDocked_LauncherFrame_OnVisibilityChangedHook\n        );\n        if (rv != 0)\n        {\n            FreeLibraryAndExitThread(hModule, rv);\n            return rv;\n        }\n    }\n    if (dwVal3 && dwVal3 != 0xFFFFFFFF && hStartDocked)\n    {\n        StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*))\n            ((uintptr_t)hStartDocked + dwVal3);\n        rv = funchook_prepare(\n            funchook,\n            (void**)&StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsFunc,\n            StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsHook\n        );\n        if (rv != 0)\n        {\n            FreeLibraryAndExitThread(hModule, rv);\n            return rv;\n        }\n    }\n    if (dwVal4 && dwVal4 != 0xFFFFFFFF && hStartUI)\n    {\n        StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*))\n            ((uintptr_t)hStartUI + dwVal4);\n        rv = funchook_prepare(\n            funchook,\n            (void**)&StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsFunc,\n            StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsHook\n        );\n        if (rv != 0)\n        {\n            FreeLibraryAndExitThread(hModule, rv);\n            return rv;\n        }\n    }\n\n    rv = funchook_install(funchook, 0);\n    if (rv != 0)\n    {\n        FreeLibraryAndExitThread(hModule, rv);\n        return rv;\n    }\n    funchook_destroy(funchook);\n    funchook = NULL;\n#endif\n    return 0;\n}\n\nvoid InjectShellExperienceHost();\n\n#if WITH_MAIN_PATCHER\nbool IsUserOOBE()\n{\n    BOOL b = FALSE;\n    SHRegGetBOOLWithREGSAM(\n        HKEY_LOCAL_MACHINE,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\OOBE\",\n        L\"LaunchUserOOBE\",\n        0,\n        &b\n    );\n    return b;\n}\n\nbool IsCredentialReset()\n{\n    BOOL b = FALSE;\n    SHRegGetBOOLWithREGSAM(\n        HKEY_LOCAL_MACHINE,\n        L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Authentication\\\\CFL\\\\ExperienceManagerData\",\n        L\"LaunchCflScenario\",\n        0,\n        &b\n    );\n    return b;\n}\n\nbool IsUserOOBEOrCredentialReset()\n{\n    return IsUserOOBE() || IsCredentialReset();\n}\n#endif\n\n#define DLL_INJECTION_METHOD_DXGI 0\n#define DLL_INJECTION_METHOD_COM 1\n#define DLL_INJECTION_METHOD_START_INJECTION 2\nHRESULT EntryPoint(DWORD dwMethod)\n{\n    if (bInstanced)\n    {\n        return E_NOINTERFACE;\n    }\n\n    InitializeGlobalVersionAndUBR();\n\n    TCHAR exePath[MAX_PATH], dllName[MAX_PATH];\n    GetModuleFileNameW(hModule, dllName, MAX_PATH);\n    PathStripPathW(dllName);\n    BOOL bIsDllNameDXGI = !_wcsicmp(dllName, L\"dxgi.dll\");\n    if (dwMethod == DLL_INJECTION_METHOD_DXGI && !bIsDllNameDXGI)\n    {\n        return E_NOINTERFACE;\n    }\n\n    HANDLE hProcess = OpenProcess(\n        PROCESS_QUERY_INFORMATION,\n        FALSE,\n        GetCurrentProcessId()\n    );\n    if (!hProcess)\n    {\n        return E_NOINTERFACE;\n    }\n    DWORD dwLength = MAX_PATH;\n    QueryFullProcessImageNameW(\n        hProcess,\n        0,\n        exePath,\n        &dwLength\n    );\n    CloseHandle(hProcess);\n\n    TCHAR wszSearchIndexerPath[MAX_PATH];\n    GetSystemDirectoryW(wszSearchIndexerPath, MAX_PATH);\n    wcscat_s(wszSearchIndexerPath, MAX_PATH, L\"\\\\SearchIndexer.exe\");\n    if (!_wcsicmp(exePath, wszSearchIndexerPath))\n    {\n        return E_NOINTERFACE;\n    }\n\n    TCHAR wszExplorerExpectedPath[MAX_PATH];\n    GetWindowsDirectoryW(wszExplorerExpectedPath, MAX_PATH);\n    wcscat_s(wszExplorerExpectedPath, MAX_PATH, L\"\\\\explorer.exe\");\n    BOOL bIsThisExplorer = !_wcsicmp(exePath, wszExplorerExpectedPath);\n\n    TCHAR wszStartExpectedPath[MAX_PATH];\n    GetWindowsDirectoryW(wszStartExpectedPath, MAX_PATH);\n    wcscat_s(wszStartExpectedPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartMenuExperienceHost.exe\");\n    BOOL bIsThisStartMEH = !_wcsicmp(exePath, wszStartExpectedPath);\n\n    TCHAR wszShellExpectedPath[MAX_PATH];\n    GetWindowsDirectoryW(wszShellExpectedPath, MAX_PATH);\n    wcscat_s(wszShellExpectedPath, MAX_PATH, L\"\\\\SystemApps\\\\ShellExperienceHost_cw5n1h2txyewy\\\\ShellExperienceHost.exe\");\n    BOOL bIsThisShellEH = !_wcsicmp(exePath, wszShellExpectedPath);\n\n    if (dwMethod == DLL_INJECTION_METHOD_DXGI)\n    {\n        if (!(bIsThisExplorer || bIsThisStartMEH || bIsThisShellEH))\n        {\n            return E_NOINTERFACE;\n        }\n    }\n    if (dwMethod == DLL_INJECTION_METHOD_COM && (bIsThisExplorer || bIsThisStartMEH || bIsThisShellEH))\n    {\n        return E_NOINTERFACE;\n    }\n    if (dwMethod == DLL_INJECTION_METHOD_START_INJECTION && !bIsThisStartMEH)\n    {\n        return E_NOINTERFACE;\n    }\n\n    bIsExplorerProcess = bIsThisExplorer;\n    if (bIsThisExplorer)\n    {\n#if WITH_MAIN_PATCHER\n        if (GetSystemMetrics(SM_CLEANBOOT) != 0 || IsUserOOBEOrCredentialReset())\n        {\n            IncrementDLLReferenceCount(hModule);\n            bInstanced = TRUE;\n            return E_NOINTERFACE;\n        }\n#endif\n        BOOL desktopExists = IsDesktopWindowAlreadyPresent();\n#if WITH_MAIN_PATCHER\n        if (!desktopExists && CrashCounterHandleEntryPoint())\n        {\n            IncrementDLLReferenceCount(hModule);\n            bInstanced = TRUE;\n            return E_NOINTERFACE;\n        }\n#endif\n        Inject(!desktopExists);\n        IncrementDLLReferenceCount(hModule);\n        bInstanced = TRUE;\n    }\n    else if (bIsThisStartMEH)\n    {\n        InjectStartMenu();\n#if WITH_MAIN_PATCHER\n        if (IsXamlSoundsEnabled())\n        {\n            HMODULE hWindowsUIXaml = LoadLibraryW(L\"Windows.UI.Xaml.dll\");\n            ForceEnableXamlSounds(hWindowsUIXaml);\n        }\n#endif\n        IncrementDLLReferenceCount(hModule);\n        bInstanced = TRUE;\n    }\n    else if (bIsThisShellEH)\n    {\n#if WITH_MAIN_PATCHER\n        InjectShellExperienceHost();\n        if (IsXamlSoundsEnabled())\n        {\n            HMODULE hWindowsUIXaml = LoadLibraryW(L\"Windows.UI.Xaml.dll\");\n            ForceEnableXamlSounds(hWindowsUIXaml);\n        }\n#endif\n        IncrementDLLReferenceCount(hModule);\n        bInstanced = TRUE;\n    }\n    else if (dwMethod == DLL_INJECTION_METHOD_COM)\n    {\n        Inject(FALSE);\n        IncrementDLLReferenceCount(hModule);\n        bInstanced = TRUE;\n    }\n\n    return E_NOINTERFACE;\n}\n\n#if WITH_MAIN_PATCHER\n// for explorer.exe and ShellExperienceHost.exe\n__declspec(dllexport) HRESULT DXGIDeclareAdapterRemovalSupport()\n{\n    EntryPoint(DLL_INJECTION_METHOD_DXGI);\n    return DXGIDeclareAdapterRemovalSupportOriginal();\n}\n// for StartMenuExperienceHost.exe via DXGI\n__declspec(dllexport) HRESULT CreateDXGIFactory1(void* p1, void** p2)\n{\n    EntryPoint(DLL_INJECTION_METHOD_DXGI);\n    return CreateDXGIFactory1Original(p1, p2);\n}\n// for StartMenuExperienceHost.exe via injection from explorer\nHRESULT InjectStartFromExplorer()\n{\n    EntryPoint(DLL_INJECTION_METHOD_START_INJECTION);\n    return HRESULT_FROM_WIN32(GetLastError());\n}\n#endif\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllGetClassObject=_DllGetClassObject\")\n#else\n#pragma comment(linker, \"/export:DllGetClassObject=__DllGetClassObject@12\")\n#endif\n// for everything else\nHRESULT WINAPI _DllGetClassObject(\n    REFCLSID rclsid,\n    REFIID   riid,\n    LPVOID* ppv\n)\n{\n    return EntryPoint(DLL_INJECTION_METHOD_COM);\n}\n\nBOOL WINAPI DllMain(\n    _In_ HINSTANCE hinstDLL,\n    _In_ DWORD     fdwReason,\n    _In_ LPVOID    lpvReserved\n)\n{\n    switch (fdwReason)\n    {\n    case DLL_PROCESS_ATTACH:\n        DisableThreadLibraryCalls(hinstDLL);\n        hModule = hinstDLL;\n        break;\n    case DLL_THREAD_ATTACH:\n        break;\n    case DLL_THREAD_DETACH:\n        break;\n    case DLL_PROCESS_DETACH:\n        break;\n    }\n    return TRUE;\n}\n\n#if WITH_MAIN_PATCHER\n__declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\n{\n    // Forward to ep_gui.dll\n    LaunchPropertiesGUI(hModule);\n    return 0;\n}\n#endif\n"
  },
  {
    "path": "ExplorerPatcher/dxgi_imp.cpp",
    "content": "#include \"dxgi_imp.h\"\r\n\r\n#include <Windows.h>\r\n\r\nEXTERN_C_START\r\n\r\nvoid* SetupRealDXGIImportFunction(const char* pszName)\r\n{\r\n    static HMODULE hRealDXGI = []() -> HMODULE\r\n    {\r\n        TCHAR szRealDXGIPath[MAX_PATH];\r\n        GetSystemDirectoryW(szRealDXGIPath, MAX_PATH);\r\n        wcscat_s(szRealDXGIPath, MAX_PATH, L\"\\\\dxgi.dll\");\r\n        return LoadLibraryW(szRealDXGIPath);\r\n    }();\r\n    return hRealDXGI ? GetProcAddress(hRealDXGI, pszName) : nullptr;\r\n}\r\n\r\n#define DXGI_SETUP_FUNC(func) static func##_t func##Func = (func##_t)SetupRealDXGIImportFunction(#func)\r\n\r\ntypedef HRESULT (WINAPI *ApplyCompatResolutionQuirking_t)(UINT*, UINT*);\r\nHRESULT WINAPI ApplyCompatResolutionQuirking(UINT* p1, UINT* p2)\r\n{\r\n    DXGI_SETUP_FUNC(ApplyCompatResolutionQuirking);\r\n    return ApplyCompatResolutionQuirkingFunc(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *CompatString_t)(const char*, DWORD*, char*, bool);\r\nHRESULT WINAPI CompatString(const char* p1, DWORD* p2, char* p3, bool p4)\r\n{\r\n    DXGI_SETUP_FUNC(CompatString);\r\n    return CompatStringFunc(p1, p2, p3, p4);\r\n}\r\ntypedef HRESULT (WINAPI *CompatValue_t)(const char*, UINT64*);\r\nHRESULT WINAPI CompatValue(const char* p1, UINT64* p2)\r\n{\r\n    DXGI_SETUP_FUNC(CompatValue);\r\n    return CompatValueFunc(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *CreateDXGIFactory_t)(REFIID, void**);\r\nHRESULT WINAPI CreateDXGIFactory(REFIID p1, void** p2)\r\n{\r\n    DXGI_SETUP_FUNC(CreateDXGIFactory);\r\n    return CreateDXGIFactoryFunc(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *CreateDXGIFactory1_t)(REFIID, void**);\r\n/*__declspec(dllexport)*/ HRESULT WINAPI CreateDXGIFactory1Original(REFIID p1, void** p2)\r\n{\r\n    DXGI_SETUP_FUNC(CreateDXGIFactory1);\r\n    return CreateDXGIFactory1Func(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *CreateDXGIFactory2_t)(UINT, REFIID, void**);\r\nHRESULT WINAPI CreateDXGIFactory2(UINT p1, REFIID p2, void** p3)\r\n{\r\n    DXGI_SETUP_FUNC(CreateDXGIFactory2);\r\n    return CreateDXGIFactory2Func(p1, p2, p3);\r\n}\r\ntypedef HRESULT (WINAPI *DXGID3D10CreateDevice_t)();\r\nHRESULT WINAPI DXGID3D10CreateDevice()\r\n{\r\n    DXGI_SETUP_FUNC(DXGID3D10CreateDevice);\r\n    return DXGID3D10CreateDeviceFunc();\r\n}\r\ntypedef HRESULT (WINAPI *DXGID3D10CreateLayeredDevice_t)();\r\nHRESULT WINAPI DXGID3D10CreateLayeredDevice()\r\n{\r\n    DXGI_SETUP_FUNC(DXGID3D10CreateLayeredDevice);\r\n    return DXGID3D10CreateLayeredDeviceFunc();\r\n}\r\ntypedef HRESULT (WINAPI *DXGID3D10GetLayeredDeviceSize_t)();\r\nHRESULT WINAPI DXGID3D10GetLayeredDeviceSize()\r\n{\r\n    DXGI_SETUP_FUNC(DXGID3D10GetLayeredDeviceSize);\r\n    return DXGID3D10GetLayeredDeviceSizeFunc();\r\n}\r\ntypedef HRESULT (WINAPI *DXGID3D10RegisterLayers_t)();\r\nHRESULT WINAPI DXGID3D10RegisterLayers()\r\n{\r\n    DXGI_SETUP_FUNC(DXGID3D10RegisterLayers);\r\n    return DXGID3D10RegisterLayersFunc();\r\n}\r\ntypedef HRESULT (WINAPI *DXGIDeclareAdapterRemovalSupport_t)();\r\n/*__declspec(dllexport)*/ HRESULT WINAPI DXGIDeclareAdapterRemovalSupportOriginal()\r\n{\r\n    DXGI_SETUP_FUNC(DXGIDeclareAdapterRemovalSupport);\r\n    return DXGIDeclareAdapterRemovalSupportFunc();\r\n}\r\ntypedef HRESULT (WINAPI *DXGIDumpJournal_t)(void*);\r\nHRESULT WINAPI DXGIDumpJournal(void* p1)\r\n{\r\n    DXGI_SETUP_FUNC(DXGIDumpJournal);\r\n    return DXGIDumpJournalFunc(p1);\r\n}\r\ntypedef HRESULT (WINAPI *DXGIGetDebugInterface1_t)(UINT, REFIID, void**);\r\nHRESULT WINAPI DXGIGetDebugInterface1(UINT p1, REFIID p2, void** p3)\r\n{\r\n    DXGI_SETUP_FUNC(DXGIGetDebugInterface1);\r\n    return DXGIGetDebugInterface1Func(p1, p2, p3);\r\n}\r\ntypedef HRESULT (WINAPI *DXGIReportAdapterConfiguration_t)(void*);\r\nHRESULT WINAPI DXGIReportAdapterConfiguration(void* p1)\r\n{\r\n    DXGI_SETUP_FUNC(DXGIReportAdapterConfiguration);\r\n    return DXGIReportAdapterConfigurationFunc(p1);\r\n}\r\ntypedef HRESULT (WINAPI *PIXBeginCapture_t)(UINT, void*);\r\nHRESULT WINAPI PIXBeginCapture(UINT p1, void* p2)\r\n{\r\n    DXGI_SETUP_FUNC(PIXBeginCapture);\r\n    return PIXBeginCaptureFunc(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *PIXEndCapture_t)();\r\nHRESULT WINAPI PIXEndCapture()\r\n{\r\n    DXGI_SETUP_FUNC(PIXEndCapture);\r\n    return PIXEndCaptureFunc();\r\n}\r\ntypedef HRESULT (WINAPI *PIXGetCaptureState_t)();\r\nHRESULT WINAPI PIXGetCaptureState()\r\n{\r\n    DXGI_SETUP_FUNC(PIXGetCaptureState);\r\n    return PIXGetCaptureStateFunc();\r\n}\r\ntypedef HRESULT (WINAPI *SetAppCompatStringPointer_t)(SIZE_T, const char*);\r\nHRESULT WINAPI SetAppCompatStringPointer(SIZE_T p1, const char* p2)\r\n{\r\n    DXGI_SETUP_FUNC(SetAppCompatStringPointer);\r\n    return SetAppCompatStringPointerFunc(p1, p2);\r\n}\r\ntypedef HRESULT (WINAPI *UpdateHMDEmulationStatus_t)(bool);\r\nHRESULT WINAPI UpdateHMDEmulationStatus(bool p1)\r\n{\r\n    DXGI_SETUP_FUNC(UpdateHMDEmulationStatus);\r\n    return UpdateHMDEmulationStatusFunc(p1);\r\n}\r\n\r\nEXTERN_C_END\r\n"
  },
  {
    "path": "ExplorerPatcher/dxgi_imp.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\nEXTERN_C_START\r\n\r\n__declspec(dllexport) HRESULT WINAPI ApplyCompatResolutionQuirking(UINT* p1, UINT* p2);\r\n__declspec(dllexport) HRESULT WINAPI CompatString(const char* p1, DWORD* p2, char* p3, bool p4);\r\n__declspec(dllexport) HRESULT WINAPI CompatValue(const char* p1, UINT64* p2);\r\n__declspec(dllexport) HRESULT WINAPI CreateDXGIFactory(REFIID p1, void** p2);\r\n__declspec(dllexport) HRESULT WINAPI CreateDXGIFactory1Original(REFIID p1, void** p2);\r\n__declspec(dllexport) HRESULT WINAPI CreateDXGIFactory2(UINT p1, REFIID p2, void** p3);\r\n__declspec(dllexport) HRESULT WINAPI DXGID3D10CreateDevice();\r\n__declspec(dllexport) HRESULT WINAPI DXGID3D10CreateLayeredDevice();\r\n__declspec(dllexport) HRESULT WINAPI DXGID3D10GetLayeredDeviceSize();\r\n__declspec(dllexport) HRESULT WINAPI DXGID3D10RegisterLayers();\r\n__declspec(dllexport) HRESULT WINAPI DXGIDeclareAdapterRemovalSupportOriginal();\r\n__declspec(dllexport) HRESULT WINAPI DXGIDumpJournal(void* p1);\r\n__declspec(dllexport) HRESULT WINAPI DXGIGetDebugInterface1(UINT p1, REFIID p2, void** p3);\r\n__declspec(dllexport) HRESULT WINAPI DXGIReportAdapterConfiguration(void* p1);\r\n__declspec(dllexport) HRESULT WINAPI PIXBeginCapture(UINT p1, void* p2);\r\n__declspec(dllexport) HRESULT WINAPI PIXEndCapture();\r\n__declspec(dllexport) HRESULT WINAPI PIXGetCaptureState();\r\n__declspec(dllexport) HRESULT WINAPI SetAppCompatStringPointer(SIZE_T p1, const char* p2);\r\n__declspec(dllexport) HRESULT WINAPI UpdateHMDEmulationStatus(bool p1);\r\n\r\nEXTERN_C_END\r\n"
  },
  {
    "path": "ExplorerPatcher/fmemopen.c",
    "content": "/*\r\n * Copyright (c) 2017  Joachim Nilsson <troglobit@gmail.com>\r\n *\r\n * Permission to use, copy, modify, and/or distribute this software for any\r\n * purpose with or without fee is hereby granted, provided that the above\r\n * copyright notice and this permission notice appear in all copies.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\r\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\r\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\r\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\r\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\r\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\r\n */\r\n\r\n#include \"fmemopen.h\"\r\n\r\nFILE* fmemopen(void* buf, size_t len, const char* type)\r\n{\r\n\tint fd;\r\n\tFILE* fp;\r\n\tchar tp[MAX_PATH - 13];\r\n\tchar fn[MAX_PATH + 1];\r\n\r\n\tif (!GetTempPathA(sizeof(tp), tp))\r\n\t\treturn NULL;\r\n\r\n\tif (!GetTempFileNameA(tp, \"eptmp\", 0, fn))\r\n\t\treturn NULL;\r\n\r\n\t_sopen_s(&fd, fn,\r\n\t\t_O_CREAT | _O_RDWR | _O_SHORT_LIVED | _O_TEMPORARY | _O_BINARY,\r\n\t\t_SH_DENYRW,\r\n\t\t_S_IREAD | _S_IWRITE);\r\n\tif (fd == -1)\r\n\t\treturn NULL;\r\n\r\n\tfp = _fdopen(fd, \"w+\");\r\n\tif (!fp) {\r\n\t\t_close(fd);\r\n\t\treturn NULL;\r\n\t}\r\n\r\n\tfwrite(buf, len, 1, fp);\r\n\trewind(fp);\r\n\r\n\treturn fp;\r\n}"
  },
  {
    "path": "ExplorerPatcher/fmemopen.h",
    "content": "#ifndef _H_FMEMOPEN_H_\r\n#define _H_FMEMOPEN_H_\r\n#include <stdio.h>\r\n#include <io.h>\r\n#include <fcntl.h>\r\n#include <windows.h>\r\n#include <sys/stat.h>\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nFILE* fmemopen(void* buf, size_t len, const char* type);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/getline.c",
    "content": "/*-\r\n * Copyright (c) 2011 The NetBSD Foundation, Inc.\r\n * All rights reserved.\r\n *\r\n * This code is derived from software contributed to The NetBSD Foundation\r\n * by Christos Zoulas.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n * 1. Redistributions of source code must retain the above copyright\r\n *    notice, this list of conditions and the following disclaimer.\r\n * 2. Redistributions in binary form must reproduce the above copyright\r\n *    notice, this list of conditions and the following disclaimer in the\r\n *    documentation and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n#include \"getline.h\"\r\n\r\nssize_t\r\ngetdelim(char** buf, size_t* bufsiz, int delimiter, FILE* fp)\r\n{\r\n\tchar* ptr, * eptr;\r\n\r\n\r\n\tif (*buf == NULL || *bufsiz == 0) {\r\n\t\t*bufsiz = BUFSIZ;\r\n\t\tif ((*buf = (char*)malloc(*bufsiz)) == NULL)\r\n\t\t\treturn -1;\r\n\t}\r\n\r\n\tfor (ptr = *buf, eptr = *buf + *bufsiz;;) {\r\n\t\tint c = fgetc(fp);\r\n\t\tif (c == -1) {\r\n\t\t\tif (feof(fp)) {\r\n\t\t\t\tssize_t diff = (ssize_t)(ptr - *buf);\r\n\t\t\t\tif (diff != 0) {\r\n\t\t\t\t\t*ptr = '\\0';\r\n\t\t\t\t\treturn diff;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\t*ptr++ = c;\r\n\t\tif (c == delimiter) {\r\n\t\t\t*ptr = '\\0';\r\n\t\t\treturn ptr - *buf;\r\n\t\t}\r\n\t\tif (ptr + 2 >= eptr) {\r\n\t\t\tchar* nbuf;\r\n\t\t\tsize_t nbufsiz = *bufsiz * 2;\r\n\t\t\tssize_t d = ptr - *buf;\r\n\t\t\tif ((nbuf = (char*)realloc(*buf, nbufsiz)) == NULL)\r\n\t\t\t\treturn -1;\r\n\t\t\t*buf = nbuf;\r\n\t\t\t*bufsiz = nbufsiz;\r\n\t\t\teptr = nbuf + nbufsiz;\r\n\t\t\tptr = nbuf + d;\r\n\t\t}\r\n\t}\r\n}\r\n\r\nssize_t\r\ngetline(char** buf, size_t* bufsiz, FILE* fp)\r\n{\r\n\treturn getdelim(buf, bufsiz, '\\n', fp);\r\n}"
  },
  {
    "path": "ExplorerPatcher/getline.h",
    "content": "#ifndef _H_GETLINE_H_\r\n#define _H_GETLINE_H_\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <BaseTsd.h>\r\ntypedef SSIZE_T ssize_t;\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nssize_t getdelim(char** buf, size_t* bufsiz, int delimiter, FILE* fp);\r\n\r\nssize_t getline(char** buf, size_t* bufsiz, FILE* fp);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/hooking.h",
    "content": "#ifndef _H_HOOKING_H_\r\n#define _H_HOOKING_H_\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\n#include <KNSoft/SlimDetours/SlimDetours.h>\r\n\r\ntypedef struct funchook funchook_t;\r\n\r\ninline funchook_t* funchook_create(void)\r\n{\r\n    return (funchook_t*)1;\r\n}\r\n\r\ninline int funchook_uninstall(\r\n    funchook_t* _this,\r\n    int flags\r\n)\r\n{\r\n    return 0;\r\n}\r\n\r\ninline int funchook_destroy(funchook_t* _this)\r\n{\r\n    return 0;\r\n}\r\n\r\ninline int funchook_prepare(\r\n    funchook_t* funchook,\r\n    void** target_func,\r\n    void* hook_func\r\n)\r\n{\r\n    HRESULT hr = SlimDetoursInlineHook(TRUE, target_func, hook_func);\r\n    return SUCCEEDED(hr) ? 0 : hr;\r\n}\r\n\r\ninline int funchook_install(\r\n    funchook_t* funchook,\r\n    int flags\r\n)\r\n{\r\n    return 0;\r\n}\r\n\r\n#ifdef __cplusplus\r\n} // extern \"C\"\r\n#endif\r\n\r\n#endif\r\n\r\n#define HOOKING_SUCCESS 0\r\n\r\n#ifdef __cplusplus\r\nextern \"C\"\r\n{\r\n#endif\r\n\r\nDECLSPEC_SELECTANY funchook_t* funchook = NULL;\r\n\r\n#ifdef __cplusplus\r\n} // extern \"C\"\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/ClassicWinRtForwardDecl.h",
    "content": "#pragma once\r\n\r\n// Define Windows.Foundation.IReference`1<Windows.UI.Text.FontWeight>\r\n\r\n#ifndef DEF___FIReference_1_Windows__CUI__CText__CFontWeight_USE\r\n#define DEF___FIReference_1_Windows__CUI__CText__CFontWeight_USE\r\n#if !defined(RO_NO_TEMPLATE_NAME)\r\nnamespace ABI { namespace Windows { namespace Foundation {\r\ntemplate <>\r\nstruct __declspec(uuid(\"741446b3-9c81-5daa-b995-5bd67473492c\"))\r\nIReference<ABI::Windows::UI::Text::FontWeight> : IReference_impl<ABI::Windows::UI::Text::FontWeight>\r\n{\r\n    static const wchar_t* z_get_rc_name_impl()\r\n    {\r\n        return L\"Windows.Foundation.IReference`1<Windows.UI.Text.FontWeight>\";\r\n    }\r\n};\r\n// Define a typedef for the parameterized interface specialization's mangled name.\r\n// This allows code which uses the mangled name for the parameterized interface to access the\r\n// correct parameterized interface specialization.\r\ntypedef IReference<ABI::Windows::UI::Text::FontWeight> __FIReference_1_Windows__CUI__CText__CFontWeight_t;\r\n#define __FIReference_1_Windows__CUI__CText__CFontWeight ABI::Windows::Foundation::__FIReference_1_Windows__CUI__CText__CFontWeight_t\r\n/* Foundation */ } /* Windows */ } /* ABI */ }\r\n\r\n#endif // !defined(RO_NO_TEMPLATE_NAME)\r\n#endif /* DEF___FIReference_1_Windows__CUI__CText__CFontWeight_USE */\r\n\r\n// Define Windows.Foundation.IReference`1<Windows.UI.Xaml.CornerRadius>\r\n\r\n#ifndef DEF___FIReference_1_Windows__CUI__CXaml__CCornerRadius_USE\r\n#define DEF___FIReference_1_Windows__CUI__CXaml__CCornerRadius_USE\r\n#if !defined(RO_NO_TEMPLATE_NAME)\r\nnamespace ABI { namespace Windows { namespace Foundation {\r\ntemplate <>\r\nstruct __declspec(uuid(\"96d922e6-a7ca-5c21-b9f7-e4504e8c7112\"))\r\nIReference<ABI::Windows::UI::Xaml::CornerRadius> : IReference_impl<ABI::Windows::UI::Xaml::CornerRadius>\r\n{\r\n    static const wchar_t* z_get_rc_name_impl()\r\n    {\r\n        return L\"Windows.Foundation.IReference`1<Windows.UI.Xaml.CornerRadius>\";\r\n    }\r\n};\r\n// Define a typedef for the parameterized interface specialization's mangled name.\r\n// This allows code which uses the mangled name for the parameterized interface to access the\r\n// correct parameterized interface specialization.\r\ntypedef IReference<ABI::Windows::UI::Xaml::CornerRadius> __FIReference_1_Windows__CUI__CXaml__CCornerRadius_t;\r\n#define __FIReference_1_Windows__CUI__CXaml__CCornerRadius ABI::Windows::Foundation::__FIReference_1_Windows__CUI__CXaml__CCornerRadius_t\r\n/* Foundation */ } /* Windows */ } /* ABI */ }\r\n\r\n#endif // !defined(RO_NO_TEMPLATE_NAME)\r\n#endif /* DEF___FIReference_1_Windows__CUI__CXaml__CCornerRadius_USE */\r\n\r\n// Define Windows.Foundation.IReference`1<Windows.UI.Xaml.Thickness>\r\n\r\n#ifndef DEF___FIReference_1_Windows__CUI__CXaml__CThickness_USE\r\n#define DEF___FIReference_1_Windows__CUI__CXaml__CThickness_USE\r\n#if !defined(RO_NO_TEMPLATE_NAME)\r\nnamespace ABI { namespace Windows { namespace Foundation {\r\ntemplate <>\r\nstruct __declspec(uuid(\"a19f7ba8-d8cd-5df2-ab44-fefd26644484\"))\r\nIReference<ABI::Windows::UI::Xaml::Thickness> : IReference_impl<ABI::Windows::UI::Xaml::Thickness>\r\n{\r\n    static const wchar_t* z_get_rc_name_impl()\r\n    {\r\n        return L\"Windows.Foundation.IReference`1<Windows.UI.Xaml.Thickness>\";\r\n    }\r\n};\r\n// Define a typedef for the parameterized interface specialization's mangled name.\r\n// This allows code which uses the mangled name for the parameterized interface to access the\r\n// correct parameterized interface specialization.\r\ntypedef IReference<ABI::Windows::UI::Xaml::Thickness> __FIReference_1_Windows__CUI__CXaml__CThickness_t;\r\n#define __FIReference_1_Windows__CUI__CXaml__CThickness ABI::Windows::Foundation::__FIReference_1_Windows__CUI__CXaml__CThickness_t\r\n/* Foundation */ } /* Windows */ } /* ABI */ }\r\n\r\n#endif // !defined(RO_NO_TEMPLATE_NAME)\r\n#endif /* DEF___FIReference_1_Windows__CUI__CXaml__CThickness_USE */\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/ContainerPolicies.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\n#include <memsafe.h>\r\n\r\ntemplate<typename T>\r\nclass CTContainer_PolicyUnOwned\r\n{\r\npublic:\r\n    static void Destroy(T* p) {}\r\n};\r\n\r\ntemplate<typename T>\r\nclass CTContainer_PolicyRelease\r\n{\r\npublic:\r\n    static void Destroy(T* p)\r\n    {\r\n        if (p)\r\n            p->Release();\r\n    }\r\n};\r\n\r\nclass CTContainer_PolicyNewMem\r\n{\r\npublic:\r\n    template<typename T>\r\n    static void Destroy(T* p)\r\n    {\r\n        delete p;\r\n    }\r\n};\r\n\r\nclass CTContainer_PolicyCoTaskMem\r\n{\r\npublic:\r\n    static void Destroy(void* p)\r\n    {\r\n        CoTaskMemFree(p);\r\n    }\r\n};\r\n\r\nclass CTContainer_PolicyLocalMem\r\n{\r\npublic:\r\n    static void Destroy(void* p)\r\n    {\r\n        DestroyMem(p);\r\n    }\r\n\r\n    static BOOL DestroyMem(void* p)\r\n    {\r\n        return !LocalFree(p);\r\n    }\r\n};\r\n\r\ntemplate <typename T>\r\nclass CTPolicyCoTaskMem : CTContainer_PolicyCoTaskMem\r\n{\r\npublic:\r\n    static void Destroy(void* p)\r\n    {\r\n        CTContainer_PolicyCoTaskMem::Destroy(p);\r\n    }\r\n\r\n    static HRESULT ReallocArray(T* pv, size_t cItems, T** ppv)\r\n    {\r\n        return CoReallocArray(pv, cItems, ppv);\r\n    }\r\n};\r\n\r\ntemplate <typename T>\r\nclass CTPolicyLocalMem : CTContainer_PolicyLocalMem\r\n{\r\npublic:\r\n    static void Destroy(void* p)\r\n    {\r\n        DestroyMem(p);\r\n    }\r\n\r\n    static HRESULT ReallocArray(T* pv, size_t cItems, T** ppv)\r\n    {\r\n        return LocalReallocArray(pv, cItems, ppv);\r\n    }\r\n};\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/NativeString.h",
    "content": "﻿#pragma once\r\n\r\n#include <intsafe.h>\r\n#include <strsafe.h>\r\n\r\n#include \"ResultUtils.h\"\r\n\r\nnamespace Windows::Internal\r\n{\r\n    class ResourceString\r\n    {\r\n    public:\r\n        static bool FindAndSize(HINSTANCE hInstance, UINT uId, WORD wLanguage, const WCHAR** ppch, WORD* plen)\r\n        {\r\n            bool fRet = false;\r\n            *ppch = nullptr;\r\n            if (plen)\r\n                *plen = 0;\r\n            HRSRC hRes = FindResourceExW(hInstance, RT_STRING, MAKEINTRESOURCEW((uId >> 4) + 1), wLanguage);\r\n            if (hRes)\r\n            {\r\n                HGLOBAL hStringSeg = LoadResource(hInstance, hRes);\r\n                if (hStringSeg)\r\n                {\r\n                    WCHAR* pch = (WCHAR*)LockResource(hStringSeg);\r\n                    if (pch)\r\n                    {\r\n                        for (uId = (char)uId & 0xF; uId; --uId)\r\n                            pch += *pch + 1;\r\n                        *ppch = *pch ? pch + 1 : L\"\";\r\n                        if (plen)\r\n                            *plen = *pch;\r\n                        fRet = true;\r\n                    }\r\n                }\r\n            }\r\n            return fRet;\r\n        }\r\n    };\r\n\r\n    template <typename ElementType>\r\n    class CoTaskMemPolicy\r\n    {\r\n    public:\r\n        static ElementType* Alloc(size_t bytes)\r\n        {\r\n            return (ElementType*)CoTaskMemAlloc(bytes);\r\n        }\r\n\r\n        static ElementType* Realloc(ElementType* p, size_t bytes)\r\n        {\r\n            return (ElementType*)CoTaskMemRealloc(p, bytes);\r\n        }\r\n\r\n        static void Free(ElementType* p)\r\n        {\r\n            CoTaskMemFree(p);\r\n        }\r\n    };\r\n\r\n    template <typename ElementType>\r\n    class LocalMemPolicy\r\n    {\r\n    public:\r\n        static ElementType* Alloc(size_t bytes)\r\n        {\r\n            return (ElementType*)LocalAlloc(LMEM_FIXED, bytes);\r\n        }\r\n\r\n        static ElementType* Realloc(ElementType* p, size_t bytes)\r\n        {\r\n            return (ElementType*)LocalReAlloc(p, bytes, LMEM_MOVEABLE);\r\n        }\r\n\r\n        static void Free(ElementType* p)\r\n        {\r\n            LocalFree(p);\r\n        }\r\n    };\r\n\r\n    template <typename Allocator>\r\n    class NativeString\r\n    {\r\n    public:\r\n        NativeString() : _pszStringData(nullptr), _cchStringData(0), _cchStringDataCapacity(0)\r\n        {\r\n        }\r\n\r\n        NativeString(NativeString&& other) noexcept\r\n            : _pszStringData(other._pszStringData)\r\n            , _cchStringData(other._cchStringData)\r\n            , _cchStringDataCapacity(other._cchStringDataCapacity)\r\n        {\r\n            other._pszStringData = nullptr;\r\n            other._cchStringData = 0;\r\n            other._cchStringDataCapacity = 0;\r\n        }\r\n\r\n    private:\r\n        NativeString(const NativeString&) = delete;\r\n\r\n    public:\r\n        ~NativeString()\r\n        {\r\n            Free();\r\n        }\r\n\r\n        HRESULT Initialize(const WCHAR* psz, const size_t cch)\r\n        {\r\n            return _Initialize(psz, cch);\r\n        }\r\n\r\n        HRESULT Initialize(const WCHAR* psz)\r\n        {\r\n            return _Initialize(psz, s_cchUnknown);\r\n        }\r\n\r\n        HRESULT Initialize(const NativeString& other)\r\n        {\r\n            return _Initialize(other._pszStringData, other.GetCount());\r\n        }\r\n\r\n        HRESULT Initialize(HINSTANCE hInstance, UINT uId, WORD wLanguage)\r\n        {\r\n            HRESULT hr;\r\n            const WCHAR* rgch;\r\n            WORD cch;\r\n            if (ResourceString::FindAndSize(hInstance, uId, wLanguage, &rgch, &cch))\r\n            {\r\n                hr = _Initialize(rgch, cch);\r\n            }\r\n            else\r\n            {\r\n                hr = E_FAIL;\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT Initialize(HINSTANCE hInstance, UINT uId)\r\n        {\r\n            return Initialize(hInstance, uId, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));\r\n        }\r\n\r\n        HRESULT Initialize(HKEY hKey, const WCHAR* pszValueName)\r\n        {\r\n            return _InitializeFromRegistry(hKey, pszValueName, true);\r\n        }\r\n\r\n        HRESULT Initialize(HKEY hKey, const WCHAR* pszSubKey, const WCHAR* pszValueName)\r\n        {\r\n            HKEY hkeySub;\r\n            HRESULT hr = HRESULT_FROM_WIN32(RegOpenKeyExW(hKey, pszSubKey, 0, KEY_READ, &hkeySub));\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                hr = Initialize(hkeySub, pszValueName);\r\n                RegCloseKey(hkeySub);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT InitializeNoExpand(HKEY hKey, const WCHAR* pszValueName)\r\n        {\r\n            return _InitializeFromRegistry(hKey, pszValueName, false);\r\n        }\r\n\r\n        HRESULT InitializeNoExpand(HKEY hKey, const WCHAR* pszSubKey, const WCHAR* pszValueName)\r\n        {\r\n            HKEY hkeySub;\r\n            HRESULT hr = HRESULT_FROM_WIN32(RegOpenKeyExW(hKey, pszSubKey, 0, KEY_READ, &hkeySub));\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                hr = InitializeNoExpand(hkeySub, pszValueName);\r\n                RegCloseKey(hkeySub);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT InitializeFormat(const WCHAR* pszFormat, va_list argList)\r\n        {\r\n            return _InitializeHelper(pszFormat, argList, [](const WCHAR* pszFormat, va_list argList, WCHAR* pszStringData, size_t cchStringData) -> HRESULT\r\n            {\r\n                _set_errno(0);\r\n                HRESULT hr = StringCchVPrintfW(pszStringData, cchStringData, pszFormat, argList);\r\n                if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))\r\n                {\r\n                    errno_t err;\r\n                    _get_errno(&err);\r\n                    if (err == EINVAL)\r\n                    {\r\n                        hr = E_INVALIDARG;\r\n                    }\r\n                }\r\n                return hr;\r\n            });\r\n        }\r\n\r\n        HRESULT InitializeFormat(const WCHAR* pszFormat, ...)\r\n        {\r\n            va_list args;\r\n            va_start(args, pszFormat);\r\n            return InitializeFormat(pszFormat, args);\r\n        }\r\n\r\n        HRESULT InitializeResFormat(HINSTANCE hInstance, UINT uId, ...)\r\n        {\r\n            va_list argList;\r\n            va_start(argList, uId);\r\n            NativeString spszFormat;\r\n            HRESULT hr = spszFormat.Initialize(hInstance, uId);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                hr = InitializeFormat(spszFormat._pszStringData, argList);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT InitializeMessage(const WCHAR* pszFormat, va_list argList)\r\n        {\r\n            return _InitializeHelper(pszFormat, argList, [](const WCHAR* pszFormat, va_list argList, WCHAR* pszStringData, size_t cchStringData) -> HRESULT\r\n            {\r\n                va_list argListT = argList;\r\n                DWORD cchResult = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, pszStringData, (DWORD)cchStringData, &argListT);\r\n                return ResultFromWin32Bool(cchResult != 0);\r\n            });\r\n        }\r\n\r\n        HRESULT InitializeMessage(const WCHAR* pszFormat, ...)\r\n        {\r\n            va_list args;\r\n            va_start(args, pszFormat);\r\n            return InitializeMessage(pszFormat, args);\r\n        }\r\n\r\n        HRESULT InitializeResMessage(HINSTANCE hInstance, UINT uId, ...)\r\n        {\r\n            va_list argList;\r\n            va_start(argList, uId);\r\n            NativeString spszFormat;\r\n            HRESULT hr = spszFormat.Initialize(hInstance, uId);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                hr = _InitializeHelper(spszFormat._pszStringData, argList, [](const WCHAR* pszFormat, va_list argList, WCHAR* pszStringData, size_t cchStringData) -> HRESULT\r\n                {\r\n                    va_list argListT = argList;\r\n                    DWORD cchResult = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, pszFormat, 0, 0, pszStringData, (DWORD)cchStringData, &argListT);\r\n                    return ResultFromWin32Bool(cchResult != 0);\r\n                });\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        void Free()\r\n        {\r\n            _Free();\r\n        }\r\n\r\n        void Attach(WCHAR* psz)\r\n        {\r\n            _Attach(psz);\r\n        }\r\n\r\n        void Attach(WCHAR* psz, const size_t cch)\r\n        {\r\n            _Attach(psz, cch);\r\n        }\r\n\r\n        WCHAR* Detach()\r\n        {\r\n            return _Detach();\r\n        }\r\n\r\n        HRESULT DetachInitializeIfEmpty(WCHAR** ppsz)\r\n        {\r\n            *ppsz = nullptr;\r\n            HRESULT hr = S_OK;\r\n\r\n            if (!_pszStringData)\r\n            {\r\n                hr = Initialize(L\"\");\r\n            }\r\n\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                *ppsz = Detach();\r\n            }\r\n\r\n            return hr;\r\n        }\r\n\r\n        WCHAR** FreeAndGetAddressOf()\r\n        {\r\n            return _FreeAndGetAddressOf();\r\n        }\r\n\r\n        HRESULT CopyTo(WCHAR** ppszDest) const\r\n        {\r\n            HRESULT hr;\r\n            *ppszDest = nullptr;\r\n            if (_pszStringData)\r\n            {\r\n                NativeString spszT;\r\n                hr = spszT.Initialize(*this);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    *ppszDest = spszT.Detach();\r\n                }\r\n            }\r\n            else\r\n            {\r\n                hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT CopyTo(WCHAR* pszDest, size_t cchDest) const\r\n        {\r\n            if (!_pszStringData)\r\n            {\r\n                if (cchDest)\r\n                    *pszDest = 0;\r\n                return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);\r\n            }\r\n            return StringCchCopyW(pszDest, cchDest, _pszStringData);\r\n        }\r\n\r\n        const WCHAR* Get() const\r\n        {\r\n            return _Get();\r\n        }\r\n\r\n        const WCHAR* GetNonNull() const\r\n        {\r\n            return _pszStringData ? _pszStringData : L\"\";\r\n        }\r\n\r\n        size_t GetCount()\r\n        {\r\n            return _GetCount();\r\n        }\r\n\r\n        size_t GetCount() const\r\n        {\r\n            return _GetCount();\r\n        }\r\n\r\n        bool IsEmpty() const\r\n        {\r\n            return _IsEmpty();\r\n        }\r\n\r\n        bool HasLength() const\r\n        {\r\n            return !_IsEmpty();\r\n        }\r\n\r\n        bool IsEmptyIgnoringWhitespace() const\r\n        {\r\n            return _IsEmpty() || _IsOnlyWhitespace();\r\n        }\r\n\r\n        int CompareOrdinal(const WCHAR* psz, const size_t cch) const\r\n        {\r\n            return CompareStringOrdinal(GetNonNull(), (int)GetCount(), psz ? psz : L\"\", psz ? (int)cch : 0, FALSE);\r\n        }\r\n\r\n        int CompareOrdinal(const WCHAR* psz) const\r\n        {\r\n            return CompareOrdinal(psz, s_cchUnknown);\r\n        }\r\n\r\n        int CompareOrdinal(const NativeString& other) const\r\n        {\r\n            return CompareOrdinal(other.GetNonNull(), other.GetCount());\r\n        }\r\n\r\n        int CompareOrdinalIgnoreCase(const WCHAR* psz, const size_t cch) const\r\n        {\r\n            return CompareStringOrdinal(GetNonNull(), (int)GetCount(), psz ? psz : L\"\", psz ? (int)cch : 0, TRUE);\r\n        }\r\n\r\n        int CompareOrdinalIgnoreCase(const WCHAR* psz) const\r\n        {\r\n            return CompareOrdinalIgnoreCase(psz, s_cchUnknown);\r\n        }\r\n\r\n        int CompareOrdinalIgnoreCase(const NativeString& other) const\r\n        {\r\n            return CompareOrdinalIgnoreCase(other.GetNonNull(), other.GetCount());\r\n        }\r\n\r\n        HRESULT Concat(const WCHAR* psz, const size_t cch)\r\n        {\r\n            return _Concat(psz, cch);\r\n        }\r\n\r\n        HRESULT Concat(WCHAR c)\r\n        {\r\n            return _Concat(c);\r\n        }\r\n\r\n        HRESULT Concat(const WCHAR* psz)\r\n        {\r\n            return _Concat(psz, psz ? wcslen(psz) : 0);\r\n        }\r\n\r\n        HRESULT Concat(const NativeString& other)\r\n        {\r\n            return _Concat(other.Get(), other.GetCount());\r\n        }\r\n\r\n        HRESULT Concat(HINSTANCE hInstance, UINT uId, WORD wLanguage)\r\n        {\r\n            HRESULT hr;\r\n            const WCHAR* rgch;\r\n            WORD cch;\r\n            if (ResourceString::FindAndSize(hInstance, uId, wLanguage, &rgch, &cch))\r\n            {\r\n                hr = _Concat(rgch, cch);\r\n            }\r\n            else\r\n            {\r\n                hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT Concat(HINSTANCE hInstance, UINT uId)\r\n        {\r\n            return Concat(hInstance, uId, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));\r\n        }\r\n\r\n        HRESULT ConcatFormat(const WCHAR* pszFormat, va_list argList)\r\n        {\r\n            if (IsEmpty())\r\n            {\r\n                return InitializeFormat(pszFormat, argList);\r\n            }\r\n            NativeString strT;\r\n            HRESULT hr = strT.InitializeFormat(pszFormat, argList);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                hr = Concat(strT);\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT ConcatFormat(const WCHAR* pszFormat, ...)\r\n        {\r\n            va_list argList;\r\n            va_start(argList, pszFormat);\r\n            return ConcatFormat(pszFormat, argList);\r\n        }\r\n\r\n        bool RemoveAt(size_t iElem, size_t cchElem)\r\n        {\r\n            return _RemoveAt(iElem, cchElem);\r\n        }\r\n\r\n        bool TrimStart(const WCHAR* pszTrim)\r\n        {\r\n            return _TrimStart(pszTrim);\r\n        }\r\n\r\n        bool TrimEnd(const WCHAR* pszTrim)\r\n        {\r\n            return _TrimEnd(pszTrim);\r\n        }\r\n\r\n        inline static const WCHAR* const s_pszTrimWhitespaceCharacterSet =\r\n            L\"\\u0020\" // Space\r\n            L\"\\u0009\" // Tab\r\n            L\"\\u3000\" // Ideographic Space\r\n            L\"\\u17D2\" // Khmer Sign Coeng\r\n            L\"\\u0F0B\" // Tibetan Mark Intersyllabic Tsheg\r\n            L\"\\u1680\" // Ogham Space Mark\r\n            L\"\\u180E\" // Mongolian Vowel Separator\r\n        ;\r\n\r\n        inline static const WCHAR* const s_pszIsOnlyWhitespaceCharacterSet =\r\n            L\"\\u0020\" // Space\r\n            L\"\\u0009\" // Tab\r\n            L\"\\u000D\" // Carriage Return\r\n            L\"\\u000A\" // Line Feed\r\n            L\"\\u3000\" // Ideographic Space\r\n            L\"\\u17D2\" // Khmer Sign Coeng\r\n            L\"\\u0F0B\" // Tibetan Mark Intersyllabic Tsheg\r\n            L\"\\u1680\" // Ogham Space Mark\r\n            L\"\\u180E\" // Mongolian Vowel Separator\r\n        ;\r\n\r\n        bool TrimWhitespace()\r\n        {\r\n            bool fWasCharacterTrimmedEnd = _TrimEnd(s_pszTrimWhitespaceCharacterSet);\r\n            bool fWasCharacterTrimmedStart = _TrimStart(s_pszTrimWhitespaceCharacterSet);\r\n            return fWasCharacterTrimmedStart || fWasCharacterTrimmedEnd;\r\n        }\r\n\r\n        void ReplaceChars(const WCHAR wcFind, const WCHAR wcReplace)\r\n        {\r\n            _EnsureCount();\r\n            for (size_t i = 0; i < _cchStringData; i++)\r\n            {\r\n                if (_pszStringData[i] == wcFind)\r\n                    _pszStringData[i] = wcReplace;\r\n            }\r\n        }\r\n\r\n        NativeString& operator=(NativeString&& other) noexcept\r\n        {\r\n            _Free();\r\n            _pszStringData = other._pszStringData;\r\n            _cchStringData = other._cchStringData;\r\n            _cchStringDataCapacity = other._cchStringDataCapacity;\r\n            other._pszStringData = nullptr;\r\n            other._cchStringData = 0;\r\n            other._cchStringDataCapacity = 0;\r\n            return *this;\r\n        }\r\n\r\n    private:\r\n        NativeString& operator=(const NativeString& other) = delete;\r\n\r\n    public:\r\n        WCHAR** operator&()\r\n        {\r\n            return FreeAndGetAddressOf();\r\n        }\r\n\r\n        /*WCHAR* operator*() const\r\n        {\r\n            return Get();\r\n        }*/\r\n\r\n        bool operator==(const WCHAR* pszOther) const\r\n        {\r\n            return pszOther ? CompareOrdinal(pszOther) == CSTR_EQUAL : !_pszStringData;\r\n        }\r\n\r\n        bool operator!=(const WCHAR* pszOther) const\r\n        {\r\n            return !operator==(pszOther);\r\n        }\r\n\r\n        HRESULT AppendMayTruncate(const WCHAR* psz, size_t cchMaxCapacity)\r\n        {\r\n            return _ConcatMayTruncate(psz, cchMaxCapacity);\r\n        }\r\n\r\n        HRESULT EnsureCapacity(size_t cchDesired)\r\n        {\r\n            return _EnsureCapacity(cchDesired);\r\n        }\r\n\r\n    private:\r\n        void _EnsureCount()\r\n        {\r\n            if (_cchStringData == s_cchUnknown)\r\n            {\r\n                _cchStringData = _pszStringData ? wcslen(_pszStringData) : 0;\r\n            }\r\n        }\r\n\r\n        HRESULT _EnsureCapacity(size_t cchDesired)\r\n        {\r\n            size_t cchCapacityCur;\r\n            HRESULT hr = SizeTAdd(cchDesired, 1, &cchCapacityCur);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                if (_cchStringDataCapacity == s_cchUnknown)\r\n                {\r\n                    _EnsureCount();\r\n                    _cchStringDataCapacity = _pszStringData ? _cchStringData + 1 : 0;\r\n                }\r\n                if (_cchStringDataCapacity == 0) // First allocation\r\n                {\r\n                    size_t cbDesired;\r\n                    hr = SizeTMult(cchCapacityCur, sizeof(WCHAR), &cbDesired);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        WCHAR* pvArrayT = Allocator::Alloc(cbDesired);\r\n                        hr = pvArrayT ? S_OK : E_OUTOFMEMORY;\r\n                        if (SUCCEEDED(hr))\r\n                        {\r\n                            _cchStringDataCapacity = cchCapacityCur;\r\n                            _pszStringData = pvArrayT;\r\n                            pvArrayT[0] = 0;\r\n                        }\r\n                    }\r\n                }\r\n                else if (cchCapacityCur > _cchStringDataCapacity) // Growing\r\n                {\r\n                    size_t celemNew;\r\n                    hr = SizeTMult(_cchStringDataCapacity, 2, &celemNew); // Double the capacity\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        if (celemNew - _cchStringDataCapacity > 2048)\r\n                            celemNew = _cchStringDataCapacity + 2048; // Make sure it doesn't grow too much; TODO Check disassembly\r\n                        if (cchCapacityCur <= celemNew)\r\n                            cchCapacityCur = celemNew;\r\n                        WCHAR* pvArrayT = Allocator::Realloc(_pszStringData, sizeof(WCHAR) * cchCapacityCur);\r\n                        hr = pvArrayT ? S_OK : E_OUTOFMEMORY;\r\n                        if (SUCCEEDED(hr))\r\n                        {\r\n                            _cchStringDataCapacity = cchCapacityCur;\r\n                            _pszStringData = pvArrayT;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        bool _IsEmpty() const\r\n        {\r\n            return !_pszStringData || !_pszStringData[0];\r\n        }\r\n\r\n        bool _IsOnlyWhitespace() const\r\n        {\r\n            size_t cchStringData = GetCount();\r\n            size_t cchWhitespace = 0;\r\n            while (cchWhitespace < cchStringData)\r\n            {\r\n                if (!wcschr(s_pszIsOnlyWhitespaceCharacterSet, _pszStringData[cchWhitespace]))\r\n                {\r\n                    break;\r\n                }\r\n                ++cchWhitespace;\r\n            }\r\n            return cchWhitespace && cchWhitespace == cchStringData;\r\n        }\r\n\r\n        HRESULT _Initialize(const WCHAR* psz, size_t cch)\r\n        {\r\n            size_t cchDesired = cch;\r\n            size_t cchStringData;\r\n            HRESULT hr = S_OK;\r\n            if (psz)\r\n            {\r\n                if (cchDesired == s_cchUnknown)\r\n                {\r\n                    cchDesired = wcslen(psz);\r\n                    cchStringData = cchDesired;\r\n                }\r\n                else\r\n                {\r\n                    cchStringData = _NativeString_Min<size_t>(cchDesired, wcslen(psz)); // @MOD Prevent double evaluation\r\n                }\r\n                hr = _EnsureCapacity(cchDesired);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    StringCchCopyNW(_pszStringData, cchDesired + 1, psz, cchStringData);\r\n                    _cchStringData = cchStringData;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                _Free();\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        template <typename T>\r\n        HRESULT _InitializeHelper(const WCHAR* pszFormat, va_list argList, const T& callback)\r\n        {\r\n            HRESULT hr;\r\n            size_t cchCapacityGuess = 32;\r\n            do\r\n            {\r\n                hr = _EnsureCapacity(cchCapacityGuess);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    hr = callback(pszFormat, argList, _pszStringData, _cchStringDataCapacity);\r\n                    if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))\r\n                    {\r\n                        size_t cchCapacityT;\r\n                        hr = SizeTAdd(_cchStringDataCapacity, 32, &cchCapacityT);\r\n                        if (SUCCEEDED(hr))\r\n                        {\r\n                            cchCapacityGuess = cchCapacityT;\r\n                        }\r\n                    }\r\n                    else\r\n                    {\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n            while (SUCCEEDED(hr));\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                _cchStringData = s_cchUnknown;\r\n            }\r\n            else\r\n            {\r\n                _Free();\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT _InitializeFromRegistry(HKEY hKey, const WCHAR* pszValueName, bool fExpand)\r\n        {\r\n            DWORD dwType;\r\n            DWORD cbT = 0;\r\n            LSTATUS lRes = RegQueryValueExW(hKey, pszValueName, nullptr, &dwType, nullptr, &cbT);\r\n            HRESULT hr = HRESULT_FROM_WIN32(lRes);\r\n            if (SUCCEEDED(hr) && ((dwType != REG_SZ && dwType != REG_EXPAND_SZ) || cbT == 0 || (cbT & 1) != 0))\r\n            {\r\n                hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);\r\n            }\r\n\r\n            WCHAR* pszT = nullptr;\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                pszT = Allocator::Alloc(cbT);\r\n                hr = pszT ? S_OK : E_OUTOFMEMORY;\r\n            }\r\n\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                lRes = RegQueryValueExW(hKey, pszValueName, nullptr, &dwType, (LPBYTE)pszT, &cbT);\r\n                hr = HRESULT_FROM_WIN32(lRes);\r\n            }\r\n\r\n            DWORD cchT = 0;\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                cchT = (cbT / sizeof(WCHAR)) - 1;\r\n                if (dwType == REG_EXPAND_SZ && fExpand)\r\n                {\r\n                    DWORD cchBuffer = ExpandEnvironmentStringsW(pszT, nullptr, 0);\r\n                    if (cchBuffer != 0)\r\n                    {\r\n                        WCHAR* pszExpand = Allocator::Alloc(sizeof(WCHAR) * cchBuffer);\r\n                        hr = pszExpand ? S_OK : E_OUTOFMEMORY;\r\n                        if (SUCCEEDED(hr))\r\n                        {\r\n                            DWORD cchResult = ExpandEnvironmentStringsW(pszT, pszExpand, cchBuffer);\r\n                            hr = ResultFromWin32Count(cchResult, cchBuffer);\r\n                            if (SUCCEEDED(hr))\r\n                            {\r\n                                Allocator::Free(pszT);\r\n                                pszT = pszExpand;\r\n                                cchT = cchResult - 1;\r\n                            }\r\n                            else\r\n                            {\r\n                                Allocator::Free(pszExpand);\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                if (!pszT[cchT])\r\n                {\r\n                    _Attach(pszT, cchT + 1);\r\n                    pszT = nullptr;\r\n                }\r\n                else\r\n                {\r\n                    hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);\r\n                }\r\n            }\r\n\r\n            Allocator::Free(pszT);\r\n            return hr;\r\n        }\r\n\r\n        size_t _GetCount()\r\n        {\r\n            _EnsureCount();\r\n            return _cchStringData;\r\n        }\r\n\r\n        size_t _GetCount() const\r\n        {\r\n            if (_cchStringData != s_cchUnknown)\r\n                return _cchStringData;\r\n            return _pszStringData ? wcslen(_pszStringData) : 0;\r\n        }\r\n\r\n        const WCHAR* _Get() const\r\n        {\r\n            return _pszStringData;\r\n        }\r\n\r\n        HRESULT _Concat(const WCHAR c)\r\n        {\r\n            WCHAR sz[2] = { c, 0 };\r\n            return _Concat(sz, 1);\r\n        }\r\n\r\n        HRESULT _Concat(const WCHAR* psz, const size_t cch)\r\n        {\r\n            HRESULT hr = S_OK;\r\n            if (psz)\r\n            {\r\n                _EnsureCount();\r\n                hr = _EnsureCapacity(cch + _cchStringData);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    StringCchCopyNW(&_pszStringData[_cchStringData], cch + 1, psz, cch);\r\n                    _cchStringData += cch;\r\n                }\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        HRESULT _ConcatMayTruncate(const WCHAR* psz, size_t cchMaxCapacity)\r\n        {\r\n            _EnsureCount();\r\n            HRESULT hr = S_OK;\r\n            if (cchMaxCapacity > _cchStringData)\r\n            {\r\n                size_t cchDesired = _NativeString_Min<size_t>(cchMaxCapacity - _cchStringData, wcslen(psz)); // @MOD Prevent double evaluation\r\n                hr = _Concat(psz, cchDesired);\r\n            }\r\n            else if (cchMaxCapacity < _cchStringData)\r\n            {\r\n                _cchStringData = cchMaxCapacity;\r\n                _pszStringData[cchMaxCapacity] = 0;\r\n            }\r\n            return hr;\r\n        }\r\n\r\n        bool _RemoveAt(size_t iElem, size_t cchElem)\r\n        {\r\n            _EnsureCount();\r\n\r\n            bool fRet = false;\r\n\r\n            if (iElem < _cchStringData)\r\n            {\r\n                cchElem = _NativeString_Min<size_t>(cchElem, _cchStringData - iElem); // @MOD Prevent double evaluation\r\n                if (cchElem)\r\n                {\r\n                    memmove(&_pszStringData[iElem], &_pszStringData[iElem + cchElem], sizeof(WCHAR) * (_cchStringData - iElem - cchElem));\r\n                    _cchStringData -= cchElem;\r\n                }\r\n                _pszStringData[_cchStringData] = 0;\r\n                fRet = true;\r\n            }\r\n\r\n            return fRet;\r\n        }\r\n\r\n        bool _TrimStart(const WCHAR* pszTrim)\r\n        {\r\n            _EnsureCount();\r\n\r\n            bool fNeedsTrimming = false;\r\n\r\n            size_t cch;\r\n            for (cch = 0; cch < _cchStringData; ++cch)\r\n            {\r\n                if (!wcschr(pszTrim, _pszStringData[cch]))\r\n                    break;\r\n            }\r\n\r\n            if (cch)\r\n            {\r\n                fNeedsTrimming = true;\r\n                memmove(_pszStringData, &_pszStringData[cch], sizeof(WCHAR) * (_cchStringData - cch) + sizeof(WCHAR));\r\n                _cchStringData -= cch;\r\n            }\r\n\r\n            return fNeedsTrimming;\r\n        }\r\n\r\n        bool _TrimEnd(const WCHAR* pszTrim)\r\n        {\r\n            _EnsureCount();\r\n\r\n            size_t cch;\r\n            for (cch = _cchStringData; cch; --cch)\r\n            {\r\n                if (!wcschr(pszTrim, _pszStringData[cch - 1]))\r\n                    break;\r\n            }\r\n\r\n            bool fNeedsTrimming = false;\r\n\r\n            if (cch != _cchStringData)\r\n            {\r\n                fNeedsTrimming = true;\r\n                _pszStringData[cch] = 0;\r\n                _cchStringData = cch;\r\n            }\r\n\r\n            return fNeedsTrimming;\r\n        }\r\n\r\n        void _Free()\r\n        {\r\n            if (_pszStringData)\r\n            {\r\n                Allocator::Free(_pszStringData);\r\n                _pszStringData = nullptr;\r\n            }\r\n            _cchStringData = 0;\r\n            _cchStringDataCapacity = 0;\r\n        }\r\n\r\n        void _Attach(WCHAR* psz)\r\n        {\r\n            if (_pszStringData)\r\n            {\r\n                Allocator::Free(_pszStringData);\r\n            }\r\n            _pszStringData = psz;\r\n            _cchStringData = s_cchUnknown;\r\n            _cchStringDataCapacity = s_cchUnknown;\r\n        }\r\n\r\n        void _Attach(WCHAR* psz, const size_t cch)\r\n        {\r\n            _Free();\r\n            if (psz && cch)\r\n            {\r\n                _pszStringData = psz;\r\n                _cchStringData = cch - 1;\r\n                _cchStringDataCapacity = cch;\r\n                psz[cch - 1] = 0;\r\n            }\r\n        }\r\n\r\n        WCHAR* _Detach()\r\n        {\r\n            WCHAR* pszStringData = _pszStringData;\r\n            _pszStringData = nullptr;\r\n            _cchStringData = 0;\r\n            _cchStringDataCapacity = 0;\r\n            return pszStringData;\r\n        }\r\n\r\n        WCHAR** _FreeAndGetAddressOf()\r\n        {\r\n            _Free();\r\n            _cchStringData = s_cchUnknown;\r\n            _cchStringDataCapacity = s_cchUnknown;\r\n            return &_pszStringData;\r\n        }\r\n\r\n        static const size_t s_cchUnknown = -1;\r\n\r\n        WCHAR* _pszStringData;\r\n        size_t _cchStringData;\r\n        size_t _cchStringDataCapacity;\r\n\r\n        template <typename T>\r\n        static FORCEINLINE constexpr const T& (_NativeString_Min)(const T& a, const T& b)\r\n        {\r\n            return a < b ? a : b;\r\n        }\r\n    };\r\n}\r\n\r\ntypedef Windows::Internal::NativeString<Windows::Internal::CoTaskMemPolicy<WCHAR>> CoTaskMemNativeString;\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/PopNoWilResultMacrosLogging.h",
    "content": "// ReSharper disable once CppMissingIncludeGuard\r\n#pragma pop_macro(\"RETURN_IF_NTSTATUS_FAILED\")\r\n#pragma pop_macro(\"RETURN_LAST_ERROR_IF_NULL\")\r\n#pragma pop_macro(\"RETURN_LAST_ERROR_IF\")\r\n#pragma pop_macro(\"RETURN_HR_IF_NULL\")\r\n#pragma pop_macro(\"RETURN_HR_IF\")\r\n#pragma pop_macro(\"RETURN_IF_NULL_ALLOC\")\r\n#pragma pop_macro(\"RETURN_IF_WIN32_ERROR\")\r\n#pragma pop_macro(\"RETURN_IF_WIN32_BOOL_FALSE\")\r\n#pragma pop_macro(\"RETURN_IF_FAILED\")\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/PushNoWilResultMacrosLogging.h",
    "content": "// ReSharper disable once CppMissingIncludeGuard\r\n#pragma push_macro(\"RETURN_IF_FAILED\")\r\n#pragma push_macro(\"RETURN_IF_WIN32_BOOL_FALSE\")\r\n#pragma push_macro(\"RETURN_IF_WIN32_ERROR\")\r\n#pragma push_macro(\"RETURN_IF_NULL_ALLOC\")\r\n#pragma push_macro(\"RETURN_HR_IF\")\r\n#pragma push_macro(\"RETURN_HR_IF_NULL\")\r\n#pragma push_macro(\"RETURN_LAST_ERROR_IF\")\r\n#pragma push_macro(\"RETURN_LAST_ERROR_IF_NULL\")\r\n#pragma push_macro(\"RETURN_IF_NTSTATUS_FAILED\")\r\n#undef RETURN_IF_FAILED\r\n#undef RETURN_IF_WIN32_BOOL_FALSE\r\n#undef RETURN_IF_WIN32_ERROR\r\n#undef RETURN_IF_NULL_ALLOC\r\n#undef RETURN_HR_IF\r\n#undef RETURN_HR_IF_NULL\r\n#undef RETURN_LAST_ERROR_IF\r\n#undef RETURN_LAST_ERROR_IF_NULL\r\n#undef RETURN_IF_NTSTATUS_FAILED\r\n#define RETURN_IF_FAILED RETURN_IF_FAILED_EXPECTED\r\n#define RETURN_IF_WIN32_BOOL_FALSE RETURN_IF_WIN32_BOOL_FALSE_EXPECTED\r\n#define RETURN_IF_WIN32_ERROR RETURN_IF_WIN32_ERROR_EXPECTED\r\n#define RETURN_IF_NULL_ALLOC RETURN_IF_NULL_ALLOC_EXPECTED\r\n#define RETURN_HR_IF RETURN_HR_IF_EXPECTED\r\n#define RETURN_HR_IF_NULL RETURN_HR_IF_NULL_EXPECTED\r\n#define RETURN_LAST_ERROR_IF RETURN_LAST_ERROR_IF_EXPECTED\r\n#define RETURN_LAST_ERROR_IF_NULL RETURN_LAST_ERROR_IF_NULL_EXPECTED\r\n#define RETURN_IF_NTSTATUS_FAILED RETURN_IF_NTSTATUS_FAILED_EXPECTED\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/RefCountedObject.h",
    "content": "#pragma once\r\n\r\n#include <wrl/client.h>\r\n\r\ntemplate <typename T>\r\nclass CRefCountedObject : public IUnknown, public T\r\n{\r\npublic:\r\n    template <typename ...TArgs>\r\n    CRefCountedObject(TArgs&& ...args)\r\n        : T(std::forward<TArgs>(args)...)\r\n        , _cRef(0)\r\n    {\r\n    }\r\n\r\n    virtual ~CRefCountedObject()\r\n    {\r\n    }\r\n\r\n    STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject) override\r\n    {\r\n        *ppvObject = nullptr;\r\n        return E_NOTIMPL;\r\n    }\r\n\r\n    STDMETHODIMP_(ULONG) AddRef() override\r\n    {\r\n        return InterlockedIncrement(&_cRef);\r\n    }\r\n\r\n    STDMETHODIMP_(ULONG) Release() override\r\n    {\r\n        ULONG refCount = InterlockedDecrement(&_cRef);\r\n        if (refCount == 0)\r\n            delete this;\r\n        return refCount;\r\n    }\r\n\r\n    ULONG _cRef;\r\n};\r\n\r\ntemplate <typename T, typename ...TArgs>\r\nMicrosoft::WRL::ComPtr<CRefCountedObject<T>> CreateRefCountedObj(TArgs&& ...args)\r\n{\r\n    return new(std::nothrow) CRefCountedObject<T>(std::forward<TArgs>(args)...);\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/ResultUtils.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n\r\ninline HRESULT ResultFromWin32(__in DWORD dwErr)\r\n{\r\n    return HRESULT_FROM_WIN32(dwErr);\r\n}\r\n\r\ninline HRESULT ResultFromLastError()\r\n{\r\n    return ResultFromWin32(GetLastError());\r\n}\r\n\r\ninline HRESULT ResultFromKnownLastError()\r\n{\r\n    HRESULT hr = ResultFromLastError();\r\n    return (SUCCEEDED(hr) ? E_FAIL : hr);\r\n}\r\n\r\ninline HRESULT ResultFromWin32Bool(BOOL b)\r\n{\r\n    return b ? S_OK : ResultFromKnownLastError();\r\n}\r\n\r\ninline HRESULT ResultFromWin32Count(UINT cchResult, UINT cchBuffer)\r\n{\r\n    return cchResult && cchResult <= cchBuffer ? S_OK : ResultFromWin32(ERROR_INSUFFICIENT_BUFFER);\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/SimpleArray.h",
    "content": "﻿#pragma once\r\n\r\n#include <Windows.h>\r\n#include <type_traits>\r\n\r\n#include \"ContainerPolicies.h\"\r\n\r\ntemplate <typename T>\r\nclass CSimpleArrayStandardCompareHelper\r\n{\r\npublic:\r\n    int Compare(const T& t1, const T& t2) const\r\n    {\r\n        return t2 == t1 ? 0 : t2 < t1 ? 1 : -1;\r\n    }\r\n};\r\n\r\nclass CSimpleArrayCaseInsensitiveOrdinalStringCompareHelper\r\n{\r\npublic:\r\n    int Compare(const WCHAR* psz1, const WCHAR* psz2) const\r\n    {\r\n        return CompareStringOrdinal(psz1, -1, psz2, -1, TRUE) - CSTR_EQUAL;\r\n    }\r\n};\r\n\r\nclass CSimpleArrayUserDefaultLocaleCaseInsensitiveCompareHelper\r\n{\r\npublic:\r\n    int Compare(const WCHAR* psz1, const WCHAR* psz2) const\r\n    {\r\n        return CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, psz1, -1, psz2, -1) - CSTR_EQUAL;\r\n    }\r\n};\r\n\r\ntemplate <typename T>\r\nclass CSimpleArrayStandardMergeHelper\r\n{\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T>\r\n>\r\nclass CTSimpleFixedArray\r\n{\r\npublic:\r\n    T* _parray;\r\n    size_t _celem;\r\n\r\n    CTSimpleFixedArray()\r\n        : _parray(nullptr)\r\n        , _celem(0)\r\n    {\r\n    }\r\n\r\n    CTSimpleFixedArray(T* const parray, size_t celem)\r\n        : _parray(parray)\r\n        , _celem(celem)\r\n    {\r\n    }\r\n\r\n    void SetData(T* const parray, size_t celem)\r\n    {\r\n        _parray = parray;\r\n        _celem = celem;\r\n    }\r\n\r\n    size_t GetSize() const { return _celem; }\r\n\r\n    T& operator[](size_t iElem) { return _parray[iElem]; }\r\n    const T& operator[](size_t iElem) const { return _parray[iElem]; }\r\n\r\n    HRESULT GetAt(size_t iElem, T& tOut) const\r\n    {\r\n        HRESULT hr = TYPE_E_OUTOFBOUNDS;\r\n        if (iElem < _celem)\r\n        {\r\n            tOut = _parray[iElem];\r\n            hr = S_OK;\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    T* GetData() const { return _parray; }\r\n    T* begin() { return _parray; }\r\n    T* begin() const { return _parray; }\r\n    T* end() { return _parray + _celem; }\r\n    T* end() const { return _parray + _celem; }\r\n\r\n    HRESULT Find(const T& t, size_t* piElem, size_t iStartAt = 0) const\r\n    {\r\n        return FindEx(CompareHelper(), t, piElem, iStartAt);\r\n    }\r\n\r\n    template <typename Comparer>\r\n    HRESULT FindEx(const Comparer& tcompare, const T& t, size_t* piElem, size_t iStartAt = 0) const\r\n    {\r\n        *piElem = 0;\r\n        for (size_t i = iStartAt; i < _celem; ++i)\r\n        {\r\n            if (tcompare.Compare(_parray[i], t) == 0)\r\n            {\r\n                *piElem = i;\r\n                return S_OK;\r\n            }\r\n        }\r\n        return TYPE_E_ELEMENTNOTFOUND;\r\n    }\r\n\r\n    HRESULT BinarySearch(const T& t, size_t* piElem) const\r\n    {\r\n        return BinarySearchEx(CompareHelper(), t, piElem);\r\n    }\r\n\r\n    template <typename Comparer>\r\n    HRESULT BinarySearchEx(const Comparer& tcompare, const T& t, size_t* piElem) const\r\n    {\r\n        *piElem = 0;\r\n\r\n        HRESULT hr = TYPE_E_ELEMENTNOTFOUND;\r\n\r\n        if (_celem != 0)\r\n        {\r\n            hr = S_OK;\r\n\r\n            size_t iLow = 0;\r\n            size_t iHigh = _celem - 1;\r\n            while (true)\r\n            {\r\n                size_t iMid = (iLow + iHigh) / 2;\r\n\r\n                int compare = tcompare.Compare(_parray[iMid], t);\r\n                if (compare > 0)\r\n                {\r\n                    if (iMid != 0)\r\n                    {\r\n                        iHigh = iMid - 1;\r\n                    }\r\n                    else\r\n                    {\r\n                        hr = TYPE_E_ELEMENTNOTFOUND;\r\n                    }\r\n                }\r\n                else if (compare < 0)\r\n                {\r\n                    iLow = iMid + 1;\r\n                }\r\n                else\r\n                {\r\n                    for (; iMid != 0; --iMid)\r\n                    {\r\n                        if (tcompare.Compare(_parray[iMid - 1], t) != 0)\r\n                            break;\r\n                    }\r\n                    *piElem = iMid;\r\n                    break;\r\n                }\r\n\r\n                if (iHigh < iLow)\r\n                    hr = TYPE_E_ELEMENTNOTFOUND;\r\n\r\n                if (FAILED(hr))\r\n                {\r\n                    *piElem = compare < 0 ? iLow : iMid;\r\n                    break;\r\n                }\r\n            }\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    template <typename TCallback>\r\n    void ForEach(const TCallback& callback) const // @MOD Pass callback by reference\r\n    {\r\n        for (size_t iElement = 0; iElement < _celem; ++iElement)\r\n        {\r\n            callback(iElement, _parray[iElement]);\r\n        }\r\n    }\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    size_t MaxSize,\r\n    typename Allocator,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T>,\r\n    typename MergeHelper = CSimpleArrayStandardMergeHelper<T>\r\n>\r\nclass CTSimpleArray : public CTSimpleFixedArray<T, CompareHelper>\r\n{\r\npublic:\r\n    T* _parrayT;\r\n    size_t _celemCapacity;\r\n\r\n    CTSimpleArray()\r\n        : CTSimpleFixedArray<T, CompareHelper>()\r\n        , _parrayT(nullptr)\r\n        , _celemCapacity(0)\r\n    {\r\n    }\r\n\r\n    ~CTSimpleArray()\r\n    {\r\n        RemoveAll();\r\n    }\r\n\r\n    HRESULT Add(const T& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _Add(t, piElemInsertedAt);\r\n    }\r\n\r\n    HRESULT Add(T&& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _Add(std::move(t), piElemInsertedAt);\r\n    }\r\n\r\n    HRESULT AddSorted(const T& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _AddSorted(t, piElemInsertedAt);\r\n    }\r\n\r\n    HRESULT AddSorted(T&& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _AddSorted(std::move(t), piElemInsertedAt);\r\n    }\r\n\r\n    template <typename Comparer>\r\n    HRESULT AddSortedEx(const Comparer& tcompare, const T& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _AddSortedEx(tcompare, t, piElemInsertedAt);\r\n    }\r\n\r\n    template <typename Comparer>\r\n    HRESULT AddSortedEx(const Comparer& tcompare, T&& t, size_t* piElemInsertedAt = nullptr)\r\n    {\r\n        return _AddSortedEx(tcompare, std::move(t), piElemInsertedAt);\r\n    }\r\n\r\n    HRESULT InsertAt(const T& t, size_t iElem)\r\n    {\r\n        return _InsertAt(t, iElem);\r\n    }\r\n\r\n    HRESULT InsertAt(T&& t, size_t iElem)\r\n    {\r\n        return _InsertAt(std::move(t), iElem);\r\n    }\r\n\r\n    HRESULT SetAtIndex(size_t iElem, const T& t)\r\n    {\r\n        return _SetAtIndex(iElem, t);\r\n    }\r\n\r\n    HRESULT SetAtIndex(size_t iElem, T&& t)\r\n    {\r\n        return _SetAtIndex(iElem, std::move(t));\r\n    }\r\n\r\n    HRESULT Remove(const T& t, size_t* piElemRemovedAt = nullptr)\r\n    {\r\n        if (piElemRemovedAt)\r\n            *piElemRemovedAt = 0;\r\n\r\n        size_t iElem;\r\n        HRESULT hr = this->Find(t, &iElem);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = RemoveAt(iElem);\r\n            if (SUCCEEDED(hr) && piElemRemovedAt)\r\n            {\r\n                *piElemRemovedAt = iElem;\r\n            }\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    HRESULT RemoveAt(size_t iElem)\r\n    {\r\n        if (iElem >= this->_celem)\r\n            return TYPE_E_OUTOFBOUNDS;\r\n        if constexpr (!std::is_trivially_destructible_v<T>)\r\n            this->_parray[iElem].~T();\r\n        if (iElem != this->_celem - 1)\r\n            memmove(std::addressof(this->_parray[iElem]), std::addressof(this->_parray[iElem + 1]), sizeof(T) * (this->_celem - iElem - 1));\r\n        --this->_celem;\r\n        return S_OK;\r\n    }\r\n\r\n    void RemoveAll()\r\n    {\r\n        if (this->_parray)\r\n        {\r\n            if constexpr (!std::is_trivially_destructible_v<T>)\r\n            {\r\n                for (size_t i = 0; i < this->_celem; ++i)\r\n                    this->_parray[i].~T();\r\n            }\r\n            Allocator::Destroy(this->_parray);\r\n            this->_parray = nullptr;\r\n        }\r\n        this->_celem = 0;\r\n        _celemCapacity = 0;\r\n    }\r\n\r\n    void TransferData(CTSimpleArray* other)\r\n    {\r\n        RemoveAll();\r\n        this->_parray = other->_parray;\r\n        this->_celem = other->_celem;\r\n        this->_parrayT = other->_parrayT;\r\n        this->_celemCapacity = other->_celemCapacity;\r\n        other->_parray = nullptr;\r\n        other->_celem = 0;\r\n        other->_parrayT = nullptr;\r\n        other->_celemCapacity = 0;\r\n    }\r\n\r\n    void Attach(T* parray, size_t celem)\r\n    {\r\n        RemoveAll();\r\n        this->_parray = parray;\r\n        this->_celem = celem;\r\n        _celemCapacity = celem;\r\n    }\r\n\r\n    size_t GetCapacity() const\r\n    {\r\n        return _celemCapacity;\r\n    }\r\n\r\n    HRESULT Sort()\r\n    {\r\n        return SortEx(CompareHelper());\r\n    }\r\n\r\n    template <typename Comparer>\r\n    HRESULT SortEx(const Comparer& tcompare)\r\n    {\r\n        HRESULT hr = S_OK;\r\n\r\n        if (this->_celem > 1)\r\n        {\r\n            _parrayT = nullptr;\r\n            hr = Allocator::ReallocArray(nullptr, this->_celem / 2, &_parrayT);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                _MergeSort(tcompare, 0, this->_celem);\r\n                Allocator::Destroy(_parrayT);\r\n                _parrayT = nullptr;\r\n            }\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    HRESULT _EnsureCapacity(size_t celemCapacityDesired, size_t celemMaxCapacity = 4096)\r\n    {\r\n        HRESULT hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);\r\n        if (celemCapacityDesired > MaxSize)\r\n            return hr;\r\n\r\n        // If we have enough capacity, we're done\r\n        hr = S_OK;\r\n        size_t celemCapacityCur = _celemCapacity;\r\n        if (celemCapacityDesired <= celemCapacityCur)\r\n            return hr;\r\n\r\n        // Double the capacity\r\n        size_t celemCapacityT;\r\n        hr = SizeTMult(celemCapacityCur, 2, &celemCapacityT);\r\n        if (FAILED(hr))\r\n            return hr;\r\n\r\n        // Make sure we don't grow too much\r\n        celemCapacityT = celemCapacityT - celemCapacityCur > celemMaxCapacity ? celemCapacityCur + celemMaxCapacity : celemCapacityT;\r\n\r\n        // Cap at desired capacity and max capacity\r\n        celemCapacityT = celemCapacityDesired > celemCapacityT || celemCapacityT <= MaxSize ? max(celemCapacityDesired, celemCapacityT) : MaxSize;\r\n\r\n        // Realloc\r\n        T* pvArrayT;\r\n        hr = Allocator::ReallocArray(this->_parray, celemCapacityT, &pvArrayT);\r\n        if (FAILED(hr))\r\n            return hr;\r\n\r\n        _celemCapacity = celemCapacityT;\r\n        this->_parray = pvArrayT;\r\n\r\n        return hr;\r\n    }\r\n\r\n    HRESULT _MakeRoomAt(size_t iElem)\r\n    {\r\n        HRESULT hr = S_OK;\r\n\r\n        size_t cElemGrowTo = max(this->_celem, iElem) + 1;\r\n        if (cElemGrowTo > _celemCapacity)\r\n        {\r\n            hr = _EnsureCapacity(cElemGrowTo);\r\n        }\r\n\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            if (iElem < this->_celem)\r\n                memmove(std::addressof(this->_parray[iElem + 1]), std::addressof(this->_parray[iElem]), sizeof(T) * (this->_celem - iElem));\r\n            this->_celem = cElemGrowTo;\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    template <typename ArgType>\r\n    void _InternalSetAtIndex(size_t iElem, ArgType&& t)\r\n    {\r\n        T* newPos = std::addressof(this->_parray[iElem]);\r\n        if (newPos)\r\n            new(newPos) T(std::forward<ArgType>(t));\r\n    }\r\n\r\n    template <typename ArgType>\r\n    HRESULT _Add(ArgType&& t, size_t* piElemInsertedAt)\r\n    {\r\n        if (piElemInsertedAt)\r\n            *piElemInsertedAt = 0;\r\n\r\n        HRESULT hr = S_OK;\r\n\r\n        if (this->_celem == _celemCapacity)\r\n        {\r\n            hr = _EnsureCapacity(_celemCapacity + 1);\r\n        }\r\n\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            _InternalSetAtIndex(this->_celem++, std::forward<ArgType>(t));\r\n            if (piElemInsertedAt)\r\n                *piElemInsertedAt = this->_celem - 1;\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    template <typename ArgType>\r\n    HRESULT _AddSorted(ArgType&& t, size_t* piElemInsertedAt)\r\n    {\r\n        if (piElemInsertedAt)\r\n            *piElemInsertedAt = 0;\r\n\r\n        size_t iElemInsertAt;\r\n        this->BinarySearch(t, &iElemInsertAt);\r\n        return _InsertAt(std::forward<ArgType>(t), iElemInsertAt);\r\n    }\r\n\r\n    template <typename Comparer, typename ArgType>\r\n    HRESULT _AddSortedEx(const Comparer& tcompare, ArgType&& t, size_t* piElemInsertedAt)\r\n    {\r\n        if (piElemInsertedAt)\r\n            *piElemInsertedAt = 0;\r\n\r\n        size_t iElemInsertAt;\r\n        this->BinarySearchEx(tcompare, t, &iElemInsertAt);\r\n        return _InsertAt(std::forward<ArgType>(t), iElemInsertAt);\r\n    }\r\n\r\n    template <typename ArgType>\r\n    HRESULT _InsertAt(ArgType&& t, size_t iElem)\r\n    {\r\n        HRESULT hr = _MakeRoomAt(iElem);\r\n\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            _InternalSetAtIndex(iElem, std::forward<ArgType>(t));\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    template <typename ArgType>\r\n    HRESULT _SetAtIndex(size_t iElem, ArgType&& t)\r\n    {\r\n        HRESULT hr = TYPE_E_OUTOFBOUNDS;\r\n\r\n        if (iElem < this->_celem)\r\n        {\r\n            _InternalSetAtIndex(iElem, std::forward<ArgType>(t));\r\n            hr = S_OK;\r\n        }\r\n\r\n        return hr;\r\n    }\r\n\r\n    template <typename Comparer>\r\n    void _MergeThem(const Comparer& tcompare, size_t iFirst, size_t cElems)\r\n    {\r\n        size_t cHalf = cElems / 2;\r\n        T* parraySrc = &this->_parray[iFirst];\r\n        memcpy(_parrayT, parraySrc, sizeof(T) * cHalf);\r\n\r\n        size_t iIn1 = 0;\r\n        size_t iIn2 = cHalf;\r\n        size_t iOut = 0;\r\n        bool fDone = false;\r\n        while (!fDone)\r\n        {\r\n            if (tcompare.Compare(_parrayT[iIn1], parraySrc[iIn2]) > 0)\r\n            {\r\n                memmove(&parraySrc[iOut], &parraySrc[iIn2], sizeof(T));\r\n                ++iOut;\r\n                if (++iIn2 == cElems)\r\n                {\r\n                    memcpy(&parraySrc[iOut], &_parrayT[iIn1], sizeof(T) * (cElems - iOut));\r\n                    fDone = true;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                memmove(&parraySrc[iOut], &_parrayT[iIn1], sizeof(T));\r\n                ++iOut;\r\n                if (++iIn1 == cHalf)\r\n                {\r\n                    fDone = true;\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    template <typename Comparer>\r\n    void _MergeSort(const Comparer& tcompare, size_t iFirst, size_t cElems)\r\n    {\r\n        if (cElems == 1)\r\n            return;\r\n\r\n        if (cElems == 2)\r\n        {\r\n            if (tcompare.Compare(this->_parray[iFirst], this->_parray[iFirst + 1]) > 0)\r\n            {\r\n                memmove(_parrayT, &this->_parray[iFirst], sizeof(T));\r\n                memmove(&this->_parray[iFirst], &this->_parray[iFirst + 1], sizeof(T));\r\n                memmove(&this->_parray[iFirst + 1], _parrayT, sizeof(T));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            size_t cHalf = cElems >> 1;\r\n            _MergeSort(tcompare, iFirst, cHalf);\r\n            _MergeSort(tcompare, iFirst + cHalf, cElems - cHalf);\r\n            _MergeThem(tcompare, iFirst, cElems);\r\n        }\r\n    }\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    size_t MaxSize = UINT_MAX - 1,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T>\r\n>\r\nclass CCoSimpleArray : public CTSimpleArray<T, MaxSize, CTPolicyCoTaskMem<T>, CompareHelper>\r\n{\r\npublic:\r\n    CCoSimpleArray()\r\n    {\r\n    }\r\n\r\n    CCoSimpleArray(CCoSimpleArray&& other) noexcept\r\n    {\r\n        this->TransferData(&other);\r\n    }\r\n\r\n    CCoSimpleArray& operator=(CCoSimpleArray&& other) noexcept\r\n    {\r\n        if (this != &other)\r\n        {\r\n            this->TransferData(&other);\r\n        }\r\n        return *this;\r\n    }\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    size_t MaxSize = UINT_MAX - 1,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T>\r\n>\r\nclass CLocalSimpleArray : public CTSimpleArray<T, MaxSize, CTPolicyLocalMem<T>, CompareHelper>\r\n{\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    typename ElementAllocator,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T*>\r\n>\r\nclass CSimplePointerArray : public CCoSimpleArray<T*, UINT_MAX - 1, CompareHelper>\r\n{\r\npublic:\r\n    ~CSimplePointerArray()\r\n    {\r\n        RemoveAndReleaseAll();\r\n    }\r\n\r\n    HRESULT RemoveAndReleaseAt(size_t iElem)\r\n    {\r\n        T* pT;\r\n        HRESULT hr = this->GetAt(iElem, pT);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = this->RemoveAt(iElem);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                ElementAllocator::Destroy(pT);\r\n            }\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    void RemoveAndReleaseAll()\r\n    {\r\n        for (size_t i = 0; i < this->_celem; ++i)\r\n        {\r\n            ElementAllocator::Destroy(this->_parray[i]);\r\n        }\r\n        this->RemoveAll();\r\n    }\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T*>\r\n>\r\nclass CSimplePointerArrayNewMem : public CSimplePointerArray<T, CTContainer_PolicyNewMem, CompareHelper>\r\n{\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T*>\r\n>\r\nclass CSimplePointerArrayCoTaskMem : public CSimplePointerArray<T, CTPolicyCoTaskMem<T>, CompareHelper>\r\n{\r\n};\r\n\r\ntemplate <\r\n    typename T,\r\n    typename CompareHelper = CSimpleArrayStandardCompareHelper<T*>\r\n>\r\nclass CSimplePointerArrayLocalMem : public CSimplePointerArray<T, CTPolicyLocalMem<T>, CompareHelper>\r\n{\r\n};\r\n\r\ntemplate <typename T>\r\nclass CSimplePointerArrayRelease : public CSimplePointerArray<T, CTContainer_PolicyRelease<T>>\r\n{\r\n};\r\n\r\ntemplate <typename TCompare>\r\nclass CSimpleStringArrayBase : public CSimplePointerArrayCoTaskMem<WCHAR, TCompare>\r\n{\r\npublic:\r\n    HRESULT Find(const WCHAR* pszItem, size_t* piElem, size_t iStartAt = 0) const\r\n    {\r\n        return CSimplePointerArrayCoTaskMem<WCHAR, TCompare>::Find(const_cast<WCHAR*>(pszItem), piElem, iStartAt);\r\n    }\r\n\r\n    HRESULT BinarySearch(const WCHAR* pszItem, size_t* piElem) const\r\n    {\r\n        return CSimplePointerArrayCoTaskMem<WCHAR, TCompare>::BinarySearch(const_cast<WCHAR*>(pszItem), piElem);\r\n    }\r\n\r\n    HRESULT Remove(const WCHAR* pszItem, size_t* piElemRemovedAt = nullptr)\r\n    {\r\n        return CSimplePointerArrayCoTaskMem<WCHAR, TCompare>::Remove(const_cast<WCHAR*>(pszItem), piElemRemovedAt);\r\n    }\r\n};\r\n\r\nclass CSimpleCaseInsensitiveOrdinalStringArray : public CSimpleStringArrayBase<CSimpleArrayCaseInsensitiveOrdinalStringCompareHelper>\r\n{\r\n};\r\n\r\n\r\nclass CSimpleUserDefaultLocaleCaseInsensitiveStringArray : public CSimpleStringArrayBase<CSimpleArrayUserDefaultLocaleCaseInsensitiveCompareHelper>\r\n{\r\n};\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/SimpleBoxer.h",
    "content": "#pragma once\r\n\r\n// Define Windows.Foundation.IReference`1<String>\r\n\r\n#ifndef DEF___FIReference_1_HSTRING_USE\r\n#define DEF___FIReference_1_HSTRING_USE\r\n#if !defined(RO_NO_TEMPLATE_NAME)\r\nnamespace ABI { namespace Windows { namespace Foundation {\r\ntemplate <>\r\nstruct __declspec(uuid(\"fd416dfb-2a07-52eb-aae3-dfce14116c05\"))\r\nIReference<HSTRING> : IReference_impl<HSTRING>\r\n{\r\n    static const wchar_t* z_get_rc_name_impl()\r\n    {\r\n        return L\"Windows.Foundation.IReference`1<String>\";\r\n    }\r\n};\r\n// Define a typedef for the parameterized interface specialization's mangled name.\r\n// This allows code which uses the mangled name for the parameterized interface to access the\r\n// correct parameterized interface specialization.\r\ntypedef IReference<HSTRING> __FIReference_1_HSTRING_t;\r\n#define __FIReference_1_HSTRING ABI::Windows::Foundation::__FIReference_1_HSTRING_t\r\n/* Foundation */ } /* Windows */ } /* ABI */ }\r\n\r\n#endif // !defined(RO_NO_TEMPLATE_NAME)\r\n#endif /* DEF___FIReference_1_HSTRING_USE */\r\n\r\nnamespace SimpleBoxer\r\n{\r\n\r\ntemplate <typename T>\r\nclass Reference final\r\n    : public Microsoft::WRL::RuntimeClass<\r\n          ABI::Windows::Foundation::IReference<T>\r\n        , ABI::Windows::Foundation::IPropertyValue\r\n    >\r\n{\r\npublic:\r\n    Reference(const T& value)\r\n        : _value(value)\r\n    {\r\n    }\r\n\r\n    //~ Begin IInspectable Interface\r\n    STDMETHODIMP GetRuntimeClassName(HSTRING* runtimeName) override\r\n    {\r\n        *runtimeName = nullptr;\r\n        HRESULT hr = S_OK;\r\n        auto name = ABI::Windows::Foundation::IReference<T>::z_get_rc_name_impl();\r\n        if (name != nullptr)\r\n        {\r\n            hr = WindowsCreateString(name, static_cast<UINT32>(wcslen(name)), runtimeName);\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    STDMETHODIMP GetTrustLevel(TrustLevel* trustLvl) override\r\n    {\r\n        *trustLvl = BaseTrust;\r\n        return S_OK;\r\n    }\r\n    //~ End IInspectable Interface\r\n\r\n    //~ Begin ABI::Windows::Foundation::IReference<T> Interface\r\n    STDMETHODIMP get_Value(T* value) override\r\n    {\r\n        *value = _value;\r\n        return S_OK;\r\n    }\r\n    //~ End ABI::Windows::Foundation::IReference<T> Interface\r\n\r\n    //~ Begin ABI::Windows::Foundation::IPropertyValue Interface\r\n    STDMETHODIMP get_Type(ABI::Windows::Foundation::PropertyType* value) override\r\n    {\r\n        *value = ABI::Windows::Foundation::PropertyType_OtherType; return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP get_IsNumericScalar(boolean* value) override\r\n    {\r\n        *value = std::is_arithmetic_v<T> || std::is_enum_v<T>;\r\n        return S_OK;\r\n    }\r\n\r\n    STDMETHODIMP GetUInt8(BYTE* value) override { return _ToScalar<BYTE>(value); }\r\n    STDMETHODIMP GetInt16(INT16* value) override { return _ToScalar<INT16>(value); }\r\n    STDMETHODIMP GetUInt16(UINT16* value) override { return _ToScalar<UINT16>(value); }\r\n    STDMETHODIMP GetInt32(INT32* value) override { return _ToScalar<INT32>(value); }\r\n    STDMETHODIMP GetUInt32(UINT32* value) override { return _ToScalar<UINT32>(value); }\r\n    STDMETHODIMP GetInt64(INT64* value) override { return _ToScalar<INT64>(value); }\r\n    STDMETHODIMP GetUInt64(UINT64* value) override { return _ToScalar<UINT64>(value); }\r\n\r\n    STDMETHODIMP GetSingle(FLOAT* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetDouble(DOUBLE* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetChar16(WCHAR* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetBoolean(boolean* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetString(HSTRING* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetGuid(GUID* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetDateTime(ABI::Windows::Foundation::DateTime* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetTimeSpan(ABI::Windows::Foundation::TimeSpan* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetPoint(ABI::Windows::Foundation::Point* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetSize(ABI::Windows::Foundation::Size* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetRect(ABI::Windows::Foundation::Rect* value) override { *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetUInt8Array(UINT32* valueLength, BYTE** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetInt16Array(UINT32* valueLength, INT16** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetUInt16Array(UINT32* valueLength, UINT16** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetInt32Array(UINT32* valueLength, INT32** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetUInt32Array(UINT32* valueLength, UINT32** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetInt64Array(UINT32* valueLength, INT64** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetUInt64Array(UINT32* valueLength, UINT64** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetSingleArray(UINT32* valueLength, FLOAT** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetDoubleArray(UINT32* valueLength, DOUBLE** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetChar16Array(UINT32* valueLength, WCHAR** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetBooleanArray(UINT32* valueLength, boolean** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetStringArray(UINT32* valueLength, HSTRING** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetInspectableArray(UINT32* valueLength, IInspectable*** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetGuidArray(UINT32* valueLength, GUID** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetDateTimeArray(UINT32* valueLength, ABI::Windows::Foundation::DateTime** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetTimeSpanArray(UINT32* valueLength, ABI::Windows::Foundation::TimeSpan** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetPointArray(UINT32* valueLength, ABI::Windows::Foundation::Point** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetSizeArray(UINT32* valueLength, ABI::Windows::Foundation::Size** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    STDMETHODIMP GetRectArray(UINT32* valueLength, ABI::Windows::Foundation::Rect** value) override { *valueLength = {}; *value = {}; return E_NOTIMPL; }\r\n    //~ End ABI::Windows::Foundation::IPropertyValue Interface\r\n\r\nprivate:\r\n    template <typename To>\r\n    HRESULT _ToScalar(To* pTo) const\r\n    {\r\n        if constexpr (std::is_arithmetic_v<T> || std::is_enum_v<T>)\r\n        {\r\n            *pTo = static_cast<To>(_value);\r\n            return S_OK;\r\n        }\r\n        else\r\n        {\r\n            *pTo = {};\r\n            return E_NOTIMPL;\r\n        }\r\n    }\r\n\r\n    T _value;\r\n};\r\n\r\ntemplate <typename T, typename = void>\r\nstruct reference_traits\r\n{\r\n    static HRESULT Create(const T& value, IInspectable** ppPropertyValue)\r\n    {\r\n        HRESULT hr = E_OUTOFMEMORY;\r\n        Microsoft::WRL::ComPtr<Reference<T>> spReference = Microsoft::WRL::Make<Reference<T>>(value);\r\n        if (spReference.Get())\r\n        {\r\n            *ppPropertyValue = static_cast<ABI::Windows::Foundation::IReference<T>*>(spReference.Detach());\r\n            hr = S_OK;\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    static HRESULT Create(\r\n        ABI::Windows::Foundation::IPropertyValueStatics*, const T& value, IInspectable** ppPropertyValue)\r\n    {\r\n        return Create(value, ppPropertyValue);\r\n    }\r\n\r\n    using InterfaceType = ABI::Windows::Foundation::IReference<T>;\r\n};\r\n\r\n#define DEFINE_REFERENCE_TRAITS_2(typeCpp, typeWinRt, creatorFuncName) \\\r\n    template <> \\\r\n    struct reference_traits<typeCpp> \\\r\n    { \\\r\n        static HRESULT Create(typeWinRt const& value, IInspectable** ppPropertyValue) \\\r\n        { \\\r\n            *ppPropertyValue = nullptr; \\\r\n            HSTRING_HEADER hstrH; \\\r\n            HSTRING hstr; \\\r\n            HRESULT hr = WindowsCreateStringReference( \\\r\n                RuntimeClass_Windows_Foundation_PropertyValue, \\\r\n                ARRAYSIZE(RuntimeClass_Windows_Foundation_PropertyValue) - 1, &hstrH, &hstr); \\\r\n            if (SUCCEEDED(hr)) \\\r\n            { \\\r\n                ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics = nullptr; \\\r\n                hr = GetActivationFactory(hstr, &pPropertyValueStatics); \\\r\n                if (SUCCEEDED(hr)) \\\r\n                { \\\r\n                    IInspectable* pPropertyValue = nullptr; \\\r\n                    hr = pPropertyValueStatics->creatorFuncName(value, &pPropertyValue); \\\r\n                    if (SUCCEEDED(hr)) \\\r\n                    { \\\r\n                        *ppPropertyValue = pPropertyValue; \\\r\n                    } \\\r\n                    pPropertyValueStatics->Release(); \\\r\n                } \\\r\n            } \\\r\n            return hr; \\\r\n        } \\\r\n        static HRESULT Create( \\\r\n            ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics, typeWinRt const& value, \\\r\n            IInspectable** ppPropertyValue) \\\r\n        { \\\r\n            return pPropertyValueStatics->creatorFuncName(value, ppPropertyValue); \\\r\n        } \\\r\n        using InterfaceType = ABI::Windows::Foundation::IReference<typeWinRt>; \\\r\n    };\r\n\r\n#define DEFINE_REFERENCE_TRAITS(typeCpp, creatorFuncName) \\\r\n    DEFINE_REFERENCE_TRAITS_2(typeCpp, typeCpp, creatorFuncName)\r\n\r\n// DEFINE_REFERENCE_TRAITS(BYTE, CreateUInt8);\r\nDEFINE_REFERENCE_TRAITS(UINT16, CreateUInt16);\r\nDEFINE_REFERENCE_TRAITS(INT16, CreateInt16);\r\nDEFINE_REFERENCE_TRAITS(UINT32, CreateUInt32);\r\nDEFINE_REFERENCE_TRAITS(INT32, CreateInt32);\r\nDEFINE_REFERENCE_TRAITS(UINT64, CreateUInt64);\r\nDEFINE_REFERENCE_TRAITS(INT64, CreateInt64);\r\nDEFINE_REFERENCE_TRAITS(float, CreateSingle);\r\nDEFINE_REFERENCE_TRAITS(double, CreateDouble);\r\nDEFINE_REFERENCE_TRAITS(WCHAR, CreateChar16);\r\nDEFINE_REFERENCE_TRAITS(bool, CreateBoolean);\r\nDEFINE_REFERENCE_TRAITS_2(boolean, bool, CreateBoolean);\r\nDEFINE_REFERENCE_TRAITS(HSTRING, CreateString);\r\nDEFINE_REFERENCE_TRAITS(IInspectable*, CreateInspectable);\r\nDEFINE_REFERENCE_TRAITS(GUID, CreateGuid);\r\nDEFINE_REFERENCE_TRAITS(ABI::Windows::Foundation::DateTime, CreateDateTime);\r\nDEFINE_REFERENCE_TRAITS(ABI::Windows::Foundation::TimeSpan, CreateTimeSpan);\r\nDEFINE_REFERENCE_TRAITS(ABI::Windows::Foundation::Point, CreatePoint);\r\nDEFINE_REFERENCE_TRAITS(ABI::Windows::Foundation::Size, CreateSize);\r\nDEFINE_REFERENCE_TRAITS(ABI::Windows::Foundation::Rect, CreateRect);\r\n\r\n#undef DEFINE_REFERENCE_TRAITS_2\r\n#undef DEFINE_REFERENCE_TRAITS\r\n\r\n// Make it easy to convert from a C string to an HSTRING\r\n// Note: we don't check for null terminators!\r\n\r\ntemplate <typename T>\r\nstruct reference_traits<T, std::enable_if_t<std::is_array_v<std::remove_reference_t<T>> && std::is_same_v<std::remove_extent_t<std::remove_reference_t<T>>, const wchar_t>>>\r\n{\r\n    template <size_t N>\r\n    static HRESULT Create(const wchar_t (&value)[N], IInspectable** ppPropertyValue)\r\n    {\r\n        static_assert(static_cast<size_t>(static_cast<unsigned int>(N-1)) == N-1,\r\n            \"String length underflow or overflow\");\r\n        *ppPropertyValue = nullptr;\r\n        HSTRING_HEADER hstrH;\r\n        HSTRING hstr;\r\n        HRESULT hr = WindowsCreateStringReference(value, N - 1, &hstrH, &hstr);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = reference_traits<HSTRING>::Create(hstr, ppPropertyValue);\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    template <size_t N>\r\n    static HRESULT Create(\r\n        ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics, const wchar_t (&value)[N],\r\n        IInspectable** ppPropertyValue)\r\n    {\r\n        static_assert(static_cast<size_t>(static_cast<unsigned int>(N-1)) == N-1,\r\n            \"String length underflow or overflow\");\r\n        *ppPropertyValue = nullptr;\r\n        HSTRING_HEADER hstrH;\r\n        HSTRING hstr;\r\n        HRESULT hr = WindowsCreateStringReference(value, N - 1, &hstrH, &hstr);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = reference_traits<HSTRING>::Create(pPropertyValueStatics, hstr, ppPropertyValue);\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    using InterfaceType = ABI::Windows::Foundation::IReference<HSTRING>;\r\n};\r\n\r\ntemplate <typename T>\r\nstruct reference_traits<T, std::enable_if_t<std::is_convertible_v<T, const wchar_t*>>>\r\n{\r\n    static HRESULT Create(const wchar_t* value, IInspectable** ppPropertyValue)\r\n    {\r\n        *ppPropertyValue = nullptr;\r\n        HSTRING_HEADER hstrH;\r\n        HSTRING hstr;\r\n        HRESULT hr = WindowsCreateStringReference(value, static_cast<UINT32>(wcslen(value)), &hstrH, &hstr);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = reference_traits<HSTRING>::Create(hstr, ppPropertyValue);\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    static HRESULT Create(\r\n        ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics, const wchar_t* value,\r\n        IInspectable** ppPropertyValue)\r\n    {\r\n        *ppPropertyValue = nullptr;\r\n        HSTRING_HEADER hstrH;\r\n        HSTRING hstr;\r\n        HRESULT hr = WindowsCreateStringReference(value, static_cast<UINT32>(wcslen(value)), &hstrH, &hstr);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            hr = reference_traits<HSTRING>::Create(pPropertyValueStatics, hstr, ppPropertyValue);\r\n        }\r\n        return hr;\r\n    }\r\n\r\n    using InterfaceType = ABI::Windows::Foundation::IReference<HSTRING>;\r\n};\r\n\r\ntemplate <typename T>\r\nstruct reference_traits<T, std::enable_if_t<std::is_enum_v<T>>>\r\n{\r\n    static HRESULT Create(const T& value, IInspectable** ppPropertyValue)\r\n    {\r\n        return reference_traits<std::underlying_type_t<T>>::Create(static_cast<std::underlying_type_t<T>>(value), ppPropertyValue);\r\n    }\r\n\r\n    using InterfaceType = ABI::Windows::Foundation::IReference<std::underlying_type_t<T>>;\r\n};\r\n\r\ntemplate <typename T>\r\nHRESULT BoxValue(const T& value, IInspectable** ppBoxed)\r\n{\r\n    return reference_traits<T>::Create(value, ppBoxed);\r\n}\r\n\r\ntemplate <typename T>\r\nMicrosoft::WRL::ComPtr<IInspectable> InlineBoxValue(const T& value)\r\n{\r\n    Microsoft::WRL::ComPtr<IInspectable> spBoxed;\r\n    reference_traits<T>::Create(value, &spBoxed);\r\n    return spBoxed;\r\n}\r\n\r\ntemplate <typename T, typename = std::enable_if_t<std::is_base_of_v<IInspectable, T>>>\r\nHRESULT BoxValue(T* value, IInspectable** ppBoxed)\r\n{\r\n    *ppBoxed = value;\r\n    if (value)\r\n    {\r\n        value->AddRef();\r\n    }\r\n    return S_OK;\r\n}\r\n\r\ntemplate <typename T, typename = std::enable_if_t<std::is_base_of_v<IInspectable, T>>>\r\nMicrosoft::WRL::ComPtr<IInspectable> InlineBoxValue(T* value)\r\n{\r\n    return value;\r\n}\r\n\r\ntemplate <typename T>\r\nHRESULT BoxValue(\r\n    ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics, const T& value, IInspectable** ppBoxed)\r\n{\r\n    return reference_traits<T>::Create(pPropertyValueStatics, value, ppBoxed);\r\n}\r\n\r\ntemplate <typename T>\r\nMicrosoft::WRL::ComPtr<IInspectable> InlineBoxValue(\r\n    ABI::Windows::Foundation::IPropertyValueStatics* pPropertyValueStatics, const T& value)\r\n{\r\n    Microsoft::WRL::ComPtr<IInspectable> spBoxed;\r\n    reference_traits<T>::Create(pPropertyValueStatics, value, &spBoxed);\r\n    return spBoxed;\r\n}\r\n\r\ntemplate <typename T, typename = std::enable_if_t<std::is_base_of_v<IInspectable, T>>>\r\nHRESULT BoxValue(ABI::Windows::Foundation::IPropertyValueStatics*, T* value, IInspectable** ppBoxed)\r\n{\r\n    *ppBoxed = value;\r\n    if (value)\r\n    {\r\n        value->AddRef();\r\n    }\r\n    return S_OK;\r\n}\r\n\r\ntemplate <typename T, typename = std::enable_if_t<std::is_base_of_v<IInspectable, T>>>\r\nMicrosoft::WRL::ComPtr<IInspectable> InlineBoxValue(ABI::Windows::Foundation::IPropertyValueStatics*, T* value)\r\n{\r\n    return value;\r\n}\r\n\r\n// For object types deriving from IInspectable\r\ntemplate <typename T, typename = std::enable_if_t<std::is_base_of_v<IInspectable, T>>>\r\nHRESULT UnboxValue(IInspectable* pBoxed, T** ppObject)\r\n{\r\n    return pBoxed->QueryInterface(IID_PPV_ARGS(ppObject));\r\n}\r\n\r\n// For HSTRING\r\ninline HRESULT UnboxValue(IInspectable* pBoxed, HSTRING* pValue)\r\n{\r\n    *pValue = nullptr;\r\n\r\n    if (!pBoxed)\r\n    {\r\n        return E_NOINTERFACE;\r\n    }\r\n\r\n    ABI::Windows::Foundation::IReference<HSTRING>* pTemp = nullptr;\r\n    HRESULT hr = pBoxed->QueryInterface(IID_PPV_ARGS(&pTemp));\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING value = nullptr;\r\n        hr = pTemp->get_Value(&value);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            *pValue = value;\r\n        }\r\n\r\n        pTemp->Release();\r\n    }\r\n\r\n    return hr;\r\n}\r\n\r\n// For value types\r\ntemplate <typename T>\r\nHRESULT UnboxValue(IInspectable* pBoxed, T* pValue)\r\n{\r\n    *pValue = {};\r\n\r\n    if (!pBoxed)\r\n    {\r\n        return E_NOINTERFACE;\r\n    }\r\n\r\n    HRESULT hr;\r\n\r\n    if constexpr (std::is_enum_v<T>)\r\n    {\r\n        // @Note: MIDLRT does not generate IReference template specializations for enums.\r\n        /*ABI::Windows::Foundation::IReference<T>* pTemp = nullptr;\r\n        hr = pBoxed->QueryInterface(IID_PPV_ARGS(&pTemp));\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            T value = {};\r\n            hr = pTemp->get_Value(&value);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                *pValue = value;\r\n            }\r\n\r\n            pTemp->Release();\r\n        }\r\n        else*/\r\n        {\r\n            ABI::Windows::Foundation::IReference<std::underlying_type_t<T>>* pTemp2 = nullptr;\r\n            hr = pBoxed->QueryInterface(IID_PPV_ARGS(&pTemp2));\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                std::underlying_type_t<T> value = {};\r\n                hr = pTemp2->get_Value(&value);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    *pValue = static_cast<T>(value);\r\n                }\r\n\r\n                pTemp2->Release();\r\n            }\r\n        }\r\n    }\r\n    else\r\n    {\r\n        typename reference_traits<T>::InterfaceType* pTemp = nullptr;\r\n        hr = pBoxed->QueryInterface(IID_PPV_ARGS(&pTemp));\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            T value = {};\r\n            hr = pTemp->get_Value(&value);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                *pValue = value;\r\n            }\r\n\r\n            pTemp->Release();\r\n        }\r\n    }\r\n\r\n    return hr;\r\n}\r\n\r\n// Allow inference from Microsoft::WRL::ComPtrRef\r\ntemplate <typename T, std::enable_if_t<std::is_base_of_v<IInspectable, T>, int> = 0>\r\nHRESULT UnboxValue(IInspectable* pBoxed, Microsoft::WRL::Details::ComPtrRef<Microsoft::WRL::ComPtr<T>> ppObject)\r\n{\r\n    return UnboxValue(pBoxed, ppObject.ReleaseAndGetAddressOf());\r\n}\r\n\r\n#define SimpleBoxer_HrInitVars(hrVarName) \\\r\n    Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IPropertyValueStatics> _SimpleBoxer_spPropertyValueStatics; \\\r\n    if (SUCCEEDED(hrVarName)) \\\r\n    { \\\r\n        HSTRING_HEADER hstrH; \\\r\n        HSTRING hstr; \\\r\n        hrVarName = WindowsCreateStringReference( \\\r\n            RuntimeClass_Windows_Foundation_PropertyValue, \\\r\n            ARRAYSIZE(RuntimeClass_Windows_Foundation_PropertyValue) - 1, &hstrH, &hstr); \\\r\n        if (SUCCEEDED(hrVarName)) \\\r\n        { \\\r\n            hrVarName = GetActivationFactory(hstr, &_SimpleBoxer_spPropertyValueStatics); \\\r\n        } \\\r\n    }(void)0 \\\r\n\r\n#define SimpleBoxer_WilInitVars() \\\r\n    HRESULT _SimpleBoxer_hrInit = S_OK; \\\r\n    SimpleBoxer_HrInitVars(_SimpleBoxer_hrInit); \\\r\n    RETURN_IF_FAILED(_SimpleBoxer_hrInit)\r\n\r\n#define SimpleBoxer_BoxValue(value, ppBoxed) \\\r\n    SimpleBoxer::BoxValue(_SimpleBoxer_spPropertyValueStatics.Get(), value, ppBoxed)\r\n\r\n#define SimpleBoxer_InlineBoxValue(value) \\\r\n    SimpleBoxer::InlineBoxValue(_SimpleBoxer_spPropertyValueStatics.Get(), value)\r\n\r\n}\r\n\r\n#pragma comment(lib, \"oleaut32.lib\")\r\n\r\n// Use SysFreeString to free the returned string!\r\nnamespace SimpleStringer\r\n{\r\n#define DEFINE_STRINGER(type, func) \\\r\n    inline HRESULT GenericToString(type value, WCHAR** ppszOut) \\\r\n    { \\\r\n        return ::func(value, LOCALE_USER_DEFAULT, 0, ppszOut); \\\r\n    }\r\n\r\n    DEFINE_STRINGER(BYTE, VarBstrFromUI1);\r\n    DEFINE_STRINGER(SHORT, VarBstrFromI2);\r\n    DEFINE_STRINGER(INT, VarBstrFromI4);\r\n    DEFINE_STRINGER(LONG, VarBstrFromI4);\r\n    DEFINE_STRINGER(LONG64, VarBstrFromI8);\r\n    DEFINE_STRINGER(FLOAT, VarBstrFromR4);\r\n    DEFINE_STRINGER(DOUBLE, VarBstrFromR8);\r\n    // DEFINE_STRINGER(VARIANT_BOOL, VarBstrFromBool);\r\n    DEFINE_STRINGER(CHAR, VarBstrFromI1);\r\n    DEFINE_STRINGER(USHORT, VarBstrFromUI2);\r\n    DEFINE_STRINGER(UINT, VarBstrFromUI4);\r\n    DEFINE_STRINGER(ULONG, VarBstrFromUI4);\r\n    DEFINE_STRINGER(ULONG64, VarBstrFromUI8);\r\n\r\n#undef DEFINE_STRINGER\r\n\r\n    // Special case\r\n    inline HRESULT BoolToString(bool value, WCHAR** ppszOut)\r\n    {\r\n        return VarBstrFromBool(value ? VARIANT_TRUE : VARIANT_FALSE, LOCALE_USER_DEFAULT, 0, ppszOut);\r\n    }\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/inc/memsafe.h",
    "content": "// Downloaded from:\r\n// https://github.com/namealt/winsdk10/blob/d1acc505c51b11a6ceafb0f93c9dc584b8b4a9d3/Include/10.0.16299.0/um/memsafe.h\r\n//\r\n//    Copyright (C) Microsoft.  All rights reserved.\r\n//\r\n#if (_MSC_VER > 1000)\r\n#pragma once\r\n#endif\r\n\r\n#ifndef __memsafe_h__\r\n#define __memsafe_h__\r\n\r\n#ifdef __cplusplus\r\n\r\n//\r\n//  Various heap allocation helpers, featuring\r\n//    - Fully annotated\r\n//    - HRESULT return values\r\n//    - Integer overflow checks via intsafe.h\r\n//    - Type safety via templates (no typecasting required)\r\n//    - Zero initialization\r\n//\r\n//  CoAllocBytes\r\n//  CoReallocBytes\r\n//  CoAllocObject\r\n//  CoAllocArray\r\n//  CoReallocArray\r\n//\r\n//  CoAllocString\r\n//  CoAllocStringLen\r\n//  CoAllocStringDoubleNullTerminate\r\n//  CoAllocStringOpt\r\n//\r\n//  LocalAllocBytes\r\n//  LocalReallocBytes\r\n//  LocalAllocObject\r\n//  LocalAllocArray\r\n//  LocalReallocArray\r\n//\r\n//  LocalAllocString\r\n//  LocalAllocStringLen\r\n//  LocalAllocStringDoubleNullTerminate\r\n//  LocalAllocStringOpt\r\n//\r\n//  HeapAllocBytes\r\n//  HeapReallocBytes\r\n//  HeapAllocObject\r\n//  HeapAllocArray\r\n//  HeapReallocArray\r\n//\r\n//  HeapAllocString\r\n//  HeapAllocStringLen\r\n//  HeapAllocStringDoubleNullTerminate\r\n//  HeapAllocStringOpt\r\n//\r\n//  GlobalAllocBytes\r\n//  GlobalReallocBytes\r\n//  GlobalAllocObject\r\n//  GlobalAllocArray\r\n//  GlobalReallocArray\r\n//\r\n//  GlobalAllocString\r\n//  GlobalAllocStringLen\r\n//  GlobalAllocStringDoubleNullTerminate\r\n//  GlobalAllocStringOpt\r\n//\r\n\r\n#include <intsafe.h>\r\n#include <strsafe.h>\r\n\r\n// Flag for inhibiting zero-initialization\r\n#define NO_ZERO_INIT        0x00000000\r\n\r\n// Templates for isolating T* <--> void* conversions and integer arithmetic\r\n\r\ntemplate <class T, class TAllocPolicy>\r\n inline HRESULT _AllocBytes(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return TAllocPolicy::Alloc(hHeap, dwFlags, cb, (void**)ppv);\r\n}\r\n\r\ntemplate <class T, class TAllocPolicy>\r\ninline HRESULT _ReallocBytes(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return TAllocPolicy::Realloc(hHeap, dwFlags, pv, cb, (void**)ppv);\r\n}\r\n\r\ntemplate <class T, class TAllocPolicy>\r\ninline HRESULT _AllocArray(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    *ppv = NULL;\r\n    size_t cb;\r\n    HRESULT hr = SizeTMult(cItems, sizeof(T), &cb);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = TAllocPolicy::Alloc(hHeap, dwFlags, cb, (void**)ppv);\r\n    }\r\n    return hr;\r\n}\r\n\r\ntemplate <class T, class TAllocPolicy>\r\ninline HRESULT _ReallocArray(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    *ppv = NULL;\r\n    size_t cb;\r\n    HRESULT hr = SizeTMult(cItems, sizeof(T), &cb);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = TAllocPolicy::Realloc(hHeap, dwFlags, pv, cb, (void**)ppv);\r\n    }\r\n    return hr;\r\n}\r\n\r\n// Templates for isolating string-specific functionality\r\n\r\ntemplate <class TAllocPolicy>\r\ninline HRESULT _AllocStringWorker(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_reads_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _In_ size_t cchExtra, _Outptr_result_buffer_(cch+cchExtra) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    *ppsz = NULL;\r\n    size_t cchTotal;\r\n    HRESULT hr = SizeTAdd(cch, cchExtra, &cchTotal);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        // Note that we do not require dwFlags to include the allocator-specific\r\n        // zero-initialization flag here.\r\n        hr = _AllocArray<WCHAR,TAllocPolicy>(hHeap, dwFlags, cchTotal, ppsz);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            // The source string may be shorter than cch, so zero-initialize\r\n            // the entire buffer using STRSAFE_FILL_BEHIND_NULL.\r\n            //\r\n            // Note that _AllocStringDoubleNullTerminate relies on\r\n            // zero-initialization to provide the 2nd NULL terminator.\r\n            StringCchCopyNExW(*ppsz, cchTotal, pszSource, cch, NULL, NULL, STRSAFE_IGNORE_NULLS | STRSAFE_FILL_BEHIND_NULL);\r\n        }\r\n    }\r\n    return hr;\r\n}\r\n\r\ntemplate <class TAllocPolicy>\r\ninline HRESULT _AllocString(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    // pszSource must be valid (non-NULL)\r\n    return _AllocStringWorker<TAllocPolicy>(hHeap, dwFlags, pszSource, wcslen(pszSource), 1, ppsz);\r\n}\r\n\r\ntemplate <class TAllocPolicy>\r\ninline HRESULT _AllocStringLen(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_reads_or_z_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    // pszSource is optional (may be NULL)\r\n    return _AllocStringWorker<TAllocPolicy>(hHeap, dwFlags, pszSource, cch, 1, ppsz);\r\n}\r\n\r\n//  Takes a single-null terminated string and allocates a double-null terminated string.\r\ntemplate <class TAllocPolicy>\r\ninline HRESULT _AllocStringDoubleNullTerminate(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz)\r\n{\r\n    // pszSource must be valid (non-NULL)\r\n    return _AllocStringWorker<TAllocPolicy>(hHeap, dwFlags, pszSource, wcslen(pszSource), 2, ppsz);\r\n}\r\n\r\ntemplate <class TAllocPolicy>\r\ninline HRESULT _AllocStringOpt(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    // pszSource is optional (may be NULL)\r\n    if (pszSource != NULL)\r\n    {\r\n        return _AllocString<TAllocPolicy>(hHeap, dwFlags, pszSource, ppsz);\r\n    }\r\n    *ppsz = NULL;\r\n    return S_OK;\r\n}\r\n\r\n#ifndef NO_COALLOC_HELPERS\r\n\r\n#include <objbase.h>\r\n\r\n// CoTaskMemAlloc does not zero-initialize by default. Define a flag to enable\r\n// zero-init behavior.\r\n#define CO_MEM_ZERO_INIT    0x00000001\r\n\r\nclass CTCoAllocPolicy\r\n{\r\nprivate:\r\n#if (NTDDI_VERSION < NTDDI_WIN10_RS1) || defined(COM_SUPPORT_MALLOC_SPIES)\r\n    static size_t _CoTaskMemSize(_In_ _Post_writable_byte_size_(return) void *pv)\r\n    {\r\n        size_t cb = 0;\r\n        IMalloc *pMalloc;\r\n        if (SUCCEEDED(CoGetMalloc(1, &pMalloc))) // should never fail (static v-table)\r\n        {\r\n            // Returns (size_t)-1 if pv is NULL.\r\n            // Result is indeterminate if pv does not belong to CoTaskMemAlloc.\r\n            cb = pMalloc->GetSize(pv);\r\n            pMalloc->Release();\r\n        }\r\n        return cb;\r\n    }\r\n#endif\r\n\r\npublic:\r\n    static HRESULT Alloc(_In_opt_ HANDLE /*hHeap*/, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        *ppv = CoTaskMemAlloc(cb);\r\n        if (*ppv)\r\n        {\r\n            if (dwFlags & CO_MEM_ZERO_INIT)\r\n            {\r\n#ifdef COM_SUPPORT_MALLOC_SPIES\r\n                // Zero-initialize the buffer\r\n                // The actual size might be larger than cb due to spies present.\r\n                // Initialize to the actual size in case of realloc later,\r\n                // or there might be an uninitialized gap in between.\r\n                size_t cbActual = _CoTaskMemSize(*ppv);\r\n                ZeroMemory(*ppv, cbActual);\r\n#else\r\n                ZeroMemory(*ppv, cb);\r\n#endif\r\n            }\r\n            return S_OK;\r\n        }\r\n        return E_OUTOFMEMORY;\r\n    }\r\n\r\n    static HRESULT Realloc(_In_opt_ HANDLE /*hHeap*/, _In_ DWORD dwFlags, _In_opt_ void *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n#if (NTDDI_VERSION < NTDDI_WIN10_RS1)\r\n        size_t cbKeepIntact = 0;\r\n\r\n        if (pv && (dwFlags & CO_MEM_ZERO_INIT))\r\n        {\r\n            // Get the current size, so we know how much to zero-initialize\r\n            cbKeepIntact = _CoTaskMemSize(pv);\r\n            if (cb < cbKeepIntact)\r\n            {\r\n                // Shrinking the buffer, only keep the new size\r\n                cbKeepIntact = cb;\r\n            }\r\n        }\r\n#else\r\n        // As of Redstone CoTaskMemRealloc always zero-initializes \r\n        // the tail of the allocation.\r\n        size_t cbKeepIntact = cb;\r\n#endif\r\n\r\n        // If pv is NULL, CoTaskMemRealloc allocates a new block\r\n        *ppv = CoTaskMemRealloc(pv, cb);\r\n\r\n        if (*ppv)\r\n        {\r\n            if (dwFlags & CO_MEM_ZERO_INIT)\r\n            {\r\n                // Zero-initialize the trailing part of the buffer\r\n#ifdef COM_SUPPORT_MALLOC_SPIES\r\n                // The actual size might be larger than cb due to due to spies present.\r\n                size_t cbActual = _CoTaskMemSize(*ppv);\r\n#else\r\n                size_t cbActual = cb;\r\n#endif\r\n                if (cbActual > cbKeepIntact)\r\n                {\r\n                    ZeroMemory(((BYTE*)*ppv) + cbKeepIntact, cbActual - cbKeepIntact);\r\n                }\r\n            }\r\n            return S_OK;\r\n        }\r\n        return E_OUTOFMEMORY;\r\n    }\r\n};\r\n\r\n// CoTaskMemAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT CoAllocBytes(_In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTCoAllocPolicy>(NULL, dwFlags, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoReallocBytes(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocBytes<T, CTCoAllocPolicy>(NULL, dwFlags, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoAllocObject(_In_ DWORD dwFlags, _Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTCoAllocPolicy>(NULL, dwFlags, sizeof(T), ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoAllocArray(_In_ DWORD dwFlags, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocArray<T, CTCoAllocPolicy>(NULL, dwFlags, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoReallocArray(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocArray<T, CTCoAllocPolicy>(NULL, dwFlags, pv, cItems, ppv);\r\n}\r\n\r\n// Zero-initializing CoTaskMemAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT CoAllocBytes(_In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return CoAllocBytes(CO_MEM_ZERO_INIT, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoReallocBytes(_In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return CoReallocBytes(CO_MEM_ZERO_INIT, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoAllocObject(_Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return CoAllocObject(CO_MEM_ZERO_INIT, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoAllocArray(_In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return CoAllocArray(CO_MEM_ZERO_INIT, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT CoReallocArray(_In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return CoReallocArray(CO_MEM_ZERO_INIT, pv, cItems, ppv);\r\n}\r\n\r\n// CoTaskMemAlloc string helpers\r\n\r\ninline HRESULT CoAllocString(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    return _AllocString<CTCoAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT CoAllocStringLen( _In_reads_or_z_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringLen<CTCoAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, cch, ppsz);\r\n}\r\n\r\ninline HRESULT CoAllocStringDoubleNullTerminate(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz)\r\n{\r\n    return _AllocStringDoubleNullTerminate<CTCoAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT CoAllocStringOpt(_In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringOpt<CTCoAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\n#endif  // NO_COALLOC_HELPERS\r\n\r\n#ifndef NO_LOCALALLOC_HELPERS\r\n\r\nclass CTLocalAllocPolicy\r\n{\r\npublic:\r\n    static HRESULT Alloc(_In_opt_ HANDLE /*hHeap*/, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        // ignore flags other than zero-init, assume fixed\r\n        *ppv = LocalAlloc(LMEM_FIXED | (dwFlags & LMEM_ZEROINIT), cb);\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n\r\n    static HRESULT Realloc(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ void *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        if (pv == NULL)\r\n        {\r\n            return Alloc(hHeap, dwFlags, cb, ppv);\r\n        }\r\n\r\n        // LMEM_MOVEABLE is correct when reallocating LMEM_FIXED buffers\r\n        *ppv = LocalReAlloc(pv, cb, LMEM_MOVEABLE | (dwFlags & LMEM_ZEROINIT));\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n};\r\n\r\n// LocalAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT LocalAllocBytes(_In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTLocalAllocPolicy>(NULL, dwFlags, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalReallocBytes(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocBytes<T, CTLocalAllocPolicy>(NULL, dwFlags, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalAllocObject(_In_ DWORD dwFlags, _Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTLocalAllocPolicy>(NULL, dwFlags, sizeof(T), ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalAllocArray(_In_ DWORD dwFlags, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocArray<T, CTLocalAllocPolicy>(NULL, dwFlags, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalReallocArray(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocArray<T, CTLocalAllocPolicy>(NULL, dwFlags, pv, cItems, ppv);\r\n}\r\n\r\n// Zero-initializing LocalAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT LocalAllocBytes(_In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return LocalAllocBytes(LMEM_ZEROINIT, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalReallocBytes(_In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return LocalReallocBytes(LMEM_ZEROINIT, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalAllocObject(_Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return LocalAllocObject(LMEM_ZEROINIT, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalAllocArray(_In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return LocalAllocArray(LMEM_ZEROINIT, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT LocalReallocArray(_In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return LocalReallocArray(LMEM_ZEROINIT, pv, cItems, ppv);\r\n}\r\n\r\n// LocalAlloc string helpers\r\n\r\ninline HRESULT LocalAllocString(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    return _AllocString<CTLocalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT LocalAllocStringLen( _In_reads_or_z_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringLen<CTLocalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, cch, ppsz);\r\n}\r\n\r\ninline HRESULT LocalAllocStringDoubleNullTerminate(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz) //todo sal 00?\r\n{\r\n    return _AllocStringDoubleNullTerminate<CTLocalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT LocalAllocStringOpt(_In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringOpt<CTLocalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\n#endif  // NO_LOCALALLOC_HELPERS\r\n\r\n#ifndef NO_HEAPALLOC_HELPERS\r\n\r\nclass CTHeapAllocPolicy\r\n{\r\npublic:\r\n    static HRESULT Alloc(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        *ppv = HeapAlloc(hHeap, dwFlags, cb);\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n\r\n    static HRESULT Realloc(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ void *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        if (pv == NULL)\r\n        {\r\n            return Alloc(hHeap, dwFlags, cb, ppv);\r\n        }\r\n        *ppv = HeapReAlloc(hHeap, dwFlags, pv, cb);\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n};\r\n\r\n// HeapAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT HeapAllocBytes(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTHeapAllocPolicy>(hHeap, dwFlags, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapReallocBytes(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocBytes<T, CTHeapAllocPolicy>(hHeap, dwFlags, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapAllocObject(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTHeapAllocPolicy>(hHeap, dwFlags, sizeof(T), ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapAllocArray(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocArray<T, CTHeapAllocPolicy>(hHeap, dwFlags, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapReallocArray(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocArray<T, CTHeapAllocPolicy>(hHeap, dwFlags, pv, cItems, ppv);\r\n}\r\n\r\n// Zero-initializing HeapAlloc helpers (process heap)\r\n\r\ntemplate <class T>\r\n inline HRESULT HeapAllocBytes(_In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return HeapAllocBytes(GetProcessHeap(), HEAP_ZERO_MEMORY, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapReallocBytes(_In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return HeapReallocBytes(GetProcessHeap(), HEAP_ZERO_MEMORY, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapAllocObject(_Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return HeapAllocObject(GetProcessHeap(), HEAP_ZERO_MEMORY, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapAllocArray(_In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return HeapAllocArray(GetProcessHeap(), HEAP_ZERO_MEMORY, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT HeapReallocArray(_In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return HeapReallocArray(GetProcessHeap(), HEAP_ZERO_MEMORY, pv, cItems, ppv);\r\n}\r\n\r\n// HeapAlloc string helpers\r\n\r\ninline HRESULT HeapAllocString(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    return _AllocString<CTHeapAllocPolicy>(hHeap, dwFlags, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringLen(_In_ HANDLE hHeap, _In_ DWORD dwFlags,  _In_reads_or_z_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringLen<CTHeapAllocPolicy>(hHeap, dwFlags, pszSource, cch, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringDoubleNullTerminate(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz)\r\n{\r\n    return _AllocStringDoubleNullTerminate<CTHeapAllocPolicy>(hHeap, dwFlags, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringOpt(_In_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringOpt<CTHeapAllocPolicy>(hHeap, dwFlags, pszSource, ppsz);\r\n}\r\n\r\n// HeapAlloc string helpers (process heap)\r\n\r\ninline HRESULT HeapAllocString(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    return HeapAllocString(GetProcessHeap(), NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringLen(_In_reads_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return HeapAllocStringLen(GetProcessHeap(), NO_ZERO_INIT, pszSource, cch, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringDoubleNullTerminate(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz)\r\n{\r\n    return HeapAllocStringDoubleNullTerminate(GetProcessHeap(), NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT HeapAllocStringOpt(_In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return HeapAllocStringOpt(GetProcessHeap(), NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\n#endif  // NO_HEAPALLOC_HELPERS\r\n\r\n#ifndef NO_GLOBALALLOC_HELPERS\r\n\r\nclass CTGlobalAllocPolicy\r\n{\r\npublic:\r\n    static HRESULT Alloc(_In_opt_ HANDLE /*hHeap*/, _In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        // ignore flags other than zero-init, assume fixed\r\n        *ppv = GlobalAlloc(GMEM_FIXED | (dwFlags & GMEM_ZEROINIT), cb);\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n\r\n    static HRESULT Realloc(_In_opt_ HANDLE hHeap, _In_ DWORD dwFlags, _In_opt_ void *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) void **ppv)\r\n    {\r\n        if (pv == NULL)\r\n        {\r\n            return Alloc(hHeap, dwFlags, cb, ppv);\r\n        }\r\n\r\n        // GMEM_MOVEABLE is correct when reallocating GMEM_FIXED buffers\r\n        *ppv = GlobalReAlloc(pv, cb, GMEM_MOVEABLE | (dwFlags & GMEM_ZEROINIT));\r\n        return (*ppv) ? S_OK : E_OUTOFMEMORY;\r\n    }\r\n};\r\n\r\n// GlobalAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT GlobalAllocBytes(_In_ DWORD dwFlags, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTGlobalAllocPolicy>(NULL, dwFlags, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalReallocBytes(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocBytes<T, CTGlobalAllocPolicy>(NULL, dwFlags, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalAllocObject(_In_ DWORD dwFlags, _Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocBytes<T, CTGlobalAllocPolicy>(NULL, dwFlags, sizeof(T), ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalAllocArray(_In_ DWORD dwFlags, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _AllocArray<T, CTGlobalAllocPolicy>(NULL, dwFlags, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalReallocArray(_In_ DWORD dwFlags, _In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return _ReallocArray<T, CTGlobalAllocPolicy>(NULL, dwFlags, pv, cItems, ppv);\r\n}\r\n\r\n// Zero-initializing GlobalAlloc helpers\r\n\r\ntemplate <class T>\r\n inline HRESULT GlobalAllocBytes(_In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return GlobalAllocBytes<T>(GMEM_ZEROINIT, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalReallocBytes(_In_opt_ T *pv, _In_ size_t cb, _Outptr_result_bytebuffer_(cb) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return GlobalReallocBytes<T>(GMEM_ZEROINIT, pv, cb, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalAllocObject(_Outptr_result_buffer_(1) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return GlobalAllocObject<T>(GMEM_ZEROINIT, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalAllocArray(_In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return GlobalAllocArray<T>(GMEM_ZEROINIT, cItems, ppv);\r\n}\r\n\r\ntemplate <class T>\r\ninline HRESULT GlobalReallocArray(_In_opt_ T *pv, _In_ size_t cItems, _Outptr_result_buffer_(cItems) _On_failure_(_Post_satisfies_(*ppv == 0)) T **ppv)\r\n{\r\n    return GlobalReallocArray<T>(GMEM_ZEROINIT, pv, cItems, ppv);\r\n}\r\n\r\n// GlobalAlloc string helpers\r\n\r\ninline HRESULT GlobalAllocString(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PWSTR *ppsz)\r\n{\r\n    return _AllocString<CTGlobalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT GlobalAllocStringLen( _In_reads_or_z_opt_(cch) PCNZWCH pszSource, _In_ size_t cch, _Outptr_result_buffer_(cch+1) _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringLen<CTGlobalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, cch, ppsz);\r\n}\r\n\r\ninline HRESULT GlobalAllocStringDoubleNullTerminate(_In_ PCWSTR pszSource, _Outptr_result_nullonfailure_ PZZWSTR *ppsz)\r\n{\r\n    return _AllocStringDoubleNullTerminate<CTGlobalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\ninline HRESULT GlobalAllocStringOpt(_In_opt_ PCWSTR pszSource, _Outptr_result_maybenull_ _On_failure_(_Post_satisfies_(*ppsz == 0)) PWSTR *ppsz)\r\n{\r\n    return _AllocStringOpt<CTGlobalAllocPolicy>(NULL, NO_ZERO_INIT, pszSource, ppsz);\r\n}\r\n\r\n#endif  // NO_GLOBALALLOC_HELPERS\r\n\r\n#endif  // __cplusplus\r\n\r\n#endif  // __memsafe_h__\r\n\r\n"
  },
  {
    "path": "ExplorerPatcher/lvt.c",
    "content": "#include \"lvt.h\"\r\n\r\nWindows_UI_Xaml_IDependencyObject* LVT_FindChildByClassName(Windows_UI_Xaml_IDependencyObject* pRootDependencyObject, Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics, LPCWSTR pwszRefName, INT* prevIndex)\r\n{\r\n    if (!pRootDependencyObject)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n    //WCHAR wszDebug[MAX_PATH];\r\n    HRESULT hr = S_OK;\r\n    INT32 Count = -1;\r\n    hr = pVisualTreeHelperStatics->lpVtbl->GetChildrenCount(pVisualTreeHelperStatics, pRootDependencyObject, &Count);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        for (INT32 Index = (prevIndex ? *prevIndex : 0); Index < Count; ++Index)\r\n        {\r\n            Windows_UI_Xaml_IDependencyObject* pChild = NULL;\r\n            hr = pVisualTreeHelperStatics->lpVtbl->GetChild(pVisualTreeHelperStatics, pRootDependencyObject, Index, &pChild);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                HSTRING hsChild = NULL;\r\n                pChild->lpVtbl->GetRuntimeClassName(pChild, &hsChild);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    PCWSTR pwszName = WindowsGetStringRawBuffer(hsChild, 0);\r\n                    //swprintf_s(wszDebug, MAX_PATH, L\"Name: %s\\n\", pwszName);\r\n                    //OutputDebugStringW(wszDebug);\r\n                    if (!_wcsicmp(pwszName, pwszRefName))\r\n                    {\r\n                        WindowsDeleteString(hsChild);\r\n                        if (prevIndex) *prevIndex = Index + 1;\r\n                        return pChild;\r\n                    }\r\n                    WindowsDeleteString(hsChild);\r\n                }\r\n                pChild->lpVtbl->Release(pChild);\r\n            }\r\n        }\r\n    }\r\n\r\n    if (prevIndex) *prevIndex = Count;\r\n    return NULL;\r\n}\r\n\r\nWindows_UI_Xaml_IDependencyObject* LVT_FindChildByName(Windows_UI_Xaml_IDependencyObject* pRootDependencyObject, Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics, LPCWSTR pwszRefName)\r\n{\r\n    if (!pRootDependencyObject)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n    //WCHAR wszDebug[MAX_PATH];\r\n    HRESULT hr = S_OK;\r\n    INT32 Count = -1;\r\n    hr = pVisualTreeHelperStatics->lpVtbl->GetChildrenCount(pVisualTreeHelperStatics, pRootDependencyObject, &Count);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        for (INT32 Index = 0; Index < Count; ++Index)\r\n        {\r\n            Windows_UI_Xaml_IDependencyObject* pChild = NULL;\r\n            hr = pVisualTreeHelperStatics->lpVtbl->GetChild(pVisualTreeHelperStatics, pRootDependencyObject, Index, &pChild);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;\r\n                hr = pChild->lpVtbl->QueryInterface(pChild, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    HSTRING hsChild = NULL;\r\n                    pFrameworkElement->lpVtbl->get_Name(pFrameworkElement, &hsChild);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        PCWSTR pwszName = WindowsGetStringRawBuffer(hsChild, 0);\r\n                        //swprintf_s(wszDebug, MAX_PATH, L\"Name: %s\\n\", pwszName);\r\n                        //OutputDebugStringW(wszDebug);\r\n                        if (!_wcsicmp(pwszName, pwszRefName))\r\n                        {\r\n                            WindowsDeleteString(hsChild);\r\n                            pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                            return pChild;\r\n                        }\r\n                        WindowsDeleteString(hsChild);\r\n                    }\r\n                    pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                }\r\n                pChild->lpVtbl->Release(pChild);\r\n            }\r\n        }\r\n    }\r\n\r\n    return NULL;\r\n}\r\n\r\n// Referenece: https://www.reddit.com/r/Windows10/comments/nvcrie/windows_11_start_menu_how_to_temporary_make_your/\r\nvoid LVT_StartUI_EnableRoundedCorners(HWND hWnd, DWORD dwReceipe, DWORD dwPos, HWND hWndTaskbar, RECT* rect)\r\n{\r\n    WCHAR wszDebug[MAX_PATH];\r\n    HRESULT hr = S_OK;\r\n\r\n    Windows_UI_Xaml_IDependencyObject* pRootDependencyObject = NULL;\r\n    Windows_UI_Xaml_Controls_ICanvasStatics* pCanvasStatics = NULL;\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshControlsCanvasStatics;\r\n        HSTRING hsControlsCanvasStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Controls.Canvas\", 31, &hshControlsCanvasStatics, &hsControlsCanvasStatics);\r\n        if (SUCCEEDED(hr) && hsControlsCanvasStatics)\r\n        {\r\n            hr = RoGetActivationFactory(hsControlsCanvasStatics, &IID_Windows_UI_Xaml_Controls_ICanvasStatics, &pCanvasStatics);\r\n            WindowsDeleteString(hsControlsCanvasStatics);\r\n        }\r\n    }\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshWindowStatics;\r\n        HSTRING hsWindowStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Window\", 22, &hshWindowStatics, &hsWindowStatics);\r\n        if (SUCCEEDED(hr) && hsWindowStatics)\r\n        {\r\n            Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;\r\n            hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IWindow* pWindow = NULL;\r\n                hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    IInspectable* pUIElement = NULL;\r\n                    hr = pWindow->lpVtbl->get_Content(pWindow, &pUIElement);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        hr = pUIElement->lpVtbl->QueryInterface(pUIElement, &IID_Windows_UI_Xaml_IDependencyObject, &pRootDependencyObject);\r\n\r\n                        pUIElement->lpVtbl->Release(pUIElement);\r\n                    }\r\n                    pWindow->lpVtbl->Release(pWindow);\r\n                }\r\n                pWindowStatics->lpVtbl->Release(pWindowStatics);\r\n            }\r\n            WindowsDeleteString(hsWindowStatics);\r\n        }\r\n    }\r\n\r\n    if (pRootDependencyObject)\r\n    {\r\n        HSTRING_HEADER hshVisualTreeHelperStatics;\r\n        HSTRING hsVisualTreeHelperStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Media.VisualTreeHelper\", 38, &hshVisualTreeHelperStatics, &hsVisualTreeHelperStatics);\r\n        if (SUCCEEDED(hr) && hsVisualTreeHelperStatics)\r\n        {\r\n            Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics = NULL;\r\n            hr = RoGetActivationFactory(hsVisualTreeHelperStatics, &IID_Windows_UI_Xaml_IVisualTreeHelperStatics, &pVisualTreeHelperStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L\"StartUI.StartSizingFrame\", NULL);\r\n                if (pStartSizingFrame)\r\n                {\r\n                    int location = LVT_LOC_NONE;\r\n\r\n                    Windows_UI_Xaml_Thickness drc;\r\n                    drc.Left = 0.0; drc.Right = 0.0; drc.Top = 0.0; drc.Bottom = 0.0;\r\n                    Windows_UI_Xaml_IUIElement* pIUIElement = NULL;\r\n                    Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;\r\n                    pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);\r\n                    if (pIUIElement)\r\n                    {\r\n                        pCanvasStatics->lpVtbl->GetLeft(pCanvasStatics, pIUIElement, &(drc.Left));\r\n                        pCanvasStatics->lpVtbl->GetTop(pCanvasStatics, pIUIElement, &(drc.Top));\r\n                    }\r\n                    pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);\r\n                    if (pFrameworkElement)\r\n                    {\r\n                        pFrameworkElement->lpVtbl->get_ActualWidth(pFrameworkElement, &(drc.Right));\r\n                        pFrameworkElement->lpVtbl->get_ActualHeight(pFrameworkElement, &(drc.Bottom));\r\n                    }\r\n                    UINT dpi = GetDpiForWindow(hWnd);\r\n                    RECT rc;\r\n                    SetRect(&rc, drc.Left, drc.Top, drc.Right, drc.Bottom);\r\n                    SetRect(&rc, MulDiv(rc.left, dpi, 96), MulDiv(rc.top, dpi, 96), MulDiv(rc.right, dpi, 96), MulDiv(rc.bottom, dpi, 96));\r\n                    *rect = rc;\r\n                    HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY);\r\n                    MONITORINFO mi;\r\n                    ZeroMemory(&mi, sizeof(MONITORINFO));\r\n                    mi.cbSize = sizeof(MONITORINFO);\r\n                    GetMonitorInfoW(hMonitor, &mi);\r\n                    //swprintf(wszDebug, MAX_PATH, L\"RECT %d %d %d %d - %d %d %d %d\\n\", rc.left, rc.top, rc.right, rc.bottom, 0, 0, mi.rcWork.right - mi.rcWork.left, mi.rcWork.bottom - mi.rcWork.top);\r\n                    //OutputDebugStringW(wszDebug);\r\n                    if (!(rc.left == 0 && rc.top == 0 && abs(mi.rcWork.right - mi.rcWork.left - rc.right) < 5 && abs(mi.rcWork.bottom - mi.rcWork.top - rc.bottom) < 5))\r\n                    {\r\n                        if (rc.left == 0)\r\n                        {\r\n                            if (rc.top == 0)\r\n                            {\r\n                                location = LVT_LOC_TOPLEFT;\r\n                            }\r\n                            else\r\n                            {\r\n                                location = LVT_LOC_BOTTOMLEFT;\r\n                            }\r\n                        }\r\n                        else\r\n                        {\r\n                            location = LVT_LOC_TOPRIGHT;\r\n                        }\r\n                    }\r\n                    //swprintf_s(wszDebug, MAX_PATH, L\"Location: %d\\n\", location);\r\n                    //OutputDebugStringW(wszDebug);\r\n                    if (pFrameworkElement)\r\n                    {\r\n                        pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                    }\r\n                    if (pIUIElement)\r\n                    {\r\n                        pIUIElement->lpVtbl->Release(pIUIElement);\r\n                    }\r\n                    Windows_UI_Xaml_IDependencyObject* pStartSizingFramePanel = LVT_FindChildByClassName(pStartSizingFrame, pVisualTreeHelperStatics, L\"StartUI.StartSizingFramePanel\", NULL);\r\n                    if (pStartSizingFramePanel)\r\n                    {\r\n                        // Drop shadow\r\n                        Windows_UI_Xaml_IDependencyObject* pDropShadow = LVT_FindChildByClassName(pStartSizingFramePanel, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Image\", NULL);\r\n                        if (pDropShadow)\r\n                        {\r\n                            Windows_UI_Xaml_IUIElement* pIUIElement = NULL;\r\n                            pDropShadow->lpVtbl->QueryInterface(pDropShadow, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);\r\n                            if (pIUIElement)\r\n                            {\r\n                                if (dwReceipe)\r\n                                {\r\n                                    pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed);\r\n                                }\r\n                                else\r\n                                {\r\n                                    pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Visible);\r\n                                }\r\n                                pIUIElement->lpVtbl->Release(pIUIElement);\r\n                            }\r\n                            pDropShadow->lpVtbl->Release(pDropShadow);\r\n                        }\r\n                        Windows_UI_Xaml_IDependencyObject* pContentPresenter = LVT_FindChildByClassName(pStartSizingFramePanel, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.ContentPresenter\", NULL);\r\n                        if (pContentPresenter)\r\n                        {\r\n                            Windows_UI_Xaml_IDependencyObject* pFrame = LVT_FindChildByClassName(pContentPresenter, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Frame\", NULL);\r\n                            if (pFrame)\r\n                            {\r\n                                // Main menu padding\r\n                                Windows_UI_Xaml_Controls_IControl* pIBorder = NULL;\r\n                                pFrame->lpVtbl->QueryInterface(pFrame, &IID_Windows_UI_Xaml_Controls_IControl, &pIBorder);\r\n                                if (pIBorder)\r\n                                {\r\n                                    double pad = 12.0;\r\n                                    Windows_UI_Xaml_Thickness th;\r\n                                    if (location && dwReceipe == 1)\r\n                                    {\r\n                                        if (location == LVT_LOC_BOTTOMLEFT)\r\n                                        {\r\n                                            th.Left = dwReceipe ? pad : 0.0;\r\n                                            th.Bottom = dwReceipe ? pad : 0.0;\r\n                                            th.Right = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                            th.Top = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                        }\r\n                                        else if (location == LVT_LOC_TOPLEFT)\r\n                                        {\r\n                                            th.Left = dwReceipe ? pad : 0.0;\r\n                                            th.Bottom = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                            th.Right = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                            th.Top = dwReceipe ? pad : 0.0;\r\n                                        }\r\n                                        else if (location == LVT_LOC_TOPRIGHT)\r\n                                        {\r\n                                            th.Left = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                            th.Bottom = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                            th.Right = dwReceipe ? pad : 0.0;\r\n                                            th.Top = dwReceipe ? pad : 0.0;\r\n                                        }\r\n                                    }\r\n                                    else\r\n                                    {\r\n                                        th.Left = 0.0;\r\n                                        th.Bottom = 0.0;\r\n                                        th.Right = 0.0;\r\n                                        th.Top = 0.0;\r\n                                    }\r\n                                    pIBorder->lpVtbl->put_Padding(pIBorder, th);\r\n                                    pIBorder->lpVtbl->Release(pIBorder);\r\n                                }\r\n                                Windows_UI_Xaml_IDependencyObject* pContentPresenter2 = LVT_FindChildByClassName(pFrame, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.ContentPresenter\", NULL);\r\n                                if (pContentPresenter2)\r\n                                {\r\n                                    Windows_UI_Xaml_IDependencyObject* pSplitViewFrame = LVT_FindChildByClassName(pContentPresenter2, pVisualTreeHelperStatics, L\"StartUI.SplitViewFrame\", NULL);\r\n                                    if (pSplitViewFrame)\r\n                                    {\r\n                                        Windows_UI_Xaml_IDependencyObject* pRootGrid = LVT_FindChildByName(pSplitViewFrame, pVisualTreeHelperStatics, L\"RootGrid\");\r\n                                        if (pRootGrid)\r\n                                        {\r\n                                            // Main menu corners\r\n                                            Windows_UI_Xaml_IDependencyObject* pAcrylicBorder = LVT_FindChildByName(pRootGrid, pVisualTreeHelperStatics, L\"AcrylicBorder\");\r\n                                            if (pAcrylicBorder)\r\n                                            {\r\n                                                Windows_UI_Xaml_Controls_IBorder* pIBorder = NULL;\r\n                                                pAcrylicBorder->lpVtbl->QueryInterface(pAcrylicBorder, &IID_Windows_UI_Xaml_Controls_IBorder, &pIBorder);\r\n                                                if (pIBorder)\r\n                                                {\r\n                                                    double pad = 10.0;\r\n                                                    Windows_UI_Xaml_CornerRadius cr;\r\n                                                    if (location && dwReceipe == 2)\r\n                                                    {\r\n                                                        if (location == LVT_LOC_BOTTOMLEFT)\r\n                                                        {\r\n                                                            cr.BottomLeft = 0.0;\r\n                                                            cr.BottomRight = 0.0;\r\n                                                            cr.TopLeft = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                                            cr.TopRight = dwReceipe ? pad : 0.0;\r\n                                                        }\r\n                                                        else if (location == LVT_LOC_TOPLEFT)\r\n                                                        {\r\n                                                            cr.BottomLeft = (hWndTaskbar && (dwPos == 2)) ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                                            cr.BottomRight = dwReceipe ? pad : 0.0;\r\n                                                            cr.TopLeft = 0.0;\r\n                                                            cr.TopRight = (hWndTaskbar && (dwPos != 2)) ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                                        }\r\n                                                        else if (location == LVT_LOC_TOPRIGHT)\r\n                                                        {\r\n                                                            cr.BottomLeft = dwReceipe ? pad : 0.0;\r\n                                                            cr.BottomRight = 0.0;\r\n                                                            cr.TopLeft = hWndTaskbar ? (dwReceipe ? pad : 0.0) : 0.0;\r\n                                                            cr.TopRight = 0.0;\r\n                                                        }\r\n                                                    }\r\n                                                    else\r\n                                                    {\r\n                                                        cr.BottomLeft = (dwReceipe ? 10.0 : 0.0);\r\n                                                        cr.BottomRight = cr.BottomLeft;\r\n                                                        cr.TopLeft = cr.BottomLeft;\r\n                                                        cr.TopRight = cr.BottomLeft;\r\n                                                    }\r\n                                                    pIBorder->lpVtbl->put_CornerRadius(pIBorder, cr);\r\n                                                    pIBorder->lpVtbl->Release(pIBorder);\r\n                                                }\r\n                                                pAcrylicBorder->lpVtbl->Release(pAcrylicBorder);\r\n                                            }\r\n                                            // Live tiles corners\r\n                                            Windows_UI_Xaml_IDependencyObject* pRootContent = LVT_FindChildByName(pRootGrid, pVisualTreeHelperStatics, L\"RootContent\");\r\n                                            if (pRootContent)\r\n                                            {\r\n                                                Windows_UI_Xaml_IDependencyObject* pGrid = LVT_FindChildByClassName(pRootContent, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Grid\", NULL);\r\n                                                if (pGrid)\r\n                                                {\r\n                                                    Windows_UI_Xaml_IDependencyObject* pContentRoot = LVT_FindChildByName(pGrid, pVisualTreeHelperStatics, L\"ContentRoot\");\r\n                                                    if (pContentRoot)\r\n                                                    {\r\n                                                        Windows_UI_Xaml_IDependencyObject* pBorder = LVT_FindChildByClassName(pContentRoot, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Border\", NULL);\r\n                                                        if (pBorder)\r\n                                                        {\r\n                                                            Windows_UI_Xaml_IDependencyObject* pContentPaneGrid = LVT_FindChildByName(pBorder, pVisualTreeHelperStatics, L\"ContentPaneGrid\");\r\n                                                            if (pContentPaneGrid)\r\n                                                            {\r\n                                                                Windows_UI_Xaml_IDependencyObject* pGridPane = LVT_FindChildByName(pContentPaneGrid, pVisualTreeHelperStatics, L\"GridPane\");\r\n                                                                if (pGridPane)\r\n                                                                {\r\n                                                                    Windows_UI_Xaml_IDependencyObject* ppage = LVT_FindChildByName(pGridPane, pVisualTreeHelperStatics, L\"page\");\r\n                                                                    if (ppage)\r\n                                                                    {\r\n                                                                        Windows_UI_Xaml_IDependencyObject* pgridRoot = LVT_FindChildByName(ppage, pVisualTreeHelperStatics, L\"gridRoot\");\r\n                                                                        if (pgridRoot)\r\n                                                                        {\r\n                                                                            Windows_UI_Xaml_IDependencyObject* pgroupItems = LVT_FindChildByName(pgridRoot, pVisualTreeHelperStatics, L\"groupItems\");\r\n                                                                            if (pgroupItems)\r\n                                                                            {\r\n                                                                                Windows_UI_Xaml_IDependencyObject* pBorder2 = LVT_FindChildByClassName(pgroupItems, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Border\", NULL);\r\n                                                                                if (pBorder2)\r\n                                                                                {\r\n                                                                                    Windows_UI_Xaml_IDependencyObject* pScrollViewer = LVT_FindChildByName(pBorder2, pVisualTreeHelperStatics, L\"ScrollViewer\");\r\n                                                                                    if (pScrollViewer)\r\n                                                                                    {\r\n                                                                                        Windows_UI_Xaml_IDependencyObject* pBorder3 = LVT_FindChildByClassName(pScrollViewer, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Border\", NULL);\r\n                                                                                        if (pBorder3)\r\n                                                                                        {\r\n                                                                                            Windows_UI_Xaml_IDependencyObject* pGrid2 = LVT_FindChildByClassName(pBorder3, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Grid\", NULL);\r\n                                                                                            if (pGrid2)\r\n                                                                                            {\r\n                                                                                                Windows_UI_Xaml_IDependencyObject* pScrollContentPresenter = LVT_FindChildByName(pGrid2, pVisualTreeHelperStatics, L\"ScrollContentPresenter\");\r\n                                                                                                if (pScrollContentPresenter)\r\n                                                                                                {\r\n                                                                                                    Windows_UI_Xaml_IDependencyObject* pItemsPresenter = LVT_FindChildByClassName(pScrollContentPresenter, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.ItemsPresenter\", NULL);\r\n                                                                                                    if (pItemsPresenter)\r\n                                                                                                    {\r\n                                                                                                        Windows_UI_Xaml_IDependencyObject* pTileGrid = LVT_FindChildByClassName(pItemsPresenter, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.TileGrid\", NULL);\r\n                                                                                                        if (pTileGrid)\r\n                                                                                                        {\r\n                                                                                                            INT iIndex = 0;\r\n                                                                                                            BOOL bSkipFirst = TRUE;\r\n                                                                                                            while (TRUE)\r\n                                                                                                            {\r\n                                                                                                                Windows_UI_Xaml_IDependencyObject* pCurrentGroup = LVT_FindChildByClassName(pTileGrid, pVisualTreeHelperStatics, L\"StartUI.TileListViewItem\", &iIndex);\r\n                                                                                                                if (!pCurrentGroup)\r\n                                                                                                                {\r\n                                                                                                                    break;\r\n                                                                                                                }\r\n                                                                                                                if (bSkipFirst)\r\n                                                                                                                {\r\n                                                                                                                    bSkipFirst = FALSE;\r\n                                                                                                                    pCurrentGroup->lpVtbl->Release(pCurrentGroup);\r\n                                                                                                                    continue;\r\n                                                                                                                }\r\n                                                                                                                Windows_UI_Xaml_IDependencyObject* pcontentPresenter = LVT_FindChildByName(pCurrentGroup, pVisualTreeHelperStatics, L\"contentPresenter\");\r\n                                                                                                                if (pcontentPresenter)\r\n                                                                                                                {\r\n                                                                                                                    Windows_UI_Xaml_IDependencyObject* pTileGroupViewControl = LVT_FindChildByClassName(pcontentPresenter, pVisualTreeHelperStatics, L\"StartUI.TileGroupViewControl\", NULL);\r\n                                                                                                                    if (pTileGroupViewControl)\r\n                                                                                                                    {\r\n                                                                                                                        Windows_UI_Xaml_IDependencyObject* pGrid3 = LVT_FindChildByClassName(pTileGroupViewControl, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Grid\", NULL);\r\n                                                                                                                        if (pGrid3)\r\n                                                                                                                        {\r\n                                                                                                                            Windows_UI_Xaml_IDependencyObject* pNestedPanel = LVT_FindChildByName(pGrid3, pVisualTreeHelperStatics, L\"NestedPanel\");\r\n                                                                                                                            if (pNestedPanel)\r\n                                                                                                                            {\r\n                                                                                                                                INT jIndex = 0;\r\n                                                                                                                                while (TRUE)\r\n                                                                                                                                {\r\n                                                                                                                                    Windows_UI_Xaml_IDependencyObject* pCurrentTile = LVT_FindChildByClassName(pNestedPanel, pVisualTreeHelperStatics, L\"StartUI.TileListViewItem\", &jIndex);\r\n                                                                                                                                    if (!pCurrentTile)\r\n                                                                                                                                    {\r\n                                                                                                                                        break;\r\n                                                                                                                                    }\r\n                                                                                                                                    Windows_UI_Xaml_IDependencyObject* pcontentPresenter2 = LVT_FindChildByName(pCurrentTile, pVisualTreeHelperStatics, L\"contentPresenter\");\r\n                                                                                                                                    if (pcontentPresenter2)\r\n                                                                                                                                    {\r\n                                                                                                                                        Windows_UI_Xaml_IDependencyObject* pTileViewControl = LVT_FindChildByClassName(pcontentPresenter2, pVisualTreeHelperStatics, L\"StartUI.TileViewControl\", NULL);\r\n                                                                                                                                        if (pTileViewControl)\r\n                                                                                                                                        {\r\n                                                                                                                                            Windows_UI_Xaml_Controls_IGrid2* pIGrid2 = NULL;\r\n                                                                                                                                            pTileViewControl->lpVtbl->QueryInterface(pTileViewControl, &IID_Windows_UI_Xaml_Controls_IGrid2, &pIGrid2);\r\n                                                                                                                                            if (pIGrid2)\r\n                                                                                                                                            {\r\n                                                                                                                                                Windows_UI_Xaml_CornerRadius cr;\r\n                                                                                                                                                cr.BottomLeft = (dwReceipe ? 5.0 : 0.0);\r\n                                                                                                                                                cr.BottomRight = cr.BottomLeft;\r\n                                                                                                                                                cr.TopLeft = cr.BottomLeft;\r\n                                                                                                                                                cr.TopRight = cr.BottomLeft;\r\n                                                                                                                                                pIGrid2->lpVtbl->put_CornerRadius(pIGrid2, cr);\r\n                                                                                                                                                pIGrid2->lpVtbl->Release(pIGrid2);\r\n                                                                                                                                            }\r\n                                                                                                                                            pTileViewControl->lpVtbl->Release(pTileViewControl);\r\n                                                                                                                                        }\r\n                                                                                                                                        pcontentPresenter2->lpVtbl->Release(pcontentPresenter2);\r\n                                                                                                                                    }\r\n                                                                                                                                    pCurrentTile->lpVtbl->Release(pCurrentTile);\r\n                                                                                                                                }\r\n                                                                                                                                pNestedPanel->lpVtbl->Release(pNestedPanel);\r\n                                                                                                                            }\r\n                                                                                                                            pGrid3->lpVtbl->Release(pGrid3);\r\n                                                                                                                        }\r\n                                                                                                                        pTileGroupViewControl->lpVtbl->Release(pTileGroupViewControl);\r\n                                                                                                                    }\r\n                                                                                                                    pcontentPresenter->lpVtbl->Release(pcontentPresenter);\r\n                                                                                                                }\r\n                                                                                                                pCurrentGroup->lpVtbl->Release(pCurrentGroup);\r\n                                                                                                            }\r\n                                                                                                            pTileGrid->lpVtbl->Release(pTileGrid);\r\n                                                                                                        }\r\n                                                                                                        pItemsPresenter->lpVtbl->Release(pItemsPresenter);\r\n                                                                                                    }\r\n                                                                                                    pScrollContentPresenter->lpVtbl->Release(pScrollContentPresenter);\r\n                                                                                                }\r\n                                                                                                pGrid2->lpVtbl->Release(pGrid2);\r\n                                                                                            }\r\n                                                                                            pBorder3->lpVtbl->Release(pBorder3);\r\n                                                                                        }\r\n                                                                                        pScrollViewer->lpVtbl->Release(pScrollViewer);\r\n                                                                                    }\r\n                                                                                    pBorder2->lpVtbl->Release(pBorder2);\r\n                                                                                }\r\n                                                                                pgroupItems->lpVtbl->Release(pgroupItems);\r\n                                                                            }\r\n                                                                            pgridRoot->lpVtbl->Release(pgridRoot);\r\n                                                                        }\r\n                                                                        ppage->lpVtbl->Release(ppage);\r\n                                                                    }\r\n                                                                    pGridPane->lpVtbl->Release(pGridPane);\r\n                                                                }\r\n                                                                pContentPaneGrid->lpVtbl->Release(pContentPaneGrid);\r\n                                                            }\r\n                                                            pBorder->lpVtbl->Release(pBorder);\r\n                                                        }\r\n                                                        pContentRoot->lpVtbl->Release(pContentRoot);\r\n                                                    }\r\n                                                    pGrid->lpVtbl->Release(pGrid);\r\n                                                }\r\n                                                pRootContent->lpVtbl->Release(pRootContent);\r\n                                            }\r\n                                            pRootGrid->lpVtbl->Release(pRootGrid);\r\n                                        }\r\n                                        pSplitViewFrame->lpVtbl->Release(pSplitViewFrame);\r\n                                    }\r\n                                    pContentPresenter2->lpVtbl->Release(pContentPresenter2);\r\n                                }\r\n                                pFrame->lpVtbl->Release(pFrame);\r\n                            }\r\n                            pContentPresenter->lpVtbl->Release(pContentPresenter);\r\n                        }\r\n                        pStartSizingFramePanel->lpVtbl->Release(pStartSizingFramePanel);\r\n                    }\r\n                    pStartSizingFrame->lpVtbl->Release(pStartSizingFrame);\r\n                }\r\n                pVisualTreeHelperStatics->lpVtbl->Release(pVisualTreeHelperStatics);\r\n            }\r\n            WindowsDeleteString(hsVisualTreeHelperStatics);\r\n        }\r\n        pRootDependencyObject->lpVtbl->Release(pRootDependencyObject);\r\n    }\r\n\r\n    if (pCanvasStatics)\r\n    {\r\n        pCanvasStatics->lpVtbl->Release(pCanvasStatics);\r\n    }\r\n}\r\n\r\nvoid LVT_StartDocked_120DPIHack(int maxHeight)\r\n{\r\n    HRESULT hr = S_OK;\r\n    Windows_UI_Xaml_IDependencyObject* pRootDependencyObject = NULL;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshWindowStatics;\r\n        HSTRING hsWindowStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Window\", 22, &hshWindowStatics, &hsWindowStatics);\r\n        if (SUCCEEDED(hr) && hsWindowStatics)\r\n        {\r\n            Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;\r\n            hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IWindow* pWindow = NULL;\r\n                hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    IInspectable* pUIElement = NULL;\r\n                    hr = pWindow->lpVtbl->get_Content(pWindow, &pUIElement);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        hr = pUIElement->lpVtbl->QueryInterface(pUIElement, &IID_Windows_UI_Xaml_IDependencyObject, &pRootDependencyObject);\r\n\r\n                        pUIElement->lpVtbl->Release(pUIElement);\r\n                    }\r\n                    pWindow->lpVtbl->Release(pWindow);\r\n                }\r\n                pWindowStatics->lpVtbl->Release(pWindowStatics);\r\n            }\r\n            WindowsDeleteString(hsWindowStatics);\r\n        }\r\n    }\r\n    if (pRootDependencyObject)\r\n    {\r\n        HSTRING_HEADER hshVisualTreeHelperStatics;\r\n        HSTRING hsVisualTreeHelperStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Media.VisualTreeHelper\", 38, &hshVisualTreeHelperStatics, &hsVisualTreeHelperStatics);\r\n        if (SUCCEEDED(hr) && hsVisualTreeHelperStatics)\r\n        {\r\n            Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics = NULL;\r\n            hr = RoGetActivationFactory(hsVisualTreeHelperStatics, &IID_Windows_UI_Xaml_IVisualTreeHelperStatics, &pVisualTreeHelperStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L\"StartDocked.StartSizingFrame\", NULL);\r\n                if (pStartSizingFrame)\r\n                {\r\n                    Windows_UI_Xaml_IUIElement* pIUIElement = NULL;\r\n                    pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);\r\n                    if (pIUIElement)\r\n                    {\r\n                        Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;\r\n                        pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);\r\n                        if (pFrameworkElement)\r\n                        {\r\n                            if (!IsWindows11Version22H2Build1413OrHigher()) pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed);\r\n                            pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, maxHeight);\r\n                            if (!IsWindows11Version22H2Build1413OrHigher()) pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Visible);\r\n                            pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                        }\r\n                        pIUIElement->lpVtbl->Release(pIUIElement);\r\n                    }\r\n                    pStartSizingFrame->lpVtbl->Release(pStartSizingFrame);\r\n                }\r\n                pVisualTreeHelperStatics->lpVtbl->Release(pVisualTreeHelperStatics);\r\n            }\r\n            WindowsDeleteString(hsVisualTreeHelperStatics);\r\n        }\r\n        pRootDependencyObject->lpVtbl->Release(pRootDependencyObject);\r\n    }\r\n}\r\n\r\n// Reference: https://www.reddit.com/r/Windows11/comments/p1ksou/this_is_not_a_concept_microsoft_in_windows_11/\r\nvoid LVT_StartDocked_DisableRecommendedSection(HWND hWnd, BOOL bApply, RECT* rect)\r\n{\r\n    WCHAR wszDebug[MAX_PATH];\r\n    HRESULT hr = S_OK;\r\n\r\n    Windows_UI_Xaml_IDependencyObject* pRootDependencyObject = NULL;\r\n    Windows_UI_Xaml_Controls_ICanvasStatics* pCanvasStatics = NULL;\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshControlsCanvasStatics;\r\n        HSTRING hsControlsCanvasStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Controls.Canvas\", 31, &hshControlsCanvasStatics, &hsControlsCanvasStatics);\r\n        if (SUCCEEDED(hr) && hsControlsCanvasStatics)\r\n        {\r\n            hr = RoGetActivationFactory(hsControlsCanvasStatics, &IID_Windows_UI_Xaml_Controls_ICanvasStatics, &pCanvasStatics);\r\n            WindowsDeleteString(hsControlsCanvasStatics);\r\n        }\r\n    }\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshWindowStatics;\r\n        HSTRING hsWindowStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Window\", 22, &hshWindowStatics, &hsWindowStatics);\r\n        if (SUCCEEDED(hr) && hsWindowStatics)\r\n        {\r\n            Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;\r\n            hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IWindow* pWindow = NULL;\r\n                hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    IInspectable* pUIElement = NULL;\r\n                    hr = pWindow->lpVtbl->get_Content(pWindow, &pUIElement);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        hr = pUIElement->lpVtbl->QueryInterface(pUIElement, &IID_Windows_UI_Xaml_IDependencyObject, &pRootDependencyObject);\r\n\r\n                        pUIElement->lpVtbl->Release(pUIElement);\r\n                    }\r\n                    pWindow->lpVtbl->Release(pWindow);\r\n                }\r\n                pWindowStatics->lpVtbl->Release(pWindowStatics);\r\n            }\r\n            WindowsDeleteString(hsWindowStatics);\r\n        }\r\n    }\r\n\r\n    if (pRootDependencyObject)\r\n    {\r\n        HSTRING_HEADER hshVisualTreeHelperStatics;\r\n        HSTRING hsVisualTreeHelperStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Media.VisualTreeHelper\", 38, &hshVisualTreeHelperStatics, &hsVisualTreeHelperStatics);\r\n        if (SUCCEEDED(hr) && hsVisualTreeHelperStatics)\r\n        {\r\n            Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics = NULL;\r\n            hr = RoGetActivationFactory(hsVisualTreeHelperStatics, &IID_Windows_UI_Xaml_IVisualTreeHelperStatics, &pVisualTreeHelperStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IDependencyObject* pStartSizingFrame = LVT_FindChildByClassName(pRootDependencyObject, pVisualTreeHelperStatics, L\"StartDocked.StartSizingFrame\", NULL);\r\n                if (pStartSizingFrame)\r\n                {\r\n                    Windows_UI_Xaml_Thickness drc;\r\n                    drc.Left = 0.0; drc.Right = 0.0; drc.Top = 0.0; drc.Bottom = 0.0;\r\n                    Windows_UI_Xaml_IUIElement* pIUIElement = NULL;\r\n                    Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;\r\n                    pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);\r\n                    if (pIUIElement)\r\n                    {\r\n                        pCanvasStatics->lpVtbl->GetLeft(pCanvasStatics, pIUIElement, &(drc.Left));\r\n                        pCanvasStatics->lpVtbl->GetTop(pCanvasStatics, pIUIElement, &(drc.Top));\r\n                    }\r\n                    pStartSizingFrame->lpVtbl->QueryInterface(pStartSizingFrame, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);\r\n                    if (pFrameworkElement)\r\n                    {\r\n                        pFrameworkElement->lpVtbl->get_ActualWidth(pFrameworkElement, &(drc.Right));\r\n                        pFrameworkElement->lpVtbl->get_ActualHeight(pFrameworkElement, &(drc.Bottom));\r\n                    }\r\n                    UINT dpi = GetDpiForWindow(hWnd);\r\n                    RECT rc;\r\n                    SetRect(&rc, drc.Left, drc.Top, drc.Right, drc.Bottom);\r\n                    SetRect(&rc, MulDiv(rc.left, dpi, 96), MulDiv(rc.top, dpi, 96), MulDiv(rc.right, dpi, 96), MulDiv(rc.bottom, dpi, 96));\r\n                    *rect = rc;\r\n                    if (bApply && dpi == 120)\r\n                    {\r\n                        HANDLE hRealThreadHandle = NULL;\r\n                        DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hRealThreadHandle, THREAD_SET_CONTEXT, FALSE, 0);\r\n                        if (hRealThreadHandle)\r\n                        {\r\n                            QueueUserAPC(LVT_StartDocked_120DPIHack, hRealThreadHandle, 826);\r\n                            CloseHandle(hRealThreadHandle);\r\n                        }\r\n                    }\r\n                    else if (pFrameworkElement)\r\n                    {\r\n                        pFrameworkElement->lpVtbl->put_MaxHeight(pFrameworkElement, 726.0);\r\n                    }\r\n                    if (pFrameworkElement)\r\n                    {\r\n                        pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                    }\r\n                    if (pIUIElement)\r\n                    {\r\n                        pIUIElement->lpVtbl->Release(pIUIElement);\r\n                    }\r\n                    Windows_UI_Xaml_IDependencyObject* pStartSizingFramePanel = LVT_FindChildByClassName(pStartSizingFrame, pVisualTreeHelperStatics, L\"StartDocked.StartSizingFramePanel\", NULL);\r\n                    if (pStartSizingFramePanel)\r\n                    {\r\n                        Windows_UI_Xaml_IDependencyObject* pContentPresenter = LVT_FindChildByClassName(pStartSizingFramePanel, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.ContentPresenter\", NULL);\r\n                        if (pContentPresenter)\r\n                        {\r\n                            Windows_UI_Xaml_IDependencyObject* pFrame = LVT_FindChildByClassName(pContentPresenter, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.Frame\", NULL);\r\n                            if (pFrame)\r\n                            {\r\n                                Windows_UI_Xaml_IDependencyObject* pContentPresenter2 = LVT_FindChildByClassName(pFrame, pVisualTreeHelperStatics, L\"Windows.UI.Xaml.Controls.ContentPresenter\", NULL);\r\n                                if (pContentPresenter2)\r\n                                {\r\n                                    Windows_UI_Xaml_IDependencyObject* pLauncherFrame = LVT_FindChildByClassName(pContentPresenter2, pVisualTreeHelperStatics, L\"StartDocked.LauncherFrame\", NULL);\r\n                                    if (pLauncherFrame)\r\n                                    {\r\n                                        Windows_UI_Xaml_IDependencyObject* pRootPanel = LVT_FindChildByName(pLauncherFrame, pVisualTreeHelperStatics, L\"RootPanel\");\r\n                                        Windows_UI_Xaml_IDependencyObject* pRootGridParent = pRootPanel;\r\n                                        if (!pRootGridParent)\r\n                                        {\r\n                                            pRootGridParent = pLauncherFrame;\r\n                                        }\r\n                                        Windows_UI_Xaml_IDependencyObject* pRootGrid = LVT_FindChildByName(pRootGridParent, pVisualTreeHelperStatics, L\"RootGrid\");\r\n                                        if (pRootGrid)\r\n                                        {\r\n                                            Windows_UI_Xaml_IDependencyObject* pRootContent = LVT_FindChildByName(pRootGrid, pVisualTreeHelperStatics, L\"RootContent\");\r\n                                            if (pRootContent)\r\n                                            {\r\n                                                Windows_UI_Xaml_IDependencyObject* pMainContent = LVT_FindChildByName(pRootContent, pVisualTreeHelperStatics, L\"MainContent\");\r\n                                                if (pMainContent)\r\n                                                {\r\n                                                    Windows_UI_Xaml_IDependencyObject* pInnerContent = NULL;\r\n                                                    Windows_UI_Xaml_IDependencyObject* pUndockedRoot = LVT_FindChildByName(pMainContent, pVisualTreeHelperStatics, L\"UndockedRoot\");\r\n                                                    if (!pUndockedRoot)\r\n                                                    {\r\n                                                        pInnerContent = LVT_FindChildByName(pMainContent, pVisualTreeHelperStatics, L\"InnerContent\");\r\n                                                        if (pInnerContent)\r\n                                                        {\r\n                                                            pUndockedRoot = LVT_FindChildByName(pInnerContent, pVisualTreeHelperStatics, L\"UndockedRoot\");\r\n                                                        }\r\n                                                    }\r\n                                                    if (pUndockedRoot)\r\n                                                    {\r\n                                                        Windows_UI_Xaml_IDependencyObject* pStartInnerFrame = LVT_FindChildByClassName(pUndockedRoot, pVisualTreeHelperStatics, L\"StartMenu.StartInnerFrame\", NULL);\r\n                                                        if (pStartInnerFrame)\r\n                                                        {\r\n                                                            Windows_UI_Xaml_IDependencyObject* pFrameRoot = LVT_FindChildByName(pStartInnerFrame, pVisualTreeHelperStatics, L\"FrameRoot\");\r\n                                                            if (pFrameRoot)\r\n                                                            {\r\n                                                                Windows_UI_Xaml_IDependencyObject* pTopLevelRoot = LVT_FindChildByName(pFrameRoot, pVisualTreeHelperStatics, L\"TopLevelRoot\");\r\n                                                                if (pTopLevelRoot)\r\n                                                                {\r\n                                                                    Windows_UI_Xaml_IDependencyObject* pStartMenuPinnedList = LVT_FindChildByName(pTopLevelRoot, pVisualTreeHelperStatics, L\"StartMenuPinnedList\");\r\n                                                                    if (pStartMenuPinnedList)\r\n                                                                    {\r\n                                                                        Windows_UI_Xaml_IFrameworkElement* pFrameworkElement = NULL;\r\n                                                                        pStartMenuPinnedList->lpVtbl->QueryInterface(pStartMenuPinnedList, &IID_Windows_UI_Xaml_IFrameworkElement, &pFrameworkElement);\r\n                                                                        if (pFrameworkElement)\r\n                                                                        {\r\n                                                                            static double StartMenuPinnedList_Height = 252.0;\r\n                                                                            double tempStartMenuPinnedList_Height = 0.0;\r\n                                                                            if (SUCCEEDED(pFrameworkElement->lpVtbl->get_Height(pFrameworkElement, &tempStartMenuPinnedList_Height)) && tempStartMenuPinnedList_Height != 510.0) StartMenuPinnedList_Height = tempStartMenuPinnedList_Height;\r\n\r\n                                                                            if (bApply)\r\n                                                                            {\r\n                                                                                pFrameworkElement->lpVtbl->put_Height(pFrameworkElement, 510.0);\r\n                                                                            }\r\n                                                                            else\r\n                                                                            {\r\n                                                                                pFrameworkElement->lpVtbl->put_Height(pFrameworkElement, StartMenuPinnedList_Height);\r\n                                                                            }\r\n                                                                            pFrameworkElement->lpVtbl->Release(pFrameworkElement);\r\n                                                                        }\r\n                                                                        Windows_UI_Xaml_IDependencyObject* pRoot = LVT_FindChildByName(pStartMenuPinnedList, pVisualTreeHelperStatics, L\"Root\");\r\n                                                                        if (pRoot)\r\n                                                                        {\r\n                                                                            Windows_UI_Xaml_IDependencyObject* pPinnedListPipsPager = LVT_FindChildByName(pRoot, pVisualTreeHelperStatics, L\"PinnedListPipsPager\");\r\n                                                                            if (pPinnedListPipsPager)\r\n                                                                            {\r\n                                                                                Windows_UI_Xaml_IUIElement* pIUIElement = NULL;\r\n                                                                                pPinnedListPipsPager->lpVtbl->QueryInterface(pPinnedListPipsPager, &IID_Windows_UI_Xaml_IUIElement, &pIUIElement);\r\n                                                                                if (pIUIElement)\r\n                                                                                {\r\n                                                                                    if (bApply)\r\n                                                                                    {\r\n                                                                                        pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Collapsed);\r\n                                                                                    }\r\n                                                                                    else\r\n                                                                                    {\r\n                                                                                        pIUIElement->lpVtbl->put_Visibility(pIUIElement, Windows_UI_Xaml_Visibility_Visible);\r\n                                                                                    }\r\n                                                                                    pIUIElement->lpVtbl->Release(pIUIElement);\r\n                                                                                }\r\n                                                                                pPinnedListPipsPager->lpVtbl->Release(pPinnedListPipsPager);\r\n                                                                            }\r\n                                                                            pRoot->lpVtbl->Release(pRoot);\r\n                                                                        }\r\n                                                                        pStartMenuPinnedList->lpVtbl->Release(pStartMenuPinnedList);\r\n                                                                    }\r\n                                                                    pTopLevelRoot->lpVtbl->Release(pTopLevelRoot);\r\n                                                                }\r\n                                                                pFrameRoot->lpVtbl->Release(pFrameRoot);\r\n                                                            }\r\n                                                            pStartInnerFrame->lpVtbl->Release(pStartInnerFrame);\r\n                                                        }\r\n                                                        pUndockedRoot->lpVtbl->Release(pUndockedRoot);\r\n                                                    }\r\n                                                    if (pInnerContent)\r\n                                                    {\r\n                                                        pInnerContent->lpVtbl->Release(pInnerContent);\r\n                                                    }\r\n                                                    pMainContent->lpVtbl->Release(pMainContent);\r\n                                                }\r\n                                                pRootContent->lpVtbl->Release(pRootContent);\r\n                                            }\r\n                                            pRootGrid->lpVtbl->Release(pRootGrid);\r\n                                        }\r\n                                        if (pRootPanel)\r\n                                        {\r\n                                            pRootPanel->lpVtbl->Release(pRootPanel);\r\n                                        }\r\n                                        pLauncherFrame->lpVtbl->Release(pLauncherFrame);\r\n                                    }\r\n                                    pContentPresenter2->lpVtbl->Release(pContentPresenter2);\r\n                                }\r\n                                pFrame->lpVtbl->Release(pFrame);\r\n                            }\r\n                            pContentPresenter->lpVtbl->Release(pContentPresenter);\r\n                        }\r\n                        pStartSizingFramePanel->lpVtbl->Release(pStartSizingFramePanel);\r\n                    }\r\n                    pStartSizingFrame->lpVtbl->Release(pStartSizingFrame);\r\n                }\r\n                pVisualTreeHelperStatics->lpVtbl->Release(pVisualTreeHelperStatics);\r\n            }\r\n            WindowsDeleteString(hsVisualTreeHelperStatics);\r\n        }\r\n        pRootDependencyObject->lpVtbl->Release(pRootDependencyObject);\r\n    }\r\n\r\n    if (pCanvasStatics)\r\n    {\r\n        pCanvasStatics->lpVtbl->Release(pCanvasStatics);\r\n    }\r\n}\r\n\r\nHRESULT IsThreadCoreWindowVisible(BOOL* bIsVisible)\r\n{\r\n    HRESULT hr = S_OK;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        HSTRING_HEADER hshWindowStatics;\r\n        HSTRING hsWindowStatics = NULL;\r\n        hr = WindowsCreateStringReference(L\"Windows.UI.Xaml.Window\", 22, &hshWindowStatics, &hsWindowStatics);\r\n        if (SUCCEEDED(hr) && hsWindowStatics)\r\n        {\r\n            Windows_UI_Xaml_IWindowStatics* pWindowStatics = NULL;\r\n            hr = RoGetActivationFactory(hsWindowStatics, &IID_Windows_UI_Xaml_IWindowStatics, &pWindowStatics);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                Windows_UI_Xaml_IWindow* pWindow = NULL;\r\n                hr = pWindowStatics->lpVtbl->get_Current(pWindowStatics, &pWindow);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    Windows_UI_Xaml_Core_ICoreWindow* pCoreWindow = NULL;\r\n                    hr = pWindow->lpVtbl->get_CoreWindow(pWindow, &pCoreWindow);\r\n                    if (SUCCEEDED(hr))\r\n                    {\r\n                        hr = pCoreWindow->lpVtbl->get_Visible(pCoreWindow, bIsVisible);\r\n                        pCoreWindow->lpVtbl->Release(pCoreWindow);\r\n                    }\r\n                    pWindow->lpVtbl->Release(pWindow);\r\n                }\r\n                pWindowStatics->lpVtbl->Release(pWindowStatics);\r\n            }\r\n            WindowsDeleteString(hsWindowStatics);\r\n        }\r\n    }\r\n    return hr;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/lvt.h",
    "content": "#ifndef _H_LVT_H_\r\n#define _H_LVT_H_\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n#include <inspectable.h>\r\n#include <roapi.h>\r\n#include <winstring.h>\r\n#include <stdio.h>\r\n#include <Shlwapi.h>\r\n#include \"osutility.h\"\r\n\r\n#define LVT_LOC_NONE 0\r\n#define LVT_LOC_BOTTOMLEFT 1\r\n#define LVT_LOC_TOPLEFT 2\r\n#define LVT_LOC_TOPRIGHT 3\r\n\r\ntypedef struct _Windows_UI_Xaml_CornerRadius\r\n{\r\n    double TopLeft;\r\n    double TopRight;\r\n    double BottomRight;\r\n    double BottomLeft;\r\n} Windows_UI_Xaml_CornerRadius;\r\n\r\ntypedef struct _Windows_UI_Xaml_Thickness\r\n{\r\n    double Left;\r\n    double Top;\r\n    double Right;\r\n    double Bottom;\r\n} Windows_UI_Xaml_Thickness;\r\n\r\ntypedef enum _Windows_UI_Xaml_Visibility\r\n{\r\n    Windows_UI_Xaml_Visibility_Visible = 0,\r\n    Windows_UI_Xaml_Visibility_Collapsed = 1\r\n} Windows_UI_Xaml_Visibility;\r\n\r\n#pragma region \"Windows.UI.Xaml.IWindowStatics\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_IWindowStatics,\r\n    0x93328409, 0x4ea1, 0x4afa, 0x83, 0xdc, 0x0c, 0x4e, 0x73, 0xe8, 0x8b, 0xb1);\r\n\r\ntypedef interface Windows_UI_Xaml_IWindowStatics Windows_UI_Xaml_IWindowStatics;\r\n\r\ntypedef struct Windows_UI_Xaml_IWindowStatics_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Current)(\r\n        __RPC__in Windows_UI_Xaml_IWindowStatics* This,\r\n        /* [out] */ __RPC__out void** value\r\n        );\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IWindowStatics_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IWindowStatics // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IWindowStatics_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.Core.CoreWindow\"\r\n\r\ntypedef interface Windows_UI_Xaml_Core_ICoreWindow Windows_UI_Xaml_Core_ICoreWindow;\r\n\r\ntypedef struct Windows_UI_Xaml_Core_ICoreWindow_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_AutomationHostProvider)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Bounds)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [out] */ __RPC__out RECT* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_CustomProperties)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Dispatcher)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FlowDirection)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FlowDirection)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_IsInputEnabled)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_IsInputEnabled)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_PointerCursor)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_PointerCursor)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_PointerPosition)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Visible)(\r\n        __RPC__in Windows_UI_Xaml_Core_ICoreWindow* This,\r\n        /* [out] */ __RPC__out BOOL* value);\r\n\r\n    // ...\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_Core_ICoreWindow_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_Core_ICoreWindow // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_Core_ICoreWindow_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.IWindow\"\r\n\r\ntypedef interface Windows_UI_Xaml_IWindow Windows_UI_Xaml_IWindow;\r\n\r\ntypedef struct Windows_UI_Xaml_IWindow_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Bounds)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out RECT* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Visible)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out BOOL* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Content)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out IInspectable** value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Content)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_CoreWindow)(\r\n        __RPC__in Windows_UI_Xaml_IWindow* This,\r\n        /* [out] */ __RPC__out Windows_UI_Xaml_Core_ICoreWindow** value);\r\n\r\n    // ...\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IWindow_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IWindow // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IWindow_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.IDependencyObject\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_IDependencyObject,\r\n    0x5c526665, 0xf60e, 0x4912, 0xaf, 0x59, 0x5f, 0xe0, 0x68, 0x0f, 0x08, 0x9d);\r\n\r\ntypedef interface Windows_UI_Xaml_IDependencyObject Windows_UI_Xaml_IDependencyObject;\r\n\r\ntypedef struct Windows_UI_Xaml_IDependencyObject_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetValue)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [in] */ __RPC__in IInspectable* dp,\r\n        /* [out] */ __RPC__out IInspectable** result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* SetValue)(\r\n        __RPC__in Windows_UI_Xaml_IDependencyObject* This,\r\n        /* [in] */ __RPC__in IInspectable* dp,\r\n        /* [in] */ __RPC__in IInspectable* value);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IDependencyObject_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IDependencyObject // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IDependencyObject_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.IVisualTreeHelperStatics\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_IVisualTreeHelperStatics,\r\n    0xe75758c4, 0xd25d, 0x4b1d, 0x97, 0x1f, 0x59, 0x6f, 0x17, 0xf1, 0x2b, 0xaa);\r\n\r\ntypedef interface Windows_UI_Xaml_IVisualTreeHelperStatics Windows_UI_Xaml_IVisualTreeHelperStatics;\r\n\r\ntypedef struct Windows_UI_Xaml_IVisualTreeHelperStatics_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* FindElementsInHostCoordinatesPoint)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* FindElementsInHostCoordinatesRect)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* FindAllElementsInHostCoordinatesPoint)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* FindAllElementsInHostCoordinatesRect)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetChild)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IDependencyObject* reference,\r\n        /* [in] */ __RPC__in INT32 childIndex,\r\n        /* [out] */ __RPC__out Windows_UI_Xaml_IDependencyObject* result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetChildrenCount)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IDependencyObject* reference,\r\n        /* [out] */ __RPC__out INT32* result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetParent)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IDependencyObject* reference,\r\n        /* [out] */ __RPC__out Windows_UI_Xaml_IDependencyObject** result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* DisconnectChildrenRecursive)(\r\n        __RPC__in Windows_UI_Xaml_IVisualTreeHelperStatics* This);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IVisualTreeHelperStatics_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IVisualTreeHelperStatics // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IVisualTreeHelperStatics_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.IFrameworkElement\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_IFrameworkElement,\r\n    0xa391d09b, 0x4a99, 0x4b7c, 0x9d, 0x8d, 0x6f, 0xa5, 0xd0, 0x1f, 0x6f, 0xbf);\r\n\r\ntypedef interface Windows_UI_Xaml_IFrameworkElement Windows_UI_Xaml_IFrameworkElement;\r\n\r\ntypedef struct Windows_UI_Xaml_IFrameworkElement_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Triggers)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Resources)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Resources)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Tag)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Tag)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Language)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Language)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_ActualWidth)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out DOUBLE* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_ActualHeight)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out DOUBLE* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Width)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out DOUBLE* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Width)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [in] */ __RPC__in DOUBLE value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Height)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out DOUBLE* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Height)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [in] */ __RPC__in DOUBLE value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_MinWidth)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_MinWidth)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_MaxWidth)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_MaxWidth)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_MinHeight)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_MinHeight)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_MaxHeight)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__out DOUBLE* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_MaxHeight)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [in] */ __RPC__in DOUBLE value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_HorizontalAlignment)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_HorizontalAlignment)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_VerticalAlignment)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_VerticalAlignment)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Margin)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Margin)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Name)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Name)(\r\n        __RPC__in Windows_UI_Xaml_IFrameworkElement* This);\r\n\r\n    // ...\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IFrameworkElement_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IFrameworkElement // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IFrameworkElement_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.Controls.IGrid2\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_Controls_IGrid2,\r\n    0xf76efa41, 0x380e, 0x45db, 0xbe, 0x87, 0x9e, 0x13, 0x26, 0xba, 0x4b, 0x57);\r\n\r\ntypedef interface Windows_UI_Xaml_Controls_IGrid2 Windows_UI_Xaml_Controls_IGrid2;\r\n\r\ntypedef struct Windows_UI_Xaml_Controls_IGrid2_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_CornerRadius)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [out] */ __RPC__deref_out_opt Windows_UI_Xaml_CornerRadius* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_CornerRadius)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_CornerRadius value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IGrid2* This);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_Controls_IGrid2_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_Controls_IGrid2 // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_Controls_IGrid2_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.Controls.IBorder\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_Controls_IBorder,\r\n    0x797c4539, 0x45bd, 0x4633, 0xa0, 0x44, 0xbf, 0xb0, 0x2e, 0xf5, 0x17, 0x0f);\r\n\r\ntypedef interface Windows_UI_Xaml_Controls_IBorder Windows_UI_Xaml_Controls_IBorder;\r\n\r\ntypedef struct Windows_UI_Xaml_Controls_IBorder_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Background)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Background)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_CornerRadius)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [out] */ __RPC__deref_out_opt Windows_UI_Xaml_CornerRadius* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_CornerRadius)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_CornerRadius value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Child)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Child)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_ChildTransitions)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_ChildTransitions)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IBorder* This);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_Controls_IBorder_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_Controls_IBorder // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_Controls_IBorder_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.Controls.IControl\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_Controls_IControl,\r\n    0xa8912263, 0x2951, 0x4f58, 0xa9, 0xc5, 0x5a, 0x13, 0x4e, 0xaa, 0x7f, 0x07);\r\n\r\ntypedef interface Windows_UI_Xaml_Controls_IControl Windows_UI_Xaml_Controls_IControl;\r\n\r\ntypedef struct Windows_UI_Xaml_Controls_IControl_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FontSize)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FontSize)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FontFamily)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FontFamily)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FontWeight)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FontWeight)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FontStyle)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FontStyle)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FontStretch)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_FontStretch)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_CharacterSpacing)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_CharacterSpacing)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Foreground)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Foreground)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_IsTabStop)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_IsTabStop)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_IsEnabled)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_IsEnabled)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_TabIndex)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_TabIndex)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_TabNavigation)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_TabNavigation)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Template)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Template)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [out] */ __RPC__out Windows_UI_Xaml_Thickness* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Padding)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_Thickness value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_HorizontalContentAlignment)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_HorizontalContentAlignment)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_VerticalContentAlignment)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_VerticalContentAlignment)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Background)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Background)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderThickness)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_BorderBrush)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_FocusState)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* add_IsEnabledChanged)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* remove_IsEnabledChanged)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* ApplyTemplate)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* Focus)(\r\n        __RPC__in Windows_UI_Xaml_Controls_IControl* This);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_Controls_IControl_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_Controls_IControl // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_Controls_IControl_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.IUIElement\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_IUIElement,\r\n    0x676d0be9, 0xb65c, 0x41c6, 0xba, 0x40, 0x58, 0xcf, 0x87, 0xf2, 0x01, 0xc1);\r\n\r\ntypedef interface Windows_UI_Xaml_IUIElement Windows_UI_Xaml_IUIElement;\r\n\r\ntypedef struct Windows_UI_Xaml_IUIElement_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_DesiredSize)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_AllowDrop)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_AllowDrop)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Opacity)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Opacity)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Clip)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Clip)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_RenderTransform)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_RenderTransform)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Projection)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Projection)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_RenderTransformOrigin)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_RenderTransformOrigin)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_IsHitTestVisible)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_IsHitTestVisible)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_Visibility)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [out] */ __RPC__out Windows_UI_Xaml_Visibility* value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* put_Visibility)(\r\n        __RPC__in Windows_UI_Xaml_IUIElement* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_Visibility value);\r\n\r\n    // ...\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_IUIElement_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_IUIElement // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_IUIElement_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\n#pragma region \"Windows.UI.Xaml.Controls.ICanvasStatics\"\r\n\r\nDEFINE_GUID(IID_Windows_UI_Xaml_Controls_ICanvasStatics,\r\n    0x40ce5c46, 0x2962, 0x446f, 0xaa, 0xfb, 0x4c, 0xdc, 0x48, 0x69, 0x39, 0xc9);\r\n\r\ntypedef interface Windows_UI_Xaml_Controls_ICanvasStatics Windows_UI_Xaml_Controls_ICanvasStatics;\r\n\r\ntypedef struct Windows_UI_Xaml_Controls_ICanvasStatics_Vtbl\r\n{\r\n    BEGIN_INTERFACE\r\n\r\n    HRESULT(STDMETHODCALLTYPE* QueryInterface)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in REFIID riid,\r\n        /* [annotation][iid_is][out] */\r\n        _COM_Outptr_  void** ppvObject);\r\n\r\n    ULONG(STDMETHODCALLTYPE* AddRef)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This);\r\n\r\n    ULONG(STDMETHODCALLTYPE* Release)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetIids)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__out ULONG* iidCount,\r\n        /* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__deref_out_opt HSTRING* className);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__out TrustLevel* trustLevel);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_LeftProperty)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__out IInspectable** value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetLeft)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [out] */ __RPC__out DOUBLE* result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* SetLeft)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [in] */ __RPC__in DOUBLE length);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_TopProperty)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__out IInspectable** value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetTop)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [out] */ __RPC__out DOUBLE* result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* SetTop)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [in] */ __RPC__in DOUBLE length);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* get_ZIndexProperty)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [out] */ __RPC__out IInspectable** value);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* GetZIndex)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [out] */ __RPC__out INT32* result);\r\n\r\n    HRESULT(STDMETHODCALLTYPE* SetZIndex)(\r\n        __RPC__in Windows_UI_Xaml_Controls_ICanvasStatics* This,\r\n        /* [in] */ __RPC__in Windows_UI_Xaml_IUIElement* element,\r\n        /* [in] */ __RPC__in INT32 value);\r\n\r\n    END_INTERFACE\r\n} Windows_UI_Xaml_Controls_ICanvasStatics_Vtbl;\r\n\r\ninterface Windows_UI_Xaml_Controls_ICanvasStatics // : IInspectable\r\n{\r\n    CONST_VTBL struct Windows_UI_Xaml_Controls_ICanvasStatics_Vtbl* lpVtbl;\r\n};\r\n#pragma endregion\r\n\r\nWindows_UI_Xaml_IDependencyObject* LVT_FindChildByClassName(Windows_UI_Xaml_IDependencyObject* pRootDependencyObject, Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics, LPCWSTR pwszRefName, INT* prevIndex);\r\n\r\nWindows_UI_Xaml_IDependencyObject* LVT_FindChildByName(Windows_UI_Xaml_IDependencyObject* pRootDependencyObject, Windows_UI_Xaml_IVisualTreeHelperStatics* pVisualTreeHelperStatics, LPCWSTR pwszRefName);\r\n\r\nvoid LVT_StartUI_EnableRoundedCorners(HWND, DWORD, DWORD, HWND, RECT*);\r\n\r\nvoid LVT_StartDocked_DisableRecommendedSection(HWND, BOOL, RECT*);\r\n\r\nHRESULT IsThreadCoreWindowVisible(BOOL*);\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/osutility.h",
    "content": "#ifndef _H_OSUTILITY_H_\r\n#define _H_OSUTILITY_H_\r\n#include <Windows.h>\r\n#include <dwmapi.h>\r\n#include <valinet/utility/osversion.h>\r\n\r\n// This allows compiling with older Windows SDKs as well\r\n#ifndef NTDDI_WIN10_CO\r\n#define DWMWA_USE_HOSTBACKDROPBRUSH 17            // [set] BOOL, Allows the use of host backdrop brushes for the window.\r\n#define DWMWA_USE_IMMERSIVE_DARK_MODE 20          // [set] BOOL, Allows a window to either use the accent color, or dark, according to the user Color Mode preferences.\r\n#define DWMWA_WINDOW_CORNER_PREFERENCE 33         // [set] WINDOW_CORNER_PREFERENCE, Controls the policy that rounds top-level window corners\r\n#define DWMWA_BORDER_COLOR 34                     // [set] COLORREF, The color of the thin border around a top-level window\r\n#define DWMWA_CAPTION_COLOR 35                    // [set] COLORREF, The color of the caption\r\n#define DWMWA_TEXT_COLOR 36                       // [set] COLORREF, The color of the caption text\r\n#define DWMWA_VISIBLE_FRAME_BORDER_THICKNESS 37   // [get] UINT, width of the visible border around a thick frame window\r\n#define DWMWCP_DEFAULT 0\r\n#define DWMWCP_DONOTROUND 1\r\n#define DWMWCP_ROUND 2\r\n#define DWMWCP_ROUNDSMALL 3\r\n#endif\r\n#define DWMWA_MICA_EFFFECT 1029\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nextern RTL_OSVERSIONINFOW global_rovi;\r\nextern DWORD32 global_ubr;\r\n\r\ninline void InitializeGlobalVersionAndUBR()\r\n{\r\n    global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n}\r\n\r\ninline BOOL IsWindows11()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    if (global_rovi.dwBuildNumber >= 21996) return TRUE;\r\n    return FALSE;\r\n}\r\n\r\ninline BOOL IsDwmExtendFrameIntoClientAreaBrokenInThisBuild()\r\n{\r\n    if (!IsWindows11())\r\n    {\r\n        return FALSE;\r\n    }\r\n    if ((global_rovi.dwBuildNumber >= 21996 && global_rovi.dwBuildNumber < 22000) || (global_rovi.dwBuildNumber == 22000 && (global_ubr >= 1 && global_ubr <= 51)))\r\n    {\r\n        return TRUE;\r\n    }\r\n    return FALSE;\r\n}\r\n\r\ninline HRESULT SetMicaMaterialForThisWindow(HWND hWnd, BOOL bApply)\r\n{\r\n    if (!IsWindows11() || IsDwmExtendFrameIntoClientAreaBrokenInThisBuild()) return S_FALSE;\r\n    DWORD dwAttribute = (global_rovi.dwBuildNumber >= 22523) ? 38 : DWMWA_MICA_EFFFECT;\r\n    DWORD dwProp = (bApply ? ((global_rovi.dwBuildNumber >= 22523) ? 2 : 1) : 0);\r\n    return DwmSetWindowAttribute(hWnd, dwAttribute, &dwProp, sizeof(DWORD));\r\n}\r\n\r\ninline BOOL IsWindows11Version22H2OrHigher()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    return global_rovi.dwBuildNumber >= 22621;\r\n}\r\n\r\ninline BOOL IsWindows11Version23H2OrHigher()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    return global_rovi.dwBuildNumber >= 22631;\r\n}\r\n\r\ninline BOOL IsWindows11BuildHigherThan25158()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    return global_rovi.dwBuildNumber > 25158;\r\n}\r\n\r\ninline BOOL IsWindows11Build25346OrHigher()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    return global_rovi.dwBuildNumber >= 25346;\r\n}\r\n\r\ninline BOOL IsWindows11Version22H2Build1413OrHigher()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    if (global_rovi.dwBuildNumber > 22621) return TRUE;\r\n    return global_rovi.dwBuildNumber == 22621 && global_ubr >= 1413;\r\n}\r\n\r\ninline BOOL IsWindows11Version22H2Build2134OrHigher()\r\n{\r\n    if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n    if (global_rovi.dwBuildNumber > 22621) return TRUE;\r\n    return global_rovi.dwBuildNumber == 22621 && global_ubr >= 2134;\r\n}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"KNSoft.SlimDetours\" version=\"1.1.4-beta\" targetFramework=\"win10.0.22621\" />\r\n  <package id=\"Microsoft.Windows.ImplementationLibrary\" version=\"1.0.250325.1\" targetFramework=\"native\" />\r\n</packages>"
  },
  {
    "path": "ExplorerPatcher/queryversion.h",
    "content": "#ifndef _H_QUERYVERSION_H_\r\n#define _H_QUERYVERSION_H_\r\n#include <Windows.h>\r\n#pragma comment(lib, \"Version.lib\")\r\n\r\ninline void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost, DWORD* dwSecondLeft, DWORD* dwSecondRight, DWORD* dwRightMost)\r\n{\r\n    HRSRC hResInfo;\r\n    DWORD dwSize;\r\n    HGLOBAL hResData;\r\n    LPVOID pRes, pResCopy;\r\n    UINT uLen;\r\n    VS_FIXEDFILEINFO* lpFfi;\r\n\r\n    hResInfo = FindResource(hModule, MAKEINTRESOURCE(Resource), RT_VERSION);\r\n    dwSize = SizeofResource(hModule, hResInfo);\r\n    hResData = LoadResource(hModule, hResInfo);\r\n    pRes = LockResource(hResData);\r\n    pResCopy = LocalAlloc(LMEM_FIXED, dwSize);\r\n    CopyMemory(pResCopy, pRes, dwSize);\r\n    FreeResource(hResData);\r\n\r\n    VerQueryValue(pResCopy, TEXT(\"\\\\\"), (LPVOID*)&lpFfi, &uLen);\r\n\r\n    DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;\r\n    DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;\r\n\r\n    *dwLeftMost = HIWORD(dwFileVersionMS);\r\n    *dwSecondLeft = LOWORD(dwFileVersionMS);\r\n    *dwSecondRight = HIWORD(dwFileVersionLS);\r\n    *dwRightMost = LOWORD(dwFileVersionLS);\r\n\r\n    LocalFree(pResCopy);\r\n}\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Visual C++ generated include file.\r\n// Used by ExplorerPatcher.rc\r\n//\r\n#define IDS_PRODUCTNAME                 102\r\n#define IDS_INSTALL_SUCCESS_TEXT        109\r\n#define IDS_INSTALL_ERROR_TEXT          110\r\n#define IDS_UNINSTALL_SUCCESS_TEXT      111\r\n#define IDS_UNINSTALL_ERROR_TEXT        112\r\n#define IDS_OPERATION_NONE              113\r\n#define IDR_REFRESHEDSTYLES_XBF         115\r\n#define IDS_DRIVECATEGORY_HARDDISKDRIVES              40000\r\n#define IDS_DRIVECATEGORY_REMOVABLESTORAGE            40001\r\n#define IDS_DRIVECATEGORY_OTHER                       40002\r\n#define IDS_DRIVECATEGORY_IMAGING                     40003\r\n#define IDS_DRIVECATEGORY_PORTABLEMEDIA               40004\r\n#define IDS_DRIVECATEGORY_PORTABLEMEDIADEVICE         40004\r\n#define IDS_DRIVECATEGORY_PORTABLEDEVICE              40005\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        111\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1001\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/symbols.c",
    "content": "#include <stdio.h>\r\n#include \"symbols.h\"\r\n\r\nconst char* explorer_SN[EXPLORER_SB_CNT] = {\r\n    EXPLORER_SB_0,\r\n    EXPLORER_SB_1,\r\n    EXPLORER_SB_2,\r\n    EXPLORER_SB_3,\r\n    EXPLORER_SB_4,\r\n    EXPLORER_SB_5,\r\n};\r\nconst char* explorer_SN_26244[1] = {\r\n    EXPLORER_SB_4,\r\n};\r\nconst char* twinui_pcshell_SN[TWINUI_PCSHELL_SB_CNT] = {\r\n    TWINUI_PCSHELL_SB_0,\r\n    TWINUI_PCSHELL_SB_1,\r\n    TWINUI_PCSHELL_SB_2,\r\n    TWINUI_PCSHELL_SB_3,\r\n    TWINUI_PCSHELL_SB_4,\r\n    TWINUI_PCSHELL_SB_5,\r\n    TWINUI_PCSHELL_SB_6,\r\n};\r\nconst char* startdocked_SN[STARTDOCKED_SB_CNT] = {\r\n    STARTDOCKED_SB_0,\r\n    STARTDOCKED_SB_1,\r\n    STARTDOCKED_SB_2,\r\n    STARTDOCKED_SB_3,\r\n    STARTDOCKED_SB_4,\r\n};\r\nconst char* startui_SN[STARTUI_SB_CNT] = {\r\n    STARTUI_SB_0,\r\n};\r\n\r\nconst wchar_t DownloadNotificationXML[] =\r\n    L\"<toast scenario=\\\"reminder\\\" \"\r\n    L\"activationType=\\\"protocol\\\" launch=\\\"%s\\\" duration=\\\"%s\\\">\\r\\n\"\r\n    L\"\t<visual>\\r\\n\"\r\n    L\"\t\t<binding template=\\\"ToastGeneric\\\">\\r\\n\"\r\n    L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n    L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n    L\"\t\t\t<text placement=\\\"attribution\\\"><![CDATA[ExplorerPatcher]]></text>\\r\\n\"\r\n    L\"\t\t</binding>\\r\\n\"\r\n    L\"\t</visual>\\r\\n\"\r\n    L\"\t<audio src=\\\"ms-winsoundevent:Notification.Default\\\" loop=\\\"false\\\" silent=\\\"false\\\"/>\\r\\n\"\r\n    L\"</toast>\\r\\n\";\r\n\r\nextern INT VnDownloadSymbols(HMODULE hModule, char* dllName, char* szLibPath, UINT sizeLibPath);\r\nextern INT VnGetSymbols(const char* pdb_file, DWORD* addresses, char** symbols, DWORD numOfSymbols);\r\n\r\nBOOL CheckVersion(HKEY hKey, DWORD dwVersion)\r\n{\r\n    DWORD dwSize = sizeof(DWORD);\r\n    DWORD dwStoredVersion = 0;\r\n    if (RegQueryValueExW(hKey, TEXT(\"Version\"), 0, NULL, (LPBYTE)&dwStoredVersion, &dwSize) == ERROR_SUCCESS)\r\n    {\r\n        return dwStoredVersion == dwVersion;\r\n    }\r\n    return FALSE;\r\n}\r\n\r\nvoid SaveVersion(HKEY hKey, DWORD dwVersion)\r\n{\r\n    RegSetValueExW(hKey, TEXT(\"Version\"), 0, REG_DWORD, (const BYTE*)&dwVersion, sizeof(DWORD));\r\n}\r\n\r\nstatic BOOL ProcessExplorerSymbols(char* pszSettingsPath, DWORD* pOffsets)\r\n{\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH) L\"\\\\\" TEXT(EXPLORER_SB_NAME),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        printf(\"[Symbols] Unable to create registry key.\\n\");\r\n        return FALSE;\r\n    }\r\n\r\n    CHAR szHash[100];\r\n    WCHAR wszPath[MAX_PATH];\r\n\r\n    ZeroMemory(szHash, sizeof(szHash));\r\n    ZeroMemory(wszPath, sizeof(wszPath));\r\n\r\n    char explorer_sb_dll[MAX_PATH];\r\n    ZeroMemory(explorer_sb_dll, sizeof(explorer_sb_dll));\r\n    GetWindowsDirectoryA(explorer_sb_dll, MAX_PATH);\r\n    strcat_s(explorer_sb_dll, MAX_PATH, \"\\\\\" EXPLORER_SB_NAME \".exe\");\r\n\r\n    GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\" _T(EXPLORER_SB_NAME) L\".exe\");\r\n    ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash));\r\n\r\n    printf(\"[Symbols] Downloading symbols for \\\"%s\\\" (\\\"%s\\\")...\\n\", explorer_sb_dll, szHash);\r\n    if (VnDownloadSymbols(\r\n        NULL,\r\n        explorer_sb_dll,\r\n        pszSettingsPath,\r\n        MAX_PATH\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Symbols for \\\"%s\\\" are not available - unable to download.\\n\", explorer_sb_dll);\r\n        printf(\"[Symbols] Please refer to \\\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\\\" for more information.\\n\");\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    printf(\"[Symbols] Reading symbols...\\n\");\r\n    if (VnGetSymbols(pszSettingsPath, pOffsets, (char**)explorer_SN, ARRAYSIZE(explorer_SN)) != 0)\r\n    {\r\n        DWORD offsets26244[ARRAYSIZE(explorer_SN_26244)];\r\n        if (VnGetSymbols(pszSettingsPath, offsets26244, (char**)explorer_SN_26244, ARRAYSIZE(explorer_SN_26244)) == 0)\r\n        {\r\n            pOffsets[4] = offsets26244[0];\r\n        }\r\n        else\r\n        {\r\n            printf(\"[Symbols] Failure in reading symbols for \\\"%s\\\".\\n\", explorer_sb_dll);\r\n            if (hKey) RegCloseKey(hKey);\r\n            return FALSE;\r\n        }\r\n    }\r\n\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_0), 0, REG_DWORD, (const BYTE*)&pOffsets[0], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_1), 0, REG_DWORD, (const BYTE*)&pOffsets[1], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_2), 0, REG_DWORD, (const BYTE*)&pOffsets[2], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_3), 0, REG_DWORD, (const BYTE*)&pOffsets[3], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_4), 0, REG_DWORD, (const BYTE*)&pOffsets[4], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(EXPLORER_SB_5), 0, REG_DWORD, (const BYTE*)&pOffsets[5], sizeof(DWORD));\r\n\r\n    RegSetValueExA(hKey, \"Hash\", 0, REG_SZ, szHash, (DWORD)(strlen(szHash) + 1));\r\n    SaveVersion(hKey, EXPLORER_SB_VERSION);\r\n\r\n    if (hKey) RegCloseKey(hKey);\r\n    return TRUE;\r\n}\r\n\r\nstatic BOOL ProcessTwinuiPcshellSymbols(char* pszSettingsPath, DWORD* pOffsets)\r\n{\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH) L\"\\\\\" TEXT(TWINUI_PCSHELL_SB_NAME),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        printf(\"[Symbols] Unable to create registry key.\\n\");\r\n        return FALSE;\r\n    }\r\n\r\n    CHAR szHash[100];\r\n    WCHAR wszPath[MAX_PATH];\r\n\r\n    ZeroMemory(szHash, sizeof(szHash));\r\n    ZeroMemory(wszPath, sizeof(wszPath));\r\n\r\n    char twinui_pcshell_sb_dll[MAX_PATH];\r\n    ZeroMemory(twinui_pcshell_sb_dll, sizeof(twinui_pcshell_sb_dll));\r\n    GetSystemDirectoryA(twinui_pcshell_sb_dll, MAX_PATH);\r\n    strcat_s(twinui_pcshell_sb_dll, MAX_PATH, \"\\\\\");\r\n    strcat_s(twinui_pcshell_sb_dll, MAX_PATH, TWINUI_PCSHELL_SB_NAME);\r\n    strcat_s(twinui_pcshell_sb_dll, MAX_PATH, \".dll\");\r\n\r\n    GetSystemDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\" _T(TWINUI_PCSHELL_SB_NAME) L\".dll\");\r\n    ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash));\r\n\r\n    printf(\"[Symbols] Downloading symbols for \\\"%s\\\" (\\\"%s\\\")...\\n\", twinui_pcshell_sb_dll, szHash);\r\n    if (VnDownloadSymbols(\r\n        NULL,\r\n        twinui_pcshell_sb_dll,\r\n        pszSettingsPath,\r\n        MAX_PATH\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Symbols for \\\"%s\\\" are not available - unable to download.\\n\", twinui_pcshell_sb_dll);\r\n        printf(\"[Symbols] Please refer to \\\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\\\" for more information.\\n\");\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    printf(\"[Symbols] Reading symbols...\\n\");\r\n    if (VnGetSymbols(\r\n        pszSettingsPath,\r\n        pOffsets,\r\n        (char**)twinui_pcshell_SN,\r\n        IsWindows11() ? TWINUI_PCSHELL_SB_CNT : 3\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Failure in reading symbols for \\\"%s\\\".\\n\", twinui_pcshell_sb_dll);\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    if (!IsWindows11())\r\n    {\r\n        pOffsets[1] = 0;\r\n    }\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_0), 0, REG_DWORD, (const BYTE*)&pOffsets[0], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_1), 0, REG_DWORD, (const BYTE*)&pOffsets[1], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_2), 0, REG_DWORD, (const BYTE*)&pOffsets[2], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_3), 0, REG_DWORD, (const BYTE*)&pOffsets[3], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_4), 0, REG_DWORD, (const BYTE*)&pOffsets[4], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_5), 0, REG_DWORD, (const BYTE*)&pOffsets[5], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_6), 0, REG_DWORD, (const BYTE*)&pOffsets[6], sizeof(DWORD));\r\n\r\n    RegSetValueExA(hKey, \"Hash\", 0, REG_SZ, szHash, (DWORD)(strlen(szHash) + 1));\r\n    SaveVersion(hKey, TWINUI_PCSHELL_SB_VERSION);\r\n\r\n    if (hKey) RegCloseKey(hKey);\r\n    return TRUE;\r\n}\r\n\r\nstatic BOOL ProcessStartDockedSymbols(char* pszSettingsPath, DWORD* pOffsets)\r\n{\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTDOCKED_SB_NAME),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        printf(\"[Symbols] Unable to create registry key.\\n\");\r\n        return FALSE;\r\n    }\r\n\r\n    CHAR szHash[100];\r\n    WCHAR wszPath[MAX_PATH];\r\n\r\n    ZeroMemory(szHash, sizeof(szHash));\r\n    ZeroMemory(wszPath, sizeof(wszPath));\r\n\r\n    char startdocked_sb_dll[MAX_PATH];\r\n    ZeroMemory(startdocked_sb_dll, sizeof(startdocked_sb_dll));\r\n    GetWindowsDirectoryA(startdocked_sb_dll, MAX_PATH);\r\n    strcat_s(startdocked_sb_dll, MAX_PATH, \"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\");\r\n    strcat_s(startdocked_sb_dll, MAX_PATH, STARTDOCKED_SB_NAME);\r\n    strcat_s(startdocked_sb_dll, MAX_PATH, \".dll\");\r\n\r\n    GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\" _T(STARTDOCKED_SB_NAME) L\".dll\");\r\n    ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash));\r\n\r\n    printf(\"[Symbols] Downloading symbols for \\\"%s\\\" (\\\"%s\\\")...\\n\", startdocked_sb_dll, szHash);\r\n    if (VnDownloadSymbols(\r\n        NULL,\r\n        startdocked_sb_dll,\r\n        pszSettingsPath,\r\n        MAX_PATH\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Symbols for \\\"%s\\\" are not available - unable to download.\\n\", startdocked_sb_dll);\r\n        printf(\"[Symbols] Please refer to \\\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\\\" for more information.\\n\");\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    printf(\"[Symbols] Reading symbols...\\n\");\r\n    if (VnGetSymbols(\r\n        pszSettingsPath,\r\n        pOffsets,\r\n        (char**)startdocked_SN,\r\n        STARTDOCKED_SB_CNT\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Failure in reading symbols for \\\"%s\\\".\\n\", startdocked_sb_dll);\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    RegSetValueExW(hKey, TEXT(STARTDOCKED_SB_0), 0, REG_DWORD, (const BYTE*)&pOffsets[0], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(STARTDOCKED_SB_1), 0, REG_DWORD, (const BYTE*)&pOffsets[1], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(STARTDOCKED_SB_2), 0, REG_DWORD, (const BYTE*)&pOffsets[2], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(STARTDOCKED_SB_3), 0, REG_DWORD, (const BYTE*)&pOffsets[3], sizeof(DWORD));\r\n    RegSetValueExW(hKey, TEXT(STARTDOCKED_SB_4), 0, REG_DWORD, (const BYTE*)&pOffsets[4], sizeof(DWORD));\r\n\r\n    RegSetValueExA(hKey, \"Hash\", 0, REG_SZ, szHash, (DWORD)(strlen(szHash) + 1));\r\n    SaveVersion(hKey, STARTDOCKED_SB_VERSION);\r\n\r\n    if (hKey) RegCloseKey(hKey);\r\n    return TRUE;\r\n}\r\n\r\nstatic BOOL ProcessStartUISymbols(char* pszSettingsPath, DWORD* pOffsets)\r\n{\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTUI_SB_NAME),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        printf(\"[Symbols] Unable to create registry key.\\n\");\r\n        return FALSE;\r\n    }\r\n\r\n    WCHAR wszPath[MAX_PATH];\r\n    ZeroMemory(wszPath, sizeof(wszPath));\r\n    GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\" _T(STARTUI_SB_NAME) L\".dll\");\r\n\r\n    BOOL bCustomStartUI = FALSE;\r\n    if (!FileExistsW(wszPath))\r\n    {\r\n        GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartUI_.dll\");\r\n        if (!FileExistsW(wszPath))\r\n        {\r\n            return TRUE; // StartUI.dll or StartUI_.dll is not present in the current Windows installation, treat this as success\r\n        }\r\n        bCustomStartUI = TRUE;\r\n    }\r\n\r\n    char startui_sb_dll[MAX_PATH];\r\n    ZeroMemory(startui_sb_dll, sizeof(startui_sb_dll));\r\n    GetWindowsDirectoryA(startui_sb_dll, MAX_PATH);\r\n    strcat_s(startui_sb_dll, MAX_PATH, \"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\");\r\n    strcat_s(startui_sb_dll, MAX_PATH, bCustomStartUI ? \"StartUI_.dll\" : STARTUI_SB_NAME \".dll\");\r\n\r\n    CHAR szHash[100];\r\n    ZeroMemory(szHash, sizeof(szHash));\r\n    ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash));\r\n\r\n    printf(\"[Symbols] Downloading symbols for \\\"%s\\\" (\\\"%s\\\")...\\n\", startui_sb_dll, szHash);\r\n    if (VnDownloadSymbols(\r\n        NULL,\r\n        startui_sb_dll,\r\n        pszSettingsPath,\r\n        MAX_PATH\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Symbols for \\\"%s\\\" are not available - unable to download.\\n\", startui_sb_dll);\r\n        printf(\"[Symbols] Please refer to \\\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\\\" for more information.\\n\");\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    printf(\"[Symbols] Reading symbols...\\n\");\r\n    if (VnGetSymbols(\r\n        pszSettingsPath,\r\n        pOffsets,\r\n        (char**)startui_SN,\r\n        STARTUI_SB_CNT\r\n    ))\r\n    {\r\n        printf(\"[Symbols] Failure in reading symbols for \\\"%s\\\".\\n\", startui_sb_dll);\r\n        if (hKey) RegCloseKey(hKey);\r\n        return FALSE;\r\n    }\r\n\r\n    RegSetValueExW(hKey, TEXT(STARTUI_SB_0), 0, REG_DWORD, (const BYTE*)&pOffsets[0], sizeof(DWORD));\r\n\r\n    RegSetValueExA(hKey, \"Hash\", 0, REG_SZ, szHash, (DWORD)(strlen(szHash) + 1));\r\n    SaveVersion(hKey, STARTUI_SB_VERSION);\r\n\r\n    if (hKey) RegCloseKey(hKey);\r\n    return TRUE;\r\n}\r\n\r\nDWORD DownloadSymbols(DownloadSymbolsParams* params)\r\n{\r\n    Sleep(6000);\r\n\r\n    printf(\"[Symbols] Started \\\"Download symbols\\\" thread.\\n\");\r\n\r\n    EP_L10N_ApplyPreferredLanguageForCurrentThread();\r\n    HMODULE hEPGui = LoadGuiModule();\r\n\r\n    RTL_OSVERSIONINFOW rovi;\r\n    DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);\r\n    wchar_t szReportedVersion[32];\r\n    swprintf_s(\r\n        szReportedVersion,\r\n        ARRAYSIZE(szReportedVersion),\r\n        L\"%d.%d.%d.%d\",\r\n        rovi.dwMajorVersion,\r\n        rovi.dwMinorVersion,\r\n        rovi.dwBuildNumber,\r\n        ubr\r\n    );\r\n\r\n    wchar_t title[160];\r\n    wchar_t body[200];\r\n    wchar_t titleFormat[160];\r\n    wchar_t buffer[1000];\r\n    title[0] = 0; body[0] = 0; titleFormat[0] = 0; buffer[0] = 0;\r\n\r\n    // Don't annoy the user with \"Downloading symbols\" notification if the symbols aren't available in MS' servers\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_READ | KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    wchar_t szLastNotifiedBuild[32];\r\n    szLastNotifiedBuild[0] = 0;\r\n    DWORD dwSize = sizeof(szLastNotifiedBuild);\r\n    RegQueryValueExW(\r\n        hKey,\r\n        TEXT(\"SymbolsLastNotifiedOSBuild\"),\r\n        0,\r\n        NULL,\r\n        (LPBYTE)szLastNotifiedBuild,\r\n        &dwSize\r\n    );\r\n\r\n    BOOL bNewBuild = wcscmp(szLastNotifiedBuild, szReportedVersion) != 0;\r\n    if (bNewBuild)\r\n    {\r\n        if (LoadStringW(hEPGui, IDS_SYM_DL_T, titleFormat, ARRAYSIZE(titleFormat)))\r\n        {\r\n            swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);\r\n        }\r\n\r\n        LoadStringW(hEPGui, IDS_SYM_DL_B, body, ARRAYSIZE(body));\r\n\r\n        swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\", L\"short\", title, body);\r\n\r\n        HRESULT hr = S_OK;\r\n        __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;\r\n        hr = String2IXMLDocument(\r\n            buffer,\r\n            (DWORD)wcslen(buffer),\r\n            &inputXml,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n        hr = ShowToastMessage(\r\n            inputXml,\r\n            APPID,\r\n            sizeof(APPID) / sizeof(wchar_t) - 1,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n\r\n        RegSetValueExW(\r\n            hKey,\r\n            TEXT(\"SymbolsLastNotifiedOSBuild\"),\r\n            0,\r\n            REG_SZ,\r\n            (const BYTE*)szReportedVersion,\r\n            (DWORD)(wcslen(szReportedVersion) * sizeof(wchar_t))\r\n        );\r\n    }\r\n\r\n    RegCloseKey(hKey);\r\n\r\n    wprintf(\r\n        L\"[Symbols] \"\r\n        L\"Attempting to download symbols for OS version %s.\\n\",\r\n        szReportedVersion\r\n    );\r\n\r\n    char szSettingsPath[MAX_PATH];\r\n    ZeroMemory(\r\n        szSettingsPath,\r\n        sizeof(szSettingsPath)\r\n    );\r\n    SHGetFolderPathA(\r\n        NULL,\r\n        SPECIAL_FOLDER_LEGACY,\r\n        NULL,\r\n        SHGFP_TYPE_CURRENT,\r\n        szSettingsPath\r\n    );\r\n    strcat_s(\r\n        szSettingsPath,\r\n        MAX_PATH,\r\n        APP_RELATIVE_PATH\r\n    );\r\n    CreateDirectoryA(szSettingsPath, NULL);\r\n    strcat_s(\r\n        szSettingsPath,\r\n        MAX_PATH,\r\n        \"\\\\\"\r\n    );\r\n    printf(\"[Symbols] Downloading to \\\"%s\\\".\\n\", szSettingsPath);\r\n\r\n    symbols_addr symbols_PTRS;\r\n    ZeroMemory(&symbols_PTRS, sizeof(symbols_addr));\r\n    BOOL bAnySuccess = FALSE, bAllSuccess = TRUE;\r\n    if (params->loadResult.bNeedToDownloadExplorerSymbols && IsWindows11Version22H2OrHigher())\r\n    {\r\n        BOOL bSuccess = ProcessExplorerSymbols(szSettingsPath, symbols_PTRS.explorer_PTRS);\r\n        bAnySuccess |= bSuccess;\r\n        bAllSuccess &= bSuccess;\r\n    }\r\n    if (params->loadResult.bNeedToDownloadTwinuiPcshellSymbols)\r\n    {\r\n        BOOL bSuccess = ProcessTwinuiPcshellSymbols(szSettingsPath, symbols_PTRS.twinui_pcshell_PTRS);\r\n        bAnySuccess |= bSuccess;\r\n        bAllSuccess &= bSuccess;\r\n    }\r\n    if (params->loadResult.bNeedToDownloadStartDockedSymbols && IsWindows11())\r\n    {\r\n        BOOL bSuccess = ProcessStartDockedSymbols(szSettingsPath, symbols_PTRS.startdocked_PTRS);\r\n        bAnySuccess |= bSuccess;\r\n        bAllSuccess &= bSuccess;\r\n    }\r\n    if (params->loadResult.bNeedToDownloadStartUISymbols && rovi.dwBuildNumber >= 18362)\r\n    {\r\n        BOOL bSuccess = ProcessStartUISymbols(szSettingsPath, symbols_PTRS.startui_PTRS);\r\n        bAnySuccess |= bSuccess;\r\n        bAllSuccess &= bSuccess;\r\n    }\r\n\r\n    printf(\"[Symbols] Finished gathering symbol data.\\n\");\r\n\r\n    title[0] = 0; body[0] = 0;\r\n    BOOL bNotify = TRUE;\r\n    if (bAllSuccess)\r\n    {\r\n        if (LoadStringW(hEPGui, IDS_SYM_SUCCESS_T, titleFormat, ARRAYSIZE(titleFormat)))\r\n        {\r\n            swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);\r\n        }\r\n        LoadStringW(hEPGui, IDS_SYM_SUCCESS_B, body, ARRAYSIZE(body));\r\n        swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\", L\"long\", title, body);\r\n    }\r\n    else if (bAnySuccess)\r\n    {\r\n        if (LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_T, titleFormat, ARRAYSIZE(titleFormat)))\r\n        {\r\n            swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);\r\n        }\r\n        LoadStringW(hEPGui, IDS_SYM_FAILEDSOME_B, body, ARRAYSIZE(body));\r\n        swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\", L\"short\", title, body);\r\n    }\r\n    else\r\n    {\r\n        if (LoadStringW(hEPGui, IDS_SYM_FAILEDALL_T, titleFormat, ARRAYSIZE(titleFormat)))\r\n        {\r\n            swprintf_s(title, ARRAYSIZE(title), titleFormat, szReportedVersion);\r\n        }\r\n        LoadStringW(hEPGui, IDS_SYM_FAILEDALL_B, body, ARRAYSIZE(body));\r\n        swprintf_s(buffer, ARRAYSIZE(buffer), DownloadNotificationXML, L\"https://github.com/valinet/ExplorerPatcher/wiki/Symbols\", L\"short\", title, body);\r\n        bNotify = bNewBuild;\r\n    }\r\n\r\n    if (bNotify)\r\n    {\r\n        __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml2 = NULL;\r\n        HRESULT hr = String2IXMLDocument(\r\n            buffer,\r\n            (DWORD)wcslen(buffer),\r\n            &inputXml2,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n        hr = ShowToastMessage(\r\n            inputXml2,\r\n            APPID,\r\n            sizeof(APPID) / sizeof(wchar_t) - 1,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n    }\r\n\r\n    FreeLibrary(hEPGui);\r\n\r\n    printf(\"[Symbols] Finished \\\"Download symbols\\\" thread.\\n\");\r\n    return 0;\r\n}\r\n\r\nLoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS)\r\n{\r\n    LoadSymbolsResult result;\r\n    ZeroMemory(&result, sizeof(LoadSymbolsResult));\r\n\r\n    HKEY hKey = NULL;\r\n    DWORD dwDisposition;\r\n    DWORD dwSize;\r\n\r\n    RTL_OSVERSIONINFOW rovi;\r\n    DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);\r\n\r\n    CHAR szHash[33];\r\n    CHAR szStoredHash[33];\r\n    ZeroMemory(szHash, sizeof(szHash));\r\n    ZeroMemory(szStoredHash, sizeof(szStoredHash));\r\n    wchar_t wszPath[MAX_PATH];\r\n    BOOL bOffsetsValid;\r\n\r\n    // Load explorer.exe offsets\r\n    if (IsWindows11Version22H2OrHigher())\r\n    {\r\n        bOffsetsValid = FALSE;\r\n        RegCreateKeyExW(\r\n            HKEY_CURRENT_USER,\r\n            TEXT(REGPATH) L\"\\\\\" TEXT(EXPLORER_SB_NAME),\r\n            0,\r\n            NULL,\r\n            REG_OPTION_NON_VOLATILE,\r\n            KEY_READ,\r\n            NULL,\r\n            &hKey,\r\n            &dwDisposition\r\n        );\r\n        if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n        {\r\n            result.bSuccess = FALSE;\r\n            return result;\r\n        }\r\n\r\n        GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\\" TEXT(EXPLORER_SB_NAME) L\".exe\");\r\n        if (ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash)) == ERROR_SUCCESS)\r\n        {\r\n            szStoredHash[0] = 0;\r\n            dwSize = sizeof(szStoredHash);\r\n            if (RegQueryValueExA(hKey, \"Hash\", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS\r\n                && !_stricmp(szHash, szStoredHash) && CheckVersion(hKey, EXPLORER_SB_VERSION))\r\n            {\r\n                dwSize = sizeof(DWORD);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_0), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[0], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_1), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[1], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_2), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[2], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_3), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[3], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_4), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[4], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(EXPLORER_SB_5), 0, NULL, (LPBYTE)&symbols_PTRS->explorer_PTRS[5], &dwSize);\r\n                bOffsetsValid = TRUE;\r\n            }\r\n            else\r\n            {\r\n                printf(\"[Symbols] Symbols for \\\"%s\\\" are not available.\\n\", EXPLORER_SB_NAME);\r\n                result.bNeedToDownloadExplorerSymbols = TRUE;\r\n            }\r\n        }\r\n        if (hKey) RegCloseKey(hKey);\r\n        if (!bOffsetsValid)\r\n        {\r\n            RegDeleteTreeW(\r\n                HKEY_CURRENT_USER,\r\n                TEXT(REGPATH) L\"\\\\\" TEXT(EXPLORER_SB_NAME)\r\n            );\r\n        }\r\n    }\r\n\r\n    // Load twinui.pcshell.dll offsets\r\n    bOffsetsValid = FALSE;\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH) L\"\\\\\" TEXT(TWINUI_PCSHELL_SB_NAME),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_READ,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (!hKey || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        result.bSuccess = FALSE;\r\n        return result;\r\n    }\r\n\r\n    GetSystemDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\" TEXT(TWINUI_PCSHELL_SB_NAME) L\".dll\");\r\n    if (ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash)) == ERROR_SUCCESS)\r\n    {\r\n        szStoredHash[0] = 0;\r\n        dwSize = sizeof(szStoredHash);\r\n        if (RegQueryValueExA(hKey, \"Hash\", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS\r\n            && !_stricmp(szHash, szStoredHash) && CheckVersion(hKey, TWINUI_PCSHELL_SB_VERSION))\r\n        {\r\n            dwSize = sizeof(DWORD);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_0), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[0], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_1), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[1], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_2), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[2], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_3), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[3], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_4), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[4], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_5), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[5], &dwSize);\r\n            RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_6), 0, NULL, (LPBYTE)&symbols_PTRS->twinui_pcshell_PTRS[6], &dwSize);\r\n            bOffsetsValid = TRUE;\r\n        }\r\n        else\r\n        {\r\n            printf(\"[Symbols] Symbols for \\\"%s\\\" are not available.\\n\", TWINUI_PCSHELL_SB_NAME);\r\n#ifdef _M_X64 // TODO Add support for ARM64\r\n            result.bNeedToDownloadTwinuiPcshellSymbols = TRUE;\r\n#endif\r\n        }\r\n    }\r\n\r\n    RegCloseKey(hKey);\r\n    if (!bOffsetsValid)\r\n    {\r\n        RegDeleteTreeW(\r\n            HKEY_CURRENT_USER,\r\n            TEXT(REGPATH) L\"\\\\\" TEXT(TWINUI_PCSHELL_SB_NAME)\r\n        );\r\n    }\r\n\r\n    if (IsWindows11())\r\n    {\r\n        // Load StartDocked.dll offsets\r\n        bOffsetsValid = FALSE;\r\n        RegCreateKeyExW(\r\n            HKEY_CURRENT_USER,\r\n            TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTDOCKED_SB_NAME),\r\n            0,\r\n            NULL,\r\n            REG_OPTION_NON_VOLATILE,\r\n            KEY_READ,\r\n            NULL,\r\n            &hKey,\r\n            &dwDisposition\r\n        );\r\n\r\n        GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\" TEXT(STARTDOCKED_SB_NAME) L\".dll\");\r\n        if (ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash)) == ERROR_SUCCESS)\r\n        {\r\n            szStoredHash[0] = 0;\r\n            dwSize = sizeof(szStoredHash);\r\n            if (RegQueryValueExA(hKey, \"Hash\", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS\r\n                && !_stricmp(szHash, szStoredHash) && CheckVersion(hKey, STARTDOCKED_SB_VERSION))\r\n            {\r\n                dwSize = sizeof(DWORD);\r\n                RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_0), 0, NULL, (LPBYTE)&symbols_PTRS->startdocked_PTRS[0], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_1), 0, NULL, (LPBYTE)&symbols_PTRS->startdocked_PTRS[1], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_2), 0, NULL, (LPBYTE)&symbols_PTRS->startdocked_PTRS[2], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_3), 0, NULL, (LPBYTE)&symbols_PTRS->startdocked_PTRS[3], &dwSize);\r\n                RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_4), 0, NULL, (LPBYTE)&symbols_PTRS->startdocked_PTRS[4], &dwSize);\r\n                bOffsetsValid = TRUE;\r\n            }\r\n            else\r\n            {\r\n                printf(\"[Symbols] Symbols for \\\"%s\\\" are not available.\\n\", STARTDOCKED_SB_NAME);\r\n                result.bNeedToDownloadStartDockedSymbols = TRUE;\r\n            }\r\n        }\r\n        if (hKey) RegCloseKey(hKey);\r\n        if (!bOffsetsValid)\r\n        {\r\n            RegDeleteTreeW(\r\n                HKEY_CURRENT_USER,\r\n                TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTDOCKED_SB_NAME)\r\n            );\r\n        }\r\n    }\r\n\r\n    if (rovi.dwBuildNumber >= 18362)\r\n    {\r\n        // Load StartUI.dll offsets\r\n        bOffsetsValid = FALSE;\r\n        RegCreateKeyExW(\r\n            HKEY_CURRENT_USER,\r\n            TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTUI_SB_NAME),\r\n            0,\r\n            NULL,\r\n            REG_OPTION_NON_VOLATILE,\r\n            KEY_READ,\r\n            NULL,\r\n            &hKey,\r\n            &dwDisposition\r\n        );\r\n\r\n        GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\\" TEXT(STARTUI_SB_NAME) L\".dll\");\r\n        if (!FileExistsW(wszPath))\r\n        {\r\n            GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n            wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartUI_.dll\");\r\n        }\r\n        if (ComputeFileHash(wszPath, szHash, ARRAYSIZE(szHash)) == ERROR_SUCCESS)\r\n        {\r\n            szStoredHash[0] = 0;\r\n            dwSize = sizeof(szStoredHash);\r\n            if (RegQueryValueExA(hKey, \"Hash\", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS\r\n                && !_stricmp(szHash, szStoredHash) && CheckVersion(hKey, STARTUI_SB_VERSION))\r\n            {\r\n                dwSize = sizeof(DWORD);\r\n                RegQueryValueExW(hKey, TEXT(STARTUI_SB_0), 0, NULL, (LPBYTE)&symbols_PTRS->startui_PTRS[0], &dwSize);\r\n                bOffsetsValid = TRUE;\r\n            }\r\n            else\r\n            {\r\n                printf(\"[Symbols] Symbols for \\\"%s\\\" are not available.\\n\", STARTUI_SB_NAME);\r\n                result.bNeedToDownloadStartUISymbols = TRUE;\r\n            }\r\n        }\r\n        if (hKey) RegCloseKey(hKey);\r\n        if (!bOffsetsValid)\r\n        {\r\n            RegDeleteTreeW(\r\n               HKEY_CURRENT_USER,\r\n               TEXT(REGPATH_STARTMENU) L\"\\\\\" TEXT(STARTUI_SB_NAME)\r\n           );\r\n        }\r\n    }\r\n\r\n    // Delete \"OSBuild\" value from previous versions of EP\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        TEXT(REGPATH),\r\n        0,\r\n        NULL,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_WRITE,\r\n        NULL,\r\n        &hKey,\r\n        &dwDisposition\r\n    );\r\n    if (hKey && hKey != INVALID_HANDLE_VALUE)\r\n    {\r\n        RegDeleteValueW(hKey, TEXT(\"OSBuild\"));\r\n        RegCloseKey(hKey);\r\n    }\r\n\r\n    result.bSuccess = TRUE;\r\n    return result;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/symbols.h",
    "content": "#ifndef _H_SYMBOLS_H_\r\n#define _H_SYMBOLS_H_\r\n#include <Windows.h>\r\n\r\n#ifndef __cplusplus\r\n#define _LIBVALINET_INCLUDE_UNIVERSAL\r\n#include <valinet/universal/toast/toast.h>\r\n#include <valinet/utility/osversion.h>\r\n#include <roapi.h>\r\n#include \"utility.h\"\r\n#include \"../ep_gui/resources/EPSharedResources.h\"\r\n#endif\r\n\r\n#define EXIT_CODE_EXPLORER 1\r\n\r\n#define EXPLORER_SB_NAME \"explorer\"\r\n#define EXPLORER_SB_0 \"ImmersiveTray::AttachWindowToTray\"\r\n#define EXPLORER_SB_1 \"ImmersiveTray::RaiseWindow\"\r\n#define EXPLORER_SB_2 \"CTaskBand_CreateInstance\"\r\n#define EXPLORER_SB_3 \"HandleFirstTimeLegacy\"\r\n#define EXPLORER_SB_4 \"SetColorPreferenceForLogonUI\"\r\n#define EXPLORER_SB_5 \"TrayUI::_UpdatePearlSize\"\r\n#define EXPLORER_SB_CNT 6\r\n#define EXPLORER_SB_VERSION 3\r\n\r\n#define TWINUI_PCSHELL_SB_NAME \"twinui.pcshell\"\r\n#define TWINUI_PCSHELL_SB_0 \"CImmersiveContextMenuOwnerDrawHelper::s_ContextMenuWndProc\"\r\n#define TWINUI_PCSHELL_SB_1 \"ImmersiveContextMenuHelper::ApplyOwnerDrawToMenu\"\r\n#define TWINUI_PCSHELL_SB_2 \"ImmersiveContextMenuHelper::RemoveOwnerDrawFromMenu\"\r\n#define TWINUI_PCSHELL_SB_3 \"CLauncherTipContextMenu::_ExecuteShutdownCommand\"\r\n#define TWINUI_PCSHELL_SB_4 \"CLauncherTipContextMenu::_ExecuteCommand\"\r\n#define TWINUI_PCSHELL_SB_5 \"CMultitaskingViewManager::_CreateXamlMTVHost\"\r\n#define TWINUI_PCSHELL_SB_6 \"CMultitaskingViewManager::_CreateDCompMTVHost\"\r\n#define TWINUI_PCSHELL_SB_CNT 7\r\n#define TWINUI_PCSHELL_SB_VERSION 2\r\n\r\n#define STARTDOCKED_SB_NAME \"StartDocked\"\r\n#define STARTDOCKED_SB_0 \"StartDocked::LauncherFrame::ShowAllApps\" // UNUSED\r\n#define STARTDOCKED_SB_1 \"StartDocked::LauncherFrame::ShowAllApps\"\r\n#define STARTDOCKED_SB_2 \"StartDocked::LauncherFrame::OnVisibilityChanged\"\r\n#define STARTDOCKED_SB_3 \"StartDocked::SystemListPolicyProvider::GetMaximumFrequentApps\"\r\n#define STARTDOCKED_SB_4 \"StartDocked::StartSizingFrame::StartSizingFrame\"\r\n#define STARTDOCKED_SB_CNT 5\r\n#define STARTDOCKED_SB_VERSION 1\r\n\r\n#define STARTUI_SB_NAME \"StartUI\"\r\n#define STARTUI_SB_0 \"StartUI::SystemListPolicyProvider::GetMaximumFrequentApps\"\r\n#define STARTUI_SB_CNT 1\r\n#define STARTUI_SB_VERSION 1\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\n#pragma pack(push, 1)\r\ntypedef struct symbols_addr\r\n{\r\n    DWORD explorer_PTRS[EXPLORER_SB_CNT];\r\n    DWORD twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT];\r\n    DWORD startdocked_PTRS[STARTDOCKED_SB_CNT];\r\n    DWORD startui_PTRS[STARTUI_SB_CNT];\r\n} symbols_addr;\r\n#pragma pack(pop)\r\n\r\ntypedef struct _LoadSymbolsResult\r\n{\r\n    BOOL bSuccess : 1;\r\n    BOOL bNeedToDownloadExplorerSymbols : 1;\r\n    BOOL bNeedToDownloadTwinuiPcshellSymbols : 1;\r\n    BOOL bNeedToDownloadStartDockedSymbols : 1;\r\n    BOOL bNeedToDownloadStartUISymbols : 1;\r\n} LoadSymbolsResult;\r\n\r\ninline BOOL NeedToDownloadSymbols(const LoadSymbolsResult* pLoadResult)\r\n{\r\n    return pLoadResult->bNeedToDownloadExplorerSymbols\r\n        || pLoadResult->bNeedToDownloadTwinuiPcshellSymbols\r\n        || pLoadResult->bNeedToDownloadStartDockedSymbols\r\n        || pLoadResult->bNeedToDownloadStartUISymbols;\r\n}\r\n\r\ntypedef struct _DownloadSymbolsParams\r\n{\r\n    HMODULE hModule;\r\n    BOOL bVerbose;\r\n    LoadSymbolsResult loadResult;\r\n} DownloadSymbolsParams;\r\nDWORD DownloadSymbols(DownloadSymbolsParams* params);\r\n\r\nLoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS);\r\n\r\ninline BOOL IsBuild(RTL_OSVERSIONINFOW rovi, DWORD32 ubr, DWORD BuildNumber, DWORD BuildMinor)\r\n{\r\n    return (rovi.dwMajorVersion == 10 &&\r\n        rovi.dwMinorVersion == 0 &&\r\n        rovi.dwBuildNumber == BuildNumber &&\r\n        ubr == BuildMinor);\r\n}\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif"
  },
  {
    "path": "ExplorerPatcher/updates.cpp",
    "content": "﻿#include \"updates.h\"\r\n\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n\r\n#include <string>\r\n\r\n#include <wil/resource.h>\r\n#include <wil/result_macros.h>\r\n#include <wrl/async.h>\r\n\r\nstatic HRESULT String2IXMLDocument(const wchar_t* pwszData, ABI::Windows::Data::Xml::Dom::IXmlDocument** pOutXmlToastMessage)\r\n{\r\n    using namespace Microsoft::WRL;\r\n    using namespace ABI::Windows::Data::Xml::Dom;\r\n\r\n    *pOutXmlToastMessage = nullptr;\r\n\r\n    CoInitialize(nullptr);\r\n    RoInitialize(RO_INIT_MULTITHREADED);\r\n\r\n    ComPtr<IInspectable> spInspectable;\r\n    RETURN_IF_FAILED(RoActivateInstance(Wrappers::HStringReference(RuntimeClass_Windows_Data_Xml_Dom_XmlDocument).Get(), &spInspectable));\r\n\r\n    ComPtr<IXmlDocument> spXmlDocument;\r\n    RETURN_IF_FAILED(spInspectable.As(&spXmlDocument));\r\n    spXmlDocument.CopyTo(pOutXmlToastMessage);\r\n\r\n    ComPtr<IXmlDocumentIO> spXmlDocumentIO;\r\n    RETURN_IF_FAILED(spXmlDocument.As(&spXmlDocumentIO));\r\n\r\n    RETURN_IF_FAILED(spXmlDocumentIO->LoadXml(Wrappers::HStringReference(pwszData).Get()));\r\n\r\n    return S_OK;\r\n}\r\n\r\nusing namespace Microsoft::WRL;\r\nusing namespace ABI::Windows::Foundation;\r\nusing namespace ABI::Windows::Foundation::Collections;\r\nusing namespace ABI::Windows::Data::Xml::Dom;\r\nusing namespace ABI::Windows::UI::Notifications;\r\n\r\nclass CToastData : public RuntimeClass<RuntimeClassFlags<ClassicCom>, ITypedEventHandler<ToastNotification*, IInspectable*>>\r\n{\r\npublic:\r\n    CToastData(IToastNotifier* notifier, IToastNotificationFactory* notifFactory)\r\n        : notifier(notifier), notifFactory(notifFactory), cookie{}, liLastUpdate{}\r\n    {\r\n    }\r\n\r\n    void HideToast()\r\n    {\r\n        if (!this) return;\r\n        IToastNotification* oldToast = toast.Get();\r\n        if (oldToast)\r\n        {\r\n            if (notifier)\r\n            {\r\n                notifier->Hide(oldToast);\r\n            }\r\n            oldToast->remove_Activated(cookie);\r\n            toast.Reset();\r\n        }\r\n    }\r\n\r\n    void HideAndShowToast(IXmlDocument* inputXml)\r\n    {\r\n        if (!this) return;\r\n        HideToast();\r\n        if (notifFactory)\r\n        {\r\n            notifFactory->CreateToastNotification(inputXml, &toast);\r\n        }\r\n        IToastNotification* newToast = toast.Get();\r\n        if (newToast && notifier)\r\n        {\r\n            ComPtr<IToastNotification2> toast2;\r\n            if (SUCCEEDED(newToast->QueryInterface(IID_PPV_ARGS(&toast2))))\r\n            {\r\n                toast2->put_Tag(Wrappers::HStringReference(L\"ep_updates\").Get());\r\n            }\r\n            newToast->add_Activated(this, &cookie);\r\n            notifier->Show(newToast);\r\n        }\r\n    }\r\n\r\n    HRESULT UpdateDownloadProgress(SIZE_T downloaded, SIZE_T total)\r\n    {\r\n        if (!this) return E_FAIL;\r\n\r\n        LARGE_INTEGER liNow;\r\n        QueryPerformanceCounter(&liNow);\r\n        /*if (downloaded != 0 && liNow.QuadPart - liLastUpdate.QuadPart < 1000000) // 100ms\r\n        {\r\n            return S_FALSE;\r\n        }*/\r\n        liLastUpdate = liNow;\r\n\r\n        ComPtr<IInspectable> dataInspectable;\r\n        RETURN_IF_FAILED(RoActivateInstance(Wrappers::HStringReference(RuntimeClass_Windows_UI_Notifications_NotificationData).Get(), &dataInspectable));\r\n\r\n        ComPtr<INotificationData> data;\r\n        RETURN_IF_FAILED(dataInspectable.As(&data));\r\n\r\n        ComPtr<IMap<HSTRING, HSTRING>> values;\r\n        RETURN_IF_FAILED(data->get_Values(&values));\r\n\r\n        WCHAR szProgressValue[64];\r\n        if (total != 0)\r\n        {\r\n            swprintf_s(szProgressValue, L\"%f\", (double)downloaded / (double)total);\r\n        }\r\n        else\r\n        {\r\n            wcscpy_s(szProgressValue, ARRAYSIZE(szProgressValue), L\"indeterminate\");\r\n        }\r\n\r\n        WCHAR szProgressStatus[80];\r\n        szProgressStatus[0] = 0;\r\n\r\n        WCHAR szDownloaded[32];\r\n        szDownloaded[0] = 0;\r\n        StrFormatByteSizeW(downloaded, szDownloaded, ARRAYSIZE(szDownloaded));\r\n\r\n        if (total != 0)\r\n        {\r\n            WCHAR szTotal[32];\r\n            szTotal[0] = 0;\r\n            StrFormatByteSizeW(total, szTotal, ARRAYSIZE(szTotal));\r\n            swprintf_s(szProgressStatus, L\"%s / %s\", szDownloaded, szTotal);\r\n        }\r\n        else if (downloaded != 0)\r\n        {\r\n            wcscpy_s(szProgressStatus, ARRAYSIZE(szProgressStatus), szDownloaded);\r\n        }\r\n        else\r\n        {\r\n            wil::unique_hmodule hEPGui(LoadGuiModule());\r\n            LoadStringW(hEPGui.get(), IDS_UPDATES_DOWNLOADING_0, szProgressStatus, ARRAYSIZE(szProgressStatus));\r\n        }\r\n\r\n        BOOLEAN bReplaced;\r\n        RETURN_IF_FAILED(values->Insert(\r\n            Wrappers::HStringReference(L\"progressValue\").Get(),\r\n            Wrappers::HStringReference(szProgressValue, (UINT)wcslen(szProgressValue)).Get(),\r\n            &bReplaced\r\n        ));\r\n        RETURN_IF_FAILED(values->Insert(\r\n            Wrappers::HStringReference(L\"progressStatus\").Get(),\r\n            Wrappers::HStringReference(szProgressStatus, (UINT)wcslen(szProgressStatus)).Get(),\r\n            &bReplaced\r\n        ));\r\n\r\n        ComPtr<IToastNotifier2> notifier2;\r\n        RETURN_IF_FAILED(notifier->QueryInterface(IID_PPV_ARGS(&notifier2)));\r\n\r\n        NotificationUpdateResult result;\r\n        RETURN_HR(notifier2->UpdateWithTag(data.Get(), Wrappers::HStringReference(L\"ep_updates\").Get(), &result));\r\n    }\r\n\r\n    STDMETHODIMP Invoke(IToastNotification* sender, IInspectable* argsInspectable) override\r\n    {\r\n        ComPtr<IToastActivatedEventArgs> args;\r\n        RETURN_IF_FAILED(argsInspectable->QueryInterface(IID_PPV_ARGS(&args)));\r\n\r\n        Wrappers::HString arguments;\r\n        RETURN_IF_FAILED(args->get_Arguments(arguments.GetAddressOf()));\r\n\r\n        const WCHAR* argumentsStr = arguments.GetRawBuffer(nullptr);\r\n        if (!wcscmp(argumentsStr, L\"action=update\"))\r\n        {\r\n            HANDLE hEvent = CreateEventW(nullptr, FALSE, FALSE, L\"EP_Ev_InstallUpdatesNoConfirm_\" _T(EP_CLSID));\r\n            if (hEvent)\r\n            {\r\n                if (GetLastError() == ERROR_ALREADY_EXISTS)\r\n                {\r\n                    SetEvent(hEvent);\r\n                }\r\n                CloseHandle(hEvent);\r\n            }\r\n        }\r\n\r\n        return S_OK;\r\n    }\r\n\r\nprivate:\r\n    IToastNotifier* notifier;\r\n    IToastNotificationFactory* notifFactory;\r\n    ComPtr<IToastNotification> toast;\r\n    EventRegistrationToken cookie;\r\n    LARGE_INTEGER liLastUpdate;\r\n};\r\n\r\nstruct IsUpdateAvailableParameters\r\n{\r\n    HINTERNET hInternet;\r\n    HANDLE hEvent;\r\n};\r\n\r\nBOOL IsUpdateAvailableHelper(\r\n    WCHAR* url,\r\n    char* szCheckAgainst,\r\n    DWORD dwUpdateTimeout,\r\n    BOOL* lpFail,\r\n    CToastData* toastData,\r\n    BOOL bUpdatePreferStaging,\r\n    WCHAR* wszInfoURL,\r\n    DWORD cchInfoURL,\r\n    BOOL bNoConfirmation,\r\n    HMODULE hModule,\r\n    DWORD* pLeftMost, DWORD* pSecondLeft, DWORD* pSecondRight, DWORD* pRightMost)\r\n{\r\n    BOOL bIsUpdateAvailable = FALSE;\r\n\r\n    IsUpdateAvailableParameters params;\r\n    params.hEvent = CreateEventW(nullptr, FALSE, FALSE, nullptr);\r\n    if (!params.hEvent)\r\n    {\r\n        return bIsUpdateAvailable;\r\n    }\r\n\r\n    Wrappers::HString hstrDownloadUrl;\r\n    hstrDownloadUrl.Set(url);\r\n    HINTERNET hInternet = nullptr;\r\n\r\n    if (bUpdatePreferStaging)\r\n    {\r\n        BOOL bRet = FALSE;\r\n        std::string jsonStr;\r\n\r\n        hInternet = InternetOpenA(UPDATES_USER_AGENT, INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0);\r\n        if ((bRet = (hInternet != nullptr)))\r\n        {\r\n            HINTERNET hConnect = InternetOpenUrlW(\r\n                hInternet,\r\n                hstrDownloadUrl.GetRawBuffer(nullptr),\r\n                nullptr,\r\n                0,\r\n                INTERNET_FLAG_RAW_DATA |\r\n                INTERNET_FLAG_RELOAD |\r\n                INTERNET_FLAG_RESYNCHRONIZE |\r\n                INTERNET_FLAG_NO_COOKIES |\r\n                INTERNET_FLAG_NO_UI |\r\n                INTERNET_FLAG_NO_CACHE_WRITE |\r\n                INTERNET_FLAG_DONT_CACHE,\r\n                (DWORD_PTR)&params\r\n            );\r\n            if ((bRet = (hConnect != nullptr)))\r\n            {\r\n                char* buffer = (char*)malloc(UPDATES_BUFSIZ);\r\n                if ((bRet = (buffer != nullptr)))\r\n                {\r\n                    DWORD dwRead = 0;\r\n                    while (InternetReadFile(hConnect, buffer, UPDATES_BUFSIZ, &dwRead) && dwRead != 0)\r\n                    {\r\n                        jsonStr.append(buffer, dwRead);\r\n                    }\r\n                    bRet = !jsonStr.empty();\r\n                    free(buffer);\r\n                }\r\n                InternetCloseHandle(hConnect);\r\n            }\r\n            InternetCloseHandle(hInternet);\r\n        }\r\n\r\n        WCHAR* pszJsonStr = nullptr;\r\n        if (bRet)\r\n        {\r\n            pszJsonStr = (WCHAR*)malloc(sizeof(WCHAR) * (jsonStr.size() + 1));\r\n            if ((bRet = (pszJsonStr != nullptr)))\r\n            {\r\n                MultiByteToWideChar(\r\n                    CP_UTF8,\r\n                    0,\r\n                    jsonStr.c_str(),\r\n                    -1,\r\n                    pszJsonStr,\r\n                    (int)(jsonStr.size() + 1)\r\n                );\r\n            }\r\n        }\r\n\r\n        if (bRet)\r\n        {\r\n            auto extract = [&](HSTRING* outHtmlUrl, HSTRING* outDownloadUrl) -> HRESULT\r\n            {\r\n                using namespace ABI::Windows::Data::Json;\r\n\r\n                *outHtmlUrl = nullptr;\r\n                *outDownloadUrl = nullptr;\r\n\r\n                ComPtr<IJsonArrayStatics> jsonArrayStatics;\r\n                RETURN_IF_FAILED(GetActivationFactory(Wrappers::HStringReference(RuntimeClass_Windows_Data_Json_JsonArray).Get(), &jsonArrayStatics));\r\n\r\n                ComPtr<IJsonArray> releases;\r\n                RETURN_IF_FAILED(jsonArrayStatics->Parse(Wrappers::HStringReference(pszJsonStr).Get(), &releases));\r\n\r\n                ComPtr<IJsonObject> firstRelease;\r\n                RETURN_IF_FAILED(releases->GetObjectAt(0, &firstRelease));\r\n\r\n                RETURN_IF_FAILED(firstRelease->GetNamedString(Wrappers::HStringReference(L\"html_url\").Get(), outHtmlUrl));\r\n\r\n                ComPtr<IJsonArray> assets;\r\n                RETURN_IF_FAILED(firstRelease->GetNamedArray(Wrappers::HStringReference(L\"assets\").Get(), &assets));\r\n\r\n                ComPtr<IIterable<IJsonValue*>> assetsIterable;\r\n                RETURN_IF_FAILED(assets.As(&assetsIterable));\r\n\r\n                ComPtr<IIterator<IJsonValue*>> assetsIterator;\r\n                RETURN_IF_FAILED(assetsIterable->First(&assetsIterator));\r\n\r\n                boolean bHasCurrent = false;\r\n                RETURN_IF_FAILED(assetsIterator->get_HasCurrent(&bHasCurrent));\r\n\r\n                while (bHasCurrent)\r\n                {\r\n                    ComPtr<IJsonValue> assetValue;\r\n                    RETURN_IF_FAILED(assetsIterator->get_Current(&assetValue));\r\n\r\n                    ComPtr<IJsonObject> asset;\r\n                    RETURN_IF_FAILED(assetValue->GetObjectW(&asset)); // Note: W/A macros caused this to be renamed\r\n\r\n                    Wrappers::HString name;\r\n                    RETURN_IF_FAILED(asset->GetNamedString(Wrappers::HStringReference(L\"name\").Get(), name.ReleaseAndGetAddressOf()));\r\n\r\n                    const WCHAR* pszName = name.GetRawBuffer(nullptr);\r\n                    if (wcscmp(pszName, _T(SETUP_UTILITY_NAME)) == 0)\r\n                    {\r\n                        RETURN_IF_FAILED(asset->GetNamedString(Wrappers::HStringReference(L\"browser_download_url\").Get(), outDownloadUrl));\r\n                        return S_OK;\r\n                    }\r\n\r\n                    RETURN_IF_FAILED(assetsIterator->MoveNext(&bHasCurrent));\r\n                }\r\n\r\n                RETURN_HR(HRESULT_FROM_WIN32(ERROR_NOT_FOUND));\r\n            };\r\n\r\n            Wrappers::HString htmlUrl;\r\n            if ((bRet = SUCCEEDED(extract(htmlUrl.ReleaseAndGetAddressOf(), hstrDownloadUrl.ReleaseAndGetAddressOf()))))\r\n            {\r\n                if (wszInfoURL)\r\n                {\r\n                    wcscpy_s(wszInfoURL, cchInfoURL, htmlUrl.GetRawBuffer(nullptr));\r\n                    wprintf(L\"[Updates] Release notes URL: \\\"%s\\\"\\n\", wszInfoURL);\r\n                }\r\n                if (hstrDownloadUrl.Get())\r\n                {\r\n                    wprintf(L\"[Updates] Prerelease update URL: \\\"%s\\\"\\n\", hstrDownloadUrl.GetRawBuffer(nullptr));\r\n                    bUpdatePreferStaging = FALSE; // Success\r\n                }\r\n            }\r\n        }\r\n\r\n        if (pszJsonStr)\r\n        {\r\n            free(pszJsonStr);\r\n        }\r\n    }\r\n\r\n    if (!bUpdatePreferStaging && ((hInternet = InternetOpenA(\r\n        UPDATES_USER_AGENT,\r\n        INTERNET_OPEN_TYPE_PRECONFIG,\r\n        nullptr,\r\n        nullptr,\r\n        0\r\n    ))))\r\n    {\r\n        HINTERNET hConnect = InternetOpenUrlW(\r\n            hInternet,\r\n            hstrDownloadUrl.GetRawBuffer(nullptr),\r\n            nullptr,\r\n            0,\r\n            INTERNET_FLAG_RAW_DATA |\r\n            INTERNET_FLAG_RELOAD |\r\n            INTERNET_FLAG_RESYNCHRONIZE |\r\n            INTERNET_FLAG_NO_COOKIES |\r\n            INTERNET_FLAG_NO_UI |\r\n            INTERNET_FLAG_NO_CACHE_WRITE |\r\n            INTERNET_FLAG_DONT_CACHE,\r\n            (DWORD_PTR)&params\r\n        );\r\n        if (hConnect)\r\n        {\r\n            if (szCheckAgainst)\r\n            {\r\n                DWORD dwRead = 0;\r\n                char hash[DOSMODE_OFFSET + UPDATES_HASH_SIZE + 1] = {};\r\n                if (InternetReadFile(hConnect, hash, DOSMODE_OFFSET + UPDATES_HASH_SIZE, &dwRead)\r\n                    && dwRead == DOSMODE_OFFSET + UPDATES_HASH_SIZE)\r\n                {\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                    printf(\"[Updates] Hash of remote file is \\\"%s\\\" (%s).\\n\", DOSMODE_OFFSET + hash, (hash[0] == 0x4D && hash[1] == 0x5A) ? \"valid\" : \"invalid\");\r\n#endif\r\n                    BOOL bOldType = TRUE;\r\n                    char *szLeftMost = nullptr, *szSecondLeft = nullptr, *szSecondRight = nullptr, *szRightMost = nullptr, *szRealHash = nullptr;\r\n                    if (hModule)\r\n                    {\r\n                        if (hash[0] == 0x4D && hash[1] == 0x5A)\r\n                        {\r\n                            if (strchr(DOSMODE_OFFSET + hash, '.'))\r\n                            {\r\n                                szLeftMost = DOSMODE_OFFSET + hash;\r\n                                if ((szSecondLeft = strchr(szLeftMost, '.')))\r\n                                {\r\n                                    *szSecondLeft = 0;\r\n                                    szSecondLeft++;\r\n                                    if ((szSecondRight = strchr(szSecondLeft, '.')))\r\n                                    {\r\n                                        *szSecondRight = 0;\r\n                                        szSecondRight++;\r\n                                        if ((szRightMost = strchr(szSecondRight, '.')))\r\n                                        {\r\n                                            *szRightMost = 0;\r\n                                            szRightMost++;\r\n                                            if ((szRealHash = strchr(szRightMost, '.')))\r\n                                            {\r\n                                                bOldType = FALSE;\r\n\r\n                                                *szRealHash = 0;\r\n                                                szRealHash++;\r\n                                                DWORD dwRemoteLeftMost = atoi(szLeftMost);\r\n                                                if (pLeftMost) *pLeftMost = dwRemoteLeftMost;\r\n                                                DWORD dwRemoteSecondLeft = atoi(szSecondLeft);\r\n                                                if (pSecondLeft) *pSecondLeft = dwRemoteSecondLeft;\r\n                                                DWORD dwRemoteSecondRight = atoi(szSecondRight);\r\n                                                if (pSecondRight) *pSecondRight = dwRemoteSecondRight;\r\n                                                DWORD dwRemoteRightMost = atoi(szRightMost);\r\n                                                if (pRightMost) *pRightMost = dwRemoteRightMost;\r\n                                                DWORD dwLocalLeftMost = 0;\r\n                                                DWORD dwLocalSecondLeft = 0;\r\n                                                DWORD dwLocalSecondRight = 0;\r\n                                                DWORD dwLocalRightMost = 0;\r\n                                                BOOL bExtractedFromHash = FALSE;\r\n                                                CHAR hashCopy[100];\r\n                                                strcpy_s(hashCopy, 100, szCheckAgainst);\r\n                                                char* szLocalLeftMost = nullptr, *szLocalSecondLeft = nullptr, *szLocalSecondRight = nullptr, *szLocalRightMost = nullptr, *szLocalRealHash = nullptr;\r\n                                                if (strchr(hashCopy, '.'))\r\n                                                {\r\n                                                    szLocalLeftMost = hashCopy;\r\n                                                    if ((szLocalSecondLeft = strchr(szLocalLeftMost, '.')))\r\n                                                    {\r\n                                                        *szLocalSecondLeft = 0;\r\n                                                        szLocalSecondLeft++;\r\n                                                        if ((szLocalSecondRight = strchr(szLocalSecondLeft, '.')))\r\n                                                        {\r\n                                                            *szLocalSecondRight = 0;\r\n                                                            szLocalSecondRight++;\r\n                                                            if ((szLocalRightMost = strchr(szLocalSecondRight, '.')))\r\n                                                            {\r\n                                                                *szLocalRightMost = 0;\r\n                                                                szLocalRightMost++;\r\n                                                                if ((szLocalRealHash = strchr(szLocalRightMost, '.')))\r\n                                                                {\r\n                                                                    *szLocalRealHash = 0;\r\n                                                                    szLocalRealHash++;\r\n\r\n                                                                    bExtractedFromHash = TRUE;\r\n                                                                    dwLocalLeftMost = atoi(szLocalLeftMost);\r\n                                                                    dwLocalSecondLeft = atoi(szLocalSecondLeft);\r\n                                                                    dwLocalSecondRight = atoi(szLocalSecondRight);\r\n                                                                    dwLocalRightMost = atoi(szLocalRightMost);\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                                                    printf(\"[Updates] Local version obtained from hash is %d.%d.%d.%d.\\n\", dwLocalLeftMost, dwLocalSecondLeft, dwLocalSecondRight, dwLocalRightMost);\r\n#endif\r\n                                                                }\r\n                                                            }\r\n                                                        }\r\n                                                    }\r\n                                                }\r\n                                                if (!bExtractedFromHash)\r\n                                                {\r\n                                                    QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLocalLeftMost, &dwLocalSecondLeft, &dwLocalSecondRight, &dwLocalRightMost);\r\n                                                }\r\n\r\n                                                int res = 0;\r\n                                                if (!res)\r\n                                                {\r\n                                                    if (dwLocalLeftMost < dwRemoteLeftMost)\r\n                                                    {\r\n                                                        res = -1;\r\n                                                    }\r\n                                                    if (dwLocalLeftMost > dwRemoteLeftMost)\r\n                                                    {\r\n                                                        res = 1;\r\n                                                    }\r\n                                                    if (!res)\r\n                                                    {\r\n                                                        if (dwLocalSecondLeft < dwRemoteSecondLeft)\r\n                                                        {\r\n                                                            res = -1;\r\n                                                        }\r\n                                                        if (dwLocalSecondLeft > dwRemoteSecondLeft)\r\n                                                        {\r\n                                                            res = 1;\r\n                                                        }\r\n                                                        if (!res)\r\n                                                        {\r\n                                                            if (dwLocalSecondRight < dwRemoteSecondRight)\r\n                                                            {\r\n                                                                res = -1;\r\n                                                            }\r\n                                                            if (dwLocalSecondRight > dwRemoteSecondRight)\r\n                                                            {\r\n                                                                res = 1;\r\n                                                            }\r\n                                                            if (!res)\r\n                                                            {\r\n                                                                if (dwLocalRightMost < dwRemoteRightMost)\r\n                                                                {\r\n                                                                    res = -1;\r\n                                                                }\r\n                                                                if (dwLocalRightMost > dwRemoteRightMost)\r\n                                                                {\r\n                                                                    res = 1;\r\n                                                                }\r\n                                                            }\r\n                                                        }\r\n                                                    }\r\n                                                }\r\n                                                DWORD dwAllowDowngrades = FALSE, dwSize = sizeof(DWORD);\r\n                                                RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"UpdateAllowDowngrades\", RRF_RT_DWORD, nullptr, &dwAllowDowngrades, &dwSize);\r\n                                                if ((res == 1 && dwAllowDowngrades) || res == -1)\r\n                                                {\r\n                                                    bIsUpdateAvailable = TRUE;\r\n                                                }\r\n                                                else if (res == 0)\r\n                                                {\r\n                                                    *(szSecondLeft - 1) = '.';\r\n                                                    *(szSecondRight - 1) = '.';\r\n                                                    *(szRightMost - 1) = '.';\r\n                                                    *(szRealHash - 1) = '.';\r\n                                                    if (_stricmp(DOSMODE_OFFSET + hash, szCheckAgainst))\r\n                                                    {\r\n                                                        bIsUpdateAvailable = TRUE;\r\n                                                    }\r\n                                                }\r\n                                            }\r\n                                        }\r\n                                    }\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    /*if (bOldType)\r\n                    {\r\n                        if (hash[0] == 0x4D && hash[1] == 0x5A && _stricmp(DOSMODE_OFFSET + hash, szCheckAgainst))\r\n                        {\r\n                            bIsUpdateAvailable = TRUE;\r\n                        }\r\n                    }*/\r\n                }\r\n                else\r\n                {\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                    printf(\"[Updates] Failed. Read %d bytes.\\n\", dwRead);\r\n#endif\r\n                    if (lpFail) *lpFail = TRUE;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                WCHAR wszPath[MAX_PATH] = {};\r\n                SHGetFolderPathW(nullptr, SPECIAL_FOLDER_LEGACY, nullptr, SHGFP_TYPE_CURRENT, wszPath);\r\n                wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n                BOOL bRet = CreateDirectoryW(wszPath, nullptr);\r\n                if (bRet || (!bRet && GetLastError() == ERROR_ALREADY_EXISTS))\r\n                {\r\n                    wcscat_s(wszPath, MAX_PATH, L\"\\\\Update for \" _T(PRODUCT_NAME) L\" from \");\r\n                    WCHAR wszURL[MAX_PATH] = {};\r\n                    wcscpy_s(wszURL, MAX_PATH, hstrDownloadUrl.GetRawBuffer(nullptr));\r\n                    if (wszURL[97]) // Truncate the URL for display\r\n                    {\r\n                        wszURL[96] = L'.';\r\n                        wszURL[97] = L'.';\r\n                        wszURL[98] = L'.';\r\n                        wszURL[99] = L'e';\r\n                        wszURL[100] = L'x';\r\n                        wszURL[101] = L'e';\r\n                        wszURL[102] = 0;\r\n                    }\r\n                    for (unsigned int i = 0; true; ++i)\r\n                    {\r\n                        if (!wszURL[i])\r\n                        {\r\n                            break;\r\n                        }\r\n                        if (wszURL[i] == L'/')\r\n                        {\r\n                            wszURL[i] = L'\\u2215';\r\n                        }\r\n                        else if (wszURL[i] == L':')\r\n                        {\r\n                            wszURL[i] = L'\\ua789';\r\n                        }\r\n                    }\r\n                    wcscat_s(wszPath, MAX_PATH, wszURL);\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                    wprintf(L\"[Updates] Download path is \\\"%s\\\".\\n\", wszPath);\r\n#endif\r\n\r\n                    BOOL bRet = DeleteFileW(wszPath);\r\n                    if (bRet || (!bRet && GetLastError() == ERROR_FILE_NOT_FOUND))\r\n                    {\r\n                        DWORD bIsUsingEpMake = 0, dwSize = sizeof(DWORD);\r\n                        RegGetValueW(HKEY_CURRENT_USER, TEXT(REGPATH), L\"UpdateUseLocal\", RRF_RT_DWORD, nullptr, &bIsUsingEpMake, &dwSize);\r\n                        if (bIsUsingEpMake) {\r\n                            GetSystemDirectoryW(wszPath, MAX_PATH);\r\n                            wcscat_s(wszPath, MAX_PATH, L\"\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\");\r\n                        }\r\n\r\n                        FILE* f = nullptr;\r\n                        if (!bIsUsingEpMake && !_wfopen_s(\r\n                            &f,\r\n                            wszPath,\r\n                            L\"wb\"\r\n                        ) && f)\r\n                        {\r\n                            BYTE* buffer = (BYTE*)malloc(UPDATES_BUFSIZ);\r\n                            if (buffer != nullptr)\r\n                            {\r\n                                DWORD totalSize = 0;\r\n                                CHAR szContentLength[24] = {};\r\n                                DWORD dwSize = sizeof(szContentLength);\r\n                                if (HttpQueryInfoA(hConnect, HTTP_QUERY_CONTENT_LENGTH, szContentLength, &dwSize, nullptr))\r\n                                {\r\n                                    totalSize = atoi(szContentLength);\r\n                                }\r\n                                toastData->UpdateDownloadProgress(0, totalSize);\r\n\r\n                                DWORD dwTotalRead = 0;\r\n                                DWORD dwRead = 0;\r\n                                bRet = FALSE;\r\n                                while ((bRet = InternetReadFile(\r\n                                    hConnect,\r\n                                    buffer,\r\n                                    UPDATES_BUFSIZ,\r\n                                    &dwRead\r\n                                )))\r\n                                {\r\n                                    if (dwRead == 0)\r\n                                    {\r\n                                        bIsUpdateAvailable = TRUE;\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                        printf(\"[Updates] Downloaded finished.\\n\");\r\n#endif\r\n                                        break;\r\n                                    }\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                    // printf(\"[Updates] Downloaded %d bytes.\\n\", dwRead);\r\n#endif\r\n                                    fwrite(\r\n                                        buffer,\r\n                                        sizeof(BYTE),\r\n                                        dwRead,\r\n                                        f\r\n                                    );\r\n                                    dwTotalRead += dwRead;\r\n                                    toastData->UpdateDownloadProgress(dwTotalRead, totalSize);\r\n                                    dwRead = 0;\r\n                                }\r\n                                free(buffer);\r\n                            }\r\n                            fclose(f);\r\n                        }\r\n                        if (bIsUsingEpMake || bIsUpdateAvailable)\r\n                        {\r\n                            bIsUpdateAvailable = FALSE;\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                            printf(\r\n                                \"[Updates] In order to install this update for the product \\\"\"\r\n                                PRODUCT_NAME\r\n                                \"\\\", please allow the request.\\n\"\r\n                            );\r\n#endif\r\n\r\n                            toastData->HideToast();\r\n\r\n                            BOOL bHasErrored = FALSE;\r\n                            BOOL bIsUACEnabled = FALSE;\r\n                            DWORD(*CheckElevationEnabled)(BOOL*);\r\n                            CheckElevationEnabled = (decltype(CheckElevationEnabled))GetProcAddress(GetModuleHandleW(L\"kernel32.dll\"), \"CheckElevationEnabled\");\r\n                            if (CheckElevationEnabled) CheckElevationEnabled(&bIsUACEnabled);\r\n                            DWORD dwData = FALSE, dwSize = sizeof(DWORD);\r\n                            RegGetValueW(\r\n                                HKEY_LOCAL_MACHINE,\r\n                                L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\System\",\r\n                                L\"ConsentPromptBehaviorAdmin\",\r\n                                RRF_RT_DWORD,\r\n                                nullptr,\r\n                                &dwData,\r\n                                &dwSize\r\n                            );\r\n                            LPWSTR wszSID = nullptr;\r\n                            HANDLE hMyToken = nullptr;\r\n                            if (OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hMyToken))\r\n                            {\r\n                                PTOKEN_USER ptu = nullptr;\r\n                                DWORD dwSize = 0;\r\n                                if (!GetTokenInformation(hMyToken, TokenUser, nullptr, 0, &dwSize)\r\n                                    && ERROR_INSUFFICIENT_BUFFER == GetLastError())\r\n                                {\r\n                                    if (nullptr != (ptu = (PTOKEN_USER)LocalAlloc(LPTR, dwSize)))\r\n                                    {\r\n                                        if (!GetTokenInformation(hMyToken, TokenUser, ptu, dwSize, &dwSize))\r\n                                        {\r\n                                            LocalFree((HLOCAL)ptu);\r\n                                            return FALSE;\r\n                                        }\r\n                                        ConvertSidToStringSidW(ptu->User.Sid, &wszSID);\r\n                                        LocalFree((HLOCAL)ptu);\r\n                                    }\r\n                                }\r\n                                CloseHandle(hMyToken);\r\n                            }\r\n                            size_t lnSID = (wszSID ? wcslen(wszSID) : 0);\r\n                            DWORD bIsBuiltInAdministratorInApprovalMode = FALSE;\r\n                            BOOL bIsBuiltInAdministratorAccount =\r\n                                IsUserAnAdmin() &&\r\n                                lnSID && !_wcsnicmp(wszSID, L\"S-1-5-\", 6) && wszSID[lnSID - 4] == L'-' && wszSID[lnSID - 3] == L'5' && wszSID[lnSID - 2] == L'0' && wszSID[lnSID - 1] == L'0';\r\n                            if (bIsBuiltInAdministratorAccount)\r\n                            {\r\n                                DWORD dwSSize = sizeof(DWORD);\r\n                                RegGetValueW(HKEY_LOCAL_MACHINE, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\System\", L\"FilterAdministratorToken\", RRF_RT_DWORD, nullptr, &bIsBuiltInAdministratorInApprovalMode, &dwSSize);\r\n                            }\r\n                            LocalFree(wszSID);\r\n                            if (!bNoConfirmation && (!bIsUACEnabled || !dwData || (bIsBuiltInAdministratorAccount && !bIsBuiltInAdministratorInApprovalMode)))\r\n                            {\r\n                                WCHAR wszMsg[500];\r\n                                wszMsg[0] = 0;\r\n\r\n                                WCHAR wszMsgFormat[500];\r\n                                EP_L10N_ApplyPreferredLanguageForCurrentThread();\r\n                                {\r\n                                    wil::unique_hmodule hEPGui(LoadGuiModule());\r\n                                    if (LoadStringW(hEPGui.get(), IDS_UPDATES_PROMPT, wszMsgFormat, ARRAYSIZE(wszMsgFormat)))\r\n                                    {\r\n                                        swprintf_s(wszMsg, ARRAYSIZE(wszMsg), wszMsgFormat, hstrDownloadUrl.GetRawBuffer(nullptr));\r\n                                    }\r\n                                }\r\n\r\n                                if (MessageBoxW(\r\n                                    FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), nullptr),\r\n                                    wszMsg,\r\n                                    _T(PRODUCT_NAME),\r\n                                    MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION\r\n                                ) == IDNO)\r\n                                {\r\n                                    bHasErrored = TRUE;\r\n                                    SetLastError(ERROR_CANCELLED);\r\n                                }\r\n                            }\r\n\r\n                            SHELLEXECUTEINFOW ShExecInfo = { 0 };\r\n                            ShExecInfo.cbSize = sizeof(ShExecInfo);\r\n                            ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n                            ShExecInfo.hwnd = nullptr;\r\n                            ShExecInfo.lpVerb = bIsUsingEpMake ? L\"open\" : L\"runas\";\r\n                            ShExecInfo.lpFile = wszPath;\r\n                            ShExecInfo.lpParameters = bIsUsingEpMake ? L\"iex (irm 'https://raw.githubusercontent.com/valinet/ep_make/master/ep_make_safe.ps1')\" : L\"/update_silent\";\r\n                            ShExecInfo.lpDirectory = nullptr;\r\n                            ShExecInfo.nShow = SW_SHOW;\r\n                            ShExecInfo.hInstApp = nullptr;\r\n                            if (!bHasErrored && ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)\r\n                            {\r\n                                WaitForSingleObject(ShExecInfo.hProcess, INFINITE);\r\n                                DWORD dwExitCode = 0;\r\n                                if (GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode) && !dwExitCode)\r\n                                {\r\n                                    bIsUpdateAvailable = TRUE;\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                    printf(\"[Updates] Update successful, File Explorer will probably restart momentarily.\\n\");\r\n#endif\r\n                                }\r\n                                else\r\n                                {\r\n                                    SetLastError(dwExitCode);\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                    printf(\"[Updates] Update failed because the following error has occured: %d.\\n\", dwExitCode);\r\n#endif\r\n                                }\r\n                                CloseHandle(ShExecInfo.hProcess);\r\n                            }\r\n                            else\r\n                            {\r\n                                DWORD dwError = GetLastError();\r\n                                if (dwError == ERROR_CANCELLED)\r\n                                {\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                    printf(\"[Updates] Update failed because the request was denied.\\n\");\r\n#endif\r\n                                }\r\n                                else\r\n                                {\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n                                    printf(\"[Updates] Update failed because the following error has occured: %d.\\n\", GetLastError());\r\n#endif\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            InternetCloseHandle(hConnect);\r\n        }\r\n        else\r\n        {\r\n            if (lpFail) *lpFail = TRUE;\r\n        }\r\n        InternetCloseHandle(hInternet);\r\n    }\r\n\r\n    CloseHandle(params.hEvent);\r\n\r\n    return bIsUpdateAvailable;\r\n}\r\n\r\nBOOL IsUpdateAvailable(LPCWSTR wszDataStore, char* szCheckAgainst, BOOL* lpFail, WCHAR* wszInfoURL, DWORD cchInfoURL, HMODULE hModule,\r\n    DWORD* pLeftMost, DWORD* pSecondLeft, DWORD* pSecondRight, DWORD* pRightMost)\r\n{\r\n    HKEY hKey = nullptr;\r\n    DWORD dwSize = 0;\r\n    DWORD dwQueriedPolicy = 0;\r\n    BOOL bIsPolicyMatch = FALSE;\r\n    WCHAR szUpdateURL[MAX_PATH] = {};\r\n    wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n    printf(\"[Updates] Checking against hash \\\"%s\\\"\\n\", szCheckAgainst);\r\n#endif\r\n    DWORD dwUpdateTimeout = UPDATES_DEFAULT_TIMEOUT;\r\n    DWORD bUpdatePreferStaging = FALSE;\r\n\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        wszDataStore,\r\n        0,\r\n        nullptr,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_READ | KEY_WOW64_64KEY,\r\n        nullptr,\r\n        &hKey,\r\n        nullptr\r\n    );\r\n    if (hKey == nullptr || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        hKey = nullptr;\r\n    }\r\n    if (hKey)\r\n    {\r\n        dwSize = sizeof(szUpdateURL);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdateURL\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)szUpdateURL,\r\n            &dwSize\r\n        );\r\n        if (dwSize == sizeof(WCHAR) && szUpdateURL[0] == 0)\r\n        {\r\n            wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n        }\r\n        wcscat_s(szUpdateURL, MAX_PATH, _T(\"/download/\"));\r\n        wcscat_s(szUpdateURL, MAX_PATH, _T(SETUP_UTILITY_NAME));\r\n        if (wszInfoURL)\r\n        {\r\n            dwSize = sizeof(WCHAR) * cchInfoURL;\r\n            RegQueryValueExW(\r\n                hKey,\r\n                L\"UpdateURL\",\r\n                nullptr,\r\n                nullptr,\r\n                (LPBYTE)wszInfoURL,\r\n                &dwSize\r\n            );\r\n            if (dwSize == sizeof(WCHAR) && wszInfoURL[0] == 0)\r\n            {\r\n                wcscat_s(wszInfoURL, cchInfoURL, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n            }\r\n        }\r\n        dwSize = sizeof(DWORD);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdateTimeout\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)&dwUpdateTimeout,\r\n            &dwSize\r\n        );\r\n        dwSize = sizeof(DWORD);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdatePreferStaging\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)&bUpdatePreferStaging,\r\n            &dwSize\r\n        );\r\n        if (bUpdatePreferStaging)\r\n        {\r\n            szUpdateURL[0] = 0;\r\n            wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STAGING));\r\n            dwSize = sizeof(szUpdateURL);\r\n            RegQueryValueExW(\r\n                hKey,\r\n                L\"UpdateURLStaging\",\r\n                nullptr,\r\n                nullptr,\r\n                (LPBYTE)szUpdateURL,\r\n                &dwSize\r\n            );\r\n            if (dwSize == sizeof(WCHAR) && szUpdateURL[0] == 0)\r\n            {\r\n                wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STAGING));\r\n            }\r\n        }\r\n        RegCloseKey(hKey);\r\n    }\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n    wprintf(L\"[Updates] Update URL: %s\\n\", szUpdateURL);\r\n#endif\r\n    return IsUpdateAvailableHelper(\r\n        szUpdateURL,\r\n        szCheckAgainst,\r\n        dwUpdateTimeout,\r\n        lpFail,\r\n        nullptr,\r\n        bUpdatePreferStaging,\r\n        wszInfoURL,\r\n        cchInfoURL,\r\n        FALSE,\r\n        hModule,\r\n        pLeftMost, pSecondLeft, pSecondRight, pRightMost\r\n    );\r\n}\r\n\r\nBOOL UpdateProduct(LPCWSTR wszDataStore, CToastData* toastData, BOOL bNoConfirmation, HMODULE hModule)\r\n{\r\n    HKEY hKey = nullptr;\r\n    DWORD dwSize = 0;\r\n    DWORD dwQueriedPolicy = 0;\r\n    BOOL bIsPolicyMatch = FALSE;\r\n    WCHAR szUpdateURL[MAX_PATH] = {};\r\n    wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n\r\n    DWORD dwUpdateTimeout = UPDATES_DEFAULT_TIMEOUT;\r\n    BOOL bUpdatePreferStaging = FALSE;\r\n\r\n    RegCreateKeyExW(\r\n        HKEY_CURRENT_USER,\r\n        wszDataStore,\r\n        0,\r\n        nullptr,\r\n        REG_OPTION_NON_VOLATILE,\r\n        KEY_READ | KEY_WOW64_64KEY,\r\n        nullptr,\r\n        &hKey,\r\n        nullptr\r\n    );\r\n    if (hKey == nullptr || hKey == INVALID_HANDLE_VALUE)\r\n    {\r\n        hKey = nullptr;\r\n    }\r\n    if (hKey)\r\n    {\r\n        dwSize = sizeof(szUpdateURL);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdateURL\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)szUpdateURL,\r\n            &dwSize\r\n        );\r\n        if (dwSize == sizeof(WCHAR) && szUpdateURL[0] == 0)\r\n        {\r\n            wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n        }\r\n        wcscat_s(szUpdateURL, MAX_PATH, _T(\"/download/\"));\r\n        wcscat_s(szUpdateURL, MAX_PATH, _T(SETUP_UTILITY_NAME));\r\n        dwSize = sizeof(DWORD);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdateTimeout\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)&dwUpdateTimeout,\r\n            &dwSize\r\n        );\r\n        dwSize = sizeof(BOOL);\r\n        RegQueryValueExW(\r\n            hKey,\r\n            L\"UpdatePreferStaging\",\r\n            nullptr,\r\n            nullptr,\r\n            (LPBYTE)&bUpdatePreferStaging,\r\n            &dwSize\r\n        );\r\n        if (bUpdatePreferStaging)\r\n        {\r\n            szUpdateURL[0] = 0;\r\n            wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STAGING));\r\n            dwSize = sizeof(szUpdateURL);\r\n            RegQueryValueExW(\r\n                hKey,\r\n                L\"UpdateURLStaging\",\r\n                nullptr,\r\n                nullptr,\r\n                (LPBYTE)szUpdateURL,\r\n                &dwSize\r\n            );\r\n            if (dwSize == sizeof(WCHAR) && szUpdateURL[0] == 0)\r\n            {\r\n                wcscat_s(szUpdateURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STAGING));\r\n            }\r\n        }\r\n        RegCloseKey(hKey);\r\n    }\r\n#ifdef UPDATES_VERBOSE_OUTPUT\r\n    wprintf(L\"[Updates] Update URL: %s\\n\", szUpdateURL);\r\n#endif\r\n    return IsUpdateAvailableHelper(\r\n        szUpdateURL,\r\n        nullptr,\r\n        dwUpdateTimeout,\r\n        nullptr,\r\n        toastData,\r\n        bUpdatePreferStaging,\r\n        nullptr, 0,\r\n        bNoConfirmation,\r\n        hModule,\r\n        nullptr, nullptr, nullptr, nullptr\r\n    );\r\n}\r\n\r\nBOOL ShowUpdateSuccessNotification(HMODULE hModule, CToastData* toastData)\r\n{\r\n    auto switchToThreadScopeExit = wil::scope_exit([](){ SwitchToThread(); });\r\n\r\n    EP_L10N_ApplyPreferredLanguageForCurrentThread();\r\n    wil::unique_hmodule hEPGui(LoadGuiModule());\r\n\r\n    WCHAR buf[TOAST_BUFSIZ];\r\n    DWORD dwLeftMost = 0;\r\n    DWORD dwSecondLeft = 0;\r\n    DWORD dwSecondRight = 0;\r\n    DWORD dwRightMost = 0;\r\n    QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n    const WCHAR text[] =\r\n        L\"<toast scenario=\\\"reminder\\\" activationType=\\\"protocol\\\" launch=\\\"%s\\\" duration=\\\"%s\\\">\\r\\n\"\r\n        L\"\t<visual>\\r\\n\"\r\n        L\"\t\t<binding template=\\\"ToastGeneric\\\">\\r\\n\"\r\n        L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n        L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n        L\"\t\t\t<text placement=\\\"attribution\\\"><![CDATA[ExplorerPatcher]]></text>\\r\\n%s\" // <-- Progress bar goes here\r\n        L\"\t\t</binding>\\r\\n\"\r\n        L\"\t</visual>\\r\\n\"\r\n        L\"\t<audio src=\\\"ms-winsoundevent:Notification.Default\\\" loop=\\\"false\\\" silent=\\\"false\\\"/>\\r\\n%s\" // <-- Buttons go here\r\n        L\"</toast>\\r\\n\";\r\n    WCHAR title[100];\r\n    WCHAR body[200];\r\n    title[0] = 0; body[0] = 0;\r\n\r\n    LoadStringW(hEPGui.get(), IDS_UPDATES_SUCCESS_T, title, ARRAYSIZE(title));\r\n\r\n    WCHAR bodyFormat[200] = {};\r\n    if (LoadStringW(hEPGui.get(), IDS_UPDATES_INSTALLEDVER, bodyFormat, ARRAYSIZE(bodyFormat)))\r\n    {\r\n        swprintf_s(body, ARRAYSIZE(body), bodyFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n    }\r\n\r\n    swprintf_s(buf, TOAST_BUFSIZ, text, L\"\", L\"short\", title, body, L\"\", L\"\");\r\n\r\n    ComPtr<IXmlDocument> inputXml;\r\n    String2IXMLDocument(buf, &inputXml);\r\n\r\n    toastData->HideAndShowToast(inputXml.Get());\r\n\r\n    return TRUE;\r\n}\r\n\r\nBOOL InstallUpdatesIfAvailable(\r\n    HMODULE hModule,\r\n    CToastData* toastData,\r\n    DWORD dwOperation,\r\n    DWORD bAllocConsole,\r\n    DWORD dwUpdatePolicy)\r\n{\r\n    EP_L10N_ApplyPreferredLanguageForCurrentThread();\r\n    wil::unique_hmodule hEPGui(LoadGuiModule());\r\n\r\n    WCHAR wszInfoURL[MAX_PATH] = {};\r\n    wcscat_s(wszInfoURL, MAX_PATH, _T(UPDATES_RELEASE_INFO_URL_STABLE));\r\n    WCHAR buf[TOAST_BUFSIZ];\r\n    DWORD dwLeftMost = 0;\r\n    DWORD dwSecondLeft = 0;\r\n    DWORD dwSecondRight = 0;\r\n    DWORD dwRightMost = 0;\r\n    QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n    if (bAllocConsole)\r\n    {\r\n        switch (dwUpdatePolicy)\r\n        {\r\n        default:\r\n        case UPDATE_POLICY_AUTO:\r\n        {\r\n            dwUpdatePolicy = UPDATE_POLICY_AUTO;\r\n            printf(\"[Updates] Configured update policy on this system: \\\"Install updates automatically\\\".\\n\");\r\n            break;\r\n        }\r\n        case UPDATE_POLICY_NOTIFY:\r\n        {\r\n            printf(\"[Updates] Configured update policy on this system: \\\"Check for updates but let me choose whether to download and install them\\\".\\n\");\r\n            break;\r\n        }\r\n        case UPDATE_POLICY_MANUAL:\r\n        {\r\n            printf(\"[Updates] Configured update policy on this system: \\\"Manually check for updates\\\".\\n\");\r\n            break;\r\n        }\r\n        }\r\n    }\r\n\r\n    const WCHAR text[] =\r\n        L\"<toast scenario=\\\"reminder\\\" activationType=\\\"protocol\\\" launch=\\\"%s\\\" duration=\\\"%s\\\">\\r\\n\"\r\n        L\"\t<visual>\\r\\n\"\r\n        L\"\t\t<binding template=\\\"ToastGeneric\\\">\\r\\n\"\r\n        L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n        L\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\n        L\"\t\t\t<text placement=\\\"attribution\\\"><![CDATA[ExplorerPatcher]]></text>\\r\\n%s\" // <-- Progress bar goes here\r\n        L\"\t\t</binding>\\r\\n\"\r\n        L\"\t</visual>\\r\\n\"\r\n        L\"\t<audio src=\\\"ms-winsoundevent:Notification.Default\\\" loop=\\\"false\\\" silent=\\\"false\\\"/>\\r\\n%s\" // <-- Buttons go here\r\n        L\"</toast>\\r\\n\";\r\n    WCHAR title[100];\r\n    WCHAR body[200];\r\n    WCHAR actionsXml[200];\r\n    WCHAR progressXml[200];\r\n    title[0] = 0; body[0] = 0; actionsXml[0] = 0; progressXml[0] = 0;\r\n\r\n    BOOL bIsInstall = dwOperation == UPDATES_OP_INSTALL || dwOperation == UPDATES_OP_INSTALL_NO_CONFIRM;\r\n    if (dwOperation == UPDATES_OP_CHECK || bIsInstall)\r\n    {\r\n        // title[0] = 0; body[0] = 0; actionsXml[0] = 0; progressXml[0] = 0;\r\n\r\n        if (bIsInstall)\r\n        {\r\n            LoadStringW(hEPGui.get(), IDS_UPDATES_DOWNLOADING_T, title, ARRAYSIZE(title));\r\n\r\n            wcscpy_s(progressXml, ARRAYSIZE(progressXml),\r\n                L\"\t\t\t<progress value=\\\"{progressValue}\\\" status=\\\"{progressStatus}\\\"/>\\r\\n\"\r\n            );\r\n        }\r\n        else if (dwOperation == UPDATES_OP_CHECK)\r\n        {\r\n            LoadStringW(hEPGui.get(), IDS_UPDATES_CHECKING_T, title, ARRAYSIZE(title));\r\n        }\r\n\r\n        WCHAR bodyFormat[200] = {};\r\n        if (LoadStringW(hEPGui.get(), IDS_UPDATES_INSTALLEDVER, bodyFormat, ARRAYSIZE(bodyFormat)))\r\n        {\r\n            swprintf_s(body, ARRAYSIZE(body), bodyFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n        }\r\n\r\n        swprintf_s(buf, TOAST_BUFSIZ, text, L\"\", L\"long\", title, body, progressXml, actionsXml);\r\n\r\n        ComPtr<IXmlDocument> inputXml;\r\n        String2IXMLDocument(buf, &inputXml);\r\n\r\n        toastData->HideAndShowToast(inputXml.Get());\r\n\r\n        if (bIsInstall)\r\n        {\r\n            toastData->UpdateDownloadProgress(0, 0);\r\n        }\r\n    }\r\n\r\n    WCHAR dllName[MAX_PATH];\r\n    GetModuleFileNameW(hModule, dllName, MAX_PATH);\r\n    wprintf(L\"[Updates] Path to module: %s\\n\", dllName);\r\n\r\n    CHAR hash[100] = {};\r\n    GetHardcodedHash(dllName, hash, 100);\r\n    if (!strcmp(hash, \"This\"))\r\n        ComputeFileHash2(hModule, dllName, hash, 100);\r\n    else\r\n        printf(\"[Updates] Using hardcoded hash.\\n\");\r\n\r\n    BOOL bFail = FALSE, bReturnValue = FALSE;\r\n    dwLeftMost = 0; dwSecondLeft = 0; dwSecondRight = 0; dwRightMost = 0;\r\n    if (IsUpdateAvailable(_T(REGPATH), hash, &bFail, wszInfoURL, MAX_PATH, hModule, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost))\r\n    {\r\n        printf(\"[Updates] An update is available.\\n\");\r\n        if ((dwOperation == UPDATES_OP_DEFAULT && dwUpdatePolicy == UPDATE_POLICY_AUTO) || bIsInstall)\r\n        {\r\n            BOOL bOk = UpdateProduct(_T(REGPATH), toastData, dwOperation == UPDATES_OP_INSTALL_NO_CONFIRM, hModule);\r\n            if (!bOk && bIsInstall)\r\n            {\r\n                title[0] = 0; body[0] = 0; actionsXml[0] = 0; progressXml[0] = 0;\r\n\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_DLFAILED_T, title, ARRAYSIZE(title));\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_DLFAILED_B, body, ARRAYSIZE(body));\r\n\r\n                swprintf_s(buf, TOAST_BUFSIZ, text, L\"\", L\"short\", title, body, progressXml, actionsXml);\r\n\r\n                ComPtr<IXmlDocument> inputXml;\r\n                String2IXMLDocument(buf, &inputXml);\r\n\r\n                toastData->HideAndShowToast(inputXml.Get());\r\n            }\r\n        }\r\n        else if ((dwOperation == UPDATES_OP_DEFAULT && dwUpdatePolicy == UPDATE_POLICY_NOTIFY) || (dwOperation == UPDATES_OP_CHECK))\r\n        {\r\n            title[0] = 0; body[0] = 0; actionsXml[0] = 0; progressXml[0] = 0;\r\n\r\n            if (!dwLeftMost)\r\n            {\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_AVAILABLE_T_U, title, ARRAYSIZE(title));\r\n            }\r\n            else\r\n            {\r\n                WCHAR titleFormat[100];\r\n                if (LoadStringW(hEPGui.get(), IDS_UPDATES_AVAILABLE_T, titleFormat, ARRAYSIZE(titleFormat)))\r\n                {\r\n                    swprintf_s(title, ARRAYSIZE(title), titleFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n                }\r\n            }\r\n\r\n            LoadStringW(hEPGui.get(), IDS_UPDATES_AVAILABLE_B, body, ARRAYSIZE(body));\r\n\r\n            WCHAR action[100];\r\n            action[0] = 0;\r\n            LoadStringW(hEPGui.get(), IDS_UPDATES_AVAILABLE_A, action, ARRAYSIZE(action));\r\n\r\n            swprintf_s(actionsXml, ARRAYSIZE(actionsXml),\r\n                L\"\t<actions>\\r\\n\"\r\n                L\"\t\t<action content=\\\"%s\\\" arguments=\\\"%s\\\"/>\\r\\n\"\r\n                L\"\t</actions>\\r\\n\",\r\n                action, L\"action=update\"\r\n            );\r\n\r\n            swprintf_s(buf, TOAST_BUFSIZ, text, wszInfoURL, L\"long\", title, body, progressXml, actionsXml);\r\n\r\n            ComPtr<IXmlDocument> inputXml;\r\n            String2IXMLDocument(buf, &inputXml);\r\n\r\n            toastData->HideAndShowToast(inputXml.Get());\r\n        }\r\n\r\n        return TRUE;\r\n    }\r\n    else\r\n    {\r\n        if (bFail)\r\n        {\r\n            printf(\"[Updates] Unable to check for updates because the remote server is unavailable.\\n\");\r\n        }\r\n        else\r\n        {\r\n            printf(\"[Updates] No updates are available.\\n\");\r\n        }\r\n        if (dwOperation == UPDATES_OP_CHECK || bIsInstall)\r\n        {\r\n            title[0] = 0; body[0] = 0; actionsXml[0] = 0; progressXml[0] = 0;\r\n\r\n            if (bFail)\r\n            {\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_CHECKFAILED_T, title, ARRAYSIZE(title));\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_CHECKFAILED_B, body, ARRAYSIZE(body));\r\n            }\r\n            else\r\n            {\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_ISLATEST_T, title, ARRAYSIZE(title));\r\n                LoadStringW(hEPGui.get(), IDS_UPDATES_ISLATEST_B, body, ARRAYSIZE(body));\r\n            }\r\n\r\n            swprintf_s(buf, TOAST_BUFSIZ, text, L\"\", L\"short\", title, body, progressXml, actionsXml);\r\n\r\n            ComPtr<IXmlDocument> inputXml;\r\n            String2IXMLDocument(buf, &inputXml);\r\n\r\n            toastData->HideAndShowToast(inputXml.Get());\r\n        }\r\n\r\n        return FALSE;\r\n    }\r\n}\r\n\r\nextern \"C\" DWORD bAllocConsole;\r\nextern \"C\" DWORD bShowUpdateToast;\r\nextern \"C\" DWORD dwUpdatePolicy;\r\n\r\nDWORD CheckForUpdatesThread(LPVOID params)\r\n{\r\n    DWORD timeout = (DWORD)(UINT_PTR)params;\r\n    HRESULT hr = S_OK;\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = RoInitialize(RO_INIT_MULTITHREADED);\r\n    }\r\n\r\n    ComPtr<IToastNotificationManagerStatics> toastStatics;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = RoGetActivationFactory(\r\n            Wrappers::HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),\r\n            IID_PPV_ARGS(&toastStatics)\r\n        );\r\n    }\r\n\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        ComPtr<IToastNotificationManagerStatics2> toastStatics2;\r\n        if (SUCCEEDED(RoGetActivationFactory(\r\n            Wrappers::HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),\r\n            IID_PPV_ARGS(&toastStatics2)\r\n        )))\r\n        {\r\n            ComPtr<IToastNotificationHistory> history;\r\n            if (SUCCEEDED(toastStatics2->get_History(&history)))\r\n            {\r\n                history->Remove(Wrappers::HStringReference(L\"ep_updates\").Get());\r\n            }\r\n        }\r\n    }\r\n\r\n    while (TRUE)\r\n    {\r\n        HWND hShell_TrayWnd = FindWindowExW(nullptr, nullptr, L\"Shell_TrayWnd\", nullptr);\r\n        if (hShell_TrayWnd)\r\n        {\r\n            Sleep(timeout);\r\n            break;\r\n        }\r\n        Sleep(100);\r\n    }\r\n    printf(\"[Updates] Starting daemon.\\n\");\r\n\r\n    ComPtr<IToastNotifier> notifier;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = toastStatics->CreateToastNotifierWithId(Wrappers::HStringReference(APPID).Get(), &notifier);\r\n    }\r\n\r\n    ComPtr<IToastNotificationFactory> notifFactory;\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        hr = RoGetActivationFactory(\r\n            Wrappers::HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(),\r\n            IID_PPV_ARGS(&notifFactory)\r\n        );\r\n    }\r\n\r\n    HANDLE hEvents[3];\r\n    hEvents[0] = CreateEventW(nullptr, FALSE, FALSE, L\"EP_Ev_CheckForUpdates_\" _T(EP_CLSID));\r\n    hEvents[1] = CreateEventW(nullptr, FALSE, FALSE, L\"EP_Ev_InstallUpdates_\" _T(EP_CLSID));\r\n    hEvents[2] = CreateEventW(nullptr, FALSE, FALSE, L\"EP_Ev_InstallUpdatesNoConfirm_\" _T(EP_CLSID));\r\n    if (hEvents[0] && hEvents[1] && hEvents[2])\r\n    {\r\n        ComPtr<CToastData> toastData = Make<CToastData>(notifier.Get(), notifFactory.Get());\r\n        if (bShowUpdateToast)\r\n        {\r\n            ShowUpdateSuccessNotification(hModule, toastData.Get());\r\n\r\n            HKEY hKey = nullptr;\r\n\r\n            RegCreateKeyExW(\r\n                HKEY_CURRENT_USER,\r\n                TEXT(REGPATH),\r\n                0,\r\n                nullptr,\r\n                REG_OPTION_NON_VOLATILE,\r\n                KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,\r\n                nullptr,\r\n                &hKey,\r\n                nullptr\r\n            );\r\n            if (hKey == nullptr || hKey == INVALID_HANDLE_VALUE)\r\n            {\r\n                hKey = nullptr;\r\n            }\r\n            if (hKey)\r\n            {\r\n                bShowUpdateToast = FALSE;\r\n                RegSetValueExW(\r\n                    hKey,\r\n                    TEXT(\"IsUpdatePending\"),\r\n                    0,\r\n                    REG_DWORD,\r\n                    (const BYTE*)&bShowUpdateToast,\r\n                    sizeof(DWORD)\r\n                );\r\n                RegCloseKey(hKey);\r\n            }\r\n        }\r\n        if (dwUpdatePolicy != UPDATE_POLICY_MANUAL)\r\n        {\r\n            InstallUpdatesIfAvailable(hModule, toastData.Get(), UPDATES_OP_DEFAULT, bAllocConsole, dwUpdatePolicy);\r\n        }\r\n        while (TRUE)\r\n        {\r\n            switch (WaitForMultipleObjects(3, hEvents, FALSE, INFINITE))\r\n            {\r\n            case WAIT_OBJECT_0:\r\n            {\r\n                InstallUpdatesIfAvailable(hModule, toastData.Get(), UPDATES_OP_CHECK, bAllocConsole, dwUpdatePolicy);\r\n                break;\r\n            }\r\n            case WAIT_OBJECT_0 + 1:\r\n            {\r\n                InstallUpdatesIfAvailable(hModule, toastData.Get(), UPDATES_OP_INSTALL, bAllocConsole, dwUpdatePolicy);\r\n                break;\r\n            }\r\n            case WAIT_OBJECT_0 + 2:\r\n            {\r\n                InstallUpdatesIfAvailable(hModule, toastData.Get(), UPDATES_OP_INSTALL_NO_CONFIRM, bAllocConsole, dwUpdatePolicy);\r\n                break;\r\n            }\r\n            default:\r\n            {\r\n                break;\r\n            }\r\n            }\r\n        }\r\n\r\n        // Unreachable, but just in case\r\n        CloseHandle(hEvents[0]);\r\n        CloseHandle(hEvents[1]);\r\n        CloseHandle(hEvents[2]);\r\n    }\r\n\r\n    return 0;\r\n}\r\n"
  },
  {
    "path": "ExplorerPatcher/updates.h",
    "content": "#ifndef _H_UPDATES_H_\r\n#define _H_UPDATES_H_\r\n#include <Windows.h>\r\n#include <stdio.h>\r\n#include <Wininet.h>\r\n#pragma comment(lib, \"Wininet.lib\")\r\n#include <shlobj_core.h>\r\n#include \"utility.h\"\r\n#include \"../ep_gui/resources/EPSharedResources.h\"\r\n\r\n#ifdef __cplusplus\r\nextern \"C\" {\r\n#endif\r\n\r\nextern HMODULE hModule;\r\n\r\n#define UPDATES_VERBOSE_OUTPUT\r\n\r\n#define UPDATE_POLICY_AUTO 0\r\n#define UPDATE_POLICY_NOTIFY 1\r\n#define UPDATE_POLICY_MANUAL 2\r\n#define UPDATE_POLICY_DEFAULT UPDATE_POLICY_NOTIFY\r\n\r\n#define UPDATES_OP_DEFAULT 0\r\n#define UPDATES_OP_CHECK 1\r\n#define UPDATES_OP_INSTALL 2\r\n#define UPDATES_OP_INSTALL_NO_CONFIRM 3\r\n\r\n#define UPDATES_USER_AGENT \"ExplorerPatcher\"\r\n#define UPDATES_FORM_HEADERS \"Content-Type: text/plain;\\r\\n\"\r\n#define UPDATES_HASH_SIZE 32\r\n#define UPDATES_BUFSIZ 10240\r\n#define UPDATES_DEFAULT_TIMEOUT 600\r\n\r\n#define UPDATES_RELEASE_INFO_URL          \"https://github.com/valinet/ExplorerPatcher\"\r\n#define UPDATES_RELEASE_INFO_URL_STABLE   \"https://github.com/valinet/ExplorerPatcher/releases/latest\"\r\n#define UPDATES_RELEASE_INFO_URL_STAGING  \"https://api.github.com/repos/valinet/ExplorerPatcher/releases?per_page=1\"\r\n\r\nDWORD CheckForUpdatesThread(LPVOID params);\r\n\r\n#ifdef __cplusplus\r\n}\r\n#endif\r\n\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/utility.c",
    "content": "#include \"utility.h\"\r\n#include <Wininet.h>\r\n#pragma comment(lib, \"Wininet.lib\")\r\n\r\nRTL_OSVERSIONINFOW global_rovi;\r\nDWORD32 global_ubr;\r\n\r\nvoid printf_guid(GUID guid) \r\n{\r\n    printf(\"Guid = {%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}\\n\",\r\n        guid.Data1, guid.Data2, guid.Data3,\r\n        guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],\r\n        guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);\r\n}\r\n\r\n#ifdef _DEBUG\r\nLRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) \r\n{\r\n    if (msg == WM_CREATE)\r\n    {\r\n        LPCREATESTRUCT lpCs = lParam;\r\n\r\n        NOTIFYICONDATA ni = { 0 };\r\n        ni.cbSize = sizeof(ni);\r\n        ni.hWnd = hWnd;\r\n        ni.uID = 1;\r\n        ni.uFlags = NIF_INFO;\r\n        ni.dwInfoFlags = NIIF_INFO;\r\n        ni.uTimeout = 2000;\r\n        _tcscpy_s(ni.szInfo, _countof(ni.szInfo), lpCs->lpCreateParams);\r\n        _tcscpy_s(ni.szInfoTitle, _countof(ni.szInfoTitle), _T(\"ExplorerPatcher\"));\r\n\r\n        Shell_NotifyIcon(NIM_ADD, &ni);\r\n\r\n        free(lpCs->lpCreateParams);\r\n\r\n        exit(0);\r\n    }\r\n    else\r\n    {\r\n        return DefWindowProc(hWnd, msg, wParam, lParam);\r\n    }\r\n    return 0;\r\n}\r\n\r\n__declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\r\n{\r\n    TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));\r\n    if (!lpwszCmdLine) exit(0);\r\n    size_t numChConv = 0;\r\n    mbstowcs_s(&numChConv, lpwszCmdLine, strlen(lpszCmdLine) + 1, lpszCmdLine, strlen(lpszCmdLine) + 1);\r\n\r\n    WNDCLASSEX wc;\r\n    HWND hwnd;\r\n    MSG msg;\r\n\r\n    wc.cbSize = sizeof(WNDCLASSEX);\r\n    wc.style = 0;\r\n    wc.lpfnWndProc = BalloonWndProc;\r\n    wc.cbClsExtra = 0;\r\n    wc.cbWndExtra = 0;\r\n    wc.hInstance = hInstance;\r\n    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);\r\n    wc.hCursor = LoadCursor(NULL, IDC_ARROW);\r\n    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);\r\n    wc.lpszMenuName = NULL;\r\n    wc.lpszClassName = L\"ExplorerPatcherBalloon\";\r\n    wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);\r\n\r\n    if (!RegisterClassEx(&wc)) {\r\n        return 0;\r\n    }\r\n\r\n    hwnd = CreateWindowEx(0, L\"ExplorerPatcherBalloon\", L\"\",\r\n        0, 0, 0, 0, 0,\r\n        HWND_MESSAGE, NULL, hInstance, lpwszCmdLine);\r\n\r\n    while (GetMessage(&msg, NULL, 0, 0) > 0) {\r\n        TranslateMessage(&msg);\r\n        DispatchMessage(&msg);\r\n    }\r\n\r\n    return 0;\r\n}\r\n\r\nconst wchar_t TestToastXML[] =\r\nL\"<toast scenario=\\\"reminder\\\" \"\r\nL\"activationType=\\\"protocol\\\" launch=\\\"https://github.com/valinet/ExplorerPatcher\\\" duration=\\\"%s\\\">\\r\\n\"\r\nL\"\t<visual>\\r\\n\"\r\nL\"\t\t<binding template=\\\"ToastGeneric\\\">\\r\\n\"\r\nL\"\t\t\t<text><![CDATA[%s]]></text>\\r\\n\"\r\nL\"\t\t\t<text placement=\\\"attribution\\\"><![CDATA[ExplorerPatcher]]></text>\\r\\n\"\r\nL\"\t\t</binding>\\r\\n\"\r\nL\"\t</visual>\\r\\n\"\r\nL\"\t<audio src=\\\"ms-winsoundevent:Notification.Default\\\" loop=\\\"false\\\" silent=\\\"false\\\"/>\\r\\n\"\r\nL\"</toast>\\r\\n\";\r\n__declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\r\n{\r\n    TCHAR* lpwszCmdLine = calloc((strlen(lpszCmdLine) + 1), sizeof(TCHAR));\r\n    if (!lpwszCmdLine) exit(0);\r\n    size_t numChConv = 0;\r\n    mbstowcs_s(&numChConv, lpwszCmdLine, strlen(lpszCmdLine) + 1, lpszCmdLine, strlen(lpszCmdLine) + 1);\r\n    TCHAR* buffer = calloc((sizeof(TestToastXML) / sizeof(wchar_t) + strlen(lpszCmdLine) + 10), sizeof(TCHAR));\r\n    if (buffer)\r\n    {\r\n        wsprintf(\r\n            buffer,\r\n            TestToastXML,\r\n            L\"short\",\r\n            lpwszCmdLine\r\n        );\r\n        HRESULT hr = S_OK;\r\n        __x_ABI_CWindows_CData_CXml_CDom_CIXmlDocument* inputXml = NULL;\r\n        hr = String2IXMLDocument(\r\n            buffer,\r\n            wcslen(buffer),\r\n            &inputXml,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n        hr = ShowToastMessage(\r\n            inputXml,\r\n            APPID,\r\n            sizeof(APPID) / sizeof(TCHAR) - 1,\r\n#ifdef DEBUG\r\n            stdout\r\n#else\r\n            NULL\r\n#endif\r\n        );\r\n        free(buffer);\r\n    }\r\n    free(lpwszCmdLine);\r\n    return 0;\r\n}\r\n#endif\r\n\r\n#ifndef EP_BUILD_SETUP\r\n__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\r\n{\r\n    Sleep(100);\r\n    TCHAR wszExplorerPath[MAX_PATH + 1];\r\n    GetWindowsDirectory(wszExplorerPath, MAX_PATH + 1);\r\n    wcscat_s(wszExplorerPath, MAX_PATH + 1, L\"\\\\explorer.exe\");\r\n    STARTUPINFO si = { sizeof(si) };\r\n    PROCESS_INFORMATION pi;\r\n    BOOL b = CreateProcess(\r\n        NULL,\r\n        wszExplorerPath,\r\n        NULL,\r\n        NULL,\r\n        TRUE,\r\n        CREATE_UNICODE_ENVIRONMENT,\r\n        NULL,\r\n        NULL,\r\n        &si,\r\n        &pi\r\n    );\r\n    FreeConsole();\r\n    TerminateProcess(\r\n        OpenProcess(\r\n            PROCESS_TERMINATE,\r\n            FALSE,\r\n            GetCurrentProcessId()\r\n        ),\r\n        0\r\n    );\r\n    return 0;\r\n}\r\n\r\n__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\r\n{\r\n    Sleep(2000);\r\n    ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow);\r\n    return 0;\r\n}\r\n\r\n__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\r\n{\r\n    BeginExplorerRestart(NULL);\r\n    FinishExplorerRestart();\r\n    return 0;\r\n}\r\n#endif\r\n\r\nvoid* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize)\r\n{\r\n    void* ok = NULL;\r\n    HANDLE hImage = CreateFileW(wszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);\r\n    if (hImage)\r\n    {\r\n        LARGE_INTEGER dwFileSize;\r\n        GetFileSizeEx(hImage, &dwFileSize);\r\n        if (dwFileSize.LowPart)\r\n        {\r\n            void* pImage = malloc(dwFileSize.LowPart);\r\n            if (pImage)\r\n            {\r\n                DWORD dwNumberOfBytesRead = 0;\r\n                ReadFile(hImage, pImage, dwFileSize.LowPart, &dwNumberOfBytesRead, NULL);\r\n                if (dwFileSize.LowPart == dwNumberOfBytesRead)\r\n                {\r\n                    ok = pImage;\r\n                    *dwSize = dwNumberOfBytesRead;\r\n                }\r\n            }\r\n        }\r\n        CloseHandle(hImage);\r\n    }\r\n    return ok;\r\n}\r\n\r\nint ComputeFileHash(LPCWSTR filename, LPSTR hash, DWORD dwHash)\r\n{\r\n    DWORD dwStatus = 0;\r\n    BOOL bResult = FALSE;\r\n    HCRYPTPROV hProv = 0;\r\n    HCRYPTHASH hHash = 0;\r\n    HANDLE hFile = NULL;\r\n    BYTE* rgbFile;\r\n    DWORD cbRead = 0;\r\n    BYTE rgbHash[16];\r\n    DWORD cbHash = 0;\r\n    WCHAR rgbDigits[] = L\"0123456789abcdef\";\r\n    // Logic to check usage goes here.\r\n\r\n    hFile = CreateFile(filename,\r\n        GENERIC_READ,\r\n        FILE_SHARE_READ,\r\n        NULL,\r\n        OPEN_EXISTING,\r\n        FILE_FLAG_SEQUENTIAL_SCAN,\r\n        NULL);\r\n\r\n    if (INVALID_HANDLE_VALUE == hFile)\r\n    {\r\n        dwStatus = GetLastError();\r\n        return dwStatus;\r\n    }\r\n\r\n    LARGE_INTEGER dwFileSize;\r\n    GetFileSizeEx(hFile, &dwFileSize);\r\n    if (!dwFileSize.LowPart)\r\n    {\r\n        dwStatus = GetLastError();\r\n        CloseHandle(hFile);\r\n        return dwStatus;\r\n    }\r\n\r\n    rgbFile = malloc(dwFileSize.LowPart);\r\n    if (!rgbFile)\r\n    {\r\n        dwStatus = E_OUTOFMEMORY;\r\n        CloseHandle(hFile);\r\n        return dwStatus;\r\n    }\r\n\r\n    // Get handle to the crypto provider\r\n    if (!CryptAcquireContext(&hProv,\r\n        NULL,\r\n        NULL,\r\n        PROV_RSA_FULL,\r\n        CRYPT_VERIFYCONTEXT))\r\n    {\r\n        dwStatus = GetLastError();\r\n        CloseHandle(hFile);\r\n        return dwStatus;\r\n    }\r\n\r\n    if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))\r\n    {\r\n        dwStatus = GetLastError();\r\n        CloseHandle(hFile);\r\n        CryptReleaseContext(hProv, 0);\r\n        return dwStatus;\r\n    }\r\n\r\n    while (bResult = ReadFile(hFile, rgbFile, dwFileSize.LowPart, &cbRead, NULL))\r\n    {\r\n        if (0 == cbRead)\r\n        {\r\n            break;\r\n        }\r\n\r\n        if (!CryptHashData(hHash, rgbFile, cbRead, 0))\r\n        {\r\n            dwStatus = GetLastError();\r\n            CryptReleaseContext(hProv, 0);\r\n            CryptDestroyHash(hHash);\r\n            CloseHandle(hFile);\r\n            return dwStatus;\r\n        }\r\n    }\r\n\r\n    if (!bResult)\r\n    {\r\n        dwStatus = GetLastError();\r\n        CryptReleaseContext(hProv, 0);\r\n        CryptDestroyHash(hHash);\r\n        CloseHandle(hFile);\r\n        return dwStatus;\r\n    }\r\n\r\n    cbHash = 16;\r\n    if (CryptGetHashParam(hHash, HP_HASHVAL, rgbHash, &cbHash, 0))\r\n    {\r\n        for (DWORD i = 0; i < cbHash; i++)\r\n        {\r\n            sprintf_s(hash + (i * 2), 3, \"%c%c\", rgbDigits[rgbHash[i] >> 4], rgbDigits[rgbHash[i] & 0xf]);\r\n        }\r\n    }\r\n    else\r\n    {\r\n        dwStatus = GetLastError();\r\n    }\r\n\r\n    CryptDestroyHash(hHash);\r\n    CryptReleaseContext(hProv, 0);\r\n    CloseHandle(hFile);\r\n    free(rgbFile);\r\n\r\n    return dwStatus;\r\n}\r\n\r\nint ComputeFileHash2(HMODULE hModule, LPCWSTR filename, LPSTR hash, DWORD dwHash)\r\n{\r\n    if (dwHash < 33)\r\n    {\r\n        return ERROR_BUFFER_OVERFLOW;\r\n    }\r\n    if (!hModule)\r\n    {\r\n        return ERROR_INVALID_ADDRESS;\r\n    }\r\n\r\n    DWORD dwLeftMost = 0;\r\n    DWORD dwSecondLeft = 0;\r\n    DWORD dwSecondRight = 0;\r\n    DWORD dwRightMost = 0;\r\n    QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n    sprintf_s(hash, 33, \"%d.%d.%d.%d.\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n\r\n    char real_hash[33];\r\n    ComputeFileHash(filename, real_hash, 33);\r\n    strncpy_s(hash + strlen(hash), dwHash - strlen(hash), real_hash, 32 - strlen(hash));\r\n    hash[33] = 0;\r\n\r\n    return ERROR_SUCCESS;\r\n}\r\n\r\nvoid GetHardcodedHash(LPCWSTR wszPath, LPSTR hash, DWORD dwHash)\r\n{\r\n    HANDLE hFile = CreateFileW(wszPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);\r\n    if (hFile == INVALID_HANDLE_VALUE)\r\n    {\r\n        return 1;\r\n    }\r\n\r\n    HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);\r\n    if (hFileMapping == 0)\r\n    {\r\n        CloseHandle(hFile);\r\n        return 2;\r\n    }\r\n\r\n    char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);\r\n    if (lpFileBase == 0)\r\n    {\r\n        CloseHandle(hFileMapping);\r\n        CloseHandle(hFile);\r\n        return 3;\r\n    }\r\n\r\n    memcpy_s(hash, MIN(32, dwHash), lpFileBase + DOSMODE_OFFSET, 32);\r\n\r\n    UnmapViewOfFile(lpFileBase);\r\n    CloseHandle(hFileMapping);\r\n    CloseHandle(hFile);\r\n}\r\n\r\nvoid LaunchPropertiesGUI(HMODULE hModule)\r\n{\r\n    //CreateThread(0, 0, ZZGUI, 0, 0, 0);\r\n    wchar_t wszPath[MAX_PATH * 2];\r\n    ZeroMemory(wszPath, ARRAYSIZE(wszPath));\r\n    wszPath[0] = '\\\"';\r\n    GetSystemDirectoryW(wszPath + 1, MAX_PATH);\r\n    wcscat_s(wszPath, ARRAYSIZE(wszPath), L\"\\\\rundll32.exe\\\" \\\"\");\r\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath + wcslen(wszPath));\r\n    wcscat_s(wszPath, ARRAYSIZE(wszPath), _T(APP_RELATIVE_PATH) L\"\\\\ep_gui.dll\");\r\n    wcscat_s(wszPath, ARRAYSIZE(wszPath), L\"\\\",ZZGUI\");\r\n\r\n    wprintf(L\"Launching : %s\\n\", wszPath);\r\n    STARTUPINFO si;\r\n    ZeroMemory(&si, sizeof(STARTUPINFO));\r\n    si.cb = sizeof(si);\r\n    PROCESS_INFORMATION pi;\r\n    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));\r\n    if (CreateProcessW(\r\n        NULL,\r\n        wszPath,\r\n        NULL,\r\n        NULL,\r\n        FALSE,\r\n        CREATE_UNICODE_ENVIRONMENT,\r\n        NULL,\r\n        NULL,\r\n        &si,\r\n        &pi\r\n    ))\r\n    {\r\n        CloseHandle(pi.hThread);\r\n        CloseHandle(pi.hProcess);\r\n    }\r\n}\r\n\r\n\r\nBOOL SystemShutdown(BOOL reboot)\r\n{\r\n    HANDLE hToken;\r\n    TOKEN_PRIVILEGES tkp;\r\n\r\n    // Get a token for this process. \r\n\r\n    if (!OpenProcessToken(GetCurrentProcess(),\r\n        TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))\r\n        return(FALSE);\r\n\r\n    // Get the LUID for the shutdown privilege. \r\n\r\n    LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,\r\n        &tkp.Privileges[0].Luid);\r\n\r\n    tkp.PrivilegeCount = 1;  // one privilege to set    \r\n    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;\r\n\r\n    // Get the shutdown privilege for this process. \r\n\r\n    AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,\r\n        (PTOKEN_PRIVILEGES)NULL, 0);\r\n\r\n    if (GetLastError() != ERROR_SUCCESS)\r\n        return FALSE;\r\n\r\n    // Shut down the system and force all applications to close. \r\n\r\n    if (!ExitWindowsEx((reboot ? EWX_REBOOT : EWX_SHUTDOWN) | EWX_FORCE,\r\n        SHTDN_REASON_MAJOR_OPERATINGSYSTEM |\r\n        SHTDN_REASON_MINOR_UPGRADE |\r\n        SHTDN_REASON_FLAG_PLANNED))\r\n        return FALSE;\r\n\r\n    //shutdown was successful\r\n    return TRUE;\r\n}\r\n\r\nHRESULT FindDesktopFolderView(REFIID riid, void** ppv)\r\n{\r\n    HRESULT hr = E_FAIL;\r\n    IShellWindows* spShellWindows = NULL;\r\n    hr = CoCreateInstance(\r\n        &CLSID_ShellWindows,\r\n        NULL,\r\n        CLSCTX_ALL,\r\n        &IID_IShellWindows,\r\n        &spShellWindows\r\n    );\r\n    if (spShellWindows)\r\n    {\r\n        VARIANT vtEmpty;\r\n        ZeroMemory(&vtEmpty, sizeof(VARIANT));\r\n        VARIANT vtLoc;\r\n        ZeroMemory(&vtLoc, sizeof(VARIANT));\r\n        vtLoc.vt = VT_INT;\r\n        vtLoc.intVal = CSIDL_DESKTOP;\r\n        long lhwnd = 0;\r\n        IDispatch* spdisp = NULL;\r\n        hr = spShellWindows->lpVtbl->FindWindowSW(\r\n            spShellWindows,\r\n            &vtLoc,\r\n            &vtEmpty,\r\n            SWC_DESKTOP,\r\n            &lhwnd,\r\n            SWFO_NEEDDISPATCH,\r\n            &spdisp\r\n        );\r\n        if (spdisp)\r\n        {\r\n            IServiceProvider* spdisp2 = NULL;\r\n            hr = spdisp->lpVtbl->QueryInterface(spdisp, &IID_IServiceProvider, &spdisp2);\r\n            if (spdisp2)\r\n            {\r\n                IShellBrowser* spBrowser = NULL;\r\n                hr = spdisp2->lpVtbl->QueryService(spdisp2, &SID_STopLevelBrowser, &IID_IShellBrowser, &spBrowser);\r\n                if (spBrowser)\r\n                {\r\n                    IShellView* spView = NULL;\r\n                    hr = spBrowser->lpVtbl->QueryActiveShellView(spBrowser, &spView);\r\n                    if (spView)\r\n                    {\r\n                        hr = spView->lpVtbl->QueryInterface(spView, riid, ppv);\r\n                        spView->lpVtbl->Release(spView);\r\n                    }\r\n                    spBrowser->lpVtbl->Release(spBrowser);\r\n                }\r\n                spdisp2->lpVtbl->Release(spdisp2);\r\n            }\r\n            spdisp->lpVtbl->Release(spdisp);\r\n        }\r\n        spShellWindows->lpVtbl->Release(spShellWindows);\r\n    }\r\n    return hr;\r\n}\r\n\r\nHRESULT GetDesktopAutomationObject(REFIID riid, void** ppv)\r\n{\r\n    HRESULT hr = E_FAIL;\r\n    IShellView* spsv = NULL;\r\n    hr = FindDesktopFolderView(&IID_IShellView, &spsv);\r\n    if (spsv)\r\n    {\r\n        IDispatch* spdispView = NULL;\r\n        hr = spsv->lpVtbl->GetItemObject(spsv, SVGIO_BACKGROUND, &IID_IDispatch, &spdispView);\r\n        if (spdispView)\r\n        {\r\n            hr = spdispView->lpVtbl->QueryInterface(spdispView, riid, ppv);\r\n            spdispView->lpVtbl->Release(spdispView);\r\n        }\r\n        spsv->lpVtbl->Release(spsv);\r\n    }\r\n    return hr;\r\n}\r\n\r\nHRESULT ShellExecuteFromExplorer(\r\n    PCWSTR pszFile,\r\n    PCWSTR pszParameters,\r\n    PCWSTR pszDirectory,\r\n    PCWSTR pszOperation,\r\n    int nShowCmd\r\n)\r\n{\r\n    HRESULT hr = E_FAIL;\r\n    IShellFolderViewDual* spFolderView = NULL;\r\n    GetDesktopAutomationObject(&IID_IShellFolderViewDual, &spFolderView);\r\n    if (spFolderView)\r\n    {\r\n        IDispatch* spdispShell = NULL;\r\n        spFolderView->lpVtbl->get_Application(spFolderView, &spdispShell);\r\n        if (spdispShell)\r\n        {\r\n            IShellDispatch2* spdispShell2 = NULL;\r\n            spdispShell->lpVtbl->QueryInterface(spdispShell, &IID_IShellDispatch2, &spdispShell2);\r\n            if (spdispShell2)\r\n            {\r\n                BSTR a_pszFile = pszFile ? SysAllocString(pszFile): SysAllocString(L\"\");\r\n                VARIANT a_pszParameters, a_pszDirectory, a_pszOperation, a_nShowCmd;\r\n                ZeroMemory(&a_pszParameters, sizeof(VARIANT));\r\n                ZeroMemory(&a_pszDirectory, sizeof(VARIANT));\r\n                ZeroMemory(&a_pszOperation, sizeof(VARIANT));\r\n                ZeroMemory(&a_nShowCmd, sizeof(VARIANT));\r\n                a_pszParameters.vt = VT_BSTR;\r\n                a_pszParameters.bstrVal = pszParameters ? SysAllocString(pszParameters) : SysAllocString(L\"\");\r\n                a_pszDirectory.vt = VT_BSTR;\r\n                a_pszDirectory.bstrVal = pszDirectory ? SysAllocString(pszDirectory) : SysAllocString(L\"\");\r\n                a_pszOperation.vt = VT_BSTR;\r\n                a_pszOperation.bstrVal = pszOperation ? SysAllocString(pszOperation) : SysAllocString(L\"\");\r\n                a_nShowCmd.vt = VT_INT;\r\n                a_nShowCmd.intVal = nShowCmd;\r\n                hr = spdispShell2->lpVtbl->ShellExecuteW(spdispShell2, a_pszFile, a_pszParameters, a_pszDirectory, a_pszOperation, a_nShowCmd);\r\n                if (a_pszOperation.bstrVal)\r\n                {\r\n                    SysFreeString(a_pszOperation.bstrVal);\r\n                }\r\n                if (a_pszDirectory.bstrVal)\r\n                {\r\n                    SysFreeString(a_pszDirectory.bstrVal);\r\n                }\r\n                if (a_pszParameters.bstrVal)\r\n                {\r\n                    SysFreeString(a_pszParameters.bstrVal);\r\n                }\r\n                if (a_pszFile)\r\n                {\r\n                    SysFreeString(a_pszFile);\r\n                }\r\n                spdispShell2->lpVtbl->Release(spdispShell2);\r\n            }\r\n            spdispShell->lpVtbl->Release(spdispShell);\r\n        }\r\n        spFolderView->lpVtbl->Release(spFolderView);\r\n    }\r\n    return hr;\r\n}\r\n\r\nvoid ToggleTaskbarAutohide()\r\n{\r\n    APPBARDATA abd;\r\n    abd.cbSize = sizeof(APPBARDATA);\r\n    if (SHAppBarMessage(ABM_GETSTATE, &abd) == ABS_AUTOHIDE)\r\n    {\r\n        abd.lParam = 0;\r\n        SHAppBarMessage(ABM_SETSTATE, &abd);\r\n    }\r\n    else\r\n    {\r\n        abd.lParam = ABS_AUTOHIDE;\r\n        SHAppBarMessage(ABM_SETSTATE, &abd);\r\n    }\r\n}\r\n\r\nLSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride)\r\n{\r\n    WCHAR wszPath[MAX_PATH];\r\n    GetSystemDirectoryW(wszPath, MAX_PATH);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\cmd.exe\");\r\n\r\n    WCHAR wszSCPath[MAX_PATH];\r\n    GetSystemDirectoryW(wszSCPath, MAX_PATH);\r\n    wcscat_s(wszSCPath, MAX_PATH, L\"\\\\sc.exe\");\r\n\r\n    WCHAR wszRundll32[MAX_PATH];\r\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszRundll32);\r\n    wcscat_s(wszRundll32, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n    wcscat_s(wszRundll32, MAX_PATH, L\"\\\\ep_dwm_svc.exe\");\r\n\r\n    WCHAR wszArgumentsRegister[MAX_PATH * 10];\r\n    swprintf_s(\r\n        wszArgumentsRegister,\r\n        MAX_PATH * 10,\r\n        L\"/c \\\"\"\r\n        L\"\\\"%s\\\" create \" _T(EP_DWM_SERVICENAME) L\" binPath= \\\"\\\\\\\"%s\\\\\\\" %s\\\" DisplayName= \\\"ExplorerPatcher Desktop Window Manager Service\\\" start= auto & \"\r\n        L\"\\\"%s\\\" description \" _T(EP_DWM_SERVICENAME) L\" \\\"Service for managing aspects related to the Desktop Window Manager.\\\" & \"\r\n        L\"\\\"%s\\\" %s \" _T(EP_DWM_SERVICENAME)\r\n        L\"\\\"\",\r\n        wszSCPath,\r\n        wszRundll32,\r\n        _T(EP_DWM_SERVICENAME) L\" \" _T(EP_DWM_EVENTNAME),\r\n        wszSCPath,\r\n        wszSCPath,\r\n        (!dwOverride || dwOverride == 3) ? L\"start\" : L\"query\"\r\n    );\r\n    WCHAR wszArgumentsUnRegister[MAX_PATH * 10];\r\n    swprintf_s(\r\n        wszArgumentsUnRegister,\r\n        MAX_PATH * 10,\r\n        L\"/c \\\"\"\r\n        L\"\\\"%s\\\" stop \" _T(EP_DWM_SERVICENAME) L\" & \"\r\n        L\"\\\"%s\\\" delete \" _T(EP_DWM_SERVICENAME) L\" & \"\r\n        L\"\\\"\",\r\n        wszSCPath,\r\n        wszSCPath\r\n    );\r\n    wprintf(L\"%s\\n\", wszArgumentsRegister);\r\n\r\n    BOOL bAreRoundedCornersDisabled = FALSE;\r\n    if (dwOverride)\r\n    {\r\n        bAreRoundedCornersDisabled = !(dwOverride - 1);\r\n    }\r\n    else\r\n    {\r\n        HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));\r\n        if (h_exists)\r\n        {\r\n            bAreRoundedCornersDisabled = GetLastError() == ERROR_ALREADY_EXISTS;\r\n            CloseHandle(h_exists);\r\n        }\r\n        else\r\n        {\r\n            bAreRoundedCornersDisabled = GetLastError() == ERROR_ACCESS_DENIED;\r\n        }\r\n        if ((bAreRoundedCornersDisabled && dwDesiredState) || (!bAreRoundedCornersDisabled && !dwDesiredState))\r\n        {\r\n            return FALSE;\r\n        }\r\n    }\r\n    SHELLEXECUTEINFOW ShExecInfo = { 0 };\r\n    ShExecInfo.cbSize = sizeof(ShExecInfo);\r\n    ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n    ShExecInfo.hwnd = NULL;\r\n    ShExecInfo.lpVerb = L\"runas\";\r\n    ShExecInfo.lpFile = wszPath;\r\n    ShExecInfo.lpParameters = !bAreRoundedCornersDisabled ? wszArgumentsRegister : wszArgumentsUnRegister;\r\n    ShExecInfo.lpDirectory = NULL;\r\n    ShExecInfo.nShow = SW_HIDE;\r\n    ShExecInfo.hInstApp = NULL;\r\n    if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)\r\n    {\r\n        WaitForSingleObject(ShExecInfo.hProcess, INFINITE);\r\n        DWORD dwExitCode = 0;\r\n        GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);\r\n        CloseHandle(ShExecInfo.hProcess);\r\n    }\r\n    return TRUE;\r\n}\r\n\r\n#ifndef EP_BUILD_SETUP\r\nchar* StrReplaceAllA(const char* s, const char* oldW, const char* newW, int* dwNewSize)\r\n{\r\n    char* result;\r\n    int i, cnt = 0;\r\n    int newWlen = strlen(newW);\r\n    int oldWlen = strlen(oldW);\r\n\r\n    for (i = 0; s[i] != '\\0'; i++) {\r\n        if (strstr(&s[i], oldW) == &s[i]) {\r\n            cnt++;\r\n            i += oldWlen - 1;\r\n        }\r\n    }\r\n    result = (char*)malloc(i + cnt * (newWlen - oldWlen) + 1);\r\n    i = 0;\r\n    while (*s) {\r\n        if (strstr(s, oldW) == s) {\r\n            strcpy_s(&result[i], strlen(newW) + 1, newW);\r\n            i += newWlen;\r\n            s += oldWlen;\r\n        }\r\n        else\r\n            result[i++] = *s++;\r\n    }\r\n\r\n    result[i] = '\\0';\r\n    if (dwNewSize) *dwNewSize = i;\r\n    return result;\r\n}\r\n\r\nWCHAR* StrReplaceAllW(const WCHAR* s, const WCHAR* oldW, const WCHAR* newW, int* dwNewSize)\r\n{\r\n    WCHAR* result;\r\n    int i, cnt = 0;\r\n    int newWlen = wcslen(newW);\r\n    int oldWlen = wcslen(oldW);\r\n\r\n    for (i = 0; s[i] != L'\\0'; i++) {\r\n        if (wcsstr(&s[i], oldW) == &s[i]) {\r\n            cnt++;\r\n            i += oldWlen - 1;\r\n        }\r\n    }\r\n    result = (WCHAR*)malloc((i + cnt * (newWlen - oldWlen) + 1) * sizeof(WCHAR));\r\n    i = 0;\r\n    while (*s) {\r\n        if (wcsstr(s, oldW) == s) {\r\n            wcscpy_s(&result[i], newWlen + 1, newW);\r\n            i += newWlen;\r\n            s += oldWlen;\r\n        }\r\n        else\r\n            result[i++] = *s++;\r\n    }\r\n    result[i] = L'\\0';\r\n    if (dwNewSize) *dwNewSize = i;\r\n    return result;\r\n}\r\n\r\nHWND InputBox_HWND;\r\n\r\nHRESULT getEngineGuid(LPCTSTR extension, GUID* guidBuffer)\r\n{\r\n    wchar_t   buffer[100];\r\n    HKEY      hk;\r\n    DWORD     size;\r\n    HKEY      subKey;\r\n    DWORD     type;\r\n\r\n    // See if this file extension is associated\r\n    // with an ActiveX script engine\r\n    if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, extension, 0,\r\n        KEY_QUERY_VALUE | KEY_READ, &hk))\r\n    {\r\n        type = REG_SZ;\r\n        size = sizeof(buffer);\r\n        size = RegQueryValueEx(hk, 0, 0, &type,\r\n            (LPBYTE)&buffer[0], &size);\r\n        RegCloseKey(hk);\r\n        if (!size)\r\n        {\r\n            // The engine set an association.\r\n            // We got the Language string in buffer[]. Now\r\n            // we can use it to look up the engine's GUID\r\n\r\n            // Open HKEY_CLASSES_ROOT\\{LanguageName}\r\n        again:   size = sizeof(buffer);\r\n            if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, (LPCTSTR)&buffer[0], 0,\r\n                KEY_QUERY_VALUE | KEY_READ, &hk))\r\n            {\r\n                // Read the GUID (in string format)\r\n                // into buffer[] by querying the value of CLSID\r\n                if (!RegOpenKeyEx(hk, L\"CLSID\", 0,\r\n                    KEY_QUERY_VALUE | KEY_READ, &subKey))\r\n                {\r\n                    size = RegQueryValueExW(subKey, 0, 0, &type,\r\n                        (LPBYTE)&buffer[0], &size);\r\n                    RegCloseKey(subKey);\r\n                }\r\n                else if (extension)\r\n                {\r\n                    // If an error, see if we have a \"ScriptEngine\"\r\n                    // key under here that contains\r\n                    // the real language name\r\n                    if (!RegOpenKeyEx(hk, L\"ScriptEngine\", 0,\r\n                        KEY_QUERY_VALUE | KEY_READ, &subKey))\r\n                    {\r\n                        size = RegQueryValueEx(subKey, 0, 0, &type,\r\n                            (LPBYTE)&buffer[0], &size);\r\n                        RegCloseKey(subKey);\r\n                        if (!size)\r\n                        {\r\n                            RegCloseKey(hk);\r\n                            extension = 0;\r\n                            goto again;\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n\r\n            RegCloseKey(hk);\r\n\r\n            if (!size)\r\n            {\r\n                // Convert the GUID string to a GUID\r\n                // and put it in caller's guidBuffer\r\n                if ((size = CLSIDFromString(&buffer[0], guidBuffer)))\r\n                {\r\n                    return(E_FAIL);\r\n                }\r\n                return(size);\r\n            }\r\n        }\r\n    }\r\n\r\n    return(E_FAIL);\r\n}\r\n\r\nULONG STDMETHODCALLTYPE ep_static_AddRefRelease(void* _this)\r\n{\r\n    return 1;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_QueryInterface(void* _this, REFIID riid, void** ppv)\r\n{\r\n    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IActiveScriptSite))\r\n        *ppv = _this;\r\n    else if (IsEqualIID(riid, &IID_IActiveScriptSiteWindow))\r\n        *ppv = ((unsigned char*)_this + 8);\r\n    else\r\n    {\r\n        *ppv = 0;\r\n        return(E_NOINTERFACE);\r\n    }\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_QueryInterface(void* _this, REFIID riid, void** ppv)\r\n{\r\n    return IActiveScriptSite_QueryInterface((char*)_this - 8, riid, ppv);\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_GetLCID(void* _this, LCID* plcid)\r\n{\r\n    *plcid = LOCALE_USER_DEFAULT;\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_GetItemInfo(void* _this, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti)\r\n{\r\n    return TYPE_E_ELEMENTNOTFOUND;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_GetDocVersionString(void* _this, BSTR* pbstrVersion)\r\n{\r\n    *pbstrVersion = 0;\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_OnScriptTerminate(void* _this, const void* pvarResult, const EXCEPINFO* pexcepinfo)\r\n{\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_OnStateChange(void* _this, SCRIPTSTATE ssScriptState)\r\n{\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_OnScriptError(void* _this, IActiveScriptError* scriptError)\r\n{\r\n    ULONG        lineNumber;\r\n    BSTR         desc;\r\n    EXCEPINFO    ei;\r\n    OLECHAR      wszOutput[1024];\r\n\r\n    // Call GetSourcePosition() to retrieve the line # where\r\n    // the error occurred in the script\r\n    scriptError->lpVtbl->GetSourcePosition(scriptError, 0, &lineNumber, 0);\r\n\r\n    // Call GetSourceLineText() to retrieve the line in the script that\r\n    // has an error.\r\n    desc = 0;\r\n    scriptError->lpVtbl->GetSourceLineText(scriptError, &desc);\r\n\r\n    // Call GetExceptionInfo() to fill in our EXCEPINFO struct with more\r\n    // information.\r\n    ZeroMemory(&ei, sizeof(EXCEPINFO));\r\n    scriptError->lpVtbl->GetExceptionInfo(scriptError, &ei);\r\n\r\n    // Format the message we'll display to the user\r\n    wsprintfW(&wszOutput[0], L\"%s\\nLine %u: %s\\n%s\", ei.bstrSource,\r\n        lineNumber + 1, ei.bstrDescription, desc ? desc : \"\");\r\n\r\n    // Free what we got from the IActiveScriptError functions\r\n    SysFreeString(desc);\r\n    SysFreeString(ei.bstrSource);\r\n    SysFreeString(ei.bstrDescription);\r\n    SysFreeString(ei.bstrHelpFile);\r\n\r\n    // Display the message\r\n    MessageBoxW(0, &wszOutput[0], L\"Error\",\r\n        MB_SETFOREGROUND | MB_OK | MB_ICONEXCLAMATION);\r\n\r\n    return(S_OK);\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_OnEnterScript(void* _this)\r\n{\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSite_OnLeaveScript(void* _this)\r\n{\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_GetWindow(void* _this, HWND* phWnd)\r\n{\r\n    *phWnd = InputBox_HWND;\r\n    return S_OK;\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_EnableModeless(void* _this, BOOL fEnable)\r\n{\r\n    return S_OK;\r\n}\r\n\r\nstatic const IActiveScriptSiteVtbl IActiveScriptSite_Vtbl = {\r\n    .QueryInterface = IActiveScriptSite_QueryInterface,\r\n    .AddRef = ep_static_AddRefRelease,\r\n    .Release = ep_static_AddRefRelease,\r\n    .GetLCID = IActiveScriptSite_GetLCID,\r\n    .GetItemInfo = IActiveScriptSite_GetItemInfo,\r\n    .GetDocVersionString = IActiveScriptSite_GetDocVersionString,\r\n    .OnScriptTerminate = IActiveScriptSite_OnScriptTerminate,\r\n    .OnStateChange = IActiveScriptSite_OnStateChange,\r\n    .OnScriptError = IActiveScriptSite_OnScriptError,\r\n    .OnEnterScript = IActiveScriptSite_OnEnterScript,\r\n    .OnLeaveScript = IActiveScriptSite_OnLeaveScript,\r\n};\r\n\r\nstatic const IActiveScriptSiteWindowVtbl IActiveScriptSiteWindow_Vtbl = {\r\n    .QueryInterface = IActiveScriptSiteWindow_QueryInterface,\r\n    .AddRef = ep_static_AddRefRelease,\r\n    .Release = ep_static_AddRefRelease,\r\n    .GetWindow = IActiveScriptSiteWindow_GetWindow,\r\n    .EnableModeless = IActiveScriptSiteWindow_EnableModeless,\r\n};\r\n\r\ntypedef struct _CSimpleScriptSite\r\n{\r\n    IActiveScriptSiteVtbl* lpVtbl;\r\n    IActiveScriptSiteWindowVtbl* lpVtbl1;\r\n} CSimpleScriptSite;\r\n\r\nstatic const CSimpleScriptSite CSimpleScriptSite_Instance = {\r\n    .lpVtbl = &IActiveScriptSite_Vtbl,\r\n    .lpVtbl1 = &IActiveScriptSiteWindow_Vtbl\r\n};\r\n\r\nstatic BOOL HideInput = FALSE;\r\nstatic LRESULT CALLBACK InputBoxProc(int nCode, WPARAM wParam, LPARAM lParam) {\r\n    if (nCode < HC_ACTION)\r\n        return CallNextHookEx(0, nCode, wParam, lParam);\r\n    if (nCode = HCBT_ACTIVATE) {\r\n        if (HideInput == TRUE) {\r\n            HWND TextBox = FindWindowExA((HWND)wParam, NULL, \"Edit\", NULL);\r\n            SendDlgItemMessageW((HWND)wParam, GetDlgCtrlID(TextBox), EM_SETPASSWORDCHAR, L'\\x25cf', 0);\r\n        }\r\n    }\r\n    if (nCode = HCBT_CREATEWND) {\r\n        if (!(GetWindowLongPtr((HWND)wParam, GWL_STYLE) & WS_CHILD))\r\n            SetWindowLongPtr((HWND)wParam, GWL_EXSTYLE, GetWindowLongPtr((HWND)wParam, GWL_EXSTYLE) | WS_EX_DLGMODALFRAME);\r\n    }\r\n    return CallNextHookEx(0, nCode, wParam, lParam);\r\n}\r\n\r\nHRESULT InputBox(BOOL bPassword, HWND hWnd, LPCWSTR wszPrompt, LPCWSTR wszTitle, LPCWSTR wszDefault, LPWSTR wszAnswer, DWORD cbAnswer, BOOL* bCancelled)\r\n{\r\n    HRESULT hr = S_OK;\r\n\r\n    if (!wszPrompt || !wszTitle || !wszDefault || !wszAnswer || !cbAnswer || !bCancelled)\r\n    {\r\n        return E_FAIL;\r\n    }\r\n\r\n    GUID guidBuffer;\r\n    hr = getEngineGuid(L\".vbs\", &guidBuffer);\r\n\r\n    DWORD cchPromptSafe = 0, cchTitleSafe = 0, cchDefaultSafe = 0;\r\n    LPWSTR wszPromptSafe = StrReplaceAllW(wszPrompt, L\"\\\"\", L\"\\\"\\\"\", &cchPromptSafe);\r\n    LPWSTR wszTitleSafe = StrReplaceAllW(wszTitle, L\"\\\"\", L\"\\\"\\\"\", &cchTitleSafe);\r\n    LPWSTR wszDefaultSafe = StrReplaceAllW(wszDefault, L\"\\\"\", L\"\\\"\\\"\", &cchDefaultSafe);\r\n    if (!wszPromptSafe || !wszTitleSafe || !wszDefaultSafe)\r\n    {\r\n        if (wszPromptSafe)\r\n        {\r\n            free(wszPromptSafe);\r\n        }\r\n        if (wszTitleSafe)\r\n        {\r\n            free(wszTitleSafe);\r\n        }\r\n        if (wszDefaultSafe)\r\n        {\r\n            free(wszDefaultSafe);\r\n        }\r\n        return E_OUTOFMEMORY;\r\n    }\r\n\r\n    IActiveScript* pActiveScript = NULL;\r\n    hr = CoCreateInstance(FAILED(hr) ? &CLSID_VBScript : &guidBuffer, 0, CLSCTX_ALL,\r\n        &IID_IActiveScript,\r\n        (void**)&pActiveScript);\r\n    if (SUCCEEDED(hr) && pActiveScript)\r\n    {\r\n        hr = pActiveScript->lpVtbl->SetScriptSite(pActiveScript, &CSimpleScriptSite_Instance);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            IActiveScriptParse* pActiveScriptParse = NULL;\r\n            hr = pActiveScript->lpVtbl->QueryInterface(pActiveScript, &IID_IActiveScriptParse, &pActiveScriptParse);\r\n            if (SUCCEEDED(hr) && pActiveScriptParse)\r\n            {\r\n                hr = pActiveScriptParse->lpVtbl->InitNew(pActiveScriptParse);\r\n                if (SUCCEEDED(hr))\r\n                {\r\n                    LPWSTR wszEvaluation = malloc(sizeof(WCHAR) * (cchPromptSafe + cchTitleSafe + cchDefaultSafe + 100));\r\n                    if (wszEvaluation)\r\n                    {\r\n                        swprintf_s(wszEvaluation, cchPromptSafe + cchTitleSafe + cchDefaultSafe + 100, L\"InputBox(\\\"%s\\\", \\\"%s\\\", \\\"%s\\\")\", wszPromptSafe, wszTitleSafe, wszDefaultSafe);\r\n                        DWORD cchEvaluation2 = 0;\r\n                        LPWSTR wszEvaluation2 = StrReplaceAllW(wszEvaluation, L\"\\n\", L\"\\\" + vbNewLine + \\\"\", &cchEvaluation2);\r\n                        if (wszEvaluation2)\r\n                        {\r\n                            EXCEPINFO ei;\r\n                            ZeroMemory(&ei, sizeof(EXCEPINFO));\r\n                            DWORD dwThreadId = GetCurrentThreadId();\r\n                            HINSTANCE hInstance = GetModuleHandle(NULL);\r\n\r\n                            if (!hWnd)\r\n                            {\r\n                                InputBox_HWND = GetAncestor(GetActiveWindow(), GA_ROOTOWNER);\r\n                            }\r\n                            else\r\n                            {\r\n                                InputBox_HWND = hWnd;\r\n                            }\r\n\r\n                            HHOOK hHook = SetWindowsHookExW(WH_CBT, &InputBoxProc, hInstance, dwThreadId);\r\n\r\n                            VARIANT result;\r\n                            VariantInit(&result);\r\n\r\n                            HideInput = bPassword;\r\n                            hr = pActiveScriptParse->lpVtbl->ParseScriptText(pActiveScriptParse, wszEvaluation2, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &result, &ei);\r\n\r\n                            *bCancelled = (result.vt == VT_EMPTY);\r\n\r\n                            UnhookWindowsHookEx(hHook);\r\n\r\n                            free(wszEvaluation2);\r\n\r\n                            if (result.bstrVal)\r\n                            {\r\n                                memcpy(wszAnswer, result.bstrVal, cbAnswer * sizeof(WCHAR));\r\n                            }\r\n                            else\r\n                            {\r\n                                if (result.vt != VT_EMPTY)\r\n                                {\r\n                                    wszAnswer[0] = 0;\r\n                                }\r\n                            }\r\n\r\n                            VariantClear(&result);\r\n                        }\r\n                        free(wszEvaluation);\r\n                    }\r\n                }\r\n                pActiveScriptParse->lpVtbl->Release(pActiveScriptParse);\r\n            }\r\n            pActiveScript->lpVtbl->Release(pActiveScript);\r\n        }\r\n    }\r\n\r\n    if (wszPromptSafe)\r\n    {\r\n        free(wszPromptSafe);\r\n    }\r\n    if (wszTitleSafe)\r\n    {\r\n        free(wszTitleSafe);\r\n    }\r\n    if (wszDefaultSafe)\r\n    {\r\n        free(wszDefaultSafe);\r\n    }\r\n\r\n    return hr;\r\n}\r\n#endif\r\n\r\nUINT PleaseWaitTimeout = 0;\r\nHHOOK PleaseWaitHook = NULL;\r\nHWND PleaseWaitHWND = NULL;\r\nvoid* PleaseWaitCallbackData = NULL;\r\nBOOL (*PleaseWaitCallbackFunc)(void* data) = NULL;\r\nBOOL PleaseWait_UpdateTimeout(int timeout)\r\n{\r\n    if (PleaseWaitHWND)\r\n    {\r\n        KillTimer(PleaseWaitHWND, 'EPPW');\r\n        PleaseWaitTimeout = timeout;\r\n        return SetTimer(PleaseWaitHWND, 'EPPW', PleaseWaitTimeout, PleaseWait_TimerProc);\r\n    }\r\n    return FALSE;\r\n}\r\n\r\nVOID CALLBACK PleaseWait_TimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime)\r\n{\r\n    if (idEvent == 'EPPW')\r\n    {\r\n        if (PleaseWaitCallbackFunc)\r\n        {\r\n            if (PleaseWaitCallbackFunc(PleaseWaitCallbackData))\r\n            {\r\n                return;\r\n            }\r\n            PleaseWaitCallbackData = NULL;\r\n            PleaseWaitCallbackFunc = NULL;\r\n        }\r\n        KillTimer(hWnd, 'EPPW');\r\n        SetTimer(hWnd, 'EPPW', 0, NULL); // <- this closes the message box\r\n        PleaseWaitHWND = NULL;\r\n        PleaseWaitTimeout = 0;\r\n    }\r\n}\r\n\r\nLRESULT CALLBACK PleaseWait_HookProc(int code, WPARAM wParam, LPARAM lParam)\r\n{\r\n    if (code < 0)\r\n    {\r\n        return CallNextHookEx(NULL, code, wParam, lParam);\r\n    }\r\n\r\n    CWPSTRUCT* msg = (CWPSTRUCT*)lParam;\r\n    /*if (msg->message == WM_CREATE)\r\n    {\r\n        CREATESTRUCT* pCS = (CREATESTRUCT*)msg->lParam;\r\n        if (pCS->lpszClass == RegisterWindowMessageW(L\"Button\"))\r\n        {\r\n        }\r\n    }*/\r\n    LRESULT result = CallNextHookEx(NULL, code, wParam, lParam);\r\n\r\n    if (msg->message == WM_INITDIALOG)\r\n    {\r\n        PleaseWaitHWND = msg->hwnd;\r\n        EnableWindow(PleaseWaitHWND, FALSE);\r\n        LONG_PTR style = GetWindowLongPtrW(PleaseWaitHWND, GWL_STYLE);\r\n        SetWindowLongPtrW(PleaseWaitHWND, GWL_STYLE, style & ~WS_SYSMENU);\r\n        RECT rc;\r\n        GetWindowRect(PleaseWaitHWND, &rc);\r\n        SetWindowPos(PleaseWaitHWND, NULL, 0, 0, rc.right - rc.left, rc.bottom - rc.top - MulDiv(50, GetDpiForWindow(PleaseWaitHWND), 96), SWP_NOMOVE | SWP_FRAMECHANGED);\r\n        SetTimer(PleaseWaitHWND, 'EPPW', PleaseWaitTimeout, PleaseWait_TimerProc);\r\n        UnhookWindowsHookEx(PleaseWaitHook);\r\n        PleaseWaitHook = NULL;\r\n    }\r\n    return result;\r\n}\r\n\r\nBOOL DownloadAndInstallWebView2Runtime()\r\n{\r\n    BOOL bOK = FALSE;\r\n    HINTERNET hInternet = NULL;\r\n    if (hInternet = InternetOpenA(\r\n        \"ExplorerPatcher\",\r\n        INTERNET_OPEN_TYPE_PRECONFIG,\r\n        NULL,\r\n        NULL,\r\n        0\r\n    ))\r\n    {\r\n        HINTERNET hConnect = InternetOpenUrlA(\r\n            hInternet,\r\n            \"https://go.microsoft.com/fwlink/p/?LinkId=2124703\",\r\n            NULL,\r\n            0,\r\n            INTERNET_FLAG_RAW_DATA |\r\n            INTERNET_FLAG_RELOAD |\r\n            INTERNET_FLAG_RESYNCHRONIZE |\r\n            INTERNET_FLAG_NO_COOKIES |\r\n            INTERNET_FLAG_NO_UI |\r\n            INTERNET_FLAG_NO_CACHE_WRITE |\r\n            INTERNET_FLAG_DONT_CACHE,\r\n            NULL\r\n        );\r\n        if (hConnect)\r\n        {\r\n            char* exe_buffer = NULL;\r\n            DWORD dwSize = 2 * 1024 * 1024;\r\n            DWORD dwRead = dwSize;\r\n            exe_buffer = calloc(dwSize, sizeof(char));\r\n            if (exe_buffer)\r\n            {\r\n                BOOL bRet = FALSE;\r\n                if (bRet = InternetReadFile(\r\n                    hConnect,\r\n                    exe_buffer,\r\n                    dwSize - 1,\r\n                    &dwRead\r\n                ))\r\n                {\r\n                    WCHAR wszPath[MAX_PATH];\r\n                    ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\r\n                    SHGetFolderPathW(NULL, SPECIAL_FOLDER_LEGACY, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n                    wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n                    BOOL bRet = CreateDirectoryW(wszPath, NULL);\r\n                    if (bRet || (!bRet && GetLastError() == ERROR_ALREADY_EXISTS))\r\n                    {\r\n                        wcscat_s(wszPath, MAX_PATH, L\"\\\\MicrosoftEdgeWebview2Setup.exe\");\r\n                        FILE* f = NULL;\r\n                        _wfopen_s(&f, wszPath, L\"wb\");\r\n                        if (f)\r\n                        {\r\n                            fwrite(exe_buffer, 1, dwRead, f);\r\n                            fclose(f);\r\n                            SHELLEXECUTEINFOW sei;\r\n                            ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n                            sei.cbSize = sizeof(sei);\r\n                            sei.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n                            sei.hwnd = NULL;\r\n                            sei.hInstApp = NULL;\r\n                            sei.lpVerb = NULL;\r\n                            sei.lpFile = wszPath;\r\n                            sei.lpParameters = L\"\";\r\n                            sei.hwnd = NULL;\r\n                            sei.nShow = SW_SHOWMINIMIZED;\r\n                            if (ShellExecuteExW(&sei) && sei.hProcess)\r\n                            {\r\n                                WaitForSingleObject(sei.hProcess, INFINITE);\r\n                                CloseHandle(sei.hProcess);\r\n                                Sleep(100);\r\n                                DeleteFileW(wszPath);\r\n                                bOK = TRUE;\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n                free(exe_buffer);\r\n            }\r\n            InternetCloseHandle(hConnect);\r\n        }\r\n        InternetCloseHandle(hInternet);\r\n    }\r\n    return bOK;\r\n}\r\n\r\nBOOL DownloadFile(LPCWSTR wszURL, DWORD dwSize, LPCWSTR wszPath)\r\n{\r\n    BOOL bOK = FALSE;\r\n    HINTERNET hInternet = NULL;\r\n    if (hInternet = InternetOpenW(\r\n        L\"ExplorerPatcher\",\r\n        INTERNET_OPEN_TYPE_PRECONFIG,\r\n        NULL,\r\n        NULL,\r\n        0\r\n    ))\r\n    {\r\n        HINTERNET hConnect = InternetOpenUrlW(\r\n            hInternet,\r\n            wszURL,\r\n            NULL,\r\n            0,\r\n            INTERNET_FLAG_RAW_DATA |\r\n            INTERNET_FLAG_RELOAD |\r\n            INTERNET_FLAG_RESYNCHRONIZE |\r\n            INTERNET_FLAG_NO_COOKIES |\r\n            INTERNET_FLAG_NO_UI |\r\n            INTERNET_FLAG_NO_CACHE_WRITE |\r\n            INTERNET_FLAG_DONT_CACHE,\r\n            NULL\r\n        );\r\n        if (hConnect)\r\n        {\r\n            char* exe_buffer = NULL;\r\n            DWORD dwRead = dwSize;\r\n            exe_buffer = calloc(dwSize, sizeof(char));\r\n            if (exe_buffer)\r\n            {\r\n                if (InternetReadFile(\r\n                    hConnect,\r\n                    exe_buffer,\r\n                    dwSize - 1,\r\n                    &dwRead\r\n                ))\r\n                {\r\n                    FILE* f = NULL;\r\n                    _wfopen_s(&f, wszPath, L\"wb\");\r\n                    if (f)\r\n                    {\r\n                        bOK = fwrite(exe_buffer, 1, dwRead, f) == dwRead;\r\n                        fclose(f);\r\n                    }\r\n                }\r\n                free(exe_buffer);\r\n            }\r\n            InternetCloseHandle(hConnect);\r\n        }\r\n        InternetCloseHandle(hInternet);\r\n    }\r\n    return bOK;\r\n}\r\n\r\nBOOL IsConnectedToInternet()\r\n{\r\n    BOOL connectedStatus = FALSE;\r\n    HRESULT hr = S_FALSE;\r\n\r\n    hr = CoInitialize(NULL);\r\n    if (SUCCEEDED(hr))\r\n    {\r\n        INetworkListManager* pNetworkListManager;\r\n        hr = CoCreateInstance(&CLSID_NetworkListManager, NULL, CLSCTX_ALL, &IID_NetworkListManager, (LPVOID*)&pNetworkListManager);\r\n        if (SUCCEEDED(hr))\r\n        {\r\n            NLM_CONNECTIVITY nlmConnectivity = NLM_CONNECTIVITY_DISCONNECTED;\r\n            VARIANT_BOOL isConnected = VARIANT_FALSE;\r\n            hr = pNetworkListManager->lpVtbl->get_IsConnectedToInternet(pNetworkListManager, &isConnected);\r\n            if (SUCCEEDED(hr))\r\n            {\r\n                if (isConnected == VARIANT_TRUE)\r\n                    connectedStatus = TRUE;\r\n                else\r\n                    connectedStatus = FALSE;\r\n            }\r\n            if (isConnected == VARIANT_FALSE && SUCCEEDED(pNetworkListManager->lpVtbl->GetConnectivity(pNetworkListManager, &nlmConnectivity)))\r\n            {\r\n                if (nlmConnectivity & (NLM_CONNECTIVITY_IPV4_LOCALNETWORK | NLM_CONNECTIVITY_IPV4_SUBNET | NLM_CONNECTIVITY_IPV6_LOCALNETWORK | NLM_CONNECTIVITY_IPV6_SUBNET))\r\n                {\r\n                    connectedStatus = 2;\r\n                }\r\n            }\r\n            pNetworkListManager->lpVtbl->Release(pNetworkListManager);\r\n        }\r\n        CoUninitialize();\r\n    }\r\n    return connectedStatus;\r\n}\r\n\r\nBOOL DoesOSBuildSupportSpotlight()\r\n{\r\n    return (global_rovi.dwBuildNumber == 22000 && global_ubr >= 706) || (global_rovi.dwBuildNumber >= 22598);\r\n}\r\n\r\nBOOL IsSpotlightEnabled()\r\n{\r\n    HKEY hKey = NULL;\r\n    BOOL bRet = RegOpenKeyExW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2CC5CA98-6485-489A-920E-B3E88A6CCCE3}\", 0, KEY_READ, &hKey) == ERROR_SUCCESS;\r\n    if (bRet) RegCloseKey(hKey);\r\n    return bRet;\r\n}\r\n\r\nconst int spop_insertmenu_ops[] = { SPOP_INSERTMENU_OPEN, SPOP_INSERTMENU_NEXTPIC, 0, SPOP_INSERTMENU_LIKE, SPOP_INSERTMENU_DISLIKE };\r\nvoid SpotlightHelper(DWORD dwOp, HWND hWnd, HMENU hMenu, LPPOINT pPt)\r\n{\r\n    HRESULT hr = S_OK;\r\n    LPITEMIDLIST pidl = NULL;\r\n    SFGAOF sfgao = 0;\r\n    if (SUCCEEDED(hr = SHParseDisplayName(L\"::{2CC5CA98-6485-489A-920E-B3E88A6CCCE3}\", NULL, &pidl, 0, &sfgao)))\r\n    {\r\n        IShellFolder* psf = NULL;\r\n        LPCITEMIDLIST pidlChild;\r\n        if (SUCCEEDED(hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidlChild)))\r\n        {\r\n            IContextMenu* pcm = NULL;\r\n            if (SUCCEEDED(hr = psf->lpVtbl->GetUIObjectOf(psf, hWnd, 1, &pidlChild, &IID_IContextMenu, NULL, &pcm)))\r\n            {\r\n                HMENU hMenu2 = CreatePopupMenu();\r\n                if (hMenu2)\r\n                {\r\n                    if (SUCCEEDED(hr = pcm->lpVtbl->QueryContextMenu(pcm, hMenu2, 0, SCRATCH_QCM_FIRST, SCRATCH_QCM_LAST, CMF_NORMAL)))\r\n                    {\r\n                        if (dwOp == SPOP_OPENMENU)\r\n                        {\r\n                            int iCmd = TrackPopupMenuEx(hMenu2, TPM_RETURNCMD, pPt->x, pPt->y, hWnd, NULL);\r\n                            if (iCmd > 0)\r\n                            {\r\n                                CMINVOKECOMMANDINFOEX info = { 0 };\r\n                                info.cbSize = sizeof(info);\r\n                                info.fMask = CMIC_MASK_UNICODE | CMIC_MASK_PTINVOKE;\r\n                                info.hwnd = hWnd;\r\n                                info.lpVerb = MAKEINTRESOURCEA(iCmd - SCRATCH_QCM_FIRST);\r\n                                info.lpVerbW = MAKEINTRESOURCEW(iCmd - SCRATCH_QCM_FIRST);\r\n                                info.nShow = SW_SHOWNORMAL;\r\n                                info.ptInvoke = *pPt;\r\n                                pcm->lpVtbl->InvokeCommand(pcm, &info);\r\n                            }\r\n                        }\r\n                        else if (!(dwOp & ~SPOP_INSERTMENU_ALL))\r\n                        {\r\n                            MENUITEMINFOW mii;\r\n                            int i = ARRAYSIZE(spop_insertmenu_ops) - 1;\r\n                            while (1)\r\n                            {\r\n                                if (i == -1 ? ((dwOp & SPOP_INSERTMENU_INFOTIP1) || (dwOp & SPOP_INSERTMENU_INFOTIP2)) : (dwOp & spop_insertmenu_ops[i]))\r\n                                {\r\n                                    mii.cbSize = sizeof(MENUITEMINFOW);\r\n                                    mii.fMask = MIIM_FTYPE | MIIM_STRING;\r\n                                    mii.cch = 0;\r\n                                    mii.dwTypeData = NULL;\r\n                                    if (i <= 0 ?\r\n                                        (i == 0 ?\r\n                                            !RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", NULL, &mii.cch) :\r\n                                            !RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", L\"InfoTip\", RRF_RT_REG_SZ, NULL, NULL, &mii.cch)\r\n                                            ) :\r\n                                        GetMenuItemInfoW(hMenu2, i, TRUE, &mii))\r\n                                    {\r\n                                        WCHAR* buf = malloc(++mii.cch * sizeof(WCHAR));\r\n                                        if (buf)\r\n                                        {\r\n                                            mii.dwTypeData = buf;\r\n                                            if (i <= 0 ?\r\n                                                (i == 0 ?\r\n                                                    !RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", mii.dwTypeData, &mii.cch) :\r\n                                                    !RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", L\"InfoTip\", RRF_RT_REG_SZ, NULL, mii.dwTypeData, &mii.cch)\r\n                                                    ) :\r\n                                                GetMenuItemInfoW(hMenu2, i, TRUE, &mii))\r\n                                            {\r\n                                                if (i == -1)\r\n                                                {\r\n                                                    WCHAR* pCInit = mii.dwTypeData;\r\n                                                    WCHAR* pC = wcschr(mii.dwTypeData, L'\\r');\r\n                                                    if (pC)\r\n                                                    {\r\n                                                        pC[0] = 0;\r\n\r\n                                                        pC++;\r\n                                                        WCHAR* pC2 = wcschr(pC, L'\\r');\r\n                                                        if (pC2)\r\n                                                        {\r\n                                                            pC2[0] = 0;\r\n                                                        }\r\n                                                        mii.dwTypeData = pC;\r\n\r\n                                                        mii.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;\r\n                                                        mii.wID = 3999 + i - 1;\r\n                                                        mii.dwItemData = SPOP_CLICKMENU_FIRST + i - 1;\r\n                                                        mii.fType = MFT_STRING;\r\n                                                        mii.fState = MFS_DISABLED;\r\n                                                        if (dwOp & SPOP_INSERTMENU_INFOTIP2)\r\n                                                        {\r\n                                                            InsertMenuItemW(hMenu, 3, TRUE, &mii);\r\n                                                        }\r\n\r\n                                                        mii.dwTypeData = pCInit;\r\n                                                    }\r\n                                                }\r\n                                                mii.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | (i == -1 ? MIIM_STATE : 0);\r\n                                                mii.wID = 3999 + i;\r\n                                                mii.dwItemData = SPOP_CLICKMENU_FIRST + i;\r\n                                                mii.fType = MFT_STRING;\r\n                                                if (i == -1) mii.fState = MFS_DISABLED;\r\n                                                if (i != -1 || (i == -1 && (dwOp & SPOP_INSERTMENU_INFOTIP1)))\r\n                                                {\r\n                                                    InsertMenuItemW(hMenu, 3, TRUE, &mii);\r\n                                                }\r\n                                            }\r\n                                            free(buf);\r\n                                        }\r\n                                    }\r\n                                }\r\n                                i--;\r\n                                if (i < -1) break;\r\n                            }\r\n                            mii.fMask = MIIM_FTYPE | MIIM_DATA;\r\n                            mii.dwItemData = 0;\r\n                            mii.fType = MFT_SEPARATOR;\r\n                            InsertMenuItemW(hMenu, 3, TRUE, &mii);\r\n                        }\r\n                        else if (dwOp >= SPOP_CLICKMENU_FIRST && dwOp <= SPOP_CLICKMENU_LAST)\r\n                        {\r\n                            MENUITEMINFOW mii;\r\n                            mii.cbSize = sizeof(MENUITEMINFOW);\r\n                            mii.fMask = MIIM_ID;\r\n                            if (GetMenuItemInfoW(hMenu2, dwOp - SPOP_CLICKMENU_FIRST, TRUE, &mii))\r\n                            {\r\n                                CMINVOKECOMMANDINFOEX info = { 0 };\r\n                                info.cbSize = sizeof(info);\r\n                                info.fMask = CMIC_MASK_UNICODE;\r\n                                info.hwnd = hWnd;\r\n                                info.lpVerb = MAKEINTRESOURCEA(mii.wID - SCRATCH_QCM_FIRST);\r\n                                info.lpVerbW = MAKEINTRESOURCEW(mii.wID - SCRATCH_QCM_FIRST);\r\n                                info.nShow = SW_SHOWNORMAL;\r\n                                pcm->lpVtbl->InvokeCommand(pcm, &info);\r\n                            }\r\n                        }\r\n                    }\r\n                    DestroyMenu(hMenu2);\r\n                }\r\n                pcm->lpVtbl->Release(pcm);\r\n            }\r\n            psf->lpVtbl->Release(psf);\r\n        }\r\n        CoTaskMemFree(pidl);\r\n    }\r\n}\r\n\r\nBOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod)\r\n{\r\n    POINT pt; pt.x = 0; pt.y = 0;\r\n    if (MonitorFromPoint(pt, MONITOR_DEFAULTTONULL) == hMonitor)\r\n    {\r\n        return TRUE;\r\n    }\r\n    if (mod->cbIndex == mod->dwIndex)\r\n    {\r\n        mod->hMonitor = hMonitor;\r\n        return FALSE;\r\n    }\r\n    mod->cbIndex++;\r\n    return TRUE;\r\n}\r\n\r\nHRESULT SHRegGetBOOLWithREGSAM(HKEY key, LPCWSTR subKey, LPCWSTR value, REGSAM regSam, BOOL* data)\r\n{\r\n    DWORD dwType = REG_NONE;\r\n    DWORD dwData;\r\n    DWORD cbData = 4;\r\n    LSTATUS lRes = RegGetValueW(\r\n        key,\r\n        subKey,\r\n        value,\r\n        ((regSam & 0x100) << 8) | RRF_RT_REG_DWORD | RRF_RT_REG_SZ | RRF_NOEXPAND,\r\n        &dwType,\r\n        &dwData,\r\n        &cbData\r\n    );\r\n    if (lRes != ERROR_SUCCESS)\r\n    {\r\n        if (lRes == ERROR_MORE_DATA)\r\n            return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);\r\n        if (lRes > 0)\r\n            return HRESULT_FROM_WIN32(lRes);\r\n        return lRes;\r\n    }\r\n\r\n    if (dwType == REG_DWORD)\r\n    {\r\n        if (dwData > 1)\r\n            return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);\r\n        *data = dwData == 1;\r\n    }\r\n    else\r\n    {\r\n        if (cbData != 4 || (WCHAR)dwData != L'0' && (WCHAR)dwData != L'1')\r\n            return HRESULT_FROM_WIN32(ERROR_INVALID_DATA);\r\n        *data = (WCHAR)dwData == L'1';\r\n    }\r\n\r\n    return S_OK;\r\n}\r\n\r\nHRESULT SHRegGetDWORD(HKEY hkey, const WCHAR* pwszSubKey, const WCHAR* pwszValue, DWORD* pdwData)\r\n{\r\n    DWORD dwSize = sizeof(DWORD);\r\n    LSTATUS lres = RegGetValueW(hkey, pwszSubKey, pwszValue, RRF_RT_REG_DWORD, NULL, pdwData, &dwSize);\r\n    return HRESULT_FROM_WIN32(lres);\r\n}\r\n\r\n#ifdef WITH_MAIN_PATCHER\r\n// https://learn.microsoft.com/en-us/windows/uwp/communication/sharing-named-objects\r\n// https://learn.microsoft.com/en-us/windows/win32/api/securityappcontainer/nf-securityappcontainer-getappcontainernamedobjectpath#examples\r\nBOOL GetLogonSid(PSID* ppsid)\r\n{\r\n    BOOL bSuccess = FALSE;\r\n    HANDLE hToken = INVALID_HANDLE_VALUE;\r\n    DWORD dwLength = 0;\r\n    PTOKEN_GROUPS ptg = NULL;\r\n\r\n    if (NULL == ppsid)\r\n        goto Cleanup;\r\n\r\n    if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))\r\n        goto Cleanup;\r\n\r\n    if (!GetTokenInformation(hToken, TokenLogonSid, (LPVOID)ptg, 0, &dwLength))\r\n    {\r\n        if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)\r\n            goto Cleanup;\r\n\r\n        ptg = (PTOKEN_GROUPS)calloc(1, dwLength);\r\n    }\r\n\r\n    if (ptg == NULL)\r\n        goto Cleanup;\r\n\r\n    if (!GetTokenInformation(hToken, TokenLogonSid, (LPVOID)ptg, dwLength, &dwLength) || ptg->GroupCount != 1)\r\n        goto Cleanup;\r\n\r\n    dwLength = GetLengthSid(ptg->Groups[0].Sid);\r\n    *ppsid = (PSID)calloc(1, dwLength);\r\n    if (*ppsid == NULL)\r\n        goto Cleanup;\r\n    if (!CopySid(dwLength, *ppsid, ptg->Groups[0].Sid))\r\n    {\r\n        free((LPVOID)*ppsid);\r\n        goto Cleanup;\r\n    }\r\n\r\n    bSuccess = TRUE;\r\n\r\nCleanup:\r\n    if (ptg != NULL)\r\n        free((LPVOID)ptg);\r\n\r\n    return bSuccess;\r\n}\r\n\r\n// https://learn.microsoft.com/en-us/windows/uwp/communication/sharing-named-objects\r\n// https://learn.microsoft.com/en-us/windows/win32/api/securityappcontainer/nf-securityappcontainer-getappcontainernamedobjectpath#examples\r\nBOOL PrepareSecurityDescriptor(PSID pMainSid, DWORD dwMainPermissions, PSID pSecondarySid, DWORD dwSecondayPermissions, PSECURITY_DESCRIPTOR* ppSD)\r\n{\r\n    BOOL bSuccess = FALSE;\r\n    DWORD dwRes = ERROR_SUCCESS;\r\n    PACL pACL = NULL;\r\n    PSECURITY_DESCRIPTOR pSD = NULL;\r\n    EXPLICIT_ACCESS ea[2];\r\n\r\n    if (pMainSid == NULL || pSecondarySid == NULL)\r\n        goto Cleanup;\r\n\r\n    ZeroMemory(&ea, 2 * sizeof(EXPLICIT_ACCESS));\r\n    ea[0].grfAccessPermissions = dwMainPermissions;\r\n    ea[0].grfAccessMode = SET_ACCESS;\r\n    ea[0].grfInheritance = NO_INHERITANCE;\r\n    ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;\r\n    ea[0].Trustee.TrusteeType = TRUSTEE_IS_USER;\r\n    ea[0].Trustee.ptstrName = (LPTSTR)pMainSid;\r\n    ea[1].grfAccessPermissions = dwSecondayPermissions;\r\n    ea[1].grfAccessMode = SET_ACCESS;\r\n    ea[1].grfInheritance = NO_INHERITANCE;\r\n    ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;\r\n    ea[1].Trustee.TrusteeType = TRUSTEE_IS_USER;\r\n    ea[1].Trustee.ptstrName = (LPTSTR)pSecondarySid;\r\n\r\n    dwRes = SetEntriesInAclW(2, ea, NULL, &pACL);\r\n    if (dwRes != ERROR_SUCCESS)\r\n        goto Cleanup;\r\n\r\n    pSD = (PSECURITY_DESCRIPTOR)calloc(1, SECURITY_DESCRIPTOR_MIN_LENGTH);\r\n    if (NULL == pSD)\r\n        goto Cleanup;\r\n\r\n    if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))\r\n        goto Cleanup;\r\n\r\n    if (!SetSecurityDescriptorDacl(pSD, TRUE, pACL, FALSE))\r\n        goto Cleanup;\r\n\r\n    *ppSD = pSD;\r\n    pSD = NULL;\r\n    bSuccess = TRUE;\r\nCleanup:\r\n\r\n    if (pACL)\r\n        LocalFree(pACL);\r\n    if (pSD)\r\n        free(pSD);\r\n\r\n    return bSuccess;\r\n}\r\n#endif\r\n"
  },
  {
    "path": "ExplorerPatcher/utility.h",
    "content": "#ifndef _H_UTILITY_H_\n#define _H_UTILITY_H_\n#if __has_include(\"ep_private.h\")\n//#define USE_PRIVATE_INTERFACES\n#endif\n#include <Windows.h>\n#include <stdio.h>\n#include <tchar.h>\n#include <windows.data.xml.dom.h>\n#include <accctrl.h>\n#include <aclapi.h>\n#include <sddl.h>\n#include <Shobjidl.h>\n#include <Shlobj_core.h>\n#include <restartmanager.h>\n#pragma comment(lib, \"Rstrtmgr.lib\")\n#define _LIBVALINET_INCLUDE_UNIVERSAL\n#ifndef __cplusplus\n#include <valinet/universal/toast/toast.h>\n#endif\n#include \"osutility.h\"\n#include \"queryversion.h\"\n#pragma comment(lib, \"Psapi.lib\")\n#include <activscp.h>\n#include <netlistmgr.h>\n#include <Psapi.h>\n#include <stdbool.h>\n#include \"Localization.h\"\n\n#include \"def.h\"\n\n#define WM_MSG_GUI_SECTION WM_USER + 1\n#define WM_MSG_GUI_SECTION_GET 1\n\n#ifdef __cplusplus\n#define EP_INLINE inline\n#else\n#define EP_INLINE\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nDEFINE_GUID(CLSID_ImmersiveShell,\n    0xc2f03a33,\n    0x21f5, 0x47fa, 0xb4, 0xbb,\n    0x15, 0x63, 0x62, 0xa2, 0xf2, 0x39\n);\n\nDEFINE_GUID(IID_OpenControlPanel,\n    0xD11AD862,\n    0x66De, 0x4DF4, 0xBf, 0x6C,\n    0x1F, 0x56, 0x21, 0x99, 0x6A, 0xF1\n);\n\nDEFINE_GUID(CLSID_VBScript,\n    0xB54F3741, \n    0x5B07, 0x11CF, 0xA4, 0xB0, \n    0x00, 0xAA, 0x00, 0x4A, 0x55, 0xE8\n);\n\nDEFINE_GUID(CLSID_NetworkListManager,\n    0xDCB00C01, 0x570F, 0x4A9B, 0x8D, 0x69, 0x19, 0x9F, 0xDB, 0xA5, 0x72, 0x3B);\n\nDEFINE_GUID(IID_NetworkListManager,\n    0xDCB00000, 0x570F, 0x4A9B, 0x8D, 0x69, 0x19, 0x9F, 0xDB, 0xA5, 0x72, 0x3B);\n\ntypedef struct _StuckRectsData\n{\n    int pvData[6];\n    RECT rc;\n    POINT pt;\n} StuckRectsData;\n\nHRESULT FindDesktopFolderView(REFIID riid, void** ppv);\n\nHRESULT GetDesktopAutomationObject(REFIID riid, void** ppv);\n\nHRESULT ShellExecuteFromExplorer(\n    PCWSTR pszFile,\n    PCWSTR pszParameters,\n    PCWSTR pszDirectory,\n    PCWSTR pszOperation,\n    int nShowCmd\n);\n\nvoid ToggleTaskbarAutohide();\n\n#pragma region \"Enable old taskbar\"\ntypedef interface ITrayUIHost ITrayUIHost;\n\ntypedef interface ITrayUI ITrayUI;\n\nDEFINE_GUID(IID_ITrayUI,\n    0x12b454e1,\n    0x6e50, 0x42b8, 0xbc, 0x3e,\n    0xae, 0x7f, 0x54, 0x91, 0x99, 0xd6\n);\n\nDEFINE_GUID(IID_ITrayUIComponent,\n    0x27775f88,\n    0x01d3, 0x46ec, 0xa1, 0xc1,\n    0x64, 0xb4, 0xc0, 0x9b, 0x21, 0x1b\n);\n\ntypedef HRESULT(*TrayUI_CreateInstance_t)(ITrayUIHost* host, REFIID riid, void** ppv);\nEP_INLINE TrayUI_CreateInstance_t explorer_TrayUI_CreateInstanceFunc;\n#pragma endregion\n\ninline int FileExistsW(wchar_t* file)\n{\n    WIN32_FIND_DATAW FindFileData;\n    HANDLE handle = FindFirstFileW(file, &FindFileData);\n    int found = handle != INVALID_HANDLE_VALUE;\n    if (found)\n    {\n        FindClose(handle);\n    }\n    return found;\n}\n\n// https://stackoverflow.com/questions/1672677/print-a-guid-variable\nvoid printf_guid(GUID guid);\n\n#ifdef _DEBUG\nLRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\n\n__declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n\n__declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n#endif\n\n#ifndef EP_BUILD_SETUP\n__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n\n__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n\n__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n#endif\n\n#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))\n#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))\n\ntypedef LSTATUS(*t_SHRegGetValueFromHKCUHKLM)(\n    PCWSTR pwszKey,\n    PCWSTR pwszValue,\n    int/*SRRF*/ srrfFlags,\n    DWORD* pdwType,\n    void* pvData,\n    DWORD* pcbData\n);\nEP_INLINE t_SHRegGetValueFromHKCUHKLM SHRegGetValueFromHKCUHKLMFunc;\n\ninline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(\n    PCWSTR pwszKey,\n    PCWSTR pwszValue,\n    REGSAM samDesired,\n    void* pvData,\n    DWORD* pcbData\n)\n{\n    LSTATUS lRes = ERROR_FILE_NOT_FOUND;\n    HKEY hKey = NULL;\n\n    RegOpenKeyExW(\n        HKEY_CURRENT_USER,\n        pwszKey,\n        0,\n        samDesired,\n        &hKey\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        lRes = RegQueryValueExW(\n            hKey,\n            pwszValue,\n            0,\n            NULL,\n            (LPBYTE)pvData,\n            pcbData\n        );\n        RegCloseKey(hKey);\n        if (lRes == ERROR_SUCCESS || lRes == ERROR_MORE_DATA)\n        {\n            return lRes;\n        }\n    }\n    RegOpenKeyExW(\n        HKEY_LOCAL_MACHINE,\n        pwszKey,\n        0,\n        samDesired,\n        &hKey\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    if (hKey)\n    {\n        lRes = RegQueryValueExW(\n            hKey,\n            pwszValue,\n            0,\n            NULL,\n            (LPBYTE)pvData,\n            pcbData\n        );\n        RegCloseKey(hKey);\n        if (lRes == ERROR_SUCCESS || lRes == ERROR_MORE_DATA)\n        {\n            return lRes;\n        }\n    }\n    return lRes;\n}\n\nEP_INLINE HWND(WINAPI* CreateWindowInBand)(\n    _In_ DWORD dwExStyle,\n    _In_opt_ LPCWSTR lpClassName,\n    _In_opt_ LPCWSTR lpWindowName,\n    _In_ DWORD dwStyle,\n    _In_ int X,\n    _In_ int Y,\n    _In_ int nWidth,\n    _In_ int nHeight,\n    _In_opt_ HWND hWndParent,\n    _In_opt_ HMENU hMenu,\n    _In_opt_ HINSTANCE hInstance,\n    _In_opt_ LPVOID lpParam,\n    DWORD band\n);\n\nEP_INLINE BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand);\n\nEP_INLINE BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand);\n\nEP_INLINE INT64(*SetWindowCompositionAttribute)(HWND, void*);\n\n// uxtheme.dll private functions\n\ntypedef enum IMMERSIVE_COLOR_TYPE\n{\n    // Defining only used ones\n    IMCLR_SystemAccentLight2 = 2,\n    IMCLR_SystemAccentDark2 = 6\n} IMMERSIVE_COLOR_TYPE;\n\ntypedef struct IMMERSIVE_COLOR_PREFERENCE\n{\n    DWORD crStartColor;\n    DWORD crAccentColor;\n} IMMERSIVE_COLOR_PREFERENCE;\n\ntypedef enum IMMERSIVE_HC_CACHE_MODE\n{\n    IHCM_USE_CACHED_VALUE = 0,\n    IHCM_REFRESH = 1\n} IMMERSIVE_HC_CACHE_MODE;\n\ntypedef void(*GetThemeName_t)(void*, void*, void*); // 74\nEP_INLINE GetThemeName_t GetThemeName;\n\ntypedef bool(*RefreshImmersiveColorPolicyState_t)(); // 104\nEP_INLINE RefreshImmersiveColorPolicyState_t RefreshImmersiveColorPolicyState;\n\ntypedef bool(*GetIsImmersiveColorUsingHighContrast_t)(IMMERSIVE_HC_CACHE_MODE); // 106\nEP_INLINE GetIsImmersiveColorUsingHighContrast_t GetIsImmersiveColorUsingHighContrast;\n\ntypedef HRESULT(*GetUserColorPreference_t)(IMMERSIVE_COLOR_PREFERENCE*, bool); // 120\nEP_INLINE GetUserColorPreference_t GetUserColorPreference;\n\ntypedef DWORD(*GetColorFromPreference_t)(const IMMERSIVE_COLOR_PREFERENCE*, IMMERSIVE_COLOR_TYPE, bool, IMMERSIVE_HC_CACHE_MODE); // 121\nEP_INLINE GetColorFromPreference_t GetColorFromPreference;\n\ntypedef bool(*ShouldAppsUseDarkMode_t)(); // 132\nEP_INLINE ShouldAppsUseDarkMode_t ShouldAppsUseDarkMode;\n\ntypedef void(*AllowDarkModeForWindow_t)(HWND hWnd, BOOL bAllowDark); // 133\nEP_INLINE AllowDarkModeForWindow_t AllowDarkModeForWindow;\n\ntypedef void(*SetPreferredAppMode_t)(BOOL bAllowDark); // 135\nEP_INLINE SetPreferredAppMode_t SetPreferredAppMode;\n\ntypedef bool(*ShouldSystemUseDarkMode_t)(); // 138\nEP_INLINE ShouldSystemUseDarkMode_t ShouldSystemUseDarkMode;\n\nvoid* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize);\n\nint ComputeFileHash(LPCWSTR filename, LPSTR hash, DWORD dwHash);\n\nint ComputeFileHash2(HMODULE hModule, LPCWSTR filename, LPSTR hash, DWORD dwHash);\n\nvoid GetHardcodedHash(LPCWSTR wszPath, LPSTR hash, DWORD dwHash);\n\nvoid LaunchPropertiesGUI(HMODULE hModule);\n\nBOOL SystemShutdown(BOOL reboot);\n\nLSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride);\n\nchar* StrReplaceAllA(const char* s, const char* oldW, const char* newW, int* dwNewSize);\n\nWCHAR* StrReplaceAllW(const WCHAR* s, const WCHAR* oldW, const WCHAR* newW, int* dwNewSize);\n\nHRESULT InputBox(BOOL bPassword, HWND hWnd, LPCWSTR wszPrompt, LPCWSTR wszTitle, LPCWSTR wszDefault, LPWSTR wszAnswer, DWORD cbAnswer, BOOL* bCancelled);\n\nBOOL GetLogonSid(PSID* ppsid);\n\nBOOL PrepareSecurityDescriptor(PSID pMainSid, DWORD dwMainPermissions, PSID pSecondarySid, DWORD dwSecondayPermissions, PSECURITY_DESCRIPTOR* ppSD);\n\ninline BOOL IsHighContrast()\n{\n    HIGHCONTRASTW highContrast;\n    ZeroMemory(&highContrast, sizeof(HIGHCONTRASTW));\n    highContrast.cbSize = sizeof(highContrast);\n    if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))\n        return highContrast.dwFlags & HCF_HIGHCONTRASTON;\n    return FALSE;\n}\n\n// https://codereview.stackexchange.com/questions/29198/random-string-generator-in-c\nstatic inline WCHAR* rand_string(WCHAR* str, size_t size)\n{\n    const WCHAR charset[] = L\"abcdefghijklmnopqrstuvwxyz\";\n    if (size) {\n        --size;\n        for (size_t n = 0; n < size; n++) {\n            int key = rand() % (int)((sizeof(charset) / sizeof(WCHAR)) - 1);\n            str[n] = charset[key];\n        }\n        str[size] = L'\\0';\n    }\n    return str;\n}\n\ninline long long milliseconds_now() {\n    LARGE_INTEGER s_frequency;\n    BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency);\n    if (s_use_qpc) {\n        LARGE_INTEGER now;\n        QueryPerformanceCounter(&now);\n        return (1000LL * now.QuadPart) / s_frequency.QuadPart;\n    }\n    else {\n        return GetTickCount();\n    }\n}\n\ninline BOOL IsAppRunningAsAdminMode()\n{\n    BOOL fIsRunAsAdmin = FALSE;\n    DWORD dwError = ERROR_SUCCESS;\n    PSID pAdministratorsGroup = NULL;\n\n    // Allocate and initialize a SID of the administrators group.\n    SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;\n    if (!AllocateAndInitializeSid(\n        &NtAuthority,\n        2,\n        SECURITY_BUILTIN_DOMAIN_RID,\n        DOMAIN_ALIAS_RID_ADMINS,\n        0, 0, 0, 0, 0, 0,\n        &pAdministratorsGroup))\n    {\n        dwError = GetLastError();\n        goto Cleanup;\n    }\n\n    // Determine whether the SID of administrators group is enabled in \n    // the primary access token of the process.\n    if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))\n    {\n        dwError = GetLastError();\n        goto Cleanup;\n    }\n\nCleanup:\n    // Centralized cleanup for all allocated resources.\n    if (pAdministratorsGroup)\n    {\n        FreeSid(pAdministratorsGroup);\n        pAdministratorsGroup = NULL;\n    }\n\n    // Throw the error if something failed in the function.\n    if (ERROR_SUCCESS != dwError)\n    {\n        return FALSE;\n    }\n\n    return fIsRunAsAdmin;\n}\n\ninline BOOL IsDesktopWindowAlreadyPresent()\n{\n    return (FindWindowExW(NULL, NULL, L\"Progman\", NULL) || FindWindowExW(NULL, NULL, L\"Proxy Desktop\", NULL));\n}\n\n// https://jiangsheng.net/2013/01/22/how-to-restart-windows-explorer-programmatically-using-restart-manager/\ninline RM_UNIQUE_PROCESS GetExplorerApplication()\n{\n    HWND hwnd = FindWindow(L\"Shell_TrayWnd\", NULL);\n    DWORD pid = 0;\n    GetWindowThreadProcessId(hwnd, &pid);\n\n    RM_UNIQUE_PROCESS out = { 0, { (DWORD)-1, (DWORD)-1 } };\n    DWORD bytesReturned;\n    WCHAR imageName[MAX_PATH]; // process image name buffer\n    DWORD processIds[2048]; // max 2048 processes (more than enough)\n\n    // enumerate all running processes (usually around 60-70)\n    EnumProcesses(processIds, sizeof(processIds), &bytesReturned);\n    int count = bytesReturned / sizeof(DWORD); // number of processIds returned\n\n    for (int i = 0; i < count; ++i)\n    {\n        DWORD processId = processIds[i];\n        HANDLE hProc;\n        if (processId == pid && (hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processId)))\n        {\n            GetProcessImageFileNameW(hProc, imageName, MAX_PATH);\n            FILETIME ftStart, ftExit, ftKernel, ftUser;\n            GetProcessTimes(hProc, &ftStart, &ftExit, &ftKernel, &ftUser);\n\n            if (ftStart.dwLowDateTime < out.ProcessStartTime.dwLowDateTime)\n            {\n                out.dwProcessId = processId;\n                out.ProcessStartTime = ftStart;\n            }\n            CloseHandle(hProc);\n        }\n    }\n    return out; // return count in pResults\n}\n\nstatic DWORD RmSession = -1;\nstatic wchar_t RmSessionKey[CCH_RM_SESSION_KEY + 1];\n\n// shuts down the explorer and is ready for explorer restart\ninline DWORD WINAPI BeginExplorerRestart(LPVOID lpUnused)\n{\n    if (RmStartSession(&RmSession, 0, RmSessionKey) == ERROR_SUCCESS)\n    {\n        RM_UNIQUE_PROCESS rgApplications[] = { GetExplorerApplication() };\n        RmRegisterResources(RmSession, 0, 0, 1, rgApplications, 0, 0);\n\n        DWORD rebootReason;\n        UINT nProcInfoNeeded, nProcInfo = 16;\n        RM_PROCESS_INFO affectedApps[16];\n        RmGetList(RmSession, &nProcInfoNeeded, &nProcInfo, affectedApps, &rebootReason);\n\n        if (rebootReason == RmRebootReasonNone) // no need for reboot?\n        {\n            // shutdown explorer\n            RmShutdown(RmSession, RmForceShutdown, 0);\n        }\n    }\n    return 0;\n}\n// restarts the explorer\ninline void FinishExplorerRestart()\n{\n    DWORD dwError;\n    if (dwError = RmRestart(RmSession, 0, NULL))\n        printf(\"\\n RmRestart error: %d\\n\\n\", dwError);\n\n    RmEndSession(RmSession);\n    RmSession = -1;\n    RmSessionKey[0] = 0;\n}\n\n// https://stackoverflow.com/questions/5689904/gracefully-exit-explorer-programmatically\ninline BOOL ExitExplorer()\n{\n    HWND hWndTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n    return PostMessageW(hWndTray, 0x5B4, 0, 0);\n}\n\ninline void StartExplorerWithDelay(int delay, HANDLE userToken)\n{\n    WCHAR wszPath[MAX_PATH];\n    ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\n    GetWindowsDirectoryW(wszPath, MAX_PATH);\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\explorer.exe\");\n    Sleep(delay);\n    if (userToken != INVALID_HANDLE_VALUE)\n    {\n        HANDLE primaryUserToken = INVALID_HANDLE_VALUE;\n        if (ImpersonateLoggedOnUser(userToken))\n        {\n            DuplicateTokenEx(userToken, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenPrimary, &primaryUserToken);\n            RevertToSelf();\n        }\n        if (primaryUserToken != INVALID_HANDLE_VALUE)\n        {\n            PROCESS_INFORMATION processInfo;\n            ZeroMemory(&processInfo, sizeof(processInfo));\n            STARTUPINFOW startupInfo;\n            ZeroMemory(&startupInfo, sizeof(startupInfo));\n            startupInfo.cb = sizeof(startupInfo);\n            BOOL processCreated = CreateProcessWithTokenW(\n                primaryUserToken, LOGON_WITH_PROFILE, wszPath, NULL, 0, NULL, NULL, &startupInfo, &processInfo) != 0;\n            CloseHandle(primaryUserToken);\n            if (processInfo.hProcess != INVALID_HANDLE_VALUE)\n            {\n                CloseHandle(processInfo.hProcess);\n            }\n            if (processInfo.hThread != INVALID_HANDLE_VALUE)\n            {\n                CloseHandle(processInfo.hThread);\n            }\n            if (processCreated)\n            {\n                return;\n            }\n        }\n    }\n    ShellExecuteW(\n        NULL,\n        L\"open\",\n        wszPath,\n        NULL,\n        NULL,\n        SW_SHOWNORMAL\n    );\n}\n\ninline void StartExplorer()\n{\n\n    /*PROCESSENTRY32 pe32 = {0};\n    pe32.dwSize = sizeof(PROCESSENTRY32);\n    HANDLE hSnapshot = CreateToolhelp32Snapshot(\n        TH32CS_SNAPPROCESS,\n        0\n    );\n    if (Process32First(hSnapshot, &pe32) == TRUE)\n    {\n        do\n        {\n            if (!wcscmp(pe32.szExeFile, TEXT(\"explorer.exe\")))\n            {\n                HANDLE hSihost = OpenProcess(\n                    PROCESS_TERMINATE,\n                    FALSE,\n                    pe32.th32ProcessID\n                );\n                TerminateProcess(hSihost, 1);\n                CloseHandle(hSihost);\n            }\n        } while (Process32Next(hSnapshot, &pe32) == TRUE);\n    }\n    CloseHandle(hSnapshot);\n    */\n    wchar_t wszPath[MAX_PATH];\n    ZeroMemory(\n        wszPath,\n        (MAX_PATH) * sizeof(wchar_t)\n    );\n    GetWindowsDirectoryW(\n        wszPath,\n        MAX_PATH\n    );\n    wcscat_s(\n        wszPath,\n        MAX_PATH,\n        L\"\\\\explorer.exe\"\n    );\n    STARTUPINFO si;\n    ZeroMemory(&si, sizeof(STARTUPINFO));\n    si.cb = sizeof(si);\n    PROCESS_INFORMATION pi;\n    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));\n    if (CreateProcessW(\n        NULL,\n        wszPath,\n        NULL,\n        NULL,\n        TRUE,\n        CREATE_UNICODE_ENVIRONMENT,\n        NULL,\n        NULL,\n        &si,\n        &pi\n    ))\n    {\n        CloseHandle(pi.hThread);\n        CloseHandle(pi.hProcess);\n    }\n}\n\ninline BOOL IncrementDLLReferenceCount(HINSTANCE hinst)\n{\n    HMODULE hMod;\n    GetModuleHandleExW(\n        GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,\n        (LPCWSTR)hinst,\n        &hMod);\n    return TRUE;\n}\n\nUINT_PTR RVAToFileOffset(PBYTE pBase, UINT_PTR rva);\n\ninline BOOL SectionBeginAndSizeEx64(\n    const IMAGE_DOS_HEADER* dosHeader, const IMAGE_NT_HEADERS64* ntHeader, const char* pszSectionName,\n    PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n    PIMAGE_SECTION_HEADER firstSection = IMAGE_FIRST_SECTION(ntHeader);\n    for (unsigned int i = 0; i < ntHeader->FileHeader.NumberOfSections; ++i)\n    {\n        PIMAGE_SECTION_HEADER section = firstSection + i;\n        if (strncmp((const char*)section->Name, pszSectionName, IMAGE_SIZEOF_SHORT_NAME) == 0)\n        {\n            *beginSection = (PBYTE)dosHeader + section->VirtualAddress;\n            *sizeSection = section->Misc.VirtualSize;\n            return TRUE;\n        }\n    }\n\n    return FALSE;\n}\n\ninline BOOL SectionBeginAndSizePEFileEx64(\n    const IMAGE_DOS_HEADER* dosHeader, const IMAGE_NT_HEADERS64* ntHeader, const char* pszSectionName,\n    PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n    PIMAGE_SECTION_HEADER firstSection = IMAGE_FIRST_SECTION(ntHeader);\n    for (unsigned int i = 0; i < ntHeader->FileHeader.NumberOfSections; ++i)\n    {\n        PIMAGE_SECTION_HEADER section = firstSection + i;\n        if (strncmp((const char*)section->Name, pszSectionName, IMAGE_SIZEOF_SHORT_NAME) == 0)\n        {\n            *beginSection = (PBYTE)dosHeader + section->PointerToRawData;\n            *sizeSection = section->SizeOfRawData;\n            return TRUE;\n        }\n    }\n\n    return FALSE;\n}\n\ninline BOOL SectionBeginAndSize(HMODULE hModule, const char* pszSectionName, PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hModule;\n    if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n    {\n        PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)((BYTE*)dosHeader + dosHeader->e_lfanew);\n        if (ntHeader->Signature == IMAGE_NT_SIGNATURE && ntHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)\n        {\n            return SectionBeginAndSizeEx64(dosHeader, ntHeader, pszSectionName, beginSection, sizeSection);\n        }\n    }\n\n    return FALSE;\n}\n\ninline BOOL SectionBeginAndSizePEFile(\n    PBYTE pFileBase, DWORD fileSize, const char* pszSectionName, PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)pFileBase;\n    if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n    {\n        PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)(pFileBase + dosHeader->e_lfanew);\n        if (ntHeader->Signature == IMAGE_NT_SIGNATURE && ntHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)\n        {\n            return SectionBeginAndSizePEFileEx64(dosHeader, ntHeader, pszSectionName, beginSection, sizeSection);\n        }\n    }\n\n    return FALSE;\n}\n\ntypedef struct _EP_IMAGE_CHPE_RANGE_ENTRY\n{\n    union\n    {\n        ULONG StartOffset;\n        struct\n        {\n            ULONG NativeCode : 1;\n            ULONG AddressBits : 31;\n        } DUMMYSTRUCTNAME;\n    } DUMMYUNIONNAME;\n    ULONG Length;\n} EP_IMAGE_CHPE_RANGE_ENTRY, *PEP_IMAGE_CHPE_RANGE_ENTRY;\n\ntypedef struct _EP_IMAGE_ARM64EC_METADATA\n{\n    ULONG  Version;\n    ULONG  CodeMap;\n    ULONG  CodeMapCount;\n    ULONG  CodeRangesToEntryPoints;\n    ULONG  RedirectionMetadata;\n    ULONG  __os_arm64x_dispatch_call_no_redirect;\n    ULONG  __os_arm64x_dispatch_ret;\n    ULONG  __os_arm64x_dispatch_call;\n    ULONG  __os_arm64x_dispatch_icall;\n    ULONG  __os_arm64x_dispatch_icall_cfg;\n    ULONG  AlternateEntryPoint;\n    ULONG  AuxiliaryIAT;\n    ULONG  CodeRangesToEntryPointsCount;\n    ULONG  RedirectionMetadataCount;\n    ULONG  GetX64InformationFunctionPointer;\n    ULONG  SetX64InformationFunctionPointer;\n    ULONG  ExtraRFETable;\n    ULONG  ExtraRFETableSize;\n    ULONG  __os_arm64x_dispatch_fptr;\n    ULONG  AuxiliaryIATCopy;\n} EP_IMAGE_ARM64EC_METADATA;\n\n// https://github.com/ramensoftware/windhawk/blob/03963d65e7077b761e5295defc2ccd5378e650a2/src/windhawk/engine/symbol_enum.cpp#L251\ninline BOOL GetChpeRanges64(\n    const IMAGE_DOS_HEADER* dosHeader, const IMAGE_NT_HEADERS64* ntHeader,\n    const EP_IMAGE_CHPE_RANGE_ENTRY** prgRanges, ULONG* pcRanges)\n{\n    *prgRanges = NULL;\n    *pcRanges = 0;\n    const IMAGE_OPTIONAL_HEADER64* opt = &ntHeader->OptionalHeader;\n\n    if (opt->NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG\n        || !opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].VirtualAddress)\n    {\n        return FALSE;\n    }\n\n    DWORD directorySize = opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].Size;\n\n    const IMAGE_LOAD_CONFIG_DIRECTORY64* cfg = (const IMAGE_LOAD_CONFIG_DIRECTORY64*)(\n        (const char*)dosHeader + opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].VirtualAddress);\n\n    const DWORD kMinSize = offsetof(IMAGE_LOAD_CONFIG_DIRECTORY64, CHPEMetadataPointer)\n        + sizeof(ULONGLONG);\n\n    if (directorySize < kMinSize || cfg->Size < kMinSize)\n    {\n        return FALSE;\n    }\n\n    if (!cfg->CHPEMetadataPointer)\n    {\n        return FALSE;\n    }\n\n    // Either IMAGE_CHPE_METADATA_X86 or EP_IMAGE_ARM64EC_METADATA.\n    const EP_IMAGE_ARM64EC_METADATA* metadata = (const EP_IMAGE_ARM64EC_METADATA*)(\n        (const char*)dosHeader + cfg->CHPEMetadataPointer - opt->ImageBase);\n\n    const EP_IMAGE_CHPE_RANGE_ENTRY* codeMap = (const EP_IMAGE_CHPE_RANGE_ENTRY*)(\n        (const char*)dosHeader + metadata->CodeMap);\n\n    *prgRanges = codeMap;\n    *pcRanges = metadata->CodeMapCount;\n    return TRUE;\n}\n\ninline BOOL GetChpeRangesPEFile64(\n    DWORD fileSize,\n    const IMAGE_DOS_HEADER* dosHeader, const IMAGE_NT_HEADERS64* ntHeader,\n    const EP_IMAGE_CHPE_RANGE_ENTRY** prgRanges, ULONG* pcRanges)\n{\n    *prgRanges = NULL;\n    *pcRanges = 0;\n    const IMAGE_OPTIONAL_HEADER64* opt = &ntHeader->OptionalHeader;\n\n    if (opt->NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG\n        || !opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].VirtualAddress)\n    {\n        return FALSE;\n    }\n\n    DWORD directorySize = opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].Size;\n\n    UINT_PTR directoryOffset = RVAToFileOffset((PBYTE)dosHeader, opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].VirtualAddress);\n    if (!directoryOffset || directoryOffset + sizeof(IMAGE_LOAD_CONFIG_DIRECTORY64) > fileSize)\n    {\n        return FALSE;\n    }\n\n    const IMAGE_LOAD_CONFIG_DIRECTORY64* cfg = (const IMAGE_LOAD_CONFIG_DIRECTORY64*)(\n        (const char*)dosHeader + directoryOffset);\n\n    const DWORD kMinSize = offsetof(IMAGE_LOAD_CONFIG_DIRECTORY64, CHPEMetadataPointer)\n        + sizeof(ULONGLONG);\n\n    if (directorySize < kMinSize || cfg->Size < kMinSize)\n    {\n        return FALSE;\n    }\n\n    if (!cfg->CHPEMetadataPointer)\n    {\n        return FALSE;\n    }\n\n    UINT_PTR metadataOffset = RVAToFileOffset((PBYTE)dosHeader, cfg->CHPEMetadataPointer - opt->ImageBase);\n    if (!metadataOffset || metadataOffset + sizeof(EP_IMAGE_ARM64EC_METADATA) > fileSize)\n    {\n        return FALSE;\n    }\n\n    // Either IMAGE_CHPE_METADATA_X86 or EP_IMAGE_ARM64EC_METADATA.\n    const EP_IMAGE_ARM64EC_METADATA* metadata = (const EP_IMAGE_ARM64EC_METADATA*)(\n        (const char*)dosHeader + metadataOffset);\n\n    UINT_PTR codeMapOffset = RVAToFileOffset((PBYTE)dosHeader, metadata->CodeMap);\n    if (!codeMapOffset || codeMapOffset + sizeof(EP_IMAGE_CHPE_RANGE_ENTRY) * metadata->CodeMapCount > fileSize)\n    {\n        return FALSE;\n    }\n\n    const EP_IMAGE_CHPE_RANGE_ENTRY* codeMap = (const EP_IMAGE_CHPE_RANGE_ENTRY*)(\n        (const char*)dosHeader + codeMapOffset);\n\n    *prgRanges = codeMap;\n    *pcRanges = metadata->CodeMapCount;\n    return TRUE;\n}\n\ntypedef enum _EP_ChpeCodeRangeType\n{\n    CODERANGE_Arm64,\n    CODERANGE_Arm64EC,\n    CODERANGE_Amd64,\n} EP_ChpeCodeRangeType;\n\n#if defined(_M_ARM64) || defined(_M_ARM64EC)\ninline BOOL TextSectionBeginAndSize(HMODULE hModule, PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n#if defined(_M_ARM64)\n    const EP_ChpeCodeRangeType appropriateCodeRangeType = CODERANGE_Arm64;\n#elif defined(_M_ARM64EC)\n    const EP_ChpeCodeRangeType appropriateCodeRangeType = CODERANGE_Arm64EC;\n#endif\n\n    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)hModule;\n    if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n    {\n        PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)((BYTE*)dosHeader + dosHeader->e_lfanew);\n        if (ntHeader->Signature == IMAGE_NT_SIGNATURE && ntHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)\n        {\n            if (!SectionBeginAndSizeEx64(dosHeader, ntHeader, \".text\", beginSection, sizeSection))\n                return FALSE;\n\n            // Narrow down the results to the appropriate code range on Arm64X binaries\n            const EP_IMAGE_CHPE_RANGE_ENTRY* rgRanges;\n            ULONG cRanges;\n            if (GetChpeRanges64(dosHeader, ntHeader, &rgRanges, &cRanges))\n            {\n                const EP_IMAGE_CHPE_RANGE_ENTRY* pLast = rgRanges + cRanges;\n                for (const EP_IMAGE_CHPE_RANGE_ENTRY* pCurrent = rgRanges; pCurrent < pLast; ++pCurrent)\n                {\n                    const ULONG typeMask = 3; // 1 for 32 bit\n                    ULONG start = pCurrent->StartOffset & ~typeMask; // RVA\n                    EP_ChpeCodeRangeType type = (EP_ChpeCodeRangeType)(pCurrent->StartOffset & typeMask);\n                    if (type == appropriateCodeRangeType)\n                    {\n                        *beginSection = (PBYTE)hModule + start;\n                        *sizeSection = pCurrent->Length;\n                        break;\n                    }\n                }\n            }\n\n            return TRUE;\n        }\n    }\n\n    return FALSE;\n}\n\ninline BOOL TextSectionBeginAndSizePEFile(PBYTE pFileBase, DWORD fileSize, PBYTE* beginSection, DWORD* sizeSection)\n{\n    *beginSection = NULL;\n    *sizeSection = 0;\n\n#if defined(_M_ARM64)\n    const EP_ChpeCodeRangeType appropriateCodeRangeType = CODERANGE_Arm64;\n#elif defined(_M_ARM64EC)\n    const EP_ChpeCodeRangeType appropriateCodeRangeType = CODERANGE_Arm64EC;\n#endif\n\n    PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)pFileBase;\n    if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE)\n    {\n        PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)(pFileBase + dosHeader->e_lfanew);\n        if (ntHeader->Signature == IMAGE_NT_SIGNATURE && ntHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)\n        {\n            if (!SectionBeginAndSizePEFileEx64(dosHeader, ntHeader, \".text\", beginSection, sizeSection))\n                return FALSE;\n\n            // Narrow down the results to the appropriate code range on Arm64X binaries\n            const EP_IMAGE_CHPE_RANGE_ENTRY* rgRanges;\n            ULONG cRanges;\n            if (GetChpeRangesPEFile64(fileSize, dosHeader, ntHeader, &rgRanges, &cRanges))\n            {\n                const EP_IMAGE_CHPE_RANGE_ENTRY* pLast = rgRanges + cRanges;\n                for (const EP_IMAGE_CHPE_RANGE_ENTRY* pCurrent = rgRanges; pCurrent < pLast; ++pCurrent)\n                {\n                    const ULONG typeMask = 3; // 1 for 32 bit\n                    ULONG start = pCurrent->StartOffset & ~typeMask; // RVA\n                    EP_ChpeCodeRangeType type = (EP_ChpeCodeRangeType)(pCurrent->StartOffset & typeMask);\n                    if (type == appropriateCodeRangeType)\n                    {\n                        UINT_PTR offset = RVAToFileOffset(pFileBase, start);\n                        if (offset && offset + pCurrent->Length <= fileSize)\n                        {\n                            *beginSection = (PBYTE)pFileBase + offset;\n                            *sizeSection = pCurrent->Length;\n                            break;\n                        }\n                    }\n                }\n            }\n\n            return TRUE;\n        }\n    }\n\n    return FALSE;\n}\n#else\n__forceinline BOOL TextSectionBeginAndSize(HMODULE hModule, PBYTE* beginSection, DWORD* sizeSection)\n{\n    return SectionBeginAndSize(hModule, \".text\", beginSection, sizeSection);\n}\n\n__forceinline BOOL TextSectionBeginAndSizePEFile(PBYTE pFileBase, DWORD fileSize, PBYTE* beginSection, DWORD* sizeSection)\n{\n    return SectionBeginAndSizePEFile(pFileBase, fileSize, \".text\", beginSection, sizeSection);\n}\n#endif\n\n__forceinline BOOL RDataSectionBeginAndSize(HMODULE hModule, PBYTE* beginSection, DWORD* sizeSection)\n{\n    return SectionBeginAndSize(hModule, \".rdata\", beginSection, sizeSection);\n}\n\n__forceinline BOOL RDataSectionBeginAndSizePEFile(PBYTE pFileBase, DWORD fileSize, PBYTE* beginSection, DWORD* sizeSection)\n{\n    return SectionBeginAndSizePEFile(pFileBase, fileSize, \".rdata\", beginSection, sizeSection);\n}\n\nPVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);\n\n#if _M_X64\ninline BOOL FollowJump(PBYTE pInstr, BYTE shortOpcode, BYTE longOpcodeExt, DWORD* pInstrSize, PBYTE* pTarget)\n{\n    // Check long\n    if (pInstr[0] == 0x0F && pInstr[1] == longOpcodeExt)\n    {\n        *pTarget = pInstr + 6 + *(int*)(pInstr + 2);\n        *pInstrSize = 6;\n        return TRUE;\n    }\n    // Check short\n    if (pInstr[0] == shortOpcode)\n    {\n        *pTarget = pInstr + 2 + *(char*)(pInstr + 1);\n        *pInstrSize = 2;\n        return TRUE;\n    }\n    return FALSE;\n}\n\ninline BOOL FollowJnz(PBYTE pInstr, PBYTE* pTarget, DWORD* pInstrSize)\n{\n    return FollowJump(pInstr, 0x75, 0x85, pInstrSize, pTarget);\n}\n\ninline BOOL FollowJz(PBYTE pInstr, PBYTE* pTarget, DWORD* pInstrSize)\n{\n    return FollowJump(pInstr, 0x74, 0x84, pInstrSize, pTarget);\n}\n#endif\n\n#if _M_ARM64\n// https://github.com/CAS-Atlantic/AArch64-Encoding\n\n__forceinline DWORD ARM64_ReadBits(DWORD value, int h, int l)\n{\n    return (value >> l) & ((1 << (h - l + 1)) - 1);\n}\n\n__forceinline int ARM64_SignExtend(DWORD value, int numBits)\n{\n    DWORD mask = 1 << (numBits - 1);\n    if (value & mask)\n        value |= ~((1 << numBits) - 1);\n    return (int)value;\n}\n\n__forceinline int ARM64_ReadBitsSignExtend(DWORD insn, int h, int l)\n{\n    return ARM64_SignExtend(ARM64_ReadBits(insn, h, l), h - l + 1);\n}\n\n__forceinline BOOL ARM64_IsInRange(int value, int bitCount)\n{\n    int minVal = -(1 << (bitCount - 1));\n    int maxVal = (1 << (bitCount - 1)) - 1;\n    return value >= minVal && value <= maxVal;\n}\n\n__forceinline UINT_PTR ARM64_Align(UINT_PTR value, UINT_PTR alignment)\n{\n    return value & ~(alignment - 1);\n}\n\n__forceinline BOOL ARM64_IsCBZW(DWORD insn) { return ARM64_ReadBits(insn, 31, 24) == 0b00110100; }\n__forceinline BOOL ARM64_IsCBNZW(DWORD insn) { return ARM64_ReadBits(insn, 31, 24) == 0b00110101; }\n__forceinline BOOL ARM64_IsTBZ(DWORD insn) { return ARM64_ReadBits(insn, 31, 24) == 0b00110110; }\n__forceinline BOOL ARM64_IsTBNZ(DWORD insn) { return ARM64_ReadBits(insn, 31, 24) == 0b00110111; }\n__forceinline BOOL ARM64_IsBL(DWORD insn) { return ARM64_ReadBits(insn, 31, 26) == 0b100101; }\n__forceinline BOOL ARM64_IsADRP(DWORD insn) { return (ARM64_ReadBits(insn, 31, 24) & ~0b01100000) == 0b10010000; }\n__forceinline BOOL ARM64_IsMOVZW(DWORD insn) { return ARM64_ReadBits(insn, 31, 23) == 0b010100101; }\n__forceinline BOOL ARM64_IsSTRBIMM(DWORD insn) { return ARM64_ReadBits(insn, 31, 22) == 0b0011100100; }\n\n__forceinline DWORD* ARM64_FollowCBNZW(DWORD* pInsnCBNZW)\n{\n    DWORD insnCBNZW = *pInsnCBNZW;\n    if (!ARM64_IsCBNZW(insnCBNZW))\n        return NULL;\n    int imm19 = ARM64_ReadBitsSignExtend(insnCBNZW, 23, 5);\n    return pInsnCBNZW + imm19; // offset = imm19 * 4\n}\n\n__forceinline DWORD* ARM64_FollowBL(DWORD* pInsnBL)\n{\n    DWORD insnBL = *pInsnBL;\n    if (!ARM64_IsBL(insnBL))\n        return NULL;\n    int imm26 = ARM64_ReadBitsSignExtend(insnBL, 25, 0);\n    return pInsnBL + imm26; // offset = imm26 * 4\n}\n\n__forceinline DWORD ARM64_MakeB(int imm26)\n{\n    if (!ARM64_IsInRange(imm26, 26))\n        return 0;\n    return 0b000101 << 26 | imm26 & (1 << 26) - 1;\n}\n\n__forceinline DWORD ARM64_MakeBL(int imm26)\n{\n    if (!ARM64_IsInRange(imm26, 26))\n        return 0;\n    return 0b100101 << 26 | imm26 & (1 << 26) - 1;\n}\n\n__forceinline DWORD ARM64_CBZWToB(DWORD insnCBZW)\n{\n    if (!ARM64_IsCBZW(insnCBZW))\n        return 0;\n    int imm19 = ARM64_ReadBitsSignExtend(insnCBZW, 23, 5);\n    return ARM64_MakeB(imm19);\n}\n\n__forceinline DWORD ARM64_CBNZWToB(DWORD insnCBNZW)\n{\n    if (!ARM64_IsCBNZW(insnCBNZW))\n        return 0;\n    int imm19 = ARM64_ReadBitsSignExtend(insnCBNZW, 23, 5);\n    return ARM64_MakeB(imm19);\n}\n\n__forceinline DWORD ARM64_TBZToB(DWORD insnTBZ)\n{\n    if (!ARM64_IsTBZ(insnTBZ))\n        return 0;\n    int imm14 = ARM64_ReadBitsSignExtend(insnTBZ, 18, 5);\n    return ARM64_MakeB(imm14);\n}\n\n__forceinline DWORD ARM64_TBNZToB(DWORD insnTBNZ)\n{\n    if (!ARM64_IsTBNZ(insnTBNZ))\n        return 0;\n    int imm14 = ARM64_ReadBitsSignExtend(insnTBNZ, 18, 5);\n    return ARM64_MakeB(imm14);\n}\n\n__forceinline DWORD ARM64_DecodeADD(DWORD insnADD)\n{\n    DWORD imm12 = ARM64_ReadBits(insnADD, 21, 10);\n    DWORD shift = ARM64_ReadBits(insnADD, 22, 22);\n    return imm12 << (shift * 12);\n}\n\n__forceinline DWORD ARM64_DecodeSTRBIMM(DWORD insnSTRBIMM)\n{\n    if (ARM64_ReadBits(insnSTRBIMM, 31, 22) != 0b0011100100)\n        return (DWORD)-1;\n    DWORD imm12 = ARM64_ReadBits(insnSTRBIMM, 21, 10);\n    return imm12;\n}\n\n__forceinline DWORD ARM64_DecodeLDRBIMM(DWORD insnLDRBIMM)\n{\n    if (ARM64_ReadBits(insnLDRBIMM, 31, 22) != 0b0011100101)\n        return (DWORD)-1;\n    DWORD imm12 = ARM64_ReadBits(insnLDRBIMM, 21, 10);\n    return imm12;\n}\n\ninline UINT_PTR ARM64_DecodeADRL(UINT_PTR offset, DWORD insnADRP, DWORD insnADD)\n{\n    if (!ARM64_IsADRP(insnADRP))\n        return 0;\n\n    UINT_PTR page = ARM64_Align(offset, 0x1000);\n\n    DWORD adrp_immlo = ARM64_ReadBits(insnADRP, 30, 29);\n    DWORD adrp_immhi = ARM64_ReadBits(insnADRP, 23, 5);\n    DWORD adrp_imm = ((adrp_immhi << 2) | adrp_immlo) << 12;\n\n    DWORD add_imm = ARM64_DecodeADD(insnADD);\n\n    return page + adrp_imm + add_imm;\n}\n#endif\n\n#if defined(WITH_MAIN_PATCHER) && WITH_MAIN_PATCHER\ninline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME(BOOL* bFound)\n{\n    // huge thanks to @Simplestas: https://github.com/valinet/ExplorerPatcher/issues/598\n    HMODULE hInputSwitch = NULL;\n    if (!GetModuleHandleExW(0, L\"InputSwitch.dll\", &hInputSwitch))\n        return FALSE;\n\n    PBYTE pInputSwitchText;\n    DWORD cbInputSwitchText;\n    if (!TextSectionBeginAndSize(hInputSwitch, &pInputSwitchText, &cbInputSwitchText))\n        return FALSE;\n\n#if defined(_M_X64)\n    // 44 38 ?? ?? 74 ?? ?? 8B CE E8 ?? ?? ?? ?? 85 C0\n    //             ^^ Change jz into jmp\n    PBYTE match = (PBYTE)FindPattern(\n        pInputSwitchText,\n        cbInputSwitchText,\n        \"\\x44\\x38\\x00\\x00\\x74\\x00\\x00\\x8B\\xCE\\xE8\\x00\\x00\\x00\\x00\\x85\\xC0\",\n        \"xx??x??xxx????xx\"\n    );\n    if (!match)\n        return FALSE;\n\n    DWORD dwOldProtect;\n    if (!VirtualProtect(match + 4, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        return FALSE;\n\n    match[4] = 0xEB;\n\n    VirtualProtect(match + 4, 1, dwOldProtect, &dwOldProtect);\n\n    return TRUE;\n#elif defined(_M_ARM64)\n    // A8 43 40 39 C8 04 00 34 E0 03 14 AA\n    //             ^^^^^^^^^^^ Change CBZ to B\n    PBYTE match = (PBYTE)FindPattern(\n        pInputSwitchText,\n        cbInputSwitchText,\n        \"\\xA8\\x43\\x40\\x39\\xC8\\x04\\x00\\x34\\xE0\\x03\\x14\\xAA\",\n        \"xxxxxxxxxxxx\"\n    );\n    if (!match)\n        return FALSE;\n\n    match += 4;\n\n    DWORD newInsn = ARM64_CBZWToB(*(DWORD*)match);\n    if (!newInsn)\n        return FALSE;\n\n    DWORD dwOldProtect;\n    if (!VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\n        return FALSE;\n\n    *(DWORD*)match = newInsn;\n\n    VirtualProtect(match, 4, dwOldProtect, &dwOldProtect);\n\n    return TRUE;\n#endif\n}\n#endif\n\nextern UINT PleaseWaitTimeout;\nextern HHOOK PleaseWaitHook;\nextern HWND PleaseWaitHWND;\nextern void* PleaseWaitCallbackData;\nextern BOOL (*PleaseWaitCallbackFunc)(void* data);\nBOOL PleaseWait_UpdateTimeout(int timeout);\nVOID CALLBACK PleaseWait_TimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime);\nLRESULT CALLBACK PleaseWait_HookProc(int code, WPARAM wParam, LPARAM lParam);\n\nBOOL DownloadAndInstallWebView2Runtime();\n\nBOOL DownloadFile(LPCWSTR wszURL, DWORD dwSize, LPCWSTR wszPath);\n\nBOOL IsConnectedToInternet();\n\n#define SCRATCH_QCM_FIRST 1\n#define SCRATCH_QCM_LAST  0x7FFF\n\n#define SPOP_OPENMENU            1\n#define SPOP_INSERTMENU_ALL      0b1111110000\n#define SPOP_INSERTMENU_OPEN     0b0000010000\n#define SPOP_INSERTMENU_NEXTPIC  0b0000100000\n#define SPOP_INSERTMENU_LIKE     0b0001000000\n#define SPOP_INSERTMENU_DISLIKE  0b0010000000\n#define SPOP_INSERTMENU_INFOTIP1 0b0100000000\n#define SPOP_INSERTMENU_INFOTIP2 0b1000000000\n#define SPOP_CLICKMENU_FIRST     40000\n#define SPOP_CLICKMENU_OPEN      40000\n#define SPOP_CLICKMENU_NEXTPIC   40001\n#define SPOP_CLICKMENU_LIKE      40002\n#define SPOP_CLICKMENU_DISLIKE   40003\n#define SPOP_CLICKMENU_LAST      40003\n\nBOOL DoesOSBuildSupportSpotlight();\n\nBOOL IsSpotlightEnabled();\n\nvoid SpotlightHelper(DWORD dwOp, HWND hWnd, HMENU hMenu, LPPOINT pPt);\n\ntypedef struct _MonitorOverrideData\n{\n    DWORD cbIndex;\n    DWORD dwIndex;\n    HMONITOR hMonitor;\n} MonitorOverrideData;\n\nBOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod);\nHRESULT SHRegGetBOOLWithREGSAM(HKEY key, LPCWSTR subKey, LPCWSTR value, REGSAM regSam, BOOL* data);\nHRESULT SHRegGetDWORD(HKEY hkey, const WCHAR* pwszSubKey, const WCHAR* pwszValue, DWORD* pdwData);\n\ninline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)\n{\n    for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value)\n    {\n        if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value)\n            return FALSE;\n    }\n\n    return TRUE;\n}\n\ninline __declspec(noinline) PVOID FindPatternHelper(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask)\n{\n    for (SIZE_T index = 0; index < dwSize; ++index)\n    {\n        PBYTE pAddress = (PBYTE)pBase + index;\n\n        if (MaskCompare(pAddress, lpPattern, lpMask))\n            return pAddress;\n    }\n\n    return NULL;\n}\n\ninline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask)\n{\n    dwSize -= strlen(lpMask);\n    return FindPatternHelper(pBase, dwSize, lpPattern, lpMask);\n}\n\ninline UINT_PTR FileOffsetToRVA(PBYTE pBase, UINT_PTR offset)\n{\n    PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pBase;\n    PIMAGE_NT_HEADERS64 pNtHeaders = (PIMAGE_NT_HEADERS64)(pBase + pDosHeader->e_lfanew);\n    PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pNtHeaders);\n    for (int i = 0; i < pNtHeaders->FileHeader.NumberOfSections; i++, pSection++)\n    {\n        if (offset >= pSection->PointerToRawData && offset < pSection->PointerToRawData + pSection->SizeOfRawData)\n            return offset - pSection->PointerToRawData + pSection->VirtualAddress;\n    }\n    return 0;\n}\n\ninline UINT_PTR RVAToFileOffset(PBYTE pBase, UINT_PTR rva)\n{\n    PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pBase;\n    PIMAGE_NT_HEADERS64 pNtHeaders = (PIMAGE_NT_HEADERS64)(pBase + pDosHeader->e_lfanew);\n    PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pNtHeaders);\n    for (int i = 0; i < pNtHeaders->FileHeader.NumberOfSections; i++, pSection++)\n    {\n        if (rva >= pSection->VirtualAddress && rva < pSection->VirtualAddress + pSection->Misc.VirtualSize)\n            return rva - pSection->VirtualAddress + pSection->PointerToRawData;\n    }\n    return 0;\n}\n\ninline HMODULE LoadGuiModule()\n{\n    wchar_t epGuiPath[MAX_PATH];\n    ZeroMemory(epGuiPath, sizeof(epGuiPath));\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, epGuiPath);\n    wcscat_s(epGuiPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\ep_gui.dll\");\n    return LoadLibraryExW(epGuiPath, NULL, LOAD_LIBRARY_AS_DATAFILE);\n}\n\ninline BOOL DoesWindows10StartMenuExist()\n{\n    if (!IsWindows11())\n        return TRUE;\n\n    wchar_t szPath[MAX_PATH];\n    GetWindowsDirectoryW(szPath, MAX_PATH);\n    wcscat_s(szPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartUI.dll\");\n    if (FileExistsW(szPath))\n        return TRUE;\n\n    GetWindowsDirectoryW(szPath, MAX_PATH);\n    wcscat_s(szPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\\\StartUI_.dll\");\n    if (FileExistsW(szPath))\n        return TRUE;\n\n    return FALSE;\n}\n\ninline BOOL IsStockWindows10TaskbarAvailable()\n{\n#if _M_X64\n    return global_rovi.dwBuildNumber < 26002;\n#else\n    return !IsWindows11();\n#endif\n}\n\ninline const WCHAR* PickTaskbarDll()\n{\n    DWORD b = global_rovi.dwBuildNumber;\n\n    if (b == 15063 // Windows 10 1703\n     || b == 16299 // Windows 10 1709\n     || b == 17134 // Windows 10 1803\n     || b == 17763 // Windows 10 1809\n     || b >= 18362 && b <= 18363 // Windows 10 1903, 1909\n     || b >= 19041 && b <= 19045) // Windows 10 20H2, 21H2, 22H2\n    {\n        return L\"ep_taskbar.0.dll\";\n    }\n\n    if (b >= 21343 && b <= 22000) // Windows 11 21H2\n    {\n        return L\"ep_taskbar.1.dll\";\n    }\n\n    if ((b >= 22621 && b <= 22635)  // 22H2-23H2 Release, Release Preview, and Beta channels\n     || (b >= 23403 && b <= 25197)) // Early pre-reboot Dev channel until post-reboot Dev channel\n    {\n        return L\"ep_taskbar.2.dll\";\n    }\n\n    if (b >= 25201 && b <= 25915) // Pre-reboot Dev channel until early Canary channel, nuked ITrayComponentHost methods related to classic search box\n    {\n        return L\"ep_taskbar.3.dll\";\n    }\n\n    if (b >= 25921 && b <= 26040) // Canary channel with nuked classic system tray\n    {\n        return L\"ep_taskbar.4.dll\";\n    }\n\n    if (b >= 26052) // Same as 4 but with 2 new methods in ITrayComponentHost between GetTrayUI and ProgrammableTaskbarReportClick\n    {\n        return L\"ep_taskbar.5.dll\";\n    }\n\n    return NULL;\n}\n\ninline BOOL DoesTaskbarDllExist()\n{\n    const wchar_t* pszTaskbarDll = PickTaskbarDll();\n    if (!pszTaskbarDll)\n        return FALSE;\n\n    wchar_t szPath[MAX_PATH];\n    ZeroMemory(szPath, sizeof(szPath));\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, szPath);\n    wcscat_s(szPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\");\n    wcscat_s(szPath, MAX_PATH, pszTaskbarDll);\n    return FileExistsW(szPath);\n}\n\ninline void AdjustTaskbarStyleValue(DWORD* pdwValue)\n{\n    if (*pdwValue >= 2 && !DoesTaskbarDllExist())\n    {\n        *pdwValue = 1;\n    }\n\n    if (IsWindows11())\n    {\n        if (*pdwValue == 1 && !IsStockWindows10TaskbarAvailable())\n        {\n            *pdwValue = 0;\n        }\n    }\n    else\n    {\n        if (*pdwValue == 0)\n        {\n            *pdwValue = 1; // There's no such thing as Windows 11 taskbar on Windows 10\n        }\n    }\n}\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "ExplorerPatcher.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 17\r\nVisualStudioVersion = 17.0.32126.317\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ExplorerPatcher\", \"ExplorerPatcher\\ExplorerPatcher.vcxproj\", \"{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E} = {314A50C1-F0A0-4D0C-89E1-AD8F3951043E}\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE} = {AF02ABAC-EAEB-471C-9957-73D430B8B4DE}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_generate_release_description\", \"ep_generate_release_description\\ep_generate_release_description.vcxproj\", \"{C362CFBE-7C6B-4457-8D01-839818D42ECB}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_generate_release_name\", \"ep_generate_release_name\\ep_generate_release_name.vcxproj\", \"{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_setup\", \"ep_setup\\ep_setup.vcxproj\", \"{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87} = {1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E} = {314A50C1-F0A0-4D0C-89E1-AD8F3951043E}\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78} = {6BF03EEA-200A-4698-9555-057DD52B0C78}\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9} = {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4} = {2351A0DF-782C-4D74-85B7-0847D245D6B4}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_setup_patch\", \"ep_setup_patch\\ep_setup_patch.vcxproj\", \"{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF} = {2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_dwm\", \"ep_dwm\\ep_dwm\\ep_dwm.vcxproj\", \"{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_weather_host\", \"ep_weather_host\\ep_weather_host.vcxproj\", \"{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE} = {AF02ABAC-EAEB-471C-9957-73D430B8B4DE}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_weather_host_stub\", \"ep_weather_host_stub\\ep_weather_host_stub.vcxproj\", \"{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_startmenu\", \"ep_startmenu\\ep_startmenu.vcxproj\", \"{6BF03EEA-200A-4698-9555-057DD52B0C78}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_extra\", \"ep_extra\\ep_extra.vcxproj\", \"{93FA47CC-7753-4F86-B583-69048F51C5AB}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_extra_valinet.win7alttab\", \"ep_extra_valinet.win7alttab\\ep_extra_valinet.win7alttab.vcxproj\", \"{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB} = {93FA47CC-7753-4F86-B583-69048F51C5AB}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ep_gui\", \"ep_gui\\ep_gui.vcxproj\", \"{2351A0DF-782C-4D74-85B7-0847D245D6B4}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E} = {314A50C1-F0A0-4D0C-89E1-AD8F3951043E}\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE} = {AF02ABAC-EAEB-471C-9957-73D430B8B4DE}\r\n\tEndProjectSection\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|amd64 = Debug|amd64\r\n\t\tDebug|arm64 = Debug|arm64\r\n\t\tDebug|IA-32 = Debug|IA-32\r\n\t\tRelease|amd64 = Release|amd64\r\n\t\tRelease|arm64 = Release|arm64\r\n\t\tRelease|IA-32 = Release|IA-32\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|IA-32.Build.0 = Debug|Win32\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|amd64.Build.0 = Release|x64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|IA-32.Build.0 = Release|Win32\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|amd64.Build.0 = Release|x64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|amd64.Build.0 = Release|x64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Release|amd64.Build.0 = Release|x64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{2FD40B09-F224-4E9A-B2FE-A22B50B2DEBF}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|amd64.Build.0 = Release|x64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.Build.0 = Release|x64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|amd64.Build.0 = Release|x64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|amd64.Build.0 = Release|x64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Release|amd64.Build.0 = Release|x64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{6BF03EEA-200A-4698-9555-057DD52B0C78}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Release|amd64.Build.0 = Release|x64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{93FA47CC-7753-4F86-B583-69048F51C5AB}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Debug|IA-32.ActiveCfg = Debug|Win32\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Release|amd64.Build.0 = Release|x64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{A66C5F27-DBF8-45A4-BDF3-BA54D8D82D0F}.Release|IA-32.ActiveCfg = Release|Win32\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Debug|amd64.ActiveCfg = Debug|x64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Debug|amd64.Build.0 = Debug|x64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Debug|arm64.ActiveCfg = Debug|ARM64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Debug|arm64.Build.0 = Debug|ARM64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Debug|IA-32.ActiveCfg = Debug|x64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Release|amd64.ActiveCfg = Release|x64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Release|amd64.Build.0 = Release|x64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Release|arm64.ActiveCfg = Release|ARM64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Release|arm64.Build.0 = Release|ARM64\r\n\t\t{2351A0DF-782C-4D74-85B7-0847D245D6B4}.Release|IA-32.ActiveCfg = Release|x64\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\t\tSolutionGuid = {39EBC2F0-6949-46EC-9FC2-776591FEE2DA}\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "FUNDING.yml",
    "content": "custom: ['https://www.paypal.com/donate?business=valentingabrielradu%40gmail.com&no_recurring=0&item_name=ExplorerPatcher']\ngithub: 'Amrsatrio'\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "README.md",
    "content": "# ExplorerPatcher\n\nThis project aims to enhance the working environment on Windows.\n\n## How to?\n\n1. Download the latest version of the setup program in [here](https://github.com/valinet/ExplorerPatcher/releases/latest).\n   * Choose `ep_setup.exe` if your device uses an Intel or AMD processor, or `ep_setup_arm64.exe` if your device uses a Snapdragon processor.\n1. Run the installer. It will automatically prompt for elevation, after which it will close `explorer.exe` and install the necessary files. When done, you will see the desktop again and the Windows 10 taskbar.\n1. Right-click the taskbar and choose \"Properties\".\n1. To change the taskbar style, go to the \"Taskbar\" section and look for \"Taskbar style\".\n1. To use the Windows 10 Start menu, go to the \"Start menu\" section and change the Start menu style to Windows 10.\n1. To use the Windows 10 Alt+Tab, go to the \"Window switcher\" section and change the \"Window switcher (Alt+tab) style\" to Windows 10.\n1. Feel free to check other configuration options.\n\nThat's it!\n\n**Note:** Some features may be unavailable on some Windows versions.\n\n## Uninstalling\n\n* Right click the taskbar then click \"Properties\" or search for \"ExplorerPatcher\", and go to \"Uninstall\" section or\n* Use \"Programs and Features\" in Control Panel, or \"Apps and features\" in the Settings app or\n* Run `ep_setup.exe /uninstall` or\n* Rename `ep_setup.exe` to `ep_uninstall.exe` and run that.\n\n## Updating\n\n* The program features built-in updates: go to \"Properties\" - \"Updates\" to configure, check for and install the latest updates. Learn more [here](https://github.com/valinet/ExplorerPatcher/wiki/Configure-updates).\n* Download the latest version's [setup file for x64](https://github.com/valinet/ExplorerPatcher/releases/latest/download/ep_setup.exe) or [setup file for ARM64](https://github.com/valinet/ExplorerPatcher/releases/latest/download/ep_setup_arm64.exe) and simply run it.\n\n## Donate\n\nIf you find this project essential to your daily life, please consider donating to support the development through the [Sponsor](https://github.com/valinet/ExplorerPatcher?sponsor) button at the top of this page, so that we can continue to keep supporting newer Windows builds.\n\n## Discord Server\n\nJoin our Discord server if you need support, want to chat regarding this project, or just want to hang out with us!\n\n[![Join on Discord](https://discordapp.com/api/guilds/1155912047897350204/widget.png?style=shield)](https://discord.gg/gsPcfqHTD2)\n\n[Read more](https://github.com/valinet/ExplorerPatcher/wiki)\n"
  },
  {
    "path": "debug.h",
    "content": "#define _CRTDBG_MAP_ALLOC\r\n#include <stdlib.h>\r\n#include <crtdbg.h>"
  },
  {
    "path": "ep_extra/README.md",
    "content": "# ExplorerPatcher Custom Libraries Chainloader\n\nExplorerPatcher has a simple, built-in mechanism that allows users to load their own DLL into `explorer.exe` right after ExplorerPatcher finishes initializing its hooks. Interested users should place a DLL called `ep_extra.dll` in `C:\\Windows`. When ExplorerPatcher finishes its setup, it loads the `ep_extra.dll` library and calls the `ep_extra_EntryPoint` function. Although this is very useful so that users can load their custom code, it is quite limited at the moment, as it loads just one DLL.\n\nThis project is a solution to this issue. A chainloader is implemented here, that looks for other modules matching the `ep_extra_*.dll` pattern in `C:\\Windows` as well, and loads them one after the other.\n"
  },
  {
    "path": "ep_extra/ep_extra.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Version\n//\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION 1,0,0,1\n PRODUCTVERSION 1,0,0,1\n FILEFLAGSMASK 0x3fL\n#ifdef _DEBUG\n FILEFLAGS 0x1L\n#else\n FILEFLAGS 0x0L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x2L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"040904b0\"\n        BEGIN\n            VALUE \"CompanyName\", \"VALINET Solutions SRL\"\n            VALUE \"FileDescription\", \"ExplorerPatcher Custom Libraries Chainloader\"\n            VALUE \"FileVersion\", \"1.0.0.0\"\n            VALUE \"InternalName\", \"ep_extra.dll\"\n            VALUE \"LegalCopyright\", \"Copyright (C) 2006-2025 VALINET Solutions SRL. All rights reserved.\"\n            VALUE \"OriginalFilename\", \"ep_extra.dll\"\n            VALUE \"ProductName\", \"ExplorerPatcher\"\n            VALUE \"ProductVersion\", \"1.0.0.0\"\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x409, 1200\n    END\nEND\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "ep_extra/ep_extra.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{93fa47cc-7753-4f86-b583-69048f51c5ab}</ProjectGuid>\r\n    <RootNamespace>epextra</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.props\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <ModuleDefinitionFile>\r\n      </ModuleDefinitionFile>\r\n      <AdditionalOptions>/EXPORT:ep_extra_EntryPoint %(AdditionalOptions)</AdditionalOptions>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <ModuleDefinitionFile>\r\n      </ModuleDefinitionFile>\r\n      <AdditionalOptions>/EXPORT:ep_extra_EntryPoint %(AdditionalOptions)</AdditionalOptions>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <ModuleDefinitionFile>\r\n      </ModuleDefinitionFile>\r\n      <AdditionalOptions>/EXPORT:ep_extra_EntryPoint %(AdditionalOptions)</AdditionalOptions>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <ModuleDefinitionFile>\r\n      </ModuleDefinitionFile>\r\n      <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>\r\n    </Link>\r\n    <MASM />\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"worker.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <MASM Include=\"main.asm\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"resource.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ep_extra.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.targets\" />\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_extra/ep_extra.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"worker.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <MASM Include=\"main.asm\">\n      <Filter>Source Files</Filter>\n    </MASM>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"ep_extra.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "ep_extra/main.asm",
    "content": "EXTERN worker : PROC\n\n.CODE\n\nep_extra_EntryPoint PROC EXPORT\n  PUSH RBP\n  MOV RBP, RSP\n  SUB RSP, 30H\n  CALL worker\n  CMP RAX, 0\n  JE finish\n  JMP RAX\nfinish:\n  LEAVE\n  RET\nep_extra_EntryPoint ENDP\n\nEND"
  },
  {
    "path": "ep_extra/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by ep_extra.rc\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "ep_extra/worker.c",
    "content": "#include <Windows.h>\n#include <Shlwapi.h>\n#pragma comment(lib, \"Shlwapi.lib\")\n#include <stdio.h>\n\nHMODULE hModule = NULL;\nHANDLE sigFinish = NULL;\nvoid* pFinishProc = NULL;\n\nvoid done() {\n    WaitForSingleObject(sigFinish, INFINITE);\n    FreeLibraryAndExitThread(hModule, 0);\n}\n\nvoid* worker() {\n    wchar_t pattern[MAX_PATH];\n    GetWindowsDirectoryW(pattern, MAX_PATH);\n    wcscat_s(pattern, MAX_PATH, L\"\\\\ep_extra_*.dll\");\n\n    WIN32_FIND_DATA data;\n    HANDLE hFind = FindFirstFileW(pattern, &data);\n    if (hFind != INVALID_HANDLE_VALUE) {\n        do {\n            wprintf(L\">> Found ep_extra library: \\\"%s\\\"\\n\", data.cFileName);\n            GetWindowsDirectoryW(pattern, MAX_PATH);\n            wcscat_s(pattern, MAX_PATH, L\"\\\\\");\n            wcscat_s(pattern, MAX_PATH, data.cFileName);\n            HMODULE hLib = LoadLibraryW(pattern);\n            if (hLib) {\n                FARPROC proc = (FARPROC)(GetProcAddress(hLib, \"setup\"));\n                if (proc) {\n                    if (proc()) FreeLibrary(hLib);\n                }\n                else FreeLibrary(hLib);\n            }\n        } while (FindNextFileW(hFind, &data));\n        FindClose(hFind);\n    }\n\n    sigFinish = CreateEventW(NULL, FALSE, FALSE, NULL);\n    if (sigFinish) {\n        BYTE payload[] = {\n            0x48, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rcx, sigFinish\n            0x48, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mov rax, SetEvent\n            0xFF, 0xD0, // call SetEvent\n            0xC9, // leave\n            0xC3  // ret\n        };\n        *(INT64*)(payload + 2) = sigFinish;\n        *(INT64*)(payload + 12) = SetEvent;\n\n        pFinishProc = VirtualAlloc(NULL, sizeof(payload), MEM_COMMIT, PAGE_EXECUTE_READWRITE);\n        if (pFinishProc) {\n            memcpy(pFinishProc, payload, sizeof(payload));\n            SHCreateThread(done, 0, CTF_NOADDREFLIB, NULL);\n            return pFinishProc;\n        }\n    }\n    return NULL;\n}\n\nBOOL WINAPI DllMain(\n    _In_ HINSTANCE hinstDLL,\n    _In_ DWORD     fdwReason,\n    _In_ LPVOID    lpvReserved\n)\n{\n    switch (fdwReason)\n    {\n    case DLL_PROCESS_ATTACH:\n        DisableThreadLibraryCalls(hinstDLL);\n        hModule = hinstDLL;\n        break;\n    case DLL_THREAD_ATTACH:\n        break;\n    case DLL_THREAD_DETACH:\n        break;\n    case DLL_PROCESS_DETACH:\n        break;\n    }\n    return TRUE;\n}\n"
  },
  {
    "path": "ep_extra_valinet.win7alttab/README.md",
    "content": "# ExplorerPatcher Windows 7 Alt-Tab Module\n\nThis module patches the Windows 7 genuine Alt-Tab implementation to work on newer Windows versions.\n\nTo install, make sure you have the following files in `C:\\Windows`:\n\n* `ep_extra_valinet.win7alttab.dll` - this DLL\n* `ep_extra.dll` - a chainloader capable of being invoked by ExplorerPatcher (implements `ep_extra_EntryPoint` and which loads other `ep_extra_*.dll` modules\n* `AltTab.dll` - a copy of the `AltTab.dll` in `C:\\Windows\\System32` from a Windows 7 installation\n"
  },
  {
    "path": "ep_extra_valinet.win7alttab/Resource.rc",
    "content": "// Microsoft Visual C++ generated resource script.\n//\n#include \"resource.h\"\n\n#define APSTUDIO_READONLY_SYMBOLS\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 2 resource.\n//\n#include \"winres.h\"\n\n/////////////////////////////////////////////////////////////////////////////\n#undef APSTUDIO_READONLY_SYMBOLS\n\n/////////////////////////////////////////////////////////////////////////////\n// English (United States) resources\n\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\n#pragma code_page(1252)\n\n#ifdef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// TEXTINCLUDE\n//\n\n1 TEXTINCLUDE \nBEGIN\n    \"resource.h\\0\"\nEND\n\n2 TEXTINCLUDE \nBEGIN\n    \"#include \"\"winres.h\"\"\\r\\n\"\n    \"\\0\"\nEND\n\n3 TEXTINCLUDE \nBEGIN\n    \"\\r\\n\"\n    \"\\0\"\nEND\n\n#endif    // APSTUDIO_INVOKED\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n// Version\n//\n\nVS_VERSION_INFO VERSIONINFO\n FILEVERSION 1,0,0,1\n PRODUCTVERSION 1,0,0,1\n FILEFLAGSMASK 0x3fL\n#ifdef _DEBUG\n FILEFLAGS 0x1L\n#else\n FILEFLAGS 0x0L\n#endif\n FILEOS 0x40004L\n FILETYPE 0x1L\n FILESUBTYPE 0x0L\nBEGIN\n    BLOCK \"StringFileInfo\"\n    BEGIN\n        BLOCK \"040904b0\"\n        BEGIN\n            VALUE \"CompanyName\", \"VALINET Solutions SRL\"\n            VALUE \"FileDescription\", \"ExplorerPatcher Windows 7 Alt-Tab Module\"\n            VALUE \"FileVersion\", \"1.0.0.0\"\n            VALUE \"InternalName\", \"ep_extra_valinet.win7alttab\"\n            VALUE \"LegalCopyright\", \"Copyright (C) 2006-2025 VALINET Solutions SRL. All rights reserved.\"\n            VALUE \"OriginalFilename\", \"ep_extra_valinet.win7alttab\"\n            VALUE \"ProductName\", \"ExplorerPatcher\"\n            VALUE \"ProductVersion\", \"1.0.0.0\"\n        END\n    END\n    BLOCK \"VarFileInfo\"\n    BEGIN\n        VALUE \"Translation\", 0x409, 1200\n    END\nEND\n\n#endif    // English (United States) resources\n/////////////////////////////////////////////////////////////////////////////\n\n\n\n#ifndef APSTUDIO_INVOKED\n/////////////////////////////////////////////////////////////////////////////\n//\n// Generated from the TEXTINCLUDE 3 resource.\n//\n\n\n/////////////////////////////////////////////////////////////////////////////\n#endif    // not APSTUDIO_INVOKED\n\n"
  },
  {
    "path": "ep_extra_valinet.win7alttab/ep_extra_valinet.win7alttab.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{a66c5f27-dbf8-45a4-bdf3-ba54d8d82d0f}</ProjectGuid>\r\n    <RootNamespace>epextravalinetwin7alttab</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.c\" />\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.c\" />\r\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.c\" />\r\n    <ClCompile Include=\"main.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\libs\\libvalinet\\valinet\\hooking\\iatpatch.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"Resource.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_extra_valinet.win7alttab/ep_extra_valinet.win7alttab.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"main.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_WindowHelpers.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_error.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"..\\libs\\sws\\SimpleWindowSwitcher\\sws_tshwnd.c\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"..\\libs\\libvalinet\\valinet\\hooking\\iatpatch.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"Resource.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "ep_extra_valinet.win7alttab/main.c",
    "content": "#include <initguid.h>\n#include <Windows.h>\n#include \"../libs/libvalinet/valinet/hooking/iatpatch.h\"\n#include \"../libs/sws/SimpleWindowSwitcher/sws_WindowHelpers.h\"\n#pragma comment(lib, \"Uxtheme.lib\")\n\nHMODULE hModule = NULL;\nHMODULE hAltTab = NULL;\nIOleCommandTarget* pAltTabSSO = NULL;\n\nDEFINE_GUID(CLSID_AltTabSSO,\n    0xA1607060, 0x5D4C, 0x467A, 0xB7, 0x11, 0x2B, 0x59, 0xA6, 0xF2, 0x59, 0x57);\n\nHRESULT AltTab_DwmpActivateLivePreview(int s, HWND hWnd, int c, int d) {\n    return S_OK;\n}\n\nint AltTab_LoadStringW(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int cchBufferMax) {\n    if (uID == 0x3E8) {\n        swprintf_s(lpBuffer, cchBufferMax, L\"AltTab\"); return 6;\n    }\n    else if (uID == 0x3EA) {\n        if (cchBufferMax < MAX_PATH) return 0;\n        sws_WindowHelpers_GetDesktopText(lpBuffer);\n        int len = wcslen(lpBuffer);\n        for (int i = 0; i < len; ++i) if (lpBuffer[i] == L'&') lpBuffer[i] = L'\\u200E';\n        return len;\n    }\n    return LoadStringW(hInstance, uID, lpBuffer, cchBufferMax);\n}\n\nHTHEME AltTab_OpenThemeData(HWND hwnd, LPCWSTR pszClassList) {\n    if (!wcscmp(pszClassList, L\"AltTab\")) return OpenThemeData(hwnd, L\"WINDOW\");\n    return OpenThemeData(hwnd, pszClassList);\n}\n\nHRESULT AltTab_DrawThemeTextEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT pRect, const DTTOPTS* pOptions) {\n    HRESULT hr = S_OK;\n    HTHEME hTheme2 = OpenThemeData(NULL, L\"TEXTSTYLE\");\n    if (hTheme2) hr = DrawThemeTextEx(hTheme2, hdc, iPartId + 1, iStateId, pszText, cchText, dwTextFlags, pRect, pOptions);\n    if (hTheme2) CloseThemeData(hTheme2);\n    return hr;\n}\n\nBOOL AltTab_IsWindowEnabled(HWND hWnd) {\n    if (!IsWindowEnabled(hWnd)) return FALSE;\n    BOOL isCloaked;\n    DwmGetWindowAttribute(hWnd, DWMWA_CLOAKED, &isCloaked, sizeof(BOOL));\n    if (isCloaked) return FALSE;\n    if (sws_IsShellFrameWindow(hWnd) && !_sws_GhostWindowFromHungWindow(hWnd)) return TRUE;\n    if (_sws_IsShellManagedWindow(hWnd) && !sws_WindowHelpers_ShouldTreatShellManagedWindowAsNotShellManaged(hWnd)) return FALSE;\n    if (sws_WindowHelpers_IsWindowShellManagedByExplorerPatcher(hWnd)) return FALSE;\n    return TRUE;\n}\n\nHRESULT AltTab_DwmExtendFrameIntoClientArea(HWND hWnd, const MARGINS* pMarInset) {\n    HRESULT hr = DwmExtendFrameIntoClientArea(hWnd, pMarInset);\n    sws_WindowHelpers_SetMicaMaterialForThisWindow(hWnd, TRUE);\n    return hr;\n}\n\nBOOL AltTab_PostMessageW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n    if (hWnd == FindWindowW(L\"Shell_TrayWnd\", NULL) && uMsg == 0x5B7 && wParam == 0 && lParam == 0) {\n        return PostMessageW(hWnd, WM_COMMAND, 407, 0);\n    }\n    return PostMessageW(hWnd, uMsg, wParam, lParam);\n}\n\n__declspec(dllexport) void clean() {\n    if (pAltTabSSO) pAltTabSSO->lpVtbl->Release(pAltTabSSO);\n    if (hAltTab) sws_WindowHelpers_Clear();\n}\n\n__declspec(dllexport) int setup() {\n    hAltTab = LoadLibraryW(L\"AltTab.dll\");\n    if (hAltTab) {\n        sws_WindowHelpers_Initialize();\n        VnPatchIAT(hAltTab, \"dwmapi.dll\", \"DwmExtendFrameIntoClientArea\", AltTab_DwmExtendFrameIntoClientArea);\n        VnPatchIAT(hAltTab, \"dwmapi.dll\", (LPCSTR)113, AltTab_DwmpActivateLivePreview);\n        VnPatchIAT(hAltTab, \"user32.dll\", \"PostMessageW\", AltTab_PostMessageW);\n        VnPatchIAT(hAltTab, \"user32.dll\", \"LoadStringW\", AltTab_LoadStringW);\n        VnPatchIAT(hAltTab, \"user32.dll\", \"IsWindowEnabled\", AltTab_IsWindowEnabled);\n        VnPatchDelayIAT(hAltTab, \"uxtheme.dll\", \"OpenThemeData\", AltTab_OpenThemeData);\n        VnPatchDelayIAT(hAltTab, \"uxtheme.dll\", \"DrawThemeTextEx\", AltTab_DrawThemeTextEx);\n        HRESULT(*pDllGetClassObject)(REFCLSID, REFIID, LPVOID) = GetProcAddress(hAltTab, \"DllGetClassObject\");\n        IClassFactory* pFactory = NULL;\n        if (pDllGetClassObject && SUCCEEDED(pDllGetClassObject(&CLSID_AltTabSSO, &IID_IClassFactory, &pFactory)) && pFactory) {\n            if (SUCCEEDED(pFactory->lpVtbl->CreateInstance(pFactory, NULL, &IID_IOleCommandTarget, &pAltTabSSO)) && pAltTabSSO) {\n                if (SUCCEEDED(pAltTabSSO->lpVtbl->Exec(pAltTabSSO, &CGID_ShellServiceObject, 2, 0, NULL, NULL))) {\n                    printf(\">>> Using Windows 7 AltTab\\n\");\n                }\n            }\n            pFactory->lpVtbl->Release(pFactory);\n        }\n        FreeLibrary(hAltTab);\n        return 0;\n    }\n    return 1;\n}\n\nBOOL WINAPI DllMain(\n    _In_ HINSTANCE hinstDLL,\n    _In_ DWORD     fdwReason,\n    _In_ LPVOID    lpvReserved\n) {\n    switch (fdwReason)\n    {\n    case DLL_PROCESS_ATTACH:\n        DisableThreadLibraryCalls(hinstDLL);\n        hModule = hinstDLL;\n        break;\n    case DLL_THREAD_ATTACH:\n        break;\n    case DLL_THREAD_DETACH:\n        break;\n    case DLL_PROCESS_DETACH:\n        break;\n    }\n    return TRUE;\n}"
  },
  {
    "path": "ep_extra_valinet.win7alttab/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by Resource.rc\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "ep_generate_release_description/ep_generate_release_description.c",
    "content": "#include <Windows.h>\r\n#include <stdio.h>\r\n#include \"../ExplorerPatcher/queryversion.h\"\r\n#define FILE_NAME \"CHANGELOG.md\"\r\n#define MAX_LINE_LENGTH 200000\r\n\r\nint main(int argc, char** argv)\r\n{\r\n    SetConsoleOutputCP(CP_UTF8);\r\n\r\n    char szStartPattern[MAX_PATH];\r\n    char szEndPattern[MAX_PATH];\r\n\r\n    DWORD dwLeftMost = 0;\r\n    DWORD dwSecondLeft = 0;\r\n    DWORD dwSecondRight = 0;\r\n    DWORD dwRightMost = 0;\r\n\r\n    QueryVersionInfo(GetModuleHandle(NULL), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n    sprintf_s(szStartPattern, MAX_PATH, \"## %d.%d.%d\\n\", dwLeftMost, dwSecondLeft, dwSecondRight);\r\n    sprintf_s(szEndPattern, MAX_PATH, \"## \");\r\n\r\n    FILE* f = NULL;\r\n    fopen_s(&f, \"..\\\\..\\\\..\\\\\" FILE_NAME, \"r\");\r\n    if (!f)\r\n    {\r\n        fopen_s(&f, \"..\\\\..\\\\\" FILE_NAME, \"r\");\r\n        if (!f)\r\n        {\r\n            fopen_s(&f, \"..\\\\\" FILE_NAME, \"r\");\r\n            if (!f)\r\n            {\r\n                fopen_s(&f, \"\" FILE_NAME, \"r\");\r\n            }\r\n        }\r\n    }\r\n    if (f)\r\n    {\r\n        int state = 0;\r\n        size_t bufsiz = MAX_LINE_LENGTH, numChRd = 0;\r\n        char* line = malloc(MAX_LINE_LENGTH * sizeof(char));\r\n        while ((numChRd = getline(&line, &bufsiz, f)) != -1)\r\n        {\r\n            if (state == 0 && !strcmp(line, szStartPattern))\r\n            {\r\n                state = 1;\r\n                numChRd = getline(&line, &bufsiz, f);\r\n                continue;\r\n            }\r\n            else if (state == 1 && !strncmp(line, szEndPattern, strlen(szEndPattern)))\r\n            {\r\n                state = 2;\r\n                break;\r\n            }\r\n            if (state == 1)\r\n            {\r\n                printf(\"%s\", line);\r\n            }\r\n        }\r\n        free(line);\r\n        printf(\r\n            \"Please consult the [README](https://github.com/valinet/ExplorerPatcher/blob/master/README.md) for more details.\\n\"\r\n            \"A detailed change log is available [here](https://github.com/valinet/ExplorerPatcher/blob/master/CHANGELOG.md).\\n\"\r\n            \"An archive containing all the files generated during the build process (including `dxgi.dll` and symbol files) is available [here](%s).\\n\\n\"\r\n            \"*This release has been published automatically from %s %s in branch [%s](https://github.com/valinet/ExplorerPatcher/tree/%s/).*\",\r\n            argc == 4 ? argv[3] : \"https://github.com/valinet/ExplorerPatcher/actions\",\r\n            argc == 4 ? \"commits up to and including\" : \"the latest commits\",\r\n            argc == 4 ? argv[1] : \"\",\r\n            argc == 4 ? argv[2] : \"master\",\r\n            argc == 4 ? argv[2] : \"master\"\r\n        );\r\n        fclose(f);\r\n    }\r\n\r\n    return 0;\r\n}\r\n"
  },
  {
    "path": "ep_generate_release_description/ep_generate_release_description.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{c362cfbe-7c6b-4457-8d01-839818d42ecb}</ProjectGuid>\r\n    <RootNamespace>epgeneratereleasedescription</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\getline.c\" />\r\n    <ClCompile Include=\"ep_generate_release_description.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\getline.h\" />\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\queryversion.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_generate_release_description/ep_generate_release_description.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_generate_release_description.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\getline.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\getline.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\queryversion.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_generate_release_name/ep_generate_release_name.c",
    "content": "#include \"../ExplorerPatcher/queryversion.h\"\r\n\r\nint main(int argc, char** argv)\r\n{\r\n    SetConsoleOutputCP(CP_UTF8);\r\n\r\n    DWORD dwLeftMost = 0;\r\n    DWORD dwSecondLeft = 0;\r\n    DWORD dwSecondRight = 0;\r\n    DWORD dwRightMost = 0;\r\n\r\n    QueryVersionInfo(GetModuleHandle(NULL), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n    printf(\"%d.%d.%d.%d\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n\r\n    return 0;\r\n}"
  },
  {
    "path": "ep_generate_release_name/ep_generate_release_name.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{78d0c3cf-25c0-41d4-9359-0e9ab72b9874}</ProjectGuid>\r\n    <RootNamespace>epqueryversion</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_generate_release_name.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\queryversion.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_generate_release_name/ep_generate_release_name.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_generate_release_name.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\queryversion.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_generate_release_name/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Visual C++ generated include file.\r\n// Used by ep_setup.rc\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        101\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1001\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "ep_gui/GUI.c",
    "content": "#include <initguid.h>\nDEFINE_GUID(LiveSetting_Property_GUID, 0xc12bcd8e, 0x2a8e, 0x4950, 0x8a, 0xe7, 0x36, 0x25, 0x11, 0x1d, 0x58, 0xeb);\n#include <oleacc.h>\n#include \"GUI.h\"\n\nTCHAR GUI_title[260];\nFILE* AuditFile = NULL;\nWCHAR wszLanguage[LOCALE_NAME_MAX_LENGTH];\nWCHAR wszThreadLanguage[LOCALE_NAME_MAX_LENGTH];\nvoid* GUI_FileMapping = NULL;\nDWORD GUI_FileSize = 0;\nBOOL g_darkModeEnabled = FALSE;\nDWORD dwTaskbarPosition = 3;\nDWORD GUI_TaskbarStyle = -1;\n\nLSTATUS SetPolicy(HKEY hKey, LPCWSTR wszPolicyPath, LPCWSTR wszPolicyName, DWORD dwVal)\n{\n    WCHAR wszPath[MAX_PATH];\n    GetSystemDirectoryW(wszPath, MAX_PATH);\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\reg.exe\");\n    WCHAR wszArguments[MAX_PATH];\n    if (dwVal)\n    {\n        swprintf_s(wszArguments, MAX_PATH, L\"ADD \\\"%s\\\\%s\\\" /V %s /T REG_DWORD /D %d /F\", (hKey == HKEY_LOCAL_MACHINE ? L\"HKLM\" : L\"HKCU\"), wszPolicyPath, wszPolicyName, dwVal);\n    }\n    else\n    {\n        swprintf_s(wszArguments, MAX_PATH, L\"DELETE \\\"%s\\\\%s\\\" /V %s /F\", (hKey == HKEY_LOCAL_MACHINE ? L\"HKLM\" : L\"HKCU\"), wszPolicyPath, wszPolicyName);\n    }\n    SHELLEXECUTEINFOW ShExecInfo = { 0 };\n    ShExecInfo.cbSize = sizeof(ShExecInfo);\n    ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;\n    ShExecInfo.hwnd = NULL;\n    ShExecInfo.lpVerb = L\"runas\";\n    ShExecInfo.lpFile = wszPath;\n    ShExecInfo.lpParameters = wszArguments;\n    ShExecInfo.lpDirectory = NULL;\n    ShExecInfo.nShow = SW_HIDE;\n    ShExecInfo.hInstApp = NULL;\n    if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)\n    {\n        WaitForSingleObject(ShExecInfo.hProcess, INFINITE);\n        DWORD dwExitCode = 0;\n        GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);\n        CloseHandle(ShExecInfo.hProcess);\n    }\n    return ERROR_SUCCESS;\n}\n\nint GUI_DeleteWeatherFolder()\n{\n    WCHAR wszWorkFolder[MAX_PATH + 1];\n    ZeroMemory(wszWorkFolder, (MAX_PATH + 1) * sizeof(WCHAR));\n    SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wszWorkFolder);\n    wcscat_s(wszWorkFolder, MAX_PATH + 1, L\"\\\\ExplorerPatcher\\\\ep_weather_host\");\n    wszWorkFolder[wcslen(wszWorkFolder) + 1] = 0;\n    SHFILEOPSTRUCTW op;\n    ZeroMemory(&op, sizeof(SHFILEOPSTRUCTW));\n    op.wFunc = FO_DELETE;\n    op.pFrom = wszWorkFolder;\n    op.fFlags = FOF_NO_UI;\n    if (!SHFileOperationW(&op))\n    {\n        return IDOK;\n    }\n    else\n    {\n        if (op.fAnyOperationsAborted)\n        {\n            return IDCANCEL;\n        }\n        else\n        {\n            return IDABORT;\n        }\n    }\n}\n\nBOOL GUI_Internal_DeleteWeatherFolder(int* res)\n{\n    if (!FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL))\n    {\n        if (!*res)\n        {\n            if (PleaseWait_UpdateTimeout(3000))\n            {\n                *res = IDRETRY;\n            }\n            else\n            {\n                *res = IDABORT;\n                return FALSE;\n            }\n        }\n        else if (*res == IDRETRY)\n        {\n            *res = GUI_DeleteWeatherFolder();\n            if (*res != IDRETRY)\n            {\n                return FALSE;\n            }\n        }\n    }\n    else\n    {\n    }\n    return TRUE;\n}\n\nvoid PlayHelpMessage(GUI* _this)\n{\n    unsigned int max_section = 0;\n    for (unsigned int i = 0; i < 100; ++i)\n    {\n        if (_this->sectionNames[i][0] == 0)\n        {\n            max_section = i - 1;\n            break;\n        }\n    }\n\n    WCHAR wszAccText[1000];\n    swprintf_s(\n        wszAccText,\n        1000,\n        L\"Welcome to ExplorerPatcher. \"\n        L\"Selected page is: %s: %d of %d. \"\n        L\"To switch pages, press the Left or Right arrow keys or press a number (%d to %d). \"\n        L\"To select an item, press the Up or Down arrow keys or Shift+Tab and Tab. \"\n        L\"To interact with the selected item, press Space or Return. \"\n        L\"To close this window, press Escape. \"\n        L\"Press a number to switch to the corresponding page: \",\n        _this->sectionNames[_this->section],\n        _this->section + 1,\n        max_section + 1,\n        1,\n        max_section + 1\n    );\n    for (unsigned int i = 0; i < 100; ++i)\n    {\n        if (_this->sectionNames[i][0] == 0)\n        {\n            break;\n        }\n        WCHAR wszAdd[100];\n        swprintf_s(wszAdd, 100, L\"%d: %s, \", i + 1, _this->sectionNames[i]);\n        wcscat_s(wszAccText, 1000, wszAdd);\n    }\n    wcscat_s(wszAccText, 1000, L\"\\nTo listen to this message again, press the F1 key at any time.\\n\");\n    SetWindowTextW(_this->hAccLabel, wszAccText);\n    NotifyWinEvent(\n        EVENT_OBJECT_LIVEREGIONCHANGED,\n        _this->hAccLabel,\n        OBJID_CLIENT,\n        CHILDID_SELF\n    );\n}\n\nNTSTATUS NTAPI hookRtlQueryElevationFlags(DWORD* pFlags)\n{\n    *pFlags = 0;\n    return 0;\n}\n\nPVOID pvRtlQueryElevationFlags;\n\nLONG NTAPI OnVex(PEXCEPTION_POINTERS ExceptionInfo)\n{\n    if (ExceptionInfo->ExceptionRecord->ExceptionCode == STATUS_SINGLE_STEP &&\n        ExceptionInfo->ExceptionRecord->ExceptionAddress == pvRtlQueryElevationFlags)\n    {\n        ExceptionInfo->ContextRecord->\n#if defined(_X86_)\n            Eip\n#elif defined (_AMD64_)\n            Rip\n#elif defined(_M_ARM64)\n            Pc\n#else\n#error not implemented\n#endif\n            = (ULONG_PTR)hookRtlQueryElevationFlags;\n\n        return EXCEPTION_CONTINUE_EXECUTION;\n    }\n\n    return EXCEPTION_CONTINUE_SEARCH;\n}\n\nBOOL IsColorSchemeChangeMessage(LPARAM lParam)\n{\n    BOOL is = FALSE;\n    if (lParam && CompareStringOrdinal(lParam, -1, L\"ImmersiveColorSet\", -1, TRUE) == CSTR_EQUAL)\n    {\n        is = TRUE;\n    }\n    return is;\n}\n\nLSTATUS GUI_Internal_RegSetValueExW(\n    HKEY       hKey,\n    LPCWSTR    lpValueName,\n    DWORD      Reserved,\n    DWORD      dwType,\n    const BYTE* lpData,\n    DWORD      cbData\n)\n{\n    if (!lpValueName || wcsncmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID), 50))\n    {\n        if (lpValueName && !wcscmp(lpValueName, L\"LogonLogoffShutdownSounds\"))\n        {\n            DWORD bExcluded = !*(const DWORD*)lpData;\n\n            HKEY localHKey = NULL;\n            RegOpenKeyExW(HKEY_CURRENT_USER, L\"AppEvents\\\\EventLabels\\\\SystemExit\", REG_OPTION_NON_VOLATILE, KEY_WRITE, &localHKey);\n            if (localHKey && localHKey != INVALID_HANDLE_VALUE)\n            {\n                RegSetValueExW(localHKey, L\"ExcludeFromCPL\", 0, REG_DWORD, &bExcluded, sizeof(DWORD));\n                RegCloseKey(localHKey);\n            }\n\n            localHKey = NULL;\n            RegOpenKeyExW(HKEY_CURRENT_USER, L\"AppEvents\\\\EventLabels\\\\WindowsLogoff\", REG_OPTION_NON_VOLATILE, KEY_WRITE, &localHKey);\n            if (localHKey && localHKey != INVALID_HANDLE_VALUE)\n            {\n                RegSetValueExW(localHKey, L\"ExcludeFromCPL\", 0, REG_DWORD, &bExcluded, sizeof(DWORD));\n                RegCloseKey(localHKey);\n            }\n\n            localHKey = NULL;\n            RegOpenKeyExW(HKEY_CURRENT_USER, L\"AppEvents\\\\EventLabels\\\\WindowsLogon\", REG_OPTION_NON_VOLATILE, KEY_WRITE, &localHKey);\n            if (localHKey && localHKey != INVALID_HANDLE_VALUE)\n            {\n                RegSetValueExW(localHKey, L\"ExcludeFromCPL\", 0, REG_DWORD, &bExcluded, sizeof(DWORD));\n                RegCloseKey(localHKey);\n            }\n        }\n        return RegSetValueExW(hKey, lpValueName, 0, dwType, lpData, cbData);\n    }\n\n    if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_TaskbarPosition\"))\n    {\n        HWND hwndTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n        if (hwndTray)\n        {\n            SendMessageW(hwndTray, WM_USER + 0x1CA, 6, *(DWORD*)lpData); // -> TrayUI::_HandleTrayPrivateSettingMessage(6, *(DWORD*)lpData)\n            dwTaskbarPosition = *(DWORD*)lpData;\n        }\n        else\n        {\n            StuckRectsData srd;\n            DWORD pcbData = sizeof(StuckRectsData);\n            RegGetValueW(\n                HKEY_CURRENT_USER,\n                L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StuckRectsLegacy\",\n                L\"Settings\",\n                REG_BINARY,\n                NULL,\n                &srd,\n                &pcbData);\n            if (pcbData == sizeof(StuckRectsData) && srd.pvData[0] == sizeof(StuckRectsData) && srd.pvData[1] == -2)\n            {\n                srd.pvData[3] = *(DWORD*)lpData;\n                dwTaskbarPosition = *(DWORD*)lpData;\n                RegSetKeyValueW(\n                    HKEY_CURRENT_USER,\n                    L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StuckRectsLegacy\",\n                    L\"Settings\",\n                    REG_BINARY,\n                    &srd,\n                    sizeof(StuckRectsData)\n                );\n            }\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_MMTaskbarPosition\"))\n    {\n        HKEY hKeyStuckRectsLegacy = NULL;\n        RegOpenKeyExW(\n            HKEY_CURRENT_USER,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\MMStuckRectsLegacy\",\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WRITE,\n            &hKeyStuckRectsLegacy\n        );\n        if (hKeyStuckRectsLegacy)\n        {\n            DWORD cValues = 0;\n            RegQueryInfoKeyW(\n                hKeyStuckRectsLegacy,\n                NULL,\n                NULL,\n                NULL,\n                NULL,\n                NULL,\n                NULL,\n                &cValues,\n                NULL,\n                NULL,\n                NULL,\n                NULL\n            );\n            WCHAR name[60];\n            DWORD szName = 60;\n            StuckRectsData srd;\n            DWORD pcbData = sizeof(StuckRectsData);\n            for (int i = 0; i < cValues; ++i)\n            {\n                RegEnumValueW(\n                    hKeyStuckRectsLegacy,\n                    i,\n                    name,\n                    &szName,\n                    0,\n                    NULL,\n                    &srd,\n                    &pcbData\n                );\n                szName = 60;\n                srd.pvData[3] = *(DWORD*)lpData;\n                pcbData = sizeof(StuckRectsData);\n                RegSetKeyValueW(\n                    HKEY_CURRENT_USER,\n                    L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\MMStuckRectsLegacy\",\n                    name,\n                    REG_BINARY,\n                    &srd,\n                    sizeof(StuckRectsData)\n                );\n            }\n            RegCloseKey(hKeyStuckRectsLegacy);\n            SendNotifyMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L\"TraySettings\");\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_AutoHideTaskbar\"))\n    {\n        APPBARDATA abd;\n        abd.cbSize = sizeof(APPBARDATA);\n        abd.lParam = *(DWORD*)lpData;\n        SHAppBarMessage(ABM_SETSTATE, &abd);\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\"))\n    {\n        DWORD dwData = 0, dwSize = sizeof(DWORD);\n        RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\\\\People\", L\"PeopleBand\", RRF_RT_DWORD, NULL, &dwData, &dwSize);\n        if ((dwData && *(DWORD*)lpData) || (!dwData && !*(DWORD*)lpData))\n        {\n            return ERROR_SUCCESS;\n        }\n        PostMessageW(FindWindowW(L\"Shell_TrayWnd\", NULL), WM_COMMAND, 435, 0);\n        DWORD dwProcessId = 0;\n        GetWindowThreadProcessId(FindWindowW(L\"Shell_TrayWnd\", NULL), &dwProcessId);\n        if (dwProcessId)\n        {\n            AllowSetForegroundWindow(dwProcessId);\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_Start_MaximumFrequentApps\"))\n    {\n        RegSetKeyValueW(\n            HKEY_CURRENT_USER,\n            TEXT(REGPATH_OLD),\n            L\"Start_MaximumFrequentApps\",\n            dwType,\n            lpData,\n            cbData\n        );\n        return RegSetValueExW(hKey, L\"Start_MaximumFrequentApps\", 0, dwType, lpData, cbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartDocked_DisableRecommendedSection\"))\n    {\n        RegSetKeyValueW(\n            HKEY_CURRENT_USER,\n            TEXT(REGPATH_OLD),\n            L\"StartDocked_DisableRecommendedSection\",\n            dwType,\n            lpData,\n            cbData\n        );\n        return RegSetValueExW(hKey, L\"StartDocked_DisableRecommendedSection\", 0, dwType, lpData, cbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartUI_EnableRoundedCorners\"))\n    {\n        RegSetKeyValueW(\n            HKEY_CURRENT_USER,\n            TEXT(REGPATH_OLD),\n            L\"StartUI_EnableRoundedCorners\",\n            dwType,\n            lpData,\n            cbData\n        );\n        return RegSetValueExW(hKey, L\"StartUI_EnableRoundedCorners\", 0, dwType, lpData, cbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartUI_ShowMoreTiles\"))\n    {\n        RegSetKeyValueW(\n            HKEY_CURRENT_USER,\n            TEXT(REGPATH_OLD),\n            L\"StartUI_ShowMoreTiles\",\n            dwType,\n            lpData,\n            cbData\n        );\n        return RegSetValueExW(hKey, L\"StartUI_ShowMoreTiles\", 0, dwType, lpData, cbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_ForceStartSize\"))\n    {\n        return SetPolicy(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Explorer\", L\"ForceStartSize\", *(DWORD*)lpData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_NoStartMenuMorePrograms\"))\n    {\n        return SetPolicy(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\Explorer\", L\"NoStartMenuMorePrograms\", *(DWORD*)lpData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_DisableRoundedCorners\"))\n    {\n        return RegisterDWMService(*(DWORD*)lpData, 0);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_FileExplorerCommandUI\"))\n    {\n        DWORD dwValue = *(DWORD*)lpData;\n        if (dwValue == 0 || dwValue == 3 || dwValue == 4) // This no longer has any effect on 22H2\n        {\n            RegDeleteTreeW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\");\n        }\n        else\n        {\n            RegSetKeyValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\\\InProcServer32\", L\"\", REG_SZ, L\"\", 1);\n        }\n        RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"FileExplorerCommandUI\", REG_DWORD, lpData, sizeof(DWORD));\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_RegisterAsShellExtension\"))\n    {\n        HKEY hKey2 = NULL;\n        RegOpenKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"Software\\\\Classes\\\\CLSID\\\\\" _T(EP_CLSID) L\"\\\\InprocServer32\",\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WOW64_64KEY,\n            &hKey2\n        );\n        WCHAR wszArgs[MAX_PATH];\n        if (((hKey2 == NULL || hKey2 == INVALID_HANDLE_VALUE) && !*(DWORD*)lpData) || !(hKey2 == NULL || hKey2 == INVALID_HANDLE_VALUE) && (*(DWORD*)lpData))\n        {\n            RegCloseKey(hKey2);\n            return ERROR_SUCCESS;\n        }\n        if (!(hKey2 == NULL || hKey2 == INVALID_HANDLE_VALUE))\n        {\n            RegCloseKey(hKey2);\n        }\n        if (*(DWORD*)lpData)\n        {\n            wszArgs[0] = L'\\\"';\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 1);\n        }\n        else\n        {\n            wszArgs[0] = L'/';\n            wszArgs[1] = L'u';\n            wszArgs[2] = L' ';\n            wszArgs[3] = L'\"';\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4);\n        }\n#if defined(_M_X64)\n        wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".amd64.dll\\\"\");\n#elif defined(_M_ARM64)\n        wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".arm64.dll\\\"\");\n#else\n#error \"Unsupported architecture\"\n#endif\n        wprintf(L\"%s\\n\", wszArgs);\n        WCHAR wszApp[MAX_PATH * 2];\n        GetSystemDirectoryW(wszApp, MAX_PATH * 2);\n        wcscat_s(wszApp, MAX_PATH * 2, L\"\\\\regsvr32.exe\");\n        wprintf(L\"%s\\n\", wszApp);\n        SHELLEXECUTEINFOW sei;\n        ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\n        sei.cbSize = sizeof(sei);\n        sei.fMask = SEE_MASK_NOCLOSEPROCESS;\n        sei.hwnd = NULL;\n        sei.hInstApp = NULL;\n        sei.lpVerb = L\"runas\";\n        sei.lpFile = wszApp;\n        sei.lpParameters = wszArgs;\n        sei.hwnd = NULL;\n        sei.nShow = SW_NORMAL;\n        if (ShellExecuteExW(&sei) && sei.hProcess)\n        {\n            WaitForSingleObject(sei.hProcess, INFINITE);\n            DWORD dwExitCode = 0;\n            if (GetExitCodeProcess(sei.hProcess, &dwExitCode) && !dwExitCode)\n            {\n\n            }\n            else\n            {\n\n            }\n            CloseHandle(sei.hProcess);\n        }\n        else\n        {\n            DWORD dwError = GetLastError();\n            if (dwError == ERROR_CANCELLED)\n            {\n            }\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_DisableModernSearchBar\"))\n    {\n        BOOL rv = FALSE;\n        if (!*(DWORD*)lpData) RegDeleteTreeW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\WOW6432Node\\\\CLSID\\\\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\");\n        else RegSetKeyValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\WOW6432Node\\\\CLSID\\\\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\\\\TreatAs\", L\"\", REG_SZ, L\"{64bc32b5-4eec-4de7-972d-bd8bd0324537}\", 39 * sizeof(TCHAR));\n        if (!*(DWORD*)lpData) rv = RegDeleteTreeW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\");\n        else rv = RegSetKeyValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\\\\TreatAs\", L\"\", REG_SZ, L\"{64bc32b5-4eec-4de7-972d-bd8bd0324537}\", 39 * sizeof(TCHAR));\n        return rv;\n    }\n\n}\n\nLSTATUS GUI_RegSetValueExW(\n    HKEY       hKey,\n    LPCWSTR    lpValueName,\n    DWORD      Reserved,\n    DWORD      dwType,\n    const BYTE* lpData,\n    DWORD      cbData\n)\n{\n    LSTATUS lRes = GUI_Internal_RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);\n    return lRes;\n}\n\nLSTATUS GUI_Internal_RegQueryValueExW(\n    HKEY    hKey,\n    LPCWSTR lpValueName,\n    LPDWORD lpReserved,\n    LPDWORD lpType,\n    LPBYTE  lpData,\n    LPDWORD lpcbData\n)\n{\n    if (!lpValueName || wcsncmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID), 50))\n    {\n        return RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);\n    }\n    if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_TaskbarPosition\"))\n    {\n        HWND hwndTray = FindWindowW(L\"Shell_TrayWnd\", NULL);\n        if (hwndTray)\n        {\n            dwTaskbarPosition = *(DWORD*)lpData = (DWORD)SendMessageW(hwndTray, WM_USER + 0x1CA, 5, 0); // -> TrayUI::_HandleTrayPrivateSettingMessage(5, 0)\n        }\n        else\n        {\n            StuckRectsData srd;\n            DWORD pcbData = sizeof(StuckRectsData);\n            RegGetValueW(\n                HKEY_CURRENT_USER,\n                L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\StuckRectsLegacy\",\n                L\"Settings\",\n                REG_BINARY,\n                NULL,\n                &srd,\n                &pcbData);\n            if (pcbData == sizeof(StuckRectsData) && srd.pvData[0] == sizeof(StuckRectsData) && srd.pvData[1] == -2)\n            {\n                dwTaskbarPosition = *(DWORD*)lpData = srd.pvData[3];\n            }\n            else\n            {\n                return ERROR_ACCESS_DENIED;\n            }\n        }\n        if (GUI_TaskbarStyle == 0)\n        {\n            if (*(DWORD*)lpData != 1 && *(DWORD*)lpData != 3) // Disallow left/right settings for Windows 11 taskbar, as this breaks it\n            {\n                *(DWORD*)lpData = 3;\n            }\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_MMTaskbarPosition\"))\n    {\n        HKEY hKey = NULL;\n        RegOpenKeyExW(\n            HKEY_CURRENT_USER,\n            L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\MMStuckRectsLegacy\",\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WRITE,\n            &hKey\n        );\n        if (hKey)\n        {\n            WCHAR name[60];\n            DWORD szName = 60;\n            StuckRectsData srd;\n            DWORD pcbData = sizeof(StuckRectsData);\n            RegEnumValueW(\n                hKey,\n                0,\n                name,\n                &szName,\n                0,\n                NULL,\n                &srd,\n                &pcbData\n            );\n            if (pcbData == sizeof(StuckRectsData) && srd.pvData[0] == sizeof(StuckRectsData) && srd.pvData[1] == -2)\n            {\n                if (GUI_TaskbarStyle == 0)\n                {\n                    if (srd.pvData[3] != 1 && srd.pvData[3] != 3) // Disallow left/right settings for Windows 11 taskbar, as this breaks it\n                    {\n                        srd.pvData[3] = 3;\n                    }\n                }\n                *(DWORD*)lpData = srd.pvData[3];\n                RegCloseKey(hKey);\n                return ERROR_SUCCESS;\n            }\n            RegCloseKey(hKey);\n        }\n        return ERROR_ACCESS_DENIED;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_AutoHideTaskbar\"))\n    {\n        APPBARDATA abd;\n        abd.cbSize = sizeof(APPBARDATA);\n        *(DWORD*)lpData = (SHAppBarMessage(ABM_GETSTATE, &abd) == ABS_AUTOHIDE);\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\"))\n    {\n        return RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\\\\People\", L\"PeopleBand\", RRF_RT_DWORD, NULL, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_Start_MaximumFrequentApps\"))\n    {\n        return RegQueryValueExW(hKey, L\"Start_MaximumFrequentApps\", lpReserved, lpType, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartDocked_DisableRecommendedSection\"))\n    {\n        return RegQueryValueExW(hKey, L\"StartDocked_DisableRecommendedSection\", lpReserved, lpType, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartUI_EnableRoundedCorners\"))\n    {\n        return RegQueryValueExW(hKey, L\"StartUI_EnableRoundedCorners\", lpReserved, lpType, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_StartUI_ShowMoreTiles\"))\n    {\n        return RegQueryValueExW(hKey, L\"StartUI_ShowMoreTiles\", lpReserved, lpType, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_ForceStartSize\"))\n    {\n        return RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Explorer\", L\"ForceStartSize\", RRF_RT_DWORD, NULL, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_NoStartMenuMorePrograms\"))\n    {\n        return RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\Explorer\", L\"NoStartMenuMorePrograms\", RRF_RT_DWORD, NULL, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_DisableRoundedCorners\"))\n    {\n        HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));\n        if (h_exists)\n        {\n            if (GetLastError() == ERROR_ALREADY_EXISTS)\n            {\n                *(DWORD*)lpData = 1;\n            }\n            else\n            {\n                *(DWORD*)lpData = 0;\n            }\n            CloseHandle(h_exists);\n        }\n        else\n        {\n            if (GetLastError() == ERROR_ACCESS_DENIED)\n            {\n                *(DWORD*)lpData = 1;\n            }\n            else\n            {\n                *(DWORD*)lpData = 0;\n            }\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_FileExplorerCommandUI\"))\n    {\n        /*if (RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\\\InProcServer32\", L\"\", RRF_RT_REG_SZ, NULL, NULL, NULL) != ERROR_SUCCESS)\n        {\n            *lpcbData = sizeof(DWORD);\n            *(DWORD*)lpData = 0;\n            return ERROR_SUCCESS;\n        }*/\n        return RegQueryValueExW(hKey, L\"FileExplorerCommandUI\", lpReserved, lpType, lpData, lpcbData);\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_RegisterAsShellExtension\"))\n    {\n        HKEY hKey2 = NULL;\n        RegOpenKeyExW(\n            HKEY_LOCAL_MACHINE,\n            L\"Software\\\\Classes\\\\CLSID\\\\\" _T(EP_CLSID) L\"\\\\InprocServer32\",\n            REG_OPTION_NON_VOLATILE,\n            KEY_READ | KEY_WOW64_64KEY,\n            &hKey2\n        );\n        if (hKey2 == NULL || hKey2 == INVALID_HANDLE_VALUE)\n        {\n            *(DWORD*)lpData = 0;\n        }\n        else\n        {\n            *(DWORD*)lpData = 1;\n            RegCloseKey(hKey2);\n        }\n        return ERROR_SUCCESS;\n    }\n    else if (!wcscmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID) L\"_DisableModernSearchBar\"))\n    {\n        *lpcbData = sizeof(DWORD);\n        *(DWORD*)lpData = 0;\n        TCHAR wszGUID[39];\n        DWORD dwSize = 39 * sizeof(TCHAR);\n        BOOL rv = RegGetValueW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Classes\\\\CLSID\\\\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\\\\TreatAs\", L\"\", RRF_RT_REG_SZ, NULL, wszGUID, &dwSize);\n        if (rv == ERROR_SUCCESS && !wcscmp(wszGUID, L\"{64bc32b5-4eec-4de7-972d-bd8bd0324537}\")) *(DWORD*)lpData = 1;\n        return ERROR_SUCCESS;\n    }\n}\n\nLSTATUS GUI_RegCreateKeyExW(\n    HKEY                        hKey,\n    LPCWSTR                     lpSubKey,\n    DWORD                       Reserved,\n    LPWSTR                      lpClass,\n    DWORD                       dwOptions,\n    REGSAM                      samDesired,\n    const LPSECURITY_ATTRIBUTES lpSecurityAttributes,\n    PHKEY                       phkResult,\n    LPDWORD                     lpdwDisposition\n)\n{\n    LSTATUS lRes = RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);\n    if (AuditFile)\n    {\n        fwprintf(AuditFile, L\"[%s\\\\%s]\\n\", hKey == HKEY_CURRENT_USER ? L\"HKEY_CURRENT_USER\" : L\"HKEY_LOCAL_MACHINE\", lpSubKey);\n    }\n    return lRes;\n}\n\nLSTATUS GUI_RegOpenKeyExW(\n    HKEY    hKey,\n    LPCWSTR lpSubKey,\n    DWORD   ulOptions,\n    REGSAM  samDesired,\n    PHKEY   phkResult\n)\n{\n    LSTATUS lRes = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);\n    if (AuditFile)\n    {\n        fwprintf(AuditFile, L\"[%s%s\\\\%s]\\n\", (*phkResult == NULL || *phkResult == INVALID_HANDLE_VALUE) ? L\"-\" : L\"\", hKey == HKEY_CURRENT_USER ? L\"HKEY_CURRENT_USER\" : L\"HKEY_LOCAL_MACHINE\", lpSubKey);\n        WCHAR wszDefVal[MAX_PATH];\n        ZeroMemory(wszDefVal, MAX_PATH);\n        DWORD dwLen = MAX_PATH;\n        RegGetValueW(hKey, lpSubKey, NULL, RRF_RT_REG_SZ, NULL, wszDefVal, &dwLen);\n        if (wszDefVal[0])\n        {\n            fwprintf(AuditFile, L\"@=\\\"%s\\\"\\n\", wszDefVal);\n        }\n        else\n        {\n            fwprintf(AuditFile, L\"@=\\\"\\\"\\n\");\n        }\n    }\n    return lRes;\n}\n\nLSTATUS GUI_RegQueryValueExW(\n    HKEY    hKey,\n    LPCWSTR lpValueName,\n    LPDWORD lpReserved,\n    LPDWORD lpType,\n    LPBYTE  lpData,\n    LPDWORD lpcbData\n)\n{\n    DWORD dwSize = lpcbData ? *(DWORD*)lpcbData : sizeof(DWORD);\n    LSTATUS lRes = GUI_Internal_RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);\n    if (AuditFile)\n    {\n        if (dwSize != sizeof(DWORD))\n        {\n            fwprintf(AuditFile, L\"%s\\\"%s\\\"=\\\"%s\\\"\\n\", (lpValueName && wcsncmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID), 50)) ? L\"\" : L\";\", lpValueName, lpData);\n        }\n        else\n        {\n            fwprintf(AuditFile, L\"%s\\\"%s\\\"=dword:%08x\\n\", (lpValueName && wcsncmp(lpValueName, L\"Virtualized_\" _T(EP_CLSID), 50)) ? L\"\" : L\";\", lpValueName, *(DWORD*)lpData);\n        }\n    }\n    return lRes;\n}\n\nstatic void GUI_SetSection(GUI* _this, BOOL bCheckEnablement, int dwSection)\n{\n    _this->section = dwSection;\n\n    HKEY hKey = NULL;\n    DWORD dwSize = sizeof(DWORD);\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH),\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        return;\n    }\n\n    BOOL bEnabled = FALSE;\n    if (bCheckEnablement)\n    {\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"LastSectionInProperties\"),\n            0,\n            NULL,\n            &bEnabled,\n            &dwSize\n        );\n        dwSection++;\n    }\n    else\n    {\n        bEnabled = TRUE;\n    }\n\n    if (bEnabled)\n    {\n        RegSetValueExW(\n            hKey,\n            TEXT(\"LastSectionInProperties\"),\n            0,\n            REG_DWORD,\n            &dwSection,\n            sizeof(DWORD)\n        );\n    }\n\n    RegCloseKey(hKey);\n}\n\nstatic void GUI_SubstituteLocalizedString(wchar_t* str, size_t cch)\n{\n    // %R:1212%\n    //    ^^^^ The resource ID\n    wchar_t* pszSubstituteBegin = wcsstr(str, L\"%R:\");\n    if (!pszSubstituteBegin) return;\n\n    wchar_t* pszSubstituteEnd = wcschr(pszSubstituteBegin + 3, L'%');\n    if (!pszSubstituteEnd) return;\n    ++pszSubstituteEnd; // Skip the %\n\n    int resId = _wtoi(pszSubstituteBegin + 3);\n    if (resId == 0) return;\n\n    const wchar_t* pszLocalized = NULL;\n    int cchLocalized = LoadStringW(hModule, resId, (LPWSTR)&pszLocalized, 0);\n    if (cchLocalized == 0 || !pszLocalized) return;\n\n    size_t cchStrBeginToSubstituteBegin = pszSubstituteBegin - str;\n    size_t cchSubstituteEndToStrEnd = wcslen(pszSubstituteEnd);\n\n    wchar_t* pszLocalizedEnd = pszSubstituteBegin + cchLocalized;\n    size_t cchStrBeginToLocalizedEnd = cchStrBeginToSubstituteBegin + cchLocalized;\n    size_t cchLocalizedEnd = cch - cchStrBeginToLocalizedEnd;\n\n    // Move the end to make space\n    memmove_s(\n        pszLocalizedEnd,\n        sizeof(wchar_t) * cchLocalizedEnd,\n        pszSubstituteEnd,\n        sizeof(wchar_t) * (cchSubstituteEndToStrEnd + 1 /*NUL*/)\n    );\n\n    // Copy the localized string\n    memcpy_s(\n        pszSubstituteBegin,\n        sizeof(wchar_t) * (cch - cchStrBeginToSubstituteBegin),\n        pszLocalized,\n        sizeof(wchar_t) * cchLocalized\n    );\n}\n\nstatic void GUI_EnumerateLanguagesCallback(const EP_L10N_Language* language, void* data)\n{\n    HMENU hMenu = data;\n\n    MENUITEMINFOW menuInfo;\n    ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n    menuInfo.cbSize = sizeof(MENUITEMINFOW);\n    menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;\n    menuInfo.wID = language->id + 1;\n    menuInfo.dwItemData = NULL;\n    menuInfo.fType = MFT_STRING;\n    menuInfo.dwTypeData = (LPWSTR)language->wszDisplayName; // Copied by the system\n    menuInfo.cch = (UINT)wcslen(language->wszDisplayName);\n    InsertMenuItemW(hMenu, 2, FALSE, &menuInfo);\n}\n\nstatic void GUI_PopulateLanguageSelectorMenu(HMENU hMenu)\n{\n    // Follow system setting (default)\n    wchar_t wszItemTitle[128];\n    wszItemTitle[0] = 0;\n    LoadStringW(hModule, IDS_AT_SWS_COLORSCHEME_0, wszItemTitle, ARRAYSIZE(wszItemTitle));\n\n    MENUITEMINFOW menuInfo;\n    ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n    menuInfo.cbSize = sizeof(MENUITEMINFOW);\n    menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;\n    menuInfo.wID = 0 + 1;\n    menuInfo.dwItemData = NULL;\n    menuInfo.fType = MFT_STRING;\n    menuInfo.dwTypeData = wszItemTitle;\n    menuInfo.cch = (UINT)wcslen(wszItemTitle);\n\n    InsertMenuItemW(hMenu, 0, FALSE, &menuInfo);\n\n    // --------------------\n    menuInfo.fMask = MIIM_TYPE;\n    menuInfo.fType = MFT_SEPARATOR;\n    InsertMenuItemW(hMenu, 0, FALSE, &menuInfo);\n\n    // English\n    // <All other languages sorted in ascending order>\n    EP_L10N_EnumerateLanguages(hModule, RT_STRING, MAKEINTRESOURCEW(IDS_TB / 16 + 1), GUI_EnumerateLanguagesCallback, hMenu);\n}\n\nstatic void GUI_UpdateLanguages()\n{\n    EP_L10N_ApplyPreferredLanguageForCurrentThread();\n    EP_L10N_GetCurrentUserLanguage(wszLanguage, ARRAYSIZE(wszLanguage));\n    EP_L10N_GetCurrentThreadLanguage(wszThreadLanguage, ARRAYSIZE(wszThreadLanguage));\n}\n\nstatic DWORD GUI_GetTaskbarStyle(BOOL bAdjust)\n{\n    DWORD dwRes = IsWindows11() ? 2 : 1;\n    DWORD dwSize = sizeof(DWORD);\n    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"OldTaskbar\", RRF_RT_DWORD, NULL, &dwRes, &dwSize);\n    if (bAdjust)\n    {\n        AdjustTaskbarStyleValue(&dwRes);\n    }\n    return dwRes;\n}\n\nstatic void GUI_RemoveChoiceEntry(HMENU hMenu, UINT value)\n{\n    MENUITEMINFOA menuInfo;\n    ZeroMemory(&menuInfo, sizeof(MENUITEMINFOA));\n    menuInfo.cbSize = sizeof(MENUITEMINFOA);\n    menuInfo.fMask = MIIM_DATA;\n    GetMenuItemInfoA(hMenu, value + 1, FALSE, &menuInfo);\n    if (menuInfo.dwItemData)\n    {\n        free(menuInfo.dwItemData);\n    }\n    RemoveMenu(hMenu, value + 1, MF_BYCOMMAND);\n}\n\nstatic BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)\n{\n    GUI* _this;\n    LONG_PTR ptr = GetWindowLongPtr(hwnd, GWLP_USERDATA);\n    _this = (int*)(ptr);\n    double dx = _this->dpi.x / 96.0, dy = _this->dpi.y / 96.0;\n    _this->padding.left = GUI_PADDING_LEFT * dx;\n    _this->padding.right = GUI_PADDING_RIGHT * dx;\n    _this->padding.top = GUI_PADDING_TOP * dy;\n    _this->padding.bottom = GUI_PADDING_BOTTOM * dy;\n    _this->sidebarWidth = GUI_SIDEBAR_WIDTH * dx;\n\n    RECT rc;\n    GetClientRect(hwnd, &rc);\n\n    PVOID pRscr = NULL;\n    DWORD cbRscr = 0;\n    if (GUI_FileMapping && GUI_FileSize)\n    {\n        pRscr = GUI_FileMapping;\n        cbRscr = GUI_FileSize;\n    }\n    else\n    {\n        HRSRC hRscr = FindResource(\n            hModule,\n            IsWindows11() ? MAKEINTRESOURCE(IDR_REGISTRY1) : MAKEINTRESOURCE(IDR_REGISTRY2),\n            RT_RCDATA\n        );\n        if (!hRscr)\n        {\n            return FALSE;\n        }\n        HGLOBAL hgRscr = LoadResource(\n            hModule,\n            hRscr\n        );\n        if (!hgRscr)\n        {\n            return FALSE;\n        }\n        pRscr = LockResource(hgRscr);\n        cbRscr = SizeofResource(\n            hModule,\n            hRscr\n        );\n    }\n\n    UINT dpiX = 0, dpiY = 0;\n    HRESULT hr = GetDpiForMonitor(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), MDT_DEFAULT, &dpiX, &dpiY);\n    LOGFONT logFont;\n    memset(&logFont, 0, sizeof(logFont));\n    NONCLIENTMETRICS ncm;\n    ncm.cbSize = sizeof(NONCLIENTMETRICS);\n    SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0, dpiX);\n    logFont = ncm.lfCaptionFont;\n    //logFont.lfHeight = GUI_CAPTION_FONT_SIZE * dy;\n    //logFont.lfWeight = FW_BOLD;\n    HFONT hFontCaption = CreateFontIndirect(&logFont);\n    logFont = ncm.lfMenuFont;\n    //logFont.lfHeight = GUI_TITLE_FONT_SIZE * dy;\n    HFONT hFontTitle = CreateFontIndirect(&logFont);\n    logFont.lfWeight = FW_REGULAR;\n    logFont.lfUnderline = 1;\n    HFONT hFontUnderline = CreateFontIndirect(&logFont);\n    logFont.lfWeight = FW_REGULAR;\n    logFont.lfUnderline = 0;\n    HFONT hFontRegular = CreateFontIndirect(&logFont);\n    logFont.lfWeight = FW_DEMIBOLD;\n    //logFont.lfHeight = GUI_SECTION_FONT_SIZE * dy;\n    HFONT hFontSection = CreateFontIndirect(&logFont);\n    logFont.lfUnderline = 1;\n    HFONT hFontSectionSel = CreateFontIndirect(&logFont);\n    HFONT hOldFont = NULL;\n\n    DTTOPTS DttOpts;\n    DttOpts.dwSize = sizeof(DTTOPTS);\n    DttOpts.dwFlags = DTT_COMPOSITED | DTT_TEXTCOLOR;\n    //DttOpts.crText = GetSysColor(COLOR_WINDOWTEXT);\n    DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_DARK : GUI_TEXTCOLOR;\n    DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS;\n    RECT rcText;\n    DWORD dwMinWidthDp = 600; // 480\n    // if (!wcscmp(wszThreadLanguage, L\"nl-NL\")) dwMinWidthDp = 600;\n    DWORD dwMaxHeight = 0, dwMaxWidth = (DWORD)(dwMinWidthDp * (_this->dpi.x / 96.0));\n    BOOL bTabOrderHit = FALSE;\n    DWORD dwLeftPad = _this->padding.left + _this->sidebarWidth + _this->padding.right;\n    DWORD dwInitialLeftPad = dwLeftPad;\n\n    HDC hdcPaint = NULL;\n    BP_PAINTPARAMS params = { sizeof(BP_PAINTPARAMS) };\n    params.dwFlags = BPPF_ERASE;\n    HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hDC, &rc, BPBF_TOPDOWNDIB, &params, &hdcPaint);\n\n    if (!hDC || (hDC && hdcPaint))\n    {\n        if (!hDC)\n        {\n            hdcPaint = GetDC(hwnd);\n        }\n\n        if ((!IsThemeActive() || IsHighContrast()) && hDC)\n        {\n            COLORREF oldcr = SetBkColor(hdcPaint, GetSysColor(COLOR_3DFACE));\n            ExtTextOutW(hdcPaint, 0, 0, ETO_OPAQUE, &rc, L\"\", 0, 0);\n            SetBkColor(hdcPaint, oldcr);\n            SetTextColor(hdcPaint, GetSysColor(COLOR_WINDOWTEXT));\n            SetBkMode(hdcPaint, TRANSPARENT);\n        }\n        else if ((!IsWindows11() || IsDwmExtendFrameIntoClientAreaBrokenInThisBuild()) && hDC)\n        {\n            COLORREF oldcr = SetBkColor(hdcPaint, g_darkModeEnabled ? RGB(0, 0, 0) : RGB(255, 255, 255));\n            ExtTextOutW(hdcPaint, 0, 0, ETO_OPAQUE, &rc, L\"\", 0, 0);\n            SetBkColor(hdcPaint, oldcr);\n        }\n\n        BOOL bResetLastHeading = TRUE;\n        BOOL bWasSpecifiedSectionValid = FALSE;\n        FILE* f = fmemopen(pRscr, cbRscr, \"r\");\n        char* line = malloc(MAX_LINE_LENGTH * sizeof(char));\n        wchar_t* text = malloc((MAX_LINE_LENGTH + 3) * sizeof(wchar_t)); \n        wchar_t* name = malloc(MAX_LINE_LENGTH * sizeof(wchar_t));\n        wchar_t* section = malloc(MAX_LINE_LENGTH * sizeof(wchar_t));\n        size_t bufsiz = MAX_LINE_LENGTH, numChRd = 0, tabOrder = 1, currentSection = -1, topAdj = 0;\n        wchar_t* lastHeading = calloc(MAX_LINE_LENGTH, sizeof(wchar_t));\n        while ((numChRd = getline(&line, &bufsiz, f)) != -1)\n        {\n            hOldFont = NULL;\n            if (currentSection == _this->section)\n            {\n                bWasSpecifiedSectionValid = TRUE;\n            }\n            if (!strncmp(line, \";g \", 3))\n            {\n                continue;\n            }\n            if (!strncmp(line, \";s \", 3))\n            {\n                if (_this->bCalcExtent) continue;\n                char* funcName = strchr(line + 3, ' ');\n                funcName[0] = 0;\n                char* skipToName = line + 3;\n                funcName++;\n                strchr(funcName, '\\r')[0] = 0;\n                BOOL bSkipLines = FALSE;\n                DWORD dwRes = 0, dwSize = sizeof(DWORD);\n                if (!_stricmp(funcName, \"DoesOSBuildSupportSpotlight\") && !DoesOSBuildSupportSpotlight()) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsSpotlightEnabled\") && !IsSpotlightEnabled()) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsSWSEnabled\") && (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\", L\"AltTabSettings\", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 2))) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsOldTaskbar\") && GUI_GetTaskbarStyle(TRUE) == 0) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"!IsOldTaskbar\") && GUI_GetTaskbarStyle(TRUE) != 0) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsStockWin10Taskbar\") && GUI_GetTaskbarStyle(TRUE) != 1) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsAltImplTaskbar\") && GUI_GetTaskbarStyle(TRUE) <= 1) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsWindows10StartMenu\") && (!DoesWindows10StartMenuExist() || (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"Start_ShowClassicMode\", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1)))) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"!IsWindows10StartMenu\") && (DoesWindows10StartMenuExist() && (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"Start_ShowClassicMode\", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes == 1)))) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"DoesWindows10StartMenuExist\") && !DoesWindows10StartMenuExist()) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsWeatherEnabled\") && (dwRes = 0, RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\\\\People\", L\"PeopleBand\", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1))) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"IsWindows11Version22H2OrHigher\") && !IsWindows11Version22H2OrHigher()) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"!IsWindows11Version22H2OrHigher\") && IsWindows11Version22H2OrHigher()) bSkipLines = TRUE;\n                else if (!_stricmp(funcName, \"!(IsWindows11Version22H2OrHigher&&!IsOldTaskbar)\") && (IsWindows11Version22H2OrHigher() && GUI_GetTaskbarStyle(TRUE) == 0)) bSkipLines = TRUE;\n#if 1\n                else if (!_stricmp(funcName, \"LogonLogoffShutdownSoundsAvailable\")) bSkipLines = TRUE;\n#endif\n                if (bSkipLines)\n                {\n                    do\n                    {\n                        getline(&text, &bufsiz, f);\n                        strchr(text, '\\r')[0] = 0;\n                    } while (strncmp(text, \";g \", 3) || _stricmp((char*)text + 3, skipToName));\n                }\n                continue;\n            }\n            if (!strncmp(line, \";q\", 2))\n            {\n                bResetLastHeading = TRUE;\n                lastHeading[0] = 0;\n                continue;\n            }\n            if (strcmp(line, \"Windows Registry Editor Version 5.00\\r\\n\") && \n                strcmp(line, \"\\r\\n\") && \n                (currentSection == -1 || currentSection == _this->section || !strncmp(line, \";T \", 3) || !strncmp(line, \";f\", 2) || AuditFile) &&\n                !((!IsThemeActive() || IsHighContrast() || !IsWindows11() || IsDwmExtendFrameIntoClientAreaBrokenInThisBuild()) && !strncmp(line, \";M \", 3))\n                )\n            {\n#ifndef USE_PRIVATE_INTERFACES\n                if (!strncmp(line, \";p \", 3))\n                {\n                    int num = atoi(line + 3);\n                    for (int i = 0; i < num; ++i)\n                    {\n                        getline(&line, &bufsiz, f);\n                    }\n                }\n#endif\n                if (!strncmp(line, \";f\", 2))\n                {\n                    //if (topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy) > dwMaxHeight)\n                    //{\n                    //    dwMaxHeight = topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy);\n                    //}\n                    if (_this->dwStatusbarY == 0)\n                    {\n                        //dwMaxHeight += GUI_STATUS_PADDING * dy;\n                        _this->dwStatusbarY = dwMaxHeight / dy;\n                    }\n                    else\n                    {\n                        dwMaxHeight = _this->dwStatusbarY * dy;\n                    }\n                    currentSection = -1;\n                    dwLeftPad = 0;\n                    continue;\n                }\n\n                if (!strncmp(line, \"[\", 1))\n                {\n                    ZeroMemory(section, MAX_LINE_LENGTH * sizeof(wchar_t));\n                    MultiByteToWideChar(\n                        CP_UTF8,\n                        0,\n                        line[1] == '-' ? line + 2 : line + 1,\n                        numChRd - (line[1] == '-' ? 5 : 4),\n                        section,\n                        MAX_LINE_LENGTH\n                    );\n                    //wprintf(L\"%s\\n\", section);\n                }\n\n                DWORD dwLineHeight = !strncmp(line, \";M \", 3) ? _this->GUI_CAPTION_LINE_HEIGHT : GUI_LINE_HEIGHT;\n                DWORD dwBottom = _this->padding.bottom;\n                DWORD dwTop = _this->padding.top;\n                if (!strncmp(line, \";a \", 3) || !strncmp(line, \";e \", 3))\n                {\n                    dwBottom = 0;\n                    dwLineHeight -= 0.2 * dwLineHeight;\n                }\n\n                rcText.left = dwLeftPad + _this->padding.left;\n                rcText.top = !strncmp(line, \";M \", 3) ? 0 : (dwTop + dwMaxHeight);\n                rcText.right = (rc.right - rc.left) - _this->padding.right;\n                rcText.bottom = !strncmp(line, \";M \", 3) ? _this->GUI_CAPTION_LINE_HEIGHT * dy : (dwMaxHeight + dwLineHeight * dy - dwBottom);\n\n                if (!strncmp(line, \";T \", 3))\n                {\n                    if (currentSection + 1 == _this->section)\n                    {\n                        hOldFont = SelectObject(hdcPaint, hFontSectionSel);\n                    }\n                    else\n                    {\n                        hOldFont = SelectObject(hdcPaint, hFontSection);\n                    }\n                    rcText.left = _this->padding.left;\n                    rcText.right = _this->padding.left + _this->sidebarWidth;\n                    rcText.top = topAdj + ((currentSection + 1) * GUI_SECTION_HEIGHT * dy);\n                    rcText.bottom = topAdj + ((currentSection + 2) * GUI_SECTION_HEIGHT * dy);\n                    ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));\n                    MultiByteToWideChar(\n                        CP_UTF8,\n                        0,\n                        line + 3,\n                        numChRd - 3,\n                        text,\n                        MAX_LINE_LENGTH\n                    );\n                    GUI_SubstituteLocalizedString(text, MAX_LINE_LENGTH);\n                    if (_this->sectionNames[currentSection + 1][0] == 0)\n                    {\n                        wcscpy_s(_this->sectionNames[currentSection + 1], 64, text);\n                    }\n                    if (hDC)\n                    {\n                        if (IsThemeActive() && !IsHighContrast())\n                        {\n                            DrawThemeTextEx(\n                                _this->hTheme,\n                                hdcPaint,\n                                0,\n                                0,\n                                text,\n                                -1,\n                                dwTextFlags,\n                                &rcText,\n                                &DttOpts\n                            );\n                        }\n                        else\n                        {\n                            DrawTextW(\n                                hdcPaint,\n                                text,\n                                -1,\n                                &rcText,\n                                dwTextFlags\n                            );\n                        }\n                    }\n                    else\n                    {\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcTemp.bottom = rcText.bottom;\n                        if (PtInRect(&rcTemp, pt))\n                        {\n                            _this->bShouldAnnounceSelected = TRUE;\n                            _this->bRebuildIfTabOrderIsEmpty = FALSE;\n                            _this->tabOrder = 0;\n                            GUI_SetSection(_this, TRUE, currentSection + 1);\n                            InvalidateRect(hwnd, NULL, FALSE);\n                        }\n                    }\n                    currentSection++;\n                    continue;\n                }\n                else if (!strncmp(line, \";M \", 3))\n                {\n                    UINT diff = (((_this->GUI_CAPTION_LINE_HEIGHT - 16) * dx) / 2.0);\n                    rcText.left = diff + (int)(16.0 * dx) + diff / 2;\n                    topAdj = dwMaxHeight + _this->GUI_CAPTION_LINE_HEIGHT * dy;\n                    hOldFont = SelectObject(hdcPaint, hFontCaption);\n                }\n                else if (!strncmp(line, \";u \", 3) || (!strncmp(line, \";y \", 3) && !strstr(line, \"\\xF0\\x9F\")))\n                {\n                    hOldFont = SelectObject(hdcPaint, hFontUnderline);\n                }\n                else\n                {\n                    hOldFont = SelectObject(hdcPaint, hFontRegular);\n                }\n\n                if (!strncmp(line, \";e \", 3) || !strncmp(line, \";a \", 3) || !strncmp(line, \";T \", 3) || !strncmp(line, \";t \", 3) || !strncmp(line, \";u \", 3) || !strncmp(line, \";M \", 3))\n                {\n                    ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));\n                    MultiByteToWideChar(\n                        CP_UTF8,\n                        0,\n                        line + 3,\n                        numChRd - 3,\n                        text,\n                        MAX_LINE_LENGTH\n                    );\n                    if (!wcsncmp(text, L\"%WEATHERLASTUPDATETEXT%\", 23))\n                    {\n                        BOOL bOk = FALSE;\n                        DWORD bIsWeatherEnabled = 0, dwSize = sizeof(DWORD);\n                        GUI_Internal_RegQueryValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\", NULL, NULL, &bIsWeatherEnabled, &dwSize);\n                        if (bIsWeatherEnabled)\n                        {\n                            IEPWeather* epw = NULL;\n                            if (SUCCEEDED(CoCreateInstance(&CLSID_EPWeather, NULL, CLSCTX_LOCAL_SERVER, &IID_IEPWeather, &epw)) && epw)\n                            {\n                                SYSTEMTIME stLastUpdate;\n                                ZeroMemory(&stLastUpdate, sizeof(SYSTEMTIME));\n                                if (SUCCEEDED(epw->lpVtbl->GetLastUpdateTime(epw, &stLastUpdate)))\n                                {\n                                    WCHAR wszWeatherLanguage[10];\n                                    ZeroMemory(wszWeatherLanguage, 10);\n                                    dwSize = sizeof(WCHAR) * 10;\n                                    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"WeatherLanguage\", RRF_RT_REG_SZ, NULL, wszWeatherLanguage, &dwSize);\n                                    WCHAR wszDate[MAX_PATH];\n                                    ZeroMemory(wszDate, sizeof(WCHAR) * MAX_PATH);\n                                    if (GetDateFormatEx(wszWeatherLanguage[0] ? wszWeatherLanguage : wszLanguage, DATE_AUTOLAYOUT | DATE_LONGDATE, &stLastUpdate, NULL, wszDate, MAX_PATH, NULL))\n                                    {\n                                        WCHAR wszTime[MAX_PATH];\n                                        ZeroMemory(wszTime, sizeof(WCHAR) * MAX_PATH);\n                                        if (GetTimeFormatEx(wszWeatherLanguage[0] ? wszWeatherLanguage : wszLanguage, TIME_NOSECONDS, &stLastUpdate, NULL, wszTime, MAX_PATH))\n                                        {\n                                            wchar_t wszFormat[MAX_PATH];\n                                            int numChars = LoadStringW(hModule, IDS_WEATHER_LASTUPDATE, wszFormat, MAX_PATH);\n                                            if (numChars != 0)\n                                            {\n                                                bOk = TRUE;\n                                                swprintf_s(text, MAX_LINE_LENGTH, wszFormat, wszDate, wszTime);\n                                            }\n                                        }\n                                    }\n                                }\n                                epw->lpVtbl->Release(epw);\n                            }\n                        }\n                        if (!bOk) continue;\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTINFOTIP1%\", 18))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", L\"InfoTip\", RRF_RT_REG_SZ, NULL, text, &dwDataSize);\n                        WCHAR* pC = wcschr(text, L'\\r');\n                        if (pC) pC[0] = 0;\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTINFOTIP2%\", 18))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", L\"InfoTip\", RRF_RT_REG_SZ, NULL, text, &dwDataSize);\n                        WCHAR* pC = wcschr(text, L'\\r');\n                        if (pC)\n                        {\n                            int d = (pC - text) + 1;\n                            for (int i = d; i < wcslen(text); ++i)\n                            {\n                                text[i - d] = text[i];\n                            }\n                            pC = wcschr(text, L'\\r');\n                            if (pC)\n                            {\n                                pC[0] = 0;\n                            }\n                        }\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTCLICK%\", 16))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\", text, &dwDataSize);\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTDISLIKE%\", 18))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\\\\shell\\\\SpotlightDislike\", text, &dwDataSize);\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTLIKE%\", 15))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\\\\shell\\\\SpotlightLike\", text, &dwDataSize);\n                    }\n                    else if (!wcsncmp(text, L\"%SPOTLIGHTNEXT%\", 15))\n                    {\n                        DWORD dwDataSize = MAX_LINE_LENGTH;\n                        RegQueryValueW(HKEY_CURRENT_USER, L\"Software\\\\Classes\\\\CLSID\\\\{2cc5ca98-6485-489a-920e-b3e88a6ccce3}\\\\shell\\\\SpotlightNext\", text, &dwDataSize);\n                    }\n                    else if (!wcsncmp(text, L\"%VERSIONINFORMATIONSTRING%\", 26))\n                    {\n                        DWORD dwLeftMost = 0;\n                        DWORD dwSecondLeft = 0;\n                        DWORD dwSecondRight = 0;\n                        DWORD dwRightMost = 0;\n\n                        QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\n\n                        wchar_t wszFormat[MAX_PATH];\n                        int numChars = LoadStringW(hModule, IDS_ABOUT_VERSION, wszFormat, MAX_PATH);\n                        if (numChars != 0)\n                        {\n                            swprintf_s(text, MAX_LINE_LENGTH, wszFormat, dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost,\n#if defined(DEBUG) | defined(_DEBUG)\n                                L\" (Debug)\"\n#else\n                                L\"\"\n#endif\n                            );\n                        }\n                    }\n                    else if (!wcsncmp(text, L\"%OSVERSIONSTRING%\", 17))\n                    {\n                        wchar_t wszFormat[MAX_PATH];\n                        int numChars = LoadStringW(hModule, IDS_ABOUT_OS, wszFormat, MAX_PATH);\n                        if (numChars != 0)\n                        {\n                            swprintf_s(\n                                text, MAX_LINE_LENGTH, wszFormat,\n                                IsWindows11() ? L\"Windows 11\" : L\"Windows 10\",\n                                global_rovi.dwBuildNumber,\n                                global_ubr\n                            );\n                        }\n                    }\n                    else\n                    {\n                        GUI_SubstituteLocalizedString(text, MAX_LINE_LENGTH);\n                    }\n                    if (bResetLastHeading)\n                    {\n                        wcscpy_s(lastHeading, MAX_LINE_LENGTH, text);\n                        bResetLastHeading = FALSE;\n                    }\n                    else\n                    {\n                        wcscat_s(lastHeading, MAX_LINE_LENGTH, L\" \");\n                        wcscat_s(lastHeading, MAX_LINE_LENGTH, text);\n                    }\n                    if (!strncmp(line, \";a \", 3))\n                    {\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            L\"\\u2795  \",\n                            3,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcText.left += rcTemp.right - rcTemp.left;\n                        rcText.right += rcTemp.right - rcTemp.left;\n                    }\n                    if (!strncmp(line, \";M \", 3))\n                    {\n                        if (hDC)\n                        {\n                            UINT diff = (int)(((_this->GUI_CAPTION_LINE_HEIGHT - 16) * dx) / 2.0);\n                            //printf(\"!!! %d %d\\n\", (int)(16.0 * dx), diff);\n                            DrawIconEx(\n                                hdcPaint,\n                                diff,\n                                diff,\n                                _this->hIcon,\n                                (int)(16.0 * dx),\n                                (int)(16.0 * dy),\n                                0,\n                                NULL,\n                                DI_NORMAL\n                            );\n                        }\n\n                        TCHAR exeName[MAX_PATH + 1];\n                        GetProcessImageFileNameW(\n                            OpenProcess(\n                                PROCESS_QUERY_INFORMATION,\n                                FALSE,\n                                GetCurrentProcessId()\n                            ),\n                            exeName,\n                            MAX_PATH\n                        );\n                        PathStripPath(exeName);\n                        //if (wcscmp(exeName, L\"explorer.exe\"))\n                        //{\n                        //    LoadStringW(hModule, IDS_PRODUCTNAME, text, MAX_LINE_LENGTH);\n                        //}\n                        //else\n                        //{\n                            //HMODULE hExplorerFrame = LoadLibraryExW(L\"ExplorerFrame.dll\", NULL, LOAD_LIBRARY_AS_DATAFILE);\n                            LoadStringW(_this->hExplorerFrame, 50222, text, 260);\n                            //FreeLibrary(hExplorerFrame);\n                            wchar_t* p = wcschr(text, L'(');\n                            if (p)\n                            {\n                                p--;\n                                if (*p == L' ')\n                                {\n                                    *p = 0;\n                                }\n                                else\n                                {\n                                    p++;\n                                    *p = 0;\n                                }\n                            }\n                        //}\n                        //rcText.bottom += _this->GUI_CAPTION_LINE_HEIGHT - dwLineHeight;\n                        dwLineHeight = _this->GUI_CAPTION_LINE_HEIGHT;\n                        _this->extent.cyTopHeight = rcText.bottom;\n                    }\n                    if (hDC)\n                    {\n                        COLORREF cr;\n                        if (!strncmp(line, \";u \", 3) && tabOrder == _this->tabOrder)\n                        {\n                            bTabOrderHit = TRUE;\n                            if (!IsThemeActive() || IsHighContrast())\n                            {\n                                cr = SetTextColor(hdcPaint, GetSysColor(COLOR_HIGHLIGHT));\n                            }\n                            else\n                            {\n                                DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_SELECTED_DARK : GUI_TEXTCOLOR_SELECTED;\n                                //DttOpts.crText = GetSysColor(COLOR_HIGHLIGHT);\n                            }\n                            if (_this->bShouldAnnounceSelected)\n                            {\n                                WCHAR accText[1000];\n                                swprintf_s(\n                                    accText, \n                                    1000, \n                                    L\"%s %s - Button.\",\n                                    (_this->dwPageLocation < 0 ?\n                                    L\"Reached end of the page.\" :\n                                    (_this->dwPageLocation > 0 ?\n                                    L\"Reached beginning of the page.\" : L\"\")),\n                                    text\n                                );\n                                _this->dwPageLocation = 0;\n                                for (unsigned int i = 0; i < wcslen(accText) - 2; ++i)\n                                {\n                                    if (accText[i] == L'(' && accText[i + 1] == L'*' && accText[i + 2] == L')')\n                                    {\n                                        accText[i] = L' ';\n                                        accText[i + 1] = L' ';\n                                        accText[i + 2] = L' ';\n                                    }\n                                }\n                                SetWindowTextW(_this->hAccLabel, accText);\n                                NotifyWinEvent(\n                                    EVENT_OBJECT_LIVEREGIONCHANGED,\n                                    _this->hAccLabel,\n                                    OBJID_CLIENT,\n                                    CHILDID_SELF);\n                                _this->bShouldAnnounceSelected = FALSE;\n                            }\n                        }\n                        RECT rcNew = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcNew,\n                            DT_CALCRECT\n                        );\n                        if (rcNew.right - rcNew.left > dwMaxWidth)\n                        {\n                            dwMaxWidth = rcNew.right - rcNew.left + 50 * dx;\n                        }\n                        if (IsThemeActive() && !IsHighContrast())\n                        {\n                            DrawThemeTextEx(\n                                _this->hTheme,\n                                hdcPaint,\n                                hOldFont ? 0 : 8,\n                                0,\n                                text,\n                                -1,\n                                dwTextFlags,\n                                &rcText,\n                                &DttOpts\n                            );\n                        }\n                        else\n                        {\n                            DrawTextW(\n                                hdcPaint,\n                                text,\n                                -1,\n                                &rcText,\n                                dwTextFlags\n                            );\n                        }\n                        if (!strncmp(line, \";u \", 3) && tabOrder == _this->tabOrder)\n                        {\n                            if (!IsThemeActive() || IsHighContrast())\n                            {\n                                SetTextColor(hdcPaint, cr);\n                            }\n                            else\n                            {\n                                DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_DARK : GUI_TEXTCOLOR;\n                                //DttOpts.crText = GetSysColor(COLOR_WINDOWTEXT);\n                            }\n                        }\n                    }\n                    else\n                    {\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcTemp.bottom = rcText.bottom;\n                        if (!strncmp(line, \";u \", 3) && (PtInRect(&rcTemp, pt) || (pt.x == 0 && pt.y == 0 && tabOrder == _this->tabOrder)))\n                        {\n                            numChRd = getline(&line, &bufsiz, f);\n                            char* p = strchr(line, '\\r');\n                            if (p) *p = 0;\n                            p = strchr(line, '\\n');\n                            if (p) *p = 0;\n                            if (!strncmp(line + 1, \"restart\", 7))\n                            {\n                                HWND hShellTrayWnd = FindWindowW(L\"Shell_TrayWnd\", NULL);\n                                if (hShellTrayWnd)\n                                {\n                                    HANDLE hEvent = NULL;\n                                    if (GetAsyncKeyState(VK_SHIFT))\n                                    {\n                                        hEvent = CreateEventW(NULL, FALSE, FALSE, _T(EP_SETUP_EVENTNAME));\n                                    }\n                                    WCHAR wszPath[MAX_PATH];\n                                    ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\n                                    PDWORD_PTR res = -1;\n                                    if (!SendMessageTimeoutW(hShellTrayWnd, 1460, 0, 0, SMTO_ABORTIFHUNG, 2000, &res) && res)\n                                    {\n                                        HANDLE hExplorerRestartThread = CreateThread(NULL, 0, BeginExplorerRestart, NULL, 0, NULL);\n                                        if (hExplorerRestartThread)\n                                        {\n                                            WaitForSingleObject(hExplorerRestartThread, 2000);\n                                            CloseHandle(hExplorerRestartThread);\n                                            hExplorerRestartThread = NULL;\n                                        }\n                                        else\n                                        {\n                                            BeginExplorerRestart(NULL);\n                                        }\n                                    }\n                                    Sleep(100);\n                                    GetSystemDirectoryW(wszPath, MAX_PATH);\n                                    wcscat_s(wszPath, MAX_PATH, L\"\\\\taskkill.exe\");\n                                    SHELLEXECUTEINFOW sei;\n                                    ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\n                                    sei.cbSize = sizeof(sei);\n                                    sei.fMask = SEE_MASK_NOCLOSEPROCESS;\n                                    sei.hwnd = NULL;\n                                    sei.hInstApp = NULL;\n                                    sei.lpVerb = NULL;\n                                    sei.lpFile = wszPath;\n                                    sei.lpParameters = L\"/f /im explorer.exe\";\n                                    sei.hwnd = NULL;\n                                    sei.nShow = SW_SHOWMINIMIZED;\n                                    if (ShellExecuteExW(&sei) && sei.hProcess)\n                                    {\n                                        WaitForSingleObject(sei.hProcess, INFINITE);\n                                        CloseHandle(sei.hProcess);\n                                    }\n                                    GetWindowsDirectoryW(wszPath, MAX_PATH);\n                                    wcscat_s(wszPath, MAX_PATH, L\"\\\\explorer.exe\");\n                                    Sleep(1000);\n                                    GUI_RegSetValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_TaskbarPosition\", NULL, NULL, &dwTaskbarPosition, NULL);\n                                    if (hEvent)\n                                    {\n                                        CloseHandle(hEvent);\n                                    }\n                                    ShellExecuteW(\n                                        NULL,\n                                        L\"open\",\n                                        wszPath,\n                                        NULL,\n                                        NULL,\n                                        SW_SHOWNORMAL\n                                    );\n                                }\n                                else\n                                {\n                                    StartExplorer();\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"reset\", 5))\n                            {\n                                wchar_t wszPath[MAX_PATH];\n                                ZeroMemory(\n                                    wszPath,\n                                    MAX_PATH * sizeof(wchar_t)\n                                );\n                                SHGetFolderPathW(\n                                    NULL,\n                                    SPECIAL_FOLDER_LEGACY,\n                                    NULL,\n                                    SHGFP_TYPE_CURRENT,\n                                    wszPath\n                                );\n                                wcscat_s(\n                                    wszPath,\n                                    MAX_PATH,\n                                    TEXT(APP_RELATIVE_PATH)\n                                );\n                                CreateDirectoryW(wszPath, NULL);\n                                wcscat_s(\n                                    wszPath,\n                                    MAX_PATH,\n                                    L\"\\\\settings.reg\"\n                                );\n                                wprintf(L\"%s\\n\", wszPath);\n                                HANDLE hFile = CreateFileW(\n                                    wszPath,\n                                    GENERIC_WRITE,\n                                    0,\n                                    NULL,\n                                    CREATE_ALWAYS,\n                                    FILE_ATTRIBUTE_NORMAL,\n                                    NULL\n                                );\n                                if (hFile)\n                                {\n                                    void* buffer = NULL;\n                                    HKEY hKey = NULL;\n                                    RegOpenKeyExW(\n                                        HKEY_LOCAL_MACHINE,\n                                        L\"Software\\\\Classes\\\\CLSID\\\\\" _T(EP_CLSID) L\"\\\\InprocServer32\",\n                                        REG_OPTION_NON_VOLATILE,\n                                        KEY_READ | KEY_WOW64_64KEY,\n                                        &hKey\n                                    );\n                                    buffer = pRscr;\n                                    DWORD dwNumberOfBytesWritten = 0;\n                                    if (WriteFile(\n                                        hFile,\n                                        buffer,\n                                        cbRscr,\n                                        &dwNumberOfBytesWritten,\n                                        NULL\n                                    ))\n                                    {\n                                        CloseHandle(hFile);\n                                        DWORD dwOldTaskbarOld = 0, dwOldTaskbar = 0, dwSize = sizeof(DWORD);\n                                        RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"OldTaskbar\", RRF_RT_DWORD, NULL, &dwOldTaskbarOld, &dwSize);\n                                        RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"OldTaskbar\", REG_DWORD, &dwOldTaskbar, sizeof(DWORD));\n\n                                        DWORD dwError = 0;\n#ifdef _M_X64\n                                        // https://stackoverflow.com/questions/50298722/win32-launching-a-highestavailable-child-process-as-a-normal-user-process\n                                        if (pvRtlQueryElevationFlags = GetProcAddress(GetModuleHandleW(L\"ntdll\"), \"RtlQueryElevationFlags\"))\n                                        {\n                                            PVOID pv;\n                                            if (pv = AddVectoredExceptionHandler(TRUE, OnVex))\n                                            {\n                                                CONTEXT ctx;\n                                                ZeroMemory(&ctx, sizeof(CONTEXT));\n                                                ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;\n                                                ctx.Dr7 = 0x404;\n                                                ctx.Dr1 = (ULONG_PTR)pvRtlQueryElevationFlags;\n\n                                                if (SetThreadContext(GetCurrentThread(), &ctx))\n                                                {\n#endif\n                                                    WCHAR wszExec[MAX_PATH * 2];\n                                                    ZeroMemory(wszExec, MAX_PATH * 2 * sizeof(WCHAR));\n                                                    wszExec[0] = L'\"';\n                                                    GetWindowsDirectoryW(wszExec + 1, MAX_PATH);\n                                                    wcscat_s(wszExec, MAX_PATH * 2, L\"\\\\regedit.exe\\\" \\\"\");\n                                                    wcscat_s(wszExec, MAX_PATH * 2, wszPath);\n                                                    wcscat_s(wszExec, MAX_PATH * 2, L\"\\\"\");\n                                                    STARTUPINFO si;\n                                                    ZeroMemory(&si, sizeof(STARTUPINFO));\n                                                    si.cb = sizeof(STARTUPINFO);\n                                                    PROCESS_INFORMATION pi;\n                                                    ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));\n                                                    wprintf(L\"%s\\n\", wszExec);\n                                                    if (CreateProcessW(NULL, wszExec, 0, 0, 0, 0, 0, 0, &si, &pi))\n                                                    {\n                                                        CloseHandle(pi.hThread);\n                                                        //CloseHandle(pi.hProcess);\n                                                    }\n                                                    else\n                                                    {\n                                                        dwError = GetLastError();\n                                                    }\n#ifdef _M_X64\n                                                    ctx.Dr7 = 0x400;\n                                                    ctx.Dr1 = 0;\n                                                    SetThreadContext(GetCurrentThread(), &ctx);\n\n                                                    if (pi.hProcess)\n                                                    {\n                                                        WaitForSingleObject(pi.hProcess, INFINITE);\n                                                        DWORD dwExitCode = 0;\n                                                        GetExitCodeProcess(pi.hProcess, &dwExitCode);\n                                                        CloseHandle(pi.hProcess);\n                                                    }\n                                                }\n                                                else\n                                                {\n                                                    dwError = GetLastError();\n                                                }\n                                                RemoveVectoredExceptionHandler(pv);\n                                            }\n                                            else\n                                            {\n                                                dwError = GetLastError();\n                                            }\n                                        }\n                                        else\n                                        {\n                                            dwError = GetLastError();\n                                        }\n#endif\n\n                                        dwSize = sizeof(DWORD);\n                                        RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"OldTaskbar\", RRF_RT_DWORD, NULL, &dwOldTaskbar, &dwSize);\n                                        if (dwOldTaskbar == 1)\n                                        {\n                                            FILE* vf = NULL;\n                                            _wfopen_s(&vf, wszPath, L\"r\");\n                                            if (vf)\n                                            {\n                                                char* line2 = malloc(MAX_LINE_LENGTH * sizeof(char));\n                                                if (line2)\n                                                {\n                                                    int numChRd2 = 0;\n                                                    size_t bufsiz2 = MAX_LINE_LENGTH;\n                                                    while ((numChRd2 = getline(&line2, &bufsiz2, vf)) != -1)\n                                                    {\n                                                        if (!strncmp(line2, \";\\\"Virtualized_\" EP_CLSID, 52))\n                                                        {\n                                                            DWORD dwVal = 0;\n                                                            WCHAR wszName[MAX_PATH];\n                                                            ZeroMemory(wszName, MAX_PATH * sizeof(wchar_t));\n                                                            MultiByteToWideChar(\n                                                                CP_UTF8,\n                                                                0,\n                                                                line2 + 2,\n                                                                numChRd2 - 2,\n                                                                wszName,\n                                                                MAX_PATH\n                                                            );\n                                                            wchar_t* ddd = wcschr(wszName, L'=');\n                                                            if (ddd) *ddd = 0;\n                                                            wchar_t* ppp = wcschr(wszName, L'\"');\n                                                            if (ppp) *ppp = 0;\n                                                            if (!wcsncmp(ddd + 1, L\"dword:\", 6))\n                                                            {\n                                                                wchar_t* xxx = wcschr(ddd + 1, L':');\n                                                                xxx++;\n                                                                dwVal = wcstol(xxx, NULL, 16);\n                                                                wprintf(L\"%s %d\\n\", wszName, dwVal);\n                                                                GUI_RegSetValueExW(NULL, wszName, 0, RRF_RT_DWORD, &dwVal, sizeof(DWORD));\n                                                            }\n                                                        }\n                                                    }\n                                                    free(line2);\n                                                }\n                                                fclose(vf);\n                                            }\n                                        }\n                                        else\n                                        {\n                                            RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"OldTaskbar\", REG_DWORD, &dwOldTaskbarOld, sizeof(DWORD));\n                                        }\n\n                                        _this->tabOrder = 0;\n                                        InvalidateRect(hwnd, NULL, FALSE);\n                                        DeleteFileW(wszPath);\n                                    }\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"export\", 6))\n                            {\n                                WCHAR title[MAX_PATH];\n                                WCHAR filter[MAX_PATH];\n                                WCHAR wszRegedit[MAX_PATH];\n                                GetWindowsDirectoryW(wszRegedit, MAX_PATH);\n                                wcscat_s(wszRegedit, MAX_PATH, L\"\\\\regedit.exe\");\n                                HMODULE hRegedit = LoadLibraryExW(wszRegedit, NULL, LOAD_LIBRARY_AS_DATAFILE);\n                                if (hRegedit)\n                                {\n                                    LoadStringW(hRegedit, 301, title, MAX_PATH);\n                                    LoadStringW(hRegedit, 302, filter, MAX_PATH);\n                                    unsigned int j = 0;\n                                    for (unsigned int i = 0; i < MAX_PATH; ++i)\n                                    {\n                                        if (filter[i] == L'#')\n                                        {\n                                            filter[i] = L'\\0';\n                                            j++;\n                                            if (j == 2)\n                                            {\n                                                filter[i + 1] = L'\\0';\n                                                break;\n                                            }\n                                        }\n                                    }\n                                    FreeLibrary(hRegedit);\n                                }\n                                else\n                                {\n                                    wcscpy_s(title, MAX_PATH, L\"Export settings\");\n                                    wcscpy_s(filter, MAX_PATH, L\"Registration Files (*.reg)\\0*.reg\\0\\0\");\n                                }\n                                WCHAR wszPath[MAX_PATH];\n                                ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\n                                DWORD dwLeftMost = 0;\n                                DWORD dwSecondLeft = 0;\n                                DWORD dwSecondRight = 0;\n                                DWORD dwRightMost = 0;\n                                QueryVersionInfo(GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\n                                swprintf_s(wszPath, MAX_PATH, _T(PRODUCT_NAME) L\"_%d.%d.%d.%d.reg\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\n                                OPENFILENAMEW ofn;\n                                ZeroMemory(&ofn, sizeof(OPENFILENAMEW));\n                                ofn.lStructSize = sizeof(OPENFILENAMEW);\n                                ofn.hwndOwner = hwnd;\n                                ofn.hInstance = GetModuleHandleW(NULL);\n                                ofn.lpstrFilter = filter;\n                                ofn.lpstrCustomFilter = NULL;\n                                ofn.nMaxCustFilter = 0;\n                                ofn.nFilterIndex = 1;\n                                ofn.lpstrFile = wszPath;\n                                ofn.nMaxFile = MAX_PATH;\n                                ofn.lpstrFileTitle = NULL;\n                                ofn.nMaxFileTitle = 0;\n                                ofn.lpstrInitialDir = NULL;\n                                ofn.lpstrTitle = title;\n                                ofn.Flags = OFN_DONTADDTORECENT | OFN_CREATEPROMPT | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;\n                                ofn.nFileOffset = 0;\n                                ofn.nFileExtension = 0;\n                                ofn.lpstrDefExt = L\"reg\";\n                                ofn.lCustData = NULL;\n                                ofn.lpfnHook = NULL;\n                                ofn.lpTemplateName = NULL;\n                                if (GetSaveFileNameW(&ofn))\n                                {\n                                    _wfopen_s(&AuditFile, wszPath, L\"w\");\n                                    if (AuditFile)\n                                    {\n                                        fwprintf(AuditFile, L\"Windows Registry Editor Version 5.00\\n\\n[HKEY_CURRENT_USER\\\\Software\\\\ExplorerPatcher]\\n\\\"ImportOK\\\"=dword:00000001\\n\");\n                                        POINT pt;\n                                        pt.x = 0;\n                                        pt.y = 0;\n                                        GUI_Build(0, hwnd, pt);\n                                        fclose(AuditFile);\n                                        AuditFile = NULL;\n                                        wchar_t mbText[256];\n                                        mbText[0] = 0;\n                                        LoadStringW(hModule, IDS_ABOUT_EXPORT_SUCCESS, mbText, ARRAYSIZE(mbText));\n                                        MessageBoxW(hwnd, mbText, GUI_title, MB_ICONINFORMATION);\n                                    }\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"import\", 6))\n                            {\n                                WCHAR title[MAX_PATH];\n                                WCHAR filter[MAX_PATH];\n                                WCHAR wszRegedit[MAX_PATH];\n                                GetWindowsDirectoryW(wszRegedit, MAX_PATH);\n                                wcscat_s(wszRegedit, MAX_PATH, L\"\\\\regedit.exe\");\n                                HMODULE hRegedit = LoadLibraryExW(wszRegedit, NULL, LOAD_LIBRARY_AS_DATAFILE);\n                                if (hRegedit)\n                                {\n                                    LoadStringW(hRegedit, 300, title, MAX_PATH);\n                                    LoadStringW(hRegedit, 302, filter, MAX_PATH);\n                                    unsigned j = 0;\n                                    for (unsigned int i = 0; i < MAX_PATH; ++i)\n                                    {\n                                        if (filter[i] == L'#')\n                                        {\n                                            filter[i] = L'\\0';\n                                            j++;\n                                            if (j == 2)\n                                            {\n                                                filter[i + 1] = L'\\0';\n                                                break;\n                                            }\n                                        }\n                                    }\n                                    FreeLibrary(hRegedit);\n                                }\n                                else\n                                {\n                                    wcscpy_s(title, MAX_PATH, L\"Import settings\");\n                                    wcscpy_s(filter, MAX_PATH, L\"Registration Files (*.reg)\\0*.reg\\0\\0\");\n                                }\n                                WCHAR wszPath[MAX_PATH];\n                                ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\n                                DWORD dwLeftMost = 0;\n                                DWORD dwSecondLeft = 0;\n                                DWORD dwSecondRight = 0;\n                                DWORD dwRightMost = 0;\n                                QueryVersionInfo(GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\n                                swprintf_s(wszPath, MAX_PATH, _T(PRODUCT_NAME) L\"_%d.%d.%d.%d.reg\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\n                                OPENFILENAMEW ofn;\n                                ZeroMemory(&ofn, sizeof(OPENFILENAMEW));\n                                ofn.lStructSize = sizeof(OPENFILENAMEW);\n                                ofn.hwndOwner = hwnd;\n                                ofn.hInstance = GetModuleHandleW(NULL);\n                                ofn.lpstrFilter = filter;\n                                ofn.lpstrCustomFilter = NULL;\n                                ofn.nMaxCustFilter = 0;\n                                ofn.nFilterIndex = 1;\n                                ofn.lpstrFile = wszPath;\n                                ofn.nMaxFile = MAX_PATH;\n                                ofn.lpstrFileTitle = NULL;\n                                ofn.nMaxFileTitle = 0;\n                                ofn.lpstrInitialDir = NULL;\n                                ofn.lpstrTitle = title;\n                                ofn.Flags = OFN_DONTADDTORECENT | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST;\n                                ofn.nFileOffset = 0;\n                                ofn.nFileExtension = 0;\n                                ofn.lpstrDefExt = L\"reg\";\n                                ofn.lCustData = NULL;\n                                ofn.lpfnHook = NULL;\n                                ofn.lpTemplateName = NULL;\n                                if (GetOpenFileNameW(&ofn))\n                                {\n                                    RegDeleteKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"ImportOK\");\n\n                                    DWORD dwError = 0;\n#ifdef _M_X64\n                                    // https://stackoverflow.com/questions/50298722/win32-launching-a-highestavailable-child-process-as-a-normal-user-process\n                                    if (pvRtlQueryElevationFlags = GetProcAddress(GetModuleHandleW(L\"ntdll\"), \"RtlQueryElevationFlags\"))\n                                    {\n                                        PVOID pv;\n                                        if (pv = AddVectoredExceptionHandler(TRUE, OnVex))\n                                        {\n                                            CONTEXT ctx;\n                                            ZeroMemory(&ctx, sizeof(CONTEXT));\n                                            ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;\n                                            ctx.Dr7 = 0x404;\n                                            ctx.Dr1 = (ULONG_PTR)pvRtlQueryElevationFlags;\n\n                                            if (SetThreadContext(GetCurrentThread(), &ctx))\n                                            {\n#endif\n                                                WCHAR wszExec[MAX_PATH * 2];\n                                                ZeroMemory(wszExec, MAX_PATH * 2 * sizeof(WCHAR));\n                                                wszExec[0] = L'\"';\n                                                GetWindowsDirectoryW(wszExec + 1, MAX_PATH);\n                                                wcscat_s(wszExec, MAX_PATH * 2, L\"\\\\regedit.exe\\\" \\\"\");\n                                                wcscat_s(wszExec, MAX_PATH * 2, wszPath);\n                                                wcscat_s(wszExec, MAX_PATH * 2, L\"\\\"\");\n                                                STARTUPINFO si;\n                                                ZeroMemory(&si, sizeof(STARTUPINFO));\n                                                si.cb = sizeof(STARTUPINFO);\n                                                PROCESS_INFORMATION pi;\n                                                ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));\n                                                wprintf(L\"%s\\n\", wszExec);\n                                                if (CreateProcessW(NULL, wszExec, 0, 0, 0, 0, 0, 0, &si, &pi))\n                                                {\n                                                    CloseHandle(pi.hThread);\n                                                    //CloseHandle(pi.hProcess);\n                                                }\n                                                else\n                                                {\n                                                    dwError = GetLastError();\n                                                }\n#ifdef _M_X64\n                                                ctx.Dr7 = 0x400;\n                                                ctx.Dr1 = 0;\n                                                SetThreadContext(GetCurrentThread(), &ctx);\n\n                                                if (pi.hProcess)\n                                                {\n                                                    WaitForSingleObject(pi.hProcess, INFINITE);\n                                                    DWORD dwExitCode = 0;\n                                                    GetExitCodeProcess(pi.hProcess, &dwExitCode);\n                                                    CloseHandle(pi.hProcess);\n                                                }\n                                            }\n                                            else\n                                            {\n                                                dwError = GetLastError();\n                                            }\n                                            RemoveVectoredExceptionHandler(pv);\n                                        }\n                                        else\n                                        {\n                                            dwError = GetLastError();\n                                        }\n                                    }\n                                    else\n                                    {\n                                        dwError = GetLastError();\n                                    }\n#endif\n\n                                    DWORD dwData = 0, dwSize = sizeof(DWORD);\n                                    RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"ImportOK\", RRF_RT_DWORD, NULL, &dwData, &dwSize);\n                                    if (dwData)\n                                    {\n                                        RegDeleteKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L\"ImportOK\");\n\n                                        FILE* vf = NULL;\n                                        _wfopen_s(&vf, wszPath, L\"r\");\n                                        if (vf)\n                                        {\n                                            char* line2 = malloc(MAX_LINE_LENGTH * sizeof(char));\n                                            if (line2)\n                                            {\n                                                int numChRd2 = 0;\n                                                size_t bufsiz2 = MAX_LINE_LENGTH;\n                                                while ((numChRd2 = getline(&line2, &bufsiz2, vf)) != -1)\n                                                {\n                                                    if (!strncmp(line2, \";\\\"Virtualized_\" EP_CLSID, 52))\n                                                    {\n                                                        DWORD dwVal = 0;\n                                                        WCHAR wszName[MAX_PATH];\n                                                        ZeroMemory(wszName, MAX_PATH * sizeof(wchar_t));\n                                                        MultiByteToWideChar(\n                                                            CP_UTF8,\n                                                            0,\n                                                            line2 + 2,\n                                                            numChRd2 - 2,\n                                                            wszName,\n                                                            MAX_PATH\n                                                        );\n                                                        wchar_t* ddd = wcschr(wszName, L'=');\n                                                        if (ddd) *ddd = 0;\n                                                        wchar_t* ppp = wcschr(wszName, L'\"');\n                                                        if (ppp) *ppp = 0;\n                                                        if (!wcsncmp(ddd + 1, L\"dword:\", 6))\n                                                        {\n                                                            wchar_t* xxx = wcschr(ddd + 1, L':');\n                                                            xxx++;\n                                                            dwVal = wcstol(xxx, NULL, 16);\n                                                            wprintf(L\"%s %d\\n\", wszName, dwVal);\n                                                            GUI_RegSetValueExW(NULL, wszName, 0, RRF_RT_DWORD, &dwVal, sizeof(DWORD));\n                                                        }\n                                                        else\n                                                        {\n                                                            //WCHAR* wszTitle = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));\n                                                            //wchar_t* x = wcschr(ddd + 2, L'\"');\n                                                            //x[0] = 0;\n                                                            //wprintf(L\">>> %s\\n\", ddd + 2);\n                                                        }\n                                                    }\n                                                }\n                                                free(line2);\n                                            }\n                                            fclose(vf);\n                                        }\n                                    }\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"uninstall\", 9))\n                            {\n                                HWND hwndExistingMb = FindWindowExW(NULL, NULL, L\"#32770\", _T(PRODUCT_NAME));\n                                if (hwndExistingMb)\n                                {\n                                    SwitchToThisWindow(hwndExistingMb, TRUE);\n                                }\n                                else\n                                {\n                                    wchar_t uninstallLink[MAX_PATH];\n                                    ZeroMemory(uninstallLink, sizeof(uninstallLink));\n                                    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, uninstallLink);\n                                    wcscat_s(uninstallLink, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(SETUP_UTILITY_NAME));\n\n                                    SHELLEXECUTEINFOW sei;\n                                    ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\n                                    sei.cbSize = sizeof(sei);\n                                    sei.hwnd = hwnd;\n                                    sei.lpFile = uninstallLink;\n                                    sei.nShow = SW_NORMAL;\n                                    sei.lpParameters = L\"/uninstall\";\n                                    ShellExecuteExW(&sei);\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"update_weather\", 14))\n                            {\n                                PostMessageW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), EP_WEATHER_WM_FETCH_DATA, 0, 0);\n                            }\n                            else if (!strncmp(line + 1, \"clear_data_weather\", 18))\n                            {\n                                wchar_t mbText[512];\n                                mbText[0] = 0;\n                                LoadStringW(hModule, IDS_WEATHER_CLEAR_PROMPT, mbText, ARRAYSIZE(mbText));\n                                if (MessageBoxW(hwnd, mbText, _T(PRODUCT_NAME), MB_ICONQUESTION | MB_YESNO) == IDYES)\n                                {\n                                    DWORD dwData = 0, dwVal = 0, dwSize = sizeof(DWORD);\n                                    GUI_Internal_RegQueryValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\", NULL, NULL, &dwData, &dwSize);\n                                    int res = 0;\n                                    if (dwData)\n                                    {\n                                        GUI_Internal_RegSetValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\", 0, 0, &dwVal, sizeof(DWORD));\n                                        PleaseWaitTimeout = 100;\n                                        PleaseWaitCallbackData = &res;\n                                        PleaseWaitCallbackFunc = GUI_Internal_DeleteWeatherFolder;\n                                        PleaseWaitHook = SetWindowsHookExW(WH_CALLWNDPROC, PleaseWait_HookProc, NULL, GetCurrentThreadId());\n                                        mbText[0] = 0;\n                                        LoadStringW(hModule, IDS_WEATHER_CLEAR_WAIT, mbText, ARRAYSIZE(mbText));\n                                        MessageBoxW(hwnd, mbText, _T(PRODUCT_NAME), 0);\n                                    }\n                                    else\n                                    {\n                                        res = GUI_DeleteWeatherFolder();\n                                    }\n                                    if (res == IDOK)\n                                    {\n                                        mbText[0] = 0;\n                                        LoadStringW(hModule, IDS_WEATHER_CLEAR_SUCCESS, mbText, ARRAYSIZE(mbText));\n                                        MessageBoxW(hwnd, mbText, _T(PRODUCT_NAME), MB_ICONINFORMATION);\n                                    }\n                                    else\n                                    {\n                                        if (res == IDABORT)\n                                        {\n                                            mbText[0] = 0;\n                                            LoadStringW(hModule, IDS_WEATHER_CLEAR_FAILED, mbText, ARRAYSIZE(mbText));\n                                            MessageBoxW(hwnd, mbText, _T(PRODUCT_NAME), MB_ICONERROR);\n                                        }\n                                    }\n                                    if (dwData)\n                                    {\n                                        dwVal = 1;\n                                        GUI_Internal_RegSetValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_PeopleBand\", 0, 0, &dwVal, sizeof(DWORD));\n                                    }\n                                }\n                            }\n                            else if (!strncmp(line + 1, \"spotlight_menu\", 14))\n                            {\n                                POINT p;\n                                p.x = rcText.left;\n                                p.y = rcText.bottom;\n                                ClientToScreen(hwnd, &p);\n                                SpotlightHelper(SPOP_OPENMENU, hwnd, NULL, &p);\n                            }\n                            else if (!strncmp(line + 1, \"spotlight_click\", 15))\n                            {\n                                SpotlightHelper(SPOP_CLICKMENU_OPEN, hwnd, NULL, &p);\n                            }\n                            else if (!strncmp(line + 1, \"spotlight_next\", 14))\n                            {\n                                SpotlightHelper(SPOP_CLICKMENU_NEXTPIC, hwnd, NULL, &p);\n                            }\n                            else if (!strncmp(line + 1, \"spotlight_like\", 14))\n                            {\n                                SpotlightHelper(SPOP_CLICKMENU_LIKE, hwnd, NULL, &p);\n                            }\n                            else if (!strncmp(line + 1, \"spotlight_dislike\", 17))\n                            {\n                                SpotlightHelper(SPOP_CLICKMENU_DISLIKE, hwnd, NULL, &p);\n                            }\n                        }\n                    }\n                    dwMaxHeight += dwLineHeight * dy;\n                    if (!strncmp(line, \";u \", 3))\n                    {\n                        tabOrder++;\n                    }\n                }\n                else if (!strncmp(line, \";l \", 3) || !strncmp(line, \";y \", 3) || !strncmp(line, \";c \", 3) || !strncmp(line, \";w \", 3) || !strncmp(line, \";z \", 3) || !strncmp(line, \";b \", 3) || !strncmp(line, \";i \", 3) || !strncmp(line, \";d \", 3) || !strncmp(line, \";v \", 3))\n                {\n                    ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));\n                    text[0] = L'\\u2795';\n                    text[1] = L' ';\n                    text[2] = L' ';\n                    MultiByteToWideChar(\n                        CP_UTF8,\n                        0,\n                        !strncmp(line, \";c \", 3) || !strncmp(line, \";z \", 3) ? strchr(line + 3, ' ') + 1 : line + 3,\n                        numChRd - 3,\n                        text + 3,\n                        MAX_LINE_LENGTH - 3\n                    );\n\n                    wchar_t* x = wcschr(text, L'\\n');\n                    if (x) *x = 0;\n                    x = wcschr(text, L'\\r');\n                    if (x) *x = 0;\n                    GUI_SubstituteLocalizedString(text + 3, MAX_LINE_LENGTH - 3);\n                    if (!strncmp(line, \";w \", 3) || !strncmp(line, \";c \", 3) || !strncmp(line, \";z \", 3) || !strncmp(line, \";b \", 3) || !strncmp(line, \";i \", 3) || !strncmp(line, \";d \", 3) || !strncmp(line, \";v \", 3))\n                    {\n                        WCHAR* wszTitle = NULL;\n                        WCHAR* wszPrompt = NULL;\n                        WCHAR* wszDefault = NULL;\n                        WCHAR* wszFallbackDefault = NULL;\n                        HMENU hMenu = NULL;\n                        BOOL bInput = !strncmp(line, \";w \", 3);\n                        BOOL bChoice = !strncmp(line, \";c \", 3);\n                        BOOL bChoiceLefted = !strncmp(line, \";z \", 3);\n                        BOOL bInvert = !strncmp(line, \";i \", 3);\n                        BOOL bJustCheck = !strncmp(line, \";d \", 3);\n                        BOOL bBool = !strncmp(line, \";b \", 3);\n                        BOOL bValue = !strncmp(line, \";v \", 3);\n                        DWORD numChoices = 0;\n                        if (bChoice || bChoiceLefted)\n                        {\n                            char* p = strchr(line + 3, ' ');\n                            if (p) *p = 0;\n                            numChoices = atoi(line + 3);\n                            hMenu = CreatePopupMenu();\n                            if (numChoices == 10001)\n                            {\n                                GUI_PopulateLanguageSelectorMenu(hMenu);\n                            }\n                            else\n                            {\n                                for (unsigned int i = 0; i < numChoices; ++i)\n                                {\n                                    char* l = malloc(MAX_LINE_LENGTH * sizeof(char));\n                                    numChRd = getline(&l, &bufsiz, f);\n                                    if (strncmp(l, \";x \", 3))\n                                    {\n                                        free(l);\n                                        i--;\n                                        continue;\n                                    }\n                                    char* p = strchr(l + 3, ' ');\n                                    if (p) *p = 0;\n                                    char* ln = p + 1;\n                                    p = strchr(p + 1, '\\r');\n                                    if (p) *p = 0;\n                                    p = strchr(p + 1, '\\n');\n                                    if (p) *p = 0;\n\n                                    wchar_t* miText = malloc(MAX_PATH * sizeof(wchar_t));\n                                    MultiByteToWideChar(\n                                        CP_UTF8,\n                                        0,\n                                        ln,\n                                        MAX_PATH,\n                                        miText,\n                                        MAX_PATH\n                                    );\n                                    GUI_SubstituteLocalizedString(miText, MAX_PATH);\n\n                                    MENUITEMINFOW menuInfo;\n                                    ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n                                    menuInfo.cbSize = sizeof(MENUITEMINFOW);\n                                    menuInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA | MIIM_STATE;\n                                    menuInfo.wID = atoi(l + 3) + 1;\n                                    menuInfo.dwItemData = l;\n                                    menuInfo.fType = MFT_STRING;\n                                    menuInfo.dwTypeData = miText;\n                                    menuInfo.cch = strlen(ln);\n                                    InsertMenuItemW(\n                                        hMenu,\n                                        i,\n                                        TRUE,\n                                        &menuInfo\n                                    );\n\n                                    free(miText);\n                                }\n                            }\n                        }\n                        else if (bInput)\n                        {\n                            wszTitle = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));\n                            wszPrompt = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));\n                            wszDefault = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));\n                            wszFallbackDefault = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));\n                            char* l = malloc(MAX_LINE_LENGTH * sizeof(char));\n                            numChRd = getline(&l, &bufsiz, f);\n                            char* p = l;\n                            p = strchr(p + 1, '\\r');\n                            if (p) *p = 0;\n                            p = strchr(p + 1, '\\n');\n                            if (p) *p = 0;\n                            MultiByteToWideChar(\n                                CP_UTF8,\n                                0,\n                                l + 1,\n                                numChRd - 1,\n                                wszPrompt,\n                                MAX_LINE_LENGTH\n                            );\n                            GUI_SubstituteLocalizedString(wszPrompt, MAX_LINE_LENGTH);\n                            numChRd = getline(&l, &bufsiz, f);\n                            p = l;\n                            p = strchr(p + 1, '\\r');\n                            if (p) *p = 0;\n                            p = strchr(p + 1, '\\n');\n                            if (p) *p = 0;\n                            MultiByteToWideChar(\n                                CP_UTF8,\n                                0,\n                                l + 1,\n                                numChRd - 1,\n                                wszFallbackDefault,\n                                MAX_LINE_LENGTH\n                            );\n                            GUI_SubstituteLocalizedString(wszFallbackDefault, MAX_LINE_LENGTH);\n                            free(l);\n                        }\n                        numChRd = getline(&line, &bufsiz, f);\n                        if (!strncmp(line, \";\\\"Virtualized_\" EP_CLSID, 52))\n                        {\n                            for (unsigned int kkkk = 1; kkkk < MAX_LINE_LENGTH; ++kkkk)\n                            {\n                                if (line[kkkk])\n                                {\n                                    line[kkkk - 1] = line[kkkk];\n                                }\n                                else\n                                {\n                                    line[kkkk - 1] = 0;\n                                    break;\n                                }\n                            }\n                            ////////printf(\"%s\\n\", line);\n                        }\n                        ZeroMemory(name, MAX_LINE_LENGTH * sizeof(wchar_t));\n                        MultiByteToWideChar(\n                            CP_UTF8,\n                            0,\n                            line[0] == '\"' ? line + 1 : line,\n                            numChRd,\n                            name,\n                            MAX_LINE_LENGTH\n                        );\n                        wchar_t* d = wcschr(name, L'=');\n                        if (d) *d = 0;\n                        wchar_t* p = wcschr(name, L'\"');\n                        if (p) *p = 0;\n                        BOOL bShouldAlterTaskbarDa = FALSE;\n                        if (!wcscmp(name, L\"TaskbarDa\"))\n                        {\n                            if (GUI_TaskbarStyle == 0)\n                            {\n                                GUI_RemoveChoiceEntry(hMenu, 2);\n                                bShouldAlterTaskbarDa = TRUE;\n                            }\n                        }\n                        else if (!wcscmp(name, L\"Virtualized_\" _T(EP_CLSID) L\"_TaskbarPosition\") || !wcscmp(name, L\"Virtualized_\" _T(EP_CLSID) L\"_MMTaskbarPosition\"))\n                        {\n                            if (GUI_TaskbarStyle == 0)\n                            {\n                                GUI_RemoveChoiceEntry(hMenu, 0); // Left\n                                GUI_RemoveChoiceEntry(hMenu, 2); // Right\n                            }\n                        }\n                        else if (!wcscmp(name, L\"OldTaskbar\"))\n                        {\n                            if (IsWindows11() && !IsStockWindows10TaskbarAvailable())\n                            {\n                                GUI_RemoveChoiceEntry(hMenu, 1); // Windows 10\n                            }\n                            if (!DoesTaskbarDllExist())\n                            {\n                                GUI_RemoveChoiceEntry(hMenu, 2); // Windows 10 (ExplorerPatcher)\n                            }\n                        }\n                        else if (!wcscmp(name, L\"ReplaceVan\"))\n                        {\n                            if (IsWindows11Build25346OrHigher())\n                            {\n                                // Hide the win8 network flyout as an option on Win 11 after 25346 as van.dll was removed\n                                GUI_RemoveChoiceEntry(hMenu, 2); // Windows 8 flyout\n                            }\n                        }\n                        HKEY hKey = NULL;\n                        wchar_t* matchHKLM = wcsstr(section, L\"HKEY_LOCAL_MACHINE\");\n                        BOOL bIsHKLM = matchHKLM && (matchHKLM - section) < 3;\n                        DWORD dwDisposition;\n                        DWORD dwSize = sizeof(DWORD);\n                        DWORD value = FALSE;\n\n                        //wprintf(L\"%s %s %s\\n\", section, name, d + 1);\n                        if (!bInput && !wcsncmp(d + 1, L\"dword:\", 6))\n                        {\n                            wchar_t* x = wcschr(d + 1, L':');\n                            x++;\n                            value = wcstol(x, NULL, 16);\n                        }\n                        if (bInput)\n                        {\n                            wchar_t* x = wcschr(d + 2, L'\"');\n                            x[0] = 0;\n                            wcscpy_s(wszDefault, MAX_LINE_LENGTH, d + 2);\n                        }\n\n                        if (bInput)\n                        {\n                            dwSize = MAX_LINE_LENGTH;\n                            GUI_RegCreateKeyExW(\n                                bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,\n                                wcschr(section, L'\\\\') + 1,\n                                0,\n                                NULL,\n                                REG_OPTION_NON_VOLATILE,\n                                KEY_READ | (hDC ? 0 : (!bIsHKLM ? KEY_WRITE : 0)),\n                                NULL,\n                                & hKey,\n                                & dwDisposition\n                            );\n                            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n                            {\n                                hKey = NULL;\n                            }\n                            GUI_RegQueryValueExW(\n                                hKey,\n                                name,\n                                0,\n                                NULL,\n                                wszDefault,\n                                &dwSize\n                            );\n                        }\n                        else if (!bJustCheck)\n                        {\n                            GUI_RegCreateKeyExW(\n                                bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,\n                                wcschr(section, L'\\\\') + 1,\n                                0,\n                                NULL,\n                                REG_OPTION_NON_VOLATILE,\n                                KEY_READ | (hDC ? 0 : (!bIsHKLM ? KEY_WRITE : 0)),\n                                NULL,\n                                &hKey,\n                                &dwDisposition\n                            );\n                            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n                            {\n                                hKey = NULL;\n                            }\n                            GUI_RegQueryValueExW(\n                                hKey,\n                                name,\n                                0,\n                                NULL,\n                                &value,\n                                &dwSize\n                            );\n                            if (!wcscmp(name, L\"OldTaskbar\"))\n                            {\n                                AdjustTaskbarStyleValue(&value);\n                                GUI_TaskbarStyle = value;\n                            }\n                            if (hDC && bInvert)\n                            {\n                                value = !value;\n                            }\n                        }\n                        else\n                        {\n                            GUI_RegOpenKeyExW(\n                                bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,\n                                wcschr(section, L'\\\\') + 1,\n                                REG_OPTION_NON_VOLATILE,\n                                KEY_READ | (hDC ? 0 : (!bIsHKLM ? KEY_WRITE : 0)),\n                                &hKey\n                            );\n                            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n                            {\n                                hKey = NULL;\n                            }\n                            value = hKey;\n                        }\n                        if (bInput)\n                        {\n                            wcscpy_s(wszTitle, MAX_LINE_LENGTH, text + 3);\n                            wcscat_s(\n                                text,\n                                MAX_LINE_LENGTH,\n                                L\" : \"\n                            );\n                            if (wszDefault[0] == 0)\n                            {\n                                wcscat_s(text, MAX_LINE_LENGTH, wszFallbackDefault);\n                            }\n                            else\n                            {\n                                wcscat_s(\n                                    text,\n                                    MAX_LINE_LENGTH,\n                                    wszDefault\n                                );\n                            }\n                        }\n                        else if (bInvert || bBool || bJustCheck)\n                        {\n                            if (value)\n                            {\n                                text[0] = L'\\u2714';\n                            }\n                            else\n                            {\n                                text[0] = L'\\u274C';\n                            }\n                            text[1] = L' ';\n                            text[2] = L' ';\n                        }\n                        else if (bValue)\n                        {\n                            wcscat_s(\n                                text,\n                                MAX_LINE_LENGTH,\n                                L\" : \"\n                            );\n                            wchar_t buf[100];\n                            _itow_s(value, buf, 100, 10);\n                            wcscat_s(\n                                text,\n                                MAX_LINE_LENGTH,\n                                buf\n                            );\n                        }\n                        else if (bChoice || bChoiceLefted)\n                        {\n                            wcscat_s(\n                                text,\n                                MAX_LINE_LENGTH,\n                                L\" : \"\n                            );\n                            MENUITEMINFOW menuInfo;\n                            ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n                            menuInfo.cbSize = sizeof(MENUITEMINFOW);\n                            menuInfo.fMask = MIIM_STRING;\n                            int vvv = value + 1;\n                            if (bShouldAlterTaskbarDa && vvv == 3) vvv = 2;\n                            GetMenuItemInfoW(hMenu, vvv, FALSE, &menuInfo);\n                            menuInfo.cch += 1;\n                            menuInfo.dwTypeData = text + wcslen(text);\n                            GetMenuItemInfoW(hMenu, vvv, FALSE, &menuInfo);\n                            ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n                            menuInfo.cbSize = sizeof(MENUITEMINFOW);\n                            menuInfo.fMask = MIIM_STATE;\n                            menuInfo.fState = MFS_CHECKED;\n                            SetMenuItemInfoW(hMenu, vvv, FALSE, &menuInfo);\n                            wcscat_s(text, MAX_LINE_LENGTH, L\" \\u25BE\");\n                        }\n                        if (hDC && !bInvert && !bBool && !bJustCheck)\n                        {\n                            RECT rcTemp;\n                            rcTemp = rcText;\n                            DrawTextW(\n                                hdcPaint,\n                                text,\n                                3,\n                                &rcTemp,\n                                DT_CALCRECT\n                            );\n                            rcText.left += (!bChoiceLefted ? (rcTemp.right - rcTemp.left) : 0);\n                            for (unsigned int i = 0; i < wcslen(text); ++i)\n                            {\n                                text[i] = text[i + 3];\n                            }\n                        }\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcTemp.bottom = rcText.bottom;\n                        if (!hDC && (PtInRect(&rcTemp, pt) || (pt.x == 0 && pt.y == 0 && tabOrder == _this->tabOrder)))\n                        {\n                            if (bJustCheck)\n                            {\n                                if (bIsHKLM && wcsstr(section, L\"Software\\\\Classes\\\\CLSID\\\\\" _T(EP_CLSID) L\"\\\\InprocServer32\"))\n                                {\n                                    WCHAR wszArgs[MAX_PATH];\n                                    if (!hKey)\n                                    {\n                                        wszArgs[0] = L'\\\"';\n                                        SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 1);\n                                    }\n                                    else\n                                    {\n                                        wszArgs[0] = L'/';\n                                        wszArgs[1] = L'u';\n                                        wszArgs[2] = L' ';\n                                        wszArgs[3] = L'\"';\n                                        SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4);\n                                    }\n#if defined(_M_X64)\n                                    wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".amd64.dll\\\"\");\n#elif defined(_M_ARM64)\n                                    wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".arm64.dll\\\"\");\n#else\n#error \"Unsupported architecture\"\n#endif\n                                    wprintf(L\"%s\\n\", wszArgs);\n                                    WCHAR wszApp[MAX_PATH * 2];\n                                    GetSystemDirectoryW(wszApp, MAX_PATH * 2);\n                                    wcscat_s(wszApp, MAX_PATH * 2, L\"\\\\regsvr32.exe\");\n                                    wprintf(L\"%s\\n\", wszApp);\n                                    SHELLEXECUTEINFOW sei;\n                                    ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\n                                    sei.cbSize = sizeof(sei);\n                                    sei.fMask = SEE_MASK_NOCLOSEPROCESS;\n                                    sei.hwnd = NULL;\n                                    sei.hInstApp = NULL;\n                                    sei.lpVerb = L\"runas\";\n                                    sei.lpFile = wszApp;\n                                    sei.lpParameters = wszArgs;\n                                    sei.hwnd = NULL;\n                                    sei.nShow = SW_NORMAL;\n                                    if (ShellExecuteExW(&sei) && sei.hProcess)\n                                    {\n                                        WaitForSingleObject(sei.hProcess, INFINITE);\n                                        DWORD dwExitCode = 0;\n                                        if (GetExitCodeProcess(sei.hProcess, &dwExitCode) && !dwExitCode)\n                                        {\n\n                                        }\n                                        else\n                                        {\n\n                                        }\n                                        CloseHandle(sei.hProcess);\n                                    }\n                                    else\n                                    {\n                                        DWORD dwError = GetLastError();\n                                        if (dwError == ERROR_CANCELLED)\n                                        {\n                                        }\n                                    }\n                                }\n                                else\n                                {\n                                    if (hKey)\n                                    {\n                                        RegCloseKey(hKey);\n                                        hKey = NULL;\n                                        RegDeleteKeyExW(\n                                            bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,\n                                            wcschr(section, L'\\\\') + 1,\n                                            REG_OPTION_NON_VOLATILE,\n                                            0\n                                        );\n                                    }\n                                    else\n                                    {\n                                        GUI_RegCreateKeyExW(\n                                            bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,\n                                            wcschr(section, L'\\\\') + 1,\n                                            0,\n                                            NULL,\n                                            REG_OPTION_NON_VOLATILE,\n                                            KEY_WRITE,\n                                            NULL,\n                                            &hKey,\n                                            &dwDisposition\n                                        );\n                                        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n                                        {\n                                            hKey = NULL;\n                                        }\n                                        if (d[1] == '\"')\n                                        {\n                                            wchar_t* p = wcschr(d + 2, L'\"');\n                                            if (p) *p = 0;\n                                            GUI_RegSetValueExW(\n                                                hKey,\n                                                !wcsncmp(name, L\"@\", 1) ? NULL : name,\n                                                0,\n                                                REG_SZ,\n                                                d + 2,\n                                                wcslen(d + 2) * sizeof(wchar_t)\n                                            );\n                                        }\n                                    }\n                                }\n                            }\n                            else\n                            {\n                                DWORD val = 0;\n                                if (bInput)\n                                {\n                                    WCHAR* wszAnswer = calloc(MAX_LINE_LENGTH, sizeof(WCHAR));\n                                    BOOL bWasCancelled = FALSE;\n                                    if (SUCCEEDED(InputBox(FALSE, hwnd, wszPrompt, wszTitle, wszDefault, wszAnswer, MAX_LINE_LENGTH, &bWasCancelled)) && !bWasCancelled)\n                                    {\n                                        if (wszAnswer[0])\n                                        {\n                                            GUI_RegSetValueExW(\n                                                hKey,\n                                                name,\n                                                0,\n                                                REG_SZ,\n                                                wszAnswer,\n                                                (wcslen(wszAnswer) + 1) * sizeof(WCHAR)\n                                            );\n                                        }\n                                        else\n                                        {\n                                            RegDeleteValueW(hKey, name);\n                                        }\n                                        Sleep(100);\n                                        PostMessageW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), EP_WEATHER_WM_FETCH_DATA, 0, 0);\n                                    }\n                                    free(wszAnswer);\n                                }\n                                else if (bChoice || bChoiceLefted)\n                                {\n                                    RECT rcTemp;\n                                    rcTemp = rcText;\n                                    DrawTextW(\n                                        hdcPaint,\n                                        text,\n                                        3,\n                                        &rcTemp,\n                                        DT_CALCRECT\n                                    );\n                                    POINT p;\n                                    p.x = rcText.left + (bChoiceLefted ? 0 : (rcTemp.right - rcTemp.left));\n                                    p.y = rcText.bottom;\n                                    ClientToScreen(\n                                        hwnd,\n                                        &p\n                                    );\n                                    val = TrackPopupMenu(\n                                        hMenu, \n                                        TPM_RETURNCMD | TPM_RIGHTBUTTON,\n                                        p.x,\n                                        p.y,\n                                        0,\n                                        hwnd,\n                                        0\n                                    );\n                                    if (val > 0) value = val - 1;\n                                    KillTimer(hwnd, GUI_TIMER_READ_REPEAT_SELECTION);\n                                    SetTimer(hwnd, GUI_TIMER_READ_REPEAT_SELECTION, GUI_TIMER_READ_REPEAT_SELECTION_TIMEOUT, NULL);\n\n                                }\n                                else if (bValue)\n                                {\n\n                                }\n                                else\n                                {\n                                    value = !value;\n                                }\n                                if (!wcscmp(name, L\"LastSectionInProperties\") && wcsstr(section, _T(REGPATH)) && value)\n                                {\n                                    value = _this->section + 1;\n                                }\n                                if (!bInput && (!(bChoice || bChoiceLefted) || ((bChoice || bChoiceLefted) && val)))\n                                {\n                                    GUI_RegSetValueExW(\n                                        hKey,\n                                        name,\n                                        0,\n                                        REG_DWORD,\n                                        &value,\n                                        sizeof(DWORD)\n                                    );\n                                    if (!wcscmp(name, L\"Language\"))\n                                    {\n                                        GUI_UpdateLanguages();\n                                        POINT pt;\n                                        pt.x = 0;\n                                        pt.y = 0;\n                                        _this->bCalcExtent = TRUE;\n                                        GUI_Build(0, hwnd, pt);\n                                    }\n                                }\n                            }\n                            InvalidateRect(hwnd, NULL, FALSE);\n                        }\n                        if (hKey)\n                        {\n                            RegCloseKey(hKey);\n                        }\n                        if (bChoice || bChoiceLefted)\n                        {\n                            for (unsigned int i = 0; ; ++i)\n                            {\n                                MENUITEMINFOW menuInfo;\n                                ZeroMemory(&menuInfo, sizeof(MENUITEMINFOW));\n                                menuInfo.cbSize = sizeof(MENUITEMINFOW);\n                                menuInfo.fMask = MIIM_DATA;\n                                if (!GetMenuItemInfoW(hMenu, i, TRUE, &menuInfo))\n                                {\n                                    break;\n                                }\n                                if (menuInfo.dwItemData)\n                                {\n                                    free(menuInfo.dwItemData);\n                                }\n                            }\n                            DestroyMenu(hMenu);\n                        }\n                        if (wszTitle)\n                        {\n                            free(wszTitle);\n                        }\n                        if (wszPrompt)\n                        {\n                            free(wszPrompt);\n                        }\n                        if (wszDefault)\n                        {\n                            free(wszDefault);\n                        }\n                        if (wszFallbackDefault)\n                        {\n                            free(wszFallbackDefault);\n                        }\n                    }\n                    if (hDC && (!strncmp(line, \";l \", 3) || !strncmp(line, \";y \", 3)))\n                    {\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            3,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcText.left += (!strncmp(line, \";l \", 3) ? (rcTemp.right - rcTemp.left) : 0);\n                        for (unsigned int i = 0; i < wcslen(text); ++i)\n                        {\n                            text[i] = text[i + 3];\n                        }\n                    }\n                    if (!hDC && (!strncmp(line, \";l \", 3) || !strncmp(line, \";y \", 3)))\n                    {\n                        RECT rcTemp;\n                        rcTemp = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcTemp,\n                            DT_CALCRECT\n                        );\n                        rcTemp.bottom = rcText.bottom;\n                        //printf(\"%d %d %d %d %d %d %d %d\\n\", rcText.left, rcText.top, rcText.right, rcText.bottom, rcTemp.left, rcTemp.top, rcTemp.right, rcTemp.bottom);\n                        if (PtInRect(&rcTemp, pt) || (pt.x == 0 && pt.y == 0 && tabOrder == _this->tabOrder))\n                        {\n                            numChRd = getline(&line, &bufsiz, f);\n                            char* p = strchr(line, '\\r');\n                            if (p) *p = 0;\n                            p = strchr(line, '\\n');\n                            if (p) *p = 0;\n                            if (line[1] != 0)\n                            {\n                                if (line[1] == ';')\n                                {\n                                    if (!strcmp(line + 2, \";EP_CHECK_FOR_UPDATES\"))\n                                    {\n                                        HANDLE hEvent = CreateEventW(NULL, FALSE, FALSE, L\"EP_Ev_CheckForUpdates_\" _T(EP_CLSID));\n                                        if (hEvent)\n                                        {\n                                            if (GetLastError() == ERROR_ALREADY_EXISTS)\n                                            {\n                                                SetEvent(hEvent);\n                                            }\n                                            CloseHandle(hEvent);\n                                        }\n                                    }\n                                    else if (!strcmp(line + 2, \";EP_INSTALL_UPDATES\"))\n                                    {\n                                        HANDLE hEvent = CreateEventW(NULL, FALSE, FALSE, L\"EP_Ev_InstallUpdates_\" _T(EP_CLSID));\n                                        if (hEvent)\n                                        {\n                                            if (GetLastError() == ERROR_ALREADY_EXISTS)\n                                            {\n                                                SetEvent(hEvent);\n                                            }\n                                            CloseHandle(hEvent);\n                                        }\n                                    }\n                                }\n                                else\n                                {\n                                    ShellExecuteA(\n                                        NULL,\n                                        \"open\",\n                                        line + 1,\n                                        NULL,\n                                        NULL,\n                                        SW_SHOWNORMAL\n                                    );\n                                }\n                            }\n                        }\n                    }\n                    if (hDC)\n                    {\n                        COLORREF cr;\n                        if (tabOrder == _this->tabOrder)\n                        {\n                            bTabOrderHit = TRUE;\n                            if (!IsThemeActive() || IsHighContrast())\n                            {\n                                cr = SetTextColor(hdcPaint, GetSysColor(COLOR_HIGHLIGHT));\n                            }\n                            else\n                            {\n                                DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_SELECTED_DARK : GUI_TEXTCOLOR_SELECTED;\n                                //DttOpts.crText = GetSysColor(COLOR_HIGHLIGHT);\n                            }\n                        }\n                        RECT rcNew = rcText;\n                        DrawTextW(\n                            hdcPaint,\n                            text,\n                            -1,\n                            &rcNew,\n                            DT_CALCRECT\n                        );\n                        if (rcNew.right - rcNew.left > dwMaxWidth)\n                        {\n                            dwMaxWidth = rcNew.right - rcNew.left + 50 * dx;\n                        }\n                        if (!wcsncmp(text + 3, L\"%PLACEHOLDER_0001%\", 18))\n                        {\n                            WCHAR key = 0;\n                            BYTE kb[256];\n                            ZeroMemory(kb, 256);\n                            ToUnicode(\n                                MapVirtualKeyW(0x29, MAPVK_VSC_TO_VK_EX),\n                                0x29,\n                                kb,\n                                &key,\n                                1,\n                                0\n                            );\n                            wchar_t wszFormat[MAX_PATH];\n                            int numChars = LoadStringW(hModule, IDS_AT_SWS_NOPERAPP, wszFormat, MAX_PATH);\n                            if (numChars != 0)\n                            {\n                                swprintf(text + 3, MAX_LINE_LENGTH - 3, wszFormat, key);\n                            }\n                        }\n                        if (tabOrder == _this->tabOrder)\n                        {\n                            if (_this->bShouldAnnounceSelected)\n                            {\n                                unsigned int accLen = wcslen(text);\n                                DWORD dwType = 0;\n                                if (!strncmp(line, \";y \", 3))\n                                {\n                                    dwType = 4;\n                                }\n                                if (text[0] == L'\\u2714') dwType = 1;\n                                else if (text[0] == L'\\u274C') dwType = 2;\n                                else if (text[accLen - 1] == 56405) dwType = 3;\n                                else if (!strstr(line, \"dword\")) dwType = 5;\n                                WCHAR accText[1000], accText2[1000];\n                                ZeroMemory(accText, 1000 * sizeof(wchar_t));\n                                ZeroMemory(accText2, 1000 * sizeof(wchar_t));\n                                swprintf_s(\n                                    accText,\n                                    1000,\n                                    L\"%s %s %s: %s\",\n                                    (_this->dwPageLocation < 0 ?\n                                        L\"Reached end of the page.\" :\n                                        (_this->dwPageLocation > 0 ?\n                                            L\"Reached beginning of the page.\" : L\"\")),\n                                    (lastHeading[0] == 0) ? L\"\" : lastHeading,\n                                    (dwType == 1 || dwType == 2) ? text + 1 : text,\n                                    dwType == 1 ? L\"Enabled\" :\n                                    (dwType == 2 ? L\"Disabled\" :\n                                        (dwType == 3 ? L\"Link\" :\n                                            (dwType == 4 ? L\"Button\" :\n                                                (dwType == 5 ? L\"Input\" : \n                                                    L\"List\"))))\n                                );\n                                accLen = wcslen(accText);\n                                unsigned int j = 0;\n                                for (unsigned int i = 0; i < accLen; ++i)\n                                {\n                                    if (accText[i] == L'%')\n                                    {\n                                        accText2[j] = L'%';\n                                        accText2[j + 1] = L'%';\n                                        j++;\n                                    }\n                                    else\n                                    {\n                                        accText2[j] = accText[i];\n                                    }\n                                    ++j;\n                                }\n                                _this->dwPageLocation = 0;\n                                BOOL dwTypeRepl = 0;\n                                accLen = wcslen(accText2);\n                                for (unsigned int i = 0; i < accLen; ++i)\n                                {\n                                    if (accText2[i] == L'*')\n                                    {\n                                        if (accText2[i + 1] == L'*')\n                                        {\n                                            dwTypeRepl = 1;\n                                        }\n                                        accText2[i] = L'%';\n                                        if (i + 1 >= accLen)\n                                        {\n                                            accText2[i + 2] = 0;\n                                        }\n                                        accText2[i + 1] = L's';\n                                    }\n                                }\n                                if (dwTypeRepl == 1)\n                                {\n                                    swprintf_s(accText, 1000, accText2, L\" - Requires registration as shell extension to work in Open or Save file dialogs - \");\n                                }\n                                else\n                                {\n                                    swprintf_s(accText, 1000, accText2, L\" - Requires File Explorer restart to apply - \");\n                                }\n                                //wprintf(L\">>> %s\\n\", accText);\n                                SetWindowTextW(_this->hAccLabel, accText);\n                                NotifyWinEvent(\n                                    EVENT_OBJECT_LIVEREGIONCHANGED,\n                                    _this->hAccLabel,\n                                    OBJID_CLIENT,\n                                    CHILDID_SELF);\n                                _this->bShouldAnnounceSelected = FALSE;\n                            }\n                        }\n                        if (IsThemeActive() && !IsHighContrast())\n                        {\n                            DrawThemeTextEx(\n                                _this->hTheme,\n                                hdcPaint,\n                                0,\n                                0,\n                                text,\n                                -1,\n                                dwTextFlags,\n                                &rcText,\n                                &DttOpts\n                            );\n                        }\n                        else\n                        {\n                            DrawTextW(\n                                hdcPaint,\n                                text,\n                                -1,\n                                &rcText,\n                                dwTextFlags\n                            );\n                        }\n                        if (tabOrder == _this->tabOrder)\n                        {\n                            if (!IsThemeActive() || IsHighContrast())\n                            {\n                                SetTextColor(hdcPaint, cr);\n                            }\n                            else\n                            {\n                                DttOpts.crText = g_darkModeEnabled ? GUI_TEXTCOLOR_DARK : GUI_TEXTCOLOR;\n                                //DttOpts.crText = GetSysColor(COLOR_WINDOWTEXT);\n                            }\n                        }\n                    }\n                    dwMaxHeight += dwLineHeight * dy;\n                    tabOrder++;\n                }\n            }\n            if (hOldFont)\n            {\n                SelectObject(hdcPaint, hOldFont);\n            }\n        }\n        fclose(f);\n        free(section);\n        free(name);\n        free(text);\n        free(line);\n        free(lastHeading);\n        if (!bWasSpecifiedSectionValid)\n        {\n            _this->bRebuildIfTabOrderIsEmpty = FALSE;\n            _this->tabOrder = 0;\n            GUI_SetSection(_this, FALSE, 0);\n            InvalidateRect(hwnd, NULL, FALSE);\n        }\n\n        if (!hDC)\n        {\n            ReleaseDC(hwnd, hdcPaint);\n        }\n        DeleteObject(hFontSectionSel);\n        DeleteObject(hFontSection);\n        DeleteObject(hFontRegular);\n        DeleteObject(hFontTitle);\n        DeleteObject(hFontUnderline);\n        DeleteObject(hFontCaption);\n\n        if (_this->bShouldAnnounceSelected)\n        {\n            int max_section = 100;\n            for (unsigned int i = 0; i < 100; ++i)\n            {\n                if (_this->sectionNames[i][0] == 0)\n                {\n                    max_section = i - 1;\n                    break;\n                }\n            }\n            WCHAR wszAccText[100];\n            swprintf_s(\n                wszAccText,\n                100,\n                L\"Selected page: %s: %d of %d.\",\n                _this->sectionNames[_this->section],\n                _this->section + 1,\n                max_section + 1\n            );\n            SetWindowTextW(_this->hAccLabel, wszAccText);\n            if (!_this->bRebuildIfTabOrderIsEmpty)\n            {\n                NotifyWinEvent(\n                    EVENT_OBJECT_LIVEREGIONCHANGED,\n                    _this->hAccLabel,\n                    OBJID_CLIENT,\n                    CHILDID_SELF\n                );\n            }\n        }\n\n        if (hDC)\n        {\n            if (_this->tabOrder == GUI_MAX_TABORDER)\n            {\n                _this->tabOrder = tabOrder - 1;\n                _this->dwPageLocation = -1;\n                InvalidateRect(hwnd, NULL, FALSE);\n            }\n            else if (!bTabOrderHit)\n            {\n                if (_this->bRebuildIfTabOrderIsEmpty)\n                {\n                    _this->dwPageLocation = 1;\n                    _this->bRebuildIfTabOrderIsEmpty = FALSE;\n                    _this->tabOrder = 1;\n                    InvalidateRect(hwnd, NULL, FALSE);\n                }\n                else\n                {\n                    _this->tabOrder = 0;\n                }\n            }\n        }\n\n        if (_this->bRebuildIfTabOrderIsEmpty)\n        {\n            _this->bRebuildIfTabOrderIsEmpty = FALSE;\n        }\n    }\n    if (_this->bCalcExtent)\n    {\n        RECT rcWin;\n        GetWindowRect(hwnd, &rcWin);\n        printf(\"%d %d - %d %d\\n\", rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, dwMaxWidth, dwMaxHeight);\n\n        dwMaxWidth += dwInitialLeftPad + _this->padding.left + _this->padding.right;\n        if (!IsThemeActive() || IsHighContrast() || !IsWindows11() || IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n        {\n            dwMaxHeight += GUI_LINE_HEIGHT * dy + 20 * dy;\n        }\n        else\n        {\n            dwMaxHeight += GUI_PADDING * 2 * dy;\n        }\n\n        HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);\n        MONITORINFO mi;\n        mi.cbSize = sizeof(MONITORINFO);\n        GetMonitorInfo(hMonitor, &mi);\n        SetWindowPos(\n            hwnd,\n            hwnd,\n            mi.rcWork.left + ((mi.rcWork.right - mi.rcWork.left) / 2 - (dwMaxWidth) / 2),\n            mi.rcWork.top + ((mi.rcWork.bottom - mi.rcWork.top) / 2 - (dwMaxHeight) / 2),\n            dwMaxWidth,\n            dwMaxHeight,\n            SWP_NOZORDER | SWP_NOACTIVATE | (_this->bCalcExtent == 2 ? SWP_NOMOVE : 0)\n        );\n\n        if (_this->bCalcExtent != 2)\n        {\n            DWORD dwReadSection = 0;\n\n            HKEY hKey = NULL;\n            DWORD dwSize = sizeof(DWORD);\n            RegCreateKeyExW(\n                HKEY_CURRENT_USER,\n                TEXT(REGPATH),\n                0,\n                NULL,\n                REG_OPTION_NON_VOLATILE,\n                KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,\n                NULL,\n                &hKey,\n                NULL\n            );\n            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n            {\n                hKey = NULL;\n            }\n            if (hKey)\n            {\n                dwReadSection = 0;\n                dwSize = sizeof(DWORD);\n                RegQueryValueExW(\n                    hKey,\n                    TEXT(\"LastSectionInProperties\"),\n                    0,\n                    NULL,\n                    &dwReadSection,\n                    &dwSize\n                );\n                if (dwReadSection)\n                {\n                    _this->section = dwReadSection - 1;\n                }\n                dwReadSection = 0;\n                dwSize = sizeof(DWORD);\n                RegQueryValueExW(\n                    hKey,\n                    TEXT(\"OpenPropertiesAtNextStart\"),\n                    0,\n                    NULL,\n                    &dwReadSection,\n                    &dwSize\n                );\n                if (dwReadSection)\n                {\n                    _this->section = dwReadSection - 1;\n                    dwReadSection = 0;\n                    RegSetValueExW(\n                        hKey,\n                        TEXT(\"OpenPropertiesAtNextStart\"),\n                        0,\n                        REG_DWORD,\n                        &dwReadSection,\n                        sizeof(DWORD)\n                    );\n                }\n                RegCloseKey(hKey);\n            }\n        }\n        if (_this->bCalcExtent == 2)\n        {\n            _this->section = _this->last_section;\n        }\n        \n        _this->bCalcExtent = 0;\n        InvalidateRect(hwnd, NULL, FALSE);\n    }\n\n    EndBufferedPaint(hBufferedPaint, TRUE);\n    return TRUE;\n}\n\nstatic LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n    GUI* _this;\n    if (uMsg == WM_CREATE)\n    {\n        CREATESTRUCT* pCreate = (CREATESTRUCT*)(lParam);\n        _this = (int*)(pCreate->lpCreateParams);\n        SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)_this);\n        UINT dpiX, dpiY, dpiXP, dpiYP;\n        POINT ptCursor, ptZero;\n        ptZero.x = 0;\n        ptZero.y = 0;\n        GetCursorPos(&ptCursor);\n        HMONITOR hMonitor = MonitorFromPoint(ptCursor, MONITOR_DEFAULTTOPRIMARY);\n        HMONITOR hPrimaryMonitor = MonitorFromPoint(ptZero, MONITOR_DEFAULTTOPRIMARY);\n        HRESULT hr = GetDpiForMonitor(\n            hMonitor,\n            MDT_DEFAULT,\n            &dpiX,\n            &dpiY\n        );\n        hr = GetDpiForMonitor(\n            hPrimaryMonitor,\n            MDT_DEFAULT,\n            &dpiXP,\n            &dpiYP\n        );\n        MONITORINFO mi;\n        mi.cbSize = sizeof(MONITORINFO);\n        GetMonitorInfo(hMonitor, &mi);\n        double dx = dpiX / 96.0, dy = dpiY / 96.0, dxp = dpiXP / 96.0, dyp = dpiYP / 96.0;\n        _this->dpi.x = dpiX;\n        _this->dpi.y = dpiY;\n        SetRect(&_this->border_thickness, 2, 2, 2, 2);\n        if (IsThemeActive() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n        {\n            BOOL bIsCompositionEnabled = TRUE;\n            DwmIsCompositionEnabled(&bIsCompositionEnabled);\n            if (bIsCompositionEnabled)\n            {\n                MARGINS marGlassInset;\n                if (!IsHighContrast())\n                {\n                    marGlassInset.cxLeftWidth = -1; // -1 means the whole window\n                    marGlassInset.cxRightWidth = -1;\n                    marGlassInset.cyBottomHeight = -1;\n                    marGlassInset.cyTopHeight = -1;\n                }\n                else\n                {\n                    marGlassInset.cxLeftWidth = 0;\n                    marGlassInset.cxRightWidth = 0;\n                    marGlassInset.cyBottomHeight = 0;\n                    marGlassInset.cyTopHeight = 0;\n                }\n                DwmExtendFrameIntoClientArea(hWnd, &marGlassInset);\n            }\n        }\n        SetWindowPos(\n            hWnd,\n            hWnd,\n            mi.rcWork.left + ((mi.rcWork.right - mi.rcWork.left) / 2 - (_this->size.cx * dx) / 2),\n            mi.rcWork.top + ((mi.rcWork.bottom - mi.rcWork.top) / 2 - (_this->size.cy * dy) / 2),\n            _this->size.cx * dxp,\n            _this->size.cy * dyp,\n            SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED\n        );\n        SetTimer(hWnd, GUI_TIMER_READ_HELP, GUI_TIMER_READ_HELP_TIMEOUT, NULL);\n        if (IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n        {\n            RECT rcTitle;\n            DwmGetWindowAttribute(hWnd, DWMWA_CAPTION_BUTTON_BOUNDS, &rcTitle, sizeof(RECT));\n            _this->GUI_CAPTION_LINE_HEIGHT = rcTitle.bottom - rcTitle.top;\n        }\n        else\n        {\n            _this->GUI_CAPTION_LINE_HEIGHT = GUI_CAPTION_LINE_HEIGHT_DEFAULT;\n        }\n        if (IsThemeActive() && ShouldAppsUseDarkMode && !IsHighContrast())\n        {\n            AllowDarkModeForWindow(hWnd, g_darkModeEnabled);\n            BOOL value = g_darkModeEnabled;\n            int s = 0;\n            if (global_rovi.dwBuildNumber < 18985)\n            {\n                s = -1;\n            }\n            DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &value, sizeof(BOOL));\n        }\n        if (!IsThemeActive() || IsHighContrast() || !IsWindows11() || IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n        {\n            int extendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);\n            SetWindowLong(hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);\n        }\n    }\n    else\n    {\n        LONG_PTR ptr = GetWindowLongPtr(hWnd, GWLP_USERDATA);\n        _this = (int*)(ptr);\n    }\n    if (uMsg == WM_DESTROY)\n    {\n        PostQuitMessage(0);\n        return 0;\n    }\n    else if (uMsg == WM_GETICON)\n    {\n        return _this->hIcon;\n    }\n    else if (uMsg == WM_SETTINGCHANGE)\n    {\n        if (IsColorSchemeChangeMessage(lParam))\n        {\n            if (IsThemeActive() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n            {\n                BOOL bIsCompositionEnabled = TRUE;\n                DwmIsCompositionEnabled(&bIsCompositionEnabled);\n                if (bIsCompositionEnabled)\n                {\n                    MARGINS marGlassInset;\n                    if (!IsHighContrast())\n                    {\n                        marGlassInset.cxLeftWidth = -1; // -1 means the whole window\n                        marGlassInset.cxRightWidth = -1;\n                        marGlassInset.cyBottomHeight = -1;\n                        marGlassInset.cyTopHeight = -1;\n                    }\n                    else\n                    {\n                        marGlassInset.cxLeftWidth = 0;\n                        marGlassInset.cxRightWidth = 0;\n                        marGlassInset.cyBottomHeight = 0;\n                        marGlassInset.cyTopHeight = 0;\n                    }\n                    DwmExtendFrameIntoClientArea(hWnd, &marGlassInset);\n                }\n            }\n            BOOL bIsCompositionEnabled = TRUE;\n            DwmIsCompositionEnabled(&bIsCompositionEnabled);\n            if (bIsCompositionEnabled)\n            {\n                BOOL value = (IsThemeActive() && !IsHighContrast() && IsWindows11()) ? 1 : 0;\n                SetMicaMaterialForThisWindow(hWnd, value);\n            }\n            if (IsThemeActive() && ShouldAppsUseDarkMode && !IsHighContrast())\n            {\n                RefreshImmersiveColorPolicyState();\n                BOOL bDarkModeEnabled = IsThemeActive() && bIsCompositionEnabled && ShouldAppsUseDarkMode() && !IsHighContrast();\n                if (bDarkModeEnabled != g_darkModeEnabled)\n                {\n                    g_darkModeEnabled = bDarkModeEnabled;\n                    AllowDarkModeForWindow(hWnd, g_darkModeEnabled);\n                    BOOL value = g_darkModeEnabled;\n                    int s = 0;\n                    if (global_rovi.dwBuildNumber < 18985)\n                    {\n                        s = -1;\n                    }\n                    DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &value, sizeof(BOOL));\n                    _this->bCalcExtent = 2;\n                    _this->last_section = _this->section;\n                    _this->section = 0;\n                    InvalidateRect(hWnd, NULL, FALSE);\n                }\n            }\n            else\n            {\n                _this->bCalcExtent = 2;\n                _this->last_section = _this->section;\n                _this->section = 0;\n                InvalidateRect(hWnd, NULL, FALSE);\n            }\n        }\n    }\n    else if (uMsg == WM_KEYDOWN)\n    {\n        _this->bRebuildIfTabOrderIsEmpty = FALSE;\n        if (wParam == VK_ESCAPE)\n        {\n            PostMessage(hWnd, WM_CLOSE, 0, 0);\n            return 0;\n        }\n        else if (wParam == VK_TAB || wParam == VK_DOWN || wParam == VK_UP)\n        {\n            if ((GetKeyState(VK_SHIFT) & 0x8000) || wParam == VK_UP)\n            {\n                if (_this->tabOrder == 0)\n                {\n                    _this->tabOrder = GUI_MAX_TABORDER;\n                }\n                else\n                {\n                    _this->tabOrder--;\n                    if (_this->tabOrder == 0)\n                    {\n                        _this->tabOrder = GUI_MAX_TABORDER;\n                    }\n                }\n            }\n            else\n            {\n                _this->tabOrder++;\n            }\n            _this->bRebuildIfTabOrderIsEmpty = TRUE;\n            _this->bShouldAnnounceSelected = TRUE;\n            InvalidateRect(hWnd, NULL, FALSE);\n            return 0;\n        }\n        else if (wParam == VK_SPACE || wParam == VK_RETURN)\n        {\n            POINT pt;\n            pt.x = 0;\n            pt.y = 0;\n            _this->bShouldAnnounceSelected = TRUE;\n            GUI_Build(0, hWnd, pt);\n            return 0;\n        }\n        // this should be determined from the file, but for now it works\n        else if (wParam >= '1' && wParam <= '9' || wParam == '0' || wParam == MapVirtualKeyW(0x0C, MAPVK_VSC_TO_VK_EX) || wParam == MapVirtualKeyW(0x0D, MAPVK_VSC_TO_VK_EX))\n        {\n            int min_section = 0;\n            int max_section = 100;\n            for (unsigned int i = 0; i < 100; ++i)\n            {\n                if (_this->sectionNames[i][0] == 0)\n                {\n                    max_section = i - 1;\n                    break;\n                }\n            }\n            int new_section = 0;\n            if (wParam == MapVirtualKeyW(0x0C, MAPVK_VSC_TO_VK_EX)) new_section = 10;\n            else if (wParam == MapVirtualKeyW(0x0D, MAPVK_VSC_TO_VK_EX)) new_section = 11;\n            else new_section = (wParam == '0' ? 9 : wParam - '1');\n            if (new_section < min_section) return 0;\n            if (new_section > max_section) return 0;\n            if (_this->section != new_section)\n            {\n                _this->tabOrder = 0;\n                GUI_SetSection(_this, TRUE, new_section);\n                _this->bShouldAnnounceSelected = TRUE;\n                InvalidateRect(hWnd, NULL, FALSE);\n            }\n            return 0;\n        }\n        else if (wParam == VK_LEFT || wParam == VK_RIGHT)\n        {\n            int min_section = 0;\n            int max_section = 100;\n            int new_section = _this->section;\n            for (unsigned int i = 0; i < 100; ++i)\n            {\n                if (_this->sectionNames[i][0] == 0)\n                {\n                    max_section = i - 1;\n                    break;\n                }\n            }\n            if (wParam == VK_LEFT)\n            {\n                new_section--;\n            }\n            else\n            {\n                new_section++;\n            }\n            if (new_section < min_section)\n            {\n                new_section = max_section;\n            }\n            if (new_section > max_section)\n            {\n                new_section = min_section;\n            }\n            if (_this->section != new_section)\n            {\n                _this->tabOrder = 0;\n                GUI_SetSection(_this, TRUE, new_section);\n                _this->bShouldAnnounceSelected = TRUE;\n                InvalidateRect(hWnd, NULL, FALSE);\n            }\n            return 0; \n        }\n        else if (wParam == 'H' || wParam == VK_F1)\n        {\n            SetTimer(hWnd, GUI_TIMER_READ_HELP, 200, NULL);\n            return 0;\n        }\n        else if (wParam == VK_F5)\n        {\n            InvalidateRect(hWnd, NULL, FALSE);\n            return 0;\n        }\n        else if (wParam == 'Z')\n        {\n            return 0;\n        }\n        else if (wParam == 'X')\n        {\n            return 0;\n        }\n    }\n    else if (uMsg == WM_NCMOUSELEAVE && IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n    {\n        LRESULT lRes = 0;\n        if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))\n        {\n            return lRes;\n        }\n    }\n    else if (uMsg == WM_NCRBUTTONUP && IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n    {\n        HMENU pSysMenu = GetSystemMenu(hWnd, FALSE);\n        if (pSysMenu != NULL)\n        {\n            int xPos = GET_X_LPARAM(lParam);\n            int yPos = GET_Y_LPARAM(lParam);\n            EnableMenuItem(pSysMenu, SC_RESTORE, MF_GRAYED);\n            EnableMenuItem(pSysMenu, SC_SIZE, MF_GRAYED);\n            EnableMenuItem(pSysMenu, SC_MAXIMIZE, MF_GRAYED);\n            BOOL cmd = TrackPopupMenu(pSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, xPos, yPos, NULL, hWnd, 0);\n            if (cmd)\n            {\n                PostMessageW(hWnd, WM_SYSCOMMAND, cmd, 0);\n            }\n        }\n        return 0;\n    }\n    else if ((uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP) && IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n    {\n        POINT pt;\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n\n        double dx = _this->dpi.x / 96.0, dy = _this->dpi.y / 96.0;\n        UINT diff = (int)(((_this->GUI_CAPTION_LINE_HEIGHT - 16) * dx) / 2.0);\n        RECT rc;\n        SetRect(&rc, diff, diff, diff + (int)(16.0 * dx), diff + (int)(16.0 * dy));\n        if (PtInRect(&rc, pt))\n        {\n            if (uMsg == WM_LBUTTONUP && _this->LeftClickTime != 0)\n            {\n                _this->LeftClickTime = milliseconds_now() - _this->LeftClickTime;\n            }\n            if (uMsg == WM_LBUTTONUP && _this->LeftClickTime != 0 && _this->LeftClickTime < GetDoubleClickTime())\n            {\n                _this->LeftClickTime = 0;\n                PostQuitMessage(0);\n            }\n            else\n            {\n                if (uMsg == WM_LBUTTONUP)\n                {\n                    _this->LeftClickTime = milliseconds_now();\n                }\n                if (uMsg == WM_RBUTTONUP || !_this->LastClickTime || milliseconds_now() - _this->LastClickTime > 500)\n                {\n                    HMENU pSysMenu = GetSystemMenu(hWnd, FALSE);\n                    if (pSysMenu != NULL)\n                    {\n                        if (uMsg == WM_LBUTTONUP)\n                        {\n                            pt.x = 0;\n                            pt.y = _this->GUI_CAPTION_LINE_HEIGHT * dy;\n                        }\n                        ClientToScreen(hWnd, &pt);\n                        EnableMenuItem(pSysMenu, SC_RESTORE, MF_GRAYED);\n                        EnableMenuItem(pSysMenu, SC_SIZE, MF_GRAYED);\n                        EnableMenuItem(pSysMenu, SC_MAXIMIZE, MF_GRAYED);\n                        BOOL cmd = TrackPopupMenu(pSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, NULL, hWnd, 0);\n                        if (cmd)\n                        {\n                            PostMessageW(hWnd, WM_SYSCOMMAND, cmd, 0);\n                        }\n                        if (uMsg == WM_LBUTTONUP)\n                        {\n                            _this->LastClickTime = milliseconds_now();\n                        }\n                    }\n                }\n            }\n            return 0;\n        }\n    }\n    else if (uMsg == WM_NCHITTEST && IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n    {\n        LRESULT lRes = 0;\n        if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))\n        {\n            return lRes;\n        }\n\n        POINT pt;\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n        ScreenToClient(hWnd, &pt);\n\n        double dx = _this->dpi.x / 96.0, dy = _this->dpi.y / 96.0;\n        UINT diff = (int)(((_this->GUI_CAPTION_LINE_HEIGHT - 16) * dx) / 2.0);\n        RECT rc;\n        SetRect(&rc, diff, diff, diff + (int)(16.0 * dx), diff + (int)(16.0 * dy));\n        if (PtInRect(&rc, pt))\n        {\n            return HTCLIENT;\n        }\n\n        if (pt.y < _this->extent.cyTopHeight)\n        {\n            return HTCAPTION;\n        }\n    }\n    else if (uMsg == WM_NCCALCSIZE && wParam == TRUE && IsThemeActive() && !IsHighContrast() && IsWindows11() && !IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n    {\n        NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)(lParam);\n        sz->rgrc[0].left += _this->border_thickness.left;\n        sz->rgrc[0].right -= _this->border_thickness.right;\n        sz->rgrc[0].bottom -= _this->border_thickness.bottom;\n        return 0;\n    }\n    else if (uMsg == WM_LBUTTONDOWN)\n    {\n        POINT pt;\n        pt.x = GET_X_LPARAM(lParam);\n        pt.y = GET_Y_LPARAM(lParam);\n        GUI_Build(0, hWnd, pt);\n        //InvalidateRect(hWnd, NULL, FALSE);\n    }\n    else if (uMsg == WM_DPICHANGED)\n    {\n        _this->dpi.x = LOWORD(wParam);\n        _this->dpi.y = HIWORD(wParam);\n        RECT* rc = lParam;\n        SetWindowPos(\n            hWnd,\n            hWnd,\n            rc->left,\n            rc->top,\n            rc->right - rc->left,\n            rc->bottom - rc->top,\n            SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS\n        );\n        RECT rcTitle;\n        DwmGetWindowAttribute(hWnd, DWMWA_CAPTION_BUTTON_BOUNDS, &rcTitle, sizeof(RECT));\n        _this->GUI_CAPTION_LINE_HEIGHT = (rcTitle.bottom - rcTitle.top) * (96.0 / _this->dpi.y);\n        return 0;\n    }\n    else if (uMsg == WM_PAINT)\n    {    \n        PAINTSTRUCT ps;\n        HDC hDC = BeginPaint(hWnd, &ps);\n\n        RECT rc;\n        GetClientRect(hWnd, &rc);\n\n        POINT pt;\n        pt.x = 0;\n        pt.y = 0;\n        GUI_Build(hDC, hWnd, pt);\n\n        EndPaint(hWnd, &ps);\n        return 0;\n    }\n    else if (uMsg == WM_INPUTLANGCHANGE)\n    {\n        InvalidateRect(hWnd, NULL, FALSE);\n        return 0;\n    }\n    else if (uMsg == WM_MSG_GUI_SECTION && wParam == WM_MSG_GUI_SECTION_GET)\n    {\n        return _this->section + 1;\n    }\n    else if (uMsg == WM_TIMER && wParam == GUI_TIMER_READ_HELP)\n    {\n        PlayHelpMessage(_this);\n        KillTimer(hWnd, GUI_TIMER_READ_HELP);\n    }\n    else if (uMsg == WM_TIMER && wParam == GUI_TIMER_READ_REPEAT_SELECTION)\n    {\n        _this->bShouldAnnounceSelected = TRUE;\n        InvalidateRect(hWnd, NULL, FALSE);\n        KillTimer(hWnd, GUI_TIMER_READ_REPEAT_SELECTION);\n    }\n    else if (uMsg == WM_USER + 1)\n    {\n        SetTimer(hWnd, GUI_TIMER_REFRESH_FOR_PEOPLEBAND, GUI_TIMER_REFRESH_FOR_PEOPLEBAND_TIMEOUT, NULL);\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == GUI_TIMER_REFRESH_FOR_PEOPLEBAND)\n    {\n        InvalidateRect(hWnd, NULL, FALSE);\n        KillTimer(hWnd, GUI_TIMER_REFRESH_FOR_PEOPLEBAND);\n        return 0;\n    }\n    return DefWindowProc(hWnd, uMsg, wParam, lParam);\n}\n\n__declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)\n{\n    HWND hOther = NULL;\n    if (hOther = FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), NULL))\n    {\n        SwitchToThisWindow(hOther, TRUE);\n        return 0;\n    }\n\n    HRESULT hr = CoInitializeEx(0, COINIT_APARTMENTTHREADED);\n\n    HKEY hKey = NULL;\n    DWORD dwSize = sizeof(DWORD);\n    RegCreateKeyExW(\n        HKEY_CURRENT_USER,\n        TEXT(REGPATH),\n        0,\n        NULL,\n        REG_OPTION_NON_VOLATILE,\n        KEY_READ | KEY_WOW64_64KEY,\n        NULL,\n        &hKey,\n        NULL\n    );\n    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n    {\n        hKey = NULL;\n    }\n    DWORD bAllocConsole = FALSE;\n    if (hKey)\n    {\n        dwSize = sizeof(DWORD);\n        RegQueryValueExW(\n            hKey,\n            TEXT(\"AllocConsole\"),\n            0,\n            NULL,\n            &bAllocConsole,\n            &dwSize\n        );\n        if (bAllocConsole)\n        {\n            FILE* conout;\n            AllocConsole();\n            freopen_s(\n                &conout,\n                \"CONOUT$\",\n                \"w\",\n                stdout\n            );\n        }\n    }\n\n    wprintf(L\"Running on Windows %d, OS Build %d.%d.%d.%d.\\n\", IsWindows11() ? 11 : 10, global_rovi.dwMajorVersion, global_rovi.dwMinorVersion, global_rovi.dwBuildNumber, global_ubr);\n\n    GUI_UpdateLanguages();\n\n    wchar_t wszPath[MAX_PATH];\n    ZeroMemory(\n        wszPath,\n        (MAX_PATH) * sizeof(char)\n    );\n    GetModuleFileNameW(hModule, wszPath, MAX_PATH);\n    PathRemoveFileSpecW(wszPath);\n    wcscat_s(\n        wszPath,\n        MAX_PATH,\n        L\"\\\\settings.reg\"\n    );\n    wprintf(L\"%s\\n\", wszPath);\n    if (FileExistsW(wszPath))\n    {\n        HANDLE hFile = CreateFileW(\n            wszPath,\n            GENERIC_READ | GENERIC_WRITE,\n            FILE_SHARE_READ,\n            NULL,\n            OPEN_EXISTING,\n            FILE_ATTRIBUTE_NORMAL,\n            0\n        );\n        if (hFile)\n        {\n            HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);\n            if (hFileMapping)\n            {\n                GUI_FileMapping = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);\n                GUI_FileSize = GetFileSize(hFile, NULL);\n            }\n        }\n    }\n\n    printf(\"Started \\\"GUI\\\" thread.\\n\");\n\n    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);\n\n    GUI _this;\n    ZeroMemory(&_this, sizeof(GUI));\n    _this.hBackgroundBrush = (HBRUSH)(CreateSolidBrush(RGB(255, 255, 255)));// (HBRUSH)GetStockObject(BLACK_BRUSH);\n    _this.location.x = GUI_POSITION_X;\n    _this.location.y = GUI_POSITION_Y;\n    _this.size.cx = GUI_POSITION_WIDTH;\n    _this.size.cy = GUI_POSITION_HEIGHT;\n    _this.padding.left = GUI_PADDING_LEFT;\n    _this.padding.right = GUI_PADDING_RIGHT;\n    _this.padding.top = GUI_PADDING_TOP;\n    _this.padding.bottom = GUI_PADDING_BOTTOM;\n    _this.sidebarWidth = GUI_SIDEBAR_WIDTH;\n    _this.hTheme = OpenThemeData(NULL, TEXT(GUI_WINDOWSWITCHER_THEME_CLASS));\n    _this.tabOrder = 0;\n    _this.bCalcExtent = 1;\n    _this.section = 0;\n    _this.dwStatusbarY = 0;\n    _this.hIcon = NULL;\n    _this.hExplorerFrame = NULL;\n\n    ZeroMemory(\n        wszPath,\n        (MAX_PATH) * sizeof(wchar_t)\n    );\n    GetSystemDirectoryW(\n        wszPath,\n        MAX_PATH\n    );\n    wcscat_s(\n        wszPath,\n        MAX_PATH,\n        L\"\\\\shell32.dll\"\n    );\n\n    WNDCLASS wc = { 0 };\n    ZeroMemory(&wc, sizeof(WNDCLASSW));\n    wc.style = 0;// CS_DBLCLKS;\n    wc.lpfnWndProc = GUI_WindowProc;\n    wc.hbrBackground = _this.hBackgroundBrush;\n    wc.hInstance = hModule;\n    wc.lpszClassName = L\"ExplorerPatcher_GUI_\" _T(EP_CLSID);\n    wc.hCursor = LoadCursorW(NULL, IDC_ARROW);\n    HMODULE hShell32 = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);\n    if (hShell32)\n    {\n        _this.hIcon = LoadIconW(hShell32, MAKEINTRESOURCEW(40)); //40\n        wc.hIcon = _this.hIcon;\n    }\n    RegisterClassW(&wc);\n\n    _this.hExplorerFrame = LoadLibraryExW(L\"ExplorerFrame.dll\", NULL, LOAD_LIBRARY_AS_DATAFILE);\n    if (_this.hExplorerFrame)\n    {\n        LoadStringW(_this.hExplorerFrame, 50222, GUI_title, 260); // 726 = File Explorer\n        wchar_t* p = wcschr(GUI_title, L'(');\n        if (p)\n        {\n            p--;\n            if (*p == L' ')\n            {\n                *p = 0;\n            }\n            else\n            {\n                p++;\n                *p = 0;\n            }\n        }\n        if (GUI_title[0] == 0)\n        {\n            LoadStringW(hModule, IDS_PRODUCTNAME, GUI_title, 260);\n        }\n    }\n    else\n    {\n        LoadStringW(hModule, IDS_PRODUCTNAME, GUI_title, 260);\n    }\n    BOOL bIsCompositionEnabled = TRUE;\n    DwmIsCompositionEnabled(&bIsCompositionEnabled);\n    HANDLE hUxtheme = NULL;\n    BOOL bHasLoadedUxtheme = FALSE;\n    bHasLoadedUxtheme = TRUE;\n    hUxtheme = LoadLibraryExW(L\"uxtheme.dll\", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);\n    if (hUxtheme)\n    {\n        RefreshImmersiveColorPolicyState = GetProcAddress(hUxtheme, (LPCSTR)104);\n        SetPreferredAppMode = GetProcAddress(hUxtheme, (LPCSTR)135);\n        AllowDarkModeForWindow = GetProcAddress(hUxtheme, (LPCSTR)133);\n        ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)132);\n        if (ShouldAppsUseDarkMode &&\n            SetPreferredAppMode &&\n            AllowDarkModeForWindow &&\n            RefreshImmersiveColorPolicyState\n            )\n        {\n            SetPreferredAppMode(TRUE);\n            RefreshImmersiveColorPolicyState();\n            g_darkModeEnabled = IsThemeActive() && bIsCompositionEnabled && ShouldAppsUseDarkMode() && !IsHighContrast();\n        }\n    }\n    GUI_RegQueryValueExW(NULL, L\"Virtualized_\" _T(EP_CLSID) L\"_TaskbarPosition\", NULL, NULL, &dwTaskbarPosition, NULL);\n    HWND hwnd = CreateWindowEx(\n        NULL,\n        L\"ExplorerPatcher_GUI_\" _T(EP_CLSID),\n        GUI_title,\n        WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX,\n        0,\n        0,\n        0,\n        0,\n        NULL, NULL, hModule, &_this\n    );\n    if (!hwnd)\n    {\n        return 1;\n    }\n\n    _this.hAccLabel = CreateWindowExW(\n        0,\n        L\"Static\",\n        L\"\",\n        WS_CHILD,\n        10,   \n        10,   \n        100, \n        100, \n        hwnd,\n        NULL,\n        (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE),\n        NULL\n    );\n\n    hr = CoCreateInstance(\n        &CLSID_AccPropServices,\n        NULL,\n        CLSCTX_INPROC,\n        &IID_IAccPropServices,\n        &_this.pAccPropServices);\n    if (SUCCEEDED(hr))\n    {\n        VARIANT var;\n        var.vt = VT_I4;\n        var.lVal = 2; // Assertive;\n\n        hr = ((IAccPropServices*)(_this.pAccPropServices))->lpVtbl->SetHwndProp(\n            _this.pAccPropServices,\n            _this.hAccLabel,\n            OBJID_CLIENT,\n            CHILDID_SELF,\n            LiveSetting_Property_GUID,\n            var\n        );\n    }\n\n    if (IsThemeActive() && !IsHighContrast() && IsWindows11())\n    {\n        if (bIsCompositionEnabled)\n        {\n            SetMicaMaterialForThisWindow(hwnd, TRUE);\n            /*WTA_OPTIONS ops;\n            ops.dwFlags = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;\n            ops.dwMask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;\n            SetWindowThemeAttribute(\n                hwnd,\n                WTA_NONCLIENT,\n                &ops,\n                sizeof(WTA_OPTIONS)\n            );*/\n        }\n    }\n    ShowWindow(hwnd, SW_SHOW);\n    if (hKey)\n    {\n        RegCloseKey(hKey);\n    }\n\n    MSG msg = { 0 };\n    while (GetMessage(&msg, NULL, 0, 0))\n    {\n        TranslateMessage(&msg);\n        DispatchMessage(&msg);\n    }\n\n    if (_this.pAccPropServices != NULL)\n    {\n        MSAAPROPID props[] = { LiveSetting_Property_GUID };\n        ((IAccPropServices*)(_this.pAccPropServices))->lpVtbl->ClearHwndProps(\n            _this.pAccPropServices,\n            _this.hAccLabel,\n            OBJID_CLIENT,\n            CHILDID_SELF,\n            props,\n            ARRAYSIZE(props));\n\n        ((IAccPropServices*)(_this.pAccPropServices))->lpVtbl->Release(_this.pAccPropServices);\n        _this.pAccPropServices = NULL;\n    }\n\n    DestroyWindow(_this.hAccLabel);\n\n    if (_this.hExplorerFrame)\n    {\n        FreeLibrary(_this.hExplorerFrame);\n    }\n\n    if (hShell32)\n    {\n        CloseHandle(_this.hIcon);\n        FreeLibrary(hShell32);\n    }\n\n    if (bHasLoadedUxtheme && hUxtheme)\n    {\n        FreeLibrary(hUxtheme);\n    }\n\n    _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\n    _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);\n    _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\n    _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);\n    _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\n    _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);\n    _CrtDumpMemoryLeaks();\n#ifdef _DEBUG\n    _getch();\n#endif\n\n    printf(\"Ended \\\"GUI\\\" thread.\\n\");\n}\n"
  },
  {
    "path": "ep_gui/GUI.h",
    "content": "#ifndef _H_GUI_H_\n#define _H_GUI_H_\n#define _CRTDBG_MAP_ALLOC\n#include <stdlib.h>\n#include <crtdbg.h>\n#pragma comment(linker,\"\\\"/manifestdependency:type='win32' \\\nname='Microsoft.Windows.Common-Controls' version='6.0.0.0' \\\nprocessorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\\\"\")\n#include <Windows.h>\n#pragma comment(lib, \"Version.lib\")\n#include <Shlwapi.h>\n#pragma comment(lib, \"Shlwapi.lib\")\n#include <windowsx.h>\n#include <tlhelp32.h>\n#include <shellscalingapi.h>\n#pragma comment(lib, \"Shcore.lib\")\n#include <conio.h>\n#include <stdio.h>\n#include <Uxtheme.h>\n#pragma comment(lib, \"UxTheme.lib\")\n#include <dwmapi.h>\n#pragma comment(lib, \"Dwmapi.lib\")\n#include \"resources/resource.h\"\n#include \"../ExplorerPatcher/getline.h\"\n#include \"../ExplorerPatcher/fmemopen.h\"\n#include \"../ExplorerPatcher/Localization.h\"\n#include \"../ExplorerPatcher/utility.h\"\n#include \"ep_weather.h\"\n#include \"ep_weather_host_h.h\"\n\n#define MAX_LINE_LENGTH 2000\nextern HMODULE hModule;\n\n#define GUI_POSITION_X CW_USEDEFAULT\n#define GUI_POSITION_Y CW_USEDEFAULT\n#define GUI_POSITION_WIDTH 367\n#define GUI_POSITION_HEIGHT 316\n#define GUI_WINDOWSWITCHER_THEME_CLASS \"ControlPanelStyle\"\n#define GUI_CAPTION_FONT_SIZE -12\n#define GUI_SECTION_FONT_SIZE -12\n#define GUI_SECTION_HEIGHT 32\n#define GUI_TITLE_FONT_SIZE -12\n#define GUI_LINE_HEIGHT 26\n#define GUI_CAPTION_LINE_HEIGHT_DEFAULT 42\n#define GUI_TEXTCOLOR RGB(0, 0, 0)\n#define GUI_TEXTCOLOR_SELECTED RGB(255, 0, 0)\n#define GUI_TEXTCOLOR_DARK RGB(240, 240, 240)\n#define GUI_TEXTCOLOR_SELECTED_DARK RGB(255, 150, 150)\n#define GUI_MAX_TABORDER 9999\n#define GUI_PADDING 5\n#define GUI_PADDING_LEFT GUI_PADDING * 3\n#define GUI_SIDEBAR_WIDTH 150 // 110\n#define GUI_PADDING_RIGHT GUI_PADDING * 3\n#define GUI_PADDING_TOP GUI_PADDING\n#define GUI_PADDING_BOTTOM GUI_PADDING\n#define GUI_STATUS_PADDING 10\n\n#define GUI_TIMER_READ_HELP 1\n#define GUI_TIMER_READ_HELP_TIMEOUT 1000\n#define GUI_TIMER_READ_REPEAT_SELECTION 2\n#define GUI_TIMER_READ_REPEAT_SELECTION_TIMEOUT 1000\n#define GUI_TIMER_REFRESH_FOR_PEOPLEBAND 2\n#define GUI_TIMER_REFRESH_FOR_PEOPLEBAND_TIMEOUT 1000\ntypedef struct _GUI\n{\n\tPOINT location;\n\tSIZE size;\n\tRECT padding;\n\tUINT sidebarWidth;\n\tHBRUSH hBackgroundBrush;\n\tHTHEME hTheme;\n\tPOINT dpi;\n\tMARGINS extent;\n\tUINT tabOrder;\n\tDWORD bCalcExtent;\n\tSIZE_T section;\n\tDWORD dwStatusbarY;\n\tHICON hIcon;\n\tRECT border_thickness;\n\tUINT GUI_CAPTION_LINE_HEIGHT;\n\tlong long LeftClickTime;\n\tlong long LastClickTime;\n\tHMODULE hExplorerFrame;\n\tvoid* pAccPropServices;\n\tHWND hAccLabel;\n\tBOOL bShouldAnnounceSelected;\n\tWCHAR sectionNames[20][64];\n\tBOOL bRebuildIfTabOrderIsEmpty;\n\tint dwPageLocation;\n\tDWORD last_section;\n} GUI;\n\nstatic BOOL GUI_Build(HDC hDC, HWND hWnd);\n\nstatic LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);\n\n__declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);\n#endif\n"
  },
  {
    "path": "ep_gui/dllmain.cpp",
    "content": "﻿#include <Windows.h>\r\n\r\nextern \"C\"\r\n{\r\n\r\nHMODULE hModule = nullptr;\r\n\r\nBOOL WINAPI DllMain(\r\n    _In_ HINSTANCE hinstDLL,\r\n    _In_ DWORD     fdwReason,\r\n    _In_ LPVOID    lpvReserved\r\n)\r\n{\r\n    switch (fdwReason)\r\n    {\r\n        case DLL_PROCESS_ATTACH:\r\n            DisableThreadLibraryCalls(hinstDLL);\r\n            hModule = hinstDLL;\r\n            break;\r\n        case DLL_THREAD_ATTACH:\r\n            break;\r\n        case DLL_THREAD_DETACH:\r\n            break;\r\n        case DLL_PROCESS_DETACH:\r\n            break;\r\n    }\r\n    return TRUE;\r\n}\r\n\r\n}\r\n"
  },
  {
    "path": "ep_gui/ep_gui.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>17.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{2351a0df-782c-4d74-85b7-0847d245d6b4}</ProjectGuid>\r\n    <RootNamespace>epgui</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup>\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)\\ep_weather_host;$(SolutionDir)\\ep_weather_host\\$(Platform)\\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)'=='Debug'\">\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)'=='Release'\">\r\n    <ClCompile>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <PreprocessorDefinitions>NDEBUG;WINRT_NO_SOURCE_LOCATION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\fmemopen.c\" />\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\getline.c\" />\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\Localization.cpp\" />\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\utility.c\" />\r\n    <ClCompile Include=\"..\\ep_weather_host_stub\\$(Platform)\\$(Configuration)\\ep_weather_host_i.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"GUI.h\" />\r\n    <!--<ClInclude Include=\"GUI2.h\" />-->\r\n    <ClInclude Include=\"pch.h\" />\r\n    <ClInclude Include=\"resources\\EPSettingsResources.h\" />\r\n    <ClInclude Include=\"resources\\EPSharedResources.h\" />\r\n    <ClInclude Include=\"resources\\resource.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"resources\\ep_gui.rc\" />\r\n    <ResourceCompile Include=\"resources\\lang\\ep_gui.*.rc\" />\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher-L10N\\resources\\lang\\ep_gui.*.rc\" Condition=\"Exists('..\\ExplorerPatcher-L10N\\resources\\lang')\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"resources\\settings.reg\" />\r\n    <None Include=\"resources\\settings10.reg\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"dllmain.cpp\" />\r\n    <ClCompile Include=\"GUI.c\" />\r\n    <!--<ClCompile Include=\"GUI2.cpp\">\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n    </ClCompile>-->\r\n    <ClCompile Include=\"pch.cpp\">\r\n      <PrecompiledHeader>Create</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\r\n    <PropertyGroup>\r\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\r\n    </PropertyGroup>\r\n  </Target>\r\n</Project>"
  },
  {
    "path": "ep_gui/pch.cpp",
    "content": "﻿#include \"pch.h\"\r\n"
  },
  {
    "path": "ep_gui/pch.h",
    "content": "﻿#pragma once\r\n"
  },
  {
    "path": "ep_gui/resources/EPSettingsResources.h",
    "content": "﻿#pragma once\r\n\r\n// 1001 - 2200\r\n\r\n#define IDS_TB 1001\r\n#define IDS_TB_STYLE 1002\r\n#define IDS_TB_STYLE_0 1003\r\n#define IDS_TB_STYLE_1 1004\r\n#define IDS_TB_MORE 1005\r\n#define IDS_TB_CUSTOMIZETRAYICONS 1006\r\n#define IDS_TB_CUSTOMIZESYSTEMICONS 1007\r\n#define IDS_TB_PRIMARYTBPOS 1008\r\n#define IDS_TB_POSBOTTOM 1009\r\n#define IDS_TB_POSTOP 1010\r\n#define IDS_TB_POSLEFT 1011\r\n#define IDS_TB_POSRIGHT 1012\r\n#define IDS_TB_SECONDARYTBPOS 1013\r\n#define IDS_TB_EXTRABTN 1014\r\n#define IDS_TB_EXTRABTN_0 1015\r\n#define IDS_TB_EXTRABTN_2 1016\r\n#define IDS_TB_EXTRABTN_1 1017\r\n#define IDS_TB_SEARCHMODE_W11 1018\r\n#define IDS_TB_SEARCHMODE 1019\r\n#define IDS_TB_SEARCHMODE_0 1020\r\n#define IDS_TB_SEARCHMODE_1 1021\r\n#define IDS_TB_SEARCHMODE_2 1022\r\n#define IDS_TB_CORTANABTN 1023\r\n#define IDS_TB_TASKVIEWBTN 1024\r\n#define IDS_TB_WIDGETSBTN 1025\r\n#define IDS_TB_AUTOHIDETB 1026\r\n#define IDS_TB_STARTBTNSTYLE 1027\r\n#define IDS_TB_STARTBTNSTYLE_0 1028\r\n#define IDS_TB_STARTBTNSTYLE_1 1029\r\n#define IDS_TB_PRIMARYTBALIGN 1030\r\n#define IDS_TB_TBALIGN_0 1031\r\n#define IDS_TB_TBALIGN_1 1032\r\n#define IDS_TB_TBALIGN_5 1033\r\n#define IDS_TB_TBALIGN_3 1034\r\n#define IDS_TB_TBALIGN_7 1035\r\n#define IDS_TB_SECONDARYTBALIGN 1036\r\n#define IDS_TB_PRIMARYTBGLOM 1037\r\n#define IDS_TB_GLOM_0_D 1038\r\n#define IDS_TB_GLOM_0 1039\r\n#define IDS_TB_GLOM_1 1040\r\n#define IDS_TB_GLOM_2 1042\r\n#define IDS_TB_SECONDARYTBGLOM 1043\r\n#define IDS_TB_ICONSIZE 1044\r\n#define IDS_TB_ICONSIZE_1 1045\r\n#define IDS_TB_ICONSIZE_0 1046\r\n#define IDS_TB_STYLE_2 1047\r\n#define IDS_TB_ALTIMPL_NOTICE 1048\r\n\r\n#define IDS_TRAY 1101\r\n#define IDS_TRAY_SKINMENUS 1102\r\n#define IDS_TRAY_CENTERMENUS 1103\r\n#define IDS_TRAY_FLYOUTMENUS 1104\r\n#define IDS_TRAY_TOUCHKB 1105\r\n#define IDS_TRAY_SHOWSECONDS 1106\r\n#define IDS_TRAY_CCBTN 1107\r\n#define IDS_TRAY_SHOWDESKTOPBTN 1108\r\n#define IDS_TRAY_SHOWDESKTOPBTN_1 1109\r\n#define IDS_TRAY_SHOWDESKTOPBTN_0 1110\r\n#define IDS_TRAY_SHOWDESKTOPBTN_2 1111\r\n#define IDS_TRAY_SKINICONS 1112\r\n#define IDS_TRAY_REPLACENETWORK_L1 1113\r\n#define IDS_TRAY_REPLACENETWORK_L2 1114\r\n#define IDS_TRAY_REPLACENETWORK_0 1115\r\n#define IDS_TRAY_REPLACENETWORK_1 1116\r\n#define IDS_TRAY_REPLACENETWORK_2 1117\r\n#define IDS_TRAY_SYSICONBEHAVIOR 1118\r\n#define IDS_TRAY_NETWORK 1119\r\n#define IDS_TRAY_NETWORK_6 1120\r\n#define IDS_TRAY_NETWORK_5 1121\r\n#define IDS_TRAY_NETWORK_0 1122\r\n#define IDS_TRAY_NETWORK_2 1123\r\n#define IDS_TRAY_NETWORK_1 1124\r\n#define IDS_TRAY_SOUND 1125\r\n#define IDS_TRAY_SOUND_1 1126\r\n#define IDS_TRAY_SOUND_0 1127\r\n#define IDS_TRAY_CLOCK 1128\r\n#define IDS_TRAY_CLOCK_2 1129\r\n#define IDS_TRAY_CLOCK_0 1130\r\n#define IDS_TRAY_CLOCK_1 1131\r\n#define IDS_TRAY_CLOCK_2_W10 1132\r\n#define IDS_TRAY_BATTERY 1133\r\n#define IDS_TRAY_BATTERY_0 1134\r\n#define IDS_TRAY_BATTERY_1 1135\r\n#define IDS_TRAY_LANGSWITCHER 1136\r\n#define IDS_TRAY_LANGSWITCHER_0 1137\r\n#define IDS_TRAY_LANGSWITCHER_1_21H2 1138\r\n#define IDS_TRAY_LANGSWITCHER_7 1140\r\n#define IDS_TRAY_LANGSWITCHER_1 1141\r\n#define IDS_TRAY_LANGSWITCHER_4 1142\r\n#define IDS_TRAY_OVERFLOWSTYLE 1143\r\n#define IDS_TRAY_OVERFLOWSTYLE_0 1144\r\n#define IDS_TRAY_OVERFLOWSTYLE_1 1145\r\n\r\n#define IDS_EXP 1201\r\n#define IDS_EXP_SHEXT_L1 1202\r\n#define IDS_EXP_SHEXT_L2 1203\r\n#define IDS_EXP_SHEXT_LEARN 1204\r\n#define IDS_EXP_SHEXT_REGISTER 1205\r\n#define IDS_EXP_DISABLECTXMENU 1206\r\n#define IDS_EXP_LEGACYFTDIALOG 1207\r\n#define IDS_EXP_CLASSICDRIVEGROUP 1208\r\n#define IDS_EXP_CTRLINTF 1209\r\n#define IDS_EXP_CTRLINTF_0_W11 1210\r\n#define IDS_EXP_CTRLINTF_3 1211\r\n#define IDS_EXP_CTRLINTF_4 1212\r\n#define IDS_EXP_CTRLINTF_0_W10 1213\r\n#define IDS_EXP_CTRLINTF_1_W11 1214\r\n#define IDS_EXP_CTRLINTF_2 1215\r\n#define IDS_EXP_NEWWINDOWS 1216\r\n#define IDS_EXP_IMMERSIVEMENUS 1217\r\n#define IDS_EXP_DISABLENAVBAR 1218\r\n#define IDS_EXP_DISABLESEARCHBAR 1219\r\n#define IDS_EXP_SHRINKADDRESSBAR 1220\r\n#define IDS_EXP_HIDESEARCHBAR 1221\r\n#define IDS_EXP_TITLEBAR 1222\r\n#define IDS_EXP_TITLEBAR_0 1223\r\n#define IDS_EXP_TITLEBAR_1 1224\r\n#define IDS_EXP_TITLEBAR_2 1225\r\n#define IDS_EXP_TITLEBAR_3 1226\r\n#define IDS_EXP_MICA 1227\r\n\r\n#define IDS_START 1301\r\n#define IDS_START_STYLE 1302\r\n#define IDS_START_STYLE_0 1303\r\n#define IDS_START_STYLE_1 1304\r\n#define IDS_START_MORE 1305\r\n#define IDS_START_POSITION 1306\r\n#define IDS_START_POSITION_0 1307\r\n#define IDS_START_POSITION_1 1308\r\n#define IDS_START_MAXFREQAPPS 1309\r\n#define IDS_START_MAXFREQAPPS_0 1310\r\n#define IDS_START_MAXFREQAPPS_6 1311\r\n#define IDS_START_MAXFREQAPPS_99999 1312\r\n#define IDS_START_MONITOROVERRIDE_L1 1313\r\n#define IDS_START_MONITOROVERRIDE_L2 1314\r\n#define IDS_START_MONITOROVERRIDE_1 1315\r\n#define IDS_START_MONITOROVERRIDE_0 1316\r\n#define IDS_START_MONITOROVERRIDE_2 1317\r\n#define IDS_START_MONITOROVERRIDE_3 1318\r\n#define IDS_START_MONITOROVERRIDE_4 1319\r\n#define IDS_START_MONITOROVERRIDE_5 1320\r\n#define IDS_START_MONITOROVERRIDE_6 1321\r\n#define IDS_START_MONITOROVERRIDE_7 1322\r\n#define IDS_START_MONITOROVERRIDE_8 1323\r\n#define IDS_START_MONITOROVERRIDE_9 1324\r\n#define IDS_START_NORECOMMENDED 1325\r\n#define IDS_START_MAKEALLAPPSDEFAULT 1326\r\n#define IDS_START_SHOWMORETILES 1327\r\n#define IDS_START_CORNERPREF 1328\r\n#define IDS_START_CORNERPREF_1 1329\r\n#define IDS_START_CORNERPREF_2 1330\r\n#define IDS_START_CORNERPREF_0 1331\r\n#define IDS_START_DISPLAYMODE 1332\r\n#define IDS_START_DISPLAYMODE_0 1333\r\n#define IDS_START_DISPLAYMODE_1 1334\r\n#define IDS_START_DISPLAYMODE_2 1335\r\n#define IDS_START_APPLIST 1336\r\n#define IDS_START_APPLIST_0 1337\r\n#define IDS_START_APPLIST_3 1338\r\n#define IDS_START_APPLIST_1 1339\r\n#define IDS_START_NOTICE 1340\r\n#define IDS_START_WIN10_NOTICE 1341\r\n\r\n#define IDS_AT 1401\r\n#define IDS_AT_STYLE 1402\r\n#define IDS_AT_STYLE_0_W11 1403\r\n#define IDS_AT_STYLE_0_W10 1404\r\n#define IDS_AT_STYLE_3 1405\r\n#define IDS_AT_STYLE_1 1406\r\n#define IDS_AT_STYLE_2 1407\r\n#define IDS_AT_SWS_INCLUDEWALLPAPER 1408\r\n#define IDS_AT_SWS_PRIMARYONLY 1409\r\n#define IDS_AT_SWS_PERMONITOR 1410\r\n#define IDS_AT_SWS_GROUPWINDOWS 1411\r\n#define IDS_AT_SWS_NOPERAPP 1412\r\n#define IDS_AT_SWS_THEME 1413\r\n#define IDS_AT_SWS_THEME_0 1414\r\n#define IDS_AT_SWS_THEME_1 1415\r\n#define IDS_AT_SWS_THEME_2 1416\r\n#define IDS_AT_SWS_OPACITY 1417\r\n#define IDS_AT_SWS_OPACITY_100 1418\r\n#define IDS_AT_SWS_OPACITY_95 1419\r\n#define IDS_AT_SWS_COLORSCHEME 1420\r\n#define IDS_AT_SWS_COLORSCHEME_0 1421\r\n#define IDS_AT_SWS_COLORSCHEME_1 1422\r\n#define IDS_AT_SWS_COLORSCHEME_2 1423\r\n#define IDS_AT_SWS_CORNERPREF 1424\r\n#define IDS_AT_SWS_CORNERPREF_2 1425\r\n#define IDS_AT_SWS_CORNERPREF_3 1426\r\n#define IDS_AT_SWS_CORNERPREF_1 1427\r\n#define IDS_AT_SWS_ROWHEIGHT 1428\r\n#define IDS_AT_SWS_ROWHEIGHT_230 1429\r\n#define IDS_AT_SWS_MAXWIDTH 1430\r\n#define IDS_AT_SWS_MAXWIDTH_100 1431\r\n#define IDS_AT_SWS_MAXWIDTH_80 1432\r\n#define IDS_AT_SWS_MAXHEIGHT 1433\r\n#define IDS_AT_SWS_MAXHEIGHT_100 1434\r\n#define IDS_AT_SWS_MAXHEIGHT_80 1435\r\n#define IDS_AT_SWS_PADDING 1436\r\n#define IDS_AT_SWS_PADDING_20 1437\r\n#define IDS_AT_SWS_PADDING_0 1438\r\n#define IDS_AT_SWS_SHOWDELAY 1439\r\n#define IDS_AT_SWS_SHOWDELAY_0 1440\r\n#define IDS_AT_SWS_SHOWDELAY_25 1441\r\n#define IDS_AT_SWS_SHOWDELAY_50 1442\r\n#define IDS_AT_SWS_SHOWDELAY_75 1443\r\n#define IDS_AT_SWS_SHOWDELAY_100 1444\r\n#define IDS_AT_SWS_SHOWDELAY_125 1445\r\n#define IDS_AT_SWS_SHOWDELAY_150 1446\r\n#define IDS_AT_SWS_SHOWDELAY_200 1447\r\n#define IDS_AT_SWS_SHOWDELAY_300 1448\r\n#define IDS_AT_SWS_SHOWDELAY_400 1449\r\n#define IDS_AT_SWS_SHOWDELAY_500 1450\r\n#define IDS_AT_SWS_SCROLLWHEEL 1451\r\n#define IDS_AT_SWS_SCROLLWHEEL_0 1452\r\n#define IDS_AT_SWS_SCROLLWHEEL_1 1453\r\n#define IDS_AT_SWS_SCROLLWHEEL_2 1454\r\n#define IDS_AT_SWS_LEARN 1455\r\n\r\n#define IDS_WEATHER 1501\r\n#define IDS_WEATHER_SHOW 1502\r\n#define IDS_WEATHER_LOC 1503\r\n#define IDS_WEATHER_LOC_PROMPT 1504\r\n#define IDS_WEATHER_LOC_DEFAULT 1505\r\n#define IDS_WEATHER_LAYOUT 1506\r\n#define IDS_WEATHER_LAYOUT_0 1507\r\n#define IDS_WEATHER_LAYOUT_3 1508\r\n#define IDS_WEATHER_LAYOUT_1 1509\r\n#define IDS_WEATHER_LAYOUT_4 1510\r\n#define IDS_WEATHER_LAYOUT_5 1511\r\n#define IDS_WEATHER_SIZE 1512\r\n#define IDS_WEATHER_SIZE_0 1513\r\n#define IDS_WEATHER_SIZE_2 1514\r\n#define IDS_WEATHER_SIZE_1 1515\r\n#define IDS_WEATHER_POSITION 1516\r\n#define IDS_WEATHER_POSITION_0 1517\r\n#define IDS_WEATHER_POSITION_1 1518\r\n#define IDS_WEATHER_UPDATEFREQ 1519\r\n#define IDS_WEATHER_UPDATEFREQ_60 1520\r\n#define IDS_WEATHER_UPDATEFREQ_300 1521\r\n#define IDS_WEATHER_UPDATEFREQ_900 1522\r\n#define IDS_WEATHER_UPDATEFREQ_1200 1523\r\n#define IDS_WEATHER_UPDATEFREQ_1800 1524\r\n#define IDS_WEATHER_UPDATEFREQ_3600 1525\r\n#define IDS_WEATHER_UPDATEFREQ_7200 1526\r\n#define IDS_WEATHER_TEMPUNIT 1527\r\n#define IDS_WEATHER_TEMPUNIT_0 1528\r\n#define IDS_WEATHER_TEMPUNIT_1 1529\r\n#define IDS_WEATHER_LANG 1533\r\n#define IDS_WEATHER_LANG_PROMPT 1534\r\n#define IDS_WEATHER_LANG_DEFAULT 1535\r\n#define IDS_WEATHER_COLORSCHEME 1536\r\n#define IDS_WEATHER_COLORSCHEME_0 1537\r\n#define IDS_WEATHER_COLORSCHEME_1 1538\r\n#define IDS_WEATHER_COLORSCHEME_2 1539\r\n#define IDS_WEATHER_CORNERPREF 1540\r\n#define IDS_WEATHER_CORNERPREF_2 1541\r\n#define IDS_WEATHER_CORNERPREF_3 1542\r\n#define IDS_WEATHER_CORNERPREF_1 1543\r\n#define IDS_WEATHER_ICONPACK 1544\r\n#define IDS_WEATHER_ICONPACK_0 1545\r\n#define IDS_WEATHER_ICONPACK_1 1546\r\n#define IDS_WEATHER_CONTENTSMODE 1547\r\n#define IDS_WEATHER_CONTENTSMODE_0 1548\r\n#define IDS_WEATHER_CONTENTSMODE_1 1549\r\n#define IDS_WEATHER_ZOOM 1550\r\n#define IDS_WEATHER_ZOOM_100 1551\r\n#define IDS_WEATHER_LEARN 1552\r\n#define IDS_WEATHER_LASTUPDATE 1553\r\n#define IDS_WEATHER_UPDATE 1554\r\n#define IDS_WEATHER_CLEAR 1555\r\n#define IDS_WEATHER_CLEAR_PROMPT 1556\r\n#define IDS_WEATHER_CLEAR_WAIT 1557\r\n#define IDS_WEATHER_CLEAR_SUCCESS 1558\r\n#define IDS_WEATHER_CLEAR_FAILED 1559\r\n\r\n#define IDS_SP 1601\r\n#define IDS_SP_HIDEICON 1602\r\n#define IDS_SP_DESKTOPMENU 1603\r\n#define IDS_SP_DESKTOPMENU_0 1604\r\n#define IDS_SP_DESKTOPMENU_32 1605\r\n#define IDS_SP_DESKTOPMENU_48 1606\r\n#define IDS_SP_DESKTOPMENU_288 1607\r\n#define IDS_SP_DESKTOPMENU_800 1608\r\n#define IDS_SP_DESKTOPMENU_304 1609\r\n#define IDS_SP_DESKTOPMENU_816 1610\r\n#define IDS_SP_DESKTOPMENU_1008 1611\r\n#define IDS_SP_UPDATEFREQ 1612\r\n#define IDS_SP_UPDATEFREQ_0 1613\r\n#define IDS_SP_UPDATEFREQ_60 1614\r\n#define IDS_SP_UPDATEFREQ_300 1615\r\n#define IDS_SP_UPDATEFREQ_900 1616\r\n#define IDS_SP_UPDATEFREQ_1200 1617\r\n#define IDS_SP_UPDATEFREQ_1800 1618\r\n#define IDS_SP_UPDATEFREQ_3600 1619\r\n#define IDS_SP_UPDATEFREQ_7200 1620\r\n#define IDS_SP_UPDATEFREQ_21600 1621\r\n#define IDS_SP_UPDATEFREQ_43200 1622\r\n#define IDS_SP_UPDATEFREQ_86400 1623\r\n#define IDS_SP_MOREOPTIONS 1624\r\n\r\n#define IDS_OTHER 1701\r\n#define IDS_OTHER_REMEMBERLAST 1702\r\n#define IDS_OTHER_CLOCKFLYOUT 1703\r\n#define IDS_OTHER_TOOLBARSEPARATORS 1704\r\n#define IDS_OTHER_WINXPROPERTIES 1705\r\n#define IDS_OTHER_DONTUSEPOWERSHELL 1706\r\n#define IDS_OTHER_WINXACCELERATOR 1707\r\n#define IDS_OTHER_DISABLEOFFICE 1708\r\n#define IDS_OTHER_DISABLEWINF 1709\r\n#define IDS_OTHER_DISABLERC 1710\r\n#define IDS_OTHER_DISABLEAEROSNAP 1711\r\n#define IDS_OTHER_SNAPASSISTSTYLE 1712\r\n#define IDS_OTHER_SNAPASSISTSTYLE_0 1713\r\n#define IDS_OTHER_SNAPASSISTSTYLE_3 1714\r\n#define IDS_OTHER_PWRBTNACTION 1715\r\n#define IDS_OTHER_PWRBTNACTION_256 1716\r\n#define IDS_OTHER_PWRBTNACTION_1 1717\r\n#define IDS_OTHER_PWRBTNACTION_16 1718\r\n#define IDS_OTHER_PWRBTNACTION_64 1719\r\n#define IDS_OTHER_PWRBTNACTION_2 1720\r\n#define IDS_OTHER_PWRBTNACTION_4 1721\r\n#define IDS_OTHER_NOREDIRECT 1722\r\n#define IDS_OTHER_NOREDIRECT_SYSTEM 1723\r\n#define IDS_OTHER_NOREDIRECT_PROGRAMS 1724\r\n#define IDS_OTHER_NOREDIRECT_DATETIME 1725\r\n#define IDS_OTHER_NOREDIRECT_TRAYICONS 1726\r\n#define IDS_OTHER_LOGONLOGOFFSHUTDOWNSOUNDS 1727\r\n\r\n#define IDS_UPDATES 1801\r\n#define IDS_UPDATES_POLICY 1802\r\n#define IDS_UPDATES_POLICY_1 1803\r\n#define IDS_UPDATES_POLICY_0 1804\r\n#define IDS_UPDATES_POLICY_2 1805\r\n#define IDS_UPDATES_PREFER_STAGING 1806\r\n#define IDS_UPDATES_DOWNGRADES 1807\r\n#define IDS_UPDATES_UPDATESERVERS 1808\r\n#define IDS_UPDATES_RELEASES 1809\r\n#define IDS_UPDATES_RELEASES_PROMPT 1810\r\n#define IDS_UPDATES_STAGING 1811\r\n#define IDS_UPDATES_STAGING_PROMPT 1812\r\n#define IDS_UPDATES_CHECK 1813\r\n#define IDS_UPDATES_INSTALL 1814\r\n#define IDS_UPDATES_CHANGES 1815\r\n#define IDS_UPDATES_LEARN 1816\r\n#define IDS_UPDATES_USELOCAL 1817\r\n\r\n#define IDS_ADV 1901\r\n#define IDS_ADV_DISCLAIMER 1902\r\n#define IDS_ADV_LEARN 1903\r\n#define IDS_ADV_CONSOLE 1904\r\n#define IDS_ADV_MEMCHECK 1905\r\n#define IDS_ADV_AUTOHIDE 1906\r\n#define IDS_ADV_PAINTDESKTOPVERSION 1907\r\n#define IDS_ADV_CLASSICTHEME 1908\r\n#define IDS_ADV_SYSLISTVIEW32 1909\r\n#define IDS_ADV_NOPROPERTIES 1910\r\n#define IDS_ADV_SYMBOLS 1911\r\n#define IDS_ADV_PINNEDITEMS 1912\r\n#define IDS_ADV_REMOVEEXTRAGAP 1913\r\n#define IDS_ADV_XAMLSOUNDS 1927\r\n\r\n#define IDS_ABOUT 2001\r\n#define IDS_ABOUT_VERSION 2002\r\n#define IDS_ABOUT_PROJECT 2003\r\n#define IDS_ABOUT_AUTHOR 2004\r\n#define IDS_ABOUT_OS 2005\r\n#define IDS_ABOUT_GITHUB 2006\r\n#define IDS_ABOUT_WEBSITE 2007\r\n#define IDS_ABOUT_DONATE 2009\r\n#define IDS_ABOUT_FAQ 2010\r\n#define IDS_ABOUT_SETTINGS 2011\r\n#define IDS_ABOUT_IMPORT 2012\r\n#define IDS_ABOUT_EXPORT 2013\r\n#define IDS_ABOUT_EXPORT_SUCCESS 2014\r\n#define IDS_ABOUT_RESET 2015\r\n\r\n#define IDS_UNINSTALL 2101\r\n#define IDS_UNINSTALL_UNINSTALL 2102\r\n\r\n#define IDS_FOOTER_RESTART 2201\r\n\r\n#define IDS_MAINTENANCE 2301\r\n"
  },
  {
    "path": "ep_gui/resources/EPSharedResources.h",
    "content": "﻿#pragma once\r\n\r\n// 301-350\r\n\r\n#define IDS_UPDATES_CHECKING_T 301\r\n#define IDS_UPDATES_AVAILABLE_T 302\r\n#define IDS_UPDATES_AVAILABLE_T_U 303\r\n#define IDS_UPDATES_AVAILABLE_B 304\r\n#define IDS_UPDATES_ISLATEST_T 305\r\n#define IDS_UPDATES_ISLATEST_B 306\r\n#define IDS_UPDATES_CHECKFAILED_T 307\r\n#define IDS_UPDATES_CHECKFAILED_B 308\r\n#define IDS_UPDATES_DOWNLOADING_T 309\r\n#define IDS_UPDATES_SUCCESS_T 310\r\n#define IDS_UPDATES_DLFAILED_T 311\r\n#define IDS_UPDATES_DLFAILED_B 312\r\n#define IDS_UPDATES_INSTALLEDVER 313\r\n#define IDS_UPDATES_PROMPT 314\r\n#define IDS_UPDATES_AVAILABLE_A 315\r\n#define IDS_UPDATES_DOWNLOADING_0 316\r\n\r\n// 351-400\r\n\r\n#define IDS_SYM_DL_T 351\r\n#define IDS_SYM_DL_B 352\r\n#define IDS_SYM_SUCCESS_T 353\r\n#define IDS_SYM_SUCCESS_B 354\r\n#define IDS_SYM_FAILEDSOME_T 355\r\n#define IDS_SYM_FAILEDSOME_B 356\r\n#define IDS_SYM_FAILEDALL_T 357\r\n#define IDS_SYM_FAILEDALL_B 358\r\n\r\n// 401-500\r\n\r\n#define IDS_CRASH_TITLE 401\r\n#define IDS_CRASH_BODY 402\r\n#define IDS_CRASH_ONCE 403\r\n#define IDS_CRASH_MULTIPLE 404\r\n#define IDS_CRASH_DISMISS 405\r\n"
  },
  {
    "path": "ep_gui/resources/ep_gui.rc",
    "content": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 2 resource.\r\n//\r\n#include \"winres.h\"\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#undef APSTUDIO_READONLY_SYMBOLS\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n// English (United States) resources\r\n\r\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n#pragma code_page(1252)\r\n\r\n#ifdef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// TEXTINCLUDE\r\n//\r\n\r\n1 TEXTINCLUDE \r\nBEGIN\r\n    \"resource.h\\0\"\r\nEND\r\n\r\n2 TEXTINCLUDE \r\nBEGIN\r\n    \"#include \"\"winres.h\"\"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n3 TEXTINCLUDE \r\nBEGIN\r\n    \"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n#endif    // APSTUDIO_INVOKED\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Version\r\n//\r\n#include \"..\\version.h\"\r\n\r\nVS_VERSION_INFO VERSIONINFO\r\n FILEVERSION VER_FILE\r\n PRODUCTVERSION VER_PRODUCT\r\n FILEFLAGSMASK 0x3fL\r\n#ifdef _DEBUG\r\n FILEFLAGS 0x1L\r\n#else\r\n FILEFLAGS 0x0L\r\n#endif\r\n FILEOS 0x40004L\r\n FILETYPE 0x1L\r\n FILESUBTYPE 0x0L\r\nBEGIN\r\n    BLOCK \"StringFileInfo\"\r\n    BEGIN\r\n        BLOCK \"040904b0\"\r\n        BEGIN\r\n            VALUE \"CompanyName\", \"VALINET Solutions SRL\"\r\n            VALUE \"FileDescription\", \"ExplorerPatcher Settings\"\r\n            VER_FILE_STRING\r\n            VALUE \"InternalName\", \"ep_gui.dll\"\r\n            VALUE \"LegalCopyright\", \"Copyright (C) 2006-2025 VALINET Solutions SRL. All rights reserved.\"\r\n            VALUE \"OriginalFilename\", \"ep_gui.dll\"\r\n            VALUE \"ProductName\", \"ExplorerPatcher\"\r\n            VER_PRODUCT_STRING\r\n        END\r\n    END\r\n    BLOCK \"VarFileInfo\"\r\n    BEGIN\r\n        VALUE \"Translation\", 0x409, 1200\r\n    END\r\nEND\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// RCDATA\r\n//\r\n\r\nIDR_REGISTRY1           RCDATA                  \"resources\\settings.reg\"\r\nIDR_REGISTRY2           RCDATA                  \"resources\\settings10.reg\"\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// String Table\r\n//\r\n\r\nSTRINGTABLE\r\nBEGIN\r\n    IDS_PRODUCTNAME         \"ExplorerPatcher\"\r\nEND\r\n\r\n#endif    // English (United States) resources\r\n/////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n\r\n#ifndef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 3 resource.\r\n//\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#endif    // not APSTUDIO_INVOKED\r\n\r\n"
  },
  {
    "path": "ep_gui/resources/lang/ep_gui.en-US.rc",
    "content": "﻿#include \"resources/resource.h\"\r\n#include \"winres.h\"\r\n\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n\r\nSTRINGTABLE\r\nBEGIN\r\n    IDS_UPDATES_CHECKING_T      \"Checking for updates…\"\r\n    IDS_UPDATES_AVAILABLE_T     \"Version %d.%d.%d.%d is available\"\r\n    IDS_UPDATES_AVAILABLE_T_U   \"New version available\"\r\n    IDS_UPDATES_AVAILABLE_B     \"Click here to learn more about this update.\"\r\n    IDS_UPDATES_AVAILABLE_A     \"Update now\"\r\n    IDS_UPDATES_ISLATEST_T      \"No updates are available\"\r\n    IDS_UPDATES_ISLATEST_B      \"Please check back later.\"\r\n    IDS_UPDATES_CHECKFAILED_T   \"Unable to check for updates\"\r\n    IDS_UPDATES_CHECKFAILED_B   \"Make sure that you are connected to the Internet and that the remote server is online.\"\r\n    IDS_UPDATES_DOWNLOADING_T   \"Downloading and installing updates…\"\r\n    IDS_UPDATES_DOWNLOADING_0   \"Preparing…\"\r\n    IDS_UPDATES_SUCCESS_T       \"Update successful\"\r\n    IDS_UPDATES_DLFAILED_T      \"Update failed\"\r\n    IDS_UPDATES_DLFAILED_B      \"The user has cancelled the process or an error has occured when attempting to install this update.\"\r\n    IDS_UPDATES_INSTALLEDVER    \"Installed version: %d.%d.%d.%d\"\r\n    IDS_UPDATES_PROMPT          \"Would you like to install an update for ExplorerPatcher?\\n\\nDownloaded from:\\n%s\"\r\n\r\n    IDS_SYM_DL_T                \"Downloading symbols for OS build %s, please wait…\"\r\n    IDS_SYM_DL_B                \"This may take several minutes. For now, ExplorerPatcher may have limited and/or broken functionality. Click here to learn more about symbols.\"\r\n    IDS_SYM_SUCCESS_T           \"Successfully downloaded symbols for OS build %s\"\r\n    IDS_SYM_SUCCESS_B           \"Please restart File Explorer to restore proper functionality.\"\r\n    IDS_SYM_FAILEDSOME_T        \"Downloaded some symbols for OS build %s\"\r\n    IDS_SYM_FAILEDSOME_B        \"Some other symbols could not be downloaded. This may be due to the current OS build being too recent or the Internet connection being unstable.\"\r\n    IDS_SYM_FAILEDALL_T         \"Failed to download symbols for OS build %s\"\r\n    IDS_SYM_FAILEDALL_B         \"No symbols could be downloaded for this build. This may be due to the current OS build being too recent or the Internet connection being unavailable or unstable.\"\r\n\r\n    IDS_CRASH_TITLE             \"Unfortunately, File Explorer is crashing :(\"\r\n    IDS_CRASH_BODY              \"It seems that File Explorer closed unexpectedly %1$s in less than %2$d seconds each time when starting up. This might indicate a problem caused by ExplorerPatcher, which might be unaware of recent changes in Windows, for example when running on a new OS build.\\nHere are a few recommendations:\\n• If an updated version is available, you can <A HREF=\"\"%3$s\"\">update ExplorerPatcher and restart File Explorer</A>.\\n• On GitHub, you can <A HREF=\"\"%4$s\"\">view releases</A>, <A HREF=\"\"%5$s\"\">check the current status</A>, <A HREF=\"\"%6$s\"\">discuss</A> or <A HREF=\"\"%7$s\"\">review the latest issues</A>.\\n• If you suspect this is not caused by ExplorerPatcher, please uninstall any recently installed shell extensions or similar utilities.\\n• If no fix is available for the time being, you can <A HREF=\"\"%8$s\"\">uninstall ExplorerPatcher</A>, and then later reinstall it when a fix is published on GitHub. Rest assured, even if you uninstall, your program configuration will be preserved.\\n\\nI am sorry for the inconvenience this might cause; I am doing my best to try to keep this program updated and working.\\n\\nExplorerPatcher is disabled until the next File Explorer restart, in order to allow you to perform maintenance tasks and take the necessary actions.\"\r\n    IDS_CRASH_ONCE              \"once\"\r\n    IDS_CRASH_MULTIPLE          \"%d times\"\r\n    IDS_CRASH_DISMISS           \"Dismiss\"\r\n\r\n    IDS_TB                      \"Taskbar\"\r\n\r\n    IDS_TB_STYLE                \"Taskbar style\"\r\n    IDS_TB_STYLE_0              \"Windows 11 (default)\"\r\n    IDS_TB_STYLE_1              \"Windows 10\"\r\n    IDS_TB_STYLE_2              \"Windows 10 (ExplorerPatcher)\"\r\n    IDS_TB_MORE                 \"More taskbar options in the Settings app\"\r\n    IDS_TB_CUSTOMIZETRAYICONS   \"Customize notification area icons\"\r\n    IDS_TB_CUSTOMIZESYSTEMICONS \"Customize system icons in the notification area\"\r\n    IDS_TB_PRIMARYTBPOS         \"Primary taskbar location on screen\"\r\n    IDS_TB_POSBOTTOM            \"Bottom (default)\"\r\n    IDS_TB_POSTOP               \"Top\"\r\n    IDS_TB_POSLEFT              \"Left\"\r\n    IDS_TB_POSRIGHT             \"Right\"\r\n    IDS_TB_SECONDARYTBPOS       \"Secondary taskbar(s) location on screen\"\r\n    IDS_TB_EXTRABTN             \"Extra button should be\"\r\n    IDS_TB_EXTRABTN_0           \"Hidden (default)\"\r\n    IDS_TB_EXTRABTN_2           \"Shown and open Cortana\"\r\n    IDS_TB_EXTRABTN_1           \"Shown and open Widgets\"\r\n    IDS_TB_SEARCHMODE_W11       \"Show Search button\"\r\n    IDS_TB_SEARCHMODE           \"Search\"\r\n    IDS_TB_SEARCHMODE_0         \"Hidden\"\r\n    IDS_TB_SEARCHMODE_1         \"Show search icon\"\r\n    IDS_TB_SEARCHMODE_2         \"Show search box\"\r\n    IDS_TB_CORTANABTN           \"Show Cortana button\"\r\n    IDS_TB_TASKVIEWBTN          \"Show Task view button\"\r\n    IDS_TB_WIDGETSBTN           \"Show Widgets button\"\r\n    IDS_TB_AUTOHIDETB           \"Automatically hide the taskbar\"\r\n    IDS_TB_STARTBTNSTYLE        \"Start button style\"\r\n    IDS_TB_STARTBTNSTYLE_0      \"Windows 10 (default)\"\r\n    IDS_TB_STARTBTNSTYLE_1      \"Windows 11\"\r\n    IDS_TB_PRIMARYTBALIGN       \"Primary taskbar alignment\"\r\n    IDS_TB_TBALIGN_0            \"At screen edge (default)\"\r\n    IDS_TB_TBALIGN_1            \"Centered\"\r\n    IDS_TB_TBALIGN_5            \"Centered, at screen edge when full\"\r\n    IDS_TB_TBALIGN_3            \"Centered with Start button\"\r\n    IDS_TB_TBALIGN_7            \"Centered with Start button, at screen edge when full\"\r\n    IDS_TB_SECONDARYTBALIGN     \"Secondary taskbar(s) alignment\"\r\n    IDS_TB_PRIMARYTBGLOM        \"Combine taskbar icons on primary taskbar\"\r\n    IDS_TB_GLOM_0_D             \"Always combine (default)\"\r\n    IDS_TB_GLOM_0               \"Always combine\"\r\n    IDS_TB_GLOM_1               \"Combine when taskbar is full\"\r\n    IDS_TB_GLOM_2               \"Never combine\"\r\n    IDS_TB_SECONDARYTBGLOM      \"Combine taskbar icons on secondary taskbar(s)\"\r\n    IDS_TB_ICONSIZE             \"Taskbar icon size\"\r\n    IDS_TB_ICONSIZE_1           \"Small\"\r\n    IDS_TB_ICONSIZE_0           \"Large (default)\"\r\n    IDS_TB_ALTIMPL_NOTICE       \"Important notice regarding ExplorerPatcher's taskbar implementation (online)\"\r\n\r\n    IDS_TRAY                    \"System tray\"\r\n\r\n    IDS_TRAY_SKINMENUS          \"Skin taskbar and tray pop-up menus\"\r\n    IDS_TRAY_CENTERMENUS        \"Center tray icon pop-up menus\"\r\n    IDS_TRAY_FLYOUTMENUS        \"Flyout behavior for tray icon pop-up menus\"\r\n    IDS_TRAY_TOUCHKB            \"Show touch keyboard button\"\r\n    IDS_TRAY_SHOWSECONDS        \"Show seconds in the clock\"\r\n    IDS_TRAY_CCBTN              \"Control Center button\"\r\n    IDS_TRAY_SHOWDESKTOPBTN     \"Show desktop button\"\r\n    IDS_TRAY_SHOWDESKTOPBTN_1   \"Enabled (default)\"\r\n    IDS_TRAY_SHOWDESKTOPBTN_0   \"Disabled\"\r\n    IDS_TRAY_SHOWDESKTOPBTN_2   \"Hidden\"\r\n    IDS_TRAY_SKINICONS          \"Apply Windows 11 style to system tray icons\"\r\n    IDS_TRAY_OVERFLOWSTYLE      \"Hidden icons popup style\"\r\n    IDS_TRAY_OVERFLOWSTYLE_0    \"Windows 10 (default)\"\r\n    IDS_TRAY_OVERFLOWSTYLE_1    \"Windows 11\"\r\n    IDS_TRAY_REPLACENETWORK_L1  \"Choosing 'Open Network && Internet settings' when right clicking the\"\r\n    IDS_TRAY_REPLACENETWORK_L2  \"network icon should open\"\r\n    IDS_TRAY_REPLACENETWORK_0   \"Network section in the Settings app (default)\"\r\n    IDS_TRAY_REPLACENETWORK_1   \"Network and Sharing Center in Control Panel\"\r\n    IDS_TRAY_REPLACENETWORK_2   \"Network Connections in Control Panel\"\r\n    IDS_TRAY_SYSICONBEHAVIOR    \"When clicking a system icon in the system tray, open:\"\r\n    IDS_TRAY_NETWORK            \"Network\"\r\n    IDS_TRAY_NETWORK_6          \"Control Center\"\r\n    IDS_TRAY_NETWORK_5          \"Windows 11 WiFi flyout\"\r\n    IDS_TRAY_NETWORK_0          \"Windows 10 flyout (default)\"\r\n    IDS_TRAY_NETWORK_2          \"Windows 8 flyout\"\r\n    IDS_TRAY_NETWORK_1          \"Network section in the Settings app\"\r\n    IDS_TRAY_SOUND              \"Sound\"\r\n    IDS_TRAY_SOUND_1            \"Windows 10 flyout (default)\"\r\n    IDS_TRAY_SOUND_0            \"Windows 7 flyout\"\r\n    IDS_TRAY_CLOCK              \"Clock\"\r\n    IDS_TRAY_CLOCK_2            \"Windows 11 flyout\"\r\n    IDS_TRAY_CLOCK_0            \"Windows 10 flyout (default)\"\r\n    IDS_TRAY_CLOCK_1            \"Windows 7\"\r\n    IDS_TRAY_CLOCK_2_W10        \"Action Center\"\r\n    IDS_TRAY_BATTERY            \"Battery\"\r\n    IDS_TRAY_BATTERY_0          \"Windows 10 flyout (default)\"\r\n    IDS_TRAY_BATTERY_1          \"Windows 7\"\r\n    IDS_TRAY_LANGSWITCHER       \"Language switcher\"\r\n    IDS_TRAY_LANGSWITCHER_0     \"Windows 11 (default)\"\r\n    IDS_TRAY_LANGSWITCHER_1_21H2 \"Windows 10 (with link to \"\"Language Preferences\"\")\"\r\n    IDS_TRAY_LANGSWITCHER_7     \"Windows 10\"\r\n    IDS_TRAY_LANGSWITCHER_1     \"Windows 10 (with link to \"\"Language Preferences\"\") (no animation)\"\r\n    IDS_TRAY_LANGSWITCHER_4     \"Windows 10 (no animation)\"\r\n\r\n    IDS_EXP                     \"File Explorer\"\r\n\r\n    IDS_EXP_SHEXT_L1            \"For the settings marked with (**) to work in Open or Save file dialogs as well, register\"\r\n    IDS_EXP_SHEXT_L2            \"this utility as shell extension using the option below.\"\r\n    IDS_EXP_SHEXT_LEARN         \"Learn more\"\r\n    IDS_EXP_SHEXT_REGISTER      \"Register as shell extension\"\r\n    IDS_EXP_DISABLECTXMENU      \"Disable the Windows 11 context menu\"\r\n    IDS_EXP_LEGACYFTDIALOG      \"Always use legacy file transfer dialog\"\r\n    IDS_EXP_CLASSICDRIVEGROUP   \"Use classic drive groupings in This PC\"\r\n    IDS_EXP_CTRLINTF            \"Control Interface\"\r\n    IDS_EXP_CTRLINTF_0_W11      \"Windows 11 Command Bar (default)\"\r\n    IDS_EXP_CTRLINTF_0_W10      \"Windows 10 Ribbon (default)\"\r\n    IDS_EXP_CTRLINTF_1_W11      \"Windows 10 Ribbon\"\r\n    IDS_EXP_CTRLINTF_2          \"Windows 7 Command Bar\"\r\n    IDS_EXP_CTRLINTF_3          \"Windows 11 Command Bar (no Tabs, classic Address Bar)\"\r\n    IDS_EXP_CTRLINTF_4          \"Windows 11 Command Bar (classic Address Bar)\"\r\n    IDS_EXP_NEWWINDOWS          \"The following settings take effect on newly created File Explorer windows:\"\r\n    IDS_EXP_IMMERSIVEMENUS      \"Use immersive menus when displaying Windows 10 context menus\"\r\n    IDS_EXP_DISABLENAVBAR       \"Disable navigation bar\"\r\n    IDS_EXP_DISABLESEARCHBAR    \"Disable modern search bar\"\r\n    IDS_EXP_SHRINKADDRESSBAR    \"Shrink address bar height\"\r\n    IDS_EXP_HIDESEARCHBAR       \"Hide search bar completely\"\r\n    IDS_EXP_TITLEBAR            \"Title bar\"\r\n    IDS_EXP_TITLEBAR_0          \"Show icon and title (default)\"\r\n    IDS_EXP_TITLEBAR_1          \"Hide title, show icon\"\r\n    IDS_EXP_TITLEBAR_2          \"Hide icon, show title\"\r\n    IDS_EXP_TITLEBAR_3          \"Hide icon and title\"\r\n    IDS_EXP_MICA                \"Apply Mica effect to the navigation bar of Windows 7 Explorer windows\"\r\n\r\n    IDS_START                   \"Start menu\"\r\n\r\n    IDS_START_STYLE             \"Start menu style\"\r\n    IDS_START_STYLE_0           \"Windows 11 (default)\"\r\n    IDS_START_STYLE_1           \"Windows 10\"\r\n    IDS_START_MORE              \"More Start menu options in the Settings app\"\r\n    IDS_START_POSITION          \"Position on screen\"\r\n    IDS_START_POSITION_0        \"At screen edge\"\r\n    IDS_START_POSITION_1        \"Center (default)\"\r\n    IDS_START_MAXFREQAPPS       \"Maximum number of frequent apps to show\"\r\n    IDS_START_MAXFREQAPPS_0     \"None\"\r\n    IDS_START_MAXFREQAPPS_6     \"6 (default)\"\r\n    IDS_START_MAXFREQAPPS_99999 \"Unlimited\"\r\n    IDS_START_MONITOROVERRIDE_L1 \"When using multiple displays, open Start on this monitor when invoked using\"\r\n    IDS_START_MONITOROVERRIDE_L2 \"the keyboard\"\r\n    IDS_START_MONITOROVERRIDE_1 \"Primary monitor (default)\"\r\n    IDS_START_MONITOROVERRIDE_0 \"Monitor on which the cursor is on\"\r\n    IDS_START_MONITOROVERRIDE_2 \"Monitor #2\"\r\n    IDS_START_MONITOROVERRIDE_3 \"Monitor #3\"\r\n    IDS_START_MONITOROVERRIDE_4 \"Monitor #4\"\r\n    IDS_START_MONITOROVERRIDE_5 \"Monitor #5\"\r\n    IDS_START_MONITOROVERRIDE_6 \"Monitor #6\"\r\n    IDS_START_MONITOROVERRIDE_7 \"Monitor #7\"\r\n    IDS_START_MONITOROVERRIDE_8 \"Monitor #8\"\r\n    IDS_START_MONITOROVERRIDE_9 \"Monitor #9\"\r\n    IDS_START_NORECOMMENDED     \"Disable the \"\"Recommended\"\" section\"\r\n    IDS_START_MAKEALLAPPSDEFAULT \"Open Start in All apps by default\"\r\n    IDS_START_SHOWMORETILES     \"Show more tiles\"\r\n    IDS_START_CORNERPREF        \"Corner preference\"\r\n    IDS_START_CORNERPREF_1      \"Rounded corners, floating menu\"\r\n    IDS_START_CORNERPREF_2      \"Rounded corners, docked menu\"\r\n    IDS_START_CORNERPREF_0      \"Not rounded\"\r\n    IDS_START_DISPLAYMODE       \"Display mode\"\r\n    IDS_START_DISPLAYMODE_0     \"Default\"\r\n    IDS_START_DISPLAYMODE_1     \"Start menu\"\r\n    IDS_START_DISPLAYMODE_2     \"Full screen Start\"\r\n    IDS_START_APPLIST           \"App list\"\r\n    IDS_START_APPLIST_0         \"Display\"\r\n    IDS_START_APPLIST_3         \"Hide\"\r\n    IDS_START_APPLIST_1         \"Disable\"\r\n    IDS_START_NOTICE            \"IMPORTANT, MUST READ: Notice regarding this feature (online)\"\r\n    IDS_START_WIN10_NOTICE      \"Some settings might not be available in older Windows 10 versions.\"\r\n\r\n    IDS_AT                      \"Window switcher\"\r\n\r\n    IDS_AT_STYLE                \"Window switcher (Alt+Tab) style\"\r\n    IDS_AT_STYLE_0_W11          \"Windows 11 (default)\"\r\n    IDS_AT_STYLE_0_W10          \"Windows 10 (default)\"\r\n    IDS_AT_STYLE_3              \"Windows 10\"\r\n    IDS_AT_STYLE_1              \"Windows NT\"\r\n    IDS_AT_STYLE_2              \"Simple Window Switcher\"\r\n    IDS_AT_SWS_INCLUDEWALLPAPER \"Show the desktop as the last window in the interaction list\"\r\n    IDS_AT_SWS_PRIMARYONLY      \"Always display switcher on primary monitor\"\r\n    IDS_AT_SWS_PERMONITOR       \"Display windows only from the monitor containing the cursor\"\r\n    IDS_AT_SWS_GROUPWINDOWS     \"Group windows of the same app\"\r\n    IDS_AT_SWS_NOPERAPP         \"Disable the interaction list for individual apps ( Alt + %c )\"\r\n    IDS_AT_SWS_THEME            \"Theme\"\r\n    IDS_AT_SWS_THEME_0          \"Default\"\r\n    IDS_AT_SWS_THEME_1          \"Acrylic\"\r\n    IDS_AT_SWS_THEME_2          \"Mica (always opaque)\"\r\n    IDS_AT_SWS_OPACITY          \"Opacity\"\r\n    IDS_AT_SWS_OPACITY_100      \"Opaque\"\r\n    IDS_AT_SWS_OPACITY_95       \"95 % (default)\"\r\n    IDS_AT_SWS_COLORSCHEME      \"Color scheme\"\r\n    IDS_AT_SWS_COLORSCHEME_0    \"Follow system setting (default)\"\r\n    IDS_AT_SWS_COLORSCHEME_1    \"Light\"\r\n    IDS_AT_SWS_COLORSCHEME_2    \"Dark\"\r\n    IDS_AT_SWS_CORNERPREF       \"Corner preference\"\r\n    IDS_AT_SWS_CORNERPREF_2     \"Rounded (default)\"\r\n    IDS_AT_SWS_CORNERPREF_3     \"Small rounded\"\r\n    IDS_AT_SWS_CORNERPREF_1     \"Not rounded\"\r\n    IDS_AT_SWS_ROWHEIGHT        \"Row height\"\r\n    IDS_AT_SWS_ROWHEIGHT_230    \"230 pt (default)\"\r\n    IDS_AT_SWS_MAXWIDTH         \"Maximum width (percentage of screen width)\"\r\n    IDS_AT_SWS_MAXWIDTH_100     \"100 % (not recommended)\"\r\n    IDS_AT_SWS_MAXWIDTH_80      \"80 % (default)\"\r\n    IDS_AT_SWS_MAXHEIGHT        \"Maximum height (percentage of screen height)\"\r\n    IDS_AT_SWS_MAXHEIGHT_100    \"100 % (not recommended)\"\r\n    IDS_AT_SWS_MAXHEIGHT_80     \"80 % (default)\"\r\n    IDS_AT_SWS_PADDING          \"Window padding\"\r\n    IDS_AT_SWS_PADDING_20       \"20 pt (default)\"\r\n    IDS_AT_SWS_PADDING_0        \"None\"\r\n    IDS_AT_SWS_SHOWDELAY        \"Show delay\"\r\n    IDS_AT_SWS_SHOWDELAY_0      \"None\"\r\n    IDS_AT_SWS_SHOWDELAY_25     \"25 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_50     \"50 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_75     \"75 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_100    \"100 ms (default)\"\r\n    IDS_AT_SWS_SHOWDELAY_125    \"125 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_150    \"150 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_200    \"200 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_300    \"300 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_400    \"400 ms\"\r\n    IDS_AT_SWS_SHOWDELAY_500    \"500 ms\"\r\n    IDS_AT_SWS_SCROLLWHEEL      \"Use the scroll wheel to change selection\"\r\n    IDS_AT_SWS_SCROLLWHEEL_0    \"Never (default)\"\r\n    IDS_AT_SWS_SCROLLWHEEL_1    \"When cursor is over the switcher\"\r\n    IDS_AT_SWS_SCROLLWHEEL_2    \"Always\"\r\n    IDS_AT_SWS_LEARN            \"Learn more about Simple Window Switcher\"\r\n\r\n    IDS_WEATHER                 \"Weather\"\r\n\r\n    IDS_WEATHER_SHOW            \"Show Weather on the taskbar\"\r\n    IDS_WEATHER_LOC             \"Location\"\r\n    IDS_WEATHER_LOC_PROMPT      \"Search City or Zip Code; the program looks up \"\"weather in /* what you typed */\"\" on Google. Leave blank for the default value (current location).\"\r\n    IDS_WEATHER_LOC_DEFAULT     \"Current location (default)\"\r\n    IDS_WEATHER_LAYOUT          \"Layout\"\r\n    IDS_WEATHER_LAYOUT_0        \"Icon and description (default)\"\r\n    IDS_WEATHER_LAYOUT_3        \"Icon and temperature\"\r\n    IDS_WEATHER_LAYOUT_1        \"Icon only\"\r\n    IDS_WEATHER_LAYOUT_4        \"Temperature only\"\r\n    IDS_WEATHER_LAYOUT_5        \"Temperature and description\"\r\n    IDS_WEATHER_SIZE            \"Widget size\"\r\n    IDS_WEATHER_SIZE_0          \"Automatic (fit contents) (default)\"\r\n    IDS_WEATHER_SIZE_2          \"Automatic (fit contents) with threshold\"\r\n    IDS_WEATHER_SIZE_1          \"Fixed\"\r\n    IDS_WEATHER_POSITION        \"Widget position\"\r\n    IDS_WEATHER_POSITION_0      \"Right / bottom (default)\"\r\n    IDS_WEATHER_POSITION_1      \"Left / top\"\r\n    IDS_WEATHER_UPDATEFREQ      \"Update frequency\"\r\n    IDS_WEATHER_UPDATEFREQ_60   \"Every minute\"\r\n    IDS_WEATHER_UPDATEFREQ_300  \"Every 5 minutes\"\r\n    IDS_WEATHER_UPDATEFREQ_900  \"Every 15 minutes\"\r\n    IDS_WEATHER_UPDATEFREQ_1200 \"Every 20 minutes (default)\"\r\n    IDS_WEATHER_UPDATEFREQ_1800 \"Every half an hour\"\r\n    IDS_WEATHER_UPDATEFREQ_3600 \"Every hour\"\r\n    IDS_WEATHER_UPDATEFREQ_7200 \"Every couple of hours\"\r\n    IDS_WEATHER_TEMPUNIT        \"Temperature unit\"\r\n    IDS_WEATHER_TEMPUNIT_0      \"Celsius (default)\"\r\n    IDS_WEATHER_TEMPUNIT_1      \"Fahrenheit\"\r\n    IDS_WEATHER_LANG            \"Language\"\r\n    IDS_WEATHER_LANG_PROMPT     \"Type the short code for the language you'd like the weather data to be displayed in. For example, try \"\"en\"\", \"\"ro\"\", \"\"de\"\", \"\"fr\"\" etc. Leave blank for the default value (language of the Windows OS).\"\r\n    IDS_WEATHER_LANG_DEFAULT    \"System language (default)\"\r\n    IDS_WEATHER_COLORSCHEME     \"Color scheme\"\r\n    IDS_WEATHER_COLORSCHEME_0   \"Follow system setting (default)\"\r\n    IDS_WEATHER_COLORSCHEME_1   \"Light\"\r\n    IDS_WEATHER_COLORSCHEME_2   \"Dark\"\r\n    IDS_WEATHER_CORNERPREF      \"Corner preference\"\r\n    IDS_WEATHER_CORNERPREF_2    \"Rounded (default)\"\r\n    IDS_WEATHER_CORNERPREF_3    \"Small rounded\"\r\n    IDS_WEATHER_CORNERPREF_1    \"Not rounded\"\r\n    IDS_WEATHER_ICONPACK        \"Icon pack\"\r\n    IDS_WEATHER_ICONPACK_0      \"Microsoft (default)\"\r\n    IDS_WEATHER_ICONPACK_1      \"Google\"\r\n    IDS_WEATHER_CONTENTSMODE    \"Display widget contents\"\r\n    IDS_WEATHER_CONTENTSMODE_0  \"On a single line (default)\"\r\n    IDS_WEATHER_CONTENTSMODE_1  \"On 2 lines, if possible\"\r\n    IDS_WEATHER_ZOOM            \"Zoom\"\r\n    IDS_WEATHER_ZOOM_100        \"100 % (default)\"\r\n    IDS_WEATHER_LEARN           \"Learn more about the Weather taskbar widget\"\r\n    IDS_WEATHER_LASTUPDATE      \"Last updated on: %s, %s.\"\r\n    IDS_WEATHER_UPDATE          \"Update weather now\"\r\n    IDS_WEATHER_CLEAR           \"Clear weather widget local data\"\r\n    IDS_WEATHER_CLEAR_PROMPT    \"Are you sure you want to permanently clear the weather widget's local data?\\n\\nThis will reset the internal components to their default state, but will preserve your preferences. This may fix the widget not loading the data properly, or having layout issues etc.\"\r\n    IDS_WEATHER_CLEAR_WAIT      \"Please wait…\"\r\n    IDS_WEATHER_CLEAR_SUCCESS   \"Weather widget data cleared successfully.\"\r\n    IDS_WEATHER_CLEAR_FAILED    \"An error has occured while clearing the data.\"\r\n\r\n    IDS_SP                      \"Spotlight\"\r\n\r\n    IDS_SP_HIDEICON             \"Hide the \"\"Learn about this picture\"\" icon\"\r\n    IDS_SP_DESKTOPMENU          \"Desktop context menu items\"\r\n    IDS_SP_DESKTOPMENU_0        \"No items\"\r\n    IDS_SP_DESKTOPMENU_32       \"Switch to the next picture\"\r\n    IDS_SP_DESKTOPMENU_48       \"Learn about and switch to next picture\"\r\n    IDS_SP_DESKTOPMENU_288      \"Info and switch to next picture\"\r\n    IDS_SP_DESKTOPMENU_800      \"Info, copyright, and switch to next picture\"\r\n    IDS_SP_DESKTOPMENU_304      \"Info, learn about, and switch to next picture\"\r\n    IDS_SP_DESKTOPMENU_816      \"Info, copyright, learn about, and switch to next picture\"\r\n    IDS_SP_DESKTOPMENU_1008     \"All items\"\r\n    IDS_SP_UPDATEFREQ           \"Update frequency\"\r\n    IDS_SP_UPDATEFREQ_0         \"Let Windows decide the best schedule (default)\"\r\n    IDS_SP_UPDATEFREQ_60        \"Every minute\"\r\n    IDS_SP_UPDATEFREQ_300       \"Every 5 minutes\"\r\n    IDS_SP_UPDATEFREQ_900       \"Every 15 minutes\"\r\n    IDS_SP_UPDATEFREQ_1200      \"Every 20 minutes\"\r\n    IDS_SP_UPDATEFREQ_1800      \"Every half an hour\"\r\n    IDS_SP_UPDATEFREQ_3600      \"Every hour\"\r\n    IDS_SP_UPDATEFREQ_7200      \"Every couple of hours\"\r\n    IDS_SP_UPDATEFREQ_21600     \"Every 6 hours\"\r\n    IDS_SP_UPDATEFREQ_43200     \"Every 12 hours\"\r\n    IDS_SP_UPDATEFREQ_86400     \"Once a day\"\r\n    IDS_SP_MOREOPTIONS          \"Show more options\"\r\n\r\n    IDS_OTHER                   \"Other\"\r\n\r\n    IDS_OTHER_REMEMBERLAST      \"Remember last used section in this window\"\r\n    IDS_OTHER_CLOCKFLYOUT       \"Open clock flyout when pressing Win+C instead of Microsoft Teams\"\r\n    IDS_OTHER_TOOLBARSEPARATORS \"Show separators between taskbar toolbars\"\r\n    IDS_OTHER_WINXPROPERTIES    \"Add shortcut to program settings in Win+X menu\"\r\n    IDS_OTHER_DONTUSEPOWERSHELL \"Show Command Prompt instead of PowerShell in Win+X menu\"\r\n    IDS_OTHER_WINXACCELERATOR   \"Remove shortcut key from program settings item in Win+X menu\"\r\n    IDS_OTHER_DISABLEOFFICE     \"Disable Office hotkeys (Ctrl+Alt+Shift+Windows key combinations)\"\r\n    IDS_OTHER_DISABLEWINF       \"Disable Win+F (Feedback Hub) hotkey\"\r\n    IDS_OTHER_DISABLERC         \"Disable rounded corners for application windows\"\r\n    IDS_OTHER_DISABLEAEROSNAP   \"Disable quadrants when snapping windows\"\r\n    IDS_OTHER_SNAPASSISTSTYLE   \"Snap Assist style\"\r\n    IDS_OTHER_SNAPASSISTSTYLE_0 \"Windows 11 (default)\"\r\n    IDS_OTHER_SNAPASSISTSTYLE_3 \"Windows 10\"\r\n    IDS_OTHER_PWRBTNACTION      \"Default action in the Alt+F4 dialog on the desktop\"\r\n    IDS_OTHER_PWRBTNACTION_256  \"Switch user\"\r\n    IDS_OTHER_PWRBTNACTION_1    \"Sign out\"\r\n    IDS_OTHER_PWRBTNACTION_16   \"Sleep\"\r\n    IDS_OTHER_PWRBTNACTION_64   \"Hibernate\"\r\n    IDS_OTHER_PWRBTNACTION_2    \"Shut down (default)\"\r\n    IDS_OTHER_PWRBTNACTION_4    \"Restart\"\r\n    IDS_OTHER_LOGONLOGOFFSHUTDOWNSOUNDS \"Enable logon, logoff, and shutdown sounds\"\r\n    IDS_OTHER_NOREDIRECT        \"Prevent the following Control Panel links from being redirected to the Settings app:\"\r\n    IDS_OTHER_NOREDIRECT_SYSTEM \"System / About page\"\r\n    IDS_OTHER_NOREDIRECT_PROGRAMS \"Programs and Features\"\r\n    IDS_OTHER_NOREDIRECT_DATETIME \"Adjust date/time\"\r\n    IDS_OTHER_NOREDIRECT_TRAYICONS \"Customize notification icons\"\r\n\r\n    IDS_UPDATES                 \"Updates\"\r\n\r\n    IDS_UPDATES_POLICY          \"When File Explorer starts\"\r\n    IDS_UPDATES_POLICY_1        \"Notify about available updates (default)\"\r\n    IDS_UPDATES_POLICY_0        \"Prompt to install available updates\"\r\n    IDS_UPDATES_POLICY_2        \"Do not check for updates\"\r\n    IDS_UPDATES_PREFER_STAGING  \"Receive pre-release versions, if available (not recommended)\"\r\n    IDS_UPDATES_DOWNGRADES      \"Suggest the latest version on the server, even if it's older (not recommended)\"\r\n    IDS_UPDATES_USELOCAL        \"Build updates locally before installing\"\r\n    IDS_UPDATES_UPDATESERVERS   \"Update servers:\"\r\n    IDS_UPDATES_RELEASES        \"Releases\"\r\n    IDS_UPDATES_RELEASES_PROMPT \"Type a URL that serves resources adhering to GitHub's releases API. To learn how to configure your own update server, please consult the wiki.\"\r\n    IDS_UPDATES_STAGING         \"Pre-releases\"\r\n    IDS_UPDATES_STAGING_PROMPT  \"Type a URL that serves resources adhering to GitHub's pre-releases API. To learn how to configure your own update server, please consult the wiki.\"\r\n    IDS_UPDATES_CHECK           \"Check for updates\"\r\n    IDS_UPDATES_INSTALL         \"Update program and restart File Explorer\"\r\n    IDS_UPDATES_CHANGES         \"Read about changes in the latest releases\"\r\n    IDS_UPDATES_LEARN           \"Learn more\"\r\n\r\n    IDS_ADV                     \"Advanced\"\r\n\r\n    IDS_ADV_DISCLAIMER          \"Only change these settings after reading the documentation about them.\"\r\n    IDS_ADV_LEARN               \"Learn more\"\r\n    IDS_ADV_CONSOLE             \"Enable console\"\r\n    IDS_ADV_MEMCHECK            \"Dump memory leaks\"\r\n    IDS_ADV_AUTOHIDE            \"Double click taskbar to toggle auto-hide (only works when locked)\"\r\n    IDS_ADV_PAINTDESKTOPVERSION \"Show Windows build info on the desktop\"\r\n    IDS_ADV_CLASSICTHEME        \"Enable advanced mitigations for correct rendering using classic theme\"\r\n    IDS_ADV_SYSLISTVIEW32       \"Enable SysListView32 for Explorer views\"\r\n    IDS_ADV_NOPROPERTIES        \"Do not change the taskbar context menu (e.g. do not display the \"\"Properties\"\" item)\"\r\n    IDS_ADV_SYMBOLS             \"Enable symbols download\"\r\n    IDS_ADV_PINNEDITEMS         \"Pinned items act as quick launch (don't group with active apps)\"\r\n    IDS_ADV_REMOVEEXTRAGAP      \"When the taskbar shows button labels, remove the extra gap around pinned items\"\r\n    IDS_ADV_XAMLSOUNDS          \"Enable UI sounds in Explorer's XAML views\"\r\n\r\n    IDS_ABOUT                   \"About\"\r\n\r\n    IDS_ABOUT_VERSION           \"Version %d.%d.%d.%d%s\"\r\n    IDS_ABOUT_PROJECT           \"This project aims to enhance the working environment on Windows.\"\r\n    IDS_ABOUT_AUTHOR            \"Proudly engineered by Valentin-Gabriel Radu.\"\r\n    IDS_ABOUT_OS                \"Running on %s, OS Build %d.%d.\"\r\n    IDS_ABOUT_GITHUB            \"Visit project GitHub\"\r\n    IDS_ABOUT_WEBSITE           \"Visit web site\"\r\n    IDS_ABOUT_DONATE            \"Donate\"\r\n    IDS_ABOUT_FAQ               \"Frequently Asked Questions\"\r\n    IDS_ABOUT_SETTINGS          \"Learn more about managing your settings\"\r\n    IDS_ABOUT_IMPORT            \"Import settings\"\r\n    IDS_ABOUT_EXPORT            \"Export current settings\"\r\n    IDS_ABOUT_EXPORT_SUCCESS    \"Settings have been exported successfully.\"\r\n    IDS_ABOUT_RESET             \"Restore default settings\"\r\n\r\n    IDS_MAINTENANCE             \"Settings and uninstall\"\r\n\r\n    IDS_UNINSTALL               \"Uninstall\"\r\n    IDS_UNINSTALL_UNINSTALL     \"Uninstall ExplorerPatcher\"\r\n\r\n    IDS_FOOTER_RESTART          \"Restart File Explorer\"\r\nEND\r\n"
  },
  {
    "path": "ep_gui/resources/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Visual C++ generated include file.\r\n// Used by ep_gui.rc\r\n//\r\n#define IDR_REGISTRY1                   101\r\n#define IDR_REGISTRY2                   102\r\n#define IDS_PRODUCTNAME                 201\r\n\r\n// 301-500\r\n#include \"EPSharedResources.h\"\r\n\r\n// 1001-2200\r\n#include \"EPSettingsResources.h\"\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        101\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1001\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "ep_gui/resources/settings.reg",
    "content": "﻿Windows Registry Editor Version 5.00\r\n\r\n\r\n;M Settings\r\n;q\r\n\r\n;T %R:1001%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 3 %R:1002% *\r\n;x 0 %R:1003%\r\n;x 1 %R:1004%\r\n;x 2 %R:1047%\r\n\"OldTaskbar\"=dword:00000002\r\n;y %R:1005% 🡕\r\n;ms-settings:taskbar\r\n;y %R:1006% 🡕\r\n;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\r\n;y %R:1007% 🡕\r\n;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\\SystemIcons\r\n;s Taskbar_LocationSection !(IsWindows11Version22H2OrHigher&&!IsOldTaskbar)\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 4 %R:1008%\r\n;x 3 %R:1009%\r\n;x 1 %R:1010%\r\n;x 0 %R:1011%\r\n;x 2 %R:1012%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_TaskbarPosition\"=dword:00000003\r\n;c 4 %R:1013%\r\n;x 3 %R:1009%\r\n;x 1 %R:1010%\r\n;x 0 %R:1011%\r\n;x 2 %R:1012%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_MMTaskbarPosition\"=dword:00000003\r\n;g Taskbar_LocationSection\r\n;s Taskbar_CortanaButtonSection !IsWindows11Version22H2OrHigher\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 3 %R:1014%\r\n;x 0 %R:1015%\r\n;x 2 %R:1016%\r\n;x 1 %R:1017%\r\n\"TaskbarDa\"=dword:00000000\r\n;g Taskbar_CortanaButtonSection\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Search]\r\n;c 3 %R:1019%\r\n;x 0 %R:1020%\r\n;x 1 %R:1021%\r\n;x 2 %R:1022%\r\n\"SearchboxTaskbarMode\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1024%\r\n\"ShowTaskViewButton\"=dword:00000001\r\n;s Taskbar_CortanaButtonSection1 IsWindows11Version22H2OrHigher\r\n;s Taskbar_CortanaButtonSection2 !IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1025%\r\n\"TaskbarDa\"=dword:00000001\r\n;g Taskbar_CortanaButtonSection2\r\n;g Taskbar_CortanaButtonSection1\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1026%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar\"=dword:00000000\r\n;s Taskbar_Windows10Section IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 2 %R:1027% *\r\n;x 0 %R:1028%\r\n;x 1 %R:1029%\r\n\"OrbStyle\"=dword:00000000\r\n;c 5 %R:1030%\r\n;x 0 %R:1031%\r\n;x 1 %R:1032%\r\n;x 5 %R:1033%\r\n;x 3 %R:1034%\r\n;x 7 %R:1035%\r\n\"OldTaskbarAl\"=dword:00000000\r\n;c 5 %R:1036%\r\n;x 0 %R:1031%\r\n;x 1 %R:1032%\r\n;x 5 %R:1033%\r\n;x 3 %R:1034%\r\n;x 7 %R:1035%\r\n\"MMOldTaskbarAl\"=dword:00000000\r\n;g Taskbar_Windows10Section\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 3 %R:1037%\r\n;x 0 %R:1038%\r\n;x 1 %R:1040%\r\n;x 2 %R:1042%\r\n\"TaskbarGlomLevel\"=dword:00000000\r\n;c 3 %R:1043%\r\n;x 0 %R:1038%\r\n;x 1 %R:1040%\r\n;x 2 %R:1042%\r\n\"MMTaskbarGlomLevel\"=dword:00000000\r\n;s Taskbar_Windows10Section IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 2 %R:1044%\r\n;x 1 %R:1045%\r\n;x 0 %R:1046%\r\n\"TaskbarSmallIcons\"=dword:00000000\r\n;g Taskbar_Windows10Section\r\n;s Taskbar_AltImplSection IsAltImplTaskbar\r\n;y %R:1048%\r\n;https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation\r\n;g Taskbar_AltImplSection\r\n\r\n\r\n;T %R:1101%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1102%\r\n\"SkinMenus\"=dword:00000001\r\n;b %R:1103%\r\n\"CenterMenus\"=dword:00000001\r\n;b %R:1104%\r\n\"FlyoutMenus\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\TabletTip\\1.7]\r\n;b %R:1105% *\r\n\"TipbandDesiredVisibility\"=dword:00000000\r\n;s SystemTray_Section98 IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1106%\r\n\"ShowSecondsInSystemClock\"=dword:00000000\r\n;g SystemTray_Section98\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;i %R:1107% *\r\n\"HideControlCenterButton\"=dword:00000000\r\n;s SystemTray_Section109 IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 3 %R:1108%\r\n;x 1 %R:1109%\r\n;x 0 %R:1110%\r\n;x 2 %R:1111%\r\n\"TaskbarSD\"=dword:00000001\r\n;g SystemTray_Section109\r\n;s SystemTray_Section117 !IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1108%\r\n\"TaskbarSD\"=dword:00000001\r\n;g SystemTray_Section117\r\n;s SystemTray_Windows10Section IsOldTaskbar\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;p 2\r\n;b %R:1112% *\r\n\"SkinIcons\"=dword:00000001\r\n;s Taskbar_AltImplSection IsAltImplTaskbar\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 2 %R:1143% *\r\n;x 0 %R:1144%\r\n;x 1 %R:1145%\r\n\"TrayOverflowStyle\"=dword:00000000\r\n;g Taskbar_AltImplSection\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;a %R:1113%\r\n;c 3 %R:1114%\r\n;x 0 %R:1115%\r\n;x 1 %R:1116%\r\n;x 2 %R:1117%\r\n\"ReplaceNetwork\"=dword:00000000\r\n;q\r\n;t %R:1118%\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Settings\\Network]\r\n;c 7 %R:1119%\r\n;x 6 %R:1120%\r\n;x 5 %R:1121%\r\n;x 0 %R:1122%\r\n;x 2 %R:1123%\r\n;x 1 %R:1124%\r\n;x 3 %R:1116%\r\n;x 4 %R:1117%\r\n\"ReplaceVan\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\MTCUVC]\r\n;c 2 %R:1125%\r\n;x 1 %R:1126%\r\n;x 0 %R:1127%\r\n\"EnableMtcUvc\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell]\r\n;c 3 %R:1128%\r\n;x 2 %R:1129%\r\n;x 0 %R:1130%\r\n;x 1 %R:1131%\r\n\"UseWin32TrayClockExperience\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell]\r\n;c 2 %R:1133%\r\n;x 0 %R:1134%\r\n;x 1 %R:1135%\r\n\"UseWin32BatteryFlyout\"=dword:00000000\r\n;s SystemTray_LanguageSwitcherBefore22H2 !IsWindows11Version22H2OrHigher\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 3 %R:1136% *\r\n;x 0 %R:1137%\r\n;x 1 %R:1138%\r\n;x 4 %R:1140%\r\n\"IMEStyle\"=dword:00000000\r\n;g SystemTray_LanguageSwitcherBefore22H2\r\n;s SystemTray_LanguageSwitcherAfter22H2 IsWindows11Version22H2OrHigher\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 4 %R:1136% *\r\n;x 0 %R:1137%\r\n;x 7 %R:1140%\r\n;x 1 %R:1141%\r\n;x 4 %R:1142%\r\n\"IMEStyle\"=dword:00000000\r\n;g SystemTray_LanguageSwitcherAfter22H2\r\n;g SystemTray_Windows10Section\r\n\r\n\r\n\r\n;T %R:1201%\r\n;e %R:1202%\r\n;e %R:1203%\r\n;y %R:1204% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Using-ExplorerPatcher-as-shell-extension\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;q\r\n;b %R:1205%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension\"=dword:00000000\r\n[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\\InprocServer32]\r\n;d %R:1206% *\r\n@=\"\"\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1207%\r\n\"LegacyFileTransferDialog\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1208%\r\n\"UseClassicDriveGrouping\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 4 %R:1209% *\r\n;x 0 %R:1210%\r\n;x 4 %R:1212%\r\n;x 1 %R:1214%\r\n;x 2 %R:1215%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_FileExplorerCommandUI\"=dword:00000000\r\n;t %R:1216%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;i %R:1217% **\r\n\"DisableImmersiveContextMenu\"=dword:00000000\r\n[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{056440FD-8568-48e7-A632-72157243B55B}\\InprocServer32]\r\n;d %R:1218% **\r\n@=\"\"\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1219%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_DisableModernSearchBar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1220% **\r\n\"ShrinkExplorerAddressBar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1221% **\r\n\"HideExplorerSearchBar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 4 %R:1222%\r\n;x 0 %R:1223%\r\n;x 1 %R:1224%\r\n;x 2 %R:1225%\r\n;x 3 %R:1226%\r\n\"HideIconAndTitleInExplorer\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1227% **\r\n\"MicaEffectOnTitlebar\"=dword:00000000\r\n\r\n\r\n\r\n;T %R:1301%\r\n;s StartMenu_StyleSection DoesWindows10StartMenuExist\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;z 2 %R:1302% *\r\n;x 0 %R:1303%\r\n;x 1 %R:1304%\r\n\"Start_ShowClassicMode\"=dword:00000000\r\n;g StartMenu_StyleSection\r\n;y %R:1305% 🡕\r\n;ms-settings:personalization-start\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 2 %R:1306%\r\n;x 0 %R:1307%\r\n;x 1 %R:1308%\r\n\"TaskbarAl\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 22 %R:1309%\r\n;x 0 %R:1310%\r\n;x 1 1\r\n;x 2 2\r\n;x 3 3\r\n;x 4 4\r\n;x 5 5\r\n;x 6 %R:1311%\r\n;x 7 7\r\n;x 8 8\r\n;x 9 9\r\n;x 10 10\r\n;x 11 11\r\n;x 12 12\r\n;x 13 13\r\n;x 14 14\r\n;x 15 15\r\n;x 16 16\r\n;x 17 17\r\n;x 18 18\r\n;x 19 19\r\n;x 20 20\r\n;x 99999 %R:1312%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_Start_MaximumFrequentApps\"=dword:00000006\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage]\r\n;a %R:1313%\r\n;c 10 %R:1314%\r\n;x 1 %R:1315%\r\n;x 0 %R:1316%\r\n;x 2 %R:1317%\r\n;x 3 %R:1318%\r\n;x 4 %R:1319%\r\n;x 5 %R:1320%\r\n;x 6 %R:1321%\r\n;x 7 %R:1322%\r\n;x 8 %R:1323%\r\n;x 9 %R:1324%\r\n\"MonitorOverride\"=dword:00000001\r\n;s StartMenu_Windows11 !IsWindows10StartMenu\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1325%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartDocked_DisableRecommendedSection\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage]\r\n;b %R:1326%\r\n\"MakeAllAppsDefault\"=dword:00000000\r\n;g StartMenu_Windows11\r\n;s StartMenu_Windows10 IsWindows10StartMenu\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1327%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_ShowMoreTiles\"=dword:00000000\r\n;c 3 %R:1328%\r\n;x 1 %R:1329%\r\n;x 2 %R:1330%\r\n;x 0 %R:1331%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 3 %R:1332%\r\n;x 0 %R:1333%\r\n;x 1 %R:1334%\r\n;x 2 %R:1335%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_ForceStartSize\"=dword:00000000\r\n;c 3 %R:1336%\r\n;x 0 %R:1337%\r\n;x 3 %R:1338%\r\n;x 1 %R:1339%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms\"=dword:00000000\r\n;y %R:1340%\r\n;https://github.com/valinet/ExplorerPatcher/discussions/1679\r\n;g StartMenu_Windows10\r\n\r\n\r\n\r\n;T %R:1401%\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer]\r\n;z 4 %R:1402% *\r\n;x 0 %R:1403%\r\n;x 3 %R:1405%\r\n;x 1 %R:1406%\r\n;x 2 %R:1407%\r\n\"AltTabSettings\"=dword:00000000\r\n;s WindowSwitcher_SWS IsSWSEnabled\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;b %R:1408%\r\n\"IncludeWallpaper\"=dword:00000001\r\n;b %R:1409%\r\n\"PrimaryOnly\"=dword:00000000\r\n;b %R:1410%\r\n\"PerMonitor\"=dword:00000000\r\n;b %R:1411%\r\n\"SwitcherIsPerApplication\"=dword:00000000\r\n;b %PLACEHOLDER_0001%\r\n\"NoPerApplicationList\"=dword:00000000\r\n;c 3 %R:1413%\r\n;x 0 %R:1414%\r\n;x 1 %R:1415%\r\n;x 2 %R:1416%\r\n\"Theme\"=dword:00000000\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MultitaskingView\\AltTabViewHost]\r\n;c 19 %R:1417%\r\n;x 100 %R:1418%\r\n;x 98 98 %\r\n;x 96 96 %\r\n;x 95 %R:1419%\r\n;x 94 94 %\r\n;x 92 92 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 80 %\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n;x 50 50 %\r\n;x 45 45 %\r\n;x 40 40 %\r\n;x 35 35 %\r\n;x 30 30 %\r\n\"Grid_backgroundPercent\"=dword:0000005F\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;c 3 %R:1420%\r\n;x 0 %R:1421%\r\n;x 1 %R:1422%\r\n;x 2 %R:1423%\r\n\"ColorScheme\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;c 3 %R:1424%\r\n;x 2 %R:1425%\r\n;x 3 %R:1426%\r\n;x 1 %R:1427%\r\n\"CornerPreference\"=dword:00000002\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;c 20 %R:1428%\r\n;x 330 330 pt\r\n;x 320 320 pt\r\n;x 310 310 pt\r\n;x 300 300 pt\r\n;x 290 290 pt\r\n;x 280 280 pt\r\n;x 270 270 pt\r\n;x 260 260 pt\r\n;x 250 250 pt\r\n;x 240 240 pt\r\n;x 230 %R:1429%\r\n;x 220 220 pt\r\n;x 210 210 pt\r\n;x 200 200 pt\r\n;x 190 190 pt\r\n;x 180 180 pt\r\n;x 170 170 pt\r\n;x 160 160 pt\r\n;x 150 150 pt\r\n;x 140 140 pt\r\n\"RowHeight\"=dword:000000e6\r\n;c 10 %R:1430%\r\n;x 100 %R:1431%\r\n;x 95 95 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 %R:1432%\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n\"MaxWidth\"=dword:00000050\r\n;c 10 %R:1433%\r\n;x 100 %R:1434%\r\n;x 95 95 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 %R:1435%\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n\"MaxHeight\"=dword:00000050\r\n;c 11 %R:1436%\r\n;x 50 50 pt\r\n;x 45 45 pt\r\n;x 40 40 pt\r\n;x 35 30 pt\r\n;x 30 30 pt\r\n;x 25 25 pt\r\n;x 20 %R:1437%\r\n;x 15 15 pt\r\n;x 10 10 pt\r\n;x 5 5 pt\r\n;x 0 %R:1438%\r\n\"MasterPadding\"=dword:00000014\r\n;c 11 %R:1439%\r\n;x 0 %R:1440%\r\n;x 25 %R:1441%\r\n;x 50 %R:1442%\r\n;x 75 %R:1443%\r\n;x 100 %R:1444%\r\n;x 125 %R:1445%\r\n;x 150 %R:1446%\r\n;x 200 %R:1447%\r\n;x 300 %R:1448%\r\n;x 400 %R:1449%\r\n;x 500 %R:1450%\r\n\"ShowDelay\"=dword:00000064\r\n;c 3 %R:1451%\r\n;x 0 %R:1452%\r\n;x 1 %R:1453%\r\n;x 2 %R:1454%\r\n\"ScrollWheelBehavior\"=dword:00000000\r\n;q\r\n;y %R:1455% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher\r\n;g WindowSwitcher_SWS\r\n\r\n\r\n\r\n;s Weather_Windows10 IsOldTaskbar\r\n;T %R:1501%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1502%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand\"=dword:00000000\r\n;s Weather_Section1 IsWeatherEnabled\r\n;w %R:1503%\r\n;%R:1504%\r\n;%R:1505%\r\n\"WeatherLocation\"=\"\"\r\n;c 5 %R:1506%\r\n;x 0 %R:1507%\r\n;x 3 %R:1508%\r\n;x 1 %R:1509%\r\n;x 4 %R:1510%\r\n;x 5 %R:1511%\r\n\"WeatherViewMode\"=dword:00000000\r\n;c 3 %R:1512%\r\n;x 0 %R:1513%\r\n;x 2 %R:1514%\r\n;x 1 %R:1515%\r\n\"WeatherFixedSize\"=dword:00000000\r\n;c 2 %R:1516%\r\n;x 0 %R:1517%\r\n;x 1 %R:1518%\r\n\"WeatherToLeft\"=dword:00000000\r\n;c 7 %R:1519%\r\n;x 60 %R:1520%\r\n;x 300 %R:1521%\r\n;x 900 %R:1522%\r\n;x 1200 %R:1523%\r\n;x 1800 %R:1524%\r\n;x 3600 %R:1525%\r\n;x 7200 %R:1526%\r\n\"WeatherContentUpdateMode\"=dword:000004B0\r\n;c 2 %R:1527%\r\n;x 0 %R:1528%\r\n;x 1 %R:1529%\r\n\"WeatherTemperatureUnit\"=dword:00000000\r\n;;;c 2 Location accuracy\r\n;;;x 0 Generic (based on the IP address) (default)\r\n;;;x 1 Precise (geolocation)\r\n;;\"WeatherLocationType\"=dword:00000000\r\n;w %R:1533%\r\n;%R:1534%\r\n;%R:1535%\r\n\"WeatherLanguage\"=\"\"\r\n;c 3 %R:1536%\r\n;x 0 %R:1537%\r\n;x 1 %R:1538%\r\n;x 2 %R:1539%\r\n\"WeatherTheme\"=dword:00000000\r\n;c 3 %R:1540%\r\n;x 2 %R:1541%\r\n;x 3 %R:1542%\r\n;x 1 %R:1543%\r\n\"WeatherWindowCornerPreference\"=dword:00000002\r\n;c 2 %R:1544%\r\n;x 0 %R:1545%\r\n;x 1 %R:1546%\r\n\"WeatherIconPack\"=dword:00000000\r\n;c 2 %R:1547%\r\n;x 0 %R:1548%\r\n;x 1 %R:1549%\r\n\"WeatherContentsMode\"=dword:00000000\r\n;c 17 %R:1550%\r\n;x 25 25 %\r\n;x 33 33 %\r\n;x 50 50 %\r\n;x 67 67 %\r\n;x 75 75 %\r\n;x 80 80 %\r\n;x 90 90 %\r\n;x 0 %R:1551%\r\n;x 110 110 %\r\n;x 125 125 %\r\n;x 150 150 %\r\n;x 175 175 %\r\n;x 200 200 %\r\n;x 250 250 %\r\n;x 300 300 %\r\n;x 400 400 %\r\n;x 500 500 %\r\n\"WeatherZoomFactor\"=dword:00000000\r\n;q\r\n;g Weather_Section1\r\n;y %R:1552% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Weather\r\n;s Weather_Section2 IsWeatherEnabled\r\n;t %WEATHERLASTUPDATETEXT%\r\n;u %R:1554%\r\n;update_weather\r\n;u %R:1555%\r\n;clear_data_weather\r\n;g Weather_Section2\r\n;g Weather_Windows10\r\n\r\n\r\n\r\n;s Spotlight_SpotlightOSCheck DoesOSBuildSupportSpotlight\r\n;s Spotlight_SpotlightEnabledCheck IsSpotlightEnabled\r\n;T %R:1601%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1602%\r\n\"SpotlightDisableIcon\"=dword:00000000\r\n;c 8 %R:1603%\r\n;x 0 %R:1604%\r\n;x 32 %R:1605%\r\n;x 48 %R:1606%\r\n;x 288 %R:1607%\r\n;x 800 %R:1608%\r\n;x 304 %R:1609%\r\n;x 816 %R:1610%\r\n;x 1008 %R:1611%\r\n\"SpotlightDesktopMenuMask\"=dword:00000000\r\n;c 11 %R:1612%\r\n;x 0 %R:1613%\r\n;x 60 %R:1614%\r\n;x 300 %R:1615%\r\n;x 900 %R:1616%\r\n;x 1200 %R:1617%\r\n;x 1800 %R:1618%\r\n;x 3600 %R:1619%\r\n;x 7200 %R:1620%\r\n;x 21600 %R:1621%\r\n;x 43200 %R:1622%\r\n;x 86400 %R:1623%\r\n\"SpotlightUpdateSchedule\"=dword:00000000\r\n;u %SPOTLIGHTCLICK%\r\n;spotlight_click\r\n;t %SPOTLIGHTINFOTIP1%\r\n;t %SPOTLIGHTINFOTIP2%\r\n;u %SPOTLIGHTNEXT%\r\n;spotlight_next\r\n;u %SPOTLIGHTLIKE%\r\n;spotlight_like\r\n;u %SPOTLIGHTDISLIKE%\r\n;spotlight_dislike\r\n;;;u %R:1624%\r\n;;;spotlight_menu\r\n;g Spotlight_SpotlightEnabledCheck\r\n;g Spotlight_SpotlightOSCheck\r\n\r\n\r\n\r\n\r\n;T %R:1701%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1702%\r\n\"LastSectionInProperties\"=dword:00000000\r\n;b %R:1703% *\r\n\"ClockFlyoutOnWinC\"=dword:00000000\r\n;b %R:1704% *\r\n\"ToolbarSeparators\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1705%\r\n\"PropertiesInWinX\"=dword:00000000\r\n;b %R:1707%\r\n\"NoMenuAccelerator\"=dword:00000000\r\n;b %R:1708% *\r\n\"DisableOfficeHotkeys\"=dword:00000000\r\n;b %R:1709% *\r\n\"DisableWinFHotkey\"=dword:00000000\r\n;b %R:1710%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_DisableRoundedCorners\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1711% *\r\n\"DisableAeroSnapQuadrants\"=dword:00000000\r\n;s Other_SnapAssistStyle !IsWindows11Version22H2OrHigher\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 2 %R:1712%\r\n;x 0 %R:1713%\r\n;x 3 %R:1714%\r\n\"SnapAssistSettings\"=dword:00000000\r\n;g Other_SnapAssistStyle\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 6 %R:1715%\r\n;x 256 %R:1716%\r\n;x 1 %R:1717%\r\n;x 16 %R:1718%\r\n;x 64 %R:1719%\r\n;x 2 %R:1720%\r\n;x 4 %R:1721%\r\n\"Start_PowerButtonAction\"=dword:00000002\r\n;s LogonLogoffShutdownSounds LogonLogoffShutdownSoundsAvailable\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1727% *\r\n\"LogonLogoffShutdownSounds\"=dword:00000000\r\n;g LogonLogoffShutdownSounds\r\n;t %R:1722%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1723%\r\n\"DoNotRedirectSystemToSettingsApp\"=dword:00000000\r\n;b %R:1724%\r\n\"DoNotRedirectProgramsAndFeaturesToSettingsApp\"=dword:00000000\r\n;b %R:1725%\r\n\"DoNotRedirectDateAndTimeToSettingsApp\"=dword:00000000\r\n;b %R:1726%\r\n\"DoNotRedirectNotificationIconsToSettingsApp\"=dword:00000000\r\n\r\n\r\n;T %R:1801%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 3 %R:1802%\r\n;x 1 %R:1803%\r\n;x 0 %R:1804%\r\n;x 2 %R:1805%\r\n\"UpdatePolicy\"=dword:00000001\r\n;b %R:1806%\r\n\"UpdatePreferStaging\"=dword:00000000\r\n;b %R:1807%\r\n\"UpdateAllowDowngrades\"=dword:00000000\r\n;b %R:1817%\r\n\"UpdateUseLocal\"=dword:00000000\r\n;t %R:1808%\r\n;w %R:1809%\r\n;%R:1810%\r\n;github.com/valinet/ExplorerPatcher/releases/latest\r\n\"UpdateURL\"=\"\"\r\n;w %R:1811%\r\n;%R:1812%\r\n;api.github.com/repos/valinet/ExplorerPatcher/releases?per_page=1\r\n\"UpdateURLStaging\"=\"\"\r\n;y %R:1813%\r\n;;;EP_CHECK_FOR_UPDATES\r\n;y %R:1814%\r\n;;;EP_INSTALL_UPDATES\r\n;y %R:1815% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/blob/master/CHANGELOG.md\r\n;y %R:1816% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Configure-updates\r\n\r\n\r\n;T %R:1901%\r\n;e %R:1902%\r\n;y %R:1903% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/About-advanced-settings\r\n;q\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1904%\r\n\"AllocConsole\"=dword:00000000\r\n;b %R:1905%\r\n\"Memcheck\"=dword:00000000\r\n;b %R:1906%\r\n\"TaskbarAutohideOnDoubleClick\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Control Panel\\Desktop]\r\n;b %R:1907% *\r\n\"PaintDesktopVersion\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1908% *\r\n\"ClassicThemeMitigations\"=dword:00000000\r\n[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{1eeb5b5a-06fb-4732-96b3-975c0194eb39}\\InprocServer32]\r\n;d %R:1909% *\r\n@=\"\"\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1910%\r\n\"NoPropertiesInContextMenu\"=dword:00000000\r\n;b %R:1911% *\r\n\"EnableSymbolDownload\"=dword:00000001\r\n;s Advanced_Windows10 IsOldTaskbar\r\n;b %R:1912% *\r\n\"PinnedItemsActAsQuickLaunch\"=dword:00000000\r\n;b %R:1913% *\r\n\"RemoveExtraGapAroundPinnedItems\"=dword:00000000\r\n;g Advanced_Windows10\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher]\r\n;b %R:1927% *\r\n\"XamlSounds\"=dword:00000000\r\n\r\n\r\n;T %R:2301%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 10001 %R:1533%\r\n\"Language\"=dword:00000000\r\n;y %R:2011% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Settings-management\r\n;u %R:2012%\r\n;import\r\n;u %R:2013%\r\n;export\r\n;u %R:2015%\r\n;reset\r\n;u %R:2102%\r\n;uninstall\r\n\r\n\r\n;T %R:2001%\r\n;e %R:201%\r\n;e %VERSIONINFORMATIONSTRING%\r\n;t © 2006-2025 VALINET Solutions SRL. All rights reserved.\r\n;e \r\n;e %R:2003%\r\n;e %R:2004%\r\n;t %OSVERSIONSTRING%\r\n;y %R:2006% (https://github.com/valinet) 🡕\r\n;https://github.com/valinet\r\n;q\r\n;y %R:2007% (https://www.valinet.ro) 🡕\r\n;https://www.valinet.ro\r\n;y %R:2009% 🡕\r\n;https://github.com/valinet/ExplorerPatcher#donate\r\n;y %R:2010% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Frequently-asked-questions\r\n\r\n\r\n\r\n;f\r\n;u %R:2201% (*)\r\n;restart\r\n"
  },
  {
    "path": "ep_gui/resources/settings10.reg",
    "content": "﻿Windows Registry Editor Version 5.00\r\n\r\n\r\n;M Settings\r\n;q\r\n\r\n;T %R:1001%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 2 %R:1002% *\r\n;x 1 %R:1404%\r\n;x 2 %R:1047%\r\n\"OldTaskbar\"=dword:00000001\r\n;y %R:1005% 🡕\r\n;ms-settings:taskbar\r\n;y %R:1006% 🡕\r\n;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\r\n;y %R:1007% 🡕\r\n;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\\SystemIcons\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 4 %R:1008%\r\n;x 3 %R:1009%\r\n;x 1 %R:1010%\r\n;x 0 %R:1011%\r\n;x 2 %R:1012%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_TaskbarPosition\"=dword:00000003\r\n;c 4 %R:1013%\r\n;x 3 %R:1009%\r\n;x 1 %R:1010%\r\n;x 0 %R:1011%\r\n;x 2 %R:1012%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_MMTaskbarPosition\"=dword:00000003\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Search]\r\n;c 3 %R:1019%\r\n;x 0 %R:1020%\r\n;x 1 %R:1021%\r\n;x 2 %R:1022%\r\n\"SearchboxTaskbarMode\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1023%\r\n\"ShowCortanaButton\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1024%\r\n\"ShowTaskViewButton\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1026%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 2 %R:1027% *\r\n;x 0 %R:1028%\r\n;x 1 %R:1029%\r\n\"OrbStyle\"=dword:00000000\r\n;c 5 %R:1030%\r\n;x 0 %R:1031%\r\n;x 1 %R:1032%\r\n;x 5 %R:1033%\r\n;x 3 %R:1034%\r\n;x 7 %R:1035%\r\n\"OldTaskbarAl\"=dword:00000000\r\n;c 5 %R:1036%\r\n;x 0 %R:1031%\r\n;x 1 %R:1032%\r\n;x 5 %R:1033%\r\n;x 3 %R:1034%\r\n;x 7 %R:1035%\r\n\"MMOldTaskbarAl\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 3 %R:1037%\r\n;x 0 %R:1038%\r\n;x 1 %R:1040%\r\n;x 2 %R:1042%\r\n\"TaskbarGlomLevel\"=dword:00000000\r\n;c 3 %R:1043%\r\n;x 0 %R:1038%\r\n;x 1 %R:1040%\r\n;x 2 %R:1042%\r\n\"MMTaskbarGlomLevel\"=dword:00000000\r\n;c 2 %R:1044%\r\n;x 1 %R:1045%\r\n;x 0 %R:1046%\r\n\"TaskbarSmallIcons\"=dword:00000000\r\n;s Taskbar_AltImplSection IsAltImplTaskbar\r\n;y %R:1048%\r\n;https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation\r\n;g Taskbar_AltImplSection\r\n\r\n;T %R:1101%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1102%\r\n\"SkinMenus\"=dword:00000001\r\n;b %R:1103%\r\n\"CenterMenus\"=dword:00000001\r\n;b %R:1104%\r\n\"FlyoutMenus\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\TabletTip\\1.7]\r\n;b %R:1105% *\r\n\"TipbandDesiredVisibility\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1106%\r\n\"ShowSecondsInSystemClock\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 3 %R:1108%\r\n;x 1 %R:1109%\r\n;x 0 %R:1110%\r\n;x 2 %R:1111%\r\n\"TaskbarSD\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;p 2\r\n;b %R:1112% *\r\n\"SkinIcons\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;a %R:1113%\r\n;c 3 %R:1114%\r\n;x 0 %R:1115%\r\n;x 1 %R:1116%\r\n;x 2 %R:1117%\r\n\"ReplaceNetwork\"=dword:00000000\r\n;q\r\n;t %R:1118%\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Settings\\Network]\r\n;c 5 %R:1119%\r\n;x 0 %R:1122%\r\n;x 2 %R:1123%\r\n;x 1 %R:1124%\r\n;x 3 %R:1116%\r\n;x 4 %R:1117%\r\n\"ReplaceVan\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\MTCUVC]\r\n;c 2 %R:1125%\r\n;x 1 %R:1126%\r\n;x 0 %R:1127%\r\n\"EnableMtcUvc\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell]\r\n;c 3 %R:1128%\r\n;x 0 %R:1130%\r\n;x 1 %R:1131%\r\n;x 2 %R:1132%\r\n\"UseWin32TrayClockExperience\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell]\r\n;c 2 %R:1133%\r\n;x 0 %R:1134%\r\n;x 1 %R:1135%\r\n\"UseWin32BatteryFlyout\"=dword:00000000\r\n\r\n\r\n;T %R:1201%\r\n;e %R:1202%\r\n;e %R:1203%\r\n;y %R:1204% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Using-ExplorerPatcher-as-shell-extension\r\n;q\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1205%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1207%\r\n\"LegacyFileTransferDialog\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1208%\r\n\"UseClassicDriveGrouping\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;c 2 %R:1209%\r\n;x 0 %R:1213%\r\n;x 2 %R:1215%\r\n\"FileExplorerCommandUI\"=dword:00000000\r\n;t %R:1216%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;i %R:1217% **\r\n\"DisableImmersiveContextMenu\"=dword:00000000\r\n[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{056440FD-8568-48e7-A632-72157243B55B}\\InprocServer32]\r\n;d %R:1218% **\r\n@=\"\"\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1219%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_DisableModernSearchBar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1220% **\r\n\"ShrinkExplorerAddressBar\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1221% **\r\n\"HideExplorerSearchBar\"=dword:00000000\r\n;p 2\r\n;b Mica effect on title bar\r\n\"MicaEffectOnTitlebar\"=dword:00000000\r\n\r\n\r\n;T %R:1301%\r\n;y %R:1305% 🡕\r\n;ms-settings:personalization-start\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;z 2 %R:1306%\r\n;x 0 %R:1307%\r\n;x 1 %R:1308%\r\n\"TaskbarAl\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 22 %R:1309%\r\n;x 0 %R:1310%\r\n;x 1 1\r\n;x 2 2\r\n;x 3 3\r\n;x 4 4\r\n;x 5 5\r\n;x 6 %R:1311%\r\n;x 7 7\r\n;x 8 8\r\n;x 9 9\r\n;x 10 10\r\n;x 11 11\r\n;x 12 12\r\n;x 13 13\r\n;x 14 14\r\n;x 15 15\r\n;x 16 16\r\n;x 17 17\r\n;x 18 18\r\n;x 19 19\r\n;x 20 20\r\n;x 99999 %R:1312%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_Start_MaximumFrequentApps\"=dword:00000006\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage]\r\n;e %R:1313%\r\n;z 10 %R:1314%\r\n;x 1 %R:1315%\r\n;x 0 %R:1316%\r\n;x 2 %R:1317%\r\n;x 3 %R:1318%\r\n;x 4 %R:1319%\r\n;x 5 %R:1320%\r\n;x 6 %R:1321%\r\n;x 7 %R:1322%\r\n;x 8 %R:1323%\r\n;x 9 %R:1324%\r\n\"MonitorOverride\"=dword:00000001\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 3 %R:1328%\r\n;x 1 %R:1329%\r\n;x 2 %R:1330%\r\n;x 0 %R:1331%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 3 %R:1332%\r\n;x 0 %R:1333%\r\n;x 1 %R:1334%\r\n;x 2 %R:1335%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_ForceStartSize\"=dword:00000000\r\n;z 3 %R:1336%\r\n;x 0 %R:1337%\r\n;x 3 %R:1338%\r\n;x 1 %R:1339%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms\"=dword:00000000\r\n;t %R:1341%\r\n\r\n\r\n;T %R:1401%\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer]\r\n;z 3 %R:1402% *\r\n;x 0 %R:1404%\r\n;x 1 %R:1406%\r\n;x 2 %R:1407%\r\n\"AltTabSettings\"=dword:00000000\r\n;s WindowSwitcher_SWS IsSWSEnabled\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;b %R:1408%\r\n\"IncludeWallpaper\"=dword:00000001\r\n;b %R:1409%\r\n\"PrimaryOnly\"=dword:00000000\r\n;b %R:1410%\r\n\"PerMonitor\"=dword:00000000\r\n;b %R:1411%\r\n\"SwitcherIsPerApplication\"=dword:00000000\r\n;b %PLACEHOLDER_0001%\r\n\"NoPerApplicationList\"=dword:00000000\r\n;c 2 %R:1413%\r\n;x 0 %R:1414%\r\n;x 1 %R:1415%\r\n\"Theme\"=dword:00000000\r\n[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MultitaskingView\\AltTabViewHost]\r\n;c 19 %R:1417%\r\n;x 100 %R:1418%\r\n;x 98 98 %\r\n;x 96 96 %\r\n;x 95 %R:1419%\r\n;x 94 94 %\r\n;x 92 92 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 80 %\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n;x 50 50 %\r\n;x 45 45 %\r\n;x 40 40 %\r\n;x 35 35 %\r\n;x 30 30 %\r\n\"Grid_backgroundPercent\"=dword:0000005F\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;c 3 %R:1420%\r\n;x 0 %R:1421%\r\n;x 1 %R:1422%\r\n;x 2 %R:1423%\r\n\"ColorScheme\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher\\sws]\r\n;c 20 %R:1424%\r\n;x 330 330 pt\r\n;x 320 320 pt\r\n;x 310 310 pt\r\n;x 300 300 pt\r\n;x 290 290 pt\r\n;x 280 280 pt\r\n;x 270 270 pt\r\n;x 260 260 pt\r\n;x 250 250 pt\r\n;x 240 240 pt\r\n;x 230 %R:1429%\r\n;x 220 220 pt\r\n;x 210 210 pt\r\n;x 200 200 pt\r\n;x 190 190 pt\r\n;x 180 180 pt\r\n;x 170 170 pt\r\n;x 160 160 pt\r\n;x 150 150 pt\r\n;x 140 140 pt\r\n\"RowHeight\"=dword:000000e6\r\n;c 10 %R:1430%\r\n;x 100 %R:1431%\r\n;x 95 95 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 %R:1432%\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n\"MaxWidth\"=dword:00000050\r\n;c 10 %R:1433%\r\n;x 100 %R:1434%\r\n;x 95 95 %\r\n;x 90 90 %\r\n;x 85 85 %\r\n;x 80 %R:1435%\r\n;x 75 75 %\r\n;x 70 70 %\r\n;x 65 65 %\r\n;x 60 60 %\r\n;x 55 55 %\r\n\"MaxHeight\"=dword:00000050\r\n;c 11 %R:1436%\r\n;x 50 50 pt\r\n;x 45 45 pt\r\n;x 40 40 pt\r\n;x 35 30 pt\r\n;x 30 30 pt\r\n;x 25 25 pt\r\n;x 20 %R:1437%\r\n;x 15 15 pt\r\n;x 10 10 pt\r\n;x 5 5 pt\r\n;x 0 %R:1438%\r\n\"MasterPadding\"=dword:00000014\r\n;c 11 %R:1439%\r\n;x 0 %R:1440%\r\n;x 25 %R:1441%\r\n;x 50 %R:1442%\r\n;x 75 %R:1443%\r\n;x 100 %R:1444%\r\n;x 125 %R:1445%\r\n;x 150 %R:1446%\r\n;x 200 %R:1447%\r\n;x 300 %R:1448%\r\n;x 400 %R:1449%\r\n;x 500 %R:1450%\r\n\"ShowDelay\"=dword:00000064\r\n;c 3 %R:1451%\r\n;x 0 %R:1452%\r\n;x 1 %R:1453%\r\n;x 2 %R:1454%\r\n\"ScrollWheelBehavior\"=dword:00000000\r\n;q\r\n;y %R:1455% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher\r\n;g WindowSwitcher_SWS\r\n\r\n\r\n;T %R:1501%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1502%\r\n;\"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand\"=dword:00000000\r\n;s Weather_Section1 IsWeatherEnabled\r\n;w %R:1503%\r\n;%R:1504%\r\n;%R:1505%\r\n\"WeatherLocation\"=\"\"\r\n;c 5 %R:1506%\r\n;x 0 %R:1507%\r\n;x 3 %R:1508%\r\n;x 1 %R:1509%\r\n;x 4 %R:1510%\r\n;x 5 %R:1511%\r\n\"WeatherViewMode\"=dword:00000000\r\n;c 3 %R:1512%\r\n;x 0 %R:1513%\r\n;x 2 %R:1514%\r\n;x 1 %R:1515%\r\n\"WeatherFixedSize\"=dword:00000000\r\n;c 2 %R:1516%\r\n;x 0 %R:1517%\r\n;x 1 %R:1518%\r\n\"WeatherToLeft\"=dword:00000000\r\n;c 7 %R:1519%\r\n;x 60 %R:1520%\r\n;x 300 %R:1521%\r\n;x 900 %R:1522%\r\n;x 1200 %R:1523%\r\n;x 1800 %R:1524%\r\n;x 3600 %R:1525%\r\n;x 7200 %R:1526%\r\n\"WeatherContentUpdateMode\"=dword:000004B0\r\n;c 2 %R:1527%\r\n;x 0 %R:1528%\r\n;x 1 %R:1529%\r\n\"WeatherTemperatureUnit\"=dword:00000000\r\n;;;c 2 Location accuracy\r\n;;;x 0 Generic (based on the IP address) (default)\r\n;;;x 1 Precise (geolocation)\r\n;;\"WeatherLocationType\"=dword:00000000\r\n;w %R:1533%\r\n;%R:1534%\r\n;%R:1535%\r\n\"WeatherLanguage\"=\"\"\r\n;c 3 %R:1536%\r\n;x 0 %R:1537%\r\n;x 1 %R:1538%\r\n;x 2 %R:1539%\r\n\"WeatherTheme\"=dword:00000000\r\n;c 2 %R:1544%\r\n;x 0 %R:1545%\r\n;x 1 %R:1546%\r\n\"WeatherIconPack\"=dword:00000000\r\n;c 2 %R:1547%\r\n;x 0 %R:1548%\r\n;x 1 %R:1549%\r\n\"WeatherContentsMode\"=dword:00000000\r\n;c 17 %R:1550%\r\n;x 25 25 %\r\n;x 33 33 %\r\n;x 50 50 %\r\n;x 67 67 %\r\n;x 75 75 %\r\n;x 80 80 %\r\n;x 90 90 %\r\n;x 0 %R:1551%\r\n;x 110 110 %\r\n;x 125 125 %\r\n;x 150 150 %\r\n;x 175 175 %\r\n;x 200 200 %\r\n;x 250 250 %\r\n;x 300 300 %\r\n;x 400 400 %\r\n;x 500 500 %\r\n\"WeatherZoomFactor\"=dword:00000000\r\n;q\r\n;g Weather_Section1\r\n;y %R:1552% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Weather\r\n;s Weather_Section2 IsWeatherEnabled\r\n;t %WEATHERLASTUPDATETEXT%\r\n;u %R:1554%\r\n;update_weather\r\n;u %R:1555%\r\n;clear_data_weather\r\n;g Weather_Section2\r\n\r\n\r\n\r\n;T %R:1701%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1702%\r\n\"LastSectionInProperties\"=dword:00000000\r\n;b %R:1703% *\r\n\"ClockFlyoutOnWinC\"=dword:00000000\r\n;b %R:1704% *\r\n\"ToolbarSeparators\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;b %R:1706% *\r\n\"DontUsePowerShellOnWinX\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1707%\r\n\"NoMenuAccelerator\"=dword:00000000\r\n;b %R:1708% *\r\n\"DisableOfficeHotkeys\"=dword:00000000\r\n;b %R:1709% *\r\n\"DisableWinFHotkey\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]\r\n;c 6 %R:1715%\r\n;x 256 %R:1716%\r\n;x 1 %R:1717%\r\n;x 16 %R:1718%\r\n;x 64 %R:1719%\r\n;x 2 %R:1720%\r\n;x 4 %R:1721%\r\n\"Start_PowerButtonAction\"=dword:00000002\r\n;s LogonLogoffShutdownSounds LogonLogoffShutdownSoundsAvailable\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1727% *\r\n\"LogonLogoffShutdownSounds\"=dword:00000000\r\n;g LogonLogoffShutdownSounds\r\n;t %R:1722%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1723%\r\n\"DoNotRedirectSystemToSettingsApp\"=dword:00000000\r\n;b %R:1724%\r\n\"DoNotRedirectProgramsAndFeaturesToSettingsApp\"=dword:00000000\r\n;b %R:1725%\r\n\"DoNotRedirectDateAndTimeToSettingsApp\"=dword:00000000\r\n;b %R:1726%\r\n\"DoNotRedirectNotificationIconsToSettingsApp\"=dword:00000000\r\n\r\n\r\n;T %R:1801%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 3 %R:1802%\r\n;x 1 %R:1803%\r\n;x 0 %R:1804%\r\n;x 2 %R:1805%\r\n\"UpdatePolicy\"=dword:00000001\r\n;b %R:1806%\r\n\"UpdatePreferStaging\"=dword:00000000\r\n;b %R:1807%\r\n\"UpdateAllowDowngrades\"=dword:00000000\r\n;b %R:1817%\r\n\"UpdateUseLocal\"=dword:00000000\r\n;t %R:1808%\r\n;w %R:1809%\r\n;%R:1810%\r\n;github.com/valinet/ExplorerPatcher/releases/latest\r\n\"UpdateURL\"=\"\"\r\n;w %R:1811%\r\n;%R:1812%\r\n;api.github.com/repos/valinet/ExplorerPatcher/releases?per_page=1\r\n\"UpdateURLStaging\"=\"\"\r\n;y %R:1813%\r\n;;;EP_CHECK_FOR_UPDATES\r\n;y %R:1814%\r\n;;;EP_INSTALL_UPDATES\r\n;y %R:1815% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/blob/master/CHANGELOG.md\r\n;y %R:1816% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Configure-updates\r\n\r\n\r\n;T %R:1901%\r\n;e %R:1902%\r\n;y %R:1903% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/About-advanced-settings\r\n;q\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1904%\r\n\"AllocConsole\"=dword:00000000\r\n;b %R:1905%\r\n\"Memcheck\"=dword:00000000\r\n;b %R:1906%\r\n\"TaskbarAutohideOnDoubleClick\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Control Panel\\Desktop]\r\n;b %R:1907% *\r\n\"PaintDesktopVersion\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1908% *\r\n\"ClassicThemeMitigations\"=dword:00000000\r\n[-HKEY_CURRENT_USER\\Software\\Classes\\CLSID\\{1eeb5b5a-06fb-4732-96b3-975c0194eb39}\\InprocServer32]\r\n;d %R:1909% *\r\n@=\"\"\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;b %R:1910%\r\n\"NoPropertiesInContextMenu\"=dword:00000000\r\n;b %R:1911% *\r\n\"EnableSymbolDownload\"=dword:00000001\r\n;b %R:1912% *\r\n\"PinnedItemsActAsQuickLaunch\"=dword:00000000\r\n;b %R:1913% *\r\n\"RemoveExtraGapAroundPinnedItems\"=dword:00000000\r\n[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ExplorerPatcher]\r\n;b %R:1927% *\r\n\"XamlSounds\"=dword:00000000\r\n\r\n\r\n;T %R:2301%\r\n[HKEY_CURRENT_USER\\Software\\ExplorerPatcher]\r\n;z 10001 %R:1533%\r\n\"Language\"=dword:00000000\r\n;y %R:2011% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Settings-management\r\n;u %R:2012%\r\n;import\r\n;u %R:2013%\r\n;export\r\n;u %R:2015%\r\n;reset\r\n;u %R:2102%\r\n;uninstall\r\n\r\n\r\n;T %R:2001%\r\n;e %R:201%\r\n;e %VERSIONINFORMATIONSTRING%\r\n;t © 2006-2025 VALINET Solutions SRL. All rights reserved.\r\n;e\r\n;e %R:2003%\r\n;e %R:2004%\r\n;t %OSVERSIONSTRING%\r\n;y %R:2006% (https://github.com/valinet) 🡕\r\n;https://github.com/valinet\r\n;q\r\n;y %R:2007% (https://www.valinet.ro) 🡕\r\n;https://www.valinet.ro\r\n;y %R:2009% 🡕\r\n;https://github.com/valinet/ExplorerPatcher#donate\r\n;y %R:2010% 🡕\r\n;https://github.com/valinet/ExplorerPatcher/wiki/Frequently-asked-questions\r\n\r\n\r\n\r\n;f\r\n;u %R:2201% (*)\r\n;restart\r\n"
  },
  {
    "path": "ep_setup/ep_setup.c",
    "content": "#include <Windows.h>\r\n#pragma comment(linker,\"\\\"/manifestdependency:type='win32' \\\r\nname='Microsoft.Windows.Common-Controls' version='6.0.0.0' \\\r\nprocessorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\\\"\")\r\n#include <stdio.h>\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n#include \"resources/resource.h\"\r\n#include \"../ExplorerPatcher/utility.h\"\r\n#include \"../version.h\"\r\n#include <zlib.h>\r\n#include <minizip/unzip.h>\r\n#ifdef WITH_ENCRYPTION\r\n#include \"rijndael-alg-fst.c\" // Include the C file for __forceinline to work\r\n#endif\r\n#pragma comment(lib, \"zs.lib\")\r\n\r\nstatic UINT g_uFailureLine;\r\n\r\n#define CHECK_OK(x) ((!x && !g_uFailureLine) ? (g_uFailureLine = __LINE__) : (void)0, (x))\r\n\r\nBOOL SetupShortcut(BOOL bInstall, WCHAR* wszPath, WCHAR* wszArguments)\r\n{\r\n    WCHAR wszTitle[MAX_PATH];\r\n    ZeroMemory(wszTitle, MAX_PATH);\r\n    WCHAR wszExplorerPath[MAX_PATH];\r\n    ZeroMemory(wszExplorerPath, MAX_PATH);\r\n    GetSystemDirectoryW(wszExplorerPath, MAX_PATH);\r\n    wcscat_s(wszExplorerPath, MAX_PATH, L\"\\\\ExplorerFrame.dll\");\r\n    if (bInstall)\r\n    {\r\n        HMODULE hExplorerFrame = LoadLibraryExW(wszExplorerPath, NULL, LOAD_LIBRARY_AS_DATAFILE);\r\n        if (hExplorerFrame)\r\n        {\r\n            LoadStringW(hExplorerFrame, 50222, wszTitle, 260); // 726 = File Explorer\r\n            wchar_t* p = wcschr(wszTitle, L'(');\r\n            if (p)\r\n            {\r\n                p--;\r\n                if (*p == L' ')\r\n                {\r\n                    *p = 0;\r\n                }\r\n                else\r\n                {\r\n                    p++;\r\n                    *p = 0;\r\n                }\r\n            }\r\n            if (wszTitle[0] == 0)\r\n            {\r\n                wcscat_s(wszTitle, MAX_PATH, _T(PRODUCT_NAME));\r\n            }\r\n        }\r\n        else\r\n        {\r\n            wcscat_s(wszTitle, MAX_PATH, _T(PRODUCT_NAME));\r\n        }\r\n    }\r\n    BOOL bOk = FALSE;\r\n    WCHAR wszStartPrograms[MAX_PATH + 1];\r\n    ZeroMemory(wszStartPrograms, MAX_PATH + 1);\r\n    SHGetFolderPathW(NULL, CSIDL_COMMON_PROGRAMS, NULL, SHGFP_TYPE_CURRENT, wszStartPrograms);\r\n    wcscat_s(wszStartPrograms, MAX_PATH + 1, L\"\\\\\" _T(PRODUCT_NAME));\r\n    wszStartPrograms[wcslen(wszStartPrograms) + 1] = 0;\r\n    SHFILEOPSTRUCTW op;\r\n    ZeroMemory(&op, sizeof(SHFILEOPSTRUCTW));\r\n    op.wFunc = FO_DELETE;\r\n    op.pFrom = wszStartPrograms;\r\n    op.fFlags = FOF_NO_UI;\r\n    bOk = SHFileOperationW(&op);\r\n    bOk = !bOk;\r\n    if (bInstall)\r\n    {\r\n        if (!CreateDirectoryW(wszStartPrograms, NULL))\r\n        {\r\n            return FALSE;\r\n        }\r\n    }\r\n    else\r\n    {\r\n        return bOk;\r\n    }\r\n    wcscat_s(wszStartPrograms, MAX_PATH, L\"\\\\\");\r\n    wcscat_s(wszStartPrograms, MAX_PATH, wszTitle);\r\n    wcscat_s(wszStartPrograms, MAX_PATH, L\" (\");\r\n    wcscat_s(wszStartPrograms, MAX_PATH, _T(PRODUCT_NAME) L\").lnk\");\r\n    ZeroMemory(wszExplorerPath, MAX_PATH);\r\n    GetSystemDirectoryW(wszExplorerPath, MAX_PATH);\r\n    wcscat_s(wszExplorerPath, MAX_PATH, L\"\\\\shell32.dll\");\r\n    if (bInstall)\r\n    {\r\n        if (SUCCEEDED(CoInitialize(0)))\r\n        {\r\n            IShellLinkW* pShellLink = NULL;\r\n            if (SUCCEEDED(CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC, &IID_IShellLinkW, &pShellLink)))\r\n            {\r\n                pShellLink->lpVtbl->SetPath(pShellLink, wszPath);\r\n                pShellLink->lpVtbl->SetArguments(pShellLink, wszArguments);\r\n                pShellLink->lpVtbl->SetIconLocation(pShellLink, wszExplorerPath, 40 - 1);\r\n                PathRemoveFileSpecW(wszExplorerPath);\r\n                pShellLink->lpVtbl->SetWorkingDirectory(pShellLink, wszExplorerPath);\r\n                pShellLink->lpVtbl->SetDescription(pShellLink, _T(PRODUCT_NAME));\r\n\r\n                IPersistFile* pPersistFile = NULL;\r\n                if (SUCCEEDED(pShellLink->lpVtbl->QueryInterface(pShellLink, &IID_IPersistFile, &pPersistFile)))\r\n                {\r\n                    if (SUCCEEDED(pPersistFile->lpVtbl->Save(pPersistFile, wszStartPrograms, TRUE)))\r\n                    {\r\n                        bOk = TRUE;\r\n                    }\r\n                    pPersistFile->lpVtbl->Release(pPersistFile);\r\n                }\r\n                pShellLink->lpVtbl->Release(pShellLink);\r\n            }\r\n            CoUninitialize();\r\n        }\r\n    }\r\n    return bOk;\r\n}\r\n\r\nBOOL SetupUninstallEntry(BOOL bInstall, WCHAR* wszPath)\r\n{\r\n    DWORD dwLastError = ERROR_SUCCESS;\r\n    HKEY hKey = NULL;\r\n\r\n    if (bInstall)\r\n    {\r\n\r\n        if (!dwLastError)\r\n        {\r\n            dwLastError = RegCreateKeyExW(\r\n                HKEY_LOCAL_MACHINE,\r\n                L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\\" _T(EP_CLSID) L\"_\" _T(PRODUCT_NAME),\r\n                0,\r\n                NULL,\r\n                REG_OPTION_NON_VOLATILE,\r\n                KEY_WRITE | KEY_WOW64_64KEY,\r\n                NULL,\r\n                &hKey,\r\n                NULL\r\n            );\r\n            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n            {\r\n                hKey = NULL;\r\n            }\r\n            if (hKey)\r\n            {\r\n                if (!dwLastError)\r\n                {\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"UninstallString\",\r\n                        0,\r\n                        REG_SZ,\r\n                        (const BYTE*)wszPath,\r\n                        (DWORD)(wcslen(wszPath) + 1) * sizeof(wchar_t)\r\n                    );\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"DisplayName\",\r\n                        0,\r\n                        REG_SZ,\r\n                        (const BYTE*)_T(PRODUCT_NAME),\r\n                        (DWORD)(wcslen(_T(PRODUCT_NAME)) + 1) * sizeof(wchar_t)\r\n                    );\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"Publisher\",\r\n                        0,\r\n                        REG_SZ,\r\n                        (const BYTE*)_T(PRODUCT_PUBLISHER),\r\n                        (DWORD)(wcslen(_T(PRODUCT_PUBLISHER)) + 1) * sizeof(wchar_t)\r\n                    );\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    DWORD dw1 = TRUE;\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"NoModify\",\r\n                        0,\r\n                        REG_DWORD,\r\n                        (const BYTE*)&dw1,\r\n                        sizeof(DWORD)\r\n                    );\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    DWORD dw1 = TRUE;\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"NoRepair\",\r\n                        0,\r\n                        REG_DWORD,\r\n                        (const BYTE*)&dw1,\r\n                        sizeof(DWORD)\r\n                    );\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    PathRemoveFileSpecW(wszPath + 1);\r\n#if defined(_M_X64)\r\n                    wcscat_s(wszPath + 1, MAX_PATH - 2, L\"\\\\\" _T(PRODUCT_NAME) L\".amd64.dll\");\r\n#elif defined(_M_ARM64)\r\n                    wcscat_s(wszPath + 1, MAX_PATH - 2, L\"\\\\\" _T(PRODUCT_NAME) L\".arm64.dll\");\r\n#endif\r\n                    HMODULE hEP = LoadLibraryExW(wszPath + 1, NULL, LOAD_LIBRARY_AS_DATAFILE);\r\n                    if (hEP)\r\n                    {\r\n                        DWORD dwLeftMost = 0;\r\n                        DWORD dwSecondLeft = 0;\r\n                        DWORD dwSecondRight = 0;\r\n                        DWORD dwRightMost = 0;\r\n\r\n                        QueryVersionInfo(hEP, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\r\n\r\n                        WCHAR wszBuf[30];\r\n                        swprintf_s(wszBuf, 30, L\"%d.%d.%d.%d\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\r\n\r\n                        if (!dwLastError)\r\n                        {\r\n                            dwLastError = RegSetValueExW(\r\n                                hKey,\r\n                                L\"DisplayVersion\",\r\n                                0,\r\n                                REG_SZ,\r\n                                (const BYTE*)wszBuf,\r\n                                (DWORD)(wcslen(wszBuf) + 1) * sizeof(wchar_t)\r\n                            );\r\n                            if (!dwLastError)\r\n                            {\r\n                                dwLastError = RegSetValueExW(\r\n                                    hKey,\r\n                                    L\"VersionMajor\",\r\n                                    0,\r\n                                    REG_DWORD,\r\n                                    (const BYTE*)&dwSecondRight,\r\n                                    sizeof(DWORD)\r\n                                );\r\n                                if (!dwLastError)\r\n                                {\r\n                                    dwLastError = RegSetValueExW(\r\n                                        hKey,\r\n                                        L\"VersionMinor\",\r\n                                        0,\r\n                                        REG_DWORD,\r\n                                        (const BYTE*)&dwRightMost,\r\n                                        sizeof(DWORD)\r\n                                    );\r\n                                }\r\n                            }\r\n                        }\r\n\r\n                        FreeLibrary(hEP);\r\n                    }\r\n                }\r\n                if (!dwLastError)\r\n                {\r\n                    GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n                    wcscat_s(wszPath, MAX_PATH, L\"\\\\explorer.exe\");\r\n                    dwLastError = RegSetValueExW(\r\n                        hKey,\r\n                        L\"DisplayIcon\",\r\n                        0,\r\n                        REG_SZ,\r\n                        (const BYTE*)wszPath,\r\n                        (DWORD)((wcslen(wszPath) + 1) * sizeof(wchar_t))\r\n                    );\r\n                }\r\n                RegCloseKey(hKey);\r\n            }\r\n        }\r\n    }\r\n    else\r\n    {\r\n        if (!dwLastError)\r\n        {\r\n            dwLastError = RegOpenKeyW(\r\n                HKEY_LOCAL_MACHINE,\r\n                L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\\" _T(EP_CLSID) L\"_\" _T(PRODUCT_NAME),\r\n                &hKey\r\n            );\r\n            if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n            {\r\n                hKey = NULL;\r\n            }\r\n            if (hKey)\r\n            {\r\n                dwLastError = RegDeleteTreeW(hKey, NULL);\r\n                RegCloseKey(hKey);\r\n            }\r\n        }\r\n     }\r\n     return !dwLastError;\r\n}\r\n\r\ntypedef struct\r\n{\r\n    PBYTE base;\r\n    ZPOS64_T size;\r\n    ZPOS64_T curOffset;\r\n} MemoryBuffer;\r\n\r\nvoid MemoryBuffer_Destroy(MemoryBuffer** mem)\r\n{\r\n    if (*mem)\r\n    {\r\n        if ((*mem)->base)\r\n            free((*mem)->base);\r\n        free(*mem);\r\n        *mem = NULL;\r\n    }\r\n}\r\n\r\nvoidpf ZCALLBACK MemOpenFile(voidpf opaque, const void* filename, int mode)\r\n{\r\n    MemoryBuffer* pMem = (MemoryBuffer*)opaque;\r\n    return pMem;\r\n}\r\n\r\nuLong ZCALLBACK MemReadFile(voidpf opaque, voidpf stream, void* buf, uLong size)\r\n{\r\n    MemoryBuffer* pMem = (MemoryBuffer*)stream;\r\n    uLong toRead = size;\r\n\r\n    if (pMem->curOffset + toRead > pMem->size)\r\n    {\r\n        toRead = (uLong)(pMem->size - pMem->curOffset);\r\n    }\r\n\r\n    if (toRead > 0)\r\n    {\r\n        memcpy(buf, pMem->base + pMem->curOffset, toRead);\r\n        pMem->curOffset += toRead;\r\n    }\r\n\r\n    return toRead;\r\n}\r\n\r\nuLong ZCALLBACK MemWriteFile(voidpf opaque, voidpf stream, const void* buf, uLong size)\r\n{\r\n    return 0;\r\n}\r\n\r\nZPOS64_T ZCALLBACK MemTellFile(voidpf opaque, voidpf stream)\r\n{\r\n    MemoryBuffer* pMem = (MemoryBuffer*)stream;\r\n    return pMem->curOffset;\r\n}\r\n\r\nlong ZCALLBACK MemSeekFile(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)\r\n{\r\n    MemoryBuffer* pMem = (MemoryBuffer*)stream;\r\n    ZPOS64_T newOffset;\r\n\r\n    switch (origin)\r\n    {\r\n        case ZLIB_FILEFUNC_SEEK_CUR:\r\n            newOffset = pMem->curOffset + offset;\r\n            break;\r\n        case ZLIB_FILEFUNC_SEEK_END:\r\n            newOffset = pMem->size + offset;\r\n            break;\r\n        case ZLIB_FILEFUNC_SEEK_SET:\r\n            newOffset = offset;\r\n            break;\r\n        default:\r\n            return -1;\r\n    }\r\n\r\n    if (newOffset > pMem->size)\r\n    {\r\n        return -1;\r\n    }\r\n\r\n    pMem->curOffset = newOffset;\r\n    return 0;\r\n}\r\n\r\nint ZCALLBACK MemCloseFile(voidpf opaque, voidpf stream)\r\n{\r\n    return 0;\r\n}\r\n\r\nint ZCALLBACK MemErrorFile(voidpf opaque, voidpf stream)\r\n{\r\n    return 0;\r\n}\r\n\r\nvoid FillMemoryFileIOFunctions(zlib_filefunc64_def* pFileFunc, MemoryBuffer* pMem)\r\n{\r\n    pFileFunc->zopen64_file = MemOpenFile;\r\n    pFileFunc->zread_file = MemReadFile;\r\n    pFileFunc->zwrite_file = MemWriteFile;\r\n    pFileFunc->ztell64_file = MemTellFile;\r\n    pFileFunc->zseek64_file = MemSeekFile;\r\n    pFileFunc->zclose_file = MemCloseFile;\r\n    pFileFunc->zerror_file = MemErrorFile;\r\n    pFileFunc->opaque = pMem;\r\n}\r\n\r\n#define AES_KEYBITS\t\t\t\t256\r\n\r\n#define KEYLENGTH( keybits )\t\t( ( keybits ) / 8 )\r\n#define RKLENGTH( keybits )\t\t( ( keybits ) / 8 + 28 )\r\n#define NROUNDS( keybits )\t\t\t( ( keybits ) / 32 + 6 )\r\n\r\n#if defined(WITH_ENCRYPTION) && !defined(ZIP_ENCRYPTION_KEY)\r\n#define ZIP_ENCRYPTION_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r\n#endif\r\n\r\nunzFile LoadZipFileFromResources(MemoryBuffer** outMem)\r\n{\r\n    *outMem = NULL;\r\n\r\n    HRSRC hRsrc = FindResourceW(NULL, MAKEINTRESOURCE(IDR_EP_ZIP), RT_RCDATA);\r\n    if (!hRsrc)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n    HGLOBAL hGlobal = LoadResource(NULL, hRsrc);\r\n    if (!hGlobal)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n    PBYTE pRsrc = (PBYTE)LockResource(hGlobal);\r\n    DWORD cbRsrc = SizeofResource(NULL, hRsrc);\r\n    if (!pRsrc || !cbRsrc)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n#ifdef WITH_ENCRYPTION\r\n    if ((cbRsrc % 16) != 0)\r\n    {\r\n        return NULL;\r\n    }\r\n#endif\r\n\r\n    MemoryBuffer* pMem = (MemoryBuffer*)malloc(sizeof(MemoryBuffer));\r\n    if (!pMem)\r\n    {\r\n        return NULL;\r\n    }\r\n\r\n    pMem->base = (PBYTE)malloc(cbRsrc);\r\n    pMem->size = cbRsrc;\r\n    pMem->curOffset = 0;\r\n    if (!pMem->base)\r\n    {\r\n        free(pMem);\r\n        return NULL;\r\n    }\r\n\r\n    *outMem = pMem;\r\n\r\n#ifdef WITH_ENCRYPTION\r\n    BYTE keyBytes[32] = { ZIP_ENCRYPTION_KEY };\r\n\r\n    UINT rk[RKLENGTH(AES_KEYBITS)] = { 0 };\r\n    int nrounds = rijndaelKeySetupDec(rk, keyBytes, AES_KEYBITS);\r\n\r\n    // Decrypt the data a block at a time\r\n    for (UINT offset = 0; offset < cbRsrc; offset += 16)\r\n    {\r\n        rijndaelDecrypt(rk, nrounds, pRsrc + offset, pMem->base + offset);\r\n    }\r\n#else\r\n    memcpy(pMem->base, pRsrc, cbRsrc);\r\n#endif\r\n\r\n    zlib_filefunc64_def fileFunc = { 0 };\r\n    FillMemoryFileIOFunctions(&fileFunc, pMem);\r\n\r\n    return unzOpen2_64(NULL, &fileFunc);\r\n}\r\n\r\nint g_cleanupFileCounter = 1;\r\n\r\n// %APPDATA%\\ExplorerPatcher\\cleanup\\<PID>_<counter>.tmp\r\nBOOL StageFileForCleanup(const WCHAR* wszProblematicFilePath)\r\n{\r\n    WCHAR wszPath[MAX_PATH];\r\n    SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\ExplorerPatcher\\\\cleanup\");\r\n    CreateDirectoryW(wszPath, NULL);\r\n\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\");\r\n    WCHAR wszPID[10];\r\n    _itow_s(GetCurrentProcessId(), wszPID, ARRAYSIZE(wszPID), 10);\r\n    wcscat_s(wszPath, MAX_PATH, wszPID);\r\n    wcscat_s(wszPath, MAX_PATH, L\"_\");\r\n    WCHAR wszCounter[10];\r\n    _itow_s(g_cleanupFileCounter++, wszCounter, ARRAYSIZE(wszCounter), 10);\r\n    wcscat_s(wszPath, MAX_PATH, wszCounter);\r\n    wcscat_s(wszPath, MAX_PATH, L\".tmp\");\r\n\r\n    return MoveFileW(wszProblematicFilePath, wszPath);\r\n}\r\n\r\n__declspec(noinline) BOOL InstallResourceHelper(BOOL bInstall, HMODULE hModule, unzFile zipFile, const WCHAR* wszPath)\r\n{\r\n    WCHAR wszReplace[MAX_PATH];\r\n    wcscpy_s(wszReplace, MAX_PATH, wszPath);\r\n    PathRemoveExtensionW(wszReplace);\r\n    wcscat_s(wszReplace, MAX_PATH, L\".prev\");\r\n    BOOL bFileExists = PathFileExistsW(wszPath);\r\n    BOOL bPrevExists = PathFileExistsW(wszReplace);\r\n    if (bFileExists || bPrevExists)\r\n    {\r\n        BOOL bRet = !bPrevExists || DeleteFileW(wszReplace);\r\n        if (bRet || (!bRet && GetLastError() == ERROR_FILE_NOT_FOUND))\r\n        {\r\n            if (bFileExists && !DeleteFileW(wszPath) && !StageFileForCleanup(wszPath))\r\n            {\r\n                return FALSE;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            return FALSE;\r\n        }\r\n    }\r\n    if (!zipFile)\r\n    {\r\n        if (bInstall)\r\n        {\r\n            wchar_t path[MAX_PATH];\r\n            GetModuleFileNameW(hModule, path, MAX_PATH);\r\n            if (_wcsicmp(path, wszPath) != 0)\r\n            {\r\n                return CopyFileW(path, wszPath, FALSE);\r\n            }\r\n        }\r\n        return TRUE;\r\n    }\r\n\r\n    if (!bInstall)\r\n    {\r\n        return TRUE;\r\n    }\r\n\r\n    unz_file_info64 fileInfo = { 0 };\r\n    // Caller (InstallResource) has already called unzOpenCurrentFile\r\n    if (unzGetCurrentFileInfo64(zipFile, &fileInfo, NULL, 0, NULL, 0, NULL, 0) != UNZ_OK)\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    BOOL bRet = FALSE;\r\n    void* pRscr = malloc(fileInfo.uncompressed_size);\r\n    DWORD cbRscr = (DWORD)fileInfo.uncompressed_size;\r\n    if (pRscr)\r\n    {\r\n        if (unzReadCurrentFile(zipFile, pRscr, cbRscr) == cbRscr)\r\n        {\r\n            HANDLE hFile = CreateFileW(wszPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\r\n            if (hFile)\r\n            {\r\n                DWORD dwNumberOfBytesWritten = 0;\r\n                int offset = 0;\r\n                wchar_t wszDxgi[MAX_PATH];\r\n                if (GetWindowsDirectoryW(wszDxgi, MAX_PATH))\r\n                {\r\n                    wcscat_s(wszDxgi, MAX_PATH, L\"\\\\dxgi.dll\");\r\n                    if (!wcscmp(wszPath, wszDxgi))\r\n                    {\r\n                        WCHAR wszOwnPath[MAX_PATH];\r\n                        GetModuleFileNameW(GetModuleHandle(NULL), wszOwnPath, MAX_PATH);\r\n                        CHAR hash[100];\r\n                        GetHardcodedHash(wszOwnPath, hash, 100);\r\n                        WriteFile(hFile, pRscr, DOSMODE_OFFSET, &dwNumberOfBytesWritten, NULL);\r\n                        offset += dwNumberOfBytesWritten;\r\n                        WriteFile(hFile, hash, 32, &dwNumberOfBytesWritten, NULL);\r\n                        offset += dwNumberOfBytesWritten;\r\n                    }\r\n                }\r\n                bRet = WriteFile(hFile, (char*)pRscr + offset, cbRscr - offset, &dwNumberOfBytesWritten, NULL);\r\n                CloseHandle(hFile);\r\n            }\r\n        }\r\n        free(pRscr);\r\n    }\r\n    // Caller (InstallResource) will call unzCloseCurrentFile\r\n    return bRet;\r\n}\r\n\r\n__declspec(noinline) BOOL InstallResource(BOOL bInstall, HMODULE hInstance, unzFile zipFile, const char* pszFileNameInZip, LPCWSTR pwszDirectory, LPCWSTR pwszFileName)\r\n{\r\n    if (bInstall && zipFile && pszFileNameInZip)\r\n    {\r\n        int resultLocateFile = unzLocateFile(zipFile, pszFileNameInZip, 0);\r\n        if (resultLocateFile != UNZ_OK)\r\n        {\r\n            return resultLocateFile == UNZ_END_OF_LIST_OF_FILE; // Don't touch this file, we don't pack this file in the setup\r\n        }\r\n\r\n        if (unzOpenCurrentFile(zipFile) != UNZ_OK)\r\n        {\r\n            return FALSE;\r\n        }\r\n    }\r\n\r\n    WCHAR wszPath[MAX_PATH];\r\n    wcscpy_s(wszPath, MAX_PATH, pwszDirectory);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\");\r\n    wcscat_s(wszPath, MAX_PATH, pwszFileName);\r\n    BOOL bRet = InstallResourceHelper(bInstall, hInstance, zipFile, wszPath);\r\n    if (bInstall && zipFile && pszFileNameInZip)\r\n        unzCloseCurrentFile(zipFile);\r\n    return bRet;\r\n}\r\n\r\nconst WCHAR* GetSystemLanguages()\r\n{\r\n    wchar_t* wszLanguagesBuffer = NULL;\r\n    ULONG ulNumLanguages = 0;\r\n    ULONG cchLanguagesBuffer = 0;\r\n    if (GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, NULL, &cchLanguagesBuffer))\r\n    {\r\n        wszLanguagesBuffer = (wchar_t*)malloc(cchLanguagesBuffer * sizeof(wchar_t));\r\n        if (wszLanguagesBuffer)\r\n        {\r\n            if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &ulNumLanguages, wszLanguagesBuffer, &cchLanguagesBuffer))\r\n            {\r\n                free(wszLanguagesBuffer);\r\n                wszLanguagesBuffer = NULL;\r\n            }\r\n        }\r\n    }\r\n    return wszLanguagesBuffer ? wszLanguagesBuffer : L\"en-US\";\r\n}\r\n\r\nBOOL SystemHasLanguageInstalled(const WCHAR* languages, const char* langCode, int cchLangCode)\r\n{\r\n    WCHAR szLangCode[100];\r\n    MultiByteToWideChar(CP_UTF8, 0, langCode, cchLangCode, szLangCode, ARRAYSIZE(szLangCode));\r\n    szLangCode[cchLangCode] = 0;\r\n    for (const WCHAR* wszLang = languages; *wszLang; wszLang += wcslen(wszLang) + 1)\r\n    {\r\n        if (!_wcsicmp(wszLang, szLangCode))\r\n        {\r\n            return TRUE;\r\n        }\r\n    }\r\n    return FALSE;\r\n}\r\n\r\ntypedef enum LanguageCodeTreatment\r\n{\r\n    LCT_None,\r\n    LCT_MUI, // module\\en-US\\module.dll.pri\r\n    LCT_PRI, // resource\\pris\\resource.en-US.pri\r\n} LanguageCodeTreatment;\r\n\r\n__declspec(noinline) BOOL ExtractDirectory(unzFile zipFile, const char* dirNameInZip, LPCWSTR pwszDirectory, const WCHAR* languages, LanguageCodeTreatment langCodeTreatment)\r\n{\r\n    if (!zipFile)\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    if (unzGoToFirstFile(zipFile) != UNZ_OK)\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    BOOL bRet = TRUE;\r\n    size_t dirNameLen = dirNameInZip ? strlen(dirNameInZip) : 0;\r\n\r\n    do\r\n    {\r\n        char szFileNameInZip[260];\r\n        unz_file_info64 fileInfo = { 0 };\r\n        if (unzGetCurrentFileInfo64(zipFile, &fileInfo, szFileNameInZip, ARRAYSIZE(szFileNameInZip), NULL, 0, NULL, 0) != UNZ_OK)\r\n        {\r\n            return FALSE;\r\n        }\r\n        szFileNameInZip[fileInfo.size_filename] = 0;\r\n\r\n        if (fileInfo.uncompressed_size == 0 || (fileInfo.external_fa & FILE_ATTRIBUTE_DIRECTORY) != 0)\r\n        {\r\n            continue;\r\n        }\r\n\r\n        if (dirNameInZip && strncmp(szFileNameInZip, dirNameInZip, dirNameLen) != 0)\r\n        {\r\n            continue;\r\n        }\r\n\r\n        // Examples:\r\n        // - \"module/en-US/module.dll.mui\" -> \"en-US/module.dll.mui\"\r\n        // - \"resource/pris/resource.en-US.pri\" -> \"pris/resource.en-US.pri\"\r\n        const char* filePathInDir = szFileNameInZip + dirNameLen;\r\n        const char* lastSlash = strrchr(filePathInDir, '/');\r\n        const char* fileName = lastSlash ? filePathInDir + (lastSlash - filePathInDir) + 1 : filePathInDir;\r\n        const char* lastDot = strrchr(fileName, '.');\r\n        const char* fileExt = lastDot ? fileName + (lastDot - fileName) + 1 : NULL;\r\n        if (langCodeTreatment == LCT_MUI)\r\n        {\r\n            if (fileExt && !_stricmp(fileExt, \"mui\"))\r\n            {\r\n                if (!SystemHasLanguageInstalled(languages, filePathInDir, (int)(strchr(filePathInDir, '/') - filePathInDir)))\r\n                {\r\n                    continue;\r\n                }\r\n            }\r\n        }\r\n        else if (langCodeTreatment == LCT_PRI)\r\n        {\r\n            if (fileExt && !_stricmp(fileExt, \"pri\") && strchr(fileName, '-') != NULL)\r\n            {\r\n                // Check if we're a language pri\r\n                const char* secondLastDot = NULL;\r\n                for (const char* p = lastDot - 1; p >= fileName; p--)\r\n                {\r\n                    if (*p == '.')\r\n                    {\r\n                        secondLastDot = p;\r\n                        break;\r\n                    }\r\n                }\r\n                if (secondLastDot != lastDot)\r\n                {\r\n                    const char* langCode = secondLastDot + 1;\r\n                    if (!SystemHasLanguageInstalled(languages, langCode, (int)(lastDot - langCode)))\r\n                    {\r\n                        continue;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        if (unzOpenCurrentFile(zipFile) != UNZ_OK)\r\n        {\r\n            return FALSE;\r\n        }\r\n\r\n        WCHAR wszFileNameInZip[MAX_PATH];\r\n        MultiByteToWideChar(CP_UTF8, 0, szFileNameInZip, -1, wszFileNameInZip, MAX_PATH);\r\n        for (size_t i = 0; i < MAX_PATH && wszFileNameInZip[i] != 0; i++)\r\n        {\r\n            if (wszFileNameInZip[i] == '/')\r\n            {\r\n                wszFileNameInZip[i] = '\\\\';\r\n            }\r\n        }\r\n\r\n        WCHAR wszPath[MAX_PATH];\r\n        wcscpy_s(wszPath, MAX_PATH, pwszDirectory);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\\");\r\n        WCHAR* pwszPathInDir = wszPath + wcslen(wszPath);\r\n        if (dirNameInZip)\r\n        {\r\n            wcscat_s(wszPath, MAX_PATH, wcschr(wszFileNameInZip, '\\\\') + 1); // Skip the directory name in the zip file\r\n        }\r\n        else\r\n        {\r\n            wcscat_s(wszPath, MAX_PATH, wszFileNameInZip);\r\n        }\r\n\r\n        for (WCHAR* p = pwszPathInDir; *p; p++)\r\n        {\r\n            if (*p == '\\\\')\r\n            {\r\n                *p = 0;\r\n                CreateDirectoryW(wszPath, NULL);\r\n                *p = '\\\\';\r\n            }\r\n        }\r\n\r\n        bRet = InstallResourceHelper(TRUE, NULL, zipFile, wszPath);\r\n\r\n        unzCloseCurrentFile(zipFile);\r\n    } while (bRet && unzGoToNextFile(zipFile) == UNZ_OK);\r\n\r\n    return bRet;\r\n}\r\n\r\nBOOL DeleteResource(LPCWSTR pwszDirectory, LPCWSTR pwszFileName)\r\n{\r\n    WCHAR wszPath[MAX_PATH];\r\n    wcscpy_s(wszPath, MAX_PATH, pwszDirectory);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\");\r\n    wcscat_s(wszPath, MAX_PATH, pwszFileName);\r\n    return InstallResourceHelper(FALSE, NULL, NULL, wszPath);\r\n}\r\n\r\n/*BOOL ShouldDownloadOrDelete(BOOL bInstall, WCHAR* wszPath, LPCSTR chash)\r\n{\r\n    if (FileExistsW(wszPath))\r\n    {\r\n        if (bInstall)\r\n        {\r\n            char hash[100];\r\n            ZeroMemory(hash, sizeof(char) * 100);\r\n            ComputeFileHash(wszPath, hash, 100);\r\n            bInstall = _stricmp(hash, chash) != 0;\r\n        }\r\n        else\r\n        {\r\n            InstallResourceHelper(FALSE, NULL, NULL, wszPath); // Delete\r\n        }\r\n    }\r\n\r\n    return bInstall;\r\n}\r\n\r\nBOOL DownloadResource(BOOL bInstall, LPCWSTR pwszURL, DWORD dwSize, LPCSTR chash, LPCWSTR pwszDirectory, LPCWSTR pwszFileName)\r\n{\r\n    BOOL bOk = TRUE;\r\n    WCHAR wszPath[MAX_PATH];\r\n    wcscpy_s(wszPath, MAX_PATH, pwszDirectory);\r\n    wcscat_s(wszPath, MAX_PATH, L\"\\\\\");\r\n    wcscat_s(wszPath, MAX_PATH, pwszFileName);\r\n    if (ShouldDownloadOrDelete(bInstall, wszPath, chash) && IsConnectedToInternet() == TRUE)\r\n    {\r\n        bOk = DownloadFile(pwszURL, dwSize, wszPath);\r\n    }\r\n    return bOk;\r\n}*/\r\n\r\nvoid ProcessTaskbarDlls(BOOL* bInOutOk, BOOL bInstall, BOOL bExtractMode, HINSTANCE hInstance, unzFile zipFile, WCHAR wszPath[260])\r\n{\r\n    LPCWSTR pwszTaskbarDllName = bExtractMode ? NULL : PickTaskbarDll();\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.0.dll\")), hInstance, zipFile, \"ep_taskbar.0.dll\", wszPath, L\"ep_taskbar.0.dll\");\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.1.dll\")), hInstance, zipFile, \"ep_taskbar.1.dll\", wszPath, L\"ep_taskbar.1.dll\");\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.2.dll\")), hInstance, zipFile, \"ep_taskbar.2.dll\", wszPath, L\"ep_taskbar.2.dll\");\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.3.dll\")), hInstance, zipFile, \"ep_taskbar.3.dll\", wszPath, L\"ep_taskbar.3.dll\");\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.4.dll\")), hInstance, zipFile, \"ep_taskbar.4.dll\", wszPath, L\"ep_taskbar.4.dll\");\r\n    if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L\"ep_taskbar.5.dll\")), hInstance, zipFile, \"ep_taskbar.5.dll\", wszPath, L\"ep_taskbar.5.dll\");\r\n}\r\n\r\nBOOL RemoveDirectoryRecursive(const WCHAR* wszDirectoryPath)\r\n{\r\n    WCHAR szDir[MAX_PATH];\r\n    wcscpy_s(szDir, MAX_PATH, wszDirectoryPath);\r\n    wcscat_s(szDir, MAX_PATH, L\"\\\\*\");\r\n\r\n    WIN32_FIND_DATA findFileData;\r\n    HANDLE hFind = FindFirstFileW(szDir, &findFileData);\r\n\r\n    if (hFind == INVALID_HANDLE_VALUE)\r\n    {\r\n        return TRUE;\r\n    }\r\n\r\n    do\r\n    {\r\n        if (lstrcmpW(findFileData.cFileName, L\".\") != 0 && lstrcmpW(findFileData.cFileName, L\"..\") != 0)\r\n        {\r\n            WCHAR szFilePath[MAX_PATH];\r\n            wcscpy_s(szFilePath, MAX_PATH, wszDirectoryPath);\r\n            wcscat_s(szFilePath, MAX_PATH, L\"\\\\\");\r\n            wcscat_s(szFilePath, MAX_PATH, findFileData.cFileName);\r\n\r\n            if ((findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)\r\n            {\r\n                if (!RemoveDirectoryRecursive(szFilePath))\r\n                {\r\n                    FindClose(hFind);\r\n                    return FALSE;\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (!DeleteFileW(szFilePath) && !StageFileForCleanup(szFilePath))\r\n                {\r\n                    FindClose(hFind);\r\n                    return FALSE;\r\n                }\r\n            }\r\n        }\r\n    }\r\n    while (FindNextFileW(hFind, &findFileData));\r\n\r\n    DWORD dwError = GetLastError();\r\n    FindClose(hFind);\r\n\r\n    if (dwError != ERROR_NO_MORE_FILES)\r\n    {\r\n        return FALSE;\r\n    }\r\n\r\n    return RemoveDirectoryW(wszDirectoryPath);\r\n}\r\n\r\n\r\nint WINAPI wWinMain(\r\n    _In_ HINSTANCE hInstance,\r\n    _In_opt_ HINSTANCE hPrevInstance,\r\n    _In_ LPWSTR lpCmdLine,\r\n    _In_ int nShowCmd\r\n)\r\n{\r\n    global_ubr = VnGetOSVersionAndUBR(&global_rovi);\r\n\r\n    BOOL bOk = TRUE, bInstall = TRUE, bWasShellExt = FALSE, bIsUpdate = FALSE, bForcePromptForUninstall = FALSE;\r\n\r\n    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);\r\n\r\n    int argc = 0;\r\n    LPWSTR* wargv = CommandLineToArgvW(\r\n        lpCmdLine,\r\n        &argc\r\n    );\r\n\r\n    WCHAR wszPath[MAX_PATH];\r\n    ZeroMemory(wszPath, MAX_PATH * sizeof(WCHAR));\r\n\r\n    if (argc >= 1 && !_wcsicmp(wargv[0], L\"/extract\"))\r\n    {\r\n        if (argc >= 2)\r\n        {\r\n            wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH);\r\n            CreateDirectoryW(wargv[1], NULL);\r\n        }\r\n        else\r\n        {\r\n            GetCurrentDirectoryW(MAX_PATH, wszPath);\r\n        }\r\n        MemoryBuffer* pMem;\r\n        unzFile zipFile = LoadZipFileFromResources(&pMem);\r\n        bOk = zipFile != NULL;\r\n        if (bOk)\r\n        {\r\n            bOk = ExtractDirectory(zipFile, NULL, wszPath, NULL, LCT_None);\r\n        }\r\n        if (zipFile)\r\n            unzClose(zipFile);\r\n        if (pMem)\r\n            MemoryBuffer_Destroy(&pMem);\r\n        return !bOk;\r\n    }\r\n\r\n#if defined(_M_X64)\r\n    typedef BOOL (WINAPI *IsWow64Process2_t)(HANDLE hProcess, USHORT* pProcessMachine, USHORT* pNativeMachine);\r\n    IsWow64Process2_t pfnIsWow64Process2 = (IsWow64Process2_t)GetProcAddress(GetModuleHandleW(L\"kernel32.dll\"), \"IsWow64Process2\");\r\n    if (pfnIsWow64Process2)\r\n    {\r\n        USHORT processMachine, nativeMachine;\r\n        if (pfnIsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine))\r\n        {\r\n            if (nativeMachine == IMAGE_FILE_MACHINE_ARM64)\r\n            {\r\n                WCHAR szFormat[256];\r\n                szFormat[0] = 0;\r\n                int written = LoadStringW(hInstance, IDS_SETUP_UNSUPPORTED_ARCH, szFormat, ARRAYSIZE(szFormat));\r\n                if (written > 0 && written < ARRAYSIZE(szFormat))\r\n                {\r\n                    WCHAR szMessage[256];\r\n                    szMessage[0] = 0;\r\n                    _swprintf_p(szMessage, ARRAYSIZE(szMessage), szFormat, L\"ARM64\", L\"x64\");\r\n                    MessageBoxW(NULL, szMessage, _T(PRODUCT_NAME), MB_OK | MB_ICONERROR);\r\n                }\r\n                exit(0);\r\n            }\r\n        }\r\n    }\r\n#endif\r\n\r\n    WCHAR wszOwnPath[MAX_PATH];\r\n    ZeroMemory(wszOwnPath, ARRAYSIZE(wszOwnPath));\r\n    if (!GetModuleFileNameW(NULL, wszOwnPath, ARRAYSIZE(wszOwnPath)))\r\n    {\r\n        exit(0);\r\n    }\r\n\r\n    bInstall = !(argc >= 1 && (!_wcsicmp(wargv[0], L\"/uninstall\") || !_wcsicmp(wargv[0], L\"/uninstall_silent\")));\r\n    PathStripPathW(wszOwnPath);\r\n    if (!_wcsicmp(wszOwnPath, L\"ep_uninstall.exe\"))\r\n    {\r\n        bInstall = FALSE;\r\n        bForcePromptForUninstall = _wcsicmp(wargv[0], L\"/uninstall_silent\");\r\n    }\r\n    if (!GetModuleFileNameW(NULL, wszOwnPath, ARRAYSIZE(wszOwnPath)))\r\n    {\r\n        exit(0);\r\n    }\r\n    bIsUpdate = (argc >= 1 && !_wcsicmp(wargv[0], L\"/update_silent\"));\r\n    if (!bInstall && (!_wcsicmp(wargv[0], L\"/uninstall\") || bForcePromptForUninstall))\r\n    {\r\n        wchar_t mbText[256];\r\n        mbText[0] = 0;\r\n        LoadStringW(hInstance, IDS_SETUP_UNINSTALL_PROMPT, mbText, ARRAYSIZE(mbText));\r\n        if (MessageBoxW(NULL, mbText, _T(PRODUCT_NAME), MB_YESNO | MB_DEFBUTTON2 | MB_ICONQUESTION) == IDNO)\r\n        {\r\n            exit(0);\r\n        }\r\n    }\r\n\r\n    if (!IsAppRunningAsAdminMode())\r\n    {\r\n        SHELLEXECUTEINFOW sei;\r\n        ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n        sei.cbSize = sizeof(sei);\r\n        sei.lpVerb = L\"runas\";\r\n        sei.lpFile = wszOwnPath;\r\n        sei.lpParameters = !bInstall ? L\"/uninstall_silent\" : lpCmdLine;\r\n        sei.hwnd = NULL;\r\n        sei.nShow = SW_NORMAL;\r\n        if (!ShellExecuteExW(&sei))\r\n        {\r\n            DWORD dwError = GetLastError();\r\n            if (dwError == ERROR_CANCELLED)\r\n            {\r\n            }\r\n        }\r\n        exit(0);\r\n    }\r\n\r\n    MemoryBuffer* pMem = NULL;\r\n    unzFile zipFile = NULL;\r\n    if (bInstall)\r\n    {\r\n        zipFile = LoadZipFileFromResources(&pMem);\r\n        if (!zipFile)\r\n        {\r\n            exit(0);\r\n        }\r\n    }\r\n\r\n    DWORD bIsUndockingDisabled = FALSE, dwSize = sizeof(DWORD);\r\n    RegGetValueW(HKEY_LOCAL_MACHINE, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Shell\\\\Update\\\\Packages\", L\"UndockingDisabled\", RRF_RT_DWORD, NULL, &bIsUndockingDisabled, &dwSize);\r\n    if (bIsUndockingDisabled)\r\n    {\r\n        wchar_t mbText[256];\r\n        mbText[0] = 0;\r\n        LoadStringW(hInstance, bInstall ? IDS_SETUP_INSTALL_LOGOFF : IDS_SETUP_UNINSTALL_LOGOFF, mbText, ARRAYSIZE(mbText));\r\n        if (MessageBoxW(NULL, mbText, _T(PRODUCT_NAME), MB_YESNO | MB_DEFBUTTON1 | MB_ICONQUESTION) == IDYES)\r\n        {\r\n            RegDeleteKeyValueW(HKEY_LOCAL_MACHINE, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Shell\\\\Update\\\\Packages\", L\"UndockingDisabled\");\r\n        }\r\n        else\r\n        {\r\n            exit(0);\r\n        }\r\n    }\r\n\r\n    CreateEventW(NULL, FALSE, FALSE, _T(EP_SETUP_EVENTNAME));\r\n\r\n    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n    wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n    bOk = CreateDirectoryW(wszPath, NULL);\r\n    if (!bOk && GetLastError() == ERROR_ALREADY_EXISTS)\r\n    {\r\n        bOk = TRUE;\r\n    }\r\n    if (bOk)\r\n    {\r\n        HANDLE userToken = INVALID_HANDLE_VALUE;\r\n\r\n        HWND hShellTrayWnd = FindWindowW(L\"Shell_TrayWnd\", NULL);\r\n        if (hShellTrayWnd)\r\n        {\r\n            DWORD explorerProcessId = 0;\r\n            GetWindowThreadProcessId(hShellTrayWnd, &explorerProcessId);\r\n            if (explorerProcessId != 0)\r\n            {\r\n                HANDLE explorerProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, explorerProcessId);\r\n                if (explorerProcess != NULL)\r\n                {\r\n                    OpenProcessToken(explorerProcess, TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, &userToken);\r\n                    CloseHandle(explorerProcess);\r\n                }\r\n                if (userToken)\r\n                {\r\n                    HANDLE myToken = INVALID_HANDLE_VALUE;\r\n                    OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, &myToken);\r\n                    if (myToken != INVALID_HANDLE_VALUE)\r\n                    {\r\n                        DWORD cbSizeNeeded = 0;\r\n                        SetLastError(0);\r\n                        if (!GetTokenInformation(userToken, TokenUser, NULL, 0, &cbSizeNeeded) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)\r\n                        {\r\n                            TOKEN_USER* userTokenInfo = malloc(cbSizeNeeded);\r\n                            if (userTokenInfo)\r\n                            {\r\n                                if (GetTokenInformation(userToken, TokenUser, userTokenInfo, cbSizeNeeded, &cbSizeNeeded))\r\n                                {\r\n                                    cbSizeNeeded = 0;\r\n                                    SetLastError(0);\r\n                                    if (!GetTokenInformation(myToken, TokenUser, NULL, 0, &cbSizeNeeded) && GetLastError() == ERROR_INSUFFICIENT_BUFFER)\r\n                                    {\r\n                                        TOKEN_USER* myTokenInfo = malloc(cbSizeNeeded);\r\n                                        if (myTokenInfo)\r\n                                        {\r\n                                            if (GetTokenInformation(myToken, TokenUser, myTokenInfo, cbSizeNeeded, &cbSizeNeeded))\r\n                                            {\r\n                                                if (EqualSid(userTokenInfo->User.Sid, myTokenInfo->User.Sid))\r\n                                                {\r\n                                                    CloseHandle(userToken);\r\n                                                    userToken = INVALID_HANDLE_VALUE;\r\n                                                }\r\n                                            }\r\n                                            free(myTokenInfo);\r\n                                        }\r\n                                    }\r\n                                }\r\n                                free(userTokenInfo);\r\n                            }\r\n                        }\r\n                        CloseHandle(myToken);\r\n                    }\r\n                }\r\n            }\r\n            DWORD_PTR res = -1;\r\n            if (!SendMessageTimeoutW(hShellTrayWnd, 1460, 0, 0, SMTO_ABORTIFHUNG, 2000, &res) && res)\r\n            {\r\n                HANDLE hExplorerRestartThread = CreateThread(NULL, 0, BeginExplorerRestart, NULL, 0, NULL);\r\n                if (hExplorerRestartThread)\r\n                {\r\n                    WaitForSingleObject(hExplorerRestartThread, 2000);\r\n                    CloseHandle(hExplorerRestartThread);\r\n                    hExplorerRestartThread = NULL;\r\n                }\r\n                else\r\n                {\r\n                    BeginExplorerRestart(NULL);\r\n                }\r\n            }\r\n        }\r\n        Sleep(100);\r\n        GetSystemDirectoryW(wszPath, MAX_PATH);\r\n        wcscat_s(wszPath, MAX_PATH, L\"\\\\taskkill.exe\");\r\n        SHELLEXECUTEINFOW sei;\r\n        ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n        sei.cbSize = sizeof(sei);\r\n        sei.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n        sei.hwnd = NULL;\r\n        sei.hInstApp = NULL;\r\n        sei.lpVerb = NULL;\r\n        sei.lpFile = wszPath;\r\n        sei.lpParameters = L\"/f /im explorer.exe\";\r\n        sei.hwnd = NULL;\r\n        sei.nShow = SW_SHOWMINIMIZED;\r\n        if (ShellExecuteExW(&sei) && sei.hProcess)\r\n        {\r\n            WaitForSingleObject(sei.hProcess, INFINITE);\r\n            CloseHandle(sei.hProcess);\r\n        }\r\n\r\n        Sleep(500);\r\n\r\n        BOOL bAreRoundedCornersDisabled = FALSE;\r\n        HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, _T(EP_DWM_EVENTNAME));\r\n        if (h_exists)\r\n        {\r\n            bAreRoundedCornersDisabled = GetLastError() == ERROR_ALREADY_EXISTS;\r\n            CloseHandle(h_exists);\r\n        }\r\n        else\r\n        {\r\n            bAreRoundedCornersDisabled = GetLastError() == ERROR_ACCESS_DENIED;\r\n        }\r\n        RegisterDWMService(0, 1);\r\n        if (bInstall && bAreRoundedCornersDisabled)\r\n        {\r\n            RegisterDWMService(0, 3);\r\n        }\r\n\r\n        WCHAR wszSCPath[MAX_PATH];\r\n        GetSystemDirectoryW(wszSCPath, MAX_PATH);\r\n        wcscat_s(wszSCPath, MAX_PATH, L\"\\\\sc.exe\");\r\n        SHELLEXECUTEINFOW ShExecInfo = { 0 };\r\n        ShExecInfo.cbSize = sizeof(ShExecInfo);\r\n        ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n        ShExecInfo.hwnd = NULL;\r\n        ShExecInfo.lpVerb = L\"runas\";\r\n        ShExecInfo.lpFile = wszSCPath;\r\n        ShExecInfo.lpParameters = L\"stop \" _T(EP_DWM_SERVICENAME);\r\n        ShExecInfo.lpDirectory = NULL;\r\n        ShExecInfo.nShow = SW_HIDE;\r\n        ShExecInfo.hInstApp = NULL;\r\n        if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)\r\n        {\r\n            WaitForSingleObject(ShExecInfo.hProcess, INFINITE);\r\n            DWORD dwExitCode = 0;\r\n            GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);\r\n            CloseHandle(ShExecInfo.hProcess);\r\n        }\r\n\r\n        HWND hWnd = FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), NULL);\r\n        if (hWnd)\r\n        {\r\n            DWORD dwGUIPid = 0;\r\n            GetWindowThreadProcessId(hWnd, &dwGUIPid);\r\n            if (dwGUIPid)\r\n            {\r\n                HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwGUIPid);\r\n                if (hProcess)\r\n                {\r\n                    DWORD dwSection = (DWORD)SendMessageW(hWnd, WM_MSG_GUI_SECTION, WM_MSG_GUI_SECTION_GET, 0);\r\n\r\n                    TerminateProcess(hProcess, 0);\r\n                    CloseHandle(hProcess);\r\n\r\n                    HKEY hKey = NULL;\r\n\r\n                    RegCreateKeyExW(\r\n                        HKEY_CURRENT_USER,\r\n                        TEXT(REGPATH),\r\n                        0,\r\n                        NULL,\r\n                        REG_OPTION_NON_VOLATILE,\r\n                        KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,\r\n                        NULL,\r\n                        &hKey,\r\n                        NULL\r\n                    );\r\n                    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n                    {\r\n                        hKey = NULL;\r\n                    }\r\n                    if (hKey)\r\n                    {\r\n                        RegSetValueExW(\r\n                            hKey,\r\n                            TEXT(\"OpenPropertiesAtNextStart\"),\r\n                            0,\r\n                            REG_DWORD,\r\n                            (const BYTE*)&dwSection,\r\n                            sizeof(DWORD)\r\n                        );\r\n                        RegCloseKey(hKey);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        Sleep(1000);\r\n\r\n        // --------------------------------------------------------------------------------\r\n\r\n        // C:\\Program Files\\ExplorerPatcher\r\n        SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n        wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n        if (CHECK_OK(bOk) && bInstall) bOk = InstallResource(bInstall, hInstance, NULL, NULL, wszPath, _T(SETUP_UTILITY_NAME));\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            if (!bInstall)\r\n            {\r\n                HKEY hKey;\r\n                RegOpenKeyExW(\r\n                    HKEY_LOCAL_MACHINE,\r\n                    L\"SOFTWARE\\\\Classes\\\\CLSID\\\\\" TEXT(EP_CLSID) L\"\\\\InProcServer32\",\r\n                    REG_OPTION_NON_VOLATILE,\r\n                    KEY_READ,\r\n                    &hKey\r\n                );\r\n                if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n                {\r\n                    hKey = NULL;\r\n                }\r\n                if (hKey)\r\n                {\r\n                    bWasShellExt = TRUE;\r\n                    RegCloseKey(hKey);\r\n                }\r\n                if (bWasShellExt)\r\n                {\r\n                    WCHAR wszArgs[MAX_PATH];\r\n                    wszArgs[0] = L'/';\r\n                    wszArgs[1] = L'u';\r\n                    wszArgs[2] = L' ';\r\n                    wszArgs[3] = L'\"';\r\n                    SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4);\r\n#if defined(_M_X64)\r\n                    wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".amd64.dll\\\"\");\r\n#elif defined(_M_ARM64)\r\n                    wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(PRODUCT_NAME) L\".arm64.dll\\\"\");\r\n#endif\r\n                    wprintf(L\"%s\\n\", wszArgs);\r\n                    WCHAR wszApp[MAX_PATH * 2];\r\n                    GetSystemDirectoryW(wszApp, MAX_PATH * 2);\r\n                    wcscat_s(wszApp, MAX_PATH * 2, L\"\\\\regsvr32.exe\");\r\n                    wprintf(L\"%s\\n\", wszApp);\r\n                    SHELLEXECUTEINFOW sei;\r\n                    ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n                    sei.cbSize = sizeof(sei);\r\n                    sei.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n                    sei.hwnd = NULL;\r\n                    sei.hInstApp = NULL;\r\n                    sei.lpVerb = NULL;\r\n                    sei.lpFile = wszApp;\r\n                    sei.lpParameters = wszArgs;\r\n                    sei.hwnd = NULL;\r\n                    sei.nShow = SW_NORMAL;\r\n                    if (ShellExecuteExW(&sei) && sei.hProcess)\r\n                    {\r\n                        WaitForSingleObject(sei.hProcess, INFINITE);\r\n                        DWORD dwExitCode = 0;\r\n                        GetExitCodeProcess(sei.hProcess, &dwExitCode);\r\n                        SetLastError(dwExitCode);\r\n                        CloseHandle(sei.hProcess);\r\n                    }\r\n                }\r\n            }\r\n        }\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".IA-32.dll\", wszPath, _T(PRODUCT_NAME) L\".IA-32.dll\");\r\n#if defined(_M_X64)\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".amd64.dll\", wszPath, _T(PRODUCT_NAME) L\".amd64.dll\");\r\n#elif defined(_M_ARM64)\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".arm64.dll\", wszPath, _T(PRODUCT_NAME) L\".arm64.dll\");\r\n#endif\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, \"ep_gui.dll\", wszPath, L\"ep_gui.dll\");\r\n        if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"ep_dwm.exe\"); // We renamed it to ep_dwm_svc.exe due to Microsoft imposing 24H2 upgrade blocks\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, \"ep_dwm_svc.exe\", wszPath, L\"ep_dwm_svc.exe\");\r\n        if (bInstall)\r\n        {\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, \"ep_weather_host.dll\", wszPath, L\"ep_weather_host.dll\");\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, \"ep_weather_host_stub.dll\", wszPath, L\"ep_weather_host_stub.dll\");\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, \"WebView2Loader.dll\", wszPath, L\"WebView2Loader.dll\");\r\n        }\r\n        ProcessTaskbarDlls(&bOk, bInstall, FALSE, hInstance, zipFile, wszPath);\r\n        const WCHAR* possibleDirs[] =\r\n        {\r\n            L\"ar-SA\", L\"bg-BG\", L\"ca-ES\", L\"cs-CZ\", L\"da-DK\", L\"de-DE\", L\"el-GR\", L\"en-GB\", L\"en-US\", L\"es-ES\",\r\n            L\"es-MX\", L\"et-EE\", L\"eu-ES\", L\"fi-FI\", L\"fr-CA\", L\"fr-FR\", L\"gl-ES\", L\"he-IL\", L\"hr-HR\", L\"hu-HU\",\r\n            L\"id-ID\", L\"it-IT\", L\"ja-JP\", L\"ko-KR\", L\"lt-LT\", L\"lv-LV\", L\"nb-NO\", L\"nl-NL\", L\"pl-PL\", L\"pt-BR\",\r\n            L\"pt-PT\", L\"ro-RO\", L\"ru-RU\", L\"sk-SK\", L\"sl-SI\", L\"sr-Latn-RS\", L\"sv-SE\", L\"th-TH\", L\"tr-TR\", L\"uk-UA\",\r\n            L\"vi-VN\", L\"zh-CN\", L\"zh-TW\", L\"pris\", L\"StartUI\",\r\n        };\r\n        for (size_t i = 0; CHECK_OK(bOk) && i < ARRAYSIZE(possibleDirs); i++)\r\n        {\r\n            WCHAR wszDirectoryPath[MAX_PATH];\r\n            wcscpy_s(wszDirectoryPath, MAX_PATH, wszPath);\r\n            wcscat_s(wszDirectoryPath, MAX_PATH, L\"\\\\\");\r\n            wcscat_s(wszDirectoryPath, MAX_PATH, possibleDirs[i]);\r\n            if (FileExistsW(wszDirectoryPath))\r\n            {\r\n                bOk = RemoveDirectoryRecursive(wszDirectoryPath);\r\n            }\r\n        }\r\n        DeleteResource(wszPath, L\"Windows.UI.ShellCommon.pri\");\r\n        BOOL bUnpackCustomStartUI = (global_rovi.dwBuildNumber >= 22621 && global_rovi.dwBuildNumber <= 22635) || global_rovi.dwBuildNumber >= 25169;\r\n        BOOL bNoPniduiInThisBuild = global_rovi.dwBuildNumber >= 25236;\r\n        if (bInstall)\r\n        {\r\n            const WCHAR* languages = GetSystemLanguages();\r\n            if (bNoPniduiInThisBuild)\r\n            {\r\n                if (CHECK_OK(bOk)) bOk = ExtractDirectory(zipFile, \"pnidui/\", wszPath, languages, LCT_MUI);\r\n            }\r\n            if (bUnpackCustomStartUI)\r\n            {\r\n                if (CHECK_OK(bOk)) bOk = ExtractDirectory(zipFile, \"Windows.UI.ShellCommon/\", wszPath, languages, LCT_PRI);\r\n            }\r\n        }\r\n\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall && bNoPniduiInThisBuild, hInstance, zipFile, \"pnidui/pnidui.dll\", wszPath, L\"pnidui.dll\");\r\n\r\n        if (CHECK_OK(bOk) && bNoPniduiInThisBuild)\r\n        {\r\n            // Windows Registry Editor Version 5.00\r\n            //\r\n            // [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellServiceObjects\\{C2796011-81BA-4148-8FCA-C6643245113F}]\r\n            // \"AutoStart\"=\"\"\r\n            if (bInstall)\r\n            {\r\n                HKEY hKey;\r\n                RegCreateKeyExW(\r\n                    HKEY_LOCAL_MACHINE,\r\n                    L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\ShellServiceObjects\\\\{C2796011-81BA-4148-8FCA-C6643245113F}\",\r\n                    0,\r\n                    NULL,\r\n                    REG_OPTION_NON_VOLATILE,\r\n                    KEY_READ | KEY_WRITE,\r\n                    NULL,\r\n                    &hKey,\r\n                    NULL\r\n                );\r\n                if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n                {\r\n                    hKey = NULL;\r\n                }\r\n                if (hKey)\r\n                {\r\n                    RegSetValueExW(hKey, L\"AutoStart\", 0, REG_SZ, (const BYTE*)L\"\", 1 * sizeof(WCHAR));\r\n                    RegCloseKey(hKey);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                RegDeleteKeyW(HKEY_LOCAL_MACHINE, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\ShellServiceObjects\\\\{C2796011-81BA-4148-8FCA-C6643245113F}\");\r\n            }\r\n        }\r\n\r\n        // --------------------------------------------------------------------------------\r\n\r\n        // C:\\Windows\r\n        // + dxgi.dll\r\n        if (CHECK_OK(bOk)) GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n#if defined(_M_X64)\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".amd64.dll\", wszPath, L\"dxgi.dll\");\r\n#elif defined(_M_ARM64)\r\n        if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".arm64.dll\", wszPath, L\"dxgi.dll\");\r\n#endif\r\n\r\n        // --------------------------------------------------------------------------------\r\n\r\n        // C:\\Windows\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\r\n        // + dxgi.dll\r\n        // + JumpViewUI_.dll (download, optional)\r\n        // + StartUI_.dll (download, optional)\r\n        // + wincorlib.dll\r\n        // + wincorlib_orig.dll (symlink)\r\n        // - AppResolverLegacy.dll\r\n        // - StartTileDataLegacy.dll\r\n        // - Windows.UI.ShellCommon.pri\r\n        // - en-US\\StartTileDataLegacy.dll.mui\r\n        // - pris2\\Windows.UI.ShellCommon.en-US.pri\r\n        if (CHECK_OK(bOk)) GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        if (CHECK_OK(bOk)) wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\");\r\n        if (CHECK_OK(bOk) && FileExistsW(wszPath))\r\n        {\r\n#if defined(_M_X64)\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".amd64.dll\", wszPath, L\"dxgi.dll\");\r\n#elif defined(_M_ARM64)\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".arm64.dll\", wszPath, L\"dxgi.dll\");\r\n#endif\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall && IsWindows11(), hInstance, zipFile, \"ep_startmenu.dll\", wszPath, L\"wincorlib.dll\");\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"wincorlib_orig.dll\");\r\n            if (CHECK_OK(bOk) && IsWindows11() && bInstall)\r\n            {\r\n                // Symlink wincorlib_orig.dll to wincorlib.dll in System32\r\n                WCHAR wszOrigPath[MAX_PATH];\r\n                GetSystemDirectoryW(wszOrigPath, MAX_PATH);\r\n                wcscat_s(wszOrigPath, MAX_PATH, L\"\\\\wincorlib.dll\");\r\n\r\n                WCHAR wszSymLinkPath[MAX_PATH];\r\n                wcscpy_s(wszSymLinkPath, MAX_PATH, wszPath);\r\n                wcscat_s(wszSymLinkPath, MAX_PATH, L\"\\\\wincorlib_orig.dll\");\r\n                bOk = CreateSymbolicLinkW(wszSymLinkPath, wszOrigPath, 0);\r\n            }\r\n\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall && bUnpackCustomStartUI, hInstance, zipFile, \"JumpViewUI/JumpViewUI.dll\", wszPath, L\"JumpViewUI_.dll\");\r\n            if (CHECK_OK(bOk)) bOk = InstallResource(bInstall && bUnpackCustomStartUI, hInstance, zipFile, \"StartUI/StartUI.dll\", wszPath, L\"StartUI_.dll\");\r\n\r\n            // Delete remnants from earlier versions\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"AppResolverLegacy.dll\");\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"StartTileDataLegacy.dll\");\r\n            if (CHECK_OK(bOk) && IsWindows11()) bOk = DeleteResource(wszPath, L\"Windows.UI.ShellCommon.pri\");\r\n\r\n            // .\\en-US\r\n            if (CHECK_OK(bOk) && IsWindows11())\r\n            {\r\n                WCHAR wszSubPath[MAX_PATH];\r\n                wcscpy_s(wszSubPath, MAX_PATH, wszPath);\r\n                wcscat_s(wszSubPath, MAX_PATH, L\"\\\\en-US\");\r\n                if (FileExistsW(wszSubPath))\r\n                {\r\n                    bOk = DeleteResource(wszSubPath, L\"StartTileDataLegacy.dll.mui\");\r\n                    if (CHECK_OK(bOk)) bOk = RemoveDirectoryW(wszSubPath);\r\n                }\r\n            }\r\n\r\n            // .\\pris2\r\n            if (CHECK_OK(bOk) && IsWindows11())\r\n            {\r\n                WCHAR wszSubPath[MAX_PATH];\r\n                wcscpy_s(wszSubPath, MAX_PATH, wszPath);\r\n                wcscat_s(wszSubPath, MAX_PATH, L\"\\\\pris2\");\r\n                if (FileExistsW(wszSubPath))\r\n                {\r\n                    bOk = DeleteResource(wszSubPath, L\"Windows.UI.ShellCommon.en-US.pri\");\r\n                    if (CHECK_OK(bOk)) bOk = RemoveDirectoryW(wszSubPath);\r\n                }\r\n            }\r\n\r\n            // End remnant deletion\r\n        }\r\n\r\n        // --------------------------------------------------------------------------------\r\n\r\n        // C:\\Windows\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy\r\n        // + dxgi.dll\r\n        if (CHECK_OK(bOk)) GetWindowsDirectoryW(wszPath, MAX_PATH);\r\n        if (CHECK_OK(bOk)) wcscat_s(wszPath, MAX_PATH, L\"\\\\SystemApps\\\\ShellExperienceHost_cw5n1h2txyewy\");\r\n        if (CHECK_OK(bOk) && FileExistsW(wszPath))\r\n        {\r\n#if defined(_M_X64)\r\n            if (CHECK_OK(bOk) && IsWindows11()) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".amd64.dll\", wszPath, L\"dxgi.dll\");\r\n#elif defined(_M_ARM64)\r\n            if (CHECK_OK(bOk) && IsWindows11()) bOk = InstallResource(bInstall, hInstance, zipFile, PRODUCT_NAME \".arm64.dll\", wszPath, L\"dxgi.dll\");\r\n#endif\r\n        }\r\n\r\n        // --------------------------------------------------------------------------------\r\n\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            GetSystemDirectoryW(wszPath, MAX_PATH);\r\n            WCHAR* pArgs = NULL;\r\n            DWORD dwLen = (DWORD)wcslen(wszPath);\r\n            wcscat_s(wszPath, MAX_PATH - dwLen, L\"\\\\rundll32.exe \\\"\");\r\n            dwLen = (DWORD)wcslen(wszPath);\r\n            pArgs = wszPath + dwLen - 2;\r\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath + dwLen);\r\n            wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\ep_gui.dll\\\",ZZGUI\");\r\n            pArgs[0] = 0;\r\n            bOk = SetupShortcut(bInstall, wszPath, pArgs + 1);\r\n            ZeroMemory(wszPath, MAX_PATH);\r\n        }\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            wszPath[0] = L'\"';\r\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath + 1);\r\n            wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\\" _T(SETUP_UTILITY_NAME) L\"\\\" /uninstall\");\r\n            bOk = SetupUninstallEntry(bInstall, wszPath);\r\n        }\r\n        ShExecInfo.lpParameters = bInstall ? L\"start \" _T(EP_DWM_SERVICENAME) : L\"delete \" _T(EP_DWM_SERVICENAME);\r\n        if (ShellExecuteExW(&ShExecInfo) && ShExecInfo.hProcess)\r\n        {\r\n            WaitForSingleObject(ShExecInfo.hProcess, INFINITE);\r\n            DWORD dwExitCode = 0;\r\n            GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);\r\n            CloseHandle(ShExecInfo.hProcess);\r\n        }\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            WCHAR wszArgs[MAX_PATH];\r\n            wszArgs[0] = L'/';\r\n            wszArgs[1] = L's';\r\n            wszArgs[2] = L' ';\r\n            wszArgs[3] = L'\"';\r\n            if (!bInstall)\r\n            {\r\n                wszArgs[3] = L'/';\r\n                wszArgs[4] = L'u';\r\n                wszArgs[5] = L' ';\r\n                wszArgs[6] = L'\"';\r\n            }\r\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4 + (bInstall ? 0 : 3));\r\n            wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\ep_weather_host.dll\\\"\");\r\n            wprintf(L\"%s\\n\", wszArgs);\r\n            WCHAR wszApp[MAX_PATH * 2];\r\n            GetSystemDirectoryW(wszApp, MAX_PATH * 2);\r\n            wcscat_s(wszApp, MAX_PATH * 2, L\"\\\\regsvr32.exe\");\r\n            wprintf(L\"%s\\n\", wszApp);\r\n            SHELLEXECUTEINFOW sei;\r\n            ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n            sei.cbSize = sizeof(sei);\r\n            sei.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n            sei.hwnd = NULL;\r\n            sei.hInstApp = NULL;\r\n            sei.lpVerb = NULL;\r\n            sei.lpFile = wszApp;\r\n            sei.lpParameters = wszArgs;\r\n            sei.hwnd = NULL;\r\n            sei.nShow = SW_NORMAL;\r\n            if (ShellExecuteExW(&sei) && sei.hProcess)\r\n            {\r\n                WaitForSingleObject(sei.hProcess, INFINITE);\r\n                DWORD dwExitCode = 0;\r\n                GetExitCodeProcess(sei.hProcess, &dwExitCode);\r\n                SetLastError(dwExitCode);\r\n                CloseHandle(sei.hProcess);\r\n            }\r\n        }\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            WCHAR wszArgs[MAX_PATH];\r\n            wszArgs[0] = L'/';\r\n            wszArgs[1] = L's';\r\n            wszArgs[2] = L' ';\r\n            wszArgs[3] = L'\"';\r\n            if (!bInstall)\r\n            {\r\n                wszArgs[3] = L'/';\r\n                wszArgs[4] = L'u';\r\n                wszArgs[5] = L' ';\r\n                wszArgs[6] = L'\"';\r\n            }\r\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4 + (bInstall ? 0 : 3));\r\n            wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L\"\\\\ep_weather_host_stub.dll\\\"\");\r\n            wprintf(L\"%s\\n\", wszArgs);\r\n            WCHAR wszApp[MAX_PATH * 2];\r\n            GetSystemDirectoryW(wszApp, MAX_PATH * 2);\r\n            wcscat_s(wszApp, MAX_PATH * 2, L\"\\\\regsvr32.exe\");\r\n            wprintf(L\"%s\\n\", wszApp);\r\n            SHELLEXECUTEINFOW sei;\r\n            ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));\r\n            sei.cbSize = sizeof(sei);\r\n            sei.fMask = SEE_MASK_NOCLOSEPROCESS;\r\n            sei.hwnd = NULL;\r\n            sei.hInstApp = NULL;\r\n            sei.lpVerb = NULL;\r\n            sei.lpFile = wszApp;\r\n            sei.lpParameters = wszArgs;\r\n            sei.hwnd = NULL;\r\n            sei.nShow = SW_NORMAL;\r\n            if (ShellExecuteExW(&sei) && sei.hProcess)\r\n            {\r\n                WaitForSingleObject(sei.hProcess, INFINITE);\r\n                DWORD dwExitCode = 0;\r\n                GetExitCodeProcess(sei.hProcess, &dwExitCode);\r\n                SetLastError(dwExitCode);\r\n                CloseHandle(sei.hProcess);\r\n            }\r\n        }\r\n        if (CHECK_OK(bOk) && bInstall)\r\n        {\r\n            HKEY hKey = NULL;\r\n            RegCreateKeyExW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Policies\\\\Microsoft\\\\Windows\\\\Explorer\", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hKey, NULL);\r\n            if (hKey && hKey != INVALID_HANDLE_VALUE)\r\n            {\r\n                RegCloseKey(hKey);\r\n            }\r\n            RegCreateKeyExW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Policies\\\\Explorer\", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hKey, NULL);\r\n            if (hKey && hKey != INVALID_HANDLE_VALUE)\r\n            {\r\n                RegCloseKey(hKey);\r\n            }\r\n        }\r\n        if (!bInstall)\r\n        {\r\n            SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n            wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"ep_weather_host.dll\");\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"ep_weather_host_stub.dll\");\r\n            if (CHECK_OK(bOk)) bOk = DeleteResource(wszPath, L\"WebView2Loader.dll\");\r\n        }\r\n\r\n        if (CHECK_OK(bOk))\r\n        {\r\n            if (!bInstall)\r\n            {\r\n                SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);\r\n                wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n                bOk = RemoveDirectoryRecursive(wszPath);\r\n            }\r\n            if (CHECK_OK(bOk) && (!bInstall || g_cleanupFileCounter > 1))\r\n            {\r\n                WCHAR wszDirToDelete[MAX_PATH];\r\n                SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wszDirToDelete);\r\n                wcscat_s(wszDirToDelete, MAX_PATH, _T(APP_RELATIVE_PATH));\r\n                if (bInstall)\r\n                {\r\n                    wcscat_s(wszDirToDelete, MAX_PATH, L\"\\\\cleanup\");\r\n                }\r\n\r\n                HKEY hKey = NULL;\r\n                RegCreateKeyExW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\RunOnce\", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &hKey, NULL);\r\n                if (hKey && hKey != INVALID_HANDLE_VALUE)\r\n                {\r\n                    WCHAR wszCommand[MAX_PATH];\r\n                    wcscpy_s(wszCommand, MAX_PATH, L\"cmd /c rmdir /s /q \\\"\");\r\n                    wcscat_s(wszCommand, MAX_PATH, wszDirToDelete);\r\n                    wcscat_s(wszCommand, MAX_PATH, L\"\\\"\");\r\n                    RegSetValueExW(hKey, L\"ExplorerPatcherCleanup\", 0, REG_SZ, (BYTE*)wszCommand, (DWORD)((wcslen(wszCommand) + 1) * sizeof(WCHAR)));\r\n                    RegCloseKey(hKey);\r\n                }\r\n            }\r\n            if (!bInstall)\r\n            {\r\n                wchar_t mbText[256];\r\n                mbText[0] = 0;\r\n                if (bWasShellExt)\r\n                {\r\n                    LoadStringW(hInstance, IDS_SETUP_UNINSTALL_RESTART, mbText, ARRAYSIZE(mbText));\r\n                    if (MessageBoxW(NULL, mbText, _T(PRODUCT_NAME), MB_YESNO | MB_DEFBUTTON1 | MB_ICONQUESTION) == IDYES)\r\n                    {\r\n                        SystemShutdown(TRUE);\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    LoadStringW(hInstance, IDS_SETUP_UNINSTALL_FINISH, mbText, ARRAYSIZE(mbText));\r\n                    MessageBoxW(NULL, mbText, _T(PRODUCT_NAME), MB_ICONASTERISK | MB_OK | MB_DEFBUTTON1);\r\n                }\r\n            }\r\n            else\r\n            {\r\n                if (bIsUpdate)\r\n                {\r\n                    HKEY hKey = NULL;\r\n                    DWORD dwSize = 0;\r\n\r\n                    RegCreateKeyExW(\r\n                        HKEY_CURRENT_USER,\r\n                        TEXT(REGPATH),\r\n                        0,\r\n                        NULL,\r\n                        REG_OPTION_NON_VOLATILE,\r\n                        KEY_READ | KEY_WOW64_64KEY | KEY_WRITE,\r\n                        NULL,\r\n                        &hKey,\r\n                        NULL\r\n                    );\r\n                    if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\r\n                    {\r\n                        hKey = NULL;\r\n                    }\r\n                    if (hKey)\r\n                    {\r\n                        dwSize = TRUE;\r\n                        RegSetValueExW(\r\n                            hKey,\r\n                            TEXT(\"IsUpdatePending\"),\r\n                            0,\r\n                            REG_DWORD,\r\n                            (const BYTE*)&dwSize,\r\n                            sizeof(DWORD)\r\n                        );\r\n                        RegCloseKey(hKey);\r\n                    }\r\n                }\r\n                //ZZRestartExplorer(0, 0, 0, 0);\r\n            }\r\n        }\r\n        if (!bOk) //  && !(argc >= 1 && !_wcsicmp(wargv[0], L\"/update_silent\"))\r\n        {\r\n            wchar_t mbText[1024];\r\n            mbText[0] = 0;\r\n            LoadStringW(hInstance, IDS_SETUP_FAILED, mbText, ARRAYSIZE(mbText));\r\n            wchar_t szDblNewlineAndLineNumber[32];\r\n            swprintf_s(szDblNewlineAndLineNumber, ARRAYSIZE(szDblNewlineAndLineNumber), L\"\\n\\n%d\", g_uFailureLine);\r\n            wcscat_s(mbText, ARRAYSIZE(mbText), szDblNewlineAndLineNumber);\r\n            MessageBoxW(NULL, mbText, _T(PRODUCT_NAME), MB_ICONERROR | MB_OK | MB_DEFBUTTON1);\r\n        }\r\n        if (bOk && bIsUndockingDisabled)\r\n        {\r\n            ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_FLAG_PLANNED);\r\n            exit(0);\r\n        }\r\n\r\n        StartExplorerWithDelay(1000, userToken);\r\n        if (userToken != INVALID_HANDLE_VALUE) CloseHandle(userToken);\r\n    }\r\n\r\n    if (zipFile)\r\n        unzClose(zipFile);\r\n    if (pMem)\r\n        MemoryBuffer_Destroy(&pMem);\r\n\r\n\treturn GetLastError();\r\n}\r\n"
  },
  {
    "path": "ep_setup/ep_setup.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{2fd40b09-f224-4e9a-b2fe-a22b50b2debf}</ProjectGuid>\r\n    <RootNamespace>epsetup</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n    <GitCommitHashShort>0000000</GitCommitHashShort>\r\n    <WithEncryption>false</WithEncryption>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;$(SolutionDir)libs\\zlib;$(SolutionDir)libs\\zlib\\contrib;$(SolutionDir)libs\\zlib\\build\\$(Platform);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalLibraryDirectories>$(SolutionDir)libs\\zlib\\build\\$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup>\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>EP_BUILD_SETUP;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(WithEncryption)' == 'true'\">\r\n    <ClCompile>\r\n      <PreprocessorDefinitions>WITH_ENCRYPTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='x64'\">\r\n    <ResourceCompile>\r\n      <PreprocessorDefinitions>PLATFORM_AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ResourceCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Platform)'=='ARM64'\">\r\n    <ResourceCompile>\r\n      <PreprocessorDefinitions>PLATFORM_ARM64;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ResourceCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\utility.c\" />\r\n    <ClCompile Include=\"ep_setup.c\" />\r\n    <ClCompile Include=\"..\\libs\\zlib\\contrib\\minizip\\ioapi.c\" />\r\n    <ClCompile Include=\"..\\libs\\zlib\\contrib\\minizip\\unzip.c\">\r\n      <PreprocessorDefinitions>NOCRYPT;NOUNCRYPT;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\utility.h\" />\r\n    <ClInclude Include=\"resources\\resource.h\" />\r\n    <ClInclude Include=\"rijndael-alg-fst.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"resources\\ep_setup.rc\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)'=='Debug'\">true</ExcludedFromBuild>\r\n    </ResourceCompile>\r\n    <ResourceCompile Include=\"resources\\ep_setup_debug.rc\">\r\n      <ExcludedFromBuild Condition=\"'$(Configuration)'=='Release'\">true</ExcludedFromBuild>\r\n    </ResourceCompile>\r\n    <ResourceCompile Include=\"resources\\lang\\ep_setup.*.rc\" />\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher-L10N\\resources\\lang\\ep_setup.*.rc\" Condition=\"Exists('..\\ExplorerPatcher-L10N\\resources\\lang')\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"applicat.bin\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <PackFile Include=\"resources\\files\\**\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\Win32\\ExplorerPatcher.IA-32.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\Win32\\ExplorerPatcher.IA-32.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\x64\\ExplorerPatcher.amd64.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\x64\\ExplorerPatcher.amd64.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\ARM64\\ExplorerPatcher.arm64.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\ARM64\\ExplorerPatcher.arm64.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\WebView2Loader.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\WebView2Loader.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_dwm_svc.exe\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_dwm_svc.exe')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_gui.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_gui.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_startmenu.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_startmenu.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.0.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.0.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.1.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.1.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.2.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.2.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.3.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.3.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.4.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.4.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.5.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_taskbar.5.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_weather_host.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_weather_host.dll')\" />\r\n    <PackFile Include=\"..\\build\\$(Configuration)\\$(Platform)\\ep_weather_host_stub.dll\" Condition=\"Exists('$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\ep_weather_host_stub.dll')\" />\r\n  </ItemGroup>\r\n  <Target Name=\"GetCommitHash\" AfterTargets=\"PrepareForBuild\">\r\n    <Exec Command=\"git rev-parse --short HEAD\" Condition=\"'$(GitCommitHashShort)' == '0000000'\">\r\n      <Output TaskParameter=\"ConsoleOutput\" PropertyName=\"GitCommitHashShort\" />\r\n    </Exec>\r\n    <Message Text=\"Git commit hash: $(GitCommitHashShort)\" />\r\n  </Target>\r\n  <UsingTask TaskName=\"GenerateAesKey\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.Core.dll\">\r\n    <ParameterGroup>\r\n      <Seed ParameterType=\"System.String\" Required=\"true\" />\r\n      <EncryptionKey ParameterType=\"System.String\" Output=\"true\" />\r\n      <EncryptionKeyCommaSeparated ParameterType=\"System.String\" Output=\"true\" />\r\n    </ParameterGroup>\r\n    <Task>\r\n      <Code Type=\"Fragment\" Language=\"cs\">\r\n        <![CDATA[\r\n          using (System.Security.Cryptography.SHA256 sha256 = System.Security.Cryptography.SHA256.Create())\r\n          {\r\n            byte[] seedBytes = System.Text.Encoding.UTF8.GetBytes(Seed);\r\n            byte[] hashBytes = sha256.ComputeHash(seedBytes);\r\n            Random random = new System.Random(System.BitConverter.ToInt32(hashBytes, 0));\r\n\r\n            byte[] keyBytes = new byte[32];\r\n            random.NextBytes(keyBytes);\r\n\r\n            EncryptionKey = System.BitConverter.ToString(keyBytes).Replace(\"-\", \"\").ToLowerInvariant();\r\n            EncryptionKeyCommaSeparated = \"0x\" + System.BitConverter.ToString(keyBytes).Replace(\"-\", \",0x\");\r\n          }\r\n        ]]>\r\n      </Code>\r\n    </Task>\r\n  </UsingTask>\r\n  <Target Name=\"GenerateAesKey\" AfterTargets=\"GetCommitHash\">\r\n    <GenerateAesKey Seed=\"$(GitCommitHashShort)\" Condition=\"'$(WithEncryption)' == 'true'\">\r\n      <Output TaskParameter=\"EncryptionKey\" PropertyName=\"ZipEncryptionKey\" />\r\n      <Output TaskParameter=\"EncryptionKeyCommaSeparated\" PropertyName=\"ZipEncryptionKeyCommaSeparated\" />\r\n    </GenerateAesKey>\r\n    <ItemGroup Condition=\"'$(WithEncryption)' == 'true'\">\r\n      <ClCompile>\r\n        <PreprocessorDefinitions>ZIP_ENCRYPTION_KEY=$(ZipEncryptionKeyCommaSeparated);%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      </ClCompile>\r\n    </ItemGroup>\r\n    <Message Text=\"Generated AES key: 0x$(ZipEncryptionKey)\" Condition=\"'$(WithEncryption)' == 'true'\" />\r\n  </Target>\r\n  <UsingTask TaskName=\"EncryptFile\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.Core.dll\">\r\n    <ParameterGroup>\r\n      <OutputFile ParameterType=\"System.String\" />\r\n      <EncryptionKey ParameterType=\"System.String\" />\r\n    </ParameterGroup>\r\n    <Task>\r\n      <Code Type=\"Fragment\" Language=\"cs\">\r\n        <![CDATA[\r\n          using (System.Security.Cryptography.Aes aes = System.Security.Cryptography.Aes.Create())\r\n          {\r\n            int numChars = EncryptionKey.Length;\r\n            byte[] keyBytes = new byte[numChars / 2];\r\n            for (int i = 0; i < numChars; i += 2)\r\n            {\r\n              keyBytes[i / 2] = System.Convert.ToByte(EncryptionKey.Substring(i, 2), 16);\r\n            }\r\n            aes.Key = keyBytes;\r\n            aes.Mode = System.Security.Cryptography.CipherMode.ECB;\r\n            using (System.IO.FileStream inputFileStream = new System.IO.FileStream(OutputFile, System.IO.FileMode.Open, System.IO.FileAccess.Read))\r\n            using (System.IO.FileStream outputFileStream = new System.IO.FileStream(OutputFile + \".bin\", System.IO.FileMode.Create, System.IO.FileAccess.Write))\r\n            using (System.Security.Cryptography.ICryptoTransform encryptor = aes.CreateEncryptor())\r\n            using (System.Security.Cryptography.CryptoStream cryptoStream = new System.Security.Cryptography.CryptoStream(outputFileStream, encryptor, System.Security.Cryptography.CryptoStreamMode.Write))\r\n            {\r\n              inputFileStream.CopyTo(cryptoStream);\r\n            }\r\n          }\r\n        ]]>\r\n      </Code>\r\n    </Task>\r\n  </UsingTask>\r\n  <Target Name=\"CreateZip\" BeforeTargets=\"ResourceCompile\">\r\n    <MakeDir Directories=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\pnidui\" DestinationFileName=\"pnidui.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/pnidui.dll/F717CABC20B000/pnidui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'x64'\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\pnidui\" DestinationFileName=\"pnidui.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/pnidui.dll/63AF842D210000/pnidui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'ARM64'\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\StartUI\" DestinationFileName=\"StartUI.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/startui.dll/C1AEED44852000/startui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'x64'\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\StartUI\" DestinationFileName=\"StartUI.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/startui.dll/122A50F3AB9000/startui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'ARM64'\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\JumpViewUI\" DestinationFileName=\"JumpViewUI.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/jumpviewui.dll/C814664216A000/jumpviewui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'x64'\" />\r\n    <DownloadFile DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\JumpViewUI\" DestinationFileName=\"JumpViewUI.dll\" SourceUrl=\"https://msdl.microsoft.com/download/symbols/jumpviewui.dll/45558FDB1E9000/jumpviewui.dll\" SkipUnchangedFiles=\"true\" Retries=\"3\" Condition=\"'$(Platform)' == 'ARM64'\" />\r\n    <Copy SourceFiles=\"@(PackFile)\" DestinationFolder=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\\%(RecursiveDir)\" />\r\n    <ZipDirectory SourceDirectory=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files\" DestinationFile=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files.zip\" Overwrite=\"true\" />\r\n    <EncryptFile OutputFile=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files.zip\" EncryptionKey=\"$(ZipEncryptionKey)\" Condition=\"'$(WithEncryption)' == 'true'\" />\r\n    <Copy SourceFiles=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files.zip\" DestinationFiles=\"..\\build\\$(Configuration)\\$(Platform)\\ep_setup_files.zip.bin\" Condition=\"'$(WithEncryption)' != 'true'\" />\r\n  </Target>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_setup/ep_setup.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_setup.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\utility.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"resource.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\utility.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ep_setup.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n    <ResourceCompile Include=\"ep_setup_debug.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"..\\build\\Release\\ExplorerPatcher.amd64.dll\" />\r\n    <None Include=\"..\\build\\Release\\ExplorerPatcher.IA-32.dll\" />\r\n    <None Include=\"applicat.bin\">\r\n      <Filter>Resource Files</Filter>\r\n    </None>\r\n    <None Include=\"..\\build\\Debug\\ExplorerPatcher.amd64.dll\" />\r\n    <None Include=\"..\\build\\Debug\\ExplorerPatcher.IA-32.dll\" />\r\n    <None Include=\"..\\build\\Release\\ep_dwm.exe\" />\r\n    <None Include=\"..\\build\\Debug\\ep_dwm.exe\" />\r\n    <None Include=\"..\\build\\Debug\\ep_weather_host.dll\" />\r\n    <None Include=\"..\\build\\Release\\ep_weather_host.dll\" />\r\n    <None Include=\"..\\build\\Release\\ep_weather_host_stub.dll\" />\r\n    <None Include=\"..\\build\\Debug\\ep_weather_host_stub.dll\" />\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_setup/resources/ep_setup.rc",
    "content": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 2 resource.\r\n//\r\n#include \"winres.h\"\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#undef APSTUDIO_READONLY_SYMBOLS\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n// English (United States) resources\r\n\r\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n#pragma code_page(1252)\r\n\r\n#ifdef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// TEXTINCLUDE\r\n//\r\n\r\n1 TEXTINCLUDE \r\nBEGIN\r\n    \"resource.h\\0\"\r\nEND\r\n\r\n2 TEXTINCLUDE \r\nBEGIN\r\n    \"#include \"\"winres.h\"\"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n3 TEXTINCLUDE \r\nBEGIN\r\n    \"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n#endif    // APSTUDIO_INVOKED\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Version\r\n//\r\n#include \"..\\version.h\"\r\n\r\nVS_VERSION_INFO VERSIONINFO\r\n FILEVERSION VER_FILE\r\n PRODUCTVERSION VER_PRODUCT\r\n FILEFLAGSMASK 0x3fL\r\n#ifdef _DEBUG\r\n FILEFLAGS 0x1L\r\n#else\r\n FILEFLAGS 0x0L\r\n#endif\r\n FILEOS 0x40004L\r\n FILETYPE 0x1L\r\n FILESUBTYPE 0x0L\r\nBEGIN\r\n    BLOCK \"StringFileInfo\"\r\n    BEGIN\r\n        BLOCK \"040904b0\"\r\n        BEGIN\r\n            VALUE \"CompanyName\", \"ExplorerPatcher Developers\"\r\n            VALUE \"FileDescription\", \"ExplorerPatcher Setup Program\"\r\n            VER_FILE_STRING\r\n            VALUE \"InternalName\", \"ep_setup.exe\"\r\n            VALUE \"LegalCopyright\", \"(C) 2021-2025 ExplorerPatcher Developers. All rights reserved.\"\r\n            VALUE \"OriginalFilename\", \"ep_setup.exe\"\r\n            VALUE \"ProductName\", \"ExplorerPatcher\"\r\n            VER_PRODUCT_STRING\r\n        END\r\n    END\r\n    BLOCK \"VarFileInfo\"\r\n    BEGIN\r\n        VALUE \"Translation\", 0x409, 1200\r\n    END\r\nEND\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// RCDATA\r\n//\r\n\r\n#if defined(PLATFORM_AMD64)\r\n\r\nIDR_EP_ZIP              RCDATA             \"..\\\\build\\\\Release\\\\x64\\\\ep_setup_files.zip.bin\"\r\n\r\n#elif defined(PLATFORM_ARM64)\r\n\r\nIDR_EP_ZIP              RCDATA             \"..\\\\build\\\\Release\\\\ARM64\\\\ep_setup_files.zip.bin\"\r\n\r\n#endif\r\n\r\n#endif    // English (United States) resources\r\n/////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n\r\n#ifndef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 3 resource.\r\n//\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#endif    // not APSTUDIO_INVOKED\r\n\r\n"
  },
  {
    "path": "ep_setup/resources/ep_setup_debug.rc",
    "content": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 2 resource.\r\n//\r\n#include \"winres.h\"\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#undef APSTUDIO_READONLY_SYMBOLS\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n// English (United States) resources\r\n\r\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n#pragma code_page(1252)\r\n\r\n#ifdef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// TEXTINCLUDE\r\n//\r\n\r\n1 TEXTINCLUDE \r\nBEGIN\r\n    \"resource.h\\0\"\r\nEND\r\n\r\n2 TEXTINCLUDE \r\nBEGIN\r\n    \"#include \"\"winres.h\"\"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n3 TEXTINCLUDE \r\nBEGIN\r\n    \"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n#endif    // APSTUDIO_INVOKED\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Version\r\n//\r\n#include \"..\\version.h\"\r\n\r\nVS_VERSION_INFO VERSIONINFO\r\n FILEVERSION VER_FILE\r\n PRODUCTVERSION VER_PRODUCT\r\n FILEFLAGSMASK 0x3fL\r\n#ifdef _DEBUG\r\n FILEFLAGS 0x1L\r\n#else\r\n FILEFLAGS 0x0L\r\n#endif\r\n FILEOS 0x40004L\r\n FILETYPE 0x1L\r\n FILESUBTYPE 0x0L\r\nBEGIN\r\n    BLOCK \"StringFileInfo\"\r\n    BEGIN\r\n        BLOCK \"040904b0\"\r\n        BEGIN\r\n            VALUE \"CompanyName\", \"ExplorerPatcher Developers\"\r\n            VALUE \"FileDescription\", \"ExplorerPatcher Setup Program (Debug Build)\"\r\n            VER_FILE_STRING\r\n            VALUE \"InternalName\", \"ep_setup.exe\"\r\n            VALUE \"LegalCopyright\", \"(C) 2021-2025 ExplorerPatcher Developers. All rights reserved.\"\r\n            VALUE \"OriginalFilename\", \"ep_setup.exe\"\r\n            VALUE \"ProductName\", \"ExplorerPatcher\"\r\n            VER_PRODUCT_STRING\r\n        END\r\n    END\r\n    BLOCK \"VarFileInfo\"\r\n    BEGIN\r\n        VALUE \"Translation\", 0x409, 1200\r\n    END\r\nEND\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// RCDATA\r\n//\r\n\r\n#if defined(PLATFORM_AMD64)\r\n\r\nIDR_EP_ZIP              RCDATA             \"..\\\\build\\\\Debug\\\\x64\\\\ep_setup_files.zip.bin\"\r\n\r\n#elif defined(PLATFORM_ARM64)\r\n\r\nIDR_EP_ZIP              RCDATA             \"..\\\\build\\\\Debug\\\\ARM64\\\\ep_setup_files.zip.bin\"\r\n\r\n#endif\r\n\r\n#endif    // English (United States) resources\r\n/////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n\r\n#ifndef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 3 resource.\r\n//\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#endif    // not APSTUDIO_INVOKED\r\n\r\n"
  },
  {
    "path": "ep_setup/resources/lang/ep_setup.en-US.rc",
    "content": "﻿#include \"resources/resource.h\"\r\n#include \"winres.h\"\r\n\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n\r\nSTRINGTABLE\r\nBEGIN\r\n    IDS_SETUP_UNSUPPORTED_ARCH  \"Please run the %1$s version of the setup file on %1$s devices. This setup file is only for %2$s devices.\"\r\n    IDS_SETUP_UNINSTALL_PROMPT  \"Are you sure you want to remove ExplorerPatcher from your PC?\"\r\n    IDS_SETUP_INSTALL_LOGOFF    \"In order to install, you will be automatically signed out of Windows. ExplorerPatcher will be ready for use when you sign back in.\\n\\nDo you want to continue?\"\r\n    IDS_SETUP_UNINSTALL_LOGOFF  \"To complete the uninstallation, you will be automatically signed out of Windows.\\n\\nDo you want to continue?\"\r\n    IDS_SETUP_UNINSTALL_RESTART \"Please reboot the PC to complete the uninstall.\\n\\nDo you want to reboot now?\"\r\n    IDS_SETUP_UNINSTALL_FINISH  \"Uninstall completed. Thank you for using ExplorerPatcher.\"\r\n    IDS_SETUP_FAILED            \"An error has occurred while servicing ExplorerPatcher.\\nThis is most likely caused by one or more of the backup files from a previous update still being in use. Unlocking the files should fix this issue.\\n\\nTroubleshooting steps:\\n• Close and reopen the \"\"Properties\"\" dialog if it is currently open.\\n• Kill and restart all \"\"explorer.exe\"\" processes.\\n• If you have registered ExplorerPatcher as a shell extension, then restarting the PC will probably fix this.\\n• Lastly, reboot the PC and try again.\"\r\nEND\r\n"
  },
  {
    "path": "ep_setup/resources/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Visual C++ generated include file.\r\n// Used by ep_setup.rc\r\n//\r\n#define IDR_EP_ZIP                      103\r\n\r\n#define IDS_SETUP_UNSUPPORTED_ARCH      301\r\n#define IDS_SETUP_UNINSTALL_PROMPT      302\r\n#define IDS_SETUP_INSTALL_LOGOFF        303\r\n#define IDS_SETUP_UNINSTALL_LOGOFF      304\r\n#define IDS_SETUP_UNINSTALL_RESTART     305\r\n#define IDS_SETUP_UNINSTALL_FINISH      306\r\n#define IDS_SETUP_FAILED                307\r\n\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        105\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1001\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "ep_setup/rijndael-alg-fst.c",
    "content": "/**\r\n * rijndael-alg-fst.c\r\n *\r\n * @version 3.0 (December 2000)\r\n *\r\n * Optimised ANSI C code for the Rijndael cipher (now AES)\r\n *\r\n * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>\r\n * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>\r\n * @author Paulo Barreto <paulo.barreto@terra.com.br>\r\n *\r\n * This code is hereby placed in the public domain.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS\r\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n#include <assert.h>\r\n\r\n#include <stdlib.h>\r\n\r\n\r\n#include \"rijndael-alg-fst.h\"\r\n\r\n/*\r\nTe0[x] = S [x].[02, 01, 01, 03];\r\nTe1[x] = S [x].[03, 02, 01, 01];\r\nTe2[x] = S [x].[01, 03, 02, 01];\r\nTe3[x] = S [x].[01, 01, 03, 02];\r\nTe4[x] = S [x].[01, 01, 01, 01];\r\n\r\nTd0[x] = Si[x].[0e, 09, 0d, 0b];\r\nTd1[x] = Si[x].[0b, 0e, 09, 0d];\r\nTd2[x] = Si[x].[0d, 0b, 0e, 09];\r\nTd3[x] = Si[x].[09, 0d, 0b, 0e];\r\nTd4[x] = Si[x].[01, 01, 01, 01];\r\n*/\r\n\r\nstatic const u32 Te0[256] = {\r\n    0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,\r\n    0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,\r\n    0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU,\r\n    0xe7fefe19U, 0xb5d7d762U, 0x4dababe6U, 0xec76769aU,\r\n    0x8fcaca45U, 0x1f82829dU, 0x89c9c940U, 0xfa7d7d87U,\r\n    0xeffafa15U, 0xb25959ebU, 0x8e4747c9U, 0xfbf0f00bU,\r\n    0x41adadecU, 0xb3d4d467U, 0x5fa2a2fdU, 0x45afafeaU,\r\n    0x239c9cbfU, 0x53a4a4f7U, 0xe4727296U, 0x9bc0c05bU,\r\n    0x75b7b7c2U, 0xe1fdfd1cU, 0x3d9393aeU, 0x4c26266aU,\r\n    0x6c36365aU, 0x7e3f3f41U, 0xf5f7f702U, 0x83cccc4fU,\r\n    0x6834345cU, 0x51a5a5f4U, 0xd1e5e534U, 0xf9f1f108U,\r\n    0xe2717193U, 0xabd8d873U, 0x62313153U, 0x2a15153fU,\r\n    0x0804040cU, 0x95c7c752U, 0x46232365U, 0x9dc3c35eU,\r\n    0x30181828U, 0x379696a1U, 0x0a05050fU, 0x2f9a9ab5U,\r\n    0x0e070709U, 0x24121236U, 0x1b80809bU, 0xdfe2e23dU,\r\n    0xcdebeb26U, 0x4e272769U, 0x7fb2b2cdU, 0xea75759fU,\r\n    0x1209091bU, 0x1d83839eU, 0x582c2c74U, 0x341a1a2eU,\r\n    0x361b1b2dU, 0xdc6e6eb2U, 0xb45a5aeeU, 0x5ba0a0fbU,\r\n    0xa45252f6U, 0x763b3b4dU, 0xb7d6d661U, 0x7db3b3ceU,\r\n    0x5229297bU, 0xdde3e33eU, 0x5e2f2f71U, 0x13848497U,\r\n    0xa65353f5U, 0xb9d1d168U, 0x00000000U, 0xc1eded2cU,\r\n    0x40202060U, 0xe3fcfc1fU, 0x79b1b1c8U, 0xb65b5bedU,\r\n    0xd46a6abeU, 0x8dcbcb46U, 0x67bebed9U, 0x7239394bU,\r\n    0x944a4adeU, 0x984c4cd4U, 0xb05858e8U, 0x85cfcf4aU,\r\n    0xbbd0d06bU, 0xc5efef2aU, 0x4faaaae5U, 0xedfbfb16U,\r\n    0x864343c5U, 0x9a4d4dd7U, 0x66333355U, 0x11858594U,\r\n    0x8a4545cfU, 0xe9f9f910U, 0x04020206U, 0xfe7f7f81U,\r\n    0xa05050f0U, 0x783c3c44U, 0x259f9fbaU, 0x4ba8a8e3U,\r\n    0xa25151f3U, 0x5da3a3feU, 0x804040c0U, 0x058f8f8aU,\r\n    0x3f9292adU, 0x219d9dbcU, 0x70383848U, 0xf1f5f504U,\r\n    0x63bcbcdfU, 0x77b6b6c1U, 0xafdada75U, 0x42212163U,\r\n    0x20101030U, 0xe5ffff1aU, 0xfdf3f30eU, 0xbfd2d26dU,\r\n    0x81cdcd4cU, 0x180c0c14U, 0x26131335U, 0xc3ecec2fU,\r\n    0xbe5f5fe1U, 0x359797a2U, 0x884444ccU, 0x2e171739U,\r\n    0x93c4c457U, 0x55a7a7f2U, 0xfc7e7e82U, 0x7a3d3d47U,\r\n    0xc86464acU, 0xba5d5de7U, 0x3219192bU, 0xe6737395U,\r\n    0xc06060a0U, 0x19818198U, 0x9e4f4fd1U, 0xa3dcdc7fU,\r\n    0x44222266U, 0x542a2a7eU, 0x3b9090abU, 0x0b888883U,\r\n    0x8c4646caU, 0xc7eeee29U, 0x6bb8b8d3U, 0x2814143cU,\r\n    0xa7dede79U, 0xbc5e5ee2U, 0x160b0b1dU, 0xaddbdb76U,\r\n    0xdbe0e03bU, 0x64323256U, 0x743a3a4eU, 0x140a0a1eU,\r\n    0x924949dbU, 0x0c06060aU, 0x4824246cU, 0xb85c5ce4U,\r\n    0x9fc2c25dU, 0xbdd3d36eU, 0x43acacefU, 0xc46262a6U,\r\n    0x399191a8U, 0x319595a4U, 0xd3e4e437U, 0xf279798bU,\r\n    0xd5e7e732U, 0x8bc8c843U, 0x6e373759U, 0xda6d6db7U,\r\n    0x018d8d8cU, 0xb1d5d564U, 0x9c4e4ed2U, 0x49a9a9e0U,\r\n    0xd86c6cb4U, 0xac5656faU, 0xf3f4f407U, 0xcfeaea25U,\r\n    0xca6565afU, 0xf47a7a8eU, 0x47aeaee9U, 0x10080818U,\r\n    0x6fbabad5U, 0xf0787888U, 0x4a25256fU, 0x5c2e2e72U,\r\n    0x381c1c24U, 0x57a6a6f1U, 0x73b4b4c7U, 0x97c6c651U,\r\n    0xcbe8e823U, 0xa1dddd7cU, 0xe874749cU, 0x3e1f1f21U,\r\n    0x964b4bddU, 0x61bdbddcU, 0x0d8b8b86U, 0x0f8a8a85U,\r\n    0xe0707090U, 0x7c3e3e42U, 0x71b5b5c4U, 0xcc6666aaU,\r\n    0x904848d8U, 0x06030305U, 0xf7f6f601U, 0x1c0e0e12U,\r\n    0xc26161a3U, 0x6a35355fU, 0xae5757f9U, 0x69b9b9d0U,\r\n    0x17868691U, 0x99c1c158U, 0x3a1d1d27U, 0x279e9eb9U,\r\n    0xd9e1e138U, 0xebf8f813U, 0x2b9898b3U, 0x22111133U,\r\n    0xd26969bbU, 0xa9d9d970U, 0x078e8e89U, 0x339494a7U,\r\n    0x2d9b9bb6U, 0x3c1e1e22U, 0x15878792U, 0xc9e9e920U,\r\n    0x87cece49U, 0xaa5555ffU, 0x50282878U, 0xa5dfdf7aU,\r\n    0x038c8c8fU, 0x59a1a1f8U, 0x09898980U, 0x1a0d0d17U,\r\n    0x65bfbfdaU, 0xd7e6e631U, 0x844242c6U, 0xd06868b8U,\r\n    0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,\r\n    0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,\r\n};\r\nstatic const u32 Te1[256] = {\r\n    0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,\r\n    0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,\r\n    0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU,\r\n    0x19e7fefeU, 0x62b5d7d7U, 0xe64dababU, 0x9aec7676U,\r\n    0x458fcacaU, 0x9d1f8282U, 0x4089c9c9U, 0x87fa7d7dU,\r\n    0x15effafaU, 0xebb25959U, 0xc98e4747U, 0x0bfbf0f0U,\r\n    0xec41adadU, 0x67b3d4d4U, 0xfd5fa2a2U, 0xea45afafU,\r\n    0xbf239c9cU, 0xf753a4a4U, 0x96e47272U, 0x5b9bc0c0U,\r\n    0xc275b7b7U, 0x1ce1fdfdU, 0xae3d9393U, 0x6a4c2626U,\r\n    0x5a6c3636U, 0x417e3f3fU, 0x02f5f7f7U, 0x4f83ccccU,\r\n    0x5c683434U, 0xf451a5a5U, 0x34d1e5e5U, 0x08f9f1f1U,\r\n    0x93e27171U, 0x73abd8d8U, 0x53623131U, 0x3f2a1515U,\r\n    0x0c080404U, 0x5295c7c7U, 0x65462323U, 0x5e9dc3c3U,\r\n    0x28301818U, 0xa1379696U, 0x0f0a0505U, 0xb52f9a9aU,\r\n    0x090e0707U, 0x36241212U, 0x9b1b8080U, 0x3ddfe2e2U,\r\n    0x26cdebebU, 0x694e2727U, 0xcd7fb2b2U, 0x9fea7575U,\r\n    0x1b120909U, 0x9e1d8383U, 0x74582c2cU, 0x2e341a1aU,\r\n    0x2d361b1bU, 0xb2dc6e6eU, 0xeeb45a5aU, 0xfb5ba0a0U,\r\n    0xf6a45252U, 0x4d763b3bU, 0x61b7d6d6U, 0xce7db3b3U,\r\n    0x7b522929U, 0x3edde3e3U, 0x715e2f2fU, 0x97138484U,\r\n    0xf5a65353U, 0x68b9d1d1U, 0x00000000U, 0x2cc1ededU,\r\n    0x60402020U, 0x1fe3fcfcU, 0xc879b1b1U, 0xedb65b5bU,\r\n    0xbed46a6aU, 0x468dcbcbU, 0xd967bebeU, 0x4b723939U,\r\n    0xde944a4aU, 0xd4984c4cU, 0xe8b05858U, 0x4a85cfcfU,\r\n    0x6bbbd0d0U, 0x2ac5efefU, 0xe54faaaaU, 0x16edfbfbU,\r\n    0xc5864343U, 0xd79a4d4dU, 0x55663333U, 0x94118585U,\r\n    0xcf8a4545U, 0x10e9f9f9U, 0x06040202U, 0x81fe7f7fU,\r\n    0xf0a05050U, 0x44783c3cU, 0xba259f9fU, 0xe34ba8a8U,\r\n    0xf3a25151U, 0xfe5da3a3U, 0xc0804040U, 0x8a058f8fU,\r\n    0xad3f9292U, 0xbc219d9dU, 0x48703838U, 0x04f1f5f5U,\r\n    0xdf63bcbcU, 0xc177b6b6U, 0x75afdadaU, 0x63422121U,\r\n    0x30201010U, 0x1ae5ffffU, 0x0efdf3f3U, 0x6dbfd2d2U,\r\n    0x4c81cdcdU, 0x14180c0cU, 0x35261313U, 0x2fc3ececU,\r\n    0xe1be5f5fU, 0xa2359797U, 0xcc884444U, 0x392e1717U,\r\n    0x5793c4c4U, 0xf255a7a7U, 0x82fc7e7eU, 0x477a3d3dU,\r\n    0xacc86464U, 0xe7ba5d5dU, 0x2b321919U, 0x95e67373U,\r\n    0xa0c06060U, 0x98198181U, 0xd19e4f4fU, 0x7fa3dcdcU,\r\n    0x66442222U, 0x7e542a2aU, 0xab3b9090U, 0x830b8888U,\r\n    0xca8c4646U, 0x29c7eeeeU, 0xd36bb8b8U, 0x3c281414U,\r\n    0x79a7dedeU, 0xe2bc5e5eU, 0x1d160b0bU, 0x76addbdbU,\r\n    0x3bdbe0e0U, 0x56643232U, 0x4e743a3aU, 0x1e140a0aU,\r\n    0xdb924949U, 0x0a0c0606U, 0x6c482424U, 0xe4b85c5cU,\r\n    0x5d9fc2c2U, 0x6ebdd3d3U, 0xef43acacU, 0xa6c46262U,\r\n    0xa8399191U, 0xa4319595U, 0x37d3e4e4U, 0x8bf27979U,\r\n    0x32d5e7e7U, 0x438bc8c8U, 0x596e3737U, 0xb7da6d6dU,\r\n    0x8c018d8dU, 0x64b1d5d5U, 0xd29c4e4eU, 0xe049a9a9U,\r\n    0xb4d86c6cU, 0xfaac5656U, 0x07f3f4f4U, 0x25cfeaeaU,\r\n    0xafca6565U, 0x8ef47a7aU, 0xe947aeaeU, 0x18100808U,\r\n    0xd56fbabaU, 0x88f07878U, 0x6f4a2525U, 0x725c2e2eU,\r\n    0x24381c1cU, 0xf157a6a6U, 0xc773b4b4U, 0x5197c6c6U,\r\n    0x23cbe8e8U, 0x7ca1ddddU, 0x9ce87474U, 0x213e1f1fU,\r\n    0xdd964b4bU, 0xdc61bdbdU, 0x860d8b8bU, 0x850f8a8aU,\r\n    0x90e07070U, 0x427c3e3eU, 0xc471b5b5U, 0xaacc6666U,\r\n    0xd8904848U, 0x05060303U, 0x01f7f6f6U, 0x121c0e0eU,\r\n    0xa3c26161U, 0x5f6a3535U, 0xf9ae5757U, 0xd069b9b9U,\r\n    0x91178686U, 0x5899c1c1U, 0x273a1d1dU, 0xb9279e9eU,\r\n    0x38d9e1e1U, 0x13ebf8f8U, 0xb32b9898U, 0x33221111U,\r\n    0xbbd26969U, 0x70a9d9d9U, 0x89078e8eU, 0xa7339494U,\r\n    0xb62d9b9bU, 0x223c1e1eU, 0x92158787U, 0x20c9e9e9U,\r\n    0x4987ceceU, 0xffaa5555U, 0x78502828U, 0x7aa5dfdfU,\r\n    0x8f038c8cU, 0xf859a1a1U, 0x80098989U, 0x171a0d0dU,\r\n    0xda65bfbfU, 0x31d7e6e6U, 0xc6844242U, 0xb8d06868U,\r\n    0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,\r\n    0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,\r\n};\r\nstatic const u32 Te2[256] = {\r\n    0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,\r\n    0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,\r\n    0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU,\r\n    0xfe19e7feU, 0xd762b5d7U, 0xabe64dabU, 0x769aec76U,\r\n    0xca458fcaU, 0x829d1f82U, 0xc94089c9U, 0x7d87fa7dU,\r\n    0xfa15effaU, 0x59ebb259U, 0x47c98e47U, 0xf00bfbf0U,\r\n    0xadec41adU, 0xd467b3d4U, 0xa2fd5fa2U, 0xafea45afU,\r\n    0x9cbf239cU, 0xa4f753a4U, 0x7296e472U, 0xc05b9bc0U,\r\n    0xb7c275b7U, 0xfd1ce1fdU, 0x93ae3d93U, 0x266a4c26U,\r\n    0x365a6c36U, 0x3f417e3fU, 0xf702f5f7U, 0xcc4f83ccU,\r\n    0x345c6834U, 0xa5f451a5U, 0xe534d1e5U, 0xf108f9f1U,\r\n    0x7193e271U, 0xd873abd8U, 0x31536231U, 0x153f2a15U,\r\n    0x040c0804U, 0xc75295c7U, 0x23654623U, 0xc35e9dc3U,\r\n    0x18283018U, 0x96a13796U, 0x050f0a05U, 0x9ab52f9aU,\r\n    0x07090e07U, 0x12362412U, 0x809b1b80U, 0xe23ddfe2U,\r\n    0xeb26cdebU, 0x27694e27U, 0xb2cd7fb2U, 0x759fea75U,\r\n    0x091b1209U, 0x839e1d83U, 0x2c74582cU, 0x1a2e341aU,\r\n    0x1b2d361bU, 0x6eb2dc6eU, 0x5aeeb45aU, 0xa0fb5ba0U,\r\n    0x52f6a452U, 0x3b4d763bU, 0xd661b7d6U, 0xb3ce7db3U,\r\n    0x297b5229U, 0xe33edde3U, 0x2f715e2fU, 0x84971384U,\r\n    0x53f5a653U, 0xd168b9d1U, 0x00000000U, 0xed2cc1edU,\r\n    0x20604020U, 0xfc1fe3fcU, 0xb1c879b1U, 0x5bedb65bU,\r\n    0x6abed46aU, 0xcb468dcbU, 0xbed967beU, 0x394b7239U,\r\n    0x4ade944aU, 0x4cd4984cU, 0x58e8b058U, 0xcf4a85cfU,\r\n    0xd06bbbd0U, 0xef2ac5efU, 0xaae54faaU, 0xfb16edfbU,\r\n    0x43c58643U, 0x4dd79a4dU, 0x33556633U, 0x85941185U,\r\n    0x45cf8a45U, 0xf910e9f9U, 0x02060402U, 0x7f81fe7fU,\r\n    0x50f0a050U, 0x3c44783cU, 0x9fba259fU, 0xa8e34ba8U,\r\n    0x51f3a251U, 0xa3fe5da3U, 0x40c08040U, 0x8f8a058fU,\r\n    0x92ad3f92U, 0x9dbc219dU, 0x38487038U, 0xf504f1f5U,\r\n    0xbcdf63bcU, 0xb6c177b6U, 0xda75afdaU, 0x21634221U,\r\n    0x10302010U, 0xff1ae5ffU, 0xf30efdf3U, 0xd26dbfd2U,\r\n    0xcd4c81cdU, 0x0c14180cU, 0x13352613U, 0xec2fc3ecU,\r\n    0x5fe1be5fU, 0x97a23597U, 0x44cc8844U, 0x17392e17U,\r\n    0xc45793c4U, 0xa7f255a7U, 0x7e82fc7eU, 0x3d477a3dU,\r\n    0x64acc864U, 0x5de7ba5dU, 0x192b3219U, 0x7395e673U,\r\n    0x60a0c060U, 0x81981981U, 0x4fd19e4fU, 0xdc7fa3dcU,\r\n    0x22664422U, 0x2a7e542aU, 0x90ab3b90U, 0x88830b88U,\r\n    0x46ca8c46U, 0xee29c7eeU, 0xb8d36bb8U, 0x143c2814U,\r\n    0xde79a7deU, 0x5ee2bc5eU, 0x0b1d160bU, 0xdb76addbU,\r\n    0xe03bdbe0U, 0x32566432U, 0x3a4e743aU, 0x0a1e140aU,\r\n    0x49db9249U, 0x060a0c06U, 0x246c4824U, 0x5ce4b85cU,\r\n    0xc25d9fc2U, 0xd36ebdd3U, 0xacef43acU, 0x62a6c462U,\r\n    0x91a83991U, 0x95a43195U, 0xe437d3e4U, 0x798bf279U,\r\n    0xe732d5e7U, 0xc8438bc8U, 0x37596e37U, 0x6db7da6dU,\r\n    0x8d8c018dU, 0xd564b1d5U, 0x4ed29c4eU, 0xa9e049a9U,\r\n    0x6cb4d86cU, 0x56faac56U, 0xf407f3f4U, 0xea25cfeaU,\r\n    0x65afca65U, 0x7a8ef47aU, 0xaee947aeU, 0x08181008U,\r\n    0xbad56fbaU, 0x7888f078U, 0x256f4a25U, 0x2e725c2eU,\r\n    0x1c24381cU, 0xa6f157a6U, 0xb4c773b4U, 0xc65197c6U,\r\n    0xe823cbe8U, 0xdd7ca1ddU, 0x749ce874U, 0x1f213e1fU,\r\n    0x4bdd964bU, 0xbddc61bdU, 0x8b860d8bU, 0x8a850f8aU,\r\n    0x7090e070U, 0x3e427c3eU, 0xb5c471b5U, 0x66aacc66U,\r\n    0x48d89048U, 0x03050603U, 0xf601f7f6U, 0x0e121c0eU,\r\n    0x61a3c261U, 0x355f6a35U, 0x57f9ae57U, 0xb9d069b9U,\r\n    0x86911786U, 0xc15899c1U, 0x1d273a1dU, 0x9eb9279eU,\r\n    0xe138d9e1U, 0xf813ebf8U, 0x98b32b98U, 0x11332211U,\r\n    0x69bbd269U, 0xd970a9d9U, 0x8e89078eU, 0x94a73394U,\r\n    0x9bb62d9bU, 0x1e223c1eU, 0x87921587U, 0xe920c9e9U,\r\n    0xce4987ceU, 0x55ffaa55U, 0x28785028U, 0xdf7aa5dfU,\r\n    0x8c8f038cU, 0xa1f859a1U, 0x89800989U, 0x0d171a0dU,\r\n    0xbfda65bfU, 0xe631d7e6U, 0x42c68442U, 0x68b8d068U,\r\n    0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,\r\n    0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,\r\n};\r\nstatic const u32 Te3[256] = {\r\n\r\n    0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,\r\n    0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,\r\n    0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U,\r\n    0xfefe19e7U, 0xd7d762b5U, 0xababe64dU, 0x76769aecU,\r\n    0xcaca458fU, 0x82829d1fU, 0xc9c94089U, 0x7d7d87faU,\r\n    0xfafa15efU, 0x5959ebb2U, 0x4747c98eU, 0xf0f00bfbU,\r\n    0xadadec41U, 0xd4d467b3U, 0xa2a2fd5fU, 0xafafea45U,\r\n    0x9c9cbf23U, 0xa4a4f753U, 0x727296e4U, 0xc0c05b9bU,\r\n    0xb7b7c275U, 0xfdfd1ce1U, 0x9393ae3dU, 0x26266a4cU,\r\n    0x36365a6cU, 0x3f3f417eU, 0xf7f702f5U, 0xcccc4f83U,\r\n    0x34345c68U, 0xa5a5f451U, 0xe5e534d1U, 0xf1f108f9U,\r\n    0x717193e2U, 0xd8d873abU, 0x31315362U, 0x15153f2aU,\r\n    0x04040c08U, 0xc7c75295U, 0x23236546U, 0xc3c35e9dU,\r\n    0x18182830U, 0x9696a137U, 0x05050f0aU, 0x9a9ab52fU,\r\n    0x0707090eU, 0x12123624U, 0x80809b1bU, 0xe2e23ddfU,\r\n    0xebeb26cdU, 0x2727694eU, 0xb2b2cd7fU, 0x75759feaU,\r\n    0x09091b12U, 0x83839e1dU, 0x2c2c7458U, 0x1a1a2e34U,\r\n    0x1b1b2d36U, 0x6e6eb2dcU, 0x5a5aeeb4U, 0xa0a0fb5bU,\r\n    0x5252f6a4U, 0x3b3b4d76U, 0xd6d661b7U, 0xb3b3ce7dU,\r\n    0x29297b52U, 0xe3e33eddU, 0x2f2f715eU, 0x84849713U,\r\n    0x5353f5a6U, 0xd1d168b9U, 0x00000000U, 0xeded2cc1U,\r\n    0x20206040U, 0xfcfc1fe3U, 0xb1b1c879U, 0x5b5bedb6U,\r\n    0x6a6abed4U, 0xcbcb468dU, 0xbebed967U, 0x39394b72U,\r\n    0x4a4ade94U, 0x4c4cd498U, 0x5858e8b0U, 0xcfcf4a85U,\r\n    0xd0d06bbbU, 0xefef2ac5U, 0xaaaae54fU, 0xfbfb16edU,\r\n    0x4343c586U, 0x4d4dd79aU, 0x33335566U, 0x85859411U,\r\n    0x4545cf8aU, 0xf9f910e9U, 0x02020604U, 0x7f7f81feU,\r\n    0x5050f0a0U, 0x3c3c4478U, 0x9f9fba25U, 0xa8a8e34bU,\r\n    0x5151f3a2U, 0xa3a3fe5dU, 0x4040c080U, 0x8f8f8a05U,\r\n    0x9292ad3fU, 0x9d9dbc21U, 0x38384870U, 0xf5f504f1U,\r\n    0xbcbcdf63U, 0xb6b6c177U, 0xdada75afU, 0x21216342U,\r\n    0x10103020U, 0xffff1ae5U, 0xf3f30efdU, 0xd2d26dbfU,\r\n    0xcdcd4c81U, 0x0c0c1418U, 0x13133526U, 0xecec2fc3U,\r\n    0x5f5fe1beU, 0x9797a235U, 0x4444cc88U, 0x1717392eU,\r\n    0xc4c45793U, 0xa7a7f255U, 0x7e7e82fcU, 0x3d3d477aU,\r\n    0x6464acc8U, 0x5d5de7baU, 0x19192b32U, 0x737395e6U,\r\n    0x6060a0c0U, 0x81819819U, 0x4f4fd19eU, 0xdcdc7fa3U,\r\n    0x22226644U, 0x2a2a7e54U, 0x9090ab3bU, 0x8888830bU,\r\n    0x4646ca8cU, 0xeeee29c7U, 0xb8b8d36bU, 0x14143c28U,\r\n    0xdede79a7U, 0x5e5ee2bcU, 0x0b0b1d16U, 0xdbdb76adU,\r\n    0xe0e03bdbU, 0x32325664U, 0x3a3a4e74U, 0x0a0a1e14U,\r\n    0x4949db92U, 0x06060a0cU, 0x24246c48U, 0x5c5ce4b8U,\r\n    0xc2c25d9fU, 0xd3d36ebdU, 0xacacef43U, 0x6262a6c4U,\r\n    0x9191a839U, 0x9595a431U, 0xe4e437d3U, 0x79798bf2U,\r\n    0xe7e732d5U, 0xc8c8438bU, 0x3737596eU, 0x6d6db7daU,\r\n    0x8d8d8c01U, 0xd5d564b1U, 0x4e4ed29cU, 0xa9a9e049U,\r\n    0x6c6cb4d8U, 0x5656faacU, 0xf4f407f3U, 0xeaea25cfU,\r\n    0x6565afcaU, 0x7a7a8ef4U, 0xaeaee947U, 0x08081810U,\r\n    0xbabad56fU, 0x787888f0U, 0x25256f4aU, 0x2e2e725cU,\r\n    0x1c1c2438U, 0xa6a6f157U, 0xb4b4c773U, 0xc6c65197U,\r\n    0xe8e823cbU, 0xdddd7ca1U, 0x74749ce8U, 0x1f1f213eU,\r\n    0x4b4bdd96U, 0xbdbddc61U, 0x8b8b860dU, 0x8a8a850fU,\r\n    0x707090e0U, 0x3e3e427cU, 0xb5b5c471U, 0x6666aaccU,\r\n    0x4848d890U, 0x03030506U, 0xf6f601f7U, 0x0e0e121cU,\r\n    0x6161a3c2U, 0x35355f6aU, 0x5757f9aeU, 0xb9b9d069U,\r\n    0x86869117U, 0xc1c15899U, 0x1d1d273aU, 0x9e9eb927U,\r\n    0xe1e138d9U, 0xf8f813ebU, 0x9898b32bU, 0x11113322U,\r\n    0x6969bbd2U, 0xd9d970a9U, 0x8e8e8907U, 0x9494a733U,\r\n    0x9b9bb62dU, 0x1e1e223cU, 0x87879215U, 0xe9e920c9U,\r\n    0xcece4987U, 0x5555ffaaU, 0x28287850U, 0xdfdf7aa5U,\r\n    0x8c8c8f03U, 0xa1a1f859U, 0x89898009U, 0x0d0d171aU,\r\n    0xbfbfda65U, 0xe6e631d7U, 0x4242c684U, 0x6868b8d0U,\r\n    0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU,\r\n    0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,\r\n};\r\nstatic const u32 Te4[256] = {\r\n    0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU,\r\n    0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U,\r\n    0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU,\r\n    0xfefefefeU, 0xd7d7d7d7U, 0xababababU, 0x76767676U,\r\n    0xcacacacaU, 0x82828282U, 0xc9c9c9c9U, 0x7d7d7d7dU,\r\n    0xfafafafaU, 0x59595959U, 0x47474747U, 0xf0f0f0f0U,\r\n    0xadadadadU, 0xd4d4d4d4U, 0xa2a2a2a2U, 0xafafafafU,\r\n    0x9c9c9c9cU, 0xa4a4a4a4U, 0x72727272U, 0xc0c0c0c0U,\r\n    0xb7b7b7b7U, 0xfdfdfdfdU, 0x93939393U, 0x26262626U,\r\n    0x36363636U, 0x3f3f3f3fU, 0xf7f7f7f7U, 0xccccccccU,\r\n    0x34343434U, 0xa5a5a5a5U, 0xe5e5e5e5U, 0xf1f1f1f1U,\r\n    0x71717171U, 0xd8d8d8d8U, 0x31313131U, 0x15151515U,\r\n    0x04040404U, 0xc7c7c7c7U, 0x23232323U, 0xc3c3c3c3U,\r\n    0x18181818U, 0x96969696U, 0x05050505U, 0x9a9a9a9aU,\r\n    0x07070707U, 0x12121212U, 0x80808080U, 0xe2e2e2e2U,\r\n    0xebebebebU, 0x27272727U, 0xb2b2b2b2U, 0x75757575U,\r\n    0x09090909U, 0x83838383U, 0x2c2c2c2cU, 0x1a1a1a1aU,\r\n    0x1b1b1b1bU, 0x6e6e6e6eU, 0x5a5a5a5aU, 0xa0a0a0a0U,\r\n    0x52525252U, 0x3b3b3b3bU, 0xd6d6d6d6U, 0xb3b3b3b3U,\r\n    0x29292929U, 0xe3e3e3e3U, 0x2f2f2f2fU, 0x84848484U,\r\n    0x53535353U, 0xd1d1d1d1U, 0x00000000U, 0xededededU,\r\n    0x20202020U, 0xfcfcfcfcU, 0xb1b1b1b1U, 0x5b5b5b5bU,\r\n    0x6a6a6a6aU, 0xcbcbcbcbU, 0xbebebebeU, 0x39393939U,\r\n    0x4a4a4a4aU, 0x4c4c4c4cU, 0x58585858U, 0xcfcfcfcfU,\r\n    0xd0d0d0d0U, 0xefefefefU, 0xaaaaaaaaU, 0xfbfbfbfbU,\r\n    0x43434343U, 0x4d4d4d4dU, 0x33333333U, 0x85858585U,\r\n    0x45454545U, 0xf9f9f9f9U, 0x02020202U, 0x7f7f7f7fU,\r\n    0x50505050U, 0x3c3c3c3cU, 0x9f9f9f9fU, 0xa8a8a8a8U,\r\n    0x51515151U, 0xa3a3a3a3U, 0x40404040U, 0x8f8f8f8fU,\r\n    0x92929292U, 0x9d9d9d9dU, 0x38383838U, 0xf5f5f5f5U,\r\n    0xbcbcbcbcU, 0xb6b6b6b6U, 0xdadadadaU, 0x21212121U,\r\n    0x10101010U, 0xffffffffU, 0xf3f3f3f3U, 0xd2d2d2d2U,\r\n    0xcdcdcdcdU, 0x0c0c0c0cU, 0x13131313U, 0xececececU,\r\n    0x5f5f5f5fU, 0x97979797U, 0x44444444U, 0x17171717U,\r\n    0xc4c4c4c4U, 0xa7a7a7a7U, 0x7e7e7e7eU, 0x3d3d3d3dU,\r\n    0x64646464U, 0x5d5d5d5dU, 0x19191919U, 0x73737373U,\r\n    0x60606060U, 0x81818181U, 0x4f4f4f4fU, 0xdcdcdcdcU,\r\n    0x22222222U, 0x2a2a2a2aU, 0x90909090U, 0x88888888U,\r\n    0x46464646U, 0xeeeeeeeeU, 0xb8b8b8b8U, 0x14141414U,\r\n    0xdedededeU, 0x5e5e5e5eU, 0x0b0b0b0bU, 0xdbdbdbdbU,\r\n    0xe0e0e0e0U, 0x32323232U, 0x3a3a3a3aU, 0x0a0a0a0aU,\r\n    0x49494949U, 0x06060606U, 0x24242424U, 0x5c5c5c5cU,\r\n    0xc2c2c2c2U, 0xd3d3d3d3U, 0xacacacacU, 0x62626262U,\r\n    0x91919191U, 0x95959595U, 0xe4e4e4e4U, 0x79797979U,\r\n    0xe7e7e7e7U, 0xc8c8c8c8U, 0x37373737U, 0x6d6d6d6dU,\r\n    0x8d8d8d8dU, 0xd5d5d5d5U, 0x4e4e4e4eU, 0xa9a9a9a9U,\r\n    0x6c6c6c6cU, 0x56565656U, 0xf4f4f4f4U, 0xeaeaeaeaU,\r\n    0x65656565U, 0x7a7a7a7aU, 0xaeaeaeaeU, 0x08080808U,\r\n    0xbabababaU, 0x78787878U, 0x25252525U, 0x2e2e2e2eU,\r\n    0x1c1c1c1cU, 0xa6a6a6a6U, 0xb4b4b4b4U, 0xc6c6c6c6U,\r\n    0xe8e8e8e8U, 0xddddddddU, 0x74747474U, 0x1f1f1f1fU,\r\n    0x4b4b4b4bU, 0xbdbdbdbdU, 0x8b8b8b8bU, 0x8a8a8a8aU,\r\n    0x70707070U, 0x3e3e3e3eU, 0xb5b5b5b5U, 0x66666666U,\r\n    0x48484848U, 0x03030303U, 0xf6f6f6f6U, 0x0e0e0e0eU,\r\n    0x61616161U, 0x35353535U, 0x57575757U, 0xb9b9b9b9U,\r\n    0x86868686U, 0xc1c1c1c1U, 0x1d1d1d1dU, 0x9e9e9e9eU,\r\n    0xe1e1e1e1U, 0xf8f8f8f8U, 0x98989898U, 0x11111111U,\r\n    0x69696969U, 0xd9d9d9d9U, 0x8e8e8e8eU, 0x94949494U,\r\n    0x9b9b9b9bU, 0x1e1e1e1eU, 0x87878787U, 0xe9e9e9e9U,\r\n    0xcecececeU, 0x55555555U, 0x28282828U, 0xdfdfdfdfU,\r\n    0x8c8c8c8cU, 0xa1a1a1a1U, 0x89898989U, 0x0d0d0d0dU,\r\n    0xbfbfbfbfU, 0xe6e6e6e6U, 0x42424242U, 0x68686868U,\r\n    0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU,\r\n    0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U,\r\n};\r\nstatic const u32 Td0[256] = {\r\n    0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,\r\n    0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,\r\n    0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U,\r\n    0x4fe5d7fcU, 0xc52acbd7U, 0x26354480U, 0xb562a38fU,\r\n    0xdeb15a49U, 0x25ba1b67U, 0x45ea0e98U, 0x5dfec0e1U,\r\n    0xc32f7502U, 0x814cf012U, 0x8d4697a3U, 0x6bd3f9c6U,\r\n    0x038f5fe7U, 0x15929c95U, 0xbf6d7aebU, 0x955259daU,\r\n    0xd4be832dU, 0x587421d3U, 0x49e06929U, 0x8ec9c844U,\r\n    0x75c2896aU, 0xf48e7978U, 0x99583e6bU, 0x27b971ddU,\r\n    0xbee14fb6U, 0xf088ad17U, 0xc920ac66U, 0x7dce3ab4U,\r\n    0x63df4a18U, 0xe51a3182U, 0x97513360U, 0x62537f45U,\r\n    0xb16477e0U, 0xbb6bae84U, 0xfe81a01cU, 0xf9082b94U,\r\n    0x70486858U, 0x8f45fd19U, 0x94de6c87U, 0x527bf8b7U,\r\n    0xab73d323U, 0x724b02e2U, 0xe31f8f57U, 0x6655ab2aU,\r\n    0xb2eb2807U, 0x2fb5c203U, 0x86c57b9aU, 0xd33708a5U,\r\n    0x302887f2U, 0x23bfa5b2U, 0x02036abaU, 0xed16825cU,\r\n    0x8acf1c2bU, 0xa779b492U, 0xf307f2f0U, 0x4e69e2a1U,\r\n    0x65daf4cdU, 0x0605bed5U, 0xd134621fU, 0xc4a6fe8aU,\r\n    0x342e539dU, 0xa2f355a0U, 0x058ae132U, 0xa4f6eb75U,\r\n    0x0b83ec39U, 0x4060efaaU, 0x5e719f06U, 0xbd6e1051U,\r\n    0x3e218af9U, 0x96dd063dU, 0xdd3e05aeU, 0x4de6bd46U,\r\n    0x91548db5U, 0x71c45d05U, 0x0406d46fU, 0x605015ffU,\r\n    0x1998fb24U, 0xd6bde997U, 0x894043ccU, 0x67d99e77U,\r\n    0xb0e842bdU, 0x07898b88U, 0xe7195b38U, 0x79c8eedbU,\r\n    0xa17c0a47U, 0x7c420fe9U, 0xf8841ec9U, 0x00000000U,\r\n    0x09808683U, 0x322bed48U, 0x1e1170acU, 0x6c5a724eU,\r\n    0xfd0efffbU, 0x0f853856U, 0x3daed51eU, 0x362d3927U,\r\n    0x0a0fd964U, 0x685ca621U, 0x9b5b54d1U, 0x24362e3aU,\r\n    0x0c0a67b1U, 0x9357e70fU, 0xb4ee96d2U, 0x1b9b919eU,\r\n    0x80c0c54fU, 0x61dc20a2U, 0x5a774b69U, 0x1c121a16U,\r\n    0xe293ba0aU, 0xc0a02ae5U, 0x3c22e043U, 0x121b171dU,\r\n    0x0e090d0bU, 0xf28bc7adU, 0x2db6a8b9U, 0x141ea9c8U,\r\n    0x57f11985U, 0xaf75074cU, 0xee99ddbbU, 0xa37f60fdU,\r\n    0xf701269fU, 0x5c72f5bcU, 0x44663bc5U, 0x5bfb7e34U,\r\n    0x8b432976U, 0xcb23c6dcU, 0xb6edfc68U, 0xb8e4f163U,\r\n    0xd731dccaU, 0x42638510U, 0x13972240U, 0x84c61120U,\r\n    0x854a247dU, 0xd2bb3df8U, 0xaef93211U, 0xc729a16dU,\r\n    0x1d9e2f4bU, 0xdcb230f3U, 0x0d8652ecU, 0x77c1e3d0U,\r\n    0x2bb3166cU, 0xa970b999U, 0x119448faU, 0x47e96422U,\r\n    0xa8fc8cc4U, 0xa0f03f1aU, 0x567d2cd8U, 0x223390efU,\r\n    0x87494ec7U, 0xd938d1c1U, 0x8ccaa2feU, 0x98d40b36U,\r\n    0xa6f581cfU, 0xa57ade28U, 0xdab78e26U, 0x3fadbfa4U,\r\n    0x2c3a9de4U, 0x5078920dU, 0x6a5fcc9bU, 0x547e4662U,\r\n    0xf68d13c2U, 0x90d8b8e8U, 0x2e39f75eU, 0x82c3aff5U,\r\n    0x9f5d80beU, 0x69d0937cU, 0x6fd52da9U, 0xcf2512b3U,\r\n    0xc8ac993bU, 0x10187da7U, 0xe89c636eU, 0xdb3bbb7bU,\r\n    0xcd267809U, 0x6e5918f4U, 0xec9ab701U, 0x834f9aa8U,\r\n    0xe6956e65U, 0xaaffe67eU, 0x21bccf08U, 0xef15e8e6U,\r\n    0xbae79bd9U, 0x4a6f36ceU, 0xea9f09d4U, 0x29b07cd6U,\r\n    0x31a4b2afU, 0x2a3f2331U, 0xc6a59430U, 0x35a266c0U,\r\n    0x744ebc37U, 0xfc82caa6U, 0xe090d0b0U, 0x33a7d815U,\r\n    0xf104984aU, 0x41ecdaf7U, 0x7fcd500eU, 0x1791f62fU,\r\n    0x764dd68dU, 0x43efb04dU, 0xccaa4d54U, 0xe49604dfU,\r\n    0x9ed1b5e3U, 0x4c6a881bU, 0xc12c1fb8U, 0x4665517fU,\r\n    0x9d5eea04U, 0x018c355dU, 0xfa877473U, 0xfb0b412eU,\r\n    0xb3671d5aU, 0x92dbd252U, 0xe9105633U, 0x6dd64713U,\r\n    0x9ad7618cU, 0x37a10c7aU, 0x59f8148eU, 0xeb133c89U,\r\n    0xcea927eeU, 0xb761c935U, 0xe11ce5edU, 0x7a47b13cU,\r\n    0x9cd2df59U, 0x55f2733fU, 0x1814ce79U, 0x73c737bfU,\r\n    0x53f7cdeaU, 0x5ffdaa5bU, 0xdf3d6f14U, 0x7844db86U,\r\n    0xcaaff381U, 0xb968c43eU, 0x3824342cU, 0xc2a3405fU,\r\n    0x161dc372U, 0xbce2250cU, 0x283c498bU, 0xff0d9541U,\r\n    0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U,\r\n    0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U,\r\n};\r\nstatic const u32 Td1[256] = {\r\n    0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU,\r\n    0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U,\r\n    0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU,\r\n    0xfc4fe5d7U, 0xd7c52acbU, 0x80263544U, 0x8fb562a3U,\r\n    0x49deb15aU, 0x6725ba1bU, 0x9845ea0eU, 0xe15dfec0U,\r\n    0x02c32f75U, 0x12814cf0U, 0xa38d4697U, 0xc66bd3f9U,\r\n    0xe7038f5fU, 0x9515929cU, 0xebbf6d7aU, 0xda955259U,\r\n    0x2dd4be83U, 0xd3587421U, 0x2949e069U, 0x448ec9c8U,\r\n    0x6a75c289U, 0x78f48e79U, 0x6b99583eU, 0xdd27b971U,\r\n    0xb6bee14fU, 0x17f088adU, 0x66c920acU, 0xb47dce3aU,\r\n    0x1863df4aU, 0x82e51a31U, 0x60975133U, 0x4562537fU,\r\n    0xe0b16477U, 0x84bb6baeU, 0x1cfe81a0U, 0x94f9082bU,\r\n    0x58704868U, 0x198f45fdU, 0x8794de6cU, 0xb7527bf8U,\r\n    0x23ab73d3U, 0xe2724b02U, 0x57e31f8fU, 0x2a6655abU,\r\n    0x07b2eb28U, 0x032fb5c2U, 0x9a86c57bU, 0xa5d33708U,\r\n    0xf2302887U, 0xb223bfa5U, 0xba02036aU, 0x5ced1682U,\r\n    0x2b8acf1cU, 0x92a779b4U, 0xf0f307f2U, 0xa14e69e2U,\r\n    0xcd65daf4U, 0xd50605beU, 0x1fd13462U, 0x8ac4a6feU,\r\n    0x9d342e53U, 0xa0a2f355U, 0x32058ae1U, 0x75a4f6ebU,\r\n    0x390b83ecU, 0xaa4060efU, 0x065e719fU, 0x51bd6e10U,\r\n    0xf93e218aU, 0x3d96dd06U, 0xaedd3e05U, 0x464de6bdU,\r\n    0xb591548dU, 0x0571c45dU, 0x6f0406d4U, 0xff605015U,\r\n    0x241998fbU, 0x97d6bde9U, 0xcc894043U, 0x7767d99eU,\r\n    0xbdb0e842U, 0x8807898bU, 0x38e7195bU, 0xdb79c8eeU,\r\n    0x47a17c0aU, 0xe97c420fU, 0xc9f8841eU, 0x00000000U,\r\n    0x83098086U, 0x48322bedU, 0xac1e1170U, 0x4e6c5a72U,\r\n    0xfbfd0effU, 0x560f8538U, 0x1e3daed5U, 0x27362d39U,\r\n    0x640a0fd9U, 0x21685ca6U, 0xd19b5b54U, 0x3a24362eU,\r\n    0xb10c0a67U, 0x0f9357e7U, 0xd2b4ee96U, 0x9e1b9b91U,\r\n    0x4f80c0c5U, 0xa261dc20U, 0x695a774bU, 0x161c121aU,\r\n    0x0ae293baU, 0xe5c0a02aU, 0x433c22e0U, 0x1d121b17U,\r\n    0x0b0e090dU, 0xadf28bc7U, 0xb92db6a8U, 0xc8141ea9U,\r\n    0x8557f119U, 0x4caf7507U, 0xbbee99ddU, 0xfda37f60U,\r\n    0x9ff70126U, 0xbc5c72f5U, 0xc544663bU, 0x345bfb7eU,\r\n    0x768b4329U, 0xdccb23c6U, 0x68b6edfcU, 0x63b8e4f1U,\r\n    0xcad731dcU, 0x10426385U, 0x40139722U, 0x2084c611U,\r\n    0x7d854a24U, 0xf8d2bb3dU, 0x11aef932U, 0x6dc729a1U,\r\n    0x4b1d9e2fU, 0xf3dcb230U, 0xec0d8652U, 0xd077c1e3U,\r\n    0x6c2bb316U, 0x99a970b9U, 0xfa119448U, 0x2247e964U,\r\n    0xc4a8fc8cU, 0x1aa0f03fU, 0xd8567d2cU, 0xef223390U,\r\n    0xc787494eU, 0xc1d938d1U, 0xfe8ccaa2U, 0x3698d40bU,\r\n    0xcfa6f581U, 0x28a57adeU, 0x26dab78eU, 0xa43fadbfU,\r\n    0xe42c3a9dU, 0x0d507892U, 0x9b6a5fccU, 0x62547e46U,\r\n    0xc2f68d13U, 0xe890d8b8U, 0x5e2e39f7U, 0xf582c3afU,\r\n    0xbe9f5d80U, 0x7c69d093U, 0xa96fd52dU, 0xb3cf2512U,\r\n    0x3bc8ac99U, 0xa710187dU, 0x6ee89c63U, 0x7bdb3bbbU,\r\n    0x09cd2678U, 0xf46e5918U, 0x01ec9ab7U, 0xa8834f9aU,\r\n    0x65e6956eU, 0x7eaaffe6U, 0x0821bccfU, 0xe6ef15e8U,\r\n    0xd9bae79bU, 0xce4a6f36U, 0xd4ea9f09U, 0xd629b07cU,\r\n    0xaf31a4b2U, 0x312a3f23U, 0x30c6a594U, 0xc035a266U,\r\n    0x37744ebcU, 0xa6fc82caU, 0xb0e090d0U, 0x1533a7d8U,\r\n    0x4af10498U, 0xf741ecdaU, 0x0e7fcd50U, 0x2f1791f6U,\r\n    0x8d764dd6U, 0x4d43efb0U, 0x54ccaa4dU, 0xdfe49604U,\r\n    0xe39ed1b5U, 0x1b4c6a88U, 0xb8c12c1fU, 0x7f466551U,\r\n    0x049d5eeaU, 0x5d018c35U, 0x73fa8774U, 0x2efb0b41U,\r\n    0x5ab3671dU, 0x5292dbd2U, 0x33e91056U, 0x136dd647U,\r\n    0x8c9ad761U, 0x7a37a10cU, 0x8e59f814U, 0x89eb133cU,\r\n    0xeecea927U, 0x35b761c9U, 0xede11ce5U, 0x3c7a47b1U,\r\n    0x599cd2dfU, 0x3f55f273U, 0x791814ceU, 0xbf73c737U,\r\n    0xea53f7cdU, 0x5b5ffdaaU, 0x14df3d6fU, 0x867844dbU,\r\n    0x81caaff3U, 0x3eb968c4U, 0x2c382434U, 0x5fc2a340U,\r\n    0x72161dc3U, 0x0cbce225U, 0x8b283c49U, 0x41ff0d95U,\r\n    0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U,\r\n    0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U,\r\n};\r\nstatic const u32 Td2[256] = {\r\n    0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U,\r\n    0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U,\r\n    0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U,\r\n    0xd7fc4fe5U, 0xcbd7c52aU, 0x44802635U, 0xa38fb562U,\r\n    0x5a49deb1U, 0x1b6725baU, 0x0e9845eaU, 0xc0e15dfeU,\r\n    0x7502c32fU, 0xf012814cU, 0x97a38d46U, 0xf9c66bd3U,\r\n    0x5fe7038fU, 0x9c951592U, 0x7aebbf6dU, 0x59da9552U,\r\n    0x832dd4beU, 0x21d35874U, 0x692949e0U, 0xc8448ec9U,\r\n    0x896a75c2U, 0x7978f48eU, 0x3e6b9958U, 0x71dd27b9U,\r\n    0x4fb6bee1U, 0xad17f088U, 0xac66c920U, 0x3ab47dceU,\r\n    0x4a1863dfU, 0x3182e51aU, 0x33609751U, 0x7f456253U,\r\n    0x77e0b164U, 0xae84bb6bU, 0xa01cfe81U, 0x2b94f908U,\r\n    0x68587048U, 0xfd198f45U, 0x6c8794deU, 0xf8b7527bU,\r\n    0xd323ab73U, 0x02e2724bU, 0x8f57e31fU, 0xab2a6655U,\r\n    0x2807b2ebU, 0xc2032fb5U, 0x7b9a86c5U, 0x08a5d337U,\r\n    0x87f23028U, 0xa5b223bfU, 0x6aba0203U, 0x825ced16U,\r\n    0x1c2b8acfU, 0xb492a779U, 0xf2f0f307U, 0xe2a14e69U,\r\n    0xf4cd65daU, 0xbed50605U, 0x621fd134U, 0xfe8ac4a6U,\r\n    0x539d342eU, 0x55a0a2f3U, 0xe132058aU, 0xeb75a4f6U,\r\n    0xec390b83U, 0xefaa4060U, 0x9f065e71U, 0x1051bd6eU,\r\n\r\n    0x8af93e21U, 0x063d96ddU, 0x05aedd3eU, 0xbd464de6U,\r\n    0x8db59154U, 0x5d0571c4U, 0xd46f0406U, 0x15ff6050U,\r\n    0xfb241998U, 0xe997d6bdU, 0x43cc8940U, 0x9e7767d9U,\r\n    0x42bdb0e8U, 0x8b880789U, 0x5b38e719U, 0xeedb79c8U,\r\n    0x0a47a17cU, 0x0fe97c42U, 0x1ec9f884U, 0x00000000U,\r\n    0x86830980U, 0xed48322bU, 0x70ac1e11U, 0x724e6c5aU,\r\n    0xfffbfd0eU, 0x38560f85U, 0xd51e3daeU, 0x3927362dU,\r\n    0xd9640a0fU, 0xa621685cU, 0x54d19b5bU, 0x2e3a2436U,\r\n    0x67b10c0aU, 0xe70f9357U, 0x96d2b4eeU, 0x919e1b9bU,\r\n    0xc54f80c0U, 0x20a261dcU, 0x4b695a77U, 0x1a161c12U,\r\n    0xba0ae293U, 0x2ae5c0a0U, 0xe0433c22U, 0x171d121bU,\r\n    0x0d0b0e09U, 0xc7adf28bU, 0xa8b92db6U, 0xa9c8141eU,\r\n    0x198557f1U, 0x074caf75U, 0xddbbee99U, 0x60fda37fU,\r\n    0x269ff701U, 0xf5bc5c72U, 0x3bc54466U, 0x7e345bfbU,\r\n    0x29768b43U, 0xc6dccb23U, 0xfc68b6edU, 0xf163b8e4U,\r\n    0xdccad731U, 0x85104263U, 0x22401397U, 0x112084c6U,\r\n    0x247d854aU, 0x3df8d2bbU, 0x3211aef9U, 0xa16dc729U,\r\n    0x2f4b1d9eU, 0x30f3dcb2U, 0x52ec0d86U, 0xe3d077c1U,\r\n    0x166c2bb3U, 0xb999a970U, 0x48fa1194U, 0x642247e9U,\r\n    0x8cc4a8fcU, 0x3f1aa0f0U, 0x2cd8567dU, 0x90ef2233U,\r\n    0x4ec78749U, 0xd1c1d938U, 0xa2fe8ccaU, 0x0b3698d4U,\r\n    0x81cfa6f5U, 0xde28a57aU, 0x8e26dab7U, 0xbfa43fadU,\r\n    0x9de42c3aU, 0x920d5078U, 0xcc9b6a5fU, 0x4662547eU,\r\n    0x13c2f68dU, 0xb8e890d8U, 0xf75e2e39U, 0xaff582c3U,\r\n    0x80be9f5dU, 0x937c69d0U, 0x2da96fd5U, 0x12b3cf25U,\r\n    0x993bc8acU, 0x7da71018U, 0x636ee89cU, 0xbb7bdb3bU,\r\n    0x7809cd26U, 0x18f46e59U, 0xb701ec9aU, 0x9aa8834fU,\r\n    0x6e65e695U, 0xe67eaaffU, 0xcf0821bcU, 0xe8e6ef15U,\r\n    0x9bd9bae7U, 0x36ce4a6fU, 0x09d4ea9fU, 0x7cd629b0U,\r\n    0xb2af31a4U, 0x23312a3fU, 0x9430c6a5U, 0x66c035a2U,\r\n    0xbc37744eU, 0xcaa6fc82U, 0xd0b0e090U, 0xd81533a7U,\r\n    0x984af104U, 0xdaf741ecU, 0x500e7fcdU, 0xf62f1791U,\r\n    0xd68d764dU, 0xb04d43efU, 0x4d54ccaaU, 0x04dfe496U,\r\n    0xb5e39ed1U, 0x881b4c6aU, 0x1fb8c12cU, 0x517f4665U,\r\n    0xea049d5eU, 0x355d018cU, 0x7473fa87U, 0x412efb0bU,\r\n    0x1d5ab367U, 0xd25292dbU, 0x5633e910U, 0x47136dd6U,\r\n    0x618c9ad7U, 0x0c7a37a1U, 0x148e59f8U, 0x3c89eb13U,\r\n    0x27eecea9U, 0xc935b761U, 0xe5ede11cU, 0xb13c7a47U,\r\n    0xdf599cd2U, 0x733f55f2U, 0xce791814U, 0x37bf73c7U,\r\n    0xcdea53f7U, 0xaa5b5ffdU, 0x6f14df3dU, 0xdb867844U,\r\n    0xf381caafU, 0xc43eb968U, 0x342c3824U, 0x405fc2a3U,\r\n    0xc372161dU, 0x250cbce2U, 0x498b283cU, 0x9541ff0dU,\r\n    0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U,\r\n    0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U,\r\n};\r\nstatic const u32 Td3[256] = {\r\n    0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU,\r\n    0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU,\r\n    0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U,\r\n    0xe5d7fc4fU, 0x2acbd7c5U, 0x35448026U, 0x62a38fb5U,\r\n    0xb15a49deU, 0xba1b6725U, 0xea0e9845U, 0xfec0e15dU,\r\n    0x2f7502c3U, 0x4cf01281U, 0x4697a38dU, 0xd3f9c66bU,\r\n    0x8f5fe703U, 0x929c9515U, 0x6d7aebbfU, 0x5259da95U,\r\n    0xbe832dd4U, 0x7421d358U, 0xe0692949U, 0xc9c8448eU,\r\n    0xc2896a75U, 0x8e7978f4U, 0x583e6b99U, 0xb971dd27U,\r\n    0xe14fb6beU, 0x88ad17f0U, 0x20ac66c9U, 0xce3ab47dU,\r\n    0xdf4a1863U, 0x1a3182e5U, 0x51336097U, 0x537f4562U,\r\n    0x6477e0b1U, 0x6bae84bbU, 0x81a01cfeU, 0x082b94f9U,\r\n    0x48685870U, 0x45fd198fU, 0xde6c8794U, 0x7bf8b752U,\r\n    0x73d323abU, 0x4b02e272U, 0x1f8f57e3U, 0x55ab2a66U,\r\n    0xeb2807b2U, 0xb5c2032fU, 0xc57b9a86U, 0x3708a5d3U,\r\n    0x2887f230U, 0xbfa5b223U, 0x036aba02U, 0x16825cedU,\r\n    0xcf1c2b8aU, 0x79b492a7U, 0x07f2f0f3U, 0x69e2a14eU,\r\n    0xdaf4cd65U, 0x05bed506U, 0x34621fd1U, 0xa6fe8ac4U,\r\n    0x2e539d34U, 0xf355a0a2U, 0x8ae13205U, 0xf6eb75a4U,\r\n    0x83ec390bU, 0x60efaa40U, 0x719f065eU, 0x6e1051bdU,\r\n    0x218af93eU, 0xdd063d96U, 0x3e05aeddU, 0xe6bd464dU,\r\n    0x548db591U, 0xc45d0571U, 0x06d46f04U, 0x5015ff60U,\r\n    0x98fb2419U, 0xbde997d6U, 0x4043cc89U, 0xd99e7767U,\r\n    0xe842bdb0U, 0x898b8807U, 0x195b38e7U, 0xc8eedb79U,\r\n    0x7c0a47a1U, 0x420fe97cU, 0x841ec9f8U, 0x00000000U,\r\n    0x80868309U, 0x2bed4832U, 0x1170ac1eU, 0x5a724e6cU,\r\n    0x0efffbfdU, 0x8538560fU, 0xaed51e3dU, 0x2d392736U,\r\n    0x0fd9640aU, 0x5ca62168U, 0x5b54d19bU, 0x362e3a24U,\r\n    0x0a67b10cU, 0x57e70f93U, 0xee96d2b4U, 0x9b919e1bU,\r\n    0xc0c54f80U, 0xdc20a261U, 0x774b695aU, 0x121a161cU,\r\n    0x93ba0ae2U, 0xa02ae5c0U, 0x22e0433cU, 0x1b171d12U,\r\n    0x090d0b0eU, 0x8bc7adf2U, 0xb6a8b92dU, 0x1ea9c814U,\r\n    0xf1198557U, 0x75074cafU, 0x99ddbbeeU, 0x7f60fda3U,\r\n    0x01269ff7U, 0x72f5bc5cU, 0x663bc544U, 0xfb7e345bU,\r\n    0x4329768bU, 0x23c6dccbU, 0xedfc68b6U, 0xe4f163b8U,\r\n    0x31dccad7U, 0x63851042U, 0x97224013U, 0xc6112084U,\r\n    0x4a247d85U, 0xbb3df8d2U, 0xf93211aeU, 0x29a16dc7U,\r\n    0x9e2f4b1dU, 0xb230f3dcU, 0x8652ec0dU, 0xc1e3d077U,\r\n    0xb3166c2bU, 0x70b999a9U, 0x9448fa11U, 0xe9642247U,\r\n    0xfc8cc4a8U, 0xf03f1aa0U, 0x7d2cd856U, 0x3390ef22U,\r\n    0x494ec787U, 0x38d1c1d9U, 0xcaa2fe8cU, 0xd40b3698U,\r\n    0xf581cfa6U, 0x7ade28a5U, 0xb78e26daU, 0xadbfa43fU,\r\n    0x3a9de42cU, 0x78920d50U, 0x5fcc9b6aU, 0x7e466254U,\r\n    0x8d13c2f6U, 0xd8b8e890U, 0x39f75e2eU, 0xc3aff582U,\r\n    0x5d80be9fU, 0xd0937c69U, 0xd52da96fU, 0x2512b3cfU,\r\n    0xac993bc8U, 0x187da710U, 0x9c636ee8U, 0x3bbb7bdbU,\r\n    0x267809cdU, 0x5918f46eU, 0x9ab701ecU, 0x4f9aa883U,\r\n    0x956e65e6U, 0xffe67eaaU, 0xbccf0821U, 0x15e8e6efU,\r\n    0xe79bd9baU, 0x6f36ce4aU, 0x9f09d4eaU, 0xb07cd629U,\r\n    0xa4b2af31U, 0x3f23312aU, 0xa59430c6U, 0xa266c035U,\r\n    0x4ebc3774U, 0x82caa6fcU, 0x90d0b0e0U, 0xa7d81533U,\r\n    0x04984af1U, 0xecdaf741U, 0xcd500e7fU, 0x91f62f17U,\r\n    0x4dd68d76U, 0xefb04d43U, 0xaa4d54ccU, 0x9604dfe4U,\r\n    0xd1b5e39eU, 0x6a881b4cU, 0x2c1fb8c1U, 0x65517f46U,\r\n    0x5eea049dU, 0x8c355d01U, 0x877473faU, 0x0b412efbU,\r\n    0x671d5ab3U, 0xdbd25292U, 0x105633e9U, 0xd647136dU,\r\n    0xd7618c9aU, 0xa10c7a37U, 0xf8148e59U, 0x133c89ebU,\r\n    0xa927eeceU, 0x61c935b7U, 0x1ce5ede1U, 0x47b13c7aU,\r\n    0xd2df599cU, 0xf2733f55U, 0x14ce7918U, 0xc737bf73U,\r\n    0xf7cdea53U, 0xfdaa5b5fU, 0x3d6f14dfU, 0x44db8678U,\r\n    0xaff381caU, 0x68c43eb9U, 0x24342c38U, 0xa3405fc2U,\r\n    0x1dc37216U, 0xe2250cbcU, 0x3c498b28U, 0x0d9541ffU,\r\n    0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U,\r\n    0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U,\r\n};\r\nstatic const u32 Td4[256] = {\r\n    0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U,\r\n    0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U,\r\n    0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU,\r\n    0x81818181U, 0xf3f3f3f3U, 0xd7d7d7d7U, 0xfbfbfbfbU,\r\n    0x7c7c7c7cU, 0xe3e3e3e3U, 0x39393939U, 0x82828282U,\r\n    0x9b9b9b9bU, 0x2f2f2f2fU, 0xffffffffU, 0x87878787U,\r\n    0x34343434U, 0x8e8e8e8eU, 0x43434343U, 0x44444444U,\r\n    0xc4c4c4c4U, 0xdedededeU, 0xe9e9e9e9U, 0xcbcbcbcbU,\r\n    0x54545454U, 0x7b7b7b7bU, 0x94949494U, 0x32323232U,\r\n    0xa6a6a6a6U, 0xc2c2c2c2U, 0x23232323U, 0x3d3d3d3dU,\r\n    0xeeeeeeeeU, 0x4c4c4c4cU, 0x95959595U, 0x0b0b0b0bU,\r\n    0x42424242U, 0xfafafafaU, 0xc3c3c3c3U, 0x4e4e4e4eU,\r\n    0x08080808U, 0x2e2e2e2eU, 0xa1a1a1a1U, 0x66666666U,\r\n    0x28282828U, 0xd9d9d9d9U, 0x24242424U, 0xb2b2b2b2U,\r\n    0x76767676U, 0x5b5b5b5bU, 0xa2a2a2a2U, 0x49494949U,\r\n    0x6d6d6d6dU, 0x8b8b8b8bU, 0xd1d1d1d1U, 0x25252525U,\r\n    0x72727272U, 0xf8f8f8f8U, 0xf6f6f6f6U, 0x64646464U,\r\n    0x86868686U, 0x68686868U, 0x98989898U, 0x16161616U,\r\n    0xd4d4d4d4U, 0xa4a4a4a4U, 0x5c5c5c5cU, 0xccccccccU,\r\n    0x5d5d5d5dU, 0x65656565U, 0xb6b6b6b6U, 0x92929292U,\r\n    0x6c6c6c6cU, 0x70707070U, 0x48484848U, 0x50505050U,\r\n    0xfdfdfdfdU, 0xededededU, 0xb9b9b9b9U, 0xdadadadaU,\r\n    0x5e5e5e5eU, 0x15151515U, 0x46464646U, 0x57575757U,\r\n    0xa7a7a7a7U, 0x8d8d8d8dU, 0x9d9d9d9dU, 0x84848484U,\r\n    0x90909090U, 0xd8d8d8d8U, 0xababababU, 0x00000000U,\r\n    0x8c8c8c8cU, 0xbcbcbcbcU, 0xd3d3d3d3U, 0x0a0a0a0aU,\r\n    0xf7f7f7f7U, 0xe4e4e4e4U, 0x58585858U, 0x05050505U,\r\n    0xb8b8b8b8U, 0xb3b3b3b3U, 0x45454545U, 0x06060606U,\r\n    0xd0d0d0d0U, 0x2c2c2c2cU, 0x1e1e1e1eU, 0x8f8f8f8fU,\r\n    0xcacacacaU, 0x3f3f3f3fU, 0x0f0f0f0fU, 0x02020202U,\r\n    0xc1c1c1c1U, 0xafafafafU, 0xbdbdbdbdU, 0x03030303U,\r\n    0x01010101U, 0x13131313U, 0x8a8a8a8aU, 0x6b6b6b6bU,\r\n    0x3a3a3a3aU, 0x91919191U, 0x11111111U, 0x41414141U,\r\n    0x4f4f4f4fU, 0x67676767U, 0xdcdcdcdcU, 0xeaeaeaeaU,\r\n    0x97979797U, 0xf2f2f2f2U, 0xcfcfcfcfU, 0xcecececeU,\r\n    0xf0f0f0f0U, 0xb4b4b4b4U, 0xe6e6e6e6U, 0x73737373U,\r\n    0x96969696U, 0xacacacacU, 0x74747474U, 0x22222222U,\r\n    0xe7e7e7e7U, 0xadadadadU, 0x35353535U, 0x85858585U,\r\n    0xe2e2e2e2U, 0xf9f9f9f9U, 0x37373737U, 0xe8e8e8e8U,\r\n    0x1c1c1c1cU, 0x75757575U, 0xdfdfdfdfU, 0x6e6e6e6eU,\r\n    0x47474747U, 0xf1f1f1f1U, 0x1a1a1a1aU, 0x71717171U,\r\n    0x1d1d1d1dU, 0x29292929U, 0xc5c5c5c5U, 0x89898989U,\r\n    0x6f6f6f6fU, 0xb7b7b7b7U, 0x62626262U, 0x0e0e0e0eU,\r\n    0xaaaaaaaaU, 0x18181818U, 0xbebebebeU, 0x1b1b1b1bU,\r\n    0xfcfcfcfcU, 0x56565656U, 0x3e3e3e3eU, 0x4b4b4b4bU,\r\n    0xc6c6c6c6U, 0xd2d2d2d2U, 0x79797979U, 0x20202020U,\r\n    0x9a9a9a9aU, 0xdbdbdbdbU, 0xc0c0c0c0U, 0xfefefefeU,\r\n    0x78787878U, 0xcdcdcdcdU, 0x5a5a5a5aU, 0xf4f4f4f4U,\r\n    0x1f1f1f1fU, 0xddddddddU, 0xa8a8a8a8U, 0x33333333U,\r\n    0x88888888U, 0x07070707U, 0xc7c7c7c7U, 0x31313131U,\r\n    0xb1b1b1b1U, 0x12121212U, 0x10101010U, 0x59595959U,\r\n    0x27272727U, 0x80808080U, 0xececececU, 0x5f5f5f5fU,\r\n    0x60606060U, 0x51515151U, 0x7f7f7f7fU, 0xa9a9a9a9U,\r\n    0x19191919U, 0xb5b5b5b5U, 0x4a4a4a4aU, 0x0d0d0d0dU,\r\n    0x2d2d2d2dU, 0xe5e5e5e5U, 0x7a7a7a7aU, 0x9f9f9f9fU,\r\n    0x93939393U, 0xc9c9c9c9U, 0x9c9c9c9cU, 0xefefefefU,\r\n    0xa0a0a0a0U, 0xe0e0e0e0U, 0x3b3b3b3bU, 0x4d4d4d4dU,\r\n    0xaeaeaeaeU, 0x2a2a2a2aU, 0xf5f5f5f5U, 0xb0b0b0b0U,\r\n    0xc8c8c8c8U, 0xebebebebU, 0xbbbbbbbbU, 0x3c3c3c3cU,\r\n    0x83838383U, 0x53535353U, 0x99999999U, 0x61616161U,\r\n    0x17171717U, 0x2b2b2b2bU, 0x04040404U, 0x7e7e7e7eU,\r\n    0xbabababaU, 0x77777777U, 0xd6d6d6d6U, 0x26262626U,\r\n    0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U,\r\n    0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU,\r\n};\r\nstatic const u32 rcon[] = {\r\n\t0x01000000, 0x02000000, 0x04000000, 0x08000000,\r\n\t0x10000000, 0x20000000, 0x40000000, 0x80000000,\r\n\t0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */\r\n};\r\n\r\n#define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)\r\n\r\n#ifdef _MSC_VER\r\n#define GETU32(p) SWAP(*((u32 *)(p)))\r\n#define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }\r\n#else\r\n#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))\r\n#define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }\r\n#endif\r\n\r\n/**\r\n * Expand the cipher key into the encryption key schedule.\r\n *\r\n * @return\tthe number of rounds for the given cipher key size.\r\n */\r\n__forceinline int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {\r\n   \tint i = 0;\r\n\tu32 temp;\r\n\r\n\trk[0] = GETU32(cipherKey     );\r\n\trk[1] = GETU32(cipherKey +  4);\r\n\trk[2] = GETU32(cipherKey +  8);\r\n\trk[3] = GETU32(cipherKey + 12);\r\n\tif (keyBits == 128) {\r\n\t\tfor (;;) {\r\n\t\t\ttemp  = rk[3];\r\n\t\t\trk[4] = rk[0] ^\r\n\t\t\t\t(Te4[(temp >> 16) & 0xff] & 0xff000000) ^\r\n\t\t\t\t(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^\r\n\t\t\t\t(Te4[(temp      ) & 0xff] & 0x0000ff00) ^\r\n\t\t\t\t(Te4[(temp >> 24)       ] & 0x000000ff) ^\r\n\t\t\t\trcon[i];\r\n\t\t\trk[5] = rk[1] ^ rk[4];\r\n\t\t\trk[6] = rk[2] ^ rk[5];\r\n\t\t\trk[7] = rk[3] ^ rk[6];\r\n\t\t\tif (++i == 10) {\r\n\t\t\t\treturn 10;\r\n\t\t\t}\r\n\t\t\trk += 4;\r\n\t\t}\r\n\t}\r\n\trk[4] = GETU32(cipherKey + 16);\r\n\trk[5] = GETU32(cipherKey + 20);\r\n\tif (keyBits == 192) {\r\n\t\tfor (;;) {\r\n\t\t\ttemp = rk[ 5];\r\n\t\t\trk[ 6] = rk[ 0] ^\r\n\t\t\t\t(Te4[(temp >> 16) & 0xff] & 0xff000000) ^\r\n\t\t\t\t(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^\r\n\t\t\t\t(Te4[(temp      ) & 0xff] & 0x0000ff00) ^\r\n\t\t\t\t(Te4[(temp >> 24)       ] & 0x000000ff) ^\r\n\t\t\t\trcon[i];\r\n\t\t\trk[ 7] = rk[ 1] ^ rk[ 6];\r\n\t\t\trk[ 8] = rk[ 2] ^ rk[ 7];\r\n\t\t\trk[ 9] = rk[ 3] ^ rk[ 8];\r\n\t\t\tif (++i == 8) {\r\n\t\t\t\treturn 12;\r\n\t\t\t}\r\n\t\t\trk[10] = rk[ 4] ^ rk[ 9];\r\n\t\t\trk[11] = rk[ 5] ^ rk[10];\r\n\t\t\trk += 6;\r\n\t\t}\r\n\t}\r\n\trk[6] = GETU32(cipherKey + 24);\r\n\trk[7] = GETU32(cipherKey + 28);\r\n\tif (keyBits == 256) {\r\n        for (;;) {\r\n        \ttemp = rk[ 7];\r\n        \trk[ 8] = rk[ 0] ^\r\n        \t\t(Te4[(temp >> 16) & 0xff] & 0xff000000) ^\r\n        \t\t(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^\r\n        \t\t(Te4[(temp      ) & 0xff] & 0x0000ff00) ^\r\n        \t\t(Te4[(temp >> 24)       ] & 0x000000ff) ^\r\n        \t\trcon[i];\r\n        \trk[ 9] = rk[ 1] ^ rk[ 8];\r\n        \trk[10] = rk[ 2] ^ rk[ 9];\r\n        \trk[11] = rk[ 3] ^ rk[10];\r\n\t\t\tif (++i == 7) {\r\n\t\t\t\treturn 14;\r\n\t\t\t}\r\n        \ttemp = rk[11];\r\n        \trk[12] = rk[ 4] ^\r\n        \t\t(Te4[(temp >> 24)       ] & 0xff000000) ^\r\n        \t\t(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^\r\n        \t\t(Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^\r\n        \t\t(Te4[(temp      ) & 0xff] & 0x000000ff);\r\n        \trk[13] = rk[ 5] ^ rk[12];\r\n        \trk[14] = rk[ 6] ^ rk[13];\r\n        \trk[15] = rk[ 7] ^ rk[14];\r\n\r\n\t\t\trk += 8;\r\n        }\r\n\t}\r\n\treturn 0;\r\n}\r\n\r\n/**\r\n * Expand the cipher key into the decryption key schedule.\r\n *\r\n * @return\tthe number of rounds for the given cipher key size.\r\n */\r\n__forceinline int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {\r\n\tint Nr, i, j;\r\n\tu32 temp;\r\n\r\n\t/* expand the cipher key: */\r\n\tNr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);\r\n\t/* invert the order of the round keys: */\r\n\tfor (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {\r\n\t\ttemp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;\r\n\t\ttemp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;\r\n\t\ttemp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;\r\n\t\ttemp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;\r\n\t}\r\n\t/* apply the inverse MixColumn transform to all round keys but the first and the last: */\r\n\tfor (i = 1; i < Nr; i++) {\r\n\t\trk += 4;\r\n\t\trk[0] =\r\n\t\t\tTd0[Te4[(rk[0] >> 24)       ] & 0xff] ^\r\n\t\t\tTd1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^\r\n\t\t\tTd2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^\r\n\t\t\tTd3[Te4[(rk[0]      ) & 0xff] & 0xff];\r\n\t\trk[1] =\r\n\t\t\tTd0[Te4[(rk[1] >> 24)       ] & 0xff] ^\r\n\t\t\tTd1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^\r\n\t\t\tTd2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^\r\n\t\t\tTd3[Te4[(rk[1]      ) & 0xff] & 0xff];\r\n\t\trk[2] =\r\n\t\t\tTd0[Te4[(rk[2] >> 24)       ] & 0xff] ^\r\n\t\t\tTd1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^\r\n\t\t\tTd2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^\r\n\t\t\tTd3[Te4[(rk[2]      ) & 0xff] & 0xff];\r\n\t\trk[3] =\r\n\t\t\tTd0[Te4[(rk[3] >> 24)       ] & 0xff] ^\r\n\t\t\tTd1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^\r\n\t\t\tTd2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^\r\n\t\t\tTd3[Te4[(rk[3]      ) & 0xff] & 0xff];\r\n\t}\r\n\treturn Nr;\r\n}\r\n\r\n__forceinline void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) {\r\n\tu32 s0, s1, s2, s3, t0, t1, t2, t3;\r\n#ifndef FULL_UNROLL\r\n    int r;\r\n#endif /* ?FULL_UNROLL */\r\n\r\n    /*\r\n\t * map byte array block to cipher state\r\n\t * and add initial round key:\r\n\t */\r\n\ts0 = GETU32(pt     ) ^ rk[0];\r\n\ts1 = GETU32(pt +  4) ^ rk[1];\r\n\ts2 = GETU32(pt +  8) ^ rk[2];\r\n\ts3 = GETU32(pt + 12) ^ rk[3];\r\n#ifdef FULL_UNROLL\r\n    /* round 1: */\r\n   \tt0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];\r\n   \tt1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];\r\n   \tt2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];\r\n   \tt3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];\r\n   \t/* round 2: */\r\n   \ts0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];\r\n   \ts1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];\r\n   \ts2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];\r\n   \ts3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];\r\n    /* round 3: */\r\n   \tt0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];\r\n   \tt1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];\r\n   \tt2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];\r\n   \tt3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];\r\n   \t/* round 4: */\r\n   \ts0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];\r\n   \ts1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];\r\n   \ts2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];\r\n   \ts3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];\r\n    /* round 5: */\r\n   \tt0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];\r\n   \tt1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];\r\n   \tt2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];\r\n   \tt3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];\r\n   \t/* round 6: */\r\n   \ts0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];\r\n   \ts1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];\r\n   \ts2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];\r\n   \ts3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];\r\n    /* round 7: */\r\n   \tt0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];\r\n   \tt1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];\r\n   \tt2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];\r\n   \tt3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];\r\n   \t/* round 8: */\r\n   \ts0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];\r\n   \ts1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];\r\n   \ts2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];\r\n   \ts3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];\r\n    /* round 9: */\r\n   \tt0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];\r\n   \tt1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];\r\n   \tt2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];\r\n   \tt3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];\r\n    if (Nr > 10) {\r\n        /* round 10: */\r\n        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];\r\n        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];\r\n        s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];\r\n        s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];\r\n        /* round 11: */\r\n        t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];\r\n        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];\r\n        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];\r\n        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];\r\n        if (Nr > 12) {\r\n            /* round 12: */\r\n            s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];\r\n            s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];\r\n            s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];\r\n            s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];\r\n            /* round 13: */\r\n            t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];\r\n            t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];\r\n            t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];\r\n            t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];\r\n        }\r\n    }\r\n    rk += Nr << 2;\r\n#else  /* !FULL_UNROLL */\r\n    /*\r\n\t * Nr - 1 full rounds:\r\n\t */\r\n    r = Nr >> 1;\r\n    for (;;) {\r\n        t0 =\r\n            Te0[(s0 >> 24)       ] ^\r\n            Te1[(s1 >> 16) & 0xff] ^\r\n            Te2[(s2 >>  8) & 0xff] ^\r\n            Te3[(s3      ) & 0xff] ^\r\n            rk[4];\r\n        t1 =\r\n            Te0[(s1 >> 24)       ] ^\r\n            Te1[(s2 >> 16) & 0xff] ^\r\n            Te2[(s3 >>  8) & 0xff] ^\r\n            Te3[(s0      ) & 0xff] ^\r\n            rk[5];\r\n        t2 =\r\n            Te0[(s2 >> 24)       ] ^\r\n            Te1[(s3 >> 16) & 0xff] ^\r\n            Te2[(s0 >>  8) & 0xff] ^\r\n            Te3[(s1      ) & 0xff] ^\r\n            rk[6];\r\n        t3 =\r\n            Te0[(s3 >> 24)       ] ^\r\n            Te1[(s0 >> 16) & 0xff] ^\r\n            Te2[(s1 >>  8) & 0xff] ^\r\n            Te3[(s2      ) & 0xff] ^\r\n            rk[7];\r\n\r\n        rk += 8;\r\n        if (--r == 0) {\r\n            break;\r\n        }\r\n\r\n        s0 =\r\n            Te0[(t0 >> 24)       ] ^\r\n            Te1[(t1 >> 16) & 0xff] ^\r\n            Te2[(t2 >>  8) & 0xff] ^\r\n            Te3[(t3      ) & 0xff] ^\r\n            rk[0];\r\n        s1 =\r\n            Te0[(t1 >> 24)       ] ^\r\n            Te1[(t2 >> 16) & 0xff] ^\r\n            Te2[(t3 >>  8) & 0xff] ^\r\n            Te3[(t0      ) & 0xff] ^\r\n            rk[1];\r\n        s2 =\r\n            Te0[(t2 >> 24)       ] ^\r\n            Te1[(t3 >> 16) & 0xff] ^\r\n            Te2[(t0 >>  8) & 0xff] ^\r\n            Te3[(t1      ) & 0xff] ^\r\n            rk[2];\r\n        s3 =\r\n            Te0[(t3 >> 24)       ] ^\r\n            Te1[(t0 >> 16) & 0xff] ^\r\n            Te2[(t1 >>  8) & 0xff] ^\r\n            Te3[(t2      ) & 0xff] ^\r\n            rk[3];\r\n    }\r\n#endif /* ?FULL_UNROLL */\r\n    /*\r\n\t * apply last round and\r\n\t * map cipher state to byte array block:\r\n\t */\r\n\ts0 =\r\n\t\t(Te4[(t0 >> 24)       ] & 0xff000000) ^\r\n\t\t(Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Te4[(t3      ) & 0xff] & 0x000000ff) ^\r\n\t\trk[0];\r\n\tPUTU32(ct     , s0);\r\n\ts1 =\r\n\t\t(Te4[(t1 >> 24)       ] & 0xff000000) ^\r\n\t\t(Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Te4[(t0      ) & 0xff] & 0x000000ff) ^\r\n\t\trk[1];\r\n\tPUTU32(ct +  4, s1);\r\n\ts2 =\r\n\t\t(Te4[(t2 >> 24)       ] & 0xff000000) ^\r\n\t\t(Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Te4[(t1      ) & 0xff] & 0x000000ff) ^\r\n\t\trk[2];\r\n\tPUTU32(ct +  8, s2);\r\n\ts3 =\r\n\t\t(Te4[(t3 >> 24)       ] & 0xff000000) ^\r\n\t\t(Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Te4[(t2      ) & 0xff] & 0x000000ff) ^\r\n\t\trk[3];\r\n\tPUTU32(ct + 12, s3);\r\n}\r\n\r\n__forceinline void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]) {\r\n\tu32 s0, s1, s2, s3, t0, t1, t2, t3;\r\n#ifndef FULL_UNROLL\r\n    int r;\r\n#endif /* ?FULL_UNROLL */\r\n\r\n    /*\r\n\t * map byte array block to cipher state\r\n\t * and add initial round key:\r\n\t */\r\n    s0 = GETU32(ct     ) ^ rk[0];\r\n    s1 = GETU32(ct +  4) ^ rk[1];\r\n    s2 = GETU32(ct +  8) ^ rk[2];\r\n    s3 = GETU32(ct + 12) ^ rk[3];\r\n#ifdef FULL_UNROLL\r\n    /* round 1: */\r\n    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];\r\n    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];\r\n    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];\r\n    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];\r\n    /* round 2: */\r\n    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];\r\n    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];\r\n    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];\r\n    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];\r\n    /* round 3: */\r\n    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];\r\n    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];\r\n    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];\r\n    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];\r\n    /* round 4: */\r\n    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];\r\n    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];\r\n    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];\r\n    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];\r\n    /* round 5: */\r\n    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];\r\n    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];\r\n    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];\r\n    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];\r\n    /* round 6: */\r\n    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];\r\n    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];\r\n    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];\r\n    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];\r\n    /* round 7: */\r\n    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];\r\n    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];\r\n    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];\r\n    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];\r\n    /* round 8: */\r\n    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];\r\n    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];\r\n    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];\r\n    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];\r\n    /* round 9: */\r\n    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];\r\n    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];\r\n    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];\r\n    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];\r\n    if (Nr > 10) {\r\n        /* round 10: */\r\n        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];\r\n        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];\r\n        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];\r\n        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];\r\n        /* round 11: */\r\n        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];\r\n        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];\r\n        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];\r\n        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];\r\n        if (Nr > 12) {\r\n            /* round 12: */\r\n            s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];\r\n            s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];\r\n            s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];\r\n            s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];\r\n            /* round 13: */\r\n            t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];\r\n            t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];\r\n            t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];\r\n            t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];\r\n        }\r\n    }\r\n\trk += Nr << 2;\r\n#else  /* !FULL_UNROLL */\r\n    /*\r\n     * Nr - 1 full rounds:\r\n     */\r\n    r = Nr >> 1;\r\n    for (;;) {\r\n        t0 =\r\n            Td0[(s0 >> 24)       ] ^\r\n            Td1[(s3 >> 16) & 0xff] ^\r\n            Td2[(s2 >>  8) & 0xff] ^\r\n            Td3[(s1      ) & 0xff] ^\r\n            rk[4];\r\n        t1 =\r\n            Td0[(s1 >> 24)       ] ^\r\n            Td1[(s0 >> 16) & 0xff] ^\r\n            Td2[(s3 >>  8) & 0xff] ^\r\n            Td3[(s2      ) & 0xff] ^\r\n            rk[5];\r\n        t2 =\r\n            Td0[(s2 >> 24)       ] ^\r\n            Td1[(s1 >> 16) & 0xff] ^\r\n            Td2[(s0 >>  8) & 0xff] ^\r\n            Td3[(s3      ) & 0xff] ^\r\n            rk[6];\r\n        t3 =\r\n            Td0[(s3 >> 24)       ] ^\r\n            Td1[(s2 >> 16) & 0xff] ^\r\n            Td2[(s1 >>  8) & 0xff] ^\r\n            Td3[(s0      ) & 0xff] ^\r\n            rk[7];\r\n\r\n        rk += 8;\r\n        if (--r == 0) {\r\n            break;\r\n        }\r\n\r\n        s0 =\r\n            Td0[(t0 >> 24)       ] ^\r\n            Td1[(t3 >> 16) & 0xff] ^\r\n            Td2[(t2 >>  8) & 0xff] ^\r\n            Td3[(t1      ) & 0xff] ^\r\n            rk[0];\r\n        s1 =\r\n            Td0[(t1 >> 24)       ] ^\r\n            Td1[(t0 >> 16) & 0xff] ^\r\n            Td2[(t3 >>  8) & 0xff] ^\r\n            Td3[(t2      ) & 0xff] ^\r\n            rk[1];\r\n        s2 =\r\n            Td0[(t2 >> 24)       ] ^\r\n            Td1[(t1 >> 16) & 0xff] ^\r\n            Td2[(t0 >>  8) & 0xff] ^\r\n            Td3[(t3      ) & 0xff] ^\r\n            rk[2];\r\n        s3 =\r\n            Td0[(t3 >> 24)       ] ^\r\n            Td1[(t2 >> 16) & 0xff] ^\r\n            Td2[(t1 >>  8) & 0xff] ^\r\n            Td3[(t0      ) & 0xff] ^\r\n            rk[3];\r\n    }\r\n#endif /* ?FULL_UNROLL */\r\n    /*\r\n\t * apply last round and\r\n\t * map cipher state to byte array block:\r\n\t */\r\n   \ts0 =\r\n   \t\t(Td4[(t0 >> 24)       ] & 0xff000000) ^\r\n   \t\t(Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^\r\n   \t\t(Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^\r\n   \t\t(Td4[(t1      ) & 0xff] & 0x000000ff) ^\r\n   \t\trk[0];\r\n\tPUTU32(pt     , s0);\r\n   \ts1 =\r\n   \t\t(Td4[(t1 >> 24)       ] & 0xff000000) ^\r\n   \t\t(Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^\r\n   \t\t(Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^\r\n   \t\t(Td4[(t2      ) & 0xff] & 0x000000ff) ^\r\n   \t\trk[1];\r\n\tPUTU32(pt +  4, s1);\r\n   \ts2 =\r\n   \t\t(Td4[(t2 >> 24)       ] & 0xff000000) ^\r\n   \t\t(Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^\r\n   \t\t(Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^\r\n   \t\t(Td4[(t3      ) & 0xff] & 0x000000ff) ^\r\n   \t\trk[2];\r\n\tPUTU32(pt +  8, s2);\r\n   \ts3 =\r\n   \t\t(Td4[(t3 >> 24)       ] & 0xff000000) ^\r\n   \t\t(Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^\r\n   \t\t(Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^\r\n   \t\t(Td4[(t0      ) & 0xff] & 0x000000ff) ^\r\n   \t\trk[3];\r\n\tPUTU32(pt + 12, s3);\r\n}\r\n\r\n#ifdef INTERMEDIATE_VALUE_KAT\r\n\r\nvoid rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {\r\n\tint r;\r\n\tu32 s0, s1, s2, s3, t0, t1, t2, t3;\r\n\r\n    /*\r\n\t * map byte array block to cipher state\r\n\t * and add initial round key:\r\n\t */\r\n\ts0 = GETU32(block     ) ^ rk[0];\r\n\ts1 = GETU32(block +  4) ^ rk[1];\r\n\ts2 = GETU32(block +  8) ^ rk[2];\r\n\ts3 = GETU32(block + 12) ^ rk[3];\r\n    rk += 4;\r\n\r\n    /*\r\n\t * Nr - 1 full rounds:\r\n\t */\r\n\tfor (r = (rounds < Nr ? rounds : Nr - 1); r > 0; r--) {\r\n\t\tt0 =\r\n\t\t\tTe0[(s0 >> 24)       ] ^\r\n\t\t\tTe1[(s1 >> 16) & 0xff] ^\r\n\t\t\tTe2[(s2 >>  8) & 0xff] ^\r\n\t\t\tTe3[(s3      ) & 0xff] ^\r\n\t\t\trk[0];\r\n\t\tt1 =\r\n\t\t\tTe0[(s1 >> 24)       ] ^\r\n\t\t\tTe1[(s2 >> 16) & 0xff] ^\r\n\t\t\tTe2[(s3 >>  8) & 0xff] ^\r\n\t\t\tTe3[(s0      ) & 0xff] ^\r\n\t\t\trk[1];\r\n\t\tt2 =\r\n\t\t\tTe0[(s2 >> 24)       ] ^\r\n\t\t\tTe1[(s3 >> 16) & 0xff] ^\r\n\t\t\tTe2[(s0 >>  8) & 0xff] ^\r\n\t\t\tTe3[(s1      ) & 0xff] ^\r\n\t\t\trk[2];\r\n\t\tt3 =\r\n\t\t\tTe0[(s3 >> 24)       ] ^\r\n\t\t\tTe1[(s0 >> 16) & 0xff] ^\r\n\t\t\tTe2[(s1 >>  8) & 0xff] ^\r\n\t\t\tTe3[(s2      ) & 0xff] ^\r\n\t\t\trk[3];\r\n\r\n\t\ts0 = t0;\r\n\t\ts1 = t1;\r\n\t\ts2 = t2;\r\n\t\ts3 = t3;\r\n\t\trk += 4;\r\n\r\n    }\r\n\r\n    /*\r\n\t * apply last round and\r\n\t * map cipher state to byte array block:\r\n\t */\r\n\tif (rounds == Nr) {\r\n    \tt0 =\r\n    \t\t(Te4[(s0 >> 24)       ] & 0xff000000) ^\r\n    \t\t(Te4[(s1 >> 16) & 0xff] & 0x00ff0000) ^\r\n    \t\t(Te4[(s2 >>  8) & 0xff] & 0x0000ff00) ^\r\n    \t\t(Te4[(s3      ) & 0xff] & 0x000000ff) ^\r\n    \t\trk[0];\r\n    \tt1 =\r\n    \t\t(Te4[(s1 >> 24)       ] & 0xff000000) ^\r\n    \t\t(Te4[(s2 >> 16) & 0xff] & 0x00ff0000) ^\r\n    \t\t(Te4[(s3 >>  8) & 0xff] & 0x0000ff00) ^\r\n    \t\t(Te4[(s0      ) & 0xff] & 0x000000ff) ^\r\n    \t\trk[1];\r\n    \tt2 =\r\n    \t\t(Te4[(s2 >> 24)       ] & 0xff000000) ^\r\n    \t\t(Te4[(s3 >> 16) & 0xff] & 0x00ff0000) ^\r\n    \t\t(Te4[(s0 >>  8) & 0xff] & 0x0000ff00) ^\r\n    \t\t(Te4[(s1      ) & 0xff] & 0x000000ff) ^\r\n    \t\trk[2];\r\n    \tt3 =\r\n    \t\t(Te4[(s3 >> 24)       ] & 0xff000000) ^\r\n    \t\t(Te4[(s0 >> 16) & 0xff] & 0x00ff0000) ^\r\n    \t\t(Te4[(s1 >>  8) & 0xff] & 0x0000ff00) ^\r\n    \t\t(Te4[(s2      ) & 0xff] & 0x000000ff) ^\r\n    \t\trk[3];\r\n\t\t\r\n\t\ts0 = t0;\r\n\t\ts1 = t1;\r\n\t\ts2 = t2;\r\n\t\ts3 = t3;\r\n\t}\r\n\r\n\tPUTU32(block     , s0);\r\n\tPUTU32(block +  4, s1);\r\n\tPUTU32(block +  8, s2);\r\n\tPUTU32(block + 12, s3);\r\n}\r\n\r\nvoid rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {\r\n\tint r;\r\n\tu32 s0, s1, s2, s3, t0, t1, t2, t3;\r\n\r\n    /*\r\n\t * map byte array block to cipher state\r\n\t * and add initial round key:\r\n\t */\r\n\ts0 = GETU32(block     ) ^ rk[0];\r\n\ts1 = GETU32(block +  4) ^ rk[1];\r\n\ts2 = GETU32(block +  8) ^ rk[2];\r\n\ts3 = GETU32(block + 12) ^ rk[3];\r\n    rk += 4;\r\n\r\n    /*\r\n\t * Nr - 1 full rounds:\r\n\t */\r\n\tfor (r = (rounds < Nr ? rounds : Nr) - 1; r > 0; r--) {\r\n\t\tt0 =\r\n\t\t\tTd0[(s0 >> 24)       ] ^\r\n\t\t\tTd1[(s3 >> 16) & 0xff] ^\r\n\t\t\tTd2[(s2 >>  8) & 0xff] ^\r\n\t\t\tTd3[(s1      ) & 0xff] ^\r\n\t\t\trk[0];\r\n\t\tt1 =\r\n\t\t\tTd0[(s1 >> 24)       ] ^\r\n\t\t\tTd1[(s0 >> 16) & 0xff] ^\r\n\t\t\tTd2[(s3 >>  8) & 0xff] ^\r\n\t\t\tTd3[(s2      ) & 0xff] ^\r\n\t\t\trk[1];\r\n\t\tt2 =\r\n\t\t\tTd0[(s2 >> 24)       ] ^\r\n\t\t\tTd1[(s1 >> 16) & 0xff] ^\r\n\t\t\tTd2[(s0 >>  8) & 0xff] ^\r\n\t\t\tTd3[(s3      ) & 0xff] ^\r\n\t\t\trk[2];\r\n\t\tt3 =\r\n\t\t\tTd0[(s3 >> 24)       ] ^\r\n\t\t\tTd1[(s2 >> 16) & 0xff] ^\r\n\t\t\tTd2[(s1 >>  8) & 0xff] ^\r\n\t\t\tTd3[(s0      ) & 0xff] ^\r\n\t\t\trk[3];\r\n\r\n\t\ts0 = t0;\r\n\t\ts1 = t1;\r\n\t\ts2 = t2;\r\n\t\ts3 = t3;\r\n\t\trk += 4;\r\n\r\n    }\r\n\r\n    /*\r\n\t * complete the last round and\r\n\t * map cipher state to byte array block:\r\n\t */\r\n\tt0 =\r\n\t\t(Td4[(s0 >> 24)       ] & 0xff000000) ^\r\n\t\t(Td4[(s3 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Td4[(s2 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Td4[(s1      ) & 0xff] & 0x000000ff);\r\n\tt1 =\r\n\t\t(Td4[(s1 >> 24)       ] & 0xff000000) ^\r\n\t\t(Td4[(s0 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Td4[(s3 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Td4[(s2      ) & 0xff] & 0x000000ff);\r\n\tt2 =\r\n\t\t(Td4[(s2 >> 24)       ] & 0xff000000) ^\r\n\t\t(Td4[(s1 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Td4[(s0 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Td4[(s3      ) & 0xff] & 0x000000ff);\r\n\tt3 =\r\n\t\t(Td4[(s3 >> 24)       ] & 0xff000000) ^\r\n\t\t(Td4[(s2 >> 16) & 0xff] & 0x00ff0000) ^\r\n\t\t(Td4[(s1 >>  8) & 0xff] & 0x0000ff00) ^\r\n\t\t(Td4[(s0      ) & 0xff] & 0x000000ff);\r\n\r\n\tif (rounds == Nr) {\r\n\t    t0 ^= rk[0];\r\n\t    t1 ^= rk[1];\r\n\t    t2 ^= rk[2];\r\n\t    t3 ^= rk[3];\r\n\t}\r\n\r\n\tPUTU32(block     , t0);\r\n\tPUTU32(block +  4, t1);\r\n\tPUTU32(block +  8, t2);\r\n\tPUTU32(block + 12, t3);\r\n}\r\n\r\n#endif /* INTERMEDIATE_VALUE_KAT */\r\n"
  },
  {
    "path": "ep_setup/rijndael-alg-fst.h",
    "content": "/**\r\n * rijndael-alg-fst.h\r\n *\r\n * @version 3.0 (December 2000)\r\n *\r\n * Optimised ANSI C code for the Rijndael cipher (now AES)\r\n *\r\n * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>\r\n * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>\r\n * @author Paulo Barreto <paulo.barreto@terra.com.br>\r\n *\r\n * This code is hereby placed in the public domain.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS\r\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n#ifndef __RIJNDAEL_ALG_FST_H\r\n#define __RIJNDAEL_ALG_FST_H\r\n\r\n#define MAXKC\t(256/32)\r\n#define MAXKB\t(256/8)\r\n#define MAXNR\t14\r\n\r\ntypedef unsigned char\tu8;\t\r\ntypedef unsigned short\tu16;\t\r\ntypedef unsigned int\tu32;\r\n\r\nint rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);\r\nint rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);\r\nvoid rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]);\r\nvoid rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]);\r\n\r\n#ifdef INTERMEDIATE_VALUE_KAT\r\nvoid rijndaelEncryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds);\r\nvoid rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds);\r\n#endif /* INTERMEDIATE_VALUE_KAT */\r\n\r\n#endif /* __RIJNDAEL_ALG_FST_H */\r\n"
  },
  {
    "path": "ep_setup_patch/ep_setup_patch.c",
    "content": "#include <Windows.h>\r\n#include <Shlwapi.h>\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n#include \"../ExplorerPatcher/utility.h\"\r\n\r\nint WINAPI wWinMain(\r\n    _In_ HINSTANCE hInstance,\r\n    _In_opt_ HINSTANCE hPrevInstance,\r\n    _In_ LPWSTR lpCmdLine,\r\n    _In_ int nShowCmd\r\n) \r\n{\r\n    if (__argc < 3)\r\n    {\r\n        return __LINE__;\r\n    }\r\n\r\n    WCHAR wszMainModulePath[MAX_PATH];\r\n    WCHAR wszSetupPath[MAX_PATH];\r\n    wcscpy_s(wszMainModulePath, MAX_PATH, __wargv[1]);\r\n    wcscpy_s(wszSetupPath, MAX_PATH, __wargv[2]);\r\n\r\n    HMODULE hModule = LoadLibraryExW(wszMainModulePath, NULL, LOAD_LIBRARY_AS_DATAFILE);\r\n    if (hModule == NULL)\r\n    {\r\n        return __LINE__;\r\n    }\r\n\r\n    CHAR hash[100];\r\n    ZeroMemory(hash, 100);\r\n    ComputeFileHash2(hModule, wszMainModulePath, hash, 100);\r\n\r\n    FreeLibrary(hModule);\r\n\r\n    HANDLE hFile = CreateFileW(wszSetupPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);\r\n    if (hFile == INVALID_HANDLE_VALUE)\r\n    {\r\n        return __LINE__;\r\n    }\r\n\r\n    HANDLE hFileMapping = CreateFileMappingW(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);\r\n    if (!hFileMapping)\r\n    {\r\n        CloseHandle(hFile);\r\n        return __LINE__;\r\n    }\r\n\r\n    char* lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 0);\r\n    if (!lpFileBase)\r\n    {\r\n        CloseHandle(hFileMapping);\r\n        CloseHandle(hFile);\r\n        return __LINE__;\r\n    }\r\n\r\n    memcpy(lpFileBase + DOSMODE_OFFSET, hash, strlen(hash));\r\n\r\n    UnmapViewOfFile(lpFileBase);\r\n    CloseHandle(hFileMapping);\r\n    CloseHandle(hFile);\r\n\r\n    return 0;\r\n}"
  },
  {
    "path": "ep_setup_patch/ep_setup_patch.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{0c13e5f3-106b-4836-a7c2-8e5808a6ed78}</ProjectGuid>\r\n    <RootNamespace>epsetuppatch</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>Application</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\utility.c\" />\r\n    <ClCompile Include=\"ep_setup_patch.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\utility.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_setup_patch/ep_setup_patch.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_setup_patch.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"..\\ExplorerPatcher\\utility.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\utility.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_startmenu/ep_sm_forwards.h",
    "content": "#ifndef _H_EP_SM_FORWARDS\r\n#define _H_EP_SM_FORWARDS\r\n#pragma comment(linker, \"/export:?<Dispose>@Exception@Platform@@UE$AAAXXZ=wincorlib_orig.dll.?<Dispose>@Exception@Platform@@UE$AAAXXZ,@1\")\r\n#pragma comment(linker, \"/export:?<Dispose>@String@Platform@@UE$AAAXXZ=wincorlib_orig.dll.?<Dispose>@String@Platform@@UE$AAAXXZ,@2\")\r\n#pragma comment(linker, \"/export:?<Dispose>@Type@Platform@@UE$AAAXXZ=wincorlib_orig.dll.?<Dispose>@Type@Platform@@UE$AAAXXZ,@3\")\r\n#pragma comment(linker, \"/export:??0AccessDeniedException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0AccessDeniedException@Platform@@QE$AAA@PE$AAVString@1@@Z,@4\")\r\n#pragma comment(linker, \"/export:??0AccessDeniedException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0AccessDeniedException@Platform@@QE$AAA@XZ,@5\")\r\n#pragma comment(linker, \"/export:??0Attribute@Metadata@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0Attribute@Metadata@Platform@@QE$AAA@XZ,@6\")\r\n#pragma comment(linker, \"/export:??0Boolean@Platform@@QEAA@_N@Z=wincorlib_orig.dll.??0Boolean@Platform@@QEAA@_N@Z,@7\")\r\n#pragma comment(linker, \"/export:??0COMException@Platform@@QE$AAA@H@Z=wincorlib_orig.dll.??0COMException@Platform@@QE$AAA@H@Z,@8\")\r\n#pragma comment(linker, \"/export:??0COMException@Platform@@QE$AAA@HPE$AAVString@1@@Z=wincorlib_orig.dll.??0COMException@Platform@@QE$AAA@HPE$AAVString@1@@Z,@9\")\r\n#pragma comment(linker, \"/export:??0ChangedStateException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0ChangedStateException@Platform@@QE$AAA@PE$AAVString@1@@Z,@10\")\r\n#pragma comment(linker, \"/export:??0ChangedStateException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0ChangedStateException@Platform@@QE$AAA@XZ,@11\")\r\n#pragma comment(linker, \"/export:??0ClassNotRegisteredException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0ClassNotRegisteredException@Platform@@QE$AAA@PE$AAVString@1@@Z,@12\")\r\n#pragma comment(linker, \"/export:??0ClassNotRegisteredException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0ClassNotRegisteredException@Platform@@QE$AAA@XZ,@13\")\r\n#pragma comment(linker, \"/export:??0Delegate@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0Delegate@Platform@@QE$AAA@XZ,@14\")\r\n#pragma comment(linker, \"/export:??0DisconnectedException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0DisconnectedException@Platform@@QE$AAA@PE$AAVString@1@@Z,@15\")\r\n#pragma comment(linker, \"/export:??0DisconnectedException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0DisconnectedException@Platform@@QE$AAA@XZ,@16\")\r\n#pragma comment(linker, \"/export:??0Enum@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0Enum@Platform@@QE$AAA@XZ,@17\")\r\n#pragma comment(linker, \"/export:??0Exception@Platform@@QE$AAA@H@Z=wincorlib_orig.dll.??0Exception@Platform@@QE$AAA@H@Z,@18\")\r\n#pragma comment(linker, \"/export:??0Exception@Platform@@QE$AAA@HPE$AAVString@1@@Z=wincorlib_orig.dll.??0Exception@Platform@@QE$AAA@HPE$AAVString@1@@Z,@19\")\r\n#pragma comment(linker, \"/export:??0FailureException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0FailureException@Platform@@QE$AAA@PE$AAVString@1@@Z,@20\")\r\n#pragma comment(linker, \"/export:??0FailureException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0FailureException@Platform@@QE$AAA@XZ,@21\")\r\n#pragma comment(linker, \"/export:??0GridLength@Xaml@UI@Windows@@QEAA@NW4GridUnitType@123@@Z=wincorlib_orig.dll.??0GridLength@Xaml@UI@Windows@@QEAA@NW4GridUnitType@123@@Z,@22\")\r\n#pragma comment(linker, \"/export:??0IntPtr@Platform@@QEAA@H@Z=wincorlib_orig.dll.??0IntPtr@Platform@@QEAA@H@Z,@23\")\r\n#pragma comment(linker, \"/export:??0IntPtr@Platform@@QEAA@PEAX@Z=wincorlib_orig.dll.??0IntPtr@Platform@@QEAA@PEAX@Z,@24\")\r\n#pragma comment(linker, \"/export:??0InvalidArgumentException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0InvalidArgumentException@Platform@@QE$AAA@PE$AAVString@1@@Z,@25\")\r\n#pragma comment(linker, \"/export:??0InvalidArgumentException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0InvalidArgumentException@Platform@@QE$AAA@XZ,@26\")\r\n#pragma comment(linker, \"/export:??0InvalidCastException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0InvalidCastException@Platform@@QE$AAA@PE$AAVString@1@@Z,@27\")\r\n#pragma comment(linker, \"/export:??0InvalidCastException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0InvalidCastException@Platform@@QE$AAA@XZ,@28\")\r\n#pragma comment(linker, \"/export:??0MTAThreadAttribute@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0MTAThreadAttribute@Platform@@QE$AAA@XZ,@29\")\r\n#pragma comment(linker, \"/export:??0NotImplementedException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0NotImplementedException@Platform@@QE$AAA@PE$AAVString@1@@Z,@30\")\r\n#pragma comment(linker, \"/export:??0NotImplementedException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0NotImplementedException@Platform@@QE$AAA@XZ,@31\")\r\n#pragma comment(linker, \"/export:??0NullReferenceException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0NullReferenceException@Platform@@QE$AAA@PE$AAVString@1@@Z,@32\")\r\n#pragma comment(linker, \"/export:??0NullReferenceException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0NullReferenceException@Platform@@QE$AAA@XZ,@33\")\r\n#pragma comment(linker, \"/export:??0Object@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0Object@Platform@@QE$AAA@XZ,@34\")\r\n#pragma comment(linker, \"/export:??0ObjectDisposedException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0ObjectDisposedException@Platform@@QE$AAA@PE$AAVString@1@@Z,@35\")\r\n#pragma comment(linker, \"/export:??0ObjectDisposedException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0ObjectDisposedException@Platform@@QE$AAA@XZ,@36\")\r\n#pragma comment(linker, \"/export:??0OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAA@XZ,@37\")\r\n#pragma comment(linker, \"/export:??0OperationCanceledException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0OperationCanceledException@Platform@@QE$AAA@PE$AAVString@1@@Z,@38\")\r\n#pragma comment(linker, \"/export:??0OperationCanceledException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0OperationCanceledException@Platform@@QE$AAA@XZ,@39\")\r\n#pragma comment(linker, \"/export:??0OutOfBoundsException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0OutOfBoundsException@Platform@@QE$AAA@PE$AAVString@1@@Z,@40\")\r\n#pragma comment(linker, \"/export:??0OutOfBoundsException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0OutOfBoundsException@Platform@@QE$AAA@XZ,@41\")\r\n#pragma comment(linker, \"/export:??0OutOfMemoryException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0OutOfMemoryException@Platform@@QE$AAA@PE$AAVString@1@@Z,@42\")\r\n#pragma comment(linker, \"/export:??0OutOfMemoryException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0OutOfMemoryException@Platform@@QE$AAA@XZ,@43\")\r\n#pragma comment(linker, \"/export:??0Rect@Foundation@Windows@@QEAA@VPoint@12@0@Z=wincorlib_orig.dll.??0Rect@Foundation@Windows@@QEAA@VPoint@12@0@Z,@44\")\r\n#pragma comment(linker, \"/export:??0Rect@Foundation@Windows@@QEAA@VPoint@12@VSize@12@@Z=wincorlib_orig.dll.??0Rect@Foundation@Windows@@QEAA@VPoint@12@VSize@12@@Z,@45\")\r\n#pragma comment(linker, \"/export:??0RepeatBehavior@Animation@Media@Xaml@UI@Windows@@QEAA@N@Z=wincorlib_orig.dll.??0RepeatBehavior@Animation@Media@Xaml@UI@Windows@@QEAA@N@Z,@46\")\r\n#pragma comment(linker, \"/export:??0STAThreadAttribute@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0STAThreadAttribute@Platform@@QE$AAA@XZ,@47\")\r\n#pragma comment(linker, \"/export:??0SizeT@Platform@@QEAA@H@Z=wincorlib_orig.dll.??0SizeT@Platform@@QEAA@H@Z,@48\")\r\n#pragma comment(linker, \"/export:??0SizeT@Platform@@QEAA@PEAX@Z=wincorlib_orig.dll.??0SizeT@Platform@@QEAA@PEAX@Z,@49\")\r\n#pragma comment(linker, \"/export:??0Type@Platform@@QE$AAA@PE$AAVObject@1@@Z=wincorlib_orig.dll.??0Type@Platform@@QE$AAA@PE$AAVObject@1@@Z,@50\")\r\n#pragma comment(linker, \"/export:??0Type@Platform@@QE$AAA@VIntPtr@1@@Z=wincorlib_orig.dll.??0Type@Platform@@QE$AAA@VIntPtr@1@@Z,@51\")\r\n#pragma comment(linker, \"/export:??0Type@Platform@@QE$AAA@VTypeName@Interop@Xaml@UI@Windows@@@Z=wincorlib_orig.dll.??0Type@Platform@@QE$AAA@VTypeName@Interop@Xaml@UI@Windows@@@Z,@52\")\r\n#pragma comment(linker, \"/export:??0ValueType@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0ValueType@Platform@@QE$AAA@XZ,@53\")\r\n#pragma comment(linker, \"/export:??0WrongThreadException@Platform@@QE$AAA@PE$AAVString@1@@Z=wincorlib_orig.dll.??0WrongThreadException@Platform@@QE$AAA@PE$AAVString@1@@Z,@54\")\r\n#pragma comment(linker, \"/export:??0WrongThreadException@Platform@@QE$AAA@XZ=wincorlib_orig.dll.??0WrongThreadException@Platform@@QE$AAA@XZ,@55\")\r\n#pragma comment(linker, \"/export:??0char16@default@@QEAA@_W@Z=wincorlib_orig.dll.??0char16@default@@QEAA@_W@Z,@56\")\r\n#pragma comment(linker, \"/export:??0float32@default@@QEAA@M@Z=wincorlib_orig.dll.??0float32@default@@QEAA@M@Z,@57\")\r\n#pragma comment(linker, \"/export:??0float64@default@@QEAA@N@Z=wincorlib_orig.dll.??0float64@default@@QEAA@N@Z,@58\")\r\n#pragma comment(linker, \"/export:??0int16@default@@QEAA@F@Z=wincorlib_orig.dll.??0int16@default@@QEAA@F@Z,@59\")\r\n#pragma comment(linker, \"/export:??0int32@default@@QEAA@H@Z=wincorlib_orig.dll.??0int32@default@@QEAA@H@Z,@60\")\r\n#pragma comment(linker, \"/export:??0int64@default@@QEAA@_J@Z=wincorlib_orig.dll.??0int64@default@@QEAA@_J@Z,@61\")\r\n#pragma comment(linker, \"/export:??0int8@default@@QEAA@C@Z=wincorlib_orig.dll.??0int8@default@@QEAA@C@Z,@62\")\r\n#pragma comment(linker, \"/export:??0uint16@default@@QEAA@G@Z=wincorlib_orig.dll.??0uint16@default@@QEAA@G@Z,@63\")\r\n#pragma comment(linker, \"/export:??0uint32@default@@QEAA@I@Z=wincorlib_orig.dll.??0uint32@default@@QEAA@I@Z,@64\")\r\n#pragma comment(linker, \"/export:??0uint64@default@@QEAA@_K@Z=wincorlib_orig.dll.??0uint64@default@@QEAA@_K@Z,@65\")\r\n#pragma comment(linker, \"/export:??0uint8@default@@QEAA@E@Z=wincorlib_orig.dll.??0uint8@default@@QEAA@E@Z,@66\")\r\n#pragma comment(linker, \"/export:??BIntPtr@Platform@@SA?AV01@H@Z=wincorlib_orig.dll.??BIntPtr@Platform@@SA?AV01@H@Z,@67\")\r\n#pragma comment(linker, \"/export:??BIntPtr@Platform@@SA?AV01@PEAX@Z=wincorlib_orig.dll.??BIntPtr@Platform@@SA?AV01@PEAX@Z,@68\")\r\n#pragma comment(linker, \"/export:??BIntPtr@Platform@@SAPEAXV01@@Z=wincorlib_orig.dll.??BIntPtr@Platform@@SAPEAXV01@@Z,@69\")\r\n#pragma comment(linker, \"/export:??BType@Platform@@SA?AVTypeName@Interop@Xaml@UI@Windows@@PE$AAV01@@Z=wincorlib_orig.dll.??BType@Platform@@SA?AVTypeName@Interop@Xaml@UI@Windows@@PE$AAV01@@Z,@70\")\r\n#pragma comment(linker, \"/export:??BType@Platform@@SAPE$AAV01@VTypeName@Interop@Xaml@UI@Windows@@@Z=wincorlib_orig.dll.??BType@Platform@@SAPE$AAV01@VTypeName@Interop@Xaml@UI@Windows@@@Z,@71\")\r\n#pragma comment(linker, \"/export:??DMatrix3D@Media3D@Media@Xaml@UI@Windows@@SA?AV012345@V012345@0@Z=wincorlib_orig.dll.??DMatrix3D@Media3D@Media@Xaml@UI@Windows@@SA?AV012345@V012345@0@Z,@72\")\r\n#pragma comment(linker, \"/export:??GDuration@Xaml@UI@Windows@@SA?AV0123@V0123@0@Z=wincorlib_orig.dll.??GDuration@Xaml@UI@Windows@@SA?AV0123@V0123@0@Z,@73\")\r\n#pragma comment(linker, \"/export:??HDuration@Xaml@UI@Windows@@SA?AV0123@V0123@0@Z=wincorlib_orig.dll.??HDuration@Xaml@UI@Windows@@SA?AV0123@V0123@0@Z,@74\")\r\n#pragma comment(linker, \"/export:??MDuration@Xaml@UI@Windows@@SA_NV0123@0@Z=wincorlib_orig.dll.??MDuration@Xaml@UI@Windows@@SA_NV0123@0@Z,@75\")\r\n#pragma comment(linker, \"/export:??NDuration@Xaml@UI@Windows@@SA_NV0123@0@Z=wincorlib_orig.dll.??NDuration@Xaml@UI@Windows@@SA_NV0123@0@Z,@76\")\r\n#pragma comment(linker, \"/export:??ODuration@Xaml@UI@Windows@@SA_NV0123@0@Z=wincorlib_orig.dll.??ODuration@Xaml@UI@Windows@@SA_NV0123@0@Z,@77\")\r\n#pragma comment(linker, \"/export:??PDuration@Xaml@UI@Windows@@SA_NV0123@0@Z=wincorlib_orig.dll.??PDuration@Xaml@UI@Windows@@SA_NV0123@0@Z,@78\")\r\n#pragma comment(linker, \"/export:?AlignedAllocate@Heap@Details@Platform@@SAPEAX_K00@Z=wincorlib_orig.dll.?AlignedAllocate@Heap@Details@Platform@@SAPEAX_K00@Z,@79\")\r\n#pragma comment(linker, \"/export:?AlignedAllocate@Heap@Details@Platform@@SAPEAX_K0@Z=wincorlib_orig.dll.?AlignedAllocate@Heap@Details@Platform@@SAPEAX_K0@Z,@80\")\r\n#pragma comment(linker, \"/export:?AlignedAllocateException@Heap@Details@Platform@@SAPEAX_K00@Z=wincorlib_orig.dll.?AlignedAllocateException@Heap@Details@Platform@@SAPEAX_K00@Z,@81\")\r\n#pragma comment(linker, \"/export:?AlignedAllocateException@Heap@Details@Platform@@SAPEAX_K0@Z=wincorlib_orig.dll.?AlignedAllocateException@Heap@Details@Platform@@SAPEAX_K0@Z,@82\")\r\n#pragma comment(linker, \"/export:?AlignedFree@Heap@Details@Platform@@SAXPEAX@Z=wincorlib_orig.dll.?AlignedFree@Heap@Details@Platform@@SAXPEAX@Z,@83\")\r\n#pragma comment(linker, \"/export:?AlignedFreeException@Heap@Details@Platform@@SAXPEAX@Z=wincorlib_orig.dll.?AlignedFreeException@Heap@Details@Platform@@SAXPEAX@Z,@84\")\r\n#pragma comment(linker, \"/export:?Allocate@Heap@Details@Platform@@SAPEAX_K0@Z=wincorlib_orig.dll.?Allocate@Heap@Details@Platform@@SAPEAX_K0@Z,@85\")\r\n#pragma comment(linker, \"/export:?Allocate@Heap@Details@Platform@@SAPEAX_K@Z=wincorlib_orig.dll.?Allocate@Heap@Details@Platform@@SAPEAX_K@Z,@86\")\r\n#pragma comment(linker, \"/export:?AllocateException@Heap@Details@Platform@@SAPEAX_K0@Z=wincorlib_orig.dll.?AllocateException@Heap@Details@Platform@@SAPEAX_K0@Z,@87\")\r\n#pragma comment(linker, \"/export:?AllocateException@Heap@Details@Platform@@SAPEAX_K@Z=wincorlib_orig.dll.?AllocateException@Heap@Details@Platform@@SAPEAX_K@Z,@88\")\r\n#pragma comment(linker, \"/export:?Compare@Duration@Xaml@UI@Windows@@SAHV1234@0@Z=wincorlib_orig.dll.?Compare@Duration@Xaml@UI@Windows@@SAHV1234@0@Z,@89\")\r\n#pragma comment(linker, \"/export:?Contains@Rect@Foundation@Windows@@QEAA_NVPoint@23@@Z=wincorlib_orig.dll.?Contains@Rect@Foundation@Windows@@QEAA_NVPoint@23@@Z,@90\")\r\n#pragma comment(linker, \"/export:?CreateException@Exception@Platform@@SAPE$AAV12@H@Z=wincorlib_orig.dll.?CreateException@Exception@Platform@@SAPE$AAV12@H@Z,@91\")\r\n#pragma comment(linker, \"/export:?CreateException@Exception@Platform@@SAPE$AAV12@HPE$AAVString@2@@Z=wincorlib_orig.dll.?CreateException@Exception@Platform@@SAPE$AAV12@HPE$AAVString@2@@Z,@92\")\r\n#pragma comment(linker, \"/export:?CreateValue@Details@Platform@@YAPE$AAVObject@2@W4TypeCode@2@PEBX@Z=wincorlib_orig.dll.?CreateValue@Details@Platform@@YAPE$AAVObject@2@W4TypeCode@2@PEBX@Z,@93\")\r\n#pragma comment(linker, \"/export:?EnableFactoryCache@@YAXXZ=wincorlib_orig.dll.?EnableFactoryCache@@YAXXZ,@94\")\r\n#pragma comment(linker, \"/export:?EnumerateAllocatedObjects@Heap@Details@Platform@@SAXPE$AAVHeapEntryHandler@23@@Z=wincorlib_orig.dll.?EnumerateAllocatedObjects@Heap@Details@Platform@@SAXPE$AAVHeapEntryHandler@23@@Z,@95\")\r\n#pragma comment(linker, \"/export:?Equals@Attribute@Metadata@Platform@@QE$AAA_NPE$AAVObject@3@@Z=wincorlib_orig.dll.?Equals@Attribute@Metadata@Platform@@QE$AAA_NPE$AAVObject@3@@Z,@96\")\r\n#pragma comment(linker, \"/export:?Equals@Boolean@Platform@@QEAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@Boolean@Platform@@QEAA_NPE$AAVObject@2@@Z,@97\")\r\n#pragma comment(linker, \"/export:?Equals@Delegate@Platform@@QE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@Delegate@Platform@@QE$AAA_NPE$AAVObject@2@@Z,@98\")\r\n#pragma comment(linker, \"/export:?Equals@Enum@Platform@@QE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@Enum@Platform@@QE$AAA_NPE$AAVObject@2@@Z,@99\")\r\n#pragma comment(linker, \"/export:?Equals@Exception@Platform@@UE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@Exception@Platform@@UE$AAA_NPE$AAVObject@2@@Z,@100\")\r\n#pragma comment(linker, \"/export:?Equals@MTAThreadAttribute@Platform@@QE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@MTAThreadAttribute@Platform@@QE$AAA_NPE$AAVObject@2@@Z,@101\")\r\n#pragma comment(linker, \"/export:?Equals@Object@Platform@@QE$AAA_NPE$AAV12@@Z=wincorlib_orig.dll.?Equals@Object@Platform@@QE$AAA_NPE$AAV12@@Z,@102\")\r\n#pragma comment(linker, \"/export:?Equals@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAA_NPE$AAVObject@4@@Z=wincorlib_orig.dll.?Equals@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAA_NPE$AAVObject@4@@Z,@103\")\r\n#pragma comment(linker, \"/export:?Equals@STAThreadAttribute@Platform@@QE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@STAThreadAttribute@Platform@@QE$AAA_NPE$AAVObject@2@@Z,@104\")\r\n#pragma comment(linker, \"/export:?Equals@Type@Platform@@UE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@Type@Platform@@UE$AAA_NPE$AAVObject@2@@Z,@105\")\r\n#pragma comment(linker, \"/export:?Equals@ValueType@Platform@@QE$AAA_NPE$AAVObject@2@@Z=wincorlib_orig.dll.?Equals@ValueType@Platform@@QE$AAA_NPE$AAVObject@2@@Z,@106\")\r\n#pragma comment(linker, \"/export:?Equals@char16@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@char16@default@@QEAA_NPE$AAVObject@Platform@@@Z,@107\")\r\n#pragma comment(linker, \"/export:?Equals@float32@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@float32@default@@QEAA_NPE$AAVObject@Platform@@@Z,@108\")\r\n#pragma comment(linker, \"/export:?Equals@float64@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@float64@default@@QEAA_NPE$AAVObject@Platform@@@Z,@109\")\r\n#pragma comment(linker, \"/export:?Equals@int16@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@int16@default@@QEAA_NPE$AAVObject@Platform@@@Z,@110\")\r\n#pragma comment(linker, \"/export:?Equals@int32@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@int32@default@@QEAA_NPE$AAVObject@Platform@@@Z,@111\")\r\n#pragma comment(linker, \"/export:?Equals@int64@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@int64@default@@QEAA_NPE$AAVObject@Platform@@@Z,@112\")\r\n#pragma comment(linker, \"/export:?Equals@int8@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@int8@default@@QEAA_NPE$AAVObject@Platform@@@Z,@113\")\r\n#pragma comment(linker, \"/export:?Equals@uint16@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@uint16@default@@QEAA_NPE$AAVObject@Platform@@@Z,@114\")\r\n#pragma comment(linker, \"/export:?Equals@uint32@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@uint32@default@@QEAA_NPE$AAVObject@Platform@@@Z,@115\")\r\n#pragma comment(linker, \"/export:?Equals@uint64@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@uint64@default@@QEAA_NPE$AAVObject@Platform@@@Z,@116\")\r\n#pragma comment(linker, \"/export:?Equals@uint8@default@@QEAA_NPE$AAVObject@Platform@@@Z=wincorlib_orig.dll.?Equals@uint8@default@@QEAA_NPE$AAVObject@Platform@@@Z,@117\")\r\n#pragma comment(linker, \"/export:?EventSourceAdd@Details@Platform@@YA?AVEventRegistrationToken@Foundation@Windows@@PEAPEAXPEAUEventLock@12@PE$AAVDelegate@2@@Z=wincorlib_orig.dll.?EventSourceAdd@Details@Platform@@YA?AVEventRegistrationToken@Foundation@Windows@@PEAPEAXPEAUEventLock@12@PE$AAVDelegate@2@@Z,@118\")\r\n#pragma comment(linker, \"/export:?EventSourceGetTargetArray@Details@Platform@@YAPEAXPEAXPEAUEventLock@12@@Z=wincorlib_orig.dll.?EventSourceGetTargetArray@Details@Platform@@YAPEAXPEAXPEAUEventLock@12@@Z,@119\")\r\n#pragma comment(linker, \"/export:?EventSourceGetTargetArrayEvent@Details@Platform@@YAPEAXPEAXIPEBXPEA_J@Z=wincorlib_orig.dll.?EventSourceGetTargetArrayEvent@Details@Platform@@YAPEAXPEAXIPEBXPEA_J@Z,@120\")\r\n#pragma comment(linker, \"/export:?EventSourceGetTargetArraySize@Details@Platform@@YAIPEAX@Z=wincorlib_orig.dll.?EventSourceGetTargetArraySize@Details@Platform@@YAIPEAX@Z,@121\")\r\n#pragma comment(linker, \"/export:?EventSourceInitialize@Details@Platform@@YAXPEAPEAX@Z=wincorlib_orig.dll.?EventSourceInitialize@Details@Platform@@YAXPEAPEAX@Z,@122\")\r\n#pragma comment(linker, \"/export:?EventSourceRemove@Details@Platform@@YAXPEAPEAXPEAUEventLock@12@VEventRegistrationToken@Foundation@Windows@@@Z=wincorlib_orig.dll.?EventSourceRemove@Details@Platform@@YAXPEAPEAXPEAUEventLock@12@VEventRegistrationToken@Foundation@Windows@@@Z,@123\")\r\n#pragma comment(linker, \"/export:?EventSourceUninitialize@Details@Platform@@YAXPEAPEAX@Z=wincorlib_orig.dll.?EventSourceUninitialize@Details@Platform@@YAXPEAPEAX@Z,@124\")\r\n#pragma comment(linker, \"/export:?FlushFactoryCache@@YAXXZ=wincorlib_orig.dll.?FlushFactoryCache@@YAXXZ,@125\")\r\n#pragma comment(linker, \"/export:?Free@Heap@Details@Platform@@SAXPEAX@Z=wincorlib_orig.dll.?Free@Heap@Details@Platform@@SAXPEAX@Z,@126\")\r\n#pragma comment(linker, \"/export:?FreeException@Heap@Details@Platform@@SAXPEAX@Z=wincorlib_orig.dll.?FreeException@Heap@Details@Platform@@SAXPEAX@Z,@127\")\r\n#pragma comment(linker, \"/export:?GetActivationFactory@Details@Platform@@YAJPEAVModuleBase@1WRL@Microsoft@@PEAUHSTRING__@@PEAPEAUIActivationFactory@@@Z=wincorlib_orig.dll.?GetActivationFactory@Details@Platform@@YAJPEAVModuleBase@1WRL@Microsoft@@PEAUHSTRING__@@PEAPEAUIActivationFactory@@@Z,@128\")\r\n//#pragma comment(linker, \"/export:?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z=wincorlib_orig.dll.?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z,@129\")\r\n//#pragma comment(linker, \"/export:?GetCmdArguments@Details@Platform@@YAPEAPEA_WPEAH@Z=wincorlib_orig.dll.?GetCmdArguments@Details@Platform@@YAPEAPEA_WPEAH@Z,@130\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Attribute@Metadata@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Attribute@Metadata@Platform@@QE$AAAHXZ,@131\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Boolean@Platform@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@Boolean@Platform@@QEAAHXZ,@132\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Delegate@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Delegate@Platform@@QE$AAAHXZ,@133\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Enum@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Enum@Platform@@QE$AAAHXZ,@134\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Exception@Platform@@UE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Exception@Platform@@UE$AAAHXZ,@135\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Guid@Platform@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@Guid@Platform@@QEAAHXZ,@136\")\r\n#pragma comment(linker, \"/export:?GetHashCode@MTAThreadAttribute@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@MTAThreadAttribute@Platform@@QE$AAAHXZ,@137\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Object@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Object@Platform@@QE$AAAHXZ,@138\")\r\n#pragma comment(linker, \"/export:?GetHashCode@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAAHXZ,@139\")\r\n#pragma comment(linker, \"/export:?GetHashCode@STAThreadAttribute@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@STAThreadAttribute@Platform@@QE$AAAHXZ,@140\")\r\n#pragma comment(linker, \"/export:?GetHashCode@Type@Platform@@UE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@Type@Platform@@UE$AAAHXZ,@141\")\r\n#pragma comment(linker, \"/export:?GetHashCode@ValueType@Platform@@QE$AAAHXZ=wincorlib_orig.dll.?GetHashCode@ValueType@Platform@@QE$AAAHXZ,@142\")\r\n#pragma comment(linker, \"/export:?GetHashCode@char16@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@char16@default@@QEAAHXZ,@143\")\r\n#pragma comment(linker, \"/export:?GetHashCode@float32@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@float32@default@@QEAAHXZ,@144\")\r\n#pragma comment(linker, \"/export:?GetHashCode@float64@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@float64@default@@QEAAHXZ,@145\")\r\n#pragma comment(linker, \"/export:?GetHashCode@int16@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@int16@default@@QEAAHXZ,@146\")\r\n#pragma comment(linker, \"/export:?GetHashCode@int32@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@int32@default@@QEAAHXZ,@147\")\r\n#pragma comment(linker, \"/export:?GetHashCode@int64@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@int64@default@@QEAAHXZ,@148\")\r\n#pragma comment(linker, \"/export:?GetHashCode@int8@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@int8@default@@QEAAHXZ,@149\")\r\n#pragma comment(linker, \"/export:?GetHashCode@uint16@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@uint16@default@@QEAAHXZ,@150\")\r\n#pragma comment(linker, \"/export:?GetHashCode@uint32@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@uint32@default@@QEAAHXZ,@151\")\r\n#pragma comment(linker, \"/export:?GetHashCode@uint64@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@uint64@default@@QEAAHXZ,@152\")\r\n#pragma comment(linker, \"/export:?GetHashCode@uint8@default@@QEAAHXZ=wincorlib_orig.dll.?GetHashCode@uint8@default@@QEAAHXZ,@153\")\r\n#pragma comment(linker, \"/export:?GetIBoxArrayVtable@Details@Platform@@YAPEAXPEAX@Z=wincorlib_orig.dll.?GetIBoxArrayVtable@Details@Platform@@YAPEAXPEAX@Z,@154\")\r\n#pragma comment(linker, \"/export:?GetIBoxVtable@Details@Platform@@YAPEAXPEAX@Z=wincorlib_orig.dll.?GetIBoxVtable@Details@Platform@@YAPEAXPEAX@Z,@155\")\r\n#pragma comment(linker, \"/export:?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z=wincorlib_orig.dll.?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z,@156\")\r\n#pragma comment(linker, \"/export:?GetObjectContext@Details@Platform@@YAPEAUIUnknown@@XZ=wincorlib_orig.dll.?GetObjectContext@Details@Platform@@YAPEAUIUnknown@@XZ,@157\")\r\n#pragma comment(linker, \"/export:?GetProxyImpl@Details@Platform@@YAJPEAUIUnknown@@AEBU_GUID@@0PEAPEAU3@@Z=wincorlib_orig.dll.?GetProxyImpl@Details@Platform@@YAJPEAUIUnknown@@AEBU_GUID@@0PEAPEAU3@@Z,@158\")\r\n#pragma comment(linker, \"/export:?GetType@Boolean@Platform@@QEAAPE$AAVType@2@XZ=wincorlib_orig.dll.?GetType@Boolean@Platform@@QEAAPE$AAVType@2@XZ,@159\")\r\n#pragma comment(linker, \"/export:?GetType@Guid@Platform@@QEAAPE$AAVType@2@XZ=wincorlib_orig.dll.?GetType@Guid@Platform@@QEAAPE$AAVType@2@XZ,@160\")\r\n#pragma comment(linker, \"/export:?GetType@Object@Platform@@QE$AAAPE$AAVType@2@XZ=wincorlib_orig.dll.?GetType@Object@Platform@@QE$AAAPE$AAVType@2@XZ,@161\")\r\n#pragma comment(linker, \"/export:?GetType@char16@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@char16@default@@QEAAPE$AAVType@Platform@@XZ,@162\")\r\n#pragma comment(linker, \"/export:?GetType@float32@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@float32@default@@QEAAPE$AAVType@Platform@@XZ,@163\")\r\n#pragma comment(linker, \"/export:?GetType@float64@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@float64@default@@QEAAPE$AAVType@Platform@@XZ,@164\")\r\n#pragma comment(linker, \"/export:?GetType@int16@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@int16@default@@QEAAPE$AAVType@Platform@@XZ,@165\")\r\n#pragma comment(linker, \"/export:?GetType@int32@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@int32@default@@QEAAPE$AAVType@Platform@@XZ,@166\")\r\n#pragma comment(linker, \"/export:?GetType@int64@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@int64@default@@QEAAPE$AAVType@Platform@@XZ,@167\")\r\n#pragma comment(linker, \"/export:?GetType@int8@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@int8@default@@QEAAPE$AAVType@Platform@@XZ,@168\")\r\n#pragma comment(linker, \"/export:?GetType@uint16@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@uint16@default@@QEAAPE$AAVType@Platform@@XZ,@169\")\r\n#pragma comment(linker, \"/export:?GetType@uint32@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@uint32@default@@QEAAPE$AAVType@Platform@@XZ,@170\")\r\n#pragma comment(linker, \"/export:?GetType@uint64@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@uint64@default@@QEAAPE$AAVType@Platform@@XZ,@171\")\r\n#pragma comment(linker, \"/export:?GetType@uint8@default@@QEAAPE$AAVType@Platform@@XZ=wincorlib_orig.dll.?GetType@uint8@default@@QEAAPE$AAVType@Platform@@XZ,@172\")\r\n#pragma comment(linker, \"/export:?GetTypeCode@Type@Platform@@SA?AW4TypeCode@2@PE$AAV12@@Z=wincorlib_orig.dll.?GetTypeCode@Type@Platform@@SA?AW4TypeCode@2@PE$AAV12@@Z,@173\")\r\n#pragma comment(linker, \"/export:?GetWeakReference@Details@Platform@@YAPEAU__abi_IUnknown@@QE$ADVObject@2@@Z=wincorlib_orig.dll.?GetWeakReference@Details@Platform@@YAPEAU__abi_IUnknown@@QE$ADVObject@2@@Z,@174\")\r\n#pragma comment(linker, \"/export:?InitControlBlock@ControlBlock@Details@Platform@@AEAAXPEAX_N11@Z=wincorlib_orig.dll.?InitControlBlock@ControlBlock@Details@Platform@@AEAAXPEAX_N11@Z,@175\")\r\n#pragma comment(linker, \"/export:?InitializeData@Details@Platform@@YAJH@Z=wincorlib_orig.dll.?InitializeData@Details@Platform@@YAJH@Z,@176\")\r\n#pragma comment(linker, \"/export:?Intersect@Rect@Foundation@Windows@@QEAAXV123@@Z=wincorlib_orig.dll.?Intersect@Rect@Foundation@Windows@@QEAAXV123@@Z,@177\")\r\n#pragma comment(linker, \"/export:?IntersectsWith@Rect@Foundation@Windows@@QEAA_NV123@@Z=wincorlib_orig.dll.?IntersectsWith@Rect@Foundation@Windows@@QEAA_NV123@@Z,@178\")\r\n#pragma comment(linker, \"/export:?Invert@Matrix3D@Media3D@Media@Xaml@UI@Windows@@QEAAXXZ=wincorlib_orig.dll.?Invert@Matrix3D@Media3D@Media@Xaml@UI@Windows@@QEAAXXZ,@179\")\r\n#pragma comment(linker, \"/export:?ReCreateException@Exception@Platform@@SAPE$AAV12@H@Z=wincorlib_orig.dll.?ReCreateException@Exception@Platform@@SAPE$AAV12@H@Z,@180\")\r\n#pragma comment(linker, \"/export:?ReCreateFromException@Details@Platform@@YAJPE$AAVException@2@@Z=wincorlib_orig.dll.?ReCreateFromException@Details@Platform@@YAJPE$AAVException@2@@Z,@181\")\r\n#pragma comment(linker, \"/export:?ReferenceEquals@Object@Platform@@SA_NPE$AAV12@0@Z=wincorlib_orig.dll.?ReferenceEquals@Object@Platform@@SA_NPE$AAV12@0@Z,@182\")\r\n#pragma comment(linker, \"/export:?ReferenceEquals@Object@Platform@@SA_NPE$AAVString@2@0@Z=wincorlib_orig.dll.?ReferenceEquals@Object@Platform@@SA_NPE$AAVString@2@0@Z,@183\")\r\n#pragma comment(linker, \"/export:?RegisterFactories@Details@Platform@@YAPE$AAVObject@2@PEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@P6AXXZ@Z=wincorlib_orig.dll.?RegisterFactories@Details@Platform@@YAPE$AAVObject@2@PEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@P6AXXZ@Z,@184\")\r\n#pragma comment(linker, \"/export:?ReleaseInContextImpl@Details@Platform@@YAJPEAUIUnknown@@0@Z=wincorlib_orig.dll.?ReleaseInContextImpl@Details@Platform@@YAJPEAUIUnknown@@0@Z,@185\")\r\n#pragma comment(linker, \"/export:?ReleaseTarget@ControlBlock@Details@Platform@@AEAAXXZ=wincorlib_orig.dll.?ReleaseTarget@ControlBlock@Details@Platform@@AEAAXXZ,@186\")\r\n#pragma comment(linker, \"/export:?ResolveWeakReference@Details@Platform@@YAPE$AAVObject@2@AEBU_GUID@@PEAPEAU__abi_IUnknown@@@Z=wincorlib_orig.dll.?ResolveWeakReference@Details@Platform@@YAPE$AAVObject@2@AEBU_GUID@@PEAPEAU__abi_IUnknown@@@Z,@187\")\r\n#pragma comment(linker, \"/export:?RunApplicationServer@Details@Platform@@YAXPEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@PEB_W@Z=wincorlib_orig.dll.?RunApplicationServer@Details@Platform@@YAXPEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@PEB_W@Z,@188\")\r\n#pragma comment(linker, \"/export:?RunServer@Details@Platform@@YAXPEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@PEB_W@Z=wincorlib_orig.dll.?RunServer@Details@Platform@@YAXPEAPEAVModuleBase@1WRL@Microsoft@@PEAPEAU__abi_Module@@PEB_W@Z,@189\")\r\n#pragma comment(linker, \"/export:?TerminateModule@Details@Platform@@YA_NPEAVModuleBase@1WRL@Microsoft@@@Z=wincorlib_orig.dll.?TerminateModule@Details@Platform@@YA_NPEAVModuleBase@1WRL@Microsoft@@@Z,@190\")\r\n#pragma comment(linker, \"/export:?ToInt32@IntPtr@Platform@@QEAAHXZ=wincorlib_orig.dll.?ToInt32@IntPtr@Platform@@QEAAHXZ,@191\")\r\n#pragma comment(linker, \"/export:?ToString@Attribute@Metadata@Platform@@QE$AAAPE$AAVString@3@XZ=wincorlib_orig.dll.?ToString@Attribute@Metadata@Platform@@QE$AAAPE$AAVString@3@XZ,@192\")\r\n#pragma comment(linker, \"/export:?ToString@Boolean@Platform@@QEAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Boolean@Platform@@QEAAPE$AAVString@2@XZ,@193\")\r\n#pragma comment(linker, \"/export:?ToString@Delegate@Platform@@QE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Delegate@Platform@@QE$AAAPE$AAVString@2@XZ,@194\")\r\n#pragma comment(linker, \"/export:?ToString@Enum@Platform@@QE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Enum@Platform@@QE$AAAPE$AAVString@2@XZ,@195\")\r\n#pragma comment(linker, \"/export:?ToString@Exception@Platform@@UE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Exception@Platform@@UE$AAAPE$AAVString@2@XZ,@196\")\r\n#pragma comment(linker, \"/export:?ToString@Guid@Platform@@QEAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Guid@Platform@@QEAAPE$AAVString@2@XZ,@197\")\r\n#pragma comment(linker, \"/export:?ToString@MTAThreadAttribute@Platform@@QE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@MTAThreadAttribute@Platform@@QE$AAAPE$AAVString@2@XZ,@198\")\r\n#pragma comment(linker, \"/export:?ToString@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAAPE$AAVString@4@XZ=wincorlib_orig.dll.?ToString@OnePhaseConstructedAttribute@CompilerServices@Runtime@Platform@@QE$AAAPE$AAVString@4@XZ,@199\")\r\n#pragma comment(linker, \"/export:?ToString@STAThreadAttribute@Platform@@QE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@STAThreadAttribute@Platform@@QE$AAAPE$AAVString@2@XZ,@200\")\r\n#pragma comment(linker, \"/export:?ToString@Type@Platform@@UE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@Type@Platform@@UE$AAAPE$AAVString@2@XZ,@201\")\r\n#pragma comment(linker, \"/export:?ToString@ValueType@Platform@@QE$AAAPE$AAVString@2@XZ=wincorlib_orig.dll.?ToString@ValueType@Platform@@QE$AAAPE$AAVString@2@XZ,@202\")\r\n#pragma comment(linker, \"/export:?ToString@char16@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@char16@default@@QEAAPE$AAVString@Platform@@XZ,@203\")\r\n#pragma comment(linker, \"/export:?ToString@float32@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@float32@default@@QEAAPE$AAVString@Platform@@XZ,@204\")\r\n#pragma comment(linker, \"/export:?ToString@float64@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@float64@default@@QEAAPE$AAVString@Platform@@XZ,@205\")\r\n#pragma comment(linker, \"/export:?ToString@int16@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@int16@default@@QEAAPE$AAVString@Platform@@XZ,@206\")\r\n#pragma comment(linker, \"/export:?ToString@int32@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@int32@default@@QEAAPE$AAVString@Platform@@XZ,@207\")\r\n#pragma comment(linker, \"/export:?ToString@int64@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@int64@default@@QEAAPE$AAVString@Platform@@XZ,@208\")\r\n#pragma comment(linker, \"/export:?ToString@int8@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@int8@default@@QEAAPE$AAVString@Platform@@XZ,@209\")\r\n#pragma comment(linker, \"/export:?ToString@uint16@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@uint16@default@@QEAAPE$AAVString@Platform@@XZ,@210\")\r\n#pragma comment(linker, \"/export:?ToString@uint32@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@uint32@default@@QEAAPE$AAVString@Platform@@XZ,@211\")\r\n#pragma comment(linker, \"/export:?ToString@uint64@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@uint64@default@@QEAAPE$AAVString@Platform@@XZ,@212\")\r\n#pragma comment(linker, \"/export:?ToString@uint8@default@@QEAAPE$AAVString@Platform@@XZ=wincorlib_orig.dll.?ToString@uint8@default@@QEAAPE$AAVString@Platform@@XZ,@213\")\r\n#pragma comment(linker, \"/export:?UninitializeData@Details@Platform@@YAXH@Z=wincorlib_orig.dll.?UninitializeData@Details@Platform@@YAXH@Z,@214\")\r\n#pragma comment(linker, \"/export:?Union@Rect@Foundation@Windows@@QEAAXV123@@Z=wincorlib_orig.dll.?Union@Rect@Foundation@Windows@@QEAAXV123@@Z,@215\")\r\n#pragma comment(linker, \"/export:?Union@Rect@Foundation@Windows@@QEAAXVPoint@23@@Z=wincorlib_orig.dll.?Union@Rect@Foundation@Windows@@QEAAXVPoint@23@@Z,@216\")\r\n#pragma comment(linker, \"/export:?WriteLine@Console@Details@Platform@@SAXPE$AAVObject@3@@Z=wincorlib_orig.dll.?WriteLine@Console@Details@Platform@@SAXPE$AAVObject@3@@Z,@217\")\r\n#pragma comment(linker, \"/export:?WriteLine@Console@Details@Platform@@SAXPE$AAVString@3@@Z=wincorlib_orig.dll.?WriteLine@Console@Details@Platform@@SAXPE$AAVString@3@@Z,@218\")\r\n#pragma comment(linker, \"/export:?WriteLine@Console@Details@Platform@@SAXXZ=wincorlib_orig.dll.?WriteLine@Console@Details@Platform@@SAXXZ,@219\")\r\n#pragma comment(linker, \"/export:?__abi_FailFast@@YAXXZ=wincorlib_orig.dll.?__abi_FailFast@@YAXXZ,@220\")\r\n#pragma comment(linker, \"/export:?__abi_ObjectToString@__abi_details@@YAPE$AAVString@Platform@@PE$AAVObject@3@_N@Z=wincorlib_orig.dll.?__abi_ObjectToString@__abi_details@@YAPE$AAVString@Platform@@PE$AAVObject@3@_N@Z,@221\")\r\n#pragma comment(linker, \"/export:?__abi_Resolve@ControlBlock@Details@Platform@@UEAAJAEAVGuid@3@PEAPEAU__abi_IInspectable@@@Z=wincorlib_orig.dll.?__abi_Resolve@ControlBlock@Details@Platform@@UEAAJAEAVGuid@3@PEAPEAU__abi_IInspectable@@@Z,@222\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseAccessDeniedException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseAccessDeniedException@@YAXXZ,@223\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseCOMException@@YAXJ@Z=wincorlib_orig.dll.?__abi_WinRTraiseCOMException@@YAXJ@Z,@224\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseChangedStateException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseChangedStateException@@YAXXZ,@225\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseClassNotRegisteredException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseClassNotRegisteredException@@YAXXZ,@226\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseDisconnectedException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseDisconnectedException@@YAXXZ,@227\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseFailureException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseFailureException@@YAXXZ,@228\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseInvalidArgumentException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseInvalidArgumentException@@YAXXZ,@229\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseInvalidCastException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseInvalidCastException@@YAXXZ,@230\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseNotImplementedException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseNotImplementedException@@YAXXZ,@231\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseNullReferenceException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseNullReferenceException@@YAXXZ,@232\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseObjectDisposedException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseObjectDisposedException@@YAXXZ,@233\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseOperationCanceledException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseOperationCanceledException@@YAXXZ,@234\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseOutOfBoundsException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseOutOfBoundsException@@YAXXZ,@235\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseOutOfMemoryException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseOutOfMemoryException@@YAXXZ,@236\")\r\n#pragma comment(linker, \"/export:?__abi_WinRTraiseWrongThreadException@@YAXXZ=wincorlib_orig.dll.?__abi_WinRTraiseWrongThreadException@@YAXXZ,@237\")\r\n#pragma comment(linker, \"/export:?__abi_cast_Object_to_String@__abi_details@@YAPE$AAVString@Platform@@_NPE$AAVObject@3@@Z=wincorlib_orig.dll.?__abi_cast_Object_to_String@__abi_details@@YAPE$AAVString@Platform@@_NPE$AAVObject@3@@Z,@238\")\r\n#pragma comment(linker, \"/export:?__abi_cast_String_to_Object@__abi_details@@YAPE$AAVObject@Platform@@PE$AAVString@3@@Z=wincorlib_orig.dll.?__abi_cast_String_to_Object@__abi_details@@YAPE$AAVObject@Platform@@PE$AAVString@3@@Z,@239\")\r\n#pragma comment(linker, \"/export:?__abi_make_type_id@@YAPE$AAVType@Platform@@AEBU__abi_type_descriptor@@@Z=wincorlib_orig.dll.?__abi_make_type_id@@YAPE$AAVType@Platform@@AEBU__abi_type_descriptor@@@Z,@240\")\r\n#pragma comment(linker, \"/export:?__abi_translateCurrentException@@YAJ_N@Z=wincorlib_orig.dll.?__abi_translateCurrentException@@YAJ_N@Z,@241\")\r\n#pragma comment(linker, \"/export:?__getActivationFactoryByHSTRING@@YAJPEAUHSTRING__@@AEAVGuid@Platform@@PEAPEAX@Z=wincorlib_orig.dll.?__getActivationFactoryByHSTRING@@YAJPEAUHSTRING__@@AEAVGuid@Platform@@PEAPEAX@Z,@242\")\r\n#pragma comment(linker, \"/export:?get@Bottom@Rect@Foundation@Windows@@QEAAMXZ=wincorlib_orig.dll.?get@Bottom@Rect@Foundation@Windows@@QEAAMXZ,@243\")\r\n#pragma comment(linker, \"/export:?get@BreakOnAllocationId@Heap@Details@Platform@@SAHXZ=wincorlib_orig.dll.?get@BreakOnAllocationId@Heap@Details@Platform@@SAHXZ,@244\")\r\n#pragma comment(linker, \"/export:?get@BreakOnFreeId@Heap@Details@Platform@@SAHXZ=wincorlib_orig.dll.?get@BreakOnFreeId@Heap@Details@Platform@@SAHXZ,@245\")\r\n#pragma comment(linker, \"/export:?get@CurrentAllocationId@Heap@Details@Platform@@SAHXZ=wincorlib_orig.dll.?get@CurrentAllocationId@Heap@Details@Platform@@SAHXZ,@246\")\r\n#pragma comment(linker, \"/export:?get@Empty@Rect@Foundation@Windows@@SA?AV234@XZ=wincorlib_orig.dll.?get@Empty@Rect@Foundation@Windows@@SA?AV234@XZ,@247\")\r\n#pragma comment(linker, \"/export:?get@Empty@Size@Foundation@Windows@@SA?AV234@XZ=wincorlib_orig.dll.?get@Empty@Size@Foundation@Windows@@SA?AV234@XZ,@248\")\r\n#pragma comment(linker, \"/export:?get@FullName@Type@Platform@@QE$AAAPE$AAVString@3@XZ=wincorlib_orig.dll.?get@FullName@Type@Platform@@QE$AAAPE$AAVString@3@XZ,@249\")\r\n#pragma comment(linker, \"/export:?get@HasInverse@Matrix3D@Media3D@Media@Xaml@UI@Windows@@QEAA_NXZ=wincorlib_orig.dll.?get@HasInverse@Matrix3D@Media3D@Media@Xaml@UI@Windows@@QEAA_NXZ,@250\")\r\n#pragma comment(linker, \"/export:?get@Message@Exception@Platform@@QE$AAAPE$AAVString@3@XZ=wincorlib_orig.dll.?get@Message@Exception@Platform@@QE$AAAPE$AAVString@3@XZ,@251\")\r\n#pragma comment(linker, \"/export:?get@ObjectCount@Heap@Details@Platform@@SAHXZ=wincorlib_orig.dll.?get@ObjectCount@Heap@Details@Platform@@SAHXZ,@252\")\r\n#pragma comment(linker, \"/export:?get@Right@Rect@Foundation@Windows@@QEAAMXZ=wincorlib_orig.dll.?get@Right@Rect@Foundation@Windows@@QEAAMXZ,@253\")\r\n#pragma comment(linker, \"/export:?get@TrackingLevel@Heap@Details@Platform@@SA?AW4HeapAllocationTrackingLevel@34@XZ=wincorlib_orig.dll.?get@TrackingLevel@Heap@Details@Platform@@SA?AW4HeapAllocationTrackingLevel@34@XZ,@254\")\r\n#pragma comment(linker, \"/export:?set@BreakOnAllocationId@Heap@Details@Platform@@SAXH@Z=wincorlib_orig.dll.?set@BreakOnAllocationId@Heap@Details@Platform@@SAXH@Z,@255\")\r\n#pragma comment(linker, \"/export:?set@BreakOnFreeId@Heap@Details@Platform@@SAXH@Z=wincorlib_orig.dll.?set@BreakOnFreeId@Heap@Details@Platform@@SAXH@Z,@256\")\r\n#pragma comment(linker, \"/export:?set@TrackingLevel@Heap@Details@Platform@@SAXW4HeapAllocationTrackingLevel@34@@Z=wincorlib_orig.dll.?set@TrackingLevel@Heap@Details@Platform@@SAXW4HeapAllocationTrackingLevel@34@@Z,@257\")\r\n#endif"
  },
  {
    "path": "ep_startmenu/ep_sm_main.c",
    "content": "#include <Windows.h>\r\n#include <initguid.h>\r\n// #include <valinet/hooking/iatpatch.h>\r\n#include <valinet/utility/memmem.h>\r\n#include \"../ExplorerPatcher/utility.h\"\r\n#include \"ep_sm_forwards.h\"\r\n#pragma comment(lib, \"Dbghelp.lib\")\r\n\r\nHMODULE hModule = NULL;\r\nHMODULE hOrig = NULL;\r\nSRWLOCK lockInstanced = { .Ptr = SRWLOCK_INIT };\r\nBOOL bInstanced = FALSE;\r\nBOOL g_bIsUsingOwnJumpViewUI = FALSE;\r\nBOOL g_bIsUsingOwnStartUI = FALSE;\r\n\r\nDEFINE_GUID(IID_StartDocked_App, 0x4C2CAEAD, 0x9DA8, 0x30EC, 0xB6, 0xD3, 0xCB, 0xD5, 0x74, 0xED, 0xCB, 0x35); // 4C2CAEAD-9DA8-30EC-B6D3-CBD574EDCB35\r\nDEFINE_GUID(IID_StartUI_App, 0x1ECDC9E0, 0xBDB1, 0x3551, 0x8C, 0xEE, 0x4B, 0x77, 0x54, 0x0C, 0x44, 0xB3); // 1ECDC9E0-BDB1-3551-8CEE-4B77540C44B3\r\nDEFINE_GUID(IID_StartDocked_XamlMetaDataProvider, 0xD5783E97, 0x0462, 0x3A6B, 0xAA, 0x60, 0x50, 0x0D, 0xB1, 0x1D, 0x3E, 0xF6); // D5783E97-0462-3A6B-AA60-500DB11D3EF6\r\nDEFINE_GUID(IID_StartUI_XamlMetaDataProvider, 0xF2777C41, 0xD2CC, 0x34B6, 0xA7, 0xEA, 0x19, 0xF6, 0xC6, 0x5F, 0x0C, 0x19); // F2777C41-D2CC-34B6-A7EA-19F6C65F0C19\r\n\r\n/*BOOL start_GetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType)\r\n{\r\n    *pdwReturnedProductType = 119;\r\n    return TRUE;\r\n}*/\r\n\r\nBOOL GetStartUIName(WCHAR* out, int cch)\r\n{\r\n    if (out && cch)\r\n        out[0] = 0;\r\n\r\n    WCHAR szPath[MAX_PATH];\r\n    wcscpy_s(szPath, MAX_PATH, L\"StartUI.dll\");\r\n    if (FileExistsW(szPath))\r\n    {\r\n        if (out && cch)\r\n            wcscpy_s(out, cch, szPath);\r\n        return TRUE;\r\n    }\r\n\r\n    wcscpy_s(szPath, MAX_PATH, L\"StartUI_.dll\");\r\n    if (FileExistsW(szPath))\r\n    {\r\n        g_bIsUsingOwnStartUI = TRUE;\r\n        if (out && cch)\r\n            wcscpy_s(out, cch, szPath);\r\n        return TRUE;\r\n    }\r\n\r\n    return FALSE;\r\n}\r\n\r\nWCHAR g_szStartUIName[MAX_PATH];\r\n\r\nBOOL GetStartShowClassicMode()\r\n{\r\n    DWORD dwStartShowClassicMode = 0;\r\n    DWORD dwSize = sizeof(DWORD);\r\n    RegGetValueW(HKEY_CURRENT_USER, L\"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Explorer\\\\Advanced\", L\"Start_ShowClassicMode\", RRF_RT_DWORD, NULL, &dwStartShowClassicMode, &dwSize);\r\n    if (dwStartShowClassicMode == 0)\r\n        return FALSE;\r\n\r\n    if (!GetStartUIName(g_szStartUIName, ARRAYSIZE(g_szStartUIName)))\r\n        return FALSE;\r\n\r\n    return TRUE;\r\n}\r\n\r\nvoid PatchXamlMetaDataProviderGuid()\r\n{\r\n    static BOOL bPatched = FALSE;\r\n    if (bPatched)\r\n    {\r\n        return;\r\n    }\r\n    bPatched = TRUE;\r\n\r\n    PBYTE beginRData;\r\n    DWORD sizeRData;\r\n    if (!RDataSectionBeginAndSize(GetModuleHandleW(NULL), &beginRData, &sizeRData))\r\n    {\r\n        return;\r\n    }\r\n\r\n    GUID* pguidTarget = memmem(beginRData, sizeRData, (void*)&IID_StartDocked_XamlMetaDataProvider, sizeof(GUID));\r\n    if (!pguidTarget)\r\n    {\r\n        return;\r\n    }\r\n\r\n    DWORD dwOldProtect = 0;\r\n    if (VirtualProtect(pguidTarget, sizeof(GUID), PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n    {\r\n        *pguidTarget = IID_StartUI_XamlMetaDataProvider;\r\n        VirtualProtect(pguidTarget, sizeof(GUID), dwOldProtect, &dwOldProtect);\r\n    }\r\n}\r\n\r\nvoid Init()\r\n{\r\n    if (GetStartShowClassicMode())\r\n    {\r\n        // VnPatchIAT(GetModuleHandleW(NULL), \"api-ms-win-core-sysinfo-l1-2-0.dll\", \"GetProductInfo\", start_GetProductInfo);\r\n        PatchXamlMetaDataProviderGuid();\r\n        if (g_bIsUsingOwnStartUI)\r\n        {\r\n            LoadLibraryW(g_szStartUIName);\r\n        }\r\n        if (FileExistsW(L\"JumpViewUI_.dll\"))\r\n        {\r\n            LoadLibraryW(L\"JumpViewUI_.dll\");\r\n            g_bIsUsingOwnJumpViewUI = TRUE;\r\n        }\r\n\r\n        PBYTE beginText;\r\n        DWORD sizeText;\r\n        if (TextSectionBeginAndSize(GetModuleHandleW(NULL), &beginText, &sizeText))\r\n        {\r\n            // Fix 0x800704DA (The service is already registered) exception when feature flag 58205615 is enabled\r\n            // Feature flag introduced in:\r\n            // - Germanium Client 26100.5742+\r\n            // - Germanium Server 26461+\r\n            // - Bromine Canary 27924+ (reworked in 27938)\r\n            // Used to be inlined in StartMenuExperienceHost::App::OnLaunched(), the rework made it be called using\r\n            // std::call_once, therefore we have a function that we can make it do nothing.\r\n\r\n            // StartMenuExperienceHost::App::SetExperienceManagerPropertiesAsync()\r\n            // Early return that function\r\n#if defined(_M_X64)\r\n            // TODO Improve pattern\r\n            // 40 53 57 48 83 EC 28 E8 ?? ?? ?? ?? 48 8B D8 48 89 44 24 40 48 8B C8\r\n            PBYTE match = FindPattern(\r\n                beginText,\r\n                sizeText,\r\n                \"\\x40\\x53\\x57\\x48\\x83\\xEC\\x28\\xE8\\x00\\x00\\x00\\x00\\x48\\x8B\\xD8\\x48\\x89\\x44\\x24\\x40\\x48\\x8B\\xC8\",\r\n                \"xxxxxxxx????xxxxxxxxxxx\"\r\n            );\r\n            if (match)\r\n            {\r\n                DWORD dwOldProtect = 0;\r\n                if (VirtualProtect(match, 1, PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n                {\r\n                    match[0] = 0xC3; // ret\r\n                    VirtualProtect(match, 1, dwOldProtect, &dwOldProtect);\r\n                }\r\n            }\r\n#elif defined(_M_ARM64)\r\n            // TODO Improve pattern\r\n            // 7F 23 03 D5 F3 53 BF A9 FD 7B BC A9 FD 03 00 91 30 00 80 92 B0 0F 00 F9\r\n            // ----------- PACIBSP, don't scan for this because it's everywhere\r\n            PBYTE match = FindPattern(\r\n                beginText,\r\n                sizeText,\r\n                \"\\xF3\\x53\\xBF\\xA9\\xFD\\x7B\\xBC\\xA9\\xFD\\x03\\x00\\x91\\x30\\x00\\x80\\x92\\xB0\\x0F\\x00\\xF9\",\r\n                \"xxxxxxxxxxxxxxxxxxxx\"\r\n            );\r\n            if (match)\r\n            {\r\n                match -= 4; // include PACIBSP\r\n                DWORD dwOldProtect = 0;\r\n                if (VirtualProtect(match, 4, PAGE_EXECUTE_READWRITE, &dwOldProtect))\r\n                {\r\n                    *(DWORD*)match = 0xD65F03C0; // RET\r\n                    VirtualProtect(match, 4, dwOldProtect, &dwOldProtect);\r\n                }\r\n            }\r\n#endif\r\n        }\r\n    }\r\n    HMODULE hMod;\r\n    GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, hModule, &hMod);\r\n    bInstanced = TRUE;\r\n}\r\n\r\n#pragma comment(linker, \"/export:?GetCmdArguments@Details@Platform@@YAPEAPEA_WPEAH@Z=GetCmdArguments,@130\")\r\nwchar_t* GetCmdArguments(int* a1)\r\n{\r\n    AcquireSRWLockExclusive(&lockInstanced);\r\n    if (!hOrig)\r\n    {\r\n        hOrig = LoadLibraryW(L\"wincorlib_orig.dll\");\r\n    }\r\n    static wchar_t* (*pGetCmdArguments)(int*) = NULL;\r\n    if (!pGetCmdArguments && hOrig)\r\n    {\r\n        pGetCmdArguments = GetProcAddress(hOrig, \"?GetCmdArguments@Details@Platform@@YAPEAPEA_WPEAH@Z\");\r\n    }\r\n    if (!pGetCmdArguments)\r\n    {\r\n        ReleaseSRWLockExclusive(&lockInstanced);\r\n        return NULL;\r\n    }\r\n\r\n    if (!bInstanced) Init();\r\n    ReleaseSRWLockExclusive(&lockInstanced);\r\n    return pGetCmdArguments(a1);\r\n}\r\n\r\nextern HRESULT LoadOurShellCommonPri();\r\nextern HRESULT GetActivationFactoryByPCWSTR_InStartUI(PCWSTR activatableClassId, REFIID riid, void** ppv);\r\nextern HRESULT GetActivationFactoryByPCWSTR_InJumpViewUI(PCWSTR activatableClassId, REFIID riid, void** ppv);\r\n\r\n#pragma comment(linker, \"/export:?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z=GetActivationFactoryByPCWSTR,@129\")\r\nHRESULT GetActivationFactoryByPCWSTR(PCWSTR activatableClassId, REFIID riid, void** ppv)\r\n{\r\n    if (!hOrig)\r\n    {\r\n        hOrig = LoadLibraryW(L\"wincorlib_orig.dll\");\r\n    }\r\n    static HRESULT (*pGetActivationFactoryByPCWSTR)(PCWSTR, REFIID, void**) = NULL;\r\n    if (!pGetActivationFactoryByPCWSTR && hOrig)\r\n    {\r\n        pGetActivationFactoryByPCWSTR = GetProcAddress(hOrig, \"?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z\");\r\n    }\r\n    if (!pGetActivationFactoryByPCWSTR)\r\n    {\r\n        return E_FAIL;\r\n    }\r\n\r\n    if (!wcscmp(activatableClassId, L\"StartDocked.App\") && IsEqualGUID(riid, &IID_StartDocked_App))\r\n    {\r\n        if (GetStartShowClassicMode())\r\n        {\r\n            LoadOurShellCommonPri();\r\n            return GetActivationFactoryByPCWSTR_InStartUI(L\"StartUI.App\", &IID_StartUI_App, ppv);\r\n        }\r\n    }\r\n    else if (!wcscmp(activatableClassId, L\"StartDocked.startdocked_XamlTypeInfo.XamlMetaDataProvider\"))\r\n    {\r\n        if (GetStartShowClassicMode())\r\n        {\r\n            return GetActivationFactoryByPCWSTR_InStartUI(L\"StartUI.startui_XamlTypeInfo.XamlMetaDataProvider\", riid, ppv);\r\n        }\r\n    }\r\n    else if (wcsncmp(activatableClassId, L\"StartUI.\", 8) == 0)\r\n    {\r\n        return GetActivationFactoryByPCWSTR_InStartUI(activatableClassId, riid, ppv);\r\n    }\r\n    else if (wcsncmp(activatableClassId, L\"JumpViewUI.\", 11) == 0)\r\n    {\r\n        if (g_bIsUsingOwnJumpViewUI)\r\n        {\r\n            return GetActivationFactoryByPCWSTR_InJumpViewUI(activatableClassId, riid, ppv);\r\n        }\r\n    }\r\n\r\n    return pGetActivationFactoryByPCWSTR(activatableClassId, riid, ppv);\r\n}\r\n\r\nBOOL WINAPI DllMain(\r\n    _In_ HINSTANCE hinstDLL,\r\n    _In_ DWORD     fdwReason,\r\n    _In_ LPVOID    lpvReserved\r\n)\r\n{\r\n    switch (fdwReason)\r\n    {\r\n    case DLL_PROCESS_ATTACH:\r\n        DisableThreadLibraryCalls(hinstDLL);\r\n        hModule = hinstDLL;\r\n        break;\r\n    case DLL_THREAD_ATTACH:\r\n        break;\r\n    case DLL_THREAD_DETACH:\r\n        break;\r\n    case DLL_PROCESS_DETACH:\r\n        break;\r\n    }\r\n    return TRUE;\r\n}\r\n"
  },
  {
    "path": "ep_startmenu/ep_sm_main_cpp.cpp",
    "content": "#include <Windows.h>\r\n#include <ShlObj_core.h>\r\n#include <strsafe.h>\r\n#include <windows.foundation.h>\r\n#include <windows.applicationmodel.resources.core.h>\r\n\r\n#include <wrl/client.h>\r\n#include <wrl/wrappers/corewrappers.h>\r\n\r\nnamespace ABI::Windows::ApplicationModel::Resources::Core::Internal\r\n{\r\n    MIDL_INTERFACE(\"4a8eac58-b652-459d-8de1-239471e8b22b\")\r\n    IResourceManagerStaticInternal : IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE GetResourceManagerForSystemProfile(IResourceManager** result) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCurrentResourceManagerForSystemProfile(IResourceManager** result) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetCurrentResourceManagerState(DWORD* result) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"c408a1f1-3ede-41e9-9a38-c203678c2df7\")\r\n    ISystemResourceManagerExtensions : IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE GetDefaultResourceContextForCurrentThread(IResourceContext**) = 0;\r\n        virtual HRESULT STDMETHODCALLTYPE GetMrtResourceManagerForResourceManager(IInspectable**) = 0;\r\n    };\r\n\r\n    MIDL_INTERFACE(\"8c25e859-1042-4da0-9232-bf2aa8ff3726\")\r\n    ISystemResourceManagerExtensions2 : IInspectable\r\n    {\r\n        virtual HRESULT STDMETHODCALLTYPE LoadPriFileForSystemUse(const WCHAR* path) = 0;\r\n    };\r\n}\r\n\r\nusing namespace Microsoft::WRL;\r\n\r\nextern \"C\" HRESULT LoadOurShellCommonPri()\r\n{\r\n    using namespace ABI::Windows::Foundation;\r\n    using namespace ABI::Windows::ApplicationModel::Resources::Core;\r\n    using namespace ABI::Windows::ApplicationModel::Resources::Core::Internal;\r\n\r\n    ComPtr<IResourceManagerStaticInternal> spResourceManagerStaticInternal;\r\n    HRESULT hr = GetActivationFactory(\r\n        Wrappers::HStringReference(RuntimeClass_Windows_ApplicationModel_Resources_Core_ResourceManager).Get(),\r\n        &spResourceManagerStaticInternal);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    ComPtr<IResourceManager> spResourceManager;\r\n    hr = spResourceManagerStaticInternal->GetCurrentResourceManagerForSystemProfile(&spResourceManager);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    ComPtr<ISystemResourceManagerExtensions2> spSystemResourceManagerExtensions2;\r\n    hr = spResourceManager.As(&spSystemResourceManagerExtensions2);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    WCHAR wszPath[MAX_PATH] = {};\r\n    hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAM_FILES, nullptr, SHGFP_TYPE_CURRENT, wszPath);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    hr = StringCchCatW(wszPath, MAX_PATH, L\"\\\\ExplorerPatcher\\\\Windows.UI.ShellCommon.pri\");\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    hr = spSystemResourceManagerExtensions2->LoadPriFileForSystemUse(wszPath);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    return hr;\r\n}\r\n\r\nextern \"C\" WCHAR g_szStartUIName[MAX_PATH];\r\n\r\nextern \"C\" HRESULT GetActivationFactoryByPCWSTR_InStartUI(PCWSTR activatableClassId, REFIID riid, void** ppv)\r\n{\r\n    typedef HRESULT (WINAPI* DllGetActivationFactory_t)(HSTRING, IActivationFactory**);\r\n    static DllGetActivationFactory_t pfnGetActivationFactory;\r\n    if (!pfnGetActivationFactory)\r\n    {\r\n        HMODULE hModule = GetModuleHandleW(g_szStartUIName);\r\n        if (hModule)\r\n        {\r\n            pfnGetActivationFactory = (DllGetActivationFactory_t)GetProcAddress(hModule, \"DllGetActivationFactory\");\r\n        }\r\n    }\r\n\r\n    if (!pfnGetActivationFactory)\r\n        return E_FAIL;\r\n\r\n    ComPtr<IActivationFactory> activationFactory;\r\n    HRESULT hr = pfnGetActivationFactory(Wrappers::HStringReference(activatableClassId).Get(), &activationFactory);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    return activationFactory.CopyTo(riid, ppv);\r\n}\r\n\r\nextern \"C\" HRESULT GetActivationFactoryByPCWSTR_InJumpViewUI(PCWSTR activatableClassId, REFIID riid, void** ppv)\r\n{\r\n    typedef HRESULT (WINAPI* DllGetActivationFactory_t)(HSTRING, IActivationFactory**);\r\n    static DllGetActivationFactory_t pfnGetActivationFactory;\r\n    if (!pfnGetActivationFactory)\r\n    {\r\n        HMODULE hModule = GetModuleHandleW(L\"JumpViewUI_.dll\");\r\n        if (hModule)\r\n        {\r\n            pfnGetActivationFactory = (DllGetActivationFactory_t)GetProcAddress(hModule, \"DllGetActivationFactory\");\r\n        }\r\n    }\r\n\r\n    if (!pfnGetActivationFactory)\r\n        return E_FAIL;\r\n\r\n    ComPtr<IActivationFactory> activationFactory;\r\n    HRESULT hr = pfnGetActivationFactory(Wrappers::HStringReference(activatableClassId).Get(), &activationFactory);\r\n    if (FAILED(hr))\r\n        return hr;\r\n\r\n    return activationFactory.CopyTo(riid, ppv);\r\n}\r\n"
  },
  {
    "path": "ep_startmenu/ep_startmenu.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{6bf03eea-200a-4698-9555-057dd52b0c78}</ProjectGuid>\r\n    <RootNamespace>epstartmenu</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <TargetName>$(ProjectName)</TargetName>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <LanguageStandard>stdcpp20</LanguageStandard>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"ep_sm_forwards.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_sm_main.c\" />\r\n    <ClCompile Include=\"ep_sm_main_cpp.cpp\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_startmenu/ep_startmenu.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"ep_sm_forwards.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_sm_main.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"..\\ExplorerPatcher\\ExplorerPatcher.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_weather_host/ep_weather.c",
    "content": "#include \"ep_weather.h\"\n#include \"ep_weather_factory.h\"\n#include \"ep_weather_host.h\"\n\nHMODULE epw_hModule;\nDWORD epw_OutstandingObjects = 0;\nDWORD epw_LockCount = 0;\n\nvoid(*RefreshImmersiveColorPolicyState)();\nvoid(*SetPreferredAppMode)(INT64 bAllowDark);\nvoid(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);\nBOOL(*ShouldAppsUseDarkMode)();\nBOOL(*ShouldSystemUseDarkMode)();\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllRegisterServer=_DllRegisterServer\")\n#else\n#pragma comment(linker, \"/export:DllRegisterServer=__DllRegisterServer@0\")\n#endif\nHRESULT WINAPI _DllRegisterServer()\n{\n    DWORD dwLastError = ERROR_SUCCESS;\n    HKEY hKey = NULL;\n    DWORD dwSize = 0;\n    wchar_t wszFilename[MAX_PATH];\n    wchar_t wszInstallPath[MAX_PATH];\n\n    if (!dwLastError)\n    {\n        if (!GetModuleFileNameW(epw_hModule, wszFilename, MAX_PATH))\n        {\n            dwLastError = GetLastError();\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\CLSID\\\\\") _T(CLSID_EPWeather_TEXT),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                _T(CLSID_EPWeather_Name),\n                29 * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"AppID\",\n                0,\n                REG_SZ,\n                _T(CLSID_EPWeather_TEXT),\n                39 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\CLSID\\\\\") _T(CLSID_EPWeather_TEXT) _T(\"\\\\InProcServer32\"),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                wszFilename,\n                (wcslen(wszFilename) + 1) * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"ThreadingModel\",\n                0,\n                REG_SZ,\n                L\"Apartment\",\n                10 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\AppID\\\\\") _T(CLSID_EPWeather_TEXT),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                _T(CLSID_EPWeather_Name),\n                29 * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"DllSurrogate\",\n                0,\n                REG_SZ,\n                L\"\",\n                1 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n        dwLastError = RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\AppID\\\\\") _T(CLSID_EPWeather_TEXT),\n            0,\n            NULL,\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE | KEY_WOW64_64KEY,\n            NULL,\n            &hKey,\n            NULL\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegSetValueExW(\n                hKey,\n                NULL,\n                0,\n                REG_SZ,\n                _T(CLSID_EPWeather_Name),\n                29 * sizeof(wchar_t)\n            );\n            dwLastError = RegSetValueExW(\n                hKey,\n                L\"DllSurrogate\",\n                0,\n                REG_SZ,\n                L\"\",\n                1 * sizeof(wchar_t)\n            );\n            RegCloseKey(hKey);\n        }\n    }\n\n    return dwLastError == 0 ? (NOERROR) : (HRESULT_FROM_WIN32(dwLastError));\n}\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllUnregisterServer=_DllUnregisterServer\")\n#else\n#pragma comment(linker, \"/export:DllUnregisterServer=__DllUnregisterServer@0\")\n#endif\nHRESULT WINAPI _DllUnregisterServer()\n{\n    DWORD dwLastError = ERROR_SUCCESS;\n    HKEY hKey = NULL;\n    DWORD dwSize = 0;\n    wchar_t wszFilename[MAX_PATH];\n\n    if (!dwLastError)\n    {\n        if (!GetModuleFileNameW(epw_hModule, wszFilename, MAX_PATH))\n        {\n            dwLastError = GetLastError();\n        }\n    }\n    if (!dwLastError)\n    {\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\CLSID\\\\\") _T(CLSID_EPWeather_TEXT),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    _T(\"SOFTWARE\\\\Classes\\\\CLSID\\\\\") _T(CLSID_EPWeather_TEXT)\n                );\n            }\n        }\n        dwLastError = RegOpenKeyW(\n            HKEY_LOCAL_MACHINE,\n            _T(\"SOFTWARE\\\\Classes\\\\AppID\\\\\") _T(CLSID_EPWeather_TEXT),\n            &hKey\n        );\n        if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)\n        {\n            hKey = NULL;\n        }\n        if (hKey)\n        {\n            dwLastError = RegDeleteTreeW(\n                hKey,\n                0\n            );\n            RegCloseKey(hKey);\n            if (!dwLastError)\n            {\n                RegDeleteTreeW(\n                    HKEY_LOCAL_MACHINE,\n                    _T(\"SOFTWARE\\\\Classes\\\\AppID\\\\\") _T(CLSID_EPWeather_TEXT)\n                );\n            }\n        }\n    }\n\n    return dwLastError == 0 ? (NOERROR) : (HRESULT_FROM_WIN32(dwLastError));\n}\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllCanUnloadNow=_DllCanUnloadNow\")\n#else\n#pragma comment(linker, \"/export:DllCanUnloadNow=__DllCanUnloadNow@0\")\n#endif\nHRESULT WINAPI _DllCanUnloadNow()\n{\n    return((epw_OutstandingObjects | epw_LockCount) ? S_FALSE : S_OK);\n}\n\n#ifdef _WIN64\n#pragma comment(linker, \"/export:DllGetClassObject=_DllGetClassObject\")\n#else\n#pragma comment(linker, \"/export:DllGetClassObject=__DllGetClassObject@12\")\n#endif\nHRESULT WINAPI _DllGetClassObject(\n    REFCLSID objGuid,\n    REFIID   factoryGuid,\n    LPVOID* factoryHandle\n)\n{\n    HRESULT  hr;\n    if (IsEqualCLSID(objGuid, &CLSID_EPWeather))\n    {\n        hr = ClassFactory->lpVtbl->QueryInterface(\n            ClassFactory,\n            factoryGuid,\n            factoryHandle\n        );\n    }\n    else\n    {\n        *factoryHandle = 0;\n        hr = CLASS_E_CLASSNOTAVAILABLE;\n    }\n\n    return(hr);\n}\n\nBOOL WINAPI DllMain(\n    _In_ HINSTANCE hinstDLL,\n    _In_ DWORD     fdwReason,\n    _In_ LPVOID    lpvReserved\n)\n{\n    switch (fdwReason)\n    {\n    case DLL_PROCESS_ATTACH:\n        DisableThreadLibraryCalls(hinstDLL);\n        epw_hModule = hinstDLL;\n        break;\n    case DLL_THREAD_ATTACH:\n        break;\n    case DLL_THREAD_DETACH:\n        break;\n    case DLL_PROCESS_DETACH:\n        break;\n    }\n    return TRUE;\n}\n"
  },
  {
    "path": "ep_weather_host/ep_weather.h",
    "content": "#ifndef _H_AS_H_\r\n#define _H_AS_H_\r\n#include <initguid.h>\r\n#include <Windows.h>\r\n#include <tchar.h>\r\n#include <Shlwapi.h>\r\n\r\n#pragma comment(lib, \"Version.lib\")\r\n#pragma comment(lib, \"Shlwapi.lib\")\r\n\r\n#ifndef NTDDI_WIN10_CO\r\n#define DWMWA_USE_HOSTBACKDROPBRUSH 17            // [set] BOOL, Allows the use of host backdrop brushes for the window.\r\n#define DWMWA_USE_IMMERSIVE_DARK_MODE 20          // [set] BOOL, Allows a window to either use the accent color, or dark, according to the user Color Mode preferences.\r\n#define DWMWA_WINDOW_CORNER_PREFERENCE 33         // [set] WINDOW_CORNER_PREFERENCE, Controls the policy that rounds top-level window corners\r\n#define DWMWA_BORDER_COLOR 34                     // [set] COLORREF, The color of the thin border around a top-level window\r\n#define DWMWA_CAPTION_COLOR 35                    // [set] COLORREF, The color of the caption\r\n#define DWMWA_TEXT_COLOR 36                       // [set] COLORREF, The color of the caption text\r\n#define DWMWA_VISIBLE_FRAME_BORDER_THICKNESS 37   // [get] UINT, width of the visible border around a thick frame window\r\n#define DWMWCP_DEFAULT 0\r\n#define DWMWCP_DONOTROUND 1\r\n#define DWMWCP_ROUND 2\r\n#define DWMWCP_ROUNDSMALL 3\r\n#endif\r\n\r\n#define ALLOC(x) calloc(1, x)\r\n#define FREE(x) free(x)\r\n\r\nextern HMODULE epw_hModule;\r\nextern DWORD epw_OutstandingObjects;\r\nextern DWORD epw_LockCount;\r\n\r\n// {A6EA9C2D-4982-4827-9204-0AC532959F6D}\r\n#define CLSID_EPWeather_Name \"ExplorerPatcher Weather Host\"\r\n#define CLSID_EPWeather_TEXT \"{A6EA9C2D-4982-4827-9204-0AC532959F6D}\"\r\n#define EP_Weather_Killswitch \"Global\\\\EP_Weather_Killswitch_\" CLSID_EPWeather_TEXT\r\nDEFINE_GUID(CLSID_EPWeather,\r\n    0xa6ea9c2d, 0x4982, 0x4827, 0x92, 0x4, 0xa, 0xc5, 0x32, 0x95, 0x9f, 0x6d);\r\n\r\n#if defined(__cplusplus) && !defined(CINTERFACE)\r\n#else\r\nDEFINE_GUID(IID_IEPWeather,\r\n    0xcdbf3734, 0xf847, 0x4f1b, 0xb9, 0x53, 0xa6, 0x5, 0x43, 0x4d, 0xc1, 0xe7);\r\n#endif\r\n\r\n#define EPW_WEATHER_CLASSNAME \"ExplorerPatcher_Weather_\" CLSID_EPWeather_TEXT\r\n\r\n#define EP_WEATHER_KEEP_VALUE -1\r\n\r\n#define EP_WEATHER_NUM_PROVIDERS 2\r\n#define EP_WEATHER_PROVIDER_TEST 0\r\n#define EP_WEATHER_PROVIDER_GOOGLE 1\r\n\r\n#define EP_WEATHER_NUM_TUNITS 2\r\n#define EP_WEATHER_TUNIT_CELSIUS 0\r\n#define EP_WEATHER_TUNIT_FAHRENHEIT 1\r\n\r\n#define EP_WEATHER_VIEW_ICONONLY 1\r\n#define EP_WEATHER_VIEW_ICONTEMP 3\r\n#define EP_WEATHER_VIEW_ICONTEXT 0\r\n#define EP_WEATHER_VIEW_TEMPONLY 4\r\n#define EP_WEATHER_VIEW_TEXTONLY 5\r\n\r\n#define EP_WEATHER_UPDATE_NORMAL 1200\r\n#define EP_WEATHER_UPDATE_REDUCED 3600\r\n\r\n#define EP_WEATHER_WM_FETCH_DATA (WM_USER + 10)\r\n#define EP_WEATHER_WM_SET_BROWSER_THEME (WM_USER + 11)\r\n#define EP_WEATHER_WM_REBOUND_BROWSER (WM_USER + 12)\r\n#define EP_WEATHER_WM_SETDEVMODE (WM_USER + 13)\r\n#define EP_WEATHER_WM_SETZOOMFACTOR (WM_USER + 14)\r\n\r\n#define EP_WEATHER_HEIGHT_ERROR 280\r\n#define EP_WEATHER_HEIGHT 353\r\n#define EP_WEATHER_WIDTH 673\r\n\r\n#define EP_WEATHER_ICONPACK_MICROSOFT 0\r\n#define EP_WEATHER_ICONPACK_GOOGLE 1\r\n#endif\r\n"
  },
  {
    "path": "ep_weather_host/ep_weather_error_html.h",
    "content": "#ifndef _H_EP_WEATHER_ERROR_HTML_H_\r\n#define _H_EP_WEATHER_ERROR_HTML_H_\r\n#include <Windows.h>\r\n#include <tchar.h>\r\n#define EP_WEATHER_ERROR_LEN 2000\r\nLPCWSTR ep_weather_error_html = L\"\\\r\n<!DOCTYPE html>\\n\\\r\n<html lang=\\\"en\\\" xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\\r\n<head>\\n\\\r\n<meta charset=\\\"utf-8\\\" />\\n\\\r\n<meta name=\\\"color-scheme\\\" content=\\\"light dark\\\">\\n\\\r\n<title>\" _T(CLSID_EPWeather_TEXT) L\"_ErrorPage</title>\\n\\\r\n<style>\\n\\\r\nhtml {\\n\\\r\n  background-color: transparent !important;\\n\\\r\n}\\n\\\r\nbody {\\n\\\r\n  font-family: 'Segoe UI';\\n\\\r\n  display: flex;\\n\\\r\n  justify-content: center;\\n\\\r\n  align-items: center;\\n\\\r\n}\\n\\\r\n@media (prefers-color-scheme: dark) {\\n\\\r\n  .refreshLink   { color: #43a7ff; }\\n\\\r\n}\\n\\\r\n@media (prefers-color-scheme: light) {\\n\\\r\n  .refreshLink   { color: #096bda; }\\n\\\r\n}\\n\\\r\na:link {\\n\\\r\n  text-decoration: none;\\n\\\r\n}\\n\\\r\na:visited {\\n\\\r\n  text-decoration: none;\\n\\\r\n}\\n\\\r\na:hover {\\n\\\r\n  text-decoration: underline;\\n\\\r\n}\\n\\\r\na:active {\\n\\\r\n  text-decoration: underline;\\n\\\r\n}\\n\\\r\n</style>\\n\\\r\n</head>\\n\\\r\n<body><center>\\n\\\r\n<h1>&#128240;</h1>\\n\\\r\n<h2>Unable to load weather information</h2>\\n\\\r\n<p>Make sure that the location you have entered is correct.<br/>\\n\\\r\nVerify that you are connected to the Internet.</p>\\n\\\r\n<a class=\\\"refreshLink\\\" href=\\\"epweather://refresh\\\">Reload</a>\\n\\\r\n</center></body>\\n\\\r\n</html>\";\r\n#endif\r\n"
  },
  {
    "path": "ep_weather_host/ep_weather_factory.c",
    "content": "#include \"ep_weather_factory.h\"\r\n#include \"ep_weather_host.h\"\r\n\r\nULONG STDMETHODCALLTYPE epw_factory_AddRef(IClassFactory* _this)\r\n{\r\n    return(1);\r\n}\r\n\r\nULONG STDMETHODCALLTYPE epw_factory_Release(IClassFactory* _this)\r\n{\r\n    return(1);\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE epw_factory_QueryInterface(\r\n    IClassFactory* _this,\r\n    REFIID riid,\r\n    void** ppv\r\n)\r\n{\r\n    if (!IsEqualIID(riid, &IID_IUnknown) &&\r\n        !IsEqualIID(riid, &IID_IClassFactory))\r\n    {\r\n        *ppv = 0;\r\n        return(E_NOINTERFACE);\r\n    }\r\n    *ppv = _this;\r\n    _this->lpVtbl->AddRef(_this);\r\n    return(NOERROR);\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE epw_factory_LockServer(\r\n    IClassFactory* this,\r\n    BOOL flock\r\n)\r\n{\r\n    if (flock) InterlockedIncrement(&epw_LockCount);\r\n    else\r\n    {\r\n        LONG dwOutstandingLocks = InterlockedDecrement(&epw_LockCount);\r\n        LONG dwOutstandingObjects = InterlockedAdd(&epw_OutstandingObjects, 0);\r\n        if (!dwOutstandingObjects && !dwOutstandingLocks)\r\n        {\r\n        }\r\n    }\r\n    return(NOERROR);\r\n}\r\n\r\nHRESULT STDMETHODCALLTYPE epw_factory_CreateInstance(\r\n    IClassFactory* _this,\r\n    IUnknown* punkOuter,\r\n    REFIID vTableGuid,\r\n    void** ppv\r\n)\r\n{\r\n    HRESULT hr = E_NOINTERFACE;\r\n    EPWeather* thisobj = NULL;\r\n\r\n    *ppv = 0;\r\n\r\n    if (punkOuter)\r\n    {\r\n        hr = CLASS_E_NOAGGREGATION;\r\n    }\r\n    else\r\n    {\r\n        BOOL bOk = FALSE;\r\n        if (IsEqualIID(vTableGuid, &IID_IEPWeather))\r\n        {\r\n            if (!(thisobj = ALLOC(sizeof(EPWeather))))\r\n            {\r\n                hr = E_OUTOFMEMORY;\r\n            }\r\n            else\r\n            {\r\n                thisobj->lpVtbl = &IEPWeather_Vtbl;\r\n                bOk = TRUE;\r\n            }\r\n        }\r\n        if (bOk)\r\n        {\r\n            thisobj->cbCount = 1;\r\n            hr = thisobj->lpVtbl->QueryInterface(thisobj, vTableGuid, ppv);\r\n            thisobj->lpVtbl->Release(thisobj);\r\n            if (SUCCEEDED(hr)) InterlockedIncrement(&epw_OutstandingObjects);\r\n        }\r\n        else\r\n        {\r\n            return hr;\r\n        }\r\n    }\r\n\r\n    return(hr);\r\n}"
  },
  {
    "path": "ep_weather_host/ep_weather_factory.h",
    "content": "#ifndef _H_AS_FACTORY_H_\r\n#define _H_AS_FACTORY_H_\r\n#include \"ep_weather.h\"\r\nULONG STDMETHODCALLTYPE epw_factory_AddRef(IClassFactory* _this);\r\nULONG STDMETHODCALLTYPE epw_factory_Release(IClassFactory* _this);\r\nHRESULT STDMETHODCALLTYPE epw_factory_QueryInterface(\r\n    IClassFactory* _this,\r\n    REFIID riid,\r\n    void** ppv\r\n);\r\nHRESULT STDMETHODCALLTYPE epw_factory_LockServer(\r\n    IClassFactory* _this,\r\n    BOOL flock\r\n);\r\nHRESULT STDMETHODCALLTYPE epw_factory_CreateInstance(\r\n    IClassFactory* _this,\r\n    IUnknown* punkOuter,\r\n    REFIID vTableGuid,\r\n    void** ppv\r\n);\r\ntypedef interface IEPWeatherFactory IEPWeatherFactory;\r\n// {A25216A3-4223-4CB3-A572-11A7CC1AEE4E}\r\nDEFINE_GUID(IID_IEPWeatherFactory,\r\n    0xa25216a3, 0x4223, 0x4cb3, 0xa5, 0x72, 0x11, 0xa7, 0xcc, 0x1a, 0xee, 0x4e);\r\nstatic const IClassFactoryVtbl IEPWeatherFactoryVtbl = {\r\n    epw_factory_QueryInterface,\r\n    epw_factory_AddRef,\r\n    epw_factory_Release,\r\n    epw_factory_CreateInstance,\r\n    epw_factory_LockServer\r\n};\r\nstatic IClassFactory IClassFactoryInstance = { &IEPWeatherFactoryVtbl };\r\nstatic IClassFactory* ClassFactory = &IClassFactoryInstance;\r\n#endif\r\n"
  },
  {
    "path": "ep_weather_host/ep_weather_host.c",
    "content": "#include \"ep_weather_host.h\"\n#include \"ep_weather_provider_google_html.h\"\n#include \"ep_weather_provider_google_script.h\"\n#include \"ep_weather_error_html.h\"\n\n#include <stdio.h>\n\nRTL_OSVERSIONINFOW global_rovi;\nDWORD32 global_ubr;\nSYSTEMTIME stLastUpdate;\n\nHRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this)\n{\n    return S_OK;\n}\n\nULONG STDMETHODCALLTYPE epw_Weather_static_AddRefRelease(void* _this)\n{\n    return 1;\n}\n\nstatic DWORD epw_Weather_ReleaseBecauseClientDiedThread(EPWeather* _this)\n{\n    Sleep(5000);\n    while (_this->lpVtbl->Release(_this));\n    return 0;\n}\n\nstatic void epw_Weather_SetTextScaleFactorFromRegistry(EPWeather* _this, HKEY hKey, BOOL bRefresh)\n{\n    DWORD dwTextScaleFactor = 100, dwSize = sizeof(DWORD);\n    if (_this->SHRegGetValueFromHKCUHKLMFunc && _this->SHRegGetValueFromHKCUHKLMFunc(L\"SOFTWARE\\\\Microsoft\\\\Accessibility\", L\"TextScaleFactor\", SRRF_RT_REG_DWORD, NULL, &dwTextScaleFactor, (LPDWORD)(&dwSize)) != ERROR_SUCCESS)\n    {\n        dwTextScaleFactor = 100;\n    }\n    if (InterlockedExchange64(&_this->dwTextScaleFactor, dwTextScaleFactor) == dwTextScaleFactor)\n    {\n        bRefresh = FALSE;\n    }\n    if (hKey == HKEY_CURRENT_USER)\n    {\n        if (RegCreateKeyExW(HKEY_CURRENT_USER, L\"SOFTWARE\\\\Microsoft\\\\Accessibility\", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WOW64_64KEY | KEY_WRITE, NULL, &_this->hKCUAccessibility, NULL) == ERROR_SUCCESS)\n        {\n            RegNotifyChangeKeyValue(_this->hKCUAccessibility, FALSE, REG_NOTIFY_CHANGE_LAST_SET, _this->hSignalOnAccessibilitySettingsChangedFromHKCU, TRUE);\n        }\n    }\n    else if (hKey == HKEY_LOCAL_MACHINE)\n    {\n        if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L\"SOFTWARE\\\\Microsoft\\\\Accessibility\", REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WOW64_64KEY | KEY_WRITE, &_this->hKLMAccessibility))\n        {\n            RegNotifyChangeKeyValue(_this->hKLMAccessibility, FALSE, REG_NOTIFY_CHANGE_LAST_SET, _this->hSignalOnAccessibilitySettingsChangedFromHKLM, TRUE);\n        }\n    }\n    if (bRefresh)\n    {\n        _ep_Weather_StartResize(_this);\n    }\n}\n\nHRESULT STDMETHODCALLTYPE INetworkListManagerEvents_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_INetworkListManagerEvents) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE INetworkListManagerEvents_ConnectivityChanged(GenericObjectWithThis* _this2, NLM_CONNECTIVITY newConnectivity)\n{\n    EPWeather* _this = _this2->_this; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);\n    if (_this)\n    {\n        if ((newConnectivity & (NLM_CONNECTIVITY_IPV4_INTERNET | NLM_CONNECTIVITY_IPV6_INTERNET)) != 0)\n        {\n            printf(\"[Network Events for 0x%p] Internet connection status is: Available.\\n\", _this);\n            LONG64 dwUpdateSchedule = InterlockedAdd64(&_this->dwUpdateSchedule, 0);\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY, NULL);\n            //PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL);\n            printf(\"[Network Events for 0x%p] Reinstalled refresh timer.\\n\", _this);\n        }\n        else\n        {\n            printf(\"[Network Events for 0x%p] Internet connection status is: Offline.\\n\", _this);\n            KillTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH);\n            KillTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH);\n            printf(\"[Network Events for 0x%p] Killed refresh timer.\\n\", _this);\n        }\n    }\n    return S_OK;\n}\n\nGenericObjectWithThis* GenericObjectWithThis_MakeAndInitialize(IUnknownVtbl* vtbl, EPWeather* _this, const LPWSTR pName)\n{\n    GenericObjectWithThis* pObj = malloc(sizeof(GenericObjectWithThis));\n    if (pObj)\n    {\n        ULONG cnt = InterlockedIncrement64(&(_this->cbGenericObject));\n        pObj->lpVtbl = vtbl;\n        pObj->cbCount = 1;\n        pObj->pInstance = pObj;\n        pObj->_this = _this;\n        pObj->pName = pName;\n        wprintf(L\"[] {%d} Making object { name: \\\"%s\\\", _this: 0x%p }\\n\", cnt, pName, _this);\n        return pObj;\n    }\n    return NULL;\n}\n\nULONG STDMETHODCALLTYPE GenericObjectWithThis_AddRef(GenericObjectWithThis* _this)\n{\n    ULONG cnt = InterlockedIncrement64(&(_this->_this->cbGenericObject));\n    ULONG value = InterlockedIncrement64(&(_this->cbCount));\n    wprintf(L\"[] {%d} AddRef, new value = %d on { name: \\\"%s\\\", _this: 0x%p }\\n\", cnt, value, _this->pName, _this->_this);\n    return value;\n}\n\nULONG STDMETHODCALLTYPE GenericObjectWithThis_Release(GenericObjectWithThis* _this)\n{\n    ULONG cnt = InterlockedDecrement64(&(_this->_this->cbGenericObject));\n    ULONG value = InterlockedDecrement64(&(_this->cbCount));\n    if (value == 0)\n    {\n        wprintf(L\"[] {%d} Release with free, new value = %d on { name: \\\"%s\\\", _this: 0x%p }\\n\", cnt, value, _this->pName, _this->_this);\n        free(_this->pInstance);\n        return 0;\n    }\n    wprintf(L\"[] {%d} Release, new value = %d on { name: \\\"%s\\\", _this: 0x%p }\\n\", cnt, value, _this->pName, _this->_this);\n    return value;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2EnvironmentOptions_QueryInterface(IUnknown* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2EnvironmentOptions) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2CreateCoreWebView2ControllerCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2CreateCoreWebView2ControllerCompletedHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2NavigationStartingEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2NavigationStartingEventHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2NavigationCompletedEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2NavigationCompletedEventHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2PermissionRequestedEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2PermissionRequestedEventHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2CallDevToolsProtocolMethodCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2ExecuteScriptCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_ICoreWebView2ExecuteScriptCompletedHandler) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_AdditionalBrowserArguments(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value)\n{\n    *value = CoTaskMemAlloc(82 * sizeof(WCHAR));\n    if (*value)\n    {\n        wcscpy_s(*value, 82, L\"--disable-site-isolation-trials --disable-web-security --allow-insecure-localhost\");\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_Language(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value)\n{\n    *value = CoTaskMemAlloc(6 * sizeof(WCHAR));\n    if (*value)\n    {\n        wcscpy_s(*value, 6, L\"en-US\");\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_TargetCompatibleBrowserVersion(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value)\n{\n    *value = CoTaskMemAlloc(13 * sizeof(WCHAR));\n    if (*value)\n    {\n        wcscpy_s(*value, 13, L\"97.0.1072.69\");\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount(ICoreWebView2EnvironmentOptions* _this, BOOL* allow)\n{\n    *allow = TRUE;\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2EnvironmentCompleted(GenericObjectWithThis* _this, HRESULT hr, ICoreWebView2Environment* pCoreWebView2Environemnt)\n{\n    GenericObjectWithThis* pCoreWebView2CreateCoreWebView2ControllerCompletedHandler = \n        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl, _this->_this, L\"pCoreWebView2CreateCoreWebView2ControllerCompletedHandler\");\n    if (!pCoreWebView2CreateCoreWebView2ControllerCompletedHandler) return E_FAIL;\n    HRESULT _hr = pCoreWebView2Environemnt->lpVtbl->CreateCoreWebView2Controller(pCoreWebView2Environemnt, _this->_this->hWnd, pCoreWebView2CreateCoreWebView2ControllerCompletedHandler);\n    pCoreWebView2CreateCoreWebView2ControllerCompletedHandler->lpVtbl->Release(pCoreWebView2CreateCoreWebView2ControllerCompletedHandler);\n    return _hr;\n}\n\nHRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)\n{\n    _ep_Weather_ReboundBrowser(_this, TRUE);\n    InterlockedExchange64(&_this->bIsNavigatingToError, TRUE);\n    UINT dpi = GetDpiForWindow(_this->hWnd);\n    DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);\n    DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);\n    int ch = MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT_ERROR, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n    RECT rc;\n    GetClientRect(_this->hWnd, &rc);\n    int w = MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n    if ((rc.bottom - rc.top != ch) || (rc.right - rc.left != w))\n    {\n        RECT rcAdj;\n        SetRect(&rcAdj, 0, 0, w, ch);\n        AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);\n        SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);\n        HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);\n        if (hNotifyWnd)\n        {\n            InvalidateRect(hNotifyWnd, NULL, TRUE);\n        }\n    }\n    if (_this->pCoreWebView2)\n    {\n        LPWSTR wszPageTitle = NULL;\n        if (SUCCEEDED(_this->pCoreWebView2->lpVtbl->get_DocumentTitle(_this->pCoreWebView2, &wszPageTitle)))\n        {\n            BOOL bIsOnErrorPage = !_wcsicmp(wszPageTitle, _T(CLSID_EPWeather_TEXT) L\"_ErrorPage\");\n            CoTaskMemFree(wszPageTitle);\n            if (!bIsOnErrorPage) return _this->pCoreWebView2->lpVtbl->NavigateToString(_this->pCoreWebView2, ep_weather_error_html);\n            else\n            {\n                printf(\"[Browser] Already on the error page.\\n\");\n                return S_OK;\n            }\n        }\n    }\n    return E_FAIL;\n}\n\nHRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToProvider(EPWeather* _this)\n{\n    _ep_Weather_ReboundBrowser(_this, FALSE);\n    HRESULT hr = S_OK;\n    LONG64 dwProvider = InterlockedAdd64(&_this->dwProvider, 0);\n    if (dwProvider == EP_WEATHER_PROVIDER_TEST)\n    {\n    }\n    else if (dwProvider == EP_WEATHER_PROVIDER_GOOGLE)\n    {\n        //hr = _this->pCoreWebView2->lpVtbl->Navigate(_this->pCoreWebView2, L\"https://google.com\");\n        LPWSTR wszScriptData = malloc(sizeof(WCHAR) * EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN);\n        if (wszScriptData)\n        {\n            swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN, L\"https://www.google.com/search?hl=%s&q=weather%s%s\", _this->wszLanguage, _this->wszTerm[0] ? L\" \" : L\"\", _this->wszTerm);\n            if (_this->pCoreWebView2)\n            {\n                hr = _this->pCoreWebView2->lpVtbl->Navigate(_this->pCoreWebView2, wszScriptData);\n            }\n            else\n            {\n                hr = E_FAIL;\n            }\n            if (FAILED(hr))\n            {\n                InterlockedExchange64(&_this->bBrowserBusy, FALSE);\n            }\n            free(wszScriptData);\n        }\n        else\n        {\n            hr = E_OUTOFMEMORY;\n        }\n    }\n    return hr;\n}\n\nHRESULT STDMETHODCALLTYPE _epw_Weather_ExecuteDataScript(EPWeather* _this)\n{\n    HRESULT hr = S_OK;\n    LONG64 dwProvider = InterlockedAdd64(&_this->dwProvider, 0);\n    if (dwProvider == EP_WEATHER_PROVIDER_TEST)\n    {\n    }\n    else if (dwProvider == EP_WEATHER_PROVIDER_GOOGLE)\n    {\n        LPWSTR wszScriptData = malloc(sizeof(WCHAR) * EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN);\n        if (wszScriptData)\n        {\n            LONG64 dwIconPack = InterlockedAdd(&_this->dwIconPack, 0);\n            if (dwIconPack == EP_WEATHER_ICONPACK_MICROSOFT)\n            {\n                swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, L\"%s%s%s%s%s%s\", ep_weather_provider_google_script00, ep_weather_provider_google_script010, ep_weather_provider_google_script011, ep_weather_provider_google_script020, ep_weather_provider_google_script021, ep_weather_provider_google_script03);\n            }\n            else if (dwIconPack == EP_WEATHER_ICONPACK_GOOGLE)\n            {\n                swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, ep_weather_provider_google_script10);\n            }\n            //wprintf(L\"%s\\n\", _this->wszScriptData);\n            if (_this->pCoreWebView2)\n            {\n                GenericObjectWithThis* pCoreWebView2ExecuteScriptCompletedHandler =\n                    GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl, _this, L\"pCoreWebView2ExecuteScriptCompletedHandler\");\n                if (!pCoreWebView2ExecuteScriptCompletedHandler) hr = E_FAIL;\n                else hr = _this->pCoreWebView2->lpVtbl->ExecuteScript(_this->pCoreWebView2, wszScriptData, pCoreWebView2ExecuteScriptCompletedHandler);\n            }\n            else\n            {\n                hr = E_FAIL;\n            }\n            if (FAILED(hr))\n            {\n                InterlockedExchange64(&_this->bBrowserBusy, FALSE);\n            }\n            free(wszScriptData);\n        }\n        else\n        {\n            hr = E_OUTOFMEMORY;\n        }\n    }\n    return hr;\n}\n\nHRESULT STDMETHODCALLTYPE _ep_Weather_StartResize(EPWeather* _this)\n{\n    _this->cntResizeWindow = 0;\n    SetTimer(_this->hWnd, EP_WEATHER_TIMER_RESIZE_WINDOW, EP_WEATHER_TIMER_RESIZE_WINDOW_DELAY, NULL);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE _ep_Weather_ReboundBrowser(EPWeather* _this, LONG64 dwType)\n{\n    UINT dpi = GetDpiForWindow(_this->hWnd);\n    RECT bounds;\n    DWORD dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);\n    if (dwType || dwDevMode)\n    {\n        GetClientRect(_this->hWnd, &bounds);\n    }\n    else\n    {\n        DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);\n        DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);\n        bounds.left = 0 - MulDiv(MulDiv(MulDiv(181, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n        bounds.top = 0 - MulDiv(MulDiv(MulDiv(152, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n        bounds.right = MulDiv(MulDiv(MulDiv((!InterlockedAdd64(&_this->dwTextDir, 0) ? 1333 : 705), dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 5560;\n        bounds.bottom = MulDiv(MulDiv(MulDiv(600, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 15600;\n    }\n    if (_this->pCoreWebView2Controller)\n    {\n        _this->pCoreWebView2Controller->lpVtbl->put_Bounds(_this->pCoreWebView2Controller, bounds);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(GenericObjectWithThis* _this2, HRESULT hr, ICoreWebView2Controller* pCoreWebView2Controller)\n{\n    EPWeather* _this = _this2->_this; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);\n    if (!_this->pCoreWebView2Controller)\n    {\n        _this->pCoreWebView2Controller = pCoreWebView2Controller;\n        _this->pCoreWebView2Controller->lpVtbl->get_CoreWebView2(_this->pCoreWebView2Controller, &_this->pCoreWebView2);\n        _this->pCoreWebView2Controller->lpVtbl->AddRef(_this->pCoreWebView2Controller);\n        _this->pCoreWebView2Controller->lpVtbl->put_ZoomFactor(_this->pCoreWebView2Controller, InterlockedAdd64(&_this->dwZoomFactor, 0) / 100.0);\n    }\n\n    _ep_Weather_ReboundBrowser(_this, FALSE);\n\n    ICoreWebView2Controller2* pCoreWebView2Controller2 = NULL;\n    _this->pCoreWebView2Controller->lpVtbl->QueryInterface(_this->pCoreWebView2Controller, &IID_ICoreWebView2Controller2, &pCoreWebView2Controller2);\n    if (pCoreWebView2Controller2)\n    {\n        COREWEBVIEW2_COLOR transparent;\n        transparent.A = 0;\n        transparent.R = 0;\n        transparent.G = 0;\n        transparent.B = 0;\n        pCoreWebView2Controller2->lpVtbl->put_DefaultBackgroundColor(pCoreWebView2Controller2, transparent);\n        pCoreWebView2Controller2->lpVtbl->Release(pCoreWebView2Controller2);\n    }\n\n    ICoreWebView2Settings* pCoreWebView2Settings = NULL;\n    _this->pCoreWebView2->lpVtbl->get_Settings(_this->pCoreWebView2, &pCoreWebView2Settings);\n    if (pCoreWebView2Settings)\n    {\n        ICoreWebView2Settings6* pCoreWebView2Settings6 = NULL;\n        pCoreWebView2Settings->lpVtbl->QueryInterface(pCoreWebView2Settings, &IID_ICoreWebView2Settings6, &pCoreWebView2Settings6);\n        if (pCoreWebView2Settings6)\n        {\n            DWORD dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);\n            pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, dwDevMode);\n            pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, dwDevMode);\n            pCoreWebView2Settings6->lpVtbl->put_IsStatusBarEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_IsZoomControlEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_IsGeneralAutofillEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_IsPasswordAutosaveEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_IsPinchZoomEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_IsSwipeNavigationEnabled(pCoreWebView2Settings6, FALSE);\n            pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, dwDevMode);\n            pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, dwDevMode);\n            pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);\n        }\n        pCoreWebView2Settings->lpVtbl->Release(pCoreWebView2Settings);\n    }\n\n    LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);\n    epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);\n\n    _this->pCoreWebView2NavigationStartingEventHandler =\n        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2NavigationStartingEventHandlerVtbl, _this, L\"pCoreWebView2NavigationStartingEventHandler\");\n    if (_this->pCoreWebView2NavigationStartingEventHandler)\n        _this->pCoreWebView2->lpVtbl->add_NavigationStarting(_this->pCoreWebView2, _this->pCoreWebView2NavigationStartingEventHandler, &_this->tkOnNavigationStarting);\n\n    _this->pCoreWebView2NavigationCompletedEventHandler =\n        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl, _this, L\"pCoreWebView2NavigationCompletedEventHandler\");\n    if (_this->pCoreWebView2NavigationCompletedEventHandler)\n        _this->pCoreWebView2->lpVtbl->add_NavigationCompleted(_this->pCoreWebView2, _this->pCoreWebView2NavigationCompletedEventHandler, &_this->tkOnNavigationCompleted);\n\n    _this->pCoreWebView2PermissionRequestedEventHandler =\n        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2PermissionRequestedEventHandlerVtbl, _this, L\"pCoreWebView2PermissionRequestedEventHandler\");\n    if (_this->pCoreWebView2PermissionRequestedEventHandler)\n        _this->pCoreWebView2->lpVtbl->add_PermissionRequested(_this->pCoreWebView2, _this->pCoreWebView2PermissionRequestedEventHandler, &_this->tkOnPermissionRequested);\n\n    _epw_Weather_NavigateToProvider(_this);\n\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CallDevToolsProtocolMethodCompleted(GenericObjectWithThis* _this, HRESULT errorCode, LPCWSTR returnObjectAsJson)\n{\n    EPWeather* EPWeather_Instance = _this->_this;\n    if (EPWeather_Instance && !wcscmp(_this->pName, L\"pCoreWebView2CallDevToolsProtocolMethodCompletedHandler_WithRefresh\"))\n    {\n        wprintf(L\"[CallDevToolsProtocolMethodCompleted] 0x%x [[ %s ]]\\n\", errorCode, returnObjectAsJson);\n        PostMessageW(EPWeather_Instance->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n        LPWSTR uri = NULL;\n        if (EPWeather_Instance->pCoreWebView2)\n        {\n            if (SUCCEEDED(EPWeather_Instance->pCoreWebView2->lpVtbl->get_Source(EPWeather_Instance->pCoreWebView2, &uri)))\n            {\n                if (wcscmp(L\"about:blank\", uri ? uri : L\"\"))\n                {\n                    SetTimer(EPWeather_Instance->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY, NULL);\n                }\n                CoTaskMemFree(uri);\n            }\n        }\n    }\n    _this->lpVtbl->Release(_this);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationStarting(GenericObjectWithThis* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationStartingEventArgs* pCoreWebView2NavigationStartingEventArgs)\n{\n    EPWeather* _this = _this2->_this; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);\n    LPWSTR wszUri = NULL;\n    pCoreWebView2NavigationStartingEventArgs->lpVtbl->get_Uri(pCoreWebView2NavigationStartingEventArgs, &wszUri);\n    if (wszUri)\n    {\n        if (!_wcsicmp(wszUri, L\"epweather://refresh\"))\n        {\n            pCoreWebView2NavigationStartingEventArgs->lpVtbl->put_Cancel(pCoreWebView2NavigationStartingEventArgs, TRUE);\n            PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n        }\n        CoTaskMemFree(wszUri);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationCompleted(GenericObjectWithThis* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationCompletedEventArgs* pCoreWebView2NavigationCompletedEventArgs)\n{\n    COREWEBVIEW2_WEB_ERROR_STATUS dwStatus = COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN;\n    pCoreWebView2NavigationCompletedEventArgs->lpVtbl->get_WebErrorStatus(pCoreWebView2NavigationCompletedEventArgs, &dwStatus);\n    if (dwStatus == COREWEBVIEW2_WEB_ERROR_STATUS_OPERATION_CANCELED) return S_OK;\n    EPWeather* _this = _this2->_this; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);\n    BOOL bIsSuccess = FALSE;\n    pCoreWebView2NavigationCompletedEventArgs->lpVtbl->get_IsSuccess(pCoreWebView2NavigationCompletedEventArgs, &bIsSuccess);\n    if (bIsSuccess)\n    {\n        BOOL bIsNavigatingToError = InterlockedAdd64(&_this->bIsNavigatingToError, 0);\n        if (bIsNavigatingToError)\n        {\n            InterlockedExchange64(&_this->bIsNavigatingToError, FALSE);\n            InterlockedExchange64(&_this->bBrowserBusy, FALSE);\n        }\n        else\n        {\n            //_epw_Weather_ExecuteDataScript(_this);\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_EXECUTEDATASCRIPT, EP_WEATHER_TIMER_EXECUTEDATASCRIPT_DELAY, NULL);\n        }\n    }\n    else\n    {\n        printf(\"[Browser] Navigation completed with error, showing error page.\\n\");\n        _epw_Weather_NavigateToError(_this);\n    }\n    _this->pCoreWebView2Controller->lpVtbl->put_IsVisible(_this->pCoreWebView2Controller, FALSE);\n    _this->pCoreWebView2Controller->lpVtbl->put_IsVisible(_this->pCoreWebView2Controller, TRUE);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(GenericObjectWithThis* _this2, HRESULT hr, LPCWSTR pResultObjectAsJson)\n{\n    EPWeather* _this = _this2->_this; // GetWindowLongPtrW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), GWLP_USERDATA);\n    if (_this)\n    {\n        BOOL bOk = FALSE;\n        LONG64 dwProvider = InterlockedAdd64(&_this->dwProvider, 0);\n        if (dwProvider == EP_WEATHER_PROVIDER_GOOGLE)\n        {\n            if (!_wcsicmp(pResultObjectAsJson, L\"\\\"run_part_2\\\"\"))\n            {\n                //_this->pCoreWebView2->lpVtbl->OpenDevToolsWindow(_this->pCoreWebView2);\n\n                //printf(\"running part 2\\n\");\n                //LONG64 bEnabled, dwDarkMode;\n                //dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);\n                //epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);\n                //swprintf_s(_this->wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, ep_weather_provider_google_script2, bEnabled ? 1 : 0);\n                GenericObjectWithThis* pCoreWebView2ExecuteScriptCompletedHandler =\n                    GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl, _this, L\"pCoreWebView2ExecuteScriptCompletedHandler\");\n                if (pCoreWebView2ExecuteScriptCompletedHandler) _this->pCoreWebView2->lpVtbl->ExecuteScript(_this->pCoreWebView2, ep_weather_provider_google_script2, pCoreWebView2ExecuteScriptCompletedHandler);\n                bOk = TRUE;\n            }\n            else if (!_wcsicmp(pResultObjectAsJson, L\"\\\"run_part_0\\\"\"))\n            {\n                LONG64 dwTemperatureUnit = InterlockedAdd64(&_this->dwTemperatureUnit, 0);\n                LONG64 cbx = InterlockedAdd64(&_this->cbx, 0);\n                LPWSTR wszScriptData = malloc(sizeof(WCHAR) * EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN);\n                if (wszScriptData)\n                {\n                    swprintf_s(wszScriptData, EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN, ep_weather_provider_google_script, dwTemperatureUnit == EP_WEATHER_TUNIT_FAHRENHEIT ? L'F' : L'C', cbx, cbx);\n                    GenericObjectWithThis* pCoreWebView2ExecuteScriptCompletedHandler =\n                        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl, _this, L\"pCoreWebView2ExecuteScriptCompletedHandler\");\n                    if (pCoreWebView2ExecuteScriptCompletedHandler) _this->pCoreWebView2->lpVtbl->ExecuteScript(_this->pCoreWebView2, wszScriptData, pCoreWebView2ExecuteScriptCompletedHandler);\n                    free(wszScriptData);\n                }\n                bOk = TRUE;\n            }\n            else if (!_wcsicmp(pResultObjectAsJson, L\"\\\"run_part_1\\\"\"))\n            {\n                printf(\"consent granted\\n\");\n                PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n                SetTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH, EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY * 5, NULL);\n                _this2->lpVtbl->Release(_this2);\n                return S_OK;\n            }\n            else\n            {\n                //wprintf(L\"%s\\n\", pResultObjectAsJson);\n\n                epw_Weather_LockData(_this);\n\n                WCHAR* wszTextDir = pResultObjectAsJson + 1;\n                if (wszTextDir)\n                {\n                    WCHAR* wszHeight = wcschr(wszTextDir, L'#');\n                    if (wszHeight)\n                    {\n                        wszHeight[0] = 0;\n                        wszHeight++;\n                        InterlockedExchange64(&_this->dwTextDir, wcsstr(wszTextDir, L\"rtl\"));\n                        WCHAR* wszTemperature = wcschr(wszHeight, L'#');\n                        if (wszTemperature)\n                        {\n                            wszTemperature[0] = 0;\n                            wszTemperature++;\n                            WCHAR* wszUnit = wcschr(wszTemperature, L'#');\n                            if (wszUnit)\n                            {\n                                wszUnit[0] = 0;\n                                wszUnit++;\n                                WCHAR* wszCondition = wcschr(wszUnit, L'#');\n                                if (wszCondition)\n                                {\n                                    wszCondition[0] = 0;\n                                    wszCondition++;\n                                    WCHAR* wszLocation = wcschr(wszCondition, L'#');\n                                    if (wszLocation)\n                                    {\n                                        wszLocation[0] = 0;\n                                        wszLocation++;\n                                        WCHAR* pImage = wcschr(wszLocation, L'#');\n                                        if (pImage)\n                                        {\n                                            pImage[0] = 0;\n                                            pImage++;\n                                            WCHAR* pTerm = wcschr(pImage, L'\"');\n                                            if (pTerm)\n                                            {\n                                                pTerm[0] = 0;\n                                                if (_this->wszTemperature)\n                                                {\n                                                    free(_this->wszTemperature);\n                                                }\n                                                if (_this->wszUnit)\n                                                {\n                                                    free(_this->wszUnit);\n                                                }\n                                                if (_this->wszCondition)\n                                                {\n                                                    free(_this->wszCondition);\n                                                }\n                                                if (_this->pImage)\n                                                {\n                                                    free(_this->pImage);\n                                                }\n                                                if (_this->wszLocation)\n                                                {\n                                                    free(_this->wszLocation);\n                                                }\n                                                _this->cbTemperature = (wcslen(wszTemperature) + 1) * sizeof(WCHAR);\n                                                _this->wszTemperature = malloc(_this->cbTemperature);\n                                                _this->cbUnit = (wcslen(wszUnit) + 1) * sizeof(WCHAR);\n                                                _this->wszUnit = malloc(_this->cbUnit);\n                                                _this->cbCondition = (wcslen(wszCondition) + 1) * sizeof(WCHAR);\n                                                _this->wszCondition = malloc(_this->cbCondition);\n                                                _this->cbImage = wcslen(pImage) / 2;\n                                                _this->pImage = malloc(_this->cbImage);\n                                                _this->cbLocation = (wcslen(wszLocation) + 1) * sizeof(WCHAR);\n                                                _this->wszLocation = malloc(_this->cbLocation);\n                                                if (_this->wszTemperature && _this->wszUnit && _this->wszCondition && _this->pImage && _this->wszLocation)\n                                                {\n                                                    wcscpy_s(_this->wszTemperature, _this->cbTemperature / 2, wszTemperature);\n                                                    wcscpy_s(_this->wszUnit, _this->cbUnit / 2, wszUnit);\n                                                    wcscpy_s(_this->wszCondition, _this->cbCondition / 2, wszCondition);\n                                                    wcscpy_s(_this->wszLocation, _this->cbLocation / 2, wszLocation);\n\n                                                    for (unsigned int i = 0; i < _this->cbImage * 2; i = i + 2)\n                                                    {\n                                                        WCHAR tmp[3];\n                                                        tmp[0] = pImage[i];\n                                                        tmp[1] = pImage[i + 1];\n                                                        tmp[2] = 0;\n                                                        _this->pImage[i / 2] = wcstol(tmp, NULL, 16);\n                                                    }\n\n                                                    bOk = TRUE;\n                                                }\n                                                int h = _wtoi(wszHeight);\n                                                int ch = MulDiv(h, EP_WEATHER_HEIGHT, 367);\n                                                UINT dpi = GetDpiForWindow(_this->hWnd);\n                                                DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);\n                                                DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);\n                                                ch = MulDiv(MulDiv(MulDiv(ch, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n                                                RECT rc;\n                                                GetClientRect(_this->hWnd, &rc);\n                                                int w = MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), dwTextScaleFactor, 100), dwZoomFactor, 100);\n                                                if ((rc.bottom - rc.top != ch) || (rc.right - rc.left != w))\n                                                {\n                                                    RECT rcAdj;\n                                                    SetRect(&rcAdj, 0, 0, w, ch);\n                                                    AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);\n                                                    SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);\n                                                    _ep_Weather_ReboundBrowser(_this, FALSE);\n                                                    HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);\n                                                    if (hNotifyWnd)\n                                                    {\n                                                        InvalidateRect(hNotifyWnd, NULL, TRUE);\n                                                    }\n                                                }\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n\n                epw_Weather_UnlockData(_this);\n            }\n        }\n\n        if (!bOk)\n        {\n            printf(\"[General] Navigating to error page.\\n\");\n            _epw_Weather_NavigateToError(_this);\n        }\n        else\n        {\n            GetLocalTime(&stLastUpdate);\n            HWND hGUI = FindWindowW(L\"ExplorerPatcher_GUI_\" _T(EP_CLSID), NULL);\n            if (hGUI) InvalidateRect(hGUI, NULL, TRUE);\n            InterlockedExchange64(&_this->bBrowserBusy, FALSE);\n            printf(\"[General] Fetched data, requesting redraw.\\n\");\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REPAINT, EP_WEATHER_TIMER_REQUEST_REPAINT_DELAY, NULL);\n        }\n    }\n    _this2->lpVtbl->Release(_this2);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE ICoreWebView2_PermissionRequested(GenericObjectWithThis* _this2, ICoreWebView2* pCoreWebView2, ICoreWebView2PermissionRequestedEventArgs* pCoreWebView2PermissionRequestedEventArgs)\n{\n    COREWEBVIEW2_PERMISSION_KIND kind;\n    pCoreWebView2PermissionRequestedEventArgs->lpVtbl->get_PermissionKind(pCoreWebView2PermissionRequestedEventArgs, &kind);\n    if (kind == COREWEBVIEW2_PERMISSION_KIND_GEOLOCATION)\n    {\n        DWORD r = InterlockedAdd64(&_this2->_this->dwGeolocationMode, 0);\n        printf(\"[Permissions] Geolocation permission request: %d\\n\", r);\n        pCoreWebView2PermissionRequestedEventArgs->lpVtbl->put_State(pCoreWebView2PermissionRequestedEventArgs, r ? COREWEBVIEW2_PERMISSION_STATE_ALLOW : COREWEBVIEW2_PERMISSION_STATE_DENY);\n    }\n    return S_OK;\n}\n\nULONG STDMETHODCALLTYPE epw_Weather_AddRef(EPWeather* _this)\n{\n    ULONG value = InterlockedIncrement64(&(_this->cbCount));\n    printf(\"[General] AddRef: %d\\n\", value);\n    return value;\n}\n\nULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this)\n{\n    ULONG value = InterlockedDecrement64(&(_this->cbCount));\n    printf(\"[General] Release: %d\\n\", value);\n\n    if (value == 0)\n    {\n        if (_this->hMainThread)\n        {\n            if (_this->hSignalExitMainThread)\n            {\n                SetEvent(_this->hSignalExitMainThread);\n                printf(\"[General] Waiting for main thread to exit.\\n\");\n                WaitForSingleObject(_this->hMainThread, INFINITE);\n            }\n            CloseHandle(_this->hMainThread);\n            if (_this->hSignalExitMainThread)\n            {\n                CloseHandle(_this->hSignalExitMainThread);\n            }\n        }\n        if (_this->hInitializeEvent)\n        {\n            CloseHandle(_this->hInitializeEvent);\n        }\n\n        if (_this->hMutexData)\n        {\n            CloseHandle(_this->hMutexData);\n        }\n\n        if (_this->hUxtheme)\n        {\n            FreeLibrary(_this->hUxtheme);\n        }\n        if (_this->hShlwapi)\n        {\n            FreeLibrary(_this->hShlwapi);\n        }\n        if (_this->hKCUAccessibility)\n        {\n            RegCloseKey(_this->hKCUAccessibility);\n        }\n        if (_this->hKLMAccessibility)\n        {\n            RegCloseKey(_this->hKLMAccessibility);\n        }\n        if (_this->hSignalOnAccessibilitySettingsChangedFromHKCU)\n        {\n            CloseHandle(_this->hSignalOnAccessibilitySettingsChangedFromHKCU);\n        }\n        if (_this->hSignalOnAccessibilitySettingsChangedFromHKLM)\n        {\n            CloseHandle(_this->hSignalOnAccessibilitySettingsChangedFromHKLM);\n        }\n        if (_this->hSignalKillSwitch)\n        {\n            CloseHandle(_this->hSignalKillSwitch);\n        }\n\n        FREE(_this);\n        LONG dwOutstandingObjects = InterlockedDecrement(&epw_OutstandingObjects);\n        LONG dwOutstandingLocks = InterlockedAdd(&epw_LockCount, 0);\n        if (!dwOutstandingObjects && !dwOutstandingLocks)\n        {\n        }\n        printf(\"[General] Outstanding objects: %d, outstanding locks: %d\\n\", dwOutstandingObjects, dwOutstandingLocks);\n\n#if defined(DEBUG) | defined(_DEBUG)\n        printf(\"\\nDumping memory leaks:\\n\");\n        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\n        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);\n        _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\n        _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);\n        _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\n        _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);\n        _CrtDumpMemoryLeaks();\n        printf(\"Memory dump complete.\\n\\n\");\n#endif\n\n        //TerminateProcess(GetCurrentProcess(), 0);\n\n        return(0);\n    }\n    return value;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_QueryInterface(EPWeather* _this, REFIID riid, void** ppv)\n{\n    if (!IsEqualIID(riid, &IID_IEPWeather) &&\n        !IsEqualIID(riid, &IID_IUnknown))\n    {\n        *ppv = 0;\n        return(E_NOINTERFACE);\n    }\n    *ppv = _this;\n    _this->lpVtbl->AddRef(_this);\n    return(NOERROR);\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_About(EPWeather* _this, HWND hWnd)\n{\n    HRESULT hr = NOERROR;\n\n    if (SUCCEEDED(hr))\n    {\n        hr = !_this ? (E_NOINTERFACE) : hr;\n    }\n    if (SUCCEEDED(hr))\n    {\n        wchar_t text[MAX_PATH];\n\n        DWORD dwLeftMost = 0;\n        DWORD dwSecondLeft = 0;\n        DWORD dwSecondRight = 0;\n        DWORD dwRightMost = 0;\n\n        QueryVersionInfo(epw_hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);\n\n        swprintf_s(text, MAX_PATH, L\"ExplorerPatcher Weather Host\\r\\n\\r\\nVersion %d.%d.%d.%d\", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);\n\n        MessageBoxW(hWnd, text, _T(\"ExplorerPatcher Weather Host\"), MB_ICONINFORMATION);\n    }\n\n    return hr;\n}\n\nLRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)\n{\n    EPWeather* _this = NULL;\n    if (uMsg == WM_CREATE)\n    {\n        CREATESTRUCT* pCreate = (CREATESTRUCT*)(lParam);\n        _this = (int*)(pCreate->lpCreateParams);\n        SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)_this);\n    }\n    else\n    {\n        LONG_PTR ptr = GetWindowLongPtrW(hWnd, GWLP_USERDATA);\n        _this = (EPWeather*)(ptr);\n    }\n    if (!_this)\n    {\n        return DefWindowProcW(hWnd, uMsg, wParam, lParam);\n    }\n\n    if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_REQUEST_REPAINT)\n    {\n        HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);\n        printf(\"[Timer Repaint] Request posted to window %x.\\n\", hNotifyWnd);\n        if (hNotifyWnd)\n        {\n            InvalidateRect(hNotifyWnd, NULL, TRUE);\n            //Sleep(100);\n            //InvalidateRect(hNotifyWnd, NULL, TRUE);\n        }\n        KillTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REPAINT);\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_REQUEST_REFRESH)\n    {\n        KillTimer(_this->hWnd, EP_WEATHER_TIMER_REQUEST_REFRESH);\n        return SendMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n    }\n    else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_SCHEDULE_REFRESH)\n    {\n        if (SendMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0))\n        {\n            printf(\"[Timer Scheduled Refresh] Browser is busy, waiting a minute and retrying...\\n\");\n            KillTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH);\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, 1000 * 60, NULL);\n        }\n        else\n        {\n            KillTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH);\n            LONG64 dwUpdateSchedule = InterlockedAdd64(&_this->dwUpdateSchedule, 0);\n            printf(\"[Timer Scheduled Refresh] Fetching data, sleeping for %lld more ms.\\n\", dwUpdateSchedule);\n            SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL);\n        }\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_RESIZE_WINDOW)\n    {\n        LPWSTR uri = NULL;\n        if (_this->pCoreWebView2)\n        {\n            _this->pCoreWebView2->lpVtbl->get_Source(_this->pCoreWebView2, &uri);\n        }\n        DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);\n        DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);\n        UINT dpi = GetDpiForWindow(_this->hWnd);\n        RECT rcAdj;\n        SetRect(&rcAdj, 0, 0, MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100), MulDiv(MulDiv(MulDiv((!wcscmp(L\"about:blank\", uri ? uri : L\"\") ? EP_WEATHER_HEIGHT_ERROR : EP_WEATHER_HEIGHT), dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100));\n        AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);\n        SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);\n        CoTaskMemFree(uri);\n        if (_this->cntResizeWindow == 7)\n        {\n            _this->cntResizeWindow = 0;\n            KillTimer(_this->hWnd, EP_WEATHER_TIMER_RESIZE_WINDOW);\n        }\n        else\n        {\n            _this->cntResizeWindow++;\n        }\n        return 0;\n    }\n    else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_EXECUTEDATASCRIPT)\n    {\n        _epw_Weather_ExecuteDataScript(_this);\n        KillTimer(_this->hWnd, EP_WEATHER_TIMER_EXECUTEDATASCRIPT);\n        return 0;\n    }\n    else if (uMsg == EP_WEATHER_WM_REBOUND_BROWSER)\n    {\n        LPWSTR uri = NULL;\n        if (_this->pCoreWebView2)\n        {\n            _this->pCoreWebView2->lpVtbl->get_Source(_this->pCoreWebView2, &uri);\n        }\n        _ep_Weather_ReboundBrowser(_this, !wcscmp(L\"about:blank\", uri ? uri : L\"\"));\n        CoTaskMemFree(uri);\n        return 0;\n    }\n    else if (uMsg == EP_WEATHER_WM_FETCH_DATA)\n    {\n        INT64 bWasBrowserBusy = InterlockedCompareExchange64(&_this->bBrowserBusy, TRUE, FALSE);\n        if (!bWasBrowserBusy)\n        {\n            return _epw_Weather_NavigateToProvider(_this);\n        }\n        return HRESULT_FROM_WIN32(ERROR_BUSY);\n    }\n    else if (uMsg == EP_WEATHER_WM_SET_BROWSER_THEME)\n    {\n        if (_this->pCoreWebView2)\n        {\n            GenericObjectWithThis* pCoreWebView2CallDevToolsProtocolMethodCompletedHandler = NULL;\n            if (lParam)\n            {\n                pCoreWebView2CallDevToolsProtocolMethodCompletedHandler =\n                    GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl, _this, L\"pCoreWebView2CallDevToolsProtocolMethodCompletedHandler_WithRefresh\");\n            }\n            else\n            {\n                pCoreWebView2CallDevToolsProtocolMethodCompletedHandler =\n                    GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl, _this, L\"pCoreWebView2CallDevToolsProtocolMethodCompletedHandler\");\n            }\n            if (wParam)\n            {\n                printf(\"[SetDarkMode] 1\\n\");\n                _this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L\"Emulation.setEmulatedMedia\", L\"{\\\"features\\\": [ { \\\"name\\\": \\\"prefers-color-scheme\\\", \\\"value\\\": \\\"dark\\\" }]}\", pCoreWebView2CallDevToolsProtocolMethodCompletedHandler);\n                //_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L\"Emulation.setAutoDarkModeOverride\", L\"{\\\"enabled\\\": true}\", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);\n            }\n            else\n            {\n                printf(\"[SetDarkMode] 0\\n\");\n                _this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L\"Emulation.setEmulatedMedia\", L\"{\\\"features\\\": [ { \\\"name\\\": \\\"prefers-color-scheme\\\", \\\"value\\\": \\\"light\\\" }]}\", pCoreWebView2CallDevToolsProtocolMethodCompletedHandler);\n                //_this->pCoreWebView2->lpVtbl->CallDevToolsProtocolMethod(_this->pCoreWebView2, L\"Emulation.setAutoDarkModeOverride\", L\"{\\\"enabled\\\": false}\", &EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler);\n            }\n            return S_OK;\n        }\n    }\n    else if (uMsg == EP_WEATHER_WM_SETDEVMODE)\n    {\n        if (_this->pCoreWebView2)\n        {\n            ICoreWebView2Settings* pCoreWebView2Settings = NULL;\n            _this->pCoreWebView2->lpVtbl->get_Settings(_this->pCoreWebView2, &pCoreWebView2Settings);\n            if (pCoreWebView2Settings)\n            {\n                ICoreWebView2Settings6* pCoreWebView2Settings6 = NULL;\n                pCoreWebView2Settings->lpVtbl->QueryInterface(pCoreWebView2Settings, &IID_ICoreWebView2Settings6, &pCoreWebView2Settings6);\n                if (pCoreWebView2Settings6)\n                {\n                    pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, wParam);\n                    pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, wParam);\n                    pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, wParam);\n                    pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, wParam);\n                    pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);\n                    LONG dwStyle = epw_Weather_GetStyle(_this);\n                    if (!GetLastError())\n                    {\n                        if (wParam) dwStyle |= WS_SIZEBOX;\n                        else dwStyle &= ~WS_SIZEBOX;\n                        SetWindowLongW(_this->hWnd, GWL_STYLE, dwStyle);\n                    }\n                    PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n                }\n                pCoreWebView2Settings->lpVtbl->Release(pCoreWebView2Settings);\n            }\n        }\n    }\n    else if (uMsg == EP_WEATHER_WM_SETZOOMFACTOR)\n    {\n        if (_this->pCoreWebView2Controller)\n        {\n            _this->pCoreWebView2Controller->lpVtbl->put_ZoomFactor(_this->pCoreWebView2Controller, wParam / 100.0);\n            _ep_Weather_StartResize(_this);\n        }\n    }\n    else if (uMsg == WM_CLOSE || (uMsg == WM_KEYUP && wParam == VK_ESCAPE) || (uMsg == WM_ACTIVATEAPP && wParam == FALSE && GetAncestor(GetForegroundWindow(), GA_ROOT) != _this->hWnd))\n    {\n        epw_Weather_Hide(_this);\n        return 0;\n    }\n    else if (uMsg == WM_WINDOWPOSCHANGING)\n    {\n        if (IsWindowVisible(hWnd))\n        {\n            LONG64 dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);\n            WINDOWPOS* pwp = (WINDOWPOS*)lParam;\n            pwp->flags |= (!dwDevMode ? (SWP_NOMOVE | SWP_NOSIZE) : 0);\n            if (dwDevMode)\n            {\n                _ep_Weather_ReboundBrowser(_this, TRUE);\n            }\n        }\n        return 0;\n    }\n    else if (uMsg == WM_SETTINGCHANGE)\n    {\n        if (IsColorSchemeChangeMessage(lParam))\n        {\n            MARGINS marGlassInset;\n            if (!IsHighContrast())\n            {\n                marGlassInset.cxLeftWidth = -1; // -1 means the whole window\n                marGlassInset.cxRightWidth = -1;\n                marGlassInset.cyBottomHeight = -1;\n                marGlassInset.cyTopHeight = -1;\n            }\n            else\n            {\n                marGlassInset.cxLeftWidth = 0;\n                marGlassInset.cxRightWidth = 0;\n                marGlassInset.cyBottomHeight = 0;\n                marGlassInset.cyTopHeight = 0;\n            }\n            LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);\n            if (IsWindows11())\n            {\n                if (!IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n                {\n                    DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);\n                }\n                BOOL value = (IsThemeActive() && !IsHighContrast()) ? 1 : 0;\n                SetMicaMaterialForThisWindow(_this->hWnd, value);\n            }\n            else\n            {\n                int s = 0;\n                if (global_rovi.dwBuildNumber < 18985)\n                {\n                    s = -1;\n                }\n                DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &dwDarkMode, sizeof(LONG64));\n            }\n            if (!dwDarkMode)\n            {\n                epw_Weather_SetDarkMode(_this, dwDarkMode, TRUE);\n            }\n            return 0;\n        }\n    }\n    else if (uMsg == WM_DPICHANGED)\n    {\n        //UINT dpiX = LOWORD(wParam);\n        //UINT dpiY = HIWORD(wParam);\n        //DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);\n        //DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);\n        //RECT rcAdj;\n        //SetRect(&rcAdj, 0, 0, MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), dwTextScaleFactor, 100), dwZoomFactor, 100), MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpiY, 96), dwTextScaleFactor, 100), dwZoomFactor, 100));\n        //AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpiX);\n        RECT* rc = lParam;\n        SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, 0);\n        return 0;\n    }\n    else if (uMsg == WM_PAINT && !IsWindows11())\n    {\n        PAINTSTRUCT ps;\n        HDC hdc = BeginPaint(hWnd, &ps);\n        if (ps.fErase)\n        {\n            LONG64 bEnabled, dwDarkMode;\n            dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);\n            epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);\n            COLORREF oldcr = SetBkColor(hdc, bEnabled ? RGB(0, 0, 0) : RGB(255, 255, 255));\n            ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &ps.rcPaint, L\"\", 0, 0);\n            SetBkColor(hdc, oldcr);\n        }\n        EndPaint(hWnd, &ps);\n        return 0;\n    }\n    /*BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();\n    if (uMsg == WM_CREATE)\n    {\n        if (bIsRunningWithoutVisualStyle)\n        {\n            SetRectEmpty(&_this->rcBorderThickness);\n            if (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_THICKFRAME)\n            {\n                AdjustWindowRectEx(&_this->rcBorderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE, NULL);\n                _this->rcBorderThickness.left *= -1;\n                _this->rcBorderThickness.top *= -1;\n            }\n            else if (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_BORDER)\n            {\n                SetRect(&_this->rcBorderThickness, 1, 1, 1, 1);\n            }\n            SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);\n        }\n    }\n    else if (uMsg == WM_NCCALCSIZE)\n    {\n        if (bIsRunningWithoutVisualStyle)\n        {\n            if (lParam)\n            {\n                NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)lParam;\n                sz->rgrc[0].left += _this->rcBorderThickness.left;\n                sz->rgrc[0].right -= _this->rcBorderThickness.right;\n                sz->rgrc[0].bottom -= _this->rcBorderThickness.bottom;\n                return 0;\n            }\n        }\n    }\n    else if (uMsg == WM_NCHITTEST)\n    {\n        if (bIsRunningWithoutVisualStyle)\n        {\n            LRESULT lRes = DefWindowProcW(hWnd, uMsg, wParam, lParam);\n            if (lRes == HTCLIENT)\n            {\n                POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };\n                ScreenToClient(hWnd, &pt);\n                if (pt.y < _this->rcBorderThickness.top)\n                {\n                    return HTTOP;\n                }\n                else\n                {\n                    return HTCAPTION;\n                }\n            }\n            else\n            {\n                return lRes;\n            }\n        }\n    }\n    else if (uMsg == WM_NCACTIVATE)\n    {\n        if (bIsRunningWithoutVisualStyle)\n        {\n            return 0;\n        }\n    }*/\n    return DefWindowProcW(hWnd, uMsg, wParam, lParam);\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64* bEnabled)\n{\n    BOOL bIsCompositionEnabled = TRUE;\n    DwmIsCompositionEnabled(&bIsCompositionEnabled);\n    if (!dwDarkMode)\n    {\n        RTL_OSVERSIONINFOW rovi;\n        *bEnabled = bIsCompositionEnabled && ((global_rovi.dwBuildNumber < 18985) ? TRUE : (ShouldSystemUseDarkMode ? ShouldSystemUseDarkMode() : FALSE)) && !IsHighContrast();\n    }\n    else\n    {\n        *bEnabled = dwDarkMode - 1;\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64 bRefresh)\n{\n    LONG64 bEnabled;\n    epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);\n    InterlockedExchange64(&_this->g_darkModeEnabled, dwDarkMode);\n    if ((dwDarkMode == 2 && bEnabled) || (dwDarkMode == 1 && !bEnabled) || !dwDarkMode)\n    {\n        RefreshImmersiveColorPolicyState();\n        if (_this->hWnd)\n        {\n            AllowDarkModeForWindow(_this->hWnd, bEnabled);\n            int s = 0;\n            if (global_rovi.dwBuildNumber < 18985)\n            {\n                s = -1;\n            }\n            DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &bEnabled, sizeof(BOOL));\n            //InvalidateRect(_this->hWnd, NULL, FALSE);\n            PostMessageW(_this->hWnd, EP_WEATHER_WM_SET_BROWSER_THEME, bEnabled, bRefresh);\n        }\n        return S_OK;\n    }\n    return E_FAIL;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG64 dwGeolocationMode)\n{\n    InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);\n    PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this, LONG64 dwWindowCornerPreference)\n{\n    InterlockedExchange64(&_this->dwWindowCornerPreference, dwWindowCornerPreference);\n    INT preference = dwWindowCornerPreference;\n    if (_this->hWnd)\n    {\n        DwmSetWindowAttribute(_this->hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetDevMode(EPWeather* _this, LONG64 dwDevMode, LONG64 bRefresh)\n{\n    InterlockedExchange64(&_this->dwDevMode, dwDevMode);\n    if (bRefresh)\n    {\n        PostMessageW(_this->hWnd, EP_WEATHER_WM_SETDEVMODE, dwDevMode, 0);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetIconPack(EPWeather* _this, LONG64 dwIconPack, LONG64 bRefresh)\n{\n    InterlockedExchange64(&_this->dwIconPack, dwIconPack);\n    if (bRefresh)\n    {\n        PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetZoomFactor(EPWeather* _this, LONG64 dwZoomFactor)\n{\n    InterlockedExchange64(&_this->dwZoomFactor, dwZoomFactor);\n    PostMessageW(_this->hWnd, EP_WEATHER_WM_SETZOOMFACTOR, dwZoomFactor, 0);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetLastUpdateTime(EPWeather* _this, LPSYSTEMTIME lpLastUpdateTime)\n{\n    *lpLastUpdateTime = stLastUpdate;\n    return S_OK;\n}\n\nDWORD WINAPI epw_Weather_MainThread(EPWeather* _this)\n{\n    HRESULT hr = S_OK;\n    BOOL bShouldReleaseBecauseClientDied = FALSE;\n\n    SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);\n\n    _this->hrLastError = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);\n    if (FAILED(_this->hrLastError))\n    {\n        goto cleanup;\n    }\n\n    _this->hrLastError = CoCreateInstance(\n        &CLSID_TaskbarList,\n        NULL,\n        CLSCTX_INPROC,\n        &IID_ITaskbarList,\n        (LPVOID*)&_this->pTaskList\n    );\n    if (FAILED(_this->hrLastError))\n    {\n        goto cleanup;\n    }\n\n    WNDCLASSW wc;\n    ZeroMemory(&wc, sizeof(WNDCLASSW));\n    wc.style = CS_DBLCLKS;\n    wc.lpfnWndProc = epw_Weather_WindowProc;\n    wc.hInstance = epw_hModule;\n    wc.hbrBackground = IsWindows11() ? (HBRUSH)GetStockObject(BLACK_BRUSH) : NULL;\n    wc.lpszClassName = _T(EPW_WEATHER_CLASSNAME);\n    wc.hCursor = LoadCursorW(NULL, IDC_ARROW);\n    if (!RegisterClassW(&wc))\n    {\n        //_this->hrLastError = HRESULT_FROM_WIN32(GetLastError());\n        //goto cleanup;\n    }\n\n    DWORD dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);\n    DWORD dwStyle = WS_CAPTION | (dwDevMode ? WS_SIZEBOX : 0);\n    DWORD dwExStyle = 0;\n    RECT rc = _this->rc;\n    AdjustWindowRectExForDpi(&rc, dwStyle, FALSE, dwExStyle, _this->dpiXInitial);\n    _this->hWnd = CreateWindowExW(dwExStyle, _T(EPW_WEATHER_CLASSNAME), L\"\", WS_OVERLAPPED | dwStyle, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, epw_hModule, _this); // 1030, 630\n    if (!_this->hWnd)\n    {\n        _this->hrLastError = HRESULT_FROM_WIN32(GetLastError());\n        goto cleanup;\n    }\n\n    SetPropW(_this->hWnd, L\"valinet.ExplorerPatcher.ShellManagedWindow\", TRUE);\n\n    _this->hrLastError = _this->pTaskList->lpVtbl->DeleteTab(_this->pTaskList, _this->hWnd);\n    if (FAILED(_this->hrLastError))\n    {\n        goto cleanup;\n    }\n\n    WCHAR wszWorkFolder[MAX_PATH];\n    ZeroMemory(wszWorkFolder, MAX_PATH * sizeof(WCHAR));\n    SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wszWorkFolder);\n    wcscat_s(wszWorkFolder, MAX_PATH, L\"\\\\ExplorerPatcher\\\\ep_weather_host\");\n    BOOL bRet = CreateDirectoryW(wszWorkFolder, NULL);\n    if (!(bRet || (!bRet && GetLastError() == ERROR_ALREADY_EXISTS)))\n    {\n        _this->hrLastError = HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS);\n        goto cleanup;\n    }\n\n    LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);\n    if (IsWindows11())\n    {\n        if (!IsHighContrast())\n        {\n            if (!IsDwmExtendFrameIntoClientAreaBrokenInThisBuild())\n            {\n                MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window\n                DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);\n            }\n            BOOL value = 1;\n            SetMicaMaterialForThisWindow(_this->hWnd, TRUE);\n        }\n    }\n    else\n    {\n        int s = 0;\n        if (global_rovi.dwBuildNumber < 18985)\n        {\n            s = -1;\n        }\n        DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &dwDarkMode, sizeof(LONG64));\n    }\n    epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);\n\n    InterlockedExchange64(&_this->bBrowserBusy, TRUE);\n\n    GenericObjectWithThis* pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler = \n        GenericObjectWithThis_MakeAndInitialize(&EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl, _this, L\"pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler\");\n    if (!pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler) goto cleanup;\n#if !defined(_M_ARM64EC)\n    _this->hrLastError = CreateCoreWebView2EnvironmentWithOptions(NULL, wszWorkFolder, &EPWeather_ICoreWebView2EnvironmentOptions, pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler);\n#else\n    _this->hrLastError = E_NOTIMPL;\n#endif\n    pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler->lpVtbl->Release(pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler);\n    if (FAILED(_this->hrLastError)) goto cleanup;\n\n    INetworkListManager* spManager = NULL;\n    IConnectionPointContainer* spConnectionPoints = NULL;\n    IConnectionPoint* spConnectionPoint = NULL;\n    IUnknown* spSink = NULL;\n    DWORD dwCookie = 0;\n    GenericObjectWithThis* pNetworkListManager = \n        GenericObjectWithThis_MakeAndInitialize(&INetworkListManagerEvents_Vtbl, _this, L\"pNetworkListManager\");\n\n    if (pNetworkListManager)\n    {\n        if (SUCCEEDED(hr = CoCreateInstance(&CLSID_NetworkListManager, NULL, CLSCTX_ALL, &IID_INetworkListManager, &spManager) && spManager))\n        {\n            if (SUCCEEDED(hr = spManager->lpVtbl->QueryInterface(spManager, &IID_IConnectionPointContainer, &spConnectionPoints)))\n            {\n                if (SUCCEEDED(hr = spConnectionPoints->lpVtbl->FindConnectionPoint(spConnectionPoints, &IID_INetworkListManagerEvents, &spConnectionPoint)))\n                {\n                    if (SUCCEEDED(hr = pNetworkListManager->lpVtbl->QueryInterface(pNetworkListManager, &IID_IUnknown, &spSink)))\n                    {\n                        if (SUCCEEDED(hr = spConnectionPoint->lpVtbl->Advise(spConnectionPoint, spSink, &dwCookie)))\n                        {\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    LONG64 dwUpdateSchedule = InterlockedAdd64(&_this->dwUpdateSchedule, 0);\n    SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL);\n\n    SetEvent(_this->hInitializeEvent);\n\n    MSG msg;\n    while (TRUE)\n    {\n        DWORD dwRes = MsgWaitForMultipleObjects(EP_WEATHER_NUM_SIGNALS, &_this->hSignalExitMainThread, FALSE, INFINITE, QS_ALLINPUT);\n        if (dwRes == WAIT_OBJECT_0 || dwRes == WAIT_ABANDONED_0 + 1)\n        {\n            if (dwRes == WAIT_ABANDONED_0 + 1)\n            {\n                printf(\"[General] Client has died.\\n\");\n\n                if (OpenEventW(READ_CONTROL, FALSE, _T(EP_SETUP_EVENTNAME)))\n                {\n                    printf(\"[General] Servicing is in progress, terminating...\\n\");\n                    TerminateProcess(GetCurrentProcess(), 0);\n                }\n\n                bShouldReleaseBecauseClientDied = TRUE;\n            }\n            PostQuitMessage(0);\n        }\n        else if (dwRes == WAIT_OBJECT_0 + EP_WEATHER_NUM_SIGNALS)\n        {\n            BOOL bRet = 0, bQuit = FALSE;\n            while (bRet = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {\n                if (msg.message == WM_QUIT)\n                {\n                    bQuit = TRUE;\n                    break;\n                }\n                else\n                {\n                    TranslateMessage(&msg);\n                    DispatchMessage(&msg);\n                }\n            }\n            if (bQuit)\n            {\n                _this->pCoreWebView2Controller->lpVtbl->Close(_this->pCoreWebView2Controller);\n                break;\n            }\n        }\n        else if (dwRes == WAIT_OBJECT_0 + 2)\n        {\n            epw_Weather_SetTextScaleFactorFromRegistry(_this, HKEY_CURRENT_USER, TRUE);\n        }\n        else if (dwRes == WAIT_OBJECT_0 + 3)\n        {\n            epw_Weather_SetTextScaleFactorFromRegistry(_this, HKEY_LOCAL_MACHINE, TRUE);\n        }\n    }\n\n    if (SUCCEEDED(hr))\n    {\n        spConnectionPoint->lpVtbl->Unadvise(spConnectionPoint, dwCookie);\n    }\n    if (spSink)\n    {\n        spSink->lpVtbl->Release(spSink);\n    }\n    if (spConnectionPoint)\n    {\n        spConnectionPoint->lpVtbl->Release(spConnectionPoint);\n    }\n    if (spConnectionPoints)\n    {\n        spConnectionPoints->lpVtbl->Release(spConnectionPoints);\n    }\n    if (spManager)\n    {\n        spManager->lpVtbl->Release(spManager);\n    }\n    if (pNetworkListManager)\n    {\n        pNetworkListManager->lpVtbl->Release(pNetworkListManager);\n    }\n\n    cleanup:\n\n    if (_this->tkOnNavigationStarting.value)\n    {\n        _this->pCoreWebView2->lpVtbl->remove_NavigationStarting(_this->pCoreWebView2, _this->tkOnNavigationStarting);\n    }\n    if (_this->pCoreWebView2NavigationStartingEventHandler)\n    {\n        _this->pCoreWebView2NavigationStartingEventHandler->lpVtbl->Release(_this->pCoreWebView2NavigationStartingEventHandler);\n    }\n    if (_this->tkOnNavigationCompleted.value)\n    {\n        _this->pCoreWebView2->lpVtbl->remove_NavigationCompleted(_this->pCoreWebView2, _this->tkOnNavigationCompleted);\n    }\n    if (_this->pCoreWebView2NavigationCompletedEventHandler)\n    {\n        _this->pCoreWebView2NavigationCompletedEventHandler->lpVtbl->Release(_this->pCoreWebView2NavigationCompletedEventHandler);\n    }\n    if (_this->tkOnPermissionRequested.value)\n    {\n        _this->pCoreWebView2->lpVtbl->remove_PermissionRequested(_this->pCoreWebView2, _this->tkOnPermissionRequested);\n    }\n    if (_this->pCoreWebView2PermissionRequestedEventHandler)\n    {\n        _this->pCoreWebView2PermissionRequestedEventHandler->lpVtbl->Release(_this->pCoreWebView2PermissionRequestedEventHandler);\n    }\n    if (_this->pCoreWebView2)\n    {\n        _this->pCoreWebView2->lpVtbl->Release(_this->pCoreWebView2);\n    }\n    if (_this->pCoreWebView2Controller)\n    {\n        _this->pCoreWebView2Controller->lpVtbl->Release(_this->pCoreWebView2Controller);\n    }\n    if (_this->wszTemperature)\n    {\n        free(_this->wszTemperature);\n    }\n    if (_this->wszUnit)\n    {\n        free(_this->wszUnit);\n    }\n    if (_this->wszCondition)\n    {\n        free(_this->wszCondition);\n    }\n    if (_this->pImage)\n    {\n        free(_this->pImage);\n    }\n    if (_this->wszLocation)\n    {\n        free(_this->wszLocation);\n    }\n    if (_this->hWnd)\n    {\n        DestroyWindow(_this->hWnd);\n    }\n    if (_this->pTaskList)\n    {\n        _this->pTaskList->lpVtbl->Release(_this->pTaskList);\n    }\n    CoUninitialize();\n    SetEvent(_this->hInitializeEvent);\n    if (bShouldReleaseBecauseClientDied)\n    {\n        SHCreateThread(epw_Weather_ReleaseBecauseClientDiedThread, _this, CTF_NOADDREFLIB, NULL);\n    }\n    printf(\"[General] Exiting main thread.\\n\");\n    return 0;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd, LONG64 dwZoomFactor, LONG64 dpiXInitial, LONG64 dpiYInitial)\n{\n    InitializeGlobalVersionAndUBR();\n\n    if (bAllocConsole)\n    {\n        FILE* conout;\n        AllocConsole();\n        freopen_s(\n            &conout,\n            \"CONOUT$\",\n            \"w\",\n            stdout\n        );\n    }\n\n    if (dwUpdateSchedule < 0)\n    {\n        return E_INVALIDARG;\n    }\n    InterlockedExchange64(&_this->dwUpdateSchedule, dwUpdateSchedule);\n\n    if (dwTemperatureUnit < 0 || dwTemperatureUnit > EP_WEATHER_NUM_TUNITS)\n    {\n        return E_INVALIDARG;\n    }\n    InterlockedExchange64(&_this->dwTemperatureUnit, dwTemperatureUnit);\n\n    if (dwProvider < 0 || dwProvider > EP_WEATHER_NUM_PROVIDERS)\n    {\n        return E_INVALIDARG;\n    }\n    InterlockedExchange64(&_this->dwProvider, dwProvider);\n\n    if (!cbx || !cby)\n    {\n        return E_INVALIDARG;\n    }\n    InterlockedExchange64(&_this->cbx, cbx);\n    InterlockedExchange64(&_this->cby, cby);\n\n    _this->hSignalKillSwitch = CreateMutexW(NULL, FALSE, wszName);\n    if (!_this->hSignalKillSwitch || GetLastError() != ERROR_ALREADY_EXISTS)\n    {\n        return E_INVALIDARG;\n    }\n\n    InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);\n    InterlockedExchange64(&_this->dwZoomFactor, dwZoomFactor);\n    _this->dpiXInitial = dpiXInitial;\n    _this->dpiYInitial = dpiYInitial;\n\n    _this->hUxtheme = LoadLibraryW(L\"uxtheme.dll\");\n    if (_this->hUxtheme)\n    {\n        RefreshImmersiveColorPolicyState = GetProcAddress(_this->hUxtheme, (LPCSTR)104);\n        SetPreferredAppMode = GetProcAddress(_this->hUxtheme, (LPCSTR)135);\n        AllowDarkModeForWindow = GetProcAddress(_this->hUxtheme, (LPCSTR)133);\n        ShouldAppsUseDarkMode = GetProcAddress(_this->hUxtheme, (LPCSTR)132);\n        ShouldSystemUseDarkMode = GetProcAddress(_this->hUxtheme, (LPCSTR)138);\n        if (ShouldAppsUseDarkMode &&\n            ShouldSystemUseDarkMode &&\n            SetPreferredAppMode &&\n            AllowDarkModeForWindow &&\n            RefreshImmersiveColorPolicyState\n            )\n        {\n            SetPreferredAppMode(TRUE);\n            epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);\n        }\n    }\n\n    _this->hShlwapi = LoadLibraryW(L\"Shlwapi.dll\");\n    if (_this->hShlwapi)\n    {\n        _this->SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(_this->hShlwapi, \"SHRegGetValueFromHKCUHKLM\");\n    }\n\n    _this->hMutexData = CreateMutexW(NULL, FALSE, NULL);\n    if (!_this->hMutexData)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n\n    _this->hInitializeEvent = CreateEventW(NULL, FALSE, FALSE, NULL);\n    if (!_this->hInitializeEvent)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n\n    _this->hSignalExitMainThread = CreateEventW(NULL, FALSE, FALSE, NULL);\n    if (!_this->hSignalExitMainThread)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n\n    _this->hSignalOnAccessibilitySettingsChangedFromHKCU = CreateEventW(NULL, FALSE, FALSE, NULL);\n    if (!_this->hSignalOnAccessibilitySettingsChangedFromHKCU)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n    _this->hSignalOnAccessibilitySettingsChangedFromHKLM = CreateEventW(NULL, FALSE, FALSE, NULL);\n    if (!_this->hSignalOnAccessibilitySettingsChangedFromHKLM)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n    epw_Weather_SetTextScaleFactorFromRegistry(_this, HKEY_CURRENT_USER, FALSE);\n    epw_Weather_SetTextScaleFactorFromRegistry(_this, HKEY_LOCAL_MACHINE, FALSE);\n\n    _this->rc = rc;\n\n    _this->hMainThread = CreateThread(NULL, 0, epw_Weather_MainThread, _this, 0, NULL);\n    if (!_this->hMainThread)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n\n    WaitForSingleObject(_this->hInitializeEvent, INFINITE);\n    if (FAILED(_this->hrLastError))\n    {\n        return _this->hrLastError;\n    }\n\n    *hWnd = _this->hWnd;\n\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this)\n{\n    SetLastError(0);\n    LONG_PTR dwExStyle = GetWindowLongPtrW(_this->hWnd, GWL_EXSTYLE);\n    if (!GetLastError())\n    {\n        SetWindowLongPtrW(_this->hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW | dwExStyle);\n    }\n    INT preference = InterlockedAdd64(&_this->dwWindowCornerPreference, 0);\n    DwmSetWindowAttribute(_this->hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));\n    PostMessageW(_this->hWnd, EP_WEATHER_WM_REBOUND_BROWSER, 0, 0);\n    ShowWindow(_this->hWnd, SW_SHOW);\n    _this->pTaskList->lpVtbl->DeleteTab(_this->pTaskList, _this->hWnd);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_Hide(EPWeather* _this)\n{\n    SetLastError(0);\n    LONG_PTR dwExStyle = GetWindowLongPtrW(_this->hWnd, GWL_EXSTYLE);\n    if (!GetLastError())\n    {\n        SetWindowLongPtrW(_this->hWnd, GWL_EXSTYLE, ~WS_EX_TOOLWINDOW & dwExStyle);\n    }\n    ShowWindow(_this->hWnd, SW_HIDE);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetWindowHandle(EPWeather* _this, HWND* phWnd)\n{\n    *phWnd = _this->hWnd;\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_LockData(EPWeather* _this)\n{\n    DWORD dwRes = WaitForSingleObject(_this->hMutexData, INFINITE);\n    if (dwRes == WAIT_ABANDONED)\n    {\n        return HRESULT_FROM_WIN32(ERROR_ABANDONED_WAIT_0);\n    }\n    else if (dwRes == WAIT_FAILED)\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetDataSizes(EPWeather* _this, LPDWORD pcbTemperature, LPDWORD pcbUnit, LPDWORD pcbCondition, LPDWORD pcbImage)\n{\n    *pcbTemperature = _this->cbTemperature;\n    *pcbUnit = _this->cbUnit;\n    *pcbCondition = _this->cbCondition;\n    *pcbImage = _this->cbImage;\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetData(EPWeather* _this, DWORD cbTemperature, LPCWSTR wszTemperature, DWORD cbUnit, LPCWSTR wszUnit, DWORD cbCondition, LPCWSTR wszCondition, DWORD cbImage, char* pImage)\n{\n    if (cbTemperature)\n    {\n        memcpy_s(wszTemperature, cbTemperature, _this->wszTemperature, _this->cbTemperature);\n    }\n    if (cbUnit)\n    {\n        memcpy_s(wszUnit, cbUnit, _this->wszUnit, _this->cbUnit);\n    }\n    if (cbCondition)\n    {\n        memcpy_s(wszCondition, cbCondition, _this->wszCondition, _this->cbCondition);\n    }\n    if (cbImage)\n    {\n        memcpy_s(pImage, cbImage, _this->pImage, _this->cbImage);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetTitle(EPWeather* _this, DWORD cbTitle, LPCWSTR wszTitle, DWORD dwType)\n{\n    WCHAR wszBuffer[MAX_PATH];\n    ZeroMemory(wszBuffer, MAX_PATH * sizeof(WCHAR));\n    if (cbTitle)\n    {\n        switch (dwType)\n        {\n        case EP_WEATHER_VIEW_ICONTEXT:\n        case EP_WEATHER_VIEW_TEXTONLY:\n            swprintf_s(wszBuffer, MAX_PATH, L\"%s\", _this->wszLocation);\n            break;\n        case EP_WEATHER_VIEW_ICONTEMP:\n        case EP_WEATHER_VIEW_TEMPONLY:\n            swprintf_s(wszBuffer, MAX_PATH, L\"%s - %s\", _this->wszLocation, _this->wszCondition);\n            break;\n        case EP_WEATHER_VIEW_ICONONLY:\n            swprintf_s(wszBuffer, MAX_PATH, L\"%s %s | %s - %s\", _this->wszTemperature, _this->wszUnit, _this->wszLocation, _this->wszCondition);\n            break;\n        }\n        memcpy_s(wszTitle, cbTitle, wszBuffer, MAX_PATH);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_UnlockData(EPWeather* _this)\n{\n    if (!ReleaseMutex(_this->hMutexData))\n    {\n        return HRESULT_FROM_WIN32(GetLastError());\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_IsInitialized(EPWeather* _this, BOOL* bIsInitialized)\n{\n    *bIsInitialized = _this->hInitializeEvent;\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetNotifyWindow(EPWeather* _this, HWND hWndNotify)\n{\n    InterlockedExchange64(&_this->hNotifyWnd, hWndNotify);\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetTemperatureUnit(EPWeather* _this, LONG64 dwTemperatureUnit)\n{\n    if (dwTemperatureUnit < 0 || dwTemperatureUnit > EP_WEATHER_NUM_TUNITS)\n    {\n        return E_INVALIDARG;\n    }\n    InterlockedExchange64(&_this->dwTemperatureUnit, dwTemperatureUnit);\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetUpdateSchedule(EPWeather* _this, LONG64 dwUpdateSchedule)\n{\n    if (dwUpdateSchedule < 0)\n    {\n        return E_INVALIDARG;\n    }\n    LONG64 dwOldUpdateSchedule = InterlockedExchange64(&_this->dwUpdateSchedule, dwUpdateSchedule);\n    if (dwOldUpdateSchedule != dwUpdateSchedule)\n    {\n        KillTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH);\n        SetTimer(_this->hWnd, EP_WEATHER_TIMER_SCHEDULE_REFRESH, dwUpdateSchedule, NULL);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetTerm(EPWeather* _this, DWORD cbTerm, LPCWSTR wszTerm)\n{\n    if (cbTerm)\n    {\n        memcpy_s(_this->wszTerm, sizeof(WCHAR) * MAX_PATH, wszTerm, cbTerm);\n    }\n    else\n    {\n        ZeroMemory(&_this->wszTerm, sizeof(WCHAR) * MAX_PATH);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetLanguage(EPWeather* _this, DWORD cbLanguage, LPCWSTR wszLanguage)\n{\n    if (cbLanguage)\n    {\n        memcpy_s(_this->wszLanguage, sizeof(WCHAR) * MAX_PATH, wszLanguage, cbLanguage);\n    }\n    else\n    {\n        ZeroMemory(&_this->wszLanguage, sizeof(WCHAR) * MAX_PATH);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_SetIconSize(EPWeather* _this, LONG64 cbx, LONG64 cby)\n{\n    DWORD dwOldX = InterlockedAdd64(&_this->cbx, 0);\n    DWORD dwOldY = InterlockedAdd64(&_this->cby, 0);\n    if (dwOldX != cbx)\n    {\n        InterlockedExchange64(&_this->cbx, cbx);\n        InterlockedExchange64(&_this->cby, cby);\n        PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);\n    }\n    return S_OK;\n}\n\nHRESULT STDMETHODCALLTYPE epw_Weather_GetIconSize(EPWeather* _this, LONG64* cbx, LONG64* cby)\n{\n    if (cbx) *cbx = InterlockedAdd64(&_this->cbx, 0);\n    if (cby) *cby = InterlockedAdd64(&_this->cby, 0);\n    return S_OK;\n}"
  },
  {
    "path": "ep_weather_host/ep_weather_host.h",
    "content": "#ifndef _H_AS_SERVICE_P_H_\r\n#define _H_AS_SERVICE_P_H_\r\n#include \"ep_weather.h\"\r\n#include \"ep_weather_utility.h\"\r\n#include \"ep_weather_host_h.h\"\r\n#include \"../ExplorerPatcher/def.h\"\r\n#include <windowsx.h>\r\n#include <ShlObj.h>\r\n#include <Shobjidl.h>\r\n#include <dwmapi.h>\r\n#pragma comment(lib, \"Dwmapi.lib\")\r\n#include <netlistmgr.h>\r\n#include <Iphlpapi.h>\r\n#pragma comment(lib, \"IPHLPAPI.lib\")\r\n#include \"WebView2.h\"\r\n#pragma comment(lib, \"uxtheme.lib\")\r\n#include <ShellScalingApi.h>\r\n#include <shlwapi.h>\r\n\r\nDEFINE_GUID(IID_ITaskbarList,\r\n    0x56FDF342, 0xFD6D, 0x11d0, 0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90);\r\n\r\n#define EP_WEATHER_NUM_SIGNALS 4\r\n\r\n#define EP_WEATHER_TIMER_REQUEST_REPAINT 1\r\n#define EP_WEATHER_TIMER_REQUEST_REPAINT_DELAY 1000\r\n#define EP_WEATHER_TIMER_REQUEST_REFRESH 10\r\n#define EP_WEATHER_TIMER_REQUEST_REFRESH_DELAY 2000\r\n#define EP_WEATHER_TIMER_SCHEDULE_REFRESH 11\r\n#define EP_WEATHER_TIMER_RESIZE_WINDOW 15\r\n#define EP_WEATHER_TIMER_RESIZE_WINDOW_DELAY 150\r\n#define EP_WEATHER_TIMER_EXECUTEDATASCRIPT 20\r\n#define EP_WEATHER_TIMER_EXECUTEDATASCRIPT_DELAY 500\r\n\r\ntypedef struct _GenericObjectWithThis GenericObjectWithThis;\r\n\r\n/* EPWeather */\r\ntypedef interface EPWeather\r\n{\r\n    CONST_VTBL IEPWeatherVtbl* lpVtbl;\r\n    unsigned int cbCount;\r\n    HRESULT hrLastError;\r\n    /**/HANDLE hMainThread;//\r\n    /**/HANDLE hInitializeEvent;//\r\n    /*//*/HWND hWnd;//\r\n\r\n    INT64 bBrowserBusy; // interlocked\r\n    HWND hNotifyWnd; // interlocked\r\n    LONG64 dwTemperatureUnit; // interlocked\r\n    LONG64 dwUpdateSchedule; // interlocked\r\n    WCHAR wszTerm[MAX_PATH];\r\n    WCHAR wszLanguage[MAX_PATH];\r\n    LONG64 cbx; // interlocked\r\n    LONG64 cby; // interlocked\r\n    LONG64 dwProvider; // interlocked\r\n    LONG64 bIsNavigatingToError; // interlocked\r\n    LONG64 g_darkModeEnabled; // interlocked\r\n    LONG64 dwGeolocationMode;\r\n    LONG64 dwWindowCornerPreference;\r\n    LONG64 dwDevMode;\r\n    LONG64 dwTextDir;\r\n    LONG64 dwIconPack;\r\n    LONG64 dwZoomFactor;\r\n\r\n    /**/HANDLE hMutexData;// // protects the following:\r\n    DWORD cbTemperature;\r\n    /*//*/LPCWSTR wszTemperature;//\r\n    DWORD cbUnit;\r\n    /*//*/LPCWSTR wszUnit;//\r\n    DWORD cbCondition;\r\n    /*//*/LPCWSTR wszCondition;//\r\n    DWORD cbImage;\r\n    /*//*/char* pImage;//\r\n    DWORD cbLocation;\r\n    /*//*/LPCWSTR wszLocation;//\r\n    LONG64 dwTextScaleFactor; // interlocked\r\n    /**/HMODULE hUxtheme;//\r\n    /**/HMODULE hShlwapi;//\r\n    /**/HKEY hKCUAccessibility;//\r\n    /**/HKEY hKLMAccessibility;//\r\n    DWORD cntResizeWindow;\r\n\r\n    RECT rcBorderThickness; // local variables:\r\n    /*//*/ITaskbarList* pTaskList;//\r\n    /*//*/ICoreWebView2Controller* pCoreWebView2Controller;//\r\n    /*//*/ICoreWebView2* pCoreWebView2;//\r\n    /*//*/GenericObjectWithThis* pCoreWebView2NavigationStartingEventHandler;//\r\n    EventRegistrationToken tkOnNavigationStarting;\r\n    /*//*/GenericObjectWithThis* pCoreWebView2NavigationCompletedEventHandler;//\r\n    EventRegistrationToken tkOnNavigationCompleted;\r\n    /*//*/GenericObjectWithThis* pCoreWebView2PermissionRequestedEventHandler;//\r\n    EventRegistrationToken tkOnPermissionRequested;\r\n    RECT rc;\r\n    LONG64 dpiXInitial;\r\n    LONG64 dpiYInitial;\r\n    FARPROC SHRegGetValueFromHKCUHKLMFunc;\r\n    LONG64 cbGenericObject;\r\n\r\n    /**/HANDLE hSignalExitMainThread;//\r\n    /**/HANDLE hSignalKillSwitch;//\r\n    /**/HANDLE hSignalOnAccessibilitySettingsChangedFromHKCU;//\r\n    /**/HANDLE hSignalOnAccessibilitySettingsChangedFromHKLM;//\r\n} EPWeather;\r\n\r\nULONG   STDMETHODCALLTYPE epw_Weather_AddRef(EPWeather* _this);\r\nULONG   STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_QueryInterface(EPWeather* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_About(EPWeather* _this, HWND hWnd);\r\n\r\nHRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd, LONG64 dwZoomFactor, LONG64 dpiXInitial, LONG64 dpiYInitial);\r\n\r\nHRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_Hide(EPWeather* _this);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetWindowHandle(EPWeather* _this, HWND* phWnd);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_IsInitialized(EPWeather* _this, BOOL* bIsInitialized);\r\n\r\nHRESULT STDMETHODCALLTYPE epw_Weather_LockData(EPWeather* _this);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetDataSizes(EPWeather* _this, LPDWORD pcbTemperature, LPDWORD pcbUnit, LPDWORD pcbCondition, LPDWORD pcbImage);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetData(EPWeather* _this, DWORD cbTemperature, LPCWSTR wszTemperature, DWORD cbUnit, LPCWSTR wszUnit, DWORD cbCondition, LPCWSTR wszCondition, DWORD cbImage, char* pImage);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetTitle(EPWeather* _this, DWORD cbTitle, LPCWSTR wszTitle, DWORD dwType);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_UnlockData(EPWeather* _this);\r\n\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetNotifyWindow(EPWeather* _this, HWND hWndNotify);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetTemperatureUnit(EPWeather* _this, LONG64 dwTemperatureUnit);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetUpdateSchedule(EPWeather* _this, LONG64 dwUpdateSchedule);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetTerm(EPWeather* _this, DWORD cbTerm, LPCWSTR wszTerm);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetLanguage(EPWeather* _this, DWORD cbLanguage, LPCWSTR wszLanguage);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetIconSize(EPWeather* _this, LONG64 cbx, LONG64 cby);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetIconSize(EPWeather* _this, LONG64* cbx, LONG64* cby);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64 bRefresh);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64* bEnabled);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG64 dwGeolocationMode);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this, LONG64 dwWindowCornerPreference);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetDevMode(EPWeather* _this, LONG64 dwDevMode, LONG64 bRefresh);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetIconPack(EPWeather* _this, LONG64 dwIconPack, LONG64 bRefresh);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_SetZoomFactor(EPWeather* _this, LONG64 dwZoomFactor);\r\nHRESULT STDMETHODCALLTYPE epw_Weather_GetLastUpdateTime(EPWeather* _this, LPSYSTEMTIME lpLastUpdateTime);\r\n\r\nstatic const IEPWeatherVtbl IEPWeather_Vtbl = {\r\n    .QueryInterface = epw_Weather_QueryInterface,\r\n    .AddRef = epw_Weather_AddRef,\r\n    .Release = epw_Weather_Release,\r\n    .About = epw_Weather_About,\r\n    .Initialize = epw_Weather_Initialize,\r\n    .Show = epw_Weather_Show,\r\n    .Hide = epw_Weather_Hide,\r\n    .GetWindowHandle = epw_Weather_GetWindowHandle,\r\n    .LockData = epw_Weather_LockData,\r\n    .GetDataSizes = epw_Weather_GetDataSizes,\r\n    .GetData = epw_Weather_GetData,\r\n    .UnlockData = epw_Weather_UnlockData,\r\n    .SetNotifyWindow = epw_Weather_SetNotifyWindow,\r\n    .IsInitialized = epw_Weather_IsInitialized,\r\n    .GetTitle = epw_Weather_GetTitle,\r\n    .SetTemperatureUnit = epw_Weather_SetTemperatureUnit,\r\n    .SetTerm = epw_Weather_SetTerm,\r\n    .SetLanguage = epw_Weather_SetLanguage,\r\n    .SetIconSize = epw_Weather_SetIconSize,\r\n    .GetIconSize = epw_Weather_GetIconSize,\r\n    .SetUpdateSchedule = epw_Weather_SetUpdateSchedule,\r\n    .SetDarkMode = epw_Weather_SetDarkMode,\r\n    .SetGeolocationMode = epw_Weather_SetGeolocationMode,\r\n    .SetWindowCornerPreference = epw_Weather_SetWindowCornerPreference,\r\n    .SetDevMode = epw_Weather_SetDevMode,\r\n    .SetIconPack = epw_Weather_SetIconPack,\r\n    .SetZoomFactor = epw_Weather_SetZoomFactor,\r\n    .GetLastUpdateTime = epw_Weather_GetLastUpdateTime,\r\n};\r\n\r\nstatic inline DWORD epw_Weather_GetTextScaleFactor(EPWeather* _this) { return InterlockedAdd64(&_this->dwTextScaleFactor, 0); }\r\nstatic inline DWORD epw_Weather_GetZoomFactor(EPWeather* _this) { return InterlockedAdd64(&_this->dwZoomFactor, 0); }\r\nstatic inline DWORD epw_Weather_GetStyle(EPWeather* _this) { SetLastError(0); return GetWindowLongW(_this->hWnd, GWL_STYLE); }\r\nstatic inline DWORD epw_Weather_HasMenuBar(EPWeather* _this) { return 0; }\r\nstatic inline DWORD epw_Weather_GetExtendedStyle(EPWeather* _this) { SetLastError(0); return GetWindowLongW(_this->hWnd, GWL_EXSTYLE); }\r\nstatic void epw_Weather_SetTextScaleFactorFromRegistry(EPWeather* _this, HKEY hKey, BOOL bRefresh);\r\n\r\nHRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this);\r\nULONG   STDMETHODCALLTYPE epw_Weather_static_AddRefRelease(EPWeather* _this);\r\n\r\n/* ICoreWebView2EnvironmentOptions */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_AdditionalBrowserArguments(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_Language(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_TargetCompatibleBrowserVersion(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount(ICoreWebView2EnvironmentOptions* _this, BOOL* allow);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2EnvironmentOptions_QueryInterface(IUnknown* _this, REFIID riid, void** ppv);\r\nstatic const ICoreWebView2EnvironmentOptionsVtbl EPWeather_ICoreWebView2EnvironmentOptionsVtbl = {\r\n    .QueryInterface = ICoreWebView2EnvironmentOptions_QueryInterface,\r\n    .AddRef = epw_Weather_static_AddRefRelease,\r\n    .Release = epw_Weather_static_AddRefRelease,\r\n    .get_AdditionalBrowserArguments = ICoreWebView2_get_AdditionalBrowserArguments,\r\n    .put_AdditionalBrowserArguments = epw_Weather_static_Stub,\r\n    .get_Language = ICoreWebView2_get_Language,\r\n    .put_Language = epw_Weather_static_Stub,\r\n    .get_TargetCompatibleBrowserVersion = ICoreWebView2_get_TargetCompatibleBrowserVersion,\r\n    .put_TargetCompatibleBrowserVersion = epw_Weather_static_Stub,\r\n    .get_AllowSingleSignOnUsingOSPrimaryAccount = ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount,\r\n    .put_AllowSingleSignOnUsingOSPrimaryAccount = epw_Weather_static_Stub,\r\n};\r\nstatic const ICoreWebView2EnvironmentOptions EPWeather_ICoreWebView2EnvironmentOptions = {\r\n    .lpVtbl = &EPWeather_ICoreWebView2EnvironmentOptionsVtbl\r\n};\r\n\r\n\r\n/* GenericObjectWithThis */\r\ntypedef struct _GenericObjectWithThis {\r\n    IUnknownVtbl* lpVtbl;\r\n    void* pInstance;\r\n    LONG64 cbCount;\r\n    EPWeather* _this;\r\n    LPWSTR pName;\r\n} GenericObjectWithThis;\r\nGenericObjectWithThis* GenericObjectWithThis_MakeAndInitialize(IUnknownVtbl* vtbl, EPWeather* _this, const LPWSTR pName);\r\nULONG   STDMETHODCALLTYPE GenericObjectWithThis_AddRef(GenericObjectWithThis* _this);\r\nULONG   STDMETHODCALLTYPE GenericObjectWithThis_Release(GenericObjectWithThis* _this);\r\n\r\n\r\n/* INetworkListManagerEvents */\r\nHRESULT STDMETHODCALLTYPE INetworkListManagerEvents_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE INetworkListManagerEvents_ConnectivityChanged(GenericObjectWithThis* _this2, NLM_CONNECTIVITY newConnectivity);\r\nstatic const INetworkListManagerEventsVtbl INetworkListManagerEvents_Vtbl = {\r\n    .QueryInterface = INetworkListManagerEvents_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .ConnectivityChanged = INetworkListManagerEvents_ConnectivityChanged,\r\n};\r\n/* */\r\n\r\n\r\n/* ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2EnvironmentCompleted(GenericObjectWithThis* _this, HRESULT errorCode, ICoreWebView2Environment* pCoreWebView2Environment);\r\nstatic const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_CreateCoreWebView2EnvironmentCompleted,\r\n};\r\n/* */\r\n\r\n\r\n/* ICoreWebView2CreateCoreWebView2ControllerCompletedHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2CreateCoreWebView2ControllerCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(GenericObjectWithThis* _this, HRESULT hr, ICoreWebView2Controller* pCoreWebView2Controller);\r\nstatic const ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_CreateCoreWebView2ControllerCompleted,\r\n};\r\n/* */\r\n\r\n\r\n/* ICoreWebView2NavigationStartingEventHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2NavigationStartingEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationStarting(GenericObjectWithThis* _this, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationStartingEventArgs* pCoreWebView2NavigationStartingEventArgs);\r\nstatic const ICoreWebView2NavigationStartingEventHandlerVtbl EPWeather_ICoreWebView2NavigationStartingEventHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2NavigationStartingEventHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_NavigationStarting,\r\n};\r\n\r\n\r\n/* ICoreWebView2NavigationCompletedEventHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2NavigationCompletedEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationCompleted(GenericObjectWithThis* _this, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationCompletedEventArgs* pCoreWebView2NavigationCompletedEventArgs);\r\nstatic const ICoreWebView2NavigationCompletedEventHandlerVtbl EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2NavigationCompletedEventHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_NavigationCompleted,\r\n};\r\n\r\n\r\n/* ICoreWebView2PermissionRequestedEventHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2PermissionRequestedEventHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_PermissionRequested(GenericObjectWithThis* _this, ICoreWebView2* pCoreWebView2, ICoreWebView2PermissionRequestedEventArgs* pCoreWebView2PermissionRequestedEventArgs);\r\nstatic const ICoreWebView2PermissionRequestedEventHandlerVtbl EPWeather_ICoreWebView2PermissionRequestedEventHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2PermissionRequestedEventHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_PermissionRequested,\r\n};\r\n\r\n\r\n/* ICoreWebView2CallDevToolsProtocolMethodCompletedHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2CallDevToolsProtocolMethodCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_CallDevToolsProtocolMethodCompleted(GenericObjectWithThis* _this, HRESULT errorCode, LPCWSTR returnObjectAsJson);\r\nstatic ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl EPWeather_ICoreWebView2CallDevToolsProtocolMethodCompletedHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2CallDevToolsProtocolMethodCompletedHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_CallDevToolsProtocolMethodCompleted\r\n};\r\n\r\n\r\n/* ICoreWebView2ExecuteScriptCompletedHandler */\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2ExecuteScriptCompletedHandler_QueryInterface(GenericObjectWithThis* _this, REFIID riid, void** ppv);\r\nHRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(GenericObjectWithThis* _this, HRESULT hr, LPCWSTR pResultObjectAsJson);\r\nstatic const ICoreWebView2ExecuteScriptCompletedHandlerVtbl EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl = {\r\n    .QueryInterface = ICoreWebView2ExecuteScriptCompletedHandler_QueryInterface,\r\n    .AddRef = GenericObjectWithThis_AddRef,\r\n    .Release = GenericObjectWithThis_Release,\r\n    .Invoke = ICoreWebView2_ExecuteScriptCompleted,\r\n};\r\n#endif\r\n"
  },
  {
    "path": "ep_weather_host/ep_weather_host.rc",
    "content": "// Microsoft Visual C++ generated resource script.\r\n//\r\n#include \"resource.h\"\r\n\r\n#define APSTUDIO_READONLY_SYMBOLS\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 2 resource.\r\n//\r\n#include \"winres.h\"\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#undef APSTUDIO_READONLY_SYMBOLS\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n// English (United States) resources\r\n\r\n#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\nLANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r\n#pragma code_page(1252)\r\n\r\n#ifdef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// TEXTINCLUDE\r\n//\r\n\r\n1 TEXTINCLUDE \r\nBEGIN\r\n    \"resource.h\\0\"\r\nEND\r\n\r\n2 TEXTINCLUDE \r\nBEGIN\r\n    \"#include \"\"winres.h\"\"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n3 TEXTINCLUDE \r\nBEGIN\r\n    \"\\r\\n\"\r\n    \"\\0\"\r\nEND\r\n\r\n#endif    // APSTUDIO_INVOKED\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Version\r\n//\r\n\r\nVS_VERSION_INFO VERSIONINFO\r\n FILEVERSION 1,0,0,0\r\n PRODUCTVERSION 1,0,0,0\r\n FILEFLAGSMASK 0x3fL\r\n#ifdef _DEBUG\r\n FILEFLAGS 0x1L\r\n#else\r\n FILEFLAGS 0x0L\r\n#endif\r\n FILEOS 0x40004L\r\n FILETYPE 0x1L\r\n FILESUBTYPE 0x0L\r\nBEGIN\r\n    BLOCK \"StringFileInfo\"\r\n    BEGIN\r\n        BLOCK \"040904b0\"\r\n        BEGIN\r\n            VALUE \"CompanyName\", \"VALINET Solutions SRL\"\r\n            VALUE \"FileDescription\", \"ExplorerPatcher Weather Host\"\r\n            VALUE \"FileVersion\", \"1.0.0.0\"\r\n            VALUE \"InternalName\", \"ep_weather_host.exe\"\r\n            VALUE \"LegalCopyright\", \"Copyright (C) 2006-2025 VALINET Solutions SRL. All rights reserved.\"\r\n            VALUE \"OriginalFilename\", \"ep_weather_host.exe\"\r\n            VALUE \"ProductName\", \"ExplorerPatcher\"\r\n            VALUE \"ProductVersion\", \"1.0.0.0\"\r\n        END\r\n    END\r\n    BLOCK \"VarFileInfo\"\r\n    BEGIN\r\n        VALUE \"Translation\", 0x409, 1200\r\n    END\r\nEND\r\n\r\n#endif    // English (United States) resources\r\n/////////////////////////////////////////////////////////////////////////////\r\n\r\n\r\n\r\n#ifndef APSTUDIO_INVOKED\r\n/////////////////////////////////////////////////////////////////////////////\r\n//\r\n// Generated from the TEXTINCLUDE 3 resource.\r\n//\r\n\r\n\r\n/////////////////////////////////////////////////////////////////////////////\r\n#endif    // not APSTUDIO_INVOKED\r\n\r\n"
  },
  {
    "path": "ep_weather_host/ep_weather_host.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64EC\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64EC\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{314a50c1-f0a0-4d0c-89e1-ad8f3951043e}</ProjectGuid>\r\n    <RootNamespace>epweatherhost</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n    <WithArm64XBinaries>false</WithArm64XBinaries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n      <ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <AdditionalIncludeDirectories>$(SolutionDir)libs\\libvalinet;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_weather.c\" />\r\n    <ClCompile Include=\"ep_weather_factory.c\" />\r\n    <ClCompile Include=\"ep_weather_host.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"..\\ep_weather_host_stub\\$(Platform)\\$(Configuration)\\ep_weather_host_h.h\" />\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\def.h\" />\r\n    <ClInclude Include=\"ep_weather.h\" />\r\n    <ClInclude Include=\"ep_weather_error_html.h\" />\r\n    <ClInclude Include=\"ep_weather_factory.h\" />\r\n    <ClInclude Include=\"ep_weather_host.h\" />\r\n    <ClInclude Include=\"ep_weather_provider_google_html.h\" />\r\n    <ClInclude Include=\"ep_weather_provider_google_script.h\" />\r\n    <ClInclude Include=\"ep_weather_utility.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ep_weather_host.rc\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Midl Include=\"..\\ep_weather_host_stub\\ep_weather_host.idl\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"packages.config\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n    <Import Project=\"..\\packages\\Microsoft.Web.WebView2.1.0.3405.78\\build\\native\\Microsoft.Web.WebView2.targets\" Condition=\"Exists('..\\packages\\Microsoft.Web.WebView2.1.0.3405.78\\build\\native\\Microsoft.Web.WebView2.targets')\" />\r\n  </ImportGroup>\r\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\r\n    <PropertyGroup>\r\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\r\n    </PropertyGroup>\r\n    <Error Condition=\"!Exists('..\\packages\\Microsoft.Web.WebView2.1.0.3405.78\\build\\native\\Microsoft.Web.WebView2.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\packages\\Microsoft.Web.WebView2.1.0.3405.78\\build\\native\\Microsoft.Web.WebView2.targets'))\" />\r\n  </Target>\r\n</Project>"
  },
  {
    "path": "ep_weather_host/ep_weather_host.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"ep_weather_host.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ep_weather_factory.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ep_weather.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"resource.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_factory.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_host.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_utility.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_provider_google_script.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_provider_google_html.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ep_weather_error_html.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\ExplorerPatcher\\def.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"..\\ep_weather_host_stub\\$(Platform)\\$(Configuration)\\ep_weather_host_h.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"ep_weather_host.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Midl Include=\"..\\ep_weather_host_stub\\ep_weather_host.idl\">\r\n      <Filter>Source Files</Filter>\r\n    </Midl>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"packages.config\" />\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "ep_weather_host/ep_weather_provider_google_html.h",
    "content": "#ifndef _H_EP_WEATHER_PROVIDER_GOOGLE_HTML_H_\r\n#define _H_EP_WEATHER_PROVIDER_GOOGLE_HTML_H_\r\n#include <Windows.h>\r\n#define EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN 2000\r\nLPCWSTR ep_weather_provider_google_html = L\"\\\r\n<!DOCTYPE html>\\n\\\r\n<html lang=\\\"en\\\" xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\\\r\n<head>\\n\\\r\n<meta charset=\\\"utf-8\\\" />\\n\\\r\n<title>Weather</title>\\n\\\r\n<style>\\n\\\r\nhtml {\\n\\\r\n  background-color: transparent !important;\\n\\\r\n}\\n\\\r\n.google-weather-place {\\n\\\r\n    width: calc(655px); height: calc(370px);\\n\\\r\n}\\n\\\r\n.google-weather-crop {\\n\\\r\n    width: calc(655px); height: calc(370px);\\n\\\r\n    overflow: hidden;\\n\\\r\n    transition: 0.3s; \\n\\\r\n    position: absolute;\\n\\\r\n}\\n\\\r\n.google-weather {\\n\\\r\n    position: relative;\\n\\\r\n    left: -180px; top: -180px;\\n\\\r\n    width: 2560px; height: 5120px;\\n\\\r\n    transform: scale(1.0);\\n\\\r\n    transform-origin: 180px 180px;\\n\\\r\n    transition: 0.3s;\\n\\\r\n    position: absolute;\\n\\\r\n}\\n\\\r\n.google-weather:hover { \\n\\\r\n    transform: scale(1); \\n\\\r\n    z-index: 1000; \\n\\\r\n}\\n\\\r\n</style>\\n\\\r\n</head>\\n\\\r\n<body>\\n\\\r\n<div class=\\\"google-weather-place\\\">\\n\\\r\n<div class=\\\"google-weather-crop\\\">\\n\\\r\n<iframe id=\\\"frame\\\" allowtransparency=\\\"true\\\" class=\\\"google-weather\\\" src=\\\"https://www.google.com/search?igu=1&amp;hl=%s&amp;q=weather%s%s\\\">\\n\\\r\n</iframe>\\n\\\r\n</div>\\n\\\r\n</div>\\n\\\r\n</body>\\n\\\r\n</html>\";\r\n#endif"
  },
  {
    "path": "ep_weather_host/ep_weather_provider_google_script.h",
    "content": "#ifndef _H_EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_H_\r\n#define _H_EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_H_\r\n#include <Windows.h>\r\n// many thanks to https://stackoverflow.com/questions/23202966/google-weather-widget-on-my-website\r\n#define EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN 30000\r\n\r\nLPCWSTR ep_weather_provider_google_script10 = L\"var final_im = 0; function ep_weather_part0() { return \\\"run_part_0\\\"; }; ep_weather_part0();\";\r\n\r\n// reference: https://github.com/Triggertrap/sun-js\r\nLPCWSTR ep_weather_provider_google_script00 = L\"\\\r\nDate.prototype.sunrise = function(latitude, longitude, zenith) {\\n\\\r\n\treturn this.sunriseSet(latitude, longitude, true, zenith);\\n\\\r\n}\\n\\\r\nDate.prototype.sunset = function(latitude, longitude, zenith) {\\n\\\r\n\treturn this.sunriseSet(latitude, longitude, false, zenith);\\n\\\r\n}\\n\\\r\nDate.prototype.sunriseSet = function(latitude, longitude, sunrise, zenith) {\\n\\\r\n\tif(!zenith) {\\n\\\r\n\t\tzenith = 90.8333;\\n\\\r\n\t}\\n\\\r\n\tvar hoursFromMeridian = longitude / Date.DEGREES_PER_HOUR,\\n\\\r\n\t\tdayOfYear = this.getDayOfYear(),\\n\\\r\n\t\tapproxTimeOfEventInDays,\\n\\\r\n\t\tsunMeanAnomaly,\\n\\\r\n\t\tsunTrueLongitude,\\n\\\r\n\t\tascension,\\n\\\r\n\t\trightAscension,\\n\\\r\n\t\tlQuadrant,\\n\\\r\n\t\traQuadrant,\\n\\\r\n\t\tsinDec,\\n\\\r\n\t\tcosDec,\\n\\\r\n\t\tlocalHourAngle,\\n\\\r\n\t\tlocalHour,\\n\\\r\n\t\tlocalMeanTime,\\n\\\r\n\t\ttime;\\n\\\r\n\tif (sunrise) {\\n\\\r\n        approxTimeOfEventInDays = dayOfYear + ((6 - hoursFromMeridian) / 24);\\n\\\r\n    } else {\\n\\\r\n        approxTimeOfEventInDays = dayOfYear + ((18.0 - hoursFromMeridian) / 24);\\n\\\r\n    }\\n\\\r\n\tsunMeanAnomaly = (0.9856 * approxTimeOfEventInDays) - 3.289;\\n\\\r\n\tsunTrueLongitude = sunMeanAnomaly + (1.916 * Math.sinDeg(sunMeanAnomaly)) + (0.020 * Math.sinDeg(2 * sunMeanAnomaly)) + 282.634;\\n\\\r\n\tsunTrueLongitude =  Math.mod(sunTrueLongitude, 360);\\n\\\r\n\tascension = 0.91764 * Math.tanDeg(sunTrueLongitude);\\n\\\r\n    rightAscension = 360 / (2 * Math.PI) * Math.atan(ascension);\\n\\\r\n    rightAscension = Math.mod(rightAscension, 360);\\n\\\r\n    lQuadrant = Math.floor(sunTrueLongitude / 90) * 90;\\n\\\r\n    raQuadrant = Math.floor(rightAscension / 90) * 90;\\n\\\r\n    rightAscension = rightAscension + (lQuadrant - raQuadrant);\\n\\\r\n    rightAscension /= Date.DEGREES_PER_HOUR;\\n\\\r\n    sinDec = 0.39782 * Math.sinDeg(sunTrueLongitude);\\n\\\r\n\tcosDec = Math.cosDeg(Math.asinDeg(sinDec));\\n\\\r\n\tcosLocalHourAngle = ((Math.cosDeg(zenith)) - (sinDec * (Math.sinDeg(latitude)))) / (cosDec * (Math.cosDeg(latitude)));\\n\\\r\n\tlocalHourAngle = Math.acosDeg(cosLocalHourAngle)\\n\\\r\n\tif (sunrise) {\\n\\\r\n\t\tlocalHourAngle = 360 - localHourAngle;\\n\\\r\n\t}\\n\\\r\n\tlocalHour = localHourAngle / Date.DEGREES_PER_HOUR;\\n\\\r\n\tlocalMeanTime = localHour + rightAscension - (0.06571 * approxTimeOfEventInDays) - 6.622;\\n\\\r\n\ttime = localMeanTime - (longitude / Date.DEGREES_PER_HOUR);\\n\\\r\n\ttime = Math.mod(time, 24);\\n\\\r\n\tvar midnight = new Date(0);\\n\\\r\n\t\tmidnight.setUTCFullYear(this.getUTCFullYear());\\n\\\r\n\t\tmidnight.setUTCMonth(this.getUTCMonth());\\n\\\r\n\t\tmidnight.setUTCDate(this.getUTCDate());\\n\\\r\n\tvar milli = midnight.getTime() + (time * 60 *60 * 1000);\\n\\\r\n\treturn new Date(milli);\\n\\\r\n}\\n\\\r\nDate.DEGREES_PER_HOUR = 360 / 24;\\n\\\r\nDate.prototype.getDayOfYear = function() {\\n\\\r\n\tvar onejan = new Date(this.getFullYear(),0,1);\\n\\\r\n\treturn Math.ceil((this - onejan) / 86400000);\\n\\\r\n}\\n\\\r\nMath.degToRad = function(num) {\\n\\\r\n\treturn num * Math.PI / 180;\\n\\\r\n}\\n\\\r\nMath.radToDeg = function(radians){\\n\\\r\n    return radians * 180.0 / Math.PI;\\n\\\r\n}\\n\\\r\nMath.sinDeg = function(deg) {\\n\\\r\n    return Math.sin(deg * 2.0 * Math.PI / 360.0);\\n\\\r\n}\\n\\\r\nMath.acosDeg = function(x) {\\n\\\r\n    return Math.acos(x) * 360.0 / (2 * Math.PI);\\n\\\r\n}\\n\\\r\nMath.asinDeg = function(x) {\\n\\\r\n    return Math.asin(x) * 360.0 / (2 * Math.PI);\\n\\\r\n}\\n\\\r\nMath.tanDeg = function(deg) {\\n\\\r\n    return Math.tan(deg * 2.0 * Math.PI / 360.0);\\n\\\r\n}\\n\\\r\nMath.cosDeg = function(deg) {\\n\\\r\n    return Math.cos(deg * 2.0 * Math.PI / 360.0);\\n\\\r\n}\\n\\\r\nMath.mod = function(a, b) {\\n\\\r\n\tvar result = a % b;\\n\\\r\n\tif(result < 0) {\\n\\\r\n\t\tresult += b;\\n\\\r\n\t}\\n\\\r\n\treturn result;\\n\\\r\n}\\n\\\r\n\\n\\\r\n\\n\\\r\nvar is_first_time = 1;\\n\\\r\nvar final_im = 0;\\n\\\r\nvar final_img2 = 0;\\n\\\r\nvar final_int;\\n\\\r\nvar final_cnt = 0;\\n\\\r\nfunction ep_set_final_img(){\\n\\\r\n//document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0].src = final_img2;\\n\\\r\n//final_cnt++;\\n\\\r\n//if (final_cnt == 20)\\n\\\r\nis_first_time=0;\\n\\\r\nclearInterval(final_int);\\n\\\r\n}\\n\\\r\nfunction ep_download_image_blob(url) {\\n\\\r\n    var request = new XMLHttpRequest();\\n\\\r\n    request.open('GET', url, false);\\n\\\r\n    request.overrideMimeType('text/plain; charset=x-user-defined');\\n\\\r\n    request.send(null);\\n\\\r\n    var binary = new Uint8Array(request.responseText.length);\\n\\\r\n    for(var i=0;i<request.responseText.length;i++){ binary[i] = request.responseText.charCodeAt(i) & 0xff; }\\n\\\r\n    return URL.createObjectURL(new Blob([binary.buffer]));\\n\\\r\n}\\n\\\r\nfunction IsDay(has_time, hrs, mins) {\\n\\\r\nvar w_url = document.querySelector('.YfftMc').childNodes[0].href;\\n\\\r\nvar lat = 0.0;\\n\\\r\nvar lon = 0.0;\\n\\\r\nif (w_url.includes('weathernews.jp')) {\\n\\\r\nlat = parseFloat(w_url.split('/')[4]);\\n\\\r\nlon = parseFloat(w_url.split('/')[5]);\\n\\\r\n} else {\\n\\\r\nvar urlParams = new URLSearchParams(w_url);\\n\\\r\nlat = parseFloat(urlParams.get('https://www.weather.com/wx/today/?lat'));\\n\\\r\nlon = parseFloat(urlParams.get('lon'));\\n\\\r\n}\\n\\\r\nvar current = new Date();\\n\\\r\nif (has_time) { \\n\\\r\nlet off = Math.round(lon/15);\\n\\\r\ncurrent.setUTCHours(hrs - off); current.setMinutes(mins); }\\n\\\r\ncurrent.setSeconds(0);\\n\\\r\ncurrent.setMilliseconds(0);\\n\\\r\nvar sunrise = new Date().sunrise(lat, lon);\\n\\\r\nsunrise.setFullYear(current.getFullYear());\\n\\\r\nsunrise.setMonth(current.getMonth());\\n\\\r\nsunrise.setDate(current.getDate());\\n\\\r\nsunrise.setSeconds(0);\\n\\\r\nsunrise.setMilliseconds(0);\\n\\\r\nvar sunset = new Date().sunset(lat, lon);\\n\\\r\nsunset.setFullYear(current.getFullYear());\\n\\\r\nsunset.setMonth(current.getMonth());\\n\\\r\nsunset.setDate(current.getDate());\\n\\\r\nsunset.setSeconds(0);\\n\\\r\nsunset.setMilliseconds(0);\\n\\\r\nvar is_day2 = 0;\\n\\\r\n//console.log(sunrise);\\n\\\r\n//console.log(sunset);\\n\\\r\n//console.log(current);\\n\\\r\nwhile (1) {\\n\\\r\nif (sunrise.getTime() == current.getTime()) { is_day2 = 1; break; }\\n\\\r\nif (sunrise.getHours() == 23 && sunrise.getMinutes() == 59) { sunrise.setHours(0); sunrise.setMinutes(0); }\\n\\\r\nelse if (sunrise.getMinutes() == 59) { sunrise.setHours(sunrise.getHours() + 1); sunrise.setMinutes(0); }\\n\\\r\nelse sunrise.setMinutes(sunrise.getMinutes() + 1);\\n\\\r\nif (sunrise.getTime() == sunset.getTime()) break;\\n\\\r\n}\\n\\\r\n//console.log(is_day2);\\n\\\r\nreturn is_day2;\\n\\\r\n}\\n\\\r\nis_day1 = IsDay(0, 0, 0);\\n\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script010 = L\"\\\r\nfunction replaceImage(im, is_day) {\\n\\\r\nvar final_img = 0;\\n\\\r\nif (!im.src) { return; }\\n\\\r\nif (       im.src.endsWith('/sunny_s_cloudy.png') || im.src.endsWith('AAAAAAAAAAAAAAAA+Pf6Bm5v6/1bJGiwAAAAAElFTkSuQmCC') || im.src.endsWith('MYe78v+ACIiACIiACJTEEyDCTi8sMWUSAAAAAElFTkSuQmCC')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949438-4e0c0e0d-67bc-4c76-b75e-e0ffcead3f48.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949442-63f14d44-ec0e-40b2-aa1b-8e4a27ec10f5.png');\\n\\\r\n} else if (im.src.endsWith('/sunny.png')          || im.src.endsWith('Ls8fJgAAAAAAAADg1nkDlR7XfJiH1ggAAAAASUVORK5CYII=') || im.src.endsWith('NzjYbzHpLqUCFKCAJfkAq7RimK7qUtAAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949449-9320c6f5-15ef-4c17-9e72-740708f4828c.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949451-269d02a3-08cb-4237-9789-f1e60fdc723d.png');\\n\\\r\n} else if (im.src.endsWith('/cloudy.png')         || im.src.endsWith('AiAAAiAAAiAAAiAAl48fFVnRpiVnD+AAAAAASUVORK5CYII=') || im.src.endsWith('gAAIgAAIgAAIgAC86wECCuvGtH3EIQAAAABJRU5ErkJggg==')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949452-f347fe27-5005-48f2-9c9a-899bb7b8825e.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949452-f347fe27-5005-48f2-9c9a-899bb7b8825e.png');\\n\\\r\n} else if (im.src.endsWith('/rain_s_cloudy.png')  || im.src.endsWith('CQABIAAEgAAQAAJAAB6iPy4FckaI/hnJAAAAAElFTkSuQmCC') || im.src.endsWith('lFRe7S+mBtAAGkADeFsvKpKWeAy6FowAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n} else if (im.src.endsWith('/cloudy_s_rain.png')  || im.src.endsWith('1S6F6f8CBIAAEAACcEP9AsAciK6YtipuAAAAAElFTkSuQmCC') || im.src.endsWith('A8DsIAvZ0J98BEAA//oBqG5a70gUjuIAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n} else if (im.src.endsWith('/rain_light.png')     || im.src.endsWith('LTAzVDExOjEzOjA0KzAyOjAw/lWSQAAAAABJRU5ErkJggg==') || im.src.endsWith('LTAzVDExOjEzOjA0KzAyOjAw/lWSQAAAAABJRU5ErkJggg==')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949458-dc66775d-8bb9-4d04-838e-7f550d305c26.png');\\n\\\r\n} else if (im.src.endsWith('/rain.png')           || im.src.endsWith('FEABFEABFEABFOB3fgDsHp230RVQOwAAAABJRU5ErkJggg==') || im.src.endsWith('MeRa9W/WClABKkAFiKofRnoGaQBkK9wAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949460-7c132d89-efb7-457f-8810-9bf235f5737f.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949460-7c132d89-efb7-457f-8810-9bf235f5737f.png');\\n\\\r\n} else if (im.src.endsWith('/rain_heavy.png')     || im.src.endsWith('oP1rrAFoABqABqAS/QFSaJKDZ1ZY3QAAAABJRU5ErkJggg==') || im.src.endsWith('U4t1idb1T/0FcAF86g/VgX+0644VVAAAAABJRU5ErkJggg==')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949460-7c132d89-efb7-457f-8810-9bf235f5737f.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949460-7c132d89-efb7-457f-8810-9bf235f5737f.png');\\n\\\r\n} else if (im.src.endsWith('/thunderstorms.png')  || im.src.endsWith('6n+NVQAVQAVQAfwS/QNrOJYuXyjUGAAAAABJRU5ErkJggg==') || im.src.endsWith('DTTcSfRpAO//1L8B/hnAD9B4AcpTDEFdAAAAAElFTkSuQmCC')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949450-7e03a3f5-580e-4414-aaeb-3a0898afd1da.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949450-7e03a3f5-580e-4414-aaeb-3a0898afd1da.png');\\n\\\r\n} else if (im.src.endsWith('/cloudy_s_sunny.png') || im.src.endsWith('gAAQAAJAAAgAASAATqNfCT6dqrbpoPYAAAAASUVORK5CYII=') || im.src.endsWith('VwAEQAAEQAAEQAD+KcA3AodABBLnBp0AAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949462-f50c21dd-85dd-4d9c-a4eb-516e6cddfb1f.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949463-a427edfb-3d7f-4167-bd6f-f5019c482ea1.png');\\n\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script011 = L\"\\\r\n} else if (im.src.endsWith('/partly_cloudy.png')  || im.src.endsWith('AlAACkABKAAFoABOp1+6Bd0LJ+BorgAAAABJRU5ErkJggg==') || im.src.endsWith('UD8fqAJVoApUgSrwqfwCJ6xaZshM+xMAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949465-54dd31c6-7e3a-464a-8e64-8b54b6fb7a65.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949461-1f058cf3-6fdd-4aeb-80b7-68fa27b02845.png');\\n\\\r\n} else if (im.src.endsWith('/sunny_s_rain.png')   || im.src.endsWith('+/JUWP5fQAAIAAEgAA6iPyWP6kEiMYUSAAAAAElFTkSuQmCC') || im.src.endsWith('EphMZLo+8U++KBAFpnwBEAqlYwd30/wAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949443-062a0fa9-88c1-4e07-b6b1-8e52ff64f4f3.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949444-d3aea936-4c22-4f17-a201-02155396684d.png');\\n\\\r\n} else if (im.src.endsWith('/rain_s_sunny.png')   || im.src.endsWith('gAgQASJABIgAESACXpxfGkmKjZKKoRQAAAAASUVORK5CYII=') || im.src.endsWith('S30fyJ+YskAWyAJZIIUf+u496Ifu2YkAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949443-062a0fa9-88c1-4e07-b6b1-8e52ff64f4f3.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949444-d3aea936-4c22-4f17-a201-02155396684d.png');\\n\\\r\n} else if (im.src.endsWith('/fog.png')            || im.src.endsWith('/wsIQAACEIAABCCAb6hfRzSoz4hgnE4AAAAASUVORK5CYII=') || im.src.endsWith('EC30ZRbiv5QMwAAM8PF6AtMRIwMJwimNAAAAAElFTkSuQmCC')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949454-81d5d47d-1f33-4859-a112-5a64ceb549a1.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949454-81d5d47d-1f33-4859-a112-5a64ceb549a1.png');\\n\\\r\n} else if (im.src.endsWith('/snow.png')           || im.src.endsWith('dMq/xgqAAqAAKABW4g+Q1luByt+ugAAAAABJRU5ErkJggg==') || im.src.endsWith('kKRD6Xzx+qvBCyCw/ABgjEYCwIT8wQAAAABJRU5ErkJggg==')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949459-dfe70eba-6c2c-4b1c-b51b-27c13ce7c08c.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949459-dfe70eba-6c2c-4b1c-b51b-27c13ce7c08c.png');\\n\\\r\n} else if (im.src.endsWith('/snow_heavy.png')     || im.src.endsWith('+jJWB6R/m0sAEoAEIBb7BcA+hV/gbM+pAAAAAElFTkSuQmCC') || im.src.endsWith('cUH9DYB6xvNfDZ4GIuMbUY1SYGBaleEAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949456-04a4bdbd-ff3b-4484-bb30-8909baff8aa8.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949456-04a4bdbd-ff3b-4484-bb30-8909baff8aa8.png');\\n\\\r\n} else if (im.src.endsWith('/snow_light.png')     || im.src.endsWith('AP5lhgAEIAABCEAAAnzlBYgKVujL4rwkAAAAAElFTkSuQmCC') || im.src.endsWith('88Tmfn8L1e/EFVABFZA0LkcjEH9Eoxa+AAAAAElFTkSuQmCC')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949459-dfe70eba-6c2c-4b1c-b51b-27c13ce7c08c.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949459-dfe70eba-6c2c-4b1c-b51b-27c13ce7c08c.png');\\n\\\r\n} else if (im.src.endsWith('/snow_s_cloudy.png')  || im.src.endsWith('SwMAAAAAAAAAAAAAAFxEL1Fe7CEOIBaKAAAAAElFTkSuQmCC') || im.src.endsWith('lfcC1L+YKkAFqAAVIFa/mfArO5CvUjAAAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949447-a6658710-567e-4977-9316-a80007df3076.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949448-cd1b69af-4028-4153-8e40-288526577b58.png');\\n\\\r\n} else if (im.src.endsWith('/snow_s_rain.png')    || im.src.endsWith('+Lc4AAAAAAAAAAAA+AGv/oIwYDUGyQAAAABJRU5ErkJggg==') || im.src.endsWith('1/kcsNXU/8gqQAWoAGXpGzmRTGmgvhAvAAAAAElFTkSuQmCC')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156950233-ccaadb4a-2e9a-4934-b41c-acd36a7f0d9c.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156950233-ccaadb4a-2e9a-4934-b41c-acd36a7f0d9c.png');\\n\\\r\n} else if (im.src.endsWith('/cloudy_s_snow.png')  || im.src.endsWith('ASAABIAAEAACQABepj8dv4hCnMCVbgAAAABJRU5ErkJggg==') || im.src.endsWith('EuzIGPqHhgAIgAAIAE1vnG7TKhwgdU4AAAAASUVORK5CYII=')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949447-a6658710-567e-4977-9316-a80007df3076.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949448-cd1b69af-4028-4153-8e40-288526577b58.png');\\n\\\r\n} else if (im.src.endsWith('/rain_s_snow.png')    || im.src.endsWith('ABAAAkAACAABIAAEwIfoF/D2gpORVfhJAAAAAElFTkSuQmCC') || im.src.endsWith('i/HUv5gqQAWoABUgWj/U6dmtXHN0sAAAAABJRU5ErkJggg==')) {\\n\\\r\n    if (is_day) final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949445-60d12efa-a21d-40e0-b9a8-1b7a84e58944.png');\\n\\\r\n    else        final_img = ep_download_image_blob('https://user-images.githubusercontent.com/6503598/156949445-60d12efa-a21d-40e0-b9a8-1b7a84e58944.png');\\n\\\r\n}\\n\\\r\nif (final_img != 0) {\\n\\\r\n    if (im.id != document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0].id) { im.width = 48; im.height = 48; }\\n\\\r\n    im.src = final_img;\\n\\\r\n}\\n\\\r\n}\\n\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script020 = L\"\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script021 = L\"\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script03 = L\"\\\r\nreplaceImage(document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], is_day1);\\n\\\r\nfor (const element of document.getElementsByClassName(\\\"uW5pk\\\")){ replaceImage(element.children[0], 1); }\\n\\\r\nvar observer = new MutationObserver((changes) => {\\n\\\r\n  changes.forEach(change => {\\n\\\r\n      if(change.attributeName.includes('src') && (document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0].src.includes('gstatic.com') || document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0].src.includes('data:image/png;base64,'))){\\n\\\r\n        let includes_time = document.getElementById(\\\"wob_dts\\\").innerText.includes(\\\":\\\");\\n\\\r\n        if (includes_time) {\\n\\\r\n            let sp = document.getElementById(\\\"wob_dts\\\").innerText.split(':');\\n\\\r\n            let hrs = parseInt(sp[0].split(' ')[1]);\\n\\\r\n            let mins = parseInt(sp[1]);\\n\\\r\n            if (is_first_time) { replaceImage(document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], is_day1); is_first_time = 0 }\\n\\\r\n            else replaceImage(document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], IsDay(1, hrs, mins));\\n\\\r\n        } else { replaceImage(document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], 1); }\\n\\\r\n      }\\n\\\r\n  });\\n\\\r\n});\\n\\\r\nobserver.observe(document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], {attributes : true});\\n\\\r\nfunction ep_weather_part0() {\\n\\\r\nreturn \\\"run_part_0\\\";\\n\\\r\n}\\n\\\r\nep_weather_part0();\\n\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script = L\"\\\r\nfunction changeCSSStyle(ssMain, selector, cssProp, cssVal) {\\n\\\r\nvar cssRules = (document.all) ? 'rules': 'cssRules'; \\n\\\r\n//console.log(ssMain);\\n\\\r\n  for (i=0, len=document.styleSheets[ssMain][cssRules].length; i<len; i++)\\n\\\r\n  {\\n\\\r\n    if (document.styleSheets[ssMain][cssRules][i].selectorText === selector) {\\n\\\r\n      document.styleSheets[ssMain][cssRules][i].style[cssProp] = cssVal; \\n\\\r\n//console.log('DA');\\n\\\r\n      return; \\n\\\r\n    }\\n\\\r\n  }\\n\\\r\n}\\n\\\r\nfunction ep_weather_utf8ToHex(str) {\\n\\\r\n  return Array.from(str).map(c => \\n\\\r\n    c.charCodeAt(0) < 128 ? c.charCodeAt(0).toString(16) : \\n\\\r\n    encodeURIComponent(c).replace(/\\\\%%/g,'').toLowerCase()\\n\\\r\n  ).join('');\\n\\\r\n}\\n\\\r\nfunction ep_weather_drawImageToCanvas(image, w, h) {\\n\\\r\n  const canvas = document.createElement('canvas');\\n\\\r\n  canvas.width = w;\\n\\\r\n  canvas.height = h;\\n\\\r\n  canvas.getContext('2d').drawImage(image, 0, 0, w, h);\\n\\\r\n  return canvas;\\n\\\r\n}\\n\\\r\nfunction ep_weather_toHexString (byteArray) {\\n\\\r\n  //const chars = new Buffer(byteArray.length * 2);\\n\\\r\n  const chars = new Uint8Array(byteArray.length * 2);\\n\\\r\n  const alpha = 'a'.charCodeAt(0) - 10;\\n\\\r\n  const digit = '0'.charCodeAt(0);\\n\\\r\n  \\n\\\r\n  let p = 0;\\n\\\r\n  for (let i = 0; i < byteArray.length; i++) {\\n\\\r\n      let nibble = byteArray[i] >>> 4;\\n\\\r\n      chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;\\n\\\r\n      nibble = byteArray[i] & 0xF;\\n\\\r\n      chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;\\n\\\r\n  }\\n\\\r\n  \\n\\\r\n  //return chars.toString('utf8');\\n\\\r\n  return String.fromCharCode.apply(null, chars);\\n\\\r\n}\\n\\\r\nfunction ep_weather_getData(image, w, h, ch) {\\n\\\r\n  const canvas = ep_weather_drawImageToCanvas(image, w, h);\\n\\\r\n  const ctx = canvas.getContext('2d');\\n\\\r\n  \\n\\\r\n  let result = [];\\n\\\r\n  for (let y = 0; y < canvas.height; y++) {\\n\\\r\n    for (let x = 0; x < canvas.width; x++) {\\n\\\r\n      let data = ctx.getImageData(x, y, 1, 1).data;\\n\\\r\n      result.push(data[2] * data[3] / 255);\\n\\\r\n      result.push(data[1] * data[3] / 255);\\n\\\r\n      result.push(data[0] * data[3] / 255);\\n\\\r\n      result.push(data[3]);\\n\\\r\n    }\\n\\\r\n  }\\n\\\r\n  let res = (\\n\\\r\n    document.documentElement.getAttribute(\\\"dir\\\") + \\\"#\\\" + \\n\\\r\n    document.getElementsByClassName(\\\"ULSxyf\\\")[0].offsetHeight + \\\"#\\\" + \\n\\\r\n    document.getElementById(ch.includes('x') ? \\\"wob_ttm\\\" : \\\"wob_tm\\\").innerText + \\\"#\\\" + \\n\\\r\n    Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t').filter(e => !e.style.display.toString().includes(\\\"none\\\"))[0].innerText + \\\"#\\\" + \\n\\\r\n    document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0].alt + \\\"#\\\" + \\n\\\r\n    document.getElementById(\\\"wob_loc\\\").innerText + \\\"#\\\" + \\n\\\r\n    ep_weather_toHexString(result)\\n\\\r\n  );\\n\\\r\n  //console.log(res);\\n\\\r\n  document.body.style.backgroundColor='transparent';\\n\\\r\n  document.body.style.backgroundColor='transparent';\\n\\\r\n  Array.from(document.getElementsByClassName(\\\"Ww4FFb\\\")).forEach((element) => {element.style.backgroundColor = \\\"transparent\\\";});\\n\\\r\n  return res;\\n\\\r\n}\\n\\\r\nvar ep_result;\\n\\\r\nlet unit = Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t')[0].innerText;\\n\\\r\nlet p = '%c';\\n\\\r\nif (!unit.includes(p)) {\\n\\\r\n    Array.from(document.getElementsByClassName('wob-unit')[0].getElementsByTagName('a')).filter(e => e.className == 'wob_t').filter(e => e.innerText.includes(p))[0].click();\\n\\\r\n    unit = 'x';\\n\\\r\n}\\n\\\r\nep_result = ep_weather_getData(\\n\\(final_im != 0) ? final_im : document.getElementsByClassName(\\\"YQ4gaf zr758c\\\")[0], %d, %d, unit);\\n\\\r\nfunction ep_weather_part1() {\\n\\\r\nreturn \\\"run_part_2\\\";\\n\\\r\n}\\n\\\r\nep_weather_part1();\\n\\\r\n\";\r\n\r\nLPCWSTR ep_weather_provider_google_script2 = L\"\\\r\nfunction scrolldisable() {\\n\\\r\nTopScroll = window.pageYOffset || document.documentElement.scrollTop;\\n\\\r\nLeftScroll = window.pageXOffset || document.documentElement.scrollLeft;\\n\\\r\nwindow.onscroll = function() {\\n\\\r\nwindow.scrollTo(LeftScroll, TopScroll);\\n\\\r\n        };\\n\\\r\n}\\n\\\r\nfunction ep_weather_part2() {\\n\\\r\nlet h = document.getElementsByClassName(\\\"ULSxyf\\\")[0].offsetHeight;\\n\\\r\n////document.getElementsByClassName(\\\"google-weather-place\\\")[0].style.height = h + 'px';\\n\\\r\n////document.getElementsByClassName(\\\"google-weather-crop\\\")[0].style.height = h + 'px';\\n\\\r\n//if (1) for (let j = 0; j < document.styleSheets.length; j++) changeCSSStyle(j, '.wob_ds', 'background-color', '#303134');\\n\\\r\ndocument.getElementsByClassName(\\\"KFFQ0c\\\")[0].style.display = 'none';\\n\\\r\nif (document.getElementsByClassName(\\\"QS5gu sy4vM\\\").length > 1) { document.getElementsByClassName(\\\"QS5gu sy4vM\\\")[1].click(); return \\\"run_part_1\\\"; }\\n\\\r\nif (document.getElementsByClassName(\\\"Gfzyee VDgVie DKlyaf Loxgyb\\\").length > 1) { document.getElementsByClassName(\\\"Gfzyee VDgVie DKlyaf Loxgyb\\\")[1].click(); return \\\"run_part_1\\\"; }\\n\\\r\n//document.getElementById(\\\"search\\\").scrollIntoView(true);\\n\\\r\nreturn ep_result;\\n\\\r\n}\\n\\\r\nlet banner1 = document.getElementById(\\\"taw\\\"); if (banner1) { banner1.style = \\\"display: none\\\"; }\\n\\\r\nlet wob_gsp = document.getElementById(\\\"wob_gsp\\\"); if (wob_gsp) { wob_gsp.style = \\\"width: 648.04px\\\"; }\\n\\\r\nlet weird_line = document.getElementsByClassName(\\\"v5jHUb\\\")[0]; if (weird_line) { weird_line.style = \\\"display: none\\\"; }\\n\\\r\nlet slim_appbar = document.getElementById(\\\"slim_appbar\\\"); if (slim_appbar) { slim_appbar.style = \\\"display: none\\\"; }\\n\\\r\nscrolldisable();\\n\\\r\nep_weather_part2();\\n\\\r\n\";\r\n#endif"
  },
  {
    "path": "ep_weather_host/ep_weather_utility.h",
    "content": "#ifndef _H_EP_WEATHER_UTILITY_H_\r\n#define _H_EP_WEATHER_UTILITY_H_\r\n#include <Windows.h>\r\n#include <stdint.h>\r\n#include \"../ExplorerPatcher/queryversion.h\"\r\n#include \"../ExplorerPatcher/osutility.h\"\r\n\r\nextern void(*RefreshImmersiveColorPolicyState)();\r\nextern void(*SetPreferredAppMode)(INT64 bAllowDark);\r\nextern void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);\r\nextern BOOL(*ShouldAppsUseDarkMode)();\r\nextern BOOL(*ShouldSystemUseDarkMode)();\r\n\r\ninline BOOL IsColorSchemeChangeMessage(LPARAM lParam)\r\n{\r\n    BOOL is = FALSE;\r\n    if (lParam && CompareStringOrdinal(lParam, -1, L\"ImmersiveColorSet\", -1, TRUE) == CSTR_EQUAL)\r\n    {\r\n        is = TRUE;\r\n    }\r\n    return is;\r\n}\r\n\r\ninline BOOL IsHighContrast()\r\n{\r\n    HIGHCONTRASTW highContrast;\r\n    ZeroMemory(&highContrast, sizeof(HIGHCONTRASTW));\r\n    highContrast.cbSize = sizeof(highContrast);\r\n    if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))\r\n        return highContrast.dwFlags & HCF_HIGHCONTRASTON;\r\n    return FALSE;\r\n}\r\n#endif"
  },
  {
    "path": "ep_weather_host/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<packages>\r\n  <package id=\"Microsoft.Web.WebView2\" version=\"1.0.3405.78\" targetFramework=\"native\" />\r\n</packages>"
  },
  {
    "path": "ep_weather_host/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\r\n// Microsoft Visual C++ generated include file.\r\n// Used by ep_weather_host.rc\r\n\r\n// Next default values for new objects\r\n// \r\n#ifdef APSTUDIO_INVOKED\r\n#ifndef APSTUDIO_READONLY_SYMBOLS\r\n#define _APS_NEXT_RESOURCE_VALUE        101\r\n#define _APS_NEXT_COMMAND_VALUE         40001\r\n#define _APS_NEXT_CONTROL_VALUE         1001\r\n#define _APS_NEXT_SYMED_VALUE           101\r\n#endif\r\n#endif\r\n"
  },
  {
    "path": "ep_weather_host_stub/ep_weather_host.idl",
    "content": "import \"oaidl.idl\";\r\nimport \"ocidl.idl\";\r\nimport \"unknwn.idl\";\r\n\r\n[\r\n\tobject,\r\n\tuuid(CDBF3734-F847-4F1B-B953-A605434DC1E7),\r\n\toleautomation,\r\n\thelpstring(\"ExplorerPatcher Weather Information\")\r\n] interface IEPWeather : IUnknown\r\n{\r\n\tHRESULT About([in] HWND hWnd);\r\n\r\n\tHRESULT Initialize(\r\n\t\t[in] WCHAR wszName[260], \r\n\t\t[in] BOOL bAllocConsole, \r\n\t\t[in] LONG64 dwProvider, \r\n\t\t[in] LONG64 cbx, \r\n\t\t[in] LONG64 cby, \r\n\t\t[in] LONG64 dwTemperatureUnit, \r\n\t\t[in] LONG64 dwUpdateSchedule, \r\n\t\t[in] RECT rc, \r\n\t\t[in] LONG64 dwDarkMode, \r\n\t\t[in] LONG64 dwGeolocationMode, \r\n\t\t[out] HWND* hWnd,\r\n\t\t[in] LONG64 dwZoomFactor,\r\n\t\t[in] LONG64 dpiXInitial,\r\n\t\t[in] LONG64 dpiYInitial\r\n\t);\r\n\r\n\tHRESULT Show();\r\n\r\n\tHRESULT Hide();\r\n\r\n\tHRESULT GetWindowHandle([out] HWND* phWnd);\r\n\r\n\tHRESULT LockData();\r\n\r\n\tHRESULT GetDataSizes(\r\n\t\t[out] LPDWORD pcbTemperature,\r\n\t\t[out] LPDWORD pcbUnit,\r\n\t\t[out] LPDWORD pcbCondition,\r\n\t\t[out] LPDWORD pcbImage\r\n\t);\r\n\r\n\tHRESULT GetData(\r\n\t\t[in] DWORD cbTemperature,\r\n\t\t[out, size_is(cbTemperature)] BYTE* wszTemperature,\r\n\t\t[in] DWORD cbUnit,\r\n\t\t[ out, size_is(cbUnit)] BYTE* wszUnit,\r\n\t\t[in] DWORD cbCondition,\r\n\t\t[out, size_is(cbCondition)] BYTE* wszCondition,\r\n\t\t[in] DWORD cbImage,\r\n\t\t[out, size_is(cbImage)] BYTE* pImage\r\n\t);\r\n\r\n\tHRESULT UnlockData();\r\n\r\n\tHRESULT SetNotifyWindow([in] HWND hWndNotify);\r\n\r\n\tHRESULT IsInitialized([out] BOOL* bIsInitialized);\r\n\r\n\tHRESULT GetTitle([in] DWORD cbTitle, [out, size_is(cbTitle)] BYTE* wszTitle, [in] DWORD dwType);\r\n\r\n\tHRESULT SetTemperatureUnit([in] LONG64 dwTemperatureUnit);\r\n\r\n\tHRESULT SetTerm([in] DWORD cbTerm, [in, size_is(cbTerm)] BYTE* wszTerm);\r\n\r\n\tHRESULT SetLanguage([in] DWORD cblanguage, [in, size_is(cblanguage)] BYTE* wszLanguage);\r\n\r\n\tHRESULT SetUpdateSchedule([in] LONG64 dwUpdateSchedule);\r\n\r\n\tHRESULT SetIconSize([in] LONG64 cbx, [in] LONG64 cby);\r\n\r\n\tHRESULT GetIconSize([out] LONG64* cbx, [out] LONG64* cby);\r\n\r\n\tHRESULT SetDarkMode([in] LONG64 dwDarkMode, [in] LONG64 bRefresh);\r\n\r\n\tHRESULT SetGeolocationMode([in] LONG64 dwGeolocationMode);\r\n\r\n\tHRESULT SetWindowCornerPreference([in] LONG64 dwWindowCornerPreference);\r\n\r\n\tHRESULT SetDevMode([in] LONG64 dwDevMode, [in] LONG64 bRefresh);\r\n\r\n\tHRESULT SetIconPack([in] LONG64 dwIconPack, [in] LONG64 bRefresh);\r\n\r\n\tHRESULT SetZoomFactor([in] LONG64 dwZoomFactor);\r\n\r\n\tHRESULT GetLastUpdateTime([out] LPSYSTEMTIME lpLastUpdateTime);\r\n};"
  },
  {
    "path": "ep_weather_host_stub/ep_weather_host_stub.def",
    "content": "LIBRARY        ep_weather_host_stub.dll\r\nDESCRIPTION    'ExplorerPatcher Weather Stub DLL'\r\nEXPORTS        DllGetClassObject      @1 PRIVATE\r\n               DllCanUnloadNow        @2 PRIVATE\r\n               DllRegisterServer      @4 PRIVATE\r\n               DllUnregisterServer    @5 PRIVATE"
  },
  {
    "path": "ep_weather_host_stub/ep_weather_host_stub.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|ARM64EC\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|ARM64EC\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>ARM64EC</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <ProjectGuid>{af02abac-eaeb-471c-9957-73d430b8b4de}</ProjectGuid>\r\n    <RootNamespace>epweatherhoststub</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n    <WithArm64XBinaries>false</WithArm64XBinaries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n    <BuildAsX>$(WithArm64XBinaries)</BuildAsX>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <OutDir>$(SolutionDir)\\build\\$(Configuration)\\$(Platform)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|ARM64EC'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|ARM64EC'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Console</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n      <ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Midl Include=\"ep_weather_host.idl\">\r\n      <OutputDirectory>$(IntDir)</OutputDirectory>\r\n    </Midl>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"$(IntDir)\\dlldata.c\">\r\n      <PreprocessorDefinitions>REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n    <ClCompile Include=\"$(IntDir)\\ep_weather_host_i.c\" />\r\n    <ClCompile Include=\"$(IntDir)\\ep_weather_host_p.c\">\r\n      <PreprocessorDefinitions>REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"ep_weather_host_h.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"ep_weather_host_stub.def\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ep_weather_host_stub/ep_weather_host_stub.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Midl Include=\"ep_weather_host.idl\">\r\n      <Filter>Source Files</Filter>\r\n    </Midl>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"dlldata.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ep_weather_host_i.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ep_weather_host_p.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"ep_weather_host_h.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"ep_weather_host_stub.def\">\r\n      <Filter>Source Files</Filter>\r\n    </None>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "version.h",
    "content": "#define VER_MAJOR 26100\r\n#define VER_MINOR 4946\r\n#define VER_BUILD_HI    69\r\n#define VER_BUILD_LO 6\r\n#define VER_FLAGS   VS_FF_PRERELEASE\r\n\r\n\r\n// The Binary form of the version numbers\r\n#define VER_FILE    VER_MAJOR, VER_MINOR, VER_BUILD_HI, VER_BUILD_LO\r\n#define VER_PRODUCT VER_MAJOR, VER_MINOR, VER_BUILD_HI, VER_BUILD_LO\r\n\r\n#define VER_STR(arg) #arg\r\n\r\n#define STRINGIFYVER2(X)      #X\r\n#define STRINGIFYVER(X)       STRINGIFYVER2(X)\r\n#define VER_WITH_DOTS STRINGIFYVER(VER_MAJOR) \".\" STRINGIFYVER(VER_MINOR) \".\" STRINGIFYVER(VER_BUILD_HI) \".\" STRINGIFYVER(VER_BUILD_LO)\r\n\r\n// The String form of the version numbers\r\n#define VER_FILE_STRING VALUE \"FileVersion\", VER_WITH_DOTS\r\n#define VER_PRODUCT_STRING VALUE \"ProductVersion\", VER_WITH_DOTS\r\n"
  }
]