2 * Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998 Juergen Schmied
7 * !!! currently work in progress on all classes !!!
8 * <contact juergen.schmied@metronet.de, 980801>
18 #include "interfaces.h"
27 #include "shell32_main.h"
30 /******************************************************************************
31 * foreward declaration
34 /* IExtractIcon implementation*/
35 static HRESULT WINAPI
IExtractIcon_QueryInterface(LPEXTRACTICON
, REFIID
, LPVOID
*);
36 static ULONG WINAPI
IExtractIcon_AddRef(LPEXTRACTICON
);
37 static ULONG WINAPI
IExtractIcon_AddRef(LPEXTRACTICON
);
38 static ULONG WINAPI
IExtractIcon_Release(LPEXTRACTICON
);
39 static HRESULT WINAPI
IExtractIcon_GetIconLocation(LPEXTRACTICON
, UINT32
, LPSTR
, UINT32
, int *, UINT32
*);
40 static HRESULT WINAPI
IExtractIcon_Extract(LPEXTRACTICON
, LPCSTR
, UINT32
, HICON32
*, HICON32
*, UINT32
);
42 /* IShellLink Implementation */
43 static HRESULT WINAPI
IShellLink_QueryInterface(LPSHELLLINK
,REFIID
,LPVOID
*);
44 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
);
45 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
);
46 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
, LPSTR
,INT32
, WIN32_FIND_DATA32A
*, DWORD
);
47 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
, LPITEMIDLIST
*);
48 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
, LPCITEMIDLIST
);
49 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
, LPSTR
,INT32
);
50 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
, LPCSTR
);
51 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
, LPSTR
,INT32
);
52 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
, LPCSTR
);
53 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
, LPSTR
,INT32
);
54 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
, LPCSTR
);
55 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
, WORD
*);
56 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
, WORD
);
57 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
, INT32
*);
58 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
, INT32
);
59 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
, LPSTR
,INT32
,INT32
*);
60 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
, LPCSTR
,INT32
);
61 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
, LPCSTR
, DWORD
);
62 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
, HWND32
, DWORD
);
63 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
, LPCSTR
);
66 /***********************************************************************
67 * IExtractIcon implementation
69 static struct IExtractIcon_VTable eivt
=
70 { IExtractIcon_QueryInterface
,
73 IExtractIcon_GetIconLocation
,
76 /**************************************************************************
77 * IExtractIcon_Constructor
79 LPEXTRACTICON
IExtractIcon_Constructor(LPCITEMIDLIST pidl
)
81 ei
=(LPEXTRACTICON
)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIcon
));
84 ei
->pidl
=ILClone(pidl
);
86 TRACE(shell
,"(%p)\n",ei
);
89 /**************************************************************************
90 * IExtractIcon_QueryInterface
92 static HRESULT WINAPI
IExtractIcon_QueryInterface( LPEXTRACTICON
this, REFIID riid
, LPVOID
*ppvObj
)
94 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
95 TRACE(shell
,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid
,ppvObj
);
99 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
102 else if(IsEqualIID(riid
, &IID_IExtractIcon
)) /*IExtractIcon*/
103 { *ppvObj
= (IExtractIcon
*)this;
107 { (*(LPEXTRACTICON
*)ppvObj
)->lpvtbl
->fnAddRef(this);
108 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
111 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
112 return E_NOINTERFACE
;
115 /**************************************************************************
116 * IExtractIcon_AddRef
118 static ULONG WINAPI
IExtractIcon_AddRef(LPEXTRACTICON
this)
119 { TRACE(shell
,"(%p)->(count=%lu)\n",this,(this->ref
)+1);
120 return ++(this->ref
);
122 /**************************************************************************
123 * IExtractIcon_Release
125 static ULONG WINAPI
IExtractIcon_Release(LPEXTRACTICON
this)
126 { TRACE(shell
,"(%p)->()\n",this);
128 { TRACE(shell
," destroying IExtractIcon(%p)\n",this);
130 HeapFree(GetProcessHeap(),0,this);
135 /**************************************************************************
136 * IExtractIcon_GetIconLocation
138 * FIXME returns allways the icon no. 3 (closed Folder)
140 static HRESULT WINAPI
IExtractIcon_GetIconLocation(LPEXTRACTICON
this, UINT32 uFlags
, LPSTR szIconFile
, UINT32 cchMax
, int * piIndex
, UINT32
* pwFlags
)
141 { FIXME (shell
,"(%p) (flags=%u file=%s max=%u %p %p) semi-stub\n", this, uFlags
, szIconFile
, cchMax
, piIndex
, pwFlags
);
148 *pwFlags
= GIL_NOTFILENAME
;
152 /**************************************************************************
153 * IExtractIcon_Extract
155 static HRESULT WINAPI
IExtractIcon_Extract(LPEXTRACTICON
this, LPCSTR pszFile
, UINT32 nIconIndex
, HICON32
*phiconLarge
, HICON32
*phiconSmall
, UINT32 nIconSize
)
156 { FIXME (shell
,"(%p) (file=%s index=%u %p %p size=%u) semi-stub\n", this, pszFile
, nIconIndex
, phiconLarge
, phiconSmall
, nIconSize
);
157 *phiconLarge
= pImageList_GetIcon(ShellBigIconList
, nIconIndex
, ILD_TRANSPARENT
);
158 *phiconSmall
= pImageList_GetIcon(ShellSmallIconList
, nIconIndex
, ILD_TRANSPARENT
);
162 /**************************************************************************
163 * IShellLink Implementation
166 static struct IShellLink_VTable slvt
=
167 { IShellLink_QueryInterface
,
171 IShellLink_GetIDList
,
172 IShellLink_SetIDList
,
173 IShellLink_GetDescription
,
174 IShellLink_SetDescription
,
175 IShellLink_GetWorkingDirectory
,
176 IShellLink_SetWorkingDirectory
,
177 IShellLink_GetArguments
,
178 IShellLink_SetArguments
,
179 IShellLink_GetHotkey
,
180 IShellLink_SetHotkey
,
181 IShellLink_GetShowCmd
,
182 IShellLink_SetShowCmd
,
183 IShellLink_GetIconLocation
,
184 IShellLink_SetIconLocation
,
185 IShellLink_SetRelativePath
,
190 /**************************************************************************
191 * IShellLink_Constructor
193 LPSHELLLINK
IShellLink_Constructor()
196 sl
= (LPSHELLLINK
)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink
));
199 TRACE(shell
,"(%p)->()\n",sl
);
203 /**************************************************************************
204 * IShellLink::QueryInterface
206 static HRESULT WINAPI
IShellLink_QueryInterface(
207 LPSHELLLINK
this, REFIID riid
, LPVOID
*ppvObj
)
209 WINE_StringFromCLSID((LPCLSID
)riid
,xriid
);
210 TRACE(shell
,"(%p)->(\n\tIID:\t%s)\n",this,xriid
);
214 if(IsEqualIID(riid
, &IID_IUnknown
)) /*IUnknown*/
217 else if(IsEqualIID(riid
, &IID_IShellLink
)) /*IShellLink*/
218 { *ppvObj
= (LPSHELLLINK
)this;
222 { (*(LPSHELLLINK
*)ppvObj
)->lpvtbl
->fnAddRef(this);
223 TRACE(shell
,"-- Interface: (%p)->(%p)\n",ppvObj
,*ppvObj
);
226 TRACE(shell
,"-- Interface: E_NOINTERFACE\n");
227 return E_NOINTERFACE
;
229 /******************************************************************************
232 static ULONG WINAPI
IShellLink_AddRef(LPSHELLLINK
this)
233 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
234 return ++(this->ref
);
236 /******************************************************************************
237 * IClassFactory_Release
239 static ULONG WINAPI
IShellLink_Release(LPSHELLLINK
this)
240 { TRACE(shell
,"(%p)->(count=%lu)\n",this,this->ref
);
242 { TRACE(shell
,"-- destroying IShellLink(%p)\n",this);
243 HeapFree(GetProcessHeap(),0,this);
249 static HRESULT WINAPI
IShellLink_GetPath(LPSHELLLINK
this, LPSTR pszFile
,INT32 cchMaxPath
, WIN32_FIND_DATA32A
*pfd
, DWORD fFlags
)
250 { FIXME(shell
,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile
, cchMaxPath
, pfd
, fFlags
);
251 strncpy(pszFile
,"c:\\foo.bar", cchMaxPath
);
254 static HRESULT WINAPI
IShellLink_GetIDList(LPSHELLLINK
this, LPITEMIDLIST
* ppidl
)
255 { FIXME(shell
,"(%p)->(ppidl=%p)\n",this, ppidl
);
256 *ppidl
= _ILCreateDesktop();
259 static HRESULT WINAPI
IShellLink_SetIDList(LPSHELLLINK
this, LPCITEMIDLIST pidl
)
260 { FIXME(shell
,"(%p)->(pidl=%p)\n",this, pidl
);
263 static HRESULT WINAPI
IShellLink_GetDescription(LPSHELLLINK
this, LPSTR pszName
,INT32 cchMaxName
)
264 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszName
, cchMaxName
);
265 strncpy(pszName
,"Description, FIXME",cchMaxName
);
268 static HRESULT WINAPI
IShellLink_SetDescription(LPSHELLLINK
this, LPCSTR pszName
)
269 { FIXME(shell
,"(%p)->(desc=%s)\n",this, pszName
);
272 static HRESULT WINAPI
IShellLink_GetWorkingDirectory(LPSHELLLINK
this, LPSTR pszDir
,INT32 cchMaxPath
)
273 { FIXME(shell
,"(%p)->()\n",this);
274 strncpy(pszDir
,"c:\\", cchMaxPath
);
277 static HRESULT WINAPI
IShellLink_SetWorkingDirectory(LPSHELLLINK
this, LPCSTR pszDir
)
278 { FIXME(shell
,"(%p)->(dir=%s)\n",this, pszDir
);
281 static HRESULT WINAPI
IShellLink_GetArguments(LPSHELLLINK
this, LPSTR pszArgs
,INT32 cchMaxPath
)
282 { FIXME(shell
,"(%p)->(%p len=%u)\n",this, pszArgs
, cchMaxPath
);
283 strncpy(pszArgs
, "", cchMaxPath
);
286 static HRESULT WINAPI
IShellLink_SetArguments(LPSHELLLINK
this, LPCSTR pszArgs
)
287 { FIXME(shell
,"(%p)->(args=%s)\n",this, pszArgs
);
290 static HRESULT WINAPI
IShellLink_GetHotkey(LPSHELLLINK
this, WORD
*pwHotkey
)
291 { FIXME(shell
,"(%p)->(%p)\n",this, pwHotkey
);
295 static HRESULT WINAPI
IShellLink_SetHotkey(LPSHELLLINK
this, WORD wHotkey
)
296 { FIXME(shell
,"(%p)->(hotkey=%x)\n",this, wHotkey
);
299 static HRESULT WINAPI
IShellLink_GetShowCmd(LPSHELLLINK
this, INT32
*piShowCmd
)
300 { FIXME(shell
,"(%p)->(%p)\n",this, piShowCmd
);
304 static HRESULT WINAPI
IShellLink_SetShowCmd(LPSHELLLINK
this, INT32 iShowCmd
)
305 { FIXME(shell
,"(%p)->(showcmd=%x)\n",this, iShowCmd
);
308 static HRESULT WINAPI
IShellLink_GetIconLocation(LPSHELLLINK
this, LPSTR pszIconPath
,INT32 cchIconPath
,INT32
*piIcon
)
309 { FIXME(shell
,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath
, cchIconPath
, piIcon
);
310 strncpy(pszIconPath
,"shell32.dll",cchIconPath
);
314 static HRESULT WINAPI
IShellLink_SetIconLocation(LPSHELLLINK
this, LPCSTR pszIconPath
,INT32 iIcon
)
315 { FIXME(shell
,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath
, iIcon
);
318 static HRESULT WINAPI
IShellLink_SetRelativePath(LPSHELLLINK
this, LPCSTR pszPathRel
, DWORD dwReserved
)
319 { FIXME(shell
,"(%p)->(path=%s %lx)\n",this, pszPathRel
, dwReserved
);
322 static HRESULT WINAPI
IShellLink_Resolve(LPSHELLLINK
this, HWND32 hwnd
, DWORD fFlags
)
323 { FIXME(shell
,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd
, fFlags
);
326 static HRESULT WINAPI
IShellLink_SetPath(LPSHELLLINK
this, LPCSTR pszFile
)
327 { FIXME(shell
,"(%p)->(path=%s)\n",this, pszFile
);