📄 shpolicy.c
字号:
/*
* shpolicy.c - Data for shell/system policies.
*
* Copyright 1999 Ian Schmidt <ischmidt@cfl.rr.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES:
*
* Some of these policies can be tweaked via the System Policy
* Editor which came with the Win95 Migration Guide, although
* there doesn't appear to be an updated Win98 version that
* 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 v5.00 (W2K)
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "shell32_main.h"
#include "shlobj.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
#define SHELL_NO_POLICY 0xffffffff
typedef struct tagPOLICYDAT
{
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;
/* registry strings */
static const CHAR strRegistryPolicyA[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
'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};
static const CHAR strPolicyA[] = "Policy";
static const WCHAR strPolicyW[] = {'P','o','l','i','c','y',0};
/* application strings */
static const char strExplorer[] = {"Explorer"};
static const char strActiveDesk[] = {"ActiveDesktop"};
static const char strWinOldApp[] = {"WinOldApp"};
static const char strAddRemoveProgs[] = {"AddRemoveProgs"};
/* key strings */
static const char strNoFileURL[] = {"NoFileUrl"};
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"};
static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"};
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"};
static const char strNoLogoff[] = {"NoLogoff"};
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"};
static const char strMyDocsOnNet[] = {"MyDocsOnNet"};
static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"};
static const char strNoAddPrinters[] = {"NoAddPrinter"};
static const char strNoDeletePrinters[] = {"NoDeletePrinter"};
static const char strNoPrintTab[] = {"NoPrinterTabs"};
static const char strRestrictRun[] = {"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 */
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,
strActiveDesk,
strNoCloseDragDrop,
SHELL_NO_POLICY
},
{
REST_NOMOVINGBAND,
strActiveDesk,
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
},
{
REST_NOLOGO3CHANNELNOTIFY,
strExplorer,
strNoMSAppLogo,
SHELL_NO_POLICY
},
{
REST_NOFORGETSOFTWAREUPDATE,
strExplorer,
strNoForgetSoftwareUpdate,
SHELL_NO_POLICY
},
{
REST_NOSETACTIVEDESKTOP,
strExplorer,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -