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"
30 DECLARE_DEBUG_CHANNEL(exec)
31 DECLARE_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)
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_(shell)("(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_(shell)("(%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_(shell)("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_(shell)("set icon to link, stub\n");
180 if (flags & SHGFI_OPENICON)
181 FIXME_(shell)("set to open icon, stub\n");
183 if (flags & SHGFI_SELECTED)
184 FIXME_(shell)("set icon to selected, stub\n");
186 if (flags & SHGFI_SHELLICONSIZE)
187 FIXME_(shell)("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_(shell)("type of executable, stub\n");
258 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
259 FIXME_(shell)("unknown attribute!\n");
262 IShellFolder_Release(psfParent);
268 TRACE_(shell) ("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_(shell)("(%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_(shell)("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_(shell)("returning %s\n", lpResult);
349 SetCurrentDirectoryA( old_dir );
353 /*************************************************************************
354 * FindExecutableW [SHELL32.219]
356 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
359 FIXME_(shell)("(%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_(shell)("(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_(shell)("(%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 )
447 { TRACE_(shell)("\n");
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,
467 FIXME_(shell)(": stub\n");
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 /*************************************************************************
659 * Shell_NotifyIcon [SHELL32.296]
661 * This function is supposed to deal with the systray.
662 * Any ideas on how this is to be implimented?
664 BOOL WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATAA pnid )
665 { FIXME_(shell)("Taskbar Notification Area functionality not implemented !\n");
666 return TRUE; /* pretend success */
669 /*************************************************************************
670 * Shell_NotifyIcon [SHELL32.297]
672 * This function is supposed to deal with the systray.
673 * Any ideas on how this is to be implimented?
675 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid )
676 { FIXME_(shell)("Taskbar Notification Area functionality not implemented !\n");
677 return TRUE; /* pretend success */
680 /*************************************************************************
683 void WINAPI FreeIconList( DWORD dw )
684 { FIXME_(shell)("(%lx): stub\n",dw);
687 /***********************************************************************
688 * DllGetVersion [COMCTL32.25]
690 * Retrieves version information of the 'SHELL32.DLL'
693 * pdvi [O] pointer to version information structure.
697 * Failure: E_INVALIDARG
700 * Returns version of a shell32.dll from IE4.01 SP1.
703 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
705 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
706 { WARN_(shell)("wrong DLLVERSIONINFO size from app");
710 pdvi->dwMajorVersion = 4;
711 pdvi->dwMinorVersion = 72;
712 pdvi->dwBuildNumber = 3110;
713 pdvi->dwPlatformID = 1;
715 TRACE_(shell)("%lu.%lu.%lu.%lu\n",
716 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
717 pdvi->dwBuildNumber, pdvi->dwPlatformID);
721 /*************************************************************************
722 * global variables of the shell32.dll
723 * all are once per process
726 void (WINAPI* pDLLInitComctl)(LPVOID);
727 INT (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
728 INT (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
729 HIMAGELIST (WINAPI * pImageList_Create) (INT,INT,UINT,INT,INT);
730 BOOL (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
731 HICON (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
732 INT (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
733 COLORREF (WINAPI *pImageList_SetBkColor)(HIMAGELIST, COLORREF);
735 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT);
736 BOOL (WINAPI* pCOMCTL32_Free) (LPVOID);
738 HDPA (WINAPI* pDPA_Create) (INT);
739 INT (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
740 BOOL (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
741 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT);
742 BOOL (WINAPI* pDPA_Destroy) (const HDPA);
743 INT (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
744 LPVOID (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
747 HICON (WINAPI *pLookupIconIdFromDirectoryEx)(LPBYTE dir, BOOL bIcon, INT width, INT height, UINT cFlag);
748 HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, DWORD dwVersion, INT width, INT height,UINT cFlag);
751 HRESULT (WINAPI* pOleInitialize)(LPVOID reserved);
752 void (WINAPI* pOleUninitialize)(void);
753 HRESULT (WINAPI* pDoDragDrop)(IDataObject* pDataObject, IDropSource * pDropSource, DWORD dwOKEffect, DWORD *pdwEffect);
754 HRESULT (WINAPI* pRegisterDragDrop)(HWND hwnd, IDropTarget* pDropTarget);
755 HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd);
757 static HINSTANCE hComctl32;
758 static HINSTANCE hOle32;
759 static INT shell32_RefCount = 0;
761 INT shell32_ObjCount = 0;
762 HINSTANCE shell32_hInstance;
763 HIMAGELIST ShellSmallIconList = 0;
764 HIMAGELIST ShellBigIconList = 0;
766 /*************************************************************************
770 * calling oleinitialize here breaks sone apps.
773 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
777 TRACE_(shell)("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
781 case DLL_PROCESS_ATTACH:
783 if (shell32_hInstance)
785 ERR_(shell)("shell32.dll instantiated twice in one address space!\n");
788 shell32_hInstance = hinstDLL;
790 hComctl32 = LoadLibraryA("COMCTL32.DLL");
791 hOle32 = LoadLibraryA("OLE32.DLL");
792 hUser32 = GetModuleHandleA("USER32");
794 if (!hComctl32 || !hUser32 || !hOle32)
796 ERR_(shell)("P A N I C SHELL32 loading failed\n");
801 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
802 pImageList_Create=(void*)GetProcAddress(hComctl32,"ImageList_Create");
803 pImageList_AddIcon=(void*)GetProcAddress(hComctl32,"ImageList_AddIcon");
804 pImageList_ReplaceIcon=(void*)GetProcAddress(hComctl32,"ImageList_ReplaceIcon");
805 pImageList_GetIcon=(void*)GetProcAddress(hComctl32,"ImageList_GetIcon");
806 pImageList_GetImageCount=(void*)GetProcAddress(hComctl32,"ImageList_GetImageCount");
807 pImageList_Draw=(void*)GetProcAddress(hComctl32,"ImageList_Draw");
808 pImageList_SetBkColor=(void*)GetProcAddress(hComctl32,"ImageList_SetBkColor");
809 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
810 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
811 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
812 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
813 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
814 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
815 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
816 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
817 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
819 pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(hUser32,"LookupIconIdFromDirectoryEx");
820 pCreateIconFromResourceEx=(void*)GetProcAddress(hUser32,"CreateIconFromResourceEx");
822 pOleInitialize=(void*)GetProcAddress(hOle32,"OleInitialize");
823 pOleUninitialize=(void*)GetProcAddress(hOle32,"OleUninitialize");
824 pDoDragDrop=(void*)GetProcAddress(hOle32,"DoDragDrop");
825 pRegisterDragDrop=(void*)GetProcAddress(hOle32,"RegisterDragDrop");
826 pRevokeDragDrop=(void*)GetProcAddress(hOle32,"RevokeDragDrop");
828 /* initialize the common controls */
831 pDLLInitComctl(NULL);
838 case DLL_THREAD_ATTACH:
842 case DLL_THREAD_DETACH:
846 case DLL_PROCESS_DETACH:
849 if ( !shell32_RefCount )
851 shell32_hInstance = 0;
855 IShellFolder_Release(pdesktopfolder);
856 pdesktopfolder = NULL;
861 /* this one is here to check if AddRef/Release is balanced */
862 if (shell32_ObjCount)
864 WARN_(shell)("leaving with %u objects left (memory leak)\n", shell32_ObjCount);
869 FreeLibrary(hComctl32);
871 TRACE_(shell)("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);