5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
13 #include "wine/winuser16.h"
18 #include "debugtools.h"
25 #include "shell32_main.h"
26 #include "wine/undocshell.h"
31 DEFAULT_DEBUG_CHANNEL(shell
);
34 /*************************************************************************
35 * CommandLineToArgvW [SHELL32.7]
37 LPWSTR
* WINAPI
CommandLineToArgvW(LPWSTR cmdline
,LPDWORD numargs
)
42 /* to get writeable copy */
43 cmdline
= HEAP_strdupW( GetProcessHeap(), 0, cmdline
);
50 while (*s
&& *s
==0x0020)
56 argv
=(LPWSTR
*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR
)*(i
+1) );
62 argv
[i
++]=HEAP_strdupW( GetProcessHeap(), 0, t
);
64 while (*s
&& *s
==0x0020)
72 argv
[i
++]=(LPWSTR
)HEAP_strdupW( GetProcessHeap(), 0, t
);
74 HeapFree( GetProcessHeap(), 0, cmdline
);
80 /*************************************************************************
81 * Control_RunDLL [SHELL32.12]
83 * Wild speculation in the following!
85 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
88 void WINAPI
Control_RunDLL( HWND hwnd
, LPCVOID code
, LPCSTR cmd
, DWORD arg4
)
90 FIXME("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd
, code
,
91 debugstr_a(cmd
), arg4
);
94 /*************************************************************************
95 * SHGetFileInfoA [SHELL32.@]
99 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
100 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
103 char szLoaction
[MAX_PATH
];
105 DWORD ret
= TRUE
, dwAttributes
= 0;
106 IShellFolder
* psfParent
= NULL
;
107 IExtractIconA
* pei
= NULL
;
108 LPITEMIDLIST pidlLast
= NULL
, pidl
= NULL
;
111 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
112 (flags
& SHGFI_PIDL
)? "pidl" : path
, dwFileAttributes
, psfi
, psfi
->dwAttributes
, sizeofpsfi
, flags
);
114 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
117 /* windows initializes this values regardless of the flags */
118 psfi
->szDisplayName
[0] = '\0';
119 psfi
->szTypeName
[0] = '\0';
122 if (flags
& SHGFI_EXETYPE
) {
126 IMAGE_DOS_HEADER mz_header
;
131 if (flags
!= SHGFI_EXETYPE
) return 0;
133 status
= GetBinaryTypeA (path
, &BinaryType
);
134 if (!status
) return 0;
135 if ((BinaryType
== SCS_DOS_BINARY
)
136 || (BinaryType
== SCS_PIF_BINARY
)) return 0x4d5a;
138 hfile
= CreateFileA( path
, GENERIC_READ
, FILE_SHARE_READ
,
139 NULL
, OPEN_EXISTING
, 0, -1 );
140 if ( hfile
== INVALID_HANDLE_VALUE
) return 0;
142 /* The next section is adapted from MODULE_GetBinaryType, as we need
143 * to examine the image header to get OS and version information. We
144 * know from calling GetBinaryTypeA that the image is valid and either
145 * an NE or PE, so much error handling can be omitted.
146 * Seek to the start of the file and read the header information.
149 SetFilePointer( hfile
, 0, NULL
, SEEK_SET
);
150 ReadFile( hfile
, &mz_header
, sizeof(mz_header
), &len
, NULL
);
152 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
153 ReadFile( hfile
, magic
, sizeof(magic
), &len
, NULL
);
154 if ( *(DWORD
*)magic
== IMAGE_NT_SIGNATURE
)
156 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
157 ReadFile( hfile
, &nt
, sizeof(nt
), &len
, NULL
);
158 CloseHandle( hfile
);
159 if (nt
.OptionalHeader
.Subsystem
== IMAGE_SUBSYSTEM_WINDOWS_GUI
) {
160 return IMAGE_NT_SIGNATURE
161 | (nt
.OptionalHeader
.MajorSubsystemVersion
<< 24)
162 | (nt
.OptionalHeader
.MinorSubsystemVersion
<< 16);
164 return IMAGE_NT_SIGNATURE
;
166 else if ( *(WORD
*)magic
== IMAGE_OS2_SIGNATURE
)
169 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
170 ReadFile( hfile
, &ne
, sizeof(ne
), &len
, NULL
);
171 CloseHandle( hfile
);
172 if (ne
.ne_exetyp
== 2) return IMAGE_OS2_SIGNATURE
173 | (ne
.ne_expver
<< 16);
176 CloseHandle( hfile
);
181 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
182 the pidl functions fail on not existing file names */
183 if (flags
& SHGFI_PIDL
)
185 pidl
= (LPCITEMIDLIST
) path
;
188 ERR("pidl is null!\n");
192 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
194 hr
= SHILCreateFromPathA ( path
, &pidl
, &dwAttributes
);
195 /* note: the attributes in ISF::ParseDisplayName are not implemented */
198 /* get the parent shellfolder */
201 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, &pidlLast
);
204 /* get the attributes of the child */
205 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
207 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
209 psfi
->dwAttributes
= 0xffffffff;
211 IShellFolder_GetAttributesOf(psfParent
, 1 , &pidlLast
, &(psfi
->dwAttributes
));
214 /* get the displayname */
215 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
217 if (flags
& SHGFI_USEFILEATTRIBUTES
)
219 strcpy (psfi
->szDisplayName
, PathFindFileNameA(path
));
224 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
225 StrRetToStrNA (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
229 /* get the type name */
230 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
232 _ILGetFileType(pidlLast
, psfi
->szTypeName
, 80);
236 if (flags
& SHGFI_LINKOVERLAY
)
237 FIXME("set icon to link, stub\n");
239 if (flags
& SHGFI_SELECTED
)
240 FIXME("set icon to selected, stub\n");
242 if (flags
& SHGFI_SHELLICONSIZE
)
243 FIXME("set icon to shell size, stub\n");
245 /* get the iconlocation */
246 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
249 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
253 hr
= IExtractIconA_GetIconLocation(pei
, (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
254 /* fixme what to do with the index? */
256 if(uFlags
!= GIL_NOTFILENAME
)
257 strcpy (psfi
->szDisplayName
, szLoaction
);
261 IExtractIconA_Release(pei
);
265 /* get icon index (or load icon)*/
266 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
268 if (flags
& SHGFI_USEFILEATTRIBUTES
)
270 char sTemp
[MAX_PATH
];
274 lstrcpynA(sTemp
, path
, MAX_PATH
);
275 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
276 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
277 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
279 if (!strcmp("%1",sTemp
)) /* icon is in the file */
283 /* FIXME: if sTemp contains a valid filename, get the icon
284 from there, index is in dwNr
288 else /* default icon */
295 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
& SHGFI_LARGEICON
),
296 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
303 ret
= (DWORD
) ((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
308 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
309 psfi
->hIcon
= pImageList_GetIcon((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
311 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
312 FIXME("unknown attribute!\n");
315 IShellFolder_Release(psfParent
);
320 if(pidlLast
) SHFree(pidlLast
);
322 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
323 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
, ret
);
328 /*************************************************************************
329 * SHGetFileInfoW [SHELL32.@]
332 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
333 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
335 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
336 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
340 /*************************************************************************
341 * SHGetFileInfoAW [SHELL32.@]
343 DWORD WINAPI
SHGetFileInfoAW(
345 DWORD dwFileAttributes
,
350 if(SHELL_OsIsUnicode())
351 return SHGetFileInfoW(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
352 return SHGetFileInfoA(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
355 /*************************************************************************
356 * DuplicateIcon [SHELL32.188]
358 HICON WINAPI
DuplicateIcon( HINSTANCE hInstance
, HICON hIcon
)
363 TRACE("(%04x, %04x)\n", hInstance
, hIcon
);
365 if(GetIconInfo(hIcon
, &IconInfo
))
367 hDupIcon
= CreateIconIndirect(&IconInfo
);
369 /* clean up hbmMask and hbmColor */
370 DeleteObject(IconInfo
.hbmMask
);
371 DeleteObject(IconInfo
.hbmColor
);
378 /*************************************************************************
379 * ExtractIconA [SHELL32.133]
382 * if the filename is not a file return 1
384 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
386 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
390 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
391 HICON16 hIcon
= *ptr
;
393 GlobalFree16(handle
);
399 /*************************************************************************
400 * ExtractIconW [SHELL32.180]
403 * is the filename is not a file return 1
405 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
411 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
412 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
414 HeapFree(GetProcessHeap(),0,exefn
);
418 /*************************************************************************
419 * FindExecutableA [SHELL32.184]
421 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
424 HINSTANCE retval
=31; /* default - 'No association was found' */
427 TRACE("File %s, Dir %s\n",
428 (lpFile
!= NULL
?lpFile
:"-"),
429 (lpDirectory
!= NULL
?lpDirectory
:"-"));
431 lpResult
[0]='\0'; /* Start off with an empty return string */
433 /* trap NULL parameters on entry */
434 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
435 { /* FIXME - should throw a warning, perhaps! */
436 return 2; /* File not found. Close enough, I guess. */
440 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
441 SetCurrentDirectoryA( lpDirectory
);
444 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
446 TRACE("returning %s\n", lpResult
);
448 SetCurrentDirectoryA( old_dir
);
452 /*************************************************************************
453 * FindExecutableW [SHELL32.219]
455 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
458 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
459 return 31; /* default - 'No association was found' */
468 #define IDC_STATIC_TEXT 100
469 #define IDC_LISTBOX 99
470 #define IDC_WINE_TEXT 98
472 #define DROP_FIELD_TOP (-15)
473 #define DROP_FIELD_HEIGHT 15
475 static HICON hIconTitleFont
;
477 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
478 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
480 { GetWindowRect( hWndCtl
, lprect
);
481 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
482 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
488 /*************************************************************************
489 * SHAppBarMessage [SHELL32.207]
491 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
493 int width
=data
->rc
.right
- data
->rc
.left
;
494 int height
=data
->rc
.bottom
- data
->rc
.top
;
498 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
499 case ABM_GETTASKBARPOS
:
500 GetWindowRect(data
->hWnd
, &rec
);
504 SetActiveWindow(data
->hWnd
);
506 case ABM_GETAUTOHIDEBAR
:
507 data
->hWnd
=GetActiveWindow();
510 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
511 width
,height
,SWP_SHOWWINDOW
);
514 GetWindowRect(data
->hWnd
, &(data
->rc
));
517 CloseHandle(data
->hWnd
);
519 case ABM_SETAUTOHIDEBAR
:
520 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
521 width
,height
,SWP_SHOWWINDOW
);
524 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
525 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
526 width
,height
,SWP_SHOWWINDOW
);
528 case ABM_WINDOWPOSCHANGED
:
529 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
530 width
,height
,SWP_SHOWWINDOW
);
536 /*************************************************************************
537 * SHHelpShortcuts_RunDLL [SHELL32.224]
540 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
541 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
542 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
547 /*************************************************************************
548 * SHLoadInProc [SHELL32.225]
549 * Create an instance of specified object class from within
550 * the shell process and release it immediately
553 DWORD WINAPI
SHLoadInProc (REFCLSID rclsid
)
555 IUnknown
* pUnk
= NULL
;
556 TRACE("%s\n", debugstr_guid(rclsid
));
558 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,(LPVOID
*)pUnk
);
561 IUnknown_Release(pUnk
);
564 return DISP_E_MEMBERNOTFOUND
;
567 /*************************************************************************
568 * ShellExecuteA [SHELL32.245]
570 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
571 LPCSTR lpFile
, LPCSTR lpParameters
,
572 LPCSTR lpDirectory
, INT iShowCmd
)
574 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
575 lpDirectory
, iShowCmd
);
578 /*************************************************************************
579 * ShellExecuteW [SHELL32.294]
581 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
582 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
589 LPCWSTR lpParameters
,
597 /*************************************************************************
598 * AboutDlgProc (internal)
600 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
603 char Template
[512], AppTitle
[512];
608 { case WM_INITDIALOG
:
609 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
611 { const char* const *pstr
= SHELL_People
;
612 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
613 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
614 sprintf( AppTitle
, Template
, info
->szApp
);
615 SetWindowTextA( hWnd
, AppTitle
);
616 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
617 info
->szOtherStuff
);
618 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
619 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
623 SystemParametersInfoA( SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0 );
624 hIconTitleFont
= CreateFontIndirectA( &logFont
);
626 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
628 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
631 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
639 HDC hDC
= BeginPaint( hWnd
, &ps
);
641 if( __get_dropline( hWnd
, &rect
) ) {
642 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
643 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
644 LineTo( hDC
, rect
.right
, rect
.bottom
);
646 EndPaint( hWnd
, &ps
);
650 #if 0 /* FIXME: should use DoDragDrop */
651 case WM_LBTRACKPOINT
:
652 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
653 if( (INT16
)GetKeyState( VK_CONTROL
) < 0 )
654 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
655 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
657 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
658 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
659 char* pstr
= (char*)GlobalLock16( hMemObj
);
662 { HCURSOR hCursor
= LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT
) );
663 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
664 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
665 UpdateWindow( hWndCtl
);
666 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
667 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
670 GlobalFree16( hMemObj
);
677 case WM_QUERYDROPOBJECT
:
679 { LPDRAGINFO16 lpDragInfo
= (LPDRAGINFO16
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
680 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
682 if( __get_dropline( hWnd
, &rect
) )
684 pt
.x
=lpDragInfo
->pt
.x
;
685 pt
.x
=lpDragInfo
->pt
.y
;
686 rect
.bottom
+= DROP_FIELD_HEIGHT
;
687 if( PtInRect( &rect
, pt
) )
688 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
698 { LPDRAGINFO16 lpDragInfo
= (LPDRAGINFO16
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
699 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
700 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
702 { static char __appendix_str
[] = " with";
704 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
705 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
706 if( !strncmp( Template
, "WINE", 4 ) )
707 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
709 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
711 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
712 (WPARAM
)-1, (LPARAM
)Template
);
715 strcpy( Template
, pstr
);
716 strcat( Template
, __appendix_str
);
717 SetWindowTextA( hWndCtl
, Template
);
718 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
727 { EndDialog(hWnd
, TRUE
);
732 EndDialog(hWnd
, TRUE
);
740 /*************************************************************************
741 * ShellAboutA [SHELL32.243]
743 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
750 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
752 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
756 info
.szOtherStuff
= szOtherStuff
;
758 if (!hIcon
) info
.hIcon
= LoadIconA( 0, MAKEINTRESOURCEA(OIC_WINEICON
) );
759 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
760 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
764 /*************************************************************************
765 * ShellAboutW [SHELL32.244]
767 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
776 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
778 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
781 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
782 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
784 if (!hIcon
) info
.hIcon
= LoadIconA( 0, MAKEINTRESOURCEA(OIC_WINEICON
) );
785 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
786 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
787 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
788 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
792 /*************************************************************************
795 void WINAPI
FreeIconList( DWORD dw
)
796 { FIXME("(%lx): stub\n",dw
);
799 /***********************************************************************
800 * DllGetVersion [SHELL32]
802 * Retrieves version information of the 'SHELL32.DLL'
805 * pdvi [O] pointer to version information structure.
809 * Failure: E_INVALIDARG
812 * Returns version of a shell32.dll from IE4.01 SP1.
815 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
817 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
819 WARN("wrong DLLVERSIONINFO size from app");
823 pdvi
->dwMajorVersion
= 4;
824 pdvi
->dwMinorVersion
= 72;
825 pdvi
->dwBuildNumber
= 3110;
826 pdvi
->dwPlatformID
= 1;
828 TRACE("%lu.%lu.%lu.%lu\n",
829 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
830 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
834 /*************************************************************************
835 * global variables of the shell32.dll
836 * all are once per process
839 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
840 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
841 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
842 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
843 BOOL (WINAPI
* pImageList_Draw
) (HIMAGELIST himl
, int i
, HDC hdcDest
, int x
, int y
, UINT fStyle
);
844 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
845 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
846 COLORREF (WINAPI
*pImageList_SetBkColor
)(HIMAGELIST
, COLORREF
);
848 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
849 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
851 HDPA (WINAPI
* pDPA_Create
) (INT
);
852 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
853 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
854 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
855 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
856 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
857 LPVOID (WINAPI
*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
860 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
861 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
863 static HINSTANCE hComctl32
;
864 static INT shell32_RefCount
= 0;
866 LONG shell32_ObjCount
= 0;
867 HINSTANCE shell32_hInstance
= 0;
869 HIMAGELIST ShellSmallIconList
= 0;
870 HIMAGELIST ShellBigIconList
= 0;
873 /*************************************************************************
877 * calling oleinitialize here breaks sone apps.
880 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
882 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
886 case DLL_PROCESS_ATTACH
:
888 if (shell32_hInstance
) return TRUE
;
890 shell32_hInstance
= hinstDLL
;
891 hComctl32
= GetModuleHandleA("COMCTL32.DLL");
892 if(!huser32
) huser32
= GetModuleHandleA("USER32.DLL");
893 DisableThreadLibraryCalls(shell32_hInstance
);
895 if (!hComctl32
|| !huser32
)
897 ERR("P A N I C SHELL32 loading failed\n");
902 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
903 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
904 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
905 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
906 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
907 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
908 pImageList_Draw
=(void*)GetProcAddress(hComctl32
,"ImageList_Draw");
909 pImageList_SetBkColor
=(void*)GetProcAddress(hComctl32
,"ImageList_SetBkColor");
910 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
911 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
912 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
913 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
914 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
915 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
916 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
917 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
918 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
920 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(huser32
,"LookupIconIdFromDirectoryEx");
921 pCreateIconFromResourceEx
=(void*)GetProcAddress(huser32
,"CreateIconFromResourceEx");
923 /* initialize the common controls */
926 pDLLInitComctl(NULL
);
931 InitChangeNotifications();
932 SHInitRestricted(NULL
, NULL
);
935 case DLL_THREAD_ATTACH
:
939 case DLL_THREAD_DETACH
:
943 case DLL_PROCESS_DETACH
:
946 if ( !shell32_RefCount
)
948 shell32_hInstance
= 0;
952 IShellFolder_Release(pdesktopfolder
);
953 pdesktopfolder
= NULL
;
957 FreeChangeNotifications();
959 /* this one is here to check if AddRef/Release is balanced */
960 if (shell32_ObjCount
)
962 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount
);
966 TRACE("refcount=%u objcount=%lu \n", shell32_RefCount
, shell32_ObjCount
);
972 /*************************************************************************
973 * DllInstall [SHELL32.202]
977 * BOOL bInstall - TRUE for install, FALSE for uninstall
978 * LPCWSTR pszCmdLine - command line (unused by shell32?)
981 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
983 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
985 return S_OK
; /* indicate success */
988 /***********************************************************************
989 * DllCanUnloadNow (SHELL32.@)
991 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void)
993 FIXME("(void): stub\n");