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:
350 /*************************************************************************
351 * SHGetDesktopFolder [SHELL32.216]
353 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
355 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
358 * the interface to the shell desktop folder.
361 * the pdesktopfolder has to be released at the end (at dll unloading???)
363 LPSHELLFOLDER pdesktopfolder=NULL;
365 DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder)
366 { HRESULT hres = E_OUTOFMEMORY;
367 LPCLASSFACTORY lpclf;
368 TRACE(shell,"%p->(%p)\n",shellfolder,*shellfolder);
370 if (pdesktopfolder) {
373 lpclf = IClassFactory_Constructor();
374 /* fixme: the buildin IClassFactory_Constructor is at the moment only
375 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
377 hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);
378 IClassFactory_Release(lpclf);
382 if (pdesktopfolder) {
383 *shellfolder = pdesktopfolder;
384 pdesktopfolder->lpvtbl->fnAddRef(pdesktopfolder);
389 TRACE(shell,"-- %p->(%p)\n",shellfolder, *shellfolder);
393 /*************************************************************************
394 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
396 BOOL32 WINAPI SHGetPathFromIDList32(LPCITEMIDLIST pidl,LPSTR pszPath)
397 { TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
398 return SHGetPathFromIDList32A(pidl,pszPath);
401 /*************************************************************************
402 * SHGetSpecialFolderLocation [SHELL32.223]
403 * gets the folder locations from the registry and creates a pidl
404 * creates missing reg keys and directorys
408 * nFolder [I] CSIDL_xxxxx
409 * ppidl [O] PIDL of a special folder
415 * - look for "User Shell Folder" first
418 HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl)
419 { LPSHELLFOLDER shellfolder;
420 DWORD pchEaten,tpathlen=MAX_PATH,type,dwdisp,res;
421 CHAR pszTemp[256],buffer[256],tpath[MAX_PATH],npath[MAX_PATH];
422 LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
426 { FT_UNKNOWN= 0x00000000,
428 FT_DESKTOP= 0x00000002,
429 FT_SPECIAL= 0x00000003
432 TRACE(shell,"(%04x,0x%x,%p)\n", hwndOwner,nFolder,ppidl);
434 strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
436 res=RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp);
438 { ERR(shell,"Could not create key %s %08lx \n",buffer,res);
439 return E_OUTOFMEMORY;
444 { case CSIDL_BITBUCKET:
445 strcpy (buffer,"xxx"); /*not in the registry*/
446 TRACE (shell,"looking for Recycler\n");
450 strcpy (buffer,"xxx"); /*virtual folder*/
451 TRACE (shell,"looking for Control\n");
455 strcpy (buffer,"xxx"); /*virtual folder*/
456 TRACE (shell,"looking for Desktop\n");
459 case CSIDL_DESKTOPDIRECTORY:
460 case CSIDL_COMMON_DESKTOPDIRECTORY:
461 strcpy (buffer,"Desktop");
464 strcpy (buffer,"xxx"); /*virtual folder*/
465 TRACE (shell,"looking for Drives\n");
469 strcpy (buffer,"Fonts");
472 strcpy (buffer,"NetHood");
474 case CSIDL_PRINTHOOD:
475 strcpy (buffer,"PrintHood");
478 strcpy (buffer,"xxx"); /*virtual folder*/
479 TRACE (shell,"looking for Network\n");
483 strcpy (buffer,"Appdata");
486 strcpy (buffer,"Personal");
488 case CSIDL_FAVORITES:
489 strcpy (buffer,"Favorites");
492 strcpy (buffer,"PrintHood");
494 case CSIDL_COMMON_PROGRAMS:
496 strcpy (buffer,"Programs");
499 strcpy (buffer,"Recent");
502 strcpy (buffer,"SendTo");
504 case CSIDL_COMMON_STARTMENU:
505 case CSIDL_STARTMENU:
506 strcpy (buffer,"Start Menu");
508 case CSIDL_COMMON_STARTUP:
510 strcpy (buffer,"Startup");
512 case CSIDL_TEMPLATES:
513 strcpy (buffer,"Templates");
516 ERR (shell,"unknown CSIDL 0x%08x\n", nFolder);
521 TRACE(shell,"Key=%s\n",buffer);
527 /* Directory: get the value from the registry, if its not there
528 create it and the directory*/
529 if (RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
530 { GetWindowsDirectory32A(npath,MAX_PATH);
531 PathAddBackslash32A(npath);
533 { case CSIDL_DESKTOPDIRECTORY:
534 case CSIDL_COMMON_DESKTOPDIRECTORY:
535 strcat (npath,"Desktop");
538 strcat (npath,"Fonts");
541 strcat (npath,"NetHood");
543 case CSIDL_PRINTHOOD:
544 strcat (npath,"PrintHood");
547 strcat (npath,"Appdata");
550 strcpy (npath,"C:\\Personal");
552 case CSIDL_FAVORITES:
553 strcat (npath,"Favorites");
556 strcat (npath,"PrintHood");
558 case CSIDL_COMMON_PROGRAMS:
560 strcat (npath,"Start Menu");
561 CreateDirectory32A(npath,NULL);
562 strcat (npath,"\\Programs");
565 strcat (npath,"Recent");
568 strcat (npath,"SendTo");
570 case CSIDL_COMMON_STARTMENU:
571 case CSIDL_STARTMENU:
572 strcat (npath,"Start Menu");
574 case CSIDL_COMMON_STARTUP:
576 strcat (npath,"Start Menu");
577 CreateDirectory32A(npath,NULL);
578 strcat (npath,"\\Startup");
580 case CSIDL_TEMPLATES:
581 strcat (npath,"Templates");
585 return E_OUTOFMEMORY;
587 if (RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)npath,sizeof(npath)+1))
588 { ERR(shell,"could not create value %s\n",buffer);
590 return E_OUTOFMEMORY;
592 TRACE(shell,"value %s=%s created\n",buffer,npath);
593 CreateDirectory32A(npath,NULL);
598 strcpy (tpath,"Desktop");
601 if (nFolder==CSIDL_DRIVES)
602 strcpy (tpath,"My Computer");
606 return E_OUTOFMEMORY;
611 TRACE(shell,"Value=%s\n",tpath);
612 LocalToWideChar32(lpszDisplayName, tpath, 256);
614 if (SHGetDesktopFolder(&shellfolder)==S_OK)
615 { shellfolder->lpvtbl->fnParseDisplayName(shellfolder,hwndOwner, NULL,lpszDisplayName,&pchEaten,ppidl,NULL);
616 shellfolder->lpvtbl->fnRelease(shellfolder);
619 TRACE(shell, "-- (new pidl %p)\n",*ppidl);
622 /*************************************************************************
623 * SHHelpShortcuts_RunDLL [SHELL32.224]
626 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
627 { FIXME (exec, "(%lx, %lx, %lx, %lx) empty stub!\n",
628 dwArg1, dwArg2, dwArg3, dwArg4);
633 /*************************************************************************
634 * SHLoadInProc [SHELL32.225]
638 DWORD WINAPI SHLoadInProc (DWORD dwArg1)
639 { FIXME (shell, "(%lx) empty stub!\n", dwArg1);
643 /*************************************************************************
644 * ShellExecute32A (SHELL32.245)
646 HINSTANCE32 WINAPI ShellExecute32A( HWND32 hWnd, LPCSTR lpOperation,
647 LPCSTR lpFile, LPCSTR lpParameters,
648 LPCSTR lpDirectory, INT32 iShowCmd )
650 return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
651 lpDirectory, iShowCmd );
654 /*************************************************************************
655 * ShellExecute32W [SHELL32.294]
657 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
658 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
665 LPCWSTR lpParameters,
669 FIXME(shell,": stub\n");
673 /*************************************************************************
674 * AboutDlgProc32 (not an exported API function)
676 BOOL32 WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
679 char Template[512], AppTitle[512];
684 { case WM_INITDIALOG:
685 { ABOUT_INFO *info = (ABOUT_INFO *)lParam;
687 { const char* const *pstr = SHELL_People;
688 SendDlgItemMessage32A(hWnd, stc1, STM_SETICON32,info->hIcon, 0);
689 GetWindowText32A( hWnd, Template, sizeof(Template) );
690 sprintf( AppTitle, Template, info->szApp );
691 SetWindowText32A( hWnd, AppTitle );
692 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT),
693 info->szOtherStuff );
694 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
695 SendMessage32A( hWndCtl, WM_SETREDRAW, 0, 0 );
696 SendMessage32A( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
698 { SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)*pstr );
701 SendMessage32A( hWndCtl, WM_SETREDRAW, 1, 0 );
709 HDC32 hDC = BeginPaint32( hWnd, &ps );
711 if( __get_dropline( hWnd, &rect ) ) {
712 SelectObject32( hDC, GetStockObject32( BLACK_PEN ) );
713 MoveToEx32( hDC, rect.left, rect.top, NULL );
714 LineTo32( hDC, rect.right, rect.bottom );
716 EndPaint32( hWnd, &ps );
720 case WM_LBTRACKPOINT:
721 hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
722 if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
723 { if( DragDetect32( hWndCtl, *((LPPOINT32)&lParam) ) )
724 { INT32 idx = SendMessage32A( hWndCtl, LB_GETCURSEL32, 0, 0 );
726 { INT32 length = SendMessage32A( hWndCtl, LB_GETTEXTLEN32, (WPARAM32)idx, 0 );
727 HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
728 char* pstr = (char*)GlobalLock16( hMemObj );
731 { HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
732 SendMessage32A( hWndCtl, LB_GETTEXT32, (WPARAM32)idx, (LPARAM)pstr );
733 SendMessage32A( hWndCtl, LB_DELETESTRING32, (WPARAM32)idx, 0 );
734 UpdateWindow32( hWndCtl );
735 if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
736 SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)pstr );
739 GlobalFree16( hMemObj );
745 case WM_QUERYDROPOBJECT:
747 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
748 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
750 if( __get_dropline( hWnd, &rect ) )
752 pt.x=lpDragInfo->pt.x;
753 pt.x=lpDragInfo->pt.y;
754 rect.bottom += DROP_FIELD_HEIGHT;
755 if( PtInRect32( &rect, pt ) )
756 { SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
766 { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
767 if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
768 { char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
770 { static char __appendix_str[] = " with";
772 hWndCtl = GetDlgItem32( hWnd, IDC_WINE_TEXT );
773 SendMessage32A( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
774 if( !lstrncmp32A( Template, "WINE", 4 ) )
775 SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT), Template );
777 { char* pch = Template + strlen(Template) - strlen(__appendix_str);
779 SendMessage32A( GetDlgItem32(hWnd, IDC_LISTBOX), LB_ADDSTRING32,
780 (WPARAM32)-1, (LPARAM)Template );
783 lstrcpy32A( Template, pstr );
784 lstrcat32A( Template, __appendix_str );
785 SetWindowText32A( hWndCtl, Template );
786 SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
795 { EndDialog32(hWnd, TRUE);
804 /*************************************************************************
805 * ShellAbout32A (SHELL32.243)
807 BOOL32 WINAPI ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
812 info.szOtherStuff = szOtherStuff;
814 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
815 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
816 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
817 hWnd, AboutDlgProc32, (LPARAM)&info );
821 /*************************************************************************
822 * ShellAbout32W (SHELL32.244)
824 BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
831 info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
832 info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
834 if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
835 ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
836 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
837 hWnd, AboutDlgProc32, (LPARAM)&info );
838 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
839 HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
843 /*************************************************************************
844 * Shell_NotifyIcon [SHELL32.296]
846 * This function is supposed to deal with the systray.
847 * Any ideas on how this is to be implimented?
849 BOOL32 WINAPI Shell_NotifyIcon( DWORD dwMessage, PNOTIFYICONDATA pnid )
854 /*************************************************************************
855 * Shell_NotifyIcon [SHELL32.297]
857 * This function is supposed to deal with the systray.
858 * Any ideas on how this is to be implimented?
860 BOOL32 WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATA pnid )
865 /*************************************************************************
868 void WINAPI FreeIconList( DWORD dw )
869 { FIXME(shell, "(%lx): stub\n",dw);
872 /*************************************************************************
873 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
880 * path from a passed PIDL.
886 * fnGetDisplayNameOf can return different types of OLEString
888 DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
890 LPSHELLFOLDER shellfolder;
891 CHAR buffer[MAX_PATH],tpath[MAX_PATH];
892 DWORD type,tpathlen=MAX_PATH,dwdisp;
895 TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
898 { strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
900 if (RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp))
901 { return E_OUTOFMEMORY;
904 strcpy (buffer,"Desktop"); /*registry name*/
905 if ( RegQueryValueEx32A(key,buffer,NULL,&type,(LPBYTE)tpath,&tpathlen))
906 { GetWindowsDirectory32A(tpath,MAX_PATH);
907 PathAddBackslash32A(tpath);
908 strcat (tpath,"Desktop"); /*folder name*/
909 RegSetValueEx32A(key,buffer,0,REG_SZ,(LPBYTE)tpath,tpathlen);
910 CreateDirectory32A(tpath,NULL);
913 strcpy(pszPath,tpath);
916 { if (SHGetDesktopFolder(&shellfolder)==S_OK)
917 { shellfolder->lpvtbl->fnGetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&lpName);
918 shellfolder->lpvtbl->fnRelease(shellfolder);
920 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
921 strcpy(pszPath,lpName.u.cStr);
922 /* fixme free the olestring*/
924 TRACE(shell,"-- (%s)\n",pszPath);
927 /*************************************************************************
928 * SHGetPathFromIDList32W [SHELL32.262]
930 DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath)
931 { char sTemp[MAX_PATH];
933 TRACE (shell,"(pidl=%p)\n", pidl);
935 SHGetPathFromIDList32A (pidl, sTemp);
936 lstrcpyAtoW(pszPath, sTemp);
938 TRACE(shell,"-- (%s)\n",debugstr_w(pszPath));
943 /*************************************************************************
944 * global variables of the shell32.dll
947 void (WINAPI* pDLLInitComctl)(LPVOID);
948 INT32 (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
949 INT32 (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
950 HIMAGELIST (WINAPI * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
951 HICON32 (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
952 INT32 (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
954 LPVOID (WINAPI* pCOMCTL32_Alloc) (INT32);
955 BOOL32 (WINAPI* pCOMCTL32_Free) (LPVOID);
957 HDPA (WINAPI* pDPA_Create) (INT32);
958 INT32 (WINAPI* pDPA_InsertPtr) (const HDPA, INT32, LPVOID);
959 BOOL32 (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
960 LPVOID (WINAPI* pDPA_GetPtr) (const HDPA, INT32);
961 BOOL32 (WINAPI* pDPA_Destroy) (const HDPA);
962 INT32 (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32);
965 HICON32 (WINAPI *pLookupIconIdFromDirectoryEx32)(LPBYTE dir, BOOL32 bIcon, INT32 width, INT32 height, UINT32 cFlag);
966 HICON32 (WINAPI *pCreateIconFromResourceEx32)(LPBYTE bits,UINT32 cbSize, BOOL32 bIcon, DWORD dwVersion, INT32 width, INT32 height,UINT32 cFlag);
968 static BOOL32 bShell32IsInitialized = 0;
969 static HINSTANCE32 hComctl32;
970 static INT32 shell32_RefCount = 0;
972 INT32 shell32_ObjCount = 0;
973 HINSTANCE32 shell32_hInstance;
974 /*************************************************************************
979 BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
982 TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
984 shell32_hInstance = hinstDLL;
987 { case DLL_PROCESS_ATTACH:
988 if (!bShell32IsInitialized)
989 { hComctl32 = LoadLibrary32A("COMCTL32.DLL");
990 hUser32 = GetModuleHandle32A("USER32");
991 if (hComctl32 && hUser32)
992 { pDLLInitComctl=(void*)GetProcAddress32(hComctl32,"InitCommonControlsEx");
994 { pDLLInitComctl(NULL);
996 pImageList_Create=(void*)GetProcAddress32(hComctl32,"ImageList_Create");
997 pImageList_AddIcon=(void*)GetProcAddress32(hComctl32,"ImageList_AddIcon");
998 pImageList_ReplaceIcon=(void*)GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
999 pImageList_GetIcon=(void*)GetProcAddress32(hComctl32,"ImageList_GetIcon");
1000 pImageList_GetImageCount=(void*)GetProcAddress32(hComctl32,"ImageList_GetImageCount");
1002 /* imports by ordinal, pray that it works*/
1003 pCOMCTL32_Alloc=(void*)GetProcAddress32(hComctl32, (LPCSTR)71L);
1004 pCOMCTL32_Free=(void*)GetProcAddress32(hComctl32, (LPCSTR)73L);
1005 pDPA_Create=(void*)GetProcAddress32(hComctl32, (LPCSTR)328L);
1006 pDPA_Destroy=(void*)GetProcAddress32(hComctl32, (LPCSTR)329L);
1007 pDPA_GetPtr=(void*)GetProcAddress32(hComctl32, (LPCSTR)332L);
1008 pDPA_InsertPtr=(void*)GetProcAddress32(hComctl32, (LPCSTR)334L);
1009 pDPA_Sort=(void*)GetProcAddress32(hComctl32, (LPCSTR)338L);
1010 pDPA_Search=(void*)GetProcAddress32(hComctl32, (LPCSTR)339L);
1012 pLookupIconIdFromDirectoryEx32=(void*)GetProcAddress32(hUser32,"LookupIconIdFromDirectoryEx");
1013 pCreateIconFromResourceEx32=(void*)GetProcAddress32(hUser32,"CreateIconFromResourceEx");
1016 { ERR(shell,"P A N I C SHELL32 loading failed\n");
1020 bShell32IsInitialized = TRUE;
1025 case DLL_THREAD_ATTACH:
1029 case DLL_THREAD_DETACH:
1033 case DLL_PROCESS_DETACH:
1035 if ( !shell32_RefCount )
1036 { FreeLibrary32(hComctl32);
1037 bShell32IsInitialized = FALSE;
1040 { pdesktopfolder->lpvtbl->fnRelease(pdesktopfolder);
1043 /* this one is here ot check if AddRef/Release is balanced */
1044 if (shell32_ObjCount)
1045 { FIXME(shell,"%u objects left\n", shell32_ObjCount);
1048 TRACE(shell, "refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);