Moved some more definitions out of undocshell.h into the exported
[wine/multimedia.git] / dlls / shell32 / shellord.c
blob55b0b3f33ebed92991926f9f0b939e3dcfdbc896
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);
72 /*************************************************************************
73 * ParseFieldA [internal]
75 * copies a field from a ',' delimited string
77 * first field is nField = 1
79 DWORD WINAPI ParseFieldA(
80 LPCSTR src,
81 DWORD nField,
82 LPSTR dst,
83 DWORD len)
85 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
87 if (!src || !src[0] || !dst || !len)
88 return 0;
90 /* skip n fields delimited by ',' */
91 while (nField > 1)
93 if (*src=='\0') return FALSE;
94 if (*(src++)==',') nField--;
97 /* copy part till the next ',' to dst */
98 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
100 /* finalize the string */
101 *dst=0x0;
103 return TRUE;
106 /*************************************************************************
107 * ParseFieldW [internal]
109 * copies a field from a ',' delimited string
111 * first field is nField = 1
113 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
115 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n", debugstr_w(src), nField, dst, len);
117 if (!src || !src[0] || !dst || !len)
118 return 0;
120 /* skip n fields delimited by ',' */
121 while (nField > 1)
123 if (*src == 0x0) return FALSE;
124 if (*src++ == ',') nField--;
127 /* copy part till the next ',' to dst */
128 while ( *src != 0x0 && *src != ',' && (len--)>0 ) *(dst++) = *(src++);
130 /* finalize the string */
131 *dst = 0x0;
133 return TRUE;
136 /*************************************************************************
137 * ParseField [SHELL32.58]
139 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
141 if (SHELL_OsIsUnicode())
142 return ParseFieldW(src, nField, dst, len);
143 return ParseFieldA(src, nField, dst, len);
146 /*************************************************************************
147 * GetFileNameFromBrowse [SHELL32.63]
150 BOOL WINAPI GetFileNameFromBrowse(
151 HWND hwndOwner,
152 LPSTR lpstrFile,
153 DWORD nMaxFile,
154 LPCSTR lpstrInitialDir,
155 LPCSTR lpstrDefExt,
156 LPCSTR lpstrFilter,
157 LPCSTR lpstrTitle)
159 HMODULE hmodule;
160 FARPROC pGetOpenFileNameA;
161 OPENFILENAMEA ofn;
162 BOOL ret;
164 TRACE("%p, %s, %ld, %s, %s, %s, %s)\n",
165 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
166 lpstrFilter, lpstrTitle);
168 hmodule = LoadLibraryA("comdlg32.dll");
169 if(!hmodule) return FALSE;
170 pGetOpenFileNameA = GetProcAddress(hmodule, "GetOpenFileNameA");
171 if(!pGetOpenFileNameA)
173 FreeLibrary(hmodule);
174 return FALSE;
177 memset(&ofn, 0, sizeof(ofn));
179 ofn.lStructSize = sizeof(ofn);
180 ofn.hwndOwner = hwndOwner;
181 ofn.lpstrFilter = lpstrFilter;
182 ofn.lpstrFile = lpstrFile;
183 ofn.nMaxFile = nMaxFile;
184 ofn.lpstrInitialDir = lpstrInitialDir;
185 ofn.lpstrTitle = lpstrTitle;
186 ofn.lpstrDefExt = lpstrDefExt;
187 ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
188 ret = pGetOpenFileNameA(&ofn);
190 FreeLibrary(hmodule);
191 return ret;
194 /*************************************************************************
195 * SHGetSetSettings [SHELL32.68]
197 VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
199 if(bSet)
201 FIXME("%p 0x%08lx TRUE\n", lpss, dwMask);
203 else
205 SHGetSettings((LPSHELLFLAGSTATE)lpss,dwMask);
209 /*************************************************************************
210 * SHGetSettings [SHELL32.@]
212 * NOTES
213 * the registry path are for win98 (tested)
214 * and possibly are the same in nt40
217 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
219 HKEY hKey;
220 DWORD dwData;
221 DWORD dwDataSize = sizeof (DWORD);
223 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
225 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
226 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
227 return;
229 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
230 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
232 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
233 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
235 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
236 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
238 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
239 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
241 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
242 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
244 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
245 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
247 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
248 { if (dwData == 0)
249 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
250 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
252 else if (dwData == 1)
253 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
254 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
256 else if (dwData == 2)
257 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
258 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
261 RegCloseKey (hKey);
263 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
266 /*************************************************************************
267 * SHShellFolderView_Message [SHELL32.73]
269 * Send a message to an explorer cabinet window.
271 * PARAMS
272 * hwndCabinet [I] The window containing the shellview to communicate with
273 * dwMessage [I] The SFVM message to send
274 * dwParam [I] Message parameter
276 * RETURNS
277 * fixme.
279 * NOTES
280 * Message SFVM_REARRANGE = 1
282 * This message gets sent when a column gets clicked to instruct the
283 * shell view to re-sort the item list. dwParam identifies the column
284 * that was clicked.
286 int WINAPI SHShellFolderView_Message(
287 HWND hwndCabinet,
288 DWORD dwMessage,
289 DWORD dwParam)
291 FIXME("%p %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
292 return 0;
295 /*************************************************************************
296 * RegisterShellHook [SHELL32.181]
298 * Register a shell hook.
300 * PARAMS
301 * hwnd [I] Window handle
302 * dwType [I] Type of hook.
304 * NOTES
305 * Exported by ordinal
307 BOOL WINAPI RegisterShellHook(
308 HWND hWnd,
309 DWORD dwType)
311 FIXME("(%p,0x%08lx):stub.\n",hWnd, dwType);
312 return TRUE;
315 /*************************************************************************
316 * ShellMessageBoxW [SHELL32.182]
318 * See ShellMessageBoxA.
320 int WINAPIV ShellMessageBoxW(
321 HINSTANCE hInstance,
322 HWND hWnd,
323 LPCWSTR lpText,
324 LPCWSTR lpCaption,
325 UINT uType,
326 ...)
328 WCHAR szText[100],szTitle[100];
329 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
330 va_list args;
331 int ret;
333 va_start(args, uType);
334 /* wvsprintfA(buf,fmt, args); */
336 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
337 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
339 if (!HIWORD(lpCaption))
340 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
341 else
342 pszTitle = lpCaption;
344 if (!HIWORD(lpText))
345 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
346 else
347 pszText = lpText;
349 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
350 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
352 va_end(args);
354 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
355 LocalFree((HLOCAL)pszTemp);
356 return ret;
359 /*************************************************************************
360 * ShellMessageBoxA [SHELL32.183]
362 * Format and output an error message.
364 * PARAMS
365 * hInstance [I] Instance handle of message creator
366 * hWnd [I] Window handle of message creator
367 * lpText [I] Resource Id of title or LPSTR
368 * lpCaption [I] Resource Id of title or LPSTR
369 * uType [I] Type of error message
371 * RETURNS
372 * A return value from MessageBoxA().
374 * NOTES
375 * Exported by ordinal
377 int WINAPIV ShellMessageBoxA(
378 HINSTANCE hInstance,
379 HWND hWnd,
380 LPCSTR lpText,
381 LPCSTR lpCaption,
382 UINT uType,
383 ...)
385 char szText[100],szTitle[100];
386 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
387 va_list args;
388 int ret;
390 va_start(args, uType);
391 /* wvsprintfA(buf,fmt, args); */
393 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
394 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
396 if (!HIWORD(lpCaption))
397 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
398 else
399 pszTitle = lpCaption;
401 if (!HIWORD(lpText))
402 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
403 else
404 pszText = lpText;
406 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
407 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
409 va_end(args);
411 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
412 LocalFree((HLOCAL)pszTemp);
413 return ret;
416 /*************************************************************************
417 * SHRegisterDragDrop [SHELL32.86]
419 * NOTES
420 * exported by ordinal
422 HRESULT WINAPI SHRegisterDragDrop(
423 HWND hWnd,
424 LPDROPTARGET pDropTarget)
426 FIXME("(%p,%p):stub.\n", hWnd, pDropTarget);
427 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
428 return 0;
431 /*************************************************************************
432 * SHRevokeDragDrop [SHELL32.87]
434 * NOTES
435 * exported by ordinal
437 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
439 FIXME("(%p):stub.\n",hWnd);
440 if (GetShellOle()) return pRevokeDragDrop(hWnd);
441 return 0;
444 /*************************************************************************
445 * SHDoDragDrop [SHELL32.88]
447 * NOTES
448 * exported by ordinal
450 HRESULT WINAPI SHDoDragDrop(
451 HWND hWnd,
452 LPDATAOBJECT lpDataObject,
453 LPDROPSOURCE lpDropSource,
454 DWORD dwOKEffect,
455 LPDWORD pdwEffect)
457 FIXME("(%p %p %p 0x%08lx %p):stub.\n",
458 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
459 if (GetShellOle()) return pDoDragDrop(lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
460 return 0;
463 /*************************************************************************
464 * ArrangeWindows [SHELL32.184]
467 WORD WINAPI ArrangeWindows(
468 HWND hwndParent,
469 DWORD dwReserved,
470 LPCRECT lpRect,
471 WORD cKids,
472 CONST HWND * lpKids)
474 FIXME("(%p 0x%08lx %p 0x%04x %p):stub.\n",
475 hwndParent, dwReserved, lpRect, cKids, lpKids);
476 return 0;
479 /*************************************************************************
480 * SignalFileOpen [SHELL32.103]
482 * NOTES
483 * exported by ordinal
485 DWORD WINAPI
486 SignalFileOpen (DWORD dwParam1)
488 FIXME("(0x%08lx):stub.\n", dwParam1);
490 return 0;
493 /*************************************************************************
494 * SHADD_get_policy - helper function for SHAddToRecentDocs
496 * PARAMETERS
497 * policy [IN] policy name (null termed string) to find
498 * type [OUT] ptr to DWORD to receive type
499 * buffer [OUT] ptr to area to hold data retrieved
500 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
501 * length filled
503 * RETURNS
504 * result of the SHQueryValueEx call
506 static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
508 HKEY Policy_basekey;
509 INT ret;
511 /* Get the key for the policies location in the registry
513 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
514 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
515 0, KEY_READ, &Policy_basekey)) {
517 if (RegOpenKeyExA(HKEY_CURRENT_USER,
518 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
519 0, KEY_READ, &Policy_basekey)) {
520 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
521 policy);
522 *len = 0;
523 return ERROR_FILE_NOT_FOUND;
527 /* Retrieve the data if it exists
529 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
530 RegCloseKey(Policy_basekey);
531 return ret;
535 /*************************************************************************
536 * SHADD_compare_mru - helper function for SHAddToRecentDocs
538 * PARAMETERS
539 * data1 [IN] data being looked for
540 * data2 [IN] data in MRU
541 * cbdata [IN] length from FindMRUData call (not used)
543 * RETURNS
544 * position within MRU list that data was added.
546 static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
548 return lstrcmpiA(data1, data2);
551 /*************************************************************************
552 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
554 * PARAMETERS
555 * mruhandle [IN] handle for created MRU list
556 * doc_name [IN] null termed pure doc name
557 * new_lnk_name [IN] null termed path and file name for .lnk file
558 * buffer [IN/OUT] 2048 byte area to consturct MRU data
559 * len [OUT] ptr to int to receive space used in buffer
561 * RETURNS
562 * position within MRU list that data was added.
564 static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
565 LPSTR buffer, INT *len)
567 LPSTR ptr;
568 INT wlen;
570 /*FIXME: Document:
571 * RecentDocs MRU data structure seems to be:
572 * +0h document file name w/ terminating 0h
573 * +nh short int w/ size of remaining
574 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
575 * +n+4h 10 bytes zeros - unknown
576 * +n+eh shortcut file name w/ terminating 0h
577 * +n+e+nh 3 zero bytes - unknown
580 /* Create the MRU data structure for "RecentDocs"
582 ptr = buffer;
583 lstrcpyA(ptr, doc_name);
584 ptr += (lstrlenA(buffer) + 1);
585 wlen= lstrlenA(new_lnk_name) + 1 + 12;
586 *((short int*)ptr) = wlen;
587 ptr += 2; /* step past the length */
588 *(ptr++) = 0x30; /* unknown reason */
589 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
590 memset(ptr, 0, 10);
591 ptr += 10;
592 lstrcpyA(ptr, new_lnk_name);
593 ptr += (lstrlenA(new_lnk_name) + 1);
594 memset(ptr, 0, 3);
595 ptr += 3;
596 *len = ptr - buffer;
598 /* Add the new entry into the MRU list
600 return AddMRUData(mruhandle, (LPCVOID)buffer, *len);
603 /*************************************************************************
604 * SHAddToRecentDocs [SHELL32.@]
606 * PARAMETERS
607 * uFlags [IN] SHARD_PATH or SHARD_PIDL
608 * pv [IN] string or pidl, NULL clears the list
610 * NOTES
611 * exported by name
613 * FIXME: ?? MSDN shows this as a VOID
615 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
617 /* If list is a string list lpfnCompare has the following prototype
618 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
619 * for binary lists the prototype is
620 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
621 * where cbData is the no. of bytes to compare.
622 * Need to check what return value means identical - 0?
626 UINT olderrormode;
627 HKEY HCUbasekey;
628 CHAR doc_name[MAX_PATH];
629 CHAR link_dir[MAX_PATH];
630 CHAR new_lnk_filepath[MAX_PATH];
631 CHAR new_lnk_name[MAX_PATH];
632 IMalloc *ppM;
633 LPITEMIDLIST pidl;
634 HWND hwnd = 0; /* FIXME: get real window handle */
635 INT ret;
636 DWORD data[64], datalen, type;
638 /*FIXME: Document:
639 * RecentDocs MRU data structure seems to be:
640 * +0h document file name w/ terminating 0h
641 * +nh short int w/ size of remaining
642 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
643 * +n+4h 10 bytes zeros - unknown
644 * +n+eh shortcut file name w/ terminating 0h
645 * +n+e+nh 3 zero bytes - unknown
648 /* See if we need to do anything.
650 datalen = 64;
651 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
652 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
653 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
654 return 0;
656 if (ret == ERROR_SUCCESS) {
657 if (!( (type == REG_DWORD) ||
658 ((type == REG_BINARY) && (datalen == 4)) )) {
659 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
660 type, datalen);
661 return 0;
664 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
665 /* now test the actual policy value */
666 if ( data[0] != 0)
667 return 0;
670 /* Open key to where the necessary info is
672 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
673 * and the close should be done during the _DETACH. The resulting
674 * key is stored in the DLL global data.
676 if (RegCreateKeyExA(HKEY_CURRENT_USER,
677 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
678 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
679 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
680 return 0;
683 /* Get path to user's "Recent" directory
685 if(SUCCEEDED(SHGetMalloc(&ppM))) {
686 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
687 &pidl))) {
688 SHGetPathFromIDListA(pidl, link_dir);
689 IMalloc_Free(ppM, pidl);
691 else {
692 /* serious issues */
693 link_dir[0] = 0;
694 ERR("serious issues 1\n");
696 IMalloc_Release(ppM);
698 else {
699 /* serious issues */
700 link_dir[0] = 0;
701 ERR("serious issues 2\n");
703 TRACE("Users Recent dir %s\n", link_dir);
705 /* If no input, then go clear the lists */
706 if (!pv) {
707 /* clear user's Recent dir
710 /* FIXME: delete all files in "link_dir"
712 * while( more files ) {
713 * lstrcpyA(old_lnk_name, link_dir);
714 * PathAppendA(old_lnk_name, filenam);
715 * DeleteFileA(old_lnk_name);
718 FIXME("should delete all files in %s\\ \n", link_dir);
720 /* clear MRU list
722 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
723 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
724 * and naturally it fails w/ rc=2. It should do it against
725 * HKEY_CURRENT_USER which is where it is stored, and where
726 * the MRU routines expect it!!!!
728 RegDeleteKeyA(HCUbasekey, "RecentDocs");
729 RegCloseKey(HCUbasekey);
730 return 0;
733 /* Have data to add, the jobs to be done:
734 * 1. Add document to MRU list in registry "HKCU\Software\
735 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
736 * 2. Add shortcut to document in the user's Recent directory
737 * (CSIDL_RECENT).
738 * 3. Add shortcut to Start menu's Documents submenu.
741 /* Get the pure document name from the input
743 if (uFlags & SHARD_PIDL) {
744 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
746 else {
747 lstrcpyA(doc_name, (LPSTR) pv);
749 TRACE("full document name %s\n", doc_name);
750 PathStripPathA(doc_name);
751 TRACE("stripped document name %s\n", doc_name);
754 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
756 { /* on input needs:
757 * doc_name - pure file-spec, no path
758 * link_dir - path to the user's Recent directory
759 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
760 * creates:
761 * new_lnk_name- pure file-spec, no path for new .lnk file
762 * new_lnk_filepath
763 * - path and file name of new .lnk file
765 CREATEMRULISTA mymru;
766 HANDLE mruhandle;
767 INT len, pos, bufused, err;
768 INT i;
769 DWORD attr;
770 CHAR buffer[2048];
771 CHAR *ptr;
772 CHAR old_lnk_name[MAX_PATH];
773 short int slen;
775 mymru.cbSize = sizeof(CREATEMRULISTA);
776 mymru.nMaxItems = 15;
777 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
778 mymru.hKey = HCUbasekey;
779 mymru.lpszSubKey = "RecentDocs";
780 mymru.lpfnCompare = &SHADD_compare_mru;
781 mruhandle = CreateMRUListA(&mymru);
782 if (!mruhandle) {
783 /* MRU failed */
784 ERR("MRU processing failed, handle zero\n");
785 RegCloseKey(HCUbasekey);
786 return 0;
788 len = lstrlenA(doc_name);
789 pos = FindMRUData(mruhandle, doc_name, len, 0);
791 /* Now get the MRU entry that will be replaced
792 * and delete the .lnk file for it
794 if ((bufused = EnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
795 buffer, 2048)) != -1) {
796 ptr = buffer;
797 ptr += (lstrlenA(buffer) + 1);
798 slen = *((short int*)ptr);
799 ptr += 2; /* skip the length area */
800 if (bufused >= slen + (ptr-buffer)) {
801 /* buffer size looks good */
802 ptr += 12; /* get to string */
803 len = bufused - (ptr-buffer); /* get length of buf remaining */
804 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
805 /* appears to be good string */
806 lstrcpyA(old_lnk_name, link_dir);
807 PathAppendA(old_lnk_name, ptr);
808 if (!DeleteFileA(old_lnk_name)) {
809 if ((attr = GetFileAttributesA(old_lnk_name)) == INVALID_FILE_ATTRIBUTES) {
810 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
811 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
812 old_lnk_name, err, attr);
814 else {
815 TRACE("old .lnk file %s did not exist\n",
816 old_lnk_name);
819 else {
820 ERR("Delete for %s failed, attr=%08lx\n",
821 old_lnk_name, attr);
824 else {
825 TRACE("deleted old .lnk file %s\n", old_lnk_name);
831 /* Create usable .lnk file name for the "Recent" directory
833 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
834 lstrcpyA(new_lnk_filepath, link_dir);
835 PathAppendA(new_lnk_filepath, new_lnk_name);
836 i = 1;
837 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
838 while (GetFileAttributesA(new_lnk_filepath) != INVALID_FILE_ATTRIBUTES) {
839 i++;
840 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
841 lstrcpyA(new_lnk_filepath, link_dir);
842 PathAppendA(new_lnk_filepath, new_lnk_name);
844 SetErrorMode(olderrormode);
845 TRACE("new shortcut will be %s\n", new_lnk_filepath);
847 /* Now add the new MRU entry and data
849 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
850 buffer, &len);
851 FreeMRUList(mruhandle);
852 TRACE("Updated MRU list, new doc is position %d\n", pos);
855 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
857 { /* on input needs:
858 * doc_name - pure file-spec, no path
859 * new_lnk_filepath
860 * - path and file name of new .lnk file
861 * uFlags[in] - flags on call to SHAddToRecentDocs
862 * pv[in] - document path/pidl on call to SHAddToRecentDocs
864 IShellLinkA *psl = NULL;
865 IPersistFile *pPf = NULL;
866 HRESULT hres;
867 CHAR desc[MAX_PATH];
868 WCHAR widelink[MAX_PATH];
870 CoInitialize(0);
872 hres = CoCreateInstance( &CLSID_ShellLink,
873 NULL,
874 CLSCTX_INPROC_SERVER,
875 &IID_IShellLinkA,
876 (LPVOID )&psl);
877 if(SUCCEEDED(hres)) {
879 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
880 (LPVOID *)&pPf);
881 if(FAILED(hres)) {
882 /* bombed */
883 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
884 goto fail;
887 /* Set the document path or pidl */
888 if (uFlags & SHARD_PIDL) {
889 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
890 } else {
891 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
893 if(FAILED(hres)) {
894 /* bombed */
895 ERR("failed Set{IDList|Path} %08lx\n", hres);
896 goto fail;
899 lstrcpyA(desc, "Shortcut to ");
900 lstrcatA(desc, doc_name);
901 hres = IShellLinkA_SetDescription(psl, desc);
902 if(FAILED(hres)) {
903 /* bombed */
904 ERR("failed SetDescription %08lx\n", hres);
905 goto fail;
908 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
909 widelink, MAX_PATH);
910 /* create the short cut */
911 hres = IPersistFile_Save(pPf, widelink, TRUE);
912 if(FAILED(hres)) {
913 /* bombed */
914 ERR("failed IPersistFile::Save %08lx\n", hres);
915 IPersistFile_Release(pPf);
916 IShellLinkA_Release(psl);
917 goto fail;
919 hres = IPersistFile_SaveCompleted(pPf, widelink);
920 IPersistFile_Release(pPf);
921 IShellLinkA_Release(psl);
922 TRACE("shortcut %s has been created, result=%08lx\n",
923 new_lnk_filepath, hres);
925 else {
926 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
930 fail:
931 CoUninitialize();
933 /* all done */
934 RegCloseKey(HCUbasekey);
935 return 0;
938 /*************************************************************************
939 * SHCreateShellFolderViewEx [SHELL32.174]
941 * NOTES
942 * see IShellFolder::CreateViewObject
944 HRESULT WINAPI SHCreateShellFolderViewEx(
945 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */
946 LPSHELLVIEW* ppv) /* [out] IShellView pointer */
948 IShellView * psf;
949 HRESULT hRes;
951 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
952 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
953 psvcbi->uViewMode, psvcbi->dwUser);
955 psf = IShellView_Constructor(psvcbi->pshf);
957 if (!psf)
958 return E_OUTOFMEMORY;
960 IShellView_AddRef(psf);
961 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
962 IShellView_Release(psf);
964 return hRes;
966 /*************************************************************************
967 * SHWinHelp [SHELL32.127]
970 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
971 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
972 return 0;
974 /*************************************************************************
975 * SHRunControlPanel [SHELL32.161]
978 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
979 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
980 return 0;
983 static LPUNKNOWN SHELL32_IExplorerInterface=0;
984 /*************************************************************************
985 * SHSetInstanceExplorer [SHELL32.176]
987 * NOTES
988 * Sets the interface
990 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
991 { TRACE("%p\n", lpUnknown);
992 SHELL32_IExplorerInterface = lpUnknown;
993 return (HRESULT) lpUnknown;
995 /*************************************************************************
996 * SHGetInstanceExplorer [SHELL32.@]
998 * NOTES
999 * gets the interface pointer of the explorer and a reference
1001 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
1002 { TRACE("%p\n", lpUnknown);
1004 *lpUnknown = SHELL32_IExplorerInterface;
1006 if (!SHELL32_IExplorerInterface)
1007 return E_FAIL;
1009 IUnknown_AddRef(SHELL32_IExplorerInterface);
1010 return NOERROR;
1012 /*************************************************************************
1013 * SHFreeUnusedLibraries [SHELL32.123]
1015 * NOTES
1016 * exported by name
1018 void WINAPI SHFreeUnusedLibraries (void)
1020 FIXME("stub\n");
1022 /*************************************************************************
1023 * DAD_AutoScroll [SHELL32.129]
1026 BOOL WINAPI DAD_AutoScroll(HWND hwnd, AUTO_SCROLL_DATA *samples, LPPOINT pt)
1028 FIXME("hwnd = %p %p %p\n",hwnd,samples,pt);
1029 return 0;
1031 /*************************************************************************
1032 * DAD_DragEnter [SHELL32.130]
1035 BOOL WINAPI DAD_DragEnter(HWND hwnd)
1037 FIXME("hwnd = %p\n",hwnd);
1038 return FALSE;
1040 /*************************************************************************
1041 * DAD_DragEnterEx [SHELL32.131]
1044 BOOL WINAPI DAD_DragEnterEx(HWND hwnd, POINT p)
1046 FIXME("hwnd = %p (%ld,%ld)\n",hwnd,p.x,p.y);
1047 return FALSE;
1049 /*************************************************************************
1050 * DAD_DragMove [SHELL32.134]
1053 BOOL WINAPI DAD_DragMove(POINT p)
1055 FIXME("(%ld,%ld)\n",p.x,p.y);
1056 return FALSE;
1058 /*************************************************************************
1059 * DAD_DragLeave [SHELL32.132]
1062 BOOL WINAPI DAD_DragLeave(VOID)
1064 FIXME("\n");
1065 return FALSE;
1067 /*************************************************************************
1068 * DAD_SetDragImage [SHELL32.136]
1070 * NOTES
1071 * exported by name
1073 BOOL WINAPI DAD_SetDragImage(
1074 HIMAGELIST himlTrack,
1075 LPPOINT lppt)
1077 FIXME("%p %p stub\n",himlTrack, lppt);
1078 return 0;
1080 /*************************************************************************
1081 * DAD_ShowDragImage [SHELL32.137]
1083 * NOTES
1084 * exported by name
1086 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1088 FIXME("0x%08x stub\n",bShow);
1089 return 0;
1092 static const WCHAR szwCabLocation[] = {
1093 'S','o','f','t','w','a','r','e','\\',
1094 'M','i','c','r','o','s','o','f','t','\\',
1095 'W','i','n','d','o','w','s','\\',
1096 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1097 'E','x','p','l','o','r','e','r','\\',
1098 'C','a','b','i','n','e','t','S','t','a','t','e',0
1101 static const WCHAR szwSettings[] = { 'S','e','t','t','i','n','g','s',0 };
1103 /*************************************************************************
1104 * ReadCabinetState [SHELL32.651] NT 4.0
1107 BOOL WINAPI ReadCabinetState(CABINETSTATE *cs, int length)
1109 HKEY hkey = 0;
1110 DWORD type, r;
1112 TRACE("%p %d \n",cs,length);
1114 if( (cs == NULL) || (length < (int)sizeof(*cs)) )
1115 return FALSE;
1117 r = RegOpenKeyW( HKEY_CURRENT_USER, szwCabLocation, &hkey );
1118 if( r == ERROR_SUCCESS )
1120 type = REG_BINARY;
1121 r = RegQueryValueExW( hkey, szwSettings,
1122 NULL, &type, (LPBYTE)cs, (LPDWORD)&length );
1123 RegCloseKey( hkey );
1127 /* if we can't read from the registry, create default values */
1128 if ( (r != ERROR_SUCCESS) || (cs->cLength < sizeof(*cs)) ||
1129 (cs->cLength != length) )
1131 ERR("Initializing shell cabinet settings\n");
1132 memset(cs, 0, sizeof(*cs));
1133 cs->cLength = sizeof(*cs);
1134 cs->nVersion = 2;
1135 cs->fFullPathTitle = FALSE;
1136 cs->fSaveLocalView = TRUE;
1137 cs->fNotShell = FALSE;
1138 cs->fSimpleDefault = TRUE;
1139 cs->fDontShowDescBar = FALSE;
1140 cs->fNewWindowMode = FALSE;
1141 cs->fShowCompColor = FALSE;
1142 cs->fDontPrettyNames = FALSE;
1143 cs->fAdminsCreateCommonGroups = TRUE;
1144 cs->fMenuEnumFilter = 96;
1147 return TRUE;
1150 /*************************************************************************
1151 * WriteCabinetState [SHELL32.652] NT 4.0
1154 BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
1156 DWORD r;
1157 HKEY hkey = 0;
1159 TRACE("%p\n",cs);
1161 if( cs == NULL )
1162 return FALSE;
1164 r = RegCreateKeyExW( HKEY_CURRENT_USER, szwCabLocation, 0,
1165 NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
1166 if( r == ERROR_SUCCESS )
1168 r = RegSetValueExW( hkey, szwSettings, 0,
1169 REG_BINARY, (LPBYTE) cs, cs->cLength);
1171 RegCloseKey( hkey );
1174 return (r==ERROR_SUCCESS);
1177 /*************************************************************************
1178 * FileIconInit [SHELL32.660]
1181 BOOL WINAPI FileIconInit(BOOL bFullInit)
1182 { FIXME("(%s)\n", bFullInit ? "true" : "false");
1183 return 0;
1185 /*************************************************************************
1186 * IsUserAdmin [SHELL32.680] NT 4.0
1189 HRESULT WINAPI IsUserAdmin(void)
1190 { FIXME("stub\n");
1191 return TRUE;
1194 /*************************************************************************
1195 * SHAllocShared [SHELL32.520]
1197 * NOTES
1198 * parameter1 is return value from HeapAlloc
1199 * parameter2 is equal to the size allocated with HeapAlloc
1200 * parameter3 is return value from GetCurrentProcessId
1202 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1203 * WM_USER+2 could be the undocumented CWM_SETPATH
1204 * the allocated memory contains a pidl
1206 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1207 { HGLOBAL hmem;
1208 LPVOID pmem;
1210 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1211 hmem = GlobalAlloc(GMEM_FIXED, size);
1212 if (!hmem)
1213 return 0;
1215 pmem = GlobalLock (hmem);
1217 if (! pmem)
1218 return 0;
1220 memcpy (pmem, psrc, size);
1221 GlobalUnlock(hmem);
1222 return hmem;
1224 /*************************************************************************
1225 * SHLockShared [SHELL32.521]
1227 * NOTES
1228 * parameter1 is return value from SHAllocShared
1229 * parameter2 is return value from GetCurrentProcessId
1230 * the receiver of (WM_USER+2) tries to lock the HANDLE (?)
1231 * the return value seems to be a memory address
1233 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1234 { TRACE("handle=%p procID=0x%04lx\n",hmem,procID);
1235 return GlobalLock(hmem);
1237 /*************************************************************************
1238 * SHUnlockShared [SHELL32.522]
1240 * NOTES
1241 * parameter1 is return value from SHLockShared
1243 BOOL WINAPI SHUnlockShared(LPVOID pv)
1245 TRACE("%p\n",pv);
1246 return GlobalUnlock((HANDLE)pv);
1248 /*************************************************************************
1249 * SHFreeShared [SHELL32.523]
1251 * NOTES
1252 * parameter1 is return value from SHAllocShared
1253 * parameter2 is return value from GetCurrentProcessId
1255 BOOL WINAPI SHFreeShared(
1256 HANDLE hMem,
1257 DWORD pid)
1259 TRACE("handle=%p 0x%04lx\n",hMem,pid);
1260 return (BOOL)GlobalFree(hMem);
1263 /*************************************************************************
1264 * SetAppStartingCursor [SHELL32.99]
1266 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1267 { FIXME("hwnd=%p 0x%04lx stub\n",u,v );
1268 return 0;
1270 /*************************************************************************
1271 * SHLoadOLE [SHELL32.151]
1274 HRESULT WINAPI SHLoadOLE(DWORD u)
1275 { FIXME("0x%04lx stub\n",u);
1276 return S_OK;
1278 /*************************************************************************
1279 * DriveType [SHELL32.64]
1282 HRESULT WINAPI DriveType(DWORD u)
1283 { FIXME("0x%04lx stub\n",u);
1284 return 0;
1286 /*************************************************************************
1287 * SHAbortInvokeCommand [SHELL32.198]
1290 HRESULT WINAPI SHAbortInvokeCommand(void)
1291 { FIXME("stub\n");
1292 return 1;
1294 /*************************************************************************
1295 * SHOutOfMemoryMessageBox [SHELL32.126]
1298 int WINAPI SHOutOfMemoryMessageBox(
1299 HWND hwndOwner,
1300 LPCSTR lpCaption,
1301 UINT uType)
1303 FIXME("%p %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1304 return 0;
1306 /*************************************************************************
1307 * SHFlushClipboard [SHELL32.121]
1310 HRESULT WINAPI SHFlushClipboard(void)
1311 { FIXME("stub\n");
1312 return 1;
1315 /*************************************************************************
1316 * SHWaitForFileToOpen [SHELL32.97]
1319 BOOL WINAPI SHWaitForFileToOpen(
1320 LPCITEMIDLIST pidl,
1321 DWORD dwFlags,
1322 DWORD dwTimeout)
1324 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1325 return 0;
1328 /************************************************************************
1329 * @ [SHELL32.654]
1331 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1332 * second one could be a size (0x0c). The size is the same as the structure saved to
1333 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1334 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1336 HRESULT WINAPI shell32_654 (CABINETSTATE *cs, int length)
1338 TRACE("%p %d\n",cs,length);
1339 return ReadCabinetState(cs,length);
1342 /************************************************************************
1343 * RLBuildListOfPaths [SHELL32.146]
1345 * NOTES
1346 * builds a DPA
1348 DWORD WINAPI RLBuildListOfPaths (void)
1349 { FIXME("stub\n");
1350 return 0;
1352 /************************************************************************
1353 * SHValidateUNC [SHELL32.173]
1356 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1358 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1359 return 0;
1362 /************************************************************************
1363 * DoEnvironmentSubstA [SHELL32.@]
1366 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1368 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1369 return 0;
1372 /************************************************************************
1373 * DoEnvironmentSubstW [SHELL32.@]
1376 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1378 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1379 return 0;
1382 /************************************************************************
1383 * DoEnvironmentSubst [SHELL32.53]
1386 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1388 if (SHELL_OsIsUnicode())
1389 return DoEnvironmentSubstW(x, y);
1390 return DoEnvironmentSubstA(x, y);
1393 /*************************************************************************
1394 * @ [SHELL32.243]
1396 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1397 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1401 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1403 return FALSE;
1406 /*************************************************************************
1407 * @ [SHELL32.714]
1409 DWORD WINAPI SHELL32_714(LPVOID x)
1411 FIXME("(%s)stub\n", debugstr_w(x));
1412 return 0;
1415 /*************************************************************************
1416 * SHAddFromPropSheetExtArray [SHELL32.167]
1418 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1420 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1421 return 0;
1424 /*************************************************************************
1425 * SHCreatePropSheetExtArray [SHELL32.168]
1427 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1429 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1430 return 0;
1433 /*************************************************************************
1434 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1436 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1438 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1439 return 0;
1442 /*************************************************************************
1443 * SHDestroyPropSheetExtArray [SHELL32.169]
1445 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1447 FIXME("(%08lx)stub\n", a);
1448 return 0;
1451 /*************************************************************************
1452 * CIDLData_CreateFromIDArray [SHELL32.83]
1454 * Create IDataObject from PIDLs??
1456 HRESULT WINAPI CIDLData_CreateFromIDArray(
1457 LPCITEMIDLIST pidlFolder,
1458 DWORD cpidlFiles,
1459 LPCITEMIDLIST *lppidlFiles,
1460 LPDATAOBJECT *ppdataObject)
1462 UINT i;
1463 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1465 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
1466 if (TRACE_ON(pidl))
1468 pdump (pidlFolder);
1469 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
1471 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1472 lppidlFiles, cpidlFiles);
1473 if (*ppdataObject) return S_OK;
1474 return E_OUTOFMEMORY;
1477 /*************************************************************************
1478 * SHCreateStdEnumFmtEtc [SHELL32.74]
1480 * NOTES
1483 HRESULT WINAPI SHCreateStdEnumFmtEtc(
1484 DWORD cFormats,
1485 const FORMATETC *lpFormats,
1486 LPENUMFORMATETC *ppenumFormatetc)
1488 IEnumFORMATETC *pef;
1489 HRESULT hRes;
1490 TRACE("cf=%ld fe=%p pef=%p\n", cFormats, lpFormats, ppenumFormatetc);
1492 pef = IEnumFORMATETC_Constructor(cFormats, lpFormats);
1493 if (!pef)
1494 return E_OUTOFMEMORY;
1496 IEnumFORMATETC_AddRef(pef);
1497 hRes = IEnumFORMATETC_QueryInterface(pef, &IID_IEnumFORMATETC, (LPVOID*)ppenumFormatetc);
1498 IEnumFORMATETC_Release(pef);
1500 return hRes;
1504 /*************************************************************************
1505 * SHELL32_256
1507 HRESULT WINAPI SHELL32_256(LPDWORD lpdw0, LPDWORD lpdw1)
1509 HRESULT ret = S_OK;
1511 FIXME("stub %p 0x%08lx %p\n", lpdw0, lpdw0 ? *lpdw0 : 0, lpdw1);
1513 if (!lpdw0 || *lpdw0 != 0x10)
1514 ret = E_INVALIDARG;
1515 else
1517 LPVOID lpdata = 0;/*LocalAlloc(GMEM_ZEROINIT, 0x4E4);*/
1519 if (!lpdata)
1520 ret = E_OUTOFMEMORY;
1521 else
1523 /* Initialize and return unknown lpdata structure */
1527 return ret;