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"
45 #include "wine/debug.h"
46 #include "wine/unicode.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(shell);
50 extern const char * const SHELL_Authors[];
53 /*************************************************************************
54 * CommandLineToArgvW [SHELL32.@]
56 * We must interpret the quotes in the command line to rebuild the argv
58 * - arguments are separated by spaces or tabs
59 * - quotes serve as optional argument delimiters
61 * - escaped quotes must be converted back to '"'
63 * - an odd number of '\'s followed by '"' correspond to half that number
64 * of '\' followed by a '"' (extension of the above)
67 * - an even number of '\'s followed by a '"' correspond to half that number
68 * of '\', plus a regular quote serving as an argument delimiter (which
69 * means it does not appear in the result)
70 * 'a\\"b c"' -> 'a\b c'
71 * 'a\\\\"b c"' -> 'a\\b c'
72 * - '\' that are not followed by a '"' are copied literally
82 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
93 /* Return the path to the executable */
96 hargv=GlobalAlloc(size, 0);
97 argv=GlobalLock(hargv);
98 while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0) {
100 hargv=GlobalReAlloc(hargv, size, 0);
101 argv=GlobalLock(hargv);
103 argv[0]=(LPWSTR)(argv+1);
110 /* to get a writeable copy */
116 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
119 /* skip the remaining spaces */
120 while (*cs==0x0009 || *cs==0x0020) {
127 } else if (*cs==0x005c) {
128 /* '\', count them */
130 } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
132 in_quotes=!in_quotes;
135 /* a regular character */
140 /* Allocate in a single lump, the string array, and the strings that go with it.
141 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
143 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
144 argv=GlobalLock(hargv);
147 cmdline=(LPWSTR)(argv+argc);
148 strcpyW(cmdline, lpCmdline);
155 if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
156 /* Close the argument and copy it */
160 /* skip the remaining spaces */
163 } while (*s==0x0009 || *s==0x0020);
165 /* Start with a new argument */
168 } else if (*s==0x005c) {
172 } else if (*s==0x0022) {
174 if ((bcount & 1)==0) {
175 /* Preceeded by an even number of '\', this is half that
176 * number of '\', plus a quote which we erase.
179 in_quotes=!in_quotes;
182 /* Preceeded by an odd number of '\', this is half that
183 * number of '\' followed by a '"'
191 /* a regular character */
206 /*************************************************************************
207 * SHGetFileInfoA [SHELL32.@]
211 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
212 SHFILEINFOW *psfi, UINT sizeofpsfi,
215 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
217 DWORD ret = TRUE, dwAttributes = 0;
218 IShellFolder * psfParent = NULL;
219 IExtractIconW * pei = NULL;
220 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
222 BOOL IconNotYetLoaded=TRUE;
224 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
225 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
227 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
230 /* windows initializes this values regardless of the flags */
232 psfi->szDisplayName[0] = '\0';
233 psfi->szTypeName[0] = '\0';
237 if (!(flags & SHGFI_PIDL)){
238 /* SHGitFileInfo should work with absolute and relative paths */
239 if (PathIsRelativeW(path)){
240 GetCurrentDirectoryW(MAX_PATH, szLocation);
241 PathCombineW(szFullPath, szLocation, path);
243 lstrcpynW(szFullPath, path, MAX_PATH);
247 if (flags & SHGFI_EXETYPE) {
251 IMAGE_DOS_HEADER mz_header;
256 if (flags != SHGFI_EXETYPE) return 0;
258 status = GetBinaryTypeW (szFullPath, &BinaryType);
259 if (!status) return 0;
260 if ((BinaryType == SCS_DOS_BINARY)
261 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
263 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
264 NULL, OPEN_EXISTING, 0, 0 );
265 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
267 /* The next section is adapted from MODULE_GetBinaryType, as we need
268 * to examine the image header to get OS and version information. We
269 * know from calling GetBinaryTypeA that the image is valid and either
270 * an NE or PE, so much error handling can be omitted.
271 * Seek to the start of the file and read the header information.
274 SetFilePointer( hfile, 0, NULL, SEEK_SET );
275 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
277 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
278 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
279 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
281 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
282 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
283 CloseHandle( hfile );
284 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
285 return IMAGE_NT_SIGNATURE
286 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
287 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
289 return IMAGE_NT_SIGNATURE;
291 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
294 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
295 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
296 CloseHandle( hfile );
297 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
298 | (ne.ne_expver << 16);
301 CloseHandle( hfile );
305 /* psfi is NULL normally to query EXE type. If it is NULL, none of the
306 * below makes sense anyway. Windows allows this and just returns FALSE */
307 if (psfi == NULL) return FALSE;
309 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
311 The pidl functions fail on not existing file names */
313 if (flags & SHGFI_PIDL) {
314 pidl = ILClone((LPCITEMIDLIST)path);
315 } else if (!(flags & SHGFI_USEFILEATTRIBUTES)) {
316 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
319 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
321 /* get the parent shellfolder */
323 hr = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&pidlLast);
326 ERR("pidl is null!\n");
331 /* get the attributes of the child */
332 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
334 if (!(flags & SHGFI_ATTR_SPECIFIED))
336 psfi->dwAttributes = 0xffffffff;
338 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &(psfi->dwAttributes));
341 /* get the displayname */
342 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
344 if (flags & SHGFI_USEFILEATTRIBUTES)
346 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
351 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
352 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
356 /* get the type name */
357 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
359 WCHAR szFile[] = { 'F','i','l','e',0 };
360 WCHAR szDashFile[] = { '-','f','i','l','e',0 };
361 if (!(flags & SHGFI_USEFILEATTRIBUTES))
364 _ILGetFileType(pidlLast, ftype, 80);
365 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
369 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
370 strcatW (psfi->szTypeName, szFile);
374 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
375 if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE)
376 && HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
378 lstrcpynW (psfi->szTypeName, sTemp, 64);
379 strcatW (psfi->szTypeName, szDashFile);
386 if (flags & SHGFI_LINKOVERLAY)
387 FIXME("set icon to link, stub\n");
389 if (flags & SHGFI_SELECTED)
390 FIXME("set icon to selected, stub\n");
392 if (flags & SHGFI_SHELLICONSIZE)
393 FIXME("set icon to shell size, stub\n");
395 /* get the iconlocation */
396 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
399 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
403 hr = IExtractIconW_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
404 psfi->iIcon = iIndex;
406 if(uFlags != GIL_NOTFILENAME)
407 lstrcpyW (psfi->szDisplayName, szLocation);
411 IExtractIconA_Release(pei);
415 /* get icon index (or load icon)*/
416 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
419 if (flags & SHGFI_USEFILEATTRIBUTES)
421 WCHAR sTemp [MAX_PATH];
425 lstrcpynW(sTemp, szFullPath, MAX_PATH);
427 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
431 WCHAR p1W[] = {'%','1',0};
433 szExt = (LPWSTR) PathFindExtensionW(sTemp);
434 if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE)
435 && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &dwNr))
437 if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
438 strcpyW(sTemp, szFullPath);
440 if (flags & SHGFI_SYSICONINDEX)
442 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
443 if (psfi->iIcon == -1) psfi->iIcon = 0;
447 IconNotYetLoaded=FALSE;
448 PrivateExtractIconsW(sTemp,dwNr,(flags & SHGFI_SMALLICON) ?
449 GetSystemMetrics(SM_CXSMICON) : GetSystemMetrics(SM_CXICON),
450 (flags & SHGFI_SMALLICON) ? GetSystemMetrics(SM_CYSMICON) :
451 GetSystemMetrics(SM_CYICON), &psfi->hIcon,0,1,0);
459 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
460 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
467 ret = (DWORD) ((flags & SHGFI_SMALLICON) ? ShellSmallIconList : ShellBigIconList);
472 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
473 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_SMALLICON) ? ShellSmallIconList:ShellBigIconList, psfi->iIcon, ILD_NORMAL);
475 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
476 FIXME("unknown attribute!\n");
479 IShellFolder_Release(psfParent);
484 if(pidlLast) SHFree(pidlLast);
486 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
487 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
492 /*************************************************************************
493 * SHGetFileInfoW [SHELL32.@]
496 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
497 SHFILEINFOA *psfi, UINT sizeofpsfi,
503 SHFILEINFOW temppsfi;
505 if (flags & SHGFI_PIDL) {
506 /* path contains a pidl */
507 temppath = (LPWSTR) path;
509 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
510 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
511 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
514 if(psfi && (flags & SHGFI_ATTR_SPECIFIED))
515 temppsfi.dwAttributes=psfi->dwAttributes;
517 ret = SHGetFileInfoW(temppath, dwFileAttributes, (psfi == NULL)? NULL : &temppsfi, sizeof(temppsfi), flags);
521 if(flags & SHGFI_ICON)
522 psfi->hIcon=temppsfi.hIcon;
523 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
524 psfi->iIcon=temppsfi.iIcon;
525 if(flags & SHGFI_ATTRIBUTES)
526 psfi->dwAttributes=temppsfi.dwAttributes;
527 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
528 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1, psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
529 if(flags & SHGFI_TYPENAME)
530 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
532 if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
536 /*************************************************************************
537 * SHGetFileInfo [SHELL32.@]
539 DWORD WINAPI SHGetFileInfoAW(
541 DWORD dwFileAttributes,
546 if(SHELL_OsIsUnicode())
547 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
548 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
551 /*************************************************************************
552 * DuplicateIcon [SHELL32.@]
554 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
559 TRACE("(%p, %p)\n", hInstance, hIcon);
561 if(GetIconInfo(hIcon, &IconInfo))
563 hDupIcon = CreateIconIndirect(&IconInfo);
565 /* clean up hbmMask and hbmColor */
566 DeleteObject(IconInfo.hbmMask);
567 DeleteObject(IconInfo.hbmColor);
573 /*************************************************************************
574 * ExtractIconA [SHELL32.@]
576 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
579 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
580 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
582 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
584 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
585 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
586 HeapFree(GetProcessHeap(), 0, lpwstrFile);
590 /*************************************************************************
591 * ExtractIconW [SHELL32.@]
593 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
597 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
599 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
601 if (nIconIndex == 0xFFFFFFFF) {
602 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
603 if (ret != 0xFFFFFFFF && ret)
608 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
610 if (ret == 0xFFFFFFFF)
612 else if (ret > 0 && hIcon)
620 LPCWSTR szOtherStuff;
624 #define IDC_STATIC_TEXT 100
625 #define IDC_LISTBOX 99
626 #define IDC_WINE_TEXT 98
628 #define DROP_FIELD_TOP (-15)
629 #define DROP_FIELD_HEIGHT 15
631 static HFONT hIconTitleFont;
633 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
634 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
636 { GetWindowRect( hWndCtl, lprect );
637 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
638 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
644 /*************************************************************************
645 * SHAppBarMessage [SHELL32.@]
647 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
649 int width=data->rc.right - data->rc.left;
650 int height=data->rc.bottom - data->rc.top;
654 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
655 case ABM_GETTASKBARPOS:
656 GetWindowRect(data->hWnd, &rec);
660 SetActiveWindow(data->hWnd);
662 case ABM_GETAUTOHIDEBAR:
663 data->hWnd=GetActiveWindow();
666 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
667 width,height,SWP_SHOWWINDOW);
670 GetWindowRect(data->hWnd, &(data->rc));
673 FIXME("ABM_REMOVE broken\n");
674 /* FIXME: this is wrong; should it be DestroyWindow instead? */
675 /*CloseHandle(data->hWnd);*/
677 case ABM_SETAUTOHIDEBAR:
678 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
679 width,height,SWP_SHOWWINDOW);
682 data->uEdge=(ABE_RIGHT | ABE_LEFT);
683 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
684 width,height,SWP_SHOWWINDOW);
686 case ABM_WINDOWPOSCHANGED:
692 /*************************************************************************
693 * SHHelpShortcuts_RunDLL [SHELL32.@]
696 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
697 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
698 dwArg1, dwArg2, dwArg3, dwArg4);
703 /*************************************************************************
704 * SHLoadInProc [SHELL32.@]
705 * Create an instance of specified object class from within
706 * the shell process and release it immediately
709 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
713 TRACE("%s\n", debugstr_guid(rclsid));
715 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
718 IUnknown * pUnk = ptr;
719 IUnknown_Release(pUnk);
722 return DISP_E_MEMBERNOTFOUND;
725 /*************************************************************************
726 * AboutDlgProc (internal)
728 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
739 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
740 WCHAR Template[512], AppTitle[512];
744 const char* const *pstr = SHELL_Authors;
745 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
746 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
747 sprintfW( AppTitle, Template, info->szApp );
748 SetWindowTextW( hWnd, AppTitle );
749 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
750 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
751 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
755 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
756 hIconTitleFont = CreateFontIndirectW( &logFont );
758 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)hIconTitleFont, 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,
844 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", (LPSTR)RT_DIALOG)))
846 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
849 info.szOtherStuff = szOtherStuff;
850 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
851 return DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW( hWnd, GWL_HINSTANCE ),
852 template, hWnd, AboutDlgProc, (LPARAM)&info );
855 /*************************************************************************
856 * FreeIconList (SHELL32.@)
858 void WINAPI FreeIconList( DWORD dw )
859 { FIXME("(%lx): stub\n",dw);
862 /***********************************************************************
863 * DllGetVersion [SHELL32.@]
865 * Retrieves version information of the 'SHELL32.DLL'
868 * pdvi [O] pointer to version information structure.
872 * Failure: E_INVALIDARG
875 * Returns version of a shell32.dll from IE4.01 SP1.
878 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
880 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
882 WARN("wrong DLLVERSIONINFO size from app\n");
886 pdvi->dwMajorVersion = 4;
887 pdvi->dwMinorVersion = 72;
888 pdvi->dwBuildNumber = 3110;
889 pdvi->dwPlatformID = 1;
891 TRACE("%lu.%lu.%lu.%lu\n",
892 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
893 pdvi->dwBuildNumber, pdvi->dwPlatformID);
897 /*************************************************************************
898 * global variables of the shell32.dll
899 * all are once per process
902 HINSTANCE shell32_hInstance = 0;
903 HIMAGELIST ShellSmallIconList = 0;
904 HIMAGELIST ShellBigIconList = 0;
907 /*************************************************************************
911 * calling oleinitialize here breaks sone apps.
914 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
916 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
920 case DLL_PROCESS_ATTACH:
921 shell32_hInstance = hinstDLL;
922 DisableThreadLibraryCalls(shell32_hInstance);
924 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
925 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
927 InitCommonControlsEx(NULL);
931 InitChangeNotifications();
934 case DLL_PROCESS_DETACH:
935 shell32_hInstance = 0;
937 FreeChangeNotifications();
943 /*************************************************************************
944 * DllInstall [SHELL32.@]
948 * BOOL bInstall - TRUE for install, FALSE for uninstall
949 * LPCWSTR pszCmdLine - command line (unused by shell32?)
952 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
954 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
956 return S_OK; /* indicate success */
959 /***********************************************************************
960 * DllCanUnloadNow (SHELL32.@)
962 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
964 FIXME("(void): stub\n");