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"
48 #include "wine/debug.h"
49 #include "wine/unicode.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
53 extern const char * const SHELL_Authors
[];
56 /*************************************************************************
57 * CommandLineToArgvW [SHELL32.@]
59 * We must interpret the quotes in the command line to rebuild the argv
61 * - arguments are separated by spaces or tabs
62 * - quotes serve as optional argument delimiters
64 * - escaped quotes must be converted back to '"'
66 * - an odd number of '\'s followed by '"' correspond to half that number
67 * of '\' followed by a '"' (extension of the above)
70 * - an even number of '\'s followed by a '"' correspond to half that number
71 * of '\', plus a regular quote serving as an argument delimiter (which
72 * means it does not appear in the result)
73 * 'a\\"b c"' -> 'a\b c'
74 * 'a\\\\"b c"' -> 'a\\b c'
75 * - '\' that are not followed by a '"' are copied literally
85 LPWSTR
* WINAPI
CommandLineToArgvW(LPCWSTR lpCmdline
, int* numargs
)
97 /* Return the path to the executable */
100 hargv
=GlobalAlloc(size
, 0);
101 argv
=GlobalLock(hargv
);
104 len
= GetModuleFileNameW(0, (LPWSTR
)(argv
+1), size
-sizeof(LPWSTR
));
110 if (len
< size
) break;
112 hargv
=GlobalReAlloc(hargv
, size
, 0);
113 argv
=GlobalLock(hargv
);
115 argv
[0]=(LPWSTR
)(argv
+1);
122 /* to get a writeable copy */
129 if (*cs
==0 || ((*cs
==0x0009 || *cs
==0x0020) && !in_quotes
))
133 /* skip the remaining spaces */
134 while (*cs
==0x0009 || *cs
==0x0020) {
142 else if (*cs
==0x005c)
144 /* '\', count them */
147 else if ((*cs
==0x0022) && ((bcount
& 1)==0))
150 in_quotes
=!in_quotes
;
155 /* a regular character */
160 /* Allocate in a single lump, the string array, and the strings that go with it.
161 * This way the caller can make a single GlobalFree call to free both, as per MSDN.
163 hargv
=GlobalAlloc(0, argc
*sizeof(LPWSTR
)+(strlenW(lpCmdline
)+1)*sizeof(WCHAR
));
164 argv
=GlobalLock(hargv
);
167 cmdline
=(LPWSTR
)(argv
+argc
);
168 strcpyW(cmdline
, lpCmdline
);
176 if ((*s
==0x0009 || *s
==0x0020) && !in_quotes
)
178 /* Close the argument and copy it */
182 /* skip the remaining spaces */
185 } while (*s
==0x0009 || *s
==0x0020);
187 /* Start with a new argument */
202 /* Preceded by an even number of '\', this is half that
203 * number of '\', plus a quote which we erase.
206 in_quotes
=!in_quotes
;
211 /* Preceded by an odd number of '\', this is half that
212 * number of '\' followed by a '"'
222 /* a regular character */
238 #define SHGFI_KNOWN_FLAGS \
239 (SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \
240 SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \
241 SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \
242 SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \
243 SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED)
245 /*************************************************************************
246 * SHGetFileInfoW [SHELL32.@]
249 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
250 SHFILEINFOW
*psfi
, UINT sizeofpsfi
, UINT flags
)
252 WCHAR szLocation
[MAX_PATH
], szFullPath
[MAX_PATH
];
254 DWORD ret
= TRUE
, dwAttributes
= 0;
255 IShellFolder
* psfParent
= NULL
;
256 IExtractIconW
* pei
= NULL
;
257 LPITEMIDLIST pidlLast
= NULL
, pidl
= NULL
;
259 BOOL IconNotYetLoaded
=TRUE
;
261 TRACE("%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x\n",
262 (flags
& SHGFI_PIDL
)? "pidl" : debugstr_w(path
), dwFileAttributes
,
263 psfi
, psfi
->dwAttributes
, sizeofpsfi
, flags
);
265 if ( (flags
& SHGFI_USEFILEATTRIBUTES
) &&
266 (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
269 /* windows initializes this values regardless of the flags */
272 psfi
->szDisplayName
[0] = '\0';
273 psfi
->szTypeName
[0] = '\0';
277 if (!(flags
& SHGFI_PIDL
))
279 /* SHGitFileInfo should work with absolute and relative paths */
280 if (PathIsRelativeW(path
))
282 GetCurrentDirectoryW(MAX_PATH
, szLocation
);
283 PathCombineW(szFullPath
, szLocation
, path
);
287 lstrcpynW(szFullPath
, path
, MAX_PATH
);
291 if (flags
& SHGFI_EXETYPE
)
296 IMAGE_DOS_HEADER mz_header
;
301 if (flags
!= SHGFI_EXETYPE
)
304 status
= GetBinaryTypeW (szFullPath
, &BinaryType
);
307 if ((BinaryType
== SCS_DOS_BINARY
) || (BinaryType
== SCS_PIF_BINARY
))
310 hfile
= CreateFileW( szFullPath
, GENERIC_READ
, FILE_SHARE_READ
,
311 NULL
, OPEN_EXISTING
, 0, 0 );
312 if ( hfile
== INVALID_HANDLE_VALUE
)
316 * The next section is adapted from MODULE_GetBinaryType, as we need
317 * to examine the image header to get OS and version information. We
318 * know from calling GetBinaryTypeA that the image is valid and either
319 * an NE or PE, so much error handling can be omitted.
320 * Seek to the start of the file and read the header information.
323 SetFilePointer( hfile
, 0, NULL
, SEEK_SET
);
324 ReadFile( hfile
, &mz_header
, sizeof(mz_header
), &len
, NULL
);
326 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
327 ReadFile( hfile
, magic
, sizeof(magic
), &len
, NULL
);
328 if ( *(DWORD
*)magic
== IMAGE_NT_SIGNATURE
)
330 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
331 ReadFile( hfile
, &nt
, sizeof(nt
), &len
, NULL
);
332 CloseHandle( hfile
);
333 if (nt
.OptionalHeader
.Subsystem
== IMAGE_SUBSYSTEM_WINDOWS_GUI
)
335 return IMAGE_NT_SIGNATURE
|
336 (nt
.OptionalHeader
.MajorSubsystemVersion
<< 24) |
337 (nt
.OptionalHeader
.MinorSubsystemVersion
<< 16);
339 return IMAGE_NT_SIGNATURE
;
341 else if ( *(WORD
*)magic
== IMAGE_OS2_SIGNATURE
)
344 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
345 ReadFile( hfile
, &ne
, sizeof(ne
), &len
, NULL
);
346 CloseHandle( hfile
);
347 if (ne
.ne_exetyp
== 2)
348 return IMAGE_OS2_SIGNATURE
| (ne
.ne_expver
<< 16);
351 CloseHandle( hfile
);
356 * psfi is NULL normally to query EXE type. If it is NULL, none of the
357 * below makes sense anyway. Windows allows this and just returns FALSE
363 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES
365 * The pidl functions fail on not existing file names
368 if (flags
& SHGFI_PIDL
)
370 pidl
= ILClone((LPCITEMIDLIST
)path
);
372 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
374 hr
= SHILCreateFromPathW(szFullPath
, &pidl
, &dwAttributes
);
377 if ((flags
& SHGFI_PIDL
) || !(flags
& SHGFI_USEFILEATTRIBUTES
))
379 /* get the parent shellfolder */
382 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
,
383 (LPCITEMIDLIST
*)&pidlLast
);
388 ERR("pidl is null!\n");
393 /* get the attributes of the child */
394 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
396 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
398 psfi
->dwAttributes
= 0xffffffff;
400 IShellFolder_GetAttributesOf( psfParent
, 1, (LPCITEMIDLIST
*)&pidlLast
,
401 &(psfi
->dwAttributes
) );
404 /* get the displayname */
405 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
407 if (flags
& SHGFI_USEFILEATTRIBUTES
)
409 lstrcpyW (psfi
->szDisplayName
, PathFindFileNameW(szFullPath
));
414 hr
= IShellFolder_GetDisplayNameOf( psfParent
, pidlLast
,
415 SHGDN_INFOLDER
, &str
);
416 StrRetToStrNW (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
420 /* get the type name */
421 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
423 static const WCHAR szFile
[] = { 'F','i','l','e',0 };
424 static const WCHAR szDashFile
[] = { '-','f','i','l','e',0 };
426 if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
430 _ILGetFileType(pidlLast
, ftype
, 80);
431 MultiByteToWideChar(CP_ACP
, 0, ftype
, -1, psfi
->szTypeName
, 80 );
435 if (dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
436 strcatW (psfi
->szTypeName
, szFile
);
441 lstrcpyW(sTemp
,PathFindExtensionW(szFullPath
));
442 if (!( HCR_MapTypeToValueW(sTemp
, sTemp
, 64, TRUE
) &&
443 HCR_MapTypeToValueW(sTemp
, psfi
->szTypeName
, 80, FALSE
)))
445 lstrcpynW (psfi
->szTypeName
, sTemp
, 64);
446 strcatW (psfi
->szTypeName
, szDashFile
);
453 if (flags
& SHGFI_ADDOVERLAYS
)
454 FIXME("SHGFI_ADDOVERLAYS unhandled\n");
456 if (flags
& SHGFI_OVERLAYINDEX
)
457 FIXME("SHGFI_OVERLAYINDEX unhandled\n");
459 if (flags
& SHGFI_LINKOVERLAY
)
460 FIXME("set icon to link, stub\n");
462 if (flags
& SHGFI_SELECTED
)
463 FIXME("set icon to selected, stub\n");
465 if (flags
& SHGFI_SHELLICONSIZE
)
466 FIXME("set icon to shell size, stub\n");
468 /* get the iconlocation */
469 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
473 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1,
474 (LPCITEMIDLIST
*)&pidlLast
, &IID_IExtractIconA
,
475 &uDummy
, (LPVOID
*)&pei
);
478 hr
= IExtractIconW_GetIconLocation(pei
,
479 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,
480 szLocation
, MAX_PATH
, &iIndex
, &uFlags
);
481 psfi
->iIcon
= iIndex
;
483 if (uFlags
!= GIL_NOTFILENAME
)
484 lstrcpyW (psfi
->szDisplayName
, szLocation
);
488 IExtractIconA_Release(pei
);
492 /* get icon index (or load icon)*/
493 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
495 if (flags
& SHGFI_USEFILEATTRIBUTES
)
497 WCHAR sTemp
[MAX_PATH
];
501 lstrcpynW(sTemp
, szFullPath
, MAX_PATH
);
503 if (dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
)
507 static const WCHAR p1W
[] = {'%','1',0};
510 szExt
= (LPWSTR
) PathFindExtensionW(sTemp
);
512 HCR_MapTypeToValueW(szExt
, sTemp
, MAX_PATH
, TRUE
) &&
513 HCR_GetDefaultIconW(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
515 if (!lstrcmpW(p1W
,sTemp
)) /* icon is in the file */
516 strcpyW(sTemp
, szFullPath
);
518 if (flags
& SHGFI_SYSICONINDEX
)
520 psfi
->iIcon
= SIC_GetIconIndex(sTemp
,dwNr
);
521 if (psfi
->iIcon
== -1)
526 IconNotYetLoaded
=FALSE
;
527 if (flags
& SHGFI_SMALLICON
)
528 PrivateExtractIconsW( sTemp
,dwNr
,
529 GetSystemMetrics( SM_CXSMICON
),
530 GetSystemMetrics( SM_CYSMICON
),
531 &psfi
->hIcon
, 0, 1, 0);
533 PrivateExtractIconsW( sTemp
, dwNr
,
534 GetSystemMetrics( SM_CXICON
),
535 GetSystemMetrics( SM_CYICON
),
536 &psfi
->hIcon
, 0, 1, 0);
544 if (!(PidlToSicIndex(psfParent
, pidlLast
, !(flags
& SHGFI_SMALLICON
),
545 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
552 if (flags
& SHGFI_SMALLICON
)
553 ret
= (DWORD
) ShellSmallIconList
;
555 ret
= (DWORD
) ShellBigIconList
;
560 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
) && IconNotYetLoaded
)
562 if (flags
& SHGFI_SMALLICON
)
563 psfi
->hIcon
= ImageList_GetIcon( ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
565 psfi
->hIcon
= ImageList_GetIcon( ShellBigIconList
, psfi
->iIcon
, ILD_NORMAL
);
568 if (flags
& ~SHGFI_KNOWN_FLAGS
)
569 FIXME("unknown flags %08x\n", flags
& ~SHGFI_KNOWN_FLAGS
);
572 IShellFolder_Release(psfParent
);
581 TRACE ("icon=%p index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
582 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
,
583 debugstr_w(psfi
->szDisplayName
), debugstr_w(psfi
->szTypeName
), ret
);
589 /*************************************************************************
590 * SHGetFileInfoA [SHELL32.@]
592 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
593 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
599 SHFILEINFOW temppsfi
;
601 if (flags
& SHGFI_PIDL
)
603 /* path contains a pidl */
604 temppath
= (LPWSTR
) path
;
608 len
= MultiByteToWideChar(CP_ACP
, 0, path
, -1, NULL
, 0);
609 temppath
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
610 MultiByteToWideChar(CP_ACP
, 0, path
, -1, temppath
, len
);
613 if (psfi
&& (flags
& SHGFI_ATTR_SPECIFIED
))
614 temppsfi
.dwAttributes
=psfi
->dwAttributes
;
617 ret
= SHGetFileInfoW(temppath
, dwFileAttributes
, NULL
, sizeof(temppsfi
), flags
);
619 ret
= SHGetFileInfoW(temppath
, dwFileAttributes
, &temppsfi
, sizeof(temppsfi
), flags
);
623 if(flags
& SHGFI_ICON
)
624 psfi
->hIcon
=temppsfi
.hIcon
;
625 if(flags
& (SHGFI_SYSICONINDEX
|SHGFI_ICON
|SHGFI_ICONLOCATION
))
626 psfi
->iIcon
=temppsfi
.iIcon
;
627 if(flags
& SHGFI_ATTRIBUTES
)
628 psfi
->dwAttributes
=temppsfi
.dwAttributes
;
629 if(flags
& (SHGFI_DISPLAYNAME
|SHGFI_ICONLOCATION
))
631 WideCharToMultiByte(CP_ACP
, 0, temppsfi
.szDisplayName
, -1,
632 psfi
->szDisplayName
, sizeof(psfi
->szDisplayName
), NULL
, NULL
);
634 if(flags
& SHGFI_TYPENAME
)
636 WideCharToMultiByte(CP_ACP
, 0, temppsfi
.szTypeName
, -1,
637 psfi
->szTypeName
, sizeof(psfi
->szTypeName
), NULL
, NULL
);
641 if (!(flags
& SHGFI_PIDL
))
642 HeapFree(GetProcessHeap(), 0, temppath
);
647 /*************************************************************************
648 * DuplicateIcon [SHELL32.@]
650 HICON WINAPI
DuplicateIcon( HINSTANCE hInstance
, HICON hIcon
)
655 TRACE("%p %p\n", hInstance
, hIcon
);
657 if (GetIconInfo(hIcon
, &IconInfo
))
659 hDupIcon
= CreateIconIndirect(&IconInfo
);
661 /* clean up hbmMask and hbmColor */
662 DeleteObject(IconInfo
.hbmMask
);
663 DeleteObject(IconInfo
.hbmColor
);
669 /*************************************************************************
670 * ExtractIconA [SHELL32.@]
672 HICON WINAPI
ExtractIconA(HINSTANCE hInstance
, LPCSTR lpszFile
, UINT nIconIndex
)
675 INT len
= MultiByteToWideChar(CP_ACP
, 0, lpszFile
, -1, NULL
, 0);
676 LPWSTR lpwstrFile
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
678 TRACE("%p %s %d\n", hInstance
, lpszFile
, nIconIndex
);
680 MultiByteToWideChar(CP_ACP
, 0, lpszFile
, -1, lpwstrFile
, len
);
681 ret
= ExtractIconW(hInstance
, lpwstrFile
, nIconIndex
);
682 HeapFree(GetProcessHeap(), 0, lpwstrFile
);
687 /*************************************************************************
688 * ExtractIconW [SHELL32.@]
690 HICON WINAPI
ExtractIconW(HINSTANCE hInstance
, LPCWSTR lpszFile
, UINT nIconIndex
)
694 UINT cx
= GetSystemMetrics(SM_CXICON
), cy
= GetSystemMetrics(SM_CYICON
);
696 TRACE("%p %s %d\n", hInstance
, debugstr_w(lpszFile
), nIconIndex
);
698 if (nIconIndex
== 0xFFFFFFFF)
700 ret
= PrivateExtractIconsW(lpszFile
, 0, cx
, cy
, NULL
, NULL
, 0, LR_DEFAULTCOLOR
);
701 if (ret
!= 0xFFFFFFFF && ret
)
706 ret
= PrivateExtractIconsW(lpszFile
, nIconIndex
, cx
, cy
, &hIcon
, NULL
, 1, LR_DEFAULTCOLOR
);
708 if (ret
== 0xFFFFFFFF)
710 else if (ret
> 0 && hIcon
)
719 LPCWSTR szOtherStuff
;
724 #define IDC_STATIC_TEXT1 100
725 #define IDC_STATIC_TEXT2 101
726 #define IDC_LISTBOX 99
727 #define IDC_WINE_TEXT 98
729 #define DROP_FIELD_TOP (-15)
730 #define DROP_FIELD_HEIGHT 15
732 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
734 HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
738 GetWindowRect( hWndCtl
, lprect
);
739 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
740 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
746 /*************************************************************************
747 * SHAppBarMessage [SHELL32.@]
749 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
751 int width
=data
->rc
.right
- data
->rc
.left
;
752 int height
=data
->rc
.bottom
- data
->rc
.top
;
758 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
759 case ABM_GETTASKBARPOS
:
760 GetWindowRect(data
->hWnd
, &rec
);
764 SetActiveWindow(data
->hWnd
);
766 case ABM_GETAUTOHIDEBAR
:
767 data
->hWnd
=GetActiveWindow();
770 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
771 width
,height
,SWP_SHOWWINDOW
);
774 GetWindowRect(data
->hWnd
, &(data
->rc
));
777 FIXME("ABM_REMOVE broken\n");
778 /* FIXME: this is wrong; should it be DestroyWindow instead? */
779 /*CloseHandle(data->hWnd);*/
781 case ABM_SETAUTOHIDEBAR
:
782 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
783 width
,height
,SWP_SHOWWINDOW
);
786 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
787 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
788 width
,height
,SWP_SHOWWINDOW
);
790 case ABM_WINDOWPOSCHANGED
:
796 /*************************************************************************
797 * SHHelpShortcuts_RunDLLA [SHELL32.@]
800 DWORD WINAPI
SHHelpShortcuts_RunDLLA(DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
802 FIXME("(%lx, %lx, %lx, %lx) stub!\n", dwArg1
, dwArg2
, dwArg3
, dwArg4
);
806 /*************************************************************************
807 * SHHelpShortcuts_RunDLLA [SHELL32.@]
810 DWORD WINAPI
SHHelpShortcuts_RunDLLW(DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
812 FIXME("(%lx, %lx, %lx, %lx) stub!\n", dwArg1
, dwArg2
, dwArg3
, dwArg4
);
816 /*************************************************************************
817 * SHLoadInProc [SHELL32.@]
818 * Create an instance of specified object class from within
819 * the shell process and release it immediately
821 HRESULT WINAPI
SHLoadInProc (REFCLSID rclsid
)
825 TRACE("%s\n", debugstr_guid(rclsid
));
827 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,&ptr
);
830 IUnknown
* pUnk
= ptr
;
831 IUnknown_Release(pUnk
);
834 return DISP_E_MEMBERNOTFOUND
;
837 /*************************************************************************
838 * AboutDlgProc (internal)
840 INT_PTR CALLBACK
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
851 ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
852 WCHAR Template
[512], AppTitle
[512];
856 const char* const *pstr
= SHELL_Authors
;
857 SendDlgItemMessageW(hWnd
, stc1
, STM_SETICON
,(WPARAM
)info
->hIcon
, 0);
858 GetWindowTextW( hWnd
, Template
, sizeof(Template
)/sizeof(WCHAR
) );
859 sprintfW( AppTitle
, Template
, info
->szApp
);
860 SetWindowTextW( hWnd
, AppTitle
);
861 SetWindowTextW( GetDlgItem(hWnd
, IDC_STATIC_TEXT1
), info
->szApp
);
862 SetWindowTextW( GetDlgItem(hWnd
, IDC_STATIC_TEXT2
), info
->szOtherStuff
);
863 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
864 SendMessageW( hWndCtl
, WM_SETREDRAW
, 0, 0 );
865 SendMessageW( hWndCtl
, WM_SETFONT
, (WPARAM
)info
->hFont
, 0 );
869 /* authors list is in iso-8859-1 format */
870 MultiByteToWideChar( 28591, 0, *pstr
, -1, name
, sizeof(name
)/sizeof(WCHAR
) );
871 SendMessageW( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)name
);
874 SendMessageW( hWndCtl
, WM_SETREDRAW
, 1, 0 );
883 HDC hDC
= BeginPaint( hWnd
, &ps
);
885 if (__get_dropline( hWnd
, &rect
))
887 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
888 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
889 LineTo( hDC
, rect
.right
, rect
.bottom
);
891 EndPaint( hWnd
, &ps
);
896 if (wParam
== IDOK
|| wParam
== IDCANCEL
)
898 EndDialog(hWnd
, TRUE
);
903 EndDialog(hWnd
, TRUE
);
911 /*************************************************************************
912 * ShellAboutA [SHELL32.288]
914 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
, HICON hIcon
)
917 LPWSTR appW
= NULL
, otherW
= NULL
;
922 len
= MultiByteToWideChar(CP_ACP
, 0, szApp
, -1, NULL
, 0);
923 appW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
924 MultiByteToWideChar(CP_ACP
, 0, szApp
, -1, appW
, len
);
928 len
= MultiByteToWideChar(CP_ACP
, 0, szOtherStuff
, -1, NULL
, 0);
929 otherW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(WCHAR
));
930 MultiByteToWideChar(CP_ACP
, 0, szOtherStuff
, -1, otherW
, len
);
933 ret
= ShellAboutW(hWnd
, appW
, otherW
, hIcon
);
935 HeapFree(GetProcessHeap(), 0, otherW
);
936 HeapFree(GetProcessHeap(), 0, appW
);
941 /*************************************************************************
942 * ShellAboutW [SHELL32.289]
944 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
952 static const WCHAR wszSHELL_ABOUT_MSGBOX
[] =
953 {'S','H','E','L','L','_','A','B','O','U','T','_','M','S','G','B','O','X',0};
957 if(!(hRes
= FindResourceW(shell32_hInstance
, wszSHELL_ABOUT_MSGBOX
, (LPWSTR
)RT_DIALOG
)))
959 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
962 info
.szOtherStuff
= szOtherStuff
;
963 info
.hIcon
= hIcon
? hIcon
: LoadIconW( 0, (LPWSTR
)IDI_WINLOGO
);
965 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0 );
966 info
.hFont
= CreateFontIndirectW( &logFont
);
968 bRet
= DialogBoxIndirectParamW((HINSTANCE
)GetWindowLongPtrW( hWnd
, GWLP_HINSTANCE
),
969 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
970 DeleteObject(info
.hFont
);
974 /*************************************************************************
975 * FreeIconList (SHELL32.@)
977 void WINAPI
FreeIconList( DWORD dw
)
979 FIXME("%lx: stub\n",dw
);
983 /*************************************************************************
984 * ShellDDEInit (SHELL32.@)
986 void WINAPI
ShellDDEInit(BOOL start
)
988 FIXME("stub: %d\n", start
);
991 /***********************************************************************
992 * DllGetVersion [SHELL32.@]
994 * Retrieves version information of the 'SHELL32.DLL'
997 * pdvi [O] pointer to version information structure.
1001 * Failure: E_INVALIDARG
1004 * Returns version of a shell32.dll from IE4.01 SP1.
1007 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
1009 /* FIXME: shouldn't these values come from the version resource? */
1010 if (pdvi
->cbSize
== sizeof(DLLVERSIONINFO
) ||
1011 pdvi
->cbSize
== sizeof(DLLVERSIONINFO2
))
1013 pdvi
->dwMajorVersion
= WINE_FILEVERSION_MAJOR
;
1014 pdvi
->dwMinorVersion
= WINE_FILEVERSION_MINOR
;
1015 pdvi
->dwBuildNumber
= WINE_FILEVERSION_BUILD
;
1016 pdvi
->dwPlatformID
= WINE_FILEVERSION_PLATFORMID
;
1017 if (pdvi
->cbSize
== sizeof(DLLVERSIONINFO2
))
1019 DLLVERSIONINFO2
*pdvi2
= (DLLVERSIONINFO2
*)pdvi
;
1022 pdvi2
->ullVersion
= MAKEDLLVERULL(WINE_FILEVERSION_MAJOR
,
1023 WINE_FILEVERSION_MINOR
,
1024 WINE_FILEVERSION_BUILD
,
1025 WINE_FILEVERSION_PLATFORMID
);
1027 TRACE("%lu.%lu.%lu.%lu\n",
1028 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
1029 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
1034 WARN("wrong DLLVERSIONINFO size from app\n");
1035 return E_INVALIDARG
;
1039 /*************************************************************************
1040 * global variables of the shell32.dll
1041 * all are once per process
1044 HINSTANCE shell32_hInstance
= 0;
1045 HIMAGELIST ShellSmallIconList
= 0;
1046 HIMAGELIST ShellBigIconList
= 0;
1049 /*************************************************************************
1053 * calling oleinitialize here breaks sone apps.
1055 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
1057 TRACE("%p 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
1061 case DLL_PROCESS_ATTACH
:
1062 shell32_hInstance
= hinstDLL
;
1063 DisableThreadLibraryCalls(shell32_hInstance
);
1065 /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
1066 GetModuleFileNameW(hinstDLL
, swShell32Name
, MAX_PATH
);
1067 swShell32Name
[MAX_PATH
- 1] = '\0';
1069 InitCommonControlsEx(NULL
);
1073 InitChangeNotifications();
1076 case DLL_PROCESS_DETACH
:
1077 shell32_hInstance
= 0;
1079 FreeChangeNotifications();
1085 /*************************************************************************
1086 * DllInstall [SHELL32.@]
1090 * BOOL bInstall - TRUE for install, FALSE for uninstall
1091 * LPCWSTR pszCmdLine - command line (unused by shell32?)
1094 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
1096 FIXME("%s %s: stub\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
1097 return S_OK
; /* indicate success */
1100 /***********************************************************************
1101 * DllCanUnloadNow (SHELL32.@)
1103 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void)