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
);
99 len
= GetModuleFileNameW(0, (LPWSTR
)(argv
+1), size
-sizeof(LPWSTR
));
104 if (len
< size
) break;
106 hargv
=GlobalReAlloc(hargv
, size
, 0);
107 argv
=GlobalLock(hargv
);
109 argv
[0]=(LPWSTR
)(argv
+1);
116 /* to get a writeable copy */
122 if (*cs
==0 || ((*cs
==0x0009 || *cs
==0x0020) && !in_quotes
)) {
125 /* skip the remaining spaces */
126 while (*cs
==0x0009 || *cs
==0x0020) {
133 } else if (*cs
==0x005c) {
134 /* '\', count them */
136 } else if ((*cs
==0x0022) && ((bcount
& 1)==0)) {
138 in_quotes
=!in_quotes
;
141 /* a regular character */
146 /* Allocate in a single lump, the string array, and the strings that go with it.
147 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
149 hargv
=GlobalAlloc(0, argc
*sizeof(LPWSTR
)+(strlenW(lpCmdline
)+1)*sizeof(WCHAR
));
150 argv
=GlobalLock(hargv
);
153 cmdline
=(LPWSTR
)(argv
+argc
);
154 strcpyW(cmdline
, lpCmdline
);
161 if ((*s
==0x0009 || *s
==0x0020) && !in_quotes
) {
162 /* Close the argument and copy it */
166 /* skip the remaining spaces */
169 } while (*s
==0x0009 || *s
==0x0020);
171 /* Start with a new argument */
174 } else if (*s
==0x005c) {
178 } else if (*s
==0x0022) {
180 if ((bcount
& 1)==0) {
181 /* Preceeded by an even number of '\', this is half that
182 * number of '\', plus a quote which we erase.
185 in_quotes
=!in_quotes
;
188 /* Preceeded by an odd number of '\', this is half that
189 * number of '\' followed by a '"'
197 /* a regular character */
212 /*************************************************************************
213 * SHGetFileInfoA [SHELL32.@]
217 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
218 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
221 WCHAR szLocation
[MAX_PATH
], szFullPath
[MAX_PATH
];
223 DWORD ret
= TRUE
, dwAttributes
= 0;
224 IShellFolder
* psfParent
= NULL
;
225 IExtractIconW
* pei
= NULL
;
226 LPITEMIDLIST pidlLast
= NULL
, pidl
= NULL
;
228 BOOL IconNotYetLoaded
=TRUE
;
230 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
231 (flags
& SHGFI_PIDL
)? "pidl" : debugstr_w(path
), dwFileAttributes
, psfi
, psfi
->dwAttributes
, sizeofpsfi
, flags
);
233 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
236 /* windows initializes this values regardless of the flags */
238 psfi
->szDisplayName
[0] = '\0';
239 psfi
->szTypeName
[0] = '\0';
243 if (!(flags
& SHGFI_PIDL
)){
244 /* SHGitFileInfo should work with absolute and relative paths */
245 if (PathIsRelativeW(path
)){
246 GetCurrentDirectoryW(MAX_PATH
, szLocation
);
247 PathCombineW(szFullPath
, szLocation
, path
);
249 lstrcpynW(szFullPath
, path
, MAX_PATH
);
253 if (flags
& SHGFI_EXETYPE
) {
257 IMAGE_DOS_HEADER mz_header
;
262 if (flags
!= SHGFI_EXETYPE
) return 0;
264 status
= GetBinaryTypeW (szFullPath
, &BinaryType
);
265 if (!status
) return 0;
266 if ((BinaryType
== SCS_DOS_BINARY
)
267 || (BinaryType
== SCS_PIF_BINARY
)) return 0x4d5a;
269 hfile
= CreateFileW( szFullPath
, GENERIC_READ
, FILE_SHARE_READ
,
270 NULL
, OPEN_EXISTING
, 0, 0 );
271 if ( hfile
== INVALID_HANDLE_VALUE
) return 0;
273 /* The next section is adapted from MODULE_GetBinaryType, as we need
274 * to examine the image header to get OS and version information. We
275 * know from calling GetBinaryTypeA that the image is valid and either
276 * an NE or PE, so much error handling can be omitted.
277 * Seek to the start of the file and read the header information.
280 SetFilePointer( hfile
, 0, NULL
, SEEK_SET
);
281 ReadFile( hfile
, &mz_header
, sizeof(mz_header
), &len
, NULL
);
283 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
284 ReadFile( hfile
, magic
, sizeof(magic
), &len
, NULL
);
285 if ( *(DWORD
*)magic
== IMAGE_NT_SIGNATURE
)
287 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
288 ReadFile( hfile
, &nt
, sizeof(nt
), &len
, NULL
);
289 CloseHandle( hfile
);
290 if (nt
.OptionalHeader
.Subsystem
== IMAGE_SUBSYSTEM_WINDOWS_GUI
) {
291 return IMAGE_NT_SIGNATURE
292 | (nt
.OptionalHeader
.MajorSubsystemVersion
<< 24)
293 | (nt
.OptionalHeader
.MinorSubsystemVersion
<< 16);
295 return IMAGE_NT_SIGNATURE
;
297 else if ( *(WORD
*)magic
== IMAGE_OS2_SIGNATURE
)
300 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
301 ReadFile( hfile
, &ne
, sizeof(ne
), &len
, NULL
);
302 CloseHandle( hfile
);
303 if (ne
.ne_exetyp
== 2) return IMAGE_OS2_SIGNATURE
304 | (ne
.ne_expver
<< 16);
307 CloseHandle( hfile
);
311 /* psfi is NULL normally to query EXE type. If it is NULL, none of the
312 * below makes sense anyway. Windows allows this and just returns FALSE */
313 if (psfi
== NULL
) return FALSE
;
315 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
317 The pidl functions fail on not existing file names */
319 if (flags
& SHGFI_PIDL
) {
320 pidl
= ILClone((LPCITEMIDLIST
)path
);
321 } else if (!(flags
& SHGFI_USEFILEATTRIBUTES
)) {
322 hr
= SHILCreateFromPathW(szFullPath
, &pidl
, &dwAttributes
);
325 if ((flags
& SHGFI_PIDL
) || !(flags
& SHGFI_USEFILEATTRIBUTES
))
327 /* get the parent shellfolder */
329 hr
= SHBindToParent(pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, (LPCITEMIDLIST
*)&pidlLast
);
332 ERR("pidl is null!\n");
337 /* get the attributes of the child */
338 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
340 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
342 psfi
->dwAttributes
= 0xffffffff;
344 IShellFolder_GetAttributesOf(psfParent
, 1, (LPCITEMIDLIST
*)&pidlLast
, &(psfi
->dwAttributes
));
347 /* get the displayname */
348 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
350 if (flags
& SHGFI_USEFILEATTRIBUTES
)
352 lstrcpyW (psfi
->szDisplayName
, PathFindFileNameW(szFullPath
));
357 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
358 StrRetToStrNW (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
362 /* get the type name */
363 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
365 static const WCHAR szFile
[] = { 'F','i','l','e',0 };
366 static const WCHAR szDashFile
[] = { '-','f','i','l','e',0 };
367 if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
370 _ILGetFileType(pidlLast
, ftype
, 80);
371 MultiByteToWideChar(CP_ACP
, 0, ftype
, -1, psfi
->szTypeName
, 80 );
375 if (dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
376 strcatW (psfi
->szTypeName
, szFile
);
380 lstrcpyW(sTemp
,PathFindExtensionW(szFullPath
));
381 if (!( HCR_MapTypeToValueW(sTemp
, sTemp
, 64, TRUE
)
382 && HCR_MapTypeToValueW(sTemp
, psfi
->szTypeName
, 80, FALSE
)))
384 lstrcpynW (psfi
->szTypeName
, sTemp
, 64);
385 strcatW (psfi
->szTypeName
, szDashFile
);
392 if (flags
& SHGFI_LINKOVERLAY
)
393 FIXME("set icon to link, stub\n");
395 if (flags
& SHGFI_SELECTED
)
396 FIXME("set icon to selected, stub\n");
398 if (flags
& SHGFI_SHELLICONSIZE
)
399 FIXME("set icon to shell size, stub\n");
401 /* get the iconlocation */
402 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
405 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, (LPCITEMIDLIST
*)&pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
409 hr
= IExtractIconW_GetIconLocation(pei
, (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,szLocation
, MAX_PATH
, &iIndex
, &uFlags
);
410 psfi
->iIcon
= iIndex
;
412 if(uFlags
!= GIL_NOTFILENAME
)
413 lstrcpyW (psfi
->szDisplayName
, szLocation
);
417 IExtractIconA_Release(pei
);
421 /* get icon index (or load icon)*/
422 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
425 if (flags
& SHGFI_USEFILEATTRIBUTES
)
427 WCHAR sTemp
[MAX_PATH
];
431 lstrcpynW(sTemp
, szFullPath
, MAX_PATH
);
433 if (dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
437 static const WCHAR p1W
[] = {'%','1',0};
439 szExt
= (LPWSTR
) PathFindExtensionW(sTemp
);
440 if ( szExt
&& HCR_MapTypeToValueW(szExt
, sTemp
, MAX_PATH
, TRUE
)
441 && HCR_GetDefaultIconW(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
443 if (!lstrcmpW(p1W
,sTemp
)) /* icon is in the file */
444 strcpyW(sTemp
, szFullPath
);
446 if (flags
& SHGFI_SYSICONINDEX
)
448 psfi
->iIcon
= SIC_GetIconIndex(sTemp
,dwNr
);
449 if (psfi
->iIcon
== -1) psfi
->iIcon
= 0;
453 IconNotYetLoaded
=FALSE
;
454 PrivateExtractIconsW(sTemp
,dwNr
,(flags
& SHGFI_SMALLICON
) ?
455 GetSystemMetrics(SM_CXSMICON
) : GetSystemMetrics(SM_CXICON
),
456 (flags
& SHGFI_SMALLICON
) ? GetSystemMetrics(SM_CYSMICON
) :
457 GetSystemMetrics(SM_CYICON
), &psfi
->hIcon
,0,1,0);
465 if (!(PidlToSicIndex(psfParent
, pidlLast
, !(flags
& SHGFI_SMALLICON
),
466 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
473 ret
= (DWORD
) ((flags
& SHGFI_SMALLICON
) ? ShellSmallIconList
: ShellBigIconList
);
478 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
) && IconNotYetLoaded
)
479 psfi
->hIcon
= ImageList_GetIcon((flags
& SHGFI_SMALLICON
) ? ShellSmallIconList
:ShellBigIconList
, psfi
->iIcon
, ILD_NORMAL
);
481 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
482 FIXME("unknown attribute!\n");
485 IShellFolder_Release(psfParent
);
490 if(pidlLast
) SHFree(pidlLast
);
492 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
493 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, debugstr_w(psfi
->szDisplayName
), debugstr_w(psfi
->szTypeName
), ret
);
498 /*************************************************************************
499 * SHGetFileInfoW [SHELL32.@]
502 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
503 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
509 SHFILEINFOW temppsfi
;
511 if (flags
& SHGFI_PIDL
) {
512 /* path contains a pidl */
513 temppath
= (LPWSTR
) path
;
515 len
= MultiByteToWideChar(CP_ACP
, 0, path
, -1, NULL
, 0);
516 temppath
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
517 MultiByteToWideChar(CP_ACP
, 0, path
, -1, temppath
, len
);
520 if(psfi
&& (flags
& SHGFI_ATTR_SPECIFIED
))
521 temppsfi
.dwAttributes
=psfi
->dwAttributes
;
523 ret
= SHGetFileInfoW(temppath
, dwFileAttributes
, (psfi
== NULL
)? NULL
: &temppsfi
, sizeof(temppsfi
), flags
);
527 if(flags
& SHGFI_ICON
)
528 psfi
->hIcon
=temppsfi
.hIcon
;
529 if(flags
& (SHGFI_SYSICONINDEX
|SHGFI_ICON
|SHGFI_ICONLOCATION
))
530 psfi
->iIcon
=temppsfi
.iIcon
;
531 if(flags
& SHGFI_ATTRIBUTES
)
532 psfi
->dwAttributes
=temppsfi
.dwAttributes
;
533 if(flags
& (SHGFI_DISPLAYNAME
|SHGFI_ICONLOCATION
))
534 WideCharToMultiByte(CP_ACP
, 0, temppsfi
.szDisplayName
, -1, psfi
->szDisplayName
, sizeof(psfi
->szDisplayName
), NULL
, NULL
);
535 if(flags
& SHGFI_TYPENAME
)
536 WideCharToMultiByte(CP_ACP
, 0, temppsfi
.szTypeName
, -1, psfi
->szTypeName
, sizeof(psfi
->szTypeName
), NULL
, NULL
);
538 if(!(flags
& SHGFI_PIDL
)) HeapFree(GetProcessHeap(), 0, temppath
);
542 /*************************************************************************
543 * SHGetFileInfo [SHELL32.@]
545 DWORD WINAPI
SHGetFileInfoAW(
547 DWORD dwFileAttributes
,
552 if(SHELL_OsIsUnicode())
553 return SHGetFileInfoW(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
554 return SHGetFileInfoA(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
557 /*************************************************************************
558 * DuplicateIcon [SHELL32.@]
560 HICON WINAPI
DuplicateIcon( HINSTANCE hInstance
, HICON hIcon
)
565 TRACE("(%p, %p)\n", hInstance
, hIcon
);
567 if(GetIconInfo(hIcon
, &IconInfo
))
569 hDupIcon
= CreateIconIndirect(&IconInfo
);
571 /* clean up hbmMask and hbmColor */
572 DeleteObject(IconInfo
.hbmMask
);
573 DeleteObject(IconInfo
.hbmColor
);
579 /*************************************************************************
580 * ExtractIconA [SHELL32.@]
582 HICON WINAPI
ExtractIconA(HINSTANCE hInstance
, LPCSTR lpszFile
, UINT nIconIndex
)
585 INT len
= MultiByteToWideChar(CP_ACP
, 0, lpszFile
, -1, NULL
, 0);
586 LPWSTR lpwstrFile
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
588 TRACE("%p %s %d\n", hInstance
, lpszFile
, nIconIndex
);
590 MultiByteToWideChar(CP_ACP
, 0, lpszFile
, -1, lpwstrFile
, len
);
591 ret
= ExtractIconW(hInstance
, lpwstrFile
, nIconIndex
);
592 HeapFree(GetProcessHeap(), 0, lpwstrFile
);
596 /*************************************************************************
597 * ExtractIconW [SHELL32.@]
599 HICON WINAPI
ExtractIconW(HINSTANCE hInstance
, LPCWSTR lpszFile
, UINT nIconIndex
)
603 UINT cx
= GetSystemMetrics(SM_CXICON
), cy
= GetSystemMetrics(SM_CYICON
);
605 TRACE("%p %s %d\n", hInstance
, debugstr_w(lpszFile
), nIconIndex
);
607 if (nIconIndex
== 0xFFFFFFFF) {
608 ret
= PrivateExtractIconsW(lpszFile
, 0, cx
, cy
, NULL
, NULL
, 0, LR_DEFAULTCOLOR
);
609 if (ret
!= 0xFFFFFFFF && ret
)
614 ret
= PrivateExtractIconsW(lpszFile
, nIconIndex
, cx
, cy
, &hIcon
, NULL
, 1, LR_DEFAULTCOLOR
);
616 if (ret
== 0xFFFFFFFF)
618 else if (ret
> 0 && hIcon
)
626 LPCWSTR szOtherStuff
;
631 #define IDC_STATIC_TEXT 100
632 #define IDC_LISTBOX 99
633 #define IDC_WINE_TEXT 98
635 #define DROP_FIELD_TOP (-15)
636 #define DROP_FIELD_HEIGHT 15
638 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
639 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
641 { GetWindowRect( hWndCtl
, lprect
);
642 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
643 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
649 /*************************************************************************
650 * SHAppBarMessage [SHELL32.@]
652 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
654 int width
=data
->rc
.right
- data
->rc
.left
;
655 int height
=data
->rc
.bottom
- data
->rc
.top
;
659 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
660 case ABM_GETTASKBARPOS
:
661 GetWindowRect(data
->hWnd
, &rec
);
665 SetActiveWindow(data
->hWnd
);
667 case ABM_GETAUTOHIDEBAR
:
668 data
->hWnd
=GetActiveWindow();
671 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
672 width
,height
,SWP_SHOWWINDOW
);
675 GetWindowRect(data
->hWnd
, &(data
->rc
));
678 FIXME("ABM_REMOVE broken\n");
679 /* FIXME: this is wrong; should it be DestroyWindow instead? */
680 /*CloseHandle(data->hWnd);*/
682 case ABM_SETAUTOHIDEBAR
:
683 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
684 width
,height
,SWP_SHOWWINDOW
);
687 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
688 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
689 width
,height
,SWP_SHOWWINDOW
);
691 case ABM_WINDOWPOSCHANGED
:
697 /*************************************************************************
698 * SHHelpShortcuts_RunDLL [SHELL32.@]
701 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
702 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
703 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
708 /*************************************************************************
709 * SHLoadInProc [SHELL32.@]
710 * Create an instance of specified object class from within
711 * the shell process and release it immediately
714 HRESULT WINAPI
SHLoadInProc (REFCLSID rclsid
)
718 TRACE("%s\n", debugstr_guid(rclsid
));
720 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,&ptr
);
723 IUnknown
* pUnk
= ptr
;
724 IUnknown_Release(pUnk
);
727 return DISP_E_MEMBERNOTFOUND
;
730 /*************************************************************************
731 * AboutDlgProc (internal)
733 INT_PTR CALLBACK
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
744 ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
745 WCHAR Template
[512], AppTitle
[512];
749 const char* const *pstr
= SHELL_Authors
;
750 SendDlgItemMessageW(hWnd
, stc1
, STM_SETICON
,(WPARAM
)info
->hIcon
, 0);
751 GetWindowTextW( hWnd
, Template
, sizeof(Template
)/sizeof(WCHAR
) );
752 sprintfW( AppTitle
, Template
, info
->szApp
);
753 SetWindowTextW( hWnd
, AppTitle
);
754 SetWindowTextW( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), info
->szOtherStuff
);
755 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
756 SendMessageW( hWndCtl
, WM_SETREDRAW
, 0, 0 );
757 SendMessageW( hWndCtl
, WM_SETFONT
, (WPARAM
)info
->hFont
, 0 );
761 /* authors list is in iso-8859-1 format */
762 MultiByteToWideChar( 28591, 0, *pstr
, -1, name
, sizeof(name
)/sizeof(WCHAR
) );
763 SendMessageW( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)name
);
766 SendMessageW( hWndCtl
, WM_SETREDRAW
, 1, 0 );
774 HDC hDC
= BeginPaint( hWnd
, &ps
);
776 if( __get_dropline( hWnd
, &rect
) ) {
777 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
778 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
779 LineTo( hDC
, rect
.right
, rect
.bottom
);
781 EndPaint( hWnd
, &ps
);
786 if (wParam
== IDOK
|| wParam
== IDCANCEL
)
788 EndDialog(hWnd
, TRUE
);
793 EndDialog(hWnd
, TRUE
);
801 /*************************************************************************
802 * ShellAboutA [SHELL32.288]
804 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
, HICON hIcon
)
807 LPWSTR appW
= NULL
, otherW
= NULL
;
812 len
= MultiByteToWideChar(CP_ACP
, 0, szApp
, -1, NULL
, 0);
813 appW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
814 MultiByteToWideChar(CP_ACP
, 0, szApp
, -1, appW
, len
);
818 len
= MultiByteToWideChar(CP_ACP
, 0, szOtherStuff
, -1, NULL
, 0);
819 otherW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
820 MultiByteToWideChar(CP_ACP
, 0, szOtherStuff
, -1, otherW
, len
);
823 ret
= ShellAboutW(hWnd
, appW
, otherW
, hIcon
);
825 if (otherW
) HeapFree(GetProcessHeap(), 0, otherW
);
826 if (appW
) HeapFree(GetProcessHeap(), 0, appW
);
831 /*************************************************************************
832 * ShellAboutW [SHELL32.289]
834 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
845 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", (LPSTR
)RT_DIALOG
)))
847 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
850 info
.szOtherStuff
= szOtherStuff
;
851 info
.hIcon
= hIcon
? hIcon
: LoadIconW( 0, (LPWSTR
)IDI_WINLOGO
);
853 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0 );
854 info
.hFont
= CreateFontIndirectW( &logFont
);
856 bRet
= DialogBoxIndirectParamW((HINSTANCE
)GetWindowLongW( hWnd
, GWL_HINSTANCE
),
857 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
858 DeleteObject(info
.hFont
);
862 /*************************************************************************
863 * FreeIconList (SHELL32.@)
865 void WINAPI
FreeIconList( DWORD dw
)
866 { FIXME("(%lx): stub\n",dw
);
870 /*************************************************************************
871 * ShellDDEInit (SHELL32.@)
873 void WINAPI
ShellDDEInit(BOOL start
)
875 FIXME("stub: %d\n", start
);
878 /***********************************************************************
879 * DllGetVersion [SHELL32.@]
881 * Retrieves version information of the 'SHELL32.DLL'
884 * pdvi [O] pointer to version information structure.
888 * Failure: E_INVALIDARG
891 * Returns version of a shell32.dll from IE4.01 SP1.
894 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
896 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
898 WARN("wrong DLLVERSIONINFO size from app\n");
902 pdvi
->dwMajorVersion
= 4;
903 pdvi
->dwMinorVersion
= 72;
904 pdvi
->dwBuildNumber
= 3110;
905 pdvi
->dwPlatformID
= 1;
907 TRACE("%lu.%lu.%lu.%lu\n",
908 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
909 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
913 /*************************************************************************
914 * global variables of the shell32.dll
915 * all are once per process
918 HINSTANCE shell32_hInstance
= 0;
919 HIMAGELIST ShellSmallIconList
= 0;
920 HIMAGELIST ShellBigIconList
= 0;
923 /*************************************************************************
927 * calling oleinitialize here breaks sone apps.
930 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
932 TRACE("%p 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
936 case DLL_PROCESS_ATTACH
:
937 shell32_hInstance
= hinstDLL
;
938 DisableThreadLibraryCalls(shell32_hInstance
);
940 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
941 GetModuleFileNameW(hinstDLL
, swShell32Name
, MAX_PATH
);
942 swShell32Name
[MAX_PATH
- 1] = '\0';
944 InitCommonControlsEx(NULL
);
948 InitChangeNotifications();
951 case DLL_PROCESS_DETACH
:
952 shell32_hInstance
= 0;
954 FreeChangeNotifications();
960 /*************************************************************************
961 * DllInstall [SHELL32.@]
965 * BOOL bInstall - TRUE for install, FALSE for uninstall
966 * LPCWSTR pszCmdLine - command line (unused by shell32?)
969 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
971 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
973 return S_OK
; /* indicate success */
976 /***********************************************************************
977 * DllCanUnloadNow (SHELL32.@)
979 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void)
981 FIXME("(void): stub\n");