ReactOS  0.4.13-dev-259-g5ca9c9c
classes.c File Reference
#include <wine/config.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <shlguid_undoc.h>
#include <shlwapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "pidl.h"
#include "shell32_main.h"
#include "shresdef.h"
Include dependency graph for classes.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define MAX_EXTENSION_LENGTH   20
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
BOOL HCR_MapTypeToValueW (LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
 
BOOL HCR_MapTypeToValueA (LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot)
 
BOOL HCR_GetDefaultVerbW (HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
 
BOOL HCR_GetExecuteCommandW (HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
 
BOOL HCR_RegOpenClassIDKey (REFIID riid, HKEY *hkey)
 
static BOOL HCR_RegGetIconW (HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
 
static BOOL HCR_RegGetIconA (HKEY hkey, LPSTR szDest, LPCSTR szName, DWORD len, int *picon_idx)
 
BOOL HCR_GetIconW (LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
 
BOOL HCR_GetIconA (LPCSTR szClass, LPSTR szDest, LPCSTR szName, DWORD len, int *picon_idx)
 
BOOL HCR_GetClassNameW (REFIID riid, LPWSTR szDest, DWORD len)
 
BOOL HCR_GetClassNameA (REFIID riid, LPSTR szDest, DWORD len)
 
BOOL HCR_GetFolderAttributes (LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
 

Variables

static const WCHAR swShell [] = {'s','h','e','l','l','\\',0}
 
static const WCHAR swOpen [] = {'o','p','e','n',0}
 
static const WCHAR swCommand [] = {'\\','c','o','m','m','a','n','d',0}
 
static const WCHAR swEmpty [] = {0}
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 27 of file classes.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 28 of file classes.c.

◆ MAX_EXTENSION_LENGTH

#define MAX_EXTENSION_LENGTH   20

Definition at line 44 of file classes.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 26 of file classes.c.

Function Documentation

◆ HCR_GetClassNameA()

BOOL HCR_GetClassNameA ( REFIID  riid,
LPSTR  szDest,
DWORD  len 
)

Definition at line 423 of file classes.c.

424 { HKEY hkey;
425  BOOL ret = FALSE;
426  DWORD buflen = len;
427 #ifdef __REACTOS__
428  CHAR szName[100];
429  LPOLESTR pStr;
430 #endif
431 
432  szDest[0] = 0;
433 
434 #ifdef __REACTOS__
435  if (StringFromCLSID(riid, &pStr) == S_OK)
436  {
437  DWORD dwLen = buflen * sizeof(CHAR);
438  sprintf(szName, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%S", pStr);
439  if (!RegGetValueA(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen))
440  {
441  ret = TRUE;
442  }
443  CoTaskMemFree(pStr);
444  }
445  if (!ret && HCR_RegOpenClassIDKey(riid, &hkey))
446 #else
447  if (HCR_RegOpenClassIDKey(riid, &hkey))
448 #endif
449  {
450  if (!RegLoadMUIStringA(hkey,"LocalizedString",szDest,len,NULL,0,NULL) ||
451  !RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len))
452  {
453  ret = TRUE;
454  }
455  RegCloseKey(hkey);
456  }
457 
458  if (!ret || !szDest[0])
459  {
460  if(IsEqualIID(riid, &CLSID_ShellDesktop))
461  {
462  if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
463  ret = TRUE;
464  }
465  else if (IsEqualIID(riid, &CLSID_MyComputer))
466  {
467  if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
468  ret = TRUE;
469  }
470 #ifdef __REACTOS__
471  else if (IsEqualIID(riid, &CLSID_MyDocuments))
472  {
473  if(LoadStringA(shell32_hInstance, IDS_PERSONAL, szDest, buflen))
474  ret = TRUE;
475  }
476  else if (IsEqualIID(riid, &CLSID_RecycleBin))
477  {
479  ret = TRUE;
480  }
481  else if (IsEqualIID(riid, &CLSID_ControlPanel))
482  {
483  if(LoadStringA(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen))
484  ret = TRUE;
485  }
487  {
489  ret = TRUE;
490  }
491 #endif
492  }
493 
494  TRACE("-- (%s)\n", szDest);
495 
496  return ret;
497 }
const GUID CLSID_AdminFolderShortcut
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4041
#define IDS_CONTROLPANEL
Definition: shresdef.h:131
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
REFIID riid
Definition: precomp.h:44
#define HKEY_CURRENT_USER
Definition: winreg.h:11
char CHAR
Definition: xmlstorage.h:175
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_RECYCLEBIN_FOLDER_NAME
Definition: shresdef.h:232
#define IDS_PERSONAL
Definition: shresdef.h:242
#define IDS_ADMINISTRATIVETOOLS
Definition: shresdef.h:237
#define RRF_RT_REG_SZ
Definition: driver.c:575
static LPOLESTR
Definition: stg_prop.c:27
#define sprintf(buf, format,...)
Definition: sprintf.c:55
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_MYCOMPUTER
Definition: shresdef.h:241
smooth NULL
Definition: ftsmooth.c:416
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2081
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:233
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define IDS_DESKTOP
Definition: shresdef.h:65
static const WCHAR szName[]
Definition: msipriv.h:1194
#define CHAR(Char)
LONG WINAPI RegLoadMUIStringA(IN HKEY hKey, IN LPCSTR pszValue OPTIONAL, OUT LPSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCSTR pszDirectory OPTIONAL)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2321

Referenced by _ILSimpleGetText(), and shdebugstr_guid().

◆ HCR_GetClassNameW()

BOOL HCR_GetClassNameW ( REFIID  riid,
LPWSTR  szDest,
DWORD  len 
)

Definition at line 346 of file classes.c.

347 {
348  HKEY hkey;
349  BOOL ret = FALSE;
350  DWORD buflen = len;
351 #ifdef __REACTOS__
352  WCHAR szName[100];
353  LPOLESTR pStr;
354 #endif
355 
356  szDest[0] = 0;
357 
358 #ifdef __REACTOS__
359  if (StringFromCLSID(riid, &pStr) == S_OK)
360  {
361  DWORD dwLen = buflen * sizeof(WCHAR);
362  swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
363  if (!RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen))
364  {
365  ret = TRUE;
366  }
367  CoTaskMemFree(pStr);
368  }
369  if (!ret && HCR_RegOpenClassIDKey(riid, &hkey))
370 #else
371  if (HCR_RegOpenClassIDKey(riid, &hkey))
372 #endif
373  {
374  static const WCHAR wszLocalizedString[] =
375  { 'L','o','c','a','l','i','z','e','d','S','t','r','i','n','g', 0 };
376  if (!RegLoadMUIStringW(hkey, wszLocalizedString, szDest, len, NULL, 0, NULL) ||
377  !RegQueryValueExW(hkey, swEmpty, 0, NULL, (LPBYTE)szDest, &len))
378  {
379  ret = TRUE;
380  }
381  RegCloseKey(hkey);
382  }
383 
384  if (!ret || !szDest[0])
385  {
386  if(IsEqualIID(riid, &CLSID_ShellDesktop))
387  {
388  if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
389  ret = TRUE;
390  }
391  else if (IsEqualIID(riid, &CLSID_MyComputer))
392  {
393  if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
394  ret = TRUE;
395  }
396 #ifdef __REACTOS__
397  else if (IsEqualIID(riid, &CLSID_MyDocuments))
398  {
399  if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen))
400  ret = TRUE;
401  }
402  else if (IsEqualIID(riid, &CLSID_RecycleBin))
403  {
405  ret = TRUE;
406  }
407  else if (IsEqualIID(riid, &CLSID_ControlPanel))
408  {
409  if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen))
410  ret = TRUE;
411  }
413  {
415  ret = TRUE;
416  }
417 #endif
418  }
419  TRACE("-- %s\n", debugstr_w(szDest));
420  return ret;
421 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
const GUID CLSID_AdminFolderShortcut
#define IDS_CONTROLPANEL
Definition: shresdef.h:131
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
REFIID riid
Definition: precomp.h:44
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define IDS_RECYCLEBIN_FOLDER_NAME
Definition: shresdef.h:232
#define IDS_PERSONAL
Definition: shresdef.h:242
#define IDS_ADMINISTRATIVETOOLS
Definition: shresdef.h:237
#define RRF_RT_REG_SZ
Definition: driver.c:575
static LPOLESTR
Definition: stg_prop.c:27
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
HINSTANCE shell32_hInstance
Definition: misc.cpp:82
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_MYCOMPUTER
Definition: shresdef.h:241
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:233
#define TRACE(s)
Definition: solgame.cpp:4
LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
Definition: muireg.c:53
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR swEmpty[]
Definition: classes.c:344
int ret
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define IDS_DESKTOP
Definition: shresdef.h:65
static const WCHAR szName[]
Definition: msipriv.h:1194
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2321

Referenced by _ILSimpleGetTextW(), and CRegFolder::GetDisplayNameOf().

◆ HCR_GetDefaultVerbW()

BOOL HCR_GetDefaultVerbW ( HKEY  hkeyClass,
LPCWSTR  szVerb,
LPWSTR  szDest,
DWORD  len 
)

Definition at line 134 of file classes.c.

135 {
136  WCHAR sTemp[MAX_PATH];
137  LONG size;
138  HKEY hkey;
139 
140  TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest);
141 
142  if (szVerb && *szVerb)
143  {
144  lstrcpynW(szDest, szVerb, len);
145  return TRUE;
146  }
147 
148  size=len;
149  *szDest='\0';
150  if (!RegQueryValueW(hkeyClass, swShell, szDest, &size) && *szDest)
151  {
152  /* The MSDN says to first try the default verb */
153  lstrcpyW(sTemp, swShell);
154  lstrcatW(sTemp, szDest);
155  lstrcatW(sTemp, swCommand);
156  if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey))
157  {
158  RegCloseKey(hkey);
159  TRACE("default verb=%s\n", debugstr_w(szDest));
160  return TRUE;
161  }
162  }
163 
164  /* then fallback to 'open' */
165  lstrcpyW(sTemp, swShell);
166  lstrcatW(sTemp, swOpen);
167  lstrcatW(sTemp, swCommand);
168  if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey))
169  {
170  RegCloseKey(hkey);
171  lstrcpynW(szDest, swOpen, len);
172  TRACE("default verb=open\n");
173  return TRUE;
174  }
175 
176  /* and then just use the first verb on Windows >= 2000 */
177 #ifdef __REACTOS__
178  if (!RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey))
179  {
180  if (!RegEnumKeyW(hkey, 0, szDest, len) && *szDest)
181  {
182  TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
183  RegCloseKey(hkey);
184  return TRUE;
185  }
186  RegCloseKey(hkey);
187  }
188 #else
189  if (!RegEnumKeyW(hkeyClass, 0, szDest, len) && *szDest)
190  {
191  TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
192  return TRUE;
193  }
194 #endif
195 
196  TRACE("no default verb!\n");
197  return FALSE;
198 }
#define TRUE
Definition: types.h:120
static const WCHAR swCommand[]
Definition: classes.c:132
#define KEY_READ
Definition: nt_native.h:1023
#define lstrcpynW
Definition: compat.h:397
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
#define MAX_PATH
Definition: compat.h:26
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2430
static const WCHAR swShell[]
Definition: classes.c:130
#define lstrcpyW
Definition: compat.h:406
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR swOpen[]
Definition: classes.c:131

Referenced by HCR_GetExecuteCommandW(), and SHELL_FindExecutableByVerb().

◆ HCR_GetExecuteCommandW()

BOOL HCR_GetExecuteCommandW ( HKEY  hkeyClass,
LPCWSTR  szClass,
LPCWSTR  szVerb,
LPWSTR  szDest,
DWORD  len 
)

Definition at line 200 of file classes.c.

201 {
202  WCHAR sTempVerb[MAX_PATH];
203  BOOL ret;
204 
205  TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest);
206 
207  if (szClass)
208  RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass);
209  if (!hkeyClass)
210  return FALSE;
211  ret = FALSE;
212 
213  if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0])))
214  {
215  WCHAR sTemp[MAX_PATH];
216  lstrcpyW(sTemp, swShell);
217  lstrcatW(sTemp, sTempVerb);
218  lstrcatW(sTemp, swCommand);
219  ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len));
220  }
221  if (szClass)
222  RegCloseKey(hkeyClass);
223 
224  TRACE("-- %s\n", debugstr_w(szDest) );
225  return ret;
226 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR swCommand[]
Definition: classes.c:132
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR swShell[]
Definition: classes.c:130
#define lstrcpyW
Definition: compat.h:406
BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
Definition: classes.c:134
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by SHELL_execute_class(), and SHELL_translate_idlist().

◆ HCR_GetFolderAttributes()

BOOL HCR_GetFolderAttributes ( LPCITEMIDLIST  pidlFolder,
LPDWORD  pdwAttributes 
)

Definition at line 516 of file classes.c.

517 {
518  HKEY hSFKey;
519  LPOLESTR pwszCLSID;
520  LONG lResult;
521  DWORD dwTemp, dwLen;
522  static const WCHAR wszAttributes[] = { 'A','t','t','r','i','b','u','t','e','s',0 };
523  static const WCHAR wszCallForAttributes[] = {
524  'C','a','l','l','F','o','r','A','t','t','r','i','b','u','t','e','s',0 };
525  WCHAR wszShellFolderKey[] = { 'C','L','S','I','D','\\','{','0','0','0','2','1','4','0','0','-',
526  '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-','0','0','0','0','0','0','0',
527  '0','0','0','4','6','}','\\','S','h','e','l','l','F','o','l','d','e','r',0 };
528 
529  TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes);
530 
531  if (!_ILIsPidlSimple(pidlFolder)) {
532  static BOOL firstHit = TRUE;
533  if (firstHit) {
534  ERR("should be called for simple PIDL's only!\n");
535  firstHit = FALSE;
536  }
537  return FALSE;
538  }
539 
540  if (!_ILIsDesktop(pidlFolder)) {
541  if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE;
542  memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR));
543  CoTaskMemFree(pwszCLSID);
544  }
545 
546  lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey);
547 #ifdef __REACTOS__
548  if (lResult != ERROR_SUCCESS)
549  {
550  ERR("Cannot open key: %ls\n", wszShellFolderKey);
551  return FALSE;
552  }
553 #else
554  if (lResult != ERROR_SUCCESS) return FALSE;
555 #endif
556 
557  dwLen = sizeof(DWORD);
558  lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
559  if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) {
560  LPSHELLFOLDER psfDesktop, psfFolder;
561  HRESULT hr;
562 
563  RegCloseKey(hSFKey);
564  hr = SHGetDesktopFolder(&psfDesktop);
565  if (SUCCEEDED(hr)) {
566  hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder,
567  (LPVOID*)&psfFolder);
568  if (SUCCEEDED(hr)) {
569  hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes);
570  IShellFolder_Release(psfFolder);
571  }
572  IShellFolder_Release(psfDesktop);
573  }
574  if (FAILED(hr)) return FALSE;
575  } else {
576  lResult = RegQueryValueExW(hSFKey, wszAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
577  RegCloseKey(hSFKey);
578  if (lResult == ERROR_SUCCESS) {
579  *pdwAttributes &= dwTemp;
580  } else {
581  return FALSE;
582  }
583  }
584 
585  TRACE("-- *pdwAttributes == 0x%08x\n", *pdwAttributes);
586 
587  return TRUE;
588 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_READ
Definition: nt_native.h:1023
static LPOLESTR
Definition: stg_prop.c:27
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2300
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2321

Referenced by CRegFolder::GetGuidItemAttributes().

◆ HCR_GetIconA()

BOOL HCR_GetIconA ( LPCSTR  szClass,
LPSTR  szDest,
LPCSTR  szName,
DWORD  len,
int picon_idx 
)

Definition at line 320 of file classes.c.

321 {
322  HKEY hkey;
323  char sTemp[MAX_PATH];
324  BOOL ret = FALSE;
325 
326  TRACE("%s\n",szClass );
327 
328  sprintf(sTemp, "%s\\DefaultIcon",szClass);
329 
330  if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey))
331  {
332  ret = HCR_RegGetIconA(hkey, szDest, szName, len, picon_idx);
333  RegCloseKey(hkey);
334  }
335  TRACE("-- %s %i\n", szDest, *picon_idx);
336  return ret;
337 }
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3346
#define sprintf(buf, format,...)
Definition: sprintf.c:55
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_PATH
Definition: compat.h:26
int ret
GLenum GLsizei len
Definition: glext.h:6722
static BOOL HCR_RegGetIconA(HKEY hkey, LPSTR szDest, LPCSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:270
static const WCHAR szName[]
Definition: msipriv.h:1194
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

◆ HCR_GetIconW()

BOOL HCR_GetIconW ( LPCWSTR  szClass,
LPWSTR  szDest,
LPCWSTR  szName,
DWORD  len,
int picon_idx 
)

Definition at line 294 of file classes.c.

295 {
296  static const WCHAR swDefaultIcon[] = {'\\','D','e','f','a','u','l','t','I','c','o','n',0};
297  HKEY hkey;
298  WCHAR sTemp[MAX_PATH];
299  BOOL ret = FALSE;
300 
301  TRACE("%s\n",debugstr_w(szClass) );
302 
303  lstrcpynW(sTemp, szClass, MAX_PATH);
304  lstrcatW(sTemp, swDefaultIcon);
305 
306  if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey))
307  {
308  ret = HCR_RegGetIconW(hkey, szDest, szName, len, picon_idx);
309  RegCloseKey(hkey);
310  }
311 
312  if(ret)
313  TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx);
314  else
315  TRACE("-- not found\n");
316 
317  return ret;
318 }
static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:246
#define KEY_READ
Definition: nt_native.h:1023
#define lstrcpynW
Definition: compat.h:397
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
int ret
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274

Referenced by CDrivesExtractIcon_CreateInstance(), CGuidItemExtractIcon_CreateInstance(), getDefaultIconLocation(), getIconLocationForFolder(), and SHGetFileInfoW().

◆ HCR_MapTypeToValueA()

BOOL HCR_MapTypeToValueA ( LPCSTR  szExtension,
LPSTR  szFileType,
LONG  len,
BOOL  bPrependDot 
)

Definition at line 88 of file classes.c.

89 {
90  HKEY hkey;
91  char szTemp[MAX_EXTENSION_LENGTH + 2];
92 
93  TRACE("%s %p\n", szExtension, szFileType);
94 
95  /* added because we do not want to have double dots */
96  if (szExtension[0] == '.')
97  bPrependDot = FALSE;
98 
99  if (bPrependDot)
100  szTemp[0] = '.';
101 
102  lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
103 
104  if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
105  {
106  return FALSE;
107  }
108 
109 #ifdef __REACTOS__
110  if (!RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL))
111  {
112  RegCloseKey(hkey);
113  return TRUE;
114  }
115 #endif
116 
117  if (RegQueryValueA(hkey, NULL, szFileType, &len))
118  {
119  RegCloseKey(hkey);
120  return FALSE;
121  }
122 
123  RegCloseKey(hkey);
124 
125  TRACE("--UE;\n} %s\n", szFileType);
126 
127  return TRUE;
128 }
#define TRUE
Definition: types.h:120
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4243
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3346
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define MAX_EXTENSION_LENGTH
Definition: classes.c:44
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpynA
Definition: compat.h:408
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegLoadMUIStringA(IN HKEY hKey, IN LPCSTR pszValue OPTIONAL, OUT LPSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCSTR pszDirectory OPTIONAL)

Referenced by _ILGetFileType(), and SHELL_IsShortcut().

◆ HCR_MapTypeToValueW()

BOOL HCR_MapTypeToValueW ( LPCWSTR  szExtension,
LPWSTR  szFileType,
LONG  len,
BOOL  bPrependDot 
)

Definition at line 46 of file classes.c.

47 {
48  HKEY hkey;
49  WCHAR szTemp[MAX_EXTENSION_LENGTH + 2];
50 
51  TRACE("%s %p\n", debugstr_w(szExtension), szFileType);
52 
53  /* added because we do not want to have double dots */
54  if (szExtension[0] == '.')
55  bPrependDot = FALSE;
56 
57  if (bPrependDot)
58  szTemp[0] = '.';
59 
60  lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
61 
62  if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
63  {
64  return FALSE;
65  }
66 
67 #ifdef __REACTOS__
68  if (!RegLoadMUIStringW(hkey, L"FriendlyTypeName", szFileType, len, NULL, 0, NULL))
69  {
70  RegCloseKey(hkey);
71  return TRUE;
72  }
73 #endif
74 
75  if (RegQueryValueW(hkey, NULL, szFileType, &len))
76  {
77  RegCloseKey(hkey);
78  return FALSE;
79  }
80 
81  RegCloseKey(hkey);
82 
83  TRACE("--UE;\n} %s\n", debugstr_w(szFileType));
84 
85  return TRUE;
86 }
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
#define lstrcpynW
Definition: compat.h:397
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
#define MAX_EXTENSION_LENGTH
Definition: classes.c:44
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
Definition: muireg.c:53
__wchar_t WCHAR
Definition: xmlstorage.h:180
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CRecycleBin::GetDetailsOf(), and SHGetFileInfoW().

◆ HCR_RegGetIconA()

static BOOL HCR_RegGetIconA ( HKEY  hkey,
LPSTR  szDest,
LPCSTR  szName,
DWORD  len,
int picon_idx 
)
static

Definition at line 270 of file classes.c.

271 {
272  DWORD dwType;
273  char sTemp[MAX_PATH];
274  char sNum[5];
275 
276  if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
277  {
278  if (dwType == REG_EXPAND_SZ)
279  {
280  ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH);
281  lstrcpynA(szDest, sTemp, len);
282  }
283  if (ParseFieldA (szDest, 2, sNum, 5))
284  *picon_idx=atoi(sNum);
285  else
286  *picon_idx=0; /* sometimes the icon number is missing */
287  ParseFieldA (szDest, 1, szDest, len);
288  PathUnquoteSpacesA(szDest);
289  return TRUE;
290  }
291  return FALSE;
292 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4041
#define TRUE
Definition: types.h:120
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len) DECLSPEC_HIDDEN
Definition: shellord.c:79
unsigned char * LPBYTE
Definition: typedefs.h:52
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
VOID WINAPI PathUnquoteSpacesA(LPSTR lpszPath)
Definition: path.c:1007
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define lstrcpynA
Definition: compat.h:408
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static const WCHAR szName[]
Definition: msipriv.h:1194

Referenced by HCR_GetIconA().

◆ HCR_RegGetIconW()

static BOOL HCR_RegGetIconW ( HKEY  hkey,
LPWSTR  szDest,
LPCWSTR  szName,
DWORD  len,
int picon_idx 
)
static

Definition at line 246 of file classes.c.

247 {
248  DWORD dwType;
249  WCHAR sTemp[MAX_PATH];
250  WCHAR sNum[7];
251 
252  if (!RegQueryValueExW(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
253  {
254  if (dwType == REG_EXPAND_SZ)
255  {
256  ExpandEnvironmentStringsW(szDest, sTemp, MAX_PATH);
257  lstrcpynW(szDest, sTemp, len);
258  }
259  if (ParseFieldW (szDest, 2, sNum, _countof(sNum)))
260  *picon_idx = atoiW(sNum);
261  else
262  *picon_idx=0; /* sometimes the icon number is missing */
263  ParseFieldW (szDest, 1, szDest, len);
264  PathUnquoteSpacesW(szDest);
265  return TRUE;
266  }
267  return FALSE;
268 }
#define TRUE
Definition: types.h:120
#define _countof(array)
Definition: fontsub.cpp:30
#define lstrcpynW
Definition: compat.h:397
unsigned char * LPBYTE
Definition: typedefs.h:52
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN
Definition: shellord.c:113
GLenum GLsizei len
Definition: glext.h:6722
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1029
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
static const WCHAR szName[]
Definition: msipriv.h:1194
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315

Referenced by HCR_GetIconW().

◆ HCR_RegOpenClassIDKey()

BOOL HCR_RegOpenClassIDKey ( REFIID  riid,
HKEY hkey 
)

Definition at line 233 of file classes.c.

234 {
235  char xriid[50];
236  sprintf( xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
237  riid->Data1, riid->Data2, riid->Data3,
238  riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
239  riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
240 
241  TRACE("%s\n",xriid );
242 
243  return !RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey);
244 }
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3346
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define TRACE(s)
Definition: solgame.cpp:4
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CRegFolder::GetDetailsOf(), CRegFolder::GetDisplayNameOf(), HCR_GetClassNameA(), and HCR_GetClassNameW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ swCommand

const WCHAR swCommand[] = {'\\','c','o','m','m','a','n','d',0}
static

Definition at line 132 of file classes.c.

Referenced by HCR_GetDefaultVerbW(), and HCR_GetExecuteCommandW().

◆ swEmpty

const WCHAR swEmpty[] = {0}
static

Definition at line 344 of file classes.c.

Referenced by HCR_GetClassNameW().

◆ swOpen

const WCHAR swOpen[] = {'o','p','e','n',0}
static

Definition at line 131 of file classes.c.

Referenced by HCR_GetDefaultVerbW().

◆ swShell

const WCHAR swShell[] = {'s','h','e','l','l','\\',0}
static

Definition at line 130 of file classes.c.

Referenced by HCR_GetDefaultVerbW(), and HCR_GetExecuteCommandW().