5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
13 #include "wine/winuser16.h"
18 #include "debugtools.h"
21 #include "winversion.h"
26 #include "shell32_main.h"
27 #include "wine/undocshell.h"
32 DEFAULT_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("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
95 debugstr_a(cmd), arg4);
98 /*************************************************************************
99 * SHGetFileInfoA [SHELL32.@]
103 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
104 SHFILEINFOA *psfi, UINT sizeofpsfi,
107 char szLoaction[MAX_PATH];
109 DWORD ret = TRUE, dwAttributes = 0;
110 IShellFolder * psfParent = NULL;
111 IExtractIconA * pei = NULL;
112 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
115 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
116 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
118 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
121 /* windows initializes this values regardless of the flags */
122 psfi->szDisplayName[0] = '\0';
123 psfi->szTypeName[0] = '\0';
126 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
127 the pidl functions fail on not existing file names */
128 if (flags & SHGFI_PIDL)
130 pidl = (LPCITEMIDLIST) path;
133 ERR("pidl is null!\n");
137 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
139 hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
140 /* note: the attributes in ISF::ParseDisplayName are not implemented */
143 /* get the parent shellfolder */
146 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
149 /* get the attributes of the child */
150 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
152 if (!(flags & SHGFI_ATTR_SPECIFIED))
154 psfi->dwAttributes = 0xffffffff;
156 IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
159 /* get the displayname */
160 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
162 if (flags & SHGFI_USEFILEATTRIBUTES)
164 strcpy (psfi->szDisplayName, PathFindFileNameA(path));
169 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
170 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
174 /* get the type name */
175 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
177 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
181 if (flags & SHGFI_LINKOVERLAY)
182 FIXME("set icon to link, stub\n");
184 if (flags & SHGFI_SELECTED)
185 FIXME("set icon to selected, stub\n");
187 if (flags & SHGFI_SHELLICONSIZE)
188 FIXME("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, (flags & SHGFI_OPENICON)? GIL_OPENICON : 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),
241 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
248 ret = (DWORD) ((flags & SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
253 if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
254 psfi->hIcon = pImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
257 if (flags & SHGFI_EXETYPE)
258 FIXME("type of executable, stub\n");
260 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
261 FIXME("unknown attribute!\n");
264 IShellFolder_Release(psfParent);
269 if(pidlLast) SHFree(pidlLast);
271 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
272 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
277 /*************************************************************************
278 * SHGetFileInfoW [SHELL32.@]
281 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
282 SHFILEINFOW *psfi, UINT sizeofpsfi,
284 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
285 debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
289 /*************************************************************************
290 * SHGetFileInfoAW [SHELL32.@]
292 DWORD WINAPI SHGetFileInfoAW(
294 DWORD dwFileAttributes,
299 if(VERSION_OsIsUnicode())
300 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
301 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
304 /*************************************************************************
305 * ExtractIconA [SHELL32.133]
308 * is the filename is not a file return 1
310 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
312 { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
316 HICON16* ptr = (HICON16*)GlobalLock16(handle);
317 HICON16 hIcon = *ptr;
319 GlobalFree16(handle);
325 /*************************************************************************
326 * ExtractIconW [SHELL32.180]
329 * is the filename is not a file return 1
331 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
337 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
338 ret = ExtractIconA(hInstance,exefn,nIconIndex);
340 HeapFree(GetProcessHeap(),0,exefn);
344 /*************************************************************************
345 * FindExecutableA [SHELL32.184]
347 HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
349 { HINSTANCE retval=31; /* default - 'No association was found' */
352 TRACE("File %s, Dir %s\n",
353 (lpFile != NULL?lpFile:"-"),
354 (lpDirectory != NULL?lpDirectory:"-"));
356 lpResult[0]='\0'; /* Start off with an empty return string */
358 /* trap NULL parameters on entry */
359 if (( lpFile == NULL ) || ( lpResult == NULL ))
360 { /* FIXME - should throw a warning, perhaps! */
361 return 2; /* File not found. Close enough, I guess. */
365 { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
366 SetCurrentDirectoryA( lpDirectory );
369 retval = SHELL_FindExecutable( lpFile, "open", lpResult );
371 TRACE("returning %s\n", lpResult);
373 SetCurrentDirectoryA( old_dir );
377 /*************************************************************************
378 * FindExecutableW [SHELL32.219]
380 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
383 FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
384 return 31; /* default - 'No association was found' */
393 #define IDC_STATIC_TEXT 100
394 #define IDC_LISTBOX 99
395 #define IDC_WINE_TEXT 98
397 #define DROP_FIELD_TOP (-15)
398 #define DROP_FIELD_HEIGHT 15
400 extern HICON hIconTitleFont;
402 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
403 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
405 { GetWindowRect( hWndCtl, lprect );
406 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
407 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
413 /*************************************************************************
414 * SHAppBarMessage [SHELL32.207]
416 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
418 int width=data->rc.right - data->rc.left;
419 int height=data->rc.bottom - data->rc.top;
423 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
424 case ABM_GETTASKBARPOS:
425 GetWindowRect(data->hWnd, &rec);
429 SetActiveWindow(data->hWnd);
431 case ABM_GETAUTOHIDEBAR:
432 data->hWnd=GetActiveWindow();
435 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
436 width,height,SWP_SHOWWINDOW);
439 GetWindowRect(data->hWnd, &(data->rc));
442 CloseHandle(data->hWnd);
444 case ABM_SETAUTOHIDEBAR:
445 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
446 width,height,SWP_SHOWWINDOW);
449 data->uEdge=(ABE_RIGHT | ABE_LEFT);
450 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
451 width,height,SWP_SHOWWINDOW);
453 case ABM_WINDOWPOSCHANGED:
454 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
455 width,height,SWP_SHOWWINDOW);
461 /*************************************************************************
462 * SHHelpShortcuts_RunDLL [SHELL32.224]
465 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
466 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
467 dwArg1, dwArg2, dwArg3, dwArg4);
472 /*************************************************************************
473 * SHLoadInProc [SHELL32.225]
474 * Create an instance of specified object class from within
475 * the shell process and release it immediately
478 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
480 IUnknown * pUnk = NULL;
481 TRACE("%s\n", debugstr_guid(rclsid));
483 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
486 IUnknown_Release(pUnk);
489 return DISP_E_MEMBERNOTFOUND;
492 /*************************************************************************
493 * ShellExecuteA [SHELL32.245]
495 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
496 LPCSTR lpFile, LPCSTR lpParameters,
497 LPCSTR lpDirectory, INT iShowCmd )
499 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
500 lpDirectory, iShowCmd );
503 /*************************************************************************
504 * ShellExecuteW [SHELL32.294]
506 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
507 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
514 LPCWSTR lpParameters,
522 /*************************************************************************
523 * AboutDlgProc (internal)
525 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
528 char Template[512], AppTitle[512];
533 { case WM_INITDIALOG:
534 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
536 { const char* const *pstr = SHELL_People;
537 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
538 GetWindowTextA( hWnd, Template, sizeof(Template) );
539 sprintf( AppTitle, Template, info->szApp );
540 SetWindowTextA( hWnd, AppTitle );
541 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
542 info->szOtherStuff );
543 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
544 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
545 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
547 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
550 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
558 HDC hDC = BeginPaint( hWnd, &ps );
560 if( __get_dropline( hWnd, &rect ) ) {
561 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
562 MoveToEx( hDC, rect.left, rect.top, NULL );
563 LineTo( hDC, rect.right, rect.bottom );
565 EndPaint( hWnd, &ps );
569 case WM_LBTRACKPOINT:
570 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
571 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
572 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
573 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
575 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
576 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
577 char* pstr = (char*)GlobalLock16( hMemObj );
580 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
581 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
582 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
583 UpdateWindow( hWndCtl );
584 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
585 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
588 GlobalFree16( hMemObj );
594 case WM_QUERYDROPOBJECT:
596 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
597 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
599 if( __get_dropline( hWnd, &rect ) )
601 pt.x=lpDragInfo->pt.x;
602 pt.x=lpDragInfo->pt.y;
603 rect.bottom += DROP_FIELD_HEIGHT;
604 if( PtInRect( &rect, pt ) )
605 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
615 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
616 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
617 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
619 { static char __appendix_str[] = " with";
621 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
622 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
623 if( !strncmp( Template, "WINE", 4 ) )
624 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
626 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
628 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
629 (WPARAM)-1, (LPARAM)Template );
632 strcpy( Template, pstr );
633 strcat( Template, __appendix_str );
634 SetWindowTextA( hWndCtl, Template );
635 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
644 { EndDialog(hWnd, TRUE);
649 EndDialog(hWnd, TRUE);
657 /*************************************************************************
658 * ShellAboutA [SHELL32.243]
660 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
667 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
669 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
673 info.szOtherStuff = szOtherStuff;
675 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
676 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
677 template, hWnd, AboutDlgProc, (LPARAM)&info );
681 /*************************************************************************
682 * ShellAboutW [SHELL32.244]
684 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
693 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
695 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
698 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
699 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
701 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
702 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
703 template, hWnd, AboutDlgProc, (LPARAM)&info );
704 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
705 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
709 /*************************************************************************
712 void WINAPI FreeIconList( DWORD dw )
713 { FIXME("(%lx): stub\n",dw);
716 /***********************************************************************
717 * DllGetVersion [SHELL32]
719 * Retrieves version information of the 'SHELL32.DLL'
722 * pdvi [O] pointer to version information structure.
726 * Failure: E_INVALIDARG
729 * Returns version of a shell32.dll from IE4.01 SP1.
732 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
734 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
736 WARN("wrong DLLVERSIONINFO size from app");
740 pdvi->dwMajorVersion = 4;
741 pdvi->dwMinorVersion = 72;
742 pdvi->dwBuildNumber = 3110;
743 pdvi->dwPlatformID = 1;
745 TRACE("%lu.%lu.%lu.%lu\n",
746 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
747 pdvi->dwBuildNumber, pdvi->dwPlatformID);
751 /*************************************************************************
752 * global variables of the shell32.dll
753 * all are once per process
756 void (WINAPI* pDLLInitComctl)(LPVOID);
757 INT (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
758 INT (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
759 HIMAGELIST (WINAPI * pImageList_Create) (INT,INT,UINT,INT,INT);
760 BOOL (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
761 HICON (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
762 INT (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
763 COLORREF (WINAPI *pImageList_SetBkColor)(HIMAGELIST, COLORREF);
765 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT);
766 BOOL (WINAPI* pCOMCTL32_Free) (LPVOID);
768 HDPA (WINAPI* pDPA_Create) (INT);
769 INT (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
770 BOOL (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
771 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT);
772 BOOL (WINAPI* pDPA_Destroy) (const HDPA);
773 INT (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
774 LPVOID (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
777 HICON (WINAPI *pLookupIconIdFromDirectoryEx)(LPBYTE dir, BOOL bIcon, INT width, INT height, UINT cFlag);
778 HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, DWORD dwVersion, INT width, INT height,UINT cFlag);
780 static HINSTANCE hComctl32;
781 static INT shell32_RefCount = 0;
783 LONG shell32_ObjCount = 0;
784 HINSTANCE shell32_hInstance = 0;
786 HIMAGELIST ShellSmallIconList = 0;
787 HIMAGELIST ShellBigIconList = 0;
790 /*************************************************************************
794 * calling oleinitialize here breaks sone apps.
797 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
799 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
803 case DLL_PROCESS_ATTACH:
805 if (shell32_hInstance) return TRUE;
807 shell32_hInstance = hinstDLL;
808 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
809 if(!huser32) huser32 = GetModuleHandleA("USER32.DLL");
810 DisableThreadLibraryCalls(shell32_hInstance);
812 if (!hComctl32 || !huser32)
814 ERR("P A N I C SHELL32 loading failed\n");
819 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
820 pImageList_Create=(void*)GetProcAddress(hComctl32,"ImageList_Create");
821 pImageList_AddIcon=(void*)GetProcAddress(hComctl32,"ImageList_AddIcon");
822 pImageList_ReplaceIcon=(void*)GetProcAddress(hComctl32,"ImageList_ReplaceIcon");
823 pImageList_GetIcon=(void*)GetProcAddress(hComctl32,"ImageList_GetIcon");
824 pImageList_GetImageCount=(void*)GetProcAddress(hComctl32,"ImageList_GetImageCount");
825 pImageList_Draw=(void*)GetProcAddress(hComctl32,"ImageList_Draw");
826 pImageList_SetBkColor=(void*)GetProcAddress(hComctl32,"ImageList_SetBkColor");
827 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
828 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
829 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
830 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
831 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
832 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
833 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
834 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
835 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
837 pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(huser32,"LookupIconIdFromDirectoryEx");
838 pCreateIconFromResourceEx=(void*)GetProcAddress(huser32,"CreateIconFromResourceEx");
840 /* initialize the common controls */
843 pDLLInitComctl(NULL);
848 InitChangeNotifications();
849 SHInitRestricted(NULL, NULL);
852 case DLL_THREAD_ATTACH:
856 case DLL_THREAD_DETACH:
860 case DLL_PROCESS_DETACH:
863 if ( !shell32_RefCount )
865 shell32_hInstance = 0;
869 IShellFolder_Release(pdesktopfolder);
870 pdesktopfolder = NULL;
874 FreeChangeNotifications();
876 /* this one is here to check if AddRef/Release is balanced */
877 if (shell32_ObjCount)
879 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
883 TRACE("refcount=%u objcount=%lu \n", shell32_RefCount, shell32_ObjCount);
889 /*************************************************************************
890 * DllInstall [SHELL32.202]
894 * BOOL bInstall - TRUE for install, FALSE for uninstall
895 * LPCWSTR pszCmdLine - command line (unused by shell32?)
898 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
900 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
902 return S_OK; /* indicate success */
905 /***********************************************************************
906 * DllCanUnloadNow (SHELL32.@)
908 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
910 FIXME("(void): stub\n");