mapi32/tests: Fix prototype of FBinFromHex function pointer.
[wine/multimedia.git] / dlls / shell32 / shpolicy.c
blob9ca8b4603961ce0bb136f41c945bcfe4c9c10d0f
1 /*
2 * shpolicy.c - Data for shell/system policies.
4 * Copyright 1999 Ian Schmidt <ischmidt@cfl.rr.com>
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.
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.
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
20 * NOTES:
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...
29 * Up to date as of SHELL32 v5.00 (W2K)
32 #include <stdarg.h>
33 #include <stdlib.h>
34 #include <string.h>
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winerror.h"
39 #include "winreg.h"
41 #include "shell32_main.h"
42 #include "shlobj.h"
44 #include "wine/debug.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(shell);
48 #define SHELL_NO_POLICY 0xffffffff
50 typedef struct tagPOLICYDAT
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;
58 /* registry strings */
59 static const CHAR strRegistryPolicyA[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
60 static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
61 's','o','f','t','\\','W','i','n','d','o','w','s','\\',
62 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',
63 '\\','P','o','l','i','c','i','e','s',0};
64 static const CHAR strPolicyA[] = "Policy";
65 static const WCHAR strPolicyW[] = {'P','o','l','i','c','y',0};
67 /* application strings */
69 static const char strExplorer[] = {"Explorer"};
70 static const char strActiveDesk[] = {"ActiveDesktop"};
71 static const char strWinOldApp[] = {"WinOldApp"};
72 static const char strAddRemoveProgs[] = {"AddRemoveProgs"};
74 /* key strings */
76 static const char strNoFileURL[] = {"NoFileUrl"};
77 static const char strNoFolderOptions[] = {"NoFolderOptions"};
78 static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"};
79 static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"};
80 static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"};
81 static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"};
82 static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"};
83 static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"};
84 static const char strNoResolveTrk[] = {"NoResolveTrack"};
85 static const char strNoResolveSearch[] = {"NoResolveSearch"};
86 static const char strNoEditComponent[] = {"NoEditingComponents"};
87 static const char strNoMovingBand[] = {"NoMovingBands"};
88 static const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"};
89 static const char strNoCloseComponent[] = {"NoClosingComponents"};
90 static const char strNoDelComponent[] = {"NoDeletingComponents"};
91 static const char strNoAddComponent[] = {"NoAddingComponents"};
92 static const char strNoComponent[] = {"NoComponents"};
93 static const char strNoChangeWallpaper[] = {"NoChangingWallpaper"};
94 static const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"};
95 static const char strNoCustomWebView[] = {"NoCustomizeWebView"};
96 static const char strClassicShell[] = {"ClassicShell"};
97 static const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"};
98 static const char strNoFavoritesMenu[] = {"NoFavoritesMenu"};
99 static const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"};
100 static const char strNoActiveDesktop[] = {"NoActiveDesktop"};
101 static const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"};
102 static const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"};
103 static const char strNoInetIcon[] = {"NoInternetIcon"};
104 static const char strNoSettingsWizard[] = {"NoSettingsWizards"};
105 static const char strNoLogoff[] = {"NoLogoff"};
106 static const char strNoNetConDis[] = {"NoNetConnectDisconnect"};
107 static const char strNoViewContextMenu[] = {"NoViewContextMenu"};
108 static const char strNoTrayContextMenu[] = {"NoTrayContextMenu"};
109 static const char strNoWebMenu[] = {"NoWebMenu"};
110 static const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"};
111 static const char strNoCommonGroups[] = {"NoCommonGroups"};
112 static const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"};
113 static const char strNoRealMode[] = {"NoRealMode"};
114 static const char strMyDocsOnNet[] = {"MyDocsOnNet"};
115 static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"};
116 static const char strNoAddPrinters[] = {"NoAddPrinter"};
117 static const char strNoDeletePrinters[] = {"NoDeletePrinter"};
118 static const char strNoPrintTab[] = {"NoPrinterTabs"};
119 static const char strRestrictRun[] = {"RestrictRun"};
120 static const char strNoStartBanner[] = {"NoStartBanner"};
121 static const char strNoNetworkNeighborhood[] = {"NoNetHood"};
122 static const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"};
123 static const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"};
124 static const char strSeparateProcess[] = {"SeparateProcess"};
125 static const char strNoDrives[] = {"NoDrives"};
126 static const char strNoFind[] = {"NoFind"};
127 static const char strNoDesktop[] = {"NoDesktop"};
128 static const char strNoSetTaskBar[] = {"NoSetTaskbar"};
129 static const char strNoSetFld[] = {"NoSetFolders"};
130 static const char strNoFileMenu[] = {"NoFileMenu"};
131 static const char strNoSaveSetting[] = {"NoSaveSettings"};
132 static const char strNoClose[] = {"NoClose"};
133 static const char strNoRun[] = {"NoRun"};
135 /* policy data array */
136 static POLICYDATA sh32_policy_table[] =
139 REST_NORUN,
140 strExplorer,
141 strNoRun,
142 SHELL_NO_POLICY
145 REST_NOCLOSE,
146 strExplorer,
147 strNoClose,
148 SHELL_NO_POLICY
151 REST_NOSAVESET,
152 strExplorer,
153 strNoSaveSetting,
154 SHELL_NO_POLICY
157 REST_NOFILEMENU,
158 strExplorer,
159 strNoFileMenu,
160 SHELL_NO_POLICY
163 REST_NOSETFOLDERS,
164 strExplorer,
165 strNoSetFld,
166 SHELL_NO_POLICY
169 REST_NOSETTASKBAR,
170 strExplorer,
171 strNoSetTaskBar,
172 SHELL_NO_POLICY
175 REST_NODESKTOP,
176 strExplorer,
177 strNoDesktop,
178 SHELL_NO_POLICY
181 REST_NOFIND,
182 strExplorer,
183 strNoFind,
184 SHELL_NO_POLICY
187 REST_NODRIVES,
188 strExplorer,
189 strNoDrives,
190 SHELL_NO_POLICY
193 REST_NODRIVEAUTORUN,
194 strExplorer,
195 strNoDrivesAutoRun,
196 SHELL_NO_POLICY
199 REST_NODRIVETYPEAUTORUN,
200 strExplorer,
201 strNoDriveTypeAtRun,
202 SHELL_NO_POLICY
205 REST_NONETHOOD,
206 strExplorer,
207 strNoNetworkNeighborhood,
208 SHELL_NO_POLICY
211 REST_STARTBANNER,
212 strExplorer,
213 strNoStartBanner,
214 SHELL_NO_POLICY
217 REST_RESTRICTRUN,
218 strExplorer,
219 strRestrictRun,
220 SHELL_NO_POLICY
223 REST_NOPRINTERTABS,
224 strExplorer,
225 strNoPrintTab,
226 SHELL_NO_POLICY
229 REST_NOPRINTERDELETE,
230 strExplorer,
231 strNoDeletePrinters,
232 SHELL_NO_POLICY
235 REST_NOPRINTERADD,
236 strExplorer,
237 strNoAddPrinters,
238 SHELL_NO_POLICY
241 REST_NOSTARTMENUSUBFOLDERS,
242 strExplorer,
243 strNoStartMenuSubfolder,
244 SHELL_NO_POLICY
247 REST_MYDOCSONNET,
248 strExplorer,
249 strMyDocsOnNet,
250 SHELL_NO_POLICY
253 REST_NOEXITTODOS,
254 strWinOldApp,
255 strNoRealMode,
256 SHELL_NO_POLICY
259 REST_ENFORCESHELLEXTSECURITY,
260 strExplorer,
261 strEnforceShlExtSecurity,
262 SHELL_NO_POLICY
265 REST_LINKRESOLVEIGNORELINKINFO,
266 strExplorer,
267 strLnkResolveIgnoreLnkInfo,
268 SHELL_NO_POLICY
271 REST_NOCOMMONGROUPS,
272 strExplorer,
273 strNoCommonGroups,
274 SHELL_NO_POLICY
277 REST_SEPARATEDESKTOPPROCESS,
278 strExplorer,
279 strSeparateProcess,
280 SHELL_NO_POLICY
283 REST_NOWEB,
284 strExplorer,
285 strNoWebMenu,
286 SHELL_NO_POLICY
289 REST_NOTRAYCONTEXTMENU,
290 strExplorer,
291 strNoTrayContextMenu,
292 SHELL_NO_POLICY
295 REST_NOVIEWCONTEXTMENU,
296 strExplorer,
297 strNoViewContextMenu,
298 SHELL_NO_POLICY
301 REST_NONETCONNECTDISCONNECT,
302 strExplorer,
303 strNoNetConDis,
304 SHELL_NO_POLICY
307 REST_STARTMENULOGOFF,
308 strExplorer,
309 strNoLogoff,
310 SHELL_NO_POLICY
313 REST_NOSETTINGSASSIST,
314 strExplorer,
315 strNoSettingsWizard,
316 SHELL_NO_POLICY
319 REST_NOINTERNETICON,
320 strExplorer,
321 strNoInetIcon,
322 SHELL_NO_POLICY
325 REST_NORECENTDOCSHISTORY,
326 strExplorer,
327 strNoRecentDocHistory,
328 SHELL_NO_POLICY
331 REST_NORECENTDOCSMENU,
332 strExplorer,
333 strNoRecentDocMenu,
334 SHELL_NO_POLICY
337 REST_NOACTIVEDESKTOP,
338 strExplorer,
339 strNoActiveDesktop,
340 SHELL_NO_POLICY
343 REST_NOACTIVEDESKTOPCHANGES,
344 strExplorer,
345 strNoActiveDesktopChanges,
346 SHELL_NO_POLICY
349 REST_NOFAVORITESMENU,
350 strExplorer,
351 strNoFavoritesMenu,
352 SHELL_NO_POLICY
355 REST_CLEARRECENTDOCSONEXIT,
356 strExplorer,
357 strClearRecentDocs,
358 SHELL_NO_POLICY
361 REST_CLASSICSHELL,
362 strExplorer,
363 strClassicShell,
364 SHELL_NO_POLICY
367 REST_NOCUSTOMIZEWEBVIEW,
368 strExplorer,
369 strNoCustomWebView,
370 SHELL_NO_POLICY
373 REST_NOHTMLWALLPAPER,
374 strActiveDesk,
375 strNoHTMLWallpaper,
376 SHELL_NO_POLICY
379 REST_NOCHANGINGWALLPAPER,
380 strActiveDesk,
381 strNoChangeWallpaper,
382 SHELL_NO_POLICY
385 REST_NODESKCOMP,
386 strActiveDesk,
387 strNoComponent,
388 SHELL_NO_POLICY
391 REST_NOADDDESKCOMP,
392 strActiveDesk,
393 strNoAddComponent,
394 SHELL_NO_POLICY
397 REST_NODELDESKCOMP,
398 strActiveDesk,
399 strNoDelComponent,
400 SHELL_NO_POLICY
403 REST_NOCLOSEDESKCOMP,
404 strActiveDesk,
405 strNoCloseComponent,
406 SHELL_NO_POLICY
409 REST_NOCLOSE_DRAGDROPBAND,
410 strActiveDesk,
411 strNoCloseDragDrop,
412 SHELL_NO_POLICY
415 REST_NOMOVINGBAND,
416 strActiveDesk,
417 strNoMovingBand,
418 SHELL_NO_POLICY
421 REST_NOEDITDESKCOMP,
422 strActiveDesk,
423 strNoEditComponent,
424 SHELL_NO_POLICY
427 REST_NORESOLVESEARCH,
428 strExplorer,
429 strNoResolveSearch,
430 SHELL_NO_POLICY
433 REST_NORESOLVETRACK,
434 strExplorer,
435 strNoResolveTrk,
436 SHELL_NO_POLICY
439 REST_FORCECOPYACLWITHFILE,
440 strExplorer,
441 strForceCopyACLW,
442 SHELL_NO_POLICY
445 REST_NOLOGO3CHANNELNOTIFY,
446 strExplorer,
447 strNoMSAppLogo,
448 SHELL_NO_POLICY
451 REST_NOFORGETSOFTWAREUPDATE,
452 strExplorer,
453 strNoForgetSoftwareUpdate,
454 SHELL_NO_POLICY
457 REST_NOSETACTIVEDESKTOP,
458 strExplorer,
459 strNoSetActiveDesktop,
460 SHELL_NO_POLICY
463 REST_NOUPDATEWINDOWS,
464 strExplorer,
465 strNoWindowsUpdate,
466 SHELL_NO_POLICY
469 REST_NOCHANGESTARMENU,
470 strExplorer,
471 strNoChangeStartMenu,
472 SHELL_NO_POLICY
475 REST_NOFOLDEROPTIONS,
476 strExplorer,
477 strNoFolderOptions,
478 SHELL_NO_POLICY
481 REST_HASFINDCOMPUTERS,
482 strExplorer,
483 "FindComputers",
484 SHELL_NO_POLICY
487 REST_INTELLIMENUS,
488 strExplorer,
489 "IntelliMenus",
490 SHELL_NO_POLICY
493 REST_RUNDLGMEMCHECKBOX,
494 strExplorer,
495 "MemCheckBoxInRunDlg",
496 SHELL_NO_POLICY
499 REST_ARP_ShowPostSetup,
500 strAddRemoveProgs,
501 "ShowPostSetup",
502 SHELL_NO_POLICY
505 REST_NOCSC,
506 strExplorer,
507 "NoSyncAll",
508 SHELL_NO_POLICY
511 REST_NOCONTROLPANEL,
512 strExplorer,
513 "NoControlPanel",
514 SHELL_NO_POLICY
517 REST_ENUMWORKGROUP,
518 strExplorer,
519 "EnumWorkgroup",
520 SHELL_NO_POLICY
523 REST_ARP_NOARP,
524 strAddRemoveProgs,
525 "NoAddRemovePrograms",
526 SHELL_NO_POLICY
529 REST_ARP_NOREMOVEPAGE,
530 strAddRemoveProgs,
531 "NoRemovePage",
532 SHELL_NO_POLICY
535 REST_ARP_NOADDPAGE,
536 strAddRemoveProgs,
537 "NoAddPage",
538 SHELL_NO_POLICY
541 REST_ARP_NOWINSETUPPAGE,
542 strAddRemoveProgs,
543 "NoWindowsSetupPage",
544 SHELL_NO_POLICY
547 REST_GREYMSIADS,
548 strExplorer,
550 SHELL_NO_POLICY
553 REST_NOCHANGEMAPPEDDRIVELABEL,
554 strExplorer,
555 "NoChangeMappedDriveLabel",
556 SHELL_NO_POLICY
559 REST_NOCHANGEMAPPEDDRIVECOMMENT,
560 strExplorer,
561 "NoChangeMappedDriveComment",
562 SHELL_NO_POLICY
565 REST_MaxRecentDocs,
566 strExplorer,
567 "MaxRecentDocs",
568 SHELL_NO_POLICY
571 REST_NONETWORKCONNECTIONS,
572 strExplorer,
573 "NoNetworkConnections",
574 SHELL_NO_POLICY
577 REST_FORCESTARTMENULOGOFF,
578 strExplorer,
579 "ForceStartMenuLogoff",
580 SHELL_NO_POLICY
583 REST_NOWEBVIEW,
584 strExplorer,
585 "NoWebView",
586 SHELL_NO_POLICY
589 REST_NOCUSTOMIZETHISFOLDER,
590 strExplorer,
591 "NoCustomizeThisFolder",
592 SHELL_NO_POLICY
595 REST_NOENCRYPTION,
596 strExplorer,
597 "NoEncryption",
598 SHELL_NO_POLICY
601 REST_ALLOWFRENCHENCRYPTION,
602 strExplorer,
603 "AllowFrenchEncryption",
604 SHELL_NO_POLICY
607 REST_DONTSHOWSUPERHIDDEN,
608 strExplorer,
609 "DontShowSuperHidden",
610 SHELL_NO_POLICY
613 REST_NOSHELLSEARCHBUTTON,
614 strExplorer,
615 "NoShellSearchButton",
616 SHELL_NO_POLICY
619 REST_NOHARDWARETAB,
620 strExplorer,
621 "NoHardwareTab",
622 SHELL_NO_POLICY
625 REST_NORUNASINSTALLPROMPT,
626 strExplorer,
627 "NoRunasInstallPrompt",
628 SHELL_NO_POLICY
631 REST_PROMPTRUNASINSTALLNETPATH,
632 strExplorer,
633 "PromptRunasInstallNetPath",
634 SHELL_NO_POLICY
637 REST_NOMANAGEMYCOMPUTERVERB,
638 strExplorer,
639 "NoManageMyComputerVerb",
640 SHELL_NO_POLICY
643 REST_NORECENTDOCSNETHOOD,
644 strExplorer,
645 "NoRecentDocsNetHood",
646 SHELL_NO_POLICY
649 REST_DISALLOWRUN,
650 strExplorer,
651 "DisallowRun",
652 SHELL_NO_POLICY
655 REST_NOWELCOMESCREEN,
656 strExplorer,
657 "NoWelcomeScreen",
658 SHELL_NO_POLICY
661 REST_RESTRICTCPL,
662 strExplorer,
663 "RestrictCpl",
664 SHELL_NO_POLICY
667 REST_DISALLOWCPL,
668 strExplorer,
669 "DisallowCpl",
670 SHELL_NO_POLICY
673 REST_NOSMBALLOONTIP,
674 strExplorer,
675 "NoSMBalloonTip",
676 SHELL_NO_POLICY
679 REST_NOSMHELP,
680 strExplorer,
681 "NoSMHelp",
682 SHELL_NO_POLICY
685 REST_NOWINKEYS,
686 strExplorer,
687 "NoWinKeys",
688 SHELL_NO_POLICY
691 REST_NOENCRYPTONMOVE,
692 strExplorer,
693 "NoEncryptOnMove",
694 SHELL_NO_POLICY
697 REST_NOLOCALMACHINERUN,
698 strExplorer,
699 "DisableLocalMachineRun",
700 SHELL_NO_POLICY
703 REST_NOCURRENTUSERRUN,
704 strExplorer,
705 "DisableCurrentUserRun",
706 SHELL_NO_POLICY
709 REST_NOLOCALMACHINERUNONCE,
710 strExplorer,
711 "DisableLocalMachineRunOnce",
712 SHELL_NO_POLICY
715 REST_NOCURRENTUSERRUNONCE,
716 strExplorer,
717 "DisableCurrentUserRunOnce",
718 SHELL_NO_POLICY
721 REST_FORCEACTIVEDESKTOPON,
722 strExplorer,
723 "ForceActiveDesktopOn",
724 SHELL_NO_POLICY
727 REST_NOCOMPUTERSNEARME,
728 strExplorer,
729 "NoComputersNearMe",
730 SHELL_NO_POLICY
733 REST_NOVIEWONDRIVE,
734 strExplorer,
735 "NoViewOnDrive",
736 SHELL_NO_POLICY
739 REST_NONETCRAWL,
740 strExplorer,
741 "NoNetCrawl",
742 SHELL_NO_POLICY
745 REST_NOSHAREDDOCUMENTS,
746 strExplorer,
747 "NoSharedDocs",
748 SHELL_NO_POLICY
751 REST_NOSMMYDOCS,
752 strExplorer,
753 "NoSMMyDocs",
754 SHELL_NO_POLICY
756 /* 0x4000050 - 0x4000060 */
758 REST_NONLEGACYSHELLMODE,
759 strExplorer,
760 "NoneLegacyShellMode",
761 SHELL_NO_POLICY
764 REST_STARTRUNNOHOMEPATH,
765 strExplorer,
766 "StartRunNoHOMEPATH",
767 SHELL_NO_POLICY
769 /* 0x4000061 - 0x4000086 */
771 REST_NODISCONNECT,
772 strExplorer,
773 "NoDisconnect",
774 SHELL_NO_POLICY
777 REST_NOSECURITY,
778 strExplorer,
779 "NoNTSecurity",
780 SHELL_NO_POLICY
783 REST_NOFILEASSOCIATE,
784 strExplorer,
785 "NoFileAssociate",
786 SHELL_NO_POLICY
789 0x50000024,
790 strExplorer,
791 strNoFileURL,
792 SHELL_NO_POLICY
798 SHELL_NO_POLICY
802 /*************************************************************************
803 * SHRestricted [SHELL32.100]
805 * Get the value associated with a policy Id.
807 * PARAMS
808 * pol [I] Policy Id
810 * RETURNS
811 * The queried value for the policy.
813 * NOTES
814 * Exported by ordinal.
815 * This function caches the retrieved values to prevent unnecessary registry access,
816 * if SHInitRestricted() was previously called.
818 * REFERENCES
819 * a: MS System Policy Editor.
820 * b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/
821 * c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press
823 DWORD WINAPI SHRestricted (RESTRICTIONS policy)
825 char regstr[256];
826 HKEY xhkey;
827 DWORD retval, datsize = 4;
828 LPPOLICYDATA p;
830 TRACE("(%08x)\n", policy);
832 /* scan to see if we know this policy ID */
833 for (p = sh32_policy_table; p->policy; p++)
835 if (policy == p->policy)
837 break;
841 if (p->policy == 0)
843 /* we don't know this policy, return 0 */
844 TRACE("unknown policy: (%08x)\n", policy);
845 return 0;
848 /* we have a known policy */
850 /* first check if this policy has been cached, return it if so */
851 if (p->cache != SHELL_NO_POLICY)
853 return p->cache;
856 lstrcpyA(regstr, strRegistryPolicyA);
857 lstrcatA(regstr, p->appstr);
859 /* return 0 and don't set the cache if any registry errors occur */
860 retval = 0;
861 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
863 if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
865 p->cache = retval;
867 RegCloseKey(xhkey);
869 return retval;
872 /*************************************************************************
873 * SHInitRestricted [SHELL32.244]
875 * Initialise the policy cache to speed up calls to SHRestricted().
877 * PARAMS
878 * unused [I] Reserved.
879 * inpRegKey [I] Registry key to scan.
881 * RETURNS
882 * Success: -1. The policy cache is initialised.
883 * Failure: 0, if inpRegKey is any value other than NULL, "Policy", or
884 * "Software\Microsoft\Windows\CurrentVersion\Policies".
886 * NOTES
887 * Exported by ordinal. Introduced in Win98.
889 BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey)
891 TRACE("(%p, %p)\n", unused, inpRegKey);
893 /* first check - if input is non-NULL and points to the secret
894 key string, then pass. Otherwise return 0.
896 if (inpRegKey != NULL)
898 if (SHELL_OsIsUnicode())
900 if (lstrcmpiW(inpRegKey, strRegistryPolicyW) &&
901 lstrcmpiW(inpRegKey, strPolicyW))
902 /* doesn't match, fail */
903 return 0;
905 else
907 if (lstrcmpiA(inpRegKey, strRegistryPolicyA) &&
908 lstrcmpiA(inpRegKey, strPolicyA))
909 /* doesn't match, fail */
910 return 0;
914 return TRUE;