Browse Source

StartUI: Implemented "Show more tiles" option

pull/979/head
Valentin Radu 4 years ago
parent
commit
54f12ee128
  1. 16
      ExplorerPatcher/GUI.c
  2. 89
      ExplorerPatcher/dllmain.c
  3. 2
      ExplorerPatcher/settings.reg

16
ExplorerPatcher/GUI.c

@ -406,6 +406,18 @@ LSTATUS GUI_Internal_RegSetValueExW(
); );
return RegSetValueExW(hKey, L"StartUI_EnableRoundedCorners", 0, dwType, lpData, cbData); return RegSetValueExW(hKey, L"StartUI_EnableRoundedCorners", 0, dwType, lpData, cbData);
} }
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_StartUI_ShowMoreTiles"))
{
RegSetKeyValueW(
HKEY_CURRENT_USER,
TEXT(REGPATH_OLD),
L"StartUI_ShowMoreTiles",
dwType,
lpData,
cbData
);
return RegSetValueExW(hKey, L"StartUI_ShowMoreTiles", 0, dwType, lpData, cbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_ForceStartSize")) else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_ForceStartSize"))
{ {
WCHAR wszPath[MAX_PATH]; WCHAR wszPath[MAX_PATH];
@ -638,6 +650,10 @@ LSTATUS GUI_Internal_RegQueryValueExW(
{ {
return RegQueryValueExW(hKey, L"StartUI_EnableRoundedCorners", lpReserved, lpType, lpData, lpcbData); return RegQueryValueExW(hKey, L"StartUI_EnableRoundedCorners", lpReserved, lpType, lpData, lpcbData);
} }
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_StartUI_ShowMoreTiles"))
{
return RegQueryValueExW(hKey, L"StartUI_ShowMoreTiles", lpReserved, lpType, lpData, lpcbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_ForceStartSize")) else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_ForceStartSize"))
{ {
return RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer", L"ForceStartSize", RRF_RT_DWORD, NULL, lpData, lpcbData); return RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Policies\\Microsoft\\Windows\\Explorer", L"ForceStartSize", RRF_RT_DWORD, NULL, lpData, lpcbData);

89
ExplorerPatcher/dllmain.c

@ -9004,6 +9004,8 @@ DWORD StartDocked_DisableRecommendedSection = FALSE;
DWORD StartDocked_DisableRecommendedSectionApply = TRUE; DWORD StartDocked_DisableRecommendedSectionApply = TRUE;
DWORD StartUI_EnableRoundedCorners = FALSE; DWORD StartUI_EnableRoundedCorners = FALSE;
DWORD StartUI_EnableRoundedCornersApply = TRUE; DWORD StartUI_EnableRoundedCornersApply = TRUE;
DWORD StartUI_ShowMoreTiles = FALSE;
HKEY hKey_StartUI_TileGrid = NULL;
void StartMenu_LoadSettings(BOOL bRestartIfChanged) void StartMenu_LoadSettings(BOOL bRestartIfChanged)
{ {
@ -9083,9 +9085,9 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged)
); );
if (dwVal != StartDocked_DisableRecommendedSection) if (dwVal != StartDocked_DisableRecommendedSection)
{ {
StartDocked_DisableRecommendedSection = dwVal;
StartDocked_DisableRecommendedSectionApply = TRUE; StartDocked_DisableRecommendedSectionApply = TRUE;
} }
StartDocked_DisableRecommendedSection = dwVal;
dwSize = sizeof(DWORD); dwSize = sizeof(DWORD);
dwVal = FALSE; dwVal = FALSE;
@ -9099,9 +9101,25 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged)
); );
if (dwVal != StartUI_EnableRoundedCorners) if (dwVal != StartUI_EnableRoundedCorners)
{ {
StartUI_EnableRoundedCorners = dwVal;
StartUI_EnableRoundedCornersApply = TRUE; StartUI_EnableRoundedCornersApply = TRUE;
} }
StartUI_EnableRoundedCorners = dwVal;
dwSize = sizeof(DWORD);
dwVal = FALSE;
RegQueryValueExW(
hKey,
TEXT("StartUI_ShowMoreTiles"),
0,
NULL,
&dwVal,
&dwSize
);
if (bRestartIfChanged && dwStartShowClassicMode && dwVal != StartUI_ShowMoreTiles)
{
exit(0);
}
StartUI_ShowMoreTiles = dwVal;
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -9324,6 +9342,46 @@ LSTATUS StartUI_RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD
return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
} }
LSTATUS StartUI_RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
{
if (wcsstr(lpSubKey, L"$start.tilegrid$windows.data.curatedtilecollection.tilecollection\\Current"))
{
LSTATUS lRes = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);
if (lRes == ERROR_SUCCESS)
{
hKey_StartUI_TileGrid = *phkResult;
}
return lRes;
}
return RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);
}
LSTATUS StartUI_RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
{
if (hKey == hKey_StartUI_TileGrid)
{
if (!_wcsicmp(lpValueName, L"Data"))
{
LSTATUS lRes = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
if (lRes == ERROR_SUCCESS && lpData && *lpcbData >= 26)
{
lpData[25] = (StartUI_ShowMoreTiles ? 16 : 12);
}
return lRes;
}
}
return RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
}
LSTATUS StartUI_RegCloseKey(HKEY hKey)
{
if (hKey == hKey_StartUI_TileGrid)
{
hKey_StartUI_TileGrid = NULL;
}
return RegCloseKey(hKey);
}
int StartUI_SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw) int StartUI_SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
{ {
BOOL bIsWindowVisible = FALSE; BOOL bIsWindowVisible = FALSE;
@ -9772,15 +9830,16 @@ void InjectStartMenu()
#ifdef _WIN64 #ifdef _WIN64
funchook = funchook_create(); funchook = funchook_create();
LoadLibraryW(L"StartDocked.dll"); HANDLE hStartDocked = NULL;
HANDLE hStartDocked = GetModuleHandleW(L"StartDocked.dll"); HANDLE hStartUI = NULL;
LoadLibraryW(L"StartUI.dll");
HANDLE hStartUI = GetModuleHandleW(L"StartUI.dll");
StartMenu_LoadSettings(FALSE); StartMenu_LoadSettings(FALSE);
if (dwStartShowClassicMode) if (dwStartShowClassicMode)
{ {
LoadLibraryW(L"StartUI.dll");
hStartUI = GetModuleHandleW(L"StartUI.dll");
// Fixes hang when Start menu closes // Fixes hang when Start menu closes
VnPatchDelayIAT(hStartUI, "ext-ms-win-ntuser-draw-l1-1-0.dll", "SetWindowRgn", StartUI_SetWindowRgn); VnPatchDelayIAT(hStartUI, "ext-ms-win-ntuser-draw-l1-1-0.dll", "SetWindowRgn", StartUI_SetWindowRgn);
@ -9796,9 +9855,19 @@ void InjectStartMenu()
VnPatchIAT(hMrmCoreR, "api-ms-win-core-file-l1-1-0.dll", "GetFileAttributesExW", StartUI_GetFileAttributesExW); VnPatchIAT(hMrmCoreR, "api-ms-win-core-file-l1-1-0.dll", "GetFileAttributesExW", StartUI_GetFileAttributesExW);
VnPatchIAT(hMrmCoreR, "api-ms-win-core-file-l1-1-0.dll", "FindFirstFileW", StartUI_FindFirstFileW); VnPatchIAT(hMrmCoreR, "api-ms-win-core-file-l1-1-0.dll", "FindFirstFileW", StartUI_FindFirstFileW);
VnPatchIAT(hMrmCoreR, "api-ms-win-core-registry-l1-1-0.dll", "RegGetValueW", StartUI_RegGetValueW); VnPatchIAT(hMrmCoreR, "api-ms-win-core-registry-l1-1-0.dll", "RegGetValueW", StartUI_RegGetValueW);
// Enables "Show more tiles" setting
LoadLibraryW(L"Windows.CloudStore.dll");
HANDLE hWindowsCloudStore = GetModuleHandleW(L"Windows.CloudStore.dll");
VnPatchIAT(hWindowsCloudStore, "api-ms-win-core-registry-l1-1-0.dll", "RegOpenKeyExW", StartUI_RegOpenKeyExW);
VnPatchIAT(hWindowsCloudStore, "api-ms-win-core-registry-l1-1-0.dll", "RegQueryValueExW", StartUI_RegQueryValueExW);
VnPatchIAT(hWindowsCloudStore, "api-ms-win-core-registry-l1-1-0.dll", "RegCloseKey", StartUI_RegCloseKey);
} }
else else
{ {
LoadLibraryW(L"StartDocked.dll");
hStartDocked = GetModuleHandleW(L"StartDocked.dll");
VnPatchDelayIAT(hStartDocked, "ext-ms-win-ntuser-draw-l1-1-0.dll", "SetWindowRgn", StartDocked_SetWindowRgn); VnPatchDelayIAT(hStartDocked, "ext-ms-win-ntuser-draw-l1-1-0.dll", "SetWindowRgn", StartDocked_SetWindowRgn);
} }
@ -9902,12 +9971,12 @@ void InjectStartMenu()
FreeLibrary(hModule); FreeLibrary(hModule);
} }
if (dwVal1 && dwVal1 != 0xFFFFFFFF) if (dwVal1 && dwVal1 != 0xFFFFFFFF && hStartDocked)
{ {
StartDocked_LauncherFrame_ShowAllAppsFunc = (INT64(*)(void*)) StartDocked_LauncherFrame_ShowAllAppsFunc = (INT64(*)(void*))
((uintptr_t)hStartDocked + dwVal1); ((uintptr_t)hStartDocked + dwVal1);
} }
if (dwVal2 && dwVal2 != 0xFFFFFFFF) if (dwVal2 && dwVal2 != 0xFFFFFFFF && hStartDocked)
{ {
StartDocked_LauncherFrame_OnVisibilityChangedFunc = (INT64(*)(void*, INT64, void*)) StartDocked_LauncherFrame_OnVisibilityChangedFunc = (INT64(*)(void*, INT64, void*))
((uintptr_t)hStartDocked + dwVal2); ((uintptr_t)hStartDocked + dwVal2);
@ -9922,7 +9991,7 @@ void InjectStartMenu()
return rv; return rv;
} }
} }
if (dwVal3 && dwVal3 != 0xFFFFFFFF) if (dwVal3 && dwVal3 != 0xFFFFFFFF && hStartDocked)
{ {
StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*)) StartDocked_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*))
((uintptr_t)hStartDocked + dwVal3); ((uintptr_t)hStartDocked + dwVal3);
@ -9937,7 +10006,7 @@ void InjectStartMenu()
return rv; return rv;
} }
} }
if (dwVal4 && dwVal4 != 0xFFFFFFFF) if (dwVal4 && dwVal4 != 0xFFFFFFFF && hStartUI)
{ {
StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*)) StartUI_SystemListPolicyProvider_GetMaximumFrequentAppsFunc = (INT64(*)(void*, INT64, void*))
((uintptr_t)hStartUI + dwVal4); ((uintptr_t)hStartUI + dwVal4);

2
ExplorerPatcher/settings.reg

@ -230,6 +230,8 @@
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Enable rounded corners ;b Enable rounded corners
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_EnableRoundedCorners"=dword:00000000
;b Show more tiles
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_ShowMoreTiles"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 3 Display mode ;c 3 Display mode
;x 0 Default ;x 0 Default

Loading…
Cancel
Save