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)
82 ei=(LPEXTRACTICON)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIcon));
85 ei->pidl=ILClone(pidl);
89 TRACE(shell,"(%p)\n",ei);
92 /**************************************************************************
93 * IExtractIcon_QueryInterface
95 static HRESULT WINAPI IExtractIcon_QueryInterface( LPEXTRACTICON this, REFIID riid, LPVOID *ppvObj)
97 WINE_StringFromCLSID((LPCLSID)riid,xriid);
98 TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
102 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
105 else if(IsEqualIID(riid, &IID_IExtractIcon)) /*IExtractIcon*/
106 { *ppvObj = (IExtractIcon*)this;
110 { (*(LPEXTRACTICON*)ppvObj)->lpvtbl->fnAddRef(this);
111 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
114 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
115 return E_NOINTERFACE;
118 /**************************************************************************
119 * IExtractIcon_AddRef
121 static ULONG WINAPI IExtractIcon_AddRef(LPEXTRACTICON this)
122 { TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
123 return ++(this->ref);
125 /**************************************************************************
126 * IExtractIcon_Release
128 static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON this)
129 { TRACE(shell,"(%p)->()\n",this);
131 { TRACE(shell," destroying IExtractIcon(%p)\n",this);
133 HeapFree(GetProcessHeap(),0,this);
138 /**************************************************************************
139 * IExtractIcon_GetIconLocation
141 static HRESULT WINAPI IExtractIcon_GetIconLocation(LPEXTRACTICON this, UINT32 uFlags, LPSTR szIconFile, UINT32 cchMax, int * piIndex, UINT32 * pwFlags)
142 { FIXME (shell,"(%p) (flags=%u file=%s max=%u %p %p) semi-stub\n", this, uFlags, szIconFile, cchMax, piIndex, pwFlags);
144 *piIndex = (int) SHMapPIDLToSystemImageListIndex(0, this->pidl,0);
145 *pwFlags = GIL_NOTFILENAME;
147 FIXME (shell,"-- %x\n",*piIndex);
151 /**************************************************************************
152 * IExtractIcon_Extract
154 static HRESULT WINAPI IExtractIcon_Extract(LPEXTRACTICON this, LPCSTR pszFile, UINT32 nIconIndex, HICON32 *phiconLarge, HICON32 *phiconSmall, UINT32 nIconSize)
155 { FIXME (shell,"(%p) (file=%s index=%u %p %p size=%u) semi-stub\n", this, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
156 *phiconLarge = pImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT);
157 *phiconSmall = pImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT);
161 /**************************************************************************
162 * IShellLink Implementation
165 static struct IShellLink_VTable slvt =
166 { IShellLink_QueryInterface,
170 IShellLink_GetIDList,
171 IShellLink_SetIDList,
172 IShellLink_GetDescription,
173 IShellLink_SetDescription,
174 IShellLink_GetWorkingDirectory,
175 IShellLink_SetWorkingDirectory,
176 IShellLink_GetArguments,
177 IShellLink_SetArguments,
178 IShellLink_GetHotkey,
179 IShellLink_SetHotkey,
180 IShellLink_GetShowCmd,
181 IShellLink_SetShowCmd,
182 IShellLink_GetIconLocation,
183 IShellLink_SetIconLocation,
184 IShellLink_SetRelativePath,
189 /**************************************************************************
190 * IShellLink_Constructor
192 LPSHELLLINK IShellLink_Constructor()
195 sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
198 TRACE(shell,"(%p)->()\n",sl);
202 /**************************************************************************
203 * IShellLink::QueryInterface
205 static HRESULT WINAPI IShellLink_QueryInterface(
206 LPSHELLLINK this, REFIID riid, LPVOID *ppvObj)
208 WINE_StringFromCLSID((LPCLSID)riid,xriid);
209 TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
213 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
216 else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
217 { *ppvObj = (LPSHELLLINK)this;
221 { (*(LPSHELLLINK*)ppvObj)->lpvtbl->fnAddRef(this);
222 TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
225 TRACE(shell,"-- Interface: E_NOINTERFACE\n");
226 return E_NOINTERFACE;
228 /******************************************************************************
231 static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this)
232 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
233 return ++(this->ref);
235 /******************************************************************************
236 * IClassFactory_Release
238 static ULONG WINAPI IShellLink_Release(LPSHELLLINK this)
239 { TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
241 { TRACE(shell,"-- destroying IShellLink(%p)\n",this);
242 HeapFree(GetProcessHeap(),0,this);
248 static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK this, LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
249 { FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
250 strncpy(pszFile,"c:\\foo.bar", cchMaxPath);
253 static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK this, LPITEMIDLIST * ppidl)
254 { FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
255 *ppidl = _ILCreateDesktop();
258 static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK this, LPCITEMIDLIST pidl)
259 { FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
262 static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK this, LPSTR pszName,INT32 cchMaxName)
263 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
264 strncpy(pszName,"Description, FIXME",cchMaxName);
267 static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK this, LPCSTR pszName)
268 { FIXME(shell,"(%p)->(desc=%s)\n",this, pszName);
271 static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK this, LPSTR pszDir,INT32 cchMaxPath)
272 { FIXME(shell,"(%p)->()\n",this);
273 strncpy(pszDir,"c:\\", cchMaxPath);
276 static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK this, LPCSTR pszDir)
277 { FIXME(shell,"(%p)->(dir=%s)\n",this, pszDir);
280 static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK this, LPSTR pszArgs,INT32 cchMaxPath)
281 { FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
282 strncpy(pszArgs, "", cchMaxPath);
285 static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK this, LPCSTR pszArgs)
286 { FIXME(shell,"(%p)->(args=%s)\n",this, pszArgs);
289 static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK this, WORD *pwHotkey)
290 { FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
294 static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK this, WORD wHotkey)
295 { FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
298 static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK this, INT32 *piShowCmd)
299 { FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
303 static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK this, INT32 iShowCmd)
304 { FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
307 static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK this, LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
308 { FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
309 strncpy(pszIconPath,"shell32.dll",cchIconPath);
313 static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK this, LPCSTR pszIconPath,INT32 iIcon)
314 { FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath, iIcon);
317 static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK this, LPCSTR pszPathRel, DWORD dwReserved)
318 { FIXME(shell,"(%p)->(path=%s %lx)\n",this, pszPathRel, dwReserved);
321 static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK this, HWND32 hwnd, DWORD fFlags)
322 { FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
325 static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK this, LPCSTR pszFile)
326 { FIXME(shell,"(%p)->(path=%s)\n",this, pszFile);