5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
13 #include "wine/winuser16.h"
17 #include "debugtools.h"
24 #include "shell32_main.h"
25 #include "wine/undocshell.h"
30 DEFAULT_DEBUG_CHANNEL(shell);
33 /*************************************************************************
34 * CommandLineToArgvW [SHELL32.7]
36 LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs)
41 /* to get writeable copy */
42 cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
49 while (*s && *s==0x0020)
55 argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
61 argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
63 while (*s && *s==0x0020)
71 argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
73 HeapFree( GetProcessHeap(), 0, cmdline );
79 /*************************************************************************
80 * Control_RunDLL [SHELL32.12]
82 * Wild speculation in the following!
84 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
87 void WINAPI Control_RunDLL( HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
89 FIXME("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
90 debugstr_a(cmd), arg4);
93 /*************************************************************************
94 * SHGetFileInfoA [SHELL32.@]
98 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
99 SHFILEINFOA *psfi, UINT sizeofpsfi,
102 char szLoaction[MAX_PATH];
104 DWORD ret = TRUE, dwAttributes = 0;
105 IShellFolder * psfParent = NULL;
106 IExtractIconA * pei = NULL;
107 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
110 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
111 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
113 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
116 /* windows initializes this values regardless of the flags */
117 psfi->szDisplayName[0] = '\0';
118 psfi->szTypeName[0] = '\0';
121 if (flags & SHGFI_EXETYPE) {
125 IMAGE_DOS_HEADER mz_header;
130 if (flags != SHGFI_EXETYPE) return 0;
132 status = GetBinaryTypeA (path, &BinaryType);
133 if (!status) return 0;
134 if ((BinaryType == SCS_DOS_BINARY)
135 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
137 hfile = CreateFileA( path, GENERIC_READ, FILE_SHARE_READ,
138 NULL, OPEN_EXISTING, 0, 0 );
139 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
141 /* The next section is adapted from MODULE_GetBinaryType, as we need
142 * to examine the image header to get OS and version information. We
143 * know from calling GetBinaryTypeA that the image is valid and either
144 * an NE or PE, so much error handling can be omitted.
145 * Seek to the start of the file and read the header information.
148 SetFilePointer( hfile, 0, NULL, SEEK_SET );
149 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
151 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
152 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
153 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
155 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
156 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
157 CloseHandle( hfile );
158 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
159 return IMAGE_NT_SIGNATURE
160 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
161 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
163 return IMAGE_NT_SIGNATURE;
165 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
168 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
169 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
170 CloseHandle( hfile );
171 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
172 | (ne.ne_expver << 16);
175 CloseHandle( hfile );
180 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
181 the pidl functions fail on not existing file names */
182 if (flags & SHGFI_PIDL)
184 pidl = (LPCITEMIDLIST) path;
187 ERR("pidl is null!\n");
191 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
193 hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
194 /* note: the attributes in ISF::ParseDisplayName are not implemented */
197 /* get the parent shellfolder */
200 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
203 /* get the attributes of the child */
204 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
206 if (!(flags & SHGFI_ATTR_SPECIFIED))
208 psfi->dwAttributes = 0xffffffff;
210 IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
213 /* get the displayname */
214 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
216 if (flags & SHGFI_USEFILEATTRIBUTES)
218 strcpy (psfi->szDisplayName, PathFindFileNameA(path));
223 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
224 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
228 /* get the type name */
229 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
231 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
235 if (flags & SHGFI_LINKOVERLAY)
236 FIXME("set icon to link, stub\n");
238 if (flags & SHGFI_SELECTED)
239 FIXME("set icon to selected, stub\n");
241 if (flags & SHGFI_SHELLICONSIZE)
242 FIXME("set icon to shell size, stub\n");
244 /* get the iconlocation */
245 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
248 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
252 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
253 /* fixme what to do with the index? */
255 if(uFlags != GIL_NOTFILENAME)
256 strcpy (psfi->szDisplayName, szLoaction);
260 IExtractIconA_Release(pei);
264 /* get icon index (or load icon)*/
265 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
267 if (flags & SHGFI_USEFILEATTRIBUTES)
269 char sTemp [MAX_PATH];
273 lstrcpynA(sTemp, path, MAX_PATH);
274 szExt = (LPSTR) PathFindExtensionA(sTemp);
275 if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
276 && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
278 if (!strcmp("%1",sTemp)) /* icon is in the file */
282 /* FIXME: if sTemp contains a valid filename, get the icon
283 from there, index is in dwNr
287 else /* default icon */
294 if (!(PidlToSicIndex(psfParent, pidlLast, (flags & SHGFI_LARGEICON),
295 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
302 ret = (DWORD) ((flags & SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
307 if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
308 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
310 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
311 FIXME("unknown attribute!\n");
314 IShellFolder_Release(psfParent);
319 if(pidlLast) SHFree(pidlLast);
321 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
322 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
327 /*************************************************************************
328 * SHGetFileInfoW [SHELL32.@]
331 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
332 SHFILEINFOW *psfi, UINT sizeofpsfi,
334 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
335 debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
339 /*************************************************************************
340 * SHGetFileInfoAW [SHELL32.@]
342 DWORD WINAPI SHGetFileInfoAW(
344 DWORD dwFileAttributes,
349 if(SHELL_OsIsUnicode())
350 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
351 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
354 /*************************************************************************
355 * DuplicateIcon [SHELL32.188]
357 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
362 TRACE("(%04x, %04x)\n", hInstance, hIcon);
364 if(GetIconInfo(hIcon, &IconInfo))
366 hDupIcon = CreateIconIndirect(&IconInfo);
368 /* clean up hbmMask and hbmColor */
369 DeleteObject(IconInfo.hbmMask);
370 DeleteObject(IconInfo.hbmColor);
377 /*************************************************************************
378 * ExtractIconA [SHELL32.133]
381 * if the filename is not a file return 1
383 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
385 { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
389 HICON16* ptr = (HICON16*)GlobalLock16(handle);
390 HICON16 hIcon = *ptr;
392 GlobalFree16(handle);
398 /*************************************************************************
399 * ExtractIconW [SHELL32.180]
402 * is the filename is not a file return 1
404 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
410 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
411 ret = ExtractIconA(hInstance,exefn,nIconIndex);
413 HeapFree(GetProcessHeap(),0,exefn);
417 /*************************************************************************
418 * FindExecutableA [SHELL32.184]
420 HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
423 HINSTANCE retval=31; /* default - 'No association was found' */
426 TRACE("File %s, Dir %s\n",
427 (lpFile != NULL?lpFile:"-"),
428 (lpDirectory != NULL?lpDirectory:"-"));
430 lpResult[0]='\0'; /* Start off with an empty return string */
432 /* trap NULL parameters on entry */
433 if (( lpFile == NULL ) || ( lpResult == NULL ))
434 { /* FIXME - should throw a warning, perhaps! */
435 return 2; /* File not found. Close enough, I guess. */
439 { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
440 SetCurrentDirectoryA( lpDirectory );
443 retval = SHELL_FindExecutable( lpFile, "open", lpResult );
445 TRACE("returning %s\n", lpResult);
447 SetCurrentDirectoryA( old_dir );
451 /*************************************************************************
452 * FindExecutableW [SHELL32.219]
454 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
457 FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
458 return 31; /* default - 'No association was found' */
467 #define IDC_STATIC_TEXT 100
468 #define IDC_LISTBOX 99
469 #define IDC_WINE_TEXT 98
471 #define DROP_FIELD_TOP (-15)
472 #define DROP_FIELD_HEIGHT 15
474 static HICON hIconTitleFont;
476 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
477 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
479 { GetWindowRect( hWndCtl, lprect );
480 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
481 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
487 /*************************************************************************
488 * SHAppBarMessage [SHELL32.207]
490 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
492 int width=data->rc.right - data->rc.left;
493 int height=data->rc.bottom - data->rc.top;
497 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
498 case ABM_GETTASKBARPOS:
499 GetWindowRect(data->hWnd, &rec);
503 SetActiveWindow(data->hWnd);
505 case ABM_GETAUTOHIDEBAR:
506 data->hWnd=GetActiveWindow();
509 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
510 width,height,SWP_SHOWWINDOW);
513 GetWindowRect(data->hWnd, &(data->rc));
516 CloseHandle(data->hWnd);
518 case ABM_SETAUTOHIDEBAR:
519 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
520 width,height,SWP_SHOWWINDOW);
523 data->uEdge=(ABE_RIGHT | ABE_LEFT);
524 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
525 width,height,SWP_SHOWWINDOW);
527 case ABM_WINDOWPOSCHANGED:
528 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
529 width,height,SWP_SHOWWINDOW);
535 /*************************************************************************
536 * SHHelpShortcuts_RunDLL [SHELL32.224]
539 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
540 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
541 dwArg1, dwArg2, dwArg3, dwArg4);
546 /*************************************************************************
547 * SHLoadInProc [SHELL32.225]
548 * Create an instance of specified object class from within
549 * the shell process and release it immediately
552 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
554 IUnknown * pUnk = NULL;
555 TRACE("%s\n", debugstr_guid(rclsid));
557 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
560 IUnknown_Release(pUnk);
563 return DISP_E_MEMBERNOTFOUND;
566 /*************************************************************************
567 * ShellExecuteA [SHELL32.245]
569 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
570 LPCSTR lpFile, LPCSTR lpParameters,
571 LPCSTR lpDirectory, INT iShowCmd )
573 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
574 lpDirectory, iShowCmd );
577 /*************************************************************************
578 * ShellExecuteW [SHELL32.294]
580 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
581 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
588 LPCWSTR lpParameters,
596 /*************************************************************************
597 * AboutDlgProc (internal)
599 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
602 char Template[512], AppTitle[512];
607 { case WM_INITDIALOG:
608 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
610 { const char* const *pstr = SHELL_People;
611 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
612 GetWindowTextA( hWnd, Template, sizeof(Template) );
613 sprintf( AppTitle, Template, info->szApp );
614 SetWindowTextA( hWnd, AppTitle );
615 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
616 info->szOtherStuff );
617 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
618 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
622 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
623 hIconTitleFont = CreateFontIndirectA( &logFont );
625 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
627 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
630 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
638 HDC hDC = BeginPaint( hWnd, &ps );
640 if( __get_dropline( hWnd, &rect ) ) {
641 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
642 MoveToEx( hDC, rect.left, rect.top, NULL );
643 LineTo( hDC, rect.right, rect.bottom );
645 EndPaint( hWnd, &ps );
649 #if 0 /* FIXME: should use DoDragDrop */
650 case WM_LBTRACKPOINT:
651 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
652 if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
653 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
654 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
656 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
657 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
658 char* pstr = (char*)GlobalLock16( hMemObj );
661 { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) );
662 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
663 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
664 UpdateWindow( hWndCtl );
665 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
666 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
669 GlobalFree16( hMemObj );
676 case WM_QUERYDROPOBJECT:
678 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
679 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
681 if( __get_dropline( hWnd, &rect ) )
683 pt.x=lpDragInfo->pt.x;
684 pt.x=lpDragInfo->pt.y;
685 rect.bottom += DROP_FIELD_HEIGHT;
686 if( PtInRect( &rect, pt ) )
687 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
697 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
698 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
699 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
701 { static char __appendix_str[] = " with";
703 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
704 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
705 if( !strncmp( Template, "WINE", 4 ) )
706 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
708 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
710 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
711 (WPARAM)-1, (LPARAM)Template );
714 strcpy( Template, pstr );
715 strcat( Template, __appendix_str );
716 SetWindowTextA( hWndCtl, Template );
717 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
726 { EndDialog(hWnd, TRUE);
731 EndDialog(hWnd, TRUE);
739 /*************************************************************************
740 * ShellAboutA [SHELL32.243]
742 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
749 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
751 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
755 info.szOtherStuff = szOtherStuff;
757 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
758 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
759 template, hWnd, AboutDlgProc, (LPARAM)&info );
763 /*************************************************************************
764 * ShellAboutW [SHELL32.244]
766 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
775 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
777 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
780 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
781 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
783 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
784 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
785 template, hWnd, AboutDlgProc, (LPARAM)&info );
786 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
787 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
791 /*************************************************************************
794 void WINAPI FreeIconList( DWORD dw )
795 { FIXME("(%lx): stub\n",dw);
798 /***********************************************************************
799 * DllGetVersion [SHELL32]
801 * Retrieves version information of the 'SHELL32.DLL'
804 * pdvi [O] pointer to version information structure.
808 * Failure: E_INVALIDARG
811 * Returns version of a shell32.dll from IE4.01 SP1.
814 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
816 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
818 WARN("wrong DLLVERSIONINFO size from app");
822 pdvi->dwMajorVersion = 4;
823 pdvi->dwMinorVersion = 72;
824 pdvi->dwBuildNumber = 3110;
825 pdvi->dwPlatformID = 1;
827 TRACE("%lu.%lu.%lu.%lu\n",
828 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
829 pdvi->dwBuildNumber, pdvi->dwPlatformID);
833 /*************************************************************************
834 * global variables of the shell32.dll
835 * all are once per process
838 void (WINAPI* pDLLInitComctl)(LPVOID);
840 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT);
841 BOOL (WINAPI* pCOMCTL32_Free) (LPVOID);
843 HDPA (WINAPI* pDPA_Create) (INT);
844 INT (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
845 BOOL (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
846 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT);
847 BOOL (WINAPI* pDPA_Destroy) (const HDPA);
848 INT (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
849 LPVOID (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
851 static HINSTANCE hComctl32;
853 LONG shell32_ObjCount = 0;
854 HINSTANCE shell32_hInstance = 0;
855 HIMAGELIST ShellSmallIconList = 0;
856 HIMAGELIST ShellBigIconList = 0;
859 /*************************************************************************
863 * calling oleinitialize here breaks sone apps.
866 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
868 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
872 case DLL_PROCESS_ATTACH:
873 shell32_hInstance = hinstDLL;
874 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
875 DisableThreadLibraryCalls(shell32_hInstance);
879 ERR("P A N I C SHELL32 loading failed\n");
884 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
885 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
886 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
887 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
888 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
889 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
890 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
891 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
892 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
893 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
895 /* initialize the common controls */
898 pDLLInitComctl(NULL);
903 InitChangeNotifications();
904 SHInitRestricted(NULL, NULL);
907 case DLL_THREAD_ATTACH:
910 case DLL_THREAD_DETACH:
913 case DLL_PROCESS_DETACH:
914 shell32_hInstance = 0;
918 IShellFolder_Release(pdesktopfolder);
919 pdesktopfolder = NULL;
923 FreeChangeNotifications();
925 /* this one is here to check if AddRef/Release is balanced */
926 if (shell32_ObjCount)
928 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
935 /*************************************************************************
936 * DllInstall [SHELL32.202]
940 * BOOL bInstall - TRUE for install, FALSE for uninstall
941 * LPCWSTR pszCmdLine - command line (unused by shell32?)
944 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
946 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
948 return S_OK; /* indicate success */
951 /***********************************************************************
952 * DllCanUnloadNow (SHELL32.@)
954 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
956 FIXME("(void): stub\n");