Make sure the import directory is not in shared memory.
[wine/testsucceed.git] / dlls / shell32 / shellord.c
blob2703d62c70f877556bb05bcd098936cce252ce18
1 /*
2 * The parameters of many functions changes between different OS versions
3 * (NT uses Unicode strings, 95 uses ASCII strings)
4 *
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 <string.h>
23 #include <stdio.h>
24 #include "winerror.h"
25 #include "winreg.h"
26 #include "wine/debug.h"
27 #include "winnls.h"
28 #include "heap.h"
30 #include "wine/obj_base.h"
31 #include "shellapi.h"
32 #include "shlguid.h"
33 #include "shlobj.h"
34 #include "shell32_main.h"
35 #include "undocshell.h"
36 #include "pidl.h"
37 #include "shlwapi.h"
38 #include "commdlg.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(shell);
41 WINE_DECLARE_DEBUG_CHANNEL(pidl);
43 /*************************************************************************
44 * ParseFieldA [internal]
46 * copies a field from a ',' delimited string
48 * first field is nField = 1
50 DWORD WINAPI ParseFieldA(
51 LPCSTR src,
52 DWORD nField,
53 LPSTR dst,
54 DWORD len)
56 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
58 if (!src || !src[0] || !dst || !len)
59 return 0;
61 /* skip n fields delimited by ',' */
62 while (nField > 1)
64 if (*src=='\0') return FALSE;
65 if (*(src++)==',') nField--;
68 /* copy part till the next ',' to dst */
69 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
71 /* finalize the string */
72 *dst=0x0;
74 return TRUE;
77 /*************************************************************************
78 * ParseFieldW [internal]
80 * copies a field from a ',' delimited string
82 * first field is nField = 1
84 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
86 FIXME("(%s,0x%08lx,%p,%ld) stub\n",
87 debugstr_w(src), nField, dst, len);
88 return FALSE;
91 /*************************************************************************
92 * ParseField [SHELL32.58]
94 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
96 if (SHELL_OsIsUnicode())
97 return ParseFieldW(src, nField, dst, len);
98 return ParseFieldA(src, nField, dst, len);
101 /*************************************************************************
102 * GetFileNameFromBrowse [SHELL32.63]
105 BOOL WINAPI GetFileNameFromBrowse(
106 HWND hwndOwner,
107 LPSTR lpstrFile,
108 DWORD nMaxFile,
109 LPCSTR lpstrInitialDir,
110 LPCSTR lpstrDefExt,
111 LPCSTR lpstrFilter,
112 LPCSTR lpstrTitle)
114 HMODULE hmodule;
115 FARPROC pGetOpenFileNameA;
116 OPENFILENAMEA ofn;
117 BOOL ret;
119 TRACE("%04x, %s, %ld, %s, %s, %s, %s)\n",
120 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
121 lpstrFilter, lpstrTitle);
123 hmodule = LoadLibraryA("comdlg32.dll");
124 if(!hmodule) return FALSE;
125 pGetOpenFileNameA = GetProcAddress(hmodule, "GetOpenFileNameA");
126 if(!pGetOpenFileNameA)
128 FreeLibrary(hmodule);
129 return FALSE;
132 memset(&ofn, 0, sizeof(ofn));
134 ofn.lStructSize = sizeof(ofn);
135 ofn.hwndOwner = hwndOwner;
136 ofn.lpstrFilter = lpstrFilter;
137 ofn.lpstrFile = lpstrFile;
138 ofn.nMaxFile = nMaxFile;
139 ofn.lpstrInitialDir = lpstrInitialDir;
140 ofn.lpstrTitle = lpstrTitle;
141 ofn.lpstrDefExt = lpstrDefExt;
142 ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
143 ret = pGetOpenFileNameA(&ofn);
145 FreeLibrary(hmodule);
146 return ret;
149 /*************************************************************************
150 * SHGetSetSettings [SHELL32.68]
152 VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z)
154 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z);
157 /*************************************************************************
158 * SHGetSettings [SHELL32.@]
160 * NOTES
161 * the registry path are for win98 (tested)
162 * and possibly are the same in nt40
165 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
167 HKEY hKey;
168 DWORD dwData;
169 DWORD dwDataSize = sizeof (DWORD);
171 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
173 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
174 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
175 return;
177 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
178 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
180 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
181 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
183 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
184 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
186 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
187 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
189 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
190 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
192 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
193 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
195 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
196 { if (dwData == 0)
197 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
198 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
200 else if (dwData == 1)
201 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
202 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
204 else if (dwData == 2)
205 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
206 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
209 RegCloseKey (hKey);
211 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
214 /*************************************************************************
215 * SHShellFolderView_Message [SHELL32.73]
217 * PARAMETERS
218 * hwndCabinet defines the explorer cabinet window that contains the
219 * shellview you need to communicate with
220 * uMsg identifying the SFVM enum to perform
221 * lParam
223 * NOTES
224 * Message SFVM_REARRANGE = 1
225 * This message gets sent when a column gets clicked to instruct the
226 * shell view to re-sort the item list. lParam identifies the column
227 * that was clicked.
229 int WINAPI SHShellFolderView_Message(
230 HWND hwndCabinet,
231 DWORD dwMessage,
232 DWORD dwParam)
234 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
235 return 0;
238 /*************************************************************************
239 * RegisterShellHook [SHELL32.181]
241 * PARAMS
242 * hwnd [I] window handle
243 * y [I] flag ????
245 * NOTES
246 * exported by ordinal
248 BOOL WINAPI RegisterShellHook(
249 HWND hWnd,
250 DWORD dwType)
252 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType);
253 return TRUE;
255 /*************************************************************************
256 * ShellMessageBoxW [SHELL32.182]
258 * Format and output errormessage.
260 * idText resource ID of title or LPSTR
261 * idTitle resource ID of title or LPSTR
263 * NOTES
264 * exported by ordinal
266 int WINAPIV ShellMessageBoxW(
267 HINSTANCE hInstance,
268 HWND hWnd,
269 LPCWSTR lpText,
270 LPCWSTR lpCaption,
271 UINT uType,
272 ...)
274 WCHAR szText[100],szTitle[100];
275 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
276 va_list args;
277 int ret;
279 va_start(args, uType);
280 /* wvsprintfA(buf,fmt, args); */
282 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
283 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
285 if (!HIWORD(lpCaption))
286 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
287 else
288 pszTitle = lpCaption;
290 if (!HIWORD(lpText))
291 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
292 else
293 pszText = lpText;
295 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
296 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
298 va_end(args);
300 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
301 LocalFree((HLOCAL)pszTemp);
302 return ret;
305 /*************************************************************************
306 * ShellMessageBoxA [SHELL32.183]
308 int WINAPIV ShellMessageBoxA(
309 HINSTANCE hInstance,
310 HWND hWnd,
311 LPCSTR lpText,
312 LPCSTR lpCaption,
313 UINT uType,
314 ...)
316 char szText[100],szTitle[100];
317 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
318 va_list args;
319 int ret;
321 va_start(args, uType);
322 /* wvsprintfA(buf,fmt, args); */
324 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
325 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
327 if (!HIWORD(lpCaption))
328 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
329 else
330 pszTitle = lpCaption;
332 if (!HIWORD(lpText))
333 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
334 else
335 pszText = lpText;
337 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
338 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
340 va_end(args);
342 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
343 LocalFree((HLOCAL)pszTemp);
344 return ret;
347 /*************************************************************************
348 * SHFree [SHELL32.195]
350 * NOTES
351 * free_ptr() - frees memory using IMalloc
352 * exported by ordinal
354 #define MEM_DEBUG 0
355 void WINAPI SHFree(LPVOID x)
357 #if MEM_DEBUG
358 WORD len = *(LPWORD)((LPBYTE)x-2);
360 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
361 ERR("MAGIC2!\n");
363 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
364 ERR("MAGIC1!\n");
365 else
366 memset((LPBYTE)x-4, 0xde, len+6);
368 TRACE("%p len=%u\n",x, len);
370 x = (LPBYTE) x - 4;
371 #else
372 TRACE("%p\n",x);
373 #endif
374 HeapFree(GetProcessHeap(), 0, x);
377 /*************************************************************************
378 * SHAlloc [SHELL32.196]
380 * NOTES
381 * void *task_alloc(DWORD len), uses SHMalloc allocator
382 * exported by ordinal
384 LPVOID WINAPI SHAlloc(DWORD len)
386 LPBYTE ret;
388 #if MEM_DEBUG
389 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
390 #else
391 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
392 #endif
394 #if MEM_DEBUG
395 *(LPWORD)(ret) = 0x8271;
396 *(LPWORD)(ret+2) = (WORD)len;
397 *(LPWORD)(ret+4+len) = 0x7384;
398 ret += 4;
399 memset(ret, 0xdf, len);
400 #endif
401 TRACE("%lu bytes at %p\n",len, ret);
402 return (LPVOID)ret;
405 /*************************************************************************
406 * SHRegisterDragDrop [SHELL32.86]
408 * NOTES
409 * exported by ordinal
411 HRESULT WINAPI SHRegisterDragDrop(
412 HWND hWnd,
413 LPDROPTARGET pDropTarget)
415 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
416 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
417 return 0;
420 /*************************************************************************
421 * SHRevokeDragDrop [SHELL32.87]
423 * NOTES
424 * exported by ordinal
426 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
428 FIXME("(0x%08x):stub.\n",hWnd);
429 return 0;
432 /*************************************************************************
433 * SHDoDragDrop [SHELL32.88]
435 * NOTES
436 * exported by ordinal
438 HRESULT WINAPI SHDoDragDrop(
439 HWND hWnd,
440 LPDATAOBJECT lpDataObject,
441 LPDROPSOURCE lpDropSource,
442 DWORD dwOKEffect,
443 LPDWORD pdwEffect)
445 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n",
446 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
447 return 0;
450 /*************************************************************************
451 * ArrangeWindows [SHELL32.184]
454 WORD WINAPI ArrangeWindows(
455 HWND hwndParent,
456 DWORD dwReserved,
457 LPCRECT lpRect,
458 WORD cKids,
459 CONST HWND * lpKids)
461 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n",
462 hwndParent, dwReserved, lpRect, cKids, lpKids);
463 return 0;
466 /*************************************************************************
467 * SignalFileOpen [SHELL32.103]
469 * NOTES
470 * exported by ordinal
472 DWORD WINAPI
473 SignalFileOpen (DWORD dwParam1)
475 FIXME("(0x%08lx):stub.\n", dwParam1);
477 return 0;
480 /*************************************************************************
481 * SHADD_get_policy - helper function for SHAddToRecentDocs
483 * PARAMETERS
484 * policy [IN] policy name (null termed string) to find
485 * type [OUT] ptr to DWORD to receive type
486 * buffer [OUT] ptr to area to hold data retrieved
487 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
488 * length filled
490 * RETURNS
491 * result of the SHQueryValueEx call
493 static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
495 HKEY Policy_basekey;
496 INT ret;
498 /* Get the key for the policies location in the registry
500 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
501 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
502 0, KEY_READ, &Policy_basekey)) {
504 if (RegOpenKeyExA(HKEY_CURRENT_USER,
505 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
506 0, KEY_READ, &Policy_basekey)) {
507 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
508 policy);
509 *len = 0;
510 return ERROR_FILE_NOT_FOUND;
514 /* Retrieve the data if it exists
516 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
517 RegCloseKey(Policy_basekey);
518 return ret;
522 /*************************************************************************
523 * SHADD_compare_mru - helper function for SHAddToRecentDocs
525 * PARAMETERS
526 * data1 [IN] data being looked for
527 * data2 [IN] data in MRU
528 * cbdata [IN] length from FindMRUData call (not used)
530 * RETURNS
531 * position within MRU list that data was added.
533 static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
535 return lstrcmpiA(data1, data2);
538 /*************************************************************************
539 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
541 * PARAMETERS
542 * mruhandle [IN] handle for created MRU list
543 * doc_name [IN] null termed pure doc name
544 * new_lnk_name [IN] null termed path and file name for .lnk file
545 * buffer [IN/OUT] 2048 byte area to consturct MRU data
546 * len [OUT] ptr to int to receive space used in buffer
548 * RETURNS
549 * position within MRU list that data was added.
551 static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
552 LPSTR buffer, INT *len)
554 LPSTR ptr;
555 INT wlen;
557 /*FIXME: Document:
558 * RecentDocs MRU data structure seems to be:
559 * +0h document file name w/ terminating 0h
560 * +nh short int w/ size of remaining
561 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
562 * +n+4h 10 bytes zeros - unknown
563 * +n+eh shortcut file name w/ terminating 0h
564 * +n+e+nh 3 zero bytes - unknown
567 /* Create the MRU data structure for "RecentDocs"
569 ptr = buffer;
570 lstrcpyA(ptr, doc_name);
571 ptr += (lstrlenA(buffer) + 1);
572 wlen= lstrlenA(new_lnk_name) + 1 + 12;
573 *((short int*)ptr) = wlen;
574 ptr += 2; /* step past the length */
575 *(ptr++) = 0x30; /* unknown reason */
576 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
577 memset(ptr, 0, 10);
578 ptr += 10;
579 lstrcpyA(ptr, new_lnk_name);
580 ptr += (lstrlenA(new_lnk_name) + 1);
581 memset(ptr, 0, 3);
582 ptr += 3;
583 *len = ptr - buffer;
585 /* Add the new entry into the MRU list
587 return pAddMRUData(mruhandle, (LPCVOID)buffer, *len);
590 /*************************************************************************
591 * SHAddToRecentDocs [SHELL32.@]
593 * PARAMETERS
594 * uFlags [IN] SHARD_PATH or SHARD_PIDL
595 * pv [IN] string or pidl, NULL clears the list
597 * NOTES
598 * exported by name
600 * FIXME: ?? MSDN shows this as a VOID
602 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
605 /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
606 /* !!! it is in both here and comctl32undoc.c !!! */
607 typedef struct tagCREATEMRULIST
609 DWORD cbSize; /* size of struct */
610 DWORD nMaxItems; /* max no. of items in list */
611 DWORD dwFlags; /* see below */
612 HKEY hKey; /* root reg. key under which list is saved */
613 LPCSTR lpszSubKey; /* reg. subkey */
614 PROC lpfnCompare; /* item compare proc */
615 } CREATEMRULIST, *LPCREATEMRULIST;
617 /* dwFlags */
618 #define MRUF_STRING_LIST 0 /* list will contain strings */
619 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
620 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
622 /* If list is a string list lpfnCompare has the following prototype
623 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
624 * for binary lists the prototype is
625 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
626 * where cbData is the no. of bytes to compare.
627 * Need to check what return value means identical - 0?
631 UINT olderrormode;
632 HKEY HCUbasekey;
633 CHAR doc_name[MAX_PATH];
634 CHAR link_dir[MAX_PATH];
635 CHAR new_lnk_filepath[MAX_PATH];
636 CHAR new_lnk_name[MAX_PATH];
637 IMalloc *ppM;
638 LPITEMIDLIST pidl;
639 HWND hwnd = 0; /* FIXME: get real window handle */
640 INT ret;
641 DWORD data[64], datalen, type;
643 /*FIXME: Document:
644 * RecentDocs MRU data structure seems to be:
645 * +0h document file name w/ terminating 0h
646 * +nh short int w/ size of remaining
647 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
648 * +n+4h 10 bytes zeros - unknown
649 * +n+eh shortcut file name w/ terminating 0h
650 * +n+e+nh 3 zero bytes - unknown
653 /* See if we need to do anything.
655 datalen = 64;
656 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
657 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
658 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
659 return 0;
661 if (ret == ERROR_SUCCESS) {
662 if (!( (type == REG_DWORD) ||
663 ((type == REG_BINARY) && (datalen == 4)) )) {
664 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
665 type, datalen);
666 return 0;
669 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
670 /* now test the actual policy value */
671 if ( data[0] != 0)
672 return 0;
675 /* Open key to where the necessary info is
677 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
678 * and the close should be done during the _DETACH. The resulting
679 * key is stored in the DLL global data.
681 if (RegCreateKeyExA(HKEY_CURRENT_USER,
682 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
683 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
684 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
685 return 0;
688 /* Get path to user's "Recent" directory
690 if(SUCCEEDED(SHGetMalloc(&ppM))) {
691 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
692 &pidl))) {
693 SHGetPathFromIDListA(pidl, link_dir);
694 IMalloc_Free(ppM, pidl);
696 else {
697 /* serious issues */
698 link_dir[0] = 0;
699 ERR("serious issues 1\n");
701 IMalloc_Release(ppM);
703 else {
704 /* serious issues */
705 link_dir[0] = 0;
706 ERR("serious issues 2\n");
708 TRACE("Users Recent dir %s\n", link_dir);
710 /* If no input, then go clear the lists */
711 if (!pv) {
712 /* clear user's Recent dir
715 /* FIXME: delete all files in "link_dir"
717 * while( more files ) {
718 * lstrcpyA(old_lnk_name, link_dir);
719 * PathAppendA(old_lnk_name, filenam);
720 * DeleteFileA(old_lnk_name);
723 FIXME("should delete all files in %s\\ \n", link_dir);
725 /* clear MRU list
727 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
728 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
729 * and naturally it fails w/ rc=2. It should do it against
730 * HKEY_CURRENT_USER which is where it is stored, and where
731 * the MRU routines expect it!!!!
733 RegDeleteKeyA(HCUbasekey, "RecentDocs");
734 RegCloseKey(HCUbasekey);
735 return 0;
738 /* Have data to add, the jobs to be done:
739 * 1. Add document to MRU list in registry "HKCU\Software\
740 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
741 * 2. Add shortcut to document in the user's Recent directory
742 * (CSIDL_RECENT).
743 * 3. Add shortcut to Start menu's Documents submenu.
746 /* Get the pure document name from the input
748 if (uFlags & SHARD_PIDL) {
749 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
751 else {
752 lstrcpyA(doc_name, (LPSTR) pv);
754 TRACE("full document name %s\n", doc_name);
755 PathStripPathA(doc_name);;
756 TRACE("stripped document name %s\n", doc_name);
759 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
761 { /* on input needs:
762 * doc_name - pure file-spec, no path
763 * link_dir - path to the user's Recent directory
764 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
765 * creates:
766 * new_lnk_name- pure file-spec, no path for new .lnk file
767 * new_lnk_filepath
768 * - path and file name of new .lnk file
770 CREATEMRULIST mymru;
771 HANDLE mruhandle;
772 INT len, pos, bufused, err;
773 INT i;
774 DWORD attr;
775 CHAR buffer[2048];
776 CHAR *ptr;
777 CHAR old_lnk_name[MAX_PATH];
778 short int slen;
780 mymru.cbSize = sizeof(CREATEMRULIST);
781 mymru.nMaxItems = 15;
782 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
783 mymru.hKey = HCUbasekey;
784 mymru.lpszSubKey = "RecentDocs";
785 mymru.lpfnCompare = &SHADD_compare_mru;
786 mruhandle = pCreateMRUListA(&mymru);
787 if (!mruhandle) {
788 /* MRU failed */
789 ERR("MRU processing failed, handle zero\n");
790 RegCloseKey(HCUbasekey);
791 return 0;
793 len = lstrlenA(doc_name);
794 pos = pFindMRUData(mruhandle, doc_name, len, 0);
796 /* Now get the MRU entry that will be replaced
797 * and delete the .lnk file for it
799 if ((bufused = pEnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
800 buffer, 2048)) != -1) {
801 ptr = buffer;
802 ptr += (lstrlenA(buffer) + 1);
803 slen = *((short int*)ptr);
804 ptr += 2; /* skip the length area */
805 if (bufused >= slen + (ptr-buffer)) {
806 /* buffer size looks good */
807 ptr += 12; /* get to string */
808 len = bufused - (ptr-buffer); /* get length of buf remaining */
809 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
810 /* appears to be good string */
811 lstrcpyA(old_lnk_name, link_dir);
812 PathAppendA(old_lnk_name, ptr);
813 if (!DeleteFileA(old_lnk_name)) {
814 if ((attr = GetFileAttributesA(old_lnk_name)) == -1) {
815 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
816 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
817 old_lnk_name, err, attr);
819 else {
820 TRACE("old .lnk file %s did not exist\n",
821 old_lnk_name);
824 else {
825 ERR("Delete for %s failed, attr=%08lx\n",
826 old_lnk_name, attr);
829 else {
830 TRACE("deleted old .lnk file %s\n", old_lnk_name);
836 /* Create usable .lnk file name for the "Recent" directory
838 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
839 lstrcpyA(new_lnk_filepath, link_dir);
840 PathAppendA(new_lnk_filepath, new_lnk_name);
841 i = 1;
842 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
843 while (GetFileAttributesA(new_lnk_filepath) != -1) {
844 i++;
845 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
846 lstrcpyA(new_lnk_filepath, link_dir);
847 PathAppendA(new_lnk_filepath, new_lnk_name);
849 SetErrorMode(olderrormode);
850 TRACE("new shortcut will be %s\n", new_lnk_filepath);
852 /* Now add the new MRU entry and data
854 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
855 buffer, &len);
856 pFreeMRUListA(mruhandle);
857 TRACE("Updated MRU list, new doc is position %d\n", pos);
860 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
862 { /* on input needs:
863 * doc_name - pure file-spec, no path
864 * new_lnk_filepath
865 * - path and file name of new .lnk file
866 * uFlags[in] - flags on call to SHAddToRecentDocs
867 * pv[in] - document path/pidl on call to SHAddToRecentDocs
869 IShellLinkA *psl = NULL;
870 IPersistFile *pPf = NULL;
871 HRESULT hres;
872 CHAR desc[MAX_PATH];
873 WCHAR widelink[MAX_PATH];
875 CoInitialize(0);
877 hres = CoCreateInstance( &CLSID_ShellLink,
878 NULL,
879 CLSCTX_INPROC_SERVER,
880 &IID_IShellLinkA,
881 (LPVOID )&psl);
882 if(SUCCEEDED(hres)) {
884 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
885 (LPVOID *)&pPf);
886 if(FAILED(hres)) {
887 /* bombed */
888 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
889 goto fail;
892 /* Set the document path or pidl */
893 if (uFlags & SHARD_PIDL) {
894 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
895 } else {
896 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
898 if(FAILED(hres)) {
899 /* bombed */
900 ERR("failed Set{IDList|Path} %08lx\n", hres);
901 goto fail;
904 lstrcpyA(desc, "Shortcut to ");
905 lstrcatA(desc, doc_name);
906 hres = IShellLinkA_SetDescription(psl, desc);
907 if(FAILED(hres)) {
908 /* bombed */
909 ERR("failed SetDescription %08lx\n", hres);
910 goto fail;
913 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
914 widelink, MAX_PATH);
915 /* create the short cut */
916 hres = IPersistFile_Save(pPf, widelink, TRUE);
917 if(FAILED(hres)) {
918 /* bombed */
919 ERR("failed IPersistFile::Save %08lx\n", hres);
920 IPersistFile_Release(pPf);
921 IShellLinkA_Release(psl);
922 goto fail;
924 hres = IPersistFile_SaveCompleted(pPf, widelink);
925 IPersistFile_Release(pPf);
926 IShellLinkA_Release(psl);
927 TRACE("shortcut %s has been created, result=%08lx\n",
928 new_lnk_filepath, hres);
930 else {
931 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
935 fail:
936 CoUninitialize();
938 /* all done */
939 RegCloseKey(HCUbasekey);
940 return 0;
943 /*************************************************************************
944 * SHCreateShellFolderViewEx [SHELL32.174]
946 * NOTES
947 * see IShellFolder::CreateViewObject
949 HRESULT WINAPI SHCreateShellFolderViewEx(
950 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */
951 LPSHELLVIEW* ppv) /* [out] IShellView pointer */
953 IShellView * psf;
954 HRESULT hRes;
956 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
957 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
958 psvcbi->uViewMode, psvcbi->dwUser);
960 psf = IShellView_Constructor(psvcbi->pshf);
962 if (!psf)
963 return E_OUTOFMEMORY;
965 IShellView_AddRef(psf);
966 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
967 IShellView_Release(psf);
969 return hRes;
971 /*************************************************************************
972 * SHWinHelp [SHELL32.127]
975 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
976 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
977 return 0;
979 /*************************************************************************
980 * SHRunControlPanel [SHELL32.161]
983 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
984 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
985 return 0;
987 /*************************************************************************
988 * ShellExecuteEx [SHELL32.291]
991 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
992 { if (SHELL_OsIsUnicode())
993 return ShellExecuteExW (sei);
994 return ShellExecuteExA (sei);
996 /*************************************************************************
997 * ShellExecuteExA [SHELL32.292]
999 * placeholder in the commandline:
1000 * %1 file
1001 * %2 printer
1002 * %3 driver
1003 * %4 port
1004 * %I adress of a global item ID (explorer switch /idlist)
1005 * %L ??? path/url/current file ???
1006 * %S ???
1007 * %* all following parameters (see batfile)
1009 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
1010 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
1011 LPSTR pos;
1012 int gap, len;
1013 STARTUPINFOA startup;
1014 PROCESS_INFORMATION info;
1016 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
1017 sei->fMask, sei->hwnd, debugstr_a(sei->lpVerb),
1018 debugstr_a(sei->lpFile), debugstr_a(sei->lpParameters),
1019 debugstr_a(sei->lpDirectory), sei->nShow,
1020 (sei->fMask & SEE_MASK_CLASSNAME) ? debugstr_a(sei->lpClass) : "not used");
1022 ZeroMemory(szApplicationName,MAX_PATH);
1023 if (sei->lpFile)
1024 strcpy(szApplicationName, sei->lpFile);
1026 ZeroMemory(szCommandline,MAX_PATH);
1027 if (sei->lpParameters)
1028 strcpy(szCommandline, sei->lpParameters);
1030 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
1031 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
1032 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
1033 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
1035 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
1038 /* launch a document by fileclass like 'Wordpad.Document.1' */
1039 if (sei->fMask & SEE_MASK_CLASSNAME)
1041 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
1042 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
1043 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline));
1044 /* FIXME: get the extension of lpFile, check if it fits to the lpClass */
1045 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
1048 /* process the IDList */
1049 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
1051 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
1052 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
1054 else
1056 if (sei->fMask & SEE_MASK_IDLIST )
1058 pos = strstr(szCommandline, "%I");
1059 if (pos)
1061 LPVOID pv;
1062 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
1063 pv = SHLockShared(hmem,0);
1064 sprintf(szPidl,":%p",pv );
1065 SHUnlockShared(pv);
1067 gap = strlen(szPidl);
1068 len = strlen(pos)-2;
1069 memmove(pos+gap,pos+2,len);
1070 memcpy(pos,szPidl,gap);
1076 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
1078 if (szCommandline[0]) {
1079 strcat(szApplicationName, " ");
1080 strcat(szApplicationName, szCommandline);
1083 ZeroMemory(&startup,sizeof(STARTUPINFOA));
1084 startup.cb = sizeof(STARTUPINFOA);
1086 if (! CreateProcessA(NULL, szApplicationName,
1087 NULL, NULL, FALSE, 0,
1088 NULL, sei->lpDirectory,
1089 &startup, &info))
1091 sei->hInstApp = GetLastError();
1092 return FALSE;
1095 sei->hInstApp = 33;
1097 /* Give 30 seconds to the app to come up */
1098 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
1099 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
1101 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
1102 sei->hProcess = info.hProcess;
1103 else
1104 CloseHandle( info.hProcess );
1105 CloseHandle( info.hThread );
1106 return TRUE;
1108 /*************************************************************************
1109 * ShellExecuteExW [SHELL32.293]
1112 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
1113 { SHELLEXECUTEINFOA seiA;
1114 DWORD ret;
1116 TRACE("%p\n", sei);
1118 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
1120 if (sei->lpVerb)
1121 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
1123 if (sei->lpFile)
1124 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
1126 if (sei->lpParameters)
1127 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
1129 if (sei->lpDirectory)
1130 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
1132 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
1133 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
1134 else
1135 seiA.lpClass = NULL;
1137 ret = ShellExecuteExA(&seiA);
1139 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
1140 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
1141 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
1142 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
1143 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
1145 return ret;
1148 static LPUNKNOWN SHELL32_IExplorerInterface=0;
1149 /*************************************************************************
1150 * SHSetInstanceExplorer [SHELL32.176]
1152 * NOTES
1153 * Sets the interface
1155 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
1156 { TRACE("%p\n", lpUnknown);
1157 SHELL32_IExplorerInterface = lpUnknown;
1158 return (HRESULT) lpUnknown;
1160 /*************************************************************************
1161 * SHGetInstanceExplorer [SHELL32.@]
1163 * NOTES
1164 * gets the interface pointer of the explorer and a reference
1166 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
1167 { TRACE("%p\n", lpUnknown);
1169 *lpUnknown = SHELL32_IExplorerInterface;
1171 if (!SHELL32_IExplorerInterface)
1172 return E_FAIL;
1174 IUnknown_AddRef(SHELL32_IExplorerInterface);
1175 return NOERROR;
1177 /*************************************************************************
1178 * SHFreeUnusedLibraries [SHELL32.123]
1180 * NOTES
1181 * exported by name
1183 void WINAPI SHFreeUnusedLibraries (void)
1185 FIXME("stub\n");
1187 /*************************************************************************
1188 * DAD_SetDragImage [SHELL32.136]
1190 * NOTES
1191 * exported by name
1193 BOOL WINAPI DAD_SetDragImage(
1194 HIMAGELIST himlTrack,
1195 LPPOINT lppt)
1197 FIXME("%p %p stub\n",himlTrack, lppt);
1198 return 0;
1200 /*************************************************************************
1201 * DAD_ShowDragImage [SHELL32.137]
1203 * NOTES
1204 * exported by name
1206 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1208 FIXME("0x%08x stub\n",bShow);
1209 return 0;
1211 /*************************************************************************
1212 * ReadCabinetState [SHELL32.651] NT 4.0
1215 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
1216 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
1217 return 0;
1219 /*************************************************************************
1220 * WriteCabinetState [SHELL32.652] NT 4.0
1223 HRESULT WINAPI WriteCabinetState(DWORD u)
1224 { FIXME("0x%04lx stub\n",u);
1225 return 0;
1227 /*************************************************************************
1228 * FileIconInit [SHELL32.660]
1231 BOOL WINAPI FileIconInit(BOOL bFullInit)
1232 { FIXME("(%s)\n", bFullInit ? "true" : "false");
1233 return 0;
1235 /*************************************************************************
1236 * IsUserAdmin [SHELL32.680] NT 4.0
1239 HRESULT WINAPI IsUserAdmin(void)
1240 { FIXME("stub\n");
1241 return TRUE;
1244 /*************************************************************************
1245 * SHAllocShared [SHELL32.520]
1247 * NOTES
1248 * parameter1 is return value from HeapAlloc
1249 * parameter2 is equal to the size allocated with HeapAlloc
1250 * parameter3 is return value from GetCurrentProcessId
1252 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1253 * WM_USER+2 could be the undocumented CWM_SETPATH
1254 * the allocated memory contains a pidl
1256 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1257 { HGLOBAL hmem;
1258 LPVOID pmem;
1260 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1261 hmem = GlobalAlloc(GMEM_FIXED, size);
1262 if (!hmem)
1263 return 0;
1265 pmem = GlobalLock (hmem);
1267 if (! pmem)
1268 return 0;
1270 memcpy (pmem, psrc, size);
1271 GlobalUnlock(hmem);
1272 return hmem;
1274 /*************************************************************************
1275 * SHLockShared [SHELL32.521]
1277 * NOTES
1278 * parameter1 is return value from SHAllocShared
1279 * parameter2 is return value from GetCurrentProcessId
1280 * the receiver of (WM_USER+2) tries to lock the HANDLE (?)
1281 * the return value seems to be a memory address
1283 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1284 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1285 return GlobalLock(hmem);
1287 /*************************************************************************
1288 * SHUnlockShared [SHELL32.522]
1290 * NOTES
1291 * parameter1 is return value from SHLockShared
1293 BOOL WINAPI SHUnlockShared(LPVOID pv)
1295 TRACE("%p\n",pv);
1296 return GlobalUnlock((HANDLE)pv);
1298 /*************************************************************************
1299 * SHFreeShared [SHELL32.523]
1301 * NOTES
1302 * parameter1 is return value from SHAllocShared
1303 * parameter2 is return value from GetCurrentProcessId
1305 BOOL WINAPI SHFreeShared(
1306 HANDLE hMem,
1307 DWORD pid)
1309 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid);
1310 return GlobalFree(hMem);
1313 /*************************************************************************
1314 * SetAppStartingCursor [SHELL32.99]
1316 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1317 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1318 return 0;
1320 /*************************************************************************
1321 * SHLoadOLE [SHELL32.151]
1324 HRESULT WINAPI SHLoadOLE(DWORD u)
1325 { FIXME("0x%04lx stub\n",u);
1326 return S_OK;
1328 /*************************************************************************
1329 * DriveType [SHELL32.64]
1332 HRESULT WINAPI DriveType(DWORD u)
1333 { FIXME("0x%04lx stub\n",u);
1334 return 0;
1336 /*************************************************************************
1337 * SHAbortInvokeCommand [SHELL32.198]
1340 HRESULT WINAPI SHAbortInvokeCommand(void)
1341 { FIXME("stub\n");
1342 return 1;
1344 /*************************************************************************
1345 * SHOutOfMemoryMessageBox [SHELL32.126]
1348 int WINAPI SHOutOfMemoryMessageBox(
1349 HWND hwndOwner,
1350 LPCSTR lpCaption,
1351 UINT uType)
1353 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1354 return 0;
1356 /*************************************************************************
1357 * SHFlushClipboard [SHELL32.121]
1360 HRESULT WINAPI SHFlushClipboard(void)
1361 { FIXME("stub\n");
1362 return 1;
1365 /*************************************************************************
1366 * SHWaitForFileToOpen [SHELL32.97]
1369 BOOL WINAPI SHWaitForFileToOpen(
1370 LPCITEMIDLIST pidl,
1371 DWORD dwFlags,
1372 DWORD dwTimeout)
1374 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1375 return 0;
1378 /************************************************************************
1379 * @ [SHELL32.654]
1381 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1382 * second one could be a size (0x0c). The size is the same as the structure saved to
1383 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1384 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1386 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1387 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1388 return 0;
1391 /************************************************************************
1392 * RLBuildListOfPaths [SHELL32.146]
1394 * NOTES
1395 * builds a DPA
1397 DWORD WINAPI RLBuildListOfPaths (void)
1398 { FIXME("stub\n");
1399 return 0;
1401 /************************************************************************
1402 * SHValidateUNC [SHELL32.173]
1405 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1407 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1408 return 0;
1411 /************************************************************************
1412 * DoEnvironmentSubstA [SHELL32.@]
1415 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1417 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1418 return 0;
1421 /************************************************************************
1422 * DoEnvironmentSubstW [SHELL32.@]
1425 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1427 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1428 return 0;
1431 /************************************************************************
1432 * DoEnvironmentSubst [SHELL32.53]
1435 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1437 if (SHELL_OsIsUnicode())
1438 return DoEnvironmentSubstW(x, y);
1439 return DoEnvironmentSubstA(x, y);
1442 /*************************************************************************
1443 * @ [SHELL32.243]
1445 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1446 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1450 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1452 return FALSE;
1455 /*************************************************************************
1456 * @ [SHELL32.714]
1458 DWORD WINAPI SHELL32_714(LPVOID x)
1460 FIXME("(%s)stub\n", debugstr_w(x));
1461 return 0;
1464 /*************************************************************************
1465 * SHAddFromPropSheetExtArray [SHELL32.167]
1467 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1469 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1470 return 0;
1473 /*************************************************************************
1474 * SHCreatePropSheetExtArray [SHELL32.168]
1476 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1478 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1479 return 0;
1482 /*************************************************************************
1483 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1485 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1487 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1488 return 0;
1491 /*************************************************************************
1492 * SHDestroyPropSheetExtArray [SHELL32.169]
1494 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1496 FIXME("(%08lx)stub\n", a);
1497 return 0;
1500 /*************************************************************************
1501 * CIDLData_CreateFromIDArray [SHELL32.83]
1503 * Create IDataObject from PIDLs??
1505 HRESULT WINAPI CIDLData_CreateFromIDArray(
1506 LPCITEMIDLIST pidlFolder,
1507 DWORD cpidlFiles,
1508 LPCITEMIDLIST *lppidlFiles,
1509 LPDATAOBJECT *ppdataObject)
1511 INT i;
1512 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1514 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles, lppidlFiles, ppdataObject);
1515 if (TRACE_ON(pidl))
1517 pdump (pidlFolder);
1518 for (i=0; i<cpidlFiles; i++) pdump (lppidlFiles[i]);
1520 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1521 lppidlFiles, cpidlFiles);
1522 if (*ppdataObject) return S_OK;
1523 return E_OUTOFMEMORY;