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 );
296 #define IDC_STATIC_TEXT 100
297 #define IDC_LISTBOX 99
298 #define IDC_WINE_TEXT 98
300 #define DROP_FIELD_TOP (-15)
301 #define DROP_FIELD_HEIGHT 15
303 extern HICON32 hIconTitleFont;
305 static BOOL32 __get_dropline( HWND32 hWnd, LPRECT32 lprect )
306 { HWND32 hWndCtl = GetDlgItem32(hWnd, IDC_WINE_TEXT);
308 { GetWindowRect32( hWndCtl, lprect );
309 MapWindowPoints32( 0, hWnd, (LPPOINT32)lprect, 2 );
310 lprect->bottom = (lprect->top += DROP_FIELD_TOP);
316 /*************************************************************************
317 * SHAppBarMessage32 [SHELL32.207]
319 UINT32 WINAPI SHAppBarMessage32(DWORD msg, PAPPBARDATA data)
320 { FIXME(shell,"(0x%08lx,%p): stub\n", msg, data);
324 case ABM_GETAUTOHIDEBAR:
326 case ABM_GETTASKBARPOS:
330 case ABM_SETAUTOHIDEBAR:
332 case ABM_WINDOWPOSCHANGED:
339 /*************************************************************************
340 * SHBrowseForFolderA [SHELL32.209]
343 LPITEMIDLIST WINAPI SHBrowseForFolder32A (LPBROWSEINFO32A lpbi)
344 { FIXME (shell, "(%lx,%s) empty stub!\n", (DWORD)lpbi, lpbi->lpszTitle);
348 /*************************************************************************
349 * SHGetDesktopFolder [SHELL32.216]
351 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
353 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
356 * the interface to the shell desktop folder.
359 * the pdesktopfolder has to be released at the end (at dll unloading???)
361 LPSHELLFOLDER pdesktopfolder=NULL;
363 DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder)
364 { HRESULT hres = E_OUTOFMEMORY;
365 LPCLASSFACTORY lpclf;
366 TRACE(shell,"%p->(%p)\n",shellfolder,*shellfolder);
372 { lpclf = IClassFactory_Constructor();
373 /* fixme: the buildin IClassFactory_Constructor is at the moment only
374 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
376 { hres = lpclf->lpvtbl->fnCreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);
377 lpclf->lpvtbl->fnRelease(lpclf);
382 { *shellfolder = pdesktopfolder;
383 pdesktopfolder->lpvtbl->fnAddRef(pdesktopfolder);
389 TRACE(shell,"-- %p->(%p)\n",shellfolder, *shellfolder);
392 /*************************************************************************
393 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
395 BOOL32 WINAPI SHGetPathFromIDList32(LPCITEMIDLIST pidl,LPSTR pszPath)
396 { TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
397 return SHGetPathFromIDList32A(pidl,pszPath);
400 /*************************************************************************
401 * SHGetSpecialFolderLocation [SHELL32.223]
402 * gets the folder locations from the registry and creates a pidl
403 * creates missing reg keys and directorys
407 * nFolder [I] CSIDL_xxxxx
408 * ppidl [O] PIDL of a special folder
414 * - look for "User Shell Folder" first
417 HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl)
418 { LPSHELLFOLDER shellfolder;
419 DWORD pchEaten,tpathlen=MAX_PATH,type,dwdisp,res;
420 CHAR pszTemp[256],buffer[256],tpath[MAX_PATH],npath[MAX_PATH];
421 LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
425 { FT_UNKNOWN= 0x00000000,
427 FT_DESKTOP= 0x00000002,
428 FT_SPECIAL= 0x00000003
431 TRACE(shell,"(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
433 strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
435 res=RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp);
437 { ERR(shell,"Could not create key %s %08lx \n",buffer,res);
438 return E_OUTOFMEMORY;
443 { case CSIDL_BITBUCKET:
444 strcpy (buffer,"xxx"); /*not in the registry*/
445 TRACE (shell,"looking for Recycler\n");
449 strcpy (buffer,"xxx"); /*virtual folder*/
450 TRACE (shell,"looking for Control\n");
454 strcpy (buffer,"xxx"); /*virtual folder*/
455 TRACE (shell,"looking for Desktop\n");
458 case CSIDL_DESKTOPDIRECTORY:
459 case CSIDL_COMMON_DESKTOPDIRECTORY:
460 strcpy (buffer,"Desktop");
463 strcpy (buffer,"xxx"); /*virtual folder*/
464 TRACE (shell,"looking for Drives\n");
468 strcpy (buffer,"Fonts");
471 strcpy (buffer,"NetHood");
473 case CSIDL_PRINTHOOD:
474 strcpy (buffer,"PrintHood");
477 strcpy (buffer,"xxx"); /*virtual folder*/
478 TRACE (shell,"looking for Network\n");
482 strcpy (buffer,"Appdata");
485 strcpy (buffer,"Personal");
487 case CSIDL_FAVORITES:
488 strcpy (buffer,"Favorites");
491 strcpy (buffer,"PrintHood");
493 case CSIDL_COMMON_PROGRAMS:
495 strcpy (buffer,"Programs");
498 strcpy (buffer,"Recent");
501 strcpy (buffer,"SendTo");
503 case CSIDL_COMMON_STARTMENU:
504 case CSIDL_STARTMENU:
505 strcpy (buffer,"Start Menu");
507 case CSIDL_COMMON_STARTUP:
509 strcpy (buffer,"Startup");
511 case CSIDL_TEMPLATES:
512 strcpy (buffer,"Templates");
515 ERR (shell,"unknown CSIDL 0x%08x\n", nFolder);
520 TRACE(shell,"Key=%s\n",buffer);
526 /* Directory: get the value from the registry, if its not there
527 create it and the directory*/
528 if (RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
529 { GetWindowsDirectory32A(npath,MAX_PATH);
530 PathAddBackslash32A(npath);
532 { case CSIDL_DESKTOPDIRECTORY:
533 case CSIDL_COMMON_DESKTOPDIRECTORY:
534 strcat (npath,"Desktop");
537 strcat (npath,"Fonts");
540 strcat (npath,"NetHood");
542 case CSIDL_PRINTHOOD:
543 strcat (npath,"PrintHood");
546 strcat (npath,"Appdata");
549 strcpy (npath,"C:\\Personal");
551 case CSIDL_FAVORITES:
552 strcat (npath,"Favorites");
555 strcat (npath,"PrintHood");
557 case CSIDL_COMMON_PROGRAMS:
559 strcat (npath,"Start Menu");
560 CreateDirectory32A(npath,NULL);
561 strcat (npath,"\\Programs");
564 strcat (npath,"Recent");
567 strcat (npath,"SendTo");
569 case CSIDL_COMMON_STARTMENU:
570 case CSIDL_STARTMENU:
571 strcat (npath,"Start Menu");
573 case CSIDL_COMMON_STARTUP:
575 strcat (npath,"Start Menu");
576 CreateDirectory32A(npath,NULL);
577 strcat (npath,"\\Startup");
579 case CSIDL_TEMPLATES:
580 strcat (npath,"Templates");
584 return E_OUTOFMEMORY;
586 if (RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)npath,sizeof(npath)+1))
587 { ERR(shell,"could not create value %s\n",buffer);
589 return E_OUTOFMEMORY;
591 TRACE(shell,"value %s=%s created\n",buffer,npath);
592 CreateDirectory32A(npath,NULL);
597 strcpy (tpath,"Desktop");
600 if (nFolder==CSIDL_DRIVES)
601 strcpy (tpath,"My Computer");
605 return E_OUTOFMEMORY;
610 TRACE(shell,"Value=%s\n",tpath);
611 LocalToWideChar32(lpszDisplayName, tpath, 256);
613 if (SHGetDesktopFolder(&shellfolder)==S_OK)
614 { shellfolder->lpvtbl->fnParseDisplayName(shellfolder,hwndOwner, NULL,lpszDisplayName,&pchEaten,ppidl,NULL);
615 shellfolder->lpvtbl->fnRelease(shellfolder);
618 TRACE(shell, "-- (new pidl %p)\n",*ppidl);
621 /*************************************************************************
622 * SHHelpShortcuts_RunDLL [SHELL32.224]
625 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
626 { FIXME (exec, "(%lx, %lx, %lx, %lx) empty stub!\n",
627 dwArg1, dwArg2, dwArg3, dwArg4);
632 /*************************************************************************
633 * SHLoadInProc [SHELL32.225]
637 DWORD WINAPI SHLoadInProc (DWORD dwArg1)
638 { FIXME (shell, "(%lx) empty stub!\n", dwArg1);
642 /*************************************************************************
643 * ShellExecute32A (SHELL32.245)
645 HINSTANCE32 WINAPI ShellExecute32A( HWND32 hWnd, LPCSTR lpOperation,
646 LPCSTR lpFile, LPCSTR lpParameters,
647 LPCSTR lpDirectory, INT32 iShowCmd )
649 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
650 lpDirectory, iShowCmd );
654 /*************************************************************************
655 * AboutDlgProc32 (not an exported API function)
657 LRESULT WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
660 char Template[512], AppTitle[512];
665 { case WM_INITDIALOG:
666 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
668 { const char* const *pstr = SHELL_People;
669 SendDlgItemMessage32A(hWnd, stc1, STM_SETICON32,info->hIcon, 0);
670 GetWindowText32A( hWnd, Template, sizeof(Template) );
671 sprintf( AppTitle, Template, info->szApp );
672 SetWindowText32A( hWnd, AppTitle );
673 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT),
674 info->szOtherStuff );
675 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
676 SendMessage32A( hWndCtl, WM_SETREDRAW, 0, 0 );
677 SendMessage32A( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
679 { SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)*pstr );
682 SendMessage32A( hWndCtl, WM_SETREDRAW, 1, 0 );
690 HDC32 hDC = BeginPaint32( hWnd, &ps );
692 if( __get_dropline( hWnd, &rect ) ) {
693 SelectObject32( hDC, GetStockObject32( BLACK_PEN ) );
694 MoveToEx32( hDC, rect.left, rect.top, NULL );
695 LineTo32( hDC, rect.right, rect.bottom );
697 EndPaint32( hWnd, &ps );
701 case WM_LBTRACKPOINT:
702 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
703 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
704 { if( DragDetect32( hWndCtl, *((LPPOINT32)&lParam) ) )
705 { INT32 idx = SendMessage32A( hWndCtl, LB_GETCURSEL32, 0, 0 );
707 { INT32 length = SendMessage32A( hWndCtl, LB_GETTEXTLEN32, (WPARAM32)idx, 0 );
708 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
709 char* pstr = (char*)GlobalLock16( hMemObj );
712 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
713 SendMessage32A( hWndCtl, LB_GETTEXT32, (WPARAM32)idx, (LPARAM)pstr );
714 SendMessage32A( hWndCtl, LB_DELETESTRING32, (WPARAM32)idx, 0 );
715 UpdateWindow32( hWndCtl );
716 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
717 SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)pstr );
720 GlobalFree16( hMemObj );
726 case WM_QUERYDROPOBJECT:
728 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
729 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
731 if( __get_dropline( hWnd, &rect ) )
733 pt.x=lpDragInfo->pt.x;
734 pt.x=lpDragInfo->pt.y;
735 rect.bottom += DROP_FIELD_HEIGHT;
736 if( PtInRect32( &rect, pt ) )
737 { SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
747 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
748 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
749 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
751 { static char __appendix_str[] = " with";
753 hWndCtl = GetDlgItem32( hWnd, IDC_WINE_TEXT );
754 SendMessage32A( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
755 if( !lstrncmp32A( Template, "WINE", 4 ) )
756 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT), Template );
758 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
760 SendMessage32A( GetDlgItem32(hWnd, IDC_LISTBOX), LB_ADDSTRING32,
761 (WPARAM32)-1, (LPARAM)Template );
764 lstrcpy32A( Template, pstr );
765 lstrcat32A( Template, __appendix_str );
766 SetWindowText32A( hWndCtl, Template );
767 SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
776 { EndDialog32(hWnd, TRUE);
785 /*************************************************************************
786 * ShellAbout32A (SHELL32.243)
788 BOOL32 WINAPI ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
793 info.szOtherStuff = szOtherStuff;
795 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
796 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
797 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
798 hWnd, AboutDlgProc32, (LPARAM)&info );
802 /*************************************************************************
803 * ShellAbout32W (SHELL32.244)
805 BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
812 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
813 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
815 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
816 ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
817 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
818 hWnd, AboutDlgProc32, (LPARAM)&info );
819 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
820 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
824 /*************************************************************************
825 * Shell_NotifyIcon [SHELL32.296]
827 * This function is supposed to deal with the systray.
828 * Any ideas on how this is to be implimented?
830 BOOL32 WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATA pnid )
835 /*************************************************************************
836 * Shell_NotifyIcon [SHELL32.297]
838 * This function is supposed to deal with the systray.
839 * Any ideas on how this is to be implimented?
841 BOOL32 WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATA pnid )
846 /*************************************************************************
849 void WINAPI FreeIconList( DWORD dw )
850 { FIXME(shell, "(%lx): stub\n",dw);
853 /*************************************************************************
854 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
861 * path from a passed PIDL.
867 * fnGetDisplayNameOf can return different types of OLEString
869 DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
871 LPSHELLFOLDER shellfolder;
872 CHAR buffer[MAX_PATH],tpath[MAX_PATH];
873 DWORD type,tpathlen=MAX_PATH,dwdisp;
876 TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
879 { strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
881 if (RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp))
882 { return E_OUTOFMEMORY;
885 strcpy (buffer,"Desktop"); /*registry name*/
886 if ( RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
887 { GetWindowsDirectory32A(tpath,MAX_PATH);
888 PathAddBackslash32A(tpath);
889 strcat (tpath,"Desktop"); /*folder name*/
890 RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)tpath,tpathlen);
891 CreateDirectory32A(tpath,NULL);
894 strcpy(pszPath,tpath);
897 { if (SHGetDesktopFolder(&shellfolder)==S_OK)
898 { shellfolder->lpvtbl->fnGetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&lpName);
899 shellfolder->lpvtbl->fnRelease(shellfolder);
901 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
902 strcpy(pszPath,lpName.u.cStr);
903 /* fixme free the olestring*/
905 TRACE(shell,"-- (%s)\n",pszPath);
908 /*************************************************************************
909 * SHGetPathFromIDList32W [SHELL32.262]
911 DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath)
912 { char sTemp[MAX_PATH];
914 TRACE (shell,"(pidl=%p)\n", pidl);
916 SHGetPathFromIDList32A (pidl, sTemp);
917 lstrcpyAtoW(pszPath, sTemp);
919 TRACE(shell,"-- (%s)\n",debugstr_w(pszPath));
925 void (CALLBACK* pDLLInitComctl)(void);
926 INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
927 INT32 (CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
928 HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
929 HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
930 INT32 (CALLBACK* pImageList_GetImageCount)(HIMAGELIST);
932 LPVOID (CALLBACK* pCOMCTL32_Alloc) (INT32);
933 BOOL32 (CALLBACK* pCOMCTL32_Free) (LPVOID);
935 HDPA (CALLBACK* pDPA_Create) (INT32);
936 INT32 (CALLBACK* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
937 BOOL32 (CALLBACK* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
938 LPVOID (CALLBACK* pDPA_GetPtr) (const HDPA, INT32);
939 BOOL32 (CALLBACK* pDPA_Destroy) (const HDPA);
940 INT32 (CALLBACK *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32);
941 static BOOL32 bShell32IsInitialized=0;
942 /*************************************************************************
946 * at the moment the icons are extracted from shell32.dll
947 * free the imagelists
949 HINSTANCE32 shell32_hInstance;
951 BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
952 { HINSTANCE32 hComctl32;
954 TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved);
956 shell32_hInstance = hinstDLL;
958 if (fdwReason==DLL_PROCESS_ATTACH && !bShell32IsInitialized)
959 { hComctl32 = LoadLibrary32A("COMCTL32.DLL");
961 { pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
965 pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create");
966 pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon");
967 pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
968 pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon");
969 pImageList_GetImageCount=GetProcAddress32(hComctl32,"ImageList_GetImageCount");
971 /* imports by ordinal, pray that it works*/
972 pCOMCTL32_Alloc=GetProcAddress32(hComctl32, (LPCSTR)71L);
973 pCOMCTL32_Free=GetProcAddress32(hComctl32, (LPCSTR)73L);
974 pDPA_Create=GetProcAddress32(hComctl32, (LPCSTR)328L);
975 pDPA_Destroy=GetProcAddress32(hComctl32, (LPCSTR)329L);
976 pDPA_GetPtr=GetProcAddress32(hComctl32, (LPCSTR)332L);
977 pDPA_InsertPtr=GetProcAddress32(hComctl32, (LPCSTR)334L);
978 pDPA_Sort=GetProcAddress32(hComctl32, (LPCSTR)338L);
979 pDPA_Search=GetProcAddress32(hComctl32, (LPCSTR)339L);
981 FreeLibrary32(hComctl32);
984 { /* panic, imediately exit wine*/
985 ERR(shell,"P A N I C error getting functionpointers\n");
989 bShell32IsInitialized = TRUE;