ReactOS  0.4.13-dev-79-gcd489d8
CLayerUIPropPage.cpp File Reference
#include "precomp.h"
#include <shlwapi.h>
#include <shellapi.h>
#include <shellutils.h>
#include <strsafe.h>
#include <apphelp.h>
#include <windowsx.h>
#include <sfc.h>
Include dependency graph for CLayerUIPropPage.cpp:

Go to the source code of this file.

Macros

#define GPLK_USER   1
 
#define GPLK_MACHINE   2
 
#define MAX_LAYER_LENGTH   256
 
#define ACDBG(fmt, ...)   ACDBG_FN(__FUNCTION__, fmt, ##__VA_ARGS__ )
 

Functions

BOOL IsBuiltinLayer (PCWSTR Name)
 
void ACDBG_FN (PCSTR FunctionName, PCWSTR Format,...)
 
static BOOL GetLayerInfo (PCWSTR Filename, DWORD QueryFlags, PDWORD OSMode, PDWORD Enabledlayers, CSimpleArray< CString > &customLayers)
 
static BOOL ArrayEquals (const CSimpleArray< CString > &lhs, const CSimpleArray< CString > &rhs)
 
static BOOL DisableShellext ()
 

Variables

const GUID CLSID_CLayerUIPropPage = { 0x513D916F, 0x2A8E, 0x4F51, { 0xAE, 0xAB, 0x0C, 0xBC, 0x76, 0xFB, 0x1A, 0xF8 } }
 
struct {
   const PCWSTR   Display
 
   const PCWSTR   Name
 
g_CompatModes []
 
struct {
   const PCWSTR   Name
 
   DWORD   Id
 
g_Layers []
 
static const WCHARg_AllowedExtensions []
 

Macro Definition Documentation

◆ ACDBG

#define ACDBG (   fmt,
  ... 
)    ACDBG_FN(__FUNCTION__, fmt, ##__VA_ARGS__ )

Definition at line 107 of file CLayerUIPropPage.cpp.

◆ GPLK_MACHINE

#define GPLK_MACHINE   2

Definition at line 21 of file CLayerUIPropPage.cpp.

◆ GPLK_USER

#define GPLK_USER   1

Definition at line 20 of file CLayerUIPropPage.cpp.

◆ MAX_LAYER_LENGTH

#define MAX_LAYER_LENGTH   256

Definition at line 22 of file CLayerUIPropPage.cpp.

Function Documentation

◆ ACDBG_FN()

void ACDBG_FN ( PCSTR  FunctionName,
PCWSTR  Format,
  ... 
)

Definition at line 93 of file CLayerUIPropPage.cpp.

94 {
95  WCHAR Buffer[512];
96  WCHAR* Current = Buffer;
97  size_t Length = _countof(Buffer);
98 
99  StringCchPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, L"[%-20S] ", FunctionName);
100  va_list ArgList;
101  va_start(ArgList, Format);
102  StringCchVPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, Format, ArgList);
103  va_end(ArgList);
105 }
#define _countof(array)
Definition: fontsub.cpp:30
STRSAFEAPI StringCchPrintfExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:585
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
Definition: bufpool.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
STRSAFEAPI StringCchVPrintfExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat, va_list argList)
Definition: strsafe.h:661
#define va_start(ap, A)
Definition: acmsvcex.h:91
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
Definition: acpixf.h:1252
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

◆ ArrayEquals()

static BOOL ArrayEquals ( const CSimpleArray< CString > &  lhs,
const CSimpleArray< CString > &  rhs 
)
static

Definition at line 278 of file CLayerUIPropPage.cpp.

279 {
280  if (lhs.GetSize() != rhs.GetSize())
281  return FALSE;
282 
283  for (int n = 0; n < lhs.GetSize(); ++n)
284  {
285  if (lhs[n] != rhs[n])
286  return FALSE;
287  }
288  return TRUE;
289 }
#define TRUE
Definition: types.h:120
GLdouble n
Definition: glext.h:7729

Referenced by CLayerUIPropPage::HasChanges().

◆ DisableShellext()

static BOOL DisableShellext ( )
static

Definition at line 421 of file CLayerUIPropPage.cpp.

422 {
423  HKEY hkey;
424  LSTATUS ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", 0, KEY_QUERY_VALUE, &hkey);
425  BOOL Disable = FALSE;
426  if (ret == ERROR_SUCCESS)
427  {
428  DWORD dwValue = 0;
429  DWORD type, size = sizeof(dwValue);
430  ret = RegQueryValueExW(hkey, L"DisableEngine", NULL, &type, (PBYTE)&dwValue, &size);
431  if (ret == ERROR_SUCCESS && type == REG_DWORD)
432  {
433  Disable = !!dwValue;
434  }
435  if (!Disable)
436  {
437  size = sizeof(dwValue);
438  ret = RegQueryValueExW(hkey, L"DisablePropPage", NULL, &type, (PBYTE)&dwValue, &size);
439  if (ret == ERROR_SUCCESS && type == REG_DWORD)
440  {
441  Disable = !!dwValue;
442  }
443  }
444 
445  RegCloseKey(hkey);
446  }
447  return Disable;
448 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
unsigned long DWORD
Definition: ntddk_ex.h:95
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CLayerUIPropPage::Initialize().

◆ GetLayerInfo()

static BOOL GetLayerInfo ( PCWSTR  Filename,
DWORD  QueryFlags,
PDWORD  OSMode,
PDWORD  Enabledlayers,
CSimpleArray< CString > &  customLayers 
)
static

Definition at line 214 of file CLayerUIPropPage.cpp.

215 {
217  DWORD dwBytes = sizeof(wszLayers);
218 
219  *OSMode = *Enabledlayers = 0;
220  customLayers.RemoveAll();
221  if (!SdbGetPermLayerKeys(Filename, wszLayers, &dwBytes, QueryFlags))
222  return FALSE;
223 
224  for (PWCHAR Layer = wcstok(wszLayers, L" "); Layer; Layer = wcstok(NULL, L" "))
225  {
226  size_t n;
227  for (n = 0; g_Layers[n].Name; ++n)
228  {
229  if (!wcsicmp(g_Layers[n].Name, Layer))
230  {
231  *Enabledlayers |= (1<<n);
232  break;
233  }
234  }
235  /* Did we find it? */
236  if (g_Layers[n].Name)
237  continue;
238 
239  for (n = 0; g_CompatModes[n].Name; ++n)
240  {
241  if (!wcsicmp(g_CompatModes[n].Name, Layer))
242  {
243  *OSMode = n+1;
244  break;
245  }
246  }
247  /* Did we find it? */
248  if (g_CompatModes[n].Name)
249  continue;
250 
251  /* Must be a 'custom' layer */
252  customLayers.Add(Layer);
253  }
254  return TRUE;
255 }
static struct @290 g_Layers[]
#define TRUE
Definition: types.h:120
_Check_return_ _CRTIMP wchar_t *__cdecl wcstok(_Inout_opt_z_ wchar_t *_Str, _In_z_ const wchar_t *_Delim)
GLdouble n
Definition: glext.h:7729
uint16_t * PWCHAR
Definition: typedefs.h:54
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:925
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SdbGetPermLayerKeys(PCWSTR wszPath, PWSTR pwszLayers, PDWORD pdwBytes, DWORD dwFlags)
Definition: layer.c:364
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define MAX_LAYER_LENGTH
#define wcsicmp
Definition: string.h:1152
static struct @289 g_CompatModes[]
static PCWSTR wszLayers
Definition: layerapi.c:33
Definition: xml2sdb.h:110

Referenced by CLayerUIPropPage::OnSetActive().

◆ IsBuiltinLayer()

BOOL IsBuiltinLayer ( PCWSTR  Name)

Definition at line 70 of file CLayerUIPropPage.cpp.

71 {
72  size_t n;
73 
74  for (n = 0; g_Layers[n].Name; ++n)
75  {
76  if (!wcsicmp(g_Layers[n].Name, Name))
77  {
78  return TRUE;
79  }
80  }
81 
82  for (n = 0; g_CompatModes[n].Name; ++n)
83  {
85  {
86  return TRUE;
87  }
88  }
89  return FALSE;
90 }
static struct @290 g_Layers[]
#define TRUE
Definition: types.h:120
GLdouble n
Definition: glext.h:7729
#define wcsicmp
Definition: string.h:1152
static struct @289 g_CompatModes[]

Referenced by CLayerStringList::Next().

Variable Documentation

◆ CLSID_CLayerUIPropPage

const GUID CLSID_CLayerUIPropPage = { 0x513D916F, 0x2A8E, 0x4F51, { 0xAE, 0xAB, 0x0C, 0xBC, 0x76, 0xFB, 0x1A, 0xF8 } }

Definition at line 18 of file CLayerUIPropPage.cpp.

◆ Display

Definition at line 25 of file CLayerUIPropPage.cpp.

◆ g_AllowedExtensions

const WCHAR* g_AllowedExtensions[]
static
Initial value:
= {
L".exe",
L".msi",
L".pif",
L".bat",
L".cmd",
0
}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 61 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::InitFile().

◆ g_CompatModes

struct { ... } g_CompatModes[]
Initial value:
= {
{ L"Windows 95", L"WIN95" },
{ L"Windows 98/ME", L"WIN98" },
{ L"Windows NT 4.0 (SP5)", L"NT4SP5" },
{ L"Windows 2000", L"WIN2000" },
{ L"Windows XP (SP2)", L"WINXPSP2" },
{ L"Windows XP (SP3)", L"WINXPSP3" },
{ L"Windows Server 2003 (SP1)", L"WINSRV03SP1" },
{ L"Windows Server 2008 (SP1)", L"WINSRV08SP1" },
{ L"Windows Vista", L"VISTARTM" },
{ L"Windows Vista (SP1)", L"VISTASP1" },
{ L"Windows Vista (SP2)", L"VISTASP2" },
{ L"Windows 7", L"WIN7RTM" },
{ L"Windows 7 (SP1)", L"WIN7SP1" },
{ L"Windows 8", L"WIN8RTM" },
{ L"Windows 8.1", L"WIN81RTM" },
{ NULL, NULL }
}
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250

Referenced by GetLayerInfo(), IsBuiltinLayer(), CLayerUIPropPage::OnApply(), and CLayerUIPropPage::OnInitDialog().

◆ g_Layers

struct { ... } g_Layers[]
Initial value:
= {
{ L"256COLOR", IDC_CHKRUNIN256COLORS },
{ L"640X480", IDC_CHKRUNIN640480RES },
{ L"DISABLETHEMES", IDC_CHKDISABLEVISUALTHEMES },
{ NULL, 0 }
}
#define IDC_CHKDISABLEVISUALTHEMES
Definition: resource.h:11
smooth NULL
Definition: ftsmooth.c:416
#define IDC_CHKRUNIN256COLORS
Definition: resource.h:9
static const WCHAR L[]
Definition: oid.c:1250
#define IDC_CHKRUNIN640480RES
Definition: resource.h:10

Referenced by CLayerUIPropPage::DisableControls(), GetLayerInfo(), IsBuiltinLayer(), CLayerUIPropPage::OnApply(), CLayerUIPropPage::OnSetActive(), and CLayerUIPropPage::UpdateControls().

◆ Id

DWORD Id

Definition at line 48 of file CLayerUIPropPage.cpp.

Referenced by AcpiUtIsPciRootBridge(), AsyncReader_FindPin(), BasePinImpl_QueryId(), BaseRendererImpl_FindPin(), BlHtCreate(), BlockIoFirmwareOpen(), BlpIoRegisterDestroyRoutine(), BlResourceFindMessage(), CabinetSelectCodec(), CheckUnattendedSetup(), COMDLG32_FR_HandleWMCommand(), CreateLanguageList(), CLayerUIPropPage::DisableControls(), CardWindow::DistributeStacks(), DosGetFileDescriptor(), EnableFileMenuItemByID(), EnumResourceLanguagesA(), EnumResourceLanguagesW(), EnumResourceNamesA(), EnumResourceNamesW(), EnumResourceTypesA(), EnumResourceTypesW(), EventDescCreate(), EventDescSetId(), FillDeviceComboBox(), find_entry_by_id(), CKsProxy::FindPin(), GetDevNum(), GetDiskBySCSI(), HalpQueryIdFdo(), HalpQueryIdPdo(), HandleFile(), InitializeIdEntry(), IopValidateID(), KdbpGetComponentId(), KdRosSetDebugCallback(), KiSystemService(), KiSystemServiceHandler(), LsapAddAuthPackage(), MENU_ButtonUp(), MENU_DoNextMenu(), NtfsMoonWalkID(), CLayerUIPropPage::OnSetActive(), Parser_FindPin(), PrintDeviceData(), ProcessComputerFiles(), ProcessDisplayRegistry(), ProcessKeyboardLayoutRegistry(), ProcessLocaleRegistry(), QueryDeviceInformation(), CPin::QueryId(), CInputPin::QueryId(), COutputPin::QueryId(), ResFindDirectoryEntry(), CCabinet::SelectCodec(), SetGeoID(), SetPaletteEntry(), SetPaletteEntryRGB(), SetupStartPage(), TbdDockBarIdFromClientWindow(), TdiQueryInformationEx(), test_AT_ARP_STATS(), test_IF_MIB_STATS(), test_IP_MIB_STATS(), TOOLBAR_ChangeBitmap(), TOOLBAR_CheckButton(), TOOLBAR_CommandToIndex(), TOOLBAR_EnableButton(), TOOLBAR_GetBitmap(), TOOLBAR_GetButtonInfoT(), TOOLBAR_GetButtonText(), TOOLBAR_GetRect(), TOOLBAR_GetState(), TOOLBAR_HideButton(), TOOLBAR_Indeterminate(), TOOLBAR_IsButtonChecked(), TOOLBAR_IsButtonEnabled(), TOOLBAR_IsButtonHidden(), TOOLBAR_IsButtonHighlighted(), TOOLBAR_IsButtonIndeterminate(), TOOLBAR_IsButtonPressed(), TOOLBAR_MarkButton(), TOOLBAR_MoveButton(), TOOLBAR_PressButton(), TOOLBAR_SetButtonInfo(), TOOLBAR_SetState(), TransformFilterImpl_FindPin(), UDFCommonCreate(), UDFFindFileId(), UDFGetOpenParamsByFileId(), UDFRemoveFileId(), UDFStoreFileId(), CLayerUIPropPage::UpdateControls(), UpdateKBLayout(), UpdatePriority(), USBH_PdoQueryId(), USBHUB_DumpingIDs(), USBPORT_GetDeviceHwIds(), and USBPORT_PdoPnP().

◆ Name

Definition at line 26 of file CLayerUIPropPage.cpp.