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