ReactOS  0.4.15-dev-1374-g8d3e80e
ShellState.cpp File Reference
#include "shelltest.h"
#include <debug.h>
#include <stdio.h>
#include <shellutils.h>
#include <strsafe.h>
#include <shlwapi.h>
Include dependency graph for ShellState.cpp:

Go to the source code of this file.

Classes

struct  REGSHELLSTATE
 

Macros

#define NDEBUG
 
#define DUMP_LONG(x)   trace(#x ": 0x%08X\n", int(x));
 
#define DUMP_BOOL(x)   trace(#x ": %d\n", !!int(x));
 
#define SSF_MASK
 
#define CHECK_REG_FLAG(x)   ok(pss->x == ss.x, "ss.%s expected %d, was %d\n", #x, (int)pss->x, (int)ss.x)
 
#define CHECK_FLAG(x)   ok(ss.x == FlagState.x, "FlagState.%s expected %d, was %d\n", #x, (int)ss.x, (int)FlagState.x)
 
#define DO_IT(x)   x
 

Typedefs

typedef struct REGSHELLSTATE REGSHELLSTATE
 
typedef struct REGSHELLSTATEPREGSHELLSTATE
 

Functions

static void dump (const char *name, const void *ptr, size_t siz)
 
static int read_key (REGSHELLSTATE *prss)
 
HKEY WINAPI SHGetShellKey (DWORD flags, LPCWSTR sub_key, BOOL create)
 
static int read_advanced_key (SHELLSTATE *pss)
 
static int dump_pss (SHELLSTATE *pss)
 
 START_TEST (ShellState)
 

Macro Definition Documentation

◆ CHECK_FLAG

#define CHECK_FLAG (   x)    ok(ss.x == FlagState.x, "FlagState.%s expected %d, was %d\n", #x, (int)ss.x, (int)FlagState.x)

◆ CHECK_REG_FLAG

#define CHECK_REG_FLAG (   x)    ok(pss->x == ss.x, "ss.%s expected %d, was %d\n", #x, (int)pss->x, (int)ss.x)

◆ DO_IT

#define DO_IT (   x)    x

◆ DUMP_BOOL

#define DUMP_BOOL (   x)    trace(#x ": %d\n", !!int(x));

◆ DUMP_LONG

#define DUMP_LONG (   x)    trace(#x ": 0x%08X\n", int(x));

◆ NDEBUG

#define NDEBUG

Definition at line 9 of file ShellState.cpp.

◆ SSF_MASK

#define SSF_MASK
Value:
SSF_SHOWCOMPCOLOR | SSF_DOUBLECLICKINWEBVIEW | SSF_DESKTOPHTML | \
SSF_WIN95CLASSIC | SSF_DONTPRETTYPATH | SSF_SHOWATTRIBCOL | \
SSF_MAPNETDRVBUTTON | SSF_SHOWINFOTIP | SSF_HIDEICONS)
#define SSF_HIDEICONS
Definition: shlobj.h:1539
#define SSF_DONTPRETTYPATH
Definition: shlobj.h:1535
#define SSF_SHOWATTRIBCOL
Definition: shlobj.h:1532
#define SSF_SHOWEXTENSIONS
Definition: shlobj.h:1528
#define SSF_SHOWALLOBJECTS
Definition: shlobj.h:1527
#define SSF_DESKTOPHTML
Definition: shlobj.h:1533
#define SSF_NOCONFIRMRECYCLE
Definition: shlobj.h:1538
#define SSF_SHOWINFOTIP
Definition: shlobj.h:1536
#define SSF_DOUBLECLICKINWEBVIEW
Definition: shlobj.h:1531

Typedef Documentation

◆ PREGSHELLSTATE

◆ REGSHELLSTATE

Function Documentation

◆ dump()

static void dump ( const char name,
const void ptr,
size_t  siz 
)
static

Definition at line 24 of file ShellState.cpp.

25 {
26  char buf[256], sz[16];
27 
28  StringCbCopyA(buf, sizeof(buf), name);
29  StringCbCatA(buf, sizeof(buf), ": ");
30 
31  const BYTE *pb = reinterpret_cast<const BYTE *>(ptr);
32  while (siz--)
33  {
34  StringCbPrintfA(sz, sizeof(sz), "%02X ", *pb++);
35  StringCbCatA(buf, sizeof(buf), sz);
36  }
37 
38  trace("%s\n", buf);
39 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static PVOID ptr
Definition: dispmode.c:27
STRSAFEAPI StringCbCopyA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:161
#define trace
Definition: atltest.h:70
STRSAFEAPI StringCbPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat,...)
Definition: strsafe.h:547
unsigned char BYTE
Definition: xxhash.c:193
STRSAFEAPI StringCbCatA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:337
Definition: name.c:38

Referenced by dump_pss().

◆ dump_pss()

static int dump_pss ( SHELLSTATE pss)
static

Definition at line 153 of file ShellState.cpp.

154 {
155  dump("SHELLSTATE", pss, sizeof(*pss));
156  return 0;
157 }
static void dump(const char *name, const void *ptr, size_t siz)
Definition: ShellState.cpp:24

Referenced by START_TEST().

◆ read_advanced_key()

static int read_advanced_key ( SHELLSTATE pss)
static

Definition at line 77 of file ShellState.cpp.

78 {
79  HKEY hKey;
80  DWORD dwValue, dwSize;
81 
82  hKey = SHGetShellKey(1, L"Advanced", FALSE);
83  if (hKey == NULL)
84  {
85  return 0;
86  }
87 
88  dwSize = sizeof(dwValue);
89  if (SHQueryValueExW(hKey, L"Hidden", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
90  {
91  pss->fShowAllObjects = (dwValue == 1);
92  pss->fShowSysFiles = (dwValue == 2);
93  }
94 
95  dwSize = sizeof(dwValue);
96  if (SHQueryValueExW(hKey, L"HideFileExt", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
97  {
98  pss->fShowExtensions = (dwValue == 0);
99  }
100 
101  dwSize = sizeof(dwValue);
102  if (SHQueryValueExW(hKey, L"DontPrettyPath", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
103  {
104  pss->fDontPrettyPath = (dwValue != 0);
105  }
106 
107  dwSize = sizeof(dwValue);
108  if (SHQueryValueExW(hKey, L"MapNetDrvBtn", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
109  {
110  pss->fMapNetDrvBtn = (dwValue != 0);
111  }
112 
113  dwSize = sizeof(dwValue);
114  if (SHQueryValueExW(hKey, L"ShowInfoTip", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
115  {
116  pss->fShowInfoTip = (dwValue != 0);
117  }
118 
119  dwSize = sizeof(dwValue);
120  if (SHQueryValueExW(hKey, L"HideIcons", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
121  {
122  pss->fHideIcons = (dwValue != 0);
123  }
124 
125  dwSize = sizeof(dwValue);
126  if (SHQueryValueExW(hKey, L"WebView", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
127  {
128  pss->fWebView = (dwValue != 0);
129  }
130 
131  dwSize = sizeof(dwValue);
132  if (SHQueryValueExW(hKey, L"Filter", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
133  {
134  pss->fFilter = (dwValue != 0);
135  }
136 
137  dwSize = sizeof(dwValue);
138  if (SHQueryValueExW(hKey, L"ShowSuperHidden", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
139  {
140  pss->fShowSuperHidden = (dwValue != 0);
141  }
142 
143  dwSize = sizeof(dwValue);
144  if (SHQueryValueExW(hKey, L"NoNetCrawling", NULL, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
145  {
146  pss->fNoNetCrawling = (dwValue != 0);
147  }
148 
149  RegCloseKey(hKey);
150  return 0;
151 }
BOOL fNoNetCrawling
Definition: shlobj.h:1483
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL fDontPrettyPath
Definition: shlobj.h:1475
BOOL fShowInfoTip
Definition: shlobj.h:1478
BOOL fHideIcons
Definition: shlobj.h:1479
BOOL fShowSuperHidden
Definition: shlobj.h:1482
BOOL fFilter
Definition: shlobj.h:1481
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
BOOL fShowAllObjects
Definition: shlobj.h:1466
BOOL fShowSysFiles
Definition: shlobj.h:1470
HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create)
Definition: ordinal.c:4472
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
static const WCHAR L[]
Definition: oid.c:1250
BOOL fWebView
Definition: shlobj.h:1480
BOOL fMapNetDrvBtn
Definition: shlobj.h:1477
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
BOOL fShowExtensions
Definition: shlobj.h:1467
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by START_TEST().

◆ read_key()

static int read_key ( REGSHELLSTATE prss)
static

Definition at line 41 of file ShellState.cpp.

42 {
43  HKEY hKey;
44  LONG result;
45  DWORD cb;
46  static const LPCWSTR s_pszExplorer =
47  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer";
48 
49  memset(prss, 0, sizeof(*prss));
50 
51  result = RegOpenKeyExW(HKEY_CURRENT_USER, s_pszExplorer, 0, KEY_READ, &hKey);
52  ok(result == ERROR_SUCCESS, "result was %ld\n", result);
53  ok(hKey != NULL, "hKey was NULL\n");
54 
55  if (result != ERROR_SUCCESS || !hKey)
56  {
57  skip("RegOpenKeyEx failed: %ld\n", result);
58  return 1;
59  }
60 
61  cb = sizeof(*prss);
62  result = RegQueryValueExW(hKey, L"ShellState", NULL, NULL, reinterpret_cast<LPBYTE>(prss), &cb);
64 
65  ok(result == ERROR_SUCCESS, "result was %ld\n", result);
66  if (result != ERROR_SUCCESS)
67  {
68  skip("RegQueryValueEx failed: %ld\n", result);
69  return 2;
70  }
71 
72  return 0;
73 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint64EXT * result
Definition: glext.h:11304
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
FxAutoRegKey hKey
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define skip(...)
Definition: atltest.h:64
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ SHGetShellKey()

HKEY WINAPI SHGetShellKey ( DWORD  flags,
LPCWSTR  sub_key,
BOOL  create 
)

Definition at line 4472 of file ordinal.c.

4473 {
4474  enum _shellkey_flags {
4475  SHKEY_Root_HKCU = 0x1,
4476  SHKEY_Root_HKLM = 0x2,
4477  SHKEY_Key_Explorer = 0x00,
4478  SHKEY_Key_Shell = 0x10,
4479  SHKEY_Key_ShellNoRoam = 0x20,
4480  SHKEY_Key_Classes = 0x30,
4481  SHKEY_Subkey_Default = 0x0000,
4482  SHKEY_Subkey_ResourceName = 0x1000,
4483  SHKEY_Subkey_Handlers = 0x2000,
4484  SHKEY_Subkey_Associations = 0x3000,
4485  SHKEY_Subkey_Volatile = 0x4000,
4486  SHKEY_Subkey_MUICache = 0x5000,
4487  SHKEY_Subkey_FileExts = 0x6000
4488  };
4489 
4490  static const WCHAR explorerW[] = {'S','o','f','t','w','a','r','e','\\',
4491  'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4492  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
4493  'E','x','p','l','o','r','e','r','\\'};
4494  static const WCHAR shellW[] = {'S','o','f','t','w','a','r','e','\\',
4495  'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4496  'S','h','e','l','l','\\'};
4497  static const WCHAR shell_no_roamW[] = {'S','o','f','t','w','a','r','e','\\',
4498  'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
4499  'S','h','e','l','l','N','o','R','o','a','m','\\'};
4500  static const WCHAR classesW[] = {'S','o','f','t','w','a','r','e','\\',
4501  'C','l','a','s','s','e','s','\\'};
4502 
4503  static const WCHAR localized_resource_nameW[] = {'L','o','c','a','l','i','z','e','d',
4504  'R','e','s','o','u','r','c','e','N','a','m','e','\\'};
4505  static const WCHAR handlersW[] = {'H','a','n','d','l','e','r','s','\\'};
4506  static const WCHAR associationsW[] = {'A','s','s','o','c','i','a','t','i','o','n','s','\\'};
4507  static const WCHAR volatileW[] = {'V','o','l','a','t','i','l','e','\\'};
4508  static const WCHAR mui_cacheW[] = {'M','U','I','C','a','c','h','e','\\'};
4509  static const WCHAR file_extsW[] = {'F','i','l','e','E','x','t','s','\\'};
4510 
4511  WCHAR *path;
4512  const WCHAR *key, *subkey;
4513  int size_key, size_subkey, size_user;
4514  HKEY hkey = NULL;
4515 
4516  TRACE("(0x%08x, %s, %d)\n", flags, debugstr_w(sub_key), create);
4517 
4518  /* For compatibility with Vista+ */
4519  if(flags == 0x1ffff)
4520  flags = 0x21;
4521 
4522  switch(flags&0xff0) {
4523  case SHKEY_Key_Explorer:
4524  key = explorerW;
4525  size_key = sizeof(explorerW);
4526  break;
4527  case SHKEY_Key_Shell:
4528  key = shellW;
4529  size_key = sizeof(shellW);
4530  break;
4531  case SHKEY_Key_ShellNoRoam:
4532  key = shell_no_roamW;
4533  size_key = sizeof(shell_no_roamW);
4534  break;
4535  case SHKEY_Key_Classes:
4536  key = classesW;
4537  size_key = sizeof(classesW);
4538  break;
4539  default:
4540  FIXME("unsupported flags (0x%08x)\n", flags);
4541  return NULL;
4542  }
4543 
4544  switch(flags&0xff000) {
4545  case SHKEY_Subkey_Default:
4546  subkey = NULL;
4547  size_subkey = 0;
4548  break;
4550  subkey = localized_resource_nameW;
4551  size_subkey = sizeof(localized_resource_nameW);
4552  break;
4553  case SHKEY_Subkey_Handlers:
4554  subkey = handlersW;
4555  size_subkey = sizeof(handlersW);
4556  break;
4558  subkey = associationsW;
4559  size_subkey = sizeof(associationsW);
4560  break;
4561  case SHKEY_Subkey_Volatile:
4562  subkey = volatileW;
4563  size_subkey = sizeof(volatileW);
4564  break;
4565  case SHKEY_Subkey_MUICache:
4566  subkey = mui_cacheW;
4567  size_subkey = sizeof(mui_cacheW);
4568  break;
4569  case SHKEY_Subkey_FileExts:
4570  subkey = file_extsW;
4571  size_subkey = sizeof(file_extsW);
4572  break;
4573  default:
4574  FIXME("unsupported flags (0x%08x)\n", flags);
4575  return NULL;
4576  }
4577 
4578  if(sub_key)
4579  size_user = lstrlenW(sub_key)*sizeof(WCHAR);
4580  else
4581  size_user = 0;
4582 
4583  path = HeapAlloc(GetProcessHeap(), 0, size_key+size_subkey+size_user+sizeof(WCHAR));
4584  if(!path) {
4585  ERR("Out of memory\n");
4586  return NULL;
4587  }
4588 
4589  memcpy(path, key, size_key);
4590  if(subkey)
4591  memcpy(path+size_key/sizeof(WCHAR), subkey, size_subkey);
4592  if(sub_key)
4593  memcpy(path+(size_key+size_subkey)/sizeof(WCHAR), sub_key, size_user);
4594  path[(size_key+size_subkey+size_user)/sizeof(WCHAR)] = '\0';
4595 
4596  if(create)
4598  path, 0, NULL, 0, MAXIMUM_ALLOWED, NULL, &hkey, NULL);
4599  else
4601  path, 0, MAXIMUM_ALLOWED, &hkey);
4602 
4603  HeapFree(GetProcessHeap(), 0, path);
4604  return hkey;
4605 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
GLsizei const GLchar ** path
Definition: glext.h:7234
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define lstrlenW
Definition: compat.h:609
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLbitfield flags
Definition: glext.h:7161
HKEY key
Definition: reg.c:42
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static const struct access_res create[16]
Definition: package.c:7720
#define HeapFree(x, y, z)
Definition: compat.h:594
Definition: path.c:41
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
_shellkey_flags
Definition: ordinal.c:2799

Referenced by init_pointers(), read_advanced_key(), SKAllocValueW(), SKDeleteValueW(), SKGetValueW(), and SKSetValueW().

◆ START_TEST()

START_TEST ( ShellState  )

Definition at line 159 of file ShellState.cpp.

160 {
161  OSVERSIONINFO osinfo;
162  REGSHELLSTATE rss;
163  SHELLSTATE ss, *pss;
164  SHELLFLAGSTATE FlagState;
165  LPBYTE pb;
166  int ret;
167 
168  trace("GetVersion(): 0x%08lX", GetVersion());
169 
170  osinfo.dwOSVersionInfoSize = sizeof(osinfo);
171  GetVersionEx(&osinfo);
172  trace("osinfo.dwMajorVersion: 0x%08lX\n", osinfo.dwMajorVersion);
173  trace("osinfo.dwMinorVersion: 0x%08lX\n", osinfo.dwMinorVersion);
174  trace("osinfo.dwBuildNumber: 0x%08lX\n", osinfo.dwBuildNumber);
175  trace("osinfo.dwPlatformId: 0x%08lX\n", osinfo.dwPlatformId);
176 
177  trace("WINVER: 0x%04X\n", WINVER);
178  trace("_WIN32_WINNT: 0x%04X\n", _WIN32_WINNT);
179  trace("_WIN32_IE: 0x%04X\n", _WIN32_IE);
180  trace("NTDDI_VERSION: 0x%08X\n", NTDDI_VERSION);
181 
182 #ifdef _MSC_VER
183  trace("_MSC_VER: 0x%08X\n", int(_MSC_VER));
184 #elif defined(__MINGW32__)
185  trace("__MINGW32__: 0x%08X\n", int(__MINGW32__));
186 #elif defined(__clang__)
187  trace("__clang__: 0x%08X\n", int(__clang__));
188 #else
189  #error Unknown compiler.
190 #endif
191 
192  ok(sizeof(REGSHELLSTATE) >= 0x24, "sizeof(REGSHELLSTATE) was %d\n", (int)sizeof(REGSHELLSTATE));
193  trace("sizeof(SHELLSTATE): %d\n", (int)sizeof(SHELLSTATE));
194  trace("__alignof(SHELLSTATE): %d\n", (int)__alignof(SHELLSTATE));
195  trace("sizeof(SHELLFLAGSTATE): %d\n", (int)sizeof(SHELLFLAGSTATE));
196  trace("sizeof(CABINETSTATE): %d\n", (int)sizeof(CABINETSTATE));
197 
198  pss = &rss.ss;
199  pb = reinterpret_cast<LPBYTE>(pss);
200 
201  ret = read_key(&rss);
202  if (ret)
203  {
204  return;
205  }
206 
207  dump_pss(pss);
208  ok(rss.dwSize >= 0x24, "rss.dwSize was %ld (0x%lX).\n", rss.dwSize, rss.dwSize);
209 
210  read_advanced_key(&rss.ss);
211 
212 #define DUMP_LONG(x) trace(#x ": 0x%08X\n", int(x));
213 #define DUMP_BOOL(x) trace(#x ": %d\n", !!int(x));
217  DUMP_BOOL(pss->fShowSysFiles);
220  DUMP_BOOL(pss->fDesktopHTML);
221  DUMP_BOOL(pss->fWin95Classic);
224  DUMP_BOOL(pss->fMapNetDrvBtn);
225  DUMP_BOOL(pss->fShowInfoTip);
226  DUMP_BOOL(pss->fHideIcons);
227  DUMP_BOOL(pss->fWebView);
228  DUMP_BOOL(pss->fFilter);
231  DUMP_LONG(pss->lParamSort);
233  DUMP_LONG(pss->version);
234  DUMP_LONG(pss->lParamSort);
236  DUMP_LONG(pss->version);
237  DUMP_BOOL(pss->fSepProcess);
238  DUMP_BOOL(pss->fStartPanelOn);
240 #if NTDDI_VERSION >= 0x06000000 // for future use
241  DUMP_BOOL(pss->fIconsOnly);
242  DUMP_BOOL(pss->fShowTypeOverlay);
243  DUMP_BOOL(pss->fShowStatusBar);
244 #endif
245 
246 #define SSF_MASK \
247  (SSF_SHOWALLOBJECTS | SSF_SHOWEXTENSIONS | SSF_NOCONFIRMRECYCLE | \
248  SSF_SHOWCOMPCOLOR | SSF_DOUBLECLICKINWEBVIEW | SSF_DESKTOPHTML | \
249  SSF_WIN95CLASSIC | SSF_DONTPRETTYPATH | SSF_SHOWATTRIBCOL | \
250  SSF_MAPNETDRVBUTTON | SSF_SHOWINFOTIP | SSF_HIDEICONS)
251  // For future:
252  // SSF_AUTOCHECKSELECT, SSF_ICONSONLY, SSF_SHOWTYPEOVERLAY, SSF_SHOWSTATUSBAR
253 
254  /* Get the settings */
255  memset(&ss, 0, sizeof(ss));
257 #define CHECK_REG_FLAG(x) ok(pss->x == ss.x, "ss.%s expected %d, was %d\n", #x, (int)pss->x, (int)ss.x)
258  CHECK_REG_FLAG(fShowAllObjects);
259  CHECK_REG_FLAG(fShowExtensions);
260  CHECK_REG_FLAG(fNoConfirmRecycle);
261  CHECK_REG_FLAG(fShowSysFiles); // No use
262  CHECK_REG_FLAG(fShowCompColor);
263  CHECK_REG_FLAG(fDoubleClickInWebView);
264  CHECK_REG_FLAG(fDesktopHTML);
265  CHECK_REG_FLAG(fWin95Classic);
266  CHECK_REG_FLAG(fDontPrettyPath);
267  CHECK_REG_FLAG(fShowAttribCol);
268  CHECK_REG_FLAG(fMapNetDrvBtn);
269  CHECK_REG_FLAG(fShowInfoTip);
270  CHECK_REG_FLAG(fHideIcons);
271 #if NTDDI_VERSION >= 0x06000000 // for future use
272  CHECK_REG_FLAG(fAutoCheckSelect);
273  CHECK_REG_FLAG(fIconsOnly);
274 #endif
275 
276  /* Get the flag settings */
277  memset(&FlagState, 0, sizeof(FlagState));
278  SHGetSettings(&FlagState, SSF_MASK);
279 #define CHECK_FLAG(x) ok(ss.x == FlagState.x, "FlagState.%s expected %d, was %d\n", #x, (int)ss.x, (int)FlagState.x)
280  CHECK_FLAG(fShowAllObjects);
281  CHECK_FLAG(fShowExtensions);
282  CHECK_FLAG(fNoConfirmRecycle);
283  CHECK_FLAG(fShowSysFiles); // No use
284  CHECK_FLAG(fShowCompColor);
285  CHECK_FLAG(fDoubleClickInWebView);
286  CHECK_FLAG(fDesktopHTML);
287  CHECK_FLAG(fWin95Classic);
288  CHECK_FLAG(fDontPrettyPath);
289  CHECK_FLAG(fShowAttribCol);
290  CHECK_FLAG(fMapNetDrvBtn);
291  CHECK_FLAG(fShowInfoTip);
292  CHECK_FLAG(fHideIcons);
293 #if NTDDI_VERSION >= 0x06000000 // for future use
294  CHECK_FLAG(fAutoCheckSelect);
295  CHECK_FLAG(fIconsOnly);
296 #endif
297 
298 #if 1
299  #define DO_IT(x) x
300 #else
301  #define DO_IT(x) do { trace(#x ";\n"); x; } while (0)
302 #endif
303 
304  DO_IT(memset(pss, 0, sizeof(*pss)));
305  DO_IT(pss->dwWin95Unused = 1);
306  ok(pb[4] == 0x01 || dump_pss(pss), "Unexpected pss ^\n");
307 
308  DO_IT(memset(pss, 0, sizeof(*pss)));
309  DO_IT(pss->lParamSort = 1);
310  ok(pb[12] == 0x01 || dump_pss(pss), "Unexpected pss ^\n");
311 
312  DO_IT(memset(pss, 0, sizeof(*pss)));
313  DO_IT(pss->iSortDirection = 0xDEADBEEF);
314  ok(*(UNALIGNED DWORD *)(pb + 16) == 0xDEADBEEF || dump_pss(pss), "Unexpected pss ^\n");
315 
316  DO_IT(memset(pss, 0, sizeof(*pss)));
317  DO_IT(pss->version = 0xDEADBEEF);
318  ok(*(UNALIGNED DWORD *)(pb + 20) == 0xDEADBEEF || dump_pss(pss), "Unexpected pss ^\n");
319 
320  DO_IT(memset(pss, 0, sizeof(*pss)));
321  DO_IT(pss->fSepProcess = TRUE);
322  ok(pb[28] == 0x01 || dump_pss(pss), "Unexpected pss ^\n");
323 }
#define _WIN32_WINNT
Definition: precomp.h:14
UINT version
Definition: shlobj.h:1490
BOOL fNoNetCrawling
Definition: shlobj.h:1483
ULONG dwMajorVersion
Definition: rtltypes.h:238
BOOL fStartPanelOn
Definition: shlobj.h:1493
BOOL fDesktopHTML
Definition: shlobj.h:1473
#define TRUE
Definition: types.h:120
static int read_advanced_key(SHELLSTATE *pss)
Definition: ShellState.cpp:77
BOOL fDontPrettyPath
Definition: shlobj.h:1475
BOOL fShowInfoTip
Definition: shlobj.h:1478
BOOL fWin95Classic
Definition: shlobj.h:1474
#define WINVER
Definition: targetver.h:11
BOOL fHideIcons
Definition: shlobj.h:1479
BOOL fShowStartPage
Definition: shlobj.h:1494
#define DUMP_LONG(x)
BOOL fShowSuperHidden
Definition: shlobj.h:1482
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
BOOL fSepProcess
Definition: shlobj.h:1492
BOOL fFilter
Definition: shlobj.h:1481
SHELLSTATE ss
Definition: general.cpp:29
int iSortDirection
Definition: shlobj.h:1489
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
BOOL fShowAllObjects
Definition: shlobj.h:1466
BOOL fShowCompColor
Definition: shlobj.h:1471
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:201
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
BOOL fShowSysFiles
Definition: shlobj.h:1470
ULONG dwBuildNumber
Definition: rtltypes.h:240
#define NTDDI_VERSION
Definition: k32.h:33
#define UNALIGNED
Definition: crtdefs.h:132
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SSF_MASK
int ret
ULONG dwMinorVersion
Definition: rtltypes.h:239
#define DUMP_BOOL(x)
BOOL fDoubleClickInWebView
Definition: shlobj.h:1472
#define _WIN32_IE
Definition: treeview.c:11
BOOL fShowAttribCol
Definition: shlobj.h:1476
static int dump_pss(SHELLSTATE *pss)
Definition: ShellState.cpp:153
BOOL fWebView
Definition: shlobj.h:1480
BOOL fMapNetDrvBtn
Definition: shlobj.h:1477
DWORD dwSize
Definition: general.cpp:28
LONG lParamSort
Definition: shlobj.h:1488
ULONG dwPlatformId
Definition: rtltypes.h:241
#define ok(value,...)
Definition: atltest.h:57
static int read_key(REGSHELLSTATE *prss)
Definition: ShellState.cpp:41
#define GetVersionEx
Definition: winbase.h:3692
#define CHECK_FLAG(x)
#define DO_IT(x)
VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
Definition: shellord.c:221
DWORD dwWin95Unused
Definition: shlobj.h:1486
BOOL fShowExtensions
Definition: shlobj.h:1467
#define ss
Definition: i386-dis.c:434
#define CHECK_REG_FLAG(x)
#define memset(x, y, z)
Definition: compat.h:39
BOOL fNoConfirmRecycle
Definition: shlobj.h:1468