winedbg: Don't dereference possibly NULL thread pointer.
[wine/zf.git] / dlls / shell32 / shlfolder.c
bloba25ceaeedb65e7fc6df947acb92645bd59ae2811
1 /*
2 * Shell Folder stuff
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
7 * IShellFolder2 and related interfaces
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "config.h"
25 #include "wine/port.h"
27 #include <stdlib.h>
28 #include <string.h>
29 #include <stdarg.h>
30 #include <stdio.h>
32 #define COBJMACROS
33 #define NONAMELESSUNION
35 #include "winerror.h"
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winreg.h"
39 #include "wingdi.h"
40 #include "winuser.h"
42 #include "ole2.h"
43 #include "shlguid.h"
45 #include "pidl.h"
46 #include "undocshell.h"
47 #include "shell32_main.h"
48 #include "shlwapi.h"
49 #include "wine/debug.h"
50 #include "shfldr.h"
52 WINE_DEFAULT_DEBUG_CHANNEL (shell);
54 static const WCHAR wszDotShellClassInfo[] = {
55 '.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0};
57 /***************************************************************************
58 * SHELL32_GetCustomFolderAttribute (internal function)
60 * Gets a value from the folder's desktop.ini file, if one exists.
62 * PARAMETERS
63 * pidl [I] Folder containing the desktop.ini file.
64 * pwszHeading [I] Heading in .ini file.
65 * pwszAttribute [I] Attribute in .ini file.
66 * pwszValue [O] Buffer to store value into.
67 * cchValue [I] Size in characters including NULL of buffer pointed to
68 * by pwszValue.
70 * RETURNS
71 * TRUE if returned non-NULL value.
72 * FALSE otherwise.
74 static inline BOOL SHELL32_GetCustomFolderAttributeFromPath(
75 LPWSTR pwszFolderPath, LPCWSTR pwszHeading, LPCWSTR pwszAttribute,
76 LPWSTR pwszValue, DWORD cchValue)
78 static const WCHAR wszDesktopIni[] =
79 {'d','e','s','k','t','o','p','.','i','n','i',0};
80 static const WCHAR wszDefault[] = {0};
82 PathAddBackslashW(pwszFolderPath);
83 PathAppendW(pwszFolderPath, wszDesktopIni);
84 return GetPrivateProfileStringW(pwszHeading, pwszAttribute, wszDefault,
85 pwszValue, cchValue, pwszFolderPath);
88 BOOL SHELL32_GetCustomFolderAttribute(
89 LPCITEMIDLIST pidl, LPCWSTR pwszHeading, LPCWSTR pwszAttribute,
90 LPWSTR pwszValue, DWORD cchValue)
92 DWORD dwAttrib = FILE_ATTRIBUTE_SYSTEM;
93 WCHAR wszFolderPath[MAX_PATH];
95 /* Hack around not having system attribute on non-Windows file systems */
96 if (0)
97 dwAttrib = _ILGetFileAttributes(pidl, NULL, 0);
99 if (dwAttrib & FILE_ATTRIBUTE_SYSTEM)
101 if (!SHGetPathFromIDListW(pidl, wszFolderPath))
102 return FALSE;
104 return SHELL32_GetCustomFolderAttributeFromPath(wszFolderPath, pwszHeading,
105 pwszAttribute, pwszValue, cchValue);
107 return FALSE;
110 /***************************************************************************
111 * GetNextElement (internal function)
113 * Gets a part of a string till the first backslash.
115 * PARAMETERS
116 * pszNext [IN] string to get the element from
117 * pszOut [IN] pointer to buffer which receives string
118 * dwOut [IN] length of pszOut
120 * RETURNS
121 * LPSTR pointer to first, not yet parsed char
124 LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut)
126 LPCWSTR pszTail = pszNext;
127 DWORD dwCopy;
129 TRACE ("(%s %p 0x%08x)\n", debugstr_w(pszNext), pszOut, dwOut);
131 *pszOut = 0;
133 if (!pszNext || !*pszNext)
134 return NULL;
136 while (*pszTail && (*pszTail != (WCHAR) '\\'))
137 pszTail++;
139 dwCopy = pszTail - pszNext + 1;
140 lstrcpynW (pszOut, pszNext, (dwOut < dwCopy) ? dwOut : dwCopy);
142 if (*pszTail)
143 pszTail++;
144 else
145 pszTail = NULL;
147 TRACE ("--(%s %s 0x%08x %p)\n", debugstr_w (pszNext), debugstr_w (pszOut), dwOut, pszTail);
148 return pszTail;
151 HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
152 LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes)
154 LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL;
155 IShellFolder *psfChild;
156 HRESULT hr;
158 TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
160 /* get the shellfolder for the child pidl and let it analyse further */
161 hr = IShellFolder2_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
163 if (SUCCEEDED(hr)) {
164 hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
165 IShellFolder_Release (psfChild);
167 if (SUCCEEDED(hr)) {
168 pidlTemp = ILCombine (*pidlInOut, pidlOut);
170 if (!pidlTemp)
171 hr = E_OUTOFMEMORY;
174 if (pidlOut)
175 ILFree (pidlOut);
178 ILFree (*pidlInOut);
179 *pidlInOut = pidlTemp;
181 TRACE ("-- pidl=%p ret=0x%08x\n", pidlInOut ? *pidlInOut : NULL, hr);
182 return hr;
185 /***********************************************************************
186 * SHELL32_CoCreateInitSF
188 * Creates a shell folder and initializes it with a pidl and a root folder
189 * via IPersistFolder3 or IPersistFolder.
191 * NOTES
192 * pathRoot can be NULL for Folders being a drive.
193 * In this case the absolute path is built from pidlChild (eg. C:)
195 static HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCWSTR pathRoot,
196 LPCITEMIDLIST pidlChild, REFCLSID clsid, LPVOID * ppvOut)
198 HRESULT hr;
200 TRACE ("(%p %s %p %s %p)\n", pidlRoot, debugstr_w(pathRoot), pidlChild, debugstr_guid(clsid), ppvOut);
202 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IShellFolder, ppvOut);
203 if (SUCCEEDED (hr))
205 LPITEMIDLIST pidlAbsolute = ILCombine (pidlRoot, pidlChild);
206 IPersistFolder *pPF;
207 IPersistFolder3 *ppf;
209 if (_ILIsFolder(pidlChild) &&
210 SUCCEEDED (IUnknown_QueryInterface ((IUnknown *) * ppvOut, &IID_IPersistFolder3, (LPVOID *) & ppf)))
212 PERSIST_FOLDER_TARGET_INFO ppfti;
214 ZeroMemory (&ppfti, sizeof (ppfti));
216 /* fill the PERSIST_FOLDER_TARGET_INFO */
217 ppfti.dwAttributes = -1;
218 ppfti.csidl = -1;
220 /* build path */
221 if (pathRoot) {
222 lstrcpynW (ppfti.szTargetParsingName, pathRoot, MAX_PATH - 1);
223 PathAddBackslashW(ppfti.szTargetParsingName); /* FIXME: why have drives a backslash here ? */
226 if (pidlChild) {
227 int len = lstrlenW(ppfti.szTargetParsingName);
229 if (!_ILSimpleGetTextW(pidlChild, ppfti.szTargetParsingName + len, MAX_PATH - len))
230 hr = E_INVALIDARG;
233 IPersistFolder3_InitializeEx (ppf, NULL, pidlAbsolute, &ppfti);
234 IPersistFolder3_Release (ppf);
236 else if (SUCCEEDED ((hr = IUnknown_QueryInterface ((IUnknown *) * ppvOut, &IID_IPersistFolder, (LPVOID *) & pPF)))) {
237 IPersistFolder_Initialize (pPF, pidlAbsolute);
238 IPersistFolder_Release (pPF);
240 ILFree (pidlAbsolute);
242 TRACE ("-- (%p) ret=0x%08x\n", *ppvOut, hr);
243 return hr;
246 /***********************************************************************
247 * SHELL32_BindToChild [Internal]
249 * Common code for IShellFolder_BindToObject.
251 * PARAMS
252 * pidlRoot [I] The parent shell folder's absolute pidl.
253 * pathRoot [I] Absolute dos path of the parent shell folder.
254 * pidlComplete [I] PIDL of the child. Relative to pidlRoot.
255 * riid [I] GUID of the interface, which ppvOut shall be bound to.
256 * ppvOut [O] A reference to the child's interface (riid).
258 * NOTES
259 * pidlComplete has to contain at least one non empty SHITEMID.
260 * This function makes special assumptions on the shell namespace, which
261 * means you probably can't use it for your IShellFolder implementation.
263 HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot,
264 LPCWSTR pathRoot, LPCITEMIDLIST pidlComplete, REFIID riid, LPVOID * ppvOut)
266 GUID const *clsid;
267 IShellFolder *pSF;
268 HRESULT hr;
269 LPITEMIDLIST pidlChild;
271 TRACE("(%p %s %p %s %p)\n", pidlRoot, debugstr_w(pathRoot), pidlComplete, debugstr_guid(riid), ppvOut);
273 if (!pidlRoot || !ppvOut || _ILIsEmpty(pidlComplete))
274 return E_INVALIDARG;
276 *ppvOut = NULL;
278 pidlChild = ILCloneFirst (pidlComplete);
280 if ((clsid = _ILGetGUIDPointer (pidlChild))) {
281 /* virtual folder */
282 hr = SHELL32_CoCreateInitSF (pidlRoot, pathRoot, pidlChild, clsid, (LPVOID *)&pSF);
283 } else if (_ILIsValue(pidlChild)) {
284 /* Don't bind to files */
285 hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
286 } else {
287 /* file system folder */
288 CLSID clsidFolder = CLSID_ShellFSFolder;
289 static const WCHAR wszCLSID[] = {'C','L','S','I','D',0};
290 WCHAR wszCLSIDValue[CHARS_IN_GUID], wszFolderPath[MAX_PATH], *pwszPathTail = wszFolderPath;
292 /* see if folder CLSID should be overridden by desktop.ini file */
293 if (pathRoot) {
294 lstrcpynW(wszFolderPath, pathRoot, MAX_PATH);
295 pwszPathTail = PathAddBackslashW(wszFolderPath);
298 _ILSimpleGetTextW(pidlChild,pwszPathTail,MAX_PATH - (int)(pwszPathTail - wszFolderPath));
300 if (SHELL32_GetCustomFolderAttributeFromPath (wszFolderPath,
301 wszDotShellClassInfo, wszCLSID, wszCLSIDValue, CHARS_IN_GUID))
302 CLSIDFromString (wszCLSIDValue, &clsidFolder);
304 hr = SHELL32_CoCreateInitSF (pidlRoot, pathRoot, pidlChild,
305 &clsidFolder, (LPVOID *)&pSF);
307 ILFree (pidlChild);
309 if (SUCCEEDED (hr)) {
310 if (_ILIsPidlSimple (pidlComplete)) {
311 /* no sub folders */
312 hr = IShellFolder_QueryInterface (pSF, riid, ppvOut);
313 } else {
314 /* go deeper */
315 hr = IShellFolder_BindToObject (pSF, ILGetNext (pidlComplete), NULL, riid, ppvOut);
317 IShellFolder_Release (pSF);
320 TRACE ("-- returning (%p) 0x%08x\n", *ppvOut, hr);
322 return hr;
325 /***********************************************************************
326 * SHELL32_GetDisplayNameOfChild
328 * Retrieves the display name of a child object of a shellfolder.
330 * For a pidl eg. [subpidl1][subpidl2][subpidl3]:
331 * - it binds to the child shellfolder [subpidl1]
332 * - asks it for the displayname of [subpidl2][subpidl3]
334 * Is possible the pidl is a simple pidl. In this case it asks the
335 * subfolder for the displayname of an empty pidl. The subfolder
336 * returns the own displayname eg. "::{guid}". This is used for
337 * virtual folders with the registry key WantsFORPARSING set.
339 HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
340 LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut, DWORD dwOutLen)
342 LPITEMIDLIST pidlFirst;
343 HRESULT hr;
345 TRACE ("(%p)->(pidl=%p 0x%08x %p 0x%08x)\n", psf, pidl, dwFlags, szOut, dwOutLen);
346 pdump (pidl);
348 pidlFirst = ILCloneFirst (pidl);
349 if (pidlFirst) {
350 IShellFolder2 *psfChild;
352 hr = IShellFolder2_BindToObject (psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID *) & psfChild);
353 if (SUCCEEDED (hr)) {
354 STRRET strTemp;
355 LPITEMIDLIST pidlNext = ILGetNext (pidl);
357 hr = IShellFolder2_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp);
358 if (SUCCEEDED (hr)) {
359 if(!StrRetToStrNW (szOut, dwOutLen, &strTemp, pidlNext))
360 hr = E_FAIL;
362 IShellFolder2_Release (psfChild);
364 ILFree (pidlFirst);
365 } else
366 hr = E_OUTOFMEMORY;
368 TRACE ("-- ret=0x%08x %s\n", hr, debugstr_w(szOut));
370 return hr;
373 /***********************************************************************
374 * SHELL32_GetItemAttributes
376 * NOTES
377 * Observed values:
378 * folder: 0xE0000177 FILESYSTEM | HASSUBFOLDER | FOLDER
379 * file: 0x40000177 FILESYSTEM
380 * drive: 0xf0000144 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR
381 * mycomputer: 0xb0000154 HASSUBFOLDER | FOLDER | FILESYSANCESTOR
382 * (seems to be default for shell extensions if no registry entry exists)
384 * win2k:
385 * folder: 0xF0400177 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR | CANMONIKER
386 * file: 0x40400177 FILESYSTEM | CANMONIKER
387 * drive 0xF0400154 FILESYSTEM | HASSUBFOLDER | FOLDER | FILESYSANCESTOR | CANMONIKER | CANRENAME (LABEL)
389 * According to the MSDN documentation this function should not set flags. It claims only to reset flags when necessary.
390 * However it turns out the native shell32.dll _sets_ flags in several cases - so do we.
392 HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
394 DWORD dwAttributes;
395 BOOL has_guid;
396 static const DWORD dwSupportedAttr=
397 SFGAO_CANCOPY | /*0x00000001 */
398 SFGAO_CANMOVE | /*0x00000002 */
399 SFGAO_CANLINK | /*0x00000004 */
400 SFGAO_CANRENAME | /*0x00000010 */
401 SFGAO_CANDELETE | /*0x00000020 */
402 SFGAO_HASPROPSHEET | /*0x00000040 */
403 SFGAO_DROPTARGET | /*0x00000100 */
404 SFGAO_LINK | /*0x00010000 */
405 SFGAO_READONLY | /*0x00040000 */
406 SFGAO_HIDDEN | /*0x00080000 */
407 SFGAO_FILESYSANCESTOR | /*0x10000000 */
408 SFGAO_FOLDER | /*0x20000000 */
409 SFGAO_FILESYSTEM | /*0x40000000 */
410 SFGAO_HASSUBFOLDER; /*0x80000000 */
412 TRACE ("0x%08x\n", *pdwAttributes);
414 if (*pdwAttributes & ~dwSupportedAttr)
416 WARN ("attributes 0x%08x not implemented\n", (*pdwAttributes & ~dwSupportedAttr));
417 *pdwAttributes &= dwSupportedAttr;
420 has_guid = _ILGetGUIDPointer(pidl) != NULL;
422 dwAttributes = *pdwAttributes;
424 if (_ILIsDrive (pidl)) {
425 *pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
426 SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
427 } else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
428 *pdwAttributes = dwAttributes;
429 } else if (_ILGetDataPointer (pidl)) {
430 dwAttributes = _ILGetFileAttributes (pidl, NULL, 0);
432 if (!dwAttributes && has_guid) {
433 WCHAR path[MAX_PATH];
434 STRRET strret;
436 /* File attributes are not present in the internal PIDL structure, so get them from the file system. */
438 HRESULT hr = IShellFolder2_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
439 if (SUCCEEDED(hr)) {
440 hr = StrRetToBufW(&strret, pidl, path, MAX_PATH);
442 /* call GetFileAttributes() only for file system paths, not for parsing names like "::{...}" */
443 if (SUCCEEDED(hr) && path[0]!=':')
444 dwAttributes = GetFileAttributesW(path);
448 /* Set common attributes */
449 *pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE |
450 SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANCOPY;
452 if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
453 *pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
454 else
455 *pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
457 if (dwAttributes & FILE_ATTRIBUTE_HIDDEN)
458 *pdwAttributes |= SFGAO_HIDDEN;
459 else
460 *pdwAttributes &= ~SFGAO_HIDDEN;
462 if (dwAttributes & FILE_ATTRIBUTE_READONLY)
463 *pdwAttributes |= SFGAO_READONLY;
464 else
465 *pdwAttributes &= ~SFGAO_READONLY;
467 if (SFGAO_LINK & *pdwAttributes) {
468 char ext[MAX_PATH];
470 if (!_ILGetExtension(pidl, ext, MAX_PATH) || lstrcmpiA(ext, "lnk"))
471 *pdwAttributes &= ~SFGAO_LINK;
473 } else {
474 *pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME|SFGAO_CANLINK;
476 TRACE ("-- 0x%08x\n", *pdwAttributes);
477 return S_OK;
480 /***********************************************************************
481 * SHELL32_CompareIDs
483 HRESULT SHELL32_CompareIDs(IShellFolder2 *sf, LPARAM lParam, LPCITEMIDLIST pidl1,
484 LPCITEMIDLIST pidl2)
486 int type1, type2;
487 char szTemp1[MAX_PATH];
488 char szTemp2[MAX_PATH];
489 HRESULT nReturn;
490 LPITEMIDLIST firstpidl, nextpidl1, nextpidl2;
491 IShellFolder *psf;
493 /* test for empty pidls */
494 BOOL isEmpty1 = _ILIsDesktop (pidl1);
495 BOOL isEmpty2 = _ILIsDesktop (pidl2);
497 if (isEmpty1 && isEmpty2)
498 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, 0 );
499 if (isEmpty1)
500 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, (WORD)-1 );
501 if (isEmpty2)
502 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, 1 );
504 /* test for different types. Sort order is the PT_* constant */
505 type1 = _ILGetDataPointer (pidl1)->type;
506 type2 = _ILGetDataPointer (pidl2)->type;
507 if (type1 < type2)
508 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, (WORD)-1 );
509 else if (type1 > type2)
510 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, 1 );
512 /* test for name of pidl */
513 _ILSimpleGetText (pidl1, szTemp1, MAX_PATH);
514 _ILSimpleGetText (pidl2, szTemp2, MAX_PATH);
515 nReturn = lstrcmpiA (szTemp1, szTemp2);
516 if (nReturn < 0)
517 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, (WORD)-1 );
518 else if (nReturn > 0)
519 return MAKE_HRESULT( SEVERITY_SUCCESS, 0, 1 );
521 /* test of complex pidls */
522 firstpidl = ILCloneFirst (pidl1);
523 nextpidl1 = ILGetNext (pidl1);
524 nextpidl2 = ILGetNext (pidl2);
526 /* optimizing: test special cases and bind not deeper */
527 /* the deeper shellfolder would do the same */
528 isEmpty1 = _ILIsDesktop (nextpidl1);
529 isEmpty2 = _ILIsDesktop (nextpidl2);
531 if (isEmpty1 && isEmpty2) {
532 nReturn = MAKE_HRESULT( SEVERITY_SUCCESS, 0, 0 );
533 } else if (isEmpty1) {
534 nReturn = MAKE_HRESULT( SEVERITY_SUCCESS, 0, (WORD)-1 );
535 } else if (isEmpty2) {
536 nReturn = MAKE_HRESULT( SEVERITY_SUCCESS, 0, 1 );
537 /* optimizing end */
538 } else if (SUCCEEDED(IShellFolder2_BindToObject(sf, firstpidl, NULL, &IID_IShellFolder, (void **)&psf))) {
539 nReturn = IShellFolder_CompareIDs (psf, lParam, nextpidl1, nextpidl2);
540 IShellFolder_Release (psf);
542 ILFree (firstpidl);
543 return nReturn;
546 HRESULT SHELL32_GetColumnDetails(const shvheader *data, int column, SHELLDETAILS *details)
548 details->fmt = data[column].fmt;
549 details->cxChar = data[column].cxChar;
551 if (SHELL_OsIsUnicode())
553 details->str.u.pOleStr = CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR));
554 if (!details->str.u.pOleStr) return E_OUTOFMEMORY;
556 details->str.uType = STRRET_WSTR;
557 LoadStringW(shell32_hInstance, data[column].colnameid, details->str.u.pOleStr, MAX_PATH);
559 else
561 details->str.uType = STRRET_CSTR;
562 LoadStringA(shell32_hInstance, data[column].colnameid, details->str.u.cStr, MAX_PATH);
565 return S_OK;
568 HRESULT shellfolder_map_column_to_scid(const shvheader *header, UINT column, SHCOLUMNID *scid)
570 if (header[column].fmtid == NULL)
572 FIXME("missing property id for column %u.\n", column);
573 memset(scid, 0, sizeof(*scid));
574 return E_NOTIMPL;
577 scid->fmtid = *header[column].fmtid;
578 scid->pid = header[column].pid;
580 return S_OK;
583 /***********************************************************************
584 * SHCreateLinks
586 * Undocumented.
588 HRESULT WINAPI SHCreateLinks( HWND hWnd, LPCSTR lpszDir, LPDATAOBJECT lpDataObject,
589 UINT uFlags, LPITEMIDLIST *lppidlLinks)
591 FIXME("%p %s %p %08x %p\n",hWnd,lpszDir,lpDataObject,uFlags,lppidlLinks);
592 return E_NOTIMPL;
595 /***********************************************************************
596 * SHOpenFolderAndSelectItems
598 * Added in XP.
600 HRESULT WINAPI SHOpenFolderAndSelectItems( PCIDLIST_ABSOLUTE pidlFolder, UINT cidl,
601 PCUITEMID_CHILD_ARRAY *apidl, DWORD flags )
603 FIXME("%p %u %p 0x%x: stub\n", pidlFolder, cidl, apidl, flags);
604 return E_NOTIMPL;
607 /***********************************************************************
608 * SHGetSetFolderCustomSettings (SHELL32.709)
610 * Only Unicode above Server 2003, writes/reads from a Desktop.ini
612 HRESULT WINAPI SHGetSetFolderCustomSettings( LPSHFOLDERCUSTOMSETTINGS fcs, PCWSTR path, DWORD flag )
614 static const WCHAR iconresourceW[] = {'I','c','o','n','R','e','s','o','u','r','c','e',0};
615 static const WCHAR desktop_iniW[] = {'D','e','s','k','t','o','p','.','i','n','i',0};
616 WCHAR bufferW[MAX_PATH];
617 HRESULT hr;
619 hr = E_FAIL;
620 bufferW[0] = 0;
622 if (!fcs || !path)
623 return hr;
625 if (flag & FCS_FORCEWRITE)
627 if (fcs->dwMask & FCSM_ICONFILE)
629 lstrcpyW(bufferW, path);
630 PathAddBackslashW(bufferW);
631 lstrcatW(bufferW, desktop_iniW);
633 if (WritePrivateProfileStringW(wszDotShellClassInfo, iconresourceW, fcs->pszIconFile, bufferW))
635 TRACE("Wrote an iconresource entry %s into %s\n", debugstr_w(fcs->pszIconFile), debugstr_w(bufferW));
636 hr = S_OK;
638 else
639 ERR("Failed to write (to) Desktop.ini file\n");
642 else
643 FIXME("%p %s 0x%x: stub\n", fcs, debugstr_w(path), flag);
645 return hr;
648 /***********************************************************************
649 * SHLimitInputEdit (SHELL32.747)
651 HRESULT WINAPI SHLimitInputEdit( HWND textbox, IShellFolder *folder )
653 FIXME("%p %p: stub\n", textbox, folder);
654 return E_NOTIMPL;