mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-28 01:10:55 +01:00
Skinned "Safe to Remove Hardware" popup menu
* The 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.
This commit is contained in:
parent
bd95a51ab3
commit
4e670f703b
@ -51,8 +51,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 22000,168,0,7
|
FILEVERSION 22000,168,0,8
|
||||||
PRODUCTVERSION 22000,168,0,7
|
PRODUCTVERSION 22000,168,0,8
|
||||||
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.7"
|
VALUE "FileVersion", "22000.168.0.8"
|
||||||
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.7"
|
VALUE "ProductVersion", "22000.168.0.8"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@ -51,8 +51,8 @@ END
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 22000,168,0,7
|
FILEVERSION 22000,168,0,8
|
||||||
PRODUCTVERSION 22000,168,0,7
|
PRODUCTVERSION 22000,168,0,8
|
||||||
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.7"
|
VALUE "FileVersion", "22000.168.0.8"
|
||||||
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.7"
|
VALUE "ProductVersion", "22000.168.0.8"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@ -60,6 +60,10 @@ DEFINE_GUID(__uuidof_IAuthUILogonSound,
|
|||||||
#define TWINUI_SB_1 "IsDesktopInputContext"
|
#define TWINUI_SB_1 "IsDesktopInputContext"
|
||||||
#define TWINUI_SB_2 "CImmersiveHotkeyNotification::OnMessage"
|
#define TWINUI_SB_2 "CImmersiveHotkeyNotification::OnMessage"
|
||||||
#define TWINUI_SB_CNT 3
|
#define TWINUI_SB_CNT 3
|
||||||
|
#define STOBJECT_SB_NAME "stobject"
|
||||||
|
#define STOBJECT_SB_0 "SysTrayWndProc"
|
||||||
|
#define STOBJECT_SB_1 "HotPlugButtonClick"
|
||||||
|
#define STOBJECT_SB_CNT 2
|
||||||
const char* explorer_SN[EXPLORER_SB_CNT] = {
|
const char* explorer_SN[EXPLORER_SB_CNT] = {
|
||||||
EXPLORER_SB_0,
|
EXPLORER_SB_0,
|
||||||
EXPLORER_SB_1,
|
EXPLORER_SB_1,
|
||||||
@ -79,12 +83,17 @@ const char* twinui_SN[TWINUI_SB_CNT] = {
|
|||||||
TWINUI_SB_1,
|
TWINUI_SB_1,
|
||||||
TWINUI_SB_2
|
TWINUI_SB_2
|
||||||
};
|
};
|
||||||
|
const char* stobject_SN[STOBJECT_SB_CNT] = {
|
||||||
|
STOBJECT_SB_0,
|
||||||
|
STOBJECT_SB_1
|
||||||
|
};
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct symbols_addr
|
typedef struct symbols_addr
|
||||||
{
|
{
|
||||||
DWORD explorer_PTRS[EXPLORER_SB_CNT];
|
DWORD explorer_PTRS[EXPLORER_SB_CNT];
|
||||||
DWORD twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT];
|
DWORD twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT];
|
||||||
DWORD twinui_PTRS[TWINUI_SB_CNT];
|
DWORD twinui_PTRS[TWINUI_SB_CNT];
|
||||||
|
DWORD stobject_PTRS[STOBJECT_SB_CNT];
|
||||||
} symbols_addr;
|
} symbols_addr;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
@ -261,6 +270,24 @@ static BOOL(*IsDesktopInputContextFunc)(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static INT64(*SysTrayWndProcFunc)(
|
||||||
|
_In_ HWND hWnd,
|
||||||
|
_In_ UINT uMsg,
|
||||||
|
_In_ WPARAM wParam,
|
||||||
|
_In_ LPARAM lParam
|
||||||
|
);
|
||||||
|
|
||||||
|
static BOOL(*TrackPopupMenuFunc)(
|
||||||
|
HMENU hMenu,
|
||||||
|
UINT uFlags,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int nReserved,
|
||||||
|
HWND hWnd,
|
||||||
|
const RECT* prcRect
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_ImmersiveShell,
|
DEFINE_GUID(CLSID_ImmersiveShell,
|
||||||
@ -607,6 +634,87 @@ LRESULT CALLBACK CLauncherTipContextMenu_WndProc(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWND lastSysTrayhWnd;
|
||||||
|
|
||||||
|
BOOL TrackPopupMenuHook(
|
||||||
|
HMENU hMenu,
|
||||||
|
UINT uFlags,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int nReserved,
|
||||||
|
HWND hWnd,
|
||||||
|
const RECT* prcRect
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (hWnd != lastSysTrayhWnd)
|
||||||
|
{
|
||||||
|
return TrackPopupMenuFunc(
|
||||||
|
hMenu,
|
||||||
|
uFlags,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
nReserved,
|
||||||
|
hWnd,
|
||||||
|
prcRect
|
||||||
|
);
|
||||||
|
}
|
||||||
|
INT64* unknown_array = calloc(4, sizeof(INT64));
|
||||||
|
POINT pt;
|
||||||
|
pt.x = x;
|
||||||
|
pt.y = y;
|
||||||
|
ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc(
|
||||||
|
hMenu,
|
||||||
|
hWnd,
|
||||||
|
&(pt),
|
||||||
|
0xc,
|
||||||
|
unknown_array
|
||||||
|
);
|
||||||
|
BOOL b = TrackPopupMenuFunc(
|
||||||
|
hMenu,
|
||||||
|
uFlags,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
nReserved,
|
||||||
|
hWnd,
|
||||||
|
prcRect
|
||||||
|
);
|
||||||
|
ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc(
|
||||||
|
hMenu,
|
||||||
|
hWnd,
|
||||||
|
&(pt)
|
||||||
|
);
|
||||||
|
free(unknown_array);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT64 SysTrayWndProcHook(
|
||||||
|
_In_ HWND hWnd,
|
||||||
|
_In_ UINT uMsg,
|
||||||
|
_In_ WPARAM wParam,
|
||||||
|
_In_ LPARAM lParam
|
||||||
|
)
|
||||||
|
{
|
||||||
|
lastSysTrayhWnd = hWnd;
|
||||||
|
BOOL v12 = FALSE;
|
||||||
|
if ((uMsg == WM_DRAWITEM || uMsg == WM_MEASUREITEM) &&
|
||||||
|
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc(
|
||||||
|
hWnd,
|
||||||
|
uMsg,
|
||||||
|
wParam,
|
||||||
|
lParam,
|
||||||
|
&v12
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return SysTrayWndProcFunc(
|
||||||
|
hWnd,
|
||||||
|
uMsg,
|
||||||
|
wParam,
|
||||||
|
lParam
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void* _this;
|
void* _this;
|
||||||
@ -1439,6 +1547,19 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
wszSettingsPath
|
wszSettingsPath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
symbols_PTRS.stobject_PTRS[0] = VnGetUInt(
|
||||||
|
TEXT(STOBJECT_SB_NAME),
|
||||||
|
TEXT(STOBJECT_SB_0),
|
||||||
|
0,
|
||||||
|
wszSettingsPath
|
||||||
|
);
|
||||||
|
symbols_PTRS.stobject_PTRS[1] = VnGetUInt(
|
||||||
|
TEXT(STOBJECT_SB_NAME),
|
||||||
|
TEXT(STOBJECT_SB_1),
|
||||||
|
0,
|
||||||
|
wszSettingsPath
|
||||||
|
);
|
||||||
|
|
||||||
BOOL bNeedToDownload = FALSE;
|
BOOL bNeedToDownload = FALSE;
|
||||||
for (UINT i = 0; i < sizeof(symbols_addr) / sizeof(DWORD); ++i)
|
for (UINT i = 0; i < sizeof(symbols_addr) / sizeof(DWORD); ++i)
|
||||||
{
|
{
|
||||||
@ -1577,6 +1698,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
MAX_PATH,
|
MAX_PATH,
|
||||||
".exe"
|
".exe"
|
||||||
);
|
);
|
||||||
|
printf("Downloading symbols for %s.\n", explorer_sb_exe);
|
||||||
if (VnDownloadSymbols(
|
if (VnDownloadSymbols(
|
||||||
NULL,
|
NULL,
|
||||||
explorer_sb_exe,
|
explorer_sb_exe,
|
||||||
@ -1590,6 +1712,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
);
|
);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
printf("Reading symbols.\n");
|
||||||
if (VnGetSymbols(
|
if (VnGetSymbols(
|
||||||
szSettingsPath,
|
szSettingsPath,
|
||||||
symbols_PTRS.explorer_PTRS,
|
symbols_PTRS.explorer_PTRS,
|
||||||
@ -1646,6 +1769,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
MAX_PATH,
|
MAX_PATH,
|
||||||
".dll"
|
".dll"
|
||||||
);
|
);
|
||||||
|
printf("Downloading symbols for %s.\n", twinui_pcshell_sb_dll);
|
||||||
if (VnDownloadSymbols(
|
if (VnDownloadSymbols(
|
||||||
NULL,
|
NULL,
|
||||||
twinui_pcshell_sb_dll,
|
twinui_pcshell_sb_dll,
|
||||||
@ -1659,6 +1783,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
);
|
);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
printf("Reading symbols.\n");
|
||||||
if (VnGetSymbols(
|
if (VnGetSymbols(
|
||||||
szSettingsPath,
|
szSettingsPath,
|
||||||
symbols_PTRS.twinui_pcshell_PTRS,
|
symbols_PTRS.twinui_pcshell_PTRS,
|
||||||
@ -1739,6 +1864,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
MAX_PATH,
|
MAX_PATH,
|
||||||
".dll"
|
".dll"
|
||||||
);
|
);
|
||||||
|
printf("Downloading symbols for %s.\n", twinui_sb_dll);
|
||||||
if (VnDownloadSymbols(
|
if (VnDownloadSymbols(
|
||||||
NULL,
|
NULL,
|
||||||
twinui_sb_dll,
|
twinui_sb_dll,
|
||||||
@ -1752,6 +1878,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
);
|
);
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
printf("Reading symbols.\n");
|
||||||
if (VnGetSymbols(
|
if (VnGetSymbols(
|
||||||
szSettingsPath,
|
szSettingsPath,
|
||||||
symbols_PTRS.twinui_PTRS,
|
symbols_PTRS.twinui_PTRS,
|
||||||
@ -1784,6 +1911,71 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
wszSettingsPath
|
wszSettingsPath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
char stobject_sb_dll[MAX_PATH];
|
||||||
|
ZeroMemory(
|
||||||
|
stobject_sb_dll,
|
||||||
|
(MAX_PATH) * sizeof(char)
|
||||||
|
);
|
||||||
|
GetSystemDirectoryA(
|
||||||
|
stobject_sb_dll,
|
||||||
|
MAX_PATH
|
||||||
|
);
|
||||||
|
strcat_s(
|
||||||
|
stobject_sb_dll,
|
||||||
|
MAX_PATH,
|
||||||
|
"\\"
|
||||||
|
);
|
||||||
|
strcat_s(
|
||||||
|
stobject_sb_dll,
|
||||||
|
MAX_PATH,
|
||||||
|
STOBJECT_SB_NAME
|
||||||
|
);
|
||||||
|
strcat_s(
|
||||||
|
stobject_sb_dll,
|
||||||
|
MAX_PATH,
|
||||||
|
".dll"
|
||||||
|
);
|
||||||
|
printf("Downloading symbols for %s.\n", stobject_sb_dll);
|
||||||
|
if (VnDownloadSymbols(
|
||||||
|
NULL,
|
||||||
|
stobject_sb_dll,
|
||||||
|
szSettingsPath,
|
||||||
|
MAX_PATH
|
||||||
|
))
|
||||||
|
{
|
||||||
|
FreeLibraryAndExitThread(
|
||||||
|
hModule,
|
||||||
|
6
|
||||||
|
);
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
printf("Reading symbols.\n");
|
||||||
|
if (VnGetSymbols(
|
||||||
|
szSettingsPath,
|
||||||
|
symbols_PTRS.stobject_PTRS,
|
||||||
|
stobject_SN,
|
||||||
|
STOBJECT_SB_CNT
|
||||||
|
))
|
||||||
|
{
|
||||||
|
FreeLibraryAndExitThread(
|
||||||
|
hModule,
|
||||||
|
7
|
||||||
|
);
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
VnWriteUInt(
|
||||||
|
TEXT(STOBJECT_SB_NAME),
|
||||||
|
TEXT(STOBJECT_SB_0),
|
||||||
|
symbols_PTRS.stobject_PTRS[0],
|
||||||
|
wszSettingsPath
|
||||||
|
);
|
||||||
|
VnWriteUInt(
|
||||||
|
TEXT(STOBJECT_SB_NAME),
|
||||||
|
TEXT(STOBJECT_SB_1),
|
||||||
|
symbols_PTRS.stobject_PTRS[1],
|
||||||
|
wszSettingsPath
|
||||||
|
);
|
||||||
|
|
||||||
VnWriteString(
|
VnWriteString(
|
||||||
TEXT("OS"),
|
TEXT("OS"),
|
||||||
TEXT("Build"),
|
TEXT("Build"),
|
||||||
@ -1851,7 +2043,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
if (hUser32) CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");
|
if (hUser32) CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");
|
||||||
|
|
||||||
|
|
||||||
|
LoadLibrary("twinui.pcshell.dll");
|
||||||
HANDLE hTwinuiPcshell = GetModuleHandle(L"twinui.pcshell.dll");
|
HANDLE hTwinuiPcshell = GetModuleHandle(L"twinui.pcshell.dll");
|
||||||
|
|
||||||
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc = (INT64(*)(HWND, int, HWND, int, BOOL*))
|
CImmersiveContextMenuOwnerDrawHelper_s_ContextMenuWndProcFunc = (INT64(*)(HWND, int, HWND, int, BOOL*))
|
||||||
@ -1886,7 +2078,7 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LoadLibrary(L"twinui.dll");
|
||||||
HANDLE hTwinui = GetModuleHandle(L"twinui.dll");
|
HANDLE hTwinui = GetModuleHandle(L"twinui.dll");
|
||||||
|
|
||||||
CImmersiveHotkeyNotification_GetMonitorForHotkeyNotificationFunc = (INT64(*)(void*, void**, HWND*))
|
CImmersiveHotkeyNotification_GetMonitorForHotkeyNotificationFunc = (INT64(*)(void*, void**, HWND*))
|
||||||
@ -1910,6 +2102,33 @@ __declspec(dllexport) DWORD WINAPI main(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LoadLibrary(L"stobject.dll");
|
||||||
|
HANDLE hStobject = GetModuleHandle(L"stobject.dll");
|
||||||
|
SysTrayWndProcFunc = (INT64(*)(HWND, UINT, WPARAM, LPARAM))
|
||||||
|
((uintptr_t)hStobject + symbols_PTRS.stobject_PTRS[0]);
|
||||||
|
rv = funchook_prepare(
|
||||||
|
funchook,
|
||||||
|
(void**)&SysTrayWndProcFunc,
|
||||||
|
SysTrayWndProcHook
|
||||||
|
);
|
||||||
|
if (rv != 0)
|
||||||
|
{
|
||||||
|
FreeLibraryAndExitThread(hModule, rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
TrackPopupMenuFunc = TrackPopupMenu;
|
||||||
|
rv = funchook_prepare(
|
||||||
|
funchook,
|
||||||
|
(void**)&TrackPopupMenuFunc,
|
||||||
|
TrackPopupMenuHook
|
||||||
|
);
|
||||||
|
if (rv != 0)
|
||||||
|
{
|
||||||
|
FreeLibraryAndExitThread(hModule, rv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rv = funchook_install(funchook, 0);
|
rv = funchook_install(funchook, 0);
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user