[SHELL32] All SHELLSTATE members must be initialized before writing to the registry (#9293)

A more reliable fix.

CORE-20585
This commit is contained in:
Whindmar Saksit
2026-07-28 16:14:13 +02:00
committed by GitHub
parent 29e8ed11af
commit 4fecc908e7
3 changed files with 7 additions and 6 deletions
-3
View File
@@ -539,9 +539,6 @@ HRESULT STDMETHODCALLTYPE CShellDispatch::ExplorerPolicy(BSTR policy, VARIANT *v
return E_NOTIMPL;
}
#ifndef SSF_SERVERADMINUI
#define SSF_SERVERADMINUI 4
#endif
HRESULT STDMETHODCALLTYPE CShellDispatch::GetSetting(LONG setting, VARIANT_BOOL *result)
{
TRACE("(%p, %lu, %p)\n", this, setting, result);
+6 -3
View File
@@ -246,6 +246,8 @@ VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
#define SSF_STRUCTONLY (SSF_NOCONFIRMRECYCLE | SSF_DOUBLECLICKINWEBVIEW | SSF_DESKTOPHTML | \
SSF_WIN95CLASSIC | SSF_SORTCOLUMNS | SSF_STARTPANELON)
#define SSF_ALL (0x07FFFFFF & ~0x40)
#define SSF_IMPLEMENTED ((SSF_ALL) & ~(SSF_SERVERADMINUI)) // SERVERADMINUI is written by Explorer and read by IsOS()
#define SHGSS_GetSetStruct(getsetmacro) \
do { \
getsetmacro(fNoConfirmRecycle, SSF_NOCONFIRMRECYCLE); \
@@ -278,11 +280,12 @@ VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
if (bSet)
{
DWORD changed = 0;
if (dwMask & ~g_CachedSSF)
DWORD changed = 0, notcached = ~g_CachedSSF & SSF_IMPLEMENTED;
if (notcached & ~dwMask)
{
// All entries in gpss have to be initialized (except the item we are about to set) because we are about to write the whole struct to the registry
SHELLSTATE tempstate;
SHGetSetSettings(&tempstate, dwMask, FALSE); // Read entries that are not in g_CachedSSF
SHGetSetSettings(&tempstate, notcached & ~dwMask, FALSE); // Read entries that are not in gpss/g_CachedSSF
}
#define SHGSS_WriteAdv(name, value, SSF) \
+1
View File
@@ -1620,6 +1620,7 @@ VOID WINAPI SHGetSettings(_Out_ LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
#define SSF_SHOWALLOBJECTS 0x00000001
#define SSF_SHOWEXTENSIONS 0x00000002
#define SSF_SERVERADMINUI 0x00000004
#define SSF_SHOWCOMPCOLOR 0x00000008
#define SSF_SORTCOLUMNS 0x00000010
#define SSF_SHOWSYSFILES 0x00000020