5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
10 #include "wine/winuser16.h"
15 #include "sysmetrics.h"
16 #include "debugtools.h"
19 #include "winversion.h"
25 #include "shell32_main.h"
27 #include "wine/undocshell.h"
30 DEFAULT_DEBUG_CHANNEL(shell
)
31 DECLARE_DEBUG_CHANNEL(exec
)
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)
75 argv
[i
++]=(LPWSTR
)HEAP_strdupW( GetProcessHeap(), 0, t
);
77 HeapFree( GetProcessHeap(), 0, cmdline
);
83 /*************************************************************************
84 * Control_RunDLL [SHELL32.12]
86 * Wild speculation in the following!
88 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
91 void WINAPI
Control_RunDLL( HWND hwnd
, LPCVOID code
, LPCSTR cmd
, DWORD arg4
)
93 FIXME("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd
, code
,
94 debugstr_a(cmd
), arg4
);
97 /*************************************************************************
98 * SHGetFileInfoA [SHELL32.254]
101 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
102 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
105 char szLoaction
[MAX_PATH
];
107 DWORD ret
= TRUE
, dwAttributes
= 0;
108 IShellFolder
* psfParent
= NULL
;
109 IExtractIcon
* pei
= NULL
;
110 LPITEMIDLIST pidlLast
, pidl
= NULL
;
113 TRACE("(%s,0x%lx,%p,0x%x,0x%x)\n",
114 (flags
& SHGFI_PIDL
)? "pidl" : path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
117 ZeroMemory(psfi
, sizeof(SHFILEINFOA
));
119 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
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_OPENICON
)
181 FIXME("set to open icon, stub\n");
183 if (flags
& SHGFI_SELECTED
)
184 FIXME("set icon to selected, stub\n");
186 if (flags
& SHGFI_SHELLICONSIZE
)
187 FIXME("set icon to shell size, stub\n");
189 /* get the iconlocation */
190 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
193 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
197 hr
= IExtractIconA_GetIconLocation(pei
, 0, szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
198 /* fixme what to do with the index? */
200 if(uFlags
!= GIL_NOTFILENAME
)
201 strcpy (psfi
->szDisplayName
, szLoaction
);
205 IExtractIconA_Release(pei
);
209 /* get icon index (or load icon)*/
210 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
212 if (flags
& SHGFI_USEFILEATTRIBUTES
)
214 char sTemp
[MAX_PATH
];
218 lstrcpynA(sTemp
, path
, MAX_PATH
);
219 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
220 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
221 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
223 if (!strcmp("%1",sTemp
)) /* icon is in the file */
227 /* FIXME: if sTemp contains a valid filename, get the icon
228 from there, index is in dwNr
232 else /* default icon */
239 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
&& SHGFI_LARGEICON
), &(psfi
->iIcon
))))
246 ret
= (DWORD
) ((flags
&& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
251 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
252 psfi
->hIcon
= pImageList_GetIcon((flags
&& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
255 if (flags
& SHGFI_EXETYPE
)
256 FIXME("type of executable, stub\n");
258 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
259 FIXME("unknown attribute!\n");
262 IShellFolder_Release(psfParent
);
268 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s\n",
269 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
);
274 /*************************************************************************
275 * SHGetFileInfoW [SHELL32.255]
278 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
279 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
281 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
282 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
286 /*************************************************************************
287 * ExtractIconA [SHELL32.133]
289 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
291 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
295 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
296 HICON16 hIcon
= *ptr
;
298 GlobalFree16(handle
);
304 /*************************************************************************
305 * ExtractIconW [SHELL32.180]
307 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
313 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
314 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
316 HeapFree(GetProcessHeap(),0,exefn
);
320 /*************************************************************************
321 * FindExecutableA [SHELL32.184]
323 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
325 { HINSTANCE retval
=31; /* default - 'No association was found' */
328 TRACE("File %s, Dir %s\n",
329 (lpFile
!= NULL
?lpFile
:"-"),
330 (lpDirectory
!= NULL
?lpDirectory
:"-"));
332 lpResult
[0]='\0'; /* Start off with an empty return string */
334 /* trap NULL parameters on entry */
335 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
336 { /* FIXME - should throw a warning, perhaps! */
337 return 2; /* File not found. Close enough, I guess. */
341 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
342 SetCurrentDirectoryA( lpDirectory
);
345 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
347 TRACE("returning %s\n", lpResult
);
349 SetCurrentDirectoryA( old_dir
);
353 /*************************************************************************
354 * FindExecutableW [SHELL32.219]
356 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
359 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
360 return 31; /* default - 'No association was found' */
369 #define IDC_STATIC_TEXT 100
370 #define IDC_LISTBOX 99
371 #define IDC_WINE_TEXT 98
373 #define DROP_FIELD_TOP (-15)
374 #define DROP_FIELD_HEIGHT 15
376 extern HICON hIconTitleFont
;
378 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
379 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
381 { GetWindowRect( hWndCtl
, lprect
);
382 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
383 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
389 /*************************************************************************
390 * SHAppBarMessage32 [SHELL32.207]
392 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
394 FIXME("(0x%08lx,%p hwnd=0x%08x): stub\n", msg
, data
, data
->hWnd
);
398 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
399 case ABM_GETTASKBARPOS
:
400 /* fake a taskbar on the bottom of the desktop */
402 GetWindowRect(GetDesktopWindow(), &rec
);
404 rec
.top
= rec
.bottom
- 2;
408 case ABM_GETAUTOHIDEBAR
:
412 case ABM_SETAUTOHIDEBAR
:
414 case ABM_WINDOWPOSCHANGED
:
420 /*************************************************************************
421 * SHHelpShortcuts_RunDLL [SHELL32.224]
424 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
425 { FIXME_(exec
)("(%lx, %lx, %lx, %lx) empty stub!\n",
426 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
431 /*************************************************************************
432 * SHLoadInProc [SHELL32.225]
436 DWORD WINAPI
SHLoadInProc (DWORD dwArg1
)
437 { FIXME("(%lx) empty stub!\n", dwArg1
);
441 /*************************************************************************
442 * ShellExecuteA [SHELL32.245]
444 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
445 LPCSTR lpFile
, LPCSTR lpParameters
,
446 LPCSTR lpDirectory
, INT iShowCmd
)
448 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
449 lpDirectory
, iShowCmd
);
452 /*************************************************************************
453 * ShellExecuteW [SHELL32.294]
455 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
456 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
463 LPCWSTR lpParameters
,
471 /*************************************************************************
472 * AboutDlgProc32 (internal)
474 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
477 char Template
[512], AppTitle
[512];
482 { case WM_INITDIALOG
:
483 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
485 { const char* const *pstr
= SHELL_People
;
486 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
487 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
488 sprintf( AppTitle
, Template
, info
->szApp
);
489 SetWindowTextA( hWnd
, AppTitle
);
490 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
491 info
->szOtherStuff
);
492 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
493 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
494 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
496 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
499 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
507 HDC hDC
= BeginPaint( hWnd
, &ps
);
509 if( __get_dropline( hWnd
, &rect
) ) {
510 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
511 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
512 LineTo( hDC
, rect
.right
, rect
.bottom
);
514 EndPaint( hWnd
, &ps
);
518 case WM_LBTRACKPOINT
:
519 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
520 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
521 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
522 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
524 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
525 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
526 char* pstr
= (char*)GlobalLock16( hMemObj
);
529 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
530 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
531 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
532 UpdateWindow( hWndCtl
);
533 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
534 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
537 GlobalFree16( hMemObj
);
543 case WM_QUERYDROPOBJECT
:
545 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
546 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
548 if( __get_dropline( hWnd
, &rect
) )
550 pt
.x
=lpDragInfo
->pt
.x
;
551 pt
.x
=lpDragInfo
->pt
.y
;
552 rect
.bottom
+= DROP_FIELD_HEIGHT
;
553 if( PtInRect( &rect
, pt
) )
554 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
564 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
565 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
566 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
568 { static char __appendix_str
[] = " with";
570 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
571 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
572 if( !strncmp( Template
, "WINE", 4 ) )
573 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
575 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
577 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
578 (WPARAM
)-1, (LPARAM
)Template
);
581 strcpy( Template
, pstr
);
582 strcat( Template
, __appendix_str
);
583 SetWindowTextA( hWndCtl
, Template
);
584 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
593 { EndDialog(hWnd
, TRUE
);
598 EndDialog(hWnd
, TRUE
);
606 /*************************************************************************
607 * ShellAboutA [SHELL32.243]
609 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
616 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
618 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
622 info
.szOtherStuff
= szOtherStuff
;
624 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
625 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
626 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
630 /*************************************************************************
631 * ShellAboutW [SHELL32.244]
633 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
642 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
644 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
647 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
648 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
650 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
651 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
652 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
653 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
654 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
658 /*************************************************************************
661 void WINAPI
FreeIconList( DWORD dw
)
662 { FIXME("(%lx): stub\n",dw
);
665 /***********************************************************************
666 * DllGetVersion [COMCTL32.25]
668 * Retrieves version information of the 'SHELL32.DLL'
671 * pdvi [O] pointer to version information structure.
675 * Failure: E_INVALIDARG
678 * Returns version of a shell32.dll from IE4.01 SP1.
681 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
683 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
684 { WARN("wrong DLLVERSIONINFO size from app");
688 pdvi
->dwMajorVersion
= 4;
689 pdvi
->dwMinorVersion
= 72;
690 pdvi
->dwBuildNumber
= 3110;
691 pdvi
->dwPlatformID
= 1;
693 TRACE("%lu.%lu.%lu.%lu\n",
694 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
695 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
699 /*************************************************************************
700 * global variables of the shell32.dll
701 * all are once per process
704 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
705 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
706 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
707 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
708 BOOL (WINAPI
* pImageList_Draw
) (HIMAGELIST himl
, int i
, HDC hdcDest
, int x
, int y
, UINT fStyle
);
709 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
710 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
711 COLORREF (WINAPI
*pImageList_SetBkColor
)(HIMAGELIST
, COLORREF
);
713 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
714 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
716 HDPA (WINAPI
* pDPA_Create
) (INT
);
717 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
718 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
719 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
720 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
721 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
722 LPVOID (WINAPI
*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
725 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
726 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
729 HRESULT (WINAPI
* pOleInitialize
)(LPVOID reserved
);
730 void (WINAPI
* pOleUninitialize
)(void);
731 HRESULT (WINAPI
* pDoDragDrop
)(IDataObject
* pDataObject
, IDropSource
* pDropSource
, DWORD dwOKEffect
, DWORD
*pdwEffect
);
732 HRESULT (WINAPI
* pRegisterDragDrop
)(HWND hwnd
, IDropTarget
* pDropTarget
);
733 HRESULT (WINAPI
* pRevokeDragDrop
)(HWND hwnd
);
735 static HINSTANCE hComctl32
;
736 static HINSTANCE hOle32
;
737 static INT shell32_RefCount
= 0;
739 INT shell32_ObjCount
= 0;
740 HINSTANCE shell32_hInstance
;
741 HIMAGELIST ShellSmallIconList
= 0;
742 HIMAGELIST ShellBigIconList
= 0;
744 /*************************************************************************
748 * calling oleinitialize here breaks sone apps.
751 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
755 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
759 case DLL_PROCESS_ATTACH
:
761 if (shell32_hInstance
)
763 ERR("shell32.dll instantiated twice in one address space!\n");
767 /* we only want to call this the first time shell32 is instantiated */
768 SHInitRestricted(NULL
, NULL
);
771 shell32_hInstance
= hinstDLL
;
773 hComctl32
= LoadLibraryA("COMCTL32.DLL");
774 hOle32
= LoadLibraryA("OLE32.DLL");
775 hUser32
= GetModuleHandleA("USER32");
777 if (!hComctl32
|| !hUser32
|| !hOle32
)
779 ERR("P A N I C SHELL32 loading failed\n");
784 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
785 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
786 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
787 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
788 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
789 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
790 pImageList_Draw
=(void*)GetProcAddress(hComctl32
,"ImageList_Draw");
791 pImageList_SetBkColor
=(void*)GetProcAddress(hComctl32
,"ImageList_SetBkColor");
792 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
793 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
794 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
795 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
796 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
797 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
798 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
799 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
800 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
802 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(hUser32
,"LookupIconIdFromDirectoryEx");
803 pCreateIconFromResourceEx
=(void*)GetProcAddress(hUser32
,"CreateIconFromResourceEx");
805 pOleInitialize
=(void*)GetProcAddress(hOle32
,"OleInitialize");
806 pOleUninitialize
=(void*)GetProcAddress(hOle32
,"OleUninitialize");
807 pDoDragDrop
=(void*)GetProcAddress(hOle32
,"DoDragDrop");
808 pRegisterDragDrop
=(void*)GetProcAddress(hOle32
,"RegisterDragDrop");
809 pRevokeDragDrop
=(void*)GetProcAddress(hOle32
,"RevokeDragDrop");
811 /* initialize the common controls */
814 pDLLInitComctl(NULL
);
822 case DLL_THREAD_ATTACH
:
826 case DLL_THREAD_DETACH
:
830 case DLL_PROCESS_DETACH
:
833 if ( !shell32_RefCount
)
835 shell32_hInstance
= 0;
839 IShellFolder_Release(pdesktopfolder
);
840 pdesktopfolder
= NULL
;
845 /* this one is here to check if AddRef/Release is balanced */
846 if (shell32_ObjCount
)
848 WARN("leaving with %u objects left (memory leak)\n", shell32_ObjCount
);
853 FreeLibrary(hComctl32
);
855 TRACE("refcount=%u objcount=%u \n", shell32_RefCount
, shell32_ObjCount
);
861 /*************************************************************************
862 * DllInstall [SHELL32.202]
866 * BOOL bInstall - TRUE for install, FALSE for uninstall
867 * LPCWSTR pszCmdLine - command line (unused by shell32?)
870 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
872 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
874 return S_OK
; /* indicate success */