ReactOS 0.4.15-dev-6661-gcc6e444
shpolicy.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <wine/debug.h>
#include "shell32_main.h"
Include dependency graph for shpolicy.c:

Go to the source code of this file.

Classes

struct  tagPOLICYDAT
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define SHELL_NO_POLICY   0xffffffff
 

Typedefs

typedef struct tagPOLICYDAT POLICYDATA
 
typedef struct tagPOLICYDATLPPOLICYDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
DWORD WINAPI SHRestricted (RESTRICTIONS policy)
 
BOOL WINAPI SHSettingsChanged (LPCVOID unused, LPCVOID inpRegKey)
 

Variables

static const char strExplorer [] = {"Explorer"}
 
static const char strActiveDesk [] = {"ActiveDesktop"}
 
static const char strWinOldApp [] = {"WinOldApp"}
 
static const char strAddRemoveProgs [] = {"AddRemoveProgs"}
 
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 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"}
 
static POLICYDATA sh32_policy_table []
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 37 of file shpolicy.c.

◆ SHELL_NO_POLICY

#define SHELL_NO_POLICY   0xffffffff

Definition at line 48 of file shpolicy.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 36 of file shpolicy.c.

Typedef Documentation

◆ LPPOLICYDATA

◆ POLICYDATA

Function Documentation

◆ SHRestricted()

DWORD WINAPI SHRestricted ( RESTRICTIONS  policy)

Definition at line 827 of file shpolicy.c.

828{
829 char regstr[256];
830 HKEY xhkey;
831 DWORD retval, datsize = 4;
833
834 TRACE("(%08x)\n", policy);
835
836 /* scan to see if we know this policy ID */
837 for (p = sh32_policy_table; p->policy; p++)
838 {
839 if (policy == p->policy)
840 {
841 break;
842 }
843 }
844
845 if (p->policy == 0)
846 {
847 /* we don't know this policy, return 0 */
848 TRACE("unknown policy: (%08x)\n", policy);
849 return 0;
850 }
851
852 /* we have a known policy */
853
854 /* first check if this policy has been cached, return it if so */
855 if (p->cache != SHELL_NO_POLICY)
856 {
857 return p->cache;
858 }
859
860 lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\");
861 lstrcatA(regstr, p->appstr);
862
863 /* return 0 and don't set the cache if any registry errors occur */
864#ifndef __REACTOS__
865 retval = 0;
866 if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS)
867#else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup()
868 // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm
869 retval = RegOpenKeyA(HKEY_LOCAL_MACHINE, regstr, &xhkey);
870 if (retval != ERROR_SUCCESS)
871 {
872 retval = RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey);
873 if (retval != ERROR_SUCCESS)
874 return 0;
875 }
876#endif
877 {
878 if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS)
879 {
880 p->cache = retval;
881 }
882 RegCloseKey(xhkey);
883 }
884 return retval;
885}
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3254
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4024
unsigned long DWORD
Definition: ntddk_ex.h:95
WDF_INTERRUPT_POLICY policy
GLfloat GLfloat p
Definition: glext.h:8902
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define SHELL_NO_POLICY
Definition: shpolicy.c:48
static POLICYDATA sh32_policy_table[]
Definition: shpolicy.c:130
#define TRACE(s)
Definition: solgame.cpp:4
DWORD policy
Definition: shpolicy.c:52
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by CStartMenuSettingsPage::_UpdateDialog(), SettingsMenu::AddEntries(), BrowseMenu::AddEntries(), SearchMenu::AddEntries(), CStartMenuBtnCtxMenu::AddStartContextMenuItems(), CStartMenuSite::AppendMenu(), CTrayWindow::HandleCommand(), DesktopBar::Init(), StartMenuRoot::Init(), CDefView::OnCommand(), CTrayWindow::OnContextMenu(), CTrayWindow::OnSysChar(), CTrayBandSite::ProcessMessage(), ProcessStartupItems(), CTrayWindowCtxMenu::QueryContextMenu(), NotifyArea::read_config(), SHFindFiles(), and StartMenuRoot::StartMenuRoot().

◆ SHSettingsChanged()

BOOL WINAPI SHSettingsChanged ( LPCVOID  unused,
LPCVOID  inpRegKey 
)

Definition at line 904 of file shpolicy.c.

905{
906 TRACE("(%p, %p)\n", unused, inpRegKey);
907
908 /* first check - if input is non-NULL and points to the secret
909 key string, then pass. Otherwise return 0.
910 */
911 if (inpRegKey != NULL)
912 {
913 if (SHELL_OsIsUnicode())
914 {
915 if (lstrcmpiW(inpRegKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies") &&
916 lstrcmpiW(inpRegKey, L"Policy"))
917 /* doesn't match, fail */
918 return FALSE;
919 }
920 else
921 {
922 if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies") &&
923 lstrcmpiA(inpRegKey, "Policy"))
924 /* doesn't match, fail */
925 return FALSE;
926 }
927 }
928
929 return TRUE;
930}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
WORD unused[29]
Definition: crypt.c:1155
#define L(x)
Definition: ntvdm.h:50
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130

Referenced by IntSetShellStateSettings(), and IntSetUnderlineState().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ sh32_policy_table

POLICYDATA sh32_policy_table[]
static

Definition at line 130 of file shpolicy.c.

Referenced by SHRestricted().

◆ strActiveDesk

const char strActiveDesk[] = {"ActiveDesktop"}
static

Definition at line 61 of file shpolicy.c.

◆ strAddRemoveProgs

const char strAddRemoveProgs[] = {"AddRemoveProgs"}
static

Definition at line 63 of file shpolicy.c.

◆ strClassicShell

const char strClassicShell[] = {"ClassicShell"}
static

Definition at line 87 of file shpolicy.c.

◆ strClearRecentDocs

const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"}
static

Definition at line 88 of file shpolicy.c.

◆ strEnforceShlExtSecurity

const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"}
static

Definition at line 103 of file shpolicy.c.

◆ strExplorer

const char strExplorer[] = {"Explorer"}
static

Definition at line 60 of file shpolicy.c.

◆ strForceCopyACLW

const char strForceCopyACLW[] = {"ForceCopyACLWithFile"}
static

Definition at line 74 of file shpolicy.c.

◆ strLnkResolveIgnoreLnkInfo

const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"}
static

Definition at line 101 of file shpolicy.c.

◆ strMyDocsOnNet

const char strMyDocsOnNet[] = {"MyDocsOnNet"}
static

Definition at line 105 of file shpolicy.c.

◆ strNoActiveDesktop

const char strNoActiveDesktop[] = {"NoActiveDesktop"}
static

Definition at line 91 of file shpolicy.c.

◆ strNoActiveDesktopChanges

const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"}
static

Definition at line 90 of file shpolicy.c.

◆ strNoAddComponent

const char strNoAddComponent[] = {"NoAddingComponents"}
static

Definition at line 82 of file shpolicy.c.

◆ strNoAddPrinters

const char strNoAddPrinters[] = {"NoAddPrinter"}
static

Definition at line 107 of file shpolicy.c.

◆ strNoChangeStartMenu

const char strNoChangeStartMenu[] = {"NoChangeStartMenu"}
static

Definition at line 69 of file shpolicy.c.

◆ strNoChangeWallpaper

const char strNoChangeWallpaper[] = {"NoChangingWallpaper"}
static

Definition at line 84 of file shpolicy.c.

◆ strNoClose

const char strNoClose[] = {"NoClose"}
static

Definition at line 123 of file shpolicy.c.

◆ strNoCloseComponent

const char strNoCloseComponent[] = {"NoClosingComponents"}
static

Definition at line 80 of file shpolicy.c.

◆ strNoCloseDragDrop

const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"}
static

Definition at line 79 of file shpolicy.c.

◆ strNoCommonGroups

const char strNoCommonGroups[] = {"NoCommonGroups"}
static

Definition at line 102 of file shpolicy.c.

◆ strNoComponent

const char strNoComponent[] = {"NoComponents"}
static

Definition at line 83 of file shpolicy.c.

◆ strNoCustomWebView

const char strNoCustomWebView[] = {"NoCustomizeWebView"}
static

Definition at line 86 of file shpolicy.c.

◆ strNoDelComponent

const char strNoDelComponent[] = {"NoDeletingComponents"}
static

Definition at line 81 of file shpolicy.c.

◆ strNoDeletePrinters

const char strNoDeletePrinters[] = {"NoDeletePrinter"}
static

Definition at line 108 of file shpolicy.c.

◆ strNoDesktop

const char strNoDesktop[] = {"NoDesktop"}
static

Definition at line 118 of file shpolicy.c.

◆ strNoDrives

const char strNoDrives[] = {"NoDrives"}
static

Definition at line 116 of file shpolicy.c.

◆ strNoDrivesAutoRun

const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"}
static

Definition at line 114 of file shpolicy.c.

◆ strNoDriveTypeAtRun

const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"}
static

Definition at line 113 of file shpolicy.c.

◆ strNoEditComponent

const char strNoEditComponent[] = {"NoEditingComponents"}
static

Definition at line 77 of file shpolicy.c.

◆ strNoFavoritesMenu

const char strNoFavoritesMenu[] = {"NoFavoritesMenu"}
static

Definition at line 89 of file shpolicy.c.

◆ strNoFileMenu

const char strNoFileMenu[] = {"NoFileMenu"}
static

Definition at line 121 of file shpolicy.c.

◆ strNoFileURL

const char strNoFileURL[] = {"NoFileUrl"}
static

Definition at line 67 of file shpolicy.c.

◆ strNoFind

const char strNoFind[] = {"NoFind"}
static

Definition at line 117 of file shpolicy.c.

◆ strNoFolderOptions

const char strNoFolderOptions[] = {"NoFolderOptions"}
static

Definition at line 68 of file shpolicy.c.

◆ strNoForgetSoftwareUpdate

const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"}
static

Definition at line 72 of file shpolicy.c.

◆ strNoHTMLWallpaper

const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"}
static

Definition at line 85 of file shpolicy.c.

◆ strNoInetIcon

const char strNoInetIcon[] = {"NoInternetIcon"}
static

Definition at line 94 of file shpolicy.c.

◆ strNoLogoff

const char strNoLogoff[] = {"NoLogoff"}
static

Definition at line 96 of file shpolicy.c.

◆ strNoMovingBand

const char strNoMovingBand[] = {"NoMovingBands"}
static

Definition at line 78 of file shpolicy.c.

◆ strNoNetConDis

const char strNoNetConDis[] = {"NoNetConnectDisconnect"}
static

Definition at line 97 of file shpolicy.c.

◆ strNoNetworkNeighborhood

const char strNoNetworkNeighborhood[] = {"NoNetHood"}
static

Definition at line 112 of file shpolicy.c.

◆ strNoPrintTab

const char strNoPrintTab[] = {"NoPrinterTabs"}
static

Definition at line 109 of file shpolicy.c.

◆ strNoRealMode

const char strNoRealMode[] = {"NoRealMode"}
static

Definition at line 104 of file shpolicy.c.

◆ strNoRecentDocHistory

const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"}
static

Definition at line 93 of file shpolicy.c.

◆ strNoRecentDocMenu

const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"}
static

Definition at line 92 of file shpolicy.c.

◆ strNoResolveSearch

const char strNoResolveSearch[] = {"NoResolveSearch"}
static

Definition at line 76 of file shpolicy.c.

◆ strNoResolveTrk

const char strNoResolveTrk[] = {"NoResolveTrack"}
static

Definition at line 75 of file shpolicy.c.

◆ strNoRun

const char strNoRun[] = {"NoRun"}
static

Definition at line 124 of file shpolicy.c.

◆ strNoSaveSetting

const char strNoSaveSetting[] = {"NoSaveSettings"}
static

Definition at line 122 of file shpolicy.c.

◆ strNoSetActiveDesktop

const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"}
static

Definition at line 71 of file shpolicy.c.

◆ strNoSetFld

const char strNoSetFld[] = {"NoSetFolders"}
static

Definition at line 120 of file shpolicy.c.

◆ strNoSetTaskBar

const char strNoSetTaskBar[] = {"NoSetTaskbar"}
static

Definition at line 119 of file shpolicy.c.

◆ strNoSettingsWizard

const char strNoSettingsWizard[] = {"NoSettingsWizards"}
static

Definition at line 95 of file shpolicy.c.

◆ strNoStartBanner

const char strNoStartBanner[] = {"NoStartBanner"}
static

Definition at line 111 of file shpolicy.c.

◆ strNoStartMenuSubfolder

const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"}
static

Definition at line 106 of file shpolicy.c.

◆ strNoTrayContextMenu

const char strNoTrayContextMenu[] = {"NoTrayContextMenu"}
static

Definition at line 99 of file shpolicy.c.

◆ strNoViewContextMenu

const char strNoViewContextMenu[] = {"NoViewContextMenu"}
static

Definition at line 98 of file shpolicy.c.

◆ strNoWebMenu

const char strNoWebMenu[] = {"NoWebMenu"}
static

Definition at line 100 of file shpolicy.c.

◆ strNoWindowsUpdate

const char strNoWindowsUpdate[] = {"NoWindowsUpdate"}
static

Definition at line 70 of file shpolicy.c.

◆ strRestrictRun

const char strRestrictRun[] = {"RestrictRun"}
static

Definition at line 110 of file shpolicy.c.

◆ strSeparateProcess

const char strSeparateProcess[] = {"SeparateProcess"}
static

Definition at line 115 of file shpolicy.c.

◆ strWinOldApp

const char strWinOldApp[] = {"WinOldApp"}
static

Definition at line 62 of file shpolicy.c.