ReactOS  0.4.10-dev-2-g0fbaea8
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 ACP_WNDPROP   L"{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}.Prop"
 
#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 void ListboxChanged (HWND hWnd)
 
static void OnAdd (HWND hWnd)
 
static BOOL ComboHasData (HWND hWnd)
 
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

#define ACDBG (   fmt,
  ... 
)    ACDBG_FN(__FUNCTION__, fmt, ##__VA_ARGS__ )
#define ACP_WNDPROP   L"{513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}.Prop"

Definition at line 19 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc().

#define GPLK_MACHINE   2

Definition at line 22 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::OnApply().

#define GPLK_USER   1

Definition at line 21 of file CLayerUIPropPage.cpp.

#define MAX_LAYER_LENGTH   256

Definition at line 23 of file CLayerUIPropPage.cpp.

Referenced by GetLayerInfo().

Function Documentation

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

Definition at line 91 of file CLayerUIPropPage.cpp.

92 {
93  WCHAR Buffer[512];
94  WCHAR* Current = Buffer;
95  size_t Length = _countof(Buffer);
96 
97  StringCchPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, L"[%-20S] ", FunctionName);
98  va_list ArgList;
99  va_start(ArgList, Format);
100  StringCchVPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, Format, ArgList);
101  va_end(ArgList);
102  OutputDebugStringW(Buffer);
103 }
Definition: bidi.c:85
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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
UINTN VOID * Buffer
Definition: acefiex.h:370
VOID UINTN Length
Definition: acefiex.h:744
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 const char UINT32 const char * FunctionName
Definition: acpixf.h:1256
#define STRSAFE_NULL_ON_FAILURE
Definition: ntstrsafe.h:47
static BOOL ArrayEquals ( const CSimpleArray< CString > &  lhs,
const CSimpleArray< CString > &  rhs 
)
static

Definition at line 276 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::HasChanges().

277 {
278  if (lhs.GetSize() != rhs.GetSize())
279  return FALSE;
280 
281  for (int n = 0; n < lhs.GetSize(); ++n)
282  {
283  if (lhs[n] != rhs[n])
284  return FALSE;
285  }
286  return TRUE;
287 }
#define TRUE
Definition: types.h:120
GLuint n
Definition: s_context.h:57
#define FALSE
Definition: types.h:117
static BOOL ComboHasData ( HWND  hWnd)
static

Definition at line 443 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc().

444 {
446  if (ComboBox_GetCurSel(Combo) >= 0)
447  return TRUE;
449  return Len > 0;
450 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
#define IDC_NEWCOMPATIBILITYMODE
Definition: resource.h:15
HANDLE HWND
Definition: compat.h:13
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:34
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define Len
Definition: deflate.h:82
unsigned int ULONG
Definition: retypes.h:1
static BOOL DisableShellext ( )
static

Definition at line 578 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::Initialize().

579 {
580  HKEY hkey;
581  LSTATUS ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", 0, KEY_QUERY_VALUE, &hkey);
582  BOOL Disable = FALSE;
583  if (ret == ERROR_SUCCESS)
584  {
585  DWORD dwValue = 0;
586  DWORD type, size = sizeof(dwValue);
587  ret = RegQueryValueExW(hkey, L"DisableEngine", NULL, &type, (PBYTE)&dwValue, &size);
588  if (ret == ERROR_SUCCESS && type == REG_DWORD)
589  {
590  Disable = !!dwValue;
591  }
592  if (!Disable)
593  {
594  size = sizeof(dwValue);
595  ret = RegQueryValueExW(hkey, L"DisablePropPage", NULL, &type, (PBYTE)&dwValue, &size);
596  if (ret == ERROR_SUCCESS && type == REG_DWORD)
597  {
598  Disable = !!dwValue;
599  }
600  }
601 
602  RegCloseKey(hkey);
603  }
604  return Disable;
605 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:85
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
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
HANDLE HKEY
Definition: registry.h:24
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
int ret
#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:539
BYTE * PBYTE
Definition: pedump.c:66
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static BOOL GetLayerInfo ( PCWSTR  Filename,
DWORD  QueryFlags,
PDWORD  OSMode,
PDWORD  Enabledlayers,
CSimpleArray< CString > &  customLayers 
)
static

Definition at line 212 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::OnSetActive().

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

Definition at line 68 of file CLayerUIPropPage.cpp.

Referenced by CLayerStringList::Next().

69 {
70  size_t n;
71 
72  for (n = 0; g_Layers[n].Name; ++n)
73  {
74  if (!wcsicmp(g_Layers[n].Name, Name))
75  {
76  return TRUE;
77  }
78  }
79 
80  for (n = 0; g_CompatModes[n].Name; ++n)
81  {
82  if (!wcsicmp(g_CompatModes[n].Name, Name))
83  {
84  return TRUE;
85  }
86  }
87  return FALSE;
88 }
#define TRUE
Definition: types.h:120
GLuint n
Definition: s_context.h:57
#define FALSE
Definition: types.h:117
_In_ PUNICODE_STRING Name
Definition: mrx.h:218
#define wcsicmp
Definition: string.h:1152
static struct @299 g_Layers[]
static struct @298 g_CompatModes[]
static void ListboxChanged ( HWND  hWnd)
static

Definition at line 419 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc(), and OnAdd().

420 {
422  EnableWindow(GetDlgItem(hWnd, IDC_EDIT), Sel >= 0);
423  EnableWindow(GetDlgItem(hWnd, IDC_DELETE), Sel >= 0);
424 }
#define ListBox_GetCurSel(hwndCtl)
Definition: windowsx.h:451
HWND hWnd
Definition: settings.c:17
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_COMPATIBILITYMODE
Definition: resource.h:8
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_EDIT
Definition: resource.h:136
#define IDC_DELETE
Definition: resource.h:18
static void OnAdd ( HWND  hWnd)
static

Definition at line 426 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc().

427 {
429 
430  int Length = ComboBox_GetTextLength(Combo);
431  CComBSTR Str(Length);
432  ComboBox_GetText(Combo, Str, Length+1);
434  int Index = ListBox_FindStringExact(List, -1, Str);
435  if (Index == LB_ERR)
436  Index = ListBox_AddString(List, Str);
437  ListBox_SetCurSel(List, Index);
439  ComboBox_SetCurSel(Combo, -1);
440  SetFocus(Combo);
441 }
#define ListBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:448
HWND hWnd
Definition: settings.c:17
#define IDC_NEWCOMPATIBILITYMODE
Definition: resource.h:15
HANDLE HWND
Definition: compat.h:13
#define ListBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:442
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:33
HWND WINAPI SetFocus(_In_opt_ HWND)
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:34
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:470
#define LB_ERR
Definition: winuser.h:2381
LIST_ENTRY List
Definition: psmgr.c:57
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static const UCHAR Index[8]
Definition: usbohci.c:11
VOID UINTN Length
Definition: acefiex.h:744
#define IDC_COMPATIBILITYMODE
Definition: resource.h:8
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
static void ListboxChanged(HWND hWnd)

Variable Documentation

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

Definition at line 18 of file CLayerUIPropPage.cpp.

Definition at line 26 of file CLayerUIPropPage.cpp.

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

Definition at line 59 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::InitFile().

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" },
{ NULL, NULL }
}
Definition: bidi.c:85
smooth NULL
Definition: ftsmooth.c:416

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

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
Definition: bidi.c:85
smooth NULL
Definition: ftsmooth.c:416
#define IDC_CHKRUNIN256COLORS
Definition: resource.h:9
#define IDC_CHKRUNIN640480RES
Definition: resource.h:10

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

Definition at line 27 of file CLayerUIPropPage.cpp.