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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
43 #include "undocshell.h"
45 #include "shell32_main.h"
48 #include "wine/debug.h"
49 #include "wine/unicode.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(shell);
53 extern const char * const SHELL_Authors[];
56 /*************************************************************************
57 * CommandLineToArgvW [SHELL32.@]
59 * We must interpret the quotes in the command line to rebuild the argv
61 * - arguments are separated by spaces or tabs
62 * - quotes serve as optional argument delimiters
64 * - escaped quotes must be converted back to '"'
66 * - an odd number of '\'s followed by '"' correspond to half that number
67 * of '\' followed by a '"' (extension of the above)
70 * - an even number of '\'s followed by a '"' correspond to half that number
71 * of '\', plus a regular quote serving as an argument delimiter (which
72 * means it does not appear in the result)
73 * 'a\\"b c"' -> 'a\b c'
74 * 'a\\\\"b c"' -> 'a\\b c'
75 * - '\' that are not followed by a '"' are copied literally
85 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
96 /* Return the path to the executable */
99 hargv=GlobalAlloc(size, 0);
100 argv=GlobalLock(hargv);
102 len = GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR));
107 if (len < size) break;
109 hargv=GlobalReAlloc(hargv, size, 0);
110 argv=GlobalLock(hargv);
112 argv[0]=(LPWSTR)(argv+1);
119 /* to get a writeable copy */
125 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
128 /* skip the remaining spaces */
129 while (*cs==0x0009 || *cs==0x0020) {
136 } else if (*cs==0x005c) {
137 /* '\', count them */
139 } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
141 in_quotes=!in_quotes;
144 /* a regular character */
149 /* Allocate in a single lump, the string array, and the strings that go with it.
150 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
152 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
153 argv=GlobalLock(hargv);
156 cmdline=(LPWSTR)(argv+argc);
157 strcpyW(cmdline, lpCmdline);
164 if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
165 /* Close the argument and copy it */
169 /* skip the remaining spaces */
172 } while (*s==0x0009 || *s==0x0020);
174 /* Start with a new argument */
177 } else if (*s==0x005c) {
181 } else if (*s==0x0022) {
183 if ((bcount & 1)==0) {
184 /* Preceeded by an even number of '\', this is half that
185 * number of '\', plus a quote which we erase.
188 in_quotes=!in_quotes;
191 /* Preceeded by an odd number of '\', this is half that
192 * number of '\' followed by a '"'
200 /* a regular character */
215 /*************************************************************************
216 * SHGetFileInfoA [SHELL32.@]
220 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
221 SHFILEINFOW *psfi, UINT sizeofpsfi,
224 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
226 DWORD ret = TRUE, dwAttributes = 0;
227 IShellFolder * psfParent = NULL;
228 IExtractIconW * pei = NULL;
229 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
231 BOOL IconNotYetLoaded=TRUE;
233 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
234 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
236 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
239 /* windows initializes this values regardless of the flags */
241 psfi->szDisplayName[0] = '\0';
242 psfi->szTypeName[0] = '\0';
246 if (!(flags & SHGFI_PIDL)){
247 /* SHGitFileInfo should work with absolute and relative paths */
248 if (PathIsRelativeW(path)){
249 GetCurrentDirectoryW(MAX_PATH, szLocation);
250 PathCombineW(szFullPath, szLocation, path);
252 lstrcpynW(szFullPath, path, MAX_PATH);
256 if (flags & SHGFI_EXETYPE) {
260 IMAGE_DOS_HEADER mz_header;
265 if (flags != SHGFI_EXETYPE) return 0;
267 status = GetBinaryTypeW (szFullPath, &BinaryType);
268 if (!status) return 0;
269 if ((BinaryType == SCS_DOS_BINARY)
270 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
272 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
273 NULL, OPEN_EXISTING, 0, 0 );
274 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
276 /* The next section is adapted from MODULE_GetBinaryType, as we need
277 * to examine the image header to get OS and version information. We
278 * know from calling GetBinaryTypeA that the image is valid and either
279 * an NE or PE, so much error handling can be omitted.
280 * Seek to the start of the file and read the header information.
283 SetFilePointer( hfile, 0, NULL, SEEK_SET );
284 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
286 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
287 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
288 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
290 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
291 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
292 CloseHandle( hfile );
293 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
294 return IMAGE_NT_SIGNATURE
295 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
296 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
298 return IMAGE_NT_SIGNATURE;
300 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
303 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
304 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
305 CloseHandle( hfile );
306 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
307 | (ne.ne_expver << 16);
310 CloseHandle( hfile );
314 /* psfi is NULL normally to query EXE type. If it is NULL, none of the
315 * below makes sense anyway. Windows allows this and just returns FALSE */
316 if (psfi == NULL) return FALSE;
318 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
320 The pidl functions fail on not existing file names */
322 if (flags & SHGFI_PIDL) {
323 pidl = ILClone((LPCITEMIDLIST)path);
324 } else if (!(flags & SHGFI_USEFILEATTRIBUTES)) {
325 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
328 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
330 /* get the parent shellfolder */
332 hr = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&pidlLast);
335 ERR("pidl is null!\n");
340 /* get the attributes of the child */
341 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
343 if (!(flags & SHGFI_ATTR_SPECIFIED))
345 psfi->dwAttributes = 0xffffffff;
347 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &(psfi->dwAttributes));
350 /* get the displayname */
351 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
353 if (flags & SHGFI_USEFILEATTRIBUTES)
355 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
360 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
361 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
365 /* get the type name */
366 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
368 static const WCHAR szFile[] = { 'F','i','l','e',0 };
369 static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
370 if (!(flags & SHGFI_USEFILEATTRIBUTES))
373 _ILGetFileType(pidlLast, ftype, 80);
374 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
378 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
379 strcatW (psfi->szTypeName, szFile);
383 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
384 if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE)
385 && HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
387 lstrcpynW (psfi->szTypeName, sTemp, 64);
388 strcatW (psfi->szTypeName, szDashFile);
395 if (flags & SHGFI_LINKOVERLAY)
396 FIXME("set icon to link, stub\n");
398 if (flags & SHGFI_SELECTED)
399 FIXME("set icon to selected, stub\n");
401 if (flags & SHGFI_SHELLICONSIZE)
402 FIXME("set icon to shell size, stub\n");
404 /* get the iconlocation */
405 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
408 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
412 hr = IExtractIconW_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
413 psfi->iIcon = iIndex;
415 if(uFlags != GIL_NOTFILENAME)
416 lstrcpyW (psfi->szDisplayName, szLocation);
420 IExtractIconA_Release(pei);
424 /* get icon index (or load icon)*/
425 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
428 if (flags & SHGFI_USEFILEATTRIBUTES)
430 WCHAR sTemp [MAX_PATH];
434 lstrcpynW(sTemp, szFullPath, MAX_PATH);
436 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
440 static const WCHAR p1W[] = {'%','1',0};
442 szExt = (LPWSTR) PathFindExtensionW(sTemp);
443 if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE)
444 && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &dwNr))
446 if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
447 strcpyW(sTemp, szFullPath);
449 if (flags & SHGFI_SYSICONINDEX)
451 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
452 if (psfi->iIcon == -1) psfi->iIcon = 0;
456 IconNotYetLoaded=FALSE;
457 PrivateExtractIconsW(sTemp,dwNr,(flags & SHGFI_SMALLICON) ?
458 GetSystemMetrics(SM_CXSMICON) : GetSystemMetrics(SM_CXICON),
459 (flags & SHGFI_SMALLICON) ? GetSystemMetrics(SM_CYSMICON) :
460 GetSystemMetrics(SM_CYICON), &psfi->hIcon,0,1,0);
468 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
469 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
476 ret = (DWORD) ((flags & SHGFI_SMALLICON) ? ShellSmallIconList : ShellBigIconList);
481 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
482 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_SMALLICON) ? ShellSmallIconList:ShellBigIconList, psfi->iIcon, ILD_NORMAL);
484 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
485 FIXME("unknown attribute!\n");
488 IShellFolder_Release(psfParent);
493 if(pidlLast) SHFree(pidlLast);
495 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
496 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
501 /*************************************************************************
502 * SHGetFileInfoW [SHELL32.@]
505 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
506 SHFILEINFOA *psfi, UINT sizeofpsfi,
512 SHFILEINFOW temppsfi;
514 if (flags & SHGFI_PIDL) {
515 /* path contains a pidl */
516 temppath = (LPWSTR) path;
518 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
519 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
520 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
523 if(psfi && (flags & SHGFI_ATTR_SPECIFIED))
524 temppsfi.dwAttributes=psfi->dwAttributes;
526 ret = SHGetFileInfoW(temppath, dwFileAttributes, (psfi == NULL)? NULL : &temppsfi, sizeof(temppsfi), flags);
530 if(flags & SHGFI_ICON)
531 psfi->hIcon=temppsfi.hIcon;
532 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
533 psfi->iIcon=temppsfi.iIcon;
534 if(flags & SHGFI_ATTRIBUTES)
535 psfi->dwAttributes=temppsfi.dwAttributes;
536 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
537 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1, psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
538 if(flags & SHGFI_TYPENAME)
539 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
541 if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
545 /*************************************************************************
546 * SHGetFileInfo [SHELL32.@]
548 DWORD WINAPI SHGetFileInfoAW(
550 DWORD dwFileAttributes,
555 if(SHELL_OsIsUnicode())
556 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
557 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
560 /*************************************************************************
561 * DuplicateIcon [SHELL32.@]
563 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
568 TRACE("(%p, %p)\n", hInstance, hIcon);
570 if(GetIconInfo(hIcon, &IconInfo))
572 hDupIcon = CreateIconIndirect(&IconInfo);
574 /* clean up hbmMask and hbmColor */
575 DeleteObject(IconInfo.hbmMask);
576 DeleteObject(IconInfo.hbmColor);
582 /*************************************************************************
583 * ExtractIconA [SHELL32.@]
585 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
588 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
589 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
591 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
593 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
594 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
595 HeapFree(GetProcessHeap(), 0, lpwstrFile);
599 /*************************************************************************
600 * ExtractIconW [SHELL32.@]
602 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
606 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
608 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
610 if (nIconIndex == 0xFFFFFFFF) {
611 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
612 if (ret != 0xFFFFFFFF && ret)
617 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
619 if (ret == 0xFFFFFFFF)
621 else if (ret > 0 && hIcon)
629 LPCWSTR szOtherStuff;
634 #define IDC_STATIC_TEXT 100
635 #define IDC_LISTBOX 99
636 #define IDC_WINE_TEXT 98
638 #define DROP_FIELD_TOP (-15)
639 #define DROP_FIELD_HEIGHT 15
641 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
642 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
644 { GetWindowRect( hWndCtl, lprect );
645 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
646 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
652 /*************************************************************************
653 * SHAppBarMessage [SHELL32.@]
655 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
657 int width=data->rc.right - data->rc.left;
658 int height=data->rc.bottom - data->rc.top;
662 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
663 case ABM_GETTASKBARPOS:
664 GetWindowRect(data->hWnd, &rec);
668 SetActiveWindow(data->hWnd);
670 case ABM_GETAUTOHIDEBAR:
671 data->hWnd=GetActiveWindow();
674 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
675 width,height,SWP_SHOWWINDOW);
678 GetWindowRect(data->hWnd, &(data->rc));
681 FIXME("ABM_REMOVE broken\n");
682 /* FIXME: this is wrong; should it be DestroyWindow instead? */
683 /*CloseHandle(data->hWnd);*/
685 case ABM_SETAUTOHIDEBAR:
686 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
687 width,height,SWP_SHOWWINDOW);
690 data->uEdge=(ABE_RIGHT | ABE_LEFT);
691 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
692 width,height,SWP_SHOWWINDOW);
694 case ABM_WINDOWPOSCHANGED:
700 /*************************************************************************
701 * SHHelpShortcuts_RunDLL [SHELL32.@]
704 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
705 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
706 dwArg1, dwArg2, dwArg3, dwArg4);
711 /*************************************************************************
712 * SHLoadInProc [SHELL32.@]
713 * Create an instance of specified object class from within
714 * the shell process and release it immediately
717 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
721 TRACE("%s\n", debugstr_guid(rclsid));
723 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
726 IUnknown * pUnk = ptr;
727 IUnknown_Release(pUnk);
730 return DISP_E_MEMBERNOTFOUND;
733 /*************************************************************************
734 * AboutDlgProc (internal)
736 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
747 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
748 WCHAR Template[512], AppTitle[512];
752 const char* const *pstr = SHELL_Authors;
753 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
754 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
755 sprintfW( AppTitle, Template, info->szApp );
756 SetWindowTextW( hWnd, AppTitle );
757 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
758 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
759 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
760 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
764 /* authors list is in iso-8859-1 format */
765 MultiByteToWideChar( 28591, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
766 SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name );
769 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
777 HDC hDC = BeginPaint( hWnd, &ps );
779 if( __get_dropline( hWnd, &rect ) ) {
780 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
781 MoveToEx( hDC, rect.left, rect.top, NULL );
782 LineTo( hDC, rect.right, rect.bottom );
784 EndPaint( hWnd, &ps );
789 if (wParam == IDOK || wParam == IDCANCEL)
791 EndDialog(hWnd, TRUE);
796 EndDialog(hWnd, TRUE);
804 /*************************************************************************
805 * ShellAboutA [SHELL32.288]
807 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
810 LPWSTR appW = NULL, otherW = NULL;
815 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
816 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
817 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
821 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
822 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
823 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
826 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
828 if (otherW) HeapFree(GetProcessHeap(), 0, otherW);
829 if (appW) HeapFree(GetProcessHeap(), 0, appW);
834 /*************************************************************************
835 * ShellAboutW [SHELL32.289]
837 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
848 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", (LPSTR)RT_DIALOG)))
850 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
853 info.szOtherStuff = szOtherStuff;
854 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
856 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
857 info.hFont = CreateFontIndirectW( &logFont );
859 bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ),
860 template, hWnd, AboutDlgProc, (LPARAM)&info );
861 DeleteObject(info.hFont);
865 /*************************************************************************
866 * FreeIconList (SHELL32.@)
868 void WINAPI FreeIconList( DWORD dw )
869 { FIXME("(%lx): stub\n",dw);
873 /*************************************************************************
874 * ShellDDEInit (SHELL32.@)
876 void WINAPI ShellDDEInit(BOOL start)
878 FIXME("stub: %d\n", start);
881 /***********************************************************************
882 * DllGetVersion [SHELL32.@]
884 * Retrieves version information of the 'SHELL32.DLL'
887 * pdvi [O] pointer to version information structure.
891 * Failure: E_INVALIDARG
894 * Returns version of a shell32.dll from IE4.01 SP1.
897 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
899 /* FIXME: shouldn't these values come from the version resource? */
900 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
901 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
903 pdvi->dwMajorVersion = WINE_FILEVERSION_MAJOR;
904 pdvi->dwMinorVersion = WINE_FILEVERSION_MINOR;
905 pdvi->dwBuildNumber = WINE_FILEVERSION_BUILD;
906 pdvi->dwPlatformID = WINE_FILEVERSION_PLATFORMID;
907 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
909 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
912 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
913 WINE_FILEVERSION_MINOR,
914 WINE_FILEVERSION_BUILD,
915 WINE_FILEVERSION_PLATFORMID);
917 TRACE("%lu.%lu.%lu.%lu\n",
918 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
919 pdvi->dwBuildNumber, pdvi->dwPlatformID);
924 WARN("wrong DLLVERSIONINFO size from app\n");
928 /*************************************************************************
929 * global variables of the shell32.dll
930 * all are once per process
933 HINSTANCE shell32_hInstance = 0;
934 HIMAGELIST ShellSmallIconList = 0;
935 HIMAGELIST ShellBigIconList = 0;
938 /*************************************************************************
942 * calling oleinitialize here breaks sone apps.
945 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
947 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
951 case DLL_PROCESS_ATTACH:
952 shell32_hInstance = hinstDLL;
953 DisableThreadLibraryCalls(shell32_hInstance);
955 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
956 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
957 swShell32Name[MAX_PATH - 1] = '\0';
959 InitCommonControlsEx(NULL);
963 InitChangeNotifications();
966 case DLL_PROCESS_DETACH:
967 shell32_hInstance = 0;
969 FreeChangeNotifications();
975 /*************************************************************************
976 * DllInstall [SHELL32.@]
980 * BOOL bInstall - TRUE for install, FALSE for uninstall
981 * LPCWSTR pszCmdLine - command line (unused by shell32?)
984 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
986 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
988 return S_OK; /* indicate success */
991 /***********************************************************************
992 * DllCanUnloadNow (SHELL32.@)
994 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
996 FIXME("(void): stub\n");