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
41 #include "undocshell.h"
43 #include "shell32_main.h"
46 #include "wine/debug.h"
47 #include "wine/unicode.h"
49 WINE_DEFAULT_DEBUG_CHANNEL(shell);
51 extern const char * const SHELL_Authors[];
54 /*************************************************************************
55 * CommandLineToArgvW [SHELL32.@]
57 * We must interpret the quotes in the command line to rebuild the argv
59 * - arguments are separated by spaces or tabs
60 * - quotes serve as optional argument delimiters
62 * - escaped quotes must be converted back to '"'
64 * - an odd number of '\'s followed by '"' correspond to half that number
65 * of '\' followed by a '"' (extension of the above)
68 * - an even number of '\'s followed by a '"' correspond to half that number
69 * of '\', plus a regular quote serving as an argument delimiter (which
70 * means it does not appear in the result)
71 * 'a\\"b c"' -> 'a\b c'
72 * 'a\\\\"b c"' -> 'a\\b c'
73 * - '\' that are not followed by a '"' are copied literally
83 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
94 /* Return the path to the executable */
97 hargv=GlobalAlloc(size, 0);
98 argv=GlobalLock(hargv);
100 len = GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR));
105 if (len < size) break;
107 hargv=GlobalReAlloc(hargv, size, 0);
108 argv=GlobalLock(hargv);
110 argv[0]=(LPWSTR)(argv+1);
117 /* to get a writeable copy */
123 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
126 /* skip the remaining spaces */
127 while (*cs==0x0009 || *cs==0x0020) {
134 } else if (*cs==0x005c) {
135 /* '\', count them */
137 } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
139 in_quotes=!in_quotes;
142 /* a regular character */
147 /* Allocate in a single lump, the string array, and the strings that go with it.
148 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
150 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
151 argv=GlobalLock(hargv);
154 cmdline=(LPWSTR)(argv+argc);
155 strcpyW(cmdline, lpCmdline);
162 if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
163 /* Close the argument and copy it */
167 /* skip the remaining spaces */
170 } while (*s==0x0009 || *s==0x0020);
172 /* Start with a new argument */
175 } else if (*s==0x005c) {
179 } else if (*s==0x0022) {
181 if ((bcount & 1)==0) {
182 /* Preceeded by an even number of '\', this is half that
183 * number of '\', plus a quote which we erase.
186 in_quotes=!in_quotes;
189 /* Preceeded by an odd number of '\', this is half that
190 * number of '\' followed by a '"'
198 /* a regular character */
213 /*************************************************************************
214 * SHGetFileInfoA [SHELL32.@]
218 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
219 SHFILEINFOW *psfi, UINT sizeofpsfi,
222 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
224 DWORD ret = TRUE, dwAttributes = 0;
225 IShellFolder * psfParent = NULL;
226 IExtractIconW * pei = NULL;
227 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
229 BOOL IconNotYetLoaded=TRUE;
231 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
232 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
234 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
237 /* windows initializes this values regardless of the flags */
239 psfi->szDisplayName[0] = '\0';
240 psfi->szTypeName[0] = '\0';
244 if (!(flags & SHGFI_PIDL)){
245 /* SHGitFileInfo should work with absolute and relative paths */
246 if (PathIsRelativeW(path)){
247 GetCurrentDirectoryW(MAX_PATH, szLocation);
248 PathCombineW(szFullPath, szLocation, path);
250 lstrcpynW(szFullPath, path, MAX_PATH);
254 if (flags & SHGFI_EXETYPE) {
258 IMAGE_DOS_HEADER mz_header;
263 if (flags != SHGFI_EXETYPE) return 0;
265 status = GetBinaryTypeW (szFullPath, &BinaryType);
266 if (!status) return 0;
267 if ((BinaryType == SCS_DOS_BINARY)
268 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
270 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
271 NULL, OPEN_EXISTING, 0, 0 );
272 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
274 /* The next section is adapted from MODULE_GetBinaryType, as we need
275 * to examine the image header to get OS and version information. We
276 * know from calling GetBinaryTypeA that the image is valid and either
277 * an NE or PE, so much error handling can be omitted.
278 * Seek to the start of the file and read the header information.
281 SetFilePointer( hfile, 0, NULL, SEEK_SET );
282 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
284 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
285 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
286 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
288 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
289 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
290 CloseHandle( hfile );
291 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
292 return IMAGE_NT_SIGNATURE
293 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
294 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
296 return IMAGE_NT_SIGNATURE;
298 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
301 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
302 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
303 CloseHandle( hfile );
304 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
305 | (ne.ne_expver << 16);
308 CloseHandle( hfile );
312 /* psfi is NULL normally to query EXE type. If it is NULL, none of the
313 * below makes sense anyway. Windows allows this and just returns FALSE */
314 if (psfi == NULL) return FALSE;
316 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
318 The pidl functions fail on not existing file names */
320 if (flags & SHGFI_PIDL) {
321 pidl = ILClone((LPCITEMIDLIST)path);
322 } else if (!(flags & SHGFI_USEFILEATTRIBUTES)) {
323 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
326 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
328 /* get the parent shellfolder */
330 hr = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&pidlLast);
333 ERR("pidl is null!\n");
338 /* get the attributes of the child */
339 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
341 if (!(flags & SHGFI_ATTR_SPECIFIED))
343 psfi->dwAttributes = 0xffffffff;
345 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &(psfi->dwAttributes));
348 /* get the displayname */
349 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
351 if (flags & SHGFI_USEFILEATTRIBUTES)
353 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
358 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
359 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
363 /* get the type name */
364 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
366 static const WCHAR szFile[] = { 'F','i','l','e',0 };
367 static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
368 if (!(flags & SHGFI_USEFILEATTRIBUTES))
371 _ILGetFileType(pidlLast, ftype, 80);
372 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
376 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
377 strcatW (psfi->szTypeName, szFile);
381 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
382 if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE)
383 && HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
385 lstrcpynW (psfi->szTypeName, sTemp, 64);
386 strcatW (psfi->szTypeName, szDashFile);
393 if (flags & SHGFI_LINKOVERLAY)
394 FIXME("set icon to link, stub\n");
396 if (flags & SHGFI_SELECTED)
397 FIXME("set icon to selected, stub\n");
399 if (flags & SHGFI_SHELLICONSIZE)
400 FIXME("set icon to shell size, stub\n");
402 /* get the iconlocation */
403 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
406 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
410 hr = IExtractIconW_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
411 psfi->iIcon = iIndex;
413 if(uFlags != GIL_NOTFILENAME)
414 lstrcpyW (psfi->szDisplayName, szLocation);
418 IExtractIconA_Release(pei);
422 /* get icon index (or load icon)*/
423 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
426 if (flags & SHGFI_USEFILEATTRIBUTES)
428 WCHAR sTemp [MAX_PATH];
432 lstrcpynW(sTemp, szFullPath, MAX_PATH);
434 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
438 static const WCHAR p1W[] = {'%','1',0};
440 szExt = (LPWSTR) PathFindExtensionW(sTemp);
441 if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE)
442 && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &dwNr))
444 if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
445 strcpyW(sTemp, szFullPath);
447 if (flags & SHGFI_SYSICONINDEX)
449 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
450 if (psfi->iIcon == -1) psfi->iIcon = 0;
454 IconNotYetLoaded=FALSE;
455 PrivateExtractIconsW(sTemp,dwNr,(flags & SHGFI_SMALLICON) ?
456 GetSystemMetrics(SM_CXSMICON) : GetSystemMetrics(SM_CXICON),
457 (flags & SHGFI_SMALLICON) ? GetSystemMetrics(SM_CYSMICON) :
458 GetSystemMetrics(SM_CYICON), &psfi->hIcon,0,1,0);
466 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
467 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
474 ret = (DWORD) ((flags & SHGFI_SMALLICON) ? ShellSmallIconList : ShellBigIconList);
479 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
480 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_SMALLICON) ? ShellSmallIconList:ShellBigIconList, psfi->iIcon, ILD_NORMAL);
482 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
483 FIXME("unknown attribute!\n");
486 IShellFolder_Release(psfParent);
491 if(pidlLast) SHFree(pidlLast);
493 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
494 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
499 /*************************************************************************
500 * SHGetFileInfoW [SHELL32.@]
503 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
504 SHFILEINFOA *psfi, UINT sizeofpsfi,
510 SHFILEINFOW temppsfi;
512 if (flags & SHGFI_PIDL) {
513 /* path contains a pidl */
514 temppath = (LPWSTR) path;
516 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
517 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
518 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
521 if(psfi && (flags & SHGFI_ATTR_SPECIFIED))
522 temppsfi.dwAttributes=psfi->dwAttributes;
524 ret = SHGetFileInfoW(temppath, dwFileAttributes, (psfi == NULL)? NULL : &temppsfi, sizeof(temppsfi), flags);
528 if(flags & SHGFI_ICON)
529 psfi->hIcon=temppsfi.hIcon;
530 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
531 psfi->iIcon=temppsfi.iIcon;
532 if(flags & SHGFI_ATTRIBUTES)
533 psfi->dwAttributes=temppsfi.dwAttributes;
534 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
535 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1, psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
536 if(flags & SHGFI_TYPENAME)
537 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
539 if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
543 /*************************************************************************
544 * SHGetFileInfo [SHELL32.@]
546 DWORD WINAPI SHGetFileInfoAW(
548 DWORD dwFileAttributes,
553 if(SHELL_OsIsUnicode())
554 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
555 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
558 /*************************************************************************
559 * DuplicateIcon [SHELL32.@]
561 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
566 TRACE("(%p, %p)\n", hInstance, hIcon);
568 if(GetIconInfo(hIcon, &IconInfo))
570 hDupIcon = CreateIconIndirect(&IconInfo);
572 /* clean up hbmMask and hbmColor */
573 DeleteObject(IconInfo.hbmMask);
574 DeleteObject(IconInfo.hbmColor);
580 /*************************************************************************
581 * ExtractIconA [SHELL32.@]
583 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
586 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
587 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
589 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
591 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
592 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
593 HeapFree(GetProcessHeap(), 0, lpwstrFile);
597 /*************************************************************************
598 * ExtractIconW [SHELL32.@]
600 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
604 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
606 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
608 if (nIconIndex == 0xFFFFFFFF) {
609 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
610 if (ret != 0xFFFFFFFF && ret)
615 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
617 if (ret == 0xFFFFFFFF)
619 else if (ret > 0 && hIcon)
627 LPCWSTR szOtherStuff;
632 #define IDC_STATIC_TEXT 100
633 #define IDC_LISTBOX 99
634 #define IDC_WINE_TEXT 98
636 #define DROP_FIELD_TOP (-15)
637 #define DROP_FIELD_HEIGHT 15
639 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
640 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
642 { GetWindowRect( hWndCtl, lprect );
643 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
644 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
650 /*************************************************************************
651 * SHAppBarMessage [SHELL32.@]
653 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
655 int width=data->rc.right - data->rc.left;
656 int height=data->rc.bottom - data->rc.top;
660 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
661 case ABM_GETTASKBARPOS:
662 GetWindowRect(data->hWnd, &rec);
666 SetActiveWindow(data->hWnd);
668 case ABM_GETAUTOHIDEBAR:
669 data->hWnd=GetActiveWindow();
672 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
673 width,height,SWP_SHOWWINDOW);
676 GetWindowRect(data->hWnd, &(data->rc));
679 FIXME("ABM_REMOVE broken\n");
680 /* FIXME: this is wrong; should it be DestroyWindow instead? */
681 /*CloseHandle(data->hWnd);*/
683 case ABM_SETAUTOHIDEBAR:
684 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
685 width,height,SWP_SHOWWINDOW);
688 data->uEdge=(ABE_RIGHT | ABE_LEFT);
689 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
690 width,height,SWP_SHOWWINDOW);
692 case ABM_WINDOWPOSCHANGED:
698 /*************************************************************************
699 * SHHelpShortcuts_RunDLL [SHELL32.@]
702 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
703 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
704 dwArg1, dwArg2, dwArg3, dwArg4);
709 /*************************************************************************
710 * SHLoadInProc [SHELL32.@]
711 * Create an instance of specified object class from within
712 * the shell process and release it immediately
715 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
719 TRACE("%s\n", debugstr_guid(rclsid));
721 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
724 IUnknown * pUnk = ptr;
725 IUnknown_Release(pUnk);
728 return DISP_E_MEMBERNOTFOUND;
731 /*************************************************************************
732 * AboutDlgProc (internal)
734 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
745 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
746 WCHAR Template[512], AppTitle[512];
750 const char* const *pstr = SHELL_Authors;
751 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
752 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
753 sprintfW( AppTitle, Template, info->szApp );
754 SetWindowTextW( hWnd, AppTitle );
755 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
756 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
757 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
758 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
762 /* authors list is in iso-8859-1 format */
763 MultiByteToWideChar( 28591, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
764 SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name );
767 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
775 HDC hDC = BeginPaint( hWnd, &ps );
777 if( __get_dropline( hWnd, &rect ) ) {
778 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
779 MoveToEx( hDC, rect.left, rect.top, NULL );
780 LineTo( hDC, rect.right, rect.bottom );
782 EndPaint( hWnd, &ps );
787 if (wParam == IDOK || wParam == IDCANCEL)
789 EndDialog(hWnd, TRUE);
794 EndDialog(hWnd, TRUE);
802 /*************************************************************************
803 * ShellAboutA [SHELL32.288]
805 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
808 LPWSTR appW = NULL, otherW = NULL;
813 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
814 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
815 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
819 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
820 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
821 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
824 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
826 if (otherW) HeapFree(GetProcessHeap(), 0, otherW);
827 if (appW) HeapFree(GetProcessHeap(), 0, appW);
832 /*************************************************************************
833 * ShellAboutW [SHELL32.289]
835 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
846 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", (LPSTR)RT_DIALOG)))
848 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
851 info.szOtherStuff = szOtherStuff;
852 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
854 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
855 info.hFont = CreateFontIndirectW( &logFont );
857 bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ),
858 template, hWnd, AboutDlgProc, (LPARAM)&info );
859 DeleteObject(info.hFont);
863 /*************************************************************************
864 * FreeIconList (SHELL32.@)
866 void WINAPI FreeIconList( DWORD dw )
867 { FIXME("(%lx): stub\n",dw);
871 /*************************************************************************
872 * ShellDDEInit (SHELL32.@)
874 void WINAPI ShellDDEInit(BOOL start)
876 FIXME("stub: %d\n", start);
879 /***********************************************************************
880 * DllGetVersion [SHELL32.@]
882 * Retrieves version information of the 'SHELL32.DLL'
885 * pdvi [O] pointer to version information structure.
889 * Failure: E_INVALIDARG
892 * Returns version of a shell32.dll from IE4.01 SP1.
895 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
897 /* FIXME: shouldn't these values come from the version resource? */
898 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
899 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
901 pdvi->dwMajorVersion = WINE_FILEVERSION_MAJOR;
902 pdvi->dwMinorVersion = WINE_FILEVERSION_MINOR;
903 pdvi->dwBuildNumber = WINE_FILEVERSION_BUILD;
904 pdvi->dwPlatformID = WINE_FILEVERSION_PLATFORMID;
905 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
907 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
910 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
911 WINE_FILEVERSION_MINOR,
912 WINE_FILEVERSION_BUILD,
913 WINE_FILEVERSION_PLATFORMID);
915 TRACE("%lu.%lu.%lu.%lu\n",
916 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
917 pdvi->dwBuildNumber, pdvi->dwPlatformID);
922 WARN("wrong DLLVERSIONINFO size from app\n");
926 /*************************************************************************
927 * global variables of the shell32.dll
928 * all are once per process
931 HINSTANCE shell32_hInstance = 0;
932 HIMAGELIST ShellSmallIconList = 0;
933 HIMAGELIST ShellBigIconList = 0;
936 /*************************************************************************
940 * calling oleinitialize here breaks sone apps.
943 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
945 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
949 case DLL_PROCESS_ATTACH:
950 shell32_hInstance = hinstDLL;
951 DisableThreadLibraryCalls(shell32_hInstance);
953 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
954 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
955 swShell32Name[MAX_PATH - 1] = '\0';
957 InitCommonControlsEx(NULL);
961 InitChangeNotifications();
964 case DLL_PROCESS_DETACH:
965 shell32_hInstance = 0;
967 FreeChangeNotifications();
973 /*************************************************************************
974 * DllInstall [SHELL32.@]
978 * BOOL bInstall - TRUE for install, FALSE for uninstall
979 * LPCWSTR pszCmdLine - command line (unused by shell32?)
982 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
984 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
986 return S_OK; /* indicate success */
989 /***********************************************************************
990 * DllCanUnloadNow (SHELL32.@)
992 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
994 FIXME("(void): stub\n");