ReactOS 0.4.15-dev-7788-g1ad9096
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 82 of file shpolicy.c.

83{
84 HANDLE hGlobalCounter;
85 if (*phGlobalCounter)
86 return *phGlobalCounter;
87 hGlobalCounter = SHGlobalCounterCreate(rguid);
88 if (InterlockedCompareExchangePointer(phGlobalCounter, hGlobalCounter, NULL))
89 CloseHandle(hGlobalCounter);
90 return *phGlobalCounter;
91}
#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 103 of file shpolicy.c.

104{
105 return SHELL_GetCachedGlobalCounter(&g_hRestGlobalCounter, &GUID_Restrictions);
106}
HANDLE g_hRestGlobalCounter
Definition: shpolicy.c:65
static HANDLE SHELL_GetCachedGlobalCounter(_Inout_ HANDLE *phGlobalCounter, _In_ REFGUID rguid)
Definition: shpolicy.c:82

Referenced by SHELL_QueryRestrictionsChanged(), and SHSettingsChanged().

◆ SHELL_QueryRestrictionsChanged()

static BOOL SHELL_QueryRestrictionsChanged ( VOID  )
static

Definition at line 115 of file shpolicy.c.

116{
119 return FALSE;
120
122 return TRUE;
123}
#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:103
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 146 of file shpolicy.c.

147{
148 TRACE("(0x%08lX)\n", rest);
149
150 /* If restrictions from registry have changed, reset all cached values to SHELL_NO_POLICY */
152 FillMemory(&g_RestValues, sizeof(g_RestValues), 0xFF);
153
155}
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:115
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(), AddCustomizeItem(), 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 174 of file shpolicy.c.

175{
176 TRACE("(%p, %s)\n", unused, debugstr_w(pszKey));
177
178 if (pszKey &&
179 lstrcmpiW(L"Policy", pszKey) != 0 &&
180 lstrcmpiW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies", pszKey) != 0)
181 {
182 return FALSE;
183 }
184
186}
LONG WINAPI SHGlobalCounterIncrement(HANDLE hSem)
Definition: thread.c:453
#define debugstr_w
Definition: kernel32.h:32
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

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().