From 93a7f5c0d72e414225805ff6a4daa7c16f80fca5 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Sat, 20 Nov 2021 13:07:58 +0200 Subject: [PATCH] Provides a simple mechanism for chainloading a custom library when the shell interface is created --- CHANGELOG.md | 1 + ExplorerPatcher/dllmain.c | 29 +++++++++++++++++++++++++++++ version.h | 6 +++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad32361..2e3cc25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * Implemented option to toggle taskbar auto-hide when double clicking the main taskbar (#389) (.3) * 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) * 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) +* 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) #### Feature enhancements diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 24795f2..6ab9680 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -5594,6 +5594,35 @@ DWORD Inject(BOOL bIsExplorer) CreateThread(NULL, 0, CheckForUpdatesThread, 0, 0, NULL); + + WCHAR wszExtraLibPath[MAX_PATH]; + if (GetWindowsDirectoryW(wszExtraLibPath, MAX_PATH)) + { + wcscat_s(wszExtraLibPath, MAX_PATH, L"\\ep_extra.dll"); + if (FileExistsW(wszExtraLibPath)) + { + HMODULE hExtra = LoadLibraryW(wszExtraLibPath); + if (hExtra) + { + + printf("[Extra] Found library: %p.\n", hExtra); + FARPROC ep_extra_entrypoint = GetProcAddress(hExtra, "ep_extra_EntryPoint"); + if (ep_extra_entrypoint) + { + printf("[Extra] Running entry point...\n"); + ep_extra_entrypoint(); + printf("[Extra] Finished running entry point.\n"); + } + } + else + { + printf("[Extra] LoadLibraryW failed with 0x%x.", GetLastError()); + } + } + } + + + /*if (bHookStartMenu) { HookStartMenuParams* params2 = calloc(1, sizeof(HookStartMenuParams)); diff --git a/version.h b/version.h index 89bcec5..99ffac9 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 318 #define VER_BUILD_HI 38 -#define VER_BUILD_LO 5 +#define VER_BUILD_LO 6 #define VER_FLAGS VS_FF_PRERELEASE @@ -12,5 +12,5 @@ #define VER_STR(arg) #arg // The String form of the version numbers -#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.5" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.5" +#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.6" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.6"