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"
28 #include "shell32_main.h"
30 #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.254]
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, pidl = NULL;
115 TRACE("(%s,0x%lx,%p,0x%x,0x%x)\n",
116 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, sizeofpsfi, flags);
119 ZeroMemory(psfi, sizeof(SHFILEINFOA));
121 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
124 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
125 the pidl functions fail on not existing file names */
126 if (flags & SHGFI_PIDL)
128 pidl = (LPCITEMIDLIST) path;
131 ERR("pidl is null!\n");
135 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
137 hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
138 /* note: the attributes in ISF::ParseDisplayName are not implemented */
141 /* get the parent shellfolder */
144 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
147 /* get the attributes of the child */
148 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
150 if (!(flags & SHGFI_ATTR_SPECIFIED))
152 psfi->dwAttributes = 0xffffffff;
154 IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
157 /* get the displayname */
158 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
160 if (flags & SHGFI_USEFILEATTRIBUTES)
162 strcpy (psfi->szDisplayName, PathFindFilenameA(path));
167 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
168 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
172 /* get the type name */
173 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
175 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
179 if (flags & SHGFI_LINKOVERLAY)
180 FIXME("set icon to link, stub\n");
182 if (flags & SHGFI_SELECTED)
183 FIXME("set icon to selected, stub\n");
185 if (flags & SHGFI_SHELLICONSIZE)
186 FIXME("set icon to shell size, stub\n");
188 /* get the iconlocation */
189 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
192 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
196 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
197 /* fixme what to do with the index? */
199 if(uFlags != GIL_NOTFILENAME)
200 strcpy (psfi->szDisplayName, szLoaction);
204 IExtractIconA_Release(pei);
208 /* get icon index (or load icon)*/
209 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
211 if (flags & SHGFI_USEFILEATTRIBUTES)
213 char sTemp [MAX_PATH];
217 lstrcpynA(sTemp, path, MAX_PATH);
218 szExt = (LPSTR) PathFindExtensionA(sTemp);
219 if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
220 && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
222 if (!strcmp("%1",sTemp)) /* icon is in the file */
226 /* FIXME: if sTemp contains a valid filename, get the icon
227 from there, index is in dwNr
231 else /* default icon */
238 if (!(PidlToSicIndex(psfParent, pidlLast, (flags & SHGFI_LARGEICON),
239 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(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 ret=0x%08lx\n",
269 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
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 int width=data->rc.right - data->rc.left;
395 int height=data->rc.bottom - data->rc.top;
399 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
400 case ABM_GETTASKBARPOS:
401 GetWindowRect(data->hWnd, &rec);
405 SetActiveWindow(data->hWnd);
407 case ABM_GETAUTOHIDEBAR:
408 data->hWnd=GetActiveWindow();
411 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
412 width,height,SWP_SHOWWINDOW);
415 GetWindowRect(data->hWnd, &(data->rc));
418 CloseHandle(data->hWnd);
420 case ABM_SETAUTOHIDEBAR:
421 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
422 width,height,SWP_SHOWWINDOW);
425 data->uEdge=(ABE_RIGHT | ABE_LEFT);
426 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
427 width,height,SWP_SHOWWINDOW);
429 case ABM_WINDOWPOSCHANGED:
430 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
431 width,height,SWP_SHOWWINDOW);
437 /*************************************************************************
438 * SHHelpShortcuts_RunDLL [SHELL32.224]
441 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
442 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
443 dwArg1, dwArg2, dwArg3, dwArg4);
448 /*************************************************************************
449 * SHLoadInProc [SHELL32.225]
450 * Create an instance of specified object class from within
451 * the shell process and release it immediately
454 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
456 IUnknown * pUnk = NULL;
457 TRACE("%s\n", debugstr_guid(rclsid));
459 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
462 IUnknown_Release(pUnk);
465 return DISP_E_MEMBERNOTFOUND;
468 /*************************************************************************
469 * ShellExecuteA [SHELL32.245]
471 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
472 LPCSTR lpFile, LPCSTR lpParameters,
473 LPCSTR lpDirectory, INT iShowCmd )
475 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
476 lpDirectory, iShowCmd );
479 /*************************************************************************
480 * ShellExecuteW [SHELL32.294]
482 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
483 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
490 LPCWSTR lpParameters,
498 /*************************************************************************
499 * AboutDlgProc32 (internal)
501 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
504 char Template[512], AppTitle[512];
509 { case WM_INITDIALOG:
510 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
512 { const char* const *pstr = SHELL_People;
513 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
514 GetWindowTextA( hWnd, Template, sizeof(Template) );
515 sprintf( AppTitle, Template, info->szApp );
516 SetWindowTextA( hWnd, AppTitle );
517 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
518 info->szOtherStuff );
519 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
520 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
521 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
523 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
526 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
534 HDC hDC = BeginPaint( hWnd, &ps );
536 if( __get_dropline( hWnd, &rect ) ) {
537 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
538 MoveToEx( hDC, rect.left, rect.top, NULL );
539 LineTo( hDC, rect.right, rect.bottom );
541 EndPaint( hWnd, &ps );
545 case WM_LBTRACKPOINT:
546 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
547 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
548 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
549 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
551 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
552 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
553 char* pstr = (char*)GlobalLock16( hMemObj );
556 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
557 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
558 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
559 UpdateWindow( hWndCtl );
560 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
561 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
564 GlobalFree16( hMemObj );
570 case WM_QUERYDROPOBJECT:
572 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
573 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
575 if( __get_dropline( hWnd, &rect ) )
577 pt.x=lpDragInfo->pt.x;
578 pt.x=lpDragInfo->pt.y;
579 rect.bottom += DROP_FIELD_HEIGHT;
580 if( PtInRect( &rect, pt ) )
581 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
591 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
592 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
593 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
595 { static char __appendix_str[] = " with";
597 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
598 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
599 if( !strncmp( Template, "WINE", 4 ) )
600 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
602 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
604 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
605 (WPARAM)-1, (LPARAM)Template );
608 strcpy( Template, pstr );
609 strcat( Template, __appendix_str );
610 SetWindowTextA( hWndCtl, Template );
611 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
620 { EndDialog(hWnd, TRUE);
625 EndDialog(hWnd, TRUE);
633 /*************************************************************************
634 * ShellAboutA [SHELL32.243]
636 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
643 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
645 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
649 info.szOtherStuff = szOtherStuff;
651 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
652 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
653 template, hWnd, AboutDlgProc, (LPARAM)&info );
657 /*************************************************************************
658 * ShellAboutW [SHELL32.244]
660 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
669 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
671 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
674 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
675 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
677 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
678 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
679 template, hWnd, AboutDlgProc, (LPARAM)&info );
680 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
681 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
685 /*************************************************************************
688 void WINAPI FreeIconList( DWORD dw )
689 { FIXME("(%lx): stub\n",dw);
692 /***********************************************************************
693 * DllGetVersion [COMCTL32.25]
695 * Retrieves version information of the 'SHELL32.DLL'
698 * pdvi [O] pointer to version information structure.
702 * Failure: E_INVALIDARG
705 * Returns version of a shell32.dll from IE4.01 SP1.
708 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
710 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
711 { WARN("wrong DLLVERSIONINFO size from app");
715 pdvi->dwMajorVersion = 4;
716 pdvi->dwMinorVersion = 72;
717 pdvi->dwBuildNumber = 3110;
718 pdvi->dwPlatformID = 1;
720 TRACE("%lu.%lu.%lu.%lu\n",
721 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
722 pdvi->dwBuildNumber, pdvi->dwPlatformID);
726 /*************************************************************************
727 * global variables of the shell32.dll
728 * all are once per process
731 void (WINAPI* pDLLInitComctl)(LPVOID);
732 INT (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
733 INT (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
734 HIMAGELIST (WINAPI * pImageList_Create) (INT,INT,UINT,INT,INT);
735 BOOL (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
736 HICON (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
737 INT (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
738 COLORREF (WINAPI *pImageList_SetBkColor)(HIMAGELIST, COLORREF);
740 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT);
741 BOOL (WINAPI* pCOMCTL32_Free) (LPVOID);
743 HDPA (WINAPI* pDPA_Create) (INT);
744 INT (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
745 BOOL (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
746 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT);
747 BOOL (WINAPI* pDPA_Destroy) (const HDPA);
748 INT (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
749 LPVOID (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
752 HICON (WINAPI *pLookupIconIdFromDirectoryEx)(LPBYTE dir, BOOL bIcon, INT width, INT height, UINT cFlag);
753 HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, DWORD dwVersion, INT width, INT height,UINT cFlag);
755 static HINSTANCE hComctl32;
756 static INT shell32_RefCount = 0;
758 INT shell32_ObjCount = 0;
759 HINSTANCE shell32_hInstance;
760 HIMAGELIST ShellSmallIconList = 0;
761 HIMAGELIST ShellBigIconList = 0;
763 /*************************************************************************
767 * calling oleinitialize here breaks sone apps.
770 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
774 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
778 case DLL_PROCESS_ATTACH:
780 if (shell32_hInstance)
782 ERR("shell32.dll instantiated twice in one address space!\n");
786 shell32_hInstance = hinstDLL;
788 hComctl32 = LoadLibraryA("COMCTL32.DLL");
789 hUser32 = GetModuleHandleA("USER32");
791 if (!hComctl32 || !hUser32)
793 ERR("P A N I C SHELL32 loading failed\n");
798 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
799 pImageList_Create=(void*)GetProcAddress(hComctl32,"ImageList_Create");
800 pImageList_AddIcon=(void*)GetProcAddress(hComctl32,"ImageList_AddIcon");
801 pImageList_ReplaceIcon=(void*)GetProcAddress(hComctl32,"ImageList_ReplaceIcon");
802 pImageList_GetIcon=(void*)GetProcAddress(hComctl32,"ImageList_GetIcon");
803 pImageList_GetImageCount=(void*)GetProcAddress(hComctl32,"ImageList_GetImageCount");
804 pImageList_Draw=(void*)GetProcAddress(hComctl32,"ImageList_Draw");
805 pImageList_SetBkColor=(void*)GetProcAddress(hComctl32,"ImageList_SetBkColor");
806 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
807 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
808 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
809 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
810 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
811 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
812 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
813 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
814 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
816 pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(hUser32,"LookupIconIdFromDirectoryEx");
817 pCreateIconFromResourceEx=(void*)GetProcAddress(hUser32,"CreateIconFromResourceEx");
819 /* initialize the common controls */
822 pDLLInitComctl(NULL);
827 InitChangeNotifications();
828 SHInitRestricted(NULL, NULL);
831 case DLL_THREAD_ATTACH:
835 case DLL_THREAD_DETACH:
839 case DLL_PROCESS_DETACH:
842 if ( !shell32_RefCount )
844 shell32_hInstance = 0;
848 IShellFolder_Release(pdesktopfolder);
849 pdesktopfolder = NULL;
853 FreeChangeNotifications();
855 /* this one is here to check if AddRef/Release is balanced */
856 if (shell32_ObjCount)
858 WARN("leaving with %u objects left (memory leak)\n", shell32_ObjCount);
862 FreeLibrary(hComctl32);
864 TRACE("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);
870 /*************************************************************************
871 * DllInstall [SHELL32.202]
875 * BOOL bInstall - TRUE for install, FALSE for uninstall
876 * LPCWSTR pszCmdLine - command line (unused by shell32?)
879 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
881 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
883 return S_OK; /* indicate success */