3 * (HKEY_CLASSES_ROOT - Stuff)
10 #include "debugtools.h"
14 #include "wine/obj_queryassociations.h"
16 #include "shell32_main.h"
20 DEFAULT_DEBUG_CHANNEL(shell);
22 #define MAX_EXTENSION_LENGTH 20
24 BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot)
26 char szTemp[MAX_EXTENSION_LENGTH + 2];
28 TRACE("%s %p\n",szExtension, szFileType );
33 lstrcpynA(szTemp+((bPrependDot)?1:0), szExtension, MAX_EXTENSION_LENGTH);
35 if (RegOpenKeyExA(HKEY_CLASSES_ROOT,szTemp,0,0x02000000,&hkey))
39 if (RegQueryValueA(hkey,NULL,szFileType,&len))
46 TRACE("-- %s\n", szFileType );
50 BOOL HCR_GetExecuteCommand ( LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len )
54 TRACE("%s %s\n",szClass, szVerb );
56 sprintf(sTemp, "%s\\shell\\%s\\command",szClass, szVerb);
58 if (RegOpenKeyExA(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
62 if (RegQueryValueA(hkey,NULL,szDest,&len))
68 TRACE("-- %s\n", szDest );
73 /***************************************************************************************
74 * HCR_GetDefaultIcon [internal]
76 * Gets the icon for a filetype
78 BOOL HCR_GetDefaultIcon (LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr)
83 TRACE("%s\n",szClass );
85 sprintf(sTemp, "%s\\DefaultIcon",szClass);
87 if (RegOpenKeyExA(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
91 if (RegQueryValueA(hkey,NULL,szDest,&len))
98 if (ParseFieldA (szDest, 2, sNum, 5))
102 ParseFieldA (szDest, 1, szDest, len);
104 TRACE("-- %s %li\n", szDest, *dwNr );
109 /***************************************************************************************
110 * HCR_GetClassName [internal]
112 * Gets the name of a registred class
114 BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
120 strcpy(xriid,"CLSID\\");
121 WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
123 TRACE("%s\n",xriid );
126 if (!RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
128 if (!RegQueryValueExA(hkey,"",0,NULL,szDest,&len))
135 if (!ret || !szDest[0])
137 if(IsEqualIID(riid, &CLSID_ShellDesktop))
139 if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen))
142 else if (IsEqualIID(riid, &CLSID_MyComputer))
144 if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen))
149 TRACE("-- %s\n", szDest);
154 /***************************************************************************************
155 * HCR_GetFolderAttributes [internal]
157 * gets the folder attributes of a class
160 * verify the defaultvalue for *szDest
162 BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
168 strcpy(xriid,"CLSID\\");
169 WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
170 TRACE("%s\n",xriid );
172 if (!szDest) return FALSE;
173 *szDest = SFGAO_FOLDER|SFGAO_FILESYSTEM;
175 strcat (xriid, "\\ShellFolder");
177 if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
182 if (RegQueryValueExA(hkey,"Attributes",0,NULL,(LPBYTE)&attributes,&len))
190 TRACE("-- 0x%08lx\n", attributes);
192 *szDest = attributes;
198 { ICOM_VFIELD(IQueryAssociations);
200 } IQueryAssociationsImpl;
202 static struct ICOM_VTABLE(IQueryAssociations) qavt;
204 /**************************************************************************
205 * IQueryAssociations_Constructor
207 IQueryAssociations* IQueryAssociations_Constructor(void)
209 IQueryAssociationsImpl* ei;
211 ei=(IQueryAssociationsImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IQueryAssociationsImpl));
213 ICOM_VTBL(ei) = &qavt;
217 return (IQueryAssociations *)ei;
219 /**************************************************************************
220 * IQueryAssociations_QueryInterface
222 static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
223 IQueryAssociations * iface,
227 ICOM_THIS(IQueryAssociationsImpl,iface);
229 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObj);
233 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
237 else if(IsEqualIID(riid, &IID_IQueryAssociations)) /*IExtractIcon*/
239 *ppvObj = (IQueryAssociations*)This;
244 IQueryAssociations_AddRef((IQueryAssociations*) *ppvObj);
245 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
248 TRACE("-- Interface: E_NOINTERFACE\n");
249 return E_NOINTERFACE;
252 /**************************************************************************
253 * IQueryAssociations_AddRef
255 static ULONG WINAPI IQueryAssociations_fnAddRef(IQueryAssociations * iface)
257 ICOM_THIS(IQueryAssociationsImpl,iface);
259 TRACE("(%p)->(count=%lu)\n",This, This->ref );
263 return ++(This->ref);
265 /**************************************************************************
266 * IQueryAssociations_Release
268 static ULONG WINAPI IQueryAssociations_fnRelease(IQueryAssociations * iface)
270 ICOM_THIS(IQueryAssociationsImpl,iface);
272 TRACE("(%p)->()\n",This);
278 TRACE(" destroying IExtractIcon(%p)\n",This);
279 HeapFree(GetProcessHeap(),0,This);
285 static HRESULT WINAPI IQueryAssociations_fnInit(
286 IQueryAssociations * iface,
295 static HRESULT WINAPI IQueryAssociations_fnGetString(
296 IQueryAssociations * iface,
306 static HRESULT WINAPI IQueryAssociations_fnGetKey(
307 IQueryAssociations * iface,
316 static HRESULT WINAPI IQueryAssociations_fnGetData(
317 IQueryAssociations * iface,
326 static HRESULT WINAPI IQueryAssociations_fnGetEnum(
327 IQueryAssociations * iface,
337 static struct ICOM_VTABLE(IQueryAssociations) qavt =
339 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
340 IQueryAssociations_fnQueryInterface,
341 IQueryAssociations_fnAddRef,
342 IQueryAssociations_fnRelease,
343 IQueryAssociations_fnInit,
344 IQueryAssociations_fnGetString,
345 IQueryAssociations_fnGetKey,
346 IQueryAssociations_fnGetData,
347 IQueryAssociations_fnGetEnum