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
37 #include "undocshell.h"
38 #include "wine/winuser16.h"
42 #include "shell32_main.h"
44 #include "wine/debug.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(shell);
49 /*************************************************************************
50 * CommandLineToArgvW [SHELL32.@]
52 * We must interpret the quotes in the command line to rebuild the argv
54 * - arguments are separated by spaces or tabs
55 * - quotes serve as optional argument delimiters
57 * - escaped quotes must be converted back to '"'
59 * - an odd number of '\'s followed by '"' correspond to half that number
60 * of '\' followed by a '"' (extension of the above)
63 * - an even number of '\'s followed by a '"' correspond to half that number
64 * of '\', plus a regular quote serving as an argument delimiter (which
65 * means it does not appear in the result)
66 * 'a\\"b c"' -> 'a\b c'
67 * 'a\\\\"b c"' -> 'a\\b c'
68 * - '\' that are not followed by a '"' are copied literally
78 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
89 /* Return the path to the executable */
96 hargv=GlobalReAlloc(hargv, size, 0);
97 argv=GlobalLock(hargv);
98 } while (GetModuleFileNameW((HMODULE)0, (LPWSTR)(argv+1), size-sizeof(LPWSTR)) == 0);
99 argv[0]=(LPWSTR)(argv+1);
106 /* to get a writeable copy */
112 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes)) {
115 /* skip the remaining spaces */
116 while (*cs==0x0009 || *cs==0x0020) {
123 } else if (*cs==0x005c) {
124 /* '\', count them */
126 } else if ((*cs==0x0022) && ((bcount & 1)==0)) {
128 in_quotes=!in_quotes;
131 /* a regular character */
136 /* Allocate in a single lump, the string array, and the strings that go with it.
137 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
139 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
140 argv=GlobalLock(hargv);
143 cmdline=(LPWSTR)(argv+argc);
144 strcpyW(cmdline, lpCmdline);
151 if ((*s==0x0009 || *s==0x0020) && !in_quotes) {
152 /* Close the argument and copy it */
156 /* skip the remaining spaces */
159 } while (*s==0x0009 || *s==0x0020);
161 /* Start with a new argument */
164 } else if (*s==0x005c) {
168 } else if (*s==0x0022) {
170 if ((bcount & 1)==0) {
171 /* Preceeded by an even number of '\', this is half that
172 * number of '\', plus a quote which we erase.
175 in_quotes=!in_quotes;
178 /* Preceeded by an odd number of '\', this is half that
179 * number of '\' followed by a '"'
187 /* a regular character */
202 /*************************************************************************
203 * SHGetFileInfoA [SHELL32.@]
207 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
208 SHFILEINFOA *psfi, UINT sizeofpsfi,
211 char szLoaction[MAX_PATH];
213 DWORD ret = TRUE, dwAttributes = 0;
214 IShellFolder * psfParent = NULL;
215 IExtractIconA * pei = NULL;
216 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
218 BOOL IconNotYetLoaded=TRUE;
220 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
221 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
223 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
226 /* windows initializes this values regardless of the flags */
227 psfi->szDisplayName[0] = '\0';
228 psfi->szTypeName[0] = '\0';
231 if (flags & SHGFI_EXETYPE) {
235 IMAGE_DOS_HEADER mz_header;
240 if (flags != SHGFI_EXETYPE) return 0;
242 status = GetBinaryTypeA (path, &BinaryType);
243 if (!status) return 0;
244 if ((BinaryType == SCS_DOS_BINARY)
245 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
247 hfile = CreateFileA( path, GENERIC_READ, FILE_SHARE_READ,
248 NULL, OPEN_EXISTING, 0, 0 );
249 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
251 /* The next section is adapted from MODULE_GetBinaryType, as we need
252 * to examine the image header to get OS and version information. We
253 * know from calling GetBinaryTypeA that the image is valid and either
254 * an NE or PE, so much error handling can be omitted.
255 * Seek to the start of the file and read the header information.
258 SetFilePointer( hfile, 0, NULL, SEEK_SET );
259 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
261 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
262 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
263 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
265 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
266 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
267 CloseHandle( hfile );
268 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
269 return IMAGE_NT_SIGNATURE
270 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
271 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
273 return IMAGE_NT_SIGNATURE;
275 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
278 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
279 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
280 CloseHandle( hfile );
281 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
282 | (ne.ne_expver << 16);
285 CloseHandle( hfile );
290 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
291 the pidl functions fail on not existing file names */
293 if (flags & SHGFI_PIDL) {
294 pidl = ILClone((LPCITEMIDLIST)path);
295 } else if (!(flags & SHGFI_USEFILEATTRIBUTES)) {
296 hr = SHILCreateFromPathA(path, &pidl, &dwAttributes);
299 /* get the parent shellfolder */
301 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
304 ERR("pidl is null!\n");
308 /* get the attributes of the child */
309 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
311 if (!(flags & SHGFI_ATTR_SPECIFIED))
313 psfi->dwAttributes = 0xffffffff;
315 IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
318 /* get the displayname */
319 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
321 if (flags & SHGFI_USEFILEATTRIBUTES)
323 strcpy (psfi->szDisplayName, PathFindFileNameA(path));
328 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
329 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
333 /* get the type name */
334 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
336 if (!(flags & SHGFI_USEFILEATTRIBUTES))
337 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
341 strcpy(sTemp,PathFindExtensionA(path));
342 if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)
343 && HCR_MapTypeToValue(sTemp, psfi->szTypeName, 80, FALSE )))
345 lstrcpynA (psfi->szTypeName, sTemp, 80 - 6);
346 strcat (psfi->szTypeName, "-file");
352 if (flags & SHGFI_LINKOVERLAY)
353 FIXME("set icon to link, stub\n");
355 if (flags & SHGFI_SELECTED)
356 FIXME("set icon to selected, stub\n");
358 if (flags & SHGFI_SHELLICONSIZE)
359 FIXME("set icon to shell size, stub\n");
361 /* get the iconlocation */
362 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
365 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
369 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
370 /* FIXME what to do with the index? */
372 if(uFlags != GIL_NOTFILENAME)
373 strcpy (psfi->szDisplayName, szLoaction);
377 IExtractIconA_Release(pei);
381 /* get icon index (or load icon)*/
382 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
385 if (flags & SHGFI_USEFILEATTRIBUTES)
387 char sTemp [MAX_PATH];
391 lstrcpynA(sTemp, path, MAX_PATH);
392 szExt = (LPSTR) PathFindExtensionA(sTemp);
393 if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
394 && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
396 if (!strcmp("%1",sTemp)) /* icon is in the file */
400 IconNotYetLoaded=FALSE;
403 PrivateExtractIconsA(sTemp,dwNr,GetSystemMetrics(SM_CXICON),
404 GetSystemMetrics(SM_CYICON),
407 PrivateExtractIconsA(sTemp,dwNr,GetSystemMetrics(SM_CXSMICON),
408 GetSystemMetrics(SM_CYSMICON),
411 else /* default icon */
418 if (!(PidlToSicIndex(psfParent, pidlLast, (flags & SHGFI_LARGEICON),
419 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
426 ret = (DWORD) ((flags & SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
431 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
432 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
434 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
435 FIXME("unknown attribute!\n");
438 IShellFolder_Release(psfParent);
443 if(pidlLast) SHFree(pidlLast);
445 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
446 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
451 /*************************************************************************
452 * SHGetFileInfoW [SHELL32.@]
455 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
456 SHFILEINFOW *psfi, UINT sizeofpsfi,
462 SHFILEINFOA temppsfi;
464 len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
465 temppath = HeapAlloc(GetProcessHeap(), 0, len);
466 WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
468 WideCharToMultiByte(CP_ACP, 0, psfi->szDisplayName, -1, temppsfi.szDisplayName,
469 sizeof(temppsfi.szDisplayName), NULL, NULL);
470 WideCharToMultiByte(CP_ACP, 0, psfi->szTypeName, -1, temppsfi.szTypeName,
471 sizeof(temppsfi.szTypeName), NULL, NULL);
473 ret = SHGetFileInfoA(temppath, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
475 HeapFree(GetProcessHeap(), 0, temppath);
480 /*************************************************************************
481 * SHGetFileInfo [SHELL32.@]
483 DWORD WINAPI SHGetFileInfoAW(
485 DWORD dwFileAttributes,
490 if(SHELL_OsIsUnicode())
491 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
492 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
495 /*************************************************************************
496 * DuplicateIcon [SHELL32.@]
498 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
503 TRACE("(%04x, %04x)\n", hInstance, hIcon);
505 if(GetIconInfo(hIcon, &IconInfo))
507 hDupIcon = CreateIconIndirect(&IconInfo);
509 /* clean up hbmMask and hbmColor */
510 DeleteObject(IconInfo.hbmMask);
511 DeleteObject(IconInfo.hbmColor);
518 /*************************************************************************
519 * ExtractIconA [SHELL32.@]
522 * if the filename is not a file return 1
524 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
526 { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
530 HICON16* ptr = (HICON16*)GlobalLock16(handle);
531 HICON16 hIcon = *ptr;
533 GlobalFree16(handle);
539 /*************************************************************************
540 * ExtractIconW [SHELL32.@]
542 * FIXME: if the filename is not a file return 1
544 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
550 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
551 ret = ExtractIconA(hInstance,exefn,nIconIndex);
553 HeapFree(GetProcessHeap(),0,exefn);
563 #define IDC_STATIC_TEXT 100
564 #define IDC_LISTBOX 99
565 #define IDC_WINE_TEXT 98
567 #define DROP_FIELD_TOP (-15)
568 #define DROP_FIELD_HEIGHT 15
570 static HICON hIconTitleFont;
572 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
573 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
575 { GetWindowRect( hWndCtl, lprect );
576 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
577 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
583 /*************************************************************************
584 * SHAppBarMessage [SHELL32.@]
586 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
588 int width=data->rc.right - data->rc.left;
589 int height=data->rc.bottom - data->rc.top;
593 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
594 case ABM_GETTASKBARPOS:
595 GetWindowRect(data->hWnd, &rec);
599 SetActiveWindow(data->hWnd);
601 case ABM_GETAUTOHIDEBAR:
602 data->hWnd=GetActiveWindow();
605 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
606 width,height,SWP_SHOWWINDOW);
609 GetWindowRect(data->hWnd, &(data->rc));
612 FIXME("ABM_REMOVE broken\n");
613 /* FIXME: this is wrong; should it be DestroyWindow instead? */
614 /*CloseHandle(data->hWnd);*/
616 case ABM_SETAUTOHIDEBAR:
617 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
618 width,height,SWP_SHOWWINDOW);
621 data->uEdge=(ABE_RIGHT | ABE_LEFT);
622 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
623 width,height,SWP_SHOWWINDOW);
625 case ABM_WINDOWPOSCHANGED:
631 /*************************************************************************
632 * SHHelpShortcuts_RunDLL [SHELL32.@]
635 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
636 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
637 dwArg1, dwArg2, dwArg3, dwArg4);
642 /*************************************************************************
643 * SHLoadInProc [SHELL32.@]
644 * Create an instance of specified object class from within
645 * the shell process and release it immediately
648 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
650 IUnknown * pUnk = NULL;
651 TRACE("%s\n", debugstr_guid(rclsid));
653 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
656 IUnknown_Release(pUnk);
659 return DISP_E_MEMBERNOTFOUND;
662 /*************************************************************************
663 * AboutDlgProc (internal)
665 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
668 char Template[512], AppTitle[512];
673 { case WM_INITDIALOG:
674 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
676 { const char* const *pstr = SHELL_People;
677 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
678 GetWindowTextA( hWnd, Template, sizeof(Template) );
679 sprintf( AppTitle, Template, info->szApp );
680 SetWindowTextA( hWnd, AppTitle );
681 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
682 info->szOtherStuff );
683 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
684 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
688 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
689 hIconTitleFont = CreateFontIndirectA( &logFont );
691 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
693 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
696 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
704 HDC hDC = BeginPaint( hWnd, &ps );
706 if( __get_dropline( hWnd, &rect ) ) {
707 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
708 MoveToEx( hDC, rect.left, rect.top, NULL );
709 LineTo( hDC, rect.right, rect.bottom );
711 EndPaint( hWnd, &ps );
715 #if 0 /* FIXME: should use DoDragDrop */
716 case WM_LBTRACKPOINT:
717 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
718 if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
719 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
720 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
722 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
723 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
724 char* pstr = (char*)GlobalLock16( hMemObj );
727 { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) );
728 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
729 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
730 UpdateWindow( hWndCtl );
731 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
732 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
735 GlobalFree16( hMemObj );
742 case WM_QUERYDROPOBJECT:
744 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
745 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
747 if( __get_dropline( hWnd, &rect ) )
749 pt.x=lpDragInfo->pt.x;
750 pt.x=lpDragInfo->pt.y;
751 rect.bottom += DROP_FIELD_HEIGHT;
752 if( PtInRect( &rect, pt ) )
753 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
763 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
764 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
765 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
767 { static char __appendix_str[] = " with";
769 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
770 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
771 if( !strncmp( Template, "WINE", 4 ) )
772 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
774 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
776 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
777 (WPARAM)-1, (LPARAM)Template );
780 strcpy( Template, pstr );
781 strcat( Template, __appendix_str );
782 SetWindowTextA( hWndCtl, Template );
783 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
792 { EndDialog(hWnd, TRUE);
797 EndDialog(hWnd, TRUE);
805 /*************************************************************************
806 * ShellAboutA [SHELL32.288]
808 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
815 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
817 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
821 info.szOtherStuff = szOtherStuff;
823 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
824 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
825 template, hWnd, AboutDlgProc, (LPARAM)&info );
829 /*************************************************************************
830 * ShellAboutW [SHELL32.289]
832 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
841 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
843 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
846 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
847 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
849 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
850 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
851 template, hWnd, AboutDlgProc, (LPARAM)&info );
852 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
853 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
857 /*************************************************************************
858 * FreeIconList (SHELL32.@)
860 void WINAPI FreeIconList( DWORD dw )
861 { FIXME("(%lx): stub\n",dw);
864 /***********************************************************************
865 * DllGetVersion [SHELL32.@]
867 * Retrieves version information of the 'SHELL32.DLL'
870 * pdvi [O] pointer to version information structure.
874 * Failure: E_INVALIDARG
877 * Returns version of a shell32.dll from IE4.01 SP1.
880 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
882 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
884 WARN("wrong DLLVERSIONINFO size from app\n");
888 pdvi->dwMajorVersion = 4;
889 pdvi->dwMinorVersion = 72;
890 pdvi->dwBuildNumber = 3110;
891 pdvi->dwPlatformID = 1;
893 TRACE("%lu.%lu.%lu.%lu\n",
894 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
895 pdvi->dwBuildNumber, pdvi->dwPlatformID);
899 /*************************************************************************
900 * global variables of the shell32.dll
901 * all are once per process
904 void (WINAPI *pDLLInitComctl)(LPVOID);
906 LPVOID (WINAPI *pCOMCTL32_Alloc) (INT);
907 BOOL (WINAPI *pCOMCTL32_Free) (LPVOID);
909 HANDLE (WINAPI *pCreateMRUListA) (LPVOID lpcml);
910 DWORD (WINAPI *pFreeMRUListA) (HANDLE hMRUList);
911 INT (WINAPI *pAddMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData);
912 INT (WINAPI *pFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum);
913 INT (WINAPI *pEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize);
915 static HINSTANCE hComctl32;
917 HINSTANCE shell32_hInstance = 0;
918 HIMAGELIST ShellSmallIconList = 0;
919 HIMAGELIST ShellBigIconList = 0;
922 /*************************************************************************
926 * calling oleinitialize here breaks sone apps.
929 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
931 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
935 case DLL_PROCESS_ATTACH:
936 shell32_hInstance = hinstDLL;
937 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
938 DisableThreadLibraryCalls(shell32_hInstance);
942 ERR("P A N I C SHELL32 loading failed\n");
947 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
948 /* initialize the common controls */
951 pDLLInitComctl(NULL);
956 InitChangeNotifications();
957 SHInitRestricted(NULL, NULL);
960 case DLL_THREAD_ATTACH:
963 case DLL_THREAD_DETACH:
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");