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 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
123 the pidl functions fail on not existing file names */
124 if (flags
& SHGFI_PIDL
)
126 pidl
= (LPCITEMIDLIST
) path
;
129 ERR("pidl is null!\n");
133 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
135 hr
= SHILCreateFromPathA ( path
, &pidl
, &dwAttributes
);
136 /* note: the attributes in ISF::ParseDisplayName are not implemented */
139 /* get the parent shellfolder */
142 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, &pidlLast
);
145 /* get the attributes of the child */
146 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
148 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
150 psfi
->dwAttributes
= 0xffffffff;
152 IShellFolder_GetAttributesOf(psfParent
, 1 , &pidlLast
, &(psfi
->dwAttributes
));
155 /* get the displayname */
156 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
158 if (flags
& SHGFI_USEFILEATTRIBUTES
)
160 strcpy (psfi
->szDisplayName
, PathFindFileNameA(path
));
165 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
166 StrRetToStrNA (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
170 /* get the type name */
171 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
173 _ILGetFileType(pidlLast
, psfi
->szTypeName
, 80);
177 if (flags
& SHGFI_LINKOVERLAY
)
178 FIXME("set icon to link, stub\n");
180 if (flags
& SHGFI_SELECTED
)
181 FIXME("set icon to selected, stub\n");
183 if (flags
& SHGFI_SHELLICONSIZE
)
184 FIXME("set icon to shell size, stub\n");
186 /* get the iconlocation */
187 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
190 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
194 hr
= IExtractIconA_GetIconLocation(pei
, (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
195 /* fixme what to do with the index? */
197 if(uFlags
!= GIL_NOTFILENAME
)
198 strcpy (psfi
->szDisplayName
, szLoaction
);
202 IExtractIconA_Release(pei
);
206 /* get icon index (or load icon)*/
207 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
209 if (flags
& SHGFI_USEFILEATTRIBUTES
)
211 char sTemp
[MAX_PATH
];
215 lstrcpynA(sTemp
, path
, MAX_PATH
);
216 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
217 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
218 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
220 if (!strcmp("%1",sTemp
)) /* icon is in the file */
224 /* FIXME: if sTemp contains a valid filename, get the icon
225 from there, index is in dwNr
229 else /* default icon */
236 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
& SHGFI_LARGEICON
),
237 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
244 ret
= (DWORD
) ((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
249 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
250 psfi
->hIcon
= pImageList_GetIcon((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
253 if (flags
& SHGFI_EXETYPE
)
254 FIXME("type of executable, stub\n");
256 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
257 FIXME("unknown attribute!\n");
260 IShellFolder_Release(psfParent
);
265 if(pidlLast
) SHFree(pidlLast
);
267 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
268 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
, ret
);
273 /*************************************************************************
274 * SHGetFileInfoW [SHELL32.@]
277 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
278 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
280 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
281 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
285 /*************************************************************************
286 * SHGetFileInfoAW [SHELL32.@]
288 DWORD WINAPI
SHGetFileInfoAW(
290 DWORD dwFileAttributes
,
295 if(SHELL_OsIsUnicode())
296 return SHGetFileInfoW(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
297 return SHGetFileInfoA(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
300 /*************************************************************************
301 * ExtractIconA [SHELL32.133]
304 * is the filename is not a file return 1
306 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
308 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
312 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
313 HICON16 hIcon
= *ptr
;
315 GlobalFree16(handle
);
321 /*************************************************************************
322 * ExtractIconW [SHELL32.180]
325 * is the filename is not a file return 1
327 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
333 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
334 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
336 HeapFree(GetProcessHeap(),0,exefn
);
340 /*************************************************************************
341 * FindExecutableA [SHELL32.184]
343 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
345 { HINSTANCE retval
=31; /* default - 'No association was found' */
348 TRACE("File %s, Dir %s\n",
349 (lpFile
!= NULL
?lpFile
:"-"),
350 (lpDirectory
!= NULL
?lpDirectory
:"-"));
352 lpResult
[0]='\0'; /* Start off with an empty return string */
354 /* trap NULL parameters on entry */
355 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
356 { /* FIXME - should throw a warning, perhaps! */
357 return 2; /* File not found. Close enough, I guess. */
361 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
362 SetCurrentDirectoryA( lpDirectory
);
365 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
367 TRACE("returning %s\n", lpResult
);
369 SetCurrentDirectoryA( old_dir
);
373 /*************************************************************************
374 * FindExecutableW [SHELL32.219]
376 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
379 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
380 return 31; /* default - 'No association was found' */
389 #define IDC_STATIC_TEXT 100
390 #define IDC_LISTBOX 99
391 #define IDC_WINE_TEXT 98
393 #define DROP_FIELD_TOP (-15)
394 #define DROP_FIELD_HEIGHT 15
396 extern HICON hIconTitleFont
;
398 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
399 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
401 { GetWindowRect( hWndCtl
, lprect
);
402 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
403 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
409 /*************************************************************************
410 * SHAppBarMessage [SHELL32.207]
412 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
414 int width
=data
->rc
.right
- data
->rc
.left
;
415 int height
=data
->rc
.bottom
- data
->rc
.top
;
419 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
420 case ABM_GETTASKBARPOS
:
421 GetWindowRect(data
->hWnd
, &rec
);
425 SetActiveWindow(data
->hWnd
);
427 case ABM_GETAUTOHIDEBAR
:
428 data
->hWnd
=GetActiveWindow();
431 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
432 width
,height
,SWP_SHOWWINDOW
);
435 GetWindowRect(data
->hWnd
, &(data
->rc
));
438 CloseHandle(data
->hWnd
);
440 case ABM_SETAUTOHIDEBAR
:
441 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
442 width
,height
,SWP_SHOWWINDOW
);
445 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
446 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
447 width
,height
,SWP_SHOWWINDOW
);
449 case ABM_WINDOWPOSCHANGED
:
450 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
451 width
,height
,SWP_SHOWWINDOW
);
457 /*************************************************************************
458 * SHHelpShortcuts_RunDLL [SHELL32.224]
461 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
462 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
463 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
468 /*************************************************************************
469 * SHLoadInProc [SHELL32.225]
470 * Create an instance of specified object class from within
471 * the shell process and release it immediately
474 DWORD WINAPI
SHLoadInProc (REFCLSID rclsid
)
476 IUnknown
* pUnk
= NULL
;
477 TRACE("%s\n", debugstr_guid(rclsid
));
479 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,(LPVOID
*)pUnk
);
482 IUnknown_Release(pUnk
);
485 return DISP_E_MEMBERNOTFOUND
;
488 /*************************************************************************
489 * ShellExecuteA [SHELL32.245]
491 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
492 LPCSTR lpFile
, LPCSTR lpParameters
,
493 LPCSTR lpDirectory
, INT iShowCmd
)
495 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
496 lpDirectory
, iShowCmd
);
499 /*************************************************************************
500 * ShellExecuteW [SHELL32.294]
502 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
503 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
510 LPCWSTR lpParameters
,
518 /*************************************************************************
519 * AboutDlgProc (internal)
521 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
524 char Template
[512], AppTitle
[512];
529 { case WM_INITDIALOG
:
530 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
532 { const char* const *pstr
= SHELL_People
;
533 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
534 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
535 sprintf( AppTitle
, Template
, info
->szApp
);
536 SetWindowTextA( hWnd
, AppTitle
);
537 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
538 info
->szOtherStuff
);
539 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
540 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
541 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
543 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
546 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
554 HDC hDC
= BeginPaint( hWnd
, &ps
);
556 if( __get_dropline( hWnd
, &rect
) ) {
557 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
558 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
559 LineTo( hDC
, rect
.right
, rect
.bottom
);
561 EndPaint( hWnd
, &ps
);
565 case WM_LBTRACKPOINT
:
566 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
567 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
568 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
569 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
571 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
572 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
573 char* pstr
= (char*)GlobalLock16( hMemObj
);
576 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
577 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
578 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
579 UpdateWindow( hWndCtl
);
580 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
581 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
584 GlobalFree16( hMemObj
);
590 case WM_QUERYDROPOBJECT
:
592 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
593 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
595 if( __get_dropline( hWnd
, &rect
) )
597 pt
.x
=lpDragInfo
->pt
.x
;
598 pt
.x
=lpDragInfo
->pt
.y
;
599 rect
.bottom
+= DROP_FIELD_HEIGHT
;
600 if( PtInRect( &rect
, pt
) )
601 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
611 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
612 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
613 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
615 { static char __appendix_str
[] = " with";
617 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
618 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
619 if( !strncmp( Template
, "WINE", 4 ) )
620 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
622 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
624 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
625 (WPARAM
)-1, (LPARAM
)Template
);
628 strcpy( Template
, pstr
);
629 strcat( Template
, __appendix_str
);
630 SetWindowTextA( hWndCtl
, Template
);
631 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
640 { EndDialog(hWnd
, TRUE
);
645 EndDialog(hWnd
, TRUE
);
653 /*************************************************************************
654 * ShellAboutA [SHELL32.243]
656 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
663 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
665 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
669 info
.szOtherStuff
= szOtherStuff
;
671 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
672 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
673 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
677 /*************************************************************************
678 * ShellAboutW [SHELL32.244]
680 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
689 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
691 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
694 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
695 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
697 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
698 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
699 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
700 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
701 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
705 /*************************************************************************
708 void WINAPI
FreeIconList( DWORD dw
)
709 { FIXME("(%lx): stub\n",dw
);
712 /***********************************************************************
713 * DllGetVersion [SHELL32]
715 * Retrieves version information of the 'SHELL32.DLL'
718 * pdvi [O] pointer to version information structure.
722 * Failure: E_INVALIDARG
725 * Returns version of a shell32.dll from IE4.01 SP1.
728 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
730 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
732 WARN("wrong DLLVERSIONINFO size from app");
736 pdvi
->dwMajorVersion
= 4;
737 pdvi
->dwMinorVersion
= 72;
738 pdvi
->dwBuildNumber
= 3110;
739 pdvi
->dwPlatformID
= 1;
741 TRACE("%lu.%lu.%lu.%lu\n",
742 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
743 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
747 /*************************************************************************
748 * global variables of the shell32.dll
749 * all are once per process
752 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
753 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
754 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
755 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
756 BOOL (WINAPI
* pImageList_Draw
) (HIMAGELIST himl
, int i
, HDC hdcDest
, int x
, int y
, UINT fStyle
);
757 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
758 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
759 COLORREF (WINAPI
*pImageList_SetBkColor
)(HIMAGELIST
, COLORREF
);
761 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
762 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
764 HDPA (WINAPI
* pDPA_Create
) (INT
);
765 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
766 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
767 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
768 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
769 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
770 LPVOID (WINAPI
*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
773 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
774 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
776 static HINSTANCE hComctl32
;
777 static INT shell32_RefCount
= 0;
779 LONG shell32_ObjCount
= 0;
780 HINSTANCE shell32_hInstance
= 0;
782 HIMAGELIST ShellSmallIconList
= 0;
783 HIMAGELIST ShellBigIconList
= 0;
786 /*************************************************************************
790 * calling oleinitialize here breaks sone apps.
793 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
795 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
799 case DLL_PROCESS_ATTACH
:
801 if (shell32_hInstance
) return TRUE
;
803 shell32_hInstance
= hinstDLL
;
804 hComctl32
= GetModuleHandleA("COMCTL32.DLL");
805 if(!huser32
) huser32
= GetModuleHandleA("USER32.DLL");
806 DisableThreadLibraryCalls(shell32_hInstance
);
808 if (!hComctl32
|| !huser32
)
810 ERR("P A N I C SHELL32 loading failed\n");
815 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
816 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
817 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
818 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
819 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
820 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
821 pImageList_Draw
=(void*)GetProcAddress(hComctl32
,"ImageList_Draw");
822 pImageList_SetBkColor
=(void*)GetProcAddress(hComctl32
,"ImageList_SetBkColor");
823 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
824 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
825 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
826 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
827 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
828 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
829 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
830 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
831 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
833 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(huser32
,"LookupIconIdFromDirectoryEx");
834 pCreateIconFromResourceEx
=(void*)GetProcAddress(huser32
,"CreateIconFromResourceEx");
836 /* initialize the common controls */
839 pDLLInitComctl(NULL
);
844 InitChangeNotifications();
845 SHInitRestricted(NULL
, NULL
);
848 case DLL_THREAD_ATTACH
:
852 case DLL_THREAD_DETACH
:
856 case DLL_PROCESS_DETACH
:
859 if ( !shell32_RefCount
)
861 shell32_hInstance
= 0;
865 IShellFolder_Release(pdesktopfolder
);
866 pdesktopfolder
= NULL
;
870 FreeChangeNotifications();
872 /* this one is here to check if AddRef/Release is balanced */
873 if (shell32_ObjCount
)
875 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount
);
879 TRACE("refcount=%u objcount=%lu \n", shell32_RefCount
, shell32_ObjCount
);
885 /*************************************************************************
886 * DllInstall [SHELL32.202]
890 * BOOL bInstall - TRUE for install, FALSE for uninstall
891 * LPCWSTR pszCmdLine - command line (unused by shell32?)
894 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
896 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
898 return S_OK
; /* indicate success */
901 /***********************************************************************
902 * DllCanUnloadNow (SHELL32.@)
904 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void)
906 FIXME("(void): stub\n");