mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Start10: Fix start menu folders, show recently added, and show frequently used apps settings not being applied on 22621.2134+
This commit is contained in:
parent
4ece80c8cb
commit
e28940d6a1
@ -101,6 +101,7 @@
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)libs\funchook\include;$(SolutionDir)libs\libvalinet;$(SolutionDir)libs\funchook\distorm\include;$(SolutionDir)libs\Detours\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -130,6 +131,7 @@
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)libs\funchook\include;$(SolutionDir)libs\libvalinet;$(SolutionDir)libs\funchook\distorm\include;$(SolutionDir)libs\Detours\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -158,6 +160,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -184,6 +187,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
<ForcedIncludeFiles>$(SolutionDir)debug.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -268,6 +272,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StartMenuSettings.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StartupSound.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -157,6 +157,9 @@
|
||||
<ClCompile Include="StartMenu.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StartMenuSettings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="symbols.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -223,4 +226,4 @@
|
||||
<Filter>Settings</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
139
ExplorerPatcher/StartMenuSettings.cpp
Normal file
139
ExplorerPatcher/StartMenuSettings.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
#include <windows.h>
|
||||
#include <windows.system.h>
|
||||
#include <winrt/windows.foundation.collections.h>
|
||||
#include <winrt/windows.system.h>
|
||||
#include <roapi.h>
|
||||
|
||||
static std::vector<winrt::guid> GlobalStartData_GetPlacesFromRegistry()
|
||||
{
|
||||
std::vector<winrt::guid> places;
|
||||
|
||||
DWORD dwSize;
|
||||
HRESULT hr = RegGetValueW(
|
||||
HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Start",
|
||||
L"VisiblePlaces",
|
||||
RRF_RT_REG_BINARY,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&dwSize
|
||||
);
|
||||
if (FAILED(hr) || dwSize == 0)
|
||||
return places;
|
||||
|
||||
places.resize(dwSize / sizeof(winrt::guid));
|
||||
hr = RegGetValueW(
|
||||
HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Start",
|
||||
L"VisiblePlaces",
|
||||
RRF_RT_REG_BINARY,
|
||||
nullptr,
|
||||
places.data(),
|
||||
&dwSize
|
||||
);
|
||||
if (FAILED(hr))
|
||||
places.clear();
|
||||
|
||||
return places;
|
||||
}
|
||||
|
||||
namespace ABI::WindowsInternal::Shell::CDSProperties
|
||||
{
|
||||
interface IStartGlobalProperties;
|
||||
|
||||
MIDL_INTERFACE("2c670963-f8a9-4bbb-9adf-683a3a89537e")
|
||||
IStartGlobalPropertiesFactory : public IInspectable
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE Create(Windows::System::IUser* user, IStartGlobalProperties** result) = 0;
|
||||
};
|
||||
|
||||
MIDL_INTERFACE("ee807266-a2db-4c9a-a1b4-970d33f99c91")
|
||||
IStartGlobalProperties : public IInspectable
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE get_FullScreenMode(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_FullScreenMode(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_HideAppList(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_HideAppList(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_HideRecentList(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_HideRecentList(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_HideFrequentList(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_HideFrequentList(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_StartMenuRelativeHeightPixels(unsigned int*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_StartMenuRelativeHeightPixels(unsigned int) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_PlacesInitialized(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_PlacesInitialized(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_PlacesInitializedVersion(unsigned int*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_PlacesInitializedVersion(unsigned int) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetVisiblePlaces(Windows::Foundation::Collections::IVectorView<GUID>**) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE SetVisiblePlaces(Windows::Foundation::Collections::IVectorView<GUID>*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE get_StartViewRestoring(unsigned char*) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE put_StartViewRestoring(unsigned char) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE add_PropertiesChanged(
|
||||
/*Windows::Foundation::ITypedEventHandler<
|
||||
StartGlobalProperties*,
|
||||
StartGlobalPropertiesChangedArgs*
|
||||
>*,
|
||||
EventRegistrationToken**/
|
||||
) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE remove_PropertiesChanged(EventRegistrationToken) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
extern "C" BOOL NeedsRo_SyncSettingsFromRegToCDS()
|
||||
{
|
||||
winrt::com_ptr<ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalPropertiesFactory> global_properties_factory;
|
||||
winrt::param::hstring hstr = L"WindowsInternal.Shell.CDSProperties.StartGlobalProperties";
|
||||
HRESULT hr = RoGetActivationFactory(
|
||||
*(HSTRING*)&hstr,
|
||||
__uuidof(ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalPropertiesFactory),
|
||||
global_properties_factory.put_void()
|
||||
);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
winrt::Windows::System::User user = winrt::Windows::System::User::FindAllAsync().get().GetAt(0);
|
||||
winrt::com_ptr<ABI::WindowsInternal::Shell::CDSProperties::IStartGlobalProperties> start_global_properties;
|
||||
hr = global_properties_factory->Create(user.as<ABI::Windows::System::IUser>().get(), start_global_properties.put());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD dwValue, dwSize;
|
||||
|
||||
// ShowFrequentList
|
||||
dwValue = 0; // Default off
|
||||
dwSize = sizeof(DWORD);
|
||||
RegGetValueW(
|
||||
HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Start",
|
||||
L"ShowFrequentList",
|
||||
RRF_RT_REG_DWORD,
|
||||
nullptr,
|
||||
&dwValue,
|
||||
&dwSize
|
||||
);
|
||||
start_global_properties->put_HideFrequentList(!dwValue);
|
||||
|
||||
// ShowRecentList
|
||||
dwValue = 1; // Default on
|
||||
dwSize = sizeof(DWORD);
|
||||
RegGetValueW(
|
||||
HKEY_CURRENT_USER,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Start",
|
||||
L"ShowRecentList",
|
||||
RRF_RT_REG_DWORD,
|
||||
nullptr,
|
||||
&dwValue,
|
||||
&dwSize
|
||||
);
|
||||
start_global_properties->put_HideRecentList(!dwValue);
|
||||
|
||||
// VisiblePlaces
|
||||
auto places_view = single_threaded_vector<winrt::guid>(GlobalStartData_GetPlacesFromRegistry()).GetView();
|
||||
start_global_properties->SetVisiblePlaces(places_view.as<ABI::Windows::Foundation::Collections::IVectorView<GUID>>().get());
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -1968,7 +1968,7 @@ void EnsureXAML()
|
||||
hr = IXamlApplicationStatics_get_Current(pXamlApplicationStatics, &pXamlApplication);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
printf("[EnsureXAML] IXamlApplicationStatics::get_Current() failed.\n");
|
||||
printf("[EnsureXAML] IXamlApplicationStatics::get_Current() failed. 0x%lX\n", hr);
|
||||
goto cleanup1;
|
||||
}
|
||||
pXamlApplication->lpVtbl->Release(pXamlApplication);
|
||||
@ -1996,7 +1996,7 @@ void EnsureXAML()
|
||||
hr = pCoreWindow5->lpVtbl->get_DispatcherQueue(pCoreWindow5, &pDispatcherQueue);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
printf("[EnsureXAML] ICoreWindow5::get_DispatcherQueue() failed.\n");
|
||||
printf("[EnsureXAML] ICoreWindow5::get_DispatcherQueue() failed. 0x%lX\n", hr);
|
||||
goto cleanup3;
|
||||
}
|
||||
// Keep pDispatcherQueue referenced in memory
|
||||
@ -11180,7 +11180,7 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (IsWindows11())
|
||||
{
|
||||
twinui_pcshell_IsUndockedAssetAvailableFunc = (INT64(*)(void*, POINT*))
|
||||
((uintptr_t)hTwinuiPcshell + symbols_PTRS.twinui_pcshell_PTRS[7]);
|
||||
@ -11195,7 +11195,7 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
{
|
||||
if (IsWindows11Version22H2OrHigher())
|
||||
printf("Failed to hook twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHost(). rv = %d\n", rv);
|
||||
else
|
||||
else if (IsWindows11())
|
||||
printf("Failed to hook twinui_pcshell_IsUndockedAssetAvailable(). rv = %d\n", rv);
|
||||
}
|
||||
|
||||
@ -12337,6 +12337,11 @@ int Start_SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw)
|
||||
SetWindowPos(hWnd, NULL, mi.rcWork.left, mi.rcWork.top, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
|
||||
}
|
||||
}
|
||||
if (bIsWindowVisible && IsWindows11Version22H2Build2134OrHigher())
|
||||
{
|
||||
extern void NeedsRo_SyncSettingsFromRegToCDS();
|
||||
NeedsRo_SyncSettingsFromRegToCDS();
|
||||
}
|
||||
}
|
||||
return SetWindowRgn(hWnd, hRgn, bRedraw);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user