5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
10 #include "wine/winuser16.h"
16 #include "sysmetrics.h"
17 #include "debugtools.h"
20 #include "winversion.h"
26 #include "shell32_main.h"
28 #include "wine/undocshell.h"
31 DECLARE_DEBUG_CHANNEL(exec
)
32 DECLARE_DEBUG_CHANNEL(shell
)
35 /*************************************************************************
36 * CommandLineToArgvW [SHELL32.7]
38 LPWSTR
* WINAPI
CommandLineToArgvW(LPWSTR cmdline
,LPDWORD numargs
)
43 /* to get writeable copy */
44 cmdline
= HEAP_strdupW( GetProcessHeap(), 0, cmdline
);
51 while (*s
&& *s
==0x0020)
57 argv
=(LPWSTR
*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR
)*(i
+1) );
63 argv
[i
++]=HEAP_strdupW( GetProcessHeap(), 0, t
);
65 while (*s
&& *s
==0x0020)
76 argv
[i
++]=(LPWSTR
)HEAP_strdupW( GetProcessHeap(), 0, t
);
78 HeapFree( GetProcessHeap(), 0, cmdline
);
84 /*************************************************************************
85 * Control_RunDLL [SHELL32.12]
87 * Wild speculation in the following!
89 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
92 void WINAPI
Control_RunDLL( HWND hwnd
, LPCVOID code
, LPCSTR cmd
, DWORD arg4
)
94 FIXME_(shell
)("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd
, code
,
95 debugstr_a(cmd
), arg4
);
98 /*************************************************************************
99 * SHGetFileInfoA [SHELL32.254]
102 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
103 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
106 char szLoaction
[MAX_PATH
];
108 DWORD ret
= TRUE
, dwAttributes
= 0;
109 IShellFolder
* psfParent
= NULL
;
110 IExtractIcon
* pei
= NULL
;
111 LPITEMIDLIST pidlLast
, pidl
= NULL
;
114 TRACE_(shell
)("(%s,0x%lx,%p,0x%x,0x%x)\n",
115 (flags
& SHGFI_PIDL
)? "pidl" : path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
118 ZeroMemory(psfi
, sizeof(SHFILEINFOA
));
120 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
123 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
124 the pidl functions fail on not existing file names */
125 if (flags
& SHGFI_PIDL
)
127 pidl
= (LPCITEMIDLIST
) path
;
130 ERR_(shell
)("pidl is null!\n");
134 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
136 hr
= SHILCreateFromPathA ( path
, &pidl
, &dwAttributes
);
137 /* note: the attributes in ISF::ParseDisplayName are not implemented */
140 /* get the parent shellfolder */
143 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, &pidlLast
);
146 /* get the attributes of the child */
147 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
149 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
151 psfi
->dwAttributes
= 0xffffffff;
153 IShellFolder_GetAttributesOf(psfParent
, 1 , &pidlLast
, &(psfi
->dwAttributes
));
156 /* get the displayname */
157 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
159 if (flags
& SHGFI_USEFILEATTRIBUTES
)
161 strcpy (psfi
->szDisplayName
, PathFindFilenameA(path
));
166 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
167 StrRetToStrNA (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
171 /* get the type name */
172 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
174 _ILGetFileType(pidlLast
, psfi
->szTypeName
, 80);
178 if (flags
& SHGFI_LINKOVERLAY
)
179 FIXME_(shell
)("set icon to link, stub\n");
181 if (flags
& SHGFI_OPENICON
)
182 FIXME_(shell
)("set to open icon, stub\n");
184 if (flags
& SHGFI_SELECTED
)
185 FIXME_(shell
)("set icon to selected, stub\n");
187 if (flags
& SHGFI_SHELLICONSIZE
)
188 FIXME_(shell
)("set icon to shell size, stub\n");
190 /* get the iconlocation */
191 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
194 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
198 hr
= IExtractIconA_GetIconLocation(pei
, 0, szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
199 /* fixme what to do with the index? */
201 if(uFlags
!= GIL_NOTFILENAME
)
202 strcpy (psfi
->szDisplayName
, szLoaction
);
206 IExtractIconA_Release(pei
);
210 /* get icon index (or load icon)*/
211 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
213 if (flags
& SHGFI_USEFILEATTRIBUTES
)
215 char sTemp
[MAX_PATH
];
219 lstrcpynA(sTemp
, path
, MAX_PATH
);
220 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
221 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
222 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
224 if (!strcmp("%1",sTemp
)) /* icon is in the file */
228 /* FIXME: if sTemp contains a valid filename, get the icon
229 from there, index is in dwNr
233 else /* default icon */
240 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
&& SHGFI_LARGEICON
), &(psfi
->iIcon
))))
247 ret
= (DWORD
) ((flags
&& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
252 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
253 psfi
->hIcon
= pImageList_GetIcon((flags
&& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
256 if (flags
& SHGFI_EXETYPE
)
257 FIXME_(shell
)("type of executable, stub\n");
259 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
260 FIXME_(shell
)("unknown attribute!\n");
263 IShellFolder_Release(psfParent
);
269 TRACE_(shell
) ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s\n",
270 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
);
275 /*************************************************************************
276 * SHGetFileInfoW [SHELL32.255]
279 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
280 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
282 { FIXME_(shell
)("(%s,0x%lx,%p,0x%x,0x%x)\n",
283 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
287 /*************************************************************************
288 * ExtractIconA [SHELL32.133]
290 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
292 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
296 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
297 HICON16 hIcon
= *ptr
;
299 GlobalFree16(handle
);
305 /*************************************************************************
306 * ExtractIconW [SHELL32.180]
308 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
314 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
315 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
317 HeapFree(GetProcessHeap(),0,exefn
);
321 /*************************************************************************
322 * FindExecutableA [SHELL32.184]
324 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
326 { HINSTANCE retval
=31; /* default - 'No association was found' */
329 TRACE_(shell
)("File %s, Dir %s\n",
330 (lpFile
!= NULL
?lpFile
:"-"),
331 (lpDirectory
!= NULL
?lpDirectory
:"-"));
333 lpResult
[0]='\0'; /* Start off with an empty return string */
335 /* trap NULL parameters on entry */
336 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
337 { /* FIXME - should throw a warning, perhaps! */
338 return 2; /* File not found. Close enough, I guess. */
342 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
343 SetCurrentDirectoryA( lpDirectory
);
346 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
348 TRACE_(shell
)("returning %s\n", lpResult
);
350 SetCurrentDirectoryA( old_dir
);
354 /*************************************************************************
355 * FindExecutableW [SHELL32.219]
357 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
360 FIXME_(shell
)("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
361 return 31; /* default - 'No association was found' */
370 #define IDC_STATIC_TEXT 100
371 #define IDC_LISTBOX 99
372 #define IDC_WINE_TEXT 98
374 #define DROP_FIELD_TOP (-15)
375 #define DROP_FIELD_HEIGHT 15
377 extern HICON hIconTitleFont
;
379 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
380 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
382 { GetWindowRect( hWndCtl
, lprect
);
383 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
384 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
390 /*************************************************************************
391 * SHAppBarMessage32 [SHELL32.207]
393 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
395 FIXME_(shell
)("(0x%08lx,%p hwnd=0x%08x): stub\n", msg
, data
, data
->hWnd
);
399 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
400 case ABM_GETTASKBARPOS
:
401 /* fake a taskbar on the bottom of the desktop */
403 GetWindowRect(GetDesktopWindow(), &rec
);
405 rec
.top
= rec
.bottom
- 2;
409 case ABM_GETAUTOHIDEBAR
:
413 case ABM_SETAUTOHIDEBAR
:
415 case ABM_WINDOWPOSCHANGED
:
421 /*************************************************************************
422 * SHHelpShortcuts_RunDLL [SHELL32.224]
425 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
426 { FIXME_(exec
)("(%lx, %lx, %lx, %lx) empty stub!\n",
427 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
432 /*************************************************************************
433 * SHLoadInProc [SHELL32.225]
437 DWORD WINAPI
SHLoadInProc (DWORD dwArg1
)
438 { FIXME_(shell
)("(%lx) empty stub!\n", dwArg1
);
442 /*************************************************************************
443 * ShellExecuteA [SHELL32.245]
445 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
446 LPCSTR lpFile
, LPCSTR lpParameters
,
447 LPCSTR lpDirectory
, INT iShowCmd
)
448 { TRACE_(shell
)("\n");
449 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
450 lpDirectory
, iShowCmd
);
453 /*************************************************************************
454 * ShellExecuteW [SHELL32.294]
456 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
457 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
464 LPCWSTR lpParameters
,
468 FIXME_(shell
)(": stub\n");
472 /*************************************************************************
473 * AboutDlgProc32 (internal)
475 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
478 char Template
[512], AppTitle
[512];
483 { case WM_INITDIALOG
:
484 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
486 { const char* const *pstr
= SHELL_People
;
487 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
488 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
489 sprintf( AppTitle
, Template
, info
->szApp
);
490 SetWindowTextA( hWnd
, AppTitle
);
491 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
492 info
->szOtherStuff
);
493 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
494 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
495 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
497 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
500 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
508 HDC hDC
= BeginPaint( hWnd
, &ps
);
510 if( __get_dropline( hWnd
, &rect
) ) {
511 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
512 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
513 LineTo( hDC
, rect
.right
, rect
.bottom
);
515 EndPaint( hWnd
, &ps
);
519 case WM_LBTRACKPOINT
:
520 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
521 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
522 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
523 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
525 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
526 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
527 char* pstr
= (char*)GlobalLock16( hMemObj
);
530 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
531 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
532 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
533 UpdateWindow( hWndCtl
);
534 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
535 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
538 GlobalFree16( hMemObj
);
544 case WM_QUERYDROPOBJECT
:
546 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
547 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
549 if( __get_dropline( hWnd
, &rect
) )
551 pt
.x
=lpDragInfo
->pt
.x
;
552 pt
.x
=lpDragInfo
->pt
.y
;
553 rect
.bottom
+= DROP_FIELD_HEIGHT
;
554 if( PtInRect( &rect
, pt
) )
555 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
565 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
566 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
567 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
569 { static char __appendix_str
[] = " with";
571 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
572 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
573 if( !strncmp( Template
, "WINE", 4 ) )
574 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
576 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
578 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
579 (WPARAM
)-1, (LPARAM
)Template
);
582 strcpy( Template
, pstr
);
583 strcat( Template
, __appendix_str
);
584 SetWindowTextA( hWndCtl
, Template
);
585 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
594 { EndDialog(hWnd
, TRUE
);
599 EndDialog(hWnd
, TRUE
);
607 /*************************************************************************
608 * ShellAboutA [SHELL32.243]
610 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
617 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
619 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
623 info
.szOtherStuff
= szOtherStuff
;
625 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
626 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
627 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
631 /*************************************************************************
632 * ShellAboutW [SHELL32.244]
634 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
643 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
645 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
648 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
649 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
651 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
652 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
653 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
654 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
655 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
659 /*************************************************************************
660 * Shell_NotifyIcon [SHELL32.296]
662 * This function is supposed to deal with the systray.
663 * Any ideas on how this is to be implimented?
665 BOOL WINAPI
Shell_NotifyIcon( DWORD dwMessage
, PNOTIFYICONDATAA pnid
)
666 { FIXME_(shell
)("Taskbar Notification Area functionality not implemented !\n");
667 return TRUE
; /* pretend success */
670 /*************************************************************************
671 * Shell_NotifyIcon [SHELL32.297]
673 * This function is supposed to deal with the systray.
674 * Any ideas on how this is to be implimented?
676 BOOL WINAPI
Shell_NotifyIconA(DWORD dwMessage
, PNOTIFYICONDATAA pnid
)
677 { FIXME_(shell
)("Taskbar Notification Area functionality not implemented !\n");
678 return TRUE
; /* pretend success */
681 /*************************************************************************
684 void WINAPI
FreeIconList( DWORD dw
)
685 { FIXME_(shell
)("(%lx): stub\n",dw
);
688 /***********************************************************************
689 * DllGetVersion [COMCTL32.25]
691 * Retrieves version information of the 'SHELL32.DLL'
694 * pdvi [O] pointer to version information structure.
698 * Failure: E_INVALIDARG
701 * Returns version of a shell32.dll from IE4.01 SP1.
704 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
706 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
707 { WARN_(shell
)("wrong DLLVERSIONINFO size from app");
711 pdvi
->dwMajorVersion
= 4;
712 pdvi
->dwMinorVersion
= 72;
713 pdvi
->dwBuildNumber
= 3110;
714 pdvi
->dwPlatformID
= 1;
716 TRACE_(shell
)("%lu.%lu.%lu.%lu\n",
717 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
718 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
722 /*************************************************************************
723 * global variables of the shell32.dll
724 * all are once per process
727 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
728 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
729 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
730 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
731 BOOL (WINAPI
* pImageList_Draw
) (HIMAGELIST himl
, int i
, HDC hdcDest
, int x
, int y
, UINT fStyle
);
732 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
733 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
734 COLORREF (WINAPI
*pImageList_SetBkColor
)(HIMAGELIST
, COLORREF
);
736 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
737 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
739 HDPA (WINAPI
* pDPA_Create
) (INT
);
740 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
741 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
742 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
743 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
744 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
745 LPVOID (WINAPI
*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
748 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
749 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
752 HRESULT (WINAPI
* pOleInitialize
)(LPVOID reserved
);
753 void (WINAPI
* pOleUninitialize
)(void);
754 HRESULT (WINAPI
* pDoDragDrop
)(IDataObject
* pDataObject
, IDropSource
* pDropSource
, DWORD dwOKEffect
, DWORD
*pdwEffect
);
755 HRESULT (WINAPI
* pRegisterDragDrop
)(HWND hwnd
, IDropTarget
* pDropTarget
);
756 HRESULT (WINAPI
* pRevokeDragDrop
)(HWND hwnd
);
758 static HINSTANCE hComctl32
;
759 static HINSTANCE hOle32
;
760 static INT shell32_RefCount
= 0;
762 INT shell32_ObjCount
= 0;
763 HINSTANCE shell32_hInstance
;
764 HIMAGELIST ShellSmallIconList
= 0;
765 HIMAGELIST ShellBigIconList
= 0;
767 /*************************************************************************
771 * calling oleinitialize here breaks sone apps.
774 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
778 TRACE_(shell
)("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
782 case DLL_PROCESS_ATTACH
:
784 if (shell32_hInstance
)
786 ERR_(shell
)("shell32.dll instantiated twice in one address space!\n");
790 /* we only want to call this the first time shell32 is instantiated */
791 SHInitRestricted(NULL
, NULL
);
794 shell32_hInstance
= hinstDLL
;
796 hComctl32
= LoadLibraryA("COMCTL32.DLL");
797 hOle32
= LoadLibraryA("OLE32.DLL");
798 hUser32
= GetModuleHandleA("USER32");
800 if (!hComctl32
|| !hUser32
|| !hOle32
)
802 ERR_(shell
)("P A N I C SHELL32 loading failed\n");
807 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
808 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
809 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
810 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
811 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
812 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
813 pImageList_Draw
=(void*)GetProcAddress(hComctl32
,"ImageList_Draw");
814 pImageList_SetBkColor
=(void*)GetProcAddress(hComctl32
,"ImageList_SetBkColor");
815 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
816 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
817 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
818 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
819 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
820 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
821 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
822 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
823 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
825 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(hUser32
,"LookupIconIdFromDirectoryEx");
826 pCreateIconFromResourceEx
=(void*)GetProcAddress(hUser32
,"CreateIconFromResourceEx");
828 pOleInitialize
=(void*)GetProcAddress(hOle32
,"OleInitialize");
829 pOleUninitialize
=(void*)GetProcAddress(hOle32
,"OleUninitialize");
830 pDoDragDrop
=(void*)GetProcAddress(hOle32
,"DoDragDrop");
831 pRegisterDragDrop
=(void*)GetProcAddress(hOle32
,"RegisterDragDrop");
832 pRevokeDragDrop
=(void*)GetProcAddress(hOle32
,"RevokeDragDrop");
834 /* initialize the common controls */
837 pDLLInitComctl(NULL
);
844 case DLL_THREAD_ATTACH
:
848 case DLL_THREAD_DETACH
:
852 case DLL_PROCESS_DETACH
:
855 if ( !shell32_RefCount
)
857 shell32_hInstance
= 0;
861 IShellFolder_Release(pdesktopfolder
);
862 pdesktopfolder
= NULL
;
867 /* this one is here to check if AddRef/Release is balanced */
868 if (shell32_ObjCount
)
870 WARN_(shell
)("leaving with %u objects left (memory leak)\n", shell32_ObjCount
);
875 FreeLibrary(hComctl32
);
877 TRACE_(shell
)("refcount=%u objcount=%u \n", shell32_RefCount
, shell32_ObjCount
);
883 /*************************************************************************
884 * DllInstall [SHELL32.202]
888 * BOOL bInstall - TRUE for install, FALSE for uninstall
889 * LPCWSTR pszCmdLine - command line (unused by shell32?)
892 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
894 FIXME_(shell
)("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
896 return S_OK
; /* indicate success */