1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-27 17:00:59 +01:00
ExplorerPatcher/README.md
Valentin Radu aca00768a2 Offsets are now determined at runtime
* 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
* 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
* Please have an unmetered active working Internet connection when
  running for the first time
* 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
* Disabled the pre/post build command that restarted sihost.exe in
  Debug builds
2021-08-29 21:03:37 +03:00

5.2 KiB

Explorer Patcher

Explorer Patcher is a patcher that enables various stuff in Explorer. For the moment, it includes the following:

  • allows using the old taskbar in Windows 11 without the side effects of UndockingDisabled and with fully working search, modern apps showing properly, screen snip still working etc
  • enables the power user menu (Win+X) when using the classic taskbar in Windows 11
  • shows the Start menu on the monitor containing the cursor when invoked with the Windows key

This has been tested only on Windows 11 build 22000.1. It probably does not work on other builds due to different offsets in explorer.exe and its libraries. Once this matures, a solution will be offered for dynamically determining the necessary offsets. As it stands, the application is more in a proof of concept phase. It should work on higher builds, provided that the OS components' structure has not changed too drastically. The library is able to automatically download symbols and determine the offsets for correctly hooking the functions.

A detailed description of how this works is available on my web site here.

Precompiled binaries are available in Releases.

Installation

To install, save the executable in a safe directory, run it once as an administrator to have it register as Taskman for Explorer and just restart Explorer or reboot.

The application does not currently offer a way to configure its behavior. In the mean time, I recommend commenting out whatever you do not like and compile your own executable, as described below (instructions are very simple).

License

Hooking is done using the excellent funchook library (GPLv2 with linking exception), which in turn is powered by the diStorm3 (3-clause BSD) disassembler. Thus, I am offering this under GNU General Public License Version 2.0, which I believe is compatible.

Compiling

The following prerequisites are necessary in order to compile this project:

  • Microsoft C/C++ Optimizing Compiler - this can be obtained by installing either of these packages:

    • Visual Studio - this is a fully featured IDE; you'll need to check "C/C++ application development role" when installing. If you do not require the full suite, use the package bellow.
    • Build Tools for Visual Studio - this just installs the compiler, which you'll be able to use from the command line, or from other applications like CMake

    Download either of those here. The guide assumes you have installed either Visual Studio 2019, either Build Tools for Visual Studio 2019.

  • A recent version of the Windows SDK - for development, version 10.0.19041.0 was used, available here (this may also be offered as an option when installing Visual Studio)

  • CMake - for easier usage, make sure to have it added to PATH during installation

  • Git - you can use Git for Windows, or git command via the Windows Subsystem for Linux.

Steps:

  1. Clone git repo along with all submodules

    git clone --recursive https://github.com/valinet/ExplorerPatcher
    

    If "git" is not found as a command, type its full path, or have its folder added to PATH, or open Git command window in the respective folder if using Git for Windows.

  2. Compile funchook

    cd libs
    cd funchook
    md build
    cd build
    cmake -G "Visual Studio 16 2019" -A x64 ..
    

    If "cmake" is not found as a command, type its full path, or have its folder added to PATH.

    Type "Win32" instead of "x64" above, if compiling for x86. The command above works for x64.

    Now, in the libs\funchook\build folder, open the file funchook-static.vcxproj with any text editor, search and replace all occurences of <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> with <RuntimeLibrary>MultiThreaded</RuntimeLibrary>.

    Once done, you can now compile funchook:

    cmake --build . --config Release
    
  3. Compile ExplorerPatcher

    • Double click the ExplorerPatcher.sln to open the solution in Visual Studio. Choose Release and your processor architecture in the toolbar. Press F6 to compile.

    • Open an "x86 Native Tools Command Prompt for VS 2019" (for x86), or "x64 Native Tools Command Prompt for VS 2019" (for x64) (search that in Start), go to folder containing solution file and type:

      • For x86:

        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=x86
        
      • For x64:

        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=x64
        

    The resulting exe and dll will be in "Release" folder (if you chose x86), or "x64\Release" (if you chose x64) in the folder containing the solution file.

That's it. later, if you want to recompile, make sure to update the repository and the submodules first:

git pull
git submodule update --init --recursive