5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
13 #include "wine/winuser16.h"
18 #include "sysmetrics.h"
19 #include "debugtools.h"
22 #include "winversion.h"
27 #include "shell32_main.h"
28 #include "wine/undocshell.h"
33 DEFAULT_DEBUG_CHANNEL(shell
);
36 /*************************************************************************
37 * CommandLineToArgvW [SHELL32.7]
39 LPWSTR
* WINAPI
CommandLineToArgvW(LPWSTR cmdline
,LPDWORD numargs
)
44 /* to get writeable copy */
45 cmdline
= HEAP_strdupW( GetProcessHeap(), 0, cmdline
);
52 while (*s
&& *s
==0x0020)
58 argv
=(LPWSTR
*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR
)*(i
+1) );
64 argv
[i
++]=HEAP_strdupW( GetProcessHeap(), 0, t
);
66 while (*s
&& *s
==0x0020)
77 argv
[i
++]=(LPWSTR
)HEAP_strdupW( GetProcessHeap(), 0, t
);
79 HeapFree( GetProcessHeap(), 0, cmdline
);
85 /*************************************************************************
86 * Control_RunDLL [SHELL32.12]
88 * Wild speculation in the following!
90 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
93 void WINAPI
Control_RunDLL( HWND hwnd
, LPCVOID code
, LPCSTR cmd
, DWORD arg4
)
95 FIXME("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd
, code
,
96 debugstr_a(cmd
), arg4
);
99 /*************************************************************************
100 * SHGetFileInfoA [SHELL32.@]
104 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
105 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
108 char szLoaction
[MAX_PATH
];
110 DWORD ret
= TRUE
, dwAttributes
= 0;
111 IShellFolder
* psfParent
= NULL
;
112 IExtractIconA
* pei
= NULL
;
113 LPITEMIDLIST pidlLast
= NULL
, pidl
= NULL
;
116 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
117 (flags
& SHGFI_PIDL
)? "pidl" : path
, dwFileAttributes
, psfi
, psfi
->dwAttributes
, sizeofpsfi
, flags
);
119 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
122 /* windows initializes this values regardless of the flags */
123 psfi
->szDisplayName
[0] = '\0';
124 psfi
->szTypeName
[0] = '\0';
127 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
128 the pidl functions fail on not existing file names */
129 if (flags
& SHGFI_PIDL
)
131 pidl
= (LPCITEMIDLIST
) path
;
134 ERR("pidl is null!\n");
138 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
140 hr
= SHILCreateFromPathA ( path
, &pidl
, &dwAttributes
);
141 /* note: the attributes in ISF::ParseDisplayName are not implemented */
144 /* get the parent shellfolder */
147 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, &pidlLast
);
150 /* get the attributes of the child */
151 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
153 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
155 psfi
->dwAttributes
= 0xffffffff;
157 IShellFolder_GetAttributesOf(psfParent
, 1 , &pidlLast
, &(psfi
->dwAttributes
));
160 /* get the displayname */
161 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
163 if (flags
& SHGFI_USEFILEATTRIBUTES
)
165 strcpy (psfi
->szDisplayName
, PathFindFileNameA(path
));
170 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
171 StrRetToStrNA (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
175 /* get the type name */
176 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
178 _ILGetFileType(pidlLast
, psfi
->szTypeName
, 80);
182 if (flags
& SHGFI_LINKOVERLAY
)
183 FIXME("set icon to link, stub\n");
185 if (flags
& SHGFI_SELECTED
)
186 FIXME("set icon to selected, stub\n");
188 if (flags
& SHGFI_SHELLICONSIZE
)
189 FIXME("set icon to shell size, stub\n");
191 /* get the iconlocation */
192 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
195 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
199 hr
= IExtractIconA_GetIconLocation(pei
, (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
200 /* fixme what to do with the index? */
202 if(uFlags
!= GIL_NOTFILENAME
)
203 strcpy (psfi
->szDisplayName
, szLoaction
);
207 IExtractIconA_Release(pei
);
211 /* get icon index (or load icon)*/
212 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
214 if (flags
& SHGFI_USEFILEATTRIBUTES
)
216 char sTemp
[MAX_PATH
];
220 lstrcpynA(sTemp
, path
, MAX_PATH
);
221 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
222 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
223 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
225 if (!strcmp("%1",sTemp
)) /* icon is in the file */
229 /* FIXME: if sTemp contains a valid filename, get the icon
230 from there, index is in dwNr
234 else /* default icon */
241 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
& SHGFI_LARGEICON
),
242 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
249 ret
= (DWORD
) ((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
254 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
255 psfi
->hIcon
= pImageList_GetIcon((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
258 if (flags
& SHGFI_EXETYPE
)
259 FIXME("type of executable, stub\n");
261 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
262 FIXME("unknown attribute!\n");
265 IShellFolder_Release(psfParent
);
270 if(pidlLast
) SHFree(pidlLast
);
272 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
273 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
, ret
);
278 /*************************************************************************
279 * SHGetFileInfoW [SHELL32.@]
282 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
283 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
285 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
286 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
290 /*************************************************************************
291 * SHGetFileInfoAW [SHELL32.@]
293 DWORD WINAPI
SHGetFileInfoAW(
295 DWORD dwFileAttributes
,
300 if(VERSION_OsIsUnicode())
301 return SHGetFileInfoW(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
302 return SHGetFileInfoA(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
305 /*************************************************************************
306 * ExtractIconA [SHELL32.133]
309 * is the filename is not a file return 1
311 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
313 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
317 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
318 HICON16 hIcon
= *ptr
;
320 GlobalFree16(handle
);
326 /*************************************************************************
327 * ExtractIconW [SHELL32.180]
330 * is the filename is not a file return 1
332 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
338 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
339 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
341 HeapFree(GetProcessHeap(),0,exefn
);
345 /*************************************************************************
346 * FindExecutableA [SHELL32.184]
348 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
350 { HINSTANCE retval
=31; /* default - 'No association was found' */
353 TRACE("File %s, Dir %s\n",
354 (lpFile
!= NULL
?lpFile
:"-"),
355 (lpDirectory
!= NULL
?lpDirectory
:"-"));
357 lpResult
[0]='\0'; /* Start off with an empty return string */
359 /* trap NULL parameters on entry */
360 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
361 { /* FIXME - should throw a warning, perhaps! */
362 return 2; /* File not found. Close enough, I guess. */
366 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
367 SetCurrentDirectoryA( lpDirectory
);
370 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
372 TRACE("returning %s\n", lpResult
);
374 SetCurrentDirectoryA( old_dir
);
378 /*************************************************************************
379 * FindExecutableW [SHELL32.219]
381 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
384 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
385 return 31; /* default - 'No association was found' */
394 #define IDC_STATIC_TEXT 100
395 #define IDC_LISTBOX 99
396 #define IDC_WINE_TEXT 98
398 #define DROP_FIELD_TOP (-15)
399 #define DROP_FIELD_HEIGHT 15
401 extern HICON hIconTitleFont
;
403 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
404 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
406 { GetWindowRect( hWndCtl
, lprect
);
407 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
408 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
414 /*************************************************************************
415 * SHAppBarMessage [SHELL32.207]
417 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
419 int width
=data
->rc
.right
- data
->rc
.left
;
420 int height
=data
->rc
.bottom
- data
->rc
.top
;
424 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
425 case ABM_GETTASKBARPOS
:
426 GetWindowRect(data
->hWnd
, &rec
);
430 SetActiveWindow(data
->hWnd
);
432 case ABM_GETAUTOHIDEBAR
:
433 data
->hWnd
=GetActiveWindow();
436 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
437 width
,height
,SWP_SHOWWINDOW
);
440 GetWindowRect(data
->hWnd
, &(data
->rc
));
443 CloseHandle(data
->hWnd
);
445 case ABM_SETAUTOHIDEBAR
:
446 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
447 width
,height
,SWP_SHOWWINDOW
);
450 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
451 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
452 width
,height
,SWP_SHOWWINDOW
);
454 case ABM_WINDOWPOSCHANGED
:
455 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
456 width
,height
,SWP_SHOWWINDOW
);
462 /*************************************************************************
463 * SHHelpShortcuts_RunDLL [SHELL32.224]
466 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
467 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
468 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
473 /*************************************************************************
474 * SHLoadInProc [SHELL32.225]
475 * Create an instance of specified object class from within
476 * the shell process and release it immediately
479 DWORD WINAPI
SHLoadInProc (REFCLSID rclsid
)
481 IUnknown
* pUnk
= NULL
;
482 TRACE("%s\n", debugstr_guid(rclsid
));
484 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,(LPVOID
*)pUnk
);
487 IUnknown_Release(pUnk
);
490 return DISP_E_MEMBERNOTFOUND
;
493 /*************************************************************************
494 * ShellExecuteA [SHELL32.245]
496 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
497 LPCSTR lpFile
, LPCSTR lpParameters
,
498 LPCSTR lpDirectory
, INT iShowCmd
)
500 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
501 lpDirectory
, iShowCmd
);
504 /*************************************************************************
505 * ShellExecuteW [SHELL32.294]
507 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
508 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
515 LPCWSTR lpParameters
,
523 /*************************************************************************
524 * AboutDlgProc (internal)
526 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
529 char Template
[512], AppTitle
[512];
534 { case WM_INITDIALOG
:
535 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
537 { const char* const *pstr
= SHELL_People
;
538 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
539 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
540 sprintf( AppTitle
, Template
, info
->szApp
);
541 SetWindowTextA( hWnd
, AppTitle
);
542 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
543 info
->szOtherStuff
);
544 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
545 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
546 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
548 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
551 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
559 HDC hDC
= BeginPaint( hWnd
, &ps
);
561 if( __get_dropline( hWnd
, &rect
) ) {
562 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
563 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
564 LineTo( hDC
, rect
.right
, rect
.bottom
);
566 EndPaint( hWnd
, &ps
);
570 case WM_LBTRACKPOINT
:
571 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
572 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
573 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
574 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
576 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
577 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
578 char* pstr
= (char*)GlobalLock16( hMemObj
);
581 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
582 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
583 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
584 UpdateWindow( hWndCtl
);
585 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
586 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
589 GlobalFree16( hMemObj
);
595 case WM_QUERYDROPOBJECT
:
597 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
598 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
600 if( __get_dropline( hWnd
, &rect
) )
602 pt
.x
=lpDragInfo
->pt
.x
;
603 pt
.x
=lpDragInfo
->pt
.y
;
604 rect
.bottom
+= DROP_FIELD_HEIGHT
;
605 if( PtInRect( &rect
, pt
) )
606 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
616 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
617 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
618 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
620 { static char __appendix_str
[] = " with";
622 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
623 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
624 if( !strncmp( Template
, "WINE", 4 ) )
625 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
627 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
629 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
630 (WPARAM
)-1, (LPARAM
)Template
);
633 strcpy( Template
, pstr
);
634 strcat( Template
, __appendix_str
);
635 SetWindowTextA( hWndCtl
, Template
);
636 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
645 { EndDialog(hWnd
, TRUE
);
650 EndDialog(hWnd
, TRUE
);
658 /*************************************************************************
659 * ShellAboutA [SHELL32.243]
661 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
668 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
670 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
674 info
.szOtherStuff
= szOtherStuff
;
676 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
677 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
678 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
682 /*************************************************************************
683 * ShellAboutW [SHELL32.244]
685 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
694 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
696 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
699 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
700 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
702 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
703 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
704 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
705 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
706 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
710 /*************************************************************************
713 void WINAPI
FreeIconList( DWORD dw
)
714 { FIXME("(%lx): stub\n",dw
);
717 /***********************************************************************
718 * DllGetVersion [SHELL32]
720 * Retrieves version information of the 'SHELL32.DLL'
723 * pdvi [O] pointer to version information structure.
727 * Failure: E_INVALIDARG
730 * Returns version of a shell32.dll from IE4.01 SP1.
733 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
735 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
737 WARN("wrong DLLVERSIONINFO size from app");
741 pdvi
->dwMajorVersion
= 4;
742 pdvi
->dwMinorVersion
= 72;
743 pdvi
->dwBuildNumber
= 3110;
744 pdvi
->dwPlatformID
= 1;
746 TRACE("%lu.%lu.%lu.%lu\n",
747 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
748 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
752 /***********************************************************************
753 * DllGetVersion [SHLWAPI]
755 * Retrieves version information of the 'SHLWAPI.DLL'
758 * pdvi [O] pointer to version information structure.
762 * Failure: E_INVALIDARG
765 * Returns version of a SHLWAPI.dll from IE5.01.
768 HRESULT WINAPI
SHLWAPI_DllGetVersion (DLLVERSIONINFO
*pdvi
)
770 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
772 WARN("wrong DLLVERSIONINFO size from app");
776 pdvi
->dwMajorVersion
= 5;
777 pdvi
->dwMinorVersion
= 0;
778 pdvi
->dwBuildNumber
= 2314;
779 pdvi
->dwPlatformID
= 1000;
781 TRACE("%lu.%lu.%lu.%lu\n",
782 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
783 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
788 /*************************************************************************
789 * global variables of the shell32.dll
790 * all are once per process
793 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
794 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
795 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
796 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
797 BOOL (WINAPI
* pImageList_Draw
) (HIMAGELIST himl
, int i
, HDC hdcDest
, int x
, int y
, UINT fStyle
);
798 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
799 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
800 COLORREF (WINAPI
*pImageList_SetBkColor
)(HIMAGELIST
, COLORREF
);
802 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
803 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
805 HDPA (WINAPI
* pDPA_Create
) (INT
);
806 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
807 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
808 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
809 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
810 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
811 LPVOID (WINAPI
*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
814 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
815 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
817 static HINSTANCE hComctl32
;
818 static INT shell32_RefCount
= 0;
820 LONG shell32_ObjCount
= 0;
821 HINSTANCE shell32_hInstance
= 0;
822 HINSTANCE shlwapi_hInstance
= 0;
824 HIMAGELIST ShellSmallIconList
= 0;
825 HIMAGELIST ShellBigIconList
= 0;
827 /*************************************************************************
831 * calling oleinitialize here breaks sone apps.
834 BOOL WINAPI
ShlwapiLibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
836 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
839 case DLL_PROCESS_ATTACH
:
840 shlwapi_hInstance
= hinstDLL
;
841 if(!huser32
) huser32
= GetModuleHandleA("USER32.DLL");
845 ERR("hModule of USER32 is 0\n");
853 /*************************************************************************
857 * calling oleinitialize here breaks sone apps.
860 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
862 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
866 case DLL_PROCESS_ATTACH
:
868 if (shell32_hInstance
) return TRUE
;
870 shell32_hInstance
= hinstDLL
;
871 hComctl32
= GetModuleHandleA("COMCTL32.DLL");
872 if(!huser32
) huser32
= GetModuleHandleA("USER32.DLL");
873 DisableThreadLibraryCalls(shell32_hInstance
);
875 if (!hComctl32
|| !huser32
)
877 ERR("P A N I C SHELL32 loading failed\n");
882 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
883 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
884 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
885 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
886 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
887 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
888 pImageList_Draw
=(void*)GetProcAddress(hComctl32
,"ImageList_Draw");
889 pImageList_SetBkColor
=(void*)GetProcAddress(hComctl32
,"ImageList_SetBkColor");
890 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
891 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
892 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
893 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
894 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
895 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
896 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
897 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
898 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
900 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(huser32
,"LookupIconIdFromDirectoryEx");
901 pCreateIconFromResourceEx
=(void*)GetProcAddress(huser32
,"CreateIconFromResourceEx");
903 /* initialize the common controls */
906 pDLLInitComctl(NULL
);
911 InitChangeNotifications();
912 SHInitRestricted(NULL
, NULL
);
915 case DLL_THREAD_ATTACH
:
919 case DLL_THREAD_DETACH
:
923 case DLL_PROCESS_DETACH
:
926 if ( !shell32_RefCount
)
928 shell32_hInstance
= 0;
932 IShellFolder_Release(pdesktopfolder
);
933 pdesktopfolder
= NULL
;
937 FreeChangeNotifications();
939 /* this one is here to check if AddRef/Release is balanced */
940 if (shell32_ObjCount
)
942 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount
);
946 TRACE("refcount=%u objcount=%lu \n", shell32_RefCount
, shell32_ObjCount
);
952 /*************************************************************************
953 * DllInstall [SHELL32.202]
957 * BOOL bInstall - TRUE for install, FALSE for uninstall
958 * LPCWSTR pszCmdLine - command line (unused by shell32?)
961 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
963 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
965 return S_OK
; /* indicate success */