-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start10: Fix start menu folders, show recently added, and show freque…
…ntly used apps settings not being applied on 22621.2134+
- Loading branch information
Showing
4 changed files
with
160 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e28940d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Amrsatrio How did you figure this interface out, I am genuinely curious. An excellent contribution, so basically one can obtain this interface from winrt which lets you get/set Start menu’s properties as you wish? Did you disassemble older versions of SystemSettings.exe or older DLLs? You looked through the registry for factories with “Start” in their name? Would you mine explaining the whole process a little bit out? Thank you very much.
e28940d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VisiblePlaces
StartUI.dll
andStartDocked.dll
, found a function namedBuildVisiblePlacesList
or somethingIStartGlobalProperties
functions. I forgot how I found thatStartGlobalProperties
is constructed byStartGlobalPropertiesFactory
, but I searched forStartGlobalPropertiesFactory::StartGlobalPropertiesFactory
in the processThe consumer call in
StartDocked.dll
has the updated code that retrieves the data from registry if a certain feature flag is enabled (instead of calling the interface), whileStartUI.dll
doesn't haveStartTileData.dll
which has the implementation for that interfeceThere's nothing in
SystemSettings.dll
that deals with these start menu settings, I've checked. Ironically, those are inStartTileData.dll
which has the same feature flag and loading/saving from registry as well.I disassembled both 22621.1992 and 22621.2361 (2134 is also fine) DLLs in order to see the differences.