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