xref: /reactos/dll/win32/shell32/wine/shpolicy.c (revision 9d3c3a75)
1 /*
2  * shpolicy.c - Data for shell/system policies.
3  *
4  * Copyright 1999 Ian Schmidt <ischmidt@cfl.rr.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  * NOTES:
21  *
22  * Some of these policies can be tweaked via the System Policy
23  * Editor which came with the Win95 Migration Guide, although
24  * there doesn't appear to be an updated Win98 version that
25  * would handle the many new policies introduced since then.
26  * You could easily write one with the information in
27  * this file...
28  *
29  * Up to date as of SHELL32 v5.00 (W2K)
30  */
31 
32 #include <stdarg.h>
33 #include <stdlib.h>
34 #include <string.h>
35 
36 #define WIN32_NO_STATUS
37 #define _INC_WINDOWS
38 
39 #include <windef.h>
40 #include <winbase.h>
41 #include <shlobj.h>
42 #include <wine/debug.h>
43 
44 #include "shell32_main.h"
45 
46 WINE_DEFAULT_DEBUG_CHANNEL(shell);
47 
48 #define SHELL_NO_POLICY 0xffffffff
49 
50 typedef struct tagPOLICYDAT
51 {
52   DWORD policy;          /* policy value passed to SHRestricted */
53   LPCSTR appstr;         /* application str such as "Explorer" */
54   LPCSTR keystr;         /* name of the actual registry key / policy */
55   DWORD cache;           /* cached value or 0xffffffff for invalid */
56 } POLICYDATA, *LPPOLICYDATA;
57 
58 /* application strings */
59 
60 static const char strExplorer[] = {"Explorer"};
61 static const char strActiveDesk[] = {"ActiveDesktop"};
62 static const char strWinOldApp[] = {"WinOldApp"};
63 static const char strAddRemoveProgs[] = {"AddRemoveProgs"};
64 
65 /* key strings */
66 
67 static const char strNoFileURL[] = {"NoFileUrl"};
68 static const char strNoFolderOptions[] = {"NoFolderOptions"};
69 static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"};
70 static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"};
71 static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"};
72 static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"};
73 //static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"};
74 static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"};
75 static const char strNoResolveTrk[] = {"NoResolveTrack"};
76 static const char strNoResolveSearch[] = {"NoResolveSearch"};
77 static const char strNoEditComponent[] = {"NoEditingComponents"};
78 static const char strNoMovingBand[] = {"NoMovingBands"};
79 static const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"};
80 static const char strNoCloseComponent[] = {"NoClosingComponents"};
81 static const char strNoDelComponent[] = {"NoDeletingComponents"};
82 static const char strNoAddComponent[] = {"NoAddingComponents"};
83 static const char strNoComponent[] = {"NoComponents"};
84 static const char strNoChangeWallpaper[] = {"NoChangingWallpaper"};
85 static const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"};
86 static const char strNoCustomWebView[] = {"NoCustomizeWebView"};
87 static const char strClassicShell[] = {"ClassicShell"};
88 static const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"};
89 static const char strNoFavoritesMenu[] = {"NoFavoritesMenu"};
90 static const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"};
91 static const char strNoActiveDesktop[] = {"NoActiveDesktop"};
92 static const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"};
93 static const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"};
94 static const char strNoInetIcon[] = {"NoInternetIcon"};
95 static const char strNoSettingsWizard[] = {"NoSettingsWizards"};
96 static const char strNoLogoff[] = {"NoLogoff"};
97 static const char strNoNetConDis[] = {"NoNetConnectDisconnect"};
98 static const char strNoViewContextMenu[] = {"NoViewContextMenu"};
99 static const char strNoTrayContextMenu[] = {"NoTrayContextMenu"};
100 static const char strNoWebMenu[] = {"NoWebMenu"};
101 static const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"};
102 static const char strNoCommonGroups[] = {"NoCommonGroups"};
103 static const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"};
104 static const char strNoRealMode[] = {"NoRealMode"};
105 static const char strMyDocsOnNet[] = {"MyDocsOnNet"};
106 static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"};
107 static const char strNoAddPrinters[] = {"NoAddPrinter"};
108 static const char strNoDeletePrinters[] = {"NoDeletePrinter"};
109 static const char strNoPrintTab[] = {"NoPrinterTabs"};
110 static const char strRestrictRun[] = {"RestrictRun"};
111 static const char strNoStartBanner[] = {"NoStartBanner"};
112 static const char strNoNetworkNeighborhood[] = {"NoNetHood"};
113 static const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"};
114 static const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"};
115 static const char strSeparateProcess[] = {"SeparateProcess"};
116 static const char strNoDrives[] = {"NoDrives"};
117 static const char strNoFind[] = {"NoFind"};
118 static const char strNoDesktop[] = {"NoDesktop"};
119 static const char strNoSetTaskBar[] = {"NoSetTaskbar"};
120 static const char strNoSetFld[] = {"NoSetFolders"};
121 static const char strNoFileMenu[] = {"NoFileMenu"};
122 static const char strNoSaveSetting[] = {"NoSaveSettings"};
123 static const char strNoClose[] = {"NoClose"};
124 static const char strNoRun[] = {"NoRun"};
125 #ifdef __REACTOS__
126 static const char strNoSimpleStartMenu[] = {"NoSimpleStartMenu"};
127 #endif
128 
129 /* policy data array */
130 static POLICYDATA sh32_policy_table[] =
131 {
132   {
133     REST_NORUN,
134     strExplorer,
135     strNoRun,
136     SHELL_NO_POLICY
137   },
138   {
139     REST_NOCLOSE,
140     strExplorer,
141     strNoClose,
142     SHELL_NO_POLICY
143   },
144   {
145     REST_NOSAVESET,
146     strExplorer,
147     strNoSaveSetting,
148     SHELL_NO_POLICY
149   },
150   {
151     REST_NOFILEMENU,
152     strExplorer,
153     strNoFileMenu,
154     SHELL_NO_POLICY
155   },
156   {
157     REST_NOSETFOLDERS,
158     strExplorer,
159     strNoSetFld,
160     SHELL_NO_POLICY
161   },
162   {
163     REST_NOSETTASKBAR,
164     strExplorer,
165     strNoSetTaskBar,
166     SHELL_NO_POLICY
167   },
168   {
169     REST_NODESKTOP,
170     strExplorer,
171     strNoDesktop,
172     SHELL_NO_POLICY
173   },
174   {
175     REST_NOFIND,
176     strExplorer,
177     strNoFind,
178     SHELL_NO_POLICY
179   },
180   {
181     REST_NODRIVES,
182     strExplorer,
183     strNoDrives,
184     SHELL_NO_POLICY
185   },
186   {
187     REST_NODRIVEAUTORUN,
188     strExplorer,
189     strNoDrivesAutoRun,
190     SHELL_NO_POLICY
191   },
192   {
193     REST_NODRIVETYPEAUTORUN,
194     strExplorer,
195     strNoDriveTypeAtRun,
196     SHELL_NO_POLICY
197   },
198   {
199     REST_NONETHOOD,
200     strExplorer,
201     strNoNetworkNeighborhood,
202     SHELL_NO_POLICY
203   },
204   {
205     REST_STARTBANNER,
206     strExplorer,
207     strNoStartBanner,
208     SHELL_NO_POLICY
209   },
210   {
211     REST_RESTRICTRUN,
212     strExplorer,
213     strRestrictRun,
214     SHELL_NO_POLICY
215   },
216   {
217     REST_NOPRINTERTABS,
218     strExplorer,
219     strNoPrintTab,
220     SHELL_NO_POLICY
221   },
222   {
223     REST_NOPRINTERDELETE,
224     strExplorer,
225     strNoDeletePrinters,
226     SHELL_NO_POLICY
227   },
228   {
229     REST_NOPRINTERADD,
230     strExplorer,
231     strNoAddPrinters,
232     SHELL_NO_POLICY
233   },
234   {
235     REST_NOSTARTMENUSUBFOLDERS,
236     strExplorer,
237     strNoStartMenuSubfolder,
238     SHELL_NO_POLICY
239   },
240   {
241     REST_MYDOCSONNET,
242     strExplorer,
243     strMyDocsOnNet,
244     SHELL_NO_POLICY
245   },
246   {
247     REST_NOEXITTODOS,
248     strWinOldApp,
249     strNoRealMode,
250     SHELL_NO_POLICY
251   },
252   {
253     REST_ENFORCESHELLEXTSECURITY,
254     strExplorer,
255     strEnforceShlExtSecurity,
256     SHELL_NO_POLICY
257   },
258   {
259     REST_LINKRESOLVEIGNORELINKINFO,
260     strExplorer,
261     strLnkResolveIgnoreLnkInfo,
262     SHELL_NO_POLICY
263   },
264   {
265     REST_NOCOMMONGROUPS,
266     strExplorer,
267     strNoCommonGroups,
268     SHELL_NO_POLICY
269   },
270   {
271     REST_SEPARATEDESKTOPPROCESS,
272     strExplorer,
273     strSeparateProcess,
274     SHELL_NO_POLICY
275   },
276   {
277     REST_NOWEB,
278     strExplorer,
279     strNoWebMenu,
280     SHELL_NO_POLICY
281   },
282   {
283     REST_NOTRAYCONTEXTMENU,
284     strExplorer,
285     strNoTrayContextMenu,
286     SHELL_NO_POLICY
287   },
288   {
289     REST_NOVIEWCONTEXTMENU,
290     strExplorer,
291     strNoViewContextMenu,
292     SHELL_NO_POLICY
293   },
294   {
295     REST_NONETCONNECTDISCONNECT,
296     strExplorer,
297     strNoNetConDis,
298     SHELL_NO_POLICY
299   },
300   {
301     REST_STARTMENULOGOFF,
302     strExplorer,
303     strNoLogoff,
304     SHELL_NO_POLICY
305   },
306   {
307     REST_NOSETTINGSASSIST,
308     strExplorer,
309     strNoSettingsWizard,
310     SHELL_NO_POLICY
311   },
312   {
313     REST_NOINTERNETICON,
314     strExplorer,
315     strNoInetIcon,
316     SHELL_NO_POLICY
317   },
318   {
319     REST_NORECENTDOCSHISTORY,
320     strExplorer,
321     strNoRecentDocHistory,
322     SHELL_NO_POLICY
323   },
324   {
325     REST_NORECENTDOCSMENU,
326     strExplorer,
327     strNoRecentDocMenu,
328     SHELL_NO_POLICY
329   },
330   {
331     REST_NOACTIVEDESKTOP,
332     strExplorer,
333     strNoActiveDesktop,
334     SHELL_NO_POLICY
335   },
336   {
337     REST_NOACTIVEDESKTOPCHANGES,
338     strExplorer,
339     strNoActiveDesktopChanges,
340     SHELL_NO_POLICY
341   },
342   {
343     REST_NOFAVORITESMENU,
344     strExplorer,
345     strNoFavoritesMenu,
346     SHELL_NO_POLICY
347   },
348   {
349     REST_CLEARRECENTDOCSONEXIT,
350     strExplorer,
351     strClearRecentDocs,
352     SHELL_NO_POLICY
353   },
354   {
355     REST_CLASSICSHELL,
356     strExplorer,
357     strClassicShell,
358     SHELL_NO_POLICY
359   },
360   {
361     REST_NOCUSTOMIZEWEBVIEW,
362     strExplorer,
363     strNoCustomWebView,
364     SHELL_NO_POLICY
365   },
366   {
367     REST_NOHTMLWALLPAPER,
368     strActiveDesk,
369     strNoHTMLWallpaper,
370     SHELL_NO_POLICY
371   },
372   {
373     REST_NOCHANGINGWALLPAPER,
374     strActiveDesk,
375     strNoChangeWallpaper,
376     SHELL_NO_POLICY
377   },
378   {
379     REST_NODESKCOMP,
380     strActiveDesk,
381     strNoComponent,
382     SHELL_NO_POLICY
383   },
384   {
385     REST_NOADDDESKCOMP,
386     strActiveDesk,
387     strNoAddComponent,
388     SHELL_NO_POLICY
389   },
390   {
391     REST_NODELDESKCOMP,
392     strActiveDesk,
393     strNoDelComponent,
394     SHELL_NO_POLICY
395   },
396   {
397     REST_NOCLOSEDESKCOMP,
398     strActiveDesk,
399     strNoCloseComponent,
400     SHELL_NO_POLICY
401   },
402   {
403     REST_NOCLOSE_DRAGDROPBAND,
404     strActiveDesk,
405     strNoCloseDragDrop,
406     SHELL_NO_POLICY
407   },
408   {
409     REST_NOMOVINGBAND,
410     strActiveDesk,
411     strNoMovingBand,
412     SHELL_NO_POLICY
413   },
414   {
415     REST_NOEDITDESKCOMP,
416     strActiveDesk,
417     strNoEditComponent,
418     SHELL_NO_POLICY
419   },
420   {
421     REST_NORESOLVESEARCH,
422     strExplorer,
423     strNoResolveSearch,
424     SHELL_NO_POLICY
425   },
426   {
427     REST_NORESOLVETRACK,
428     strExplorer,
429     strNoResolveTrk,
430     SHELL_NO_POLICY
431   },
432   {
433     REST_FORCECOPYACLWITHFILE,
434     strExplorer,
435     strForceCopyACLW,
436     SHELL_NO_POLICY
437   },
438 #if (NTDDI_VERSION < NTDDI_LONGHORN)
439   {
440     REST_NOLOGO3CHANNELNOTIFY,
441     strExplorer,
442     strNoMSAppLogo,
443     SHELL_NO_POLICY
444   },
445 #endif
446   {
447     REST_NOFORGETSOFTWAREUPDATE,
448     strExplorer,
449     strNoForgetSoftwareUpdate,
450     SHELL_NO_POLICY
451   },
452   {
453     REST_NOSETACTIVEDESKTOP,
454     strExplorer,
455     strNoSetActiveDesktop,
456     SHELL_NO_POLICY
457   },
458   {
459     REST_NOUPDATEWINDOWS,
460     strExplorer,
461     strNoWindowsUpdate,
462     SHELL_NO_POLICY
463   },
464   {
465     REST_NOCHANGESTARMENU,
466     strExplorer,
467     strNoChangeStartMenu,
468     SHELL_NO_POLICY
469   },
470   {
471     REST_NOFOLDEROPTIONS,
472     strExplorer,
473     strNoFolderOptions,
474     SHELL_NO_POLICY
475   },
476   {
477     REST_HASFINDCOMPUTERS,
478     strExplorer,
479     "FindComputers",
480     SHELL_NO_POLICY
481   },
482   {
483     REST_INTELLIMENUS,
484     strExplorer,
485     "IntelliMenus",
486     SHELL_NO_POLICY
487   },
488   {
489     REST_RUNDLGMEMCHECKBOX,
490     strExplorer,
491     "MemCheckBoxInRunDlg",
492     SHELL_NO_POLICY
493   },
494   {
495     REST_ARP_ShowPostSetup,
496     strAddRemoveProgs,
497     "ShowPostSetup",
498     SHELL_NO_POLICY
499   },
500   {
501     REST_NOCSC,
502     strExplorer,
503     "NoSyncAll",
504     SHELL_NO_POLICY
505   },
506   {
507     REST_NOCONTROLPANEL,
508     strExplorer,
509     "NoControlPanel",
510     SHELL_NO_POLICY
511   },
512   {
513     REST_ENUMWORKGROUP,
514     strExplorer,
515     "EnumWorkgroup",
516     SHELL_NO_POLICY
517   },
518   {
519     REST_ARP_NOARP,
520     strAddRemoveProgs,
521     "NoAddRemovePrograms",
522     SHELL_NO_POLICY
523   },
524   {
525     REST_ARP_NOREMOVEPAGE,
526     strAddRemoveProgs,
527     "NoRemovePage",
528     SHELL_NO_POLICY
529   },
530   {
531     REST_ARP_NOADDPAGE,
532     strAddRemoveProgs,
533     "NoAddPage",
534     SHELL_NO_POLICY
535   },
536   {
537     REST_ARP_NOWINSETUPPAGE,
538     strAddRemoveProgs,
539     "NoWindowsSetupPage",
540     SHELL_NO_POLICY
541   },
542   {
543     REST_GREYMSIADS,
544     strExplorer,
545     "",
546     SHELL_NO_POLICY
547   },
548   {
549     REST_NOCHANGEMAPPEDDRIVELABEL,
550     strExplorer,
551     "NoChangeMappedDriveLabel",
552     SHELL_NO_POLICY
553   },
554   {
555     REST_NOCHANGEMAPPEDDRIVECOMMENT,
556     strExplorer,
557     "NoChangeMappedDriveComment",
558     SHELL_NO_POLICY
559   },
560   {
561     REST_MaxRecentDocs,
562     strExplorer,
563     "MaxRecentDocs",
564     SHELL_NO_POLICY
565   },
566   {
567     REST_NONETWORKCONNECTIONS,
568     strExplorer,
569     "NoNetworkConnections",
570     SHELL_NO_POLICY
571   },
572   {
573     REST_FORCESTARTMENULOGOFF,
574     strExplorer,
575     "ForceStartMenuLogoff",
576     SHELL_NO_POLICY
577   },
578   {
579     REST_NOWEBVIEW,
580     strExplorer,
581      "NoWebView",
582     SHELL_NO_POLICY
583   },
584   {
585     REST_NOCUSTOMIZETHISFOLDER,
586     strExplorer,
587     "NoCustomizeThisFolder",
588     SHELL_NO_POLICY
589   },
590   {
591     REST_NOENCRYPTION,
592     strExplorer,
593     "NoEncryption",
594     SHELL_NO_POLICY
595   },
596   {
597     REST_ALLOWFRENCHENCRYPTION,
598     strExplorer,
599     "AllowFrenchEncryption",
600     SHELL_NO_POLICY
601   },
602   {
603     REST_DONTSHOWSUPERHIDDEN,
604     strExplorer,
605     "DontShowSuperHidden",
606     SHELL_NO_POLICY
607   },
608   {
609     REST_NOSHELLSEARCHBUTTON,
610     strExplorer,
611     "NoShellSearchButton",
612     SHELL_NO_POLICY
613   },
614   {
615     REST_NOHARDWARETAB,
616     strExplorer,
617     "NoHardwareTab",
618     SHELL_NO_POLICY
619   },
620   {
621     REST_NORUNASINSTALLPROMPT,
622     strExplorer,
623     "NoRunasInstallPrompt",
624     SHELL_NO_POLICY
625   },
626   {
627     REST_PROMPTRUNASINSTALLNETPATH,
628     strExplorer,
629     "PromptRunasInstallNetPath",
630     SHELL_NO_POLICY
631   },
632   {
633     REST_NOMANAGEMYCOMPUTERVERB,
634     strExplorer,
635     "NoManageMyComputerVerb",
636     SHELL_NO_POLICY
637   },
638   {
639     REST_NORECENTDOCSNETHOOD,
640     strExplorer,
641     "NoRecentDocsNetHood",
642     SHELL_NO_POLICY
643   },
644   {
645     REST_DISALLOWRUN,
646     strExplorer,
647     "DisallowRun",
648     SHELL_NO_POLICY
649   },
650   {
651     REST_NOWELCOMESCREEN,
652     strExplorer,
653     "NoWelcomeScreen",
654     SHELL_NO_POLICY
655   },
656   {
657     REST_RESTRICTCPL,
658     strExplorer,
659     "RestrictCpl",
660     SHELL_NO_POLICY
661   },
662   {
663     REST_DISALLOWCPL,
664     strExplorer,
665     "DisallowCpl",
666     SHELL_NO_POLICY
667   },
668   {
669     REST_NOSMBALLOONTIP,
670     strExplorer,
671     "NoSMBalloonTip",
672     SHELL_NO_POLICY
673   },
674   {
675     REST_NOSMHELP,
676     strExplorer,
677     "NoSMHelp",
678     SHELL_NO_POLICY
679   },
680   {
681     REST_NOWINKEYS,
682     strExplorer,
683     "NoWinKeys",
684     SHELL_NO_POLICY
685   },
686   {
687     REST_NOENCRYPTONMOVE,
688     strExplorer,
689     "NoEncryptOnMove",
690     SHELL_NO_POLICY
691   },
692   {
693     REST_NOLOCALMACHINERUN,
694     strExplorer,
695     "DisableLocalMachineRun",
696     SHELL_NO_POLICY
697   },
698   {
699     REST_NOCURRENTUSERRUN,
700     strExplorer,
701     "DisableCurrentUserRun",
702     SHELL_NO_POLICY
703   },
704   {
705     REST_NOLOCALMACHINERUNONCE,
706     strExplorer,
707     "DisableLocalMachineRunOnce",
708     SHELL_NO_POLICY
709   },
710   {
711     REST_NOCURRENTUSERRUNONCE,
712     strExplorer,
713     "DisableCurrentUserRunOnce",
714     SHELL_NO_POLICY
715   },
716   {
717     REST_FORCEACTIVEDESKTOPON,
718     strExplorer,
719     "ForceActiveDesktopOn",
720     SHELL_NO_POLICY
721   },
722   {
723     REST_NOCOMPUTERSNEARME,
724     strExplorer,
725     "NoComputersNearMe",
726     SHELL_NO_POLICY
727   },
728   {
729     REST_NOVIEWONDRIVE,
730     strExplorer,
731     "NoViewOnDrive",
732     SHELL_NO_POLICY
733   },
734   {
735     REST_NONETCRAWL,
736     strExplorer,
737     "NoNetCrawl",
738     SHELL_NO_POLICY
739   },
740   {
741     REST_NOSHAREDDOCUMENTS,
742     strExplorer,
743     "NoSharedDocs",
744     SHELL_NO_POLICY
745   },
746   {
747     REST_NOSMMYDOCS,
748     strExplorer,
749     "NoSMMyDocs",
750     SHELL_NO_POLICY
751   },
752 /* 0x4000050 - 0x4000060 */
753   {
754     REST_NONLEGACYSHELLMODE,
755     strExplorer,
756     "NoneLegacyShellMode",
757     SHELL_NO_POLICY
758   },
759 #ifdef __REACTOS__
760   {
761     REST_NOSTARTPANEL,
762     strExplorer,
763     strNoSimpleStartMenu,
764     SHELL_NO_POLICY
765   },
766 #endif
767   {
768     REST_STARTRUNNOHOMEPATH,
769     strExplorer,
770     "StartRunNoHOMEPATH",
771     SHELL_NO_POLICY
772   },
773 /* 0x4000061 - 0x4000086 */
774   {
775     REST_NODISCONNECT,
776     strExplorer,
777     "NoDisconnect",
778     SHELL_NO_POLICY
779   },
780   {
781     REST_NOSECURITY,
782     strExplorer,
783     "NoNTSecurity",
784     SHELL_NO_POLICY
785   },
786   {
787     REST_NOFILEASSOCIATE,
788     strExplorer,
789     "NoFileAssociate",
790     SHELL_NO_POLICY
791   },
792   {
793     0x50000024,
794     strExplorer,
795     strNoFileURL,
796     SHELL_NO_POLICY
797   },
798   {
799     0,
800     0,
801     0,
802     SHELL_NO_POLICY
803   }
804 };
805 
806 /*************************************************************************
807  * SHRestricted				 [SHELL32.100]
808  *
809  * Get the value associated with a policy Id.
810  *
811  * PARAMS
812  *     pol [I] Policy Id
813  *
814  * RETURNS
815  *     The queried value for the policy.
816  *
817  * NOTES
818  *     Exported by ordinal.
819  *     This function caches the retrieved values to prevent unnecessary registry access,
820  *     if SHSettingsChanged() was previously called.
821  *
822  * REFERENCES
823  *     a: MS System Policy Editor.
824  *     b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
825  *     c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press
826  */
827 DWORD WINAPI SHRestricted (RESTRICTIONS policy)
828 {
829 	char regstr[256];
830 	HKEY    xhkey;
831 	DWORD   retval, datsize = 4;
832 	LPPOLICYDATA p;
833 
834 	TRACE("(%08x)\n", policy);
835 
836 	/* scan to see if we know this policy ID */
837 	for (p = sh32_policy_table; p->policy; p++)
838 	{
839 	  if (policy == p->policy)
840 	  {
841 	    break;
842 	  }
843 	}
844 
845 	if (p->policy == 0)
846 	{
847 	    /* we don't know this policy, return 0 */
848 	    TRACE("unknown policy: (%08x)\n", policy);
849 		return 0;
850 	}
851 
852 	/* we have a known policy */
853 
854 	/* first check if this policy has been cached, return it if so */
855 	if (p->cache != SHELL_NO_POLICY)
856 	{
857 	    return p->cache;
858 	}
859 
860 	lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
861 	lstrcatA(regstr, p->appstr);
862 
863 	/* return 0 and don't set the cache if any registry errors occur */
864 #ifndef __REACTOS__
865 	retval = 0;
866 	if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
867 #else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup()
868       // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm
869     retval = RegOpenKeyA(HKEY_LOCAL_MACHINE, regstr, &xhkey);
870     if (retval != ERROR_SUCCESS)
871     {
872         retval = RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey);
873         if (retval != ERROR_SUCCESS)
874             return 0;
875     }
876 #endif
877 	{
878 	  if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
879 	  {
880 	    p->cache = retval;
881 	  }
882 	  RegCloseKey(xhkey);
883 	}
884 	return retval;
885 }
886 
887 /*************************************************************************
888  * SHSettingsChanged          [SHELL32.244]
889  *
890  * Initialise the policy cache to speed up calls to SHRestricted().
891  *
892  * PARAMS
893  *  unused    [I] Reserved.
894  *  inpRegKey [I] Registry key to scan.
895  *
896  * RETURNS
897  *  Success: -1. The policy cache is initialised.
898  *  Failure: 0, if inpRegKey is any value other than NULL, "Policy", or
899  *           "Software\Microsoft\Windows\CurrentVersion\Policies".
900  *
901  * NOTES
902  *  Exported by ordinal. Introduced in Win98.
903  */
904 BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey)
905 {
906 	TRACE("(%p, %p)\n", unused, inpRegKey);
907 
908 	/* first check - if input is non-NULL and points to the secret
909 	   key string, then pass. Otherwise return 0.
910 	 */
911 	if (inpRegKey != NULL)
912 	{
913 	  if (SHELL_OsIsUnicode())
914 	  {
915             if (lstrcmpiW(inpRegKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies") &&
916                 lstrcmpiW(inpRegKey, L"Policy"))
917 	      /* doesn't match, fail */
918 	      return FALSE;
919 	  }
920 	  else
921 	  {
922             if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies") &&
923                 lstrcmpiA(inpRegKey, "Policy"))
924 	      /* doesn't match, fail */
925 	      return FALSE;
926 	  }
927 	}
928 
929 	return TRUE;
930 }
931