ReactOS  r76032
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

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"
#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 71 of file CLayerUIPropPage.cpp.

72 {
73  WCHAR Buffer[512];
74  WCHAR* Current = Buffer;
75  size_t Length = _countof(Buffer);
76 
77  StringCchPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, L"[%-20S] ", FunctionName);
78  va_list ArgList;
79  va_start(ArgList, Format);
80  StringCchVPrintfExW(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, Format, ArgList);
81  va_end(ArgList);
82  OutputDebugStringW(Buffer);
83 }
Definition: bidi.c:75
__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 250 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::HasChanges().

251 {
252  if (lhs.GetSize() != rhs.GetSize())
253  return FALSE;
254 
255  for (int n = 0; n < lhs.GetSize(); ++n)
256  {
257  if (lhs[n] != rhs[n])
258  return FALSE;
259  }
260  return TRUE;
261 }
#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 472 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc().

473 {
475  if (ComboBox_GetCurSel(Combo) >= 0)
476  return TRUE;
478  return Len > 0;
479 }
#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 607 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::Initialize().

608 {
609  HKEY hkey;
610  LSTATUS ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat", 0, KEY_QUERY_VALUE, &hkey);
611  BOOL Disable = FALSE;
612  if (ret == ERROR_SUCCESS)
613  {
614  DWORD dwValue = 0;
615  DWORD type, size = sizeof(dwValue);
616  ret = RegQueryValueExW(hkey, L"DisableEngine", NULL, &type, (PBYTE)&dwValue, &size);
617  if (ret == ERROR_SUCCESS && type == REG_DWORD)
618  {
619  Disable = !!dwValue;
620  }
621  if (!Disable)
622  {
623  size = sizeof(dwValue);
624  ret = RegQueryValueExW(hkey, L"DisablePropPage", NULL, &type, (PBYTE)&dwValue, &size);
625  if (ret == ERROR_SUCCESS && type == REG_DWORD)
626  {
627  Disable = !!dwValue;
628  }
629  }
630 
631  RegCloseKey(hkey);
632  }
633  return Disable;
634 }
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: bidi.c:75
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:557
unsigned int BOOL
Definition: ntddk_ex.h:94
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 REG_DWORD
Definition: nt_native.h:1497
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
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 186 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::OnRefresh().

187 {
189  DWORD dwBytes = sizeof(wszLayers);
190 
191  *OSMode = *Enabledlayers = 0;
192  customLayers.RemoveAll();
193  if (!SdbGetPermLayerKeys(Filename, wszLayers, &dwBytes, QueryFlags))
194  return FALSE;
195 
196  for (PWCHAR Layer = wcstok(wszLayers, L" "); Layer; Layer = wcstok(NULL, L" "))
197  {
198  size_t n;
199  for (n = 0; g_Layers[n].Name; ++n)
200  {
201  if (!wcsicmp(g_Layers[n].Name, Layer))
202  {
203  *Enabledlayers |= (1<<n);
204  break;
205  }
206  }
207  /* Did we find it? */
208  if (g_Layers[n].Name)
209  continue;
210 
211  for (n = 0; g_CompatModes[n].Name; ++n)
212  {
213  if (!wcsicmp(g_CompatModes[n].Name, Layer))
214  {
215  *OSMode = n+1;
216  break;
217  }
218  }
219  /* Did we find it? */
220  if (g_CompatModes[n].Name)
221  continue;
222 
223  /* Must be a 'custom' layer */
224  customLayers.Add(Layer);
225  }
226  return TRUE;
227 }
#define TRUE
Definition: types.h:120
Definition: bidi.c:75
__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)
static struct @292 g_Layers[]
uint16_t * PWCHAR
Definition: typedefs.h:54
DWORD DWORD
Definition: winlogon.h:75
GLuint n
Definition: s_context.h:57
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:557
static struct @291 g_CompatModes[]
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 PCWSTR wszLayers
Definition: layerapi.c:33
Definition: xml2sdb.h:68
static void ListboxChanged ( HWND  hWnd)
static

Definition at line 448 of file CLayerUIPropPage.cpp.

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

449 {
451  EnableWindow(GetDlgItem(hWnd, IDC_EDIT), Sel >= 0);
452  EnableWindow(GetDlgItem(hWnd, IDC_DELETE), Sel >= 0);
453 }
#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:134
#define IDC_DELETE
Definition: resource.h:18
static void OnAdd ( HWND  hWnd)
static

Definition at line 455 of file CLayerUIPropPage.cpp.

Referenced by CLayerUIPropPage::EditModesProc().

456 {
458 
459  int Length = ComboBox_GetTextLength(Combo);
460  CComBSTR Str(Length);
461  ComboBox_GetText(Combo, Str, Length+1);
463  int Index = ListBox_FindStringExact(List, -1, Str);
464  if (Index == LB_ERR)
465  Index = ListBox_AddString(List, Str);
466  ListBox_SetCurSel(List, Index);
468  ComboBox_SetCurSel(Combo, -1);
469  SetFocus(Combo);
470 }
#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)
_Must_inspect_result_ _In_ ULONG Index
Definition: fltkernel.h:1824
#define ComboBox_GetTextLength(hwndCtl)
Definition: windowsx.h:34
#define ListBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:470
#define LB_ERR
Definition: winuser.h:2376
LIST_ENTRY List
Definition: psmgr.c:57
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
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:75

Definition at line 61 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" },
{ NULL, NULL }
}
Definition: bidi.c:75
smooth NULL
Definition: ftsmooth.c:557

Referenced by GetLayerInfo(), CLayerUIPropPage::InitDialog(), and CLayerUIPropPage::OnApply().

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

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

Definition at line 27 of file CLayerUIPropPage.cpp.