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

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define DEFINE_POLICY(policy, appstr, keystr)    { policy, L##appstr, L##keystr }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
 DEFINE_GUID (GUID_Restrictions, 0xA48F1A32, 0xA340, 0x11D1, 0xBC, 0x6B, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1)
 
static HANDLE SHELL_GetCachedGlobalCounter (_Inout_ HANDLE *phGlobalCounter, _In_ REFGUID rguid)
 
static HANDLE SHELL_GetRestrictionsCounter (VOID)
 
static BOOL SHELL_QueryRestrictionsChanged (VOID)
 
DWORD WINAPI SHRestricted (RESTRICTIONS rest)
 
BOOL WINAPI SHSettingsChanged (LPCVOID unused, LPCWSTR pszKey)
 

Variables

static const POLICYDATA s_PolicyTable []
 
HANDLE g_hRestGlobalCounter = NULL
 
LONG g_nRestCountValue = -1
 
DWORD g_RestValues [_countof(s_PolicyTable)] = { 0 }
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 36 of file shpolicy.c.

◆ DEFINE_POLICY

#define DEFINE_POLICY (   policy,
  appstr,
  keystr 
)     { policy, L##appstr, L##keystr }

Definition at line 51 of file shpolicy.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 35 of file shpolicy.c.

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( GUID_Restrictions  ,
0xA48F1A32  ,
0xA340  ,
0x11D1  ,
0xBC  ,
0x6B  ,
0x00  ,
0xA0  ,
0xC9  ,
0x03  ,
0x12  ,
0xE1   
)

◆ SHELL_GetCachedGlobalCounter()

static HANDLE SHELL_GetCachedGlobalCounter ( _Inout_ HANDLE phGlobalCounter,
_In_ REFGUID  rguid 
)
static

Definition at line 86 of file shpolicy.c.

87{
88 HANDLE hGlobalCounter;
89 if (*phGlobalCounter)
90 return *phGlobalCounter;
91 hGlobalCounter = SHGlobalCounterCreate(rguid);
92 if (InterlockedCompareExchangePointer(phGlobalCounter, hGlobalCounter, NULL))
93 CloseHandle(hGlobalCounter);
94 return *phGlobalCounter;
95}
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI SHGlobalCounterCreate(REFGUID guid)
Definition: thread.c:551
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129

Referenced by SHELL_GetRestrictionsCounter().

◆ SHELL_GetRestrictionsCounter()

static HANDLE SHELL_GetRestrictionsCounter ( VOID  )
static

Definition at line 107 of file shpolicy.c.

108{
109 return SHELL_GetCachedGlobalCounter(&g_hRestGlobalCounter, &GUID_Restrictions);
110}
HANDLE g_hRestGlobalCounter
Definition: shpolicy.c:65
static HANDLE SHELL_GetCachedGlobalCounter(_Inout_ HANDLE *phGlobalCounter, _In_ REFGUID rguid)
Definition: shpolicy.c:86

Referenced by SHELL_QueryRestrictionsChanged(), and SHSettingsChanged().

◆ SHELL_QueryRestrictionsChanged()

static BOOL SHELL_QueryRestrictionsChanged ( VOID  )
static

Definition at line 119 of file shpolicy.c.

120{
123 return FALSE;
124
126 return TRUE;
127}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI SHGlobalCounterGetValue(HANDLE hSem)
Definition: thread.c:432
long LONG
Definition: pedump.c:60
static HANDLE SHELL_GetRestrictionsCounter(VOID)
Definition: shpolicy.c:107
LONG g_nRestCountValue
Definition: shpolicy.c:66
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by SHRestricted().

◆ SHRestricted()

DWORD WINAPI SHRestricted ( RESTRICTIONS  rest)

Definition at line 150 of file shpolicy.c.

151{
152 TRACE("(0x%08lX)\n", rest);
153
154 /* If restrictions from registry have changed, reset all cached values to SHELL_NO_POLICY */
156 FillMemory(&g_RestValues, sizeof(g_RestValues), 0xFF);
157
159}
DWORD WINAPI SHRestrictionLookup(DWORD policy, LPCWSTR initial, LPPOLICYDATA polTable, LPDWORD polArr)
Definition: ordinal.c:2807
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
static BOOL SHELL_QueryRestrictionsChanged(VOID)
Definition: shpolicy.c:119
DWORD g_RestValues[_countof(s_PolicyTable)]
Definition: shpolicy.c:67
static const POLICYDATA s_PolicyTable[]
Definition: shpolicy.c:54
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ SHSettingsChanged()

BOOL WINAPI SHSettingsChanged ( LPCVOID  unused,
LPCWSTR  pszKey 
)

Definition at line 178 of file shpolicy.c.

179{
180 TRACE("(%p, %s)\n", unused, debugstr_w(pszKey));
181
182 if (pszKey &&
183 lstrcmpiW(L"Policy", pszKey) != 0 &&
184 lstrcmpiW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies", pszKey) != 0)
185 {
186 return FALSE;
187 }
188
190}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
LONG WINAPI SHGlobalCounterIncrement(HANDLE hSem)
Definition: thread.c:453
#define debugstr_w
Definition: kernel32.h:32
WORD unused[29]
Definition: crypt.c:1155
#define L(x)
Definition: ntvdm.h:50

Referenced by IntSetShellStateSettings(), and IntSetUnderlineState().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ g_hRestGlobalCounter

HANDLE g_hRestGlobalCounter = NULL

Definition at line 65 of file shpolicy.c.

Referenced by SHELL_GetRestrictionsCounter().

◆ g_nRestCountValue

LONG g_nRestCountValue = -1

Definition at line 66 of file shpolicy.c.

Referenced by SHELL_QueryRestrictionsChanged().

◆ g_RestValues

DWORD g_RestValues[_countof(s_PolicyTable)] = { 0 }

Definition at line 67 of file shpolicy.c.

Referenced by SHRestricted().

◆ s_PolicyTable

const POLICYDATA s_PolicyTable[]
static
Initial value:
=
{
{ 0, NULL, NULL }
}

Definition at line 54 of file shpolicy.c.

Referenced by SHRestricted().