dsound: Get rid of redundant NULL check.
[wine/multimedia.git] / dlls / shell32 / shellord.c
blobac06e4bf600a7e2be5832b18fe0c2016619fa5d7
1 /*
2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
5 * Copyright 1997 Marcus Meissner
6 * 1998 Jürgen Schmied
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.
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.
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
22 #include "config.h"
24 #include <string.h>
25 #include <stdarg.h>
26 #include <stdio.h>
28 #define COBJMACROS
30 #include "winerror.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winreg.h"
34 #include "wine/debug.h"
35 #include "winnls.h"
36 #include "winternl.h"
38 #include "shellapi.h"
39 #include "objbase.h"
40 #include "shlguid.h"
41 #include "wingdi.h"
42 #include "winuser.h"
43 #include "shlobj.h"
44 #include "shell32_main.h"
45 #include "undocshell.h"
46 #include "pidl.h"
47 #include "shlwapi.h"
48 #include "commdlg.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(shell);
51 WINE_DECLARE_DEBUG_CHANNEL(pidl);
53 /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
54 /* !!! it is in both here and comctl32undoc.c !!! */
55 typedef struct tagCREATEMRULIST
57 DWORD cbSize; /* size of struct */
58 DWORD nMaxItems; /* max no. of items in list */
59 DWORD dwFlags; /* see below */
60 HKEY hKey; /* root reg. key under which list is saved */
61 LPCSTR lpszSubKey; /* reg. subkey */
62 PROC lpfnCompare; /* item compare proc */
63 } CREATEMRULISTA, *LPCREATEMRULISTA;
65 /* dwFlags */
66 #define MRUF_STRING_LIST 0 /* list will contain strings */
67 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
68 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
70 extern HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml);
71 extern DWORD WINAPI FreeMRUList(HANDLE hMRUList);
72 extern INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData);
73 extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
74 extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
77 /* Get a function pointer from a DLL handle */
78 #define GET_FUNC(func, module, name, fail) \
79 do { \
80 if (!func) { \
81 if (!SHELL32_h##module && !(SHELL32_h##module = LoadLibraryA(#module ".dll"))) return fail; \
82 func = (void*)GetProcAddress(SHELL32_h##module, name); \
83 if (!func) return fail; \
84 } \
85 } while (0)
87 /* Function pointers for GET_FUNC macro */
88 static HMODULE SHELL32_hshlwapi=NULL;
89 static HANDLE (WINAPI *pSHAllocShared)(LPCVOID,DWORD,DWORD);
90 static LPVOID (WINAPI *pSHLockShared)(HANDLE,DWORD);
91 static BOOL (WINAPI *pSHUnlockShared)(LPVOID);
92 static BOOL (WINAPI *pSHFreeShared)(HANDLE,DWORD);
95 /*************************************************************************
96 * ParseFieldA [internal]
98 * copies a field from a ',' delimited string
100 * first field is nField = 1
102 DWORD WINAPI ParseFieldA(
103 LPCSTR src,
104 DWORD nField,
105 LPSTR dst,
106 DWORD len)
108 WARN("(%s,0x%08x,%p,%d) semi-stub.\n",debugstr_a(src),nField,dst,len);
110 if (!src || !src[0] || !dst || !len)
111 return 0;
113 /* skip n fields delimited by ',' */
114 while (nField > 1)
116 if (*src=='\0') return FALSE;
117 if (*(src++)==',') nField--;
120 /* copy part till the next ',' to dst */
121 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
123 /* finalize the string */
124 *dst=0x0;
126 return TRUE;
129 /*************************************************************************
130 * ParseFieldW [internal]
132 * copies a field from a ',' delimited string
134 * first field is nField = 1
136 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
138 WARN("(%s,0x%08x,%p,%d) semi-stub.\n", debugstr_w(src), nField, dst, len);
140 if (!src || !src[0] || !dst || !len)
141 return 0;
143 /* skip n fields delimited by ',' */
144 while (nField > 1)
146 if (*src == 0x0) return FALSE;
147 if (*src++ == ',') nField--;
150 /* copy part till the next ',' to dst */
151 while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);
153 /* finalize the string */
154 *dst = 0x0;
156 return TRUE;
159 /*************************************************************************
160 * ParseField [SHELL32.58]
162 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
164 if (SHELL_OsIsUnicode())
165 return ParseFieldW(src, nField, dst, len);
166 return ParseFieldA(src, nField, dst, len);
169 /*************************************************************************
170 * GetFileNameFromBrowse [SHELL32.63]
173 BOOL WINAPI GetFileNameFromBrowse(
174 HWND hwndOwner,
175 LPSTR lpstrFile,
176 DWORD nMaxFile,
177 LPCSTR lpstrInitialDir,
178 LPCSTR lpstrDefExt,
179 LPCSTR lpstrFilter,
180 LPCSTR lpstrTitle)
182 HMODULE hmodule;
183 BOOL (WINAPI *pGetOpenFileNameA)(LPOPENFILENAMEA);
184 OPENFILENAMEA ofn;
185 BOOL ret;
187 TRACE("%p, %s, %d, %s, %s, %s, %s)\n",
188 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
189 lpstrFilter, lpstrTitle);
191 hmodule = LoadLibraryA("comdlg32.dll");
192 if(!hmodule) return FALSE;
193 pGetOpenFileNameA = (void *)GetProcAddress(hmodule, "GetOpenFileNameA");
194 if(!pGetOpenFileNameA)
196 FreeLibrary(hmodule);
197 return FALSE;
200 memset(&ofn, 0, sizeof(ofn));
202 ofn.lStructSize = sizeof(ofn);
203 ofn.hwndOwner = hwndOwner;
204 ofn.lpstrFilter = lpstrFilter;
205 ofn.lpstrFile = lpstrFile;
206 ofn.nMaxFile = nMaxFile;
207 ofn.lpstrInitialDir = lpstrInitialDir;
208 ofn.lpstrTitle = lpstrTitle;
209 ofn.lpstrDefExt = lpstrDefExt;
210 ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
211 ret = pGetOpenFileNameA(&ofn);
213 FreeLibrary(hmodule);
214 return ret;
217 /*************************************************************************
218 * SHGetSetSettings [SHELL32.68]
220 VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
222 if(bSet)
224 FIXME("%p 0x%08x TRUE\n", lpss, dwMask);
226 else
228 SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask);
232 /*************************************************************************
233 * SHGetSettings [SHELL32.@]
235 * NOTES
236 * the registry path are for win98 (tested)
237 * and possibly are the same in nt40
240 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
242 HKEY hKey;
243 DWORD dwData;
244 DWORD dwDataSize = sizeof (DWORD);
246 TRACE("(%p 0x%08x)\n",lpsfs,dwMask);
248 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
249 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
250 return;
252 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
253 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
255 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
256 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
258 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
259 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
261 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
262 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
264 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
265 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
267 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
268 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
270 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
271 { if (dwData == 0)
272 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
273 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
275 else if (dwData == 1)
276 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
277 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
279 else if (dwData == 2)
280 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
281 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
284 RegCloseKey (hKey);
286 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
289 /*************************************************************************
290 * SHShellFolderView_Message [SHELL32.73]
292 * Send a message to an explorer cabinet window.
294 * PARAMS
295 * hwndCabinet [I] The window containing the shellview to communicate with
296 * dwMessage [I] The SFVM message to send
297 * dwParam [I] Message parameter
299 * RETURNS
300 * fixme.
302 * NOTES
303 * Message SFVM_REARRANGE = 1
305 * This message gets sent when a column gets clicked to instruct the
306 * shell view to re-sort the item list. dwParam identifies the column
307 * that was clicked.
309 LRESULT WINAPI SHShellFolderView_Message(
310 HWND hwndCabinet,
311 UINT uMessage,
312 LPARAM lParam)
314 FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam);
315 return 0;
318 /*************************************************************************
319 * RegisterShellHook [SHELL32.181]
321 * Register a shell hook.
323 * PARAMS
324 * hwnd [I] Window handle
325 * dwType [I] Type of hook.
327 * NOTES
328 * Exported by ordinal
330 BOOL WINAPI RegisterShellHook(
331 HWND hWnd,
332 DWORD dwType)
334 FIXME("(%p,0x%08x):stub.\n",hWnd, dwType);
335 return TRUE;
338 /*************************************************************************
339 * ShellMessageBoxW [SHELL32.182]
341 * See ShellMessageBoxA.
343 * NOTE:
344 * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
345 * because we can't forward to it in the .spec file since it's exported by
346 * ordinal. If you change the implementation here please update the code in
347 * shlwapi as well.
349 int WINAPIV ShellMessageBoxW(
350 HINSTANCE hInstance,
351 HWND hWnd,
352 LPCWSTR lpText,
353 LPCWSTR lpCaption,
354 UINT uType,
355 ...)
357 WCHAR szText[100],szTitle[100];
358 LPCWSTR pszText = szText, pszTitle = szTitle;
359 LPWSTR pszTemp;
360 __ms_va_list args;
361 int ret;
363 __ms_va_start(args, uType);
364 /* wvsprintfA(buf,fmt, args); */
366 TRACE("(%p,%p,%p,%p,%08x)\n",
367 hInstance,hWnd,lpText,lpCaption,uType);
369 if (IS_INTRESOURCE(lpCaption))
370 LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
371 else
372 pszTitle = lpCaption;
374 if (IS_INTRESOURCE(lpText))
375 LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0]));
376 else
377 pszText = lpText;
379 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
380 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
382 __ms_va_end(args);
384 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
385 LocalFree(pszTemp);
386 return ret;
389 /*************************************************************************
390 * ShellMessageBoxA [SHELL32.183]
392 * Format and output an error message.
394 * PARAMS
395 * hInstance [I] Instance handle of message creator
396 * hWnd [I] Window handle of message creator
397 * lpText [I] Resource Id of title or LPSTR
398 * lpCaption [I] Resource Id of title or LPSTR
399 * uType [I] Type of error message
401 * RETURNS
402 * A return value from MessageBoxA().
404 * NOTES
405 * Exported by ordinal
407 int WINAPIV ShellMessageBoxA(
408 HINSTANCE hInstance,
409 HWND hWnd,
410 LPCSTR lpText,
411 LPCSTR lpCaption,
412 UINT uType,
413 ...)
415 char szText[100],szTitle[100];
416 LPCSTR pszText = szText, pszTitle = szTitle;
417 LPSTR pszTemp;
418 __ms_va_list args;
419 int ret;
421 __ms_va_start(args, uType);
422 /* wvsprintfA(buf,fmt, args); */
424 TRACE("(%p,%p,%p,%p,%08x)\n",
425 hInstance,hWnd,lpText,lpCaption,uType);
427 if (IS_INTRESOURCE(lpCaption))
428 LoadStringA(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle));
429 else
430 pszTitle = lpCaption;
432 if (IS_INTRESOURCE(lpText))
433 LoadStringA(hInstance, LOWORD(lpText), szText, sizeof(szText));
434 else
435 pszText = lpText;
437 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
438 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
440 __ms_va_end(args);
442 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
443 LocalFree(pszTemp);
444 return ret;
447 /*************************************************************************
448 * SHRegisterDragDrop [SHELL32.86]
450 * Probably equivalent to RegisterDragDrop but under Windows 95 it could use the
451 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
452 * for details. Under Windows 98 this function initializes the true OLE when called
453 * the first time, on XP always returns E_OUTOFMEMORY and it got removed from Vista.
455 * We follow Windows 98 behaviour.
457 * NOTES
458 * exported by ordinal
460 * SEE ALSO
461 * RegisterDragDrop, SHLoadOLE
463 HRESULT WINAPI SHRegisterDragDrop(
464 HWND hWnd,
465 LPDROPTARGET pDropTarget)
467 static BOOL ole_initialized = FALSE;
468 HRESULT hr;
470 TRACE("(%p,%p)\n", hWnd, pDropTarget);
472 if (!ole_initialized)
474 hr = OleInitialize(NULL);
475 if (FAILED(hr))
476 return hr;
477 ole_initialized = TRUE;
479 return RegisterDragDrop(hWnd, pDropTarget);
482 /*************************************************************************
483 * SHRevokeDragDrop [SHELL32.87]
485 * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the
486 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
487 * for details. Function removed from Windows Vista.
489 * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was
490 * not called.
492 * NOTES
493 * exported by ordinal
495 * SEE ALSO
496 * RevokeDragDrop, SHLoadOLE
498 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
500 TRACE("(%p)\n", hWnd);
501 return RevokeDragDrop(hWnd);
504 /*************************************************************************
505 * SHDoDragDrop [SHELL32.88]
507 * Probably equivalent to DoDragDrop but under Windows 9x it could use the
508 * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
509 * for details
511 * NOTES
512 * exported by ordinal
514 * SEE ALSO
515 * DoDragDrop, SHLoadOLE
517 HRESULT WINAPI SHDoDragDrop(
518 HWND hWnd,
519 LPDATAOBJECT lpDataObject,
520 LPDROPSOURCE lpDropSource,
521 DWORD dwOKEffect,
522 LPDWORD pdwEffect)
524 FIXME("(%p %p %p 0x%08x %p):stub.\n",
525 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
526 return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
529 /*************************************************************************
530 * ArrangeWindows [SHELL32.184]
533 WORD WINAPI ArrangeWindows(
534 HWND hwndParent,
535 DWORD dwReserved,
536 LPCRECT lpRect,
537 WORD cKids,
538 CONST HWND * lpKids)
540 FIXME("(%p 0x%08x %p 0x%04x %p):stub.\n",
541 hwndParent, dwReserved, lpRect, cKids, lpKids);
542 return 0;
545 /*************************************************************************
546 * SignalFileOpen [SHELL32.103]
548 * NOTES
549 * exported by ordinal
551 DWORD WINAPI
552 SignalFileOpen (DWORD dwParam1)
554 FIXME("(0x%08x):stub.\n", dwParam1);
556 return 0;
559 /*************************************************************************
560 * SHADD_get_policy - helper function for SHAddToRecentDocs
562 * PARAMETERS
563 * policy [IN] policy name (null termed string) to find
564 * type [OUT] ptr to DWORD to receive type
565 * buffer [OUT] ptr to area to hold data retrieved
566 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
567 * length filled
569 * RETURNS
570 * result of the SHQueryValueEx call
572 static INT SHADD_get_policy(LPCSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
574 HKEY Policy_basekey;
575 INT ret;
577 /* Get the key for the policies location in the registry
579 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
580 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
581 0, KEY_READ, &Policy_basekey)) {
583 if (RegOpenKeyExA(HKEY_CURRENT_USER,
584 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
585 0, KEY_READ, &Policy_basekey)) {
586 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
587 policy);
588 *len = 0;
589 return ERROR_FILE_NOT_FOUND;
593 /* Retrieve the data if it exists
595 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
596 RegCloseKey(Policy_basekey);
597 return ret;
601 /*************************************************************************
602 * SHADD_compare_mru - helper function for SHAddToRecentDocs
604 * PARAMETERS
605 * data1 [IN] data being looked for
606 * data2 [IN] data in MRU
607 * cbdata [IN] length from FindMRUData call (not used)
609 * RETURNS
610 * position within MRU list that data was added.
612 static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
614 return lstrcmpiA(data1, data2);
617 /*************************************************************************
618 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
620 * PARAMETERS
621 * mruhandle [IN] handle for created MRU list
622 * doc_name [IN] null termed pure doc name
623 * new_lnk_name [IN] null termed path and file name for .lnk file
624 * buffer [IN/OUT] 2048 byte area to construct MRU data
625 * len [OUT] ptr to int to receive space used in buffer
627 * RETURNS
628 * position within MRU list that data was added.
630 static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR new_lnk_name,
631 LPSTR buffer, INT *len)
633 LPSTR ptr;
634 INT wlen;
636 /*FIXME: Document:
637 * RecentDocs MRU data structure seems to be:
638 * +0h document file name w/ terminating 0h
639 * +nh short int w/ size of remaining
640 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
641 * +n+4h 10 bytes zeros - unknown
642 * +n+eh shortcut file name w/ terminating 0h
643 * +n+e+nh 3 zero bytes - unknown
646 /* Create the MRU data structure for "RecentDocs"
648 ptr = buffer;
649 lstrcpyA(ptr, doc_name);
650 ptr += (lstrlenA(buffer) + 1);
651 wlen= lstrlenA(new_lnk_name) + 1 + 12;
652 *((short int*)ptr) = wlen;
653 ptr += 2; /* step past the length */
654 *(ptr++) = 0x30; /* unknown reason */
655 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
656 memset(ptr, 0, 10);
657 ptr += 10;
658 lstrcpyA(ptr, new_lnk_name);
659 ptr += (lstrlenA(new_lnk_name) + 1);
660 memset(ptr, 0, 3);
661 ptr += 3;
662 *len = ptr - buffer;
664 /* Add the new entry into the MRU list
666 return AddMRUData(mruhandle, buffer, *len);
669 /*************************************************************************
670 * SHAddToRecentDocs [SHELL32.@]
672 * Modify (add/clear) Shell's list of recently used documents.
674 * PARAMETERS
675 * uFlags [IN] SHARD_PATHA, SHARD_PATHW or SHARD_PIDL
676 * pv [IN] string or pidl, NULL clears the list
678 * NOTES
679 * exported by name
681 * FIXME
682 * convert to unicode
684 void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
686 /* If list is a string list lpfnCompare has the following prototype
687 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
688 * for binary lists the prototype is
689 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
690 * where cbData is the no. of bytes to compare.
691 * Need to check what return value means identical - 0?
695 UINT olderrormode;
696 HKEY HCUbasekey;
697 CHAR doc_name[MAX_PATH];
698 CHAR link_dir[MAX_PATH];
699 CHAR new_lnk_filepath[MAX_PATH];
700 CHAR new_lnk_name[MAX_PATH];
701 IMalloc *ppM;
702 LPITEMIDLIST pidl;
703 HWND hwnd = 0; /* FIXME: get real window handle */
704 INT ret;
705 DWORD data[64], datalen, type;
707 TRACE("%04x %p\n", uFlags, pv);
709 /*FIXME: Document:
710 * RecentDocs MRU data structure seems to be:
711 * +0h document file name w/ terminating 0h
712 * +nh short int w/ size of remaining
713 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
714 * +n+4h 10 bytes zeros - unknown
715 * +n+eh shortcut file name w/ terminating 0h
716 * +n+e+nh 3 zero bytes - unknown
719 /* See if we need to do anything.
721 datalen = 64;
722 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, data, &datalen);
723 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
724 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
725 return;
727 if (ret == ERROR_SUCCESS) {
728 if (!( (type == REG_DWORD) ||
729 ((type == REG_BINARY) && (datalen == 4)) )) {
730 ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n",
731 type, datalen);
732 return;
735 TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]);
736 /* now test the actual policy value */
737 if ( data[0] != 0)
738 return;
741 /* Open key to where the necessary info is
743 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
744 * and the close should be done during the _DETACH. The resulting
745 * key is stored in the DLL global data.
747 if (RegCreateKeyExA(HKEY_CURRENT_USER,
748 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
749 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
750 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
751 return;
754 /* Get path to user's "Recent" directory
756 if(SUCCEEDED(SHGetMalloc(&ppM))) {
757 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
758 &pidl))) {
759 SHGetPathFromIDListA(pidl, link_dir);
760 IMalloc_Free(ppM, pidl);
762 else {
763 /* serious issues */
764 link_dir[0] = 0;
765 ERR("serious issues 1\n");
767 IMalloc_Release(ppM);
769 else {
770 /* serious issues */
771 link_dir[0] = 0;
772 ERR("serious issues 2\n");
774 TRACE("Users Recent dir %s\n", link_dir);
776 /* If no input, then go clear the lists */
777 if (!pv) {
778 /* clear user's Recent dir
781 /* FIXME: delete all files in "link_dir"
783 * while( more files ) {
784 * lstrcpyA(old_lnk_name, link_dir);
785 * PathAppendA(old_lnk_name, filenam);
786 * DeleteFileA(old_lnk_name);
789 FIXME("should delete all files in %s\\\n", link_dir);
791 /* clear MRU list
793 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
794 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
795 * and naturally it fails w/ rc=2. It should do it against
796 * HKEY_CURRENT_USER which is where it is stored, and where
797 * the MRU routines expect it!!!!
799 RegDeleteKeyA(HCUbasekey, "RecentDocs");
800 RegCloseKey(HCUbasekey);
801 return;
804 /* Have data to add, the jobs to be done:
805 * 1. Add document to MRU list in registry "HKCU\Software\
806 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
807 * 2. Add shortcut to document in the user's Recent directory
808 * (CSIDL_RECENT).
809 * 3. Add shortcut to Start menu's Documents submenu.
812 /* Get the pure document name from the input
814 switch (uFlags)
816 case SHARD_PIDL:
817 SHGetPathFromIDListA(pv, doc_name);
818 break;
820 case SHARD_PATHA:
821 lstrcpynA(doc_name, pv, MAX_PATH);
822 break;
824 case SHARD_PATHW:
825 WideCharToMultiByte(CP_ACP, 0, pv, -1, doc_name, MAX_PATH, NULL, NULL);
826 break;
828 default:
829 FIXME("Unsupported flags: %u\n", uFlags);
830 return;
833 TRACE("full document name %s\n", debugstr_a(doc_name));
834 PathStripPathA(doc_name);
835 TRACE("stripped document name %s\n", debugstr_a(doc_name));
838 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
840 { /* on input needs:
841 * doc_name - pure file-spec, no path
842 * link_dir - path to the user's Recent directory
843 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
844 * creates:
845 * new_lnk_name- pure file-spec, no path for new .lnk file
846 * new_lnk_filepath
847 * - path and file name of new .lnk file
849 CREATEMRULISTA mymru;
850 HANDLE mruhandle;
851 INT len, pos, bufused, err;
852 INT i;
853 DWORD attr;
854 CHAR buffer[2048];
855 CHAR *ptr;
856 CHAR old_lnk_name[MAX_PATH];
857 short int slen;
859 mymru.cbSize = sizeof(CREATEMRULISTA);
860 mymru.nMaxItems = 15;
861 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
862 mymru.hKey = HCUbasekey;
863 mymru.lpszSubKey = "RecentDocs";
864 mymru.lpfnCompare = (PROC)SHADD_compare_mru;
865 mruhandle = CreateMRUListA(&mymru);
866 if (!mruhandle) {
867 /* MRU failed */
868 ERR("MRU processing failed, handle zero\n");
869 RegCloseKey(HCUbasekey);
870 return;
872 len = lstrlenA(doc_name);
873 pos = FindMRUData(mruhandle, doc_name, len, 0);
875 /* Now get the MRU entry that will be replaced
876 * and delete the .lnk file for it
878 if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
879 buffer, 2048)) != -1) {
880 ptr = buffer;
881 ptr += (lstrlenA(buffer) + 1);
882 slen = *((short int*)ptr);
883 ptr += 2; /* skip the length area */
884 if (bufused >= slen + (ptr-buffer)) {
885 /* buffer size looks good */
886 ptr += 12; /* get to string */
887 len = bufused - (ptr-buffer); /* get length of buf remaining */
888 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
889 /* appears to be good string */
890 lstrcpyA(old_lnk_name, link_dir);
891 PathAppendA(old_lnk_name, ptr);
892 if (!DeleteFileA(old_lnk_name)) {
893 if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) {
894 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
895 ERR("Delete for %s failed, err=%d, attr=%08x\n",
896 old_lnk_name, err, attr);
898 else {
899 TRACE("old .lnk file %s did not exist\n",
900 old_lnk_name);
903 else {
904 ERR("Delete for %s failed, attr=%08x\n",
905 old_lnk_name, attr);
908 else {
909 TRACE("deleted old .lnk file %s\n", old_lnk_name);
915 /* Create usable .lnk file name for the "Recent" directory
917 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
918 lstrcpyA(new_lnk_filepath, link_dir);
919 PathAppendA(new_lnk_filepath, new_lnk_name);
920 i = 1;
921 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
922 while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) {
923 i++;
924 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
925 lstrcpyA(new_lnk_filepath, link_dir);
926 PathAppendA(new_lnk_filepath, new_lnk_name);
928 SetErrorMode(olderrormode);
929 TRACE("new shortcut will be %s\n", new_lnk_filepath);
931 /* Now add the new MRU entry and data
933 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
934 buffer, &len);
935 FreeMRUList(mruhandle);
936 TRACE("Updated MRU list, new doc is position %d\n", pos);
939 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
941 { /* on input needs:
942 * doc_name - pure file-spec, no path
943 * new_lnk_filepath
944 * - path and file name of new .lnk file
945 * uFlags[in] - flags on call to SHAddToRecentDocs
946 * pv[in] - document path/pidl on call to SHAddToRecentDocs
948 IShellLinkA *psl = NULL;
949 IPersistFile *pPf = NULL;
950 HRESULT hres;
951 CHAR desc[MAX_PATH];
952 WCHAR widelink[MAX_PATH];
954 CoInitialize(0);
956 hres = CoCreateInstance( &CLSID_ShellLink,
957 NULL,
958 CLSCTX_INPROC_SERVER,
959 &IID_IShellLinkA,
960 (LPVOID )&psl);
961 if(SUCCEEDED(hres)) {
963 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
964 (LPVOID *)&pPf);
965 if(FAILED(hres)) {
966 /* bombed */
967 ERR("failed QueryInterface for IPersistFile %08x\n", hres);
968 goto fail;
971 /* Set the document path or pidl */
972 if (uFlags == SHARD_PIDL) {
973 hres = IShellLinkA_SetIDList(psl, pv);
974 } else {
975 hres = IShellLinkA_SetPath(psl, pv);
977 if(FAILED(hres)) {
978 /* bombed */
979 ERR("failed Set{IDList|Path} %08x\n", hres);
980 goto fail;
983 lstrcpyA(desc, "Shortcut to ");
984 lstrcatA(desc, doc_name);
985 hres = IShellLinkA_SetDescription(psl, desc);
986 if(FAILED(hres)) {
987 /* bombed */
988 ERR("failed SetDescription %08x\n", hres);
989 goto fail;
992 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
993 widelink, MAX_PATH);
994 /* create the short cut */
995 hres = IPersistFile_Save(pPf, widelink, TRUE);
996 if(FAILED(hres)) {
997 /* bombed */
998 ERR("failed IPersistFile::Save %08x\n", hres);
999 IPersistFile_Release(pPf);
1000 IShellLinkA_Release(psl);
1001 goto fail;
1003 hres = IPersistFile_SaveCompleted(pPf, widelink);
1004 IPersistFile_Release(pPf);
1005 IShellLinkA_Release(psl);
1006 TRACE("shortcut %s has been created, result=%08x\n",
1007 new_lnk_filepath, hres);
1009 else {
1010 ERR("CoCreateInstance failed, hres=%08x\n", hres);
1014 fail:
1015 CoUninitialize();
1017 /* all done */
1018 RegCloseKey(HCUbasekey);
1019 return;
1022 /*************************************************************************
1023 * SHCreateShellFolderViewEx [SHELL32.174]
1025 * Create a new instance of the default Shell folder view object.
1027 * RETURNS
1028 * Success: S_OK
1029 * Failure: error value
1031 * NOTES
1032 * see IShellFolder::CreateViewObject
1034 HRESULT WINAPI SHCreateShellFolderViewEx(
1035 LPCSFV psvcbi, /* [in] shelltemplate struct */
1036 IShellView **ppv) /* [out] IShellView pointer */
1038 IShellView * psf;
1039 HRESULT hRes;
1041 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
1042 psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
1043 psvcbi->fvm, psvcbi->psvOuter);
1045 psf = IShellView_Constructor(psvcbi->pshf);
1047 if (!psf)
1048 return E_OUTOFMEMORY;
1050 IShellView_AddRef(psf);
1051 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
1052 IShellView_Release(psf);
1054 return hRes;
1056 /*************************************************************************
1057 * SHWinHelp [SHELL32.127]
1060 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
1061 { FIXME("0x%08x 0x%08x 0x%08x 0x%08x stub\n",v,w,x,z);
1062 return 0;
1064 /*************************************************************************
1065 * SHRunControlPanel [SHELL32.161]
1068 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
1069 { FIXME("0x%08x 0x%08x stub\n",x,z);
1070 return 0;
1073 static LPUNKNOWN SHELL32_IExplorerInterface=0;
1074 /*************************************************************************
1075 * SHSetInstanceExplorer [SHELL32.176]
1077 * NOTES
1078 * Sets the interface
1080 VOID WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
1081 { TRACE("%p\n", lpUnknown);
1082 SHELL32_IExplorerInterface = lpUnknown;
1084 /*************************************************************************
1085 * SHGetInstanceExplorer [SHELL32.@]
1087 * NOTES
1088 * gets the interface pointer of the explorer and a reference
1090 HRESULT WINAPI SHGetInstanceExplorer (IUnknown **lpUnknown)
1091 { TRACE("%p\n", lpUnknown);
1093 *lpUnknown = SHELL32_IExplorerInterface;
1095 if (!SHELL32_IExplorerInterface)
1096 return E_FAIL;
1098 IUnknown_AddRef(SHELL32_IExplorerInterface);
1099 return NOERROR;
1101 /*************************************************************************
1102 * SHFreeUnusedLibraries [SHELL32.123]
1104 * Probably equivalent to CoFreeUnusedLibraries but under Windows 9x it could use
1105 * the shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE
1106 * for details
1108 * NOTES
1109 * exported by ordinal
1111 * SEE ALSO
1112 * CoFreeUnusedLibraries, SHLoadOLE
1114 void WINAPI SHFreeUnusedLibraries (void)
1116 FIXME("stub\n");
1117 CoFreeUnusedLibraries();
1119 /*************************************************************************
1120 * DAD_AutoScroll [SHELL32.129]
1123 BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, LPPOINT pt)
1125 FIXME("hwnd = %p %p %p\n",hwnd,samples,pt);
1126 return 0;
1128 /*************************************************************************
1129 * DAD_DragEnter [SHELL32.130]
1132 BOOL WINAPI DAD_DragEnter(HWND hwnd)
1134 FIXME("hwnd = %p\n",hwnd);
1135 return FALSE;
1137 /*************************************************************************
1138 * DAD_DragEnterEx [SHELL32.131]
1141 BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p)
1143 FIXME("hwnd = %p (%d,%d)\n",hwnd,p.x,p.y);
1144 return FALSE;
1146 /*************************************************************************
1147 * DAD_DragMove [SHELL32.134]
1150 BOOL WINAPI DAD_DragMove(POINT p)
1152 FIXME("(%d,%d)\n",p.x,p.y);
1153 return FALSE;
1155 /*************************************************************************
1156 * DAD_DragLeave [SHELL32.132]
1159 BOOL WINAPI DAD_DragLeave(VOID)
1161 FIXME("\n");
1162 return FALSE;
1164 /*************************************************************************
1165 * DAD_SetDragImage [SHELL32.136]
1167 * NOTES
1168 * exported by name
1170 BOOL WINAPI DAD_SetDragImage(
1171 HIMAGELIST himlTrack,
1172 LPPOINT lppt)
1174 FIXME("%p %p stub\n",himlTrack, lppt);
1175 return 0;
1177 /*************************************************************************
1178 * DAD_ShowDragImage [SHELL32.137]
1180 * NOTES
1181 * exported by name
1183 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1185 FIXME("0x%08x stub\n",bShow);
1186 return 0;
1189 static const WCHAR szwCabLocation[] = {
1190 'S','o','f','t','w','a','r','e','\\',
1191 'M','i','c','r','o','s','o','f','t','\\',
1192 'W','i','n','d','o','w','s','\\',
1193 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1194 'E','x','p','l','o','r','e','r','\\',
1195 'C','a','b','i','n','e','t','S','t','a','t','e',0
1198 static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 };
1200 /*************************************************************************
1201 * ReadCabinetState [SHELL32.651] NT 4.0
1204 BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
1206 HKEY hkey = 0;
1207 DWORD type, r;
1209 TRACE("%p %d\n", cs, length);
1211 if( (cs == NULL) || (length < (int)sizeof(*cs)) )
1212 return FALSE;
1214 r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey );
1215 if( r == ERROR_SUCCESS )
1217 type = REG_BINARY;
1218 r = RegQueryValueExW( hkey, szwSettings,
1219 NULL, &type, (LPBYTE)cs, (LPDWORD)&length );
1220 RegCloseKey( hkey );
1224 /* if we can't read from the registry, create default values */
1225 if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) ||
1226 (cs->cLength != length) )
1228 ERR("Initializing shell cabinet settings\n");
1229 memset(cs, 0, sizeof(*cs));
1230 cs->cLength = sizeof(*cs);
1231 cs->nVersion = 2;
1232 cs->fFullPathTitle = FALSE;
1233 cs->fSaveLocalView = TRUE;
1234 cs->fNotShell = FALSE;
1235 cs->fSimpleDefault = TRUE;
1236 cs->fDontShowDescBar = FALSE;
1237 cs->fNewWindowMode = FALSE;
1238 cs->fShowCompColor = FALSE;
1239 cs->fDontPrettyNames = FALSE;
1240 cs->fAdminsCreateCommonGroups = TRUE;
1241 cs->fMenuEnumFilter = 96;
1244 return TRUE;
1247 /*************************************************************************
1248 * WriteCabinetState [SHELL32.652] NT 4.0
1251 BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
1253 DWORD r;
1254 HKEY hkey = 0;
1256 TRACE("%p\n",cs);
1258 if( cs == NULL )
1259 return FALSE;
1261 r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0,
1262 NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
1263 if( r == ERROR_SUCCESS )
1265 r = RegSetValueExW( hkey, szwSettings, 0,
1266 REG_BINARY, (LPBYTE) cs, cs->cLength);
1268 RegCloseKey( hkey );
1271 return (r==ERROR_SUCCESS);
1274 /*************************************************************************
1275 * FileIconInit [SHELL32.660]
1278 BOOL WINAPI FileIconInit(BOOL bFullInit)
1279 { FIXME("(%s)\n", bFullInit ? "true" : "false");
1280 return 0;
1283 /*************************************************************************
1284 * IsUserAnAdmin [SHELL32.680] NT 4.0
1286 * Checks whether the current user is a member of the Administrators group.
1288 * PARAMS
1289 * None
1291 * RETURNS
1292 * Success: TRUE
1293 * Failure: FALSE
1295 BOOL WINAPI IsUserAnAdmin(VOID)
1297 SID_IDENTIFIER_AUTHORITY Authority = {SECURITY_NT_AUTHORITY};
1298 HANDLE hToken;
1299 DWORD dwSize;
1300 PTOKEN_GROUPS lpGroups;
1301 PSID lpSid;
1302 DWORD i;
1303 BOOL bResult = FALSE;
1305 TRACE("\n");
1306 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
1308 return FALSE;
1311 if (!GetTokenInformation(hToken, TokenGroups, NULL, 0, &dwSize))
1313 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
1315 CloseHandle(hToken);
1316 return FALSE;
1320 lpGroups = HeapAlloc(GetProcessHeap(), 0, dwSize);
1321 if (lpGroups == NULL)
1323 CloseHandle(hToken);
1324 return FALSE;
1327 if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize))
1329 HeapFree(GetProcessHeap(), 0, lpGroups);
1330 CloseHandle(hToken);
1331 return FALSE;
1334 CloseHandle(hToken);
1335 if (!AllocateAndInitializeSid(&Authority, 2, SECURITY_BUILTIN_DOMAIN_RID,
1336 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
1337 &lpSid))
1339 HeapFree(GetProcessHeap(), 0, lpGroups);
1340 return FALSE;
1343 for (i = 0; i < lpGroups->GroupCount; i++)
1345 if (EqualSid(lpSid, lpGroups->Groups[i].Sid))
1347 bResult = TRUE;
1348 break;
1352 FreeSid(lpSid);
1353 HeapFree(GetProcessHeap(), 0, lpGroups);
1354 return bResult;
1357 /*************************************************************************
1358 * SHAllocShared [SHELL32.520]
1360 * See shlwapi.SHAllocShared
1362 HANDLE WINAPI SHAllocShared(LPVOID lpvData, DWORD dwSize, DWORD dwProcId)
1364 GET_FUNC(pSHAllocShared, shlwapi, (char*)7, NULL);
1365 return pSHAllocShared(lpvData, dwSize, dwProcId);
1368 /*************************************************************************
1369 * SHLockShared [SHELL32.521]
1371 * See shlwapi.SHLockShared
1373 LPVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId)
1375 GET_FUNC(pSHLockShared, shlwapi, (char*)8, NULL);
1376 return pSHLockShared(hShared, dwProcId);
1379 /*************************************************************************
1380 * SHUnlockShared [SHELL32.522]
1382 * See shlwapi.SHUnlockShared
1384 BOOL WINAPI SHUnlockShared(LPVOID lpView)
1386 GET_FUNC(pSHUnlockShared, shlwapi, (char*)9, FALSE);
1387 return pSHUnlockShared(lpView);
1390 /*************************************************************************
1391 * SHFreeShared [SHELL32.523]
1393 * See shlwapi.SHFreeShared
1395 BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId)
1397 GET_FUNC(pSHFreeShared, shlwapi, (char*)10, FALSE);
1398 return pSHFreeShared(hShared, dwProcId);
1401 /*************************************************************************
1402 * SetAppStartingCursor [SHELL32.99]
1404 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1405 { FIXME("hwnd=%p 0x%04x stub\n",u,v );
1406 return 0;
1409 /*************************************************************************
1410 * SHLoadOLE [SHELL32.151]
1412 * To reduce the memory usage of Windows 95, its shell32 contained an
1413 * internal implementation of a part of COM (see e.g. SHGetMalloc, SHCoCreateInstance,
1414 * SHRegisterDragDrop etc.) that allowed to use in-process STA objects without
1415 * the need to load OLE32.DLL. If OLE32.DLL was already loaded, the SH* function
1416 * would just call the Co* functions.
1418 * The SHLoadOLE was called when OLE32.DLL was being loaded to transfer all the
1419 * information from the shell32 "mini-COM" to ole32.dll.
1421 * See http://blogs.msdn.com/oldnewthing/archive/2004/07/05/173226.aspx for a
1422 * detailed description.
1424 * Under wine ole32.dll is always loaded as it is imported by shlwapi.dll which is
1425 * imported by shell32 and no "mini-COM" is used (except for the "LoadWithoutCOM"
1426 * hack in SHCoCreateInstance)
1428 HRESULT WINAPI SHLoadOLE(LPARAM lParam)
1429 { FIXME("0x%08lx stub\n",lParam);
1430 return S_OK;
1432 /*************************************************************************
1433 * DriveType [SHELL32.64]
1436 HRESULT WINAPI DriveType(DWORD u)
1437 { FIXME("0x%04x stub\n",u);
1438 return 0;
1440 /*************************************************************************
1441 * InvalidateDriveType [SHELL32.65]
1444 int WINAPI InvalidateDriveType(int u)
1445 { FIXME("0x%08x stub\n",u);
1446 return 0;
1448 /*************************************************************************
1449 * SHAbortInvokeCommand [SHELL32.198]
1452 HRESULT WINAPI SHAbortInvokeCommand(void)
1453 { FIXME("stub\n");
1454 return 1;
1456 /*************************************************************************
1457 * SHOutOfMemoryMessageBox [SHELL32.126]
1460 int WINAPI SHOutOfMemoryMessageBox(
1461 HWND hwndOwner,
1462 LPCSTR lpCaption,
1463 UINT uType)
1465 FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1466 return 0;
1468 /*************************************************************************
1469 * SHFlushClipboard [SHELL32.121]
1472 HRESULT WINAPI SHFlushClipboard(void)
1473 { FIXME("stub\n");
1474 return 1;
1477 /*************************************************************************
1478 * SHWaitForFileToOpen [SHELL32.97]
1481 BOOL WINAPI SHWaitForFileToOpen(
1482 LPCITEMIDLIST pidl,
1483 DWORD dwFlags,
1484 DWORD dwTimeout)
1486 FIXME("%p 0x%08x 0x%08x stub\n", pidl, dwFlags, dwTimeout);
1487 return 0;
1490 /************************************************************************
1491 * @ [SHELL32.654]
1493 * NOTES
1494 * first parameter seems to be a pointer (same as passed to WriteCabinetState)
1495 * second one could be a size (0x0c). The size is the same as the structure saved to
1496 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1497 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1499 HRESULT WINAPI shell32_654 (CABINETSTATE *cs, int length)
1501 TRACE("%p %d\n",cs,length);
1502 return ReadCabinetState(cs,length);
1505 /************************************************************************
1506 * RLBuildListOfPaths [SHELL32.146]
1508 * NOTES
1509 * builds a DPA
1511 DWORD WINAPI RLBuildListOfPaths (void)
1512 { FIXME("stub\n");
1513 return 0;
1515 /************************************************************************
1516 * SHValidateUNC [SHELL32.173]
1519 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1521 FIXME("0x%08x 0x%08x 0x%08x stub\n",x,y,z);
1522 return 0;
1525 /************************************************************************
1526 * DoEnvironmentSubstA [SHELL32.@]
1528 * Replace %KEYWORD% in the str with the value of variable KEYWORD
1529 * from environment. If it is not found the %KEYWORD% is left
1530 * intact. If the buffer is too small, str is not modified.
1532 * PARAMS
1533 * pszString [I] '\0' terminated string with %keyword%.
1534 * [O] '\0' terminated string with %keyword% substituted.
1535 * cchString [I] size of str.
1537 * RETURNS
1538 * cchString length in the HIWORD;
1539 * TRUE in LOWORD if subst was successful and FALSE in other case
1541 DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
1543 LPSTR dst;
1544 BOOL res = FALSE;
1545 FIXME("(%s, %d) stub\n", debugstr_a(pszString), cchString);
1546 if (pszString == NULL) /* Really return 0? */
1547 return 0;
1548 if ((dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(CHAR))))
1550 DWORD num = ExpandEnvironmentStringsA(pszString, dst, cchString);
1551 if (num && num < cchString) /* dest buffer is too small */
1553 res = TRUE;
1554 memcpy(pszString, dst, num);
1556 HeapFree(GetProcessHeap(), 0, dst);
1558 return MAKELONG(res,cchString); /* Always cchString? */
1561 /************************************************************************
1562 * DoEnvironmentSubstW [SHELL32.@]
1564 * See DoEnvironmentSubstA.
1566 DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
1568 FIXME("(%s, %d): stub\n", debugstr_w(pszString), cchString);
1569 return MAKELONG(FALSE,cchString);
1572 /************************************************************************
1573 * DoEnvironmentSubst [SHELL32.53]
1575 * See DoEnvironmentSubstA.
1577 DWORD WINAPI DoEnvironmentSubstAW(LPVOID x, UINT y)
1579 if (SHELL_OsIsUnicode())
1580 return DoEnvironmentSubstW(x, y);
1581 return DoEnvironmentSubstA(x, y);
1584 /*************************************************************************
1585 * @ [SHELL32.243]
1587 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1588 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1592 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1594 return FALSE;
1597 /*************************************************************************
1598 * GUIDFromStringW [SHELL32.704]
1600 BOOL WINAPI GUIDFromStringW(LPCWSTR str, LPGUID guid)
1602 UNICODE_STRING guid_str;
1604 RtlInitUnicodeString(&guid_str, str);
1605 return !RtlGUIDFromString(&guid_str, guid);
1608 /*************************************************************************
1609 * @ [SHELL32.714]
1611 DWORD WINAPI SHELL32_714(LPVOID x)
1613 FIXME("(%s)stub\n", debugstr_w(x));
1614 return 0;
1617 typedef struct _PSXA
1619 UINT uiCount;
1620 UINT uiAllocated;
1621 IShellPropSheetExt *pspsx[1];
1622 } PSXA, *PPSXA;
1624 typedef struct _PSXA_CALL
1626 LPFNADDPROPSHEETPAGE lpfnAddReplaceWith;
1627 LPARAM lParam;
1628 BOOL bCalled;
1629 BOOL bMultiple;
1630 UINT uiCount;
1631 } PSXA_CALL, *PPSXA_CALL;
1633 static BOOL CALLBACK PsxaCall(HPROPSHEETPAGE hpage, LPARAM lParam)
1635 PPSXA_CALL Call = (PPSXA_CALL)lParam;
1637 if (Call != NULL)
1639 if ((Call->bMultiple || !Call->bCalled) &&
1640 Call->lpfnAddReplaceWith(hpage, Call->lParam))
1642 Call->bCalled = TRUE;
1643 Call->uiCount++;
1644 return TRUE;
1648 return FALSE;
1651 /*************************************************************************
1652 * SHAddFromPropSheetExtArray [SHELL32.167]
1654 UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
1656 PSXA_CALL Call;
1657 UINT i;
1658 PPSXA psxa = (PPSXA)hpsxa;
1660 TRACE("(%p,%p,%08lx)\n", hpsxa, lpfnAddPage, lParam);
1662 if (psxa)
1664 ZeroMemory(&Call, sizeof(Call));
1665 Call.lpfnAddReplaceWith = lpfnAddPage;
1666 Call.lParam = lParam;
1667 Call.bMultiple = TRUE;
1669 /* Call the AddPage method of all registered IShellPropSheetExt interfaces */
1670 for (i = 0; i != psxa->uiCount; i++)
1672 psxa->pspsx[i]->lpVtbl->AddPages(psxa->pspsx[i], PsxaCall, (LPARAM)&Call);
1675 return Call.uiCount;
1678 return 0;
1681 /*************************************************************************
1682 * SHCreatePropSheetExtArray [SHELL32.168]
1684 HPSXA WINAPI SHCreatePropSheetExtArray(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface)
1686 return SHCreatePropSheetExtArrayEx(hKey, pszSubKey, max_iface, NULL);
1689 /*************************************************************************
1690 * SHCreatePropSheetExtArrayEx [SHELL32.194]
1692 HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, LPDATAOBJECT pDataObj)
1694 static const WCHAR szPropSheetSubKey[] = {'s','h','e','l','l','e','x','\\','P','r','o','p','e','r','t','y','S','h','e','e','t','H','a','n','d','l','e','r','s',0};
1695 WCHAR szHandler[64];
1696 DWORD dwHandlerLen;
1697 WCHAR szClsidHandler[39];
1698 DWORD dwClsidSize;
1699 CLSID clsid;
1700 LONG lRet;
1701 DWORD dwIndex;
1702 IShellExtInit *psxi;
1703 IShellPropSheetExt *pspsx;
1704 HKEY hkBase, hkPropSheetHandlers;
1705 PPSXA psxa = NULL;
1707 TRACE("(%p,%s,%u)\n", hKey, debugstr_w(pszSubKey), max_iface);
1709 if (max_iface == 0)
1710 return NULL;
1712 /* Open the registry key */
1713 lRet = RegOpenKeyW(hKey, pszSubKey, &hkBase);
1714 if (lRet != ERROR_SUCCESS)
1715 return NULL;
1717 lRet = RegOpenKeyExW(hkBase, szPropSheetSubKey, 0, KEY_ENUMERATE_SUB_KEYS, &hkPropSheetHandlers);
1718 RegCloseKey(hkBase);
1719 if (lRet == ERROR_SUCCESS)
1721 /* Create and initialize the Property Sheet Extensions Array */
1722 psxa = LocalAlloc(LMEM_FIXED, FIELD_OFFSET(PSXA, pspsx[max_iface]));
1723 if (psxa)
1725 ZeroMemory(psxa, FIELD_OFFSET(PSXA, pspsx[max_iface]));
1726 psxa->uiAllocated = max_iface;
1728 /* Enumerate all subkeys and attempt to load the shell extensions */
1729 dwIndex = 0;
1732 dwHandlerLen = sizeof(szHandler) / sizeof(szHandler[0]);
1733 lRet = RegEnumKeyExW(hkPropSheetHandlers, dwIndex++, szHandler, &dwHandlerLen, NULL, NULL, NULL, NULL);
1734 if (lRet != ERROR_SUCCESS)
1736 if (lRet == ERROR_MORE_DATA)
1737 continue;
1739 if (lRet == ERROR_NO_MORE_ITEMS)
1740 lRet = ERROR_SUCCESS;
1741 break;
1744 dwClsidSize = sizeof(szClsidHandler);
1745 if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS)
1747 /* Force a NULL-termination and convert the string */
1748 szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0;
1749 if (SUCCEEDED(SHCLSIDFromStringW(szClsidHandler, &clsid)))
1751 /* Attempt to get an IShellPropSheetExt and an IShellExtInit instance.
1752 Only if both interfaces are supported it's a real shell extension.
1753 Then call IShellExtInit's Initialize method. */
1754 if (SUCCEEDED(CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER/* | CLSCTX_NO_CODE_DOWNLOAD */, &IID_IShellPropSheetExt, (LPVOID *)&pspsx)))
1756 if (SUCCEEDED(pspsx->lpVtbl->QueryInterface(pspsx, &IID_IShellExtInit, (PVOID *)&psxi)))
1758 if (SUCCEEDED(psxi->lpVtbl->Initialize(psxi, NULL, pDataObj, hKey)))
1760 /* Add the IShellPropSheetExt instance to the array */
1761 psxa->pspsx[psxa->uiCount++] = pspsx;
1763 else
1765 psxi->lpVtbl->Release(psxi);
1766 pspsx->lpVtbl->Release(pspsx);
1769 else
1770 pspsx->lpVtbl->Release(pspsx);
1775 } while (psxa->uiCount != psxa->uiAllocated);
1777 else
1778 lRet = ERROR_NOT_ENOUGH_MEMORY;
1780 RegCloseKey(hkPropSheetHandlers);
1783 if (lRet != ERROR_SUCCESS && psxa)
1785 SHDestroyPropSheetExtArray((HPSXA)psxa);
1786 psxa = NULL;
1789 return (HPSXA)psxa;
1792 /*************************************************************************
1793 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1795 UINT WINAPI SHReplaceFromPropSheetExtArray(HPSXA hpsxa, UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam)
1797 PSXA_CALL Call;
1798 UINT i;
1799 PPSXA psxa = (PPSXA)hpsxa;
1801 TRACE("(%p,%u,%p,%08lx)\n", hpsxa, uPageID, lpfnReplaceWith, lParam);
1803 if (psxa)
1805 ZeroMemory(&Call, sizeof(Call));
1806 Call.lpfnAddReplaceWith = lpfnReplaceWith;
1807 Call.lParam = lParam;
1809 /* Call the ReplacePage method of all registered IShellPropSheetExt interfaces.
1810 Each shell extension is only allowed to call the callback once during the callback. */
1811 for (i = 0; i != psxa->uiCount; i++)
1813 Call.bCalled = FALSE;
1814 psxa->pspsx[i]->lpVtbl->ReplacePage(psxa->pspsx[i], uPageID, PsxaCall, (LPARAM)&Call);
1817 return Call.uiCount;
1820 return 0;
1823 /*************************************************************************
1824 * SHDestroyPropSheetExtArray [SHELL32.169]
1826 void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
1828 UINT i;
1829 PPSXA psxa = (PPSXA)hpsxa;
1831 TRACE("(%p)\n", hpsxa);
1833 if (psxa)
1835 for (i = 0; i != psxa->uiCount; i++)
1837 psxa->pspsx[i]->lpVtbl->Release(psxa->pspsx[i]);
1840 LocalFree(psxa);
1844 /*************************************************************************
1845 * CIDLData_CreateFromIDArray [SHELL32.83]
1847 * Create IDataObject from PIDLs??
1849 HRESULT WINAPI CIDLData_CreateFromIDArray(
1850 LPCITEMIDLIST pidlFolder,
1851 DWORD cpidlFiles,
1852 LPCITEMIDLIST *lppidlFiles,
1853 LPDATAOBJECT *ppdataObject)
1855 UINT i;
1856 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1858 TRACE("(%p, %d, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
1859 if (TRACE_ON(pidl))
1861 pdump (pidlFolder);
1862 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
1864 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1865 lppidlFiles, cpidlFiles);
1866 if (*ppdataObject) return S_OK;
1867 return E_OUTOFMEMORY;
1870 /*************************************************************************
1871 * SHCreateStdEnumFmtEtc [SHELL32.74]
1873 * NOTES
1876 HRESULT WINAPI SHCreateStdEnumFmtEtc(
1877 DWORD cFormats,
1878 const FORMATETC *lpFormats,
1879 LPENUMFORMATETC *ppenumFormatetc)
1881 IEnumFORMATETC *pef;
1882 HRESULT hRes;
1883 TRACE("cf=%d fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc);
1885 pef = IEnumFORMATETC_Constructor(cFormats, lpFormats);
1886 if (!pef)
1887 return E_OUTOFMEMORY;
1889 IEnumFORMATETC_AddRef(pef);
1890 hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc);
1891 IEnumFORMATETC_Release(pef);
1893 return hRes;
1896 /*************************************************************************
1897 * SHFindFiles (SHELL32.90)
1899 BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile )
1901 FIXME("%p %p\n", pidlFolder, pidlSaveFile );
1902 return FALSE;
1905 /*************************************************************************
1906 * SHUpdateImageW (SHELL32.192)
1908 * Notifies the shell that an icon in the system image list has been changed.
1910 * PARAMS
1911 * pszHashItem [I] Path to file that contains the icon.
1912 * iIndex [I] Zero-based index of the icon in the file.
1913 * uFlags [I] Flags determining the icon attributes. See notes.
1914 * iImageIndex [I] Index of the icon in the system image list.
1916 * RETURNS
1917 * Nothing
1919 * NOTES
1920 * uFlags can be one or more of the following flags:
1921 * GIL_NOTFILENAME - pszHashItem is not a file name.
1922 * GIL_SIMULATEDOC - Create a document icon using the specified icon.
1924 void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
1926 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex);
1929 /*************************************************************************
1930 * SHUpdateImageA (SHELL32.191)
1932 * See SHUpdateImageW.
1934 VOID WINAPI SHUpdateImageA(LPCSTR pszHashItem, INT iIndex, UINT uFlags, INT iImageIndex)
1936 FIXME("%s, %d, 0x%x, %d - stub\n", debugstr_a(pszHashItem), iIndex, uFlags, iImageIndex);
1939 INT WINAPI SHHandleUpdateImage(LPCITEMIDLIST pidlExtra)
1941 FIXME("%p - stub\n", pidlExtra);
1943 return -1;
1946 BOOL WINAPI SHObjectProperties(HWND hwnd, DWORD dwType, LPCWSTR szObject, LPCWSTR szPage)
1948 FIXME("%p, 0x%08x, %s, %s - stub\n", hwnd, dwType, debugstr_w(szObject), debugstr_w(szPage));
1950 return TRUE;
1953 BOOL WINAPI SHGetNewLinkInfoA(LPCSTR pszLinkTo, LPCSTR pszDir, LPSTR pszName, BOOL *pfMustCopy,
1954 UINT uFlags)
1956 WCHAR wszLinkTo[MAX_PATH];
1957 WCHAR wszDir[MAX_PATH];
1958 WCHAR wszName[MAX_PATH];
1959 BOOL res;
1961 MultiByteToWideChar(CP_ACP, 0, pszLinkTo, -1, wszLinkTo, MAX_PATH);
1962 MultiByteToWideChar(CP_ACP, 0, pszDir, -1, wszDir, MAX_PATH);
1964 res = SHGetNewLinkInfoW(wszLinkTo, wszDir, wszName, pfMustCopy, uFlags);
1966 if (res)
1967 WideCharToMultiByte(CP_ACP, 0, wszName, -1, pszName, MAX_PATH, NULL, NULL);
1969 return res;
1972 BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, BOOL *pfMustCopy,
1973 UINT uFlags)
1975 const WCHAR *basename;
1976 WCHAR *dst_basename;
1977 int i=2;
1978 static const WCHAR lnkformat[] = {'%','s','.','l','n','k',0};
1979 static const WCHAR lnkformatnum[] = {'%','s',' ','(','%','d',')','.','l','n','k',0};
1981 TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(pszLinkTo), debugstr_w(pszDir),
1982 pszName, pfMustCopy, uFlags);
1984 *pfMustCopy = FALSE;
1986 if (uFlags & SHGNLI_PIDL)
1988 FIXME("SHGNLI_PIDL flag unsupported\n");
1989 return FALSE;
1992 if (uFlags)
1993 FIXME("ignoring flags: 0x%08x\n", uFlags);
1995 /* FIXME: should test if the file is a shortcut or DOS program */
1996 if (GetFileAttributesW(pszLinkTo) == INVALID_FILE_ATTRIBUTES)
1997 return FALSE;
1999 basename = strrchrW(pszLinkTo, '\\');
2000 if (basename)
2001 basename = basename+1;
2002 else
2003 basename = pszLinkTo;
2005 lstrcpynW(pszName, pszDir, MAX_PATH);
2006 if (!PathAddBackslashW(pszName))
2007 return FALSE;
2009 dst_basename = pszName + strlenW(pszName);
2011 snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformat, basename);
2013 while (GetFileAttributesW(pszName) != INVALID_FILE_ATTRIBUTES)
2015 snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformatnum, basename, i);
2016 i++;
2019 return TRUE;
2022 HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType)
2024 FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType);
2026 return S_OK;
2029 HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags)
2031 FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRootPath), dwFlags);
2033 return S_OK;
2036 HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags)
2038 FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_w(pszRootPath), dwFlags);
2040 return S_OK;
2043 DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
2045 FIXME("%p, 0x%08x, 0x%08x, 0x%08x - stub\n", hwnd, drive, fmtID, options);
2047 return SHFMT_NOFORMAT;
2050 HRESULT WINAPI SHQueryRecycleBinA(LPCSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
2052 FIXME("%s, %p - stub\n", debugstr_a(pszRootPath), pSHQueryRBInfo);
2054 pSHQueryRBInfo->i64Size = 0;
2055 pSHQueryRBInfo->i64NumItems = 0;
2057 return S_OK;
2060 HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryRBInfo)
2062 FIXME("%s, %p - stub\n", debugstr_w(pszRootPath), pSHQueryRBInfo);
2064 pSHQueryRBInfo->i64Size = 0;
2065 pSHQueryRBInfo->i64NumItems = 0;
2067 return S_OK;
2070 /*************************************************************************
2071 * SHSetLocalizedName (SHELL32.@)
2073 HRESULT WINAPI SHSetLocalizedName(LPWSTR pszPath, LPCWSTR pszResModule, int idsRes)
2075 FIXME("%p, %s, %d - stub\n", pszPath, debugstr_w(pszResModule), idsRes);
2077 return S_OK;
2080 /*************************************************************************
2081 * LinkWindow_RegisterClass (SHELL32.258)
2083 BOOL WINAPI LinkWindow_RegisterClass(void)
2085 FIXME("()\n");
2086 return TRUE;
2089 /*************************************************************************
2090 * LinkWindow_UnregisterClass (SHELL32.259)
2092 BOOL WINAPI LinkWindow_UnregisterClass(void)
2094 FIXME("()\n");
2095 return TRUE;
2098 /*************************************************************************
2099 * SHFlushSFCache (SHELL32.526)
2101 * Notifies the shell that a user-specified special folder location has changed.
2103 * NOTES
2104 * In Wine, the shell folder registry values are not cached, so this function
2105 * has no effect.
2107 void WINAPI SHFlushSFCache(void)
2111 HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
2113 FIXME("STUB: %i %s\n",iImageList,debugstr_guid(riid));
2114 return E_NOINTERFACE;
2117 /*************************************************************************
2118 * SHCreateShellFolderView [SHELL32.256]
2120 * Create a new instance of the default Shell folder view object.
2122 * RETURNS
2123 * Success: S_OK
2124 * Failure: error value
2126 * NOTES
2127 * see IShellFolder::CreateViewObject
2129 HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv,
2130 IShellView **ppsv)
2132 IShellView * psf;
2133 HRESULT hRes;
2135 TRACE("sf=%p outer=%p callback=%p\n",
2136 pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
2138 psf = IShellView_Constructor(pcsfv->pshf);
2140 if (!psf)
2141 return E_OUTOFMEMORY;
2143 IShellView_AddRef(psf);
2144 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppsv);
2145 IShellView_Release(psf);
2147 return hRes;