source: trunk/src/shell32/shellord.c@ 7904

Last change on this file since 7904 was 7904, checked in by sandervl, 24 years ago

extended logging added

File size: 41.5 KB
Line 
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
9/****************************************************************************
10 * includes
11 ****************************************************************************/
12
13#include <odin.h>
14#include <os2sel.h>
15#include <odinwrap.h>
16
17ODINDEBUGCHANNEL(SHELL32-SHELLORD)
18
19
20#include <string.h>
21#include <stdio.h>
22#include "winerror.h"
23#include "winreg.h"
24#include "debugtools.h"
25#include "winnls.h"
26
27#ifdef __WIN32OS2__
28#include "heapstring.h"
29#else
30#include "heap.h"
31#endif
32
33#include "shlwapi.h"
34#include "shellapi.h"
35#include "shlguid.h"
36#include "shlobj.h"
37#include "shell32_main.h"
38#ifdef __WIN32OS2__
39#include "wine\undocshell.h"
40#else
41#include "undocshell.h"
42#endif
43
44DEFAULT_DEBUG_CHANNEL(shell);
45
46/*************************************************************************
47 * ParseFieldA [internal]
48 *
49 * copys a field from a ',' delimited string
50 *
51 * first field is nField = 1
52 */
53DWORD WINAPI ParseFieldA(
54 LPCSTR src,
55 DWORD nField,
56 LPSTR dst,
57 DWORD len)
58{
59 WARN("('%s',0x%08lx,%p,%ld) semi-stub.\n",src,nField,dst,len);
60
61 if (!src || !src[0] || !dst || !len)
62 return 0;
63
64 /* skip n fields delimited by ',' */
65 while (nField > 1)
66 {
67 if (*src=='\0') return FALSE;
68 if (*(src++)==',') nField--;
69 }
70
71 /* copy part till the next ',' to dst */
72 while ( *src!='\0' && *src!=',' && (len--)>0 ) *(dst++)=*(src++);
73
74 /* finalize the string */
75 *dst=0x0;
76
77 return TRUE;
78}
79
80/*************************************************************************
81 * ParseFieldW [internal]
82 *
83 * copys a field from a ',' delimited string
84 *
85 * first field is nField = 1
86 */
87DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len)
88{
89 FIXME("(%s,0x%08lx,%p,%ld) stub\n",
90 debugstr_w(src), nField, dst, len);
91 return FALSE;
92}
93
94/*************************************************************************
95 * ParseField [SHELL32.58]
96 */
97DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
98{
99 if (SHELL_OsIsUnicode())
100 return ParseFieldW(src, nField, dst, len);
101 return ParseFieldA(src, nField, dst, len);
102}
103
104/*************************************************************************
105 * GetFileNameFromBrowse [SHELL32.63]
106 *
107 */
108BOOL WIN32API GetFileNameFromBrowse(HWND hwndOwner, LPSTR lpstrFile,
109 DWORD nMaxFile, LPCSTR lpstrInitialDir,
110 LPCSTR lpstrDefExt, LPCSTR lpstrFilter,
111 LPCSTR lpstrTitle)
112{
113 FIXME("(%04x,%s,%ld,%s,%s,%s,%s):stub.\n",
114 hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
115 lpstrFilter, lpstrTitle);
116
117 /* puts up a Open Dialog and requests input into targetbuf */
118 /* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
119 strcpy(lpstrFile,"x:\\dummy.exe");
120 return 1;
121}
122
123/*************************************************************************
124 * SHGetSetSettings [SHELL32.68]
125 */
126VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z)
127{
128 FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z);
129}
130
131/*************************************************************************
132 * SHGetSettings [SHELL32.@]
133 *
134 * NOTES
135 * the registry path are for win98 (tested)
136 * and possibly are the same in nt40
137 *
138 */
139VOID WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask)
140{
141 HKEY hKey;
142 DWORD dwData;
143 DWORD dwDataSize = sizeof (DWORD);
144
145 TRACE("(%p 0x%08lx)\n",lpsfs,dwMask);
146
147 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
148 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0))
149 return;
150
151 if ( (SSF_SHOWEXTENSIONS & dwMask) && !RegQueryValueExA(hKey, "HideFileExt", 0, 0, (LPBYTE)&dwData, &dwDataSize))
152 lpsfs->fShowExtensions = ((dwData == 0) ? 0 : 1);
153
154 if ( (SSF_SHOWINFOTIP & dwMask) && !RegQueryValueExA(hKey, "ShowInfoTip", 0, 0, (LPBYTE)&dwData, &dwDataSize))
155 lpsfs->fShowInfoTip = ((dwData == 0) ? 0 : 1);
156
157 if ( (SSF_DONTPRETTYPATH & dwMask) && !RegQueryValueExA(hKey, "DontPrettyPath", 0, 0, (LPBYTE)&dwData, &dwDataSize))
158 lpsfs->fDontPrettyPath = ((dwData == 0) ? 0 : 1);
159
160 if ( (SSF_HIDEICONS & dwMask) && !RegQueryValueExA(hKey, "HideIcons", 0, 0, (LPBYTE)&dwData, &dwDataSize))
161 lpsfs->fHideIcons = ((dwData == 0) ? 0 : 1);
162
163 if ( (SSF_MAPNETDRVBUTTON & dwMask) && !RegQueryValueExA(hKey, "MapNetDrvBtn", 0, 0, (LPBYTE)&dwData, &dwDataSize))
164 lpsfs->fMapNetDrvBtn = ((dwData == 0) ? 0 : 1);
165
166 if ( (SSF_SHOWATTRIBCOL & dwMask) && !RegQueryValueExA(hKey, "ShowAttribCol", 0, 0, (LPBYTE)&dwData, &dwDataSize))
167 lpsfs->fShowAttribCol = ((dwData == 0) ? 0 : 1);
168
169 if (((SSF_SHOWALLOBJECTS | SSF_SHOWSYSFILES) & dwMask) && !RegQueryValueExA(hKey, "Hidden", 0, 0, (LPBYTE)&dwData, &dwDataSize))
170 { if (dwData == 0)
171 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
172 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
173 }
174 else if (dwData == 1)
175 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 1;
176 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 0;
177 }
178 else if (dwData == 2)
179 { if (SSF_SHOWALLOBJECTS & dwMask) lpsfs->fShowAllObjects = 0;
180 if (SSF_SHOWSYSFILES & dwMask) lpsfs->fShowSysFiles = 1;
181 }
182 }
183 RegCloseKey (hKey);
184
185 TRACE("-- 0x%04x\n", *(WORD*)lpsfs);
186}
187
188/*************************************************************************
189 * SHShellFolderView_Message [SHELL32.73]
190 *
191 * PARAMETERS
192 * hwndCabinet defines the explorer cabinet window that contains the
193 * shellview you need to communicate with
194 * uMsg identifying the SFVM enum to perform
195 * lParam
196 *
197 * NOTES
198 * Message SFVM_REARRANGE = 1
199 * This message gets sent when a column gets clicked to instruct the
200 * shell view to re-sort the item list. lParam identifies the column
201 * that was clicked.
202 */
203int WINAPI SHShellFolderView_Message(
204 HWND hwndCabinet,
205 DWORD dwMessage,
206 DWORD dwParam)
207{
208 FIXME("%04x %08lx %08lx stub\n",hwndCabinet, dwMessage, dwParam);
209 return 0;
210}
211
212/*************************************************************************
213 * RegisterShellHook [SHELL32.181]
214 *
215 * PARAMS
216 * hwnd [I] window handle
217 * y [I] flag ????
218 *
219 * NOTES
220 * exported by ordinal
221 */
222BOOL WINAPI RegisterShellHook(
223 HWND hWnd,
224 DWORD dwType)
225{
226 FIXME("(0x%08x,0x%08lx):stub.\n",hWnd, dwType);
227 return TRUE;
228}
229/*************************************************************************
230 * ShellMessageBoxW [SHELL32.182]
231 *
232 * Format and output errormessage.
233 *
234 * idText resource ID of title or LPSTR
235 * idTitle resource ID of title or LPSTR
236 *
237 * NOTES
238 * exported by ordinal
239 */
240int WINAPIV ShellMessageBoxW(
241 HINSTANCE hInstance,
242 HWND hWnd,
243 LPCWSTR lpText,
244 LPCWSTR lpCaption,
245 UINT uType,
246 ...)
247{
248 WCHAR szText[100],szTitle[100];
249 LPCWSTR pszText = szText, pszTitle = szTitle, pszTemp;
250 va_list args;
251 int ret;
252
253 va_start(args, uType);
254 /* wvsprintfA(buf,fmt, args); */
255
256 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
257 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
258
259 if (!HIWORD(lpCaption))
260 LoadStringW(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
261 else
262 pszTitle = lpCaption;
263
264 if (!HIWORD(lpText))
265 LoadStringW(hInstance, (DWORD)lpText, szText, sizeof(szText)/sizeof(szText[0]));
266 else
267 pszText = lpText;
268
269 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
270 pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
271
272 va_end(args);
273
274 ret = MessageBoxW(hWnd,pszTemp,pszTitle,uType);
275 LocalFree((HLOCAL)pszTemp);
276 return ret;
277}
278
279/*************************************************************************
280 * ShellMessageBoxA [SHELL32.183]
281 */
282int WINAPIV ShellMessageBoxA(
283 HINSTANCE hInstance,
284 HWND hWnd,
285 LPCSTR lpText,
286 LPCSTR lpCaption,
287 UINT uType,
288 ...)
289{
290 char szText[100],szTitle[100];
291 LPCSTR pszText = szText, pszTitle = szTitle, pszTemp;
292 va_list args;
293 int ret;
294
295 va_start(args, uType);
296 /* wvsprintfA(buf,fmt, args); */
297
298 TRACE("(%08lx,%08lx,%p,%p,%08x)\n",
299 (DWORD)hInstance,(DWORD)hWnd,lpText,lpCaption,uType);
300
301 if (!HIWORD(lpCaption))
302 LoadStringA(hInstance, (DWORD)lpCaption, szTitle, sizeof(szTitle));
303 else
304 pszTitle = lpCaption;
305
306 if (!HIWORD(lpText))
307 LoadStringA(hInstance, (DWORD)lpText, szText, sizeof(szText));
308 else
309 pszText = lpText;
310
311 FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
312 pszText, 0, 0, (LPSTR)&pszTemp, 0, &args);
313
314 va_end(args);
315
316 ret = MessageBoxA(hWnd,pszTemp,pszTitle,uType);
317 LocalFree((HLOCAL)pszTemp);
318 return ret;
319}
320
321/*************************************************************************
322 * SHFree [SHELL32.195]
323 *
324 * NOTES
325 * free_ptr() - frees memory using IMalloc
326 * exported by ordinal
327 */
328#define MEM_DEBUG 0
329
330void WIN32API SHFree(LPVOID x)
331{
332#if MEM_DEBUG
333 WORD len = *(LPWORD)((LPBYTE)x-2);
334
335 if ( *(LPWORD)((LPBYTE)x+len) != 0x7384)
336 ERR("MAGIC2!\n");
337
338 if ( (*(LPWORD)((LPBYTE)x-4)) != 0x8271)
339 ERR("MAGIC1!\n");
340 else
341 memset((LPBYTE)x-4, 0xde, len+6);
342
343 TRACE("%p len=%u\n",x, len);
344
345 x = (LPBYTE) x - 4;
346#else
347 TRACE("%p\n",x);
348#endif
349
350#if __WIN32OS2_
351 HEAP_free(x);
352#else
353 HeapFree(GetProcessHeap(), 0, x);
354#endif
355}
356
357/*************************************************************************
358 * SHAlloc [SHELL32.196]
359 *
360 * NOTES
361 * void *task_alloc(DWORD len), uses SHMalloc allocator
362 * exported by ordinal
363 */
364LPVOID WIN32API SHAlloc(DWORD len)
365{
366 LPBYTE ret;
367
368#ifdef __WIN32OS2__
369#if MEM_DEBUG
370 ret = (LPVOID) HEAP_malloc(len+6);
371#else
372 ret = (LPVOID) HEAP_malloc(len);
373#endif
374#else
375#if MEM_DEBUG
376 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len+6);
377#else
378 ret = (LPVOID) HeapAlloc(GetProcessHeap(),0,len);
379#endif
380#endif
381
382#if MEM_DEBUG
383 *(LPWORD)(ret) = 0x8271;
384 *(LPWORD)(ret+2) = (WORD)len;
385 *(LPWORD)(ret+4+len) = 0x7384;
386 ret += 4;
387 memset(ret, 0xdf, len);
388#endif
389 TRACE("%lu bytes at %p\n",len, ret);
390 return (LPVOID)ret;
391}
392
393/*************************************************************************
394 * SHRegisterDragDrop [SHELL32.86]
395 *
396 * NOTES
397 * exported by ordinal
398 */
399HRESULT WINAPI SHRegisterDragDrop(
400 HWND hWnd,
401 LPDROPTARGET pDropTarget)
402{
403 FIXME("(0x%08x,%p):stub.\n", hWnd, pDropTarget);
404 if (GetShellOle()) return pRegisterDragDrop(hWnd, pDropTarget);
405 return 0;
406}
407
408/*************************************************************************
409 * SHRevokeDragDrop [SHELL32.87]
410 *
411 * NOTES
412 * exported by ordinal
413 */
414HRESULT WINAPI SHRevokeDragDrop(HWND hWnd)
415{
416 FIXME("(0x%08x):stub.\n",hWnd);
417 return 0;
418}
419
420/*************************************************************************
421 * SHDoDragDrop [SHELL32.88]
422 *
423 * NOTES
424 * exported by ordinal
425 */
426HRESULT WINAPI SHDoDragDrop(
427 HWND hWnd,
428 LPDATAOBJECT lpDataObject,
429 LPDROPSOURCE lpDropSource,
430 DWORD dwOKEffect,
431 LPDWORD pdwEffect)
432{
433 FIXME("(0x%04x %p %p 0x%08lx %p):stub.\n",
434 hWnd, lpDataObject, lpDropSource, dwOKEffect, pdwEffect);
435 return 0;
436}
437
438/*************************************************************************
439 * ArrangeWindows [SHELL32.184]
440 *
441 */
442WORD WINAPI ArrangeWindows(
443 HWND hwndParent,
444 DWORD dwReserved,
445 LPCRECT lpRect,
446 WORD cKids,
447 CONST HWND * lpKids)
448{
449 FIXME("(0x%08x 0x%08lx %p 0x%04x %p):stub.\n",
450 hwndParent, dwReserved, lpRect, cKids, lpKids);
451 return 0;
452}
453
454/*************************************************************************
455 * SignalFileOpen [SHELL32.103]
456 *
457 * NOTES
458 * exported by ordinal
459 */
460DWORD WINAPI
461SignalFileOpen (DWORD dwParam1)
462{
463 FIXME("(0x%08lx):stub.\n", dwParam1);
464
465 return 0;
466}
467
468/*************************************************************************
469 * SHADD_get_policy - helper function for SHAddToRecentDocs
470 *
471 * PARAMETERS
472 * policy [IN] policy name (null termed string) to find
473 * type [OUT] ptr to DWORD to receive type
474 * buffer [OUT] ptr to area to hold data retrieved
475 * len [IN/OUT] ptr to DWORD holding size of buffer and getting
476 * length filled
477 *
478 * RETURNS
479 * result of the SHQueryValueEx call
480 */
481static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
482{
483 HKEY Policy_basekey;
484 INT ret;
485
486 /* Get the key for the policies location in the registry
487 */
488 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
489 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
490 0, KEY_READ, &Policy_basekey)) {
491
492 if (RegOpenKeyExA(HKEY_CURRENT_USER,
493 "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
494 0, KEY_READ, &Policy_basekey)) {
495 TRACE("No Explorer Policies location exists. Policy wanted=%s\n",
496 policy);
497 *len = 0;
498 return ERROR_FILE_NOT_FOUND;
499 }
500 }
501
502 /* Retrieve the data if it exists
503 */
504 ret = SHQueryValueExA(Policy_basekey, policy, 0, type, buffer, len);
505 RegCloseKey(Policy_basekey);
506 return ret;
507}
508
509
510/*************************************************************************
511 * SHADD_compare_mru - helper function for SHAddToRecentDocs
512 *
513 * PARAMETERS
514 * data1 [IN] data being looked for
515 * data2 [IN] data in MRU
516 * cbdata [IN] length from FindMRUData call (not used)
517 *
518 * RETURNS
519 * position within MRU list that data was added.
520 */
521static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData)
522{
523 return lstrcmpiA(data1, data2);
524}
525
526/*************************************************************************
527 * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs
528 *
529 * PARAMETERS
530 * mruhandle [IN] handle for created MRU list
531 * doc_name [IN] null termed pure doc name
532 * new_lnk_name [IN] null termed path and file name for .lnk file
533 * buffer [IN/OUT] 2048 byte area to consturct MRU data
534 * len [OUT] ptr to int to receive space used in buffer
535 *
536 * RETURNS
537 * position within MRU list that data was added.
538 */
539static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPSTR doc_name, LPSTR new_lnk_name,
540 LPSTR buffer, INT *len)
541{
542 LPSTR ptr;
543 INT wlen;
544
545 /*FIXME: Document:
546 * RecentDocs MRU data structure seems to be:
547 * +0h document file name w/ terminating 0h
548 * +nh short int w/ size of remaining
549 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
550 * +n+4h 10 bytes zeros - unknown
551 * +n+eh shortcut file name w/ terminating 0h
552 * +n+e+nh 3 zero bytes - unknown
553 */
554
555 /* Create the MRU data structure for "RecentDocs"
556 */
557 ptr = buffer;
558 lstrcpyA(ptr, doc_name);
559 ptr += (lstrlenA(buffer) + 1);
560 wlen= lstrlenA(new_lnk_name) + 1 + 12;
561 *((short int*)ptr) = wlen;
562 ptr += 2; /* step past the length */
563 *(ptr++) = 0x30; /* unknown reason */
564 *(ptr++) = 0; /* unknown, but can be 0x00, 0x01, 0x02 */
565 memset(ptr, 0, 10);
566 ptr += 10;
567 lstrcpyA(ptr, new_lnk_name);
568 ptr += (lstrlenA(new_lnk_name) + 1);
569 memset(ptr, 0, 3);
570 ptr += 3;
571 *len = ptr - buffer;
572
573 /* Add the new entry into the MRU list
574 */
575 return pAddMRUData(mruhandle, (LPCVOID)buffer, *len);
576}
577
578/*************************************************************************
579 * SHAddToRecentDocs [SHELL32.@]
580 *
581 * PARAMETERS
582 * uFlags [IN] SHARD_PATH or SHARD_PIDL
583 * pv [IN] string or pidl, NULL clears the list
584 *
585 * NOTES
586 * exported by name
587 *
588 * FIXME: ?? MSDN shows this as a VOID
589 */
590DWORD WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
591{
592
593#ifndef __WIN32OS2__
594/* FIXME: !!! move CREATEMRULIST and flags to header file !!! */
595/* !!! it is in both here and comctl32undoc.c !!! */
596typedef struct tagCREATEMRULIST
597{
598 DWORD cbSize; /* size of struct */
599 DWORD nMaxItems; /* max no. of items in list */
600 DWORD dwFlags; /* see below */
601 HKEY hKey; /* root reg. key under which list is saved */
602 LPCSTR lpszSubKey; /* reg. subkey */
603 PROC lpfnCompare; /* item compare proc */
604} CREATEMRULIST, *LPCREATEMRULIST;
605
606/* dwFlags */
607#define MRUF_STRING_LIST 0 /* list will contain strings */
608#define MRUF_BINARY_LIST 1 /* list will contain binary data */
609#define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
610
611/* If list is a string list lpfnCompare has the following prototype
612 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
613 * for binary lists the prototype is
614 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
615 * where cbData is the no. of bytes to compare.
616 * Need to check what return value means identical - 0?
617 */
618#endif
619
620 UINT olderrormode;
621 HKEY HCUbasekey;
622 CHAR doc_name[MAX_PATH];
623 CHAR link_dir[MAX_PATH];
624 CHAR new_lnk_filepath[MAX_PATH];
625 CHAR new_lnk_name[MAX_PATH];
626 IMalloc *ppM;
627 LPITEMIDLIST pidl;
628 HWND hwnd = 0; /* FIXME: get real window handle */
629 INT ret;
630 DWORD data[64], datalen, type;
631
632 /*FIXME: Document:
633 * RecentDocs MRU data structure seems to be:
634 * +0h document file name w/ terminating 0h
635 * +nh short int w/ size of remaining
636 * +n+2h 02h 30h, or 01h 30h, or 00h 30h - unknown
637 * +n+4h 10 bytes zeros - unknown
638 * +n+eh shortcut file name w/ terminating 0h
639 * +n+e+nh 3 zero bytes - unknown
640 */
641
642 /* See if we need to do anything.
643 */
644 datalen = 64;
645 ret=SHADD_get_policy( "NoRecentDocsHistory", &type, &data, &datalen);
646 if ((ret > 0) && (ret != ERROR_FILE_NOT_FOUND)) {
647 ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret);
648 return 0;
649 }
650 if (ret == ERROR_SUCCESS) {
651 if (!( (type == REG_DWORD) ||
652 ((type == REG_BINARY) && (datalen == 4)) )) {
653 ERR("Error policy data for \"NoRecentDocsHistory\" not formated correctly, type=%ld, len=%ld\n",
654 type, datalen);
655 return 0;
656 }
657
658 TRACE("policy value for NoRecentDocsHistory = %08lx\n", data[0]);
659 /* now test the actual policy value */
660 if ( data[0] != 0)
661 return 0;
662 }
663
664 /* Open key to where the necessary info is
665 */
666 /* FIXME: This should be done during DLL PROCESS_ATTACH (or THREAD_ATTACH)
667 * and the close should be done during the _DETACH. The resulting
668 * key is stored in the DLL global data.
669 */
670 if (RegCreateKeyExA(HKEY_CURRENT_USER,
671 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
672 0, 0, 0, KEY_READ, 0, &HCUbasekey ,0)) {
673 ERR("Failed to create 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n");
674 return 0;
675 }
676
677 /* Get path to user's "Recent" directory
678 */
679 if(SUCCEEDED(SHGetMalloc(&ppM))) {
680 if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
681 &pidl))) {
682 SHGetPathFromIDListA(pidl, link_dir);
683 IMalloc_Free(ppM, pidl);
684 }
685 else {
686 /* serious issues */
687 link_dir[0] = 0;
688 ERR("serious issues 1\n");
689 }
690 IMalloc_Release(ppM);
691 }
692 else {
693 /* serious issues */
694 link_dir[0] = 0;
695 ERR("serious issues 2\n");
696 }
697 TRACE("Users Recent dir %s\n", link_dir);
698
699 /* If no input, then go clear the lists */
700 if (!pv) {
701 /* clear user's Recent dir
702 */
703
704 /* FIXME: delete all files in "link_dir"
705 *
706 * while( more files ) {
707 * lstrcpyA(old_lnk_name, link_dir);
708 * PathAppendA(old_lnk_name, filenam);
709 * DeleteFileA(old_lnk_name);
710 * }
711 */
712 FIXME("should delete all files in %s\\ \n", link_dir);
713
714 /* clear MRU list
715 */
716 /* MS Bug ?? v4.72.3612.1700 of shell32 does the delete against
717 * HKEY_LOCAL_MACHINE version of ...CurrentVersion\Explorer
718 * and naturally it fails w/ rc=2. It should do it against
719 * HKEY_CURRENT_USER which is where it is stored, and where
720 * the MRU routines expect it!!!!
721 */
722 RegDeleteKeyA(HCUbasekey, "RecentDocs");
723 RegCloseKey(HCUbasekey);
724 return 0;
725 }
726
727 /* Have data to add, the jobs to be done:
728 * 1. Add document to MRU list in registry "HKCU\Software\
729 * Microsoft\Windows\CurrentVersion\Explorer\RecentDocs".
730 * 2. Add shortcut to document in the user's Recent directory
731 * (CSIDL_RECENT).
732 * 3. Add shortcut to Start menu's Documents submenu.
733 */
734
735 /* Get the pure document name from the input
736 */
737 if (uFlags & SHARD_PIDL) {
738 SHGetPathFromIDListA((LPCITEMIDLIST) pv, doc_name);
739 }
740 else {
741 lstrcpyA(doc_name, (LPSTR) pv);
742 }
743 TRACE("full document name %s\n", doc_name);
744 PathStripPathA(doc_name);;
745 TRACE("stripped document name %s\n", doc_name);
746
747
748 /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */
749
750 { /* on input needs:
751 * doc_name - pure file-spec, no path
752 * link_dir - path to the user's Recent directory
753 * HCUbasekey - key of ...Windows\CurrentVersion\Explorer" node
754 * creates:
755 * new_lnk_name- pure file-spec, no path for new .lnk file
756 * new_lnk_filepath
757 * - path and file name of new .lnk file
758 */
759 CREATEMRULIST mymru;
760 HANDLE mruhandle;
761 INT len, pos, bufused, err;
762 INT i;
763 DWORD attr;
764 CHAR buffer[2048];
765 CHAR *ptr;
766 CHAR old_lnk_name[MAX_PATH];
767 short int slen;
768
769 mymru.cbSize = sizeof(CREATEMRULIST);
770 mymru.nMaxItems = 15;
771 mymru.dwFlags = MRUF_BINARY_LIST | MRUF_DELAYED_SAVE;
772 mymru.hKey = HCUbasekey;
773 mymru.lpszSubKey = "RecentDocs";
774 mymru.lpfnCompare = &SHADD_compare_mru;
775 mruhandle = pCreateMRUListA(&mymru);
776 if (!mruhandle) {
777 /* MRU failed */
778 ERR("MRU processing failed, handle zero\n");
779 RegCloseKey(HCUbasekey);
780 return 0;
781 }
782 len = lstrlenA(doc_name);
783 pos = pFindMRUData(mruhandle, doc_name, len, 0);
784
785 /* Now get the MRU entry that will be replaced
786 * and delete the .lnk file for it
787 */
788 if ((bufused = pEnumMRUListA(mruhandle, (pos == -1) ? 14 : pos,
789 buffer, 2048)) != -1) {
790 ptr = buffer;
791 ptr += (lstrlenA(buffer) + 1);
792 slen = *((short int*)ptr);
793 ptr += 2; /* skip the length area */
794 if (bufused >= slen + (ptr-buffer)) {
795 /* buffer size looks good */
796 ptr += 12; /* get to string */
797 len = bufused - (ptr-buffer); /* get length of buf remaining */
798 if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
799 /* appears to be good string */
800 lstrcpyA(old_lnk_name, link_dir);
801 PathAppendA(old_lnk_name, ptr);
802 if (!DeleteFileA(old_lnk_name)) {
803 if ((attr = GetFileAttributesA(old_lnk_name)) == -1) {
804 if ((err = GetLastError()) != ERROR_FILE_NOT_FOUND) {
805 ERR("Delete for %s failed, err=%d, attr=%08lx\n",
806 old_lnk_name, err, attr);
807 }
808 else {
809 TRACE("old .lnk file %s did not exist\n",
810 old_lnk_name);
811 }
812 }
813 else {
814 ERR("Delete for %s failed, attr=%08lx\n",
815 old_lnk_name, attr);
816 }
817 }
818 else {
819 TRACE("deleted old .lnk file %s\n", old_lnk_name);
820 }
821 }
822 }
823 }
824
825 /* Create usable .lnk file name for the "Recent" directory
826 */
827 wsprintfA(new_lnk_name, "%s.lnk", doc_name);
828 lstrcpyA(new_lnk_filepath, link_dir);
829 PathAppendA(new_lnk_filepath, new_lnk_name);
830 i = 1;
831 olderrormode = SetErrorMode(SEM_FAILCRITICALERRORS);
832 while (GetFileAttributesA(new_lnk_filepath) != -1) {
833 i++;
834 wsprintfA(new_lnk_name, "%s (%u).lnk", doc_name, i);
835 lstrcpyA(new_lnk_filepath, link_dir);
836 PathAppendA(new_lnk_filepath, new_lnk_name);
837 }
838 SetErrorMode(olderrormode);
839 TRACE("new shortcut will be %s\n", new_lnk_filepath);
840
841 /* Now add the new MRU entry and data
842 */
843 pos = SHADD_create_add_mru_data(mruhandle, doc_name, new_lnk_name,
844 buffer, &len);
845 pFreeMRUListA(mruhandle);
846 TRACE("Updated MRU list, new doc is position %d\n", pos);
847 }
848
849 /* *** JOB 2: Create shortcut in user's "Recent" directory *** */
850
851 { /* on input needs:
852 * doc_name - pure file-spec, no path
853 * new_lnk_filepath
854 * - path and file name of new .lnk file
855 * uFlags[in] - flags on call to SHAddToRecentDocs
856 * pv[in] - document path/pidl on call to SHAddToRecentDocs
857 */
858 IShellLinkA *psl = NULL;
859 IPersistFile *pPf = NULL;
860 HRESULT hres;
861 CHAR desc[MAX_PATH];
862 WCHAR widelink[MAX_PATH];
863
864 CoInitialize(0);
865
866 hres = CoCreateInstance( &CLSID_ShellLink,
867 NULL,
868 CLSCTX_INPROC_SERVER,
869 &IID_IShellLinkA,
870 (LPVOID )&psl);
871 if(SUCCEEDED(hres)) {
872
873 hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile,
874 (LPVOID *)&pPf);
875 if(FAILED(hres)) {
876 /* bombed */
877 ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
878 goto fail;
879 }
880
881 /* Set the document path or pidl */
882 if (uFlags & SHARD_PIDL) {
883 hres = IShellLinkA_SetIDList(psl, (LPCITEMIDLIST) pv);
884 } else {
885 hres = IShellLinkA_SetPath(psl, (LPCSTR) pv);
886 }
887 if(FAILED(hres)) {
888 /* bombed */
889 ERR("failed Set{IDList|Path} %08lx\n", hres);
890 goto fail;
891 }
892
893 lstrcpyA(desc, "Shortcut to ");
894 lstrcatA(desc, doc_name);
895 hres = IShellLinkA_SetDescription(psl, desc);
896 if(FAILED(hres)) {
897 /* bombed */
898 ERR("failed SetDescription %08lx\n", hres);
899 goto fail;
900 }
901
902 MultiByteToWideChar(CP_ACP, 0, new_lnk_filepath, -1,
903 widelink, MAX_PATH);
904 /* create the short cut */
905 hres = IPersistFile_Save(pPf, widelink, TRUE);
906 if(FAILED(hres)) {
907 /* bombed */
908 ERR("failed IPersistFile::Save %08lx\n", hres);
909 IPersistFile_Release(pPf);
910 IShellLinkA_Release(psl);
911 goto fail;
912 }
913 hres = IPersistFile_SaveCompleted(pPf, widelink);
914 IPersistFile_Release(pPf);
915 IShellLinkA_Release(psl);
916 TRACE("shortcut %s has been created, result=%08lx\n",
917 new_lnk_filepath, hres);
918 }
919 else {
920 ERR("CoCreateInstance failed, hres=%08lx\n", hres);
921 }
922 }
923
924 fail:
925 CoUninitialize();
926
927 /* all done */
928 RegCloseKey(HCUbasekey);
929 return 0;
930}
931
932/*************************************************************************
933 * SHCreateShellFolderViewEx [SHELL32.174]
934 *
935 * NOTES
936 * see IShellFolder::CreateViewObject
937 */
938HRESULT WINAPI SHCreateShellFolderViewEx(
939 LPCSHELLFOLDERVIEWINFO psvcbi, /* [in] shelltemplate struct */
940 LPSHELLVIEW* ppv) /* [out] IShellView pointer */
941{
942 IShellView * psf;
943 HRESULT hRes;
944
945 TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=0x%08lx\n",
946 psvcbi->pshf, psvcbi->pidlFolder, psvcbi->lpfnCallback,
947 psvcbi->uViewMode, psvcbi->dwUser);
948
949 psf = IShellView_Constructor(psvcbi->pshf);
950
951 if (!psf)
952 return E_OUTOFMEMORY;
953
954 IShellView_AddRef(psf);
955 hRes = IShellView_QueryInterface(psf, &IID_IShellView, (LPVOID *)ppv);
956 IShellView_Release(psf);
957
958 return hRes;
959}
960/*************************************************************************
961 * SHWinHelp [SHELL32.127]
962 *
963 */
964HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z)
965{ FIXME("0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z);
966 return 0;
967}
968/*************************************************************************
969 * SHRunControlPanel [SHELL32.161]
970 *
971 */
972HRESULT WINAPI SHRunControlPanel (DWORD x, DWORD z)
973{ FIXME("0x%08lx 0x%08lx stub\n",x,z);
974 return 0;
975}
976/*************************************************************************
977 * ShellExecuteEx [SHELL32.291]
978 *
979 */
980BOOL WINAPI ShellExecuteExAW (LPVOID sei)
981{ if (SHELL_OsIsUnicode())
982 return ShellExecuteExW (sei);
983 return ShellExecuteExA (sei);
984}
985/*************************************************************************
986 * ShellExecuteExA [SHELL32.292]
987 *
988 * placeholder in the commandline:
989 * %1 file
990 * %2 printer
991 * %3 driver
992 * %4 port
993 * %I adress of a global item ID (explorer switch /idlist)
994 * %L ??? path/url/current file ???
995 * %S ???
996 * %* all following parameters (see batfile)
997 */
998BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
999{ CHAR szApplicationName[MAX_PATH],szCommandline[MAX_PATH],szPidl[20];
1000 LPSTR pos;
1001 int gap, len;
1002 STARTUPINFOA startup;
1003 PROCESS_INFORMATION info;
1004
1005 WARN("mask=0x%08lx hwnd=0x%04x verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s incomplete\n",
1006 sei->fMask, sei->hwnd, sei->lpVerb, sei->lpFile,
1007 sei->lpParameters, sei->lpDirectory, sei->nShow,
1008 (sei->fMask & SEE_MASK_CLASSNAME) ? sei->lpClass : "not used");
1009
1010 ZeroMemory(szApplicationName,MAX_PATH);
1011 if (sei->lpFile)
1012 strcpy(szApplicationName, sei->lpFile);
1013
1014 ZeroMemory(szCommandline,MAX_PATH);
1015 if (sei->lpParameters)
1016 strcpy(szCommandline, sei->lpParameters);
1017
1018 if (sei->fMask & (SEE_MASK_CLASSKEY | SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
1019 SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
1020 SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
1021 SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
1022 {
1023 FIXME("flags ignored: 0x%08lx\n", sei->fMask);
1024 }
1025
1026 /* launch a document by fileclass like 'Wordpad.Document.1' */
1027 if (sei->fMask & SEE_MASK_CLASSNAME)
1028 {
1029 /* FIXME: szCommandline should not be of a fixed size. Plus MAX_PATH is way too short! */
1030 /* the commandline contains 'c:\Path\wordpad.exe "%1"' */
1031 HCR_GetExecuteCommand(sei->lpClass, (sei->lpVerb) ? sei->lpVerb : "open", szCommandline, sizeof(szCommandline));
1032 /* fixme: get the extension of lpFile, check if it fits to the lpClass */
1033 TRACE("SEE_MASK_CLASSNAME->'%s'\n", szCommandline);
1034 }
1035
1036 /* process the IDList */
1037 if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
1038 {
1039 SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
1040 TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
1041 }
1042 else
1043 {
1044 if (sei->fMask & SEE_MASK_IDLIST )
1045 {
1046 pos = strstr(szCommandline, "%I");
1047 if (pos)
1048 {
1049 LPVOID pv;
1050 HGLOBAL hmem = SHAllocShared ( sei->lpIDList, ILGetSize(sei->lpIDList), 0);
1051 pv = SHLockShared(hmem,0);
1052 sprintf(szPidl,":%p",pv );
1053 SHUnlockShared(pv);
1054
1055 gap = strlen(szPidl);
1056 len = strlen(pos)-2;
1057 memmove(pos+gap,pos+2,len);
1058 memcpy(pos,szPidl,gap);
1059
1060 }
1061 }
1062 }
1063
1064 TRACE("execute:'%s','%s'\n",szApplicationName, szCommandline);
1065
1066 strcat(szApplicationName, " ");
1067 strcat(szApplicationName, szCommandline);
1068
1069 ZeroMemory(&startup,sizeof(STARTUPINFOA));
1070 startup.cb = sizeof(STARTUPINFOA);
1071
1072 if (! CreateProcessA(NULL, szApplicationName,
1073 NULL, NULL, FALSE, 0,
1074 NULL, NULL, &startup, &info))
1075 {
1076 sei->hInstApp = GetLastError();
1077 return FALSE;
1078 }
1079
1080 sei->hInstApp = 33;
1081
1082 /* Give 30 seconds to the app to come up */
1083 if ( WaitForInputIdle ( info.hProcess, 30000 ) == 0xFFFFFFFF )
1084 ERR("WaitForInputIdle failed: Error %ld\n", GetLastError() );
1085
1086 if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
1087 sei->hProcess = info.hProcess;
1088 else
1089 CloseHandle( info.hProcess );
1090 CloseHandle( info.hThread );
1091 return TRUE;
1092}
1093/*************************************************************************
1094 * ShellExecuteExW [SHELL32.293]
1095 *
1096 */
1097BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
1098{ SHELLEXECUTEINFOA seiA;
1099 DWORD ret;
1100
1101 TRACE("%p\n", sei);
1102
1103 memcpy(&seiA, sei, sizeof(SHELLEXECUTEINFOA));
1104
1105 if (sei->lpVerb)
1106 seiA.lpVerb = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpVerb);
1107
1108 if (sei->lpFile)
1109 seiA.lpFile = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpFile);
1110
1111 if (sei->lpParameters)
1112 seiA.lpParameters = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpParameters);
1113
1114 if (sei->lpDirectory)
1115 seiA.lpDirectory = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpDirectory);
1116
1117 if ((sei->fMask & SEE_MASK_CLASSNAME) && sei->lpClass)
1118 seiA.lpClass = HEAP_strdupWtoA( GetProcessHeap(), 0, sei->lpClass);
1119 else
1120 seiA.lpClass = NULL;
1121
1122 ret = ShellExecuteExA(&seiA);
1123
1124 if (seiA.lpVerb) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpVerb );
1125 if (seiA.lpFile) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpFile );
1126 if (seiA.lpParameters) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpParameters );
1127 if (seiA.lpDirectory) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
1128 if (seiA.lpClass) HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
1129
1130 return ret;
1131}
1132
1133static LPUNKNOWN SHELL32_IExplorerInterface=0;
1134/*************************************************************************
1135 * SHSetInstanceExplorer [SHELL32.176]
1136 *
1137 * NOTES
1138 * Sets the interface
1139 */
1140HRESULT WINAPI SHSetInstanceExplorer (LPUNKNOWN lpUnknown)
1141{ TRACE("%p\n", lpUnknown);
1142 SHELL32_IExplorerInterface = lpUnknown;
1143 return (HRESULT) lpUnknown;
1144}
1145/*************************************************************************
1146 * SHGetInstanceExplorer [SHELL32.@]
1147 *
1148 * NOTES
1149 * gets the interface pointer of the explorer and a reference
1150 */
1151HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
1152{ TRACE("%p\n", lpUnknown);
1153
1154 *lpUnknown = SHELL32_IExplorerInterface;
1155
1156 if (!SHELL32_IExplorerInterface)
1157 return E_FAIL;
1158
1159 IUnknown_AddRef(SHELL32_IExplorerInterface);
1160 return NOERROR;
1161}
1162/*************************************************************************
1163 * SHFreeUnusedLibraries [SHELL32.123]
1164 *
1165 * NOTES
1166 * exported by name
1167 */
1168void WINAPI SHFreeUnusedLibraries (void)
1169{
1170 FIXME("stub\n");
1171}
1172/*************************************************************************
1173 * DAD_SetDragImage [SHELL32.136]
1174 *
1175 * NOTES
1176 * exported by name
1177 */
1178BOOL WINAPI DAD_SetDragImage(
1179 HIMAGELIST himlTrack,
1180 LPPOINT lppt)
1181{
1182 FIXME("%p %p stub\n",himlTrack, lppt);
1183 return 0;
1184}
1185/*************************************************************************
1186 * DAD_ShowDragImage [SHELL32.137]
1187 *
1188 * NOTES
1189 * exported by name
1190 */
1191BOOL WINAPI DAD_ShowDragImage(BOOL bShow)
1192{
1193 FIXME("0x%08x stub\n",bShow);
1194 return 0;
1195}
1196/*************************************************************************
1197 * ReadCabinetState [SHELL32.651] NT 4.0
1198 *
1199 */
1200HRESULT WINAPI ReadCabinetState(DWORD u, DWORD v)
1201{ FIXME("0x%04lx 0x%04lx stub\n",u,v);
1202 return 0;
1203}
1204/*************************************************************************
1205 * WriteCabinetState [SHELL32.652] NT 4.0
1206 *
1207 */
1208HRESULT WINAPI WriteCabinetState(DWORD u)
1209{ FIXME("0x%04lx stub\n",u);
1210 return 0;
1211}
1212/*************************************************************************
1213 * FileIconInit [SHELL32.660]
1214 *
1215 */
1216BOOL WINAPI FileIconInit(BOOL bFullInit)
1217{ FIXME("(%s)\n", bFullInit ? "true" : "false");
1218 return 0;
1219}
1220/*************************************************************************
1221 * IsUserAdmin [SHELL32.680] NT 4.0
1222 *
1223 */
1224HRESULT WINAPI IsUserAdmin(void)
1225{ FIXME("stub\n");
1226 return TRUE;
1227}
1228
1229/*************************************************************************
1230 * SHAllocShared [SHELL32.520]
1231 *
1232 * NOTES
1233 * parameter1 is return value from HeapAlloc
1234 * parameter2 is equal to the size allocated with HeapAlloc
1235 * parameter3 is return value from GetCurrentProcessId
1236 *
1237 * the return value is posted as lParam with 0x402 (WM_USER+2) to somewhere
1238 * WM_USER+2 could be the undocumented CWM_SETPATH
1239 * the allocated memory contains a pidl
1240 */
1241HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID)
1242{ HGLOBAL hmem;
1243 LPVOID pmem;
1244
1245 TRACE("ptr=%p size=0x%04lx procID=0x%04lx\n",psrc,size,procID);
1246 hmem = GlobalAlloc(GMEM_FIXED, size);
1247 if (!hmem)
1248 return 0;
1249
1250 pmem = GlobalLock (hmem);
1251
1252 if (! pmem)
1253 return 0;
1254
1255 memcpy (pmem, psrc, size);
1256 GlobalUnlock(hmem);
1257 return hmem;
1258}
1259/*************************************************************************
1260 * SHLockShared [SHELL32.521]
1261 *
1262 * NOTES
1263 * parameter1 is return value from SHAllocShared
1264 * parameter2 is return value from GetCurrentProcessId
1265 * the receiver of (WM_USER+2) trys to lock the HANDLE (?)
1266 * the returnvalue seems to be a memoryadress
1267 */
1268LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID)
1269{ TRACE("handle=0x%04x procID=0x%04lx\n",hmem,procID);
1270 return GlobalLock(hmem);
1271}
1272/*************************************************************************
1273 * SHUnlockShared [SHELL32.522]
1274 *
1275 * NOTES
1276 * parameter1 is return value from SHLockShared
1277 */
1278BOOL WINAPI SHUnlockShared(LPVOID pv)
1279{
1280 TRACE("%p\n",pv);
1281 return GlobalUnlock((HANDLE)pv);
1282}
1283/*************************************************************************
1284 * SHFreeShared [SHELL32.523]
1285 *
1286 * NOTES
1287 * parameter1 is return value from SHAllocShared
1288 * parameter2 is return value from GetCurrentProcessId
1289 */
1290BOOL WINAPI SHFreeShared(
1291 HANDLE hMem,
1292 DWORD pid)
1293{
1294 TRACE("handle=0x%04x 0x%04lx\n",hMem,pid);
1295 return GlobalFree(hMem);
1296}
1297
1298/*************************************************************************
1299 * SetAppStartingCursor [SHELL32.99]
1300 */
1301HRESULT WINAPI SetAppStartingCursor(HWND u, DWORD v)
1302{ FIXME("hwnd=0x%04x 0x%04lx stub\n",u,v );
1303 return 0;
1304}
1305/*************************************************************************
1306 * SHLoadOLE [SHELL32.151]
1307 *
1308 */
1309HRESULT WINAPI SHLoadOLE(DWORD u)
1310{ FIXME("0x%04lx stub\n",u);
1311 return S_OK;
1312}
1313/*************************************************************************
1314 * DriveType [SHELL32.64]
1315 *
1316 */
1317HRESULT WINAPI DriveType(DWORD u)
1318{ FIXME("0x%04lx stub\n",u);
1319 return 0;
1320}
1321/*************************************************************************
1322 * SHAbortInvokeCommand [SHELL32.198]
1323 *
1324 */
1325HRESULT WINAPI SHAbortInvokeCommand(void)
1326{ FIXME("stub\n");
1327 return 1;
1328}
1329/*************************************************************************
1330 * SHOutOfMemoryMessageBox [SHELL32.126]
1331 *
1332 */
1333int WINAPI SHOutOfMemoryMessageBox(
1334 HWND hwndOwner,
1335 LPCSTR lpCaption,
1336 UINT uType)
1337{
1338 FIXME("0x%04x %s 0x%08x stub\n",hwndOwner, lpCaption, uType);
1339 return 0;
1340}
1341/*************************************************************************
1342 * SHFlushClipboard [SHELL32.121]
1343 *
1344 */
1345HRESULT WINAPI SHFlushClipboard(void)
1346{ FIXME("stub\n");
1347 return 1;
1348}
1349
1350/*************************************************************************
1351 * SHWaitForFileToOpen [SHELL32.97]
1352 *
1353 */
1354BOOL WINAPI SHWaitForFileToOpen(
1355 LPCITEMIDLIST pidl,
1356 DWORD dwFlags,
1357 DWORD dwTimeout)
1358{
1359 FIXME("%p 0x%08lx 0x%08lx stub\n", pidl, dwFlags, dwTimeout);
1360 return 0;
1361}
1362
1363/************************************************************************
1364 * @ [SHELL32.654]
1365 *
1366 * NOTES: first parameter seems to be a pointer (same as passed to WriteCabinetState)
1367 * second one could be a size (0x0c). The size is the same as the structure saved to
1368 * HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState
1369 * I'm (js) guessing: this one is just ReadCabinetState ;-)
1370 */
1371HRESULT WINAPI shell32_654 (DWORD x, DWORD y)
1372{ FIXME("0x%08lx 0x%08lx stub\n",x,y);
1373 return 0;
1374}
1375
1376/************************************************************************
1377 * RLBuildListOfPaths [SHELL32.146]
1378 *
1379 * NOTES
1380 * builds a DPA
1381 */
1382DWORD WINAPI RLBuildListOfPaths (void)
1383{ FIXME("stub\n");
1384 return 0;
1385}
1386/************************************************************************
1387 * SHValidateUNC [SHELL32.173]
1388 *
1389 */
1390HRESULT WINAPI SHValidateUNC (DWORD x, DWORD y, DWORD z)
1391{
1392 FIXME("0x%08lx 0x%08lx 0x%08lx stub\n",x,y,z);
1393 return 0;
1394}
1395
1396/************************************************************************
1397 * DoEnvironmentSubstA [SHELL32.@]
1398 *
1399 */
1400HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
1401{
1402 FIXME("(%s, %s) stub\n", debugstr_a(x), debugstr_a(y));
1403 return 0;
1404}
1405
1406/************************************************************************
1407 * DoEnvironmentSubstW [SHELL32.@]
1408 *
1409 */
1410HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
1411{
1412 FIXME("(%s, %s): stub\n", debugstr_w(x), debugstr_w(y));
1413 return 0;
1414}
1415
1416/************************************************************************
1417 * DoEnvironmentSubst [SHELL32.53]
1418 *
1419 */
1420HRESULT WINAPI DoEnvironmentSubstAW(LPVOID x, LPVOID y)
1421{
1422 if (SHELL_OsIsUnicode())
1423 return DoEnvironmentSubstW(x, y);
1424 return DoEnvironmentSubstA(x, y);
1425}
1426
1427/*************************************************************************
1428 * @ [SHELL32.243]
1429 *
1430 * Win98+ by-ordinal routine. In Win98 this routine returns zero and
1431 * does nothing else. Possibly this does something in NT or SHELL32 5.0?
1432 *
1433 */
1434
1435BOOL WINAPI shell32_243(DWORD a, DWORD b)
1436{
1437 return FALSE;
1438}
1439
1440/*************************************************************************
1441 * @ [SHELL32.714]
1442 */
1443DWORD WINAPI SHELL32_714(LPVOID x)
1444{
1445 FIXME("(%s)stub\n", debugstr_w(x));
1446 return 0;
1447}
1448
1449/*************************************************************************
1450 * SHAddFromPropSheetExtArray [SHELL32.167]
1451 */
1452DWORD WINAPI SHAddFromPropSheetExtArray(DWORD a, DWORD b, DWORD c)
1453{
1454 FIXME("(%08lx,%08lx,%08lx)stub\n", a, b, c);
1455 return 0;
1456}
1457
1458/*************************************************************************
1459 * SHCreatePropSheetExtArray [SHELL32.168]
1460 */
1461DWORD WINAPI SHCreatePropSheetExtArray(DWORD a, LPCSTR b, DWORD c)
1462{
1463 FIXME("(%08lx,%s,%08lx)stub\n", a, debugstr_a(b), c);
1464 return 0;
1465}
1466
1467/*************************************************************************
1468 * SHReplaceFromPropSheetExtArray [SHELL32.170]
1469 */
1470DWORD WINAPI SHReplaceFromPropSheetExtArray(DWORD a, DWORD b, DWORD c, DWORD d)
1471{
1472 FIXME("(%08lx,%08lx,%08lx,%08lx)stub\n", a, b, c, d);
1473 return 0;
1474}
1475
1476/*************************************************************************
1477 * SHDestroyPropSheetExtArray [SHELL32.169]
1478 */
1479DWORD WINAPI SHDestroyPropSheetExtArray(DWORD a)
1480{
1481 FIXME("(%08lx)stub\n", a);
1482 return 0;
1483}
1484
1485/*************************************************************************
1486* CIDLData_CreateFromIDArray[SHELL32.83]
1487*
1488* Create IDataObject from PIDLs??
1489*/
1490HRESULT WINAPI CIDLData_CreateFromIDArray(
1491 LPCITEMIDLIST pidlFolder,
1492 DWORD cpidlFiles,
1493 LPCITEMIDLIST *lppidlFiles,
1494 LPDATAOBJECT *ppdataObject)
1495{
1496 INT i;
1497 HWND hwnd = 0; /*FIXME: who should be hwnd of owner? set to desktop */
1498 BOOL boldpidl;
1499
1500#ifndef __WIN32OS2__
1501 if (TRACE_ON(shell)) {
1502 TRACE("(%p, %ld, %p, %p)\n", pidlFolder, cpidlFiles,
1503 lppidlFiles, ppdataObject);
1504 boldpidl = TRACE_ON(pidl);
1505 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, FALSE);
1506 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, TRUE);
1507 pdump (pidlFolder);
1508 for (i=0; i<cpidlFiles; i++){
1509 pdump (lppidlFiles[i]);
1510 }
1511 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_shell, TRUE);
1512 __SET_DEBUGGING(__DBCL_TRACE, __wine_dbch_pidl, boldpidl);
1513 }
1514#endif
1515
1516 *ppdataObject = IDataObject_Constructor( hwnd, pidlFolder,
1517 lppidlFiles, cpidlFiles);
1518 if (*ppdataObject) return S_OK;
1519 return E_OUTOFMEMORY;
1520}
Note: See TracBrowser for help on using the repository browser.