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 /* 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}; 66 67 /* application strings */ 68 69 static const char strExplorer[] = {"Explorer"}; 70 static const char strActiveDesk[] = {"ActiveDesktop"}; 71 static const char strWinOldApp[] = {"WinOldApp"}; 72 static const char strAddRemoveProgs[] = {"AddRemoveProgs"}; 73 74 /* key strings */ 75 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"}; 134 #ifdef __REACTOS__ 135 static const char strNoSimpleStartMenu[] = {"NoSimpleStartMenu"}; 136 #endif 137 138 /* policy data array */ 139 static POLICYDATA sh32_policy_table[] = 140 { 141 { 142 REST_NORUN, 143 strExplorer, 144 strNoRun, 145 SHELL_NO_POLICY 146 }, 147 { 148 REST_NOCLOSE, 149 strExplorer, 150 strNoClose, 151 SHELL_NO_POLICY 152 }, 153 { 154 REST_NOSAVESET, 155 strExplorer, 156 strNoSaveSetting, 157 SHELL_NO_POLICY 158 }, 159 { 160 REST_NOFILEMENU, 161 strExplorer, 162 strNoFileMenu, 163 SHELL_NO_POLICY 164 }, 165 { 166 REST_NOSETFOLDERS, 167 strExplorer, 168 strNoSetFld, 169 SHELL_NO_POLICY 170 }, 171 { 172 REST_NOSETTASKBAR, 173 strExplorer, 174 strNoSetTaskBar, 175 SHELL_NO_POLICY 176 }, 177 { 178 REST_NODESKTOP, 179 strExplorer, 180 strNoDesktop, 181 SHELL_NO_POLICY 182 }, 183 { 184 REST_NOFIND, 185 strExplorer, 186 strNoFind, 187 SHELL_NO_POLICY 188 }, 189 { 190 REST_NODRIVES, 191 strExplorer, 192 strNoDrives, 193 SHELL_NO_POLICY 194 }, 195 { 196 REST_NODRIVEAUTORUN, 197 strExplorer, 198 strNoDrivesAutoRun, 199 SHELL_NO_POLICY 200 }, 201 { 202 REST_NODRIVETYPEAUTORUN, 203 strExplorer, 204 strNoDriveTypeAtRun, 205 SHELL_NO_POLICY 206 }, 207 { 208 REST_NONETHOOD, 209 strExplorer, 210 strNoNetworkNeighborhood, 211 SHELL_NO_POLICY 212 }, 213 { 214 REST_STARTBANNER, 215 strExplorer, 216 strNoStartBanner, 217 SHELL_NO_POLICY 218 }, 219 { 220 REST_RESTRICTRUN, 221 strExplorer, 222 strRestrictRun, 223 SHELL_NO_POLICY 224 }, 225 { 226 REST_NOPRINTERTABS, 227 strExplorer, 228 strNoPrintTab, 229 SHELL_NO_POLICY 230 }, 231 { 232 REST_NOPRINTERDELETE, 233 strExplorer, 234 strNoDeletePrinters, 235 SHELL_NO_POLICY 236 }, 237 { 238 REST_NOPRINTERADD, 239 strExplorer, 240 strNoAddPrinters, 241 SHELL_NO_POLICY 242 }, 243 { 244 REST_NOSTARTMENUSUBFOLDERS, 245 strExplorer, 246 strNoStartMenuSubfolder, 247 SHELL_NO_POLICY 248 }, 249 { 250 REST_MYDOCSONNET, 251 strExplorer, 252 strMyDocsOnNet, 253 SHELL_NO_POLICY 254 }, 255 { 256 REST_NOEXITTODOS, 257 strWinOldApp, 258 strNoRealMode, 259 SHELL_NO_POLICY 260 }, 261 { 262 REST_ENFORCESHELLEXTSECURITY, 263 strExplorer, 264 strEnforceShlExtSecurity, 265 SHELL_NO_POLICY 266 }, 267 { 268 REST_LINKRESOLVEIGNORELINKINFO, 269 strExplorer, 270 strLnkResolveIgnoreLnkInfo, 271 SHELL_NO_POLICY 272 }, 273 { 274 REST_NOCOMMONGROUPS, 275 strExplorer, 276 strNoCommonGroups, 277 SHELL_NO_POLICY 278 }, 279 { 280 REST_SEPARATEDESKTOPPROCESS, 281 strExplorer, 282 strSeparateProcess, 283 SHELL_NO_POLICY 284 }, 285 { 286 REST_NOWEB, 287 strExplorer, 288 strNoWebMenu, 289 SHELL_NO_POLICY 290 }, 291 { 292 REST_NOTRAYCONTEXTMENU, 293 strExplorer, 294 strNoTrayContextMenu, 295 SHELL_NO_POLICY 296 }, 297 { 298 REST_NOVIEWCONTEXTMENU, 299 strExplorer, 300 strNoViewContextMenu, 301 SHELL_NO_POLICY 302 }, 303 { 304 REST_NONETCONNECTDISCONNECT, 305 strExplorer, 306 strNoNetConDis, 307 SHELL_NO_POLICY 308 }, 309 { 310 REST_STARTMENULOGOFF, 311 strExplorer, 312 strNoLogoff, 313 SHELL_NO_POLICY 314 }, 315 { 316 REST_NOSETTINGSASSIST, 317 strExplorer, 318 strNoSettingsWizard, 319 SHELL_NO_POLICY 320 }, 321 { 322 REST_NOINTERNETICON, 323 strExplorer, 324 strNoInetIcon, 325 SHELL_NO_POLICY 326 }, 327 { 328 REST_NORECENTDOCSHISTORY, 329 strExplorer, 330 strNoRecentDocHistory, 331 SHELL_NO_POLICY 332 }, 333 { 334 REST_NORECENTDOCSMENU, 335 strExplorer, 336 strNoRecentDocMenu, 337 SHELL_NO_POLICY 338 }, 339 { 340 REST_NOACTIVEDESKTOP, 341 strExplorer, 342 strNoActiveDesktop, 343 SHELL_NO_POLICY 344 }, 345 { 346 REST_NOACTIVEDESKTOPCHANGES, 347 strExplorer, 348 strNoActiveDesktopChanges, 349 SHELL_NO_POLICY 350 }, 351 { 352 REST_NOFAVORITESMENU, 353 strExplorer, 354 strNoFavoritesMenu, 355 SHELL_NO_POLICY 356 }, 357 { 358 REST_CLEARRECENTDOCSONEXIT, 359 strExplorer, 360 strClearRecentDocs, 361 SHELL_NO_POLICY 362 }, 363 { 364 REST_CLASSICSHELL, 365 strExplorer, 366 strClassicShell, 367 SHELL_NO_POLICY 368 }, 369 { 370 REST_NOCUSTOMIZEWEBVIEW, 371 strExplorer, 372 strNoCustomWebView, 373 SHELL_NO_POLICY 374 }, 375 { 376 REST_NOHTMLWALLPAPER, 377 strActiveDesk, 378 strNoHTMLWallpaper, 379 SHELL_NO_POLICY 380 }, 381 { 382 REST_NOCHANGINGWALLPAPER, 383 strActiveDesk, 384 strNoChangeWallpaper, 385 SHELL_NO_POLICY 386 }, 387 { 388 REST_NODESKCOMP, 389 strActiveDesk, 390 strNoComponent, 391 SHELL_NO_POLICY 392 }, 393 { 394 REST_NOADDDESKCOMP, 395 strActiveDesk, 396 strNoAddComponent, 397 SHELL_NO_POLICY 398 }, 399 { 400 REST_NODELDESKCOMP, 401 strActiveDesk, 402 strNoDelComponent, 403 SHELL_NO_POLICY 404 }, 405 { 406 REST_NOCLOSEDESKCOMP, 407 strActiveDesk, 408 strNoCloseComponent, 409 SHELL_NO_POLICY 410 }, 411 { 412 REST_NOCLOSE_DRAGDROPBAND, 413 strActiveDesk, 414 strNoCloseDragDrop, 415 SHELL_NO_POLICY 416 }, 417 { 418 REST_NOMOVINGBAND, 419 strActiveDesk, 420 strNoMovingBand, 421 SHELL_NO_POLICY 422 }, 423 { 424 REST_NOEDITDESKCOMP, 425 strActiveDesk, 426 strNoEditComponent, 427 SHELL_NO_POLICY 428 }, 429 { 430 REST_NORESOLVESEARCH, 431 strExplorer, 432 strNoResolveSearch, 433 SHELL_NO_POLICY 434 }, 435 { 436 REST_NORESOLVETRACK, 437 strExplorer, 438 strNoResolveTrk, 439 SHELL_NO_POLICY 440 }, 441 { 442 REST_FORCECOPYACLWITHFILE, 443 strExplorer, 444 strForceCopyACLW, 445 SHELL_NO_POLICY 446 }, 447 #if (NTDDI_VERSION < NTDDI_LONGHORN) 448 { 449 REST_NOLOGO3CHANNELNOTIFY, 450 strExplorer, 451 strNoMSAppLogo, 452 SHELL_NO_POLICY 453 }, 454 #endif 455 { 456 REST_NOFORGETSOFTWAREUPDATE, 457 strExplorer, 458 strNoForgetSoftwareUpdate, 459 SHELL_NO_POLICY 460 }, 461 { 462 REST_NOSETACTIVEDESKTOP, 463 strExplorer, 464 strNoSetActiveDesktop, 465 SHELL_NO_POLICY 466 }, 467 { 468 REST_NOUPDATEWINDOWS, 469 strExplorer, 470 strNoWindowsUpdate, 471 SHELL_NO_POLICY 472 }, 473 { 474 REST_NOCHANGESTARMENU, 475 strExplorer, 476 strNoChangeStartMenu, 477 SHELL_NO_POLICY 478 }, 479 { 480 REST_NOFOLDEROPTIONS, 481 strExplorer, 482 strNoFolderOptions, 483 SHELL_NO_POLICY 484 }, 485 { 486 REST_HASFINDCOMPUTERS, 487 strExplorer, 488 "FindComputers", 489 SHELL_NO_POLICY 490 }, 491 { 492 REST_INTELLIMENUS, 493 strExplorer, 494 "IntelliMenus", 495 SHELL_NO_POLICY 496 }, 497 { 498 REST_RUNDLGMEMCHECKBOX, 499 strExplorer, 500 "MemCheckBoxInRunDlg", 501 SHELL_NO_POLICY 502 }, 503 { 504 REST_ARP_ShowPostSetup, 505 strAddRemoveProgs, 506 "ShowPostSetup", 507 SHELL_NO_POLICY 508 }, 509 { 510 REST_NOCSC, 511 strExplorer, 512 "NoSyncAll", 513 SHELL_NO_POLICY 514 }, 515 { 516 REST_NOCONTROLPANEL, 517 strExplorer, 518 "NoControlPanel", 519 SHELL_NO_POLICY 520 }, 521 { 522 REST_ENUMWORKGROUP, 523 strExplorer, 524 "EnumWorkgroup", 525 SHELL_NO_POLICY 526 }, 527 { 528 REST_ARP_NOARP, 529 strAddRemoveProgs, 530 "NoAddRemovePrograms", 531 SHELL_NO_POLICY 532 }, 533 { 534 REST_ARP_NOREMOVEPAGE, 535 strAddRemoveProgs, 536 "NoRemovePage", 537 SHELL_NO_POLICY 538 }, 539 { 540 REST_ARP_NOADDPAGE, 541 strAddRemoveProgs, 542 "NoAddPage", 543 SHELL_NO_POLICY 544 }, 545 { 546 REST_ARP_NOWINSETUPPAGE, 547 strAddRemoveProgs, 548 "NoWindowsSetupPage", 549 SHELL_NO_POLICY 550 }, 551 { 552 REST_GREYMSIADS, 553 strExplorer, 554 "", 555 SHELL_NO_POLICY 556 }, 557 { 558 REST_NOCHANGEMAPPEDDRIVELABEL, 559 strExplorer, 560 "NoChangeMappedDriveLabel", 561 SHELL_NO_POLICY 562 }, 563 { 564 REST_NOCHANGEMAPPEDDRIVECOMMENT, 565 strExplorer, 566 "NoChangeMappedDriveComment", 567 SHELL_NO_POLICY 568 }, 569 { 570 REST_MaxRecentDocs, 571 strExplorer, 572 "MaxRecentDocs", 573 SHELL_NO_POLICY 574 }, 575 { 576 REST_NONETWORKCONNECTIONS, 577 strExplorer, 578 "NoNetworkConnections", 579 SHELL_NO_POLICY 580 }, 581 { 582 REST_FORCESTARTMENULOGOFF, 583 strExplorer, 584 "ForceStartMenuLogoff", 585 SHELL_NO_POLICY 586 }, 587 { 588 REST_NOWEBVIEW, 589 strExplorer, 590 "NoWebView", 591 SHELL_NO_POLICY 592 }, 593 { 594 REST_NOCUSTOMIZETHISFOLDER, 595 strExplorer, 596 "NoCustomizeThisFolder", 597 SHELL_NO_POLICY 598 }, 599 { 600 REST_NOENCRYPTION, 601 strExplorer, 602 "NoEncryption", 603 SHELL_NO_POLICY 604 }, 605 { 606 REST_ALLOWFRENCHENCRYPTION, 607 strExplorer, 608 "AllowFrenchEncryption", 609 SHELL_NO_POLICY 610 }, 611 { 612 REST_DONTSHOWSUPERHIDDEN, 613 strExplorer, 614 "DontShowSuperHidden", 615 SHELL_NO_POLICY 616 }, 617 { 618 REST_NOSHELLSEARCHBUTTON, 619 strExplorer, 620 "NoShellSearchButton", 621 SHELL_NO_POLICY 622 }, 623 { 624 REST_NOHARDWARETAB, 625 strExplorer, 626 "NoHardwareTab", 627 SHELL_NO_POLICY 628 }, 629 { 630 REST_NORUNASINSTALLPROMPT, 631 strExplorer, 632 "NoRunasInstallPrompt", 633 SHELL_NO_POLICY 634 }, 635 { 636 REST_PROMPTRUNASINSTALLNETPATH, 637 strExplorer, 638 "PromptRunasInstallNetPath", 639 SHELL_NO_POLICY 640 }, 641 { 642 REST_NOMANAGEMYCOMPUTERVERB, 643 strExplorer, 644 "NoManageMyComputerVerb", 645 SHELL_NO_POLICY 646 }, 647 { 648 REST_NORECENTDOCSNETHOOD, 649 strExplorer, 650 "NoRecentDocsNetHood", 651 SHELL_NO_POLICY 652 }, 653 { 654 REST_DISALLOWRUN, 655 strExplorer, 656 "DisallowRun", 657 SHELL_NO_POLICY 658 }, 659 { 660 REST_NOWELCOMESCREEN, 661 strExplorer, 662 "NoWelcomeScreen", 663 SHELL_NO_POLICY 664 }, 665 { 666 REST_RESTRICTCPL, 667 strExplorer, 668 "RestrictCpl", 669 SHELL_NO_POLICY 670 }, 671 { 672 REST_DISALLOWCPL, 673 strExplorer, 674 "DisallowCpl", 675 SHELL_NO_POLICY 676 }, 677 { 678 REST_NOSMBALLOONTIP, 679 strExplorer, 680 "NoSMBalloonTip", 681 SHELL_NO_POLICY 682 }, 683 { 684 REST_NOSMHELP, 685 strExplorer, 686 "NoSMHelp", 687 SHELL_NO_POLICY 688 }, 689 { 690 REST_NOWINKEYS, 691 strExplorer, 692 "NoWinKeys", 693 SHELL_NO_POLICY 694 }, 695 { 696 REST_NOENCRYPTONMOVE, 697 strExplorer, 698 "NoEncryptOnMove", 699 SHELL_NO_POLICY 700 }, 701 { 702 REST_NOLOCALMACHINERUN, 703 strExplorer, 704 "DisableLocalMachineRun", 705 SHELL_NO_POLICY 706 }, 707 { 708 REST_NOCURRENTUSERRUN, 709 strExplorer, 710 "DisableCurrentUserRun", 711 SHELL_NO_POLICY 712 }, 713 { 714 REST_NOLOCALMACHINERUNONCE, 715 strExplorer, 716 "DisableLocalMachineRunOnce", 717 SHELL_NO_POLICY 718 }, 719 { 720 REST_NOCURRENTUSERRUNONCE, 721 strExplorer, 722 "DisableCurrentUserRunOnce", 723 SHELL_NO_POLICY 724 }, 725 { 726 REST_FORCEACTIVEDESKTOPON, 727 strExplorer, 728 "ForceActiveDesktopOn", 729 SHELL_NO_POLICY 730 }, 731 { 732 REST_NOCOMPUTERSNEARME, 733 strExplorer, 734 "NoComputersNearMe", 735 SHELL_NO_POLICY 736 }, 737 { 738 REST_NOVIEWONDRIVE, 739 strExplorer, 740 "NoViewOnDrive", 741 SHELL_NO_POLICY 742 }, 743 { 744 REST_NONETCRAWL, 745 strExplorer, 746 "NoNetCrawl", 747 SHELL_NO_POLICY 748 }, 749 { 750 REST_NOSHAREDDOCUMENTS, 751 strExplorer, 752 "NoSharedDocs", 753 SHELL_NO_POLICY 754 }, 755 { 756 REST_NOSMMYDOCS, 757 strExplorer, 758 "NoSMMyDocs", 759 SHELL_NO_POLICY 760 }, 761 /* 0x4000050 - 0x4000060 */ 762 { 763 REST_NONLEGACYSHELLMODE, 764 strExplorer, 765 "NoneLegacyShellMode", 766 SHELL_NO_POLICY 767 }, 768 #ifdef __REACTOS__ 769 { 770 REST_NOSTARTPANEL, 771 strExplorer, 772 strNoSimpleStartMenu, 773 SHELL_NO_POLICY 774 }, 775 #endif 776 { 777 REST_STARTRUNNOHOMEPATH, 778 strExplorer, 779 "StartRunNoHOMEPATH", 780 SHELL_NO_POLICY 781 }, 782 /* 0x4000061 - 0x4000086 */ 783 { 784 REST_NODISCONNECT, 785 strExplorer, 786 "NoDisconnect", 787 SHELL_NO_POLICY 788 }, 789 { 790 REST_NOSECURITY, 791 strExplorer, 792 "NoNTSecurity", 793 SHELL_NO_POLICY 794 }, 795 { 796 REST_NOFILEASSOCIATE, 797 strExplorer, 798 "NoFileAssociate", 799 SHELL_NO_POLICY 800 }, 801 { 802 0x50000024, 803 strExplorer, 804 strNoFileURL, 805 SHELL_NO_POLICY 806 }, 807 { 808 0, 809 0, 810 0, 811 SHELL_NO_POLICY 812 } 813 }; 814 815 /************************************************************************* 816 * SHRestricted [SHELL32.100] 817 * 818 * Get the value associated with a policy Id. 819 * 820 * PARAMS 821 * pol [I] Policy Id 822 * 823 * RETURNS 824 * The queried value for the policy. 825 * 826 * NOTES 827 * Exported by ordinal. 828 * This function caches the retrieved values to prevent unnecessary registry access, 829 * if SHSettingsChanged() was previously called. 830 * 831 * REFERENCES 832 * a: MS System Policy Editor. 833 * b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ 834 * c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press 835 */ 836 DWORD WINAPI SHRestricted (RESTRICTIONS policy) 837 { 838 char regstr[256]; 839 HKEY xhkey; 840 DWORD retval, datsize = 4; 841 LPPOLICYDATA p; 842 843 TRACE("(%08x)\n", policy); 844 845 /* scan to see if we know this policy ID */ 846 for (p = sh32_policy_table; p->policy; p++) 847 { 848 if (policy == p->policy) 849 { 850 break; 851 } 852 } 853 854 if (p->policy == 0) 855 { 856 /* we don't know this policy, return 0 */ 857 TRACE("unknown policy: (%08x)\n", policy); 858 return 0; 859 } 860 861 /* we have a known policy */ 862 863 /* first check if this policy has been cached, return it if so */ 864 if (p->cache != SHELL_NO_POLICY) 865 { 866 return p->cache; 867 } 868 869 lstrcpyA(regstr, strRegistryPolicyA); 870 lstrcatA(regstr, "\\"); 871 lstrcatA(regstr, p->appstr); 872 873 /* return 0 and don't set the cache if any registry errors occur */ 874 #ifndef __REACTOS__ 875 retval = 0; 876 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) 877 #else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup() 878 // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm 879 retval = RegOpenKeyA(HKEY_LOCAL_MACHINE, regstr, &xhkey); 880 if (retval != ERROR_SUCCESS) 881 { 882 retval = RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey); 883 if (retval != ERROR_SUCCESS) 884 return 0; 885 } 886 #endif 887 { 888 if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) 889 { 890 p->cache = retval; 891 } 892 RegCloseKey(xhkey); 893 } 894 return retval; 895 } 896 897 /************************************************************************* 898 * SHSettingsChanged [SHELL32.244] 899 * 900 * Initialise the policy cache to speed up calls to SHRestricted(). 901 * 902 * PARAMS 903 * unused [I] Reserved. 904 * inpRegKey [I] Registry key to scan. 905 * 906 * RETURNS 907 * Success: -1. The policy cache is initialised. 908 * Failure: 0, if inpRegKey is any value other than NULL, "Policy", or 909 * "Software\Microsoft\Windows\CurrentVersion\Policies". 910 * 911 * NOTES 912 * Exported by ordinal. Introduced in Win98. 913 */ 914 BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey) 915 { 916 TRACE("(%p, %p)\n", unused, inpRegKey); 917 918 /* first check - if input is non-NULL and points to the secret 919 key string, then pass. Otherwise return 0. 920 */ 921 if (inpRegKey != NULL) 922 { 923 if (SHELL_OsIsUnicode()) 924 { 925 if (lstrcmpiW(inpRegKey, strRegistryPolicyW) && 926 lstrcmpiW(inpRegKey, strPolicyW)) 927 /* doesn't match, fail */ 928 return FALSE; 929 } 930 else 931 { 932 if (lstrcmpiA(inpRegKey, strRegistryPolicyA) && 933 lstrcmpiA(inpRegKey, strPolicyA)) 934 /* doesn't match, fail */ 935 return FALSE; 936 } 937 } 938 939 return TRUE; 940 } 941