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
43 #include "undocshell.h"
45 #include "shell32_main.h"
49 #include "wine/debug.h"
50 #include "wine/unicode.h"
52 WINE_DEFAULT_DEBUG_CHANNEL(shell);
54 extern const char * const SHELL_Authors[];
57 /*************************************************************************
58 * CommandLineToArgvW [SHELL32.@]
60 * We must interpret the quotes in the command line to rebuild the argv
62 * - arguments are separated by spaces or tabs
63 * - quotes serve as optional argument delimiters
65 * - escaped quotes must be converted back to '"'
67 * - an odd number of '\'s followed by '"' correspond to half that number
68 * of '\' followed by a '"' (extension of the above)
71 * - an even number of '\'s followed by a '"' correspond to half that number
72 * of '\', plus a regular quote serving as an argument delimiter (which
73 * means it does not appear in the result)
74 * 'a\\"b c"' -> 'a\b c'
75 * 'a\\\\"b c"' -> 'a\\b c'
76 * - '\' that are not followed by a '"' are copied literally
86 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
98 /* Return the path to the executable */
101 hargv=GlobalAlloc(size, 0);
102 argv=GlobalLock(hargv);
105 len = GetModuleFileNameW(0, (LPWSTR)(argv+1), size-sizeof(LPWSTR));
111 if (len < size) break;
113 hargv=GlobalReAlloc(hargv, size, 0);
114 argv=GlobalLock(hargv);
116 argv[0]=(LPWSTR)(argv+1);
123 /* to get a writeable copy */
130 if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes))
134 /* skip the remaining spaces */
135 while (*cs==0x0009 || *cs==0x0020) {
143 else if (*cs==0x005c)
145 /* '\', count them */
148 else if ((*cs==0x0022) && ((bcount & 1)==0))
151 in_quotes=!in_quotes;
156 /* a regular character */
161 /* Allocate in a single lump, the string array, and the strings that go with it.
162 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
164 hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
165 argv=GlobalLock(hargv);
168 cmdline=(LPWSTR)(argv+argc);
169 strcpyW(cmdline, lpCmdline);
177 if ((*s==0x0009 || *s==0x0020) && !in_quotes)
179 /* Close the argument and copy it */
183 /* skip the remaining spaces */
186 } while (*s==0x0009 || *s==0x0020);
188 /* Start with a new argument */
203 /* Preceded by an even number of '\', this is half that
204 * number of '\', plus a quote which we erase.
207 in_quotes=!in_quotes;
212 /* Preceded by an odd number of '\', this is half that
213 * number of '\' followed by a '"'
223 /* a regular character */
239 #define SHGFI_KNOWN_FLAGS \
240 (SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
241 SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
242 SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
243 SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
244 SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
246 /*************************************************************************
247 * SHGetFileInfoW [SHELL32.@]
250 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
251 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags )
253 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH];
255 DWORD ret = TRUE, dwAttributes = 0;
256 IShellFolder * psfParent = NULL;
257 IExtractIconW * pei = NULL;
258 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
260 BOOL IconNotYetLoaded=TRUE;
262 TRACE("%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x\n",
263 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
264 psfi, psfi->dwAttributes, sizeofpsfi, flags);
266 if ( (flags & SHGFI_USEFILEATTRIBUTES) &&
267 (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
270 /* windows initializes this values regardless of the flags */
273 psfi->szDisplayName[0] = '\0';
274 psfi->szTypeName[0] = '\0';
278 if (!(flags & SHGFI_PIDL))
280 /* SHGitFileInfo should work with absolute and relative paths */
281 if (PathIsRelativeW(path))
283 GetCurrentDirectoryW(MAX_PATH, szLocation);
284 PathCombineW(szFullPath, szLocation, path);
288 lstrcpynW(szFullPath, path, MAX_PATH);
292 if (flags & SHGFI_EXETYPE)
297 IMAGE_DOS_HEADER mz_header;
302 if (flags != SHGFI_EXETYPE)
305 status = GetBinaryTypeW (szFullPath, &BinaryType);
308 if ((BinaryType == SCS_DOS_BINARY) || (BinaryType == SCS_PIF_BINARY))
311 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ,
312 NULL, OPEN_EXISTING, 0, 0 );
313 if ( hfile == INVALID_HANDLE_VALUE )
317 * The next section is adapted from MODULE_GetBinaryType, as we need
318 * to examine the image header to get OS and version information. We
319 * know from calling GetBinaryTypeA that the image is valid and either
320 * an NE or PE, so much error handling can be omitted.
321 * Seek to the start of the file and read the header information.
324 SetFilePointer( hfile, 0, NULL, SEEK_SET );
325 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
327 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
328 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
329 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
331 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
332 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
333 CloseHandle( hfile );
334 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
336 return IMAGE_NT_SIGNATURE |
337 (nt.OptionalHeader.MajorSubsystemVersion << 24) |
338 (nt.OptionalHeader.MinorSubsystemVersion << 16);
340 return IMAGE_NT_SIGNATURE;
342 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
345 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
346 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
347 CloseHandle( hfile );
348 if (ne.ne_exetyp == 2)
349 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16);
352 CloseHandle( hfile );
357 * psfi is NULL normally to query EXE type. If it is NULL, none of the
358 * below makes sense anyway. Windows allows this and just returns FALSE
364 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
366 * The pidl functions fail on not existing file names
369 if (flags & SHGFI_PIDL)
371 pidl = ILClone((LPCITEMIDLIST)path);
373 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
375 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes);
378 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES))
380 /* get the parent shellfolder */
383 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent,
384 (LPCITEMIDLIST*)&pidlLast );
389 ERR("pidl is null!\n");
394 /* get the attributes of the child */
395 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
397 if (!(flags & SHGFI_ATTR_SPECIFIED))
399 psfi->dwAttributes = 0xffffffff;
401 IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
402 &(psfi->dwAttributes) );
405 /* get the displayname */
406 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
408 if (flags & SHGFI_USEFILEATTRIBUTES)
410 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
415 hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
416 SHGDN_INFOLDER, &str);
417 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
421 /* get the type name */
422 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
424 static const WCHAR szFile[] = { 'F','i','l','e',0 };
425 static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
427 if (!(flags & SHGFI_USEFILEATTRIBUTES))
431 _ILGetFileType(pidlLast, ftype, 80);
432 MultiByteToWideChar(CP_ACP, 0, ftype, -1, psfi->szTypeName, 80 );
436 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
437 strcatW (psfi->szTypeName, szFile);
442 lstrcpyW(sTemp,PathFindExtensionW(szFullPath));
443 if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) &&
444 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE )))
446 lstrcpynW (psfi->szTypeName, sTemp, 64);
447 strcatW (psfi->szTypeName, szDashFile);
454 if (flags & SHGFI_ADDOVERLAYS)
455 FIXME("SHGFI_ADDOVERLAYS unhandled\n");
457 if (flags & SHGFI_OVERLAYINDEX)
458 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
460 if (flags & SHGFI_LINKOVERLAY)
461 FIXME("set icon to link, stub\n");
463 if (flags & SHGFI_SELECTED)
464 FIXME("set icon to selected, stub\n");
466 if (flags & SHGFI_SHELLICONSIZE)
467 FIXME("set icon to shell size, stub\n");
469 /* get the iconlocation */
470 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
474 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
475 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconA,
476 &uDummy, (LPVOID*)&pei);
479 hr = IExtractIconW_GetIconLocation(pei,
480 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,
481 szLocation, MAX_PATH, &iIndex, &uFlags);
482 psfi->iIcon = iIndex;
484 if (uFlags != GIL_NOTFILENAME)
485 lstrcpyW (psfi->szDisplayName, szLocation);
489 IExtractIconA_Release(pei);
493 /* get icon index (or load icon)*/
494 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
496 if (flags & SHGFI_USEFILEATTRIBUTES)
498 WCHAR sTemp [MAX_PATH];
502 lstrcpynW(sTemp, szFullPath, MAX_PATH);
504 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
505 psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER);
508 static const WCHAR p1W[] = {'%','1',0};
511 szExt = (LPWSTR) PathFindExtensionW(sTemp);
513 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
514 HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &dwNr))
516 if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
517 strcpyW(sTemp, szFullPath);
519 if (flags & SHGFI_SYSICONINDEX)
521 psfi->iIcon = SIC_GetIconIndex(sTemp,dwNr);
522 if (psfi->iIcon == -1)
527 IconNotYetLoaded=FALSE;
528 if (flags & SHGFI_SMALLICON)
529 PrivateExtractIconsW( sTemp,dwNr,
530 GetSystemMetrics( SM_CXSMICON ),
531 GetSystemMetrics( SM_CYSMICON ),
532 &psfi->hIcon, 0, 1, 0);
534 PrivateExtractIconsW( sTemp, dwNr,
535 GetSystemMetrics( SM_CXICON),
536 GetSystemMetrics( SM_CYICON),
537 &psfi->hIcon, 0, 1, 0);
545 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
546 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
553 if (flags & SHGFI_SMALLICON)
554 ret = (DWORD) ShellSmallIconList;
556 ret = (DWORD) ShellBigIconList;
561 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
563 if (flags & SHGFI_SMALLICON)
564 psfi->hIcon = ImageList_GetIcon( ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
566 psfi->hIcon = ImageList_GetIcon( ShellBigIconList, psfi->iIcon, ILD_NORMAL);
569 if (flags & ~SHGFI_KNOWN_FLAGS)
570 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS);
573 IShellFolder_Release(psfParent);
582 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
583 psfi->hIcon, psfi->iIcon, psfi->dwAttributes,
584 debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret);
590 /*************************************************************************
591 * SHGetFileInfoA [SHELL32.@]
593 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
594 SHFILEINFOA *psfi, UINT sizeofpsfi,
600 SHFILEINFOW temppsfi;
602 if (flags & SHGFI_PIDL)
604 /* path contains a pidl */
605 temppath = (LPWSTR) path;
609 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
610 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
611 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
614 if (psfi && (flags & SHGFI_ATTR_SPECIFIED))
615 temppsfi.dwAttributes=psfi->dwAttributes;
618 ret = SHGetFileInfoW(temppath, dwFileAttributes, NULL, sizeof(temppsfi), flags);
620 ret = SHGetFileInfoW(temppath, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
624 if(flags & SHGFI_ICON)
625 psfi->hIcon=temppsfi.hIcon;
626 if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
627 psfi->iIcon=temppsfi.iIcon;
628 if(flags & SHGFI_ATTRIBUTES)
629 psfi->dwAttributes=temppsfi.dwAttributes;
630 if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
632 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
633 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
635 if(flags & SHGFI_TYPENAME)
637 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
638 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
642 if (!(flags & SHGFI_PIDL))
643 HeapFree(GetProcessHeap(), 0, temppath);
648 /*************************************************************************
649 * DuplicateIcon [SHELL32.@]
651 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
656 TRACE("%p %p\n", hInstance, hIcon);
658 if (GetIconInfo(hIcon, &IconInfo))
660 hDupIcon = CreateIconIndirect(&IconInfo);
662 /* clean up hbmMask and hbmColor */
663 DeleteObject(IconInfo.hbmMask);
664 DeleteObject(IconInfo.hbmColor);
670 /*************************************************************************
671 * ExtractIconA [SHELL32.@]
673 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex)
676 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
677 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
679 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex);
681 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
682 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex);
683 HeapFree(GetProcessHeap(), 0, lpwstrFile);
688 /*************************************************************************
689 * ExtractIconW [SHELL32.@]
691 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex)
695 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON);
697 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex);
699 if (nIconIndex == 0xFFFFFFFF)
701 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR);
702 if (ret != 0xFFFFFFFF && ret)
707 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR);
709 if (ret == 0xFFFFFFFF)
711 else if (ret > 0 && hIcon)
720 LPCWSTR szOtherStuff;
725 #define IDC_STATIC_TEXT1 100
726 #define IDC_STATIC_TEXT2 101
727 #define IDC_LISTBOX 99
728 #define IDC_WINE_TEXT 98
730 #define DROP_FIELD_TOP (-15)
731 #define DROP_FIELD_HEIGHT 15
733 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
735 HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
739 GetWindowRect( hWndCtl, lprect );
740 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
741 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
747 /*************************************************************************
748 * SHAppBarMessage [SHELL32.@]
750 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
752 int width=data->rc.right - data->rc.left;
753 int height=data->rc.bottom - data->rc.top;
759 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
760 case ABM_GETTASKBARPOS:
761 GetWindowRect(data->hWnd, &rec);
765 SetActiveWindow(data->hWnd);
767 case ABM_GETAUTOHIDEBAR:
768 data->hWnd=GetActiveWindow();
771 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
772 width,height,SWP_SHOWWINDOW);
775 GetWindowRect(data->hWnd, &(data->rc));
778 FIXME("ABM_REMOVE broken\n");
779 /* FIXME: this is wrong; should it be DestroyWindow instead? */
780 /*CloseHandle(data->hWnd);*/
782 case ABM_SETAUTOHIDEBAR:
783 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
784 width,height,SWP_SHOWWINDOW);
787 data->uEdge=(ABE_RIGHT | ABE_LEFT);
788 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
789 width,height,SWP_SHOWWINDOW);
791 case ABM_WINDOWPOSCHANGED:
797 /*************************************************************************
798 * SHHelpShortcuts_RunDLLA [SHELL32.@]
801 DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
803 FIXME("(%lx, %lx, %lx, %lx) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
807 /*************************************************************************
808 * SHHelpShortcuts_RunDLLA [SHELL32.@]
811 DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
813 FIXME("(%lx, %lx, %lx, %lx) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4);
817 /*************************************************************************
818 * SHLoadInProc [SHELL32.@]
819 * Create an instance of specified object class from within
820 * the shell process and release it immediately
822 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid)
826 TRACE("%s\n", debugstr_guid(rclsid));
828 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr);
831 IUnknown * pUnk = ptr;
832 IUnknown_Release(pUnk);
835 return DISP_E_MEMBERNOTFOUND;
838 /*************************************************************************
839 * AboutDlgProc (internal)
841 INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
852 ABOUT_INFO *info = (ABOUT_INFO *)lParam;
853 WCHAR Template[512], AppTitle[512];
857 const char* const *pstr = SHELL_Authors;
858 SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
859 GetWindowTextW( hWnd, Template, sizeof(Template)/sizeof(WCHAR) );
860 sprintfW( AppTitle, Template, info->szApp );
861 SetWindowTextW( hWnd, AppTitle );
862 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT1), info->szApp );
863 SetWindowTextW( GetDlgItem(hWnd, IDC_STATIC_TEXT2), info->szOtherStuff );
864 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
865 SendMessageW( hWndCtl, WM_SETREDRAW, 0, 0 );
866 SendMessageW( hWndCtl, WM_SETFONT, (WPARAM)info->hFont, 0 );
870 /* authors list is in iso-8859-1 format */
871 MultiByteToWideChar( 28591, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) );
872 SendMessageW( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name );
875 SendMessageW( hWndCtl, WM_SETREDRAW, 1, 0 );
884 HDC hDC = BeginPaint( hWnd, &ps );
886 if (__get_dropline( hWnd, &rect ))
888 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
889 MoveToEx( hDC, rect.left, rect.top, NULL );
890 LineTo( hDC, rect.right, rect.bottom );
892 EndPaint( hWnd, &ps );
897 if (wParam == IDOK || wParam == IDCANCEL)
899 EndDialog(hWnd, TRUE);
904 EndDialog(hWnd, TRUE);
912 /*************************************************************************
913 * ShellAboutA [SHELL32.288]
915 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
918 LPWSTR appW = NULL, otherW = NULL;
923 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
924 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
925 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
929 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
930 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
931 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
934 ret = ShellAboutW(hWnd, appW, otherW, hIcon);
936 HeapFree(GetProcessHeap(), 0, otherW);
937 HeapFree(GetProcessHeap(), 0, appW);
942 /*************************************************************************
943 * ShellAboutW [SHELL32.289]
945 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
953 static const WCHAR wszSHELL_ABOUT_MSGBOX[] =
954 {'S','H','E','L','L','_','A','B','O','U','T','_','M','S','G','B','O','X',0};
958 if(!(hRes = FindResourceW(shell32_hInstance, wszSHELL_ABOUT_MSGBOX, (LPWSTR)RT_DIALOG)))
960 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
963 info.szOtherStuff = szOtherStuff;
964 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO );
966 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
967 info.hFont = CreateFontIndirectW( &logFont );
969 bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ),
970 template, hWnd, AboutDlgProc, (LPARAM)&info );
971 DeleteObject(info.hFont);
975 /*************************************************************************
976 * FreeIconList (SHELL32.@)
978 void WINAPI FreeIconList( DWORD dw )
980 FIXME("%lx: stub\n",dw);
984 /*************************************************************************
985 * ShellDDEInit (SHELL32.@)
987 void WINAPI ShellDDEInit(BOOL start)
989 FIXME("stub: %d\n", start);
992 /***********************************************************************
993 * DllGetVersion [SHELL32.@]
995 * Retrieves version information of the 'SHELL32.DLL'
998 * pdvi [O] pointer to version information structure.
1002 * Failure: E_INVALIDARG
1005 * Returns version of a shell32.dll from IE4.01 SP1.
1008 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
1010 /* FIXME: shouldn't these values come from the version resource? */
1011 if (pdvi->cbSize == sizeof(DLLVERSIONINFO) ||
1012 pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1014 pdvi->dwMajorVersion = WINE_FILEVERSION_MAJOR;
1015 pdvi->dwMinorVersion = WINE_FILEVERSION_MINOR;
1016 pdvi->dwBuildNumber = WINE_FILEVERSION_BUILD;
1017 pdvi->dwPlatformID = WINE_FILEVERSION_PLATFORMID;
1018 if (pdvi->cbSize == sizeof(DLLVERSIONINFO2))
1020 DLLVERSIONINFO2 *pdvi2 = (DLLVERSIONINFO2 *)pdvi;
1023 pdvi2->ullVersion = MAKEDLLVERULL(WINE_FILEVERSION_MAJOR,
1024 WINE_FILEVERSION_MINOR,
1025 WINE_FILEVERSION_BUILD,
1026 WINE_FILEVERSION_PLATFORMID);
1028 TRACE("%lu.%lu.%lu.%lu\n",
1029 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
1030 pdvi->dwBuildNumber, pdvi->dwPlatformID);
1035 WARN("wrong DLLVERSIONINFO size from app\n");
1036 return E_INVALIDARG;
1040 /*************************************************************************
1041 * global variables of the shell32.dll
1042 * all are once per process
1045 HINSTANCE shell32_hInstance = 0;
1046 HIMAGELIST ShellSmallIconList = 0;
1047 HIMAGELIST ShellBigIconList = 0;
1050 /*************************************************************************
1054 * calling oleinitialize here breaks sone apps.
1056 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
1058 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
1062 case DLL_PROCESS_ATTACH:
1063 shell32_hInstance = hinstDLL;
1064 DisableThreadLibraryCalls(shell32_hInstance);
1066 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
1067 GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
1068 swShell32Name[MAX_PATH - 1] = '\0';
1070 InitCommonControlsEx(NULL);
1074 InitChangeNotifications();
1077 case DLL_PROCESS_DETACH:
1078 shell32_hInstance = 0;
1080 FreeChangeNotifications();
1086 /*************************************************************************
1087 * DllInstall [SHELL32.@]
1091 * BOOL bInstall - TRUE for install, FALSE for uninstall
1092 * LPCWSTR pszCmdLine - command line (unused by shell32?)
1095 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
1097 FIXME("%s %s: stub\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
1098 return S_OK; /* indicate success */
1101 /***********************************************************************
1102 * DllCanUnloadNow (SHELL32.@)
1104 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)