ReactOS 0.4.15-dev-7918-g2a2556c
folders.cpp File Reference
#include "precomp.h"
Include dependency graph for folders.cpp:

Go to the source code of this file.

Functions

static void InitIconOverlays (void)
 
BOOL GetIconOverlay (LPCITEMIDLIST pidl, WCHAR *wTemp, int *pIndex)
 

Variables

WCHAR swShell32Name [MAX_PATH]
 
DWORD NumIconOverlayHandlers = 0
 
IShellIconOverlayIdentifier ** Handlers = NULL
 

Function Documentation

◆ GetIconOverlay()

BOOL GetIconOverlay ( LPCITEMIDLIST  pidl,
WCHAR wTemp,
int pIndex 
)

Definition at line 88 of file folders.cpp.

89{
91 HRESULT hResult;
92 int Priority;
93 int HighestPriority;
97
99 return FALSE;
100
101 if (!Handlers)
103
104 HighestPriority = 101;
107 {
108 hResult = Handlers[Index]->IsMemberOf(szPath, SFGAO_FILESYSTEM);
109 if (hResult == S_OK)
110 {
111 hResult = Handlers[Index]->GetPriority(&Priority);
112 if (hResult == S_OK)
113 {
114 if (Priority < HighestPriority)
115 {
116 HighestPriority = Priority;
118 }
119 }
120 }
121 }
122
124 return FALSE;
125
126 hResult = Handlers[IconIndex]->GetOverlayInfo(wTemp, MAX_PATH, pIndex, &Flags);
127
128 if (hResult == S_OK)
129 return TRUE;
130 else
131 return FALSE;
132}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PATH
Definition: compat.h:34
static const WCHAR IconIndex[]
Definition: install.c:52
unsigned long DWORD
Definition: ntddk_ex.h:95
static void InitIconOverlays(void)
Definition: folders.cpp:27
DWORD NumIconOverlayHandlers
Definition: folders.cpp:24
IShellIconOverlayIdentifier ** Handlers
Definition: folders.cpp:25
#define S_OK
Definition: intsafe.h:52
LPCWSTR szPath
Definition: env.c:37
_Out_ PULONG _Out_ PULONG pIndex
Definition: ndis.h:4565
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1353
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ InitIconOverlays()

static void InitIconOverlays ( void  )
static

Definition at line 27 of file folders.cpp.

28{
29 HKEY hKey;
30 DWORD dwIndex, dwResult, dwSize;
32 WCHAR szValue[100];
34
35 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
36 return;
37
39 {
41 return;
42 }
43
44 Handlers = (IShellIconOverlayIdentifier **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwResult * sizeof(IShellIconOverlayIdentifier*));
45 if (!Handlers)
46 {
48 return;
49 }
50
51 dwIndex = 0;
52
53 CoInitialize(0);
54
55 do
56 {
57 dwSize = sizeof(szName) / sizeof(WCHAR);
58 dwResult = RegEnumKeyExW(hKey, dwIndex, szName, &dwSize, NULL, NULL, NULL, NULL);
59
60 if (dwResult == ERROR_NO_MORE_ITEMS)
61 break;
62
63 if (dwResult == ERROR_SUCCESS)
64 {
65 dwSize = sizeof(szValue) / sizeof(WCHAR);
67 {
69
70 CLSIDFromString(szValue, &clsid);
71 dwResult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IShellIconOverlayIdentifier, &Overlay));
72 if (dwResult == S_OK)
73 {
76 }
77 }
78 }
79
80 dwIndex++;
81
82 } while(1);
83
85}
#define RegCloseKey(hKey)
Definition: registry.h:49
T * Detach()
Definition: atlcomcli.h:186
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
#define RRF_RT_REG_SZ
Definition: driver.c:575
FxAutoRegKey hKey
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
REFCLSID clsid
Definition: msctf.c:82
#define KEY_READ
Definition: nt_native.h:1023
#define L(x)
Definition: ntvdm.h:50
static const WCHAR szName[]
Definition: powrprof.c:45
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define IID_PPV_ARG(Itype, ppType)

Referenced by GetIconOverlay().

Variable Documentation

◆ Handlers

IShellIconOverlayIdentifier** Handlers = NULL

Definition at line 25 of file folders.cpp.

Referenced by GetIconOverlay(), and InitIconOverlays().

◆ NumIconOverlayHandlers

DWORD NumIconOverlayHandlers = 0

Definition at line 24 of file folders.cpp.

Referenced by GetIconOverlay(), and InitIconOverlays().

◆ swShell32Name