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 * SHGetFileInfoA [SHELL32.@]
84 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
85 SHFILEINFOA *psfi, UINT sizeofpsfi,
88 char szLoaction[MAX_PATH];
90 DWORD ret = TRUE, dwAttributes = 0;
91 IShellFolder * psfParent = NULL;
92 IExtractIconA * pei = NULL;
93 LPITEMIDLIST pidlLast = NULL, pidl = NULL;
96 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
97 (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
99 if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
102 /* windows initializes this values regardless of the flags */
103 psfi->szDisplayName[0] = '\0';
104 psfi->szTypeName[0] = '\0';
107 if (flags & SHGFI_EXETYPE) {
111 IMAGE_DOS_HEADER mz_header;
116 if (flags != SHGFI_EXETYPE) return 0;
118 status = GetBinaryTypeA (path, &BinaryType);
119 if (!status) return 0;
120 if ((BinaryType == SCS_DOS_BINARY)
121 || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
123 hfile = CreateFileA( path, GENERIC_READ, FILE_SHARE_READ,
124 NULL, OPEN_EXISTING, 0, 0 );
125 if ( hfile == INVALID_HANDLE_VALUE ) return 0;
127 /* The next section is adapted from MODULE_GetBinaryType, as we need
128 * to examine the image header to get OS and version information. We
129 * know from calling GetBinaryTypeA that the image is valid and either
130 * an NE or PE, so much error handling can be omitted.
131 * Seek to the start of the file and read the header information.
134 SetFilePointer( hfile, 0, NULL, SEEK_SET );
135 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
137 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
138 ReadFile( hfile, magic, sizeof(magic), &len, NULL );
139 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE )
141 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
142 ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
143 CloseHandle( hfile );
144 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
145 return IMAGE_NT_SIGNATURE
146 | (nt.OptionalHeader.MajorSubsystemVersion << 24)
147 | (nt.OptionalHeader.MinorSubsystemVersion << 16);
149 return IMAGE_NT_SIGNATURE;
151 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
154 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
155 ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
156 CloseHandle( hfile );
157 if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
158 | (ne.ne_expver << 16);
161 CloseHandle( hfile );
166 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
167 the pidl functions fail on not existing file names */
168 if (flags & SHGFI_PIDL)
170 pidl = (LPCITEMIDLIST) path;
173 ERR("pidl is null!\n");
177 else if (!(flags & SHGFI_USEFILEATTRIBUTES))
179 hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
180 /* note: the attributes in ISF::ParseDisplayName are not implemented */
183 /* get the parent shellfolder */
186 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
189 /* get the attributes of the child */
190 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
192 if (!(flags & SHGFI_ATTR_SPECIFIED))
194 psfi->dwAttributes = 0xffffffff;
196 IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
199 /* get the displayname */
200 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
202 if (flags & SHGFI_USEFILEATTRIBUTES)
204 strcpy (psfi->szDisplayName, PathFindFileNameA(path));
209 hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
210 StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
214 /* get the type name */
215 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
217 _ILGetFileType(pidlLast, psfi->szTypeName, 80);
221 if (flags & SHGFI_LINKOVERLAY)
222 FIXME("set icon to link, stub\n");
224 if (flags & SHGFI_SELECTED)
225 FIXME("set icon to selected, stub\n");
227 if (flags & SHGFI_SHELLICONSIZE)
228 FIXME("set icon to shell size, stub\n");
230 /* get the iconlocation */
231 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
234 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
238 hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
239 /* fixme what to do with the index? */
241 if(uFlags != GIL_NOTFILENAME)
242 strcpy (psfi->szDisplayName, szLoaction);
246 IExtractIconA_Release(pei);
250 /* get icon index (or load icon)*/
251 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
253 if (flags & SHGFI_USEFILEATTRIBUTES)
255 char sTemp [MAX_PATH];
259 lstrcpynA(sTemp, path, MAX_PATH);
260 szExt = (LPSTR) PathFindExtensionA(sTemp);
261 if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
262 && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
264 if (!strcmp("%1",sTemp)) /* icon is in the file */
268 /* FIXME: if sTemp contains a valid filename, get the icon
269 from there, index is in dwNr
273 else /* default icon */
280 if (!(PidlToSicIndex(psfParent, pidlLast, (flags & SHGFI_LARGEICON),
281 (flags & SHGFI_OPENICON)? GIL_OPENICON : 0, &(psfi->iIcon))))
288 ret = (DWORD) ((flags & SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
293 if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
294 psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
296 if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
297 FIXME("unknown attribute!\n");
300 IShellFolder_Release(psfParent);
305 if(pidlLast) SHFree(pidlLast);
307 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
308 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
313 /*************************************************************************
314 * SHGetFileInfoW [SHELL32.@]
317 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
318 SHFILEINFOW *psfi, UINT sizeofpsfi,
320 { FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
321 debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
325 /*************************************************************************
326 * SHGetFileInfoAW [SHELL32.@]
328 DWORD WINAPI SHGetFileInfoAW(
330 DWORD dwFileAttributes,
335 if(SHELL_OsIsUnicode())
336 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
337 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
340 /*************************************************************************
341 * DuplicateIcon [SHELL32.188]
343 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
348 TRACE("(%04x, %04x)\n", hInstance, hIcon);
350 if(GetIconInfo(hIcon, &IconInfo))
352 hDupIcon = CreateIconIndirect(&IconInfo);
354 /* clean up hbmMask and hbmColor */
355 DeleteObject(IconInfo.hbmMask);
356 DeleteObject(IconInfo.hbmColor);
363 /*************************************************************************
364 * ExtractIconA [SHELL32.133]
367 * if the filename is not a file return 1
369 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
371 { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
375 HICON16* ptr = (HICON16*)GlobalLock16(handle);
376 HICON16 hIcon = *ptr;
378 GlobalFree16(handle);
384 /*************************************************************************
385 * ExtractIconW [SHELL32.180]
388 * is the filename is not a file return 1
390 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
396 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
397 ret = ExtractIconA(hInstance,exefn,nIconIndex);
399 HeapFree(GetProcessHeap(),0,exefn);
403 /*************************************************************************
404 * FindExecutableA [SHELL32.184]
406 HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
409 HINSTANCE retval=31; /* default - 'No association was found' */
412 TRACE("File %s, Dir %s\n",
413 (lpFile != NULL?lpFile:"-"),
414 (lpDirectory != NULL?lpDirectory:"-"));
416 lpResult[0]='\0'; /* Start off with an empty return string */
418 /* trap NULL parameters on entry */
419 if (( lpFile == NULL ) || ( lpResult == NULL ))
420 { /* FIXME - should throw a warning, perhaps! */
421 return 2; /* File not found. Close enough, I guess. */
425 { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
426 SetCurrentDirectoryA( lpDirectory );
429 retval = SHELL_FindExecutable( lpFile, "open", lpResult );
431 TRACE("returning %s\n", lpResult);
433 SetCurrentDirectoryA( old_dir );
437 /*************************************************************************
438 * FindExecutableW [SHELL32.219]
440 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
443 FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
444 return 31; /* default - 'No association was found' */
453 #define IDC_STATIC_TEXT 100
454 #define IDC_LISTBOX 99
455 #define IDC_WINE_TEXT 98
457 #define DROP_FIELD_TOP (-15)
458 #define DROP_FIELD_HEIGHT 15
460 static HICON hIconTitleFont;
462 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
463 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
465 { GetWindowRect( hWndCtl, lprect );
466 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
467 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
473 /*************************************************************************
474 * SHAppBarMessage [SHELL32.207]
476 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
478 int width=data->rc.right - data->rc.left;
479 int height=data->rc.bottom - data->rc.top;
483 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
484 case ABM_GETTASKBARPOS:
485 GetWindowRect(data->hWnd, &rec);
489 SetActiveWindow(data->hWnd);
491 case ABM_GETAUTOHIDEBAR:
492 data->hWnd=GetActiveWindow();
495 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
496 width,height,SWP_SHOWWINDOW);
499 GetWindowRect(data->hWnd, &(data->rc));
502 CloseHandle(data->hWnd);
504 case ABM_SETAUTOHIDEBAR:
505 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
506 width,height,SWP_SHOWWINDOW);
509 data->uEdge=(ABE_RIGHT | ABE_LEFT);
510 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
511 width,height,SWP_SHOWWINDOW);
513 case ABM_WINDOWPOSCHANGED:
514 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
515 width,height,SWP_SHOWWINDOW);
521 /*************************************************************************
522 * SHHelpShortcuts_RunDLL [SHELL32.224]
525 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
526 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
527 dwArg1, dwArg2, dwArg3, dwArg4);
532 /*************************************************************************
533 * SHLoadInProc [SHELL32.225]
534 * Create an instance of specified object class from within
535 * the shell process and release it immediately
538 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
540 IUnknown * pUnk = NULL;
541 TRACE("%s\n", debugstr_guid(rclsid));
543 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
546 IUnknown_Release(pUnk);
549 return DISP_E_MEMBERNOTFOUND;
552 /*************************************************************************
553 * ShellExecuteA [SHELL32.245]
555 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
556 LPCSTR lpFile, LPCSTR lpParameters,
557 LPCSTR lpDirectory, INT iShowCmd )
559 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
560 lpDirectory, iShowCmd );
563 /*************************************************************************
564 * ShellExecuteW [SHELL32.294]
566 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
567 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
574 LPCWSTR lpParameters,
582 /*************************************************************************
583 * AboutDlgProc (internal)
585 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
588 char Template[512], AppTitle[512];
593 { case WM_INITDIALOG:
594 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
596 { const char* const *pstr = SHELL_People;
597 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
598 GetWindowTextA( hWnd, Template, sizeof(Template) );
599 sprintf( AppTitle, Template, info->szApp );
600 SetWindowTextA( hWnd, AppTitle );
601 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
602 info->szOtherStuff );
603 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
604 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
608 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
609 hIconTitleFont = CreateFontIndirectA( &logFont );
611 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
613 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
616 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
624 HDC hDC = BeginPaint( hWnd, &ps );
626 if( __get_dropline( hWnd, &rect ) ) {
627 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
628 MoveToEx( hDC, rect.left, rect.top, NULL );
629 LineTo( hDC, rect.right, rect.bottom );
631 EndPaint( hWnd, &ps );
635 #if 0 /* FIXME: should use DoDragDrop */
636 case WM_LBTRACKPOINT:
637 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
638 if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
639 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
640 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
642 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
643 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
644 char* pstr = (char*)GlobalLock16( hMemObj );
647 { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) );
648 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
649 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
650 UpdateWindow( hWndCtl );
651 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
652 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
655 GlobalFree16( hMemObj );
662 case WM_QUERYDROPOBJECT:
664 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
665 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
667 if( __get_dropline( hWnd, &rect ) )
669 pt.x=lpDragInfo->pt.x;
670 pt.x=lpDragInfo->pt.y;
671 rect.bottom += DROP_FIELD_HEIGHT;
672 if( PtInRect( &rect, pt ) )
673 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
683 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
684 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
685 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
687 { static char __appendix_str[] = " with";
689 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
690 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
691 if( !strncmp( Template, "WINE", 4 ) )
692 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
694 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
696 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
697 (WPARAM)-1, (LPARAM)Template );
700 strcpy( Template, pstr );
701 strcat( Template, __appendix_str );
702 SetWindowTextA( hWndCtl, Template );
703 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
712 { EndDialog(hWnd, TRUE);
717 EndDialog(hWnd, TRUE);
725 /*************************************************************************
726 * ShellAboutA [SHELL32.243]
728 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
735 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
737 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
741 info.szOtherStuff = szOtherStuff;
743 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
744 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
745 template, hWnd, AboutDlgProc, (LPARAM)&info );
749 /*************************************************************************
750 * ShellAboutW [SHELL32.244]
752 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
761 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
763 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
766 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
767 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
769 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
770 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
771 template, hWnd, AboutDlgProc, (LPARAM)&info );
772 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
773 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
777 /*************************************************************************
780 void WINAPI FreeIconList( DWORD dw )
781 { FIXME("(%lx): stub\n",dw);
784 /***********************************************************************
785 * DllGetVersion [SHELL32]
787 * Retrieves version information of the 'SHELL32.DLL'
790 * pdvi [O] pointer to version information structure.
794 * Failure: E_INVALIDARG
797 * Returns version of a shell32.dll from IE4.01 SP1.
800 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
802 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
804 WARN("wrong DLLVERSIONINFO size from app");
808 pdvi->dwMajorVersion = 4;
809 pdvi->dwMinorVersion = 72;
810 pdvi->dwBuildNumber = 3110;
811 pdvi->dwPlatformID = 1;
813 TRACE("%lu.%lu.%lu.%lu\n",
814 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
815 pdvi->dwBuildNumber, pdvi->dwPlatformID);
819 /*************************************************************************
820 * global variables of the shell32.dll
821 * all are once per process
824 void WINAPI (*pDLLInitComctl)(LPVOID);
826 LPVOID WINAPI (*pCOMCTL32_Alloc) (INT);
827 BOOL WINAPI (*pCOMCTL32_Free) (LPVOID);
829 HDPA WINAPI (*pDPA_Create) (INT);
830 INT WINAPI (*pDPA_InsertPtr) (const HDPA, INT, LPVOID);
831 BOOL WINAPI (*pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
832 LPVOID WINAPI (*pDPA_GetPtr) (const HDPA, INT);
833 BOOL WINAPI (*pDPA_Destroy) (const HDPA);
834 INT WINAPI (*pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
835 LPVOID WINAPI (*pDPA_DeletePtr) (const HDPA hdpa, INT i);
837 static HINSTANCE hComctl32;
839 LONG shell32_ObjCount = 0;
840 HINSTANCE shell32_hInstance = 0;
841 HIMAGELIST ShellSmallIconList = 0;
842 HIMAGELIST ShellBigIconList = 0;
845 /*************************************************************************
849 * calling oleinitialize here breaks sone apps.
852 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
854 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
858 case DLL_PROCESS_ATTACH:
859 shell32_hInstance = hinstDLL;
860 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
861 DisableThreadLibraryCalls(shell32_hInstance);
865 ERR("P A N I C SHELL32 loading failed\n");
870 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
871 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
872 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
873 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
874 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
875 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
876 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
877 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
878 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
879 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
881 /* initialize the common controls */
884 pDLLInitComctl(NULL);
889 InitChangeNotifications();
890 SHInitRestricted(NULL, NULL);
893 case DLL_THREAD_ATTACH:
896 case DLL_THREAD_DETACH:
899 case DLL_PROCESS_DETACH:
900 shell32_hInstance = 0;
904 IShellFolder_Release(pdesktopfolder);
905 pdesktopfolder = NULL;
909 FreeChangeNotifications();
911 /* this one is here to check if AddRef/Release is balanced */
912 if (shell32_ObjCount)
914 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
921 /*************************************************************************
922 * DllInstall [SHELL32.202]
926 * BOOL bInstall - TRUE for install, FALSE for uninstall
927 * LPCWSTR pszCmdLine - command line (unused by shell32?)
930 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
932 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
934 return S_OK; /* indicate success */
937 /***********************************************************************
938 * DllCanUnloadNow (SHELL32.@)
940 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
942 FIXME("(void): stub\n");