~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/shell32/cpanelfolder.c

Version: ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Control panel folder
  3  *
  4  * Copyright 2003 Martin Fuchs
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "config.h"
 22 #include "wine/port.h"
 23 
 24 #include <stdlib.h>
 25 #include <string.h>
 26 #include <stdarg.h>
 27 #include <stdio.h>
 28 
 29 #define COBJMACROS
 30 #define NONAMELESSUNION
 31 #define NONAMELESSSTRUCT
 32 
 33 #include "winerror.h"
 34 #include "windef.h"
 35 #include "winbase.h"
 36 #include "winreg.h"
 37 #include "wingdi.h"
 38 #include "winuser.h"
 39 
 40 #include "ole2.h"
 41 #include "shlguid.h"
 42 
 43 #include "commctrl.h"
 44 #include "cpanel.h"
 45 #include "pidl.h"
 46 #include "undocshell.h"
 47 #include "shell32_main.h"
 48 #include "shresdef.h"
 49 #include "shlwapi.h"
 50 #include "wine/debug.h"
 51 #include "debughlp.h"
 52 #include "shfldr.h"
 53 
 54 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 55 
 56 /***********************************************************************
 57 *   control panel implementation in shell namespace
 58 */
 59 
 60 typedef struct {
 61     IShellFolder2      IShellFolder2_iface;
 62     IPersistFolder2    IPersistFolder2_iface;
 63     IShellExecuteHookW IShellExecuteHookW_iface;
 64     IShellExecuteHookA IShellExecuteHookA_iface;
 65     LONG               ref;
 66 
 67     IUnknown *pUnkOuter;        /* used for aggregation */
 68 
 69     /* both paths are parsible from the desktop */
 70     LPITEMIDLIST pidlRoot;      /* absolute pidl */
 71     int dwAttributes;           /* attributes returned by GetAttributesOf FIXME: use it */
 72 } ICPanelImpl;
 73 
 74 static const IShellFolder2Vtbl vt_ShellFolder2;
 75 static const IPersistFolder2Vtbl vt_PersistFolder2;
 76 static const IShellExecuteHookWVtbl vt_ShellExecuteHookW;
 77 static const IShellExecuteHookAVtbl vt_ShellExecuteHookA;
 78 
 79 static inline ICPanelImpl *impl_from_IShellFolder2(IShellFolder2 *iface)
 80 {
 81     return CONTAINING_RECORD(iface, ICPanelImpl, IShellFolder2_iface);
 82 }
 83 
 84 static inline ICPanelImpl *impl_from_IPersistFolder2(IPersistFolder2 *iface)
 85 {
 86     return CONTAINING_RECORD(iface, ICPanelImpl, IPersistFolder2_iface);
 87 }
 88 
 89 static inline ICPanelImpl *impl_from_IShellExecuteHookW(IShellExecuteHookW *iface)
 90 {
 91     return CONTAINING_RECORD(iface, ICPanelImpl, IShellExecuteHookW_iface);
 92 }
 93 
 94 static inline ICPanelImpl *impl_from_IShellExecuteHookA(IShellExecuteHookA *iface)
 95 {
 96     return CONTAINING_RECORD(iface, ICPanelImpl, IShellExecuteHookA_iface);
 97 }
 98 
 99 
100 /***********************************************************************
101 *   IShellFolder [ControlPanel] implementation
102 */
103 
104 static const shvheader ControlPanelSFHeader[] = {
105     {IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},/*FIXME*/
106     {IDS_SHV_COLUMN9, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_LEFT, 80},/*FIXME*/
107 };
108 
109 #define CONROLPANELSHELLVIEWCOLUMNS 2
110 
111 /**************************************************************************
112 *       IControlPanel_Constructor
113 */
114 HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID * ppv)
115 {
116     ICPanelImpl *sf;
117 
118     TRACE("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid(riid));
119 
120     if (!ppv)
121         return E_POINTER;
122     if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
123         return CLASS_E_NOAGGREGATION;
124 
125     sf = LocalAlloc(LMEM_ZEROINIT, sizeof(ICPanelImpl));
126     if (!sf)
127         return E_OUTOFMEMORY;
128 
129     sf->ref = 0;
130     sf->IShellFolder2_iface.lpVtbl = &vt_ShellFolder2;
131     sf->IPersistFolder2_iface.lpVtbl = &vt_PersistFolder2;
132     sf->IShellExecuteHookW_iface.lpVtbl = &vt_ShellExecuteHookW;
133     sf->IShellExecuteHookA_iface.lpVtbl = &vt_ShellExecuteHookA;
134     sf->pidlRoot = _ILCreateControlPanel();     /* my qualified pidl */
135     sf->pUnkOuter = pUnkOuter ? pUnkOuter : (IUnknown *)&sf->IShellFolder2_iface;
136 
137     if (FAILED(IShellFolder2_QueryInterface(&sf->IShellFolder2_iface, riid, ppv))) {
138         IShellFolder2_Release(&sf->IShellFolder2_iface);
139         return E_NOINTERFACE;
140     }
141 
142     TRACE("--(%p)\n", sf);
143     return S_OK;
144 }
145 
146 /**************************************************************************
147  *      ISF_ControlPanel_fnQueryInterface
148  *
149  * NOTES supports not IPersist/IPersistFolder
150  */
151 static HRESULT WINAPI ISF_ControlPanel_fnQueryInterface(IShellFolder2 *iface, REFIID riid,
152         void **ppvObject)
153 {
154     ICPanelImpl *This = impl_from_IShellFolder2(iface);
155 
156     TRACE("(%p)->(%s,%p)\n", This, shdebugstr_guid(riid), ppvObject);
157 
158     *ppvObject = NULL;
159 
160     if (IsEqualIID(riid, &IID_IUnknown) ||
161         IsEqualIID(riid, &IID_IShellFolder) || IsEqualIID(riid, &IID_IShellFolder2))
162         *ppvObject = This;
163     else if (IsEqualIID(riid, &IID_IPersist) ||
164                IsEqualIID(riid, &IID_IPersistFolder) || IsEqualIID(riid, &IID_IPersistFolder2))
165         *ppvObject = &This->IPersistFolder2_iface;
166     else if (IsEqualIID(riid, &IID_IShellExecuteHookW))
167         *ppvObject = &This->IShellExecuteHookW_iface;
168     else if (IsEqualIID(riid, &IID_IShellExecuteHookA))
169         *ppvObject = &This->IShellExecuteHookA_iface;
170 
171     if (*ppvObject) {
172         IUnknown_AddRef((IUnknown *)(*ppvObject));
173         TRACE("-- Interface:(%p)->(%p)\n", ppvObject, *ppvObject);
174         return S_OK;
175     }
176     TRACE("-- Interface: E_NOINTERFACE\n");
177     return E_NOINTERFACE;
178 }
179 
180 static ULONG WINAPI ISF_ControlPanel_fnAddRef(IShellFolder2 *iface)
181 {
182     ICPanelImpl *This = impl_from_IShellFolder2(iface);
183     ULONG refCount = InterlockedIncrement(&This->ref);
184 
185     TRACE("(%p)->(count=%u)\n", This, refCount - 1);
186 
187     return refCount;
188 }
189 
190 static ULONG WINAPI ISF_ControlPanel_fnRelease(IShellFolder2 *iface)
191 {
192     ICPanelImpl *This = impl_from_IShellFolder2(iface);
193     ULONG refCount = InterlockedDecrement(&This->ref);
194 
195     TRACE("(%p)->(count=%u)\n", This, refCount + 1);
196 
197     if (!refCount) {
198         TRACE("-- destroying IShellFolder(%p)\n", This);
199         SHFree(This->pidlRoot);
200         LocalFree(This);
201     }
202     return refCount;
203 }
204 
205 /**************************************************************************
206 *       ISF_ControlPanel_fnParseDisplayName
207 */
208 static HRESULT WINAPI ISF_ControlPanel_fnParseDisplayName(IShellFolder2 *iface, HWND hwndOwner,
209         LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, LPITEMIDLIST *ppidl,
210         DWORD *pdwAttributes)
211 {
212     ICPanelImpl *This = impl_from_IShellFolder2(iface);
213 
214     HRESULT hr = E_INVALIDARG;
215 
216     FIXME("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
217            This, hwndOwner, pbc, lpszDisplayName, debugstr_w(lpszDisplayName), pchEaten, ppidl, pdwAttributes);
218 
219     *ppidl = 0;
220     if (pchEaten)
221         *pchEaten = 0;
222 
223     TRACE("(%p)->(-- ret=0x%08x)\n", This, hr);
224 
225     return hr;
226 }
227 
228 static LPITEMIDLIST _ILCreateCPanelApplet(LPCSTR name, LPCSTR displayName,
229  LPCSTR comment, int iconIdx)
230 {
231     PIDLCPanelStruct *p;
232     LPITEMIDLIST pidl;
233     PIDLDATA tmp;
234     int size0 = (char*)tmp.u.cpanel.szName-(char*)&tmp.u.cpanel;
235     int size = size0;
236     int l;
237 
238     tmp.type = PT_CPLAPPLET;
239     tmp.u.cpanel.dummy = 0;
240     tmp.u.cpanel.iconIdx = iconIdx;
241 
242     l = strlen(name);
243     size += l+1;
244 
245     tmp.u.cpanel.offsDispName = l+1;
246     l = strlen(displayName);
247     size += l+1;
248 
249     tmp.u.cpanel.offsComment = tmp.u.cpanel.offsDispName+1+l;
250     l = strlen(comment);
251     size += l+1;
252 
253     pidl = SHAlloc(size+4);
254     if (!pidl)
255         return NULL;
256 
257     pidl->mkid.cb = size+2;
258     memcpy(pidl->mkid.abID, &tmp, 2+size0);
259 
260     p = &((PIDLDATA*)pidl->mkid.abID)->u.cpanel;
261     strcpy(p->szName, name);
262     strcpy(p->szName+tmp.u.cpanel.offsDispName, displayName);
263     strcpy(p->szName+tmp.u.cpanel.offsComment, comment);
264 
265     *(WORD*)((char*)pidl+(size+2)) = 0;
266 
267     pcheck(pidl);
268 
269     return pidl;
270 }
271 
272 /**************************************************************************
273  *  _ILGetCPanelPointer()
274  * gets a pointer to the control panel struct stored in the pidl
275  */
276 static PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl)
277 {
278     LPPIDLDATA pdata = _ILGetDataPointer(pidl);
279 
280     if (pdata && pdata->type==PT_CPLAPPLET)
281         return &pdata->u.cpanel;
282 
283     return NULL;
284 }
285 
286  /**************************************************************************
287  *              ISF_ControlPanel_fnEnumObjects
288  */
289 static BOOL SHELL_RegisterCPanelApp(IEnumIDListImpl *list, LPCSTR path)
290 {
291     LPITEMIDLIST pidl;
292     CPlApplet* applet;
293     CPanel panel;
294     CPLINFO info;
295     unsigned i;
296     int iconIdx;
297 
298     char displayName[MAX_PATH];
299     char comment[MAX_PATH];
300 
301     WCHAR wpath[MAX_PATH];
302 
303     MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
304 
305     panel.first = NULL;
306     applet = Control_LoadApplet(0, wpath, &panel);
307 
308     if (applet)
309     {
310         for(i=0; i<applet->count; ++i)
311         {
312             WideCharToMultiByte(CP_ACP, 0, applet->info[i].name, -1, displayName, MAX_PATH, 0, 0);
313             WideCharToMultiByte(CP_ACP, 0, applet->info[i].info, -1, comment, MAX_PATH, 0, 0);
314 
315             applet->proc(0, CPL_INQUIRE, i, (LPARAM)&info);
316 
317             if (info.idIcon > 0)
318                 iconIdx = -info.idIcon; /* negative icon index instead of icon number */
319             else
320                 iconIdx = 0;
321 
322             pidl = _ILCreateCPanelApplet(path, displayName, comment, iconIdx);
323 
324             if (pidl)
325                 AddToEnumList(list, pidl);
326         }
327         Control_UnloadApplet(applet);
328     }
329     return TRUE;
330 }
331 
332 static int SHELL_RegisterRegistryCPanelApps(IEnumIDListImpl *list, HKEY hkey_root, LPCSTR szRepPath)
333 {
334     char name[MAX_PATH];
335     char value[MAX_PATH];
336     HKEY hkey;
337 
338     int cnt = 0;
339 
340     if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
341     {
342         int idx = 0;
343 
344         for(;; ++idx)
345         {
346             DWORD nameLen = MAX_PATH;
347             DWORD valueLen = MAX_PATH;
348 
349             if (RegEnumValueA(hkey, idx, name, &nameLen, NULL, NULL, (LPBYTE)value, &valueLen) != ERROR_SUCCESS)
350                 break;
351 
352             if (SHELL_RegisterCPanelApp(list, value))
353                 ++cnt;
354         }
355         RegCloseKey(hkey);
356     }
357 
358     return cnt;
359 }
360 
361 static int SHELL_RegisterCPanelFolders(IEnumIDListImpl *list, HKEY hkey_root, LPCSTR szRepPath)
362 {
363     char name[MAX_PATH];
364     HKEY hkey;
365 
366     int cnt = 0;
367 
368     if (RegOpenKeyA(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
369     {
370         int idx = 0;
371         for(;; ++idx)
372         {
373             if (RegEnumKeyA(hkey, idx, name, MAX_PATH) != ERROR_SUCCESS)
374                 break;
375 
376             if (*name == '{')
377             {
378                 LPITEMIDLIST pidl = _ILCreateGuidFromStrA(name);
379 
380                 if (pidl && AddToEnumList(list, pidl))
381                     ++cnt;
382             }
383         }
384 
385         RegCloseKey(hkey);
386     }
387 
388   return cnt;
389 }
390 
391 /**************************************************************************
392  *  CreateCPanelEnumList()
393  */
394 static BOOL CreateCPanelEnumList(IEnumIDListImpl *list, DWORD dwFlags)
395 {
396     CHAR szPath[MAX_PATH];
397     WIN32_FIND_DATAA wfd;
398     HANDLE hFile;
399 
400     TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
401 
402     /* enumerate control panel folders */
403     if (dwFlags & SHCONTF_FOLDERS)
404         SHELL_RegisterCPanelFolders(list, HKEY_LOCAL_MACHINE,
405                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
406 
407     /* enumerate the control panel applets */
408     if (dwFlags & SHCONTF_NONFOLDERS)
409     {
410         LPSTR p;
411 
412         GetSystemDirectoryA(szPath, MAX_PATH);
413         p = PathAddBackslashA(szPath);
414         strcpy(p, "*.cpl");
415 
416         TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n", list, debugstr_a(szPath));
417         hFile = FindFirstFileA(szPath, &wfd);
418 
419         if (hFile != INVALID_HANDLE_VALUE)
420         {
421             do
422             {
423                 if (!(dwFlags & SHCONTF_INCLUDEHIDDEN) && (wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
424                     continue;
425 
426                 if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
427                     strcpy(p, wfd.cFileName);
428                     SHELL_RegisterCPanelApp(list, szPath);
429                 }
430             } while(FindNextFileA(hFile, &wfd));
431             FindClose(hFile);
432         }
433 
434         SHELL_RegisterRegistryCPanelApps(list, HKEY_LOCAL_MACHINE,
435                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
436         SHELL_RegisterRegistryCPanelApps(list, HKEY_CURRENT_USER,
437                 "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls");
438     }
439     return TRUE;
440 }
441 
442 /**************************************************************************
443 *               ISF_ControlPanel_fnEnumObjects
444 */
445 static HRESULT WINAPI ISF_ControlPanel_fnEnumObjects(IShellFolder2 *iface, HWND hwndOwner,
446         DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
447 {
448     ICPanelImpl *This = impl_from_IShellFolder2(iface);
449     IEnumIDListImpl *list;
450 
451     TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", This, hwndOwner, dwFlags, ppEnumIDList);
452 
453     if (!(list = IEnumIDList_Constructor()))
454         return E_OUTOFMEMORY;
455     CreateCPanelEnumList(list, dwFlags);
456     *ppEnumIDList = &list->IEnumIDList_iface;
457 
458     TRACE("--(%p)->(new ID List: %p)\n", This, *ppEnumIDList);
459 
460     return S_OK;
461 }
462 
463 /**************************************************************************
464 *               ISF_ControlPanel_fnBindToObject
465 */
466 static HRESULT WINAPI ISF_ControlPanel_fnBindToObject(IShellFolder2 *iface, LPCITEMIDLIST pidl,
467         LPBC pbcReserved, REFIID riid, void **ppvOut)
468 {
469     ICPanelImpl *This = impl_from_IShellFolder2(iface);
470 
471     TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", This, pidl, pbcReserved, shdebugstr_guid(riid), ppvOut);
472 
473     return SHELL32_BindToChild(This->pidlRoot, NULL, pidl, riid, ppvOut);
474 }
475 
476 /**************************************************************************
477 *       ISF_ControlPanel_fnBindToStorage
478 */
479 static HRESULT WINAPI ISF_ControlPanel_fnBindToStorage(IShellFolder2 *iface, LPCITEMIDLIST pidl,
480         LPBC pbcReserved, REFIID riid, void **ppvOut)
481 {
482     ICPanelImpl *This = impl_from_IShellFolder2(iface);
483 
484     FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", This, pidl, pbcReserved, shdebugstr_guid(riid), ppvOut);
485 
486     *ppvOut = NULL;
487     return E_NOTIMPL;
488 }
489 
490 /**************************************************************************
491 *       ISF_ControlPanel_fnCompareIDs
492 */
493 
494 static HRESULT WINAPI ISF_ControlPanel_fnCompareIDs(IShellFolder2 *iface, LPARAM lParam,
495         LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
496 {
497     ICPanelImpl *This = impl_from_IShellFolder2(iface);
498 
499     int nReturn;
500 
501     TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", This, lParam, pidl1, pidl2);
502     nReturn = SHELL32_CompareIDs((IShellFolder *)&This->IShellFolder2_iface, lParam, pidl1, pidl2);
503     TRACE("-- %i\n", nReturn);
504     return nReturn;
505 }
506 
507 /**************************************************************************
508 *       ISF_ControlPanel_fnCreateViewObject
509 */
510 static HRESULT WINAPI ISF_ControlPanel_fnCreateViewObject(IShellFolder2 *iface, HWND hwndOwner,
511         REFIID riid, void **ppvOut)
512 {
513     ICPanelImpl *This = impl_from_IShellFolder2(iface);
514 
515     LPSHELLVIEW pShellView;
516     HRESULT hr = E_INVALIDARG;
517 
518     TRACE("(%p)->(hwnd=%p,%s,%p)\n", This, hwndOwner, shdebugstr_guid(riid), ppvOut);
519 
520     if (ppvOut) {
521         *ppvOut = NULL;
522 
523         if (IsEqualIID(riid, &IID_IDropTarget)) {
524             WARN("IDropTarget not implemented\n");
525             hr = E_NOTIMPL;
526         } else if (IsEqualIID(riid, &IID_IContextMenu)) {
527             WARN("IContextMenu not implemented\n");
528             hr = E_NOTIMPL;
529         } else if (IsEqualIID(riid, &IID_IShellView)) {
530             pShellView = IShellView_Constructor((IShellFolder *) iface);
531             if (pShellView) {
532                 hr = IShellView_QueryInterface(pShellView, riid, ppvOut);
533                 IShellView_Release(pShellView);
534             }
535         }
536     }
537     TRACE("--(%p)->(interface=%p)\n", This, ppvOut);
538     return hr;
539 }
540 
541 /**************************************************************************
542 *  ISF_ControlPanel_fnGetAttributesOf
543 */
544 static HRESULT WINAPI ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 *iface, UINT cidl,
545         LPCITEMIDLIST *apidl, DWORD *rgfInOut)
546 {
547     ICPanelImpl *This = impl_from_IShellFolder2(iface);
548 
549     HRESULT hr = S_OK;
550 
551     TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
552           This, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
553 
554     if (!rgfInOut)
555         return E_INVALIDARG;
556     if (cidl && !apidl)
557         return E_INVALIDARG;
558 
559     if (*rgfInOut == 0)
560         *rgfInOut = ~0;
561 
562     while(cidl > 0 && *apidl) {
563         pdump(*apidl);
564         SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
565         apidl++;
566         cidl--;
567     }
568     /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
569     *rgfInOut &= ~SFGAO_VALIDATE;
570 
571     TRACE("-- result=0x%08x\n", *rgfInOut);
572     return hr;
573 }
574 
575 /**************************************************************************
576 *       ISF_ControlPanel_fnGetUIObjectOf
577 *
578 * PARAMETERS
579 *  HWND           hwndOwner, //[in ] Parent window for any output
580 *  UINT           cidl,      //[in ] array size
581 *  LPCITEMIDLIST* apidl,     //[in ] simple pidl array
582 *  REFIID         riid,      //[in ] Requested Interface
583 *  UINT*          prgfInOut, //[   ] reserved
584 *  LPVOID*        ppvObject) //[out] Resulting Interface
585 *
586 */
587 static HRESULT WINAPI ISF_ControlPanel_fnGetUIObjectOf(IShellFolder2 *iface, HWND hwndOwner,
588         UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, UINT *prgfInOut, void **ppvOut)
589 {
590     ICPanelImpl *This = impl_from_IShellFolder2(iface);
591 
592     LPITEMIDLIST pidl;
593     IUnknown *pObj = NULL;
594     HRESULT hr = E_INVALIDARG;
595 
596     TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
597            This, hwndOwner, cidl, apidl, shdebugstr_guid(riid), prgfInOut, ppvOut);
598 
599     if (ppvOut) {
600         *ppvOut = NULL;
601 
602         if (IsEqualIID(riid, &IID_IContextMenu) &&(cidl >= 1)) {
603             return ItemMenu_Constructor((IShellFolder*)iface, This->pidlRoot, apidl, cidl, riid, ppvOut);
604         } else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1)) {
605             pObj = (LPUNKNOWN) IDataObject_Constructor(hwndOwner, This->pidlRoot, apidl, cidl);
606             hr = S_OK;
607         } else if (IsEqualIID(riid, &IID_IExtractIconA) &&(cidl == 1)) {
608             pidl = ILCombine(This->pidlRoot, apidl[0]);
609             pObj = (LPUNKNOWN) IExtractIconA_Constructor(pidl);
610             SHFree(pidl);
611             hr = S_OK;
612         } else if (IsEqualIID(riid, &IID_IExtractIconW) &&(cidl == 1)) {
613             pidl = ILCombine(This->pidlRoot, apidl[0]);
614             pObj = (LPUNKNOWN) IExtractIconW_Constructor(pidl);
615             SHFree(pidl);
616             hr = S_OK;
617         } else if ((IsEqualIID(riid,&IID_IShellLinkW) || IsEqualIID(riid,&IID_IShellLinkA))
618                                 && (cidl == 1)) {
619             pidl = ILCombine(This->pidlRoot, apidl[0]);
620             hr = IShellLink_ConstructFromFile(NULL, riid, pidl,(LPVOID*)&pObj);
621             SHFree(pidl);
622         } else {
623             hr = E_NOINTERFACE;
624         }
625 
626         if (SUCCEEDED(hr) && !pObj)
627             hr = E_OUTOFMEMORY;
628 
629         *ppvOut = pObj;
630     }
631     TRACE("(%p)->hr=0x%08x\n", This, hr);
632     return hr;
633 }
634 
635 /**************************************************************************
636 *       ISF_ControlPanel_fnGetDisplayNameOf
637 */
638 static HRESULT WINAPI ISF_ControlPanel_fnGetDisplayNameOf(IShellFolder2 *iface, LPCITEMIDLIST pidl,
639         DWORD dwFlags, LPSTRRET strRet)
640 {
641     ICPanelImpl *This = impl_from_IShellFolder2(iface);
642 
643     CHAR szPath[MAX_PATH];
644     WCHAR wszPath[MAX_PATH+1]; /* +1 for potential backslash */
645     PIDLCPanelStruct* pcpanel;
646 
647     *szPath = '\0';
648 
649     TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", This, pidl, dwFlags, strRet);
650     pdump(pidl);
651 
652     if (!pidl || !strRet)
653         return E_INVALIDARG;
654 
655     pcpanel = _ILGetCPanelPointer(pidl);
656 
657     if (pcpanel) {
658         lstrcpyA(szPath, pcpanel->szName+pcpanel->offsDispName);
659 
660         if (!(dwFlags & SHGDN_FORPARSING))
661             FIXME("retrieve display name from control panel app\n");
662     }
663     /* take names of special folders only if it's only this folder */
664     else if (_ILIsSpecialFolder(pidl)) {
665         BOOL bSimplePidl = _ILIsPidlSimple(pidl);
666 
667         if (bSimplePidl) {
668             _ILSimpleGetTextW(pidl, wszPath, MAX_PATH); /* append my own path */
669         } else {
670             FIXME("special pidl\n");
671         }
672 
673         if ((dwFlags & SHGDN_FORPARSING) && !bSimplePidl) { /* go deeper if needed */
674             int len = 0;
675 
676             PathAddBackslashW(wszPath);
677             len = lstrlenW(wszPath);
678 
679             if (FAILED(SHELL32_GetDisplayNameOfChild(iface, pidl, dwFlags | SHGDN_INFOLDER, wszPath + len, MAX_PATH + 1 - len)))
680                 return E_OUTOFMEMORY;
681             if (!WideCharToMultiByte(CP_ACP, 0, wszPath, -1, szPath, MAX_PATH, NULL, NULL))
682                 wszPath[0] = '\0';
683         }
684     }
685 
686     strRet->uType = STRRET_CSTR;
687     lstrcpynA(strRet->u.cStr, szPath, MAX_PATH);
688 
689     TRACE("--(%p)->(%s)\n", This, szPath);
690     return S_OK;
691 }
692 
693 /**************************************************************************
694 *  ISF_ControlPanel_fnSetNameOf
695 *  Changes the name of a file object or subfolder, possibly changing its item
696 *  identifier in the process.
697 *
698 * PARAMETERS
699 *  HWND          hwndOwner,  //[in ] Owner window for output
700 *  LPCITEMIDLIST pidl,       //[in ] simple pidl of item to change
701 *  LPCOLESTR     lpszName,   //[in ] the items new display name
702 *  DWORD         dwFlags,    //[in ] SHGNO formatting flags
703 *  LPITEMIDLIST* ppidlOut)   //[out] simple pidl returned
704 */
705 static HRESULT WINAPI ISF_ControlPanel_fnSetNameOf(IShellFolder2 *iface, HWND hwndOwner,
706         LPCITEMIDLIST pidl, LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST *pPidlOut)
707 {
708     ICPanelImpl *This = impl_from_IShellFolder2(iface);
709     FIXME("(%p)->(%p,pidl=%p,%s,%u,%p)\n", This, hwndOwner, pidl, debugstr_w(lpName), dwFlags, pPidlOut);
710     return E_FAIL;
711 }
712 
713 static HRESULT WINAPI ISF_ControlPanel_fnGetDefaultSearchGUID(IShellFolder2 *iface, GUID *pguid)
714 {
715     ICPanelImpl *This = impl_from_IShellFolder2(iface);
716     FIXME("(%p)\n", This);
717     return E_NOTIMPL;
718 }
719 static HRESULT WINAPI ISF_ControlPanel_fnEnumSearches(IShellFolder2 *iface,
720         IEnumExtraSearch **ppenum)
721 {
722     ICPanelImpl *This = impl_from_IShellFolder2(iface);
723     FIXME("(%p)\n", This);
724     return E_NOTIMPL;
725 }
726 static HRESULT WINAPI ISF_ControlPanel_fnGetDefaultColumn(IShellFolder2 *iface, DWORD dwRes,
727         ULONG *pSort, ULONG *pDisplay)
728 {
729     ICPanelImpl *This = impl_from_IShellFolder2(iface);
730 
731     TRACE("(%p)\n", This);
732 
733     if (pSort) *pSort = 0;
734     if (pDisplay) *pDisplay = 0;
735     return S_OK;
736 }
737 static HRESULT WINAPI ISF_ControlPanel_fnGetDefaultColumnState(IShellFolder2 *iface, UINT iColumn,
738         DWORD *pcsFlags)
739 {
740     ICPanelImpl *This = impl_from_IShellFolder2(iface);
741 
742     TRACE("(%p)\n", This);
743 
744     if (!pcsFlags || iColumn >= CONROLPANELSHELLVIEWCOLUMNS) return E_INVALIDARG;
745     *pcsFlags = ControlPanelSFHeader[iColumn].pcsFlags;
746     return S_OK;
747 }
748 static HRESULT WINAPI ISF_ControlPanel_fnGetDetailsEx(IShellFolder2 *iface, LPCITEMIDLIST pidl,
749         const SHCOLUMNID *pscid, VARIANT *pv)
750 {
751     ICPanelImpl *This = impl_from_IShellFolder2(iface);
752     FIXME("(%p)\n", This);
753     return E_NOTIMPL;
754 }
755 
756 static HRESULT WINAPI ISF_ControlPanel_fnGetDetailsOf(IShellFolder2 *iface, LPCITEMIDLIST pidl,
757         UINT iColumn, SHELLDETAILS *psd)
758 {
759     ICPanelImpl *This = impl_from_IShellFolder2(iface);
760     PIDLCPanelStruct* pcpanel;
761     HRESULT hr;
762 
763     TRACE("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
764 
765     if (!psd || iColumn >= CONROLPANELSHELLVIEWCOLUMNS)
766         return E_INVALIDARG;
767 
768     if (!pidl) {
769         psd->fmt = ControlPanelSFHeader[iColumn].fmt;
770         psd->cxChar = ControlPanelSFHeader[iColumn].cxChar;
771         psd->str.uType = STRRET_CSTR;
772         LoadStringA(shell32_hInstance, ControlPanelSFHeader[iColumn].colnameid, psd->str.u.cStr, MAX_PATH);
773         return S_OK;
774     } else {
775         psd->str.u.cStr[0] = 0x00;
776         psd->str.uType = STRRET_CSTR;
777         switch(iColumn) {
778         case 0:         /* name */
779             hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
780             break;
781         case 1:         /* comment */
782             pcpanel = _ILGetCPanelPointer(pidl);
783 
784             if (pcpanel)
785                 lstrcpyA(psd->str.u.cStr, pcpanel->szName+pcpanel->offsComment);
786             else
787                 _ILGetFileType(pidl, psd->str.u.cStr, MAX_PATH);
788 
789             break;
790         }
791         hr = S_OK;
792     }
793 
794     return hr;
795 }
796 static HRESULT WINAPI ISF_ControlPanel_fnMapColumnToSCID(IShellFolder2 *iface, UINT column,
797         SHCOLUMNID *pscid)
798 {
799     ICPanelImpl *This = impl_from_IShellFolder2(iface);
800     FIXME("(%p)\n", This);
801     return E_NOTIMPL;
802 }
803 
804 static const IShellFolder2Vtbl vt_ShellFolder2 =
805 {
806 
807     ISF_ControlPanel_fnQueryInterface,
808     ISF_ControlPanel_fnAddRef,
809     ISF_ControlPanel_fnRelease,
810     ISF_ControlPanel_fnParseDisplayName,
811     ISF_ControlPanel_fnEnumObjects,
812     ISF_ControlPanel_fnBindToObject,
813     ISF_ControlPanel_fnBindToStorage,
814     ISF_ControlPanel_fnCompareIDs,
815     ISF_ControlPanel_fnCreateViewObject,
816     ISF_ControlPanel_fnGetAttributesOf,
817     ISF_ControlPanel_fnGetUIObjectOf,
818     ISF_ControlPanel_fnGetDisplayNameOf,
819     ISF_ControlPanel_fnSetNameOf,
820 
821     /* ShellFolder2 */
822     ISF_ControlPanel_fnGetDefaultSearchGUID,
823     ISF_ControlPanel_fnEnumSearches,
824     ISF_ControlPanel_fnGetDefaultColumn,
825     ISF_ControlPanel_fnGetDefaultColumnState,
826     ISF_ControlPanel_fnGetDetailsEx,
827     ISF_ControlPanel_fnGetDetailsOf,
828     ISF_ControlPanel_fnMapColumnToSCID
829 };
830 
831 /************************************************************************
832  *      ICPanel_PersistFolder2_QueryInterface
833  */
834 static HRESULT WINAPI ICPanel_PersistFolder2_QueryInterface(IPersistFolder2 * iface, REFIID iid, LPVOID * ppvObject)
835 {
836     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
837 
838     TRACE("(%p)\n", This);
839 
840     return IShellFolder2_QueryInterface(&This->IShellFolder2_iface, iid, ppvObject);
841 }
842 
843 /************************************************************************
844  *      ICPanel_PersistFolder2_AddRef
845  */
846 static ULONG WINAPI ICPanel_PersistFolder2_AddRef(IPersistFolder2 * iface)
847 {
848     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
849 
850     TRACE("(%p)->(count=%u)\n", This, This->ref);
851 
852     return IShellFolder2_AddRef(&This->IShellFolder2_iface);
853 }
854 
855 /************************************************************************
856  *      ISFPersistFolder_Release
857  */
858 static ULONG WINAPI ICPanel_PersistFolder2_Release(IPersistFolder2 * iface)
859 {
860     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
861 
862     TRACE("(%p)->(count=%u)\n", This, This->ref);
863 
864     return IShellFolder2_Release(&This->IShellFolder2_iface);
865 }
866 
867 /************************************************************************
868  *      ICPanel_PersistFolder2_GetClassID
869  */
870 static HRESULT WINAPI ICPanel_PersistFolder2_GetClassID(IPersistFolder2 * iface, CLSID * lpClassId)
871 {
872     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
873 
874     TRACE("(%p)\n", This);
875 
876     if (!lpClassId)
877         return E_POINTER;
878     *lpClassId = CLSID_ControlPanel;
879 
880     return S_OK;
881 }
882 
883 /************************************************************************
884  *      ICPanel_PersistFolder2_Initialize
885  *
886  * NOTES: it makes no sense to change the pidl
887  */
888 static HRESULT WINAPI ICPanel_PersistFolder2_Initialize(IPersistFolder2 * iface, LPCITEMIDLIST pidl)
889 {
890     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
891     TRACE("(%p)->(%p)\n", This, pidl);
892     return E_NOTIMPL;
893 }
894 
895 /**************************************************************************
896  *      IPersistFolder2_fnGetCurFolder
897  */
898 static HRESULT WINAPI ICPanel_PersistFolder2_GetCurFolder(IPersistFolder2 * iface, LPITEMIDLIST * pidl)
899 {
900     ICPanelImpl *This = impl_from_IPersistFolder2(iface);
901 
902     TRACE("(%p)->(%p)\n", This, pidl);
903 
904     if (!pidl)
905         return E_POINTER;
906     *pidl = ILClone(This->pidlRoot);
907     return S_OK;
908 }
909 
910 static const IPersistFolder2Vtbl vt_PersistFolder2 =
911 {
912 
913     ICPanel_PersistFolder2_QueryInterface,
914     ICPanel_PersistFolder2_AddRef,
915     ICPanel_PersistFolder2_Release,
916     ICPanel_PersistFolder2_GetClassID,
917     ICPanel_PersistFolder2_Initialize,
918     ICPanel_PersistFolder2_GetCurFolder
919 };
920 
921 HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST pidl,
922                LPWSTR szIconFile, UINT cchMax, int* piIndex)
923 {
924     PIDLCPanelStruct* pcpanel = _ILGetCPanelPointer(pidl);
925 
926     if (!pcpanel)
927         return E_INVALIDARG;
928 
929     MultiByteToWideChar(CP_ACP, 0, pcpanel->szName, -1, szIconFile, cchMax);
930     *piIndex = pcpanel->iconIdx!=-1? pcpanel->iconIdx: 0;
931 
932     return S_OK;
933 }
934 
935 
936 /**************************************************************************
937 * IShellExecuteHookW Implementation
938 */
939 
940 static HRESULT WINAPI IShellExecuteHookW_fnQueryInterface(
941                IShellExecuteHookW* iface, REFIID riid, void** ppvObject)
942 {
943     ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
944 
945     TRACE("(%p)->(count=%u)\n", This, This->ref);
946 
947     return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject);
948 }
949 
950 static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnAddRef(IShellExecuteHookW* iface)
951 {
952     ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
953 
954     TRACE("(%p)->(count=%u)\n", This, This->ref);
955 
956     return IUnknown_AddRef(This->pUnkOuter);
957 }
958 
959 static ULONG STDMETHODCALLTYPE IShellExecuteHookW_fnRelease(IShellExecuteHookW* iface)
960 {
961     ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
962 
963     TRACE("(%p)\n", This);
964 
965     return IUnknown_Release(This->pUnkOuter);
966 }
967 
968 static HRESULT WINAPI IShellExecuteHookW_fnExecute(IShellExecuteHookW *iface,
969         LPSHELLEXECUTEINFOW psei)
970 {
971     ICPanelImpl *This = impl_from_IShellExecuteHookW(iface);
972     static const WCHAR wCplopen[] = {'c','p','l','o','p','e','n','\0'};
973 
974     SHELLEXECUTEINFOW sei_tmp;
975     PIDLCPanelStruct* pcpanel;
976     WCHAR path[MAX_PATH];
977     WCHAR params[MAX_PATH];
978     BOOL ret;
979     int l;
980 
981     TRACE("(%p)->execute(%p)\n", This, psei);
982 
983     if (!psei)
984         return E_INVALIDARG;
985 
986     pcpanel = _ILGetCPanelPointer(ILFindLastID(psei->lpIDList));
987 
988     if (!pcpanel)
989         return E_INVALIDARG;
990 
991     path[0] = '\"';
992     /* Return value from MultiByteToWideChar includes terminating NUL, which
993      * compensates for the starting double quote we just put in */
994     l = MultiByteToWideChar(CP_ACP, 0, pcpanel->szName, -1, path+1, MAX_PATH-1);
995 
996     /* pass applet name to Control_RunDLL to distinguish between applets in one .cpl file */
997     path[l++] = '"';
998     path[l] = '\0';
999 
1000     MultiByteToWideChar(CP_ACP, 0, pcpanel->szName+pcpanel->offsDispName, -1, params, MAX_PATH);
1001 
1002     sei_tmp = *psei;
1003     sei_tmp.lpFile = path;
1004     sei_tmp.lpParameters = params;
1005     sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
1006     sei_tmp.lpVerb = wCplopen;
1007 
1008     ret = ShellExecuteExW(&sei_tmp);
1009     if (ret)
1010         return S_OK;
1011     else
1012         return S_FALSE;
1013 }
1014 
1015 static const IShellExecuteHookWVtbl vt_ShellExecuteHookW =
1016 {
1017 
1018     IShellExecuteHookW_fnQueryInterface,
1019     IShellExecuteHookW_fnAddRef,
1020     IShellExecuteHookW_fnRelease,
1021 
1022     IShellExecuteHookW_fnExecute
1023 };
1024 
1025 
1026 /**************************************************************************
1027 * IShellExecuteHookA Implementation
1028 */
1029 
1030 static HRESULT WINAPI IShellExecuteHookA_fnQueryInterface(IShellExecuteHookA* iface, REFIID riid, void** ppvObject)
1031 {
1032     ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
1033 
1034     TRACE("(%p)->(count=%u)\n", This, This->ref);
1035 
1036     return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject);
1037 }
1038 
1039 static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnAddRef(IShellExecuteHookA* iface)
1040 {
1041     ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
1042 
1043     TRACE("(%p)->(count=%u)\n", This, This->ref);
1044 
1045     return IUnknown_AddRef(This->pUnkOuter);
1046 }
1047 
1048 static ULONG STDMETHODCALLTYPE IShellExecuteHookA_fnRelease(IShellExecuteHookA* iface)
1049 {
1050     ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
1051 
1052     TRACE("(%p)\n", This);
1053 
1054     return IUnknown_Release(This->pUnkOuter);
1055 }
1056 
1057 static HRESULT WINAPI IShellExecuteHookA_fnExecute(IShellExecuteHookA *iface,
1058         LPSHELLEXECUTEINFOA psei)
1059 {
1060     ICPanelImpl *This = impl_from_IShellExecuteHookA(iface);
1061 
1062     SHELLEXECUTEINFOA sei_tmp;
1063     PIDLCPanelStruct* pcpanel;
1064     char path[MAX_PATH];
1065     BOOL ret;
1066 
1067     TRACE("(%p)->execute(%p)\n", This, psei);
1068 
1069     if (!psei)
1070         return E_INVALIDARG;
1071 
1072     pcpanel = _ILGetCPanelPointer(ILFindLastID(psei->lpIDList));
1073 
1074     if (!pcpanel)
1075         return E_INVALIDARG;
1076 
1077     path[0] = '\"';
1078     lstrcpyA(path+1, pcpanel->szName);
1079 
1080     /* pass applet name to Control_RunDLL to distinguish between applets in one .cpl file */
1081     lstrcatA(path, "\" ");
1082     lstrcatA(path, pcpanel->szName+pcpanel->offsDispName);
1083 
1084     sei_tmp = *psei;
1085     sei_tmp.lpFile = path;
1086     sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
1087 
1088     ret = ShellExecuteExA(&sei_tmp);
1089     if (ret)
1090         return S_OK;
1091     else
1092         return S_FALSE;
1093 }
1094 
1095 static const IShellExecuteHookAVtbl vt_ShellExecuteHookA =
1096 {
1097     IShellExecuteHookA_fnQueryInterface,
1098     IShellExecuteHookA_fnAddRef,
1099     IShellExecuteHookA_fnRelease,
1100     IShellExecuteHookA_fnExecute
1101 };
1102 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.