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 SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
212 SHFILEINFOA *psfi, UINT sizeofpsfi,
215 char szLocation[MAX_PATH], szFullPath[MAX_PATH];
217 DWORD ret = TRUE, dwAttributes = 0;
218 IShellFolder * psfParent = NULL;
219 IExtractIconA * 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" : 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 (PathIsRelativeA(path)){
240 GetCurrentDirectoryA(MAX_PATH, szLocation);
241 PathCombineA(szFullPath, szLocation, path);
243 lstrcpynA(szFullPath, path, MAX_PATH);
247 if (flags & SHGFI_EXETYPE) {
251 IMAGE_DOS_HEADER mz_header;
256 if (flags != SHGFI_EXETYPE) return 0;
258 status = GetBinaryTypeA (szFullPath, &BinaryType);
259 if (!status) return 0;
260 if ((BinaryType == SCS_DOS_BINARY)
261 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
263 hfile = CreateFileA( 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 = SHILCreateFromPathA(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 strcpy (psfi->szDisplayName, PathFindFileNameA(szFullPath));
351 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
352 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
356 /* get the type name */
357 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
359 if (!(flags & SHGFI_USEFILEATTRIBUTES))
360 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
363 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
364 strcat (psfi->szTypeName, "File");
368 strcpy(sTemp,PathFindExtensionA(szFullPath));
369 if (!( HCR_MapTypeToValueA(sTemp, sTemp, 64, TRUE)
370 && HCR_MapTypeToValueA(sTemp, psfi->szTypeName, 80, FALSE )))
372 lstrcpynA (psfi->szTypeName, sTemp, 64);
373 strcat (psfi->szTypeName, "-file");
380 if (flags & SHGFI_LINKOVERLAY)
381 FIXME("set icon to link, stub\n");
383 if (flags & SHGFI_SELECTED)
384 FIXME("set icon to selected, stub\n");
386 if (flags & SHGFI_SHELLICONSIZE)
387 FIXME("set icon to shell size, stub\n");
389 /* get the iconlocation */
390 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
393 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
397 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
398 psfi->iIcon = iIndex;
400 if(uFlags != GIL_NOTFILENAME)
401 strcpy (psfi->szDisplayName, szLocation);
405 IExtractIconA_Release(pei);
409 /* get icon index (or load icon)*/
410 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
413 if (flags & SHGFI_USEFILEATTRIBUTES)
415 char sTemp [MAX_PATH];
419 lstrcpynA(sTemp, szFullPath, MAX_PATH);
421 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
426 szExt = (LPSTR) PathFindExtensionA(sTemp);
427 if ( szExt && HCR_MapTypeToValueA(szExt, sTemp, MAX_PATH, TRUE)
428 && HCR_GetDefaultIconA(sTemp, sTemp, MAX_PATH, &dwNr))
430 if (!strcmp("%1",sTemp)) /* icon is in the file */
431 strcpy(sTemp, szFullPath);
433 if (flags & SHGFI_SYSICONINDEX)
435 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
436 if (psfi->iIcon == -1) psfi->iIcon = 0;
440 IconNotYetLoaded=FALSE;
441 PrivateExtractIconsA(sTemp,dwNr,(flags & SHGFI_SMALLICON) ?
442 GetSystemMetrics(SM_CXSMICON) : GetSystemMetrics(SM_CXICON),
443 (flags & SHGFI_SMALLICON) ? GetSystemMetrics(SM_CYSMICON) :
444 GetSystemMetrics(SM_CYICON), &psfi->hIcon,0,1,0);
452 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
453 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
460 ret = (DWORD) ((flags & SHGFI_SMALLICON) ? ShellSmallIconList : ShellBigIconList);
465 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
466 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_SMALLICON) ? ShellSmallIconList:ShellBigIconList, psfi->iIcon, ILD_NORMAL);
468 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
469 FIXME("unknown attribute!\n");
472 IShellFolder_Release(psfParent);
477 if(pidlLast) SHFree(pidlLast);
479 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
480 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
485 /*************************************************************************
486 * SHGetFileInfoW [SHELL32.@]
489 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
490 SHFILEINFOW *psfi, UINT sizeofpsfi,
496 SHFILEINFOA temppsfi;
498 if (flags & SHGFI_PIDL) {
499 /* path contains a pidl */
500 temppath = (LPSTR) path;
502 len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
503 temppath = HeapAlloc(GetProcessHeap(), 0, len);
504 WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
507 if(psfi && (flags & SHGFI_ATTR_SPECIFIED))
508 temppsfi.dwAttributes=psfi->dwAttributes;
510 ret = SHGetFileInfoA(temppath, dwFileAttributes, (psfi == NULL)? NULL : &temppsfi, sizeof(temppsfi), flags);
514 if(flags & SHGFI_ICON)
515 psfi->hIcon=temppsfi.hIcon;
516 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
517 psfi->iIcon=temppsfi.iIcon;
518 if(flags & SHGFI_ATTRIBUTES)
519 psfi->dwAttributes=temppsfi.dwAttributes;
520 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
521 MultiByteToWideChar(CP_ACP, 0, temppsfi.szDisplayName, -1, psfi->szDisplayName, sizeof(psfi->szDisplayName));
522 if(flags & SHGFI_TYPENAME)
523 MultiByteToWideChar(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName));
525 if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
529 /*************************************************************************
530 * SHGetFileInfo [SHELL32.@]
532 DWORD WINAPI SHGetFileInfoAW(
534 DWORD dwFileAttributes,
539 if(SHELL_OsIsUnicode())
540 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
541 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
544 /*************************************************************************
545 * DuplicateIcon [SHELL32.@]
547 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
552 TRACE("(%p, %p)\n", hInstance, hIcon);
554 if(GetIconInfo(hIcon, &IconInfo))
556 hDupIcon = CreateIconIndirect(&IconInfo);
558 /* clean up hbmMask and hbmColor */
559 DeleteObject(IconInfo.hbmMask);
560 DeleteObject(IconInfo.hbmColor);
566 /*************************************************************************
567 * ExtractIconA [SHELL32.@]
569 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
572 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
573 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
575 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
577 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
578 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
579 HeapFree(GetProcessHeap(), 0, lpwstrFile);
583 /*************************************************************************
584 * ExtractIconW [SHELL32.@]
586 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
590 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
592 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
594 if (nIconIndex == 0xFFFFFFFF) {
595 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
596 if (ret != 0xFFFFFFFF && ret)
601 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
603 if (ret == 0xFFFFFFFF)
605 else if (ret > 0 && hIcon)
613 LPCWSTR szOtherStuff;
617 #define IDC_STATIC_TEXT 100
618 #define IDC_LISTBOX 99
619 #define IDC_WINE_TEXT 98
621 #define DROP_FIELD_TOP (-15)
622 #define DROP_FIELD_HEIGHT 15
624 static HFONT hIconTitleFont;
626 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
627 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
629 { GetWindowRect( hWndCtl, lprect );
630 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
631 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
637 /*************************************************************************
638 * SHAppBarMessage [SHELL32.@]
640 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
642 int width=data->rc.right - data->rc.left;
643 int height=data->rc.bottom - data->rc.top;
647 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
648 case ABM_GETTASKBARPOS:
649 GetWindowRect(data->hWnd, &rec);
653 SetActiveWindow(data->hWnd);
655 case ABM_GETAUTOHIDEBAR:
656 data->hWnd=GetActiveWindow();
659 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
660 width,height,SWP_SHOWWINDOW);
663 GetWindowRect(data->hWnd, &(data->rc));
666 FIXME("ABM_REMOVE broken\n");
667 /* FIXME: this is wrong; should it be DestroyWindow instead? */
668 /*CloseHandle(data->hWnd);*/
670 case ABM_SETAUTOHIDEBAR:
671 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
672 width,height,SWP_SHOWWINDOW);
675 data->uEdge=(ABE_RIGHT | ABE_LEFT);
676 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
677 width,height,SWP_SHOWWINDOW);
679 case ABM_WINDOWPOSCHANGED:
685 /*************************************************************************
686 * SHHelpShortcuts_RunDLL [SHELL32.@]
689 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
690 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
691 dwArg1, dwArg2, dwArg3, dwArg4);
696 /*************************************************************************
697 * SHLoadInProc [SHELL32.@]
698 * Create an instance of specified object class from within
699 * the shell process and release it immediately
702 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
706 TRACE("%s\n", debugstr_guid(rclsid));
708 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
711 IUnknown * pUnk = ptr;
712 IUnknown_Release(pUnk);
715 return DISP_E_MEMBERNOTFOUND;
718 /*************************************************************************
719 * AboutDlgProc (internal)
721 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
732 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
733 WCHAR Template[512], AppTitle[512];
737 const char* const *pstr = SHELL_Authors;
738 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
739 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
740 sprintfW( AppTitle, Template, info->szApp );
741 SetWindowTextW( hWnd, AppTitle );
742 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
743 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
744 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
748 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
749 hIconTitleFont = CreateFontIndirectW( &logFont );
751 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)hIconTitleFont, 0 );
755 /* authors list is in iso-8859-1 format */
756 MultiByteToWideChar( 28591, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
757 SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name );
760 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
768 HDC hDC = BeginPaint( hWnd, &ps );
770 if( __get_dropline( hWnd, &rect ) ) {
771 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
772 MoveToEx( hDC, rect.left, rect.top, NULL );
773 LineTo( hDC, rect.right, rect.bottom );
775 EndPaint( hWnd, &ps );
780 if (wParam == IDOK || wParam == IDCANCEL)
782 EndDialog(hWnd, TRUE);
787 EndDialog(hWnd, TRUE);
795 /*************************************************************************
796 * ShellAboutA [SHELL32.288]
798 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
801 LPWSTR appW = NULL, otherW = NULL;
806 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
807 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
808 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
812 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
813 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
814 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
817 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
819 if (otherW) HeapFree(GetProcessHeap(), 0, otherW);
820 if (appW) HeapFree(GetProcessHeap(), 0, appW);
825 /*************************************************************************
826 * ShellAboutW [SHELL32.289]
828 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
837 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", (LPSTR)RT_DIALOG)))
839 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
842 info.szOtherStuff = szOtherStuff;
843 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
844 return DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW( hWnd, GWL_HINSTANCE ),
845 template, hWnd, AboutDlgProc, (LPARAM)&info );
848 /*************************************************************************
849 * FreeIconList (SHELL32.@)
851 void WINAPI FreeIconList( DWORD dw )
852 { FIXME("(%lx): stub\n",dw);
855 /***********************************************************************
856 * DllGetVersion [SHELL32.@]
858 * Retrieves version information of the 'SHELL32.DLL'
861 * pdvi [O] pointer to version information structure.
865 * Failure: E_INVALIDARG
868 * Returns version of a shell32.dll from IE4.01 SP1.
871 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
873 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
875 WARN("wrong DLLVERSIONINFO size from app\n");
879 pdvi->dwMajorVersion = 4;
880 pdvi->dwMinorVersion = 72;
881 pdvi->dwBuildNumber = 3110;
882 pdvi->dwPlatformID = 1;
884 TRACE("%lu.%lu.%lu.%lu\n",
885 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
886 pdvi->dwBuildNumber, pdvi->dwPlatformID);
890 /*************************************************************************
891 * global variables of the shell32.dll
892 * all are once per process
895 HINSTANCE shell32_hInstance = 0;
896 HIMAGELIST ShellSmallIconList = 0;
897 HIMAGELIST ShellBigIconList = 0;
900 /*************************************************************************
904 * calling oleinitialize here breaks sone apps.
907 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
909 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
913 case DLL_PROCESS_ATTACH:
914 shell32_hInstance = hinstDLL;
915 DisableThreadLibraryCalls(shell32_hInstance);
917 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
918 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
919 WideCharToMultiByte(CP_ACP, 0, swShell32Name, -1, sShell32Name, MAX_PATH, NULL, NULL);
921 InitCommonControlsEx(NULL);
925 InitChangeNotifications();
928 case DLL_PROCESS_DETACH:
929 shell32_hInstance = 0;
931 FreeChangeNotifications();
937 /*************************************************************************
938 * DllInstall [SHELL32.@]
942 * BOOL bInstall - TRUE for install, FALSE for uninstall
943 * LPCWSTR pszCmdLine - command line (unused by shell32?)
946 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
948 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
950 return S_OK; /* indicate success */
953 /***********************************************************************
954 * DllCanUnloadNow (SHELL32.@)
956 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
958 FIXME("(void): stub\n");