shell32/tests: Add more ShellExecute() shortcut tests.
[wine] / dlls / shell32 / shell32_main.c
1 /*
2  *                 Shell basics
3  *
4  * Copyright 1998 Marcus Meissner
5  * Copyright 1998 Juergen Schmied (jsch)  *  <juergen.schmied@metronet.de>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23
24 #include <stdlib.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28
29 #define COBJMACROS
30
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winerror.h"
34 #include "winreg.h"
35 #include "dlgs.h"
36 #include "shellapi.h"
37 #include "winuser.h"
38 #include "wingdi.h"
39 #include "shlobj.h"
40 #include "rpcproxy.h"
41 #include "shlwapi.h"
42 #include "propsys.h"
43
44 #include "undocshell.h"
45 #include "pidl.h"
46 #include "shell32_main.h"
47 #include "version.h"
48 #include "shresdef.h"
49 #include "initguid.h"
50 #include "shfldr.h"
51
52 #include "wine/debug.h"
53 #include "wine/unicode.h"
54
55 WINE_DEFAULT_DEBUG_CHANNEL(shell);
56
57 /*************************************************************************
58  * CommandLineToArgvW            [SHELL32.@]
59  *
60  * We must interpret the quotes in the command line to rebuild the argv
61  * array correctly:
62  * - arguments are separated by spaces or tabs
63  * - quotes serve as optional argument delimiters
64  *   '"a b"'   -> 'a b'
65  * - escaped quotes must be converted back to '"'
66  *   '\"'      -> '"'
67  * - an odd number of '\'s followed by '"' correspond to half that number
68  *   of '\' followed by a '"' (extension of the above)
69  *   '\\\"'    -> '\"'
70  *   '\\\\\"'  -> '\\"'
71  * - an even number of '\'s followed by a '"' correspond to half that number
72  *   of '\', plus a regular quote serving as an argument delimiter (which
73  *   means it does not appear in the result)
74  *   'a\\"b c"'   -> 'a\b c'
75  *   'a\\\\"b c"' -> 'a\\b c'
76  * - '\' that are not followed by a '"' are copied literally
77  *   'a\b'     -> 'a\b'
78  *   'a\\b'    -> 'a\\b'
79  *
80  * Note:
81  * '\t' == 0x0009
82  * ' '  == 0x0020
83  * '"'  == 0x0022
84  * '\\' == 0x005c
85  */
86 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
87 {
88     DWORD argc;
89     LPWSTR  *argv;
90     LPCWSTR cs;
91     LPWSTR arg,s,d;
92     LPWSTR cmdline;
93     int in_quotes,bcount;
94
95     if(!numargs)
96     {
97         SetLastError(ERROR_INVALID_PARAMETER);
98         return NULL;
99     }
100
101     if (*lpCmdline==0)
102     {
103         /* Return the path to the executable */
104         DWORD len, deslen=MAX_PATH, size;
105
106         size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR);
107         for (;;)
108         {
109             if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL;
110             len = GetModuleFileNameW(0, (LPWSTR)(argv+1), deslen);
111             if (!len)
112             {
113                 LocalFree(argv);
114                 return NULL;
115             }
116             if (len < deslen) break;
117             deslen*=2;
118             size = sizeof(LPWSTR) + deslen*sizeof(WCHAR) + sizeof(LPWSTR);
119             LocalFree( argv );
120         }
121         argv[0]=(LPWSTR)(argv+1);
122         *numargs=1;
123
124         return argv;
125     }
126
127     /* to get a writable copy */
128     argc=0;
129     bcount=0;
130     in_quotes=0;
131     cs=lpCmdline;
132     while (1)
133     {
134         if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes))
135         {
136             /* space */
137             argc++;
138             /* skip the remaining spaces */
139             while (*cs==0x0009 || *cs==0x0020) {
140                 cs++;
141             }
142             if (*cs==0)
143                 break;
144             bcount=0;
145             continue;
146         }
147         else if (*cs==0x005c)
148         {
149             /* '\', count them */
150             bcount++;
151         }
152         else if ((*cs==0x0022) && ((bcount & 1)==0))
153         {
154             /* unescaped '"' */
155             in_quotes=!in_quotes;
156             bcount=0;
157         }
158         else
159         {
160             /* a regular character */
161             bcount=0;
162         }
163         cs++;
164     }
165     /* Allocate in a single lump, the string array, and the strings that go with it.
166      * This way the caller can make a single GlobalFree call to free both, as per MSDN.
167      */
168     argv=LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
169     if (!argv)
170         return NULL;
171     cmdline=(LPWSTR)(argv+argc);
172     strcpyW(cmdline, lpCmdline);
173
174     argc=0;
175     bcount=0;
176     in_quotes=0;
177     arg=d=s=cmdline;
178     while (*s)
179     {
180         if ((*s==0x0009 || *s==0x0020) && !in_quotes)
181         {
182             /* Close the argument and copy it */
183             *d=0;
184             argv[argc++]=arg;
185
186             /* skip the remaining spaces */
187             do {
188                 s++;
189             } while (*s==0x0009 || *s==0x0020);
190
191             /* Start with a new argument */
192             arg=d=s;
193             bcount=0;
194         }
195         else if (*s==0x005c)
196         {
197             /* '\\' */
198             *d++=*s++;
199             bcount++;
200         }
201         else if (*s==0x0022)
202         {
203             /* '"' */
204             if ((bcount & 1)==0)
205             {
206                 /* Preceded by an even number of '\', this is half that
207                  * number of '\', plus a quote which we erase.
208                  */
209                 d-=bcount/2;
210                 in_quotes=!in_quotes;
211                 s++;
212             }
213             else
214             {
215                 /* Preceded by an odd number of '\', this is half that
216                  * number of '\' followed by a '"'
217                  */
218                 d=d-bcount/2-1;
219                 *d++='"';
220                 s++;
221             }
222             bcount=0;
223         }
224         else
225         {
226             /* a regular character */
227             *d++=*s++;
228             bcount=0;
229         }
230     }
231     if (*arg)
232     {
233         *d='\0';
234         argv[argc++]=arg;
235     }
236     *numargs=argc;
237
238     return argv;
239 }
240
241 static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
242 {
243     BOOL status = FALSE;
244     HANDLE hfile;
245     DWORD BinaryType;
246     IMAGE_DOS_HEADER mz_header;
247     IMAGE_NT_HEADERS nt;
248     DWORD len;
249     char magic[4];
250
251     status = GetBinaryTypeW (szFullPath, &BinaryType);
252     if (!status)
253         return 0;
254     if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
255         return 0x4d5a;
256
257     hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
258                          NULL, OPEN_EXISTING, 0, 0 );
259     if ( hfile == INVALID_HANDLE_VALUE )
260         return 0;
261
262     /*
263      * The next section is adapted from MODULE_GetBinaryType, as we need
264      * to examine the image header to get OS and version information. We
265      * know from calling GetBinaryTypeA that the image is valid and either
266      * an NE or PE, so much error handling can be omitted.
267      * Seek to the start of the file and read the header information.
268      */
269
270     SetFilePointer( hfile, 0, NULL, SEEK_SET );
271     ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
272
273     SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
274     ReadFile( hfile, magic, sizeof(magic), &len, NULL );
275     if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
276     {
277         SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
278         ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
279         CloseHandle( hfile );
280         /* DLL files are not executable and should return 0 */
281         if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL)
282             return 0;
283         if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
284         {
285              return IMAGE_NT_SIGNATURE | 
286                    (nt.OptionalHeader.MajorSubsystemVersion << 24) |
287                    (nt.OptionalHeader.MinorSubsystemVersion << 16);
288         }
289         return IMAGE_NT_SIGNATURE;
290     }
291     else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
292     {
293         IMAGE_OS2_HEADER ne;
294         SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
295         ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
296         CloseHandle( hfile );
297         if (ne.ne_exetyp == 2)
298             return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
299         return 0;
300     }
301     CloseHandle( hfile );
302     return 0;
303 }
304
305 /*************************************************************************
306  * SHELL_IsShortcut             [internal]
307  *
308  * Decide if an item id list points to a shell shortcut
309  */
310 BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
311 {
312     char szTemp[MAX_PATH];
313     HKEY keyCls;
314     BOOL ret = FALSE;
315
316     if (_ILGetExtension(pidlLast, szTemp, MAX_PATH) &&
317           HCR_MapTypeToValueA(szTemp, szTemp, MAX_PATH, TRUE))
318     {
319         if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_QUERY_VALUE, &keyCls))
320         {
321           if (ERROR_SUCCESS == RegQueryValueExA(keyCls, "IsShortcut", NULL, NULL, NULL, NULL))
322             ret = TRUE;
323
324           RegCloseKey(keyCls);
325         }
326     }
327
328     return ret;
329 }
330
331 #define SHGFI_KNOWN_FLAGS \
332     (SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
333      SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
334      SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
335      SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
336      SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
337
338 /*************************************************************************
339  * SHGetFileInfoW            [SHELL32.@]
340  *
341  */
342 DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
343                                 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags )
344 {
345     WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
346     int iIndex;
347     DWORD_PTR ret = TRUE;
348     DWORD dwAttributes = 0;
349     IShellFolder * psfParent = NULL;
350     IExtractIconW * pei = NULL;
351     LPITEMIDLIST    pidlLast = NULL, pidl = NULL;
352     HRESULT hr = S_OK;
353     BOOL IconNotYetLoaded=TRUE;
354     UINT uGilFlags = 0;
355
356     TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
357           (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
358           psfi, psfi->dwAttributes, sizeofpsfi, flags);
359
360     if (!path)
361         return FALSE;
362
363     /* windows initializes these values regardless of the flags */
364     if (psfi != NULL)
365     {
366         psfi->szDisplayName[0] = '\0';
367         psfi->szTypeName[0] = '\0';
368         psfi->iIcon = 0;
369     }
370
371     if (!(flags & SHGFI_PIDL))
372     {
373         /* SHGetFileInfo should work with absolute and relative paths */
374         if (PathIsRelativeW(path))
375         {
376             GetCurrentDirectoryW(MAX_PATH, szLocation);
377             PathCombineW(szFullPath, szLocation, path);
378         }
379         else
380         {
381             lstrcpynW(szFullPath, path, MAX_PATH);
382         }
383     }
384
385     if (flags & SHGFI_EXETYPE)
386     {
387         if (flags != SHGFI_EXETYPE)
388             return 0;
389         return shgfi_get_exe_type(szFullPath);
390     }
391
392     /*
393      * psfi is NULL normally to query EXE type. If it is NULL, none of the
394      * below makes sense anyway. Windows allows this and just returns FALSE
395      */
396     if (psfi == NULL)
397         return FALSE;
398
399     /*
400      * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
401      * is not specified.
402      * The pidl functions fail on not existing file names
403      */
404
405     if (flags & SHGFI_PIDL)
406     {
407         pidl = ILClone((LPCITEMIDLIST)path);
408     }
409     else if (!(flags & SHGFI_USEFILEATTRIBUTES))
410     {
411         hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
412     }
413
414     if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
415     {
416         /* get the parent shellfolder */
417         if (pidl)
418         {
419             hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
420                                 (LPCITEMIDLIST*)&pidlLast );
421             if (SUCCEEDED(hr))
422                 pidlLast = ILClone(pidlLast);
423             ILFree(pidl);
424         }
425         else
426         {
427             ERR("pidl is null!\n");
428             return FALSE;
429         }
430     }
431
432     /* get the attributes of the child */
433     if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
434     {
435         if (!(flags & SHGFI_ATTR_SPECIFIED))
436         {
437             psfi->dwAttributes = 0xffffffff;
438         }
439         if (psfParent)
440             IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
441                                       &(psfi->dwAttributes) );
442     }
443
444     /* get the displayname */
445     if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
446     {
447         if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
448         {
449             lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
450         }
451         else
452         {
453             STRRET str;
454             hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
455                                                 SHGDN_INFOLDER, &str);
456             StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
457         }
458     }
459
460     /* get the type name */
461     if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
462     {
463         static const WCHAR szFile[] = { 'F','i','l','e',0 };
464         static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
465
466         if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
467         {
468             char ftype[80];
469
470             _ILGetFileType(pidlLast, ftype, 80);
471             MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
472         }
473         else
474         {
475             if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
476                 strcatW (psfi->szTypeName, szFile);
477             else 
478             {
479                 WCHAR sTemp[64];
480
481                 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
482                 if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
483                     HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
484                 {
485                     lstrcpynW (psfi->szTypeName, sTemp, 64);
486                     strcatW (psfi->szTypeName, szDashFile);
487                 }
488             }
489         }
490     }
491
492     /* ### icons ###*/
493     if (flags & SHGFI_OPENICON)
494         uGilFlags |= GIL_OPENICON;
495
496     if (flags & SHGFI_LINKOVERLAY)
497         uGilFlags |= GIL_FORSHORTCUT;
498     else if ((flags&SHGFI_ADDOVERLAYS) ||
499              (flags&(SHGFI_ICON|SHGFI_SMALLICON))==SHGFI_ICON)
500     {
501         if (SHELL_IsShortcut(pidlLast))
502             uGilFlags |= GIL_FORSHORTCUT;
503     }
504
505     if (flags & SHGFI_OVERLAYINDEX)
506         FIXME("SHGFI_OVERLAYINDEX unhandled\n");
507
508     if (flags & SHGFI_SELECTED)
509         FIXME("set icon to selected, stub\n");
510
511     if (flags & SHGFI_SHELLICONSIZE)
512         FIXME("set icon to shell size, stub\n");
513
514     /* get the iconlocation */
515     if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
516     {
517         UINT uDummy,uFlags;
518
519         if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
520         {
521             if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
522             {
523                 lstrcpyW(psfi->szDisplayName, swShell32Name);
524                 psfi->iIcon = -IDI_SHELL_FOLDER;
525             }
526             else
527             {
528                 WCHAR* szExt;
529                 static const WCHAR p1W[] = {'%','1',0};
530                 WCHAR sTemp [MAX_PATH];
531
532                 szExt = PathFindExtensionW(szFullPath);
533                 TRACE("szExt=%s\n", debugstr_w(szExt));
534                 if ( szExt &&
535                      HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
536                      HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon))
537                 {
538                     if (lstrcmpW(p1W, sTemp))
539                         strcpyW(psfi->szDisplayName, sTemp);
540                     else
541                     {
542                         /* the icon is in the file */
543                         strcpyW(psfi->szDisplayName, szFullPath);
544                     }
545                 }
546                 else
547                     ret = FALSE;
548             }
549         }
550         else
551         {
552             hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
553                 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
554                 &uDummy, (LPVOID*)&pei);
555             if (SUCCEEDED(hr))
556             {
557                 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
558                     szLocation, MAX_PATH, &iIndex, &uFlags);
559
560                 if (uFlags & GIL_NOTFILENAME)
561                     ret = FALSE;
562                 else
563                 {
564                     lstrcpyW (psfi->szDisplayName, szLocation);
565                     psfi->iIcon = iIndex;
566                 }
567                 IExtractIconW_Release(pei);
568             }
569         }
570     }
571
572     /* get icon index (or load icon)*/
573     if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
574     {
575         if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
576         {
577             WCHAR sTemp [MAX_PATH];
578             WCHAR * szExt;
579             int icon_idx=0;
580
581             lstrcpynW(sTemp, szFullPath, MAX_PATH);
582
583             if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
584                 psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER, 0);
585             else
586             {
587                 static const WCHAR p1W[] = {'%','1',0};
588
589                 psfi->iIcon = 0;
590                 szExt = PathFindExtensionW(sTemp);
591                 if ( szExt &&
592                      HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
593                      HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx))
594                 {
595                     if (!lstrcmpW(p1W,sTemp))            /* icon is in the file */
596                         strcpyW(sTemp, szFullPath);
597
598                     if (flags & SHGFI_SYSICONINDEX) 
599                     {
600                         psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
601                         if (psfi->iIcon == -1)
602                             psfi->iIcon = 0;
603                     }
604                     else 
605                     {
606                         UINT ret;
607                         if (flags & SHGFI_SMALLICON)
608                             ret = PrivateExtractIconsW( sTemp,icon_idx,
609                                 GetSystemMetrics( SM_CXSMICON ),
610                                 GetSystemMetrics( SM_CYSMICON ),
611                                 &psfi->hIcon, 0, 1, 0);
612                         else
613                             ret = PrivateExtractIconsW( sTemp, icon_idx,
614                                 GetSystemMetrics( SM_CXICON),
615                                 GetSystemMetrics( SM_CYICON),
616                                 &psfi->hIcon, 0, 1, 0);
617                         if (ret != 0 && ret != (UINT)-1)
618                         {
619                             IconNotYetLoaded=FALSE;
620                             psfi->iIcon = icon_idx;
621                         }
622                     }
623                 }
624             }
625         }
626         else
627         {
628             if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
629                 uGilFlags, &(psfi->iIcon))))
630             {
631                 ret = FALSE;
632             }
633         }
634         if (ret && (flags & SHGFI_SYSICONINDEX))
635         {
636             if (flags & SHGFI_SMALLICON)
637                 ret = (DWORD_PTR) ShellSmallIconList;
638             else
639                 ret = (DWORD_PTR) ShellBigIconList;
640         }
641     }
642
643     /* icon handle */
644     if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
645     {
646         if (flags & SHGFI_SMALLICON)
647             psfi->hIcon = ImageList_GetIcon( ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
648         else
649             psfi->hIcon = ImageList_GetIcon( ShellBigIconList, psfi->iIcon, ILD_NORMAL);
650     }
651
652     if (flags & ~SHGFI_KNOWN_FLAGS)
653         FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
654
655     if (psfParent)
656         IShellFolder_Release(psfParent);
657
658     if (hr != S_OK)
659         ret = FALSE;
660
661     SHFree(pidlLast);
662
663     TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
664            psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
665            debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
666
667     return ret;
668 }
669
670 /*************************************************************************
671  * SHGetFileInfoA            [SHELL32.@]
672  *
673  * Note:
674  *    MSVBVM60.__vbaNew2 expects this function to return a value in range
675  *    1 .. 0x7fff when the function succeeds and flags does not contain
676  *    SHGFI_EXETYPE or SHGFI_SYSICONINDEX (see bug 7701)
677  */
678 DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
679                                 SHFILEINFOA *psfi, UINT sizeofpsfi,
680                                 UINT flags )
681 {
682     INT len;
683     LPWSTR temppath = NULL;
684     LPCWSTR pathW;
685     DWORD_PTR ret;
686     SHFILEINFOW temppsfi;
687
688     if (flags & SHGFI_PIDL)
689     {
690         /* path contains a pidl */
691         pathW = (LPCWSTR)path;
692     }
693     else
694     {
695         len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
696         temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
697         MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
698         pathW = temppath;
699     }
700
701     if (psfi && (flags & SHGFI_ATTR_SPECIFIED))
702         temppsfi.dwAttributes=psfi->dwAttributes;
703
704     if (psfi == NULL)
705         ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, sizeof(temppsfi), flags);
706     else
707         ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
708
709     if (psfi)
710     {
711         if(flags & SHGFI_ICON)
712             psfi->hIcon=temppsfi.hIcon;
713         if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
714             psfi->iIcon=temppsfi.iIcon;
715         if(flags & SHGFI_ATTRIBUTES)
716             psfi->dwAttributes=temppsfi.dwAttributes;
717         if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
718         {
719             WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
720                   psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
721         }
722         if(flags & SHGFI_TYPENAME)
723         {
724             WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
725                   psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
726         }
727     }
728
729     HeapFree(GetProcessHeap(), 0, temppath);
730
731     return ret;
732 }
733
734 /*************************************************************************
735  * DuplicateIcon            [SHELL32.@]
736  */
737 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
738 {
739     ICONINFO IconInfo;
740     HICON hDupIcon = 0;
741
742     TRACE("%p %p\n", hInstance, hIcon);
743
744     if (GetIconInfo(hIcon, &IconInfo))
745     {
746         hDupIcon = CreateIconIndirect(&IconInfo);
747
748         /* clean up hbmMask and hbmColor */
749         DeleteObject(IconInfo.hbmMask);
750         DeleteObject(IconInfo.hbmColor);
751     }
752
753     return hDupIcon;
754 }
755
756 /*************************************************************************
757  * ExtractIconA                [SHELL32.@]
758  */
759 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
760 {   
761     HICON ret;
762     INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
763     LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
764
765     TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
766
767     MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
768     ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
769     HeapFree(GetProcessHeap(), 0, lpwstrFile);
770
771     return ret;
772 }
773
774 /*************************************************************************
775  * ExtractIconW                [SHELL32.@]
776  */
777 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
778 {
779     HICON  hIcon = NULL;
780     UINT ret;
781     UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
782
783     TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
784
785     if (nIconIndex == (UINT)-1)
786     {
787         ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
788         if (ret != (UINT)-1 && ret)
789             return (HICON)(UINT_PTR)ret;
790         return NULL;
791     }
792     else
793         ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
794
795     if (ret == (UINT)-1)
796         return (HICON)1;
797     else if (ret > 0 && hIcon)
798         return hIcon;
799
800     return NULL;
801 }
802
803 HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR file, DWORD attribs, REFIID riid, void **ppv)
804 {
805   FIXME("%s, %x, %s, %p\n", debugstr_w(file), attribs, debugstr_guid(riid), ppv);
806   *ppv = NULL;
807   return E_NOTIMPL;
808 }
809
810 /*************************************************************************
811  * Printer_LoadIconsW        [SHELL32.205]
812  */
813 VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon)
814 {
815     INT iconindex=IDI_SHELL_PRINTER;
816
817     TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
818
819     /* We should check if wsPrinterName is
820        1. the Default Printer or not
821        2. connected or not
822        3. a Local Printer or a Network-Printer
823        and use different Icons
824     */
825     if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
826     {
827         FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
828     }
829
830     if(pLargeIcon != NULL)
831         *pLargeIcon = LoadImageW(shell32_hInstance,
832                                  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
833                                  0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE);
834
835     if(pSmallIcon != NULL)
836         *pSmallIcon = LoadImageW(shell32_hInstance,
837                                  (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
838                                  16, 16, LR_DEFAULTCOLOR);
839 }
840
841 /*************************************************************************
842  * Printers_RegisterWindowW        [SHELL32.213]
843  * used by "printui.dll":
844  * find the Window of the given Type for the specific Printer and 
845  * return the already existent hwnd or open a new window
846  */
847 BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType,
848             HANDLE * phClassPidl, HWND * phwnd)
849 {
850     FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
851                 phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
852                 phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
853
854     return FALSE;
855
856
857 /*************************************************************************
858  * Printers_UnregisterWindow      [SHELL32.214]
859  */
860 VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd)
861 {
862     FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
863
864
865 /*************************************************************************
866  * SHGetPropertyStoreFromParsingName [SHELL32.@]
867  */
868 HRESULT WINAPI SHGetPropertyStoreFromParsingName(PCWSTR pszPath, IBindCtx *pbc, GETPROPERTYSTOREFLAGS flags, REFIID riid, void **ppv)
869 {
870     FIXME("(%s %p %u %p %p) stub!\n", debugstr_w(pszPath), pbc, flags, riid, ppv);
871     return E_NOTIMPL;
872 }
873
874 /*************************************************************************/
875
876 typedef struct
877 {
878     LPCWSTR  szApp;
879     LPCWSTR  szOtherStuff;
880     HICON hIcon;
881     HFONT hFont;
882 } ABOUT_INFO;
883
884 #define DROP_FIELD_TOP    (-12)
885
886 static void paint_dropline( HDC hdc, HWND hWnd )
887 {
888     HWND hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_WINE_TEXT);
889     RECT rect;
890
891     if (!hWndCtl) return;
892     GetWindowRect( hWndCtl, &rect );
893     MapWindowPoints( 0, hWnd, (LPPOINT)&rect, 2 );
894     rect.top += DROP_FIELD_TOP;
895     rect.bottom = rect.top + 2;
896     DrawEdge( hdc, &rect, BDR_SUNKENOUTER, BF_RECT );
897 }
898
899 /*************************************************************************
900  * SHHelpShortcuts_RunDLLA        [SHELL32.@]
901  *
902  */
903 DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
904 {
905     FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
906     return 0;
907 }
908
909 /*************************************************************************
910  * SHHelpShortcuts_RunDLLA        [SHELL32.@]
911  *
912  */
913 DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
914 {
915     FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
916     return 0;
917 }
918
919 /*************************************************************************
920  * SHLoadInProc                [SHELL32.@]
921  * Create an instance of specified object class from within
922  * the shell process and release it immediately
923  */
924 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
925 {
926     void *ptr = NULL;
927
928     TRACE("%s\n", debugstr_guid(rclsid));
929
930     CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
931     if(ptr)
932     {
933         IUnknown * pUnk = ptr;
934         IUnknown_Release(pUnk);
935         return S_OK;
936     }
937     return DISP_E_MEMBERNOTFOUND;
938 }
939
940 static void add_authors( HWND list )
941 {
942     static const WCHAR eol[] = {'\r','\n',0};
943     static const WCHAR authors[] = {'A','U','T','H','O','R','S',0};
944     WCHAR *strW, *start, *end;
945     HRSRC rsrc = FindResourceW( shell32_hInstance, authors, (LPCWSTR)RT_RCDATA );
946     char *strA = LockResource( LoadResource( shell32_hInstance, rsrc ));
947     DWORD sizeW, sizeA = SizeofResource( shell32_hInstance, rsrc );
948
949     if (!strA) return;
950     sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1;
951     if (!(strW = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) return;
952     MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
953     strW[sizeW - 1] = 0;
954
955     start = strpbrkW( strW, eol );  /* skip the header line */
956     while (start)
957     {
958         while (*start && strchrW( eol, *start )) start++;
959         if (!*start) break;
960         end = strpbrkW( start, eol );
961         if (end) *end++ = 0;
962         SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
963         start = end;
964     }
965     HeapFree( GetProcessHeap(), 0, strW );
966 }
967
968 /*************************************************************************
969  * AboutDlgProc            (internal)
970  */
971 static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
972                                       LPARAM lParam )
973 {
974     HWND hWndCtl;
975
976     TRACE("\n");
977
978     switch(msg)
979     {
980     case WM_INITDIALOG:
981         {
982             ABOUT_INFO *info = (ABOUT_INFO *)lParam;
983             WCHAR template[512], buffer[512], version[64];
984             extern const char *wine_get_build_id(void);
985
986             if (info)
987             {
988                 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
989                 GetWindowTextW( hWnd, template, sizeof(template)/sizeof(WCHAR) );
990                 sprintfW( buffer, template, info->szApp );
991                 SetWindowTextW( hWnd, buffer );
992                 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp );
993                 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff );
994                 GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3),
995                                 template, sizeof(template)/sizeof(WCHAR) );
996                 MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1,
997                                      version, sizeof(version)/sizeof(WCHAR) );
998                 sprintfW( buffer, template, version );
999                 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer );
1000                 hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);
1001                 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
1002                 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
1003                 add_authors( hWndCtl );
1004                 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
1005             }
1006         }
1007         return 1;
1008
1009     case WM_PAINT:
1010         {
1011             PAINTSTRUCT ps;
1012             HDC hDC = BeginPaint( hWnd, &ps );
1013             paint_dropline( hDC, hWnd );
1014             EndPaint( hWnd, &ps );
1015         }
1016     break;
1017
1018     case WM_COMMAND:
1019         if (wParam == IDOK || wParam == IDCANCEL)
1020         {
1021             EndDialog(hWnd, TRUE);
1022             return TRUE;
1023         }
1024         if (wParam == IDC_ABOUT_LICENSE)
1025         {
1026             MSGBOXPARAMSW params;
1027
1028             params.cbSize = sizeof(params);
1029             params.hwndOwner = hWnd;
1030             params.hInstance = shell32_hInstance;
1031             params.lpszText = MAKEINTRESOURCEW(IDS_LICENSE);
1032             params.lpszCaption = MAKEINTRESOURCEW(IDS_LICENSE_CAPTION);
1033             params.dwStyle = MB_ICONINFORMATION | MB_OK;
1034             params.lpszIcon = 0;
1035             params.dwContextHelpId = 0;
1036             params.lpfnMsgBoxCallback = NULL;
1037             params.dwLanguageId = LANG_NEUTRAL;
1038             MessageBoxIndirectW( &params );
1039         }
1040         break;
1041     case WM_CLOSE:
1042       EndDialog(hWnd, TRUE);
1043       break;
1044     }
1045
1046     return 0;
1047 }
1048
1049
1050 /*************************************************************************
1051  * ShellAboutA                [SHELL32.288]
1052  */
1053 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
1054 {
1055     BOOL ret;
1056     LPWSTR appW = NULL, otherW = NULL;
1057     int len;
1058
1059     if (szApp)
1060     {
1061         len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1062         appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1063         MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1064     }
1065     if (szOtherStuff)
1066     {
1067         len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1068         otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1069         MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1070     }
1071
1072     ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1073
1074     HeapFree(GetProcessHeap(), 0, otherW);
1075     HeapFree(GetProcessHeap(), 0, appW);
1076     return ret;
1077 }
1078
1079
1080 /*************************************************************************
1081  * ShellAboutW                [SHELL32.289]
1082  */
1083 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
1084                              HICON hIcon )
1085 {
1086     ABOUT_INFO info;
1087     LOGFONTW logFont;
1088     BOOL bRet;
1089     static const WCHAR wszSHELL_ABOUT_MSGBOX[] =
1090         {'S','H','E','L','L','_','A','B','O','U','T','_','M','S','G','B','O','X',0};
1091
1092     TRACE("\n");
1093
1094     if (!hIcon) hIcon = LoadImageW( 0, (LPWSTR)IDI_WINLOGO, IMAGE_ICON, 48, 48, LR_SHARED );
1095     info.szApp        = szApp;
1096     info.szOtherStuff = szOtherStuff;
1097     info.hIcon        = hIcon;
1098
1099     SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
1100     info.hFont = CreateFontIndirectW( &logFont );
1101
1102     bRet = DialogBoxParamW( shell32_hInstance, wszSHELL_ABOUT_MSGBOX, hWnd, AboutDlgProc, (LPARAM)&info );
1103     DeleteObject(info.hFont);
1104     return bRet;
1105 }
1106
1107 /*************************************************************************
1108  * FreeIconList (SHELL32.@)
1109  */
1110 void WINAPI FreeIconList( DWORD dw )
1111 {
1112     FIXME("%x: stub\n",dw);
1113 }
1114
1115 /*************************************************************************
1116  * SHLoadNonloadedIconOverlayIdentifiers (SHELL32.@)
1117  */
1118 HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers( VOID )
1119 {
1120     FIXME("stub\n");
1121     return S_OK;
1122 }
1123
1124 /***********************************************************************
1125  * DllGetVersion [SHELL32.@]
1126  *
1127  * Retrieves version information of the 'SHELL32.DLL'
1128  *
1129  * PARAMS
1130  *     pdvi [O] pointer to version information structure.
1131  *
1132  * RETURNS
1133  *     Success: S_OK
1134  *     Failure: E_INVALIDARG
1135  *
1136  * NOTES
1137  *     Returns version of a shell32.dll from IE4.01 SP1.
1138  */
1139
1140 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
1141 {
1142     /* FIXME: shouldn't these values come from the version resource? */
1143     if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
1144         pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1145     {
1146         pdvi->dwMajorVersion = WINE_FILEVERSION_MAJOR;
1147         pdvi->dwMinorVersion = WINE_FILEVERSION_MINOR;
1148         pdvi->dwBuildNumber = WINE_FILEVERSION_BUILD;
1149         pdvi->dwPlatformID = WINE_FILEVERSION_PLATFORMID;
1150         if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1151         {
1152             DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
1153
1154             pdvi2->dwFlags = 0;
1155             pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
1156                                               WINE_FILEVERSION_MINOR,
1157                                               WINE_FILEVERSION_BUILD,
1158                                               WINE_FILEVERSION_PLATFORMID);
1159         }
1160         TRACE("%u.%u.%u.%u\n",
1161               pdvi->dwMajorVersion, pdvi->dwMinorVersion,
1162               pdvi->dwBuildNumber, pdvi->dwPlatformID);
1163         return S_OK;
1164     }
1165     else
1166     {
1167         WARN("wrong DLLVERSIONINFO size from app\n");
1168         return E_INVALIDARG;
1169     }
1170 }
1171
1172 /*************************************************************************
1173  * global variables of the shell32.dll
1174  * all are once per process
1175  *
1176  */
1177 HINSTANCE    shell32_hInstance = 0;
1178 HIMAGELIST   ShellSmallIconList = 0;
1179 HIMAGELIST   ShellBigIconList = 0;
1180
1181
1182 /*************************************************************************
1183  * SHELL32 DllMain
1184  *
1185  * NOTES
1186  *  calling oleinitialize here breaks some apps.
1187  */
1188 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
1189 {
1190     TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad);
1191
1192     switch (fdwReason)
1193     {
1194     case DLL_PROCESS_ATTACH:
1195         shell32_hInstance = hinstDLL;
1196         DisableThreadLibraryCalls(shell32_hInstance);
1197
1198         /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
1199         GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
1200         swShell32Name[MAX_PATH - 1] = '\0';
1201
1202         InitCommonControlsEx(NULL);
1203
1204         SIC_Initialize();
1205         InitChangeNotifications();
1206         break;
1207
1208     case DLL_PROCESS_DETACH:
1209         shell32_hInstance = 0;
1210         SIC_Destroy();
1211         FreeChangeNotifications();
1212         break;
1213     }
1214     return TRUE;
1215 }
1216
1217 /*************************************************************************
1218  * DllInstall         [SHELL32.@]
1219  *
1220  * PARAMETERS
1221  *
1222  *    BOOL bInstall - TRUE for install, FALSE for uninstall
1223  *    LPCWSTR pszCmdLine - command line (unused by shell32?)
1224  */
1225
1226 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
1227 {
1228     FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
1229     return S_OK;        /* indicate success */
1230 }
1231
1232 /***********************************************************************
1233  *              DllCanUnloadNow (SHELL32.@)
1234  */
1235 HRESULT WINAPI DllCanUnloadNow(void)
1236 {
1237     return S_FALSE;
1238 }
1239
1240 /***********************************************************************
1241  *              DllRegisterServer (SHELL32.@)
1242  */
1243 HRESULT WINAPI DllRegisterServer(void)
1244 {
1245     HRESULT hr = __wine_register_resources( shell32_hInstance );
1246     if (SUCCEEDED(hr)) hr = SHELL_RegisterShellFolders();
1247     return hr;
1248 }
1249
1250 /***********************************************************************
1251  *              DllUnregisterServer (SHELL32.@)
1252  */
1253 HRESULT WINAPI DllUnregisterServer(void)
1254 {
1255     return __wine_unregister_resources( shell32_hInstance );
1256 }
1257
1258 /***********************************************************************
1259  *              ExtractVersionResource16W (SHELL32.@)
1260  */
1261 BOOL WINAPI ExtractVersionResource16W(LPWSTR s, DWORD d)
1262 {
1263     FIXME("(%s %x) stub!\n", debugstr_w(s), d);
1264     return FALSE;
1265 }
1266
1267 /***********************************************************************
1268  *              InitNetworkAddressControl (SHELL32.@)
1269  */
1270 BOOL WINAPI InitNetworkAddressControl(void)
1271 {
1272     FIXME("stub\n");
1273     return FALSE;
1274 }
1275
1276 /***********************************************************************
1277  *              ShellHookProc (SHELL32.@)
1278  */
1279 LRESULT CALLBACK ShellHookProc(DWORD a, DWORD b, DWORD c)
1280 {
1281     FIXME("Stub\n");
1282     return 0;
1283 }
1284
1285 /***********************************************************************
1286  *              SHGetLocalizedName (SHELL32.@)
1287  */
1288 HRESULT WINAPI SHGetLocalizedName(LPCWSTR path, LPWSTR module, UINT size, INT *res)
1289 {
1290     FIXME("%s %p %u %p: stub\n", debugstr_w(path), module, size, res);
1291     return E_NOTIMPL;
1292 }
1293
1294 /***********************************************************************
1295  *              SetCurrentProcessExplicitAppUserModelID (SHELL32.@)
1296  */
1297 HRESULT WINAPI SetCurrentProcessExplicitAppUserModelID(PCWSTR appid)
1298 {
1299     FIXME("%s: stub\n", debugstr_w(appid));
1300     return E_NOTIMPL;
1301 }
1302
1303 /***********************************************************************
1304  *              SHSetUnreadMailCountW (SHELL32.@)
1305  */
1306 HRESULT WINAPI SHSetUnreadMailCountW(LPCWSTR mailaddress, DWORD count, LPCWSTR executecommand)
1307 {
1308     FIXME("%s %x %s: stub\n", debugstr_w(mailaddress), count, debugstr_w(executecommand));
1309     return E_NOTIMPL;
1310 }