Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jpbandroid/reactos-pulls
Browse files Browse the repository at this point in the history
…into windivs8
  • Loading branch information
errortek committed Mar 14, 2024
2 parents 757376b + 115db38 commit eae90fb
Show file tree
Hide file tree
Showing 288 changed files with 6,263 additions and 4,759 deletions.
8 changes: 1 addition & 7 deletions base/applications/kbswitch/kbswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <shlobj.h>
#include <shlwapi_undoc.h>
#include <imm.h>
#include <imm32_undoc.h>

/*
* This program kbswitch is a mimic of Win2k's internat.exe.
Expand All @@ -26,13 +27,6 @@
* won't be generated in Vista+.
*/

#define IME_MASK (0xE0000000UL)
#define SPECIAL_MASK (0xF0000000UL)

#define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == IME_MASK)
#define IS_SPECIAL_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == SPECIAL_MASK)
#define SPECIALIDFROMHKL(hKL) ((WORD)(HIWORD(hKL) & 0x0FFF))

#define WM_NOTIFYICONMSG (WM_USER + 248)

PKBSWITCHSETHOOKS KbSwitchSetHooks = NULL;
Expand Down
5 changes: 5 additions & 0 deletions base/shell/explorer/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
/* These values must be synchronized with shell32 */
#define IDS_ADVANCED_DISPLAY_FAVORITES 30466
#define IDS_ADVANCED_DISPLAY_LOG_OFF 30467
#define IDS_ADVANCED_EXPAND_CONTROL_PANEL 30468
#define IDS_ADVANCED_EXPAND_MY_DOCUMENTS 30469
#define IDS_ADVANCED_EXPAND_PRINTERS 30470
#define IDS_ADVANCED_EXPAND_MY_PICTURES 30472
#define IDS_ADVANCED_EXPAND_NET_CONNECTIONS 30473
#define IDS_ADVANCED_DISPLAY_RUN 30474
#define IDS_ADVANCED_DISPLAY_ADMINTOOLS 30476

Expand Down
79 changes: 54 additions & 25 deletions base/shell/explorer/startmnucust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "precomp.h"

#define I_UNCHECKED 1
#define I_CHECKED 2

// TODO: Windows Explorer appears to be calling NewLinkHere / ConfigStartMenu directly for both items.
Expand Down Expand Up @@ -82,34 +83,57 @@ struct CUSTOMIZE_ENTRY
{
LPARAM id;
LPCWSTR name;
FN_CUSTOMIZE_READ fnRead;
FN_CUSTOMIZE_WRITE fnWrite;
BOOL bDefaultValue;
RESTRICTIONS policy1, policy2;
};

static DWORD CALLBACK CustomizeRead0(const CUSTOMIZE_ENTRY *entry)
{
return GetAdvancedBool(entry->name, FALSE);
}

static BOOL CALLBACK CustomizeWrite0(const CUSTOMIZE_ENTRY *entry, DWORD dwValue)
{
return SetAdvancedDword(entry->name, dwValue);
}

static const CUSTOMIZE_ENTRY s_CustomizeEntries[] =
{
// FIXME: Make "StartMenuAdminTools" effective
//{ IDS_ADVANCED_DISPLAY_ADMINTOOLS, L"StartMenuAdminTools", CustomizeRead1, CustomizeWrite1 }, // FIXME

{ IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", CustomizeRead0, CustomizeWrite0 },
{ IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", CustomizeRead0, CustomizeWrite0 },

// FIXME: SHRestricted is buggy!
//{ IDS_ADVANCED_DISPLAY_RUN, L"NoRun", CustomizeRead2, CustomizeWrite2 },
{
IDS_ADVANCED_DISPLAY_ADMINTOOLS, L"StartMenuAdminTools", TRUE,
},
{
IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", FALSE,
REST_NOFAVORITESMENU
},
{
IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", FALSE,
REST_STARTMENULOGOFF
},
{
IDS_ADVANCED_DISPLAY_RUN, L"StartMenuRun", TRUE,
REST_NORUN
},
{
IDS_ADVANCED_EXPAND_MY_DOCUMENTS, L"CascadeMyDocuments", FALSE,
REST_NOSMMYDOCS
},
{
IDS_ADVANCED_EXPAND_MY_PICTURES, L"CascadeMyPictures", FALSE,
REST_NOSMMYPICS
},
{
IDS_ADVANCED_EXPAND_CONTROL_PANEL, L"CascadeControlPanel", FALSE,
REST_NOSETFOLDERS, REST_NOCONTROLPANEL,
},
{
IDS_ADVANCED_EXPAND_PRINTERS, L"CascadePrinters", FALSE,
REST_NOSETFOLDERS
},
{
IDS_ADVANCED_EXPAND_NET_CONNECTIONS, L"CascadeNetworkConnections", FALSE,
REST_NOSETFOLDERS, REST_NONETWORKCONNECTIONS
},
};

static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry)
{
if (SHRestricted(entry->policy1) || SHRestricted(entry->policy2))
{
TRACE("%p: Restricted\n", entry->id);
return; // Restricted. Don't show
}

TV_INSERTSTRUCT Insert = { TVI_ROOT, TVI_LAST };
Insert.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;

Expand All @@ -118,8 +142,9 @@ static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry)
Insert.item.pszText = szText;
Insert.item.lParam = entry->id;
Insert.item.stateMask = TVIS_STATEIMAGEMASK;
if (entry->fnRead(entry))
Insert.item.state = INDEXTOSTATEIMAGEMASK(I_CHECKED);
BOOL bChecked = GetAdvancedBool(entry->name, entry->bDefaultValue);
Insert.item.state = INDEXTOSTATEIMAGEMASK(bChecked ? I_CHECKED : I_UNCHECKED);
TRACE("%p: %d\n", entry->id, bChecked);
TreeView_InsertItem(hTreeView, &Insert);
}

Expand All @@ -142,7 +167,7 @@ static BOOL CustomizeClassic_OnOK(HWND hwnd)
{
HWND hTreeView = GetDlgItem(hwnd, IDC_CLASSICSTART_SETTINGS);

for (HTREEITEM hItem = TreeView_GetFirstVisible(hTreeView);
for (HTREEITEM hItem = TreeView_GetRoot(hTreeView);
hItem != NULL;
hItem = TreeView_GetNextVisible(hTreeView, hItem))
{
Expand All @@ -151,12 +176,16 @@ static BOOL CustomizeClassic_OnOK(HWND hwnd)
item.stateMask = TVIS_STATEIMAGEMASK;
TreeView_GetItem(hTreeView, &item);

BOOL bChecked = (item.state & INDEXTOSTATEIMAGEMASK(I_CHECKED));
BOOL bChecked = !!(item.state & INDEXTOSTATEIMAGEMASK(I_CHECKED));
for (auto& entry : s_CustomizeEntries)
{
if (SHRestricted(entry.policy1) || SHRestricted(entry.policy2))
continue;

if (item.lParam == entry.id)
{
entry.fnWrite(&entry, bChecked);
TRACE("%p: %d\n", item.lParam, bChecked);
SetAdvancedDword(entry.name, bChecked);
break;
}
}
Expand Down
159 changes: 68 additions & 91 deletions base/shell/explorer/startmnusite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,107 +130,96 @@ class CStartMenuSite :

/* Remove menu items that don't apply */

dwLogoff = SHRestricted(REST_STARTMENULOGOFF);
bWantLogoff = (dwLogoff == 2 ||
SHRestricted(REST_FORCESTARTMENULOGOFF) ||
GetAdvancedBool(L"StartMenuLogoff", FALSE));

/* Favorites */
if (!GetAdvancedBool(L"StartMenuFavorites", FALSE))
if (SHRestricted(REST_NOFAVORITESMENU) ||
!GetAdvancedBool(L"StartMenuFavorites", FALSE))
{
DeleteMenu(hMenu,
IDM_FAVORITES,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_FAVORITES, MF_BYCOMMAND);
}

/* Documents */
if (SHRestricted(REST_NORECENTDOCSMENU))
if (SHRestricted(REST_NORECENTDOCSMENU) ||
!GetAdvancedBool(L"Start_ShowRecentDocs", TRUE))
{
DeleteMenu(hMenu,
IDM_DOCUMENTS,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_DOCUMENTS, MF_BYCOMMAND);
}

/* Settings */
hSettingsMenu = FindSubMenu(hMenu,
IDM_SETTINGS,
FALSE);
if (hSettingsMenu != NULL)
hSettingsMenu = FindSubMenu(hMenu, IDM_SETTINGS, FALSE);

/* Control Panel */
if (SHRestricted(REST_NOSETFOLDERS) ||
SHRestricted(REST_NOCONTROLPANEL) ||
!GetAdvancedBool(L"Start_ShowControlPanel", TRUE))
{
if (SHRestricted(REST_NOSETFOLDERS))
{
/* Control Panel */
if (SHRestricted(REST_NOCONTROLPANEL))
{
DeleteMenu(hSettingsMenu,
IDM_CONTROLPANEL,
MF_BYCOMMAND);

/* Delete the separator below it */
DeleteMenu(hSettingsMenu,
0,
MF_BYPOSITION);
}

/* Network Connections */
if (SHRestricted(REST_NONETWORKCONNECTIONS))
{
DeleteMenu(hSettingsMenu,
IDM_NETWORKCONNECTIONS,
MF_BYCOMMAND);
}

/* Printers and Faxes */
DeleteMenu(hSettingsMenu,
IDM_PRINTERSANDFAXES,
MF_BYCOMMAND);
}
DeleteMenu(hSettingsMenu, IDM_CONTROLPANEL, MF_BYCOMMAND);

/* Security */
if (GetSystemMetrics(SM_REMOTECONTROL) == 0 ||
SHRestricted(REST_NOSECURITY))
{
DeleteMenu(hSettingsMenu,
IDM_SECURITY,
MF_BYCOMMAND);
}
/* Delete the separator below it */
DeleteMenu(hSettingsMenu, 0, MF_BYPOSITION);
}

if (GetMenuItemCount(hSettingsMenu) == 0)
{
DeleteMenu(hMenu,
IDM_SETTINGS,
MF_BYCOMMAND);
}
/* Network Connections */
if (SHRestricted(REST_NOSETFOLDERS) ||
SHRestricted(REST_NONETWORKCONNECTIONS) ||
!GetAdvancedBool(L"Start_ShowNetConn", TRUE))
{
DeleteMenu(hSettingsMenu, IDM_NETWORKCONNECTIONS, MF_BYCOMMAND);
}

/* Printers and Faxes */
if (SHRestricted(REST_NOSETFOLDERS) ||
!GetAdvancedBool(L"Start_ShowPrinters", TRUE))
{
DeleteMenu(hSettingsMenu, IDM_PRINTERSANDFAXES, MF_BYCOMMAND);
}

/* Security */
if (SHRestricted(REST_NOSETFOLDERS) ||
GetSystemMetrics(SM_REMOTECONTROL) == 0 ||
SHRestricted(REST_NOSECURITY))
{
DeleteMenu(hSettingsMenu, IDM_SECURITY, MF_BYCOMMAND);
}

/* Delete Settings menu if it was empty */
if (GetMenuItemCount(hSettingsMenu) == 0)
{
DeleteMenu(hMenu, IDM_SETTINGS, MF_BYCOMMAND);
}

/* Search */
if (SHRestricted(REST_NOFIND))
if (SHRestricted(REST_NOFIND) ||
!GetAdvancedBool(L"Start_ShowSearch", TRUE))
{
DeleteMenu(hMenu,
IDM_SEARCH,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_SEARCH, MF_BYCOMMAND);
}

/* FIXME: Help */
/* Help */
if (SHRestricted(REST_NOSMHELP) ||
!GetAdvancedBool(L"Start_ShowHelp", TRUE))
{
DeleteMenu(hMenu, IDM_HELPANDSUPPORT, MF_BYCOMMAND);
}

/* Run */
if (SHRestricted(REST_NORUN))
if (SHRestricted(REST_NORUN) ||
!GetAdvancedBool(L"StartMenuRun", TRUE))
{
DeleteMenu(hMenu,
IDM_RUN,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_RUN, MF_BYCOMMAND);
}

/* Synchronize */
if (!ShowSynchronizeMenuItem())
{
DeleteMenu(hMenu,
IDM_SYNCHRONIZE,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_SYNCHRONIZE, MF_BYCOMMAND);
uLastItemsCount--;
}

/* Log off */
dwLogoff = SHRestricted(REST_STARTMENULOGOFF);
bWantLogoff = (dwLogoff == 2 ||
SHRestricted(REST_FORCESTARTMENULOGOFF) ||
GetAdvancedBool(L"StartMenuLogoff", FALSE));
if (dwLogoff != 1 && bWantLogoff)
{
/* FIXME: We need a more sophisticated way to determine whether to show
Expand All @@ -248,53 +237,41 @@ class CStartMenuSite :
szUser))
{
/* We couldn't update the menu item, delete it... */
DeleteMenu(hMenu,
IDM_LOGOFF,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_LOGOFF, MF_BYCOMMAND);
}
}
else
{
DeleteMenu(hMenu,
IDM_LOGOFF,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_LOGOFF, MF_BYCOMMAND);
uLastItemsCount--;
}


/* Disconnect */
if (GetSystemMetrics(SM_REMOTECONTROL) == 0)
if (SHRestricted(REST_NODISCONNECT) ||
GetSystemMetrics(SM_REMOTECONTROL) == 0)
{
DeleteMenu(hMenu,
IDM_DISCONNECT,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_DISCONNECT, MF_BYCOMMAND);
uLastItemsCount--;
}

/* Undock computer */
if (!ShowUndockMenuItem())
{
DeleteMenu(hMenu,
IDM_UNDOCKCOMPUTER,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_UNDOCKCOMPUTER, MF_BYCOMMAND);
uLastItemsCount--;
}

/* Shut down */
if (SHRestricted(REST_NOCLOSE))
{
DeleteMenu(hMenu,
IDM_SHUTDOWN,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_SHUTDOWN, MF_BYCOMMAND);
uLastItemsCount--;
}

if (uLastItemsCount == 0)
{
/* Remove the separator at the end of the menu */
DeleteMenu(hMenu,
IDM_LASTSTARTMENU_SEPARATOR,
MF_BYCOMMAND);
DeleteMenu(hMenu, IDM_LASTSTARTMENU_SEPARATOR, MF_BYCOMMAND);
}

return S_OK;
Expand Down
2 changes: 1 addition & 1 deletion boot/boot_images.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function(add_user_profile_dirs _image_filelist _rootdir _username)
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
#file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") # CORE-12328
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n")
endfunction()
Expand Down
Loading

0 comments on commit eae90fb

Please sign in to comment.