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
];
109 LPITEMIDLIST pPidlTemp
= NULL
;
112 TRACE(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
113 path
,dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
115 /* translate the pidl to a path*/
116 if (flags
& SHGFI_PIDL
)
117 { pPidlTemp
= (LPCITEMIDLIST
)path
;
118 SHGetPathFromIDList32A (pPidlTemp
, szTemp
);
119 TRACE(shell
,"pidl=%p is %s\n", path
, szTemp
);
122 { strcpy(szTemp
,path
);
123 TRACE(shell
,"path=%s\n", szTemp
);
126 if (flags
& SHGFI_ATTRIBUTES
)
127 { if (flags
& SHGFI_PIDL
)
128 { pData
= _ILGetDataPointer((LPCITEMIDLIST
)path
);
129 psfi
->dwAttributes
= pData
->u
.generic
.dwSFGAO
; /* fixme: no direct access*/
133 { psfi
->dwAttributes
=SFGAO_FILESYSTEM
;
136 FIXME(shell
,"file attributes, stub\n");
139 if (flags
& SHGFI_DISPLAYNAME
)
140 { if (flags
& SHGFI_PIDL
)
141 { strcpy(psfi
->szDisplayName
,szTemp
);
144 { strcpy(psfi
->szDisplayName
,path
);
146 TRACE(shell
,"displayname=%s\n", psfi
->szDisplayName
);
150 if (flags
& SHGFI_TYPENAME
)
151 { FIXME(shell
,"get the file type, stub\n");
152 strcpy(psfi
->szTypeName
,"FIXME: Type");
156 if (flags
& SHGFI_ICONLOCATION
)
157 { FIXME(shell
,"location of icon, stub\n");
158 strcpy(psfi
->szDisplayName
,"");
162 if (flags
& SHGFI_EXETYPE
)
163 FIXME(shell
,"type of executable, stub\n");
165 if (flags
& SHGFI_LINKOVERLAY
)
166 FIXME(shell
,"set icon to link, stub\n");
168 if (flags
& SHGFI_OPENICON
)
169 FIXME(shell
,"set to open icon, stub\n");
171 if (flags
& SHGFI_SELECTED
)
172 FIXME(shell
,"set icon to selected, stub\n");
174 if (flags
& SHGFI_SHELLICONSIZE
)
175 FIXME(shell
,"set icon to shell size, stub\n");
177 if (flags
& SHGFI_USEFILEATTRIBUTES
)
178 FIXME(shell
,"use the dwFileAttributes, stub\n");
180 if (flags
& SHGFI_ICON
)
181 { FIXME(shell
,"icon handle\n");
182 if (flags
& SHGFI_SMALLICON
)
183 { TRACE(shell
,"set to small icon\n");
184 psfi
->hIcon
=pImageList_GetIcon(ShellSmallIconList
,32,ILD_NORMAL
);
185 ret
= (DWORD
) ShellSmallIconList
;
188 { TRACE(shell
,"set to big icon\n");
189 psfi
->hIcon
=pImageList_GetIcon(ShellBigIconList
,32,ILD_NORMAL
);
190 ret
= (DWORD
) ShellBigIconList
;
194 if (flags
& SHGFI_SYSICONINDEX
)
196 { pPidlTemp
= ILCreateFromPath (szTemp
);
198 psfi
->iIcon
= SHMapPIDLToSystemImageListIndex (NULL
, pPidlTemp
, 0);
199 TRACE(shell
,"-- SYSICONINDEX %i\n", psfi
->iIcon
);
201 if (flags
& SHGFI_SMALLICON
)
202 { TRACE(shell
,"set to small icon\n");
203 ret
= (DWORD
) ShellSmallIconList
;
206 { TRACE(shell
,"set to big icon\n");
207 ret
= (DWORD
) ShellBigIconList
;
214 /*************************************************************************
215 * SHGetFileInfo32W [SHELL32.255]
221 DWORD WINAPI
SHGetFileInfo32W(LPCWSTR path
,DWORD dwFileAttributes
,
222 SHFILEINFO32W
*psfi
, UINT32 sizeofpsfi
,
224 { FIXME(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
225 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
229 /*************************************************************************
230 * ExtractIcon32A (SHELL32.133)
232 HICON32 WINAPI
ExtractIcon32A( HINSTANCE32 hInstance
, LPCSTR lpszExeFileName
,
234 { HGLOBAL16 handle
= InternalExtractIcon(hInstance
,lpszExeFileName
,nIconIndex
, 1);
238 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
239 HICON16 hIcon
= *ptr
;
241 GlobalFree16(handle
);
247 /*************************************************************************
248 * ExtractIcon32W (SHELL32.180)
250 HICON32 WINAPI
ExtractIcon32W( HINSTANCE32 hInstance
, LPCWSTR lpszExeFileName
,
256 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
257 ret
= ExtractIcon32A(hInstance
,exefn
,nIconIndex
);
259 HeapFree(GetProcessHeap(),0,exefn
);
263 /*************************************************************************
264 * FindExecutable32A (SHELL32.184)
266 HINSTANCE32 WINAPI
FindExecutable32A( LPCSTR lpFile
, LPCSTR lpDirectory
,
268 { HINSTANCE32 retval
=31; /* default - 'No association was found' */
271 TRACE(shell
, "File %s, Dir %s\n",
272 (lpFile
!= NULL
?lpFile
:"-"),
273 (lpDirectory
!= NULL
?lpDirectory
:"-"));
275 lpResult
[0]='\0'; /* Start off with an empty return string */
277 /* trap NULL parameters on entry */
278 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
279 { /* FIXME - should throw a warning, perhaps! */
280 return 2; /* File not found. Close enough, I guess. */
284 { GetCurrentDirectory32A( sizeof(old_dir
), old_dir
);
285 SetCurrentDirectory32A( lpDirectory
);
288 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
290 TRACE(shell
, "returning %s\n", lpResult
);
292 SetCurrentDirectory32A( old_dir
);
296 /*************************************************************************
297 * FindExecutable32W (SHELL32.219)
299 HINSTANCE32 WINAPI
FindExecutable32W(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
302 FIXME(shell
, "(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
303 return 31; /* default - 'No association was found' */
312 #define IDC_STATIC_TEXT 100
313 #define IDC_LISTBOX 99
314 #define IDC_WINE_TEXT 98
316 #define DROP_FIELD_TOP (-15)
317 #define DROP_FIELD_HEIGHT 15
319 extern HICON32 hIconTitleFont
;
321 static BOOL32
__get_dropline( HWND32 hWnd
, LPRECT32 lprect
)
322 { HWND32 hWndCtl
= GetDlgItem32(hWnd
, IDC_WINE_TEXT
);
324 { GetWindowRect32( hWndCtl
, lprect
);
325 MapWindowPoints32( 0, hWnd
, (LPPOINT32
)lprect
, 2 );
326 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
332 /*************************************************************************
333 * SHAppBarMessage32 [SHELL32.207]
335 UINT32 WINAPI
SHAppBarMessage32(DWORD msg
, PAPPBARDATA data
)
336 { FIXME(shell
,"(0x%08lx,%p): stub\n", msg
, data
);
340 case ABM_GETAUTOHIDEBAR
:
342 case ABM_GETTASKBARPOS
:
346 case ABM_SETAUTOHIDEBAR
:
348 case ABM_WINDOWPOSCHANGED
:
355 /*************************************************************************
356 * SHBrowseForFolderA [SHELL32.209]
359 LPITEMIDLIST WINAPI
SHBrowseForFolder32A (LPBROWSEINFO32A lpbi
)
360 { FIXME (shell
, "(%lx,%s) empty stub!\n", (DWORD
)lpbi
, lpbi
->lpszTitle
);
364 /*************************************************************************
365 * SHGetDesktopFolder [SHELL32.216]
367 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
369 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
372 * the interface to the shell desktop folder.
375 * the pdesktopfolder has to be released at the end (at dll unloading???)
377 LPSHELLFOLDER pdesktopfolder
=NULL
;
379 DWORD WINAPI
SHGetDesktopFolder(LPSHELLFOLDER
*shellfolder
)
380 { HRESULT hres
= E_OUTOFMEMORY
;
381 LPCLASSFACTORY lpclf
;
382 TRACE(shell
,"%p->(%p)\n",shellfolder
,*shellfolder
);
388 { lpclf
= IClassFactory_Constructor();
389 /* fixme: the buildin IClassFactory_Constructor is at the moment only
390 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
392 { hres
= lpclf
->lpvtbl
->fnCreateInstance(lpclf
,NULL
,(REFIID
)&IID_IShellFolder
, (void*)&pdesktopfolder
);
393 lpclf
->lpvtbl
->fnRelease(lpclf
);
398 { *shellfolder
= pdesktopfolder
;
399 pdesktopfolder
->lpvtbl
->fnAddRef(pdesktopfolder
);
405 TRACE(shell
,"-- %p->(%p)\n",shellfolder
, *shellfolder
);
408 /*************************************************************************
409 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
411 BOOL32 WINAPI
SHGetPathFromIDList32(LPCITEMIDLIST pidl
,LPSTR pszPath
)
412 { TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
413 return SHGetPathFromIDList32A(pidl
,pszPath
);
416 /*************************************************************************
417 * SHGetSpecialFolderLocation [SHELL32.223]
418 * gets the folder locations from the registry and creates a pidl
419 * creates missing reg keys and directorys
423 * nFolder [I] CSIDL_xxxxx
424 * ppidl [O] PIDL of a special folder
430 * - look for "User Shell Folder" first
433 HRESULT WINAPI
SHGetSpecialFolderLocation(HWND32 hwndOwner
, INT32 nFolder
, LPITEMIDLIST
* ppidl
)
434 { LPSHELLFOLDER shellfolder
;
435 DWORD pchEaten
,tpathlen
=MAX_PATH
,type
,dwdisp
,res
;
436 CHAR pszTemp
[256],buffer
[256],tpath
[MAX_PATH
],npath
[MAX_PATH
];
437 LPWSTR lpszDisplayName
= (LPWSTR
)&pszTemp
[0];
441 { FT_UNKNOWN
= 0x00000000,
443 FT_DESKTOP
= 0x00000002,
444 FT_SPECIAL
= 0x00000003
447 TRACE(shell
,"(%04x,0x%x,%p)\n", hwndOwner
,nFolder
,ppidl
);
449 strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
451 res
=RegCreateKeyEx32A(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
);
453 { ERR(shell
,"Could not create key %s %08lx \n",buffer
,res
);
454 return E_OUTOFMEMORY
;
459 { case CSIDL_BITBUCKET
:
460 strcpy (buffer
,"xxx"); /*not in the registry*/
461 TRACE (shell
,"looking for Recycler\n");
465 strcpy (buffer
,"xxx"); /*virtual folder*/
466 TRACE (shell
,"looking for Control\n");
470 strcpy (buffer
,"xxx"); /*virtual folder*/
471 TRACE (shell
,"looking for Desktop\n");
474 case CSIDL_DESKTOPDIRECTORY
:
475 case CSIDL_COMMON_DESKTOPDIRECTORY
:
476 strcpy (buffer
,"Desktop");
479 strcpy (buffer
,"xxx"); /*virtual folder*/
480 TRACE (shell
,"looking for Drives\n");
484 strcpy (buffer
,"Fonts");
487 strcpy (buffer
,"NetHood");
489 case CSIDL_PRINTHOOD
:
490 strcpy (buffer
,"PrintHood");
493 strcpy (buffer
,"xxx"); /*virtual folder*/
494 TRACE (shell
,"looking for Network\n");
498 strcpy (buffer
,"Appdata");
501 strcpy (buffer
,"Personal");
503 case CSIDL_FAVORITES
:
504 strcpy (buffer
,"Favorites");
507 strcpy (buffer
,"PrintHood");
509 case CSIDL_COMMON_PROGRAMS
:
511 strcpy (buffer
,"Programs");
514 strcpy (buffer
,"Recent");
517 strcpy (buffer
,"SendTo");
519 case CSIDL_COMMON_STARTMENU
:
520 case CSIDL_STARTMENU
:
521 strcpy (buffer
,"Start Menu");
523 case CSIDL_COMMON_STARTUP
:
525 strcpy (buffer
,"Startup");
527 case CSIDL_TEMPLATES
:
528 strcpy (buffer
,"Templates");
531 ERR (shell
,"unknown CSIDL 0x%08x\n", nFolder
);
536 TRACE(shell
,"Key=%s\n",buffer
);
542 /* Directory: get the value from the registry, if its not there
543 create it and the directory*/
544 if (RegQueryValueEx32A(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
545 { GetWindowsDirectory32A(npath
,MAX_PATH
);
546 PathAddBackslash32A(npath
);
548 { case CSIDL_DESKTOPDIRECTORY
:
549 case CSIDL_COMMON_DESKTOPDIRECTORY
:
550 strcat (npath
,"Desktop");
553 strcat (npath
,"Fonts");
556 strcat (npath
,"NetHood");
558 case CSIDL_PRINTHOOD
:
559 strcat (npath
,"PrintHood");
562 strcat (npath
,"Appdata");
565 strcpy (npath
,"C:\\Personal");
567 case CSIDL_FAVORITES
:
568 strcat (npath
,"Favorites");
571 strcat (npath
,"PrintHood");
573 case CSIDL_COMMON_PROGRAMS
:
575 strcat (npath
,"Start Menu");
576 CreateDirectory32A(npath
,NULL
);
577 strcat (npath
,"\\Programs");
580 strcat (npath
,"Recent");
583 strcat (npath
,"SendTo");
585 case CSIDL_COMMON_STARTMENU
:
586 case CSIDL_STARTMENU
:
587 strcat (npath
,"Start Menu");
589 case CSIDL_COMMON_STARTUP
:
591 strcat (npath
,"Start Menu");
592 CreateDirectory32A(npath
,NULL
);
593 strcat (npath
,"\\Startup");
595 case CSIDL_TEMPLATES
:
596 strcat (npath
,"Templates");
600 return E_OUTOFMEMORY
;
602 if (RegSetValueEx32A(key
,buffer
,0,REG_SZ
,(LPBYTE
)npath
,sizeof(npath
)+1))
603 { ERR(shell
,"could not create value %s\n",buffer
);
605 return E_OUTOFMEMORY
;
607 TRACE(shell
,"value %s=%s created\n",buffer
,npath
);
608 CreateDirectory32A(npath
,NULL
);
613 strcpy (tpath
,"Desktop");
616 if (nFolder
==CSIDL_DRIVES
)
617 strcpy (tpath
,"My Computer");
621 return E_OUTOFMEMORY
;
626 TRACE(shell
,"Value=%s\n",tpath
);
627 LocalToWideChar32(lpszDisplayName
, tpath
, 256);
629 if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
630 { shellfolder
->lpvtbl
->fnParseDisplayName(shellfolder
,hwndOwner
, NULL
,lpszDisplayName
,&pchEaten
,ppidl
,NULL
);
631 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
634 TRACE(shell
, "-- (new pidl %p)\n",*ppidl
);
637 /*************************************************************************
638 * SHHelpShortcuts_RunDLL [SHELL32.224]
641 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
642 { FIXME (exec
, "(%lx, %lx, %lx, %lx) empty stub!\n",
643 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
648 /*************************************************************************
649 * SHLoadInProc [SHELL32.225]
653 DWORD WINAPI
SHLoadInProc (DWORD dwArg1
)
654 { FIXME (shell
, "(%lx) empty stub!\n", dwArg1
);
658 /*************************************************************************
659 * ShellExecute32A (SHELL32.245)
661 HINSTANCE32 WINAPI
ShellExecute32A( HWND32 hWnd
, LPCSTR lpOperation
,
662 LPCSTR lpFile
, LPCSTR lpParameters
,
663 LPCSTR lpDirectory
, INT32 iShowCmd
)
665 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
666 lpDirectory
, iShowCmd
);
669 /*************************************************************************
670 * ShellExecute32W [SHELL32.294]
672 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
673 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
680 LPCWSTR lpParameters
,
684 FIXME(shell
,": stub\n");
693 /*************************************************************************
694 * AboutDlgProc32 (not an exported API function)
696 LRESULT WINAPI
AboutDlgProc32( HWND32 hWnd
, UINT32 msg
, WPARAM32 wParam
,
699 char Template
[512], AppTitle
[512];
704 { case WM_INITDIALOG
:
705 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
707 { const char* const *pstr
= SHELL_People
;
708 SendDlgItemMessage32A(hWnd
, stc1
, STM_SETICON32
,info
->hIcon
, 0);
709 GetWindowText32A( hWnd
, Template
, sizeof(Template
) );
710 sprintf( AppTitle
, Template
, info
->szApp
);
711 SetWindowText32A( hWnd
, AppTitle
);
712 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
),
713 info
->szOtherStuff
);
714 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
715 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 0, 0 );
716 SendMessage32A( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
718 { SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)*pstr
);
721 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 1, 0 );
729 HDC32 hDC
= BeginPaint32( hWnd
, &ps
);
731 if( __get_dropline( hWnd
, &rect
) ) {
732 SelectObject32( hDC
, GetStockObject32( BLACK_PEN
) );
733 MoveToEx32( hDC
, rect
.left
, rect
.top
, NULL
);
734 LineTo32( hDC
, rect
.right
, rect
.bottom
);
736 EndPaint32( hWnd
, &ps
);
740 case WM_LBTRACKPOINT
:
741 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
742 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
743 { if( DragDetect32( hWndCtl
, *((LPPOINT32
)&lParam
) ) )
744 { INT32 idx
= SendMessage32A( hWndCtl
, LB_GETCURSEL32
, 0, 0 );
746 { INT32 length
= SendMessage32A( hWndCtl
, LB_GETTEXTLEN32
, (WPARAM32
)idx
, 0 );
747 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
748 char* pstr
= (char*)GlobalLock16( hMemObj
);
751 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
752 SendMessage32A( hWndCtl
, LB_GETTEXT32
, (WPARAM32
)idx
, (LPARAM
)pstr
);
753 SendMessage32A( hWndCtl
, LB_DELETESTRING32
, (WPARAM32
)idx
, 0 );
754 UpdateWindow32( hWndCtl
);
755 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
756 SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)pstr
);
759 GlobalFree16( hMemObj
);
765 case WM_QUERYDROPOBJECT
:
767 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
768 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
770 if( __get_dropline( hWnd
, &rect
) )
772 pt
.x
=lpDragInfo
->pt
.x
;
773 pt
.x
=lpDragInfo
->pt
.y
;
774 rect
.bottom
+= DROP_FIELD_HEIGHT
;
775 if( PtInRect32( &rect
, pt
) )
776 { SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
786 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
787 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
788 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
790 { static char __appendix_str
[] = " with";
792 hWndCtl
= GetDlgItem32( hWnd
, IDC_WINE_TEXT
);
793 SendMessage32A( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
794 if( !lstrncmp32A( Template
, "WINE", 4 ) )
795 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
), Template
);
797 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
799 SendMessage32A( GetDlgItem32(hWnd
, IDC_LISTBOX
), LB_ADDSTRING32
,
800 (WPARAM32
)-1, (LPARAM
)Template
);
803 lstrcpy32A( Template
, pstr
);
804 lstrcat32A( Template
, __appendix_str
);
805 SetWindowText32A( hWndCtl
, Template
);
806 SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
815 { EndDialog32(hWnd
, TRUE
);
824 /*************************************************************************
825 * ShellAbout32A (SHELL32.243)
827 BOOL32 WINAPI
ShellAbout32A( HWND32 hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
832 info
.szOtherStuff
= szOtherStuff
;
834 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
835 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
836 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
837 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
841 /*************************************************************************
842 * ShellAbout32W (SHELL32.244)
844 BOOL32 WINAPI
ShellAbout32W( HWND32 hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
851 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
852 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
854 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
855 ret
= DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
856 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
857 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
858 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
859 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
863 /*************************************************************************
864 * Shell_NotifyIcon [SHELL32.296]
866 * This function is supposed to deal with the systray.
867 * Any ideas on how this is to be implimented?
869 BOOL32 WINAPI
Shell_NotifyIcon( DWORD dwMessage
, PNOTIFYICONDATA pnid
)
874 /*************************************************************************
875 * Shell_NotifyIcon [SHELL32.297]
877 * This function is supposed to deal with the systray.
878 * Any ideas on how this is to be implimented?
880 BOOL32 WINAPI
Shell_NotifyIconA(DWORD dwMessage
, PNOTIFYICONDATA pnid
)
885 /*************************************************************************
888 void WINAPI
FreeIconList( DWORD dw
)
889 { FIXME(shell
, "(%lx): stub\n",dw
);
892 /*************************************************************************
893 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
900 * path from a passed PIDL.
906 * fnGetDisplayNameOf can return different types of OLEString
908 DWORD WINAPI
SHGetPathFromIDList32A (LPCITEMIDLIST pidl
,LPSTR pszPath
)
910 LPSHELLFOLDER shellfolder
;
911 CHAR buffer
[MAX_PATH
],tpath
[MAX_PATH
];
912 DWORD type
,tpathlen
=MAX_PATH
,dwdisp
;
915 TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
918 { strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
920 if (RegCreateKeyEx32A(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
))
921 { return E_OUTOFMEMORY
;
924 strcpy (buffer
,"Desktop"); /*registry name*/
925 if ( RegQueryValueEx32A(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
926 { GetWindowsDirectory32A(tpath
,MAX_PATH
);
927 PathAddBackslash32A(tpath
);
928 strcat (tpath
,"Desktop"); /*folder name*/
929 RegSetValueEx32A(key
,buffer
,0,REG_SZ
,(LPBYTE
)tpath
,tpathlen
);
930 CreateDirectory32A(tpath
,NULL
);
933 strcpy(pszPath
,tpath
);
936 { if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
937 { shellfolder
->lpvtbl
->fnGetDisplayNameOf(shellfolder
,pidl
,SHGDN_FORPARSING
,&lpName
);
938 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
940 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
941 strcpy(pszPath
,lpName
.u
.cStr
);
942 /* fixme free the olestring*/
944 TRACE(shell
,"-- (%s)\n",pszPath
);
947 /*************************************************************************
948 * SHGetPathFromIDList32W [SHELL32.262]
950 DWORD WINAPI
SHGetPathFromIDList32W (LPCITEMIDLIST pidl
,LPWSTR pszPath
)
951 { char sTemp
[MAX_PATH
];
953 TRACE (shell
,"(pidl=%p)\n", pidl
);
955 SHGetPathFromIDList32A (pidl
, sTemp
);
956 lstrcpyAtoW(pszPath
, sTemp
);
958 TRACE(shell
,"-- (%s)\n",debugstr_w(pszPath
));
964 void (CALLBACK
* pDLLInitComctl
)(void);
965 INT32 (CALLBACK
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON32 hIcon
);
966 INT32 (CALLBACK
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT32
, HICON32
);
967 HIMAGELIST (CALLBACK
* pImageList_Create
) (INT32
,INT32
,UINT32
,INT32
,INT32
);
968 HICON32 (CALLBACK
* pImageList_GetIcon
) (HIMAGELIST
, INT32
, UINT32
);
969 INT32 (CALLBACK
* pImageList_GetImageCount
)(HIMAGELIST
);
971 LPVOID (CALLBACK
* pCOMCTL32_Alloc
) (INT32
);
972 BOOL32 (CALLBACK
* pCOMCTL32_Free
) (LPVOID
);
974 HDPA (CALLBACK
* pDPA_Create
) (INT32
);
975 INT32 (CALLBACK
* pDPA_InsertPtr
) (const HDPA
, INT32
, LPVOID
);
976 BOOL32 (CALLBACK
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
977 LPVOID (CALLBACK
* pDPA_GetPtr
) (const HDPA
, INT32
);
978 BOOL32 (CALLBACK
* pDPA_Destroy
) (const HDPA
);
979 INT32 (CALLBACK
*pDPA_Search
) (const HDPA
, LPVOID
, INT32
, PFNDPACOMPARE
, LPARAM
, UINT32
);
980 static BOOL32 bShell32IsInitialized
=0;
981 /*************************************************************************
985 * at the moment the icons are extracted from shell32.dll
986 * free the imagelists
988 HINSTANCE32 shell32_hInstance
;
990 BOOL32 WINAPI
Shell32LibMain(HINSTANCE32 hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
991 { HINSTANCE32 hComctl32
;
993 TRACE(shell
,"0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, lpvReserved
);
995 shell32_hInstance
= hinstDLL
;
997 if (fdwReason
==DLL_PROCESS_ATTACH
&& !bShell32IsInitialized
)
998 { hComctl32
= LoadLibrary32A("COMCTL32.DLL");
1000 { pDLLInitComctl
=GetProcAddress32(hComctl32
,"InitCommonControlsEx");
1004 pImageList_Create
=GetProcAddress32(hComctl32
,"ImageList_Create");
1005 pImageList_AddIcon
=GetProcAddress32(hComctl32
,"ImageList_AddIcon");
1006 pImageList_ReplaceIcon
=GetProcAddress32(hComctl32
,"ImageList_ReplaceIcon");
1007 pImageList_GetIcon
=GetProcAddress32(hComctl32
,"ImageList_GetIcon");
1008 pImageList_GetImageCount
=GetProcAddress32(hComctl32
,"ImageList_GetImageCount");
1010 /* imports by ordinal, pray that it works*/
1011 pCOMCTL32_Alloc
=GetProcAddress32(hComctl32
, (LPCSTR
)71L);
1012 pCOMCTL32_Free
=GetProcAddress32(hComctl32
, (LPCSTR
)73L);
1013 pDPA_Create
=GetProcAddress32(hComctl32
, (LPCSTR
)328L);
1014 pDPA_Destroy
=GetProcAddress32(hComctl32
, (LPCSTR
)329L);
1015 pDPA_GetPtr
=GetProcAddress32(hComctl32
, (LPCSTR
)332L);
1016 pDPA_InsertPtr
=GetProcAddress32(hComctl32
, (LPCSTR
)334L);
1017 pDPA_Sort
=GetProcAddress32(hComctl32
, (LPCSTR
)338L);
1018 pDPA_Search
=GetProcAddress32(hComctl32
, (LPCSTR
)339L);
1020 FreeLibrary32(hComctl32
);
1023 { /* panic, imediately exit wine*/
1024 ERR(shell
,"P A N I C error getting functionpointers\n");
1028 bShell32IsInitialized
= TRUE
;