ReactOS  0.4.12-dev-934-g9a4676f
CFSFolder.cpp
Go to the documentation of this file.
1 
2 /*
3  * file system folder
4  *
5  * Copyright 1997 Marcus Meissner
6  * Copyright 1998, 1999, 2002 Juergen Schmied
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #include <precomp.h>
24 
26 
28 {
29  HKEY hkey;
30 
31  if (!_ILIsValue(pidl))
32  {
33  ERR("Invalid pidl!\n");
34  return NULL;
35  }
36 
37  FileStructW* pDataW = _ILGetFileStructW(pidl);
38  if (!pDataW)
39  {
40  ERR("Invalid pidl!\n");
41  return NULL;
42  }
43 
44  LPWSTR pExtension = PathFindExtensionW(pDataW->wszName);
45  if (!pExtension || *pExtension == NULL)
46  {
47  WARN("No extension for %S!\n", pDataW->wszName);
48  return NULL;
49  }
50 
52  DWORD dwSize = sizeof(FullName);
53  wsprintf(FullName, L"%s\\%s", pExtension, KeyName);
54 
56  if (!res)
57  return hkey;
58 
60  if (res)
61  {
62  WARN("Failed to get progid for file %S, extension %S (%x), address %x, pidl: %x, error %d\n", pDataW->wszName, pExtension, pExtension, &dwSize, pidl, res);
63  return NULL;
64  }
65 
66  wcscat(FullName, L"\\");
68 
69  hkey = NULL;
71  if (res)
72  WARN("Could not open key %S for extension %S\n", KeyName, pExtension);
73 
74  return hkey;
75 }
76 
78 {
79  HKEY hkeyProgId = OpenKeyFromFileType(pidl, KeyName);
80  if (!hkeyProgId)
81  {
82  WARN("OpenKeyFromFileType failed for key %S\n", KeyName);
83  return S_FALSE;
84  }
85 
86  WCHAR wszCLSIDValue[CHARS_IN_GUID];
87  DWORD dwSize = sizeof(wszCLSIDValue);
88  LONG res = RegGetValueW(hkeyProgId, NULL, NULL, RRF_RT_REG_SZ, NULL, wszCLSIDValue, &dwSize);
89  RegCloseKey(hkeyProgId);
90  if (res)
91  {
92  ERR("OpenKeyFromFileType succeeded but RegGetValueW failed\n");
93  return S_FALSE;
94  }
95 
96 #if 0
97  {
99  L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved",
100  wszCLSIDValue,
102  NULL,
103  NULL,
104  NULL);
105  if (res != ERROR_SUCCESS)
106  {
107  ERR("DropHandler extension %S not approved\n", wszName);
108  return E_ACCESSDENIED;
109  }
110  }
111 #endif
112 
114  L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked",
115  wszCLSIDValue,
117  NULL,
118  NULL,
119  NULL) == ERROR_SUCCESS)
120  {
121  ERR("Extension %S not approved\n", wszCLSIDValue);
122  return E_ACCESSDENIED;
123  }
124 
125  HRESULT hres = CLSIDFromString (wszCLSIDValue, pclsid);
127  return hres;
128 
129  return S_OK;
130 }
131 
132 static HRESULT
133 getDefaultIconLocation(LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT uFlags)
134 {
135  static const WCHAR folder[] = { 'F', 'o', 'l', 'd', 'e', 'r', 0 };
136 
137  if (!HCR_GetIconW(folder, szIconFile, NULL, cchMax, piIndex))
138  {
139  lstrcpynW(szIconFile, swShell32Name, cchMax);
140  *piIndex = -IDI_SHELL_FOLDER;
141  }
142 
143  if (uFlags & GIL_OPENICON)
144  {
145  // next icon
146  if (*piIndex < 0)
147  (*piIndex)--;
148  else
149  (*piIndex)++;
150  }
151 
152  return S_OK;
153 }
154 
155 static const WCHAR s_shellClassInfo[] = { '.', 'S', 'h', 'e', 'l', 'l', 'C', 'l', 'a', 's', 's', 'I', 'n', 'f', 'o', 0 };
156 
157 static BOOL
158 getShellClassInfo(LPCWSTR Entry, LPWSTR pszValue, DWORD cchValueLen, LPCWSTR IniFile)
159 {
160  return GetPrivateProfileStringW(s_shellClassInfo, Entry, NULL, pszValue, cchValueLen, IniFile);
161 }
162 
163 static HRESULT
165  LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
166 {
167  DWORD dwFileAttrs;
168  WCHAR wszPath[MAX_PATH];
169  WCHAR wszIniFullPath[MAX_PATH];
170  static const WCHAR iconFile[] = { 'I', 'c', 'o', 'n', 'F', 'i', 'l', 'e', 0 };
171  static const WCHAR clsid[] = { 'C', 'L', 'S', 'I', 'D', 0 };
172  static const WCHAR clsid2[] = { 'C', 'L', 'S', 'I', 'D', '2', 0 };
173  static const WCHAR iconIndex[] = { 'I', 'c', 'o', 'n', 'I', 'n', 'd', 'e', 'x', 0 };
174  static const WCHAR iconResource[] = { 'I', 'c', 'o', 'n', 'R', 'e', 's', 'o', 'u', 'r', 'c', 'e', 0 };
175  static const WCHAR wszDesktopIni[] = { 'd','e','s','k','t','o','p','.','i','n','i',0 };
176 
177  if (uFlags & GIL_DEFAULTICON)
178  goto Quit;
179 
180  // get path
181  if (!ILGetDisplayNameExW(psf, pidl, wszPath, 0))
182  goto Quit;
183  if (!PathIsDirectoryW(wszPath))
184  goto Quit;
185 
186  // read-only or system folder?
187  dwFileAttrs = _ILGetFileAttributes(ILFindLastID(pidl), NULL, 0);
188  if ((dwFileAttrs & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) == 0)
189  goto Quit;
190 
191  // build the full path of ini file
192  StringCchCopyW(wszIniFullPath, _countof(wszIniFullPath), wszPath);
193  PathAppendW(wszIniFullPath, wszDesktopIni);
194 
195  WCHAR wszValue[MAX_PATH], wszTemp[MAX_PATH];
196  if (getShellClassInfo(iconFile, wszValue, _countof(wszValue), wszIniFullPath))
197  {
198  // wszValue --> wszTemp
199  ExpandEnvironmentStringsW(wszValue, wszTemp, _countof(wszTemp));
200 
201  // wszPath + wszTemp --> wszPath
202  if (PathIsRelativeW(wszTemp))
203  PathAppendW(wszPath, wszTemp);
204  else
205  StringCchCopyW(wszPath, _countof(wszPath), wszTemp);
206 
207  // wszPath --> szIconFile
208  GetFullPathNameW(wszPath, cchMax, szIconFile, NULL);
209 
210  *piIndex = GetPrivateProfileIntW(s_shellClassInfo, iconIndex, 0, wszIniFullPath);
211  return S_OK;
212  }
213  else if (getShellClassInfo(clsid, wszValue, _countof(wszValue), wszIniFullPath) &&
214  HCR_GetIconW(wszValue, szIconFile, NULL, cchMax, piIndex))
215  {
216  return S_OK;
217  }
218  else if (getShellClassInfo(clsid2, wszValue, _countof(wszValue), wszIniFullPath) &&
219  HCR_GetIconW(wszValue, szIconFile, NULL, cchMax, piIndex))
220  {
221  return S_OK;
222  }
223  else if (getShellClassInfo(iconResource, wszValue, _countof(wszValue), wszIniFullPath))
224  {
225  // wszValue --> wszTemp
226  ExpandEnvironmentStringsW(wszValue, wszTemp, _countof(wszTemp));
227 
228  // parse the icon location
229  *piIndex = PathParseIconLocationW(wszTemp);
230 
231  // wszPath + wszTemp --> wszPath
232  if (PathIsRelativeW(wszTemp))
233  PathAppendW(wszPath, wszTemp);
234  else
235  StringCchCopyW(wszPath, _countof(wszPath), wszTemp);
236 
237  // wszPath --> szIconFile
238  GetFullPathNameW(wszPath, cchMax, szIconFile, NULL);
239  return S_OK;
240  }
241 
242 Quit:
243  return getDefaultIconLocation(szIconFile, cchMax, piIndex, uFlags);
244 }
245 
247 {
248  CComPtr<IDefaultExtractIconInit> initIcon;
249  HRESULT hr;
250  int icon_idx = 0;
251  UINT flags = 0; // FIXME: Use it!
252  WCHAR wTemp[MAX_PATH] = L"";
253 
255  if (FAILED(hr))
256  return hr;
257 
258  if (_ILIsFolder (pidl))
259  {
261  pidl, 0, wTemp, _countof(wTemp),
262  &icon_idx,
263  &flags)))
264  {
265  initIcon->SetNormalIcon(wTemp, icon_idx);
266  // FIXME: if/when getIconLocationForFolder does something for
267  // GIL_FORSHORTCUT, code below should be uncommented. and
268  // the following line removed.
269  initIcon->SetShortcutIcon(wTemp, icon_idx);
270  }
272  pidl, GIL_DEFAULTICON, wTemp, _countof(wTemp),
273  &icon_idx,
274  &flags)))
275  {
276  initIcon->SetDefaultIcon(wTemp, icon_idx);
277  }
278  // if (SUCCEEDED(getIconLocationForFolder(psf,
279  // pidl, GIL_FORSHORTCUT, wTemp, _countof(wTemp),
280  // &icon_idx,
281  // &flags)))
282  // {
283  // initIcon->SetShortcutIcon(wTemp, icon_idx);
284  // }
286  pidl, GIL_OPENICON, wTemp, _countof(wTemp),
287  &icon_idx,
288  &flags)))
289  {
290  initIcon->SetOpenIcon(wTemp, icon_idx);
291  }
292  }
293  else
294  {
295  HKEY hkey = OpenKeyFromFileType(pidl, L"DefaultIcon");
296  if (!hkey)
297  WARN("Could not open DefaultIcon key!\n");
298 
299  DWORD dwSize = sizeof(wTemp);
300  if (hkey && !SHQueryValueExW(hkey, NULL, NULL, NULL, wTemp, &dwSize))
301  {
302  WCHAR sNum[5];
303  if (ParseFieldW (wTemp, 2, sNum, 5))
304  icon_idx = _wtoi(sNum);
305  else
306  icon_idx = 0; /* sometimes the icon number is missing */
307  ParseFieldW (wTemp, 1, wTemp, MAX_PATH);
308  PathUnquoteSpacesW(wTemp);
309 
310  if (!wcscmp(L"%1", wTemp)) /* icon is in the file */
311  {
312  ILGetDisplayNameExW(psf, pidl, wTemp, 0);
313  icon_idx = 0;
314  }
315 
316  initIcon->SetNormalIcon(wTemp, icon_idx);
317  }
318  else
319  {
320  initIcon->SetNormalIcon(swShell32Name, 0);
321  }
322 
323  if (hkey)
324  RegCloseKey(hkey);
325  }
326 
327  return initIcon->QueryInterface(iid, ppvOut);
328 }
329 
330 /*
331 CFileSysEnum should do an initial FindFirstFile and do a FindNextFile as each file is
332 returned by Next. When the enumerator is created, it can do numerous additional operations
333 including formatting a drive, reconnecting a network share drive, and requesting a disk
334 be inserted in a removable drive.
335 */
336 
337 /***********************************************************************
338 * IShellFolder implementation
339 */
340 
342  public CEnumIDListBase
343 {
344  private:
345  public:
346  CFileSysEnum();
347  ~CFileSysEnum();
349 
351  COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
352  END_COM_MAP()
353 };
354 
356 {
357 }
358 
360 {
361 }
362 
364 {
365  WIN32_FIND_DATAW stffile;
366  HANDLE hFile;
368  BOOL succeeded = TRUE;
369  static const WCHAR stars[] = { '*','.','*',0 };
370  static const WCHAR dot[] = { '.',0 };
371  static const WCHAR dotdot[] = { '.','.',0 };
372 
373  TRACE("(%p)->(path=%s flags=0x%08x)\n", this, debugstr_w(lpszPath), dwFlags);
374 
375  if(!lpszPath || !lpszPath[0]) return FALSE;
376 
377  wcscpy(szPath, lpszPath);
380 
381  hFile = FindFirstFileW(szPath,&stffile);
382  if ( hFile != INVALID_HANDLE_VALUE )
383  {
384  BOOL findFinished = FALSE;
385 
386  do
387  {
388  if ( !(stffile.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
389  || (dwFlags & SHCONTF_INCLUDEHIDDEN) )
390  {
391  LPITEMIDLIST pidl = NULL;
392 
393  if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
394  dwFlags & SHCONTF_FOLDERS &&
395  strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName, dotdot))
396  {
397  pidl = _ILCreateFromFindDataW(&stffile);
398  succeeded = succeeded && AddToEnumList(pidl);
399  }
400  else if (!(stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
401  && dwFlags & SHCONTF_NONFOLDERS)
402  {
403  pidl = _ILCreateFromFindDataW(&stffile);
404  succeeded = succeeded && AddToEnumList(pidl);
405  }
406  }
407  if (succeeded)
408  {
409  if (!FindNextFileW(hFile, &stffile))
410  {
412  findFinished = TRUE;
413  else
414  succeeded = FALSE;
415  }
416  }
417  } while (succeeded && !findFinished);
418  FindClose(hFile);
419  }
420 
421  return succeeded;
422 }
423 
425 {
426  pclsid = (CLSID *)&CLSID_ShellFSFolder;
427  sPathTarget = NULL;
428  pidlRoot = NULL;
430 }
431 
433 {
434  TRACE("-- destroying IShellFolder(%p)\n", this);
435 
436  SHFree(pidlRoot);
438 }
439 
440 
441 static const shvheader GenericSFHeader[] = {
448 };
449 
450 #define GENERICSHELLVIEWCOLUMNS 6
451 
452 /**************************************************************************
453  * SHELL32_CreatePidlFromBindCtx [internal]
454  *
455  * If the caller bound File System Bind Data, assume it is the
456  * find data for the path.
457  * This allows binding of paths that don't exist.
458  */
460 {
462  LPITEMIDLIST pidl = NULL;
463  IUnknown *param = NULL;
464  WIN32_FIND_DATAW wfd;
465  HRESULT r;
466 
467  TRACE("%p %s\n", pbc, debugstr_w(path));
468 
469  if (!pbc)
470  return NULL;
471 
472  /* see if the caller bound File System Bind Data */
473  r = pbc->GetObjectParam((LPOLESTR)STR_FILE_SYS_BIND_DATA, &param);
474  if (FAILED(r))
475  return NULL;
476 
477  r = param->QueryInterface(IID_PPV_ARG(IFileSystemBindData,&fsbd));
478  if (SUCCEEDED(r))
479  {
480  r = fsbd->GetFindData(&wfd);
481  if (SUCCEEDED(r))
482  {
483  lstrcpynW(&wfd.cFileName[0], path, MAX_PATH);
484  pidl = _ILCreateFromFindDataW(&wfd);
485  }
486  fsbd->Release();
487  }
488 
489  return pidl;
490 }
491 
492 void SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, CLSID* pclsidFolder)
493 {
494  WCHAR wszCLSIDValue[CHARS_IN_GUID];
495  WCHAR wszDesktopIni[MAX_PATH];
496  StringCchCopyW(wszDesktopIni, MAX_PATH, pwszDir);
497  StringCchCatW(wszDesktopIni, MAX_PATH, L"\\desktop.ini");
498 
499  if (GetPrivateProfileStringW(L".ShellClassInfo",
500  L"CLSID",
501  L"",
502  wszCLSIDValue,
503  CHARS_IN_GUID,
504  wszDesktopIni))
505  {
506  CLSIDFromString (wszCLSIDValue, pclsidFolder);
507  }
508 }
509 
511 {
512  DWORD dwFileAttributes, dwShellAttributes;
513 
514  if (!_ILIsFolder(pidl) && !_ILIsValue(pidl))
515  {
516  ERR("Got wrong type of pidl!\n");
517  *pdwAttributes &= SFGAO_CANLINK;
518  return S_OK;
519  }
520 
522 
523  /* Set common attributes */
524  dwShellAttributes = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK | SFGAO_CANRENAME | SFGAO_CANDELETE |
525  SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSTEM;
526 
528  dwShellAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
529  else
530  dwShellAttributes |= SFGAO_STREAM;
531 
533  dwShellAttributes |= SFGAO_HIDDEN;
534 
536  dwShellAttributes |= SFGAO_READONLY;
537 
538  if (SFGAO_LINK & *pdwAttributes)
539  {
540  char ext[MAX_PATH];
541 
542  if (_ILGetExtension(pidl, ext, MAX_PATH) && !lstrcmpiA(ext, "lnk"))
543  dwShellAttributes |= SFGAO_LINK;
544  }
545 
546  if (SFGAO_HASSUBFOLDER & *pdwAttributes)
547  {
548  CComPtr<IShellFolder> psf2;
549  if (SUCCEEDED(psf->BindToObject(pidl, 0, IID_PPV_ARG(IShellFolder, &psf2))))
550  {
551  CComPtr<IEnumIDList> pEnumIL;
552  if (SUCCEEDED(psf2->EnumObjects(0, SHCONTF_FOLDERS, &pEnumIL)))
553  {
554  if (pEnumIL->Skip(1) == S_OK)
555  dwShellAttributes |= SFGAO_HASSUBFOLDER;
556  }
557  }
558  }
559 
560  *pdwAttributes = dwShellAttributes;
561 
562  TRACE ("-- 0x%08x\n", *pdwAttributes);
563  return S_OK;
564 }
565 
566 /**************************************************************************
567 * CFSFolder::ParseDisplayName {SHELL32}
568 *
569 * Parse a display name.
570 *
571 * PARAMS
572 * hwndOwner [in] Parent window for any message's
573 * pbc [in] optional FileSystemBindData context
574 * lpszDisplayName [in] Unicode displayname.
575 * pchEaten [out] (unicode) characters processed
576 * ppidl [out] complex pidl to item
577 * pdwAttributes [out] items attributes
578 *
579 * NOTES
580 * Every folder tries to parse only its own (the leftmost) pidl and creates a
581 * subfolder to evaluate the remaining parts.
582 * Now we can parse into namespaces implemented by shell extensions
583 *
584 * Behaviour on win98: lpszDisplayName=NULL -> crash
585 * lpszDisplayName="" -> returns mycoputer-pidl
586 *
587 * FIXME
588 * pdwAttributes is not set
589 * pchEaten is not set like in windows
590 */
592  LPBC pbc,
593  LPOLESTR lpszDisplayName,
594  DWORD *pchEaten, PIDLIST_RELATIVE *ppidl,
595  DWORD *pdwAttributes)
596 {
598  LPCWSTR szNext = NULL;
601  LPITEMIDLIST pidlTemp = NULL;
602  DWORD len;
603 
604  TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
605  this, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
606  pchEaten, ppidl, pdwAttributes);
607 
608  if (!ppidl)
609  return E_INVALIDARG;
610 
611  if (!lpszDisplayName)
612  {
613  *ppidl = NULL;
614  return E_INVALIDARG;
615  }
616 
617  *ppidl = NULL;
618 
619  if (pchEaten)
620  *pchEaten = 0; /* strange but like the original */
621 
622  if (*lpszDisplayName)
623  {
624  /* get the next element */
625  szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
626 
627  pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, szElement);
628  if (pidlTemp != NULL)
629  {
630  /* We are creating an id list without ensuring that the items exist.
631  If we have a remaining path, this must be a folder.
632  We have to do it now because it is set as a file by default */
633  if (szNext)
634  {
635  pidlTemp->mkid.abID[0] = PT_FOLDER;
636  }
637  hr = S_OK;
638  }
639  else
640  {
641  /* build the full pathname to the element */
644  len = wcslen(szPath);
646 
647  /* get the pidl */
648  hr = _ILCreateFromPathW(szPath, &pidlTemp);
649  }
650 
651  if (SUCCEEDED(hr))
652  {
653  if (szNext && *szNext)
654  {
655  /* try to analyse the next element */
656  hr = SHELL32_ParseNextElement(this, hwndOwner, pbc,
657  &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
658  }
659  else
660  {
661  /* it's the last element */
662  if (pdwAttributes && *pdwAttributes)
663  hr = SHELL32_GetFSItemAttributes(this, pidlTemp, pdwAttributes);
664  }
665  }
666  }
667 
668  if (SUCCEEDED(hr))
669  *ppidl = pidlTemp;
670  else
671  *ppidl = NULL;
672 
673  TRACE("(%p)->(-- pidl=%p ret=0x%08x)\n", this, ppidl ? *ppidl : 0, hr);
674 
675  return hr;
676 }
677 
678 /**************************************************************************
679 * CFSFolder::EnumObjects
680 * PARAMETERS
681 * HWND hwndOwner, //[in ] Parent Window
682 * DWORD grfFlags, //[in ] SHCONTF enumeration mask
683 * LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
684 */
686  HWND hwndOwner,
687  DWORD dwFlags,
688  LPENUMIDLIST *ppEnumIDList)
689 {
690  return ShellObjectCreatorInit<CFileSysEnum>(sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
691 }
692 
693 /**************************************************************************
694 * CFSFolder::BindToObject
695 * PARAMETERS
696 * LPCITEMIDLIST pidl, //[in ] relative pidl to open
697 * LPBC pbc, //[in ] optional FileSystemBindData context
698 * REFIID riid, //[in ] Initial Interface
699 * LPVOID* ppvObject //[out] Interface*
700 */
702  PCUIDLIST_RELATIVE pidl,
703  LPBC pbc,
704  REFIID riid,
705  LPVOID * ppvOut)
706 {
707  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this, pidl, pbc,
708  shdebugstr_guid(&riid), ppvOut);
709 
710  CComPtr<IShellFolder> pSF;
711  HRESULT hr;
712 
713  if (!pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
714  {
715  ERR("CFSFolder::BindToObject: Invalid parameters\n");
716  return E_INVALIDARG;
717  }
718 
719  /* Get the pidl data */
720  FileStruct* pData = &_ILGetDataPointer(pidl)->u.file;
721  FileStructW* pDataW = _ILGetFileStructW(pidl);
722 
723  if (!pDataW)
724  {
725  ERR("CFSFolder::BindToObject: Invalid pidl!\n");
726  return E_INVALIDARG;
727  }
728 
729  *ppvOut = NULL;
730 
731  /* Create the target folder info */
732  PERSIST_FOLDER_TARGET_INFO pfti = {0};
733  pfti.dwAttributes = -1;
734  pfti.csidl = -1;
736 
737  /* Get the CLSID to bind to */
738  CLSID clsidFolder;
739  if (_ILIsFolder(pidl))
740  {
741  clsidFolder = CLSID_ShellFSFolder;
742 
743  if ((pData->uFileAttribs & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
745  }
746  else
747  {
748  hr = GetCLSIDForFileType(pidl, L"CLSID", &clsidFolder);
749  if (hr == S_FALSE)
751  if (hr != S_OK)
752  return hr;
753  }
754 
755  hr = SHELL32_BindToSF(pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
756  if (FAILED_UNEXPECTEDLY(hr))
757  return hr;
758 
759  TRACE ("-- returning (%p) %08x\n", *ppvOut, hr);
760 
761  return S_OK;
762 
763 }
764 
765 /**************************************************************************
766 * CFSFolder::BindToStorage
767 * PARAMETERS
768 * LPCITEMIDLIST pidl, //[in ] complex pidl to store
769 * LPBC pbc, //[in ] reserved
770 * REFIID riid, //[in ] Initial storage interface
771 * LPVOID* ppvObject //[out] Interface* returned
772 */
774  PCUIDLIST_RELATIVE pidl,
775  LPBC pbcReserved,
776  REFIID riid,
777  LPVOID *ppvOut)
778 {
779  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, pidl, pbcReserved,
780  shdebugstr_guid (&riid), ppvOut);
781 
782  *ppvOut = NULL;
783  return E_NOTIMPL;
784 }
785 
786 /**************************************************************************
787 * CFSFolder::CompareIDs
788 */
789 
791  PCUIDLIST_RELATIVE pidl1,
792  PCUIDLIST_RELATIVE pidl2)
793 {
794  LPPIDLDATA pData1 = _ILGetDataPointer(pidl1);
795  LPPIDLDATA pData2 = _ILGetDataPointer(pidl2);
796  FileStructW* pDataW1 = _ILGetFileStructW(pidl1);
797  FileStructW* pDataW2 = _ILGetFileStructW(pidl2);
798  BOOL bIsFolder1 = _ILIsFolder(pidl1);
799  BOOL bIsFolder2 = _ILIsFolder(pidl2);
800  LPWSTR pExtension1, pExtension2;
801 
802  if (!pDataW1 || !pDataW2 || LOWORD(lParam) >= GENERICSHELLVIEWCOLUMNS)
803  return E_INVALIDARG;
804 
805  /* When sorting between a File and a Folder, the Folder gets sorted first */
806  if (bIsFolder1 != bIsFolder2)
807  {
808  return MAKE_COMPARE_HRESULT(bIsFolder1 ? -1 : 1);
809  }
810 
811  int result;
812  switch (LOWORD(lParam))
813  {
814  case 0: /* Name */
815  result = wcsicmp(pDataW1->wszName, pDataW2->wszName);
816  break;
817  case 1: /* Comments */
818  result = 0;
819  break;
820  case 2: /* Type */
821  pExtension1 = PathFindExtensionW(pDataW1->wszName);
822  pExtension2 = PathFindExtensionW(pDataW2->wszName);
823  result = wcsicmp(pExtension1, pExtension2);
824  break;
825  case 3: /* Size */
826  result = pData1->u.file.dwFileSize - pData2->u.file.dwFileSize;
827  break;
828  case 4: /* Modified */
829  result = pData1->u.file.uFileDate - pData2->u.file.uFileDate;
830  if (result == 0)
831  result = pData1->u.file.uFileTime - pData2->u.file.uFileTime;
832  break;
833  case 5: /* Attributes */
834  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
835  }
836 
837  if (result == 0)
838  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
839 
841 }
842 
843 /**************************************************************************
844 * CFSFolder::CreateViewObject
845 */
847  REFIID riid, LPVOID * ppvOut)
848 {
849  CComPtr<IShellView> pShellView;
851 
852  TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this, hwndOwner, shdebugstr_guid (&riid),
853  ppvOut);
854 
855  if (ppvOut)
856  {
857  *ppvOut = NULL;
858 
859  if (IsEqualIID (riid, IID_IDropTarget))
861  else if (IsEqualIID (riid, IID_IContextMenu))
862  {
863  HKEY hKeys[16];
864  UINT cKeys = 0;
865  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
866 
867  DEFCONTEXTMENU dcm;
868  dcm.hwnd = hwndOwner;
869  dcm.pcmcb = this;
870  dcm.pidlFolder = pidlRoot;
871  dcm.psf = this;
872  dcm.cidl = 0;
873  dcm.apidl = NULL;
874  dcm.cKeys = cKeys;
875  dcm.aKeys = hKeys;
877  hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
878  }
879  else if (IsEqualIID (riid, IID_IShellView))
880  {
881  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
882  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
883  }
884  }
885  TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
886  return hr;
887 }
888 
889 /**************************************************************************
890 * CFSFolder::GetAttributesOf
891 *
892 * PARAMETERS
893 * UINT cidl, //[in ] num elements in pidl array
894 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
895 * ULONG* rgfInOut) //[out] result array
896 *
897 */
899  PCUITEMID_CHILD_ARRAY apidl, DWORD * rgfInOut)
900 {
901  HRESULT hr = S_OK;
902 
903  if (!rgfInOut)
904  return E_INVALIDARG;
905  if (cidl && !apidl)
906  return E_INVALIDARG;
907 
908  if (*rgfInOut == 0)
909  *rgfInOut = ~0;
910 
911  if(cidl == 0)
912  {
914 
915  if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
916  {
917  SHELL32_GetFSItemAttributes(this, rpidl, rgfInOut);
918  }
919  else if (_ILIsDrive(rpidl))
920  {
921  IShellFolder *psfParent = NULL;
923  if(SUCCEEDED(hr))
924  {
925  hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
926  psfParent->Release();
927  }
928  }
929  else
930  {
931  ERR("Got and unknown pidl!\n");
932  }
933  }
934  else
935  {
936  while (cidl > 0 && *apidl)
937  {
938  pdump(*apidl);
939  if(_ILIsFolder(*apidl) || _ILIsValue(*apidl))
940  SHELL32_GetFSItemAttributes(this, *apidl, rgfInOut);
941  else
942  ERR("Got an unknown type of pidl!!!\n");
943  apidl++;
944  cidl--;
945  }
946  }
947  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
948  *rgfInOut &= ~SFGAO_VALIDATE;
949 
950  TRACE("-- result=0x%08x\n", *rgfInOut);
951 
952  return hr;
953 }
954 
955 /**************************************************************************
956 * CFSFolder::GetUIObjectOf
957 *
958 * PARAMETERS
959 * HWND hwndOwner, //[in ] Parent window for any output
960 * UINT cidl, //[in ] array size
961 * LPCITEMIDLIST* apidl, //[in ] simple pidl array
962 * REFIID riid, //[in ] Requested Interface
963 * UINT* prgfInOut, //[ ] reserved
964 * LPVOID* ppvObject) //[out] Resulting Interface
965 *
966 * NOTES
967 * This function gets asked to return "view objects" for one or more (multiple
968 * select) items:
969 * The viewobject typically is an COM object with one of the following
970 * interfaces:
971 * IExtractIcon,IDataObject,IContextMenu
972 * In order to support icon positions in the default Listview your DataObject
973 * must implement the SetData method (in addition to GetData :) - the shell
974 * passes a barely documented "Icon positions" structure to SetData when the
975 * drag starts, and GetData's it if the drop is in another explorer window that
976 * needs the positions.
977 */
979  UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
980  REFIID riid, UINT * prgfInOut,
981  LPVOID * ppvOut)
982 {
983  LPVOID pObj = NULL;
985 
986  TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
987  this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
988 
989  if (ppvOut)
990  {
991  *ppvOut = NULL;
992 
993  if (cidl == 1 && _ILIsValue(apidl[0]))
994  {
995  hr = _CreateExtensionUIObject(apidl[0], riid, ppvOut);
996  if(hr != S_FALSE)
997  return hr;
998  }
999 
1000  if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1))
1001  {
1002  HKEY hKeys[16];
1003  UINT cKeys = 0;
1004  AddFSClassKeysToArray(apidl[0], hKeys, &cKeys);
1005 
1006  DEFCONTEXTMENU dcm;
1007  dcm.hwnd = hwndOwner;
1008  dcm.pcmcb = this;
1009  dcm.pidlFolder = pidlRoot;
1010  dcm.psf = this;
1011  dcm.cidl = cidl;
1012  dcm.apidl = apidl;
1013  dcm.cKeys = cKeys;
1014  dcm.aKeys = hKeys;
1015  dcm.punkAssociationInfo = NULL;
1016  hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
1017  }
1018  else if (IsEqualIID (riid, IID_IDataObject))
1019  {
1020  if (cidl >= 1)
1021  {
1022  hr = IDataObject_Constructor (hwndOwner, pidlRoot, apidl, cidl, (IDataObject **)&pObj);
1023  }
1024  else
1025  {
1026  hr = E_INVALIDARG;
1027  }
1028  }
1029  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
1030  {
1031  if (_ILIsValue(apidl[0]))
1032  hr = _GetIconHandler(apidl[0], riid, (LPVOID*)&pObj);
1033  if (hr != S_OK)
1034  hr = CFSExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
1035  }
1036  else if (IsEqualIID (riid, IID_IDropTarget))
1037  {
1038  /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */
1039  if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj)))
1040  {
1042  }
1043  }
1044  else
1045  hr = E_NOINTERFACE;
1046 
1047  if (SUCCEEDED(hr) && !pObj)
1048  hr = E_OUTOFMEMORY;
1049 
1050  *ppvOut = pObj;
1051  }
1052  TRACE("(%p)->hr=0x%08x\n", this, hr);
1053  return hr;
1054 }
1055 
1056 static const WCHAR AdvancedW[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced";
1057 static const WCHAR HideFileExtW[] = L"HideFileExt";
1058 static const WCHAR NeverShowExtW[] = L"NeverShowExt";
1059 
1060 /******************************************************************************
1061  * SHELL_FS_HideExtension [Internal]
1062  *
1063  * Query the registry if the filename extension of a given path should be
1064  * hidden.
1065  *
1066  * PARAMS
1067  * szPath [I] Relative or absolute path of a file
1068  *
1069  * RETURNS
1070  * TRUE, if the filename's extension should be hidden
1071  * FALSE, otherwise.
1072  */
1074 {
1075  HKEY hKey;
1076  DWORD dwData;
1077  DWORD dwDataSize = sizeof (DWORD);
1078  BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
1079 
1080  if (!RegCreateKeyExW(HKEY_CURRENT_USER, AdvancedW, 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
1081  if (!RegQueryValueExW(hKey, HideFileExtW, 0, 0, (LPBYTE) &dwData, &dwDataSize))
1082  doHide = dwData;
1083  RegCloseKey (hKey);
1084  }
1085 
1086  if (!doHide) {
1088 
1089  if (*ext != '\0') {
1091  LONG classlen = sizeof(classname);
1092 
1093  if (!RegQueryValueW(HKEY_CLASSES_ROOT, ext, classname, &classlen))
1094  if (!RegOpenKeyW(HKEY_CLASSES_ROOT, classname, &hKey)) {
1095  if (!RegQueryValueExW(hKey, NeverShowExtW, 0, NULL, NULL, NULL))
1096  doHide = TRUE;
1097  RegCloseKey(hKey);
1098  }
1099  }
1100  }
1101  return doHide;
1102 }
1103 
1105 {
1106  /*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
1107  if (!(dwFlags & SHGDN_FORPARSING) &&
1108  ((dwFlags & SHGDN_INFOLDER) || (dwFlags == SHGDN_NORMAL))) {
1109  if (SHELL_FS_HideExtension(szPath) && szPath[0] != '.')
1111  }
1112 }
1113 
1114 /**************************************************************************
1115 * CFSFolder::GetDisplayNameOf
1116 * Retrieves the display name for the specified file object or subfolder
1117 *
1118 * PARAMETERS
1119 * LPCITEMIDLIST pidl, //[in ] complex pidl to item
1120 * DWORD dwFlags, //[in ] SHGNO formatting flags
1121 * LPSTRRET lpName) //[out] Returned display name
1122 *
1123 * FIXME
1124 * if the name is in the pidl the ret value should be a STRRET_OFFSET
1125 */
1126 
1128  DWORD dwFlags, LPSTRRET strRet)
1129 {
1130  if (!strRet)
1131  return E_INVALIDARG;
1132 
1133  /* If it is a complex pidl, let the child handle it */
1134  if (!_ILIsPidlSimple (pidl)) /* complex pidl */
1135  {
1136  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1137  }
1138  else if (pidl && !pidl->mkid.cb) /* empty pidl */
1139  {
1140  /* If it is an empty pidl return only the path of the folder */
1143  sPathTarget)
1144  {
1145  return SHSetStrRet(strRet, sPathTarget);
1146  }
1147  return E_INVALIDARG;
1148  }
1149 
1150  int len = 0;
1151  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1152  if (!pszPath)
1153  return E_OUTOFMEMORY;
1154 
1157  sPathTarget)
1158  {
1159  lstrcpynW(pszPath, sPathTarget, MAX_PATH);
1160  PathAddBackslashW(pszPath);
1161  len = wcslen(pszPath);
1162  }
1163  _ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
1164  if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
1165 
1166  strRet->uType = STRRET_WSTR;
1167  strRet->pOleStr = pszPath;
1168 
1169  TRACE ("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1170  return S_OK;
1171 }
1172 
1173 /**************************************************************************
1174 * CFSFolder::SetNameOf
1175 * Changes the name of a file object or subfolder, possibly changing its item
1176 * identifier in the process.
1177 *
1178 * PARAMETERS
1179 * HWND hwndOwner, //[in ] Owner window for output
1180 * LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
1181 * LPCOLESTR lpszName, //[in ] the items new display name
1182 * DWORD dwFlags, //[in ] SHGNO formatting flags
1183 * LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
1184 */
1186  HWND hwndOwner,
1187  PCUITEMID_CHILD pidl,
1188  LPCOLESTR lpName,
1189  DWORD dwFlags,
1190  PITEMID_CHILD *pPidlOut)
1191 {
1192  WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
1193  BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
1194 
1195  TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
1196  debugstr_w (lpName), dwFlags, pPidlOut);
1197 
1198  FileStructW* pDataW = _ILGetFileStructW(pidl);
1199  if (!pDataW)
1200  {
1201  ERR("Got garbage pidl\n");
1202  return E_INVALIDARG;
1203  }
1204 
1205  /* build source path */
1206  PathCombineW(szSrc, sPathTarget, pDataW->wszName);
1207 
1208  /* build destination path */
1210  PathCombineW(szDest, sPathTarget, lpName);
1211  else
1212  lstrcpynW(szDest, lpName, MAX_PATH);
1213 
1214  if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
1215  WCHAR *ext = PathFindExtensionW(szSrc);
1216  if(*ext != '\0') {
1217  INT len = wcslen(szDest);
1218  lstrcpynW(szDest + len, ext, MAX_PATH - len);
1219  }
1220  }
1221 
1222  TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1223  if (!wcscmp(szSrc, szDest))
1224  {
1225  /* src and destination is the same */
1226  HRESULT hr = S_OK;
1227  if (pPidlOut)
1228  hr = _ILCreateFromPathW(szDest, pPidlOut);
1229 
1230  return hr;
1231  }
1232 
1233  if (MoveFileW (szSrc, szDest))
1234  {
1235  HRESULT hr = S_OK;
1236 
1237  if (pPidlOut)
1238  hr = _ILCreateFromPathW(szDest, pPidlOut);
1239 
1241  SHCNF_PATHW, szSrc, szDest);
1242 
1243  return hr;
1244  }
1245 
1246  return E_FAIL;
1247 }
1248 
1250 {
1251  FIXME ("(%p)\n", this);
1252  return E_NOTIMPL;
1253 }
1254 
1256 {
1257  FIXME ("(%p)\n", this);
1258  return E_NOTIMPL;
1259 }
1260 
1262  ULONG * pSort, ULONG * pDisplay)
1263 {
1264  TRACE ("(%p)\n", this);
1265 
1266  if (pSort)
1267  *pSort = 0;
1268  if (pDisplay)
1269  *pDisplay = 0;
1270 
1271  return S_OK;
1272 }
1273 
1275  DWORD * pcsFlags)
1276 {
1277  TRACE ("(%p)\n", this);
1278 
1279  if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
1280  return E_INVALIDARG;
1281 
1282  *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1283 
1284  return S_OK;
1285 }
1286 
1288  const SHCOLUMNID * pscid, VARIANT * pv)
1289 {
1290  FIXME ("(%p)\n", this);
1291 
1292  return E_NOTIMPL;
1293 }
1294 
1296  UINT iColumn, SHELLDETAILS * psd)
1297 {
1298  HRESULT hr = E_FAIL;
1299 
1300  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1301 
1302  if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
1303  return E_INVALIDARG;
1304 
1305  if (!pidl)
1306  {
1307  /* the header titles */
1308  psd->fmt = GenericSFHeader[iColumn].fmt;
1309  psd->cxChar = GenericSFHeader[iColumn].cxChar;
1310  return SHSetStrRet(&psd->str, GenericSFHeader[iColumn].colnameid);
1311  }
1312  else
1313  {
1314  hr = S_OK;
1315  psd->str.uType = STRRET_CSTR;
1316  /* the data from the pidl */
1317  switch (iColumn)
1318  {
1319  case 0: /* name */
1320  hr = GetDisplayNameOf (pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1321  break;
1322  case 1: /* FIXME: comments */
1323  psd->str.cStr[0] = 0;
1324  break;
1325  case 2: /* type */
1326  _ILGetFileType(pidl, psd->str.cStr, MAX_PATH);
1327  break;
1328  case 3: /* size */
1329  _ILGetFileSize(pidl, psd->str.cStr, MAX_PATH);
1330  break;
1331  case 4: /* date */
1332  _ILGetFileDate(pidl, psd->str.cStr, MAX_PATH);
1333  break;
1334  case 5: /* attributes */
1335  _ILGetFileAttributes(pidl, psd->str.cStr, MAX_PATH);
1336  break;
1337  }
1338  }
1339 
1340  return hr;
1341 }
1342 
1344  SHCOLUMNID * pscid)
1345 {
1346  FIXME ("(%p)\n", this);
1347  return E_NOTIMPL;
1348 }
1349 
1350 /************************************************************************
1351  * CFSFolder::GetClassID
1352  */
1354 {
1355  TRACE ("(%p)\n", this);
1356 
1357  if (!lpClassId)
1358  return E_POINTER;
1359 
1360  *lpClassId = *pclsid;
1361 
1362  return S_OK;
1363 }
1364 
1365 /************************************************************************
1366  * CFSFolder::Initialize
1367  *
1368  * NOTES
1369  * sPathTarget is not set. Don't know how to handle in a non rooted environment.
1370  */
1372 {
1373  WCHAR wszTemp[MAX_PATH];
1374 
1375  TRACE ("(%p)->(%p)\n", this, pidl);
1376 
1377  SHFree (pidlRoot); /* free the old pidl */
1378  pidlRoot = ILClone (pidl); /* set my pidl */
1379 
1380  SHFree (sPathTarget);
1381  sPathTarget = NULL;
1382 
1383  /* set my path */
1384  if (SHGetPathFromIDListW (pidl, wszTemp))
1385  {
1386  int len = wcslen(wszTemp);
1387  sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1388  if (!sPathTarget)
1389  return E_OUTOFMEMORY;
1390  memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1391  }
1392 
1393  TRACE ("--(%p)->(%s)\n", this, debugstr_w(sPathTarget));
1394  return S_OK;
1395 }
1396 
1397 /**************************************************************************
1398  * CFSFolder::GetCurFolder
1399  */
1401 {
1402  TRACE ("(%p)->(%p)\n", this, pidl);
1403 
1404  if (!pidl)
1405  return E_POINTER;
1406 
1407  *pidl = ILClone(pidlRoot);
1408  return S_OK;
1409 }
1410 
1411 /**************************************************************************
1412  * CFSFolder::InitializeEx
1413  *
1414  * FIXME: error handling
1415  */
1417  const PERSIST_FOLDER_TARGET_INFO * ppfti)
1418 {
1419  WCHAR wszTemp[MAX_PATH];
1420 
1421  TRACE("(%p)->(%p,%p,%p)\n", this, pbc, pidlRootx, ppfti);
1422  if (ppfti)
1423  TRACE("--%p %s %s 0x%08x 0x%08x\n",
1425  debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
1426  ppfti->csidl);
1427 
1428  pdump (pidlRootx);
1429  if (ppfti && ppfti->pidlTargetFolder)
1430  pdump(ppfti->pidlTargetFolder);
1431 
1432  if (pidlRoot)
1433  __SHFreeAndNil(&pidlRoot); /* free the old */
1434  if (sPathTarget)
1436 
1437  /*
1438  * Root path and pidl
1439  */
1440  pidlRoot = ILClone(pidlRootx);
1441 
1442  /*
1443  * the target folder is spezified in csidl OR pidlTargetFolder OR
1444  * szTargetParsingName
1445  */
1446  if (ppfti)
1447  {
1448  if (ppfti->csidl != -1)
1449  {
1450  if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
1451  ppfti->csidl & CSIDL_FLAG_CREATE)) {
1452  int len = wcslen(wszTemp);
1453  sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1454  if (!sPathTarget)
1455  return E_OUTOFMEMORY;
1456  memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1457  }
1458  }
1459  else if (ppfti->szTargetParsingName[0])
1460  {
1461  int len = wcslen(ppfti->szTargetParsingName);
1462  sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1463  if (!sPathTarget)
1464  return E_OUTOFMEMORY;
1466  (len + 1) * sizeof(WCHAR));
1467  }
1468  else if (ppfti->pidlTargetFolder)
1469  {
1470  if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
1471  {
1472  int len = wcslen(wszTemp);
1473  sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1474  if (!sPathTarget)
1475  return E_OUTOFMEMORY;
1476  memcpy(sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1477  }
1478  }
1479  }
1480 
1481  TRACE("--(%p)->(target=%s)\n", this, debugstr_w(sPathTarget));
1482  pdump(pidlRoot);
1483  return (sPathTarget) ? S_OK : E_FAIL;
1484 }
1485 
1487 {
1488  FIXME("(%p)->(%p)\n", this, ppfti);
1489  ZeroMemory(ppfti, sizeof (*ppfti));
1490  return E_NOTIMPL;
1491 }
1492 
1494 {
1495  static const WCHAR formatW[] = {'S','h','e','l','l','E','x','\\',
1496  '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
1497  '%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x',
1498  '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
1499  WCHAR buf[MAX_PATH];
1500 
1501  sprintfW(buf, formatW, riid.Data1, riid.Data2, riid.Data3,
1502  riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3],
1503  riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);
1504 
1505  CLSID clsid;
1506  HRESULT hr;
1507 
1508  hr = GetCLSIDForFileType(pidl, buf, &clsid);
1509  if (hr != S_OK)
1510  return hr;
1511 
1512  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1513  if (FAILED_UNEXPECTEDLY(hr))
1514  return hr;
1515 
1516  return S_OK;
1517 }
1518 
1520 {
1521  HRESULT hr;
1522 
1523  TRACE("CFSFolder::_GetDropTarget entered\n");
1524 
1525  if (_ILIsFolder (pidl))
1526  {
1527  CComPtr<IShellFolder> psfChild;
1528  hr = this->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1529  if (FAILED_UNEXPECTEDLY(hr))
1530  return hr;
1531 
1532  return psfChild->CreateViewObject(NULL, IID_IDropTarget, ppvOut);
1533  }
1534 
1535  CLSID clsid;
1536  hr = GetCLSIDForFileType(pidl, L"shellex\\DropHandler", &clsid);
1537  if (hr != S_OK)
1538  return hr;
1539 
1540  hr = _CreateShellExtInstance(&clsid, pidl, IID_IDropTarget, ppvOut);
1541  if (FAILED_UNEXPECTEDLY(hr))
1542  return S_FALSE;
1543 
1544  return S_OK;
1545 }
1546 
1548 {
1549  CLSID clsid;
1550  HRESULT hr;
1551 
1552  hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1553  if (hr != S_OK)
1554  return hr;
1555 
1556  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1557  if (FAILED_UNEXPECTEDLY(hr))
1558  return S_FALSE;
1559 
1560  return S_OK;
1561 }
1562 
1564 {
1565  HRESULT hr;
1566  WCHAR wszPath[MAX_PATH];
1567 
1568  FileStructW* pDataW = _ILGetFileStructW(pidl);
1569  if (!pDataW)
1570  {
1571  ERR("Got garbage pidl\n");
1572  return E_INVALIDARG;
1573  }
1574 
1575  PathCombineW(wszPath, sPathTarget, pDataW->wszName);
1576 
1577  CComPtr<IPersistFile> pp;
1579  if (FAILED_UNEXPECTEDLY(hr))
1580  return hr;
1581 
1582  pp->Load(wszPath, 0);
1583 
1584  hr = pp->QueryInterface(riid, ppvOut);
1585  if (hr != S_OK)
1586  {
1587  ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid));
1588  return hr;
1589  }
1590  return hr;
1591 }
1592 
1594 {
1595  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1596  return S_OK;
1597 
1598  /* no data object means no selection */
1599  if (!pdtobj)
1600  {
1601  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
1602  {
1604  LPITEMIDLIST pidlParent = ILClone(pidlRoot);
1605  ILRemoveLastID(pidlParent);
1606  HRESULT hr = SH_ShowPropertiesDialog(sPathTarget, pidlParent, &pidlChild);
1607  if (FAILED(hr))
1608  ERR("SH_ShowPropertiesDialog failed\n");
1609  ILFree(pidlChild);
1610  ILFree(pidlParent);
1611  }
1612  else if (uMsg == DFM_MERGECONTEXTMENU)
1613  {
1614  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1615  HMENU hpopup = CreatePopupMenu();
1617  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1618  DestroyMenu(hpopup);
1619  }
1620 
1621  return S_OK;
1622  }
1623 
1624  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1625  return S_OK;
1626 
1627  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1628 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1975
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define IDS_SHV_COLUMN_COMMENTS
Definition: shresdef.h:61
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1563
UINT idCmdLast
Definition: shlobj.h:1309
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define MFT_STRING
Definition: winuser.h:741
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
#define REFIID
Definition: guiddef.h:113
#define TRUE
Definition: types.h:120
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1558
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2162
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
Definition: fci.c:115
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2581
HRESULT hr
Definition: shlfolder.c:183
virtual HRESULT WINAPI GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
Definition: CFSFolder.cpp:1295
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
const HKEY * aKeys
Definition: shlobj.h:2348
static HRESULT getDefaultIconLocation(LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT uFlags)
Definition: CFSFolder.cpp:133
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:47
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define KEY_READ
Definition: nt_native.h:1023
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
REFIID riid
Definition: precomp.h:44
virtual HRESULT WINAPI EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
Definition: CFSFolder.cpp:685
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL AddToEnumList(LPITEMIDLIST pidl)
HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1519
#define _countof(array)
Definition: fontsub.cpp:30
#define HKEY_CURRENT_USER
Definition: winreg.h:11
WCHAR wszName[1]
Definition: shlfolder.c:1555
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:294
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:450
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
#define WARN(fmt,...)
Definition: debug.h:111
#define CHARS_IN_GUID
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1737
#define LVCFMT_RIGHT
Definition: commctrl.h:2571
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
IContextMenuCB * pcmcb
Definition: shlobj.h:2341
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1280
_In_ LPCSTR lpName
Definition: winbase.h:2729
virtual HRESULT WINAPI GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
Definition: CFSFolder.cpp:1287
LPWSTR pOleStr
Definition: shtypes.idl:96
HMENU hmenu
Definition: shlobj.h:1306
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
static const WCHAR NeverShowExtW[]
Definition: CFSFolder.cpp:1058
#define LVCFMT_LEFT
Definition: commctrl.h:2570
static HANDLE ULONG_PTR dwData
Definition: file.c:35
virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidl)
Definition: CFSFolder.cpp:1371
const char * wine_dbgstr_guid(const GUID *guid)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
#define RRF_RT_REG_SZ
Definition: driver.c:575
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
const GUID IID_IDataObject
HRESULT WINAPI Initialize(LPWSTR sPathTarget, DWORD dwFlags)
Definition: CFSFolder.cpp:363
virtual HRESULT WINAPI MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
Definition: CFSFolder.cpp:1343
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:380
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
static BOOL getShellClassInfo(LPCWSTR Entry, LPWSTR pszValue, DWORD cchValueLen, LPCWSTR IniFile)
Definition: CFSFolder.cpp:158
WCHAR classname[128]
Definition: startup.c:15
#define IDS_PROPERTIES
Definition: resource.h:101
UINT uFlags
Definition: api.c:60
static LPOLESTR
Definition: stg_prop.c:27
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:159
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, IDataObject **dataObject)
HRESULT GetFindData([out] WIN32_FIND_DATAW *pfd)
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1720
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3351
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
#define DWORD
Definition: nt_native.h:44
STRRET str
Definition: shtypes.idl:108
int32_t INT
Definition: typedefs.h:56
virtual HRESULT WINAPI GetClassID(CLSID *lpClassId)
Definition: CFSFolder.cpp:1353
WPARAM wParam
Definition: combotst.c:138
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:75
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1094
#define lstrcpynW
Definition: compat.h:397
static HRESULT getIconLocationForFolder(IShellFolder *psf, PCITEMID_CHILD pidl, UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
Definition: CFSFolder.cpp:164
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:121
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define __SHFreeAndNil(ptr)
Definition: shell32_main.h:136
STAR * stars
Definition: screensaver.c:45
UINT WINAPI GetPrivateProfileIntW(LPCWSTR section, LPCWSTR entry, INT def_val, LPCWSTR filename)
Definition: profile.c:1297
#define IDS_SHV_COLUMN_SIZE
Definition: shresdef.h:44
char cStr[MAX_PATH]
Definition: shtypes.idl:98
IShellFolder * psf
Definition: shlobj.h:2343
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define MFS_ENABLED
Definition: winuser.h:745
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:818
HRESULT CFSExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:246
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL SHELL_FS_HideExtension(LPWSTR szPath)
Definition: CFSFolder.cpp:1073
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:46
HRESULT _ILCreateFromPathW(LPCWSTR szPath, LPITEMIDLIST *ppidl)
Definition: pidl.c:1775
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:215
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
#define pp
Definition: hlsl.yy.c:978
ULONG Release()
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
DWORD _ILGetFileSize(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2441
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1951
#define DFM_INVOKECOMMAND
Definition: precomp.h:39
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
BOOL _ILGetExtension(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2462
LONG_PTR LPARAM
Definition: windef.h:208
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
UINT indexMenu
Definition: shlobj.h:1307
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:197
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2082
struct _SFV_CREATE SFV_CREATE
HRESULT _GetIconHandler(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1547
BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
Definition: pidl.c:91
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
static WCHAR szElement[]
Definition: domdoc.c:1171
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
HRESULT GetObjectParam([in] LPOLESTR pszKey, [out] IUnknown **ppunk)
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:70
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:238
virtual HRESULT WINAPI GetDefaultSearchGUID(GUID *pguid)
Definition: CFSFolder.cpp:1249
virtual HRESULT WINAPI GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
Definition: CFSFolder.cpp:1261
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
virtual HRESULT WINAPI GetCurFolder(LPITEMIDLIST *pidl)
Definition: CFSFolder.cpp:1400
static IFileSystemBindData fsbd
Definition: shlfolder.c:4672
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
DWORD m_bGroupPolicyActive
Definition: CFSFolder.h:41
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MM_ADDSEPARATOR
Definition: shlobj.h:2319
LONG HRESULT
Definition: typedefs.h:77
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
Definition: CFSFolder.cpp:459
UINT idCmdFirst
Definition: shlobj.h:1308
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
GLfloat param
Definition: glext.h:5796
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
HKEY OpenKeyFromFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName)
Definition: CFSFolder.cpp:27
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:38
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2389
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PSTRING FullName
Definition: rtlfuncs.h:1649
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl)
Definition: fprop.cpp:94
virtual HRESULT WINAPI GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
Definition: CFSFolder.cpp:978
GLbitfield flags
Definition: glext.h:7161
UINT cchMax
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1939
LPCWSTR GetNextElementW(LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut)
Definition: shlfolder.cpp:43
virtual HRESULT WINAPI ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
Definition: CFSFolder.cpp:591
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len) DECLSPEC_HIDDEN
Definition: shellord.c:113
CLSID * pclsid
Definition: CFSFolder.h:34
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:701
#define IDI_SHELL_FOLDER
Definition: shresdef.h:467
DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, LPDWORD lpReserved, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1461
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
REFCLSID clsid
Definition: msctf.c:84
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1960
WINE_DEFAULT_DEBUG_CHANNEL(shell)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
virtual HRESULT WINAPI GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO *ppfti)
Definition: CFSFolder.cpp:1486
void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
Definition: changenotify.c:340
_In_ HANDLE hFile
Definition: mswsock.h:90
#define IDS_SHV_COLUMN_MODIFIED
Definition: shresdef.h:46
#define wcsicmp
Definition: string.h:1152
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
virtual HRESULT WINAPI CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:846
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:441
SFGAO_STORAGEANCESTOR typedef ULONG SFGAOF
Definition: shobjidl.idl:213
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define SHCNF_PATHW
Definition: shlobj.h:1755
static const WCHAR HideFileExtW[]
Definition: CFSFolder.cpp:1057
int WINAPI PathParseIconLocationW(LPWSTR lpszPath)
Definition: path.c:1087
#define ERR(fmt,...)
Definition: debug.h:109
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags)
Definition: CFSFolder.cpp:1104
#define S_OK
Definition: intsafe.h:59
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2336
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:77
virtual HRESULT WINAPI SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
Definition: CFSFolder.cpp:1185
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2566
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
BOOL _ILGetFileDate(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2397
LPWSTR sPathTarget
Definition: CFSFolder.h:37
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
LPCWSTR szPath
Definition: env.c:35
void AddFSClassKeysToArray(PCUITEMID_CHILD pidl, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:281
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFSFolder.cpp:1127
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: services.c:325
#define sprintfW
Definition: unicode.h:58
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1029
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int UINT
Definition: ndis.h:50
#define CSIDL_FLAG_CREATE
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
virtual HRESULT WINAPI EnumSearches(IEnumExtraSearch **ppenum)
Definition: CFSFolder.cpp:1255
void SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, CLSID *pclsidFolder)
Definition: CFSFolder.cpp:492
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *wfd)
Definition: pidl.c:1727
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2508
DWORD dwFileAttributes
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
GLuint res
Definition: glext.h:9613
uint32_t * LPDWORD
Definition: typedefs.h:57
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
virtual HRESULT WINAPI BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:773
IUnknown * punkAssociationInfo
Definition: shlobj.h:2346
static const WCHAR s_shellClassInfo[]
Definition: CFSFolder.cpp:155
#define PT_FOLDER
Definition: pidl.h:94
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:450
static const WCHAR AdvancedW[]
Definition: CFSFolder.cpp:1056
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
virtual HRESULT WINAPI GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
Definition: CFSFolder.cpp:1274
#define END_COM_MAP()
Definition: atlcom.h:552
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
WCHAR * LPWSTR
Definition: xmlstorage.h:184
virtual HRESULT WINAPI GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
Definition: CFSFolder.cpp:898
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define wsprintf
Definition: winuser.h:5731
UINT uType
Definition: shtypes.idl:93
#define E_POINTER
Definition: winerror.h:2365
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:189
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2345
GLuint64EXT * result
Definition: glext.h:11304
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
virtual HRESULT WINAPI InitializeEx(IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti)
Definition: CFSFolder.cpp:1416
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2342
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define IDS_SHV_COLUMN_ATTRIBUTES
Definition: shresdef.h:47
base of all file and directory entries
Definition: entries.h:82
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
LPITEMIDLIST pidlRoot
Definition: CFSFolder.h:39
HRESULT SHELL32_GetFSItemAttributes(IShellFolder *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CFSFolder.cpp:510
HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1493
#define SUCCEEDED(hr)
Definition: intsafe.h:57
virtual HRESULT WINAPI CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
Definition: CFSFolder.cpp:790
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
virtual HRESULT WINAPI CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CFSFolder.cpp:1593
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502