Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'valinet-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
creeper-0910 committed May 27, 2022
2 parents 316e223 + 19159df commit 318c564
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -9183,6 +9183,7 @@ BOOL SHELL32_CanDisplayWin8CopyDialogHook()

HKEY hKeySpotlight1 = NULL;
HKEY hKeySpotlight2 = NULL;
BOOL bSpotlightIsDesktopContextMenu = FALSE;

LSTATUS shell32_RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, const LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition)
{
Expand Down Expand Up @@ -9214,12 +9215,19 @@ LSTATUS shell32_RegSetValueExW(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, D
return RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);
}

BOOL shell32_DeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags)
{
if (uPosition == 0x7053 && IsSpotlightEnabled() && dwSpotlightDesktopMenuMask) bSpotlightIsDesktopContextMenu = TRUE;
return DeleteMenu(hMenu, uPosition, uFlags);
}

BOOL shell32_TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, int nReserved, HWND hWnd, const RECT* prcRect)
{
if (IsSpotlightEnabled() && dwSpotlightDesktopMenuMask && RegisterWindowMessageW(L"WorkerW") == GetClassWord(GetParent(hWnd), GCW_ATOM))
if (IsSpotlightEnabled() && dwSpotlightDesktopMenuMask && RegisterWindowMessageW(L"WorkerW") == GetClassWord(GetParent(hWnd), GCW_ATOM) && bSpotlightIsDesktopContextMenu)
{
SpotlightHelper(dwSpotlightDesktopMenuMask, hWnd, hMenu, NULL);
}
bSpotlightIsDesktopContextMenu = FALSE;
BOOL bRet = TrackPopupMenuHook(hMenu, uFlags, x, y, nReserved, hWnd, prcRect);
if (IsSpotlightEnabled() && dwSpotlightDesktopMenuMask)
{
Expand Down Expand Up @@ -10123,6 +10131,7 @@ DWORD Inject(BOOL bIsExplorer)
{
VnPatchIAT(hShell32, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegCreateKeyExW", shell32_RegCreateKeyExW);
VnPatchIAT(hShell32, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegSetValueExW", shell32_RegSetValueExW);
VnPatchIAT(hShell32, "user32.dll", "DeleteMenu", shell32_DeleteMenu);
}
}
printf("Setup shell32 functions done\n");
Expand Down Expand Up @@ -11886,4 +11895,4 @@ BOOL WINAPI DllMain(
break;
}
return TRUE;
}
}

0 comments on commit 318c564

Please sign in to comment.