dbghelp: Return the size of each directory instead of passing a pointer to it.
[wine] / dlls / shell32 / folders.c
CommitLineData
85ed45e3 1/*
85ed45e3
AJ
2 * Copyright 1997 Marcus Meissner
3 * Copyright 1998 Juergen Schmied
4 *
0799c1a7
AJ
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
360a3f91 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
85ed45e3
AJ
18 */
19
0f3d8bf5
MF
20#include "config.h"
21#include "wine/port.h"
22
85ed45e3 23#include <stdlib.h>
e37c6e18 24#include <stdarg.h>
91791032 25#include <stdio.h>
85ed45e3 26#include <string.h>
8e7cb4db 27
486d020c
FG
28#define COBJMACROS
29
f5cea729 30#include "windef.h"
e37c6e18 31#include "winbase.h"
8e804681 32#include "winerror.h"
1f5315c8 33#include "objbase.h"
3954117c 34#include "undocshell.h"
b08cb175 35#include "shlguid.h"
8e7cb4db 36
0799c1a7 37#include "wine/debug.h"
8e7cb4db 38
ba28ba17 39#include "pidl.h"
85ed45e3 40#include "shell32_main.h"
8e804681 41#include "shfldr.h"
861282bf 42#include "shresdef.h"
85ed45e3 43
0799c1a7 44WINE_DEFAULT_DEBUG_CHANNEL(shell);
b4b9fae6 45
8e7cb4db 46/***********************************************************************
1b7b3163 47* IExtractIconW implementation
85ed45e3 48*/
9a624916 49typedef struct
1b7b3163 50{
eba47f1d 51 const IExtractIconWVtbl *lpVtbl;
e28c014a 52 LONG ref;
eba47f1d
DT
53 const IPersistFileVtbl *lpvtblPersistFile;
54 const IExtractIconAVtbl *lpvtblExtractIconA;
0467ce9f 55 LPITEMIDLIST pidl;
1b7b3163 56} IExtractIconWImpl;
8e7cb4db 57
eba47f1d
DT
58static const IExtractIconAVtbl eiavt;
59static const IExtractIconWVtbl eivt;
60static const IPersistFileVtbl pfvt;
85ed45e3 61
b1a9701b
AJ
62static inline IExtractIconW *impl_from_IPersistFile( IPersistFile *iface )
63{
64 return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblPersistFile));
65}
66
67static inline IExtractIconW *impl_from_IExtractIconA( IExtractIconA *iface )
68{
69 return (IExtractIconW *)((char*)iface - FIELD_OFFSET(IExtractIconWImpl, lpvtblExtractIconA));
70}
85ed45e3 71
1b7b3163 72
85ed45e3 73/**************************************************************************
1b7b3163 74* IExtractIconW_Constructor
85ed45e3 75*/
1b7b3163 76IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl)
8e7cb4db 77{
1b7b3163 78 IExtractIconWImpl* ei;
d7d7e3bc
RK
79
80 TRACE("%p\n", pidl);
72b76d1a 81
17c31068 82 ei = HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImpl));
8e7cb4db 83 ei->ref=1;
c2ebe1ff 84 ei->lpVtbl = &eivt;
d0065323 85 ei->lpvtblPersistFile = &pfvt;
1b7b3163 86 ei->lpvtblExtractIconA = &eiavt;
8e7cb4db 87 ei->pidl=ILClone(pidl);
72b76d1a 88
8e7cb4db 89 pdump(pidl);
72b76d1a 90
1b7b3163
RK
91 TRACE("(%p)\n", ei);
92 return (IExtractIconW *)ei;
85ed45e3
AJ
93}
94/**************************************************************************
1b7b3163 95 * IExtractIconW_QueryInterface
85ed45e3 96 */
1b7b3163 97static HRESULT WINAPI IExtractIconW_fnQueryInterface(IExtractIconW *iface, REFIID riid, LPVOID *ppvObj)
8e7cb4db 98{
314b99c4 99 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
8e7cb4db 100
1b7b3163 101 TRACE("(%p)->(\n\tIID:\t%s,%p)\n", This, debugstr_guid(riid), ppvObj);
8e7cb4db
JS
102
103 *ppvObj = NULL;
104
1b7b3163
RK
105 if (IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
106 {
107 *ppvObj = This;
108 }
109 else if (IsEqualIID(riid, &IID_IPersistFile)) /*IExtractIcon*/
110 {
111 *ppvObj = (IPersistFile*)&(This->lpvtblPersistFile);
8e7cb4db 112 }
1b7b3163
RK
113 else if (IsEqualIID(riid, &IID_IExtractIconA)) /*IExtractIcon*/
114 {
115 *ppvObj = (IExtractIconA*)&(This->lpvtblExtractIconA);
d0065323 116 }
1b7b3163
RK
117 else if (IsEqualIID(riid, &IID_IExtractIconW)) /*IExtractIcon*/
118 {
119 *ppvObj = (IExtractIconW*)This;
8e7cb4db
JS
120 }
121
122 if(*ppvObj)
1b7b3163
RK
123 {
124 IExtractIconW_AddRef((IExtractIconW*) *ppvObj);
a099a555 125 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
8e7cb4db
JS
126 return S_OK;
127 }
a099a555 128 TRACE("-- Interface: E_NOINTERFACE\n");
85ed45e3 129 return E_NOINTERFACE;
8e7cb4db 130}
85ed45e3
AJ
131
132/**************************************************************************
1b7b3163 133* IExtractIconW_AddRef
85ed45e3 134*/
1b7b3163 135static ULONG WINAPI IExtractIconW_fnAddRef(IExtractIconW * iface)
8e7cb4db 136{
314b99c4 137 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ba92d292 138 ULONG refCount = InterlockedIncrement(&This->ref);
8e7cb4db 139
89e1d294 140 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
ba28ba17 141
ba92d292 142 return refCount;
85ed45e3
AJ
143}
144/**************************************************************************
1b7b3163 145* IExtractIconW_Release
85ed45e3 146*/
1b7b3163 147static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
8e7cb4db 148{
314b99c4 149 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
ba92d292 150 ULONG refCount = InterlockedDecrement(&This->ref);
8e7cb4db 151
89e1d294 152 TRACE("(%p)->(count=%u)\n", This, refCount + 1);
ba28ba17 153
ba92d292 154 if (!refCount)
1b7b3163
RK
155 {
156 TRACE(" destroying IExtractIcon(%p)\n",This);
8e7cb4db
JS
157 SHFree(This->pidl);
158 HeapFree(GetProcessHeap(),0,This);
159 return 0;
160 }
ba92d292 161 return refCount;
85ed45e3 162}
1b7b3163 163
77beaca7
JL
164static HRESULT getIconLocationForFolder(IExtractIconW *iface, UINT uFlags,
165 LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
166{
314b99c4 167 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
7114f8c3 168 int icon_idx;
8e804681
RS
169 WCHAR wszPath[MAX_PATH];
170 WCHAR wszCLSIDValue[CHARS_IN_GUID];
171 static const WCHAR shellClassInfo[] = { '.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0 };
172 static const WCHAR iconFile[] = { 'I','c','o','n','F','i','l','e',0 };
173 static const WCHAR clsid[] = { 'C','L','S','I','D',0 };
174 static const WCHAR clsid2[] = { 'C','L','S','I','D','2',0 };
175 static const WCHAR iconIndex[] = { 'I','c','o','n','I','n','d','e','x',0 };
176
177 if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconFile,
178 wszPath, MAX_PATH))
77beaca7 179 {
8e804681
RS
180 WCHAR wszIconIndex[10];
181 SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconIndex,
182 wszIconIndex, 10);
183 *piIndex = atoiW(wszIconIndex);
184 }
185 else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid,
186 wszCLSIDValue, CHARS_IN_GUID) &&
7114f8c3 187 HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx))
8e804681 188 {
7114f8c3 189 *piIndex = icon_idx;
8e804681
RS
190 }
191 else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid2,
192 wszCLSIDValue, CHARS_IN_GUID) &&
7114f8c3 193 HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx))
8e804681 194 {
7114f8c3 195 *piIndex = icon_idx;
77beaca7 196 }
8e804681 197 else
77beaca7
JL
198 {
199 static const WCHAR folder[] = { 'F','o','l','d','e','r',0 };
200
7114f8c3 201 if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &icon_idx))
77beaca7
JL
202 {
203 lstrcpynW(szIconFile, swShell32Name, cchMax);
7114f8c3 204 icon_idx = -IDI_SHELL_FOLDER;
77beaca7 205 }
7114f8c3
MF
206
207 if (uFlags & GIL_OPENICON)
208 *piIndex = icon_idx<0? icon_idx-1: icon_idx+1;
209 else
210 *piIndex = icon_idx;
77beaca7 211 }
7114f8c3 212
77beaca7
JL
213 return S_OK;
214}
215
0f3d8bf5 216WCHAR swShell32Name[MAX_PATH];
1b7b3163 217
85ed45e3 218/**************************************************************************
1b7b3163 219* IExtractIconW_GetIconLocation
0fa45f11
JS
220*
221* mapping filetype to icon
85ed45e3 222*/
1b7b3163
RK
223static HRESULT WINAPI IExtractIconW_fnGetIconLocation(
224 IExtractIconW * iface,
225 UINT uFlags, /* GIL_ flags */
226 LPWSTR szIconFile,
d0065323
JS
227 UINT cchMax,
228 int * piIndex,
1b7b3163 229 UINT * pwFlags) /* returned GIL_ flags */
8e7cb4db 230{
314b99c4 231 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
72b76d1a 232
d0065323 233 char sTemp[MAX_PATH];
7114f8c3 234 int icon_idx;
0fa45f11 235 GUID const * riid;
d0065323 236 LPITEMIDLIST pSimplePidl = ILFindLastID(This->pidl);
9a624916 237
a099a555 238 TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags);
8e7cb4db 239
d0065323
JS
240 if (pwFlags)
241 *pwFlags = 0;
a0d77315 242
d0065323 243 if (_ILIsDesktop(pSimplePidl))
0fa45f11 244 {
1b7b3163 245 lstrcpynW(szIconFile, swShell32Name, cchMax);
861282bf 246 *piIndex = -IDI_SHELL_DESKTOP;
d0065323 247 }
0fa45f11
JS
248
249 /* my computer and other shell extensions */
1b7b3163 250 else if ((riid = _ILGetGUIDPointer(pSimplePidl)))
9a624916 251 {
77beaca7
JL
252 static const WCHAR fmt[] = { 'C','L','S','I','D','\\',
253 '{','%','0','8','l','x','-','%','0','4','x','-','%','0','4','x','-',
254 '%','0','2','x','%','0','2','x','-','%','0','2','x', '%','0','2','x',
255 '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0 };
2843de3f 256 WCHAR xriid[50];
1b7b3163 257
2843de3f 258 sprintfW(xriid, fmt,
1b7b3163
RK
259 riid->Data1, riid->Data2, riid->Data3,
260 riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
261 riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);
0fa45f11 262
7114f8c3 263 if (HCR_GetDefaultIconW(xriid, szIconFile, cchMax, &icon_idx))
0fa45f11 264 {
7114f8c3 265 *piIndex = icon_idx;
d0065323
JS
266 }
267 else
0fa45f11 268 {
1b7b3163 269 lstrcpynW(szIconFile, swShell32Name, cchMax);
be428abd
HD
270 if(IsEqualGUID(riid, &CLSID_MyComputer))
271 *piIndex = -IDI_SHELL_MY_COMPUTER;
272 else if(IsEqualGUID(riid, &CLSID_MyDocuments))
b0b47774 273 *piIndex = -IDI_SHELL_MY_DOCUMENTS;
be428abd
HD
274 else if(IsEqualGUID(riid, &CLSID_NetworkPlaces))
275 *piIndex = -IDI_SHELL_MY_NETWORK_PLACES;
3c3495ea
MJ
276 else if(IsEqualGUID(riid, &CLSID_UnixFolder) ||
277 IsEqualGUID(riid, &CLSID_UnixDosFolder))
94e5f012 278 *piIndex = -IDI_SHELL_DRIVE;
be428abd
HD
279 else
280 *piIndex = -IDI_SHELL_FOLDER;
d0065323 281 }
d0065323 282 }
0fa45f11 283
d0065323 284 else if (_ILIsDrive (pSimplePidl))
0fa45f11 285 {
77beaca7 286 static const WCHAR drive[] = { 'D','r','i','v','e',0 };
2843de3f 287
72c9008e
AJ
288 int icon_idx = -1;
289
290 if (_ILGetDrive(pSimplePidl, sTemp, MAX_PATH))
0fa45f11 291 {
72c9008e
AJ
292 switch(GetDriveTypeA(sTemp))
293 {
861282bf
HD
294 case DRIVE_REMOVABLE: icon_idx = IDI_SHELL_FLOPPY; break;
295 case DRIVE_CDROM: icon_idx = IDI_SHELL_CDROM; break;
296 case DRIVE_REMOTE: icon_idx = IDI_SHELL_NETDRIVE; break;
297 case DRIVE_RAMDISK: icon_idx = IDI_SHELL_RAMDISK; break;
72c9008e
AJ
298 }
299 }
300
301 if (icon_idx != -1)
302 {
303 lstrcpynW(szIconFile, swShell32Name, cchMax);
861282bf 304 *piIndex = -icon_idx;
d0065323
JS
305 }
306 else
0fa45f11 307 {
7114f8c3 308 if (HCR_GetDefaultIconW(drive, szIconFile, cchMax, &icon_idx))
72c9008e 309 {
7114f8c3 310 *piIndex = icon_idx;
72c9008e
AJ
311 }
312 else
313 {
314 lstrcpynW(szIconFile, swShell32Name, cchMax);
861282bf 315 *piIndex = -IDI_SHELL_DRIVE;
72c9008e 316 }
d0065323 317 }
d0065323
JS
318 }
319 else if (_ILIsFolder (pSimplePidl))
0fa45f11 320 {
861282bf
HD
321 getIconLocationForFolder(iface, uFlags, szIconFile, cchMax, piIndex,
322 pwFlags);
d0065323 323 }
dd46d6df 324 else
0fa45f11 325 {
dd46d6df
MF
326 BOOL found = FALSE;
327
328 if (_ILIsCPanelStruct(pSimplePidl))
329 {
330 if (SUCCEEDED(CPanel_GetIconLocationW(pSimplePidl, szIconFile, cchMax, piIndex)))
331 found = TRUE;
332 }
333 else if (_ILGetExtension(pSimplePidl, sTemp, MAX_PATH))
0fa45f11 334 {
dd46d6df 335 if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
7114f8c3 336 && HCR_GetDefaultIconA(sTemp, sTemp, MAX_PATH, &icon_idx))
0fa45f11 337 {
dd46d6df
MF
338 if (!lstrcmpA("%1", sTemp)) /* icon is in the file */
339 {
340 SHGetPathFromIDListW(This->pidl, szIconFile);
341 *piIndex = 0;
342 }
343 else
344 {
345 MultiByteToWideChar(CP_ACP, 0, sTemp, -1, szIconFile, cchMax);
7114f8c3 346 *piIndex = icon_idx;
dd46d6df
MF
347 }
348
349 found = TRUE;
1b7b3163 350 }
2c8367a3 351 else if (!lstrcmpiA(sTemp, "lnkfile"))
1b7b3163 352 {
d98c36c1
MF
353 /* extract icon from shell shortcut */
354 IShellFolder* dsf;
355 IShellLinkW* psl;
356
357 if (SUCCEEDED(SHGetDesktopFolder(&dsf)))
358 {
359 HRESULT hr = IShellFolder_GetUIObjectOf(dsf, NULL, 1, (LPCITEMIDLIST*)&This->pidl, &IID_IShellLinkW, NULL, (LPVOID*)&psl);
360
361 if (SUCCEEDED(hr))
362 {
363 hr = IShellLinkW_GetIconLocation(psl, szIconFile, MAX_PATH, piIndex);
364
365 if (SUCCEEDED(hr) && *szIconFile)
366 found = TRUE;
367
368 IShellLinkW_Release(psl);
369 }
370
371 IShellFolder_Release(dsf);
372 }
d0065323 373 }
0fa45f11 374 }
d98c36c1
MF
375
376 if (!found) /* default icon */
377 {
378 lstrcpynW(szIconFile, swShell32Name, cchMax);
379 *piIndex = 0;
380 }
d0065323 381 }
72b76d1a 382
1b7b3163 383 TRACE("-- %s %x\n", debugstr_w(szIconFile), *piIndex);
0fa45f11 384 return NOERROR;
85ed45e3 385}
dd46d6df 386
85ed45e3 387/**************************************************************************
1b7b3163 388* IExtractIconW_Extract
85ed45e3 389*/
1b7b3163 390static HRESULT WINAPI IExtractIconW_fnExtract(IExtractIconW * iface, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
8e7cb4db 391{
314b99c4 392 IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
861282bf 393 int index;
8e7cb4db 394
861282bf
HD
395 FIXME("(%p) (file=%p index=%d %p %p size=%08x) semi-stub\n", This, debugstr_w(pszFile), (signed)nIconIndex,
396 phiconLarge, phiconSmall, nIconSize);
397
40cb9826 398 index = SIC_GetIconIndex(pszFile, nIconIndex, 0);
d0065323
JS
399
400 if (phiconLarge)
861282bf 401 *phiconLarge = ImageList_GetIcon(ShellBigIconList, index, ILD_TRANSPARENT);
d0065323
JS
402
403 if (phiconSmall)
861282bf 404 *phiconSmall = ImageList_GetIcon(ShellSmallIconList, index, ILD_TRANSPARENT);
8e7cb4db 405
8e7cb4db 406 return S_OK;
85ed45e3
AJ
407}
408
eba47f1d 409static const IExtractIconWVtbl eivt =
1b7b3163 410{
1b7b3163
RK
411 IExtractIconW_fnQueryInterface,
412 IExtractIconW_fnAddRef,
413 IExtractIconW_fnRelease,
414 IExtractIconW_fnGetIconLocation,
415 IExtractIconW_fnExtract
416};
417
418/**************************************************************************
419* IExtractIconA_Constructor
420*/
421IExtractIconA* IExtractIconA_Constructor(LPCITEMIDLIST pidl)
422{
314b99c4 423 IExtractIconWImpl *This = (IExtractIconWImpl *)IExtractIconW_Constructor(pidl);
d7d7e3bc
RK
424 IExtractIconA *eia = (IExtractIconA *)&This->lpvtblExtractIconA;
425
426 TRACE("(%p)->(%p)\n", This, eia);
427 return eia;
1b7b3163
RK
428}
429/**************************************************************************
430 * IExtractIconA_QueryInterface
431 */
432static HRESULT WINAPI IExtractIconA_fnQueryInterface(IExtractIconA * iface, REFIID riid, LPVOID *ppvObj)
433{
b1a9701b 434 IExtractIconW *This = impl_from_IExtractIconA(iface);
1b7b3163
RK
435
436 return IExtractIconW_QueryInterface(This, riid, ppvObj);
437}
438
439/**************************************************************************
440* IExtractIconA_AddRef
441*/
442static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface)
443{
b1a9701b 444 IExtractIconW *This = impl_from_IExtractIconA(iface);
1b7b3163
RK
445
446 return IExtractIconW_AddRef(This);
447}
448/**************************************************************************
449* IExtractIconA_Release
450*/
451static ULONG WINAPI IExtractIconA_fnRelease(IExtractIconA * iface)
452{
b1a9701b 453 IExtractIconW *This = impl_from_IExtractIconA(iface);
1b7b3163
RK
454
455 return IExtractIconW_AddRef(This);
456}
457/**************************************************************************
458* IExtractIconA_GetIconLocation
459*
460* mapping filetype to icon
461*/
462static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
463 IExtractIconA * iface,
464 UINT uFlags,
465 LPSTR szIconFile,
466 UINT cchMax,
467 int * piIndex,
468 UINT * pwFlags)
469{
470 HRESULT ret;
471 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR));
b1a9701b 472 IExtractIconW *This = impl_from_IExtractIconA(iface);
1b7b3163
RK
473
474 TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags);
475
476 ret = IExtractIconW_GetIconLocation(This, uFlags, lpwstrFile, cchMax, piIndex, pwFlags);
ea10ed7c 477 WideCharToMultiByte(CP_ACP, 0, lpwstrFile, -1, szIconFile, cchMax, NULL, NULL);
1b7b3163
RK
478 HeapFree(GetProcessHeap(), 0, lpwstrFile);
479
480 TRACE("-- %s %x\n", szIconFile, *piIndex);
481 return ret;
482}
483/**************************************************************************
484* IExtractIconA_Extract
485*/
486static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
487{
488 HRESULT ret;
489 INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0);
490 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
b1a9701b 491 IExtractIconW *This = impl_from_IExtractIconA(iface);
1b7b3163
RK
492
493 TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
494
495 MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwstrFile, len);
496 ret = IExtractIconW_Extract(This, lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
497 HeapFree(GetProcessHeap(), 0, lpwstrFile);
498 return ret;
499}
500
eba47f1d 501static const IExtractIconAVtbl eiavt =
9a624916 502{
2305f3c0 503 IExtractIconA_fnQueryInterface,
8e7cb4db
JS
504 IExtractIconA_fnAddRef,
505 IExtractIconA_fnRelease,
506 IExtractIconA_fnGetIconLocation,
507 IExtractIconA_fnExtract
508};
d0065323
JS
509
510/************************************************************************
511 * IEIPersistFile_QueryInterface (IUnknown)
512 */
513static HRESULT WINAPI IEIPersistFile_fnQueryInterface(
514 IPersistFile *iface,
515 REFIID iid,
516 LPVOID *ppvObj)
517{
b1a9701b 518 IExtractIconW *This = impl_from_IPersistFile(iface);
d0065323 519
1b7b3163 520 return IExtractIconW_QueryInterface(This, iid, ppvObj);
d0065323
JS
521}
522
523/************************************************************************
524 * IEIPersistFile_AddRef (IUnknown)
525 */
526static ULONG WINAPI IEIPersistFile_fnAddRef(
527 IPersistFile *iface)
528{
b1a9701b 529 IExtractIconW *This = impl_from_IPersistFile(iface);
d0065323 530
1b7b3163 531 return IExtractIconW_AddRef(This);
d0065323
JS
532}
533
534/************************************************************************
535 * IEIPersistFile_Release (IUnknown)
536 */
537static ULONG WINAPI IEIPersistFile_fnRelease(
538 IPersistFile *iface)
539{
b1a9701b 540 IExtractIconW *This = impl_from_IPersistFile(iface);
d0065323 541
1b7b3163 542 return IExtractIconW_Release(This);
d0065323
JS
543}
544
545/************************************************************************
546 * IEIPersistFile_GetClassID (IPersist)
547 */
548static HRESULT WINAPI IEIPersistFile_fnGetClassID(
478eee17
PS
549 IPersistFile *iface,
550 LPCLSID lpClassId)
d0065323
JS
551{
552 CLSID StdFolderID = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
553
554 if (lpClassId==NULL)
555 return E_POINTER;
556
557 memcpy(lpClassId, &StdFolderID, sizeof(StdFolderID));
558
559 return S_OK;
560}
561
562/************************************************************************
563 * IEIPersistFile_Load (IPersistFile)
564 */
565static HRESULT WINAPI IEIPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
566{
b1a9701b 567 IExtractIconW *This = impl_from_IPersistFile(iface);
a099a555 568 FIXME("%p\n", This);
d0065323
JS
569 return E_NOTIMPL;
570
571}
572
eba47f1d 573static const IPersistFileVtbl pfvt =
d0065323
JS
574{
575 IEIPersistFile_fnQueryInterface,
576 IEIPersistFile_fnAddRef,
577 IEIPersistFile_fnRelease,
578 IEIPersistFile_fnGetClassID,
579 (void *) 0xdeadbeef /* IEIPersistFile_fnIsDirty */,
580 IEIPersistFile_fnLoad,
581 (void *) 0xdeadbeef /* IEIPersistFile_fnSave */,
582 (void *) 0xdeadbeef /* IEIPersistFile_fnSaveCompleted */,
583 (void *) 0xdeadbeef /* IEIPersistFile_fnGetCurFile */
584};