5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
11 #include "wine/winuser16.h"
17 #include "sysmetrics.h"
25 #include "shell32_main.h"
29 /*************************************************************************
30 * CommandLineToArgvW [SHELL32.7]
32 LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs)
37 /* to get writeable copy */
38 cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
45 while (*s && *s==0x0020)
51 argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
57 argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
59 while (*s && *s==0x0020)
70 argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
71 HeapFree( GetProcessHeap(), 0, cmdline );
77 /*************************************************************************
78 * Control_RunDLL [SHELL32.12]
80 * Wild speculation in the following!
82 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
85 void WINAPI Control_RunDLL( HWND32 hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
87 FIXME(shell, "(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
88 debugstr_a(cmd), arg4);
91 /*************************************************************************
92 * SHGetFileInfoA [SHELL32.254]
98 DWORD WINAPI SHGetFileInfo32A(LPCSTR path,DWORD dwFileAttributes,
99 SHFILEINFO32A *psfi, UINT32 sizeofpsfi,
101 { CHAR szTemp[MAX_PATH];
103 LPITEMIDLIST pPidlTemp = NULL;
106 TRACE(shell,"(%s,0x%lx,%p,0x%x,0x%x)\n",
107 path,dwFileAttributes,psfi,sizeofpsfi,flags);
109 /* translate the pidl to a path*/
110 if (flags & SHGFI_PIDL)
111 { pPidlTemp = (LPCITEMIDLIST)path;
112 SHGetPathFromIDList32A (pPidlTemp, szTemp);
113 TRACE(shell,"pidl=%p is %s\n", path, szTemp);
116 { strcpy(szTemp,path);
117 TRACE(shell,"path=%s\n", szTemp);
120 if (flags & SHGFI_ATTRIBUTES)
121 { if (flags & SHGFI_PIDL)
122 { pData = _ILGetDataPointer((LPCITEMIDLIST)path);
123 psfi->dwAttributes = pData->u.generic.dwSFGAO; /* fixme: no direct access*/
127 { psfi->dwAttributes=SFGAO_FILESYSTEM;
130 FIXME(shell,"file attributes, stub\n");
133 if (flags & SHGFI_DISPLAYNAME)
134 { if (flags & SHGFI_PIDL)
135 { strcpy(psfi->szDisplayName,szTemp);
138 { strcpy(psfi->szDisplayName,path);
140 TRACE(shell,"displayname=%s\n", psfi->szDisplayName);
144 if (flags & SHGFI_TYPENAME)
145 { FIXME(shell,"get the file type, stub\n");
146 strcpy(psfi->szTypeName,"FIXME: Type");
150 if (flags & SHGFI_ICONLOCATION)
151 { FIXME(shell,"location of icon, stub\n");
152 strcpy(psfi->szDisplayName,"");
156 if (flags & SHGFI_EXETYPE)
157 FIXME(shell,"type of executable, stub\n");
159 if (flags & SHGFI_LINKOVERLAY)
160 FIXME(shell,"set icon to link, stub\n");
162 if (flags & SHGFI_OPENICON)
163 FIXME(shell,"set to open icon, stub\n");
165 if (flags & SHGFI_SELECTED)
166 FIXME(shell,"set icon to selected, stub\n");
168 if (flags & SHGFI_SHELLICONSIZE)
169 FIXME(shell,"set icon to shell size, stub\n");
171 if (flags & SHGFI_USEFILEATTRIBUTES)
172 FIXME(shell,"use the dwFileAttributes, stub\n");
174 if (flags & SHGFI_ICON)
175 { FIXME(shell,"icon handle\n");
176 if (flags & SHGFI_SMALLICON)
177 { TRACE(shell,"set to small icon\n");
178 psfi->hIcon=pImageList_GetIcon(ShellSmallIconList,32,ILD_NORMAL);
179 ret = (DWORD) ShellSmallIconList;
182 { TRACE(shell,"set to big icon\n");
183 psfi->hIcon=pImageList_GetIcon(ShellBigIconList,32,ILD_NORMAL);
184 ret = (DWORD) ShellBigIconList;
188 if (flags & SHGFI_SYSICONINDEX)
190 { pPidlTemp = ILCreateFromPath (szTemp);
192 psfi->iIcon = SHMapPIDLToSystemImageListIndex (NULL, pPidlTemp, 0);
193 TRACE(shell,"-- SYSICONINDEX %i\n", psfi->iIcon);
195 if (flags & SHGFI_SMALLICON)
196 { TRACE(shell,"set to small icon\n");
197 ret = (DWORD) ShellSmallIconList;
200 { TRACE(shell,"set to big icon\n");
201 ret = (DWORD) ShellBigIconList;
208 /*************************************************************************
209 * SHGetFileInfo32W [SHELL32.255]
215 DWORD WINAPI SHGetFileInfo32W(LPCWSTR path,DWORD dwFileAttributes,
216 SHFILEINFO32W *psfi, UINT32 sizeofpsfi,
218 { FIXME(shell,"(%s,0x%lx,%p,0x%x,0x%x)\n",
219 debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
223 /*************************************************************************
224 * ExtractIcon32A (SHELL32.133)
226 HICON32 WINAPI ExtractIcon32A( HINSTANCE32 hInstance, LPCSTR lpszExeFileName,
228 { HGLOBAL16 handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1);
232 HICON16* ptr = (HICON16*)GlobalLock16(handle);
233 HICON16 hIcon = *ptr;
235 GlobalFree16(handle);
241 /*************************************************************************
242 * ExtractIcon32W (SHELL32.180)
244 HICON32 WINAPI ExtractIcon32W( HINSTANCE32 hInstance, LPCWSTR lpszExeFileName,
250 exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
251 ret = ExtractIcon32A(hInstance,exefn,nIconIndex);
253 HeapFree(GetProcessHeap(),0,exefn);
257 /*************************************************************************
258 * FindExecutable32A (SHELL32.184)
260 HINSTANCE32 WINAPI FindExecutable32A( LPCSTR lpFile, LPCSTR lpDirectory,
262 { HINSTANCE32 retval=31; /* default - 'No association was found' */
265 TRACE(shell, "File %s, Dir %s\n",
266 (lpFile != NULL?lpFile:"-"),
267 (lpDirectory != NULL?lpDirectory:"-"));
269 lpResult[0]='\0'; /* Start off with an empty return string */
271 /* trap NULL parameters on entry */
272 if (( lpFile == NULL ) || ( lpResult == NULL ))
273 { /* FIXME - should throw a warning, perhaps! */
274 return 2; /* File not found. Close enough, I guess. */
278 { GetCurrentDirectory32A( sizeof(old_dir), old_dir );
279 SetCurrentDirectory32A( lpDirectory );
282 retval = SHELL_FindExecutable( lpFile, "open", lpResult );
284 TRACE(shell, "returning %s\n", lpResult);
286 SetCurrentDirectory32A( old_dir );
290 /*************************************************************************
291 * FindExecutable32W (SHELL32.219)
293 HINSTANCE32 WINAPI FindExecutable32W(LPCWSTR lpFile, LPCWSTR lpDirectory,
296 FIXME(shell, "(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
297 return 31; /* default - 'No association was found' */
306 #define IDC_STATIC_TEXT 100
307 #define IDC_LISTBOX 99
308 #define IDC_WINE_TEXT 98
310 #define DROP_FIELD_TOP (-15)
311 #define DROP_FIELD_HEIGHT 15
313 extern HICON32 hIconTitleFont;
315 static BOOL32 __get_dropline( HWND32 hWnd, LPRECT32 lprect )
316 { HWND32 hWndCtl = GetDlgItem32(hWnd, IDC_WINE_TEXT);
318 { GetWindowRect32( hWndCtl, lprect );
319 MapWindowPoints32( 0, hWnd, (LPPOINT32)lprect, 2 );
320 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
326 /*************************************************************************
327 * SHAppBarMessage32 [SHELL32.207]
329 UINT32 WINAPI SHAppBarMessage32(DWORD msg, PAPPBARDATA data)
330 { FIXME(shell,"(0x%08lx,%p): stub\n", msg, data);
334 case ABM_GETAUTOHIDEBAR:
336 case ABM_GETTASKBARPOS:
340 case ABM_SETAUTOHIDEBAR:
342 case ABM_WINDOWPOSCHANGED:
349 /*************************************************************************
350 * SHBrowseForFolderA [SHELL32.209]
353 LPITEMIDLIST WINAPI SHBrowseForFolder32A (LPBROWSEINFO32A lpbi)
354 { FIXME (shell, "(%lx,%s) empty stub!\n", (DWORD)lpbi, lpbi->lpszTitle);
358 /*************************************************************************
359 * SHGetDesktopFolder [SHELL32.216]
361 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
363 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
366 * the interface to the shell desktop folder.
369 * the pdesktopfolder has to be released at the end (at dll unloading???)
371 LPSHELLFOLDER pdesktopfolder=NULL;
373 DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder)
374 { HRESULT hres = E_OUTOFMEMORY;
375 LPCLASSFACTORY lpclf;
376 TRACE(shell,"%p->(%p)\n",shellfolder,*shellfolder);
378 if (pdesktopfolder) {
381 lpclf = IClassFactory_Constructor();
382 /* fixme: the buildin IClassFactory_Constructor is at the moment only
383 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
385 hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);
386 IClassFactory_Release(lpclf);
390 if (pdesktopfolder) {
391 *shellfolder = pdesktopfolder;
392 pdesktopfolder->lpvtbl->fnAddRef(pdesktopfolder);
397 TRACE(shell,"-- %p->(%p)\n",shellfolder, *shellfolder);
401 /*************************************************************************
402 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
404 BOOL32 WINAPI SHGetPathFromIDList32(LPCITEMIDLIST pidl,LPSTR pszPath)
405 { TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
406 return SHGetPathFromIDList32A(pidl,pszPath);
409 /*************************************************************************
410 * SHGetSpecialFolderLocation [SHELL32.223]
411 * gets the folder locations from the registry and creates a pidl
412 * creates missing reg keys and directorys
416 * nFolder [I] CSIDL_xxxxx
417 * ppidl [O] PIDL of a special folder
423 * - look for "User Shell Folder" first
426 HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl)
427 { LPSHELLFOLDER shellfolder;
428 DWORD pchEaten,tpathlen=MAX_PATH,type,dwdisp,res;
429 CHAR pszTemp[256],buffer[256],tpath[MAX_PATH],npath[MAX_PATH];
430 LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
434 { FT_UNKNOWN= 0x00000000,
436 FT_DESKTOP= 0x00000002,
437 FT_SPECIAL= 0x00000003
440 TRACE(shell,"(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
442 strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
444 res=RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp);
446 { ERR(shell,"Could not create key %s %08lx \n",buffer,res);
447 return E_OUTOFMEMORY;
452 { case CSIDL_BITBUCKET:
453 strcpy (buffer,"xxx"); /*not in the registry*/
454 TRACE (shell,"looking for Recycler\n");
458 strcpy (buffer,"xxx"); /*virtual folder*/
459 TRACE (shell,"looking for Control\n");
463 strcpy (buffer,"xxx"); /*virtual folder*/
464 TRACE (shell,"looking for Desktop\n");
467 case CSIDL_DESKTOPDIRECTORY:
468 case CSIDL_COMMON_DESKTOPDIRECTORY:
469 strcpy (buffer,"Desktop");
472 strcpy (buffer,"xxx"); /*virtual folder*/
473 TRACE (shell,"looking for Drives\n");
477 strcpy (buffer,"Fonts");
480 strcpy (buffer,"NetHood");
482 case CSIDL_PRINTHOOD:
483 strcpy (buffer,"PrintHood");
486 strcpy (buffer,"xxx"); /*virtual folder*/
487 TRACE (shell,"looking for Network\n");
491 strcpy (buffer,"Appdata");
494 strcpy (buffer,"Personal");
496 case CSIDL_FAVORITES:
497 strcpy (buffer,"Favorites");
500 strcpy (buffer,"PrintHood");
502 case CSIDL_COMMON_PROGRAMS:
504 strcpy (buffer,"Programs");
507 strcpy (buffer,"Recent");
510 strcpy (buffer,"SendTo");
512 case CSIDL_COMMON_STARTMENU:
513 case CSIDL_STARTMENU:
514 strcpy (buffer,"Start Menu");
516 case CSIDL_COMMON_STARTUP:
518 strcpy (buffer,"Startup");
520 case CSIDL_TEMPLATES:
521 strcpy (buffer,"Templates");
524 ERR (shell,"unknown CSIDL 0x%08x\n", nFolder);
529 TRACE(shell,"Key=%s\n",buffer);
535 /* Directory: get the value from the registry, if its not there
536 create it and the directory*/
537 if (RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
538 { GetWindowsDirectory32A(npath,MAX_PATH);
539 PathAddBackslash32A(npath);
541 { case CSIDL_DESKTOPDIRECTORY:
542 case CSIDL_COMMON_DESKTOPDIRECTORY:
543 strcat (npath,"Desktop");
546 strcat (npath,"Fonts");
549 strcat (npath,"NetHood");
551 case CSIDL_PRINTHOOD:
552 strcat (npath,"PrintHood");
555 strcat (npath,"Appdata");
558 strcpy (npath,"C:\\Personal");
560 case CSIDL_FAVORITES:
561 strcat (npath,"Favorites");
564 strcat (npath,"PrintHood");
566 case CSIDL_COMMON_PROGRAMS:
568 strcat (npath,"Start Menu");
569 CreateDirectory32A(npath,NULL);
570 strcat (npath,"\\Programs");
573 strcat (npath,"Recent");
576 strcat (npath,"SendTo");
578 case CSIDL_COMMON_STARTMENU:
579 case CSIDL_STARTMENU:
580 strcat (npath,"Start Menu");
582 case CSIDL_COMMON_STARTUP:
584 strcat (npath,"Start Menu");
585 CreateDirectory32A(npath,NULL);
586 strcat (npath,"\\Startup");
588 case CSIDL_TEMPLATES:
589 strcat (npath,"Templates");
593 return E_OUTOFMEMORY;
595 if (RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)npath,sizeof(npath)+1))
596 { ERR(shell,"could not create value %s\n",buffer);
598 return E_OUTOFMEMORY;
600 TRACE(shell,"value %s=%s created\n",buffer,npath);
601 CreateDirectory32A(npath,NULL);
606 strcpy (tpath,"Desktop");
609 if (nFolder==CSIDL_DRIVES)
610 strcpy (tpath,"My Computer");
614 return E_OUTOFMEMORY;
619 TRACE(shell,"Value=%s\n",tpath);
620 LocalToWideChar32(lpszDisplayName, tpath, 256);
622 if (SHGetDesktopFolder(&shellfolder)==S_OK)
623 { shellfolder->lpvtbl->fnParseDisplayName(shellfolder,hwndOwner, NULL,lpszDisplayName,&pchEaten,ppidl,NULL);
624 shellfolder->lpvtbl->fnRelease(shellfolder);
627 TRACE(shell, "-- (new pidl %p)\n",*ppidl);
630 /*************************************************************************
631 * SHHelpShortcuts_RunDLL [SHELL32.224]
634 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
635 { FIXME (exec, "(%lx, %lx, %lx, %lx) empty stub!\n",
636 dwArg1, dwArg2, dwArg3, dwArg4);
641 /*************************************************************************
642 * SHLoadInProc [SHELL32.225]
646 DWORD WINAPI SHLoadInProc (DWORD dwArg1)
647 { FIXME (shell, "(%lx) empty stub!\n", dwArg1);
651 /*************************************************************************
652 * ShellExecute32A (SHELL32.245)
654 HINSTANCE32 WINAPI ShellExecute32A( HWND32 hWnd, LPCSTR lpOperation,
655 LPCSTR lpFile, LPCSTR lpParameters,
656 LPCSTR lpDirectory, INT32 iShowCmd )
658 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
659 lpDirectory, iShowCmd );
662 /*************************************************************************
663 * ShellExecute32W [SHELL32.294]
665 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
666 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
673 LPCWSTR lpParameters,
677 FIXME(shell,": stub\n");
686 /*************************************************************************
687 * AboutDlgProc32 (not an exported API function)
689 BOOL32 WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
692 char Template[512], AppTitle[512];
697 { case WM_INITDIALOG:
698 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
700 { const char* const *pstr = SHELL_People;
701 SendDlgItemMessage32A(hWnd, stc1, STM_SETICON32,info->hIcon, 0);
702 GetWindowText32A( hWnd, Template, sizeof(Template) );
703 sprintf( AppTitle, Template, info->szApp );
704 SetWindowText32A( hWnd, AppTitle );
705 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT),
706 info->szOtherStuff );
707 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
708 SendMessage32A( hWndCtl, WM_SETREDRAW, 0, 0 );
709 SendMessage32A( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
711 { SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)*pstr );
714 SendMessage32A( hWndCtl, WM_SETREDRAW, 1, 0 );
722 HDC32 hDC = BeginPaint32( hWnd, &ps );
724 if( __get_dropline( hWnd, &rect ) ) {
725 SelectObject32( hDC, GetStockObject32( BLACK_PEN ) );
726 MoveToEx32( hDC, rect.left, rect.top, NULL );
727 LineTo32( hDC, rect.right, rect.bottom );
729 EndPaint32( hWnd, &ps );
733 case WM_LBTRACKPOINT:
734 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
735 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
736 { if( DragDetect32( hWndCtl, *((LPPOINT32)&lParam) ) )
737 { INT32 idx = SendMessage32A( hWndCtl, LB_GETCURSEL32, 0, 0 );
739 { INT32 length = SendMessage32A( hWndCtl, LB_GETTEXTLEN32, (WPARAM32)idx, 0 );
740 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
741 char* pstr = (char*)GlobalLock16( hMemObj );
744 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
745 SendMessage32A( hWndCtl, LB_GETTEXT32, (WPARAM32)idx, (LPARAM)pstr );
746 SendMessage32A( hWndCtl, LB_DELETESTRING32, (WPARAM32)idx, 0 );
747 UpdateWindow32( hWndCtl );
748 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
749 SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)pstr );
752 GlobalFree16( hMemObj );
758 case WM_QUERYDROPOBJECT:
760 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
761 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
763 if( __get_dropline( hWnd, &rect ) )
765 pt.x=lpDragInfo->pt.x;
766 pt.x=lpDragInfo->pt.y;
767 rect.bottom += DROP_FIELD_HEIGHT;
768 if( PtInRect32( &rect, pt ) )
769 { SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
779 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
780 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
781 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
783 { static char __appendix_str[] = " with";
785 hWndCtl = GetDlgItem32( hWnd, IDC_WINE_TEXT );
786 SendMessage32A( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
787 if( !lstrncmp32A( Template, "WINE", 4 ) )
788 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT), Template );
790 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
792 SendMessage32A( GetDlgItem32(hWnd, IDC_LISTBOX), LB_ADDSTRING32,
793 (WPARAM32)-1, (LPARAM)Template );
796 lstrcpy32A( Template, pstr );
797 lstrcat32A( Template, __appendix_str );
798 SetWindowText32A( hWndCtl, Template );
799 SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
808 { EndDialog32(hWnd, TRUE);
817 /*************************************************************************
818 * ShellAbout32A (SHELL32.243)
820 BOOL32 WINAPI ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
825 info.szOtherStuff = szOtherStuff;
827 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
828 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
829 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
830 hWnd, AboutDlgProc32, (LPARAM)&info );
834 /*************************************************************************
835 * ShellAbout32W (SHELL32.244)
837 BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
844 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
845 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
847 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
848 ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
849 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
850 hWnd, AboutDlgProc32, (LPARAM)&info );
851 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
852 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
856 /*************************************************************************
857 * Shell_NotifyIcon [SHELL32.296]
859 * This function is supposed to deal with the systray.
860 * Any ideas on how this is to be implimented?
862 BOOL32 WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATA pnid )
867 /*************************************************************************
868 * Shell_NotifyIcon [SHELL32.297]
870 * This function is supposed to deal with the systray.
871 * Any ideas on how this is to be implimented?
873 BOOL32 WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATA pnid )
878 /*************************************************************************
881 void WINAPI FreeIconList( DWORD dw )
882 { FIXME(shell, "(%lx): stub\n",dw);
885 /*************************************************************************
886 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
893 * path from a passed PIDL.
899 * fnGetDisplayNameOf can return different types of OLEString
901 DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
903 LPSHELLFOLDER shellfolder;
904 CHAR buffer[MAX_PATH],tpath[MAX_PATH];
905 DWORD type,tpathlen=MAX_PATH,dwdisp;
908 TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
911 { strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
913 if (RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp))
914 { return E_OUTOFMEMORY;
917 strcpy (buffer,"Desktop"); /*registry name*/
918 if ( RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
919 { GetWindowsDirectory32A(tpath,MAX_PATH);
920 PathAddBackslash32A(tpath);
921 strcat (tpath,"Desktop"); /*folder name*/
922 RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)tpath,tpathlen);
923 CreateDirectory32A(tpath,NULL);
926 strcpy(pszPath,tpath);
929 { if (SHGetDesktopFolder(&shellfolder)==S_OK)
930 { shellfolder->lpvtbl->fnGetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&lpName);
931 shellfolder->lpvtbl->fnRelease(shellfolder);
933 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
934 strcpy(pszPath,lpName.u.cStr);
935 /* fixme free the olestring*/
937 TRACE(shell,"-- (%s)\n",pszPath);
940 /*************************************************************************
941 * SHGetPathFromIDList32W [SHELL32.262]
943 DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath)
944 { char sTemp[MAX_PATH];
946 TRACE (shell,"(pidl=%p)\n", pidl);
948 SHGetPathFromIDList32A (pidl, sTemp);
949 lstrcpyAtoW(pszPath, sTemp);
951 TRACE(shell,"-- (%s)\n",debugstr_w(pszPath));
956 /*************************************************************************
957 * global variables of the shell32.dll
960 void (WINAPI* pDLLInitComctl)(LPVOID);
961 INT32 (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
962 INT32 (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
963 HIMAGELIST (WINAPI * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
964 HICON32 (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
965 INT32 (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
967 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT32);
968 BOOL32 (WINAPI* pCOMCTL32_Free) (LPVOID);
970 HDPA (WINAPI* pDPA_Create) (INT32);
971 INT32 (WINAPI* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
972 BOOL32 (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
973 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT32);
974 BOOL32 (WINAPI* pDPA_Destroy) (const HDPA);
975 INT32 (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32);
978 HICON32* (WINAPI *pLookupIconIdFromDirectoryEx32)(LPBYTE dir, BOOL32 bIcon, INT32 width, INT32 height, UINT32 cFlag);
979 HICON32* (WINAPI *pCreateIconFromResourceEx32)(LPBYTE bits,UINT32 cbSize, BOOL32 bIcon, DWORD dwVersion, INT32 width, INT32 height,UINT32 cFlag);
981 static BOOL32 bShell32IsInitialized = 0;
982 static HINSTANCE32 hComctl32;
983 static INT32 shell32_RefCount = 0;
985 INT32 shell32_ObjCount = 0;
986 HINSTANCE32 shell32_hInstance;
987 /*************************************************************************
992 BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
995 TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
997 shell32_hInstance = hinstDLL;
1000 { case DLL_PROCESS_ATTACH:
1001 if (!bShell32IsInitialized)
1002 { hComctl32 = LoadLibrary32A("COMCTL32.DLL");
1003 hUser32 = GetModuleHandle32A("USER32");
1004 if (hComctl32 && hUser32)
1005 { pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
1007 { pDLLInitComctl(NULL);
1009 pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create");
1010 pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon");
1011 pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
1012 pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon");
1013 pImageList_GetImageCount=GetProcAddress32(hComctl32,"ImageList_GetImageCount");
1015 /* imports by ordinal, pray that it works*/
1016 pCOMCTL32_Alloc=GetProcAddress32(hComctl32, (LPCSTR)71L);
1017 pCOMCTL32_Free=GetProcAddress32(hComctl32, (LPCSTR)73L);
1018 pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L);
1019 pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L);
1020 pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L);
1021 pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L);
1022 pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L);
1023 pDPA_Search=GetProcAddress32(hComctl32, (LPCSTR)339L);
1025 pLookupIconIdFromDirectoryEx32=GetProcAddress32(hUser32,"LookupIconIdFromDirectoryEx");
1026 pCreateIconFromResourceEx32=GetProcAddress32(hUser32,"CreateIconFromResourceEx");
1029 { ERR(shell,"P A N I C SHELL32 loading failed\n");
1033 bShell32IsInitialized = TRUE;
1038 case DLL_THREAD_ATTACH:
1042 case DLL_THREAD_DETACH:
1046 case DLL_PROCESS_DETACH:
1048 if ( !shell32_RefCount )
1049 { FreeLibrary32(hComctl32);
1050 bShell32IsInitialized = FALSE;
1053 { pdesktopfolder->lpvtbl->fnRelease(pdesktopfolder);
1056 /* this one is here ot check if AddRef/Release is balanced */
1057 if (shell32_ObjCount)
1058 { FIXME(shell,"%u objects left\n", shell32_ObjCount);
1061 TRACE(shell, "refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);