List 16-bit spec files explicitly to avoid problems with some versions
[wine] / dlls / shell32 / shpolicy.c
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 <stdlib.h>
33 #include <string.h>
34
35 #include "windef.h"
36 #include "winerror.h"
37 #include "winreg.h"
38
39 #include "shell32_main.h"
40 #include "undocshell.h"
41 #include "wine/winuser16.h"
42
43 #include "wine/debug.h"
44
45 WINE_DEFAULT_DEBUG_CHANNEL(shell);
46
47 #define SHELL_NO_POLICY 0xffffffff
48
49 typedef struct tagPOLICYDAT
50 {
51   DWORD policy;          /* policy value passed to SHRestricted */
52   LPCSTR appstr;         /* application str such as "Explorer" */
53   LPCSTR keystr;         /* name of the actual registry key / policy */
54   DWORD cache;           /* cached value or 0xffffffff for invalid */
55 } POLICYDATA, *LPPOLICYDATA;
56
57 /* registry strings */
58 static const CHAR strRegistryPolicyA[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
59 static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
60                                            's','o','f','t','\\','W','i','n','d','o','w','s','\\',
61                                            'C','u','r','r','e','n','t','V','e','r','s','i','o','n',
62                                            '\\','P','o','l','i','c','i','e','s',0};
63 static const CHAR strPolicyA[] = "Policy";
64 static const WCHAR strPolicyW[] = {'P','o','l','i','c','y',0};
65
66 /* application strings */
67
68 static const char strExplorer[] = {"Explorer"};
69 static const char strActiveDesk[] = {"ActiveDesktop"};
70 static const char strWinOldApp[] = {"WinOldApp"};
71 static const char strAddRemoveProgs[] = {"AddRemoveProgs"};
72
73 /* key strings */
74
75 static const char strNoFileURL[] = {"NoFileUrl"};
76 static const char strNoFolderOptions[] = {"NoFolderOptions"};
77 static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"};
78 static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"};
79 static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"};
80 static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"};
81 static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"};
82 static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"};
83 static const char strNoResolveTrk[] = {"NoResolveTrack"};
84 static const char strNoResolveSearch[] = {"NoResolveSearch"};
85 static const char strNoEditComponent[] = {"NoEditingComponents"};
86 static const char strNoMovingBand[] = {"NoMovingBands"};
87 static const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"};
88 static const char strNoCloseComponent[] = {"NoClosingComponents"};
89 static const char strNoDelComponent[] = {"NoDeletingComponents"};
90 static const char strNoAddComponent[] = {"NoAddingComponents"};
91 static const char strNoComponent[] = {"NoComponents"};
92 static const char strNoChangeWallpaper[] = {"NoChangingWallpaper"};
93 static const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"};
94 static const char strNoCustomWebView[] = {"NoCustomizeWebView"};
95 static const char strClassicShell[] = {"ClassicShell"};
96 static const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"};
97 static const char strNoFavoritesMenu[] = {"NoFavoritesMenu"};
98 static const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"};
99 static const char strNoActiveDesktop[] = {"NoActiveDesktop"};
100 static const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"};
101 static const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"};
102 static const char strNoInetIcon[] = {"NoInternetIcon"};
103 static const char strNoStngsWizard[] = {"NoSettingsWizards"};
104 static const char strNoLogoff[] = {"NoLogoff"};
105 static const char strNoNetConDis[] = {"NoNetConnectDisconnect"};
106 static const char strNoContextMenu[] = {"NoViewContextMenu"};
107 static const char strNoTryContextMenu[] = {"NoTrayContextMenu"};
108 static const char strNoWebMenu[] = {"NoWebMenu"};
109 static const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"};
110 static const char strNoCommonGroups[] = {"NoCommonGroups"};
111 static const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"};
112 static const char strNoRealMode[] = {"NoRealMode"};
113 static const char strMyDocsOnNet[] = {"MyDocsOnNet"};
114 static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"};
115 static const char strNoAddPrinters[] = {"NoAddPrinter"};
116 static const char strNoDeletePrinters[] = {"NoDeletePrinter"};
117 static const char strNoPrintTab[] = {"NoPrinterTabs"};
118 static const char strRestrictRun[] = {"RestrictRun"};
119 static const char strNoStartBanner[] = {"NoStartBanner"};
120 static const char strNoNetworkNeighborhood[] = {"NoNetHood"};
121 static const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"};
122 static const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"};
123 static const char strNoDrives[] = {"NoDrives"};
124 static const char strNoFind[] = {"NoFind"};
125 static const char strNoDesktop[] = {"NoDesktop"};
126 static const char strNoSetTaskBar[] = {"NoSetTaskbar"};
127 static const char strNoSetFld[] = {"NoSetFolders"};
128 static const char strNoFileMenu[] = {"NoFileMenu"};
129 static const char strNoSavSetng[] = {"NoSaveSettings"};
130 static const char strNoClose[] = {"NoClose"};
131 static const char strNoRun[] = {"NoRun"};
132
133 /* policy data array */
134 POLICYDATA sh32_policy_table[] =
135 {
136   {
137     0x1,
138     strExplorer,
139     strNoRun,
140     SHELL_NO_POLICY
141   },
142   {
143     0x2,
144     strExplorer,
145     strNoClose,
146     SHELL_NO_POLICY
147   },
148   {
149     0x4,
150     strExplorer,
151     strNoSavSetng,
152     SHELL_NO_POLICY
153   },
154   {
155     0x8,
156     strExplorer,
157     strNoFileMenu,
158     SHELL_NO_POLICY
159   },
160   {
161     0x10,
162     strExplorer,
163     strNoSetFld,
164     SHELL_NO_POLICY
165   },
166   {
167     0x20,
168     strExplorer,
169     strNoSetTaskBar,
170     SHELL_NO_POLICY
171   },
172   {
173     0x40,
174     strExplorer,
175     strNoDesktop,
176     SHELL_NO_POLICY
177   },
178   {
179     0x80,
180     strExplorer,
181     strNoFind,
182     SHELL_NO_POLICY
183   },
184   {
185     0x100,
186     strExplorer,
187     strNoDrives,
188     SHELL_NO_POLICY
189   },
190   {
191     0x200,
192     strExplorer,
193     strNoDrivesAutoRun,
194     SHELL_NO_POLICY
195   },
196   {
197     0x400,
198     strExplorer,
199     strNoDriveTypeAtRun,
200     SHELL_NO_POLICY
201   },
202   {
203     0x800,
204     strExplorer,
205     strNoNetworkNeighborhood,
206     SHELL_NO_POLICY
207   },
208   {
209     0x1000,
210     strExplorer,
211     strNoStartBanner,
212     SHELL_NO_POLICY
213   },
214   {
215     0x2000,
216     strExplorer,
217     strRestrictRun,
218     SHELL_NO_POLICY
219   },
220   {
221     0x4000,
222     strExplorer,
223     strNoPrintTab,
224     SHELL_NO_POLICY
225   },
226   {
227     0x8000,
228     strExplorer,
229     strNoDeletePrinters,
230     SHELL_NO_POLICY
231   },
232   {
233     0x10000,
234     strExplorer,
235     strNoAddPrinters,
236     SHELL_NO_POLICY
237   },
238   {
239     0x20000,
240     strExplorer,
241     strNoStartMenuSubfolder,
242     SHELL_NO_POLICY
243   },
244   {
245     0x40000,
246     strExplorer,
247     strMyDocsOnNet,
248     SHELL_NO_POLICY
249   },
250   {
251     0x80000,
252     strWinOldApp,
253     strNoRealMode,
254     SHELL_NO_POLICY
255   },
256   {
257     0x100000,
258     strExplorer,
259     strEnforceShlExtSecurity,
260     SHELL_NO_POLICY
261   },
262   {
263     0x200000,
264     strExplorer,
265     strLnkResolveIgnoreLnkInfo,
266     SHELL_NO_POLICY
267   },
268   {
269     0x400000,
270     strExplorer,
271     strNoCommonGroups,
272     SHELL_NO_POLICY
273   },
274   {
275     0x800000,
276     strExplorer,
277     "SeparateProcess",
278     SHELL_NO_POLICY
279   },
280   {
281     0x1000000,
282     strExplorer,
283     strNoWebMenu,
284     SHELL_NO_POLICY
285   },
286   {
287     0x2000000,
288     strExplorer,
289     strNoTryContextMenu,
290     SHELL_NO_POLICY
291   },
292   {
293     0x4000000,
294     strExplorer,
295     strNoContextMenu,
296     SHELL_NO_POLICY
297   },
298   {
299     0x8000000,
300     strExplorer,
301     strNoNetConDis,
302     SHELL_NO_POLICY
303   },
304   {
305     0x10000000,
306     strExplorer,
307     strNoLogoff,
308     SHELL_NO_POLICY
309   },
310   {
311     0x20000000,
312     strExplorer,
313     strNoStngsWizard,
314     SHELL_NO_POLICY
315   },
316   {
317     0x40000001,
318     strExplorer,
319     strNoInetIcon,
320     SHELL_NO_POLICY
321   },
322   {
323     0x40000002,
324     strExplorer,
325     strNoRecentDocHistory,
326     SHELL_NO_POLICY
327   },
328   {
329     0x40000003,
330     strExplorer,
331     strNoRecentDocMenu,
332     SHELL_NO_POLICY
333   },
334   {
335     0x40000004,
336     strExplorer,
337     strNoActiveDesktop,
338     SHELL_NO_POLICY
339   },
340   {
341     0x40000005,
342     strExplorer,
343     strNoActiveDesktopChanges,
344     SHELL_NO_POLICY
345   },
346   {
347     0x40000006,
348     strExplorer,
349     strNoFavoritesMenu,
350     SHELL_NO_POLICY
351   },
352   {
353     0x40000007,
354     strExplorer,
355     strClearRecentDocs,
356     SHELL_NO_POLICY
357   },
358   {
359     0x40000008,
360     strExplorer,
361     strClassicShell,
362     SHELL_NO_POLICY
363   },
364   {
365     0x40000009,
366     strExplorer,
367     strNoCustomWebView,
368     SHELL_NO_POLICY
369   },
370   {
371     0x40000010,
372     strActiveDesk,
373     strNoHTMLWallpaper,
374     SHELL_NO_POLICY
375   },
376   {
377     0x40000011,
378     strActiveDesk,
379     strNoChangeWallpaper,
380     SHELL_NO_POLICY
381   },
382   {
383     0x40000012,
384     strActiveDesk,
385     strNoComponent,
386     SHELL_NO_POLICY
387   },
388   {
389     0x40000013,
390     strActiveDesk,
391     strNoAddComponent,
392     SHELL_NO_POLICY
393   },
394   {
395     0x40000014,
396     strActiveDesk,
397     strNoDelComponent,
398     SHELL_NO_POLICY
399   },
400   {
401     0x40000015,
402     strActiveDesk,
403     strNoCloseComponent,
404     SHELL_NO_POLICY
405   },
406   {
407     0x40000016,
408     strActiveDesk,
409     strNoCloseDragDrop,
410     SHELL_NO_POLICY
411   },
412   {
413     0x40000017,
414     strActiveDesk,
415     strNoMovingBand,
416     SHELL_NO_POLICY
417   },
418   {
419     0x40000018,
420     strActiveDesk,
421     strNoEditComponent,
422     SHELL_NO_POLICY
423   },
424   {
425     0x40000019,
426     strExplorer,
427     strNoResolveSearch,
428     SHELL_NO_POLICY
429   },
430   {
431     0x4000001a,
432     strExplorer,
433     strNoResolveTrk,
434     SHELL_NO_POLICY
435   },
436   {
437     0x4000001b,
438     strExplorer,
439     strForceCopyACLW,
440     SHELL_NO_POLICY
441   },
442   {
443     0x4000001c,
444     strExplorer,
445     strNoMSAppLogo,
446     SHELL_NO_POLICY
447   },
448   {
449     0x4000001d,
450     strExplorer,
451     strNoForgetSoftwareUpdate,
452     SHELL_NO_POLICY
453   },
454   {
455     0x4000001e,
456     strExplorer,
457     strNoSetActiveDesktop,
458     SHELL_NO_POLICY
459   },
460   {
461     0x4000001f,
462     strExplorer,
463     strNoWindowsUpdate,
464     SHELL_NO_POLICY
465   },
466   {
467     0x40000020,
468     strExplorer,
469     strNoChangeStartMenu,
470     SHELL_NO_POLICY
471   },
472   {
473     0x40000021,
474     strExplorer,
475     strNoFolderOptions,
476     SHELL_NO_POLICY
477   },
478   {
479     0x50000024,
480     strExplorer,
481     strNoFileURL,
482     SHELL_NO_POLICY
483   },
484   {
485     0x40000022,
486     strExplorer,
487     "FindComputers",
488     SHELL_NO_POLICY
489   },
490   {
491     0x40000023,
492     strExplorer,
493     "IntelliMenus",
494     SHELL_NO_POLICY
495   },
496   {
497     0x40000024,
498     strExplorer,
499     "MemCheckBoxInRunDlg",
500     SHELL_NO_POLICY
501   },
502   {
503     0x40000025,
504     strAddRemoveProgs,
505     "ShowPostSetup",
506     SHELL_NO_POLICY
507   },
508   {
509     0x40000026,
510     strExplorer,
511     "NoSyncAll",
512     SHELL_NO_POLICY
513   },
514   {
515     0x40000027,
516     strExplorer,
517     "NoControlPanel",
518     SHELL_NO_POLICY
519   },
520   {
521     0x40000028,
522     strExplorer,
523     "EnumWorkgroup",
524     SHELL_NO_POLICY
525   },
526   {
527     0x40000029,
528     strAddRemoveProgs,
529     "NoAddRemovePrograms",
530     SHELL_NO_POLICY
531   },
532   {
533     0x4000002A,
534     strAddRemoveProgs,
535     "NoRemovePage",
536     SHELL_NO_POLICY
537   },
538   {
539     0x4000002B,
540     strAddRemoveProgs,
541     "NoAddPage",
542     SHELL_NO_POLICY
543   },
544   {
545     0x4000002C,
546     strAddRemoveProgs,
547     "NoWindowsSetupPage",
548     SHELL_NO_POLICY
549   },
550   {
551     0x4000002E,
552     strExplorer,
553     "NoChangeMappedDriveLabel",
554     SHELL_NO_POLICY
555   },
556   {
557     0x4000002F,
558     strExplorer,
559     "NoChangeMappedDriveComment",
560     SHELL_NO_POLICY
561   },
562   {
563     0x40000030,
564     strExplorer,
565     "MaxRecentDocs",
566     SHELL_NO_POLICY
567   },
568   {
569     0x40000031,
570     strExplorer,
571     "NoNetworkConnections",
572     SHELL_NO_POLICY
573   },
574   {
575     0x40000032,
576     strExplorer,
577     "ForceStartMenuLogoff",
578     SHELL_NO_POLICY
579   },
580   {
581     0x40000033,
582     strExplorer,
583      "NoWebView",
584     SHELL_NO_POLICY
585   },
586   {
587     0x40000034,
588     strExplorer,
589     "NoCustomizeThisFolder",
590     SHELL_NO_POLICY
591   },
592   {
593     0x40000035,
594     strExplorer,
595     "NoEncryption",
596     SHELL_NO_POLICY
597   },
598   {
599     0x40000036,
600     strExplorer,
601     "AllowFrenchEncryption",
602     SHELL_NO_POLICY
603   },
604   {
605     0x40000037,
606     strExplorer,
607     "DontShowSuperHidden",
608     SHELL_NO_POLICY
609   },
610   {
611     0x40000038,
612     strExplorer,
613     "NoShellSearchButton",
614     SHELL_NO_POLICY
615   },
616   {
617     0x40000039,
618     strExplorer,
619     "NoHardwareTab",
620     SHELL_NO_POLICY
621   },
622   {
623     0x4000003A,
624     strExplorer,
625     "NoRunasInstallPrompt",
626     SHELL_NO_POLICY
627   },
628   {
629     0x4000003B,
630     strExplorer,
631     "PromptRunasInstallNetPath",
632     SHELL_NO_POLICY
633   },
634   {
635     0x4000003C,
636     strExplorer,
637     "NoManageMyComputerVerb",
638     SHELL_NO_POLICY
639   },
640   {
641     0x4000003D,
642     strExplorer,
643     "NoRecentDocsNetHood",
644     SHELL_NO_POLICY
645   },
646   {
647     0x4000003E,
648     strExplorer,
649     "DisallowRun",
650     SHELL_NO_POLICY
651   },
652   {
653     0x4000003F,
654     strExplorer,
655     "NoWelcomeScreen",
656     SHELL_NO_POLICY
657   },
658   {
659     0x40000040,
660     strExplorer,
661     "RestrictCpl",
662     SHELL_NO_POLICY
663   },
664   {
665     0x40000041,
666     strExplorer,
667     "DisallowCpl",
668     SHELL_NO_POLICY
669   },
670   {
671     0x40000042,
672     strExplorer,
673     "NoSMBalloonTip",
674     SHELL_NO_POLICY
675   },
676   {
677     0x40000043,
678     strExplorer,
679     "NoSMHelp",
680     SHELL_NO_POLICY
681   },
682   {
683     0x40000044,
684     strExplorer,
685     "NoWinKeys",
686     SHELL_NO_POLICY
687   },
688   {
689     0x40000045,
690     strExplorer,
691     "NoEncryptOnMove",
692     SHELL_NO_POLICY
693   },
694   {
695     0x40000046,
696     strExplorer,
697     "DisableLocalMachineRun",
698     SHELL_NO_POLICY
699   },
700   {
701     0x40000047,
702     strExplorer,
703     "DisableCurrentUserRun",
704     SHELL_NO_POLICY
705   },
706   {
707     0x40000048,
708     strExplorer,
709     "DisableLocalMachineRunOnce",
710     SHELL_NO_POLICY
711   },
712   {
713     0x40000049,
714     strExplorer,
715     "DisableCurrentUserRunOnce",
716     SHELL_NO_POLICY
717   },
718   {
719     0x4000004A,
720     strExplorer,
721     "ForceActiveDesktopOn",
722     SHELL_NO_POLICY
723   },
724   {
725     0x4000004B,
726     strExplorer,
727     "NoComputersNearMe",
728     SHELL_NO_POLICY
729   },
730   {
731     0x4000004C,
732     strExplorer,
733     "NoViewOnDrive",
734     SHELL_NO_POLICY
735   },
736   {
737     0x4000004F,
738     strExplorer,
739     "NoSMMyDocs",
740     SHELL_NO_POLICY
741   },
742   {
743     0x40000061,
744     strExplorer,
745     "StartRunNoHOMEPATH",
746     SHELL_NO_POLICY
747   },
748   {
749     0x41000001,
750     strExplorer,
751     "NoDisconnect",
752     SHELL_NO_POLICY
753   },
754   {
755     0x41000002,
756     strExplorer,
757     "NoNTSecurity",
758     SHELL_NO_POLICY
759   },
760   {
761     0x41000003,
762     strExplorer,
763     "NoFileAssociate",
764     SHELL_NO_POLICY
765   },
766   {
767     0,
768     0,
769     0,
770     SHELL_NO_POLICY
771         }
772 };
773
774 /*************************************************************************
775  * SHRestricted                          [SHELL32.100]
776  *
777  * Get the value associated with a policy Id.
778  *
779  * PARAMS
780  *     pol [I] Policy Id
781  *
782  * RETURNS
783  *     The queried value for the policy.
784  *
785  * NOTES
786  *     Exported by ordinal.
787  *     This function caches the retrieved values to prevent unnecessary registry access,
788  *     if SHInitRestricted() was previously called.
789  *
790  * REFERENCES
791  *     a: MS System Policy Editor.
792  *     b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
793  *     c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press
794  */
795 DWORD WINAPI SHRestricted (DWORD policy)
796 {
797         char regstr[256];
798         HKEY    xhkey;
799         DWORD   retval, datsize = 4;
800         LPPOLICYDATA p;
801
802         TRACE("(%08lx)\n", policy);
803
804         /* scan to see if we know this policy ID */
805         for (p = sh32_policy_table; p->policy; p++)
806         {
807           if (policy == p->policy)
808           {
809             break;
810           }
811         }
812
813         if (p->policy == 0)
814         {
815             /* we don't know this policy, return 0 */
816             TRACE("unknown policy: (%08lx)\n", policy);
817                 return 0;
818         }
819
820         /* we have a known policy */
821
822         /* first check if this policy has been cached, return it if so */
823         if (p->cache != SHELL_NO_POLICY)
824         {
825             return p->cache;
826         }
827
828         lstrcpyA(regstr, strRegistryPolicyA);
829         lstrcatA(regstr, p->appstr);
830
831         /* return 0 and don't set the cache if any registry errors occur */
832         retval = 0;
833         if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
834         {
835           if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
836           {
837             p->cache = retval;
838           }
839           RegCloseKey(xhkey);
840         }
841         return retval;
842 }
843
844 /*************************************************************************
845  * SHInitRestricted          [SHELL32.244]
846  *
847  * Initialise the policy cache to speed up calls to SHRestricted().
848  *
849  * PARAMS
850  *  unused    [I] Reserved.
851  *  inpRegKey [I] Registry key to scan.
852  *
853  * RETURNS
854  *  Success: -1. The policy cache is initialised.
855  *  Failure: 0, if inpRegKey is any value other than NULL, "Policy", or
856  *           "Software\Microsoft\Windows\CurrentVersion\Policies".
857  *
858  * NOTES
859  *  Exported by ordinal. Introduced in Win98.
860  */
861 BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey)
862 {
863         LPPOLICYDATA p;
864
865         TRACE("(%p, %p)\n", unused, inpRegKey);
866
867         /* first check - if input is non-NULL and points to the secret
868            key string, then pass.  Otherwise return 0.
869          */
870         if (inpRegKey != NULL)
871         {
872           if (SHELL_OsIsUnicode())
873           {
874             if (lstrcmpiA((LPSTR)inpRegKey, strRegistryPolicyA) ||
875                 lstrcmpiA((LPSTR)inpRegKey, strPolicyA))
876               /* doesn't match, fail */
877               return 0;
878           }
879           else
880           {
881             if (lstrcmpiW((LPWSTR)inpRegKey, strRegistryPolicyW) ||
882                 lstrcmpiW((LPWSTR)inpRegKey, strPolicyW))
883               /* doesn't match, fail */
884               return 0;
885           }
886         }
887
888         /* check passed, init all policy cache entries with SHELL_NO_POLICY */
889         for (p = sh32_policy_table; p->policy; p++)
890         {
891           p->cache = SHELL_NO_POLICY;
892         }
893         return SHELL_NO_POLICY;
894 }