shell32: Cosmetic changes to file type names.
[wine.git] / dlls / shell32 / shell32_main.c
blob7e1c7d565c49071ecd51e288dd26b1b0426fd3d6
1 /*
2 * Shell basics
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
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.
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.
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
22 #include "config.h"
24 #include <stdlib.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include <stdio.h>
29 #define COBJMACROS
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"
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"
52 #include "wine/debug.h"
53 #include "wine/unicode.h"
55 WINE_DEFAULT_DEBUG_CHANNEL(shell);
57 /*************************************************************************
58 * CommandLineToArgvW [SHELL32.@]
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 * - consecutive backslashes preceding a quote see their number halved with
68 * the remainder escaping the quote:
69 * 2n backslashes + quote -> n backslashes + quote as an argument delimiter
70 * 2n+1 backslashes + quote -> n backslashes + literal quote
71 * - backslashes that are not followed by a quote are copied literally:
72 * 'a\b' -> 'a\b'
73 * 'a\\b' -> 'a\\b'
74 * - in quoted strings, consecutive quotes see their number divided by three
75 * with the remainder modulo 3 deciding whether to close the string or not.
76 * Note that the opening quote must be counted in the consecutive quotes,
77 * that's the (1+) below:
78 * (1+) 3n quotes -> n quotes
79 * (1+) 3n+1 quotes -> n quotes plus closes the quoted string
80 * (1+) 3n+2 quotes -> n+1 quotes plus closes the quoted string
81 * - in unquoted strings, the first quote opens the quoted string and the
82 * remaining consecutive quotes follow the above rule.
84 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
86 DWORD argc;
87 LPWSTR *argv;
88 LPCWSTR s;
89 LPWSTR d;
90 LPWSTR cmdline;
91 int qcount,bcount;
93 if(!numargs)
95 SetLastError(ERROR_INVALID_PARAMETER);
96 return NULL;
99 if (*lpCmdline==0)
101 /* Return the path to the executable */
102 DWORD len, deslen=MAX_PATH, size;
104 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
105 for (;;)
107 if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL;
108 len = GetModuleFileNameW(0, (LPWSTR)(argv+2), deslen);
109 if (!len)
111 LocalFree(argv);
112 return NULL;
114 if (len < deslen) break;
115 deslen*=2;
116 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR);
117 LocalFree( argv );
119 argv[0]=(LPWSTR)(argv+2);
120 argv[1]=NULL;
121 *numargs=1;
123 return argv;
126 /* --- First count the arguments */
127 argc=1;
128 s=lpCmdline;
129 /* The first argument, the executable path, follows special rules */
130 if (*s=='"')
132 /* The executable path ends at the next quote, no matter what */
133 s++;
134 while (*s)
135 if (*s++=='"')
136 break;
138 else
140 /* The executable path ends at the next space, no matter what */
141 while (*s && *s!=' ' && *s!='\t')
142 s++;
144 /* skip to the first argument, if any */
145 while (*s==' ' || *s=='\t')
146 s++;
147 if (*s)
148 argc++;
150 /* Analyze the remaining arguments */
151 qcount=bcount=0;
152 while (*s)
154 if ((*s==' ' || *s=='\t') && qcount==0)
156 /* skip to the next argument and count it if any */
157 while (*s==' ' || *s=='\t')
158 s++;
159 if (*s)
160 argc++;
161 bcount=0;
163 else if (*s=='\\')
165 /* '\', count them */
166 bcount++;
167 s++;
169 else if (*s=='"')
171 /* '"' */
172 if ((bcount & 1)==0)
173 qcount++; /* unescaped '"' */
174 s++;
175 bcount=0;
176 /* consecutive quotes, see comment in copying code below */
177 while (*s=='"')
179 qcount++;
180 s++;
182 qcount=qcount % 3;
183 if (qcount==2)
184 qcount=0;
186 else
188 /* a regular character */
189 bcount=0;
190 s++;
194 /* Allocate in a single lump, the string array, and the strings that go
195 * with it. This way the caller can make a single LocalFree() call to free
196 * both, as per MSDN.
198 argv=LocalAlloc(LMEM_FIXED, (argc+1)*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
199 if (!argv)
200 return NULL;
201 cmdline=(LPWSTR)(argv+argc+1);
202 strcpyW(cmdline, lpCmdline);
204 /* --- Then split and copy the arguments */
205 argv[0]=d=cmdline;
206 argc=1;
207 /* The first argument, the executable path, follows special rules */
208 if (*d=='"')
210 /* The executable path ends at the next quote, no matter what */
211 s=d+1;
212 while (*s)
214 if (*s=='"')
216 s++;
217 break;
219 *d++=*s++;
222 else
224 /* The executable path ends at the next space, no matter what */
225 while (*d && *d!=' ' && *d!='\t')
226 d++;
227 s=d;
228 if (*s)
229 s++;
231 /* close the executable path */
232 *d++=0;
233 /* skip to the first argument and initialize it if any */
234 while (*s==' ' || *s=='\t')
235 s++;
236 if (!*s)
238 /* There are no parameters so we are all done */
239 argv[argc]=NULL;
240 *numargs=argc;
241 return argv;
244 /* Split and copy the remaining arguments */
245 argv[argc++]=d;
246 qcount=bcount=0;
247 while (*s)
249 if ((*s==' ' || *s=='\t') && qcount==0)
251 /* close the argument */
252 *d++=0;
253 bcount=0;
255 /* skip to the next one and initialize it if any */
256 do {
257 s++;
258 } while (*s==' ' || *s=='\t');
259 if (*s)
260 argv[argc++]=d;
262 else if (*s=='\\')
264 *d++=*s++;
265 bcount++;
267 else if (*s=='"')
269 if ((bcount & 1)==0)
271 /* Preceded by an even number of '\', this is half that
272 * number of '\', plus a quote which we erase.
274 d-=bcount/2;
275 qcount++;
277 else
279 /* Preceded by an odd number of '\', this is half that
280 * number of '\' followed by a '"'
282 d=d-bcount/2-1;
283 *d++='"';
285 s++;
286 bcount=0;
287 /* Now count the number of consecutive quotes. Note that qcount
288 * already takes into account the opening quote if any, as well as
289 * the quote that lead us here.
291 while (*s=='"')
293 if (++qcount==3)
295 *d++='"';
296 qcount=0;
298 s++;
300 if (qcount==2)
301 qcount=0;
303 else
305 /* a regular character */
306 *d++=*s++;
307 bcount=0;
310 *d='\0';
311 argv[argc]=NULL;
312 *numargs=argc;
314 return argv;
317 static DWORD shgfi_get_exe_type(LPCWSTR szFullPath)
319 BOOL status = FALSE;
320 HANDLE hfile;
321 DWORD BinaryType;
322 IMAGE_DOS_HEADER mz_header;
323 IMAGE_NT_HEADERS nt;
324 DWORD len;
325 char magic[4];
327 status = GetBinaryTypeW (szFullPath, &BinaryType);
328 if (!status)
329 return 0;
330 if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY)
331 return 0x4d5a;
333 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
334 NULL, OPEN_EXISTING, 0, 0 );
335 if ( hfile == INVALID_HANDLE_VALUE )
336 return 0;
339 * The next section is adapted from MODULE_GetBinaryType, as we need
340 * to examine the image header to get OS and version information. We
341 * know from calling GetBinaryTypeA that the image is valid and either
342 * an NE or PE, so much error handling can be omitted.
343 * Seek to the start of the file and read the header information.
346 SetFilePointer( hfile, 0, NULL, SEEK_SET );
347 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
349 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
350 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
351 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
353 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
354 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
355 CloseHandle( hfile );
356 /* DLL files are not executable and should return 0 */
357 if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL)
358 return 0;
359 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
361 return IMAGE_NT_SIGNATURE |
362 (nt.OptionalHeader.MajorSubsystemVersion << 24) |
363 (nt.OptionalHeader.MinorSubsystemVersion << 16);
365 return IMAGE_NT_SIGNATURE;
367 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
369 IMAGE_OS2_HEADER ne;
370 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
371 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
372 CloseHandle( hfile );
373 if (ne.ne_exetyp == 2)
374 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
375 return 0;
377 CloseHandle( hfile );
378 return 0;
381 /*************************************************************************
382 * SHELL_IsShortcut [internal]
384 * Decide if an item id list points to a shell shortcut
386 BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast)
388 char szTemp[MAX_PATH];
389 HKEY keyCls;
390 BOOL ret = FALSE;
392 if (_ILGetExtension(pidlLast, szTemp, MAX_PATH) &&
393 HCR_MapTypeToValueA(szTemp, szTemp, MAX_PATH, TRUE))
395 if (ERROR_SUCCESS == RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_QUERY_VALUE, &keyCls))
397 if (ERROR_SUCCESS == RegQueryValueExA(keyCls, "IsShortcut", NULL, NULL, NULL, NULL))
398 ret = TRUE;
400 RegCloseKey(keyCls);
404 return ret;
407 #define SHGFI_KNOWN_FLAGS \
408 (SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
409 SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
410 SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
411 SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
412 SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
414 /*************************************************************************
415 * SHGetFileInfoW [SHELL32.@]
418 DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
419 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags )
421 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
422 int iIndex;
423 DWORD_PTR ret = TRUE;
424 DWORD dwAttributes = 0;
425 IShellFolder * psfParent = NULL;
426 IExtractIconW * pei = NULL;
427 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
428 HRESULT hr = S_OK;
429 BOOL IconNotYetLoaded=TRUE;
430 UINT uGilFlags = 0;
431 HIMAGELIST big_icons, small_icons;
433 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
434 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
435 psfi, psfi->dwAttributes, sizeofpsfi, flags);
437 if (!path)
438 return FALSE;
440 /* windows initializes these values regardless of the flags */
441 if (psfi != NULL)
443 psfi->szDisplayName[0] = '\0';
444 psfi->szTypeName[0] = '\0';
445 psfi->iIcon = 0;
448 if (!(flags & SHGFI_PIDL))
450 /* SHGetFileInfo should work with absolute and relative paths */
451 if (PathIsRelativeW(path))
453 GetCurrentDirectoryW(MAX_PATH, szLocation);
454 PathCombineW(szFullPath, szLocation, path);
456 else
458 lstrcpynW(szFullPath, path, MAX_PATH);
462 if (flags & SHGFI_EXETYPE)
464 if (flags != SHGFI_EXETYPE)
465 return 0;
466 return shgfi_get_exe_type(szFullPath);
470 * psfi is NULL normally to query EXE type. If it is NULL, none of the
471 * below makes sense anyway. Windows allows this and just returns FALSE
473 if (psfi == NULL)
474 return FALSE;
477 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
478 * is not specified.
479 * The pidl functions fail on not existing file names
482 if (flags & SHGFI_PIDL)
484 pidl = ILClone((LPCITEMIDLIST)path);
486 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
488 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
491 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
493 /* get the parent shellfolder */
494 if (pidl)
496 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
497 (LPCITEMIDLIST*)&pidlLast );
498 if (SUCCEEDED(hr))
499 pidlLast = ILClone(pidlLast);
500 ILFree(pidl);
502 else
504 ERR("pidl is null!\n");
505 return FALSE;
509 /* get the attributes of the child */
510 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
512 if (!(flags & SHGFI_ATTR_SPECIFIED))
514 psfi->dwAttributes = 0xffffffff;
516 if (psfParent)
517 IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
518 &(psfi->dwAttributes) );
521 /* get the displayname */
522 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
524 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
526 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
528 else
530 STRRET str;
531 hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
532 SHGDN_INFOLDER, &str);
533 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
537 /* get the type name */
538 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
540 static const WCHAR szFolder[] = { 'F','o','l','d','e','r',0 };
541 static const WCHAR szFile[] = { 'F','i','l','e',0 };
542 static const WCHAR szSpaceFile[] = { ' ','f','i','l','e',0 };
544 if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL))
546 char ftype[80];
548 _ILGetFileType(pidlLast, ftype, 80);
549 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
551 else
553 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
554 strcatW (psfi->szTypeName, szFolder);
555 else
557 WCHAR sTemp[64];
559 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
560 if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0))
562 /* "name" or "name." => "File" */
563 lstrcpynW (psfi->szTypeName, szFile, 64);
565 else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
566 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
568 if (sTemp[0])
570 lstrcpynW (psfi->szTypeName, sTemp, 64);
571 strcatW (psfi->szTypeName, szSpaceFile);
573 else
575 lstrcpynW (psfi->szTypeName, szFile, 64);
582 /* ### icons ###*/
584 Shell_GetImageLists( &big_icons, &small_icons );
586 if (flags & SHGFI_OPENICON)
587 uGilFlags |= GIL_OPENICON;
589 if (flags & SHGFI_LINKOVERLAY)
590 uGilFlags |= GIL_FORSHORTCUT;
591 else if ((flags&SHGFI_ADDOVERLAYS) ||
592 (flags&(SHGFI_ICON|SHGFI_SMALLICON))==SHGFI_ICON)
594 if (SHELL_IsShortcut(pidlLast))
595 uGilFlags |= GIL_FORSHORTCUT;
598 if (flags & SHGFI_OVERLAYINDEX)
599 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
601 if (flags & SHGFI_SELECTED)
602 FIXME("set icon to selected, stub\n");
604 if (flags & SHGFI_SHELLICONSIZE)
605 FIXME("set icon to shell size, stub\n");
607 /* get the iconlocation */
608 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
610 UINT uDummy,uFlags;
612 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
614 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
616 lstrcpyW(psfi->szDisplayName, swShell32Name);
617 psfi->iIcon = -IDI_SHELL_FOLDER;
619 else
621 WCHAR* szExt;
622 static const WCHAR p1W[] = {'%','1',0};
623 WCHAR sTemp [MAX_PATH];
625 szExt = PathFindExtensionW(szFullPath);
626 TRACE("szExt=%s\n", debugstr_w(szExt));
627 if ( szExt &&
628 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
629 HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon))
631 if (lstrcmpW(p1W, sTemp))
632 strcpyW(psfi->szDisplayName, sTemp);
633 else
635 /* the icon is in the file */
636 strcpyW(psfi->szDisplayName, szFullPath);
639 else
640 ret = FALSE;
643 else
645 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
646 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
647 &uDummy, (LPVOID*)&pei);
648 if (SUCCEEDED(hr))
650 hr = IExtractIconW_GetIconLocation(pei, uGilFlags,
651 szLocation, MAX_PATH, &iIndex, &uFlags);
653 if (uFlags & GIL_NOTFILENAME)
654 ret = FALSE;
655 else
657 lstrcpyW (psfi->szDisplayName, szLocation);
658 psfi->iIcon = iIndex;
660 IExtractIconW_Release(pei);
665 /* get icon index (or load icon)*/
666 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
668 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
670 WCHAR sTemp [MAX_PATH];
671 WCHAR * szExt;
672 int icon_idx=0;
674 lstrcpynW(sTemp, szFullPath, MAX_PATH);
676 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
677 psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER, 0);
678 else
680 static const WCHAR p1W[] = {'%','1',0};
682 psfi->iIcon = 0;
683 szExt = PathFindExtensionW(sTemp);
684 if ( szExt &&
685 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
686 HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx))
688 if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
689 strcpyW(sTemp, szFullPath);
691 if (flags & SHGFI_SYSICONINDEX)
693 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0);
694 if (psfi->iIcon == -1)
695 psfi->iIcon = 0;
697 else
699 UINT ret;
700 if (flags & SHGFI_SMALLICON)
701 ret = PrivateExtractIconsW( sTemp,icon_idx,
702 GetSystemMetrics( SM_CXSMICON ),
703 GetSystemMetrics( SM_CYSMICON ),
704 &psfi->hIcon, 0, 1, 0);
705 else
706 ret = PrivateExtractIconsW( sTemp, icon_idx,
707 GetSystemMetrics( SM_CXICON),
708 GetSystemMetrics( SM_CYICON),
709 &psfi->hIcon, 0, 1, 0);
710 if (ret != 0 && ret != (UINT)-1)
712 IconNotYetLoaded=FALSE;
713 psfi->iIcon = icon_idx;
719 else
721 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
722 uGilFlags, &(psfi->iIcon))))
724 ret = FALSE;
727 if (ret && (flags & SHGFI_SYSICONINDEX))
729 if (flags & SHGFI_SMALLICON)
730 ret = (DWORD_PTR)small_icons;
731 else
732 ret = (DWORD_PTR)big_icons;
736 /* icon handle */
737 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
739 if (flags & SHGFI_SMALLICON)
740 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
741 else
742 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
745 if (flags & ~SHGFI_KNOWN_FLAGS)
746 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
748 if (psfParent)
749 IShellFolder_Release(psfParent);
751 if (hr != S_OK)
752 ret = FALSE;
754 SHFree(pidlLast);
756 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n",
757 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
758 debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
760 return ret;
763 /*************************************************************************
764 * SHGetFileInfoA [SHELL32.@]
766 * Note:
767 * MSVBVM60.__vbaNew2 expects this function to return a value in range
768 * 1 .. 0x7fff when the function succeeds and flags does not contain
769 * SHGFI_EXETYPE or SHGFI_SYSICONINDEX (see bug 7701)
771 DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
772 SHFILEINFOA *psfi, UINT sizeofpsfi,
773 UINT flags )
775 INT len;
776 LPWSTR temppath = NULL;
777 LPCWSTR pathW;
778 DWORD_PTR ret;
779 SHFILEINFOW temppsfi;
781 if (flags & SHGFI_PIDL)
783 /* path contains a pidl */
784 pathW = (LPCWSTR)path;
786 else
788 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
789 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
790 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
791 pathW = temppath;
794 if (psfi && (flags & SHGFI_ATTR_SPECIFIED))
795 temppsfi.dwAttributes=psfi->dwAttributes;
797 if (psfi == NULL)
798 ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, sizeof(temppsfi), flags);
799 else
800 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
802 if (psfi)
804 if(flags & SHGFI_ICON)
805 psfi->hIcon=temppsfi.hIcon;
806 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
807 psfi->iIcon=temppsfi.iIcon;
808 if(flags & SHGFI_ATTRIBUTES)
809 psfi->dwAttributes=temppsfi.dwAttributes;
810 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
812 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
813 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
815 if(flags & SHGFI_TYPENAME)
817 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
818 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
822 HeapFree(GetProcessHeap(), 0, temppath);
824 return ret;
827 /*************************************************************************
828 * DuplicateIcon [SHELL32.@]
830 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
832 ICONINFO IconInfo;
833 HICON hDupIcon = 0;
835 TRACE("%p %p\n", hInstance, hIcon);
837 if (GetIconInfo(hIcon, &IconInfo))
839 hDupIcon = CreateIconIndirect(&IconInfo);
841 /* clean up hbmMask and hbmColor */
842 DeleteObject(IconInfo.hbmMask);
843 DeleteObject(IconInfo.hbmColor);
846 return hDupIcon;
849 /*************************************************************************
850 * ExtractIconA [SHELL32.@]
852 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
854 HICON ret;
855 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
856 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
858 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
860 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
861 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
862 HeapFree(GetProcessHeap(), 0, lpwstrFile);
864 return ret;
867 /*************************************************************************
868 * ExtractIconW [SHELL32.@]
870 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
872 HICON hIcon = NULL;
873 UINT ret;
874 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
876 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
878 if (nIconIndex == (UINT)-1)
880 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
881 if (ret != (UINT)-1 && ret)
882 return (HICON)(UINT_PTR)ret;
883 return NULL;
885 else
886 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
888 if (ret == (UINT)-1)
889 return (HICON)1;
890 else if (ret > 0 && hIcon)
891 return hIcon;
893 return NULL;
896 HRESULT WINAPI SHCreateFileExtractIconW(LPCWSTR file, DWORD attribs, REFIID riid, void **ppv)
898 FIXME("%s, %x, %s, %p\n", debugstr_w(file), attribs, debugstr_guid(riid), ppv);
899 *ppv = NULL;
900 return E_NOTIMPL;
903 /*************************************************************************
904 * Printer_LoadIconsW [SHELL32.205]
906 VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon)
908 INT iconindex=IDI_SHELL_PRINTER;
910 TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon);
912 /* We should check if wsPrinterName is
913 1. the Default Printer or not
914 2. connected or not
915 3. a Local Printer or a Network-Printer
916 and use different Icons
918 if((wsPrinterName != NULL) && (wsPrinterName[0] != 0))
920 FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName));
923 if(pLargeIcon != NULL)
924 *pLargeIcon = LoadImageW(shell32_hInstance,
925 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
926 0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE);
928 if(pSmallIcon != NULL)
929 *pSmallIcon = LoadImageW(shell32_hInstance,
930 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON,
931 16, 16, LR_DEFAULTCOLOR);
934 /*************************************************************************
935 * Printers_RegisterWindowW [SHELL32.213]
936 * used by "printui.dll":
937 * find the Window of the given Type for the specific Printer and
938 * return the already existent hwnd or open a new window
940 BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType,
941 HANDLE * phClassPidl, HWND * phwnd)
943 FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType,
944 phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL,
945 phwnd, (phwnd != NULL) ? *(phwnd) : NULL);
947 return FALSE;
950 /*************************************************************************
951 * Printers_UnregisterWindow [SHELL32.214]
953 VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd)
955 FIXME("(%p, %p) stub!\n", hClassPidl, hwnd);
958 /*************************************************************************
959 * SHGetPropertyStoreForWindow [SHELL32.@]
961 HRESULT WINAPI SHGetPropertyStoreForWindow(HWND hwnd, REFIID riid, void **ppv)
963 FIXME("(%p %p %p) stub!\n", hwnd, riid, ppv);
964 return E_NOTIMPL;
967 /*************************************************************************
968 * SHGetPropertyStoreFromParsingName [SHELL32.@]
970 HRESULT WINAPI SHGetPropertyStoreFromParsingName(PCWSTR pszPath, IBindCtx *pbc, GETPROPERTYSTOREFLAGS flags, REFIID riid, void **ppv)
972 FIXME("(%s %p %u %p %p) stub!\n", debugstr_w(pszPath), pbc, flags, riid, ppv);
973 return E_NOTIMPL;
976 /*************************************************************************/
978 typedef struct
980 LPCWSTR szApp;
981 LPCWSTR szOtherStuff;
982 HICON hIcon;
983 HFONT hFont;
984 } ABOUT_INFO;
986 #define DROP_FIELD_TOP (-12)
988 static void paint_dropline( HDC hdc, HWND hWnd )
990 HWND hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_WINE_TEXT);
991 RECT rect;
993 if (!hWndCtl) return;
994 GetWindowRect( hWndCtl, &rect );
995 MapWindowPoints( 0, hWnd, (LPPOINT)&rect, 2 );
996 rect.top += DROP_FIELD_TOP;
997 rect.bottom = rect.top + 2;
998 DrawEdge( hdc, &rect, BDR_SUNKENOUTER, BF_RECT );
1001 /*************************************************************************
1002 * SHHelpShortcuts_RunDLLA [SHELL32.@]
1005 DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
1007 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1008 return 0;
1011 /*************************************************************************
1012 * SHHelpShortcuts_RunDLLA [SHELL32.@]
1015 DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
1017 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
1018 return 0;
1021 /*************************************************************************
1022 * SHLoadInProc [SHELL32.@]
1023 * Create an instance of specified object class from within
1024 * the shell process and release it immediately
1026 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
1028 void *ptr = NULL;
1030 TRACE("%s\n", debugstr_guid(rclsid));
1032 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
1033 if(ptr)
1035 IUnknown * pUnk = ptr;
1036 IUnknown_Release(pUnk);
1037 return S_OK;
1039 return DISP_E_MEMBERNOTFOUND;
1042 static void add_authors( HWND list )
1044 static const WCHAR eol[] = {'\r','\n',0};
1045 static const WCHAR authors[] = {'A','U','T','H','O','R','S',0};
1046 WCHAR *strW, *start, *end;
1047 HRSRC rsrc = FindResourceW( shell32_hInstance, authors, (LPCWSTR)RT_RCDATA );
1048 char *strA = LockResource( LoadResource( shell32_hInstance, rsrc ));
1049 DWORD sizeW, sizeA = SizeofResource( shell32_hInstance, rsrc );
1051 if (!strA) return;
1052 sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1;
1053 if (!(strW = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) return;
1054 MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
1055 strW[sizeW - 1] = 0;
1057 start = strpbrkW( strW, eol ); /* skip the header line */
1058 while (start)
1060 while (*start && strchrW( eol, *start )) start++;
1061 if (!*start) break;
1062 end = strpbrkW( start, eol );
1063 if (end) *end++ = 0;
1064 SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
1065 start = end;
1067 HeapFree( GetProcessHeap(), 0, strW );
1070 /*************************************************************************
1071 * AboutDlgProc (internal)
1073 static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
1074 LPARAM lParam )
1076 HWND hWndCtl;
1078 TRACE("\n");
1080 switch(msg)
1082 case WM_INITDIALOG:
1084 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
1085 WCHAR template[512], buffer[512], version[64];
1086 extern const char *wine_get_build_id(void);
1088 if (info)
1090 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
1091 GetWindowTextW( hWnd, template, sizeof(template)/sizeof(WCHAR) );
1092 sprintfW( buffer, template, info->szApp );
1093 SetWindowTextW( hWnd, buffer );
1094 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp );
1095 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff );
1096 GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3),
1097 template, sizeof(template)/sizeof(WCHAR) );
1098 MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1,
1099 version, sizeof(version)/sizeof(WCHAR) );
1100 sprintfW( buffer, template, version );
1101 SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer );
1102 hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);
1103 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
1104 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
1105 add_authors( hWndCtl );
1106 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
1109 return 1;
1111 case WM_PAINT:
1113 PAINTSTRUCT ps;
1114 HDC hDC = BeginPaint( hWnd, &ps );
1115 paint_dropline( hDC, hWnd );
1116 EndPaint( hWnd, &ps );
1118 break;
1120 case WM_COMMAND:
1121 if (wParam == IDOK || wParam == IDCANCEL)
1123 EndDialog(hWnd, TRUE);
1124 return TRUE;
1126 if (wParam == IDC_ABOUT_LICENSE)
1128 MSGBOXPARAMSW params;
1130 params.cbSize = sizeof(params);
1131 params.hwndOwner = hWnd;
1132 params.hInstance = shell32_hInstance;
1133 params.lpszText = MAKEINTRESOURCEW(IDS_LICENSE);
1134 params.lpszCaption = MAKEINTRESOURCEW(IDS_LICENSE_CAPTION);
1135 params.dwStyle = MB_ICONINFORMATION | MB_OK;
1136 params.lpszIcon = 0;
1137 params.dwContextHelpId = 0;
1138 params.lpfnMsgBoxCallback = NULL;
1139 params.dwLanguageId = LANG_NEUTRAL;
1140 MessageBoxIndirectW( &params );
1142 break;
1143 case WM_CLOSE:
1144 EndDialog(hWnd, TRUE);
1145 break;
1148 return 0;
1152 /*************************************************************************
1153 * ShellAboutA [SHELL32.288]
1155 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
1157 BOOL ret;
1158 LPWSTR appW = NULL, otherW = NULL;
1159 int len;
1161 if (szApp)
1163 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
1164 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1165 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
1167 if (szOtherStuff)
1169 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
1170 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1171 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
1174 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
1176 HeapFree(GetProcessHeap(), 0, otherW);
1177 HeapFree(GetProcessHeap(), 0, appW);
1178 return ret;
1182 /*************************************************************************
1183 * ShellAboutW [SHELL32.289]
1185 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
1186 HICON hIcon )
1188 ABOUT_INFO info;
1189 LOGFONTW logFont;
1190 BOOL bRet;
1191 static const WCHAR wszSHELL_ABOUT_MSGBOX[] =
1192 {'S','H','E','L','L','_','A','B','O','U','T','_','M','S','G','B','O','X',0};
1194 TRACE("\n");
1196 if (!hIcon) hIcon = LoadImageW( 0, (LPWSTR)IDI_WINLOGO, IMAGE_ICON, 48, 48, LR_SHARED );
1197 info.szApp = szApp;
1198 info.szOtherStuff = szOtherStuff;
1199 info.hIcon = hIcon;
1201 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
1202 info.hFont = CreateFontIndirectW( &logFont );
1204 bRet = DialogBoxParamW( shell32_hInstance, wszSHELL_ABOUT_MSGBOX, hWnd, AboutDlgProc, (LPARAM)&info );
1205 DeleteObject(info.hFont);
1206 return bRet;
1209 /*************************************************************************
1210 * FreeIconList (SHELL32.@)
1212 void WINAPI FreeIconList( DWORD dw )
1214 FIXME("%x: stub\n",dw);
1217 /*************************************************************************
1218 * SHLoadNonloadedIconOverlayIdentifiers (SHELL32.@)
1220 HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers( VOID )
1222 FIXME("stub\n");
1223 return S_OK;
1226 /***********************************************************************
1227 * DllGetVersion [SHELL32.@]
1229 * Retrieves version information of the 'SHELL32.DLL'
1231 * PARAMS
1232 * pdvi [O] pointer to version information structure.
1234 * RETURNS
1235 * Success: S_OK
1236 * Failure: E_INVALIDARG
1238 * NOTES
1239 * Returns version of a shell32.dll from IE4.01 SP1.
1242 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
1244 /* FIXME: shouldn't these values come from the version resource? */
1245 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
1246 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1248 pdvi->dwMajorVersion = WINE_FILEVERSION_MAJOR;
1249 pdvi->dwMinorVersion = WINE_FILEVERSION_MINOR;
1250 pdvi->dwBuildNumber = WINE_FILEVERSION_BUILD;
1251 pdvi->dwPlatformID = WINE_FILEVERSION_PLATFORMID;
1252 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1254 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
1256 pdvi2->dwFlags = 0;
1257 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
1258 WINE_FILEVERSION_MINOR,
1259 WINE_FILEVERSION_BUILD,
1260 WINE_FILEVERSION_PLATFORMID);
1262 TRACE("%u.%u.%u.%u\n",
1263 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
1264 pdvi->dwBuildNumber, pdvi->dwPlatformID);
1265 return S_OK;
1267 else
1269 WARN("wrong DLLVERSIONINFO size from app\n");
1270 return E_INVALIDARG;
1274 /*************************************************************************
1275 * global variables of the shell32.dll
1276 * all are once per process
1279 HINSTANCE shell32_hInstance = 0;
1282 /*************************************************************************
1283 * SHELL32 DllMain
1285 * NOTES
1286 * calling oleinitialize here breaks some apps.
1288 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
1290 TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad);
1292 switch (fdwReason)
1294 case DLL_PROCESS_ATTACH:
1295 shell32_hInstance = hinstDLL;
1296 DisableThreadLibraryCalls(shell32_hInstance);
1298 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
1299 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
1300 swShell32Name[MAX_PATH - 1] = '\0';
1302 InitChangeNotifications();
1303 break;
1305 case DLL_PROCESS_DETACH:
1306 if (fImpLoad) break;
1307 SIC_Destroy();
1308 FreeChangeNotifications();
1309 release_desktop_folder();
1310 release_typelib();
1311 break;
1313 return TRUE;
1316 /*************************************************************************
1317 * DllInstall [SHELL32.@]
1319 * PARAMETERS
1321 * BOOL bInstall - TRUE for install, FALSE for uninstall
1322 * LPCWSTR pszCmdLine - command line (unused by shell32?)
1325 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
1327 FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
1328 return S_OK; /* indicate success */
1331 /***********************************************************************
1332 * DllCanUnloadNow (SHELL32.@)
1334 HRESULT WINAPI DllCanUnloadNow(void)
1336 return S_FALSE;
1339 /***********************************************************************
1340 * DllRegisterServer (SHELL32.@)
1342 HRESULT WINAPI DllRegisterServer(void)
1344 HRESULT hr = __wine_register_resources( shell32_hInstance );
1345 if (SUCCEEDED(hr)) hr = SHELL_RegisterShellFolders();
1346 return hr;
1349 /***********************************************************************
1350 * DllUnregisterServer (SHELL32.@)
1352 HRESULT WINAPI DllUnregisterServer(void)
1354 return __wine_unregister_resources( shell32_hInstance );
1357 /***********************************************************************
1358 * ExtractVersionResource16W (SHELL32.@)
1360 BOOL WINAPI ExtractVersionResource16W(LPWSTR s, DWORD d)
1362 FIXME("(%s %x) stub!\n", debugstr_w(s), d);
1363 return FALSE;
1366 /***********************************************************************
1367 * InitNetworkAddressControl (SHELL32.@)
1369 BOOL WINAPI InitNetworkAddressControl(void)
1371 FIXME("stub\n");
1372 return FALSE;
1375 /***********************************************************************
1376 * ShellHookProc (SHELL32.@)
1378 LRESULT CALLBACK ShellHookProc(DWORD a, DWORD b, DWORD c)
1380 FIXME("Stub\n");
1381 return 0;
1384 /***********************************************************************
1385 * SHGetLocalizedName (SHELL32.@)
1387 HRESULT WINAPI SHGetLocalizedName(LPCWSTR path, LPWSTR module, UINT size, INT *res)
1389 FIXME("%s %p %u %p: stub\n", debugstr_w(path), module, size, res);
1390 return E_NOTIMPL;
1393 /***********************************************************************
1394 * SetCurrentProcessExplicitAppUserModelID (SHELL32.@)
1396 HRESULT WINAPI SetCurrentProcessExplicitAppUserModelID(PCWSTR appid)
1398 FIXME("%s: stub\n", debugstr_w(appid));
1399 return E_NOTIMPL;
1402 /***********************************************************************
1403 * GetCurrentProcessExplicitAppUserModelID (SHELL32.@)
1405 HRESULT WINAPI GetCurrentProcessExplicitAppUserModelID(PWSTR *appid)
1407 FIXME("%p: stub\n", appid);
1408 *appid = NULL;
1409 return E_NOTIMPL;
1412 /***********************************************************************
1413 * SHSetUnreadMailCountW (SHELL32.@)
1415 HRESULT WINAPI SHSetUnreadMailCountW(LPCWSTR mailaddress, DWORD count, LPCWSTR executecommand)
1417 FIXME("%s %x %s: stub\n", debugstr_w(mailaddress), count, debugstr_w(executecommand));
1418 return E_NOTIMPL;
1421 /***********************************************************************
1422 * SHEnumerateUnreadMailAccountsW (SHELL32.@)
1424 HRESULT WINAPI SHEnumerateUnreadMailAccountsW(HKEY user, DWORD idx, LPWSTR mailaddress, INT mailaddresslen)
1426 FIXME("%p %d %p %d: stub\n", user, idx, mailaddress, mailaddresslen);
1427 return E_NOTIMPL;
1430 /***********************************************************************
1431 * SHQueryUserNotificationState (SHELL32.@)
1433 HRESULT WINAPI SHQueryUserNotificationState(QUERY_USER_NOTIFICATION_STATE *state)
1435 FIXME("%p: stub\n", state);
1436 *state = QUNS_ACCEPTS_NOTIFICATIONS;
1437 return S_OK;