5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
23 #include "cursoricon.h"
24 #include "interfaces.h"
25 #include "sysmetrics.h"
29 #include "imagelist.h"
34 #include "shell32_main.h"
36 /*************************************************************************
37 * CommandLineToArgvW [SHELL32.7]
39 LPWSTR
* WINAPI
CommandLineToArgvW(LPWSTR cmdline
,LPDWORD numargs
)
44 /* to get writeable copy */
45 cmdline
= HEAP_strdupW( GetProcessHeap(), 0, cmdline
);
52 while (*s
&& *s
==0x0020)
58 argv
=(LPWSTR
*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR
)*(i
+1) );
64 argv
[i
++]=HEAP_strdupW( GetProcessHeap(), 0, t
);
66 while (*s
&& *s
==0x0020)
77 argv
[i
++]=(LPWSTR
)HEAP_strdupW( GetProcessHeap(), 0, t
);
78 HeapFree( GetProcessHeap(), 0, cmdline
);
84 /*************************************************************************
85 * Control_RunDLL [SHELL32.12]
87 * Wild speculation in the following!
89 * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
92 void WINAPI
Control_RunDLL( HWND32 hwnd
, LPCVOID code
, LPCSTR cmd
, DWORD arg4
)
94 FIXME(shell
, "(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd
, code
,
95 debugstr_a(cmd
), arg4
);
98 /*************************************************************************
99 * Shell_GetImageList [SHELL32.71]
102 * imglist[1|2] [OUT] pointer which recive imagelist handles
106 * I don't know, which pointer is which. They may have to be
109 BOOL32 WINAPI
Shell_GetImageList(HIMAGELIST
* imglist1
,HIMAGELIST
* imglist2
)
110 { WARN(shell
,"(%p,%p):semi-stub.\n",imglist1
,imglist2
);
112 { *imglist1
=ShellSmallIconList
;
115 { *imglist2
=ShellBigIconList
;
121 /*************************************************************************
122 * SHGetFileInfoA [SHELL32.218]
127 HIMAGELIST ShellSmallIconList
= 0;
128 HIMAGELIST ShellBigIconList
= 0;
130 DWORD WINAPI
SHGetFileInfo32A(LPCSTR path
,DWORD dwFileAttributes
,
131 SHFILEINFO32A
*psfi
, UINT32 sizeofpsfi
,
133 { CHAR szTemp
[MAX_PATH
];
137 TRACE(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
138 path
,dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
140 /* translate the pidl to a path*/
141 if (flags
& SHGFI_PIDL
)
142 { SHGetPathFromIDList32A ((LPCITEMIDLIST
)path
,szTemp
);
143 TRACE(shell
,"pidl=%p is %s\n",path
,szTemp
);
146 { TRACE(shell
,"path=%p\n",path
);
149 if (flags
& SHGFI_ATTRIBUTES
)
150 { if (flags
& SHGFI_PIDL
)
151 { pData
= _ILGetDataPointer((LPCITEMIDLIST
)path
);
152 psfi
->dwAttributes
= pData
->u
.generic
.dwSFGAO
; /* fixme: no direct access*/
156 { psfi
->dwAttributes
=SFGAO_FILESYSTEM
;
159 FIXME(shell
,"file attributes, stub\n");
162 if (flags
& SHGFI_DISPLAYNAME
)
163 { if (flags
& SHGFI_PIDL
)
164 { strcpy(psfi
->szDisplayName
,szTemp
);
167 { strcpy(psfi
->szDisplayName
,path
);
169 TRACE(shell
,"displayname=%s\n", psfi
->szDisplayName
);
173 if (flags
& SHGFI_TYPENAME
)
174 { FIXME(shell
,"get the file type, stub\n");
175 strcpy(psfi
->szTypeName
,"FIXME: Type");
179 if (flags
& SHGFI_ICONLOCATION
)
180 { FIXME(shell
,"location of icon, stub\n");
181 strcpy(psfi
->szDisplayName
,"");
185 if (flags
& SHGFI_EXETYPE
)
186 FIXME(shell
,"type of executable, stub\n");
188 if (flags
& SHGFI_LINKOVERLAY
)
189 FIXME(shell
,"set icon to link, stub\n");
191 if (flags
& SHGFI_OPENICON
)
192 FIXME(shell
,"set to open icon, stub\n");
194 if (flags
& SHGFI_SELECTED
)
195 FIXME(shell
,"set icon to selected, stub\n");
197 if (flags
& SHGFI_SHELLICONSIZE
)
198 FIXME(shell
,"set icon to shell size, stub\n");
200 if (flags
& SHGFI_USEFILEATTRIBUTES
)
201 FIXME(shell
,"use the dwFileAttributes, stub\n");
203 if (flags
& SHGFI_ICON
)
204 { FIXME(shell
,"icon handle\n");
205 if (flags
& SHGFI_SMALLICON
)
206 { TRACE(shell
,"set to small icon\n");
207 psfi
->hIcon
=pImageList_GetIcon(ShellSmallIconList
,32,ILD_NORMAL
);
208 ret
= (DWORD
) ShellSmallIconList
;
211 { TRACE(shell
,"set to big icon\n");
212 psfi
->hIcon
=pImageList_GetIcon(ShellBigIconList
,32,ILD_NORMAL
);
213 ret
= (DWORD
) ShellBigIconList
;
217 if (flags
& SHGFI_SYSICONINDEX
)
218 { FIXME(shell
,"get the SYSICONINDEX\n");
220 if (flags
& SHGFI_SMALLICON
)
221 { TRACE(shell
,"set to small icon\n");
222 ret
= (DWORD
) ShellSmallIconList
;
225 { TRACE(shell
,"set to big icon\n");
226 ret
= (DWORD
) ShellBigIconList
;
234 /*************************************************************************
235 * ExtractIcon32A (SHELL32.133)
237 HICON32 WINAPI
ExtractIcon32A( HINSTANCE32 hInstance
, LPCSTR lpszExeFileName
,
239 { HGLOBAL16 handle
= InternalExtractIcon(hInstance
,lpszExeFileName
,nIconIndex
, 1);
243 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
244 HICON16 hIcon
= *ptr
;
246 GlobalFree16(handle
);
252 /*************************************************************************
253 * ExtractIcon32W (SHELL32.180)
255 HICON32 WINAPI
ExtractIcon32W( HINSTANCE32 hInstance
, LPCWSTR lpszExeFileName
,
261 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
262 ret
= ExtractIcon32A(hInstance
,exefn
,nIconIndex
);
264 HeapFree(GetProcessHeap(),0,exefn
);
268 /*************************************************************************
269 * FindExecutable32A (SHELL32.184)
271 HINSTANCE32 WINAPI
FindExecutable32A( LPCSTR lpFile
, LPCSTR lpDirectory
,
273 { HINSTANCE32 retval
=31; /* default - 'No association was found' */
276 TRACE(shell
, "File %s, Dir %s\n",
277 (lpFile
!= NULL
?lpFile
:"-"),
278 (lpDirectory
!= NULL
?lpDirectory
:"-"));
280 lpResult
[0]='\0'; /* Start off with an empty return string */
282 /* trap NULL parameters on entry */
283 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
284 { /* FIXME - should throw a warning, perhaps! */
285 return 2; /* File not found. Close enough, I guess. */
289 { GetCurrentDirectory32A( sizeof(old_dir
), old_dir
);
290 SetCurrentDirectory32A( lpDirectory
);
293 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
295 TRACE(shell
, "returning %s\n", lpResult
);
297 SetCurrentDirectory32A( old_dir
);
307 #define IDC_STATIC_TEXT 100
308 #define IDC_LISTBOX 99
309 #define IDC_WINE_TEXT 98
311 #define DROP_FIELD_TOP (-15)
312 #define DROP_FIELD_HEIGHT 15
314 extern HICON32 hIconTitleFont
;
316 static BOOL32
__get_dropline( HWND32 hWnd
, LPRECT32 lprect
)
317 { HWND32 hWndCtl
= GetDlgItem32(hWnd
, IDC_WINE_TEXT
);
319 { GetWindowRect32( hWndCtl
, lprect
);
320 MapWindowPoints32( 0, hWnd
, (LPPOINT32
)lprect
, 2 );
321 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
327 /*************************************************************************
328 * SHAppBarMessage32 [SHELL32.207]
330 UINT32 WINAPI
SHAppBarMessage32(DWORD msg
, PAPPBARDATA data
)
331 { FIXME(shell
,"(0x%08lx,%p): stub\n", msg
, data
);
335 case ABM_GETAUTOHIDEBAR
:
337 case ABM_GETTASKBARPOS
:
341 case ABM_SETAUTOHIDEBAR
:
343 case ABM_WINDOWPOSCHANGED
:
350 /*************************************************************************
351 * SHBrowseForFolderA [SHELL32.209]
354 LPITEMIDLIST WINAPI
SHBrowseForFolder32A (LPBROWSEINFO32A lpbi
)
355 { FIXME (shell
, "(0x%lx,%s): stub\n", (DWORD
)lpbi
, debugstr_a(lpbi
->lpszTitle
));
359 /*************************************************************************
360 * SHGetDesktopFolder [SHELL32.216]
362 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
364 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
367 * the interface to the shell desktop folder.
370 * the pdesktopfolder has to be released at the end (at dll unloading???)
372 LPSHELLFOLDER pdesktopfolder
=NULL
;
374 DWORD WINAPI
SHGetDesktopFolder(LPSHELLFOLDER
*shellfolder
)
375 { HRESULT hres
= E_OUTOFMEMORY
;
376 LPCLASSFACTORY lpclf
;
377 TRACE(shell
,"%p->(%p)\n",shellfolder
,*shellfolder
);
383 { lpclf
= IClassFactory_Constructor();
384 /* fixme: the buildin IClassFactory_Constructor is at the moment only
385 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
387 { hres
= lpclf
->lpvtbl
->fnCreateInstance(lpclf
,NULL
,(REFIID
)&IID_IShellFolder
, (void*)&pdesktopfolder
);
388 lpclf
->lpvtbl
->fnRelease(lpclf
);
393 { *shellfolder
= pdesktopfolder
;
394 pdesktopfolder
->lpvtbl
->fnAddRef(pdesktopfolder
);
400 TRACE(shell
,"-- %p->(%p)\n",shellfolder
, *shellfolder
);
403 /*************************************************************************
404 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
406 BOOL32 WINAPI
SHGetPathFromIDList32(LPCITEMIDLIST pidl
,LPSTR pszPath
)
407 { TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
408 return SHGetPathFromIDList32A(pidl
,pszPath
);
411 /*************************************************************************
412 * SHGetSpecialFolderLocation [SHELL32.223]
413 * gets the folder locations from the registry and creates a pidl
414 * creates missing reg keys and directorys
418 * nFolder [I] CSIDL_xxxxx
419 * ppidl [O] PIDL of a special folder
425 * - look for "User Shell Folder" first
428 HRESULT WINAPI
SHGetSpecialFolderLocation(HWND32 hwndOwner
, INT32 nFolder
, LPITEMIDLIST
* ppidl
)
429 { LPSHELLFOLDER shellfolder
;
430 DWORD pchEaten
,tpathlen
=MAX_PATH
,type
,dwdisp
,res
;
431 CHAR pszTemp
[256],buffer
[256],tpath
[MAX_PATH
],npath
[MAX_PATH
];
432 LPWSTR lpszDisplayName
= (LPWSTR
)&pszTemp
[0];
436 { FT_UNKNOWN
= 0x00000000,
438 FT_DESKTOP
= 0x00000002
441 TRACE(shell
,"(%04x,%d,%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 strcpy (buffer
,"Desktop");
472 strcpy (buffer
,"xxx"); /*virtual folder*/
473 TRACE (shell
,"looking for Drives\n");
477 strcpy (buffer
,"Fonts");
480 strcpy (buffer
,"NetHood");
483 strcpy (buffer
,"xxx"); /*virtual folder*/
484 TRACE (shell
,"looking for Network\n");
488 strcpy (buffer
,"Personal");
490 case CSIDL_FAVORITES
:
491 strcpy (buffer
,"Favorites");
494 strcpy (buffer
,"PrintHood");
497 strcpy (buffer
,"Programs");
500 strcpy (buffer
,"Recent");
503 strcpy (buffer
,"SendTo");
505 case CSIDL_STARTMENU
:
506 strcpy (buffer
,"Start Menu");
509 strcpy (buffer
,"Startup");
511 case CSIDL_TEMPLATES
:
512 strcpy (buffer
,"Templates");
515 ERR (shell
,"unknown CSIDL\n");
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
,tpath
,&tpathlen
))
529 { GetWindowsDirectory32A(npath
,MAX_PATH
);
530 PathAddBackslash(npath
);
532 { case CSIDL_DESKTOPDIRECTORY
:
533 strcat (npath
,"Desktop");
536 strcat (npath
,"Fonts");
539 strcat (npath
,"NetHood");
542 strcpy (npath
,"C:\\Personal");
544 case CSIDL_FAVORITES
:
545 strcat (npath
,"Favorites");
548 strcat (npath
,"PrintHood");
551 strcat (npath
,"Start Menu");
552 CreateDirectory32A(npath
,NULL
);
553 strcat (npath
,"\\Programs");
556 strcat (npath
,"Recent");
559 strcat (npath
,"SendTo");
561 case CSIDL_STARTMENU
:
562 strcat (npath
,"Start Menu");
565 strcat (npath
,"Start Menu");
566 CreateDirectory32A(npath
,NULL
);
567 strcat (npath
,"\\Startup");
569 case CSIDL_TEMPLATES
:
570 strcat (npath
,"Templates");
574 return E_OUTOFMEMORY
;
576 if (RegSetValueEx32A(key
,buffer
,0,REG_SZ
,npath
,sizeof(npath
)+1))
577 { ERR(shell
,"could not create value %s\n",buffer
);
579 return E_OUTOFMEMORY
;
581 TRACE(shell
,"value %s=%s created\n",buffer
,npath
);
582 CreateDirectory32A(npath
,NULL
);
587 strcpy (tpath
,"Desktop");
591 return E_OUTOFMEMORY
;
597 TRACE(shell
,"Value=%s\n",tpath
);
598 LocalToWideChar32(lpszDisplayName
, tpath
, 256);
600 if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
601 { shellfolder
->lpvtbl
->fnParseDisplayName(shellfolder
,hwndOwner
, NULL
,lpszDisplayName
,&pchEaten
,ppidl
,NULL
);
602 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
605 TRACE(shell
, "-- (new pidl %p)\n",*ppidl
);
608 /*************************************************************************
609 * SHHelpShortcuts_RunDLL [SHELL32.224]
612 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
613 { FIXME (exec
, "(%lx, %lx, %lx, %lx) empty stub!\n",
614 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
619 /*************************************************************************
620 * SHLoadInProc [SHELL32.225]
624 DWORD WINAPI
SHLoadInProc (DWORD dwArg1
)
625 { FIXME (shell
, "(%lx) empty stub!\n", dwArg1
);
629 /*************************************************************************
630 * ShellExecute32A (SHELL32.245)
632 HINSTANCE32 WINAPI
ShellExecute32A( HWND32 hWnd
, LPCSTR lpOperation
,
633 LPCSTR lpFile
, LPCSTR lpParameters
,
634 LPCSTR lpDirectory
, INT32 iShowCmd
)
636 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
637 lpDirectory
, iShowCmd
);
641 /*************************************************************************
642 * AboutDlgProc32 (not an exported API function)
644 LRESULT WINAPI
AboutDlgProc32( HWND32 hWnd
, UINT32 msg
, WPARAM32 wParam
,
647 char Template
[512], AppTitle
[512];
652 { case WM_INITDIALOG
:
653 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
655 { const char* const *pstr
= SHELL_People
;
656 SendDlgItemMessage32A(hWnd
, stc1
, STM_SETICON32
,info
->hIcon
, 0);
657 GetWindowText32A( hWnd
, Template
, sizeof(Template
) );
658 sprintf( AppTitle
, Template
, info
->szApp
);
659 SetWindowText32A( hWnd
, AppTitle
);
660 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
),
661 info
->szOtherStuff
);
662 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
663 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 0, 0 );
664 SendMessage32A( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
666 { SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)*pstr
);
669 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 1, 0 );
677 HDC32 hDC
= BeginPaint32( hWnd
, &ps
);
679 if( __get_dropline( hWnd
, &rect
) )
680 GRAPH_DrawLines( hDC
, (LPPOINT32
)&rect
, 1, GetStockObject32( BLACK_PEN
) );
681 EndPaint32( hWnd
, &ps
);
685 case WM_LBTRACKPOINT
:
686 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
687 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
688 { if( DragDetect32( hWndCtl
, *((LPPOINT32
)&lParam
) ) )
689 { INT32 idx
= SendMessage32A( hWndCtl
, LB_GETCURSEL32
, 0, 0 );
691 { INT32 length
= SendMessage32A( hWndCtl
, LB_GETTEXTLEN32
, (WPARAM32
)idx
, 0 );
692 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
693 char* pstr
= (char*)GlobalLock16( hMemObj
);
696 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
697 SendMessage32A( hWndCtl
, LB_GETTEXT32
, (WPARAM32
)idx
, (LPARAM
)pstr
);
698 SendMessage32A( hWndCtl
, LB_DELETESTRING32
, (WPARAM32
)idx
, 0 );
699 UpdateWindow32( hWndCtl
);
700 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
701 SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)pstr
);
704 GlobalFree16( hMemObj
);
710 case WM_QUERYDROPOBJECT
:
712 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
713 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
715 if( __get_dropline( hWnd
, &rect
) )
716 { POINT32 pt
= { lpDragInfo
->pt
.x
, lpDragInfo
->pt
.y
};
717 rect
.bottom
+= DROP_FIELD_HEIGHT
;
718 if( PtInRect32( &rect
, pt
) )
719 { SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
729 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
730 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
731 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
733 { static char __appendix_str
[] = " with";
735 hWndCtl
= GetDlgItem32( hWnd
, IDC_WINE_TEXT
);
736 SendMessage32A( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
737 if( !lstrncmp32A( Template
, "WINE", 4 ) )
738 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
), Template
);
740 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
742 SendMessage32A( GetDlgItem32(hWnd
, IDC_LISTBOX
), LB_ADDSTRING32
,
743 (WPARAM32
)-1, (LPARAM
)Template
);
746 lstrcpy32A( Template
, pstr
);
747 lstrcat32A( Template
, __appendix_str
);
748 SetWindowText32A( hWndCtl
, Template
);
749 SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
758 { EndDialog32(hWnd
, TRUE
);
767 /*************************************************************************
768 * ShellAbout32A (SHELL32.243)
770 BOOL32 WINAPI
ShellAbout32A( HWND32 hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
775 info
.szOtherStuff
= szOtherStuff
;
777 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
778 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
779 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
780 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
784 /*************************************************************************
785 * ShellAbout32W (SHELL32.244)
787 BOOL32 WINAPI
ShellAbout32W( HWND32 hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
794 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
795 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
797 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
798 ret
= DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
799 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
800 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
801 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
802 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
806 /*************************************************************************
807 * Shell_NotifyIcon [SHELL32.296]
809 * This function is supposed to deal with the systray.
810 * Any ideas on how this is to be implimented?
812 BOOL32 WINAPI
Shell_NotifyIcon( DWORD dwMessage
, PNOTIFYICONDATA pnid
)
817 /*************************************************************************
818 * Shell_NotifyIcon [SHELL32.297]
820 * This function is supposed to deal with the systray.
821 * Any ideas on how this is to be implimented?
823 BOOL32 WINAPI
Shell_NotifyIconA(DWORD dwMessage
, PNOTIFYICONDATA pnid
)
828 /*************************************************************************
831 void WINAPI
FreeIconList( DWORD dw
)
832 { FIXME(shell
, "(%lx): stub\n",dw
);
835 /*************************************************************************
836 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
843 * path from a passed PIDL.
849 * fnGetDisplayNameOf can return different types of OLEString
851 DWORD WINAPI
SHGetPathFromIDList32A (LPCITEMIDLIST pidl
,LPSTR pszPath
)
853 LPSHELLFOLDER shellfolder
;
854 CHAR buffer
[MAX_PATH
],tpath
[MAX_PATH
];
855 DWORD type
,tpathlen
=MAX_PATH
,dwdisp
;
858 TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
861 { strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
863 if (RegCreateKeyEx32A(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
))
864 { return E_OUTOFMEMORY
;
867 strcpy (buffer
,"Desktop"); /*registry name*/
868 if ( RegQueryValueEx32A(key
,buffer
,NULL
,&type
,tpath
,&tpathlen
))
869 { GetWindowsDirectory32A(tpath
,MAX_PATH
);
870 PathAddBackslash(tpath
);
871 strcat (tpath
,"Desktop"); /*folder name*/
872 RegSetValueEx32A(key
,buffer
,0,REG_SZ
,tpath
,tpathlen
);
873 CreateDirectory32A(tpath
,NULL
);
876 strcpy(pszPath
,tpath
);
879 { if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
880 { shellfolder
->lpvtbl
->fnGetDisplayNameOf(shellfolder
,pidl
,SHGDN_FORPARSING
,&lpName
);
881 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
883 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
884 strcpy(pszPath
,lpName
.u
.cStr
);
885 /* fixme free the olestring*/
887 TRACE(shell
,"-- (%s)\n",pszPath
);
890 /*************************************************************************
891 * SHGetPathFromIDList32W [SHELL32.262]
893 DWORD WINAPI
SHGetPathFromIDList32W (LPCITEMIDLIST pidl
,LPWSTR pszPath
)
894 { FIXME (shell
,"(pidl=%p %s):stub.\n", pidl
, debugstr_w(pszPath
));
899 void (CALLBACK
* pDLLInitComctl
)();
900 INT32 (CALLBACK
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON32 hIcon
);
901 INT32(CALLBACK
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT32
, HICON32
);
902 HIMAGELIST (CALLBACK
* pImageList_Create
) (INT32
,INT32
,UINT32
,INT32
,INT32
);
903 HICON32 (CALLBACK
* pImageList_GetIcon
) (HIMAGELIST
, INT32
, UINT32
);
905 /*************************************************************************
909 * at the moment the icons are extracted from shell32.dll
910 * free the imagelists
912 HINSTANCE32 shell32_hInstance
;
914 BOOL32 WINAPI
Shell32LibMain(HINSTANCE32 hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
918 CHAR szShellPath
[MAX_PATH
];
919 HINSTANCE32 hComctl32
;
922 TRACE(shell
,"0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, lpvReserved
);
924 shell32_hInstance
= hinstDLL
;
926 GetWindowsDirectory32A(szShellPath
,MAX_PATH
);
927 PathAddBackslash(szShellPath
);
928 strcat(szShellPath
,"system\\shell32.dll");
930 if (fdwReason
==DLL_PROCESS_ATTACH
)
931 { hComctl32
= LoadLibrary32A("COMCTL32.DLL");
933 { pDLLInitComctl
=GetProcAddress32(hComctl32
,"InitCommonControlsEx");
937 pImageList_Create
=GetProcAddress32(hComctl32
,"ImageList_Create");
938 pImageList_AddIcon
=GetProcAddress32(hComctl32
,"ImageList_AddIcon");
939 pImageList_ReplaceIcon
=GetProcAddress32(hComctl32
,"ImageList_ReplaceIcon");
940 pImageList_GetIcon
=GetProcAddress32(hComctl32
,"ImageList_GetIcon");
941 FreeLibrary32(hComctl32
);
944 { /* panic, imediately exit wine*/
945 ERR(shell
,"P A N I C error getting functionpointers\n");
948 if ( ! ShellSmallIconList
)
949 { if ( (ShellSmallIconList
= pImageList_Create(sysMetrics
[SM_CXSMICON
],sysMetrics
[SM_CYSMICON
],ILC_COLORDDB
| ILC_MASK
,0,0x20)) )
950 { for (index
=0;index
< 40; index
++)
951 { if ( ! ( htmpIcon
= ExtractIcon32A(hinstDLL
, szShellPath
, index
))
952 || ( -1 == (iiconindex
= pImageList_AddIcon (ShellSmallIconList
, htmpIcon
))) )
953 { ERR(shell
,"could not initialize iconlist (is shell32.dll in the system directory?)\n");
959 if ( ! ShellBigIconList
)
960 { if ( (ShellBigIconList
= pImageList_Create(SYSMETRICS_CXSMICON
, SYSMETRICS_CYSMICON
,ILC_COLORDDB
| ILC_MASK
,0,0x20)) )
961 { for (index
=0;index
< 40; index
++)
962 { if ( ! (htmpIcon
= ExtractIcon32A( hinstDLL
, szShellPath
, index
))
963 || (-1 == (iiconindex
= pImageList_AddIcon (ShellBigIconList
, htmpIcon
))) )
964 { ERR(shell
,"could not initialize iconlist (is shell32.dll in the system directory?)\n");
970 TRACE(shell
,"hIconSmall=%p hIconBig=%p\n",ShellSmallIconList
, ShellBigIconList
);