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,
324 SHFILEINFOA temppsfi;
326 len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
327 temppath = HeapAlloc(GetProcessHeap(), 0, len);
328 WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
330 WideCharToMultiByte(CP_ACP, 0, psfi->szDisplayName, -1, temppsfi.szDisplayName,
331 sizeof(temppsfi.szDisplayName), NULL, NULL);
332 WideCharToMultiByte(CP_ACP, 0, psfi->szTypeName, -1, temppsfi.szTypeName,
333 sizeof(temppsfi.szTypeName), NULL, NULL);
335 ret = SHGetFileInfoA(temppath, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
337 HeapFree(GetProcessHeap(), 0, temppath);
342 /*************************************************************************
343 * SHGetFileInfoAW [SHELL32.@]
345 DWORD WINAPI SHGetFileInfoAW(
347 DWORD dwFileAttributes,
352 if(SHELL_OsIsUnicode())
353 return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
354 return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
357 /*************************************************************************
358 * DuplicateIcon [SHELL32.188]
360 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon)
365 TRACE("(%04x, %04x)\n", hInstance, hIcon);
367 if(GetIconInfo(hIcon, &IconInfo))
369 hDupIcon = CreateIconIndirect(&IconInfo);
371 /* clean up hbmMask and hbmColor */
372 DeleteObject(IconInfo.hbmMask);
373 DeleteObject(IconInfo.hbmColor);
380 /*************************************************************************
381 * ExtractIconA [SHELL32.133]
384 * if the filename is not a file return 1
386 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
388 { HGLOBAL16 handle = InternalExtractIcon16(hInstance,lpszExeFileName,nIconIndex, 1);
392 HICON16* ptr = (HICON16*)GlobalLock16(handle);
393 HICON16 hIcon = *ptr;
395 GlobalFree16(handle);
401 /*************************************************************************
402 * ExtractIconW [SHELL32.180]
405 * is the filename is not a file return 1
407 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
413 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
414 ret = ExtractIconA(hInstance,exefn,nIconIndex);
416 HeapFree(GetProcessHeap(),0,exefn);
420 /*************************************************************************
421 * FindExecutableA [SHELL32.184]
423 HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
426 HINSTANCE retval=31; /* default - 'No association was found' */
429 TRACE("File %s, Dir %s\n",
430 (lpFile != NULL?lpFile:"-"),
431 (lpDirectory != NULL?lpDirectory:"-"));
433 lpResult[0]='\0'; /* Start off with an empty return string */
435 /* trap NULL parameters on entry */
436 if (( lpFile == NULL ) || ( lpResult == NULL ))
437 { /* FIXME - should throw a warning, perhaps! */
438 return 2; /* File not found. Close enough, I guess. */
442 { GetCurrentDirectoryA( sizeof(old_dir), old_dir );
443 SetCurrentDirectoryA( lpDirectory );
446 retval = SHELL_FindExecutable( lpFile, "open", lpResult );
448 TRACE("returning %s\n", lpResult);
450 SetCurrentDirectoryA( old_dir );
454 /*************************************************************************
455 * FindExecutableW [SHELL32.219]
457 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
460 FIXME("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
461 return 31; /* default - 'No association was found' */
470 #define IDC_STATIC_TEXT 100
471 #define IDC_LISTBOX 99
472 #define IDC_WINE_TEXT 98
474 #define DROP_FIELD_TOP (-15)
475 #define DROP_FIELD_HEIGHT 15
477 static HICON hIconTitleFont;
479 static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
480 { HWND hWndCtl = GetDlgItem(hWnd, IDC_WINE_TEXT);
482 { GetWindowRect( hWndCtl, lprect );
483 MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
484 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
490 /*************************************************************************
491 * SHAppBarMessage [SHELL32.207]
493 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
495 int width=data->rc.right - data->rc.left;
496 int height=data->rc.bottom - data->rc.top;
500 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
501 case ABM_GETTASKBARPOS:
502 GetWindowRect(data->hWnd, &rec);
506 SetActiveWindow(data->hWnd);
508 case ABM_GETAUTOHIDEBAR:
509 data->hWnd=GetActiveWindow();
512 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
513 width,height,SWP_SHOWWINDOW);
516 GetWindowRect(data->hWnd, &(data->rc));
519 CloseHandle(data->hWnd);
521 case ABM_SETAUTOHIDEBAR:
522 SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
523 width,height,SWP_SHOWWINDOW);
526 data->uEdge=(ABE_RIGHT | ABE_LEFT);
527 SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
528 width,height,SWP_SHOWWINDOW);
530 case ABM_WINDOWPOSCHANGED:
531 SetWindowPos(data->hWnd,HWND_TOP,rec.left,rec.top,
532 width,height,SWP_SHOWWINDOW);
538 /*************************************************************************
539 * SHHelpShortcuts_RunDLL [SHELL32.224]
542 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
543 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
544 dwArg1, dwArg2, dwArg3, dwArg4);
549 /*************************************************************************
550 * SHLoadInProc [SHELL32.225]
551 * Create an instance of specified object class from within
552 * the shell process and release it immediately
555 DWORD WINAPI SHLoadInProc (REFCLSID rclsid)
557 IUnknown * pUnk = NULL;
558 TRACE("%s\n", debugstr_guid(rclsid));
560 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,(LPVOID*)pUnk);
563 IUnknown_Release(pUnk);
566 return DISP_E_MEMBERNOTFOUND;
569 /*************************************************************************
570 * ShellExecuteA [SHELL32.245]
572 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
573 LPCSTR lpFile, LPCSTR lpParameters,
574 LPCSTR lpDirectory, INT iShowCmd )
576 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
577 lpDirectory, iShowCmd );
580 /*************************************************************************
581 * ShellExecuteW [SHELL32.294]
583 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
584 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
591 LPCWSTR lpParameters,
599 /*************************************************************************
600 * AboutDlgProc (internal)
602 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
605 char Template[512], AppTitle[512];
610 { case WM_INITDIALOG:
611 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
613 { const char* const *pstr = SHELL_People;
614 SendDlgItemMessageA(hWnd, stc1, STM_SETICON,info->hIcon, 0);
615 GetWindowTextA( hWnd, Template, sizeof(Template) );
616 sprintf( AppTitle, Template, info->szApp );
617 SetWindowTextA( hWnd, AppTitle );
618 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT),
619 info->szOtherStuff );
620 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
621 SendMessageA( hWndCtl, WM_SETREDRAW, 0, 0 );
625 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
626 hIconTitleFont = CreateFontIndirectA( &logFont );
628 SendMessageA( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
630 { SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)*pstr );
633 SendMessageA( hWndCtl, WM_SETREDRAW, 1, 0 );
641 HDC hDC = BeginPaint( hWnd, &ps );
643 if( __get_dropline( hWnd, &rect ) ) {
644 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
645 MoveToEx( hDC, rect.left, rect.top, NULL );
646 LineTo( hDC, rect.right, rect.bottom );
648 EndPaint( hWnd, &ps );
652 #if 0 /* FIXME: should use DoDragDrop */
653 case WM_LBTRACKPOINT:
654 hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
655 if( (INT16)GetKeyState( VK_CONTROL ) < 0 )
656 { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
657 { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
659 { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
660 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
661 char* pstr = (char*)GlobalLock16( hMemObj );
664 { HCURSOR hCursor = LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT) );
665 SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
666 SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
667 UpdateWindow( hWndCtl );
668 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
669 SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
672 GlobalFree16( hMemObj );
679 case WM_QUERYDROPOBJECT:
681 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
682 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
684 if( __get_dropline( hWnd, &rect ) )
686 pt.x=lpDragInfo->pt.x;
687 pt.x=lpDragInfo->pt.y;
688 rect.bottom += DROP_FIELD_HEIGHT;
689 if( PtInRect( &rect, pt ) )
690 { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
700 { LPDRAGINFO16 lpDragInfo = MapSL((SEGPTR)lParam);
701 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
702 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
704 { static char __appendix_str[] = " with";
706 hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
707 SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
708 if( !strncmp( Template, "WINE", 4 ) )
709 SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
711 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
713 SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
714 (WPARAM)-1, (LPARAM)Template );
717 strcpy( Template, pstr );
718 strcat( Template, __appendix_str );
719 SetWindowTextA( hWndCtl, Template );
720 SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
729 { EndDialog(hWnd, TRUE);
734 EndDialog(hWnd, TRUE);
742 /*************************************************************************
743 * ShellAboutA [SHELL32.243]
745 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
752 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
754 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
758 info.szOtherStuff = szOtherStuff;
760 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
761 return DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
762 template, hWnd, AboutDlgProc, (LPARAM)&info );
766 /*************************************************************************
767 * ShellAboutW [SHELL32.244]
769 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
778 if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
780 if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
783 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
784 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
786 if (!hIcon) info.hIcon = LoadIconA( 0, IDI_WINLOGOA );
787 ret = DialogBoxIndirectParamA( GetWindowLongA( hWnd, GWL_HINSTANCE ),
788 template, hWnd, AboutDlgProc, (LPARAM)&info );
789 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
790 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
794 /*************************************************************************
797 void WINAPI FreeIconList( DWORD dw )
798 { FIXME("(%lx): stub\n",dw);
801 /***********************************************************************
802 * DllGetVersion [SHELL32]
804 * Retrieves version information of the 'SHELL32.DLL'
807 * pdvi [O] pointer to version information structure.
811 * Failure: E_INVALIDARG
814 * Returns version of a shell32.dll from IE4.01 SP1.
817 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
819 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
821 WARN("wrong DLLVERSIONINFO size from app\n");
825 pdvi->dwMajorVersion = 4;
826 pdvi->dwMinorVersion = 72;
827 pdvi->dwBuildNumber = 3110;
828 pdvi->dwPlatformID = 1;
830 TRACE("%lu.%lu.%lu.%lu\n",
831 pdvi->dwMajorVersion, pdvi->dwMinorVersion,
832 pdvi->dwBuildNumber, pdvi->dwPlatformID);
836 /*************************************************************************
837 * global variables of the shell32.dll
838 * all are once per process
841 void WINAPI (*pDLLInitComctl)(LPVOID);
843 LPVOID WINAPI (*pCOMCTL32_Alloc) (INT);
844 BOOL WINAPI (*pCOMCTL32_Free) (LPVOID);
846 HDPA WINAPI (*pDPA_Create) (INT);
847 INT WINAPI (*pDPA_InsertPtr) (const HDPA, INT, LPVOID);
848 BOOL WINAPI (*pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
849 LPVOID WINAPI (*pDPA_GetPtr) (const HDPA, INT);
850 BOOL WINAPI (*pDPA_Destroy) (const HDPA);
851 INT WINAPI (*pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
852 LPVOID WINAPI (*pDPA_DeletePtr) (const HDPA hdpa, INT i);
854 static HINSTANCE hComctl32;
856 LONG shell32_ObjCount = 0;
857 HINSTANCE shell32_hInstance = 0;
858 HIMAGELIST ShellSmallIconList = 0;
859 HIMAGELIST ShellBigIconList = 0;
862 /*************************************************************************
866 * calling oleinitialize here breaks sone apps.
869 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
871 TRACE("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
875 case DLL_PROCESS_ATTACH:
876 shell32_hInstance = hinstDLL;
877 hComctl32 = GetModuleHandleA("COMCTL32.DLL");
878 DisableThreadLibraryCalls(shell32_hInstance);
882 ERR("P A N I C SHELL32 loading failed\n");
887 pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
888 pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
889 pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
890 pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
891 pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
892 pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
893 pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
894 pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
895 pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
896 pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
898 /* initialize the common controls */
901 pDLLInitComctl(NULL);
906 InitChangeNotifications();
907 SHInitRestricted(NULL, NULL);
910 case DLL_THREAD_ATTACH:
913 case DLL_THREAD_DETACH:
916 case DLL_PROCESS_DETACH:
917 shell32_hInstance = 0;
921 IShellFolder_Release(pdesktopfolder);
922 pdesktopfolder = NULL;
926 FreeChangeNotifications();
928 /* this one is here to check if AddRef/Release is balanced */
929 if (shell32_ObjCount)
931 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
938 /*************************************************************************
939 * DllInstall [SHELL32.202]
943 * BOOL bInstall - TRUE for install, FALSE for uninstall
944 * LPCWSTR pszCmdLine - command line (unused by shell32?)
947 HRESULT WINAPI SHELL32_DllInstall(BOOL bInstall, LPCWSTR cmdline)
949 FIXME("(%s, %s): stub!\n", bInstall ? "TRUE":"FALSE", debugstr_w(cmdline));
951 return S_OK; /* indicate success */
954 /***********************************************************************
955 * DllCanUnloadNow (SHELL32.@)
957 HRESULT WINAPI SHELL32_DllCanUnloadNow(void)
959 FIXME("(void): stub\n");