Browse Source

Enables compatibility with ArchiveMenu.

pull/20/head 22000.168.0.7
Valentin Radu 4 years ago
parent
commit
b666d834e0
  1. 4
      CHANGELOG.md
  2. 8
      ExplorerPatcher/ExplorerPatcher.rc
  3. 8
      ExplorerPatcherLibrary/ExplorerPatcherLibrary.rc
  4. 293
      ExplorerPatcherLibrary/dllmain.c
  5. 4
      PostBuildCommand/PostBuildCommand.vcxproj
  6. 4
      PreBuildCommand/PreBuildCommand.vcxproj
  7. 2
      README.md

4
CHANGELOG.md

@ -2,6 +2,10 @@
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub. This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
## 22000.168.0.7
Enables compatibility with [ArchiveMenu](https://github.com/valinet/archivemenu).
## 22000.168.0.6 ## 22000.168.0.6
Fixes [#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). Fixes [#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).

8
ExplorerPatcher/ExplorerPatcher.rc

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,168,0,6 FILEVERSION 22000,168,0,7
PRODUCTVERSION 22000,168,0,6 PRODUCTVERSION 22000,168,0,7
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "VALINET Solutions SRL" VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher Daemon" VALUE "FileDescription", "ExplorerPatcher Daemon"
VALUE "FileVersion", "22000.168.0.6" VALUE "FileVersion", "22000.168.0.7"
VALUE "InternalName", "ExplorerPatcher.exe" VALUE "InternalName", "ExplorerPatcher.exe"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved." VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcher.exe" VALUE "OriginalFilename", "ExplorerPatcher.exe"
VALUE "ProductName", "ExplorerPatcher" VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "22000.168.0.6" VALUE "ProductVersion", "22000.168.0.7"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

8
ExplorerPatcherLibrary/ExplorerPatcherLibrary.rc

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,168,0,6 FILEVERSION 22000,168,0,7
PRODUCTVERSION 22000,168,0,6 PRODUCTVERSION 22000,168,0,7
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "VALINET Solutions SRL" VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher Library" VALUE "FileDescription", "ExplorerPatcher Library"
VALUE "FileVersion", "22000.168.0.6" VALUE "FileVersion", "22000.168.0.7"
VALUE "InternalName", "ExplorerPatcherLibrary.dll" VALUE "InternalName", "ExplorerPatcherLibrary.dll"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved." VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcherLibrary.dll" VALUE "OriginalFilename", "ExplorerPatcherLibrary.dll"
VALUE "ProductName", "WinOverview" VALUE "ProductName", "WinOverview"
VALUE "ProductVersion", "22000.168.0.6" VALUE "ProductVersion", "22000.168.0.7"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

293
ExplorerPatcherLibrary/dllmain.c

@ -13,6 +13,21 @@
#include <valinet/pdb/pdb.h> #include <valinet/pdb/pdb.h>
#define _LIBVALINET_INCLUDE_UNIVERSAL #define _LIBVALINET_INCLUDE_UNIVERSAL
#include <valinet/universal/toast/toast.h> #include <valinet/universal/toast/toast.h>
#include <Shlobj_core.h>
DEFINE_GUID(__uuidof_TaskbarList,
0x56FDF344,
0xFD6D, 0x11d0, 0x95, 0x8A,
0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90
);
DEFINE_GUID(__uuidof_ITaskbarList,
0x56FDF342,
0xFD6D, 0x11d0, 0x95, 0x8A,
0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90
);
#define OPEN_NAME L"&Open archive"
#define EXTRACT_NAME L"&Extract to \"%s\\\""
#define OPEN_CMD L"\"C:\\Program Files\\7-Zip\\7zFM.exe\" %s"
#define EXTRACT_CMD L"\"C:\\Program Files\\7-Zip\\7zG.exe\" x -o\"%s\" -spe %s"
#define APPID L"Microsoft.Windows.Explorer" #define APPID L"Microsoft.Windows.Explorer"
#define SYMBOLS_RELATIVE_PATH "\\settings.ini" #define SYMBOLS_RELATIVE_PATH "\\settings.ini"
@ -88,6 +103,8 @@ L"</toast>\r\n";
#define DEBUG #define DEBUG
#undef DEBUG #undef DEBUG
HWND archivehWnd;
funchook_t* funchook = NULL; funchook_t* funchook = NULL;
HMODULE hModule = NULL; HMODULE hModule = NULL;
HWND messageWindow = NULL; HWND messageWindow = NULL;
@ -362,6 +379,103 @@ LRESULT CALLBACK CLauncherTipContextMenu_WndProc(
{ {
LRESULT result; LRESULT result;
if (uMsg == WM_COPYDATA && hWnd == archivehWnd)
{
COPYDATASTRUCT* st = lParam;
HWND srcWnd = wParam;
POINT pt;
GetCursorPos(&pt);
SetForegroundWindow(hWnd);
HMENU hMenu = CreatePopupMenu();
TCHAR buffer[MAX_PATH + 100];
TCHAR filename[MAX_PATH];
ZeroMemory(filename, MAX_PATH * sizeof(TCHAR));
memcpy(filename, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));
PathUnquoteSpacesW(filename);
PathRemoveExtensionW(filename);
PathStripPathW(filename);
wsprintf(buffer, EXTRACT_NAME, filename);
InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, 1, buffer);
InsertMenu(hMenu, 0, MF_BYPOSITION | MF_STRING, 2, OPEN_NAME);
INT64* unknown_array = calloc(4, sizeof(INT64));
ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(
hMenu,
hWnd,
&(pt),
0xc,
unknown_array
);
BOOL res = TrackPopupMenu(
hMenu,
TPM_RETURNCMD,
pt.x - 15,
pt.y - 15,
0,
hWnd,
0
);
ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(
hMenu,
hWnd,
&(pt)
);
free(unknown_array);
if (res == 1 || res == 2)
{
ZeroMemory(buffer, (MAX_PATH + 100) * sizeof(TCHAR));
if (res == 2)
{
wsprintf(buffer, OPEN_CMD, st->lpData);
//wprintf(L"%s\n%s\n\n", st->lpData, buffer);
}
else if (res == 1)
{
TCHAR path[MAX_PATH], path_orig[MAX_PATH];
ZeroMemory(path, MAX_PATH * sizeof(TCHAR));
ZeroMemory(path_orig, MAX_PATH * sizeof(TCHAR));
memcpy(path, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));
memcpy(path_orig, st->lpData, wcslen(st->lpData) * sizeof(TCHAR));
PathUnquoteSpacesW(path_orig);
PathRemoveExtensionW(path_orig);
wsprintf(buffer, EXTRACT_CMD, path_orig, path);
//wprintf(L"%s\n%s\n\n", st->lpData, buffer);
}
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
BOOL b = CreateProcess(
NULL,
buffer,
NULL,
NULL,
TRUE,
CREATE_UNICODE_ENVIRONMENT,
NULL,
NULL,
&si,
&pi
);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
DestroyMenu(hMenu);
ShowWindow(hWnd, SW_HIDE);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
if (uMsg == WM_CLOSE && hWnd == archivehWnd)
{
return 0;
}
if (uMsg == WM_NCCREATE) if (uMsg == WM_NCCREATE)
{ {
CREATESTRUCT* pCs = lParam; CREATESTRUCT* pCs = lParam;
@ -382,35 +496,41 @@ LRESULT CALLBACK CLauncherTipContextMenu_WndProc(
} }
else else
{ {
result = 0; result = DefWindowProc(
hWnd,
uMsg,
wParam,
lParam
);
//result = 0;
} }
} }
else else
{ {
void* _this = GetWindowLongPtr(hWnd, GWLP_USERDATA); void* _this = GetWindowLongPtr(hWnd, GWLP_USERDATA);
BOOL v12 = FALSE;
if ((uMsg == WM_DRAWITEM || uMsg == WM_MEASUREITEM) &&
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc(
hWnd,
uMsg,
wParam,
lParam,
&v12
))
{
result = 0;
}
else
{
result = DefWindowProc(
hWnd,
uMsg,
wParam,
lParam
);
}
if (_this) if (_this)
{ {
BOOL v12 = FALSE;
if ((uMsg == WM_DRAWITEM || uMsg == WM_MEASUREITEM) &&
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc(
hWnd,
uMsg,
wParam,
lParam,
&v12
))
{
result = 0;
}
else
{
result = DefWindowProc(
hWnd,
uMsg,
wParam,
lParam
);
}
if (uMsg == WM_NCDESTROY) if (uMsg == WM_NCDESTROY)
{ {
SetWindowLongPtrW( SetWindowLongPtrW(
@ -421,15 +541,6 @@ LRESULT CALLBACK CLauncherTipContextMenu_WndProc(
*((HWND*)((char*)_this + 0x78)) = 0; *((HWND*)((char*)_this + 0x78)) = 0;
} }
} }
else
{
result = DefWindowProc(
hWnd,
uMsg,
wParam,
lParam
);
}
} }
return result; return result;
} }
@ -902,6 +1013,81 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
return CallNextHookEx(NULL, code, wParam, lParam); return CallNextHookEx(NULL, code, wParam, lParam);
} }
DWORD ArchiveMenuThread(LPVOID unused)
{
Sleep(1000);
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
return 0;
}
WNDCLASS wc = { 0 };
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = CLauncherTipContextMenu_WndProc;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = L"ArchiveMenuWindowExplorer";
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
RegisterClass(&wc);
archivehWnd = CreateWindowInBand(
0,
L"ArchiveMenuWindowExplorer",
0,
WS_POPUP,
0,
0,
0,
0,
0,
0,
GetModuleHandle(NULL),
NULL,
7
);
if (!archivehWnd)
{
return 0;
}
ITaskbarList* pTaskList = NULL;
hr = CoCreateInstance(
&__uuidof_TaskbarList,
NULL,
CLSCTX_ALL,
&__uuidof_ITaskbarList,
(void**)(&pTaskList)
);
if (FAILED(hr))
{
return 0;
}
hr = pTaskList->lpVtbl->HrInit(pTaskList);
if (FAILED(hr))
{
return 0;
}
ShowWindow(archivehWnd, SW_SHOW);
hr = pTaskList->lpVtbl->DeleteTab(pTaskList, archivehWnd);
if (FAILED(hr))
{
return 0;
}
hr = pTaskList->lpVtbl->Release(pTaskList);
if (FAILED(hr))
{
return 0;
}
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
DWORD OpenStartOnCurentMonitorThread(LPVOID unused) DWORD OpenStartOnCurentMonitorThread(LPVOID unused)
{ {
HWND g_ProgWin = FindWindowEx( HWND g_ProgWin = FindWindowEx(
@ -962,16 +1148,6 @@ __declspec(dllexport) DWORD WINAPI main(
CreateThread(
0,
0,
OpenStartOnCurentMonitorThread,
0,
0,
0
);
DWORD dwRet = 0; DWORD dwRet = 0;
char szSettingsPath[MAX_PATH]; char szSettingsPath[MAX_PATH];
@ -1003,6 +1179,41 @@ __declspec(dllexport) DWORD WINAPI main(
MAX_PATH MAX_PATH
); );
UINT archive_plugin = VnGetUInt(
L"ArchiveMenu",
L"Enabled",
0,
wszSettingsPath
);
if (archive_plugin)
{
CreateThread(
0,
0,
ArchiveMenuThread,
0,
0,
0
);
}
CreateThread(
0,
0,
OpenStartOnCurentMonitorThread,
0,
0,
0
);
symbols_addr symbols_PTRS; symbols_addr symbols_PTRS;
ZeroMemory( ZeroMemory(
&symbols_PTRS, &symbols_PTRS,

4
PostBuildCommand/PostBuildCommand.vcxproj

@ -63,10 +63,10 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakeBuildCommandLine>rem taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine> <NMakeBuildCommandLine>taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine>
<NMakeOutput>PostBuildCommand.exe</NMakeOutput> <NMakeOutput>PostBuildCommand.exe</NMakeOutput>
<NMakePreprocessorDefinitions>NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> <NMakePreprocessorDefinitions>NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeReBuildCommandLine>rem taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeReBuildCommandLine> <NMakeReBuildCommandLine>taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeReBuildCommandLine>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeBuildCommandLine>rem taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine> <NMakeBuildCommandLine>rem taskkill /f /im:sihost.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine>

4
PreBuildCommand/PreBuildCommand.vcxproj

@ -63,10 +63,10 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<NMakeBuildCommandLine>rem taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine> <NMakeBuildCommandLine>taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine>
<NMakeOutput>PreBuildCommand.exe</NMakeOutput> <NMakeOutput>PreBuildCommand.exe</NMakeOutput>
<NMakePreprocessorDefinitions>NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> <NMakePreprocessorDefinitions>NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeReBuildCommandLine>rem taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeReBuildCommandLine> <NMakeReBuildCommandLine>taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeReBuildCommandLine>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeBuildCommandLine>rem taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine> <NMakeBuildCommandLine>rem taskkill /f /im:explorer.exe 2&gt;nul &amp;set errorlevel=0</NMakeBuildCommandLine>

2
README.md

@ -5,7 +5,7 @@ Explorer Patcher is a patcher that enables various stuff in Explorer. For the mo
* enables the power user menu (Win+X) when using the classic taskbar in Windows 11 * 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 * shows the Start menu on the monitor containing the cursor when invoked with the Windows key
This heas been tested on the following builds: This has been tested on the following builds:
* 22000.1 - works as advertised, tested with `Start_ShowClassicMode` which shows the Windows 10 Start menu; taskbar works, Win+X works and is skinned, WiFi flyout works, battery flyout works, no delay at logon * 22000.1 - works as advertised, tested with `Start_ShowClassicMode` which shows the Windows 10 Start menu; taskbar works, Win+X works and is skinned, WiFi flyout works, battery flyout works, no delay at logon
* 22000.168 - works as advertised, Start button opens Windows 11 Start menu (a half broken Windows 10 menu can be restored by copying `StartMenuExperienceHost.exe` and its DLLs from 22000.1); taskbar works, Win+X works and is skinned, WiFi flyout DOES NOT work (use control center aka gear icon or [enable Windows 8 network flyout](https://winaero.com/change-network-icon-click-action-in-windows-10/?utm_source=software&utm_medium=in-app&utm_campaign=winaerotweaker&utm_content=networkflyout) instead, battery flyout DOES NOT work (use [Battery Mode](https://en.bmode.tarcode.ru/) utility), control center icon works, no delay at logon (!!!) * 22000.168 - works as advertised, Start button opens Windows 11 Start menu (a half broken Windows 10 menu can be restored by copying `StartMenuExperienceHost.exe` and its DLLs from 22000.1); taskbar works, Win+X works and is skinned, WiFi flyout DOES NOT work (use control center aka gear icon or [enable Windows 8 network flyout](https://winaero.com/change-network-icon-click-action-in-windows-10/?utm_source=software&utm_medium=in-app&utm_campaign=winaerotweaker&utm_content=networkflyout) instead, battery flyout DOES NOT work (use [Battery Mode](https://en.bmode.tarcode.ru/) utility), control center icon works, no delay at logon (!!!)

Loading…
Cancel
Save