📄 shpolicy.c
字号:
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,
"",
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
},
{
REST_ALLOWFRENCHENCRYPTION,
strExplorer,
"AllowFrenchEncryption",
SHELL_NO_POLICY
},
{
REST_DONTSHOWSUPERHIDDEN,
strExplorer,
"DontShowSuperHidden",
SHELL_NO_POLICY
},
{
REST_NOSHELLSEARCHBUTTON,
strExplorer,
"NoShellSearchButton",
SHELL_NO_POLICY
},
{
REST_NOHARDWARETAB,
strExplorer,
"NoHardwareTab",
SHELL_NO_POLICY
},
{
REST_NORUNASINSTALLPROMPT,
strExplorer,
"NoRunasInstallPrompt",
SHELL_NO_POLICY
},
{
REST_PROMPTRUNASINSTALLNETPATH,
strExplorer,
"PromptRunasInstallNetPath",
SHELL_NO_POLICY
},
{
REST_NOMANAGEMYCOMPUTERVERB,
strExplorer,
"NoManageMyComputerVerb",
SHELL_NO_POLICY
},
{
REST_NORECENTDOCSNETHOOD,
strExplorer,
"NoRecentDocsNetHood",
SHELL_NO_POLICY
},
{
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
},
{
REST_NOCOMPUTERSNEARME,
strExplorer,
"NoComputersNearMe",
SHELL_NO_POLICY
},
{
REST_NOVIEWONDRIVE,
strExplorer,
"NoViewOnDrive",
SHELL_NO_POLICY
},
{
REST_NONETCRAWL,
strExplorer,
"NoNetCrawl",
SHELL_NO_POLICY
},
{
REST_NOSHAREDDOCUMENTS,
strExplorer,
"NoSharedDocs",
SHELL_NO_POLICY
},
{
REST_NOSMMYDOCS,
strExplorer,
"NoSMMyDocs",
SHELL_NO_POLICY
},
/* 0x4000050 - 0x4000060 */
{
REST_NONLEGACYSHELLMODE,
strExplorer,
"NoneLegacyShellMode",
SHELL_NO_POLICY
},
{
REST_STARTRUNNOHOMEPATH,
strExplorer,
"StartRunNoHOMEPATH",
SHELL_NO_POLICY
},
/* 0x4000061 - 0x4000086 */
{
REST_NODISCONNECT,
strExplorer,
"NoDisconnect",
SHELL_NO_POLICY
},
{
REST_NOSECURITY,
strExplorer,
"NoNTSecurity",
SHELL_NO_POLICY
},
{
REST_NOFILEASSOCIATE,
strExplorer,
"NoFileAssociate",
SHELL_NO_POLICY
},
{
0x50000024,
strExplorer,
strNoFileURL,
SHELL_NO_POLICY
},
{
0,
0,
0,
SHELL_NO_POLICY
}
};
/*************************************************************************
* SHRestricted [SHELL32.100]
*
* Get the value associated with a policy Id.
*
* PARAMS
* pol [I] Policy Id
*
* RETURNS
* The queried value for the policy.
*
* NOTES
* Exported by ordinal.
* This function caches the retrieved values to prevent unnecessary registry access,
* if SHInitRestricted() was previously called.
*
* REFERENCES
* a: MS System Policy Editor.
* 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)
{
char regstr[256];
HKEY xhkey;
DWORD retval, datsize = 4;
LPPOLICYDATA p;
TRACE("(%08x)\n", policy);
/* 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, strRegistryPolicyA);
lstrcatA(regstr, p->appstr);
/* return 0 and don't set the cache if any registry errors occur */
retval = 0;
if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
{
if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
{
p->cache = retval;
}
RegCloseKey(xhkey);
}
return retval;
}
/*************************************************************************
* SHInitRestricted [SHELL32.244]
*
* Initialise the policy cache to speed up calls to SHRestricted().
*
* PARAMS
* unused [I] Reserved.
* inpRegKey [I] Registry key to scan.
*
* RETURNS
* Success: -1. The policy cache is initialised.
* Failure: 0, if inpRegKey is any value other than NULL, "Policy", or
* "Software\Microsoft\Windows\CurrentVersion\Policies".
*
* NOTES
* Exported by ordinal. Introduced in Win98.
*/
BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey)
{
TRACE("(%p, %p)\n", unused, inpRegKey);
/* 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((LPCWSTR)inpRegKey, strRegistryPolicyW) &&
lstrcmpiW((LPCWSTR)inpRegKey, strPolicyW))
/* doesn't match, fail */
return 0;
}
else
{
if (lstrcmpiA((LPCSTR)inpRegKey, strRegistryPolicyA) &&
lstrcmpiA((LPCSTR)inpRegKey, strPolicyA))
/* doesn't match, fail */
return 0;
}
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -