5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
22 #include "cursoricon.h"
23 #include "interfaces.h"
24 #include "sysmetrics.h"
28 #include "imagelist.h"
29 #include "sysmetrics.h"
33 #include "shell32_main.h"
35 /*************************************************************************
36 * CommandLineToArgvW [SHELL32.7]
38 LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs)
43 /* to get writeable copy */
44 cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
51 while (*s && *s==0x0020)
57 argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
63 argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
65 while (*s && *s==0x0020)
76 argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
77 HeapFree( GetProcessHeap(), 0, cmdline );
83 /*************************************************************************
84 * Control_RunDLL [SHELL32.12]
86 * Wild speculation in the following!
88 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
91 void WINAPI Control_RunDLL( HWND32 hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
93 FIXME(shell, "(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
94 debugstr_a(cmd), arg4);
97 /*************************************************************************
98 * SHGetFileInfoA [SHELL32.254]
104 DWORD WINAPI SHGetFileInfo32A(LPCSTR path,DWORD dwFileAttributes,
105 SHFILEINFO32A *psfi, UINT32 sizeofpsfi,
107 { CHAR szTemp[MAX_PATH];
111 TRACE(shell,"(%s,0x%lx,%p,0x%x,0x%x)\n",
112 path,dwFileAttributes,psfi,sizeofpsfi,flags);
114 /* translate the pidl to a path*/
115 if (flags & SHGFI_PIDL)
116 { SHGetPathFromIDList32A ((LPCITEMIDLIST)path,szTemp);
117 TRACE(shell,"pidl=%p is %s\n",path,szTemp);
120 { TRACE(shell,"path=%p\n",path);
123 if (flags & SHGFI_ATTRIBUTES)
124 { if (flags & SHGFI_PIDL)
125 { pData = _ILGetDataPointer((LPCITEMIDLIST)path);
126 psfi->dwAttributes = pData->u.generic.dwSFGAO; /* fixme: no direct access*/
130 { psfi->dwAttributes=SFGAO_FILESYSTEM;
133 FIXME(shell,"file attributes, stub\n");
136 if (flags & SHGFI_DISPLAYNAME)
137 { if (flags & SHGFI_PIDL)
138 { strcpy(psfi->szDisplayName,szTemp);
141 { strcpy(psfi->szDisplayName,path);
143 TRACE(shell,"displayname=%s\n", psfi->szDisplayName);
147 if (flags & SHGFI_TYPENAME)
148 { FIXME(shell,"get the file type, stub\n");
149 strcpy(psfi->szTypeName,"FIXME: Type");
153 if (flags & SHGFI_ICONLOCATION)
154 { FIXME(shell,"location of icon, stub\n");
155 strcpy(psfi->szDisplayName,"");
159 if (flags & SHGFI_EXETYPE)
160 FIXME(shell,"type of executable, stub\n");
162 if (flags & SHGFI_LINKOVERLAY)
163 FIXME(shell,"set icon to link, stub\n");
165 if (flags & SHGFI_OPENICON)
166 FIXME(shell,"set to open icon, stub\n");
168 if (flags & SHGFI_SELECTED)
169 FIXME(shell,"set icon to selected, stub\n");
171 if (flags & SHGFI_SHELLICONSIZE)
172 FIXME(shell,"set icon to shell size, stub\n");
174 if (flags & SHGFI_USEFILEATTRIBUTES)
175 FIXME(shell,"use the dwFileAttributes, stub\n");
177 if (flags & SHGFI_ICON)
178 { FIXME(shell,"icon handle\n");
179 if (flags & SHGFI_SMALLICON)
180 { TRACE(shell,"set to small icon\n");
181 psfi->hIcon=pImageList_GetIcon(ShellSmallIconList,32,ILD_NORMAL);
182 ret = (DWORD) ShellSmallIconList;
185 { TRACE(shell,"set to big icon\n");
186 psfi->hIcon=pImageList_GetIcon(ShellBigIconList,32,ILD_NORMAL);
187 ret = (DWORD) ShellBigIconList;
191 if (flags & SHGFI_SYSICONINDEX)
192 { FIXME(shell,"get the SYSICONINDEX\n");
194 if (flags & SHGFI_SMALLICON)
195 { TRACE(shell,"set to small icon\n");
196 ret = (DWORD) ShellSmallIconList;
199 { TRACE(shell,"set to big icon\n");
200 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);
382 { lpclf = IClassFactory_Constructor();
383 /* fixme: the buildin IClassFactory_Constructor is at the moment only
384 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
386 { hres = lpclf->lpvtbl->fnCreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);
387 lpclf->lpvtbl->fnRelease(lpclf);
392 { *shellfolder = pdesktopfolder;
393 pdesktopfolder->lpvtbl->fnAddRef(pdesktopfolder);
399 TRACE(shell,"-- %p->(%p)\n",shellfolder, *shellfolder);
402 /*************************************************************************
403 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
405 BOOL32 WINAPI SHGetPathFromIDList32(LPCITEMIDLIST pidl,LPSTR pszPath)
406 { TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
407 return SHGetPathFromIDList32A(pidl,pszPath);
410 /*************************************************************************
411 * SHGetSpecialFolderLocation [SHELL32.223]
412 * gets the folder locations from the registry and creates a pidl
413 * creates missing reg keys and directorys
417 * nFolder [I] CSIDL_xxxxx
418 * ppidl [O] PIDL of a special folder
424 * - look for "User Shell Folder" first
427 HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl)
428 { LPSHELLFOLDER shellfolder;
429 DWORD pchEaten,tpathlen=MAX_PATH,type,dwdisp,res;
430 CHAR pszTemp[256],buffer[256],tpath[MAX_PATH],npath[MAX_PATH];
431 LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
435 { FT_UNKNOWN= 0x00000000,
437 FT_DESKTOP= 0x00000002,
438 FT_SPECIAL= 0x00000003
441 TRACE(shell,"(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
443 strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
445 res=RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp);
447 { ERR(shell,"Could not create key %s %08lx \n",buffer,res);
448 return E_OUTOFMEMORY;
453 { case CSIDL_BITBUCKET:
454 strcpy (buffer,"xxx"); /*not in the registry*/
455 TRACE (shell,"looking for Recycler\n");
459 strcpy (buffer,"xxx"); /*virtual folder*/
460 TRACE (shell,"looking for Control\n");
464 strcpy (buffer,"xxx"); /*virtual folder*/
465 TRACE (shell,"looking for Desktop\n");
468 case CSIDL_DESKTOPDIRECTORY:
469 case CSIDL_COMMON_DESKTOPDIRECTORY:
470 strcpy (buffer,"Desktop");
473 strcpy (buffer,"xxx"); /*virtual folder*/
474 TRACE (shell,"looking for Drives\n");
478 strcpy (buffer,"Fonts");
481 strcpy (buffer,"NetHood");
483 case CSIDL_PRINTHOOD:
484 strcpy (buffer,"PrintHood");
487 strcpy (buffer,"xxx"); /*virtual folder*/
488 TRACE (shell,"looking for Network\n");
492 strcpy (buffer,"Appdata");
495 strcpy (buffer,"Personal");
497 case CSIDL_FAVORITES:
498 strcpy (buffer,"Favorites");
501 strcpy (buffer,"PrintHood");
503 case CSIDL_COMMON_PROGRAMS:
505 strcpy (buffer,"Programs");
508 strcpy (buffer,"Recent");
511 strcpy (buffer,"SendTo");
513 case CSIDL_COMMON_STARTMENU:
514 case CSIDL_STARTMENU:
515 strcpy (buffer,"Start Menu");
517 case CSIDL_COMMON_STARTUP:
519 strcpy (buffer,"Startup");
521 case CSIDL_TEMPLATES:
522 strcpy (buffer,"Templates");
525 ERR (shell,"unknown CSIDL 0x%08x\n", nFolder);
530 TRACE(shell,"Key=%s\n",buffer);
536 /* Directory: get the value from the registry, if its not there
537 create it and the directory*/
538 if (RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
539 { GetWindowsDirectory32A(npath,MAX_PATH);
540 PathAddBackslash32A(npath);
542 { case CSIDL_DESKTOPDIRECTORY:
543 case CSIDL_COMMON_DESKTOPDIRECTORY:
544 strcat (npath,"Desktop");
547 strcat (npath,"Fonts");
550 strcat (npath,"NetHood");
552 case CSIDL_PRINTHOOD:
553 strcat (npath,"PrintHood");
556 strcat (npath,"Appdata");
559 strcpy (npath,"C:\\Personal");
561 case CSIDL_FAVORITES:
562 strcat (npath,"Favorites");
565 strcat (npath,"PrintHood");
567 case CSIDL_COMMON_PROGRAMS:
569 strcat (npath,"Start Menu");
570 CreateDirectory32A(npath,NULL);
571 strcat (npath,"\\Programs");
574 strcat (npath,"Recent");
577 strcat (npath,"SendTo");
579 case CSIDL_COMMON_STARTMENU:
580 case CSIDL_STARTMENU:
581 strcat (npath,"Start Menu");
583 case CSIDL_COMMON_STARTUP:
585 strcat (npath,"Start Menu");
586 CreateDirectory32A(npath,NULL);
587 strcat (npath,"\\Startup");
589 case CSIDL_TEMPLATES:
590 strcat (npath,"Templates");
594 return E_OUTOFMEMORY;
596 if (RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)npath,sizeof(npath)+1))
597 { ERR(shell,"could not create value %s\n",buffer);
599 return E_OUTOFMEMORY;
601 TRACE(shell,"value %s=%s created\n",buffer,npath);
602 CreateDirectory32A(npath,NULL);
607 strcpy (tpath,"Desktop");
610 if (nFolder==CSIDL_DRIVES)
611 strcpy (tpath,"My Computer");
615 return E_OUTOFMEMORY;
620 TRACE(shell,"Value=%s\n",tpath);
621 LocalToWideChar32(lpszDisplayName, tpath, 256);
623 if (SHGetDesktopFolder(&shellfolder)==S_OK)
624 { shellfolder->lpvtbl->fnParseDisplayName(shellfolder,hwndOwner, NULL,lpszDisplayName,&pchEaten,ppidl,NULL);
625 shellfolder->lpvtbl->fnRelease(shellfolder);
628 TRACE(shell, "-- (new pidl %p)\n",*ppidl);
631 /*************************************************************************
632 * SHHelpShortcuts_RunDLL [SHELL32.224]
635 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
636 { FIXME (exec, "(%lx, %lx, %lx, %lx) empty stub!\n",
637 dwArg1, dwArg2, dwArg3, dwArg4);
642 /*************************************************************************
643 * SHLoadInProc [SHELL32.225]
647 DWORD WINAPI SHLoadInProc (DWORD dwArg1)
648 { FIXME (shell, "(%lx) empty stub!\n", dwArg1);
652 /*************************************************************************
653 * ShellExecute32A (SHELL32.245)
655 HINSTANCE32 WINAPI ShellExecute32A( HWND32 hWnd, LPCSTR lpOperation,
656 LPCSTR lpFile, LPCSTR lpParameters,
657 LPCSTR lpDirectory, INT32 iShowCmd )
659 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
660 lpDirectory, iShowCmd );
663 /*************************************************************************
664 * ShellExecute32W [SHELL32.294]
666 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
667 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
674 LPCWSTR lpParameters,
678 FIXME(shell,": stub\n");
687 /*************************************************************************
688 * AboutDlgProc32 (not an exported API function)
690 LRESULT WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
693 char Template[512], AppTitle[512];
698 { case WM_INITDIALOG:
699 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
701 { const char* const *pstr = SHELL_People;
702 SendDlgItemMessage32A(hWnd, stc1, STM_SETICON32,info->hIcon, 0);
703 GetWindowText32A( hWnd, Template, sizeof(Template) );
704 sprintf( AppTitle, Template, info->szApp );
705 SetWindowText32A( hWnd, AppTitle );
706 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT),
707 info->szOtherStuff );
708 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
709 SendMessage32A( hWndCtl, WM_SETREDRAW, 0, 0 );
710 SendMessage32A( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
712 { SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)*pstr );
715 SendMessage32A( hWndCtl, WM_SETREDRAW, 1, 0 );
723 HDC32 hDC = BeginPaint32( hWnd, &ps );
725 if( __get_dropline( hWnd, &rect ) ) {
726 SelectObject32( hDC, GetStockObject32( BLACK_PEN ) );
727 MoveToEx32( hDC, rect.left, rect.top, NULL );
728 LineTo32( hDC, rect.right, rect.bottom );
730 EndPaint32( hWnd, &ps );
734 case WM_LBTRACKPOINT:
735 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
736 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
737 { if( DragDetect32( hWndCtl, *((LPPOINT32)&lParam) ) )
738 { INT32 idx = SendMessage32A( hWndCtl, LB_GETCURSEL32, 0, 0 );
740 { INT32 length = SendMessage32A( hWndCtl, LB_GETTEXTLEN32, (WPARAM32)idx, 0 );
741 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
742 char* pstr = (char*)GlobalLock16( hMemObj );
745 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
746 SendMessage32A( hWndCtl, LB_GETTEXT32, (WPARAM32)idx, (LPARAM)pstr );
747 SendMessage32A( hWndCtl, LB_DELETESTRING32, (WPARAM32)idx, 0 );
748 UpdateWindow32( hWndCtl );
749 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
750 SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)pstr );
753 GlobalFree16( hMemObj );
759 case WM_QUERYDROPOBJECT:
761 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
762 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
764 if( __get_dropline( hWnd, &rect ) )
766 pt.x=lpDragInfo->pt.x;
767 pt.x=lpDragInfo->pt.y;
768 rect.bottom += DROP_FIELD_HEIGHT;
769 if( PtInRect32( &rect, pt ) )
770 { SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
780 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
781 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
782 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
784 { static char __appendix_str[] = " with";
786 hWndCtl = GetDlgItem32( hWnd, IDC_WINE_TEXT );
787 SendMessage32A( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
788 if( !lstrncmp32A( Template, "WINE", 4 ) )
789 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT), Template );
791 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
793 SendMessage32A( GetDlgItem32(hWnd, IDC_LISTBOX), LB_ADDSTRING32,
794 (WPARAM32)-1, (LPARAM)Template );
797 lstrcpy32A( Template, pstr );
798 lstrcat32A( Template, __appendix_str );
799 SetWindowText32A( hWndCtl, Template );
800 SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
809 { EndDialog32(hWnd, TRUE);
818 /*************************************************************************
819 * ShellAbout32A (SHELL32.243)
821 BOOL32 WINAPI ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
826 info.szOtherStuff = szOtherStuff;
828 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
829 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
830 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
831 hWnd, AboutDlgProc32, (LPARAM)&info );
835 /*************************************************************************
836 * ShellAbout32W (SHELL32.244)
838 BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
845 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
846 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
848 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
849 ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
850 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
851 hWnd, AboutDlgProc32, (LPARAM)&info );
852 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
853 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
857 /*************************************************************************
858 * Shell_NotifyIcon [SHELL32.296]
860 * This function is supposed to deal with the systray.
861 * Any ideas on how this is to be implimented?
863 BOOL32 WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATA pnid )
868 /*************************************************************************
869 * Shell_NotifyIcon [SHELL32.297]
871 * This function is supposed to deal with the systray.
872 * Any ideas on how this is to be implimented?
874 BOOL32 WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATA pnid )
879 /*************************************************************************
882 void WINAPI FreeIconList( DWORD dw )
883 { FIXME(shell, "(%lx): stub\n",dw);
886 /*************************************************************************
887 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
894 * path from a passed PIDL.
900 * fnGetDisplayNameOf can return different types of OLEString
902 DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
904 LPSHELLFOLDER shellfolder;
905 CHAR buffer[MAX_PATH],tpath[MAX_PATH];
906 DWORD type,tpathlen=MAX_PATH,dwdisp;
909 TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
912 { strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
914 if (RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp))
915 { return E_OUTOFMEMORY;
918 strcpy (buffer,"Desktop"); /*registry name*/
919 if ( RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
920 { GetWindowsDirectory32A(tpath,MAX_PATH);
921 PathAddBackslash32A(tpath);
922 strcat (tpath,"Desktop"); /*folder name*/
923 RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)tpath,tpathlen);
924 CreateDirectory32A(tpath,NULL);
927 strcpy(pszPath,tpath);
930 { if (SHGetDesktopFolder(&shellfolder)==S_OK)
931 { shellfolder->lpvtbl->fnGetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&lpName);
932 shellfolder->lpvtbl->fnRelease(shellfolder);
934 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
935 strcpy(pszPath,lpName.u.cStr);
936 /* fixme free the olestring*/
938 TRACE(shell,"-- (%s)\n",pszPath);
941 /*************************************************************************
942 * SHGetPathFromIDList32W [SHELL32.262]
944 DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath)
945 { char sTemp[MAX_PATH];
947 TRACE (shell,"(pidl=%p)\n", pidl);
949 SHGetPathFromIDList32A (pidl, sTemp);
950 lstrcpyAtoW(pszPath, sTemp);
952 TRACE(shell,"-- (%s)\n",debugstr_w(pszPath));
958 void (CALLBACK* pDLLInitComctl)(void);
959 INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
960 INT32 (CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
961 HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
962 HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
963 INT32 (CALLBACK* pImageList_GetImageCount)(HIMAGELIST);
965 LPVOID (CALLBACK* pCOMCTL32_Alloc) (INT32);
966 BOOL32 (CALLBACK* pCOMCTL32_Free) (LPVOID);
968 HDPA (CALLBACK* pDPA_Create) (INT32);
969 INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
970 BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
971 LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32);
972 BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA);
973 INT32 (CALLBACK *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32);
974 static BOOL32 bShell32IsInitialized=0;
975 /*************************************************************************
979 * at the moment the icons are extracted from shell32.dll
980 * free the imagelists
982 HINSTANCE32 shell32_hInstance;
984 BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
985 { HINSTANCE32 hComctl32;
987 TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved);
989 shell32_hInstance = hinstDLL;
991 if (fdwReason==DLL_PROCESS_ATTACH && !bShell32IsInitialized)
992 { hComctl32 = LoadLibrary32A("COMCTL32.DLL");
994 { pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
998 pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create");
999 pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon");
1000 pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
1001 pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon");
1002 pImageList_GetImageCount=GetProcAddress32(hComctl32,"ImageList_GetImageCount");
1004 /* imports by ordinal, pray that it works*/
1005 pCOMCTL32_Alloc=GetProcAddress32(hComctl32, (LPCSTR)71L);
1006 pCOMCTL32_Free=GetProcAddress32(hComctl32, (LPCSTR)73L);
1007 pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L);
1008 pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L);
1009 pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L);
1010 pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L);
1011 pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L);
1012 pDPA_Search=GetProcAddress32(hComctl32, (LPCSTR)339L);
1014 FreeLibrary32(hComctl32);
1017 { /* panic, imediately exit wine*/
1018 ERR(shell,"P A N I C error getting functionpointers\n");
1022 bShell32IsInitialized = TRUE;