Add support for HCBT_SYSCOMMAND hook, add logging for HCBT_SYSCOMMAND
[wine.git] / dlls / shell32 / shellord.c
blob3df8271398a7c40eecab01d90ad1de1f35143ad7
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
24 #include <string.h>
25 #include <stdarg.h>
26 #include <stdio.h>
27 #include "winerror.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "wine/debug.h"
32 #include "winnls.h"
34 #include "shellapi.h"
35 #include "objbase.h"
36 #include "shlguid.h"
37 #include "wingdi.h"
38 #include "winuser.h"
39 #include "shlobj.h"
40 #include "shell32_main.h"
41 #include "undocshell.h"
42 #include "pidl.h"
43 #include "shlwapi.h"
44 #include "commdlg.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(shell);
47 WINE_DECLARE_DEBUG_CHANNEL(pidl);
49 /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
50 /* !!! it is in both here and comctl32undoc.c !!! */
51 typedef struct tagCREATEMRULIST
53 DWORD cbSize; /* size of struct */
54 DWORD nMaxItems; /* max no. of items in list */
55 DWORD dwFlags; /* see below */
56 HKEY hKey; /* root reg. key under which list is saved */
57 LPCSTR lpszSubKey; /* reg. subkey */
58 PROC lpfnCompare; /* item compare proc */
59 } CREATEMRULISTA, *LPCREATEMRULISTA;
61 /* dwFlags */
62 #define MRUF_STRING_LIST 0 /* list will contain strings */
63 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
64 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
66 extern HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml);
67 extern DWORD WINAPI FreeMRUList(HANDLE hMRUList);
68 extern INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData);
69 extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
70 extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
73 /* Get a function pointer from a DLL handle */
74 #define GET_FUNC(func, module, name, fail) \
75 do { \
76 if (!func) { \
77 if (!SHELL32_h##module && !(SHELL32_h##module = LoadLibraryA(#module ".dll"))) return fail; \
78 func = (void*)GetProcAddress(SHELL32_h##module, name); \
79 if (!func) return fail; \
80 } \
81 } while (0)
83 /* Function pointers for GET_FUNC macro */
84 static HMODULE SHELL32_hshlwapi=NULL;
85 static HANDLE (WINAPI *pSHAllocShared)(LPCVOID,DWORD,DWORD);
86 static LPVOID (WINAPI *pSHLockShared)(HANDLE,DWORD);
87 static BOOL (WINAPI *pSHUnlockShared)(LPVOID);
88 static BOOL (WINAPI *pSHFreeShared)(HANDLE,DWORD);
91 /*************************************************************************
92 * ParseFieldA [internal]
94 * copies a field from a ',' delimited string
96 * first field is nField = 1
98 DWORD WINAPI ParseFieldA(
99 LPCSTR src,
100 DWORD nField,
101 LPSTR dst,
102 DWORD len)
104 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
106 if (!src || !src[0] || !dst || !len)
107 return 0;
109 /* skip n fields delimited by ',' */
110 while (nField > 1)
112 if (*src=='\0') return FALSE;
113 if (*(src++)==',') nField--;
116 /* copy part till the next ',' to dst */
117 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
119 /* finalize the string */
120 *dst=0x0;
122 return TRUE;
125 /*************************************************************************
126 * ParseFieldW [internal]
128 * copies a field from a ',' delimited string
130 * first field is nField = 1
132 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
134 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n", debugstr_w(src), nField, dst, len);
136 if (!src || !src[0] || !dst || !len)
137 return 0;
139 /* skip n fields delimited by ',' */
140 while (nField > 1)
142 if (*src == 0x0) return FALSE;
143 if (*src++ == ',') nField--;
146 /* copy part till the next ',' to dst */
147 while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);
149 /* finalize the string */
150 *dst = 0x0;
152 return TRUE;
155 /*************************************************************************
156 * ParseField [SHELL32.58]
158 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
160 if (SHELL_OsIsUnicode())
161 return ParseFieldW(src, nField, dst, len);
162 return ParseFieldA(src, nField, dst, len);
165 /*************************************************************************
166 * GetFileNameFromBrowse [SHELL32.63]
169 BOOL WINAPI GetFileNameFromBrowse(
170 HWND hwndOwner,
171 LPSTR lpstrFile,
172 DWORD nMaxFile,
173 LPCSTR lpstrInitialDir,
174 LPCSTR lpstrDefExt,
175 LPCSTR lpstrFilter,
176 LPCSTR lpstrTitle)
178 HMODULE hmodule;
179 FARPROC pGetOpenFileNameA;
180 OPENFILENAMEA ofn;
181 BOOL ret;
183 TRACE("%p, %s, %ld, %s, %s, %s, %s)\n",
184 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
185 lpstrFilter, lpstrTitle);
187 hmodule = LoadLibraryA("comdlg32.dll");
188 if(!hmodule) return FALSE;
189 pGetOpenFileNameA = GetProcAddress(hmodule, "GetOpenFileNameA");
190 if(!pGetOpenFileNameA)
192 FreeLibrary(hmodule);
193 return FALSE;
196 memset(&ofn, 0, sizeof(ofn));
198 ofn.lStructSize = sizeof(ofn);
199 ofn.hwndOwner = hwndOwner;
200 ofn.lpstrFilter = lpstrFilter;
201 ofn.lpstrFile = lpstrFile;
202 ofn.nMaxFile = nMaxFile;
203 ofn.lpstrInitialDir = lpstrInitialDir;
204 ofn.lpstrTitle = lpstrTitle;
205 ofn.lpstrDefExt = lpstrDefExt;
206 ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
207 ret = pGetOpenFileNameA(&ofn);
209 FreeLibrary(hmodule);
210 return ret;
213 /*************************************************************************
214 * SHGetSetSettings [SHELL32.68]
216 VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
218 if(bSet)
220 FIXME("%p 0x%08lx TRUE\n", lpss, dwMask);
222 else
224 SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask);
228 /*************************************************************************
229 * SHGetSettings [SHELL32.@]
231 * NOTES
232 * the registry path are for win98 (tested)
233 * and possibly are the same in nt40
236 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
238 HKEY hKey;
239 DWORD dwData;
240 DWORD dwDataSize = sizeof (DWORD);
242 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
244 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
245 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
246 return;
248 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
249 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
251 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
252 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
254 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
255 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
257 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
258 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
260 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
261 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
263 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
264 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
266 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
267 { if (dwData == 0)
268 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
269 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
271 else if (dwData == 1)
272 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
273 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
275 else if (dwData == 2)
276 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
277 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
280 RegCloseKey (hKey);
282 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
285 /*************************************************************************
286 * SHShellFolderView_Message [SHELL32.73]
288 * Send a message to an explorer cabinet window.
290 * PARAMS
291 * hwndCabinet [I] The window containing the shellview to communicate with
292 * dwMessage [I] The SFVM message to send
293 * dwParam [I] Message parameter
295 * RETURNS
296 * fixme.
298 * NOTES
299 * Message SFVM_REARRANGE = 1
301 * This message gets sent when a column gets clicked to instruct the
302 * shell view to re-sort the item list. dwParam identifies the column
303 * that was clicked.
305 LRESULT WINAPI SHShellFolderView_Message(
306 HWND hwndCabinet,
307 UINT uMessage,
308 LPARAM lParam)
310 FIXME("%p %08x %08lx stub\n",hwndCabinet, uMessage, lParam);
311 return 0;
314 /*************************************************************************
315 * RegisterShellHook [SHELL32.181]
317 * Register a shell hook.
319 * PARAMS
320 * hwnd [I] Window handle
321 * dwType [I] Type of hook.
323 * NOTES
324 * Exported by ordinal
326 BOOL WINAPI RegisterShellHook(
327 HWND hWnd,
328 DWORD dwType)
330 FIXME("(%p,0x%08lx):stub.\n",hWnd, dwType);
331 return TRUE;
334 /*************************************************************************
335 * ShellMessageBoxW [SHELL32.182]
337 * See ShellMessageBoxA.
339 int WINAPIV ShellMessageBoxW(
340 HINSTANCE hInstance,
341 HWND hWnd,
342 LPCWSTR lpText,
343 LPCWSTR lpCaption,
344 UINT uType,
345 ...)
347 WCHAR szText[100],szTitle[100];
348 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
349 va_list args;
350 int ret;
352 va_start(args, uType);
353 /* wvsprintfA(buf,fmt, args); */
355 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
356 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
358 if (!HIWORD(lpCaption))
359 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
360 else
361 pszTitle = lpCaption;
363 if (!HIWORD(lpText))
364 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
365 else
366 pszText = lpText;
368 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
369 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
371 va_end(args);
373 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
374 LocalFree((HLOCAL)pszTemp);
375 return ret;
378 /*************************************************************************
379 * ShellMessageBoxA [SHELL32.183]
381 * Format and output an error message.
383 * PARAMS
384 * hInstance [I] Instance handle of message creator
385 * hWnd [I] Window handle of message creator
386 * lpText [I] Resource Id of title or LPSTR
387 * lpCaption [I] Resource Id of title or LPSTR
388 * uType [I] Type of error message
390 * RETURNS
391 * A return value from MessageBoxA().
393 * NOTES
394 * Exported by ordinal
396 int WINAPIV ShellMessageBoxA(
397 HINSTANCE hInstance,
398 HWND hWnd,
399 LPCSTR lpText,
400 LPCSTR lpCaption,
401 UINT uType,
402 ...)
404 char szText[100],szTitle[100];
405 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
406 va_list args;
407 int ret;
409 va_start(args, uType);
410 /* wvsprintfA(buf,fmt, args); */
412 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
413 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
415 if (!HIWORD(lpCaption))
416 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
417 else
418 pszTitle = lpCaption;
420 if (!HIWORD(lpText))
421 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
422 else
423 pszText = lpText;
425 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
426 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
428 va_end(args);
430 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
431 LocalFree((HLOCAL)pszTemp);
432 return ret;
435 /*************************************************************************
436 * SHRegisterDragDrop [SHELL32.86]
438 * NOTES
439 * exported by ordinal
441 HRESULT WINAPI SHRegisterDragDrop(
442 HWND hWnd,
443 LPDROPTARGET pDropTarget)
445 FIXME("(%p,%p):stub.\n", hWnd, pDropTarget);
446 return RegisterDragDrop(hWnd, pDropTarget);
449 /*************************************************************************
450 * SHRevokeDragDrop [SHELL32.87]
452 * NOTES
453 * exported by ordinal
455 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
457 FIXME("(%p):stub.\n",hWnd);
458 return RevokeDragDrop(hWnd);
461 /*************************************************************************
462 * SHDoDragDrop [SHELL32.88]
464 * NOTES
465 * exported by ordinal
467 HRESULT WINAPI SHDoDragDrop(
468 HWND hWnd,
469 LPDATAOBJECT lpDataObject,
470 LPDROPSOURCE lpDropSource,
471 DWORD dwOKEffect,
472 LPDWORD pdwEffect)
474 FIXME("(%p %p %p 0x%08lx %p):stub.\n",
475 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
476 return DoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
479 /*************************************************************************
480 * ArrangeWindows [SHELL32.184]
483 WORD WINAPI ArrangeWindows(
484 HWND hwndParent,
485 DWORD dwReserved,
486 LPCRECT lpRect,
487 WORD cKids,
488 CONST HWND * lpKids)
490 FIXME("(%p 0x%08lx %p 0x%04x %p):stub.\n",
491 hwndParent, dwReserved, lpRect, cKids, lpKids);
492 return 0;
495 /*************************************************************************
496 * SignalFileOpen [SHELL32.103]
498 * NOTES
499 * exported by ordinal
501 DWORD WINAPI
502 SignalFileOpen (DWORD dwParam1)
504 FIXME("(0x%08lx):stub.\n", dwParam1);
506 return 0;
509 /*************************************************************************
510 * SHADD_get_policy - helper function for SHAddToRecentDocs
512 * PARAMETERS
513 * policy [IN] policy name (null termed string) to find
514 * type [OUT] ptr to DWORD to receive type
515 * buffer [OUT] ptr to area to hold data retrieved
516 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
517 * length filled
519 * RETURNS
520 * result of the SHQueryValueEx call
522 static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
524 HKEY Policy_basekey;
525 INT ret;
527 /* Get the key for the policies location in the registry
529 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
530 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
531 0, KEY_READ, &Policy_basekey)) {
533 if (RegOpenKeyExA(HKEY_CURRENT_USER,
534 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
535 0, KEY_READ, &Policy_basekey)) {
536 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
537 policy);
538 *len = 0;
539 return ERROR_FILE_NOT_FOUND;
543 /* Retrieve the data if it exists
545 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
546 RegCloseKey(Policy_basekey);
547 return ret;
551 /*************************************************************************
552 * SHADD_compare_mru - helper function for SHAddToRecentDocs
554 * PARAMETERS
555 * data1 [IN] data being looked for
556 * data2 [IN] data in MRU
557 * cbdata [IN] length from FindMRUData call (not used)
559 * RETURNS
560 * position within MRU list that data was added.
562 static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
564 return lstrcmpiA(data1, data2);
567 /*************************************************************************
568 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
570 * PARAMETERS
571 * mruhandle [IN] handle for created MRU list
572 * doc_name [IN] null termed pure doc name
573 * new_lnk_name [IN] null termed path and file name for .lnk file
574 * buffer [IN/OUT] 2048 byte area to consturct MRU data
575 * len [OUT] ptr to int to receive space used in buffer
577 * RETURNS
578 * position within MRU list that data was added.
580 static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
581 LPSTR buffer, INT *len)
583 LPSTR ptr;
584 INT wlen;
586 /*FIXME: Document:
587 * RecentDocs MRU data structure seems to be:
588 * +0h document file name w/ terminating 0h
589 * +nh short int w/ size of remaining
590 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
591 * +n+4h 10 bytes zeros - unknown
592 * +n+eh shortcut file name w/ terminating 0h
593 * +n+e+nh 3 zero bytes - unknown
596 /* Create the MRU data structure for "RecentDocs"
598 ptr = buffer;
599 lstrcpyA(ptr, doc_name);
600 ptr += (lstrlenA(buffer) + 1);
601 wlen= lstrlenA(new_lnk_name) + 1 + 12;
602 *((short int*)ptr) = wlen;
603 ptr += 2; /* step past the length */
604 *(ptr++) = 0x30; /* unknown reason */
605 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
606 memset(ptr, 0, 10);
607 ptr += 10;
608 lstrcpyA(ptr, new_lnk_name);
609 ptr += (lstrlenA(new_lnk_name) + 1);
610 memset(ptr, 0, 3);
611 ptr += 3;
612 *len = ptr - buffer;
614 /* Add the new entry into the MRU list
616 return AddMRUData(mruhandle, (LPCVOID)buffer, *len);
619 /*************************************************************************
620 * SHAddToRecentDocs [SHELL32.@]
622 * PARAMETERS
623 * uFlags [IN] SHARD_PATH or SHARD_PIDL
624 * pv [IN] string or pidl, NULL clears the list
626 * NOTES
627 * exported by name
629 void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
631 /* If list is a string list lpfnCompare has the following prototype
632 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
633 * for binary lists the prototype is
634 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
635 * where cbData is the no. of bytes to compare.
636 * Need to check what return value means identical - 0?
640 UINT olderrormode;
641 HKEY HCUbasekey;
642 CHAR doc_name[MAX_PATH];
643 CHAR link_dir[MAX_PATH];
644 CHAR new_lnk_filepath[MAX_PATH];
645 CHAR new_lnk_name[MAX_PATH];
646 IMalloc *ppM;
647 LPITEMIDLIST pidl;
648 HWND hwnd = 0; /* FIXME: get real window handle */
649 INT ret;
650 DWORD data[64], datalen, type;
652 /*FIXME: Document:
653 * RecentDocs MRU data structure seems to be:
654 * +0h document file name w/ terminating 0h
655 * +nh short int w/ size of remaining
656 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
657 * +n+4h 10 bytes zeros - unknown
658 * +n+eh shortcut file name w/ terminating 0h
659 * +n+e+nh 3 zero bytes - unknown
662 /* See if we need to do anything.
664 datalen = 64;
665 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
666 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
667 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
668 return;
670 if (ret == ERROR_SUCCESS) {
671 if (!( (type == REG_DWORD) ||
672 ((type == REG_BINARY) && (datalen == 4)) )) {
673 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
674 type, datalen);
675 return;
678 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
679 /* now test the actual policy value */
680 if ( data[0] != 0)
681 return;
684 /* Open key to where the necessary info is
686 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
687 * and the close should be done during the _DETACH. The resulting
688 * key is stored in the DLL global data.
690 if (RegCreateKeyExA(HKEY_CURRENT_USER,
691 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
692 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
693 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
694 return;
697 /* Get path to user's "Recent" directory
699 if(SUCCEEDED(SHGetMalloc(&ppM))) {
700 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
701 &pidl))) {
702 SHGetPathFromIDListA(pidl, link_dir);
703 IMalloc_Free(ppM, pidl);
705 else {
706 /* serious issues */
707 link_dir[0] = 0;
708 ERR("serious issues 1\n");
710 IMalloc_Release(ppM);
712 else {
713 /* serious issues */
714 link_dir[0] = 0;
715 ERR("serious issues 2\n");
717 TRACE("Users Recent dir %s\n", link_dir);
719 /* If no input, then go clear the lists */
720 if (!pv) {
721 /* clear user's Recent dir
724 /* FIXME: delete all files in "link_dir"
726 * while( more files ) {
727 * lstrcpyA(old_lnk_name, link_dir);
728 * PathAppendA(old_lnk_name, filenam);
729 * DeleteFileA(old_lnk_name);
732 FIXME("should delete all files in %s\\ \n", link_dir);
734 /* clear MRU list
736 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
737 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
738 * and naturally it fails w/ rc=2. It should do it against
739 * HKEY_CURRENT_USER which is where it is stored, and where
740 * the MRU routines expect it!!!!
742 RegDeleteKeyA(HCUbasekey, "RecentDocs");
743 RegCloseKey(HCUbasekey);
744 return;
747 /* Have data to add, the jobs to be done:
748 * 1. Add document to MRU list in registry "HKCU\Software\
749 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
750 * 2. Add shortcut to document in the user's Recent directory
751 * (CSIDL_RECENT).
752 * 3. Add shortcut to Start menu's Documents submenu.
755 /* Get the pure document name from the input
757 if (uFlags & SHARD_PIDL) {
758 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
760 else {
761 lstrcpyA(doc_name, (LPSTR) pv);
763 TRACE("full document name %s\n", doc_name);
764 PathStripPathA(doc_name);
765 TRACE("stripped document name %s\n", doc_name);
768 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
770 { /* on input needs:
771 * doc_name - pure file-spec, no path
772 * link_dir - path to the user's Recent directory
773 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
774 * creates:
775 * new_lnk_name- pure file-spec, no path for new .lnk file
776 * new_lnk_filepath
777 * - path and file name of new .lnk file
779 CREATEMRULISTA mymru;
780 HANDLE mruhandle;
781 INT len, pos, bufused, err;
782 INT i;
783 DWORD attr;
784 CHAR buffer[2048];
785 CHAR *ptr;
786 CHAR old_lnk_name[MAX_PATH];
787 short int slen;
789 mymru.cbSize = sizeof(CREATEMRULISTA);
790 mymru.nMaxItems = 15;
791 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
792 mymru.hKey = HCUbasekey;
793 mymru.lpszSubKey = "RecentDocs";
794 mymru.lpfnCompare = &SHADD_compare_mru;
795 mruhandle = CreateMRUListA(&mymru);
796 if (!mruhandle) {
797 /* MRU failed */
798 ERR("MRU processing failed, handle zero\n");
799 RegCloseKey(HCUbasekey);
800 return;
802 len = lstrlenA(doc_name);
803 pos = FindMRUData(mruhandle, doc_name, len, 0);
805 /* Now get the MRU entry that will be replaced
806 * and delete the .lnk file for it
808 if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
809 buffer, 2048)) != -1) {
810 ptr = buffer;
811 ptr += (lstrlenA(buffer) + 1);
812 slen = *((short int*)ptr);
813 ptr += 2; /* skip the length area */
814 if (bufused >= slen + (ptr-buffer)) {
815 /* buffer size looks good */
816 ptr += 12; /* get to string */
817 len = bufused - (ptr-buffer); /* get length of buf remaining */
818 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
819 /* appears to be good string */
820 lstrcpyA(old_lnk_name, link_dir);
821 PathAppendA(old_lnk_name, ptr);
822 if (!DeleteFileA(old_lnk_name)) {
823 if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) {
824 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
825 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
826 old_lnk_name, err, attr);
828 else {
829 TRACE("old .lnk file %s did not exist\n",
830 old_lnk_name);
833 else {
834 ERR("Delete for %s failed, attr=%08lx\n",
835 old_lnk_name, attr);
838 else {
839 TRACE("deleted old .lnk file %s\n", old_lnk_name);
845 /* Create usable .lnk file name for the "Recent" directory
847 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
848 lstrcpyA(new_lnk_filepath, link_dir);
849 PathAppendA(new_lnk_filepath, new_lnk_name);
850 i = 1;
851 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
852 while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) {
853 i++;
854 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
855 lstrcpyA(new_lnk_filepath, link_dir);
856 PathAppendA(new_lnk_filepath, new_lnk_name);
858 SetErrorMode(olderrormode);
859 TRACE("new shortcut will be %s\n", new_lnk_filepath);
861 /* Now add the new MRU entry and data
863 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
864 buffer, &len);
865 FreeMRUList(mruhandle);
866 TRACE("Updated MRU list, new doc is position %d\n", pos);
869 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
871 { /* on input needs:
872 * doc_name - pure file-spec, no path
873 * new_lnk_filepath
874 * - path and file name of new .lnk file
875 * uFlags[in] - flags on call to SHAddToRecentDocs
876 * pv[in] - document path/pidl on call to SHAddToRecentDocs
878 IShellLinkA *psl = NULL;
879 IPersistFile *pPf = NULL;
880 HRESULT hres;
881 CHAR desc[MAX_PATH];
882 WCHAR widelink[MAX_PATH];
884 CoInitialize(0);
886 hres = CoCreateInstance( &CLSID_ShellLink,
887 NULL,
888 CLSCTX_INPROC_SERVER,
889 &IID_IShellLinkA,
890 (LPVOID )&psl);
891 if(SUCCEEDED(hres)) {
893 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
894 (LPVOID *)&pPf);
895 if(FAILED(hres)) {
896 /* bombed */
897 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
898 goto fail;
901 /* Set the document path or pidl */
902 if (uFlags & SHARD_PIDL) {
903 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
904 } else {
905 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
907 if(FAILED(hres)) {
908 /* bombed */
909 ERR("failed Set{IDList|Path} %08lx\n", hres);
910 goto fail;
913 lstrcpyA(desc, "Shortcut to ");
914 lstrcatA(desc, doc_name);
915 hres = IShellLinkA_SetDescription(psl, desc);
916 if(FAILED(hres)) {
917 /* bombed */
918 ERR("failed SetDescription %08lx\n", hres);
919 goto fail;
922 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
923 widelink, MAX_PATH);
924 /* create the short cut */
925 hres = IPersistFile_Save(pPf, widelink, TRUE);
926 if(FAILED(hres)) {
927 /* bombed */
928 ERR("failed IPersistFile::Save %08lx\n", hres);
929 IPersistFile_Release(pPf);
930 IShellLinkA_Release(psl);
931 goto fail;
933 hres = IPersistFile_SaveCompleted(pPf, widelink);
934 IPersistFile_Release(pPf);
935 IShellLinkA_Release(psl);
936 TRACE("shortcut %s has been created, result=%08lx\n",
937 new_lnk_filepath, hres);
939 else {
940 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
944 fail:
945 CoUninitialize();
947 /* all done */
948 RegCloseKey(HCUbasekey);
949 return;
952 /*************************************************************************
953 * SHCreateShellFolderViewEx [SHELL32.174]
955 * NOTES
956 * see IShellFolder::CreateViewObject
958 HRESULT WINAPI SHCreateShellFolderViewEx(
959 LPCSFV psvcbi, /* [in] shelltemplate struct */
960 IShellView **ppv) /* [out] IShellView pointer */
962 IShellView * psf;
963 HRESULT hRes;
965 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
966 psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
967 psvcbi->fvm, psvcbi->psvOuter);
969 psf = IShellView_Constructor(psvcbi->pshf);
971 if (!psf)
972 return E_OUTOFMEMORY;
974 IShellView_AddRef(psf);
975 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
976 IShellView_Release(psf);
978 return hRes;
980 /*************************************************************************
981 * SHWinHelp [SHELL32.127]
984 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
985 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
986 return 0;
988 /*************************************************************************
989 * SHRunControlPanel [SHELL32.161]
992 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
993 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
994 return 0;
997 static LPUNKNOWN SHELL32_IExplorerInterface=0;
998 /*************************************************************************
999 * SHSetInstanceExplorer [SHELL32.176]
1001 * NOTES
1002 * Sets the interface
1004 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
1005 { TRACE("%p\n", lpUnknown);
1006 SHELL32_IExplorerInterface = lpUnknown;
1007 return (HRESULT) lpUnknown;
1009 /*************************************************************************
1010 * SHGetInstanceExplorer [SHELL32.@]
1012 * NOTES
1013 * gets the interface pointer of the explorer and a reference
1015 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
1016 { TRACE("%p\n", lpUnknown);
1018 *lpUnknown = SHELL32_IExplorerInterface;
1020 if (!SHELL32_IExplorerInterface)
1021 return E_FAIL;
1023 IUnknown_AddRef(SHELL32_IExplorerInterface);
1024 return NOERROR;
1026 /*************************************************************************
1027 * SHFreeUnusedLibraries [SHELL32.123]
1029 * NOTES
1030 * exported by name
1032 void WINAPI SHFreeUnusedLibraries (void)
1034 FIXME("stub\n");
1036 /*************************************************************************
1037 * DAD_AutoScroll [SHELL32.129]
1040 BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, LPPOINT pt)
1042 FIXME("hwnd = %p %p %p\n",hwnd,samples,pt);
1043 return 0;
1045 /*************************************************************************
1046 * DAD_DragEnter [SHELL32.130]
1049 BOOL WINAPI DAD_DragEnter(HWND hwnd)
1051 FIXME("hwnd = %p\n",hwnd);
1052 return FALSE;
1054 /*************************************************************************
1055 * DAD_DragEnterEx [SHELL32.131]
1058 BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p)
1060 FIXME("hwnd = %p (%ld,%ld)\n",hwnd,p.x,p.y);
1061 return FALSE;
1063 /*************************************************************************
1064 * DAD_DragMove [SHELL32.134]
1067 BOOL WINAPI DAD_DragMove(POINT p)
1069 FIXME("(%ld,%ld)\n",p.x,p.y);
1070 return FALSE;
1072 /*************************************************************************
1073 * DAD_DragLeave [SHELL32.132]
1076 BOOL WINAPI DAD_DragLeave(VOID)
1078 FIXME("\n");
1079 return FALSE;
1081 /*************************************************************************
1082 * DAD_SetDragImage [SHELL32.136]
1084 * NOTES
1085 * exported by name
1087 BOOL WINAPI DAD_SetDragImage(
1088 HIMAGELIST himlTrack,
1089 LPPOINT lppt)
1091 FIXME("%p %p stub\n",himlTrack, lppt);
1092 return 0;
1094 /*************************************************************************
1095 * DAD_ShowDragImage [SHELL32.137]
1097 * NOTES
1098 * exported by name
1100 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1102 FIXME("0x%08x stub\n",bShow);
1103 return 0;
1106 static const WCHAR szwCabLocation[] = {
1107 'S','o','f','t','w','a','r','e','\\',
1108 'M','i','c','r','o','s','o','f','t','\\',
1109 'W','i','n','d','o','w','s','\\',
1110 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1111 'E','x','p','l','o','r','e','r','\\',
1112 'C','a','b','i','n','e','t','S','t','a','t','e',0
1115 static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 };
1117 /*************************************************************************
1118 * ReadCabinetState [SHELL32.651] NT 4.0
1121 BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
1123 HKEY hkey = 0;
1124 DWORD type, r;
1126 TRACE("%p %d \n",cs,length);
1128 if( (cs == NULL) || (length < (int)sizeof(*cs)) )
1129 return FALSE;
1131 r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey );
1132 if( r == ERROR_SUCCESS )
1134 type = REG_BINARY;
1135 r = RegQueryValueExW( hkey, szwSettings,
1136 NULL, &type, (LPBYTE)cs, (LPDWORD)&length );
1137 RegCloseKey( hkey );
1141 /* if we can't read from the registry, create default values */
1142 if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) ||
1143 (cs->cLength != length) )
1145 ERR("Initializing shell cabinet settings\n");
1146 memset(cs, 0, sizeof(*cs));
1147 cs->cLength = sizeof(*cs);
1148 cs->nVersion = 2;
1149 cs->fFullPathTitle = FALSE;
1150 cs->fSaveLocalView = TRUE;
1151 cs->fNotShell = FALSE;
1152 cs->fSimpleDefault = TRUE;
1153 cs->fDontShowDescBar = FALSE;
1154 cs->fNewWindowMode = FALSE;
1155 cs->fShowCompColor = FALSE;
1156 cs->fDontPrettyNames = FALSE;
1157 cs->fAdminsCreateCommonGroups = TRUE;
1158 cs->fMenuEnumFilter = 96;
1161 return TRUE;
1164 /*************************************************************************
1165 * WriteCabinetState [SHELL32.652] NT 4.0
1168 BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
1170 DWORD r;
1171 HKEY hkey = 0;
1173 TRACE("%p\n",cs);
1175 if( cs == NULL )
1176 return FALSE;
1178 r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0,
1179 NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
1180 if( r == ERROR_SUCCESS )
1182 r = RegSetValueExW( hkey, szwSettings, 0,
1183 REG_BINARY, (LPBYTE) cs, cs->cLength);
1185 RegCloseKey( hkey );
1188 return (r==ERROR_SUCCESS);
1191 /*************************************************************************
1192 * FileIconInit [SHELL32.660]
1195 BOOL WINAPI FileIconInit(BOOL bFullInit)
1196 { FIXME("(%s)\n", bFullInit ? "true" : "false");
1197 return 0;
1199 /*************************************************************************
1200 * IsUserAdmin [SHELL32.680] NT 4.0
1203 HRESULT WINAPI IsUserAdmin(void)
1204 { FIXME("stub\n");
1205 return TRUE;
1208 /*************************************************************************
1209 * SHAllocShared [SHELL32.520]
1211 * See shlwapi.SHAllocShared
1213 HANDLE WINAPI SHAllocShared(LPVOID lpvData, DWORD dwSize, DWORD dwProcId)
1215 GET_FUNC(pSHAllocShared, shlwapi, (char*)7, NULL);
1216 return pSHAllocShared(lpvData, dwSize, dwProcId);
1219 /*************************************************************************
1220 * SHLockShared [SHELL32.521]
1222 * See shlwapi.SHLockShared
1224 LPVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId)
1226 GET_FUNC(pSHLockShared, shlwapi, (char*)8, NULL);
1227 return pSHLockShared(hShared, dwProcId);
1230 /*************************************************************************
1231 * SHUnlockShared [SHELL32.522]
1233 * See shlwapi.SHUnlockShared
1235 BOOL WINAPI SHUnlockShared(LPVOID lpView)
1237 GET_FUNC(pSHUnlockShared, shlwapi, (char*)9, FALSE);
1238 return pSHUnlockShared(lpView);
1241 /*************************************************************************
1242 * SHFreeShared [SHELL32.523]
1244 * See shlwapi.SHFreeShared
1246 BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId)
1248 GET_FUNC(pSHFreeShared, shlwapi, (char*)10, FALSE);
1249 return pSHFreeShared(hShared, dwProcId);
1252 /*************************************************************************
1253 * SetAppStartingCursor [SHELL32.99]
1255 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1256 { FIXME("hwnd=%p 0x%04lx stub\n",u,v );
1257 return 0;
1259 /*************************************************************************
1260 * SHLoadOLE [SHELL32.151]
1263 HRESULT WINAPI SHLoadOLE(LPARAM lParam)
1264 { FIXME("0x%04lx stub\n",lParam);
1265 return S_OK;
1267 /*************************************************************************
1268 * DriveType [SHELL32.64]
1271 HRESULT WINAPI DriveType(DWORD u)
1272 { FIXME("0x%04lx stub\n",u);
1273 return 0;
1275 /*************************************************************************
1276 * SHAbortInvokeCommand [SHELL32.198]
1279 HRESULT WINAPI SHAbortInvokeCommand(void)
1280 { FIXME("stub\n");
1281 return 1;
1283 /*************************************************************************
1284 * SHOutOfMemoryMessageBox [SHELL32.126]
1287 int WINAPI SHOutOfMemoryMessageBox(
1288 HWND hwndOwner,
1289 LPCSTR lpCaption,
1290 UINT uType)
1292 FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1293 return 0;
1295 /*************************************************************************
1296 * SHFlushClipboard [SHELL32.121]
1299 HRESULT WINAPI SHFlushClipboard(void)
1300 { FIXME("stub\n");
1301 return 1;
1304 /*************************************************************************
1305 * SHWaitForFileToOpen [SHELL32.97]
1308 BOOL WINAPI SHWaitForFileToOpen(
1309 LPCITEMIDLIST pidl,
1310 DWORD dwFlags,
1311 DWORD dwTimeout)
1313 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1314 return 0;
1317 /************************************************************************
1318 * @ [SHELL32.654]
1320 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1321 * second one could be a size (0x0c). The size is the same as the structure saved to
1322 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1323 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1325 HRESULT WINAPI shell32_654 (CABINETSTATE *cs, int length)
1327 TRACE("%p %d\n",cs,length);
1328 return ReadCabinetState(cs,length);
1331 /************************************************************************
1332 * RLBuildListOfPaths [SHELL32.146]
1334 * NOTES
1335 * builds a DPA
1337 DWORD WINAPI RLBuildListOfPaths (void)
1338 { FIXME("stub\n");
1339 return 0;
1341 /************************************************************************
1342 * SHValidateUNC [SHELL32.173]
1345 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1347 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1348 return 0;
1351 /************************************************************************
1352 * DoEnvironmentSubstA [SHELL32.@]
1355 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1357 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1358 return 0;
1361 /************************************************************************
1362 * DoEnvironmentSubstW [SHELL32.@]
1365 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1367 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1368 return 0;
1371 /************************************************************************
1372 * DoEnvironmentSubst [SHELL32.53]
1375 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1377 if (SHELL_OsIsUnicode())
1378 return DoEnvironmentSubstW(x, y);
1379 return DoEnvironmentSubstA(x, y);
1382 /*************************************************************************
1383 * @ [SHELL32.243]
1385 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1386 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1390 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1392 return FALSE;
1395 /*************************************************************************
1396 * @ [SHELL32.714]
1398 DWORD WINAPI SHELL32_714(LPVOID x)
1400 FIXME("(%s)stub\n", debugstr_w(x));
1401 return 0;
1404 /*************************************************************************
1405 * SHAddFromPropSheetExtArray [SHELL32.167]
1407 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1409 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1410 return 0;
1413 /*************************************************************************
1414 * SHCreatePropSheetExtArray [SHELL32.168]
1416 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1418 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1419 return 0;
1422 /*************************************************************************
1423 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1425 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1427 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1428 return 0;
1431 /*************************************************************************
1432 * SHDestroyPropSheetExtArray [SHELL32.169]
1434 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1436 FIXME("(%08lx)stub\n", a);
1437 return 0;
1440 /*************************************************************************
1441 * CIDLData_CreateFromIDArray [SHELL32.83]
1443 * Create IDataObject from PIDLs??
1445 HRESULT WINAPI CIDLData_CreateFromIDArray(
1446 LPCITEMIDLIST pidlFolder,
1447 DWORD cpidlFiles,
1448 LPCITEMIDLIST *lppidlFiles,
1449 LPDATAOBJECT *ppdataObject)
1451 UINT i;
1452 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1454 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
1455 if (TRACE_ON(pidl))
1457 pdump (pidlFolder);
1458 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
1460 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1461 lppidlFiles, cpidlFiles);
1462 if (*ppdataObject) return S_OK;
1463 return E_OUTOFMEMORY;
1466 /*************************************************************************
1467 * SHCreateStdEnumFmtEtc [SHELL32.74]
1469 * NOTES
1472 HRESULT WINAPI SHCreateStdEnumFmtEtc(
1473 DWORD cFormats,
1474 const FORMATETC *lpFormats,
1475 LPENUMFORMATETC *ppenumFormatetc)
1477 IEnumFORMATETC *pef;
1478 HRESULT hRes;
1479 TRACE("cf=%ld fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc);
1481 pef = IEnumFORMATETC_Constructor(cFormats, lpFormats);
1482 if (!pef)
1483 return E_OUTOFMEMORY;
1485 IEnumFORMATETC_AddRef(pef);
1486 hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc);
1487 IEnumFORMATETC_Release(pef);
1489 return hRes;
1493 /*************************************************************************
1494 * SHELL32_256 (SHELL32.256)
1496 HRESULT WINAPI SHELL32_256(LPDWORD lpdw0, LPDWORD lpdw1)
1498 HRESULT ret = S_OK;
1500 FIXME("stub %p 0x%08lx %p\n", lpdw0, lpdw0 ? *lpdw0 : 0, lpdw1);
1502 if (!lpdw0 || *lpdw0 != 0x10)
1503 ret = E_INVALIDARG;
1504 else
1506 LPVOID lpdata = 0;/*LocalAlloc(GMEM_ZEROINIT, 0x4E4);*/
1508 if (!lpdata)
1509 ret = E_OUTOFMEMORY;
1510 else
1512 /* Initialize and return unknown lpdata structure */
1516 return ret;
1519 /*************************************************************************
1520 * SHFindFiles (SHELL32.90)
1522 BOOL WINAPI SHFindFiles( LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlSaveFile )
1524 FIXME("%p %p\n", pidlFolder, pidlSaveFile );
1525 return FALSE;
1528 /*************************************************************************
1529 * SHUpdateImageW (SHELL32.192)
1531 * Notifies the shell that an icon in the system image list has been changed.
1533 * PARAMS
1534 * pszHashItem [I] Path to file that contains the icon.
1535 * iIndex [I] Zero-based index of the icon in the file.
1536 * uFlags [I] Flags determining the icon attributes. See notes.
1537 * iImageIndex [I] Index of the icon in the system image list.
1539 * NOTES
1540 * uFlags can be one or more of the following flags:
1541 * GIL_NOTFILENAME - pszHashItem is not a file name.
1542 * GIL_SIMULATEDOC - Create a document icon using the specified icon.
1544 void WINAPI SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex)
1546 FIXME("%s, %d, 0x%x, %d\n", debugstr_w(pszHashItem), iIndex, uFlags, iImageIndex);