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