ReactOS 0.4.17-dev-683-g0dafdc5
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)
 
static LONG GetRegString (HKEY hKey, PCWSTR SubKey, PCWSTR Name, PWSTR Buffer, UINT cchBuf)
 
HRESULT HCR_GetProgIdKeyOfExtension (PCWSTR szExtension, PHKEY phKey, BOOL AllowFallback)
 
BOOL HCR_MapTypeToValueW (LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot)
 
BOOL HCR_MapTypeToValueA (LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot)
 
EXTERN_C HRESULT SHELL32_EnumDefaultVerbList (LPCWSTR List, UINT Index, LPWSTR Verb, SIZE_T cchMax)
 
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)
 

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 47 of file classes.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 26 of file classes.c.

Function Documentation

◆ GetRegString()

static LONG GetRegString ( HKEY  hKey,
PCWSTR  SubKey,
PCWSTR  Name,
PWSTR  Buffer,
UINT  cchBuf 
)
static

Definition at line 49 of file classes.c.

50{
51 DWORD cb = sizeof(*Buffer) * cchBuf;
52 return RegGetValueW(hKey, SubKey, Name, RRF_RT_REG_SZ, NULL, Buffer, &cb);
53}
Definition: bufpool.h:45
LPWSTR Name
Definition: desk.c:124
#define NULL
Definition: types.h:112
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
_In_ UINT cchBuf
Definition: shlwapi.h:378
#define RRF_RT_REG_SZ
Definition: winreg.h:58

Referenced by HCR_GetProgIdKeyOfExtension().

◆ HCR_GetClassNameA()

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

Definition at line 501 of file classes.c.

502{ HKEY hkey;
503 BOOL ret = FALSE;
504 DWORD buflen = len;
505#ifdef __REACTOS__
506 CHAR szName[100];
507 LPOLESTR pStr;
508#endif
509
510 szDest[0] = 0;
511
512#ifdef __REACTOS__
513 if (StringFromCLSID(riid, &pStr) == S_OK)
514 {
515 DWORD dwLen = buflen * sizeof(CHAR);
516 sprintf(szName, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%S", pStr);
518 {
519 ret = TRUE;
520 }
521 CoTaskMemFree(pStr);
522 }
523 if (!ret && HCR_RegOpenClassIDKey(riid, &hkey))
524#else
525 if (HCR_RegOpenClassIDKey(riid, &hkey))
526#endif
527 {
528 if (!RegLoadMUIStringA(hkey,"LocalizedString",szDest,len,NULL,0,NULL) ||
529 !RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len))
530 {
531 ret = TRUE;
532 }
533 RegCloseKey(hkey);
534 }
535
536 if (!ret || !szDest[0])
537 {
538 if(IsEqualIID(riid, &CLSID_ShellDesktop))
539 {
540 if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
541 ret = TRUE;
542 }
543 else if (IsEqualIID(riid, &CLSID_MyComputer))
544 {
545 if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
546 ret = TRUE;
547 }
548#ifdef __REACTOS__
549 else if (IsEqualIID(riid, &CLSID_MyDocuments))
550 {
551 if(LoadStringA(shell32_hInstance, IDS_PERSONAL, szDest, buflen))
552 ret = TRUE;
553 }
554 else if (IsEqualIID(riid, &CLSID_RecycleBin))
555 {
557 ret = TRUE;
558 }
559 else if (IsEqualIID(riid, &CLSID_ControlPanel))
560 {
562 ret = TRUE;
563 }
565 {
567 ret = TRUE;
568 }
569#endif
570 }
571
572 TRACE("-- (%s)\n", szDest);
573
574 return ret;
575}
#define shell32_hInstance
#define CHAR(Char)
#define RegCloseKey(hKey)
Definition: registry.h:49
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_PERSONAL
Definition: desktop.c:27
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2037
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:4009
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)
Definition: reg.c:5268
HRESULT WINAPI StringFromCLSID(REFCLSID clsid, LPOLESTR *str)
Definition: combase.c:1515
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
INT WINAPI DECLSPEC_HOTPATCH LoadStringA(HINSTANCE instance, UINT resource_id, LPSTR buffer, INT buflen)
Definition: string.c:1307
const GUID CLSID_AdminFolderShortcut
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define sprintf
Definition: sprintf.c:45
char CHAR
Definition: pedump.c:57
static const WCHAR szName[]
Definition: powrprof.c:45
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
Definition: classes.c:257
#define IDS_DESKTOP
Definition: shresdef.h:71
#define IDS_MYCOMPUTER
Definition: shresdef.h:283
#define IDS_CONTROLPANEL
Definition: shresdef.h:139
#define IDS_ADMINISTRATIVETOOLS
Definition: shresdef.h:278
#define IDS_RECYCLEBIN_FOLDER_NAME
Definition: shresdef.h:272
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by shdebugstr_guid().

◆ HCR_GetClassNameW()

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

Definition at line 426 of file classes.c.

427{
428 HKEY hkey;
429 BOOL ret = FALSE;
430 DWORD buflen = len;
431#ifdef __REACTOS__
432 WCHAR szName[100];
433 LPOLESTR pStr;
434#endif
435
436 szDest[0] = 0;
437
438#ifdef __REACTOS__
439 if (StringFromCLSID(riid, &pStr) == S_OK)
440 {
441 DWORD dwLen = buflen * sizeof(WCHAR);
442 swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
444 {
445 ret = TRUE;
446 }
447 CoTaskMemFree(pStr);
448 }
449 if (!ret && HCR_RegOpenClassIDKey(riid, &hkey))
450#else
451 if (HCR_RegOpenClassIDKey(riid, &hkey))
452#endif
453 {
454 if (!RegLoadMUIStringW(hkey, L"LocalizedString", szDest, len, NULL, 0, NULL) ||
455 !RegQueryValueExW(hkey, L"", 0, NULL, (LPBYTE)szDest, &len))
456 {
457 ret = TRUE;
458 }
459 RegCloseKey(hkey);
460 }
461
462 if (!ret || !szDest[0])
463 {
464 if(IsEqualIID(riid, &CLSID_ShellDesktop))
465 {
466 if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
467 ret = TRUE;
468 }
469 else if (IsEqualIID(riid, &CLSID_MyComputer))
470 {
471 if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
472 ret = TRUE;
473 }
474#ifdef __REACTOS__
475 else if (IsEqualIID(riid, &CLSID_MyDocuments))
476 {
477 if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen))
478 ret = TRUE;
479 }
480 else if (IsEqualIID(riid, &CLSID_RecycleBin))
481 {
483 ret = TRUE;
484 }
485 else if (IsEqualIID(riid, &CLSID_ControlPanel))
486 {
488 ret = TRUE;
489 }
491 {
493 ret = TRUE;
494 }
495#endif
496 }
497 TRACE("-- %s\n", debugstr_w(szDest));
498 return ret;
499}
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:4103
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
#define debugstr_w
Definition: kernel32.h:32
short WCHAR
Definition: pedump.c:58
#define LoadStringW
Definition: utils.h:64

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

◆ HCR_GetDefaultVerbW()

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

Definition at line 152 of file classes.c.

153{
154 WCHAR sTemp[MAX_PATH], verbs[MAX_PATH];
155 LONG size;
156 HKEY hkey;
157
158 TRACE("%p %s %p\n", hkeyClass, debugstr_w(szVerb), szDest);
159
160 if (szVerb && *szVerb)
161 {
162 lstrcpynW(szDest, szVerb, len);
163 return TRUE;
164 }
165
166 /* MSDN says to first try the default verb */
168 if (!RegQueryValueW(hkeyClass, L"shell", verbs, &size) && *verbs)
169 {
170 for (UINT i = 0;; ++i)
171 {
173 break;
174 if (FAILED(StringCchPrintfW(sTemp, _countof(sTemp), L"shell\\%s\\command", szDest)))
175 break;
176 if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey))
177 {
178 RegCloseKey(hkey);
179 TRACE("default verb=%s\n", debugstr_w(szDest));
180 return TRUE;
181 }
182 }
183 }
184 *szDest = UNICODE_NULL;
185
186 /* then fallback to 'open' */
187#ifdef __REACTOS__
188 if (!RegOpenKeyExW(hkeyClass, L"shell\\open\\command", 0, KEY_READ, &hkey))
189#else
190 lstrcpyW(sTemp, L"shell\\open\\command");
191 if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey))
192#endif
193 {
194 RegCloseKey(hkey);
195 lstrcpynW(szDest, L"open", len);
196 TRACE("default verb=open\n");
197 return TRUE;
198 }
199
200 /* and then just use the first verb on Windows >= 2000 */
201#ifdef __REACTOS__
202 if (!RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey))
203 {
204 if (!RegEnumKeyW(hkey, 0, szDest, len) && *szDest)
205 {
206 TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
207 RegCloseKey(hkey);
208 return TRUE;
209 }
210 RegCloseKey(hkey);
211 }
212#else
213 if (!RegEnumKeyW(hkeyClass, 0, szDest, len) && *szDest)
214 {
215 TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
216 return TRUE;
217 }
218#endif
219
220 TRACE("no default verb!\n");
221 return FALSE;
222}
Verb verbs[]
Definition: certutil.cpp:21
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
#define MAX_PATH
Definition: compat.h:34
#define lstrcpyW
Definition: compat.h:749
#define lstrcpynW
Definition: compat.h:738
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
#define FAILED(hr)
Definition: intsafe.h:51
#define KEY_READ
Definition: nt_native.h:1026
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
EXTERN_C HRESULT SHELL32_EnumDefaultVerbList(LPCWSTR List, UINT Index, LPWSTR Verb, SIZE_T cchMax)
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by HCR_GetExecuteCommandW(), OpenShellVerbKey(), COpenWithList::SetDefaultHandler(), and SHELL_FindExecutableByVerb().

◆ HCR_GetExecuteCommandW()

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

Definition at line 224 of file classes.c.

225{
226 WCHAR sTempVerb[MAX_PATH];
227 BOOL ret;
228
229 TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest);
230
231 if (szClass)
232 RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass);
233 if (!hkeyClass)
234 return FALSE;
235 ret = FALSE;
236
237 if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0])))
238 {
239 WCHAR sTemp[MAX_PATH];
240 lstrcpyW(sTemp, L"shell\\");
241 lstrcatW(sTemp, sTempVerb);
242 lstrcatW(sTemp, L"\\command");
243 ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len));
244 }
245 if (szClass)
246 RegCloseKey(hkeyClass);
247
248 TRACE("-- %s\n", debugstr_w(szDest) );
249 return ret;
250}
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
Definition: classes.c:152
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by SHELL_execute_class(), and SHELL_translate_idlist().

◆ HCR_GetFolderAttributes()

BOOL HCR_GetFolderAttributes ( LPCITEMIDLIST  pidlFolder,
LPDWORD  pdwAttributes 
)

Definition at line 594 of file classes.c.

595{
596 HKEY hSFKey;
597 LPOLESTR pwszCLSID;
598 LONG lResult;
599 DWORD dwTemp, dwLen;
600 WCHAR wszShellFolderKey[] = L"CLSID\\{00021400-0000-0000-C000-000000000046}\\ShellFolder";
601
602 TRACE("(pidlFolder=%p, pdwAttributes=%p)\n", pidlFolder, pdwAttributes);
603
604 if (!_ILIsPidlSimple(pidlFolder)) {
605 static BOOL firstHit = TRUE;
606 if (firstHit) {
607 ERR("should be called for simple PIDL's only!\n");
608 firstHit = FALSE;
609 }
610 return FALSE;
611 }
612
613 if (!_ILIsDesktop(pidlFolder)) {
614 if (FAILED(StringFromCLSID(_ILGetGUIDPointer(pidlFolder), &pwszCLSID))) return FALSE;
615 memcpy(&wszShellFolderKey[6], pwszCLSID, 38 * sizeof(WCHAR));
616 CoTaskMemFree(pwszCLSID);
617 }
618
619 lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey);
620#ifdef __REACTOS__
621 if (lResult != ERROR_SUCCESS)
622 {
623 ERR("Cannot open key: %ls\n", wszShellFolderKey);
624 return FALSE;
625 }
626#else
627 if (lResult != ERROR_SUCCESS) return FALSE;
628#endif
629
630 dwLen = sizeof(DWORD);
631 lResult = RegQueryValueExW(hSFKey, L"CallForAttributes", 0, NULL, (LPBYTE)&dwTemp, &dwLen);
632 if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) {
633 LPSHELLFOLDER psfDesktop, psfFolder;
634 HRESULT hr;
635
636 RegCloseKey(hSFKey);
637 hr = SHGetDesktopFolder(&psfDesktop);
638 if (SUCCEEDED(hr)) {
639 hr = IShellFolder_BindToObject(psfDesktop, pidlFolder, NULL, &IID_IShellFolder,
640 (LPVOID*)&psfFolder);
641 if (SUCCEEDED(hr)) {
642 hr = IShellFolder_GetAttributesOf(psfFolder, 0, NULL, pdwAttributes);
643 IShellFolder_Release(psfFolder);
644 }
645 IShellFolder_Release(psfDesktop);
646 }
647 if (FAILED(hr)) return FALSE;
648 } else {
649 lResult = RegQueryValueExW(hSFKey, L"Attributes", 0, NULL, (LPBYTE)&dwTemp, &dwLen);
650 RegCloseKey(hSFKey);
651 if (lResult == ERROR_SUCCESS) {
652 *pdwAttributes &= dwTemp;
653 } else {
654 return FALSE;
655 }
656 }
657
658 TRACE("-- *pdwAttributes == 0x%08x\n", *pdwAttributes);
659
660 return TRUE;
661}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:582
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DWORD
Definition: nt_native.h:44
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2416
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)

Referenced by CRegFolder::GetGuidItemAttributes().

◆ HCR_GetIconA()

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

Definition at line 343 of file classes.c.

344{
345 HKEY hkey;
346 char sTemp[MAX_PATH];
347 BOOL ret = FALSE;
348
349 TRACE("%s\n",szClass );
350
351 sprintf(sTemp, "%s\\DefaultIcon",szClass);
352
353 if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey))
354 {
355 ret = HCR_RegGetIconA(hkey, szDest, szName, len, picon_idx);
356 RegCloseKey(hkey);
357 }
358
359 if (ret)
360 TRACE("-- %s %i\n", szDest, *picon_idx);
361 else
362 TRACE("-- not found\n");
363
364 return ret;
365}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
static BOOL HCR_RegGetIconA(HKEY hkey, LPSTR szDest, LPCSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:294

◆ HCR_GetIconW()

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

Definition at line 318 of file classes.c.

319{
320 HKEY hkey;
321 WCHAR sTemp[MAX_PATH];
322 BOOL ret = FALSE;
323
324 TRACE("%s\n",debugstr_w(szClass) );
325
326 lstrcpynW(sTemp, szClass, MAX_PATH);
327 lstrcatW(sTemp, L"\\DefaultIcon");
328
329 if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey))
330 {
331 ret = HCR_RegGetIconW(hkey, szDest, szName, len, picon_idx);
332 RegCloseKey(hkey);
333 }
334
335 if(ret)
336 TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx);
337 else
338 TRACE("-- not found\n");
339
340 return ret;
341}
static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:270

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

◆ HCR_GetProgIdKeyOfExtension()

HRESULT HCR_GetProgIdKeyOfExtension ( PCWSTR  szExtension,
PHKEY  phKey,
BOOL  AllowFallback 
)

Definition at line 55 of file classes.c.

56{
57 LONG err;
60 if (szExtension[0] != '.')
61 {
62 ext[0] = '.';
63 lstrcpynW(ext + 1, szExtension, _countof(ext) - 1);
64 szExtension = ext;
65 }
67 if (!err && progid[0] != UNICODE_NULL)
68 {
70 if (!err)
71 return err; /* A real ProgId key, return S_OK */
72 }
73 if (AllowFallback)
74 {
75 err = RegOpenKeyExW(HKEY_CLASSES_ROOT, szExtension, 0, KEY_READ, phKey);
76 if (!err)
77 return S_FALSE;
78 }
79 return HRESULT_FROM_WIN32(err);
80}
static const WCHAR *const ext[]
Definition: module.c:53
#define progid(str)
Definition: exdisp.idl:31
#define err(...)
#define MAX_EXTENSION_LENGTH
Definition: classes.c:47
static LONG GetRegString(HKEY hKey, PCWSTR SubKey, PCWSTR Name, PWSTR Buffer, UINT cchBuf)
Definition: classes.c:49
#define max(a, b)
Definition: svc.c:63
#define S_FALSE
Definition: winerror.h:3451
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210

Referenced by SHELL32_AssocGetExtensionDescription(), SHELL_IsShortcut(), and ShellExecute_GetClassKey().

◆ HCR_MapTypeToValueA()

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

Definition at line 116 of file classes.c.

117{
118 HKEY hkey;
119 char szTemp[MAX_EXTENSION_LENGTH + 2];
120
121 TRACE("%s %p\n", szExtension, szFileType);
122
123 /* added because we do not want to have double dots */
124 if (szExtension[0] == '.')
125 bPrependDot = FALSE;
126
127 if (bPrependDot)
128 szTemp[0] = '.';
129
130 lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
131
132 if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
133 {
134 return FALSE;
135 }
136
137 if (RegQueryValueA(hkey, NULL, szFileType, &len))
138 {
139 RegCloseKey(hkey);
140 return FALSE;
141 }
142
143 RegCloseKey(hkey);
144
145 TRACE("--UE;\n} %s\n", szFileType);
146
147 return TRUE;
148}
LSTATUS WINAPI RegQueryValueA(HKEY hkey, LPCSTR name, LPSTR data, LPLONG count)
Definition: reg.c:4212
#define lstrcpynA
Definition: compat.h:751

◆ HCR_MapTypeToValueW()

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

Definition at line 82 of file classes.c.

83{
84 HKEY hkey;
85 WCHAR szTemp[MAX_EXTENSION_LENGTH + 2];
86
87 TRACE("%s %p\n", debugstr_w(szExtension), szFileType);
88
89 /* added because we do not want to have double dots */
90 if (szExtension[0] == '.')
91 bPrependDot = FALSE;
92
93 if (bPrependDot)
94 szTemp[0] = '.';
95
96 lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
97
98 if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
99 {
100 return FALSE;
101 }
102
103 if (RegQueryValueW(hkey, NULL, szFileType, &len))
104 {
105 RegCloseKey(hkey);
106 return FALSE;
107 }
108
109 RegCloseKey(hkey);
110
111 TRACE("--UE;\n} %s\n", debugstr_w(szFileType));
112
113 return TRUE;
114}

Referenced by SHGetFileInfoW().

◆ HCR_RegGetIconA()

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

Definition at line 294 of file classes.c.

295{
296 DWORD dwType;
297 char sTemp[MAX_PATH];
298 char sNum[5];
299
300 if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
301 {
302 if (dwType == REG_EXPAND_SZ)
303 {
304 ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH);
305 lstrcpynA(szDest, sTemp, len);
306 }
307 if (ParseFieldA (szDest, 2, sNum, 5))
308 *picon_idx=atoi(sNum);
309 else
310 *picon_idx=0; /* sometimes the icon number is missing */
311 ParseFieldA (szDest, 1, szDest, len);
312 PathUnquoteSpacesA(szDest);
313 return TRUE;
314 }
315 return FALSE;
316}
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:372
void WINAPI PathUnquoteSpacesA(char *path)
Definition: path.c:1964
_ACRTIMP int __cdecl atoi(const char *)
Definition: string.c:1720
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len) DECLSPEC_HIDDEN
Definition: shellord.c:83

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 270 of file classes.c.

271{
272 DWORD dwType, size = len * sizeof(WCHAR);
273 WCHAR sTemp[MAX_PATH];
274 WCHAR sNum[5];
275
276 if (!RegQueryValueExW(hkey, szName, 0, &dwType, (LPBYTE)szDest, &size))
277 {
278 if (dwType == REG_EXPAND_SZ)
279 {
280 ExpandEnvironmentStringsW(szDest, sTemp, MAX_PATH);
281 lstrcpynW(szDest, sTemp, len);
282 }
283 if (ParseFieldW (szDest, 2, sNum, _countof(sNum)))
284 *picon_idx = atoiW(sNum);
285 else
286 *picon_idx=0; /* sometimes the icon number is missing */
287 ParseFieldW (szDest, 1, szDest, len);
288 PathUnquoteSpacesW(szDest);
289 return TRUE;
290 }
291 return FALSE;
292}
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:1982
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN
Definition: shellord.c:117
#define atoiW(s)
Definition: unicode.h:54

Referenced by HCR_GetIconW().

◆ HCR_RegOpenClassIDKey()

BOOL HCR_RegOpenClassIDKey ( REFIID  riid,
HKEY hkey 
)

Definition at line 257 of file classes.c.

258{
259 char xriid[50];
260 sprintf( xriid, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
261 (UINT)riid->Data1, riid->Data2, riid->Data3,
262 riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
263 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
264
265 TRACE("%s\n",xriid );
266
267 return !RegOpenKeyExA(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey);
268}

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

◆ SHELL32_EnumDefaultVerbList()

EXTERN_C HRESULT SHELL32_EnumDefaultVerbList ( LPCWSTR  List,
UINT  Index,
LPWSTR  Verb,
SIZE_T  cchMax 
)

Definition at line 238 of file CDefaultContextMenu.cpp.

239{
240 for (UINT i = 0; *List; ++i)
241 {
242 while (IsVerbListSeparator(*List))
243 List++;
245 while (*List && !IsVerbListSeparator(*List))
246 List++;
247 if (List > Start && i == Index)
249 }
251}
static bool IsVerbListSeparator(WCHAR Ch)
static _Out_opt_ PULONGLONG Start
UINT cchMax
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
const uint16_t * LPCWSTR
Definition: typedefs.h:57
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by HCR_GetDefaultVerbW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )