diff --git a/dll/win32/shell32/wine/PolicyData.h b/dll/win32/shell32/wine/PolicyData.h new file mode 100644 index 00000000000..f106d28fcfd --- /dev/null +++ b/dll/win32/shell32/wine/PolicyData.h @@ -0,0 +1,307 @@ +/* + * PROJECT: ReactOS Shell32 + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Defining shell policy data + * COPYRIGHT: Copyright 2022 Hermès Bélusca-Maïto + * Copyright 2024 Katayama Hirofumi MZ + */ + +/* + * NOTE: Up to date as of SHELL32 v6.00 (Win2k3). + * References: + * https://www.geoffchappell.com/studies/windows/shell/shell32/api/util/restrictions.htm + * https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ne-shlobj_core-restrictions + * https://abi-laboratory.pro/compatibility/Windows_5.0_to_Windows_6.0/x86_64/headers_diff/shell32.dll/diff.html + */ + +DEFINE_POLICY( REST_NORUN, "Explorer", "NoRun" ), +DEFINE_POLICY( REST_NOCLOSE, "Explorer", "NoClose" ), +DEFINE_POLICY( REST_NOSAVESET, "Explorer", "NoSaveSettings" ), +DEFINE_POLICY( REST_NOFILEMENU, "Explorer", "NoFileMenu" ), +DEFINE_POLICY( REST_NOSETFOLDERS, "Explorer", "NoSetFolders" ), +DEFINE_POLICY( REST_NOSETTASKBAR, "Explorer", "NoSetTaskbar" ), +DEFINE_POLICY( REST_NODESKTOP, "Explorer", "NoDesktop" ), +DEFINE_POLICY( REST_NOFIND, "Explorer", "NoFind" ), +DEFINE_POLICY( REST_NODRIVES, "Explorer", "NoDrives" ), +DEFINE_POLICY( REST_NODRIVEAUTORUN, "Explorer", "NoDriveAutoRun" ), +DEFINE_POLICY( REST_NODRIVETYPEAUTORUN, "Explorer", "NoDriveTypeAutoRun" ), +DEFINE_POLICY( REST_NONETHOOD, "Explorer", "NoNetHood" ), +DEFINE_POLICY( REST_STARTBANNER, "Explorer", "NoStartBanner" ), +DEFINE_POLICY( REST_RESTRICTRUN, "Explorer", "RestrictRun" ), // REGSTR_VAL_RESTRICTRUN +DEFINE_POLICY( REST_NOPRINTERTABS, "Explorer", "NoPrinterTabs" ), // REGSTR_VAL_PRINTERS_HIDETABS +DEFINE_POLICY( REST_NOPRINTERDELETE, "Explorer", "NoDeletePrinter" ), // REGSTR_VAL_PRINTERS_NODELETE +DEFINE_POLICY( REST_NOPRINTERADD, "Explorer", "NoAddPrinter" ), // REGSTR_VAL_PRINTERS_NOADD +DEFINE_POLICY( REST_NOSTARTMENUSUBFOLDERS, "Explorer", "NoStartMenuSubFolders" ), +DEFINE_POLICY( REST_MYDOCSONNET, "Explorer", "MyDocsOnNet" ), +DEFINE_POLICY( REST_NOEXITTODOS, "WinOldApp", "NoRealMode" ), // REGSTR_VAL_WINOLDAPP_NOREALMODE +DEFINE_POLICY( REST_ENFORCESHELLEXTSECURITY, "Explorer", "EnforceShellExtensionSecurity" ), +DEFINE_POLICY( REST_LINKRESOLVEIGNORELINKINFO, "Explorer", "LinkResolveIgnoreLinkInfo" ), +DEFINE_POLICY( REST_NOCOMMONGROUPS, "Explorer", "NoCommonGroups" ), +DEFINE_POLICY( REST_SEPARATEDESKTOPPROCESS, "Explorer", "SeparateProcess" ), +DEFINE_POLICY( REST_NOWEB, "Explorer", "NoWebMenu" ), +DEFINE_POLICY( REST_NOTRAYCONTEXTMENU, "Explorer", "NoTrayContextMenu" ), +DEFINE_POLICY( REST_NOVIEWCONTEXTMENU, "Explorer", "NoViewContextMenu" ), +DEFINE_POLICY( REST_NONETCONNECTDISCONNECT, "Explorer", "NoNetConnectDisconnect" ), + +#if (WINE_FILEVERSION_MAJOR < 5) +// NOTE: This policy only controls the LogOff capability in the TaskMgr. +DEFINE_POLICY( REST_STARTMENULOGOFF, "Explorer", "NoLogoff" ), +#else +// NOTE: This policy now controls the presence/absence of the LogOff item in the Start Menu. +DEFINE_POLICY( REST_STARTMENULOGOFF, "Explorer", "StartMenuLogoff" ), +#endif + +DEFINE_POLICY( REST_NOSETTINGSASSIST, "Explorer", "NoSettingsWizards" ), +DEFINE_POLICY( REST_NOINTERNETICON, "Explorer", "NoInternetIcon" ), +DEFINE_POLICY( REST_NORECENTDOCSHISTORY, "Explorer", "NoRecentDocsHistory" ), +DEFINE_POLICY( REST_NORECENTDOCSMENU, "Explorer", "NoRecentDocsMenu" ), +DEFINE_POLICY( REST_NOACTIVEDESKTOP, "Explorer", "NoActiveDesktop" ), +DEFINE_POLICY( REST_NOACTIVEDESKTOPCHANGES, "Explorer", "NoActiveDesktopChanges" ), +DEFINE_POLICY( REST_NOFAVORITESMENU, "Explorer", "NoFavoritesMenu" ), +DEFINE_POLICY( REST_CLEARRECENTDOCSONEXIT, "Explorer", "ClearRecentDocsOnExit" ), +DEFINE_POLICY( REST_CLASSICSHELL, "Explorer", "ClassicShell" ), +DEFINE_POLICY( REST_NOCUSTOMIZEWEBVIEW, "Explorer", "NoCustomizeWebView" ), +DEFINE_POLICY( REST_NOHTMLWALLPAPER, "ActiveDesktop", "NoHTMLWallpaper" ), +DEFINE_POLICY( REST_NOCHANGINGWALLPAPER, "ActiveDesktop", "NoChangingWallpaper" ), +DEFINE_POLICY( REST_NODESKCOMP, "ActiveDesktop", "NoComponents" ), +DEFINE_POLICY( REST_NOADDDESKCOMP, "ActiveDesktop", "NoAddingComponents" ), +DEFINE_POLICY( REST_NODELDESKCOMP, "ActiveDesktop", "NoDeletingComponents" ), +DEFINE_POLICY( REST_NOCLOSEDESKCOMP, "ActiveDesktop", "NoClosingComponents" ), + +#if (WINE_FILEVERSION_MAJOR < 5) +DEFINE_POLICY( REST_NOCLOSE_DRAGDROPBAND, "ActiveDesktop", "NoCloseDragDropBands" ), +DEFINE_POLICY( REST_NOMOVINGBAND, "ActiveDesktop", "NoMovingBands" ), +#else +DEFINE_POLICY( REST_NOCLOSE_DRAGDROPBAND, "Explorer", "NoCloseDragDropBands" ), +DEFINE_POLICY( REST_NOMOVINGBAND, "Explorer", "NoMovingBands" ), +#endif + +DEFINE_POLICY( REST_NOEDITDESKCOMP, "ActiveDesktop", "NoEditingComponents" ), +DEFINE_POLICY( REST_NORESOLVESEARCH, "Explorer", "NoResolveSearch" ), +DEFINE_POLICY( REST_NORESOLVETRACK, "Explorer", "NoResolveTrack" ), +DEFINE_POLICY( REST_FORCECOPYACLWITHFILE, "Explorer", "ForceCopyACLWithFile" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOLOGO3CHANNELNOTIFY, "Explorer", "NoMSAppLogo5ChannelNotify" ), +#endif + +DEFINE_POLICY( REST_NOFORGETSOFTWAREUPDATE, "Explorer", "NoForgetSoftwareUpdate" ), +DEFINE_POLICY( REST_NOSETACTIVEDESKTOP, "Explorer", "NoSetActiveDesktop" ), +DEFINE_POLICY( REST_NOUPDATEWINDOWS, "Explorer", "NoWindowsUpdate" ), +DEFINE_POLICY( REST_NOCHANGESTARMENU, "Explorer", "NoChangeStartMenu" ), +DEFINE_POLICY( REST_NOFOLDEROPTIONS, "Explorer", "NoFolderOptions" ), +DEFINE_POLICY( REST_HASFINDCOMPUTERS, "Explorer", "FindComputers" ), +DEFINE_POLICY( REST_INTELLIMENUS, "Explorer", "IntelliMenus" ), +DEFINE_POLICY( REST_RUNDLGMEMCHECKBOX, "Explorer", "MemCheckBoxInRunDlg" ), +DEFINE_POLICY( REST_ARP_ShowPostSetup, "Uninstall", "ShowPostSetup" ), +DEFINE_POLICY( REST_NOCSC, "Explorer", "NoSyncAll" ), +DEFINE_POLICY( REST_NOCONTROLPANEL, "Explorer", "NoControlPanel" ), +DEFINE_POLICY( REST_ENUMWORKGROUP, "Explorer", "EnumWorkgroup" ), +DEFINE_POLICY( REST_ARP_NOARP, "Uninstall", "NoAddRemovePrograms" ), +DEFINE_POLICY( REST_ARP_NOREMOVEPAGE, "Uninstall", "NoRemovePage" ), +DEFINE_POLICY( REST_ARP_NOADDPAGE, "Uninstall", "NoAddPage" ), +DEFINE_POLICY( REST_ARP_NOWINSETUPPAGE, "Uninstall", "NoWindowsSetupPage" ), +DEFINE_POLICY( REST_GREYMSIADS, "Explorer", "GreyMSIAds" ), +DEFINE_POLICY( REST_NOCHANGEMAPPEDDRIVELABEL, "Explorer", "NoChangeMappedDriveLabel" ), +DEFINE_POLICY( REST_NOCHANGEMAPPEDDRIVECOMMENT, "Explorer", "NoChangeMappedDriveComment" ), +DEFINE_POLICY( REST_MaxRecentDocs, "Explorer", "MaxRecentDocs" ), +DEFINE_POLICY( REST_NONETWORKCONNECTIONS, "Explorer", "NoNetworkConnections" ), +DEFINE_POLICY( REST_FORCESTARTMENULOGOFF, "Explorer", "ForceStartMenuLogoff" ), +DEFINE_POLICY( REST_NOWEBVIEW, "Explorer", "NoWebView" ), +DEFINE_POLICY( REST_NOCUSTOMIZETHISFOLDER, "Explorer", "NoCustomizeThisFolder" ), +DEFINE_POLICY( REST_NOENCRYPTION, "Explorer", "NoEncryption" ), + +#if (WINE_FILEVERSION_MAJOR == 5) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_ALLOWFRENCHENCRYPTION, "Explorer", "AllowFrenchEncryption" ), +#endif + +DEFINE_POLICY( REST_DONTSHOWSUPERHIDDEN, "Explorer", "DontShowSuperHidden" ), +DEFINE_POLICY( REST_NOSHELLSEARCHBUTTON, "Explorer", "NoShellSearchButton" ), +DEFINE_POLICY( REST_NOHARDWARETAB, "Explorer", "NoHardwareTab" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NORUNASINSTALLPROMPT, "Explorer", "NoRunasInstallPrompt" ), +DEFINE_POLICY( REST_PROMPTRUNASINSTALLNETPATH, "Explorer", "PromptRunasInstallNetPath" ), +#endif + +DEFINE_POLICY( REST_NOMANAGEMYCOMPUTERVERB, "Explorer", "NoManageMyComputerVerb" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NORECENTDOCSNETHOOD, "Explorer", "NoRecentDocsNetHood" ), +#endif + +DEFINE_POLICY( REST_DISALLOWRUN, "Explorer", "DisallowRun" ), +DEFINE_POLICY( REST_NOWELCOMESCREEN, "Explorer", "NoWelcomeScreen" ), +DEFINE_POLICY( REST_RESTRICTCPL, "Explorer", "RestrictCpl" ), +DEFINE_POLICY( REST_DISALLOWCPL, "Explorer", "DisallowCpl" ), +DEFINE_POLICY( REST_NOSMBALLOONTIP, "Explorer", "NoSMBalloonTip" ), +DEFINE_POLICY( REST_NOSMHELP, "Explorer", "NoSMHelp" ), +DEFINE_POLICY( REST_NOWINKEYS, "Explorer", "NoWinKeys" ), +DEFINE_POLICY( REST_NOENCRYPTONMOVE, "Explorer", "NoEncryptOnMove" ), +DEFINE_POLICY( REST_NOLOCALMACHINERUN, "Explorer", "DisableLocalMachineRun" ), +DEFINE_POLICY( REST_NOCURRENTUSERRUN, "Explorer", "DisableCurrentUserRun" ), +DEFINE_POLICY( REST_NOLOCALMACHINERUNONCE, "Explorer", "DisableLocalMachineRunOnce" ), +DEFINE_POLICY( REST_NOCURRENTUSERRUNONCE, "Explorer", "DisableCurrentUserRunOnce" ), +DEFINE_POLICY( REST_FORCEACTIVEDESKTOPON, "Explorer", "ForceActiveDesktopOn" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOCOMPUTERSNEARME, "Explorer", "NoComputersNearMe" ), +#endif + +DEFINE_POLICY( REST_NOVIEWONDRIVE, "Explorer", "NoViewOnDrive" ), +DEFINE_POLICY( REST_NONETCRAWL, "Explorer", "NoNetCrawling" ), +DEFINE_POLICY( REST_NOSHAREDDOCUMENTS, "Explorer", "NoSharedDocuments" ), +DEFINE_POLICY( REST_NOSMMYDOCS, "Explorer", "NoSMMyDocs" ), +DEFINE_POLICY( REST_NOSMMYPICS, "Explorer", "NoSMMyPictures" ), +DEFINE_POLICY( REST_ALLOWBITBUCKDRIVES, "Explorer", "RecycleBinDrives" ), + +/* 0x4000050 - 0x4000060 */ +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NONLEGACYSHELLMODE, "Explorer", "NoneLegacyShellMode" ), +#endif + +DEFINE_POLICY( REST_NOCONTROLPANELBARRICADE, "Explorer", "NoControlPanelBarricade" ), + +// NOTE: REST_NOSTARTPAGE never really existed. + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOAUTOTRAYNOTIFY, "Explorer", "NoAutoTrayNotify" ), +DEFINE_POLICY( REST_NOTASKGROUPING, "Explorer", "NoTaskGrouping" ), +DEFINE_POLICY( REST_NOCDBURNING, "Explorer", "NoCDBurning" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_MYCOMPNOPROP, "Explorer", "NoPropertiesMyComputer" ), +DEFINE_POLICY( REST_MYDOCSNOPROP, "Explorer", "NoPropertiesMyDocuments" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOSTARTPANEL, "Explorer", "NoSimpleStartMenu" ), +DEFINE_POLICY( REST_NODISPLAYAPPEARANCEPAGE, "System", "NoDispAppearancePage" ), // REGSTR_VAL_DISPCPL_NOAPPEARANCEPAGE +DEFINE_POLICY( REST_NOTHEMESTAB, "Explorer", "NoThemesTab" ), +DEFINE_POLICY( REST_NOVISUALSTYLECHOICE, "System", "NoVisualStyleChoice" ), +DEFINE_POLICY( REST_NOSIZECHOICE, "System", "NoSizeChoice" ), +DEFINE_POLICY( REST_NOCOLORCHOICE, "System", "NoColorChoice" ), +DEFINE_POLICY( REST_SETVISUALSTYLE, "System", "SetVisualStyle" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_STARTRUNNOHOMEPATH, "Explorer", "StartRunNoHOMEPATH" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOUSERNAMEINSTARTPANEL, "Explorer", "NoUserNameInStartMenu" ), +DEFINE_POLICY( REST_NOMYCOMPUTERICON, "NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" ), +DEFINE_POLICY( REST_NOSMNETWORKPLACES, "Explorer", "NoStartMenuNetworkPlaces" ), +DEFINE_POLICY( REST_NOSMPINNEDLIST, "Explorer", "NoStartMenuPinnedList" ), +DEFINE_POLICY( REST_NOSMMYMUSIC, "Explorer", "NoStartMenuMyMusic" ), +DEFINE_POLICY( REST_NOSMEJECTPC, "Explorer", "NoStartMenuEjectPC" ), +DEFINE_POLICY( REST_NOSMMOREPROGRAMS, "Explorer", "NoStartMenuMorePrograms" ), +DEFINE_POLICY( REST_NOSMMFUPROGRAMS, "Explorer", "NoStartMenuMFUprogramsList" ), +DEFINE_POLICY( REST_NOTRAYITEMSDISPLAY, "Explorer", "NoTrayItemsDisplay" ), +DEFINE_POLICY( REST_NOTOOLBARSONTASKBAR, "Explorer", "NoToolbarsOnTaskbar" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_NOSMCONFIGUREPROGRAMS, "Explorer", "NoSMConfigurePrograms" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_HIDECLOCK, "Explorer", "HideClock" ), +DEFINE_POLICY( REST_NOLOWDISKSPACECHECKS, "Explorer", "NoLowDiskSpaceChecks" ), +#endif + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOENTIRENETWORK, "Network", "NoEntireNetwork" ), // REGSTR_VAL_NOENTIRENETWORK +DEFINE_POLICY( REST_NODESKTOPCLEANUP, "Explorer", "NoDesktopCleanupWizard" ), +#endif + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_BITBUCKNUKEONDELETE, "Explorer", "NoRecycleFiles" ), +DEFINE_POLICY( REST_BITBUCKCONFIRMDELETE, "Explorer", "ConfirmFileDelete" ), +DEFINE_POLICY( REST_BITBUCKNOPROP, "Explorer", "NoPropertiesRecycleBin" ), +DEFINE_POLICY( REST_NODISPBACKGROUND, "System", "NoDispBackgroundPage" ), // REGSTR_VAL_DISPCPL_NOBACKGROUNDPAGE +DEFINE_POLICY( REST_NODISPSCREENSAVEPG, "System", "NoDispScrSavPage" ), // REGSTR_VAL_DISPCPL_NOSCRSAVPAGE +DEFINE_POLICY( REST_NODISPSETTINGSPG, "System", "NoDispSettingsPage" ), // REGSTR_VAL_DISPCPL_NOSETTINGSPAGE +DEFINE_POLICY( REST_NODISPSCREENSAVEPREVIEW, "System", "NoScreenSavePreview" ), +DEFINE_POLICY( REST_NODISPLAYCPL, "System", "NoDispCPL" ), // REGSTR_VAL_DISPCPL_NODISPCPL +DEFINE_POLICY( REST_HIDERUNASVERB, "Explorer", "HideRunAsVerb" ), +DEFINE_POLICY( REST_NOTHUMBNAILCACHE, "Explorer", "NoThumbnailCache" ), +DEFINE_POLICY( REST_NOSTRCMPLOGICAL, "Explorer", "NoStrCmpLogical" ), +DEFINE_POLICY( REST_NOPUBLISHWIZARD, "Explorer", "NoPublishingWizard" ), +DEFINE_POLICY( REST_NOONLINEPRINTSWIZARD, "Explorer", "NoOnlinePrintsWizard" ), +DEFINE_POLICY( REST_NOWEBSERVICES, "Explorer", "NoWebServices" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_ALLOWUNHASHEDWEBVIEW, "Explorer", "AllowUnhashedWebView" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_ALLOWLEGACYWEBVIEW, "Explorer", "AllowLegacyWebView" ), +#endif + +DEFINE_POLICY( REST_REVERTWEBVIEWSECURITY, "Explorer", "RevertWebViewSecurity" ), +DEFINE_POLICY( REST_INHERITCONSOLEHANDLES, "Explorer", "InheritConsoleHandles" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_SORTMAXITEMCOUNT, "Explorer", "SortMaxItemCount" ), +#endif +DEFINE_POLICY( REST_NOREMOTERECURSIVEEVENTS, "Explorer", "NoRemoteRecursiveEvents" ), + +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_NOREMOTECHANGENOTIFY, "Explorer", "NoRemoteChangeNotify" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOSIMPLENETIDLIST, "Explorer", "NoSimpleNetIDList" ), +#endif + +// #if (NTDDI_VERSION < NTDDI_LONGHORN) +// NOTE: Geoff Chappell is inacurrate here. + DEFINE_POLICY( REST_NOENUMENTIRENETWORK, "Explorer", "NoEnumEntireNetwork" ), +// #endif + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NODETAILSTHUMBNAILONNETWORK, "Explorer", "NoDetailsThumbnailOnNetwork" ), +#endif + +DEFINE_POLICY( REST_NOINTERNETOPENWITH, "Explorer", "NoInternetOpenWith" ), + +#if (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_ALLOWLEGACYLMZBEHAVIOR, "Explorer", "AllowLegacyLMZBehavior" ), +#endif + +DEFINE_POLICY( REST_DONTRETRYBADNETNAME, "Explorer", "DontRetryBadNetName" ), +DEFINE_POLICY( REST_ALLOWFILECLSIDJUNCTIONS, "Explorer", "AllowFileCLSIDJunctions" ), +DEFINE_POLICY( REST_NOUPNPINSTALL, "Explorer", "NoUPnPInstallTask" ), + +// "NormalizeLinkNetPidls" only in version 6.0 from Windows XP SP3. + +#if (NTDDI_VERSION >= NTDDI_LONGHORN) +DEFINE_POLICY( REST_ARP_DONTGROUPPATCHES, "Uninstall", "DontGroupPatches" ), +DEFINE_POLICY( REST_ARP_NOCHOOSEPROGRAMSPAGE, "Uninstall", "NoChooseProgramsPage" ), +#endif + +// "AllowCLSIDPROGIDMapping" in Windows XP SP3 and Windows Server 2003 SP2 only. +// Maybe in Vista+ too? + +#endif // WINE_FILEVERSION_MAJOR + +/* 0x4000061 - 0x4000086 */ +DEFINE_POLICY( REST_NODISCONNECT, "Explorer", "NoDisconnect" ), +DEFINE_POLICY( REST_NOSECURITY, "Explorer", "NoNTSecurity" ), +DEFINE_POLICY( REST_NOFILEASSOCIATE, "Explorer", "NoFileAssociate" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +// #if (NTDDI_VERSION < NTDDI_LONGHORN) +// NOTE: Either Geoff Chappell or MSDN is inaccurate here. +DEFINE_POLICY( REST_ALLOWCOMMENTTOGGLE, "Explorer", "ToggleCommentPosition" ), +// #endif +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_USEDESKTOPINICACHE, "Explorer", "UseDesktopIniCache" ), +#endif + +// "NoNetFolderInfoTip" only in version 6.0 from Windows XP SP3. + +#endif // WINE_FILEVERSION_MAJOR + +// NOTE: This is a SHDOCVW-only policy. +// DEFINE_POLICY( 0x50000024, "Explorer", "NoFileUrl" ), diff --git a/dll/win32/shell32/wine/shpolicy.c b/dll/win32/shell32/wine/shpolicy.c index 1300a2e7aa9..7a24ef49b40 100644 --- a/dll/win32/shell32/wine/shpolicy.c +++ b/dll/win32/shell32/wine/shpolicy.c @@ -2,7 +2,7 @@ * shpolicy.c - Data for shell/system policies. * * Copyright 1999 Ian Schmidt - * Copyright 2022 Hermes Belusca-Maito + * Copyright 2024 Katayama Hirofumi MZ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,11 +26,6 @@ * would handle the many new policies introduced since then. * You could easily write one with the information in * this file... - * - * Up to date as of SHELL32 v6.00 (Win2k3) - * References: - * https://www.geoffchappell.com/studies/windows/shell/shell32/api/util/restrictions.htm - * https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ne-shlobj_core-restrictions */ #include @@ -43,1277 +38,90 @@ #include #include #include +#include +#include #include #include "shell32_main.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); -#define SHELL_NO_POLICY 0xffffffff +DEFINE_GUID(GUID_Restrictions, 0xA48F1A32, 0xA340, 0x11D1, 0xBC, 0x6B, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1); -typedef struct tagPOLICYDAT +#define DEFINE_POLICY(policy, appstr, keystr) \ + { policy, L##appstr, L##keystr } + +static const POLICYDATA s_PolicyTable[] = { - DWORD policy; /* policy value passed to SHRestricted */ - LPCSTR appstr; /* application str such as "Explorer" */ - LPCSTR keystr; /* name of the actual registry key / policy */ - DWORD cache; /* cached value or 0xffffffff for invalid */ -} POLICYDATA, *LPPOLICYDATA; - -/* application strings */ - -static const char strExplorer[] = {"Explorer"}; -static const char strActiveDesk[] = {"ActiveDesktop"}; -static const char strWinOldApp[] = {"WinOldApp"}; -#if (WINE_FILEVERSION_MAJOR < 6) -/* Windows 2000/Me SHELL32 uses "AddRemoveProgs" */ -static const char strAddRemoveProgs[] = {"AddRemoveProgs"}; -#else -static const char strAddRemoveProgs[] = {"Uninstall"}; -#endif -#ifdef __REACTOS__ -static const char strSystem[] = {"System"}; -#endif - -/* key strings */ - -#ifndef __REACTOS__ -static const char strNoFileURL[] = {"NoFileUrl"}; -#endif -static const char strNoFolderOptions[] = {"NoFolderOptions"}; -static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"}; -static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"}; -static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"}; -static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"}; -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) -static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"}; -#endif -static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"}; -static const char strNoResolveTrk[] = {"NoResolveTrack"}; -static const char strNoResolveSearch[] = {"NoResolveSearch"}; -static const char strNoEditComponent[] = {"NoEditingComponents"}; -static const char strNoMovingBand[] = {"NoMovingBands"}; -static const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"}; -static const char strNoCloseComponent[] = {"NoClosingComponents"}; -static const char strNoDelComponent[] = {"NoDeletingComponents"}; -static const char strNoAddComponent[] = {"NoAddingComponents"}; -static const char strNoComponent[] = {"NoComponents"}; -static const char strNoChangeWallpaper[] = {"NoChangingWallpaper"}; -static const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"}; -static const char strNoCustomWebView[] = {"NoCustomizeWebView"}; -static const char strClassicShell[] = {"ClassicShell"}; -static const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"}; -static const char strNoFavoritesMenu[] = {"NoFavoritesMenu"}; -static const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"}; -static const char strNoActiveDesktop[] = {"NoActiveDesktop"}; -static const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"}; -static const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"}; -static const char strNoInetIcon[] = {"NoInternetIcon"}; -static const char strNoSettingsWizard[] = {"NoSettingsWizards"}; -#if (WINE_FILEVERSION_MAJOR < 5) -// NOTE: This value now only controls the LogOff capability in the TaskMgr. -static const char strNoLogoff[] = {"NoLogoff"}; -#else -// NOTE: This is the new value that controls the presence/absence -// of the LogOff item in the Start Menu. -static const char strNoLogoff[] = {"StartMenuLogoff"}; -#endif -static const char strNoNetConDis[] = {"NoNetConnectDisconnect"}; -static const char strNoViewContextMenu[] = {"NoViewContextMenu"}; -static const char strNoTrayContextMenu[] = {"NoTrayContextMenu"}; -static const char strNoWebMenu[] = {"NoWebMenu"}; -static const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"}; -static const char strNoCommonGroups[] = {"NoCommonGroups"}; -static const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"}; -static const char strNoRealMode[] = {"NoRealMode"}; // REGSTR_VAL_WINOLDAPP_NOREALMODE -static const char strMyDocsOnNet[] = {"MyDocsOnNet"}; -static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"}; -static const char strNoAddPrinters[] = {"NoAddPrinter"}; // REGSTR_VAL_PRINTERS_NOADD -static const char strNoDeletePrinters[] = {"NoDeletePrinter"}; // REGSTR_VAL_PRINTERS_NODELETE -static const char strNoPrintTab[] = {"NoPrinterTabs"}; // REGSTR_VAL_PRINTERS_HIDETABS -static const char strRestrictRun[] = {"RestrictRun"}; // REGSTR_VAL_RESTRICTRUN -static const char strNoStartBanner[] = {"NoStartBanner"}; -static const char strNoNetworkNeighborhood[] = {"NoNetHood"}; -static const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"}; -static const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"}; -static const char strSeparateProcess[] = {"SeparateProcess"}; -static const char strNoDrives[] = {"NoDrives"}; -static const char strNoFind[] = {"NoFind"}; -static const char strNoDesktop[] = {"NoDesktop"}; -static const char strNoSetTaskBar[] = {"NoSetTaskbar"}; -static const char strNoSetFld[] = {"NoSetFolders"}; -static const char strNoFileMenu[] = {"NoFileMenu"}; -static const char strNoSaveSetting[] = {"NoSaveSettings"}; -static const char strNoClose[] = {"NoClose"}; -static const char strNoRun[] = {"NoRun"}; - -/* policy data array */ -static POLICYDATA sh32_policy_table[] = -{ - { - REST_NORUN, - strExplorer, - strNoRun, - SHELL_NO_POLICY - }, - { - REST_NOCLOSE, - strExplorer, - strNoClose, - SHELL_NO_POLICY - }, - { - REST_NOSAVESET, - strExplorer, - strNoSaveSetting, - SHELL_NO_POLICY - }, - { - REST_NOFILEMENU, - strExplorer, - strNoFileMenu, - SHELL_NO_POLICY - }, - { - REST_NOSETFOLDERS, - strExplorer, - strNoSetFld, - SHELL_NO_POLICY - }, - { - REST_NOSETTASKBAR, - strExplorer, - strNoSetTaskBar, - SHELL_NO_POLICY - }, - { - REST_NODESKTOP, - strExplorer, - strNoDesktop, - SHELL_NO_POLICY - }, - { - REST_NOFIND, - strExplorer, - strNoFind, - SHELL_NO_POLICY - }, - { - REST_NODRIVES, - strExplorer, - strNoDrives, - SHELL_NO_POLICY - }, - { - REST_NODRIVEAUTORUN, - strExplorer, - strNoDrivesAutoRun, - SHELL_NO_POLICY - }, - { - REST_NODRIVETYPEAUTORUN, - strExplorer, - strNoDriveTypeAtRun, - SHELL_NO_POLICY - }, - { - REST_NONETHOOD, - strExplorer, - strNoNetworkNeighborhood, - SHELL_NO_POLICY - }, - { - REST_STARTBANNER, - strExplorer, - strNoStartBanner, - SHELL_NO_POLICY - }, - { - REST_RESTRICTRUN, - strExplorer, - strRestrictRun, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERTABS, - strExplorer, - strNoPrintTab, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERDELETE, - strExplorer, - strNoDeletePrinters, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERADD, - strExplorer, - strNoAddPrinters, - SHELL_NO_POLICY - }, - { - REST_NOSTARTMENUSUBFOLDERS, - strExplorer, - strNoStartMenuSubfolder, - SHELL_NO_POLICY - }, - { - REST_MYDOCSONNET, - strExplorer, - strMyDocsOnNet, - SHELL_NO_POLICY - }, - { - REST_NOEXITTODOS, - strWinOldApp, - strNoRealMode, - SHELL_NO_POLICY - }, - { - REST_ENFORCESHELLEXTSECURITY, - strExplorer, - strEnforceShlExtSecurity, - SHELL_NO_POLICY - }, - { - REST_LINKRESOLVEIGNORELINKINFO, - strExplorer, - strLnkResolveIgnoreLnkInfo, - SHELL_NO_POLICY - }, - { - REST_NOCOMMONGROUPS, - strExplorer, - strNoCommonGroups, - SHELL_NO_POLICY - }, - { - REST_SEPARATEDESKTOPPROCESS, - strExplorer, - strSeparateProcess, - SHELL_NO_POLICY - }, - { - REST_NOWEB, - strExplorer, - strNoWebMenu, - SHELL_NO_POLICY - }, - { - REST_NOTRAYCONTEXTMENU, - strExplorer, - strNoTrayContextMenu, - SHELL_NO_POLICY - }, - { - REST_NOVIEWCONTEXTMENU, - strExplorer, - strNoViewContextMenu, - SHELL_NO_POLICY - }, - { - REST_NONETCONNECTDISCONNECT, - strExplorer, - strNoNetConDis, - SHELL_NO_POLICY - }, - { - REST_STARTMENULOGOFF, - strExplorer, - strNoLogoff, - SHELL_NO_POLICY - }, - { - REST_NOSETTINGSASSIST, - strExplorer, - strNoSettingsWizard, - SHELL_NO_POLICY - }, - { - REST_NOINTERNETICON, - strExplorer, - strNoInetIcon, - SHELL_NO_POLICY - }, - { - REST_NORECENTDOCSHISTORY, - strExplorer, - strNoRecentDocHistory, - SHELL_NO_POLICY - }, - { - REST_NORECENTDOCSMENU, - strExplorer, - strNoRecentDocMenu, - SHELL_NO_POLICY - }, - { - REST_NOACTIVEDESKTOP, - strExplorer, - strNoActiveDesktop, - SHELL_NO_POLICY - }, - { - REST_NOACTIVEDESKTOPCHANGES, - strExplorer, - strNoActiveDesktopChanges, - SHELL_NO_POLICY - }, - { - REST_NOFAVORITESMENU, - strExplorer, - strNoFavoritesMenu, - SHELL_NO_POLICY - }, - { - REST_CLEARRECENTDOCSONEXIT, - strExplorer, - strClearRecentDocs, - SHELL_NO_POLICY - }, - { - REST_CLASSICSHELL, - strExplorer, - strClassicShell, - SHELL_NO_POLICY - }, - { - REST_NOCUSTOMIZEWEBVIEW, - strExplorer, - strNoCustomWebView, - SHELL_NO_POLICY - }, - { - REST_NOHTMLWALLPAPER, - strActiveDesk, - strNoHTMLWallpaper, - SHELL_NO_POLICY - }, - { - REST_NOCHANGINGWALLPAPER, - strActiveDesk, - strNoChangeWallpaper, - SHELL_NO_POLICY - }, - { - REST_NODESKCOMP, - strActiveDesk, - strNoComponent, - SHELL_NO_POLICY - }, - { - REST_NOADDDESKCOMP, - strActiveDesk, - strNoAddComponent, - SHELL_NO_POLICY - }, - { - REST_NODELDESKCOMP, - strActiveDesk, - strNoDelComponent, - SHELL_NO_POLICY - }, - { - REST_NOCLOSEDESKCOMP, - strActiveDesk, - strNoCloseComponent, - SHELL_NO_POLICY - }, - { - REST_NOCLOSE_DRAGDROPBAND, -#if (WINE_FILEVERSION_MAJOR < 5) - strActiveDesk, -#else - strExplorer, -#endif - strNoCloseDragDrop, - SHELL_NO_POLICY - }, - { - REST_NOMOVINGBAND, -#if (WINE_FILEVERSION_MAJOR < 5) - strActiveDesk, -#else - strExplorer, -#endif - strNoMovingBand, - SHELL_NO_POLICY - }, - { - REST_NOEDITDESKCOMP, - strActiveDesk, - strNoEditComponent, - SHELL_NO_POLICY - }, - { - REST_NORESOLVESEARCH, - strExplorer, - strNoResolveSearch, - SHELL_NO_POLICY - }, - { - REST_NORESOLVETRACK, - strExplorer, - strNoResolveTrk, - SHELL_NO_POLICY - }, - { - REST_FORCECOPYACLWITHFILE, - strExplorer, - strForceCopyACLW, - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOLOGO3CHANNELNOTIFY, - strExplorer, - strNoMSAppLogo, - SHELL_NO_POLICY - }, -#endif - { - REST_NOFORGETSOFTWAREUPDATE, - strExplorer, - strNoForgetSoftwareUpdate, - SHELL_NO_POLICY - }, - { - REST_NOSETACTIVEDESKTOP, - strExplorer, - strNoSetActiveDesktop, - SHELL_NO_POLICY - }, - { - REST_NOUPDATEWINDOWS, - strExplorer, - strNoWindowsUpdate, - SHELL_NO_POLICY - }, - { - REST_NOCHANGESTARMENU, - strExplorer, - strNoChangeStartMenu, - SHELL_NO_POLICY - }, - { - REST_NOFOLDEROPTIONS, - strExplorer, - strNoFolderOptions, - SHELL_NO_POLICY - }, - { - REST_HASFINDCOMPUTERS, - strExplorer, - "FindComputers", - SHELL_NO_POLICY - }, - { - REST_INTELLIMENUS, - strExplorer, - "IntelliMenus", - SHELL_NO_POLICY - }, - { - REST_RUNDLGMEMCHECKBOX, - strExplorer, - "MemCheckBoxInRunDlg", - SHELL_NO_POLICY - }, - { - REST_ARP_ShowPostSetup, - strAddRemoveProgs, - "ShowPostSetup", - SHELL_NO_POLICY - }, - { - REST_NOCSC, - strExplorer, - "NoSyncAll", - SHELL_NO_POLICY - }, - { - REST_NOCONTROLPANEL, - strExplorer, - "NoControlPanel", - SHELL_NO_POLICY - }, - { - REST_ENUMWORKGROUP, - strExplorer, - "EnumWorkgroup", - SHELL_NO_POLICY - }, - { - REST_ARP_NOARP, - strAddRemoveProgs, - "NoAddRemovePrograms", - SHELL_NO_POLICY - }, - { - REST_ARP_NOREMOVEPAGE, - strAddRemoveProgs, - "NoRemovePage", - SHELL_NO_POLICY - }, - { - REST_ARP_NOADDPAGE, - strAddRemoveProgs, - "NoAddPage", - SHELL_NO_POLICY - }, - { - REST_ARP_NOWINSETUPPAGE, - strAddRemoveProgs, - "NoWindowsSetupPage", - SHELL_NO_POLICY - }, - { - REST_GREYMSIADS, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "", -#else - "GreyMSIAds", -#endif - SHELL_NO_POLICY - }, - { - REST_NOCHANGEMAPPEDDRIVELABEL, - strExplorer, - "NoChangeMappedDriveLabel", - SHELL_NO_POLICY - }, - { - REST_NOCHANGEMAPPEDDRIVECOMMENT, - strExplorer, - "NoChangeMappedDriveComment", - SHELL_NO_POLICY - }, - { - REST_MaxRecentDocs, - strExplorer, - "MaxRecentDocs", - SHELL_NO_POLICY - }, - { - REST_NONETWORKCONNECTIONS, - strExplorer, - "NoNetworkConnections", - SHELL_NO_POLICY - }, - { - REST_FORCESTARTMENULOGOFF, - strExplorer, - "ForceStartMenuLogoff", - SHELL_NO_POLICY - }, - { - REST_NOWEBVIEW, - strExplorer, - "NoWebView", - SHELL_NO_POLICY - }, - { - REST_NOCUSTOMIZETHISFOLDER, - strExplorer, - "NoCustomizeThisFolder", - SHELL_NO_POLICY - }, - { - REST_NOENCRYPTION, - strExplorer, - "NoEncryption", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR == 5) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_ALLOWFRENCHENCRYPTION, - strExplorer, - "AllowFrenchEncryption", - SHELL_NO_POLICY - }, -#endif - { - REST_DONTSHOWSUPERHIDDEN, - strExplorer, - "DontShowSuperHidden", - SHELL_NO_POLICY - }, - { - REST_NOSHELLSEARCHBUTTON, - strExplorer, - "NoShellSearchButton", - SHELL_NO_POLICY - }, - { - REST_NOHARDWARETAB, - strExplorer, - "NoHardwareTab", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NORUNASINSTALLPROMPT, - strExplorer, - "NoRunasInstallPrompt", - SHELL_NO_POLICY - }, - { - REST_PROMPTRUNASINSTALLNETPATH, - strExplorer, - "PromptRunasInstallNetPath", - SHELL_NO_POLICY - }, -#endif - { - REST_NOMANAGEMYCOMPUTERVERB, - strExplorer, - "NoManageMyComputerVerb", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NORECENTDOCSNETHOOD, - strExplorer, - "NoRecentDocsNetHood", - SHELL_NO_POLICY - }, -#endif - { - REST_DISALLOWRUN, - strExplorer, - "DisallowRun", - SHELL_NO_POLICY - }, - { - REST_NOWELCOMESCREEN, - strExplorer, - "NoWelcomeScreen", - SHELL_NO_POLICY - }, - { - REST_RESTRICTCPL, - strExplorer, - "RestrictCpl", - SHELL_NO_POLICY - }, - { - REST_DISALLOWCPL, - strExplorer, - "DisallowCpl", - SHELL_NO_POLICY - }, - { - REST_NOSMBALLOONTIP, - strExplorer, - "NoSMBalloonTip", - SHELL_NO_POLICY - }, - { - REST_NOSMHELP, - strExplorer, - "NoSMHelp", - SHELL_NO_POLICY - }, - { - REST_NOWINKEYS, - strExplorer, - "NoWinKeys", - SHELL_NO_POLICY - }, - { - REST_NOENCRYPTONMOVE, - strExplorer, - "NoEncryptOnMove", - SHELL_NO_POLICY - }, - { - REST_NOLOCALMACHINERUN, - strExplorer, - "DisableLocalMachineRun", - SHELL_NO_POLICY - }, - { - REST_NOCURRENTUSERRUN, - strExplorer, - "DisableCurrentUserRun", - SHELL_NO_POLICY - }, - { - REST_NOLOCALMACHINERUNONCE, - strExplorer, - "DisableLocalMachineRunOnce", - SHELL_NO_POLICY - }, - { - REST_NOCURRENTUSERRUNONCE, - strExplorer, - "DisableCurrentUserRunOnce", - SHELL_NO_POLICY - }, - { - REST_FORCEACTIVEDESKTOPON, - strExplorer, - "ForceActiveDesktopOn", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOCOMPUTERSNEARME, - strExplorer, - "NoComputersNearMe", - SHELL_NO_POLICY - }, -#endif - { - REST_NOVIEWONDRIVE, - strExplorer, - "NoViewOnDrive", - SHELL_NO_POLICY - }, - { - REST_NONETCRAWL, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "NoNetCrawl", -#else - "NoNetCrawling", -#endif - SHELL_NO_POLICY - }, - { - REST_NOSHAREDDOCUMENTS, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "NoSharedDocs", -#else - "NoSharedDocuments", -#endif - SHELL_NO_POLICY - }, - { - REST_NOSMMYDOCS, - strExplorer, - "NoSMMyDocs", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ - { - REST_NOSMMYPICS, - strExplorer, - "NoSMMyPictures", - SHELL_NO_POLICY - }, - { - REST_ALLOWBITBUCKDRIVES, - strExplorer, - "RecycleBinDrives", - SHELL_NO_POLICY - }, -#endif - -/* 0x4000050 - 0x4000060 */ -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NONLEGACYSHELLMODE, - strExplorer, - "NoneLegacyShellMode", - SHELL_NO_POLICY - }, -#endif - -#ifdef __REACTOS__ - - { - REST_NOCONTROLPANELBARRICADE, - strExplorer, - "NoControlPanelBarricade", - SHELL_NO_POLICY - }, - -// NOTE: REST_NOSTARTPAGE never really existed. - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOAUTOTRAYNOTIFY, - strExplorer, - "NoAutoTrayNotify", - SHELL_NO_POLICY - }, - { - REST_NOTASKGROUPING, - strExplorer, - "NoTaskGrouping", - SHELL_NO_POLICY - }, - { - REST_NOCDBURNING, - strExplorer, - "NoCDBurning", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - { - REST_MYCOMPNOPROP, - strExplorer, - "NoPropertiesMyComputer", - SHELL_NO_POLICY - }, - { - REST_MYDOCSNOPROP, - strExplorer, - "NoPropertiesMyDocuments", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOSTARTPANEL, - strExplorer, - "NoSimpleStartMenu", - SHELL_NO_POLICY - }, - { - REST_NODISPLAYAPPEARANCEPAGE, - strSystem, - "NoDispAppearancePage", // REGSTR_VAL_DISPCPL_NOAPPEARANCEPAGE - SHELL_NO_POLICY - }, - { - REST_NOTHEMESTAB, - strExplorer, - "NoThemesTab", - SHELL_NO_POLICY - }, - { - REST_NOVISUALSTYLECHOICE, - strSystem, - "NoVisualStyleChoice", - SHELL_NO_POLICY - }, - { - REST_NOSIZECHOICE, - strSystem, - "NoSizeChoice", - SHELL_NO_POLICY - }, - { - REST_NOCOLORCHOICE, - strSystem, - "NoColorChoice", - SHELL_NO_POLICY - }, - { - REST_SETVISUALSTYLE, - strSystem, - "SetVisualStyle", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - -#endif // __REACTOS__ - - { - REST_STARTRUNNOHOMEPATH, - strExplorer, - "StartRunNoHOMEPATH", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOUSERNAMEINSTARTPANEL, - strExplorer, - "NoUserNameInStartMenu", - SHELL_NO_POLICY - }, - { - REST_NOMYCOMPUTERICON, - "NonEnum", - "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", - SHELL_NO_POLICY - }, - { - REST_NOSMNETWORKPLACES, - strExplorer, - "NoStartMenuNetworkPlaces", - SHELL_NO_POLICY - }, - { - REST_NOSMPINNEDLIST, - strExplorer, - "NoStartMenuPinnedList", - SHELL_NO_POLICY - }, - { - REST_NOSMMYMUSIC, - strExplorer, - "NoStartMenuMyMusic", - SHELL_NO_POLICY - }, - { - REST_NOSMEJECTPC, - strExplorer, - "NoStartMenuEjectPC", - SHELL_NO_POLICY - }, - { - REST_NOSMMOREPROGRAMS, - strExplorer, - "NoStartMenuMorePrograms", - SHELL_NO_POLICY - }, - { - REST_NOSMMFUPROGRAMS, - strExplorer, - "NoStartMenuMFUprogramsList", - SHELL_NO_POLICY - }, - { - REST_NOTRAYITEMSDISPLAY, - strExplorer, - "NoTrayItemsDisplay", - SHELL_NO_POLICY - }, - { - REST_NOTOOLBARSONTASKBAR, - strExplorer, - "NoToolbarsOnTaskbar", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - - { - REST_NOSMCONFIGUREPROGRAMS, - strExplorer, - "NoSMConfigurePrograms", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_HIDECLOCK, - strExplorer, - "HideClock", - SHELL_NO_POLICY - }, - { - REST_NOLOWDISKSPACECHECKS, - strExplorer, - "NoLowDiskSpaceChecks", - SHELL_NO_POLICY - }, -#endif - -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOENTIRENETWORK, - "Network", - "NoEntireNetwork", // REGSTR_VAL_NOENTIRENETWORK - SHELL_NO_POLICY - }, - { - REST_NODESKTOPCLEANUP, - strExplorer, - "NoDesktopCleanupWizard", - SHELL_NO_POLICY - }, -#endif - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_BITBUCKNUKEONDELETE, - strExplorer, - "NoRecycleFiles", - SHELL_NO_POLICY - }, - { - REST_BITBUCKCONFIRMDELETE, - strExplorer, - "ConfirmFileDelete", - SHELL_NO_POLICY - }, - { - REST_BITBUCKNOPROP, - strExplorer, - "NoPropertiesRecycleBin", - SHELL_NO_POLICY - }, - { - REST_NODISPBACKGROUND, - strSystem, - "NoDispBackgroundPage", // REGSTR_VAL_DISPCPL_NOBACKGROUNDPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSCREENSAVEPG, - strSystem, - "NoDispScrSavPage", // REGSTR_VAL_DISPCPL_NOSCRSAVPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSETTINGSPG, - strSystem, - "NoDispSettingsPage", // REGSTR_VAL_DISPCPL_NOSETTINGSPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSCREENSAVEPREVIEW, - strSystem, - "NoScreenSavePreview", - SHELL_NO_POLICY - }, - { - REST_NODISPLAYCPL, - strSystem, - "NoDispCPL", // REGSTR_VAL_DISPCPL_NODISPCPL - SHELL_NO_POLICY - }, - { - REST_HIDERUNASVERB, - strExplorer, - "HideRunAsVerb", - SHELL_NO_POLICY - }, - { - REST_NOTHUMBNAILCACHE, - strExplorer, - "NoThumbnailCache", - SHELL_NO_POLICY - }, - { - REST_NOSTRCMPLOGICAL, - strExplorer, - "NoStrCmpLogical", - SHELL_NO_POLICY - }, - { - REST_NOPUBLISHWIZARD, - strExplorer, - "NoPublishingWizard", - SHELL_NO_POLICY - }, - { - REST_NOONLINEPRINTSWIZARD, - strExplorer, - "NoOnlinePrintsWizard", - SHELL_NO_POLICY - }, - { - REST_NOWEBSERVICES, - strExplorer, - "NoWebServices", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - - { - REST_ALLOWUNHASHEDWEBVIEW, - strExplorer, - "AllowUnhashedWebView", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_ALLOWLEGACYWEBVIEW, - strExplorer, - "AllowLegacyWebView", - SHELL_NO_POLICY - }, -#endif - { - REST_REVERTWEBVIEWSECURITY, - strExplorer, - "RevertWebViewSecurity", - SHELL_NO_POLICY - }, - { - REST_INHERITCONSOLEHANDLES, - strExplorer, - "InheritConsoleHandles", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_SORTMAXITEMCOUNT, - strExplorer, - "SortMaxItemCount", - SHELL_NO_POLICY - }, -#endif - { - REST_NOREMOTERECURSIVEEVENTS, - strExplorer, - "NoRemoteRecursiveEvents", - SHELL_NO_POLICY - }, - -#endif // WINE_FILEVERSION_MAJOR - - { - REST_NOREMOTECHANGENOTIFY, - strExplorer, - "NoRemoteChangeNotify", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOSIMPLENETIDLIST, - strExplorer, - "NoSimpleNetIDList", - SHELL_NO_POLICY - }, -#endif -// #if (NTDDI_VERSION < NTDDI_LONGHORN) -// NOTE: Geoff Chappell is inacurrate here. - { - REST_NOENUMENTIRENETWORK, - strExplorer, - "NoEnumEntireNetwork", - SHELL_NO_POLICY - }, -// #endif -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NODETAILSTHUMBNAILONNETWORK, - strExplorer, - "NoDetailsThumbnailOnNetwork", - SHELL_NO_POLICY - }, -#endif - { - REST_NOINTERNETOPENWITH, - strExplorer, - "NoInternetOpenWith", - SHELL_NO_POLICY - }, -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_ALLOWLEGACYLMZBEHAVIOR, - strExplorer, - "AllowLegacyLMZBehavior", - SHELL_NO_POLICY - }, -#endif - { - REST_DONTRETRYBADNETNAME, - strExplorer, - "DontRetryBadNetName", - SHELL_NO_POLICY - }, - { - REST_ALLOWFILECLSIDJUNCTIONS, - strExplorer, - "AllowFileCLSIDJunctions", - SHELL_NO_POLICY - }, - { - REST_NOUPNPINSTALL, - strExplorer, - "NoUPnPInstallTask", - SHELL_NO_POLICY - }, - -// "NormalizeLinkNetPidls" only in version 6.0 from Windows XP SP3. - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) - { - REST_ARP_DONTGROUPPATCHES, - strAddRemoveProgs, - "DontGroupPatches", - SHELL_NO_POLICY - }, - { - REST_ARP_NOCHOOSEPROGRAMSPAGE, - strAddRemoveProgs, - "NoChooseProgramsPage", - SHELL_NO_POLICY - }, -#endif - -// "AllowCLSIDPROGIDMapping" in Windows XP SP3 and Windows Server 2003 SP2 only. -// Maybe in Vista+ too? - -#endif // WINE_FILEVERSION_MAJOR - -#endif // __REACTOS__ - -/* 0x4000061 - 0x4000086 */ - { - REST_NODISCONNECT, - strExplorer, - "NoDisconnect", - SHELL_NO_POLICY - }, - { - REST_NOSECURITY, - strExplorer, - "NoNTSecurity", - SHELL_NO_POLICY - }, - { - REST_NOFILEASSOCIATE, - strExplorer, - "NoFileAssociate", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ - -#if (WINE_FILEVERSION_MAJOR >= 6) -// #if (NTDDI_VERSION < NTDDI_LONGHORN) -// NOTE: Either Geoff Chappell or MSDN is inacurrate here. - { - REST_ALLOWCOMMENTTOGGLE, - strExplorer, - "ToggleCommentPosition", - SHELL_NO_POLICY - }, -// #endif -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_USEDESKTOPINICACHE, - strExplorer, - "UseDesktopIniCache", - SHELL_NO_POLICY - }, -#endif - -// "NoNetFolderInfoTip" only in version 6.0 from Windows XP SP3. - -#endif // WINE_FILEVERSION_MAJOR - -#endif // __REACTOS__ - -#ifndef __REACTOS__ -// NOTE: This is a SHDOCVW-only policy. - { - 0x50000024, - strExplorer, - strNoFileURL, - SHELL_NO_POLICY - }, -#endif - - { - 0, - 0, - 0, - SHELL_NO_POLICY - } +#include "PolicyData.h" + { 0, NULL, NULL } }; +#undef DEFINE_POLICY + +/* + * The restriction-related variables + */ +HANDLE g_hRestGlobalCounter = NULL; +LONG g_nRestCountValue = -1; +DWORD g_RestValues[_countof(s_PolicyTable)] = { 0 }; + +/**************************************************************************** + * SHELL_GetCachedGlobalCounter + * + * Retrieves the global counter using cache in a thread-safe manner. + * If a cache of global counter exists, the function returns it. + * If there is no cache, the function creates a global counter. + * + * @param[in,out] phGlobalCounter The pointer to the handle of global counter. + * @param[in] rguid The GUID of global counter. + * @return The handle of the global counter. + * @implemented + */ +static HANDLE +SHELL_GetCachedGlobalCounter(_Inout_ HANDLE *phGlobalCounter, _In_ REFGUID rguid) +{ + HANDLE hGlobalCounter; + if (*phGlobalCounter) + return *phGlobalCounter; + hGlobalCounter = SHGlobalCounterCreate(rguid); + if (InterlockedCompareExchangePointer(phGlobalCounter, hGlobalCounter, NULL)) + CloseHandle(hGlobalCounter); + return *phGlobalCounter; +} + +/**************************************************************************** + * SHELL_GetRestrictionsCounter + * + * Retrieves the global counter for GUID_Restrictions using caching in a + * thread-safe manner. The variable g_hRestGlobalCounter is used for caching. + * + * @return The handle of the global counter. + * @see SHELL_GetCachedGlobalCounter + * @implemented + */ +static HANDLE SHELL_GetRestrictionsCounter(VOID) +{ + return SHELL_GetCachedGlobalCounter(&g_hRestGlobalCounter, &GUID_Restrictions); +} + +/**************************************************************************** + * SHELL_QueryRestrictionsChanged + * + * @return The value of the global counter for GUID_Restrictions. + * @see SHELL_GetRestrictionsCounter + * @implemented + */ +static BOOL SHELL_QueryRestrictionsChanged(VOID) +{ + LONG Value = SHGlobalCounterGetValue(SHELL_GetRestrictionsCounter()); + if (g_nRestCountValue == Value) + return FALSE; + + g_nRestCountValue = Value; + return TRUE; +} + /************************************************************************* * SHRestricted [SHELL32.100] * @@ -1335,64 +143,15 @@ static POLICYDATA sh32_policy_table[] = * b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ * c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press */ -DWORD WINAPI SHRestricted (RESTRICTIONS policy) +DWORD WINAPI SHRestricted (RESTRICTIONS rest) { - char regstr[256]; - HKEY xhkey; - DWORD retval, datsize = 4; - LPPOLICYDATA p; + TRACE("(0x%08lX)\n", rest); - TRACE("(%08x)\n", policy); + /* If restrictions from registry have changed, reset all cached values to SHELL_NO_POLICY */ + if (SHELL_QueryRestrictionsChanged()) + FillMemory(&g_RestValues, sizeof(g_RestValues), 0xFF); - /* scan to see if we know this policy ID */ - for (p = sh32_policy_table; p->policy; p++) - { - if (policy == p->policy) - { - break; - } - } - - if (p->policy == 0) - { - /* we don't know this policy, return 0 */ - TRACE("unknown policy: (%08x)\n", policy); - return 0; - } - - /* we have a known policy */ - - /* first check if this policy has been cached, return it if so */ - if (p->cache != SHELL_NO_POLICY) - { - return p->cache; - } - - lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); - lstrcatA(regstr, p->appstr); - - /* return 0 and don't set the cache if any registry errors occur */ -#ifndef __REACTOS__ - retval = 0; - if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) -#else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup() - // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm - retval = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regstr, 0, KEY_READ, &xhkey); - if (retval != ERROR_SUCCESS) - { - retval = RegOpenKeyExA(HKEY_CURRENT_USER, regstr, 0, KEY_READ, &xhkey); - if (retval != ERROR_SUCCESS) - return 0; - } -#endif - { - if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) - { - p->cache = retval; - } - RegCloseKey(xhkey); - } - return retval; + return SHRestrictionLookup(rest, NULL, s_PolicyTable, g_RestValues); } /************************************************************************* @@ -1402,7 +161,7 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy) * * PARAMS * unused [I] Reserved. - * inpRegKey [I] Registry key to scan. + * pszKey [I] Registry key to scan. * * RETURNS * Success: -1. The policy cache is initialised. @@ -1412,30 +171,16 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy) * NOTES * Exported by ordinal. Introduced in Win98. */ -BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey) +BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey) { - TRACE("(%p, %p)\n", unused, inpRegKey); + TRACE("(%p, %s)\n", unused, debugstr_w(pszKey)); - /* first check - if input is non-NULL and points to the secret - key string, then pass. Otherwise return 0. - */ - if (inpRegKey != NULL) - { - if (SHELL_OsIsUnicode()) - { - if (lstrcmpiW(inpRegKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && - lstrcmpiW(inpRegKey, L"Policy")) - /* doesn't match, fail */ - return FALSE; - } - else - { - if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && - lstrcmpiA(inpRegKey, "Policy")) - /* doesn't match, fail */ - return FALSE; - } - } + if (pszKey && + lstrcmpiW(L"Policy", pszKey) != 0 && + lstrcmpiW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies", pszKey) != 0) + { + return FALSE; + } - return TRUE; + return SHGlobalCounterIncrement(SHELL_GetRestrictionsCounter()); } diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index 37181442f48..bd25ca1144b 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -2665,6 +2665,7 @@ HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, DWORD dwExSt return hWnd; } +#ifndef __REACTOS__ /* The followings are defined in */ typedef struct tagPOLICYDATA { DWORD policy; /* flags value passed to SHRestricted */ @@ -2679,6 +2680,7 @@ static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\', 's','o','f','t','\\','W','i','n','d','o','w','s','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n', '\\','P','o','l','i','c','i','e','s',0}; +#endif /* ndef __REACTOS__ */ /************************************************************************* * @ [SHLWAPI.271] @@ -2695,6 +2697,25 @@ static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\', */ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpValue) { +#ifdef __REACTOS__ + WCHAR szPath[MAX_PATH]; + DWORD dwSize, dwValue = 0; + + TRACE("(%s, %s, %s)\n", debugstr_w(lpSubKey), debugstr_w(lpSubName), debugstr_w(lpValue)); + + if (!lpSubKey) + lpSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies"; + + PathCombineW(szPath, lpSubKey, lpSubName); + + dwSize = sizeof(dwValue); + if (SHGetValueW(HKEY_LOCAL_MACHINE, szPath, lpValue, NULL, &dwValue, &dwSize) == ERROR_SUCCESS) + return dwValue; + + dwSize = sizeof(dwValue); + SHGetValueW(HKEY_CURRENT_USER, szPath, lpValue, NULL, &dwValue, &dwSize); + return dwValue; +#else DWORD retval, datsize = sizeof(retval); HKEY hKey; @@ -2710,6 +2731,7 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal SHGetValueW(hKey, lpSubName, lpValue, NULL, &retval, &datsize); RegCloseKey(hKey); return retval; +#endif } /************************************************************************* @@ -2732,18 +2754,33 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal * different POLICYDATA structure and implements a similar algorithm adapted to * that structure. */ +#ifdef __REACTOS__ +DWORD WINAPI +SHRestrictionLookup( + _In_ DWORD policy, + _In_ LPCWSTR initial, + _In_ const POLICYDATA *polTable, + _Inout_ LPDWORD polArr) +#else DWORD WINAPI SHRestrictionLookup( DWORD policy, LPCWSTR initial, LPPOLICYDATA polTable, LPDWORD polArr) +#endif { TRACE("(0x%08x %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr); +#ifndef __REACTOS__ if (!polTable || !polArr) return 0; +#endif +#ifndef __REACTOS__ + for (;polTable->appstr; polTable++, polArr++) +#else for (;polTable->policy; polTable++, polArr++) +#endif { if (policy == polTable->policy) { diff --git a/sdk/include/psdk/shlobj.h b/sdk/include/psdk/shlobj.h index ba9f05b4878..3d27f328631 100644 --- a/sdk/include/psdk/shlobj.h +++ b/sdk/include/psdk/shlobj.h @@ -1832,11 +1832,11 @@ typedef enum RESTRICTIONS REST_NODETAILSTHUMBNAILONNETWORK = 0x40000094, #endif REST_NOINTERNETOPENWITH = 0x40000095, -#if (NTDDI_VERSION < NTDDI_VISTA) - REST_ALLOWLEGACYLMZBEHAVIOR = 0x40000096, /* not documented */ -#endif #endif #if (NTDDI_VERSION >= NTDDI_WINXPSP2) +#if (NTDDI_VERSION < NTDDI_VISTA) + REST_ALLOWLEGACYLMZBEHAVIOR = 0x4000009A, /* not documented */ +#endif REST_DONTRETRYBADNETNAME = 0x4000009B, REST_ALLOWFILECLSIDJUNCTIONS, REST_NOUPNPINSTALL, diff --git a/sdk/include/reactos/shlwapi_undoc.h b/sdk/include/reactos/shlwapi_undoc.h index 1a46c7b7438..746284d2cb4 100644 --- a/sdk/include/reactos/shlwapi_undoc.h +++ b/sdk/include/reactos/shlwapi_undoc.h @@ -25,6 +25,27 @@ extern "C" { #endif /* defined(__cplusplus) */ +#define SHELL_NO_POLICY ((DWORD)-1) + +typedef struct tagPOLICYDATA +{ + DWORD policy; /* flags value passed to SHRestricted */ + LPCWSTR appstr; /* application str such as "Explorer" */ + LPCWSTR keystr; /* name of the actual registry key / policy */ +} POLICYDATA, *LPPOLICYDATA; + +HANDLE WINAPI SHGlobalCounterCreate(REFGUID guid); +PVOID WINAPI SHInterlockedCompareExchange(PVOID *dest, PVOID xchg, PVOID compare); +LONG WINAPI SHGlobalCounterGetValue(HANDLE hGlobalCounter); +LONG WINAPI SHGlobalCounterIncrement(HANDLE hGlobalCounter); + +DWORD WINAPI +SHRestrictionLookup( + _In_ DWORD policy, + _In_ LPCWSTR key, + _In_ const POLICYDATA *polTable, + _Inout_ LPDWORD polArr); + BOOL WINAPI SHAboutInfoA(LPSTR lpszDest, DWORD dwDestLen); BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen); #ifdef UNICODE