mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:51:58 +00:00
[EXPLORER][SHELL32][SDK] Show/hide 'Run' menu item (#6592)
Improve Start Menu customization. JIRA issue: CORE-16956 - Add SHSettingsChanged prototype to <undocshell.h>. - Add SetRestriction helper function. - Implement showing/hiding Run menu item of Start Menu.
This commit is contained in:
parent
ede65b88bc
commit
5daab33c59
6 changed files with 26 additions and 12 deletions
|
@ -110,6 +110,7 @@ BOOL GetRegValue(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN BOOL bDefault
|
||||||
BOOL SetRegDword(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN DWORD dwValue);
|
BOOL SetRegDword(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN DWORD dwValue);
|
||||||
BOOL GetAdvancedBool(IN LPCWSTR pszValueName, IN BOOL bDefaultValue);
|
BOOL GetAdvancedBool(IN LPCWSTR pszValueName, IN BOOL bDefaultValue);
|
||||||
BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue);
|
BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue);
|
||||||
|
BOOL SetRestriction(IN LPCWSTR pszKey, IN LPCWSTR pszValueName, IN DWORD dwValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rshell.c
|
* rshell.c
|
||||||
|
|
|
@ -96,6 +96,17 @@ static BOOL CALLBACK CustomizeWrite0(const CUSTOMIZE_ENTRY *entry, DWORD dwValue
|
||||||
return SetAdvancedDword(entry->name, dwValue);
|
return SetAdvancedDword(entry->name, dwValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD CALLBACK CustomizeReadRun(const CUSTOMIZE_ENTRY *entry)
|
||||||
|
{
|
||||||
|
return !SHRestricted(REST_NORUN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL CALLBACK CustomizeWriteRest(const CUSTOMIZE_ENTRY *entry, DWORD dwValue)
|
||||||
|
{
|
||||||
|
SetRestriction(L"Explorer", entry->name, !dwValue);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static const CUSTOMIZE_ENTRY s_CustomizeEntries[] =
|
static const CUSTOMIZE_ENTRY s_CustomizeEntries[] =
|
||||||
{
|
{
|
||||||
// FIXME: Make "StartMenuAdminTools" effective
|
// FIXME: Make "StartMenuAdminTools" effective
|
||||||
|
@ -103,9 +114,7 @@ static const CUSTOMIZE_ENTRY s_CustomizeEntries[] =
|
||||||
|
|
||||||
{ IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", CustomizeRead0, CustomizeWrite0 },
|
{ IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", CustomizeRead0, CustomizeWrite0 },
|
||||||
{ IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", CustomizeRead0, CustomizeWrite0 },
|
{ IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", CustomizeRead0, CustomizeWrite0 },
|
||||||
|
{ IDS_ADVANCED_DISPLAY_RUN, L"NoRun", CustomizeReadRun, CustomizeWriteRest },
|
||||||
// FIXME: SHRestricted is buggy!
|
|
||||||
//{ IDS_ADVANCED_DISPLAY_RUN, L"NoRun", CustomizeRead2, CustomizeWrite2 },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry)
|
static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry)
|
||||||
|
|
|
@ -216,9 +216,7 @@ public:
|
||||||
/* Run */
|
/* Run */
|
||||||
if (SHRestricted(REST_NORUN))
|
if (SHRestricted(REST_NORUN))
|
||||||
{
|
{
|
||||||
DeleteMenu(hMenu,
|
DeleteMenu(hMenu, IDM_RUN, MF_BYCOMMAND);
|
||||||
IDM_RUN,
|
|
||||||
MF_BYCOMMAND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Synchronize */
|
/* Synchronize */
|
||||||
|
|
|
@ -163,6 +163,15 @@ BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue)
|
||||||
return SetRegDword(REGKEY_ADVANCED, pszValueName, dwValue);
|
return SetRegDword(REGKEY_ADVANCED, pszValueName, dwValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL SetRestriction(IN LPCWSTR pszKey, IN LPCWSTR pszValueName, IN DWORD dwValue)
|
||||||
|
{
|
||||||
|
WCHAR szSubKey[MAX_PATH] = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
|
||||||
|
PathAppendW(szSubKey, pszKey);
|
||||||
|
SHSetValueW(HKEY_CURRENT_USER, szSubKey, pszValueName, REG_DWORD, &dwValue, sizeof(dwValue));
|
||||||
|
SHSettingsChanged(NULL, NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
GetVersionInfoString(IN LPCWSTR szFileName,
|
GetVersionInfoString(IN LPCWSTR szFileName,
|
||||||
IN LPCWSTR szVersionInfo,
|
IN LPCWSTR szVersionInfo,
|
||||||
|
|
|
@ -34,9 +34,6 @@ typedef struct REGSHELLSTATE
|
||||||
static const LPCWSTR s_pszExplorerKey =
|
static const LPCWSTR s_pszExplorerKey =
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
|
||||||
|
|
||||||
extern "C"
|
|
||||||
BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey);
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Shell settings
|
// Shell settings
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,12 @@ typedef struct _TRAYNOTIFYDATAW
|
||||||
|
|
||||||
#endif /* defined (_SHELLAPI_H) || defined (_INC_SHELLAPI) */
|
#endif /* defined (_SHELLAPI_H) || defined (_INC_SHELLAPI) */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Taskbar WM_COMMAND identifiers
|
* Taskbar WM_COMMAND identifiers
|
||||||
*/
|
*/
|
||||||
#define TWM_DOEXITWINDOWS (WM_USER + 342)
|
#define TWM_DOEXITWINDOWS (WM_USER + 342)
|
||||||
#define TWM_CYCLEFOCUS (WM_USER + 348)
|
#define TWM_CYCLEFOCUS (WM_USER + 348)
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* IDList Functions
|
* IDList Functions
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +94,6 @@ HRESULT WINAPI SHILCreateFromPathW (
|
||||||
BOOL WINAPI StrRetToStrNA(LPSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
|
BOOL WINAPI StrRetToStrNA(LPSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
|
||||||
BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
|
BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SHChangeNotifyRegister API
|
* SHChangeNotifyRegister API
|
||||||
*/
|
*/
|
||||||
|
@ -258,6 +255,7 @@ ExtractIconResInfoW(
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* File Menu Routines
|
* File Menu Routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* FileMenu_Create nSelHeight constants */
|
/* FileMenu_Create nSelHeight constants */
|
||||||
#define FM_DEFAULT_SELHEIGHT -1
|
#define FM_DEFAULT_SELHEIGHT -1
|
||||||
#define FM_FULL_SELHEIGHT 0
|
#define FM_FULL_SELHEIGHT 0
|
||||||
|
@ -732,6 +730,8 @@ Activate_RunDLL(
|
||||||
_In_ LPCWSTR cmdline,
|
_In_ LPCWSTR cmdline,
|
||||||
_In_ INT cmdshow);
|
_In_ INT cmdshow);
|
||||||
|
|
||||||
|
BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Shell32 resources
|
* Shell32 resources
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue