ReactOS 0.4.16-dev-823-g9a093ec
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
#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
#define RRF_RT_REG_SZ
Definition: driver.c:575
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33

Referenced by HCR_GetProgIdKeyOfExtension().

◆ HCR_GetClassNameA()

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

Definition at line 497 of file classes.c.

498{ HKEY hkey;
499 BOOL ret = FALSE;
500 DWORD buflen = len;
501#ifdef __REACTOS__
502 CHAR szName[100];
503 LPOLESTR pStr;
504#endif
505
506 szDest[0] = 0;
507
508#ifdef __REACTOS__
509 if (StringFromCLSID(riid, &pStr) == S_OK)
510 {
511 DWORD dwLen = buflen * sizeof(CHAR);
512 sprintf(szName, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%S", pStr);
514 {
515 ret = TRUE;
516 }
517 CoTaskMemFree(pStr);
518 }
519 if (!ret && HCR_RegOpenClassIDKey(riid, &hkey))
520#else
521 if (HCR_RegOpenClassIDKey(riid, &hkey))
522#endif
523 {
524 if (!RegLoadMUIStringA(hkey,"LocalizedString",szDest,len,NULL,0,NULL) ||
525 !RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len))
526 {
527 ret = TRUE;
528 }
529 RegCloseKey(hkey);
530 }
531
532 if (!ret || !szDest[0])
533 {
534 if(IsEqualIID(riid, &CLSID_ShellDesktop))
535 {
536 if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
537 ret = TRUE;
538 }
539 else if (IsEqualIID(riid, &CLSID_MyComputer))
540 {
541 if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
542 ret = TRUE;
543 }
544#ifdef __REACTOS__
545 else if (IsEqualIID(riid, &CLSID_MyDocuments))
546 {
547 if(LoadStringA(shell32_hInstance, IDS_PERSONAL, szDest, buflen))
548 ret = TRUE;
549 }
550 else if (IsEqualIID(riid, &CLSID_RecycleBin))
551 {
553 ret = TRUE;
554 }
555 else if (IsEqualIID(riid, &CLSID_ControlPanel))
556 {
558 ret = TRUE;
559 }
561 {
563 ret = TRUE;
564 }
565#endif
566 }
567
568 TRACE("-- (%s)\n", szDest);
569
570 return ret;
571}
#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 id, LPOLESTR *idstr)
Definition: compobj.c:2412
const GUID CLSID_AdminFolderShortcut
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static LPOLESTR
Definition: stg_prop.c:27
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:253
#define IDS_DESKTOP
Definition: shresdef.h:71
#define IDS_MYCOMPUTER
Definition: shresdef.h:279
#define IDS_CONTROLPANEL
Definition: shresdef.h:139
#define IDS_ADMINISTRATIVETOOLS
Definition: shresdef.h:274
#define IDS_RECYCLEBIN_FOLDER_NAME
Definition: shresdef.h:268
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char * LPBYTE
Definition: typedefs.h:53
int ret
#define HKEY_CURRENT_USER
Definition: winreg.h:11
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
char CHAR
Definition: xmlstorage.h:175

Referenced by shdebugstr_guid().

◆ HCR_GetClassNameW()

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

Definition at line 422 of file classes.c.

423{
424 HKEY hkey;
425 BOOL ret = FALSE;
426 DWORD buflen = len;
427#ifdef __REACTOS__
428 WCHAR 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(WCHAR);
438 swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr);
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 (!RegLoadMUIStringW(hkey, L"LocalizedString", szDest, len, NULL, 0, NULL) ||
451 !RegQueryValueExW(hkey, L"", 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 (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
463 ret = TRUE;
464 }
465 else if (IsEqualIID(riid, &CLSID_MyComputer))
466 {
467 if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
468 ret = TRUE;
469 }
470#ifdef __REACTOS__
471 else if (IsEqualIID(riid, &CLSID_MyDocuments))
472 {
473 if(LoadStringW(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 {
484 ret = TRUE;
485 }
487 {
489 ret = TRUE;
490 }
491#endif
492 }
493 TRACE("-- %s\n", debugstr_w(szDest));
494 return ret;
495}
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 debugstr_w
Definition: kernel32.h:32
#define L(x)
Definition: ntvdm.h:50
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180

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 */
167 size = _countof(verbs);
168 if (!RegQueryValueW(hkeyClass, L"shell", verbs, &size) && *verbs)
169 {
170 for (UINT i = 0;; ++i)
171 {
172 if (FAILED(SHELL32_EnumDefaultVerbList(verbs, i, szDest, len)))
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 lstrcpyW(sTemp, L"shell\\open\\command");
188 if (!RegOpenKeyExW(hkeyClass, sTemp, 0, KEY_READ, &hkey))
189 {
190 RegCloseKey(hkey);
191 lstrcpynW(szDest, L"open", len);
192 TRACE("default verb=open\n");
193 return TRUE;
194 }
195
196 /* and then just use the first verb on Windows >= 2000 */
197#ifdef __REACTOS__
198 if (!RegOpenKeyExW(hkeyClass, L"shell", 0, KEY_READ, &hkey))
199 {
200 if (!RegEnumKeyW(hkey, 0, szDest, len) && *szDest)
201 {
202 TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
203 RegCloseKey(hkey);
204 return TRUE;
205 }
206 RegCloseKey(hkey);
207 }
208#else
209 if (!RegEnumKeyW(hkeyClass, 0, szDest, len) && *szDest)
210 {
211 TRACE("default verb=first verb=%s\n", debugstr_w(szDest));
212 return TRUE;
213 }
214#endif
215
216 TRACE("no default verb!\n");
217 return FALSE;
218}
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
#define FAILED(hr)
Definition: intsafe.h:51
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#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(), COpenWithList::SetDefaultHandler(), and SHELL_FindExecutableByVerb().

◆ HCR_GetExecuteCommandW()

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

Definition at line 220 of file classes.c.

221{
222 WCHAR sTempVerb[MAX_PATH];
223 BOOL ret;
224
225 TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest);
226
227 if (szClass)
228 RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass);
229 if (!hkeyClass)
230 return FALSE;
231 ret = FALSE;
232
233 if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0])))
234 {
235 WCHAR sTemp[MAX_PATH];
236 lstrcpyW(sTemp, L"shell\\");
237 lstrcatW(sTemp, sTempVerb);
238 lstrcatW(sTemp, L"\\command");
239 ret = (ERROR_SUCCESS == SHGetValueW(hkeyClass, sTemp, NULL, NULL, szDest, &len));
240 }
241 if (szClass)
242 RegCloseKey(hkeyClass);
243
244 TRACE("-- %s\n", debugstr_w(szDest) );
245 return ret;
246}
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
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 590 of file classes.c.

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

Referenced by CRegFolder::GetGuidItemAttributes().

◆ HCR_GetIconA()

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

Definition at line 339 of file classes.c.

340{
341 HKEY hkey;
342 char sTemp[MAX_PATH];
343 BOOL ret = FALSE;
344
345 TRACE("%s\n",szClass );
346
347 sprintf(sTemp, "%s\\DefaultIcon",szClass);
348
349 if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey))
350 {
351 ret = HCR_RegGetIconA(hkey, szDest, szName, len, picon_idx);
352 RegCloseKey(hkey);
353 }
354
355 if (ret)
356 TRACE("-- %s %i\n", szDest, *picon_idx);
357 else
358 TRACE("-- not found\n");
359
360 return ret;
361}
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:290

◆ HCR_GetIconW()

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

Definition at line 314 of file classes.c.

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

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:2357
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by SHELL32_AssocGetExtensionDescription(), and SHELL_IsShortcut().

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

291{
292 DWORD dwType;
293 char sTemp[MAX_PATH];
294 char sNum[5];
295
296 if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
297 {
298 if (dwType == REG_EXPAND_SZ)
299 {
300 ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH);
301 lstrcpynA(szDest, sTemp, len);
302 }
303 if (ParseFieldA (szDest, 2, sNum, 5))
304 *picon_idx=atoi(sNum);
305 else
306 *picon_idx=0; /* sometimes the icon number is missing */
307 ParseFieldA (szDest, 1, szDest, len);
308 PathUnquoteSpacesA(szDest);
309 return TRUE;
310 }
311 return FALSE;
312}
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
VOID WINAPI PathUnquoteSpacesA(LPSTR lpszPath)
Definition: path.c:1018
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
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 266 of file classes.c.

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

Referenced by HCR_GetIconW().

◆ HCR_RegOpenClassIDKey()

BOOL HCR_RegOpenClassIDKey ( REFIID  riid,
HKEY hkey 
)

Definition at line 253 of file classes.c.

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

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 127 of file CDefaultContextMenu.cpp.

128{
129 for (UINT i = 0; *List; ++i)
130 {
131 while (IsVerbListSeparator(*List))
132 List++;
134 while (*List && !IsVerbListSeparator(*List))
135 List++;
136 if (List > Start && i == Index)
137 return StringCchCopyNW(Verb, cchMax, Start, List - Start);
138 }
140}
static bool IsVerbListSeparator(WCHAR Ch)
UINT cchMax
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
return pTarget Start()
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by HCR_GetDefaultVerbW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )