Make the Wine trace facilities accessible from Winelib applications.
[wine/gsoc_dplay.git] / dlls / shell32 / shellord.c
blobd9eb50084e85699e13f1553fb0e20be9ed1f29d6
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
7 */
8 #include <string.h>
9 #include <stdio.h>
10 #include "winerror.h"
11 #include "winreg.h"
12 #include "debugtools.h"
13 #include "winnls.h"
14 #include "heap.h"
16 #include "wine/obj_base.h"
17 #include "shellapi.h"
18 #include "shlguid.h"
19 #include "shlobj.h"
20 #include "shell32_main.h"
21 #include "undocshell.h"
22 #include "pidl.h"
23 #include "shlwapi.h"
25 DEFAULT_DEBUG_CHANNEL(shell);
26 DECLARE_DEBUG_CHANNEL(pidl);
28 /*************************************************************************
29 * ParseFieldA [internal]
31 * copies a field from a ',' delimited string
33 * first field is nField = 1
35 DWORD WINAPI ParseFieldA(
36 LPCSTR src,
37 DWORD nField,
38 LPSTR dst,
39 DWORD len)
41 WARN("(%s,0x%08lx,%p,%ld) semi-stub.\n",debugstr_a(src),nField,dst,len);
43 if (!src || !src[0] || !dst || !len)
44 return 0;
46 /* skip n fields delimited by ',' */
47 while (nField > 1)
49 if (*src=='\0') return FALSE;
50 if (*(src++)==',') nField--;
53 /* copy part till the next ',' to dst */
54 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
56 /* finalize the string */
57 *dst=0x0;
59 return TRUE;
62 /*************************************************************************
63 * ParseFieldW [internal]
65 * copies a field from a ',' delimited string
67 * first field is nField = 1
69 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
71 FIXME("(%s,0x%08lx,%p,%ld) stub\n",
72 debugstr_w(src), nField, dst, len);
73 return FALSE;
76 /*************************************************************************
77 * ParseField [SHELL32.58]
79 DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
81 if (SHELL_OsIsUnicode())
82 return ParseFieldW(src, nField, dst, len);
83 return ParseFieldA(src, nField, dst, len);
86 /*************************************************************************
87 * GetFileNameFromBrowse [SHELL32.63]
90 BOOL WINAPI GetFileNameFromBrowse(
91 HWND hwndOwner,
92 LPSTR lpstrFile,
93 DWORD nMaxFile,
94 LPCSTR lpstrInitialDir,
95 LPCSTR lpstrDefExt,
96 LPCSTR lpstrFilter,
97 LPCSTR lpstrTitle)
99 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n",
100 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
101 lpstrFilter, lpstrTitle);
103 /* puts up a Open Dialog and requests input into targetbuf */
104 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
105 strcpy(lpstrFile,"x:\\dummy.exe");
106 return 1;
109 /*************************************************************************
110 * SHGetSetSettings [SHELL32.68]
112 VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z)
114 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z);
117 /*************************************************************************
118 * SHGetSettings [SHELL32.@]
120 * NOTES
121 * the registry path are for win98 (tested)
122 * and possibly are the same in nt40
125 VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
127 HKEY hKey;
128 DWORD dwData;
129 DWORD dwDataSize = sizeof (DWORD);
131 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
133 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
134 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
135 return;
137 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
138 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
140 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
141 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
143 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
144 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
146 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
147 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
149 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
150 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
152 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
153 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
155 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
156 { if (dwData == 0)
157 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
158 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
160 else if (dwData == 1)
161 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
162 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
164 else if (dwData == 2)
165 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
166 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
169 RegCloseKey (hKey);
171 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
174 /*************************************************************************
175 * SHShellFolderView_Message [SHELL32.73]
177 * PARAMETERS
178 * hwndCabinet defines the explorer cabinet window that contains the
179 * shellview you need to communicate with
180 * uMsg identifying the SFVM enum to perform
181 * lParam
183 * NOTES
184 * Message SFVM_REARRANGE = 1
185 * This message gets sent when a column gets clicked to instruct the
186 * shell view to re-sort the item list. lParam identifies the column
187 * that was clicked.
189 int WINAPI SHShellFolderView_Message(
190 HWND hwndCabinet,
191 DWORD dwMessage,
192 DWORD dwParam)
194 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
195 return 0;
198 /*************************************************************************
199 * RegisterShellHook [SHELL32.181]
201 * PARAMS
202 * hwnd [I] window handle
203 * y [I] flag ????
205 * NOTES
206 * exported by ordinal
208 BOOL WINAPI RegisterShellHook(
209 HWND hWnd,
210 DWORD dwType)
212 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType);
213 return TRUE;
215 /*************************************************************************
216 * ShellMessageBoxW [SHELL32.182]
218 * Format and output errormessage.
220 * idText resource ID of title or LPSTR
221 * idTitle resource ID of title or LPSTR
223 * NOTES
224 * exported by ordinal
226 int WINAPIV ShellMessageBoxW(
227 HINSTANCE hInstance,
228 HWND hWnd,
229 LPCWSTR lpText,
230 LPCWSTR lpCaption,
231 UINT uType,
232 ...)
234 WCHAR szText[100],szTitle[100];
235 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
236 va_list args;
237 int ret;
239 va_start(args, uType);
240 /* wvsprintfA(buf,fmt, args); */
242 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
243 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
245 if (!HIWORD(lpCaption))
246 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
247 else
248 pszTitle = lpCaption;
250 if (!HIWORD(lpText))
251 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
252 else
253 pszText = lpText;
255 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
256 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
258 va_end(args);
260 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
261 LocalFree((HLOCAL)pszTemp);
262 return ret;
265 /*************************************************************************
266 * ShellMessageBoxA [SHELL32.183]
268 int WINAPIV ShellMessageBoxA(
269 HINSTANCE hInstance,
270 HWND hWnd,
271 LPCSTR lpText,
272 LPCSTR lpCaption,
273 UINT uType,
274 ...)
276 char szText[100],szTitle[100];
277 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
278 va_list args;
279 int ret;
281 va_start(args, uType);
282 /* wvsprintfA(buf,fmt, args); */
284 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
285 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
287 if (!HIWORD(lpCaption))
288 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
289 else
290 pszTitle = lpCaption;
292 if (!HIWORD(lpText))
293 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
294 else
295 pszText = lpText;
297 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
298 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
300 va_end(args);
302 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
303 LocalFree((HLOCAL)pszTemp);
304 return ret;
307 /*************************************************************************
308 * SHFree [SHELL32.195]
310 * NOTES
311 * free_ptr() - frees memory using IMalloc
312 * exported by ordinal
314 #define MEM_DEBUG 0
315 void WINAPI SHFree(LPVOID x)
317 #if MEM_DEBUG
318 WORD len = *(LPWORD)((LPBYTE)x-2);
320 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
321 ERR("MAGIC2!\n");
323 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
324 ERR("MAGIC1!\n");
325 else
326 memset((LPBYTE)x-4, 0xde, len+6);
328 TRACE("%p len=%u\n",x, len);
330 x = (LPBYTE) x - 4;
331 #else
332 TRACE("%p\n",x);
333 #endif
334 HeapFree(GetProcessHeap(), 0, x);
337 /*************************************************************************
338 * SHAlloc [SHELL32.196]
340 * NOTES
341 * void *task_alloc(DWORD len), uses SHMalloc allocator
342 * exported by ordinal
344 LPVOID WINAPI SHAlloc(DWORD len)
346 LPBYTE ret;
348 #if MEM_DEBUG
349 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
350 #else
351 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
352 #endif
354 #if MEM_DEBUG
355 *(LPWORD)(ret) = 0x8271;
356 *(LPWORD)(ret+2) = (WORD)len;
357 *(LPWORD)(ret+4+len) = 0x7384;
358 ret += 4;
359 memset(ret, 0xdf, len);
360 #endif
361 TRACE("%lu bytes at %p\n",len, ret);
362 return (LPVOID)ret;
365 /*************************************************************************
366 * SHRegisterDragDrop [SHELL32.86]
368 * NOTES
369 * exported by ordinal
371 HRESULT WINAPI SHRegisterDragDrop(
372 HWND hWnd,
373 LPDROPTARGET pDropTarget)
375 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
376 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
377 return 0;
380 /*************************************************************************
381 * SHRevokeDragDrop [SHELL32.87]
383 * NOTES
384 * exported by ordinal
386 HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
388 FIXME("(0x%08x):stub.\n",hWnd);
389 return 0;
392 /*************************************************************************
393 * SHDoDragDrop [SHELL32.88]
395 * NOTES
396 * exported by ordinal
398 HRESULT WINAPI SHDoDragDrop(
399 HWND hWnd,
400 LPDATAOBJECT lpDataObject,
401 LPDROPSOURCE lpDropSource,
402 DWORD dwOKEffect,
403 LPDWORD pdwEffect)
405 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n",
406 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
407 return 0;
410 /*************************************************************************
411 * ArrangeWindows [SHELL32.184]
414 WORD WINAPI ArrangeWindows(
415 HWND hwndParent,
416 DWORD dwReserved,
417 LPCRECT lpRect,
418 WORD cKids,
419 CONST HWND * lpKids)
421 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n",
422 hwndParent, dwReserved, lpRect, cKids, lpKids);
423 return 0;
426 /*************************************************************************
427 * SignalFileOpen [SHELL32.103]
429 * NOTES
430 * exported by ordinal
432 DWORD WINAPI
433 SignalFileOpen (DWORD dwParam1)
435 FIXME("(0x%08lx):stub.\n", dwParam1);
437 return 0;
440 /*************************************************************************
441 * SHADD_get_policy - helper function for SHAddToRecentDocs
443 * PARAMETERS
444 * policy [IN] policy name (null termed string) to find
445 * type [OUT] ptr to DWORD to receive type
446 * buffer [OUT] ptr to area to hold data retrieved
447 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
448 * length filled
450 * RETURNS
451 * result of the SHQueryValueEx call
453 static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
455 HKEY Policy_basekey;
456 INT ret;
458 /* Get the key for the policies location in the registry
460 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
461 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
462 0, KEY_READ, &Policy_basekey)) {
464 if (RegOpenKeyExA(HKEY_CURRENT_USER,
465 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
466 0, KEY_READ, &Policy_basekey)) {
467 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
468 policy);
469 *len = 0;
470 return ERROR_FILE_NOT_FOUND;
474 /* Retrieve the data if it exists
476 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
477 RegCloseKey(Policy_basekey);
478 return ret;
482 /*************************************************************************
483 * SHADD_compare_mru - helper function for SHAddToRecentDocs
485 * PARAMETERS
486 * data1 [IN] data being looked for
487 * data2 [IN] data in MRU
488 * cbdata [IN] length from FindMRUData call (not used)
490 * RETURNS
491 * position within MRU list that data was added.
493 static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
495 return lstrcmpiA(data1, data2);
498 /*************************************************************************
499 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
501 * PARAMETERS
502 * mruhandle [IN] handle for created MRU list
503 * doc_name [IN] null termed pure doc name
504 * new_lnk_name [IN] null termed path and file name for .lnk file
505 * buffer [IN/OUT] 2048 byte area to consturct MRU data
506 * len [OUT] ptr to int to receive space used in buffer
508 * RETURNS
509 * position within MRU list that data was added.
511 static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
512 LPSTR buffer, INT *len)
514 LPSTR ptr;
515 INT wlen;
517 /*FIXME: Document:
518 * RecentDocs MRU data structure seems to be:
519 * +0h document file name w/ terminating 0h
520 * +nh short int w/ size of remaining
521 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
522 * +n+4h 10 bytes zeros - unknown
523 * +n+eh shortcut file name w/ terminating 0h
524 * +n+e+nh 3 zero bytes - unknown
527 /* Create the MRU data structure for "RecentDocs"
529 ptr = buffer;
530 lstrcpyA(ptr, doc_name);
531 ptr += (lstrlenA(buffer) + 1);
532 wlen= lstrlenA(new_lnk_name) + 1 + 12;
533 *((short int*)ptr) = wlen;
534 ptr += 2; /* step past the length */
535 *(ptr++) = 0x30; /* unknown reason */
536 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
537 memset(ptr, 0, 10);
538 ptr += 10;
539 lstrcpyA(ptr, new_lnk_name);
540 ptr += (lstrlenA(new_lnk_name) + 1);
541 memset(ptr, 0, 3);
542 ptr += 3;
543 *len = ptr - buffer;
545 /* Add the new entry into the MRU list
547 return pAddMRUData(mruhandle, (LPCVOID)buffer, *len);
550 /*************************************************************************
551 * SHAddToRecentDocs [SHELL32.@]
553 * PARAMETERS
554 * uFlags [IN] SHARD_PATH or SHARD_PIDL
555 * pv [IN] string or pidl, NULL clears the list
557 * NOTES
558 * exported by name
560 * FIXME: ?? MSDN shows this as a VOID
562 DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
565 /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
566 /* !!! it is in both here and comctl32undoc.c !!! */
567 typedef struct tagCREATEMRULIST
569 DWORD cbSize; /* size of struct */
570 DWORD nMaxItems; /* max no. of items in list */
571 DWORD dwFlags; /* see below */
572 HKEY hKey; /* root reg. key under which list is saved */
573 LPCSTR lpszSubKey; /* reg. subkey */
574 PROC lpfnCompare; /* item compare proc */
575 } CREATEMRULIST, *LPCREATEMRULIST;
577 /* dwFlags */
578 #define MRUF_STRING_LIST 0 /* list will contain strings */
579 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
580 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
582 /* If list is a string list lpfnCompare has the following prototype
583 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
584 * for binary lists the prototype is
585 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
586 * where cbData is the no. of bytes to compare.
587 * Need to check what return value means identical - 0?
591 UINT olderrormode;
592 HKEY HCUbasekey;
593 CHAR doc_name[MAX_PATH];
594 CHAR link_dir[MAX_PATH];
595 CHAR new_lnk_filepath[MAX_PATH];
596 CHAR new_lnk_name[MAX_PATH];
597 IMalloc *ppM;
598 LPITEMIDLIST pidl;
599 HWND hwnd = 0; /* FIXME: get real window handle */
600 INT ret;
601 DWORD data[64], datalen, type;
603 /*FIXME: Document:
604 * RecentDocs MRU data structure seems to be:
605 * +0h document file name w/ terminating 0h
606 * +nh short int w/ size of remaining
607 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
608 * +n+4h 10 bytes zeros - unknown
609 * +n+eh shortcut file name w/ terminating 0h
610 * +n+e+nh 3 zero bytes - unknown
613 /* See if we need to do anything.
615 datalen = 64;
616 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
617 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
618 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
619 return 0;
621 if (ret == ERROR_SUCCESS) {
622 if (!( (type == REG_DWORD) ||
623 ((type == REG_BINARY) && (datalen == 4)) )) {
624 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
625 type, datalen);
626 return 0;
629 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
630 /* now test the actual policy value */
631 if ( data[0] != 0)
632 return 0;
635 /* Open key to where the necessary info is
637 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
638 * and the close should be done during the _DETACH. The resulting
639 * key is stored in the DLL global data.
641 if (RegCreateKeyExA(HKEY_CURRENT_USER,
642 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
643 0, 0, 0, KEY_READ, 0, &HCUbasekey, 0)) {
644 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
645 return 0;
648 /* Get path to user's "Recent" directory
650 if(SUCCEEDED(SHGetMalloc(&ppM))) {
651 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
652 &pidl))) {
653 SHGetPathFromIDListA(pidl, link_dir);
654 IMalloc_Free(ppM, pidl);
656 else {
657 /* serious issues */
658 link_dir[0] = 0;
659 ERR("serious issues 1\n");
661 IMalloc_Release(ppM);
663 else {
664 /* serious issues */
665 link_dir[0] = 0;
666 ERR("serious issues 2\n");
668 TRACE("Users Recent dir %s\n", link_dir);
670 /* If no input, then go clear the lists */
671 if (!pv) {
672 /* clear user's Recent dir
675 /* FIXME: delete all files in "link_dir"
677 * while( more files ) {
678 * lstrcpyA(old_lnk_name, link_dir);
679 * PathAppendA(old_lnk_name, filenam);
680 * DeleteFileA(old_lnk_name);
683 FIXME("should delete all files in %s\\ \n", link_dir);
685 /* clear MRU list
687 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
688 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
689 * and naturally it fails w/ rc=2. It should do it against
690 * HKEY_CURRENT_USER which is where it is stored, and where
691 * the MRU routines expect it!!!!
693 RegDeleteKeyA(HCUbasekey, "RecentDocs");
694 RegCloseKey(HCUbasekey);
695 return 0;
698 /* Have data to add, the jobs to be done:
699 * 1. Add document to MRU list in registry "HKCU\Software\
700 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
701 * 2. Add shortcut to document in the user's Recent directory
702 * (CSIDL_RECENT).
703 * 3. Add shortcut to Start menu's Documents submenu.
706 /* Get the pure document name from the input
708 if (uFlags & SHARD_PIDL) {
709 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
711 else {
712 lstrcpyA(doc_name, (LPSTR) pv);
714 TRACE("full document name %s\n", doc_name);
715 PathStripPathA(doc_name);;
716 TRACE("stripped document name %s\n", doc_name);
719 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
721 { /* on input needs:
722 * doc_name - pure file-spec, no path
723 * link_dir - path to the user's Recent directory
724 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
725 * creates:
726 * new_lnk_name- pure file-spec, no path for new .lnk file
727 * new_lnk_filepath
728 * - path and file name of new .lnk file
730 CREATEMRULIST mymru;
731 HANDLE mruhandle;
732 INT len, pos, bufused, err;
733 INT i;
734 DWORD attr;
735 CHAR buffer[2048];
736 CHAR *ptr;
737 CHAR old_lnk_name[MAX_PATH];
738 short int slen;
740 mymru.cbSize = sizeof(CREATEMRULIST);
741 mymru.nMaxItems = 15;
742 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
743 mymru.hKey = HCUbasekey;
744 mymru.lpszSubKey = "RecentDocs";
745 mymru.lpfnCompare = &SHADD_compare_mru;
746 mruhandle = pCreateMRUListA(&mymru);
747 if (!mruhandle) {
748 /* MRU failed */
749 ERR("MRU processing failed, handle zero\n");
750 RegCloseKey(HCUbasekey);
751 return 0;
753 len = lstrlenA(doc_name);
754 pos = pFindMRUData(mruhandle, doc_name, len, 0);
756 /* Now get the MRU entry that will be replaced
757 * and delete the .lnk file for it
759 if ((bufused = pEnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
760 buffer, 2048)) != -1) {
761 ptr = buffer;
762 ptr += (lstrlenA(buffer) + 1);
763 slen = *((short int*)ptr);
764 ptr += 2; /* skip the length area */
765 if (bufused >= slen + (ptr-buffer)) {
766 /* buffer size looks good */
767 ptr += 12; /* get to string */
768 len = bufused - (ptr-buffer); /* get length of buf remaining */
769 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
770 /* appears to be good string */
771 lstrcpyA(old_lnk_name, link_dir);
772 PathAppendA(old_lnk_name, ptr);
773 if (!DeleteFileA(old_lnk_name)) {
774 if ((attr = GetFileAttributesA(old_lnk_name)) == -1) {
775 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
776 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
777 old_lnk_name, err, attr);
779 else {
780 TRACE("old .lnk file %s did not exist\n",
781 old_lnk_name);
784 else {
785 ERR("Delete for %s failed, attr=%08lx\n",
786 old_lnk_name, attr);
789 else {
790 TRACE("deleted old .lnk file %s\n", old_lnk_name);
796 /* Create usable .lnk file name for the "Recent" directory
798 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
799 lstrcpyA(new_lnk_filepath, link_dir);
800 PathAppendA(new_lnk_filepath, new_lnk_name);
801 i = 1;
802 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
803 while (GetFileAttributesA(new_lnk_filepath) != -1) {
804 i++;
805 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
806 lstrcpyA(new_lnk_filepath, link_dir);
807 PathAppendA(new_lnk_filepath, new_lnk_name);
809 SetErrorMode(olderrormode);
810 TRACE("new shortcut will be %s\n", new_lnk_filepath);
812 /* Now add the new MRU entry and data
814 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
815 buffer, &len);
816 pFreeMRUListA(mruhandle);
817 TRACE("Updated MRU list, new doc is position %d\n", pos);
820 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
822 { /* on input needs:
823 * doc_name - pure file-spec, no path
824 * new_lnk_filepath
825 * - path and file name of new .lnk file
826 * uFlags[in] - flags on call to SHAddToRecentDocs
827 * pv[in] - document path/pidl on call to SHAddToRecentDocs
829 IShellLinkA *psl = NULL;
830 IPersistFile *pPf = NULL;
831 HRESULT hres;
832 CHAR desc[MAX_PATH];
833 WCHAR widelink[MAX_PATH];
835 CoInitialize(0);
837 hres = CoCreateInstance( &CLSID_ShellLink,
838 NULL,
839 CLSCTX_INPROC_SERVER,
840 &IID_IShellLinkA,
841 (LPVOID )&psl);
842 if(SUCCEEDED(hres)) {
844 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
845 (LPVOID *)&pPf);
846 if(FAILED(hres)) {
847 /* bombed */
848 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
849 goto fail;
852 /* Set the document path or pidl */
853 if (uFlags & SHARD_PIDL) {
854 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
855 } else {
856 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
858 if(FAILED(hres)) {
859 /* bombed */
860 ERR("failed Set{IDList|Path} %08lx\n", hres);
861 goto fail;
864 lstrcpyA(desc, "Shortcut to ");
865 lstrcatA(desc, doc_name);
866 hres = IShellLinkA_SetDescription(psl, desc);
867 if(FAILED(hres)) {
868 /* bombed */
869 ERR("failed SetDescription %08lx\n", hres);
870 goto fail;
873 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
874 widelink, MAX_PATH);
875 /* create the short cut */
876 hres = IPersistFile_Save(pPf, widelink, TRUE);
877 if(FAILED(hres)) {
878 /* bombed */
879 ERR("failed IPersistFile::Save %08lx\n", hres);
880 IPersistFile_Release(pPf);
881 IShellLinkA_Release(psl);
882 goto fail;
884 hres = IPersistFile_SaveCompleted(pPf, widelink);
885 IPersistFile_Release(pPf);
886 IShellLinkA_Release(psl);
887 TRACE("shortcut %s has been created, result=%08lx\n",
888 new_lnk_filepath, hres);
890 else {
891 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
895 fail:
896 CoUninitialize();
898 /* all done */
899 RegCloseKey(HCUbasekey);
900 return 0;
903 /*************************************************************************
904 * SHCreateShellFolderViewEx [SHELL32.174]
906 * NOTES
907 * see IShellFolder::CreateViewObject
909 HRESULT WINAPI SHCreateShellFolderViewEx(
910 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */
911 LPSHELLVIEW* ppv) /* [out] IShellView pointer */
913 IShellView * psf;
914 HRESULT hRes;
916 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
917 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
918 psvcbi->uViewMode, psvcbi->dwUser);
920 psf = IShellView_Constructor(psvcbi->pshf);
922 if (!psf)
923 return E_OUTOFMEMORY;
925 IShellView_AddRef(psf);
926 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
927 IShellView_Release(psf);
929 return hRes;
931 /*************************************************************************
932 * SHWinHelp [SHELL32.127]
935 HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
936 { FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
937 return 0;
939 /*************************************************************************
940 * SHRunControlPanel [SHELL32.161]
943 HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
944 { FIXME("0x%08lx 0x%08lx stub\n",x,z);
945 return 0;
947 /*************************************************************************
948 * ShellExecuteEx [SHELL32.291]
951 BOOL WINAPI ShellExecuteExAW (LPVOID sei)
952 { if (SHELL_OsIsUnicode())
953 return ShellExecuteExW (sei);
954 return ShellExecuteExA (sei);
956 /*************************************************************************
957 * ShellExecuteExA [SHELL32.292]
959 * placeholder in the commandline:
960 * %1 file
961 * %2 printer
962 * %3 driver
963 * %4 port
964 * %I adress of a global item ID (explorer switch /idlist)
965 * %L ??? path/url/current file ???
966 * %S ???
967 * %* all following parameters (see batfile)
969 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
970 { CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
971 LPSTR pos;
972 int gap, len;
973 STARTUPINFOA startup;
974 PROCESS_INFORMATION info;
976 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
977 sei->fMask, sei->hwnd, debugstr_a(sei->lpVerb),
978 debugstr_a(sei->lpFile), debugstr_a(sei->lpParameters),
979 debugstr_a(sei->lpDirectory), sei->nShow,
980 (sei->fMask & SEE_MASK_CLASSNAME) ? debugstr_a(sei->lpClass) : "not used");
982 ZeroMemory(szApplicationName,MAX_PATH);
983 if (sei->lpFile)
984 strcpy(szApplicationName, sei->lpFile);
986 ZeroMemory(szCommandline,MAX_PATH);
987 if (sei->lpParameters)
988 strcpy(szCommandline, sei->lpParameters);
990 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
991 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
992 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
993 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
995 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
998 /* launch a document by fileclass like 'Wordpad.Document.1' */
999 if (sei->fMask & SEE_MASK_CLASSNAME)
1001 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
1002 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
1003 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline));
1004 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
1005 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
1008 /* process the IDList */
1009 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
1011 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
1012 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
1014 else
1016 if (sei->fMask & SEE_MASK_IDLIST )
1018 pos = strstr(szCommandline, "%I");
1019 if (pos)
1021 LPVOID pv;
1022 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
1023 pv = SHLockShared(hmem,0);
1024 sprintf(szPidl,":%p",pv );
1025 SHUnlockShared(pv);
1027 gap = strlen(szPidl);
1028 len = strlen(pos)-2;
1029 memmove(pos+gap,pos+2,len);
1030 memcpy(pos,szPidl,gap);
1036 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
1038 if (szCommandline[0]) {
1039 strcat(szApplicationName, " ");
1040 strcat(szApplicationName, szCommandline);
1043 ZeroMemory(&startup,sizeof(STARTUPINFOA));
1044 startup.cb = sizeof(STARTUPINFOA);
1046 if (! CreateProcessA(NULL, szApplicationName,
1047 NULL, NULL, FALSE, 0,
1048 NULL, sei->lpDirectory,
1049 &startup, &info))
1051 sei->hInstApp = GetLastError();
1052 return FALSE;
1055 sei->hInstApp = 33;
1057 /* Give 30 seconds to the app to come up */
1058 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
1059 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
1061 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
1062 sei->hProcess = info.hProcess;
1063 else
1064 CloseHandle( info.hProcess );
1065 CloseHandle( info.hThread );
1066 return TRUE;
1068 /*************************************************************************
1069 * ShellExecuteExW [SHELL32.293]
1072 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
1073 { SHELLEXECUTEINFOA seiA;
1074 DWORD ret;
1076 TRACE("%p\n", sei);
1078 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
1080 if (sei->lpVerb)
1081 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
1083 if (sei->lpFile)
1084 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
1086 if (sei->lpParameters)
1087 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
1089 if (sei->lpDirectory)
1090 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
1092 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
1093 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
1094 else
1095 seiA.lpClass = NULL;
1097 ret = ShellExecuteExA(&seiA);
1099 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
1100 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
1101 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
1102 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
1103 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
1105 return ret;
1108 static LPUNKNOWN SHELL32_IExplorerInterface=0;
1109 /*************************************************************************
1110 * SHSetInstanceExplorer [SHELL32.176]
1112 * NOTES
1113 * Sets the interface
1115 HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
1116 { TRACE("%p\n", lpUnknown);
1117 SHELL32_IExplorerInterface = lpUnknown;
1118 return (HRESULT) lpUnknown;
1120 /*************************************************************************
1121 * SHGetInstanceExplorer [SHELL32.@]
1123 * NOTES
1124 * gets the interface pointer of the explorer and a reference
1126 HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
1127 { TRACE("%p\n", lpUnknown);
1129 *lpUnknown = SHELL32_IExplorerInterface;
1131 if (!SHELL32_IExplorerInterface)
1132 return E_FAIL;
1134 IUnknown_AddRef(SHELL32_IExplorerInterface);
1135 return NOERROR;
1137 /*************************************************************************
1138 * SHFreeUnusedLibraries [SHELL32.123]
1140 * NOTES
1141 * exported by name
1143 void WINAPI SHFreeUnusedLibraries (void)
1145 FIXME("stub\n");
1147 /*************************************************************************
1148 * DAD_SetDragImage [SHELL32.136]
1150 * NOTES
1151 * exported by name
1153 BOOL WINAPI DAD_SetDragImage(
1154 HIMAGELIST himlTrack,
1155 LPPOINT lppt)
1157 FIXME("%p %p stub\n",himlTrack, lppt);
1158 return 0;
1160 /*************************************************************************
1161 * DAD_ShowDragImage [SHELL32.137]
1163 * NOTES
1164 * exported by name
1166 BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1168 FIXME("0x%08x stub\n",bShow);
1169 return 0;
1171 /*************************************************************************
1172 * ReadCabinetState [SHELL32.651] NT 4.0
1175 HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
1176 { FIXME("0x%04lx 0x%04lx stub\n",u,v);
1177 return 0;
1179 /*************************************************************************
1180 * WriteCabinetState [SHELL32.652] NT 4.0
1183 HRESULT WINAPI WriteCabinetState(DWORD u)
1184 { FIXME("0x%04lx stub\n",u);
1185 return 0;
1187 /*************************************************************************
1188 * FileIconInit [SHELL32.660]
1191 BOOL WINAPI FileIconInit(BOOL bFullInit)
1192 { FIXME("(%s)\n", bFullInit ? "true" : "false");
1193 return 0;
1195 /*************************************************************************
1196 * IsUserAdmin [SHELL32.680] NT 4.0
1199 HRESULT WINAPI IsUserAdmin(void)
1200 { FIXME("stub\n");
1201 return TRUE;
1204 /*************************************************************************
1205 * SHAllocShared [SHELL32.520]
1207 * NOTES
1208 * parameter1 is return value from HeapAlloc
1209 * parameter2 is equal to the size allocated with HeapAlloc
1210 * parameter3 is return value from GetCurrentProcessId
1212 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1213 * WM_USER+2 could be the undocumented CWM_SETPATH
1214 * the allocated memory contains a pidl
1216 HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1217 { HGLOBAL hmem;
1218 LPVOID pmem;
1220 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1221 hmem = GlobalAlloc(GMEM_FIXED, size);
1222 if (!hmem)
1223 return 0;
1225 pmem = GlobalLock (hmem);
1227 if (! pmem)
1228 return 0;
1230 memcpy (pmem, psrc, size);
1231 GlobalUnlock(hmem);
1232 return hmem;
1234 /*************************************************************************
1235 * SHLockShared [SHELL32.521]
1237 * NOTES
1238 * parameter1 is return value from SHAllocShared
1239 * parameter2 is return value from GetCurrentProcessId
1240 * the receiver of (WM_USER+2) tries to lock the HANDLE (?)
1241 * the return value seems to be a memory address
1243 LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1244 { TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1245 return GlobalLock(hmem);
1247 /*************************************************************************
1248 * SHUnlockShared [SHELL32.522]
1250 * NOTES
1251 * parameter1 is return value from SHLockShared
1253 BOOL WINAPI SHUnlockShared(LPVOID pv)
1255 TRACE("%p\n",pv);
1256 return GlobalUnlock((HANDLE)pv);
1258 /*************************************************************************
1259 * SHFreeShared [SHELL32.523]
1261 * NOTES
1262 * parameter1 is return value from SHAllocShared
1263 * parameter2 is return value from GetCurrentProcessId
1265 BOOL WINAPI SHFreeShared(
1266 HANDLE hMem,
1267 DWORD pid)
1269 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid);
1270 return GlobalFree(hMem);
1273 /*************************************************************************
1274 * SetAppStartingCursor [SHELL32.99]
1276 HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1277 { FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1278 return 0;
1280 /*************************************************************************
1281 * SHLoadOLE [SHELL32.151]
1284 HRESULT WINAPI SHLoadOLE(DWORD u)
1285 { FIXME("0x%04lx stub\n",u);
1286 return S_OK;
1288 /*************************************************************************
1289 * DriveType [SHELL32.64]
1292 HRESULT WINAPI DriveType(DWORD u)
1293 { FIXME("0x%04lx stub\n",u);
1294 return 0;
1296 /*************************************************************************
1297 * SHAbortInvokeCommand [SHELL32.198]
1300 HRESULT WINAPI SHAbortInvokeCommand(void)
1301 { FIXME("stub\n");
1302 return 1;
1304 /*************************************************************************
1305 * SHOutOfMemoryMessageBox [SHELL32.126]
1308 int WINAPI SHOutOfMemoryMessageBox(
1309 HWND hwndOwner,
1310 LPCSTR lpCaption,
1311 UINT uType)
1313 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1314 return 0;
1316 /*************************************************************************
1317 * SHFlushClipboard [SHELL32.121]
1320 HRESULT WINAPI SHFlushClipboard(void)
1321 { FIXME("stub\n");
1322 return 1;
1325 /*************************************************************************
1326 * SHWaitForFileToOpen [SHELL32.97]
1329 BOOL WINAPI SHWaitForFileToOpen(
1330 LPCITEMIDLIST pidl,
1331 DWORD dwFlags,
1332 DWORD dwTimeout)
1334 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1335 return 0;
1338 /************************************************************************
1339 * @ [SHELL32.654]
1341 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1342 * second one could be a size (0x0c). The size is the same as the structure saved to
1343 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1344 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1346 HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1347 { FIXME("0x%08lx 0x%08lx stub\n",x,y);
1348 return 0;
1351 /************************************************************************
1352 * RLBuildListOfPaths [SHELL32.146]
1354 * NOTES
1355 * builds a DPA
1357 DWORD WINAPI RLBuildListOfPaths (void)
1358 { FIXME("stub\n");
1359 return 0;
1361 /************************************************************************
1362 * SHValidateUNC [SHELL32.173]
1365 HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1367 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1368 return 0;
1371 /************************************************************************
1372 * DoEnvironmentSubstA [SHELL32.@]
1375 HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1377 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1378 return 0;
1381 /************************************************************************
1382 * DoEnvironmentSubstW [SHELL32.@]
1385 HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1387 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1388 return 0;
1391 /************************************************************************
1392 * DoEnvironmentSubst [SHELL32.53]
1395 HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1397 if (SHELL_OsIsUnicode())
1398 return DoEnvironmentSubstW(x, y);
1399 return DoEnvironmentSubstA(x, y);
1402 /*************************************************************************
1403 * @ [SHELL32.243]
1405 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1406 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1410 BOOL WINAPI shell32_243(DWORD a, DWORD b)
1412 return FALSE;
1415 /*************************************************************************
1416 * @ [SHELL32.714]
1418 DWORD WINAPI SHELL32_714(LPVOID x)
1420 FIXME("(%s)stub\n", debugstr_w(x));
1421 return 0;
1424 /*************************************************************************
1425 * SHAddFromPropSheetExtArray [SHELL32.167]
1427 DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1429 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1430 return 0;
1433 /*************************************************************************
1434 * SHCreatePropSheetExtArray [SHELL32.168]
1436 DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1438 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1439 return 0;
1442 /*************************************************************************
1443 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1445 DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1447 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1448 return 0;
1451 /*************************************************************************
1452 * SHDestroyPropSheetExtArray [SHELL32.169]
1454 DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1456 FIXME("(%08lx)stub\n", a);
1457 return 0;
1460 /*************************************************************************
1461 * CIDLData_CreateFromIDArray [SHELL32.83]
1463 * Create IDataObject from PIDLs??
1465 HRESULT WINAPI CIDLData_CreateFromIDArray(
1466 LPCITEMIDLIST pidlFolder,
1467 DWORD cpidlFiles,
1468 LPCITEMIDLIST *lppidlFiles,
1469 LPDATAOBJECT *ppdataObject)
1471 INT i;
1472 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1473 BOOL boldpidl;
1475 if (TRACE_ON(shell)) {
1476 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles,
1477 lppidlFiles, ppdataObject);
1478 boldpidl = TRACE_ON(pidl);
1479 __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_shell, FALSE);
1480 __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_pidl, TRUE);
1481 pdump (pidlFolder);
1482 for (i=0; i<cpidlFiles; i++){
1483 pdump (lppidlFiles[i]);
1485 __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_shell, TRUE);
1486 __WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_pidl, boldpidl);
1488 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1489 lppidlFiles, cpidlFiles);
1490 if (*ppdataObject) return S_OK;
1491 return E_OUTOFMEMORY;