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
42 #include "undocshell.h"
44 #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);
99 while (GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0) {
101 hargv=GlobalReAlloc(hargv, size, 0);
102 argv=GlobalLock(hargv);
104 argv[0]=(LPWSTR)(argv+1);
111 /* to get a writeable copy */
117 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
120 /* skip the remaining spaces */
121 while (*cs==0x0009 || *cs==0x0020) {
128 } else if (*cs==0x005c) {
129 /* '\', count them */
131 } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
133 in_quotes=!in_quotes;
136 /* a regular character */
141 /* Allocate in a single lump, the string array, and the strings that go with it.
142 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
144 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
145 argv=GlobalLock(hargv);
148 cmdline=(LPWSTR)(argv+argc);
149 strcpyW(cmdline, lpCmdline);
156 if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
157 /* Close the argument and copy it */
161 /* skip the remaining spaces */
164 } while (*s==0x0009 || *s==0x0020);
166 /* Start with a new argument */
169 } else if (*s==0x005c) {
173 } else if (*s==0x0022) {
175 if ((bcount & 1)==0) {
176 /* Preceeded by an even number of '\', this is half that
177 * number of '\', plus a quote which we erase.
180 in_quotes=!in_quotes;
183 /* Preceeded by an odd number of '\', this is half that
184 * number of '\' followed by a '"'
192 /* a regular character */
207 /*************************************************************************
208 * SHGetFileInfoA [SHELL32.@]
212 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
213 SHFILEINFOA *psfi, UINT sizeofpsfi,
216 char szLocation[MAX_PATH], szFullPath[MAX_PATH];
218 DWORD ret = TRUE, dwAttributes = 0;
219 IShellFolder * psfParent = NULL;
220 IExtractIconA * pei = NULL;
221 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
223 BOOL IconNotYetLoaded=TRUE;
225 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
226 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
228 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
231 /* windows initializes this values regardless of the flags */
233 psfi->szDisplayName[0] = '\0';
234 psfi->szTypeName[0] = '\0';
238 if (!(flags & SHGFI_PIDL)){
239 /* SHGitFileInfo should work with absolute and relative paths */
240 if (PathIsRelativeA(path)){
241 GetCurrentDirectoryA(MAX_PATH, szLocation);
242 PathCombineA(szFullPath, szLocation, path);
244 lstrcpynA(szFullPath, path, MAX_PATH);
248 if (flags & SHGFI_EXETYPE) {
252 IMAGE_DOS_HEADER mz_header;
257 if (flags != SHGFI_EXETYPE) return 0;
259 status = GetBinaryTypeA (szFullPath, &BinaryType);
260 if (!status) return 0;
261 if ((BinaryType == SCS_DOS_BINARY)
262 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
264 hfile = CreateFileA( szFullPath, GENERIC_READ, FILE_SHARE_READ,
265 NULL, OPEN_EXISTING, 0, 0 );
266 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
268 /* The next section is adapted from MODULE_GetBinaryType, as we need
269 * to examine the image header to get OS and version information. We
270 * know from calling GetBinaryTypeA that the image is valid and either
271 * an NE or PE, so much error handling can be omitted.
272 * Seek to the start of the file and read the header information.
275 SetFilePointer( hfile, 0, NULL, SEEK_SET );
276 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
278 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
279 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
280 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
282 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
283 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
284 CloseHandle( hfile );
285 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
286 return IMAGE_NT_SIGNATURE
287 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
288 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
290 return IMAGE_NT_SIGNATURE;
292 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
295 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
296 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
297 CloseHandle( hfile );
298 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
299 | (ne.ne_expver << 16);
302 CloseHandle( hfile );
306 /* psfi is NULL normally to query EXE type. If it is NULL, none of the
307 * below makes sense anyway. Windows allows this and just returns FALSE */
308 if (psfi == NULL) return FALSE;
310 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
312 The pidl functions fail on not existing file names */
314 if (flags & SHGFI_PIDL) {
315 pidl = ILClone((LPCITEMIDLIST)path);
316 } else if (!(flags & SHGFI_USEFILEATTRIBUTES)) {
317 hr = SHILCreateFromPathA(szFullPath, &pidl, &dwAttributes);
320 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
322 /* get the parent shellfolder */
324 hr = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, (LPCITEMIDLIST*)&pidlLast);
327 ERR("pidl is null!\n");
332 /* get the attributes of the child */
333 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
335 if (!(flags & SHGFI_ATTR_SPECIFIED))
337 psfi->dwAttributes = 0xffffffff;
339 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, &(psfi->dwAttributes));
342 /* get the displayname */
343 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
345 if (flags & SHGFI_USEFILEATTRIBUTES)
347 strcpy (psfi->szDisplayName, PathFindFileNameA(szFullPath));
352 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
353 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
357 /* get the type name */
358 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
360 if (!(flags & SHGFI_USEFILEATTRIBUTES))
361 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
364 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
365 strcat (psfi->szTypeName, "File");
369 strcpy(sTemp,PathFindExtensionA(szFullPath));
370 if (!( HCR_MapTypeToValueA(sTemp, sTemp, 64, TRUE)
371 && HCR_MapTypeToValueA(sTemp, psfi->szTypeName, 80, FALSE )))
373 lstrcpynA (psfi->szTypeName, sTemp, 64);
374 strcat (psfi->szTypeName, "-file");
381 if (flags & SHGFI_LINKOVERLAY)
382 FIXME("set icon to link, stub\n");
384 if (flags & SHGFI_SELECTED)
385 FIXME("set icon to selected, stub\n");
387 if (flags & SHGFI_SHELLICONSIZE)
388 FIXME("set icon to shell size, stub\n");
390 /* get the iconlocation */
391 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
394 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
398 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
399 psfi->iIcon = iIndex;
401 if(uFlags != GIL_NOTFILENAME)
402 strcpy (psfi->szDisplayName, szLocation);
406 IExtractIconA_Release(pei);
410 /* get icon index (or load icon)*/
411 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
414 if (flags & SHGFI_USEFILEATTRIBUTES)
416 char sTemp [MAX_PATH];
420 lstrcpynA(sTemp, szFullPath, MAX_PATH);
422 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
427 szExt = (LPSTR) PathFindExtensionA(sTemp);
428 if ( szExt && HCR_MapTypeToValueA(szExt, sTemp, MAX_PATH, TRUE)
429 && HCR_GetDefaultIconA(sTemp, sTemp, MAX_PATH, &dwNr))
431 if (!strcmp("%1",sTemp)) /* icon is in the file */
432 strcpy(sTemp, szFullPath);
434 if (flags & SHGFI_SYSICONINDEX)
436 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
437 if (psfi->iIcon == -1) psfi->iIcon = 0;
441 IconNotYetLoaded=FALSE;
442 PrivateExtractIconsA(sTemp,dwNr,(flags & SHGFI_SMALLICON) ?
443 GetSystemMetrics(SM_CXSMICON) : GetSystemMetrics(SM_CXICON),
444 (flags & SHGFI_SMALLICON) ? GetSystemMetrics(SM_CYSMICON) :
445 GetSystemMetrics(SM_CYICON), &psfi->hIcon,0,1,0);
453 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
454 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
461 ret = (DWORD) ((flags & SHGFI_SMALLICON) ? ShellSmallIconList : ShellBigIconList);
466 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
467 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_SMALLICON) ? ShellSmallIconList:ShellBigIconList, psfi->iIcon, ILD_NORMAL);
469 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
470 FIXME("unknown attribute!\n");
473 IShellFolder_Release(psfParent);
478 if(pidlLast) SHFree(pidlLast);
480 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
481 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
486 /*************************************************************************
487 * SHGetFileInfoW [SHELL32.@]
490 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
491 SHFILEINFOW *psfi, UINT sizeofpsfi,
497 SHFILEINFOA temppsfi;
499 if (flags & SHGFI_PIDL) {
500 /* path contains a pidl */
501 temppath = (LPSTR) path;
503 len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
504 temppath = HeapAlloc(GetProcessHeap(), 0, len);
505 WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
508 if(psfi && (flags & SHGFI_ATTR_SPECIFIED))
509 temppsfi.dwAttributes=psfi->dwAttributes;
511 ret = SHGetFileInfoA(temppath, dwFileAttributes, (psfi == NULL)? NULL : &temppsfi, sizeof(temppsfi), flags);
515 if(flags & SHGFI_ICON)
516 psfi->hIcon=temppsfi.hIcon;
517 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
518 psfi->iIcon=temppsfi.iIcon;
519 if(flags & SHGFI_ATTRIBUTES)
520 psfi->dwAttributes=temppsfi.dwAttributes;
521 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
522 MultiByteToWideChar(CP_ACP, 0, temppsfi.szDisplayName, -1, psfi->szDisplayName, sizeof(psfi->szDisplayName));
523 if(flags & SHGFI_TYPENAME)
524 MultiByteToWideChar(CP_ACP, 0, temppsfi.szTypeName, -1, psfi->szTypeName, sizeof(psfi->szTypeName));
526 if(!(flags & SHGFI_PIDL)) HeapFree(GetProcessHeap(), 0, temppath);
530 /*************************************************************************
531 * SHGetFileInfo [SHELL32.@]
533 DWORD WINAPI SHGetFileInfoAW(
535 DWORD dwFileAttributes,
540 if(SHELL_OsIsUnicode())
541 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
542 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
545 /*************************************************************************
546 * DuplicateIcon [SHELL32.@]
548 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
553 TRACE("(%p, %p)\n", hInstance, hIcon);
555 if(GetIconInfo(hIcon, &IconInfo))
557 hDupIcon = CreateIconIndirect(&IconInfo);
559 /* clean up hbmMask and hbmColor */
560 DeleteObject(IconInfo.hbmMask);
561 DeleteObject(IconInfo.hbmColor);
567 /*************************************************************************
568 * ExtractIconA [SHELL32.@]
570 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
573 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
574 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
576 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
578 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
579 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
580 HeapFree(GetProcessHeap(), 0, lpwstrFile);
584 /*************************************************************************
585 * ExtractIconW [SHELL32.@]
587 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
591 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
593 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
595 if (nIconIndex == 0xFFFFFFFF) {
596 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
597 if (ret != 0xFFFFFFFF && ret)
602 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
604 if (ret == 0xFFFFFFFF)
606 else if (ret > 0 && hIcon)
614 LPCWSTR szOtherStuff;
618 #define IDC_STATIC_TEXT 100
619 #define IDC_LISTBOX 99
620 #define IDC_WINE_TEXT 98
622 #define DROP_FIELD_TOP (-15)
623 #define DROP_FIELD_HEIGHT 15
625 static HFONT hIconTitleFont;
627 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
628 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
630 { GetWindowRect( hWndCtl, lprect );
631 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
632 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
638 /*************************************************************************
639 * SHAppBarMessage [SHELL32.@]
641 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
643 int width=data->rc.right - data->rc.left;
644 int height=data->rc.bottom - data->rc.top;
648 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
649 case ABM_GETTASKBARPOS:
650 GetWindowRect(data->hWnd, &rec);
654 SetActiveWindow(data->hWnd);
656 case ABM_GETAUTOHIDEBAR:
657 data->hWnd=GetActiveWindow();
660 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
661 width,height,SWP_SHOWWINDOW);
664 GetWindowRect(data->hWnd, &(data->rc));
667 FIXME("ABM_REMOVE broken\n");
668 /* FIXME: this is wrong; should it be DestroyWindow instead? */
669 /*CloseHandle(data->hWnd);*/
671 case ABM_SETAUTOHIDEBAR:
672 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
673 width,height,SWP_SHOWWINDOW);
676 data->uEdge=(ABE_RIGHT | ABE_LEFT);
677 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
678 width,height,SWP_SHOWWINDOW);
680 case ABM_WINDOWPOSCHANGED:
686 /*************************************************************************
687 * SHHelpShortcuts_RunDLL [SHELL32.@]
690 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
691 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
692 dwArg1, dwArg2, dwArg3, dwArg4);
697 /*************************************************************************
698 * SHLoadInProc [SHELL32.@]
699 * Create an instance of specified object class from within
700 * the shell process and release it immediately
703 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
707 TRACE("%s\n", debugstr_guid(rclsid));
709 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
712 IUnknown * pUnk = ptr;
713 IUnknown_Release(pUnk);
716 return DISP_E_MEMBERNOTFOUND;
719 /*************************************************************************
720 * AboutDlgProc (internal)
722 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
733 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
734 WCHAR Template[512], AppTitle[512];
738 const char* const *pstr = SHELL_Authors;
739 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
740 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
741 sprintfW( AppTitle, Template, info->szApp );
742 SetWindowTextW( hWnd, AppTitle );
743 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT), info->szOtherStuff );
744 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
745 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
749 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
750 hIconTitleFont = CreateFontIndirectW( &logFont );
752 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)hIconTitleFont, 0 );
756 /* authors list is in iso-8859-1 format */
757 MultiByteToWideChar( 28591, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
758 SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name );
761 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
769 HDC hDC = BeginPaint( hWnd, &ps );
771 if( __get_dropline( hWnd, &rect ) ) {
772 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
773 MoveToEx( hDC, rect.left, rect.top, NULL );
774 LineTo( hDC, rect.right, rect.bottom );
776 EndPaint( hWnd, &ps );
781 if (wParam == IDOK || wParam == IDCANCEL)
783 EndDialog(hWnd, TRUE);
788 EndDialog(hWnd, TRUE);
796 /*************************************************************************
797 * ShellAboutA [SHELL32.288]
799 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
801 UNICODE_STRING appW, otherW;
804 RtlCreateUnicodeStringFromAsciiz( &appW, szApp );
805 RtlCreateUnicodeStringFromAsciiz( &otherW, szOtherStuff );
806 ret = ShellAboutW( hWnd, appW.Buffer, otherW.Buffer, hIcon );
807 RtlFreeUnicodeString( &appW );
808 RtlFreeUnicodeString( &otherW );
813 /*************************************************************************
814 * ShellAboutW [SHELL32.289]
816 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
825 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", (LPSTR)RT_DIALOG)))
827 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
830 info.szOtherStuff = szOtherStuff;
831 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
832 return DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW( hWnd, GWL_HINSTANCE ),
833 template, hWnd, AboutDlgProc, (LPARAM)&info );
836 /*************************************************************************
837 * FreeIconList (SHELL32.@)
839 void WINAPI FreeIconList( DWORD dw )
840 { FIXME("(%lx): stub\n",dw);
843 /***********************************************************************
844 * DllGetVersion [SHELL32.@]
846 * Retrieves version information of the 'SHELL32.DLL'
849 * pdvi [O] pointer to version information structure.
853 * Failure: E_INVALIDARG
856 * Returns version of a shell32.dll from IE4.01 SP1.
859 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
861 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
863 WARN("wrong DLLVERSIONINFO size from app\n");
867 pdvi->dwMajorVersion = 4;
868 pdvi->dwMinorVersion = 72;
869 pdvi->dwBuildNumber = 3110;
870 pdvi->dwPlatformID = 1;
872 TRACE("%lu.%lu.%lu.%lu\n",
873 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
874 pdvi->dwBuildNumber, pdvi->dwPlatformID);
878 /*************************************************************************
879 * global variables of the shell32.dll
880 * all are once per process
883 void (WINAPI *pDLLInitComctl)(LPVOID);
885 static HINSTANCE hComctl32;
887 HINSTANCE shell32_hInstance = 0;
888 HIMAGELIST ShellSmallIconList = 0;
889 HIMAGELIST ShellBigIconList = 0;
892 /*************************************************************************
896 * calling oleinitialize here breaks sone apps.
899 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
901 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
905 case DLL_PROCESS_ATTACH:
906 shell32_hInstance = hinstDLL;
908 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
909 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
910 WideCharToMultiByte(CP_ACP, 0, swShell32Name, -1, sShell32Name, MAX_PATH, NULL, NULL);
912 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
913 DisableThreadLibraryCalls(shell32_hInstance);
917 ERR("P A N I C SHELL32 loading failed\n");
922 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
923 /* initialize the common controls */
926 pDLLInitComctl(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");