5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
13 #include "wine/winuser16.h"
23 #include "cursoricon.h"
24 #include "interfaces.h"
25 #include "sysmetrics.h"
29 #include "imagelist.h"
30 #include "sysmetrics.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 * SHGetFileInfoA [SHELL32.254]
105 DWORD WINAPI
SHGetFileInfo32A(LPCSTR path
,DWORD dwFileAttributes
,
106 SHFILEINFO32A
*psfi
, UINT32 sizeofpsfi
,
108 { CHAR szTemp
[MAX_PATH
];
110 LPITEMIDLIST pPidlTemp
= NULL
;
113 TRACE(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
114 path
,dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
116 /* translate the pidl to a path*/
117 if (flags
& SHGFI_PIDL
)
118 { pPidlTemp
= (LPCITEMIDLIST
)path
;
119 SHGetPathFromIDList32A (pPidlTemp
, szTemp
);
120 TRACE(shell
,"pidl=%p is %s\n", path
, szTemp
);
123 { strcpy(szTemp
,path
);
124 TRACE(shell
,"path=%s\n", szTemp
);
127 if (flags
& SHGFI_ATTRIBUTES
)
128 { if (flags
& SHGFI_PIDL
)
129 { pData
= _ILGetDataPointer((LPCITEMIDLIST
)path
);
130 psfi
->dwAttributes
= pData
->u
.generic
.dwSFGAO
; /* fixme: no direct access*/
134 { psfi
->dwAttributes
=SFGAO_FILESYSTEM
;
137 FIXME(shell
,"file attributes, stub\n");
140 if (flags
& SHGFI_DISPLAYNAME
)
141 { if (flags
& SHGFI_PIDL
)
142 { strcpy(psfi
->szDisplayName
,szTemp
);
145 { strcpy(psfi
->szDisplayName
,path
);
147 TRACE(shell
,"displayname=%s\n", psfi
->szDisplayName
);
151 if (flags
& SHGFI_TYPENAME
)
152 { FIXME(shell
,"get the file type, stub\n");
153 strcpy(psfi
->szTypeName
,"FIXME: Type");
157 if (flags
& SHGFI_ICONLOCATION
)
158 { FIXME(shell
,"location of icon, stub\n");
159 strcpy(psfi
->szDisplayName
,"");
163 if (flags
& SHGFI_EXETYPE
)
164 FIXME(shell
,"type of executable, stub\n");
166 if (flags
& SHGFI_LINKOVERLAY
)
167 FIXME(shell
,"set icon to link, stub\n");
169 if (flags
& SHGFI_OPENICON
)
170 FIXME(shell
,"set to open icon, stub\n");
172 if (flags
& SHGFI_SELECTED
)
173 FIXME(shell
,"set icon to selected, stub\n");
175 if (flags
& SHGFI_SHELLICONSIZE
)
176 FIXME(shell
,"set icon to shell size, stub\n");
178 if (flags
& SHGFI_USEFILEATTRIBUTES
)
179 FIXME(shell
,"use the dwFileAttributes, stub\n");
181 if (flags
& SHGFI_ICON
)
182 { FIXME(shell
,"icon handle\n");
183 if (flags
& SHGFI_SMALLICON
)
184 { TRACE(shell
,"set to small icon\n");
185 psfi
->hIcon
=pImageList_GetIcon(ShellSmallIconList
,32,ILD_NORMAL
);
186 ret
= (DWORD
) ShellSmallIconList
;
189 { TRACE(shell
,"set to big icon\n");
190 psfi
->hIcon
=pImageList_GetIcon(ShellBigIconList
,32,ILD_NORMAL
);
191 ret
= (DWORD
) ShellBigIconList
;
195 if (flags
& SHGFI_SYSICONINDEX
)
197 { pPidlTemp
= ILCreateFromPath (szTemp
);
199 psfi
->iIcon
= SHMapPIDLToSystemImageListIndex (NULL
, pPidlTemp
, 0);
200 TRACE(shell
,"-- SYSICONINDEX %i\n", psfi
->iIcon
);
202 if (flags
& SHGFI_SMALLICON
)
203 { TRACE(shell
,"set to small icon\n");
204 ret
= (DWORD
) ShellSmallIconList
;
207 { TRACE(shell
,"set to big icon\n");
208 ret
= (DWORD
) ShellBigIconList
;
215 /*************************************************************************
216 * SHGetFileInfo32W [SHELL32.255]
222 DWORD WINAPI
SHGetFileInfo32W(LPCWSTR path
,DWORD dwFileAttributes
,
223 SHFILEINFO32W
*psfi
, UINT32 sizeofpsfi
,
225 { FIXME(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
226 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
230 /*************************************************************************
231 * ExtractIcon32A (SHELL32.133)
233 HICON32 WINAPI
ExtractIcon32A( HINSTANCE32 hInstance
, LPCSTR lpszExeFileName
,
235 { HGLOBAL16 handle
= InternalExtractIcon(hInstance
,lpszExeFileName
,nIconIndex
, 1);
239 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
240 HICON16 hIcon
= *ptr
;
242 GlobalFree16(handle
);
248 /*************************************************************************
249 * ExtractIcon32W (SHELL32.180)
251 HICON32 WINAPI
ExtractIcon32W( HINSTANCE32 hInstance
, LPCWSTR lpszExeFileName
,
257 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
258 ret
= ExtractIcon32A(hInstance
,exefn
,nIconIndex
);
260 HeapFree(GetProcessHeap(),0,exefn
);
264 /*************************************************************************
265 * FindExecutable32A (SHELL32.184)
267 HINSTANCE32 WINAPI
FindExecutable32A( LPCSTR lpFile
, LPCSTR lpDirectory
,
269 { HINSTANCE32 retval
=31; /* default - 'No association was found' */
272 TRACE(shell
, "File %s, Dir %s\n",
273 (lpFile
!= NULL
?lpFile
:"-"),
274 (lpDirectory
!= NULL
?lpDirectory
:"-"));
276 lpResult
[0]='\0'; /* Start off with an empty return string */
278 /* trap NULL parameters on entry */
279 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
280 { /* FIXME - should throw a warning, perhaps! */
281 return 2; /* File not found. Close enough, I guess. */
285 { GetCurrentDirectory32A( sizeof(old_dir
), old_dir
);
286 SetCurrentDirectory32A( lpDirectory
);
289 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
291 TRACE(shell
, "returning %s\n", lpResult
);
293 SetCurrentDirectory32A( old_dir
);
297 /*************************************************************************
298 * FindExecutable32W (SHELL32.219)
300 HINSTANCE32 WINAPI
FindExecutable32W(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
303 FIXME(shell
, "(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
304 return 31; /* default - 'No association was found' */
313 #define IDC_STATIC_TEXT 100
314 #define IDC_LISTBOX 99
315 #define IDC_WINE_TEXT 98
317 #define DROP_FIELD_TOP (-15)
318 #define DROP_FIELD_HEIGHT 15
320 extern HICON32 hIconTitleFont
;
322 static BOOL32
__get_dropline( HWND32 hWnd
, LPRECT32 lprect
)
323 { HWND32 hWndCtl
= GetDlgItem32(hWnd
, IDC_WINE_TEXT
);
325 { GetWindowRect32( hWndCtl
, lprect
);
326 MapWindowPoints32( 0, hWnd
, (LPPOINT32
)lprect
, 2 );
327 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
333 /*************************************************************************
334 * SHAppBarMessage32 [SHELL32.207]
336 UINT32 WINAPI
SHAppBarMessage32(DWORD msg
, PAPPBARDATA data
)
337 { FIXME(shell
,"(0x%08lx,%p): stub\n", msg
, data
);
341 case ABM_GETAUTOHIDEBAR
:
343 case ABM_GETTASKBARPOS
:
347 case ABM_SETAUTOHIDEBAR
:
349 case ABM_WINDOWPOSCHANGED
:
356 /*************************************************************************
357 * SHBrowseForFolderA [SHELL32.209]
360 LPITEMIDLIST WINAPI
SHBrowseForFolder32A (LPBROWSEINFO32A lpbi
)
361 { FIXME (shell
, "(%lx,%s) empty stub!\n", (DWORD
)lpbi
, lpbi
->lpszTitle
);
365 /*************************************************************************
366 * SHGetDesktopFolder [SHELL32.216]
368 * SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
370 * CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
373 * the interface to the shell desktop folder.
376 * the pdesktopfolder has to be released at the end (at dll unloading???)
378 LPSHELLFOLDER pdesktopfolder
=NULL
;
380 DWORD WINAPI
SHGetDesktopFolder(LPSHELLFOLDER
*shellfolder
)
381 { HRESULT hres
= E_OUTOFMEMORY
;
382 LPCLASSFACTORY lpclf
;
383 TRACE(shell
,"%p->(%p)\n",shellfolder
,*shellfolder
);
389 { lpclf
= IClassFactory_Constructor();
390 /* fixme: the buildin IClassFactory_Constructor is at the moment only
391 for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
393 { hres
= lpclf
->lpvtbl
->fnCreateInstance(lpclf
,NULL
,(REFIID
)&IID_IShellFolder
, (void*)&pdesktopfolder
);
394 lpclf
->lpvtbl
->fnRelease(lpclf
);
399 { *shellfolder
= pdesktopfolder
;
400 pdesktopfolder
->lpvtbl
->fnAddRef(pdesktopfolder
);
406 TRACE(shell
,"-- %p->(%p)\n",shellfolder
, *shellfolder
);
409 /*************************************************************************
410 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
412 BOOL32 WINAPI
SHGetPathFromIDList32(LPCITEMIDLIST pidl
,LPSTR pszPath
)
413 { TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
414 return SHGetPathFromIDList32A(pidl
,pszPath
);
417 /*************************************************************************
418 * SHGetSpecialFolderLocation [SHELL32.223]
419 * gets the folder locations from the registry and creates a pidl
420 * creates missing reg keys and directorys
424 * nFolder [I] CSIDL_xxxxx
425 * ppidl [O] PIDL of a special folder
431 * - look for "User Shell Folder" first
434 HRESULT WINAPI
SHGetSpecialFolderLocation(HWND32 hwndOwner
, INT32 nFolder
, LPITEMIDLIST
* ppidl
)
435 { LPSHELLFOLDER shellfolder
;
436 DWORD pchEaten
,tpathlen
=MAX_PATH
,type
,dwdisp
,res
;
437 CHAR pszTemp
[256],buffer
[256],tpath
[MAX_PATH
],npath
[MAX_PATH
];
438 LPWSTR lpszDisplayName
= (LPWSTR
)&pszTemp
[0];
442 { FT_UNKNOWN
= 0x00000000,
444 FT_DESKTOP
= 0x00000002,
445 FT_SPECIAL
= 0x00000003
448 TRACE(shell
,"(%04x,0x%x,%p)\n", hwndOwner
,nFolder
,ppidl
);
450 strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
452 res
=RegCreateKeyEx32A(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
);
454 { ERR(shell
,"Could not create key %s %08lx \n",buffer
,res
);
455 return E_OUTOFMEMORY
;
460 { case CSIDL_BITBUCKET
:
461 strcpy (buffer
,"xxx"); /*not in the registry*/
462 TRACE (shell
,"looking for Recycler\n");
466 strcpy (buffer
,"xxx"); /*virtual folder*/
467 TRACE (shell
,"looking for Control\n");
471 strcpy (buffer
,"xxx"); /*virtual folder*/
472 TRACE (shell
,"looking for Desktop\n");
475 case CSIDL_DESKTOPDIRECTORY
:
476 case CSIDL_COMMON_DESKTOPDIRECTORY
:
477 strcpy (buffer
,"Desktop");
480 strcpy (buffer
,"xxx"); /*virtual folder*/
481 TRACE (shell
,"looking for Drives\n");
485 strcpy (buffer
,"Fonts");
488 strcpy (buffer
,"NetHood");
490 case CSIDL_PRINTHOOD
:
491 strcpy (buffer
,"PrintHood");
494 strcpy (buffer
,"xxx"); /*virtual folder*/
495 TRACE (shell
,"looking for Network\n");
499 strcpy (buffer
,"Appdata");
502 strcpy (buffer
,"Personal");
504 case CSIDL_FAVORITES
:
505 strcpy (buffer
,"Favorites");
508 strcpy (buffer
,"PrintHood");
510 case CSIDL_COMMON_PROGRAMS
:
512 strcpy (buffer
,"Programs");
515 strcpy (buffer
,"Recent");
518 strcpy (buffer
,"SendTo");
520 case CSIDL_COMMON_STARTMENU
:
521 case CSIDL_STARTMENU
:
522 strcpy (buffer
,"Start Menu");
524 case CSIDL_COMMON_STARTUP
:
526 strcpy (buffer
,"Startup");
528 case CSIDL_TEMPLATES
:
529 strcpy (buffer
,"Templates");
532 ERR (shell
,"unknown CSIDL 0x%08x\n", nFolder
);
537 TRACE(shell
,"Key=%s\n",buffer
);
543 /* Directory: get the value from the registry, if its not there
544 create it and the directory*/
545 if (RegQueryValueEx32A(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
546 { GetWindowsDirectory32A(npath
,MAX_PATH
);
547 PathAddBackslash32A(npath
);
549 { case CSIDL_DESKTOPDIRECTORY
:
550 case CSIDL_COMMON_DESKTOPDIRECTORY
:
551 strcat (npath
,"Desktop");
554 strcat (npath
,"Fonts");
557 strcat (npath
,"NetHood");
559 case CSIDL_PRINTHOOD
:
560 strcat (npath
,"PrintHood");
563 strcat (npath
,"Appdata");
566 strcpy (npath
,"C:\\Personal");
568 case CSIDL_FAVORITES
:
569 strcat (npath
,"Favorites");
572 strcat (npath
,"PrintHood");
574 case CSIDL_COMMON_PROGRAMS
:
576 strcat (npath
,"Start Menu");
577 CreateDirectory32A(npath
,NULL
);
578 strcat (npath
,"\\Programs");
581 strcat (npath
,"Recent");
584 strcat (npath
,"SendTo");
586 case CSIDL_COMMON_STARTMENU
:
587 case CSIDL_STARTMENU
:
588 strcat (npath
,"Start Menu");
590 case CSIDL_COMMON_STARTUP
:
592 strcat (npath
,"Start Menu");
593 CreateDirectory32A(npath
,NULL
);
594 strcat (npath
,"\\Startup");
596 case CSIDL_TEMPLATES
:
597 strcat (npath
,"Templates");
601 return E_OUTOFMEMORY
;
603 if (RegSetValueEx32A(key
,buffer
,0,REG_SZ
,(LPBYTE
)npath
,sizeof(npath
)+1))
604 { ERR(shell
,"could not create value %s\n",buffer
);
606 return E_OUTOFMEMORY
;
608 TRACE(shell
,"value %s=%s created\n",buffer
,npath
);
609 CreateDirectory32A(npath
,NULL
);
614 strcpy (tpath
,"Desktop");
617 if (nFolder
==CSIDL_DRIVES
)
618 strcpy (tpath
,"My Computer");
622 return E_OUTOFMEMORY
;
627 TRACE(shell
,"Value=%s\n",tpath
);
628 LocalToWideChar32(lpszDisplayName
, tpath
, 256);
630 if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
631 { shellfolder
->lpvtbl
->fnParseDisplayName(shellfolder
,hwndOwner
, NULL
,lpszDisplayName
,&pchEaten
,ppidl
,NULL
);
632 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
635 TRACE(shell
, "-- (new pidl %p)\n",*ppidl
);
638 /*************************************************************************
639 * SHHelpShortcuts_RunDLL [SHELL32.224]
642 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
643 { FIXME (exec
, "(%lx, %lx, %lx, %lx) empty stub!\n",
644 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
649 /*************************************************************************
650 * SHLoadInProc [SHELL32.225]
654 DWORD WINAPI
SHLoadInProc (DWORD dwArg1
)
655 { FIXME (shell
, "(%lx) empty stub!\n", dwArg1
);
659 /*************************************************************************
660 * ShellExecute32A (SHELL32.245)
662 HINSTANCE32 WINAPI
ShellExecute32A( HWND32 hWnd
, LPCSTR lpOperation
,
663 LPCSTR lpFile
, LPCSTR lpParameters
,
664 LPCSTR lpDirectory
, INT32 iShowCmd
)
666 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
667 lpDirectory
, iShowCmd
);
670 /*************************************************************************
671 * ShellExecute32W [SHELL32.294]
673 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
674 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
681 LPCWSTR lpParameters
,
685 FIXME(shell
,": stub\n");
694 /*************************************************************************
695 * AboutDlgProc32 (not an exported API function)
697 LRESULT WINAPI
AboutDlgProc32( HWND32 hWnd
, UINT32 msg
, WPARAM32 wParam
,
700 char Template
[512], AppTitle
[512];
705 { case WM_INITDIALOG
:
706 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
708 { const char* const *pstr
= SHELL_People
;
709 SendDlgItemMessage32A(hWnd
, stc1
, STM_SETICON32
,info
->hIcon
, 0);
710 GetWindowText32A( hWnd
, Template
, sizeof(Template
) );
711 sprintf( AppTitle
, Template
, info
->szApp
);
712 SetWindowText32A( hWnd
, AppTitle
);
713 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
),
714 info
->szOtherStuff
);
715 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
716 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 0, 0 );
717 SendMessage32A( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
719 { SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)*pstr
);
722 SendMessage32A( hWndCtl
, WM_SETREDRAW
, 1, 0 );
730 HDC32 hDC
= BeginPaint32( hWnd
, &ps
);
732 if( __get_dropline( hWnd
, &rect
) ) {
733 SelectObject32( hDC
, GetStockObject32( BLACK_PEN
) );
734 MoveToEx32( hDC
, rect
.left
, rect
.top
, NULL
);
735 LineTo32( hDC
, rect
.right
, rect
.bottom
);
737 EndPaint32( hWnd
, &ps
);
741 case WM_LBTRACKPOINT
:
742 hWndCtl
= GetDlgItem32(hWnd
, IDC_LISTBOX
);
743 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
744 { if( DragDetect32( hWndCtl
, *((LPPOINT32
)&lParam
) ) )
745 { INT32 idx
= SendMessage32A( hWndCtl
, LB_GETCURSEL32
, 0, 0 );
747 { INT32 length
= SendMessage32A( hWndCtl
, LB_GETTEXTLEN32
, (WPARAM32
)idx
, 0 );
748 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
749 char* pstr
= (char*)GlobalLock16( hMemObj
);
752 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
753 SendMessage32A( hWndCtl
, LB_GETTEXT32
, (WPARAM32
)idx
, (LPARAM
)pstr
);
754 SendMessage32A( hWndCtl
, LB_DELETESTRING32
, (WPARAM32
)idx
, 0 );
755 UpdateWindow32( hWndCtl
);
756 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
757 SendMessage32A( hWndCtl
, LB_ADDSTRING32
, (WPARAM32
)-1, (LPARAM
)pstr
);
760 GlobalFree16( hMemObj
);
766 case WM_QUERYDROPOBJECT
:
768 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
769 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
771 if( __get_dropline( hWnd
, &rect
) )
773 pt
.x
=lpDragInfo
->pt
.x
;
774 pt
.x
=lpDragInfo
->pt
.y
;
775 rect
.bottom
+= DROP_FIELD_HEIGHT
;
776 if( PtInRect32( &rect
, pt
) )
777 { SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
787 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
788 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
789 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
791 { static char __appendix_str
[] = " with";
793 hWndCtl
= GetDlgItem32( hWnd
, IDC_WINE_TEXT
);
794 SendMessage32A( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
795 if( !lstrncmp32A( Template
, "WINE", 4 ) )
796 SetWindowText32A( GetDlgItem32(hWnd
, IDC_STATIC_TEXT
), Template
);
798 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
800 SendMessage32A( GetDlgItem32(hWnd
, IDC_LISTBOX
), LB_ADDSTRING32
,
801 (WPARAM32
)-1, (LPARAM
)Template
);
804 lstrcpy32A( Template
, pstr
);
805 lstrcat32A( Template
, __appendix_str
);
806 SetWindowText32A( hWndCtl
, Template
);
807 SetWindowLong32A( hWnd
, DWL_MSGRESULT
, 1 );
816 { EndDialog32(hWnd
, TRUE
);
825 /*************************************************************************
826 * ShellAbout32A (SHELL32.243)
828 BOOL32 WINAPI
ShellAbout32A( HWND32 hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
833 info
.szOtherStuff
= szOtherStuff
;
835 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
836 return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
837 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
838 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
842 /*************************************************************************
843 * ShellAbout32W (SHELL32.244)
845 BOOL32 WINAPI
ShellAbout32W( HWND32 hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
852 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
853 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
855 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
856 ret
= DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd
),
857 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
858 hWnd
, AboutDlgProc32
, (LPARAM
)&info
);
859 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
860 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
864 /*************************************************************************
865 * Shell_NotifyIcon [SHELL32.296]
867 * This function is supposed to deal with the systray.
868 * Any ideas on how this is to be implimented?
870 BOOL32 WINAPI
Shell_NotifyIcon( DWORD dwMessage
, PNOTIFYICONDATA pnid
)
875 /*************************************************************************
876 * Shell_NotifyIcon [SHELL32.297]
878 * This function is supposed to deal with the systray.
879 * Any ideas on how this is to be implimented?
881 BOOL32 WINAPI
Shell_NotifyIconA(DWORD dwMessage
, PNOTIFYICONDATA pnid
)
886 /*************************************************************************
889 void WINAPI
FreeIconList( DWORD dw
)
890 { FIXME(shell
, "(%lx): stub\n",dw
);
893 /*************************************************************************
894 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
901 * path from a passed PIDL.
907 * fnGetDisplayNameOf can return different types of OLEString
909 DWORD WINAPI
SHGetPathFromIDList32A (LPCITEMIDLIST pidl
,LPSTR pszPath
)
911 LPSHELLFOLDER shellfolder
;
912 CHAR buffer
[MAX_PATH
],tpath
[MAX_PATH
];
913 DWORD type
,tpathlen
=MAX_PATH
,dwdisp
;
916 TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
919 { strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
921 if (RegCreateKeyEx32A(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
))
922 { return E_OUTOFMEMORY
;
925 strcpy (buffer
,"Desktop"); /*registry name*/
926 if ( RegQueryValueEx32A(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
927 { GetWindowsDirectory32A(tpath
,MAX_PATH
);
928 PathAddBackslash32A(tpath
);
929 strcat (tpath
,"Desktop"); /*folder name*/
930 RegSetValueEx32A(key
,buffer
,0,REG_SZ
,(LPBYTE
)tpath
,tpathlen
);
931 CreateDirectory32A(tpath
,NULL
);
934 strcpy(pszPath
,tpath
);
937 { if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
938 { shellfolder
->lpvtbl
->fnGetDisplayNameOf(shellfolder
,pidl
,SHGDN_FORPARSING
,&lpName
);
939 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
941 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
942 strcpy(pszPath
,lpName
.u
.cStr
);
943 /* fixme free the olestring*/
945 TRACE(shell
,"-- (%s)\n",pszPath
);
948 /*************************************************************************
949 * SHGetPathFromIDList32W [SHELL32.262]
951 DWORD WINAPI
SHGetPathFromIDList32W (LPCITEMIDLIST pidl
,LPWSTR pszPath
)
952 { char sTemp
[MAX_PATH
];
954 TRACE (shell
,"(pidl=%p)\n", pidl
);
956 SHGetPathFromIDList32A (pidl
, sTemp
);
957 lstrcpyAtoW(pszPath
, sTemp
);
959 TRACE(shell
,"-- (%s)\n",debugstr_w(pszPath
));
965 void (CALLBACK
* pDLLInitComctl
)(void);
966 INT32 (CALLBACK
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON32 hIcon
);
967 INT32 (CALLBACK
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT32
, HICON32
);
968 HIMAGELIST (CALLBACK
* pImageList_Create
) (INT32
,INT32
,UINT32
,INT32
,INT32
);
969 HICON32 (CALLBACK
* pImageList_GetIcon
) (HIMAGELIST
, INT32
, UINT32
);
970 INT32 (CALLBACK
* pImageList_GetImageCount
)(HIMAGELIST
);
972 LPVOID (CALLBACK
* pCOMCTL32_Alloc
) (INT32
);
973 BOOL32 (CALLBACK
* pCOMCTL32_Free
) (LPVOID
);
975 HDPA (CALLBACK
* pDPA_Create
) (INT32
);
976 INT32 (CALLBACK
* pDPA_InsertPtr
) (const HDPA
, INT32
, LPVOID
);
977 BOOL32 (CALLBACK
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
978 LPVOID (CALLBACK
* pDPA_GetPtr
) (const HDPA
, INT32
);
979 BOOL32 (CALLBACK
* pDPA_Destroy
) (const HDPA
);
980 INT32 (CALLBACK
*pDPA_Search
) (const HDPA
, LPVOID
, INT32
, PFNDPACOMPARE
, LPARAM
, UINT32
);
981 static BOOL32 bShell32IsInitialized
=0;
982 /*************************************************************************
986 * at the moment the icons are extracted from shell32.dll
987 * free the imagelists
989 HINSTANCE32 shell32_hInstance
;
991 BOOL32 WINAPI
Shell32LibMain(HINSTANCE32 hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
992 { HINSTANCE32 hComctl32
;
994 TRACE(shell
,"0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, lpvReserved
);
996 shell32_hInstance
= hinstDLL
;
998 if (fdwReason
==DLL_PROCESS_ATTACH
&& !bShell32IsInitialized
)
999 { hComctl32
= LoadLibrary32A("COMCTL32.DLL");
1001 { pDLLInitComctl
=GetProcAddress32(hComctl32
,"InitCommonControlsEx");
1005 pImageList_Create
=GetProcAddress32(hComctl32
,"ImageList_Create");
1006 pImageList_AddIcon
=GetProcAddress32(hComctl32
,"ImageList_AddIcon");
1007 pImageList_ReplaceIcon
=GetProcAddress32(hComctl32
,"ImageList_ReplaceIcon");
1008 pImageList_GetIcon
=GetProcAddress32(hComctl32
,"ImageList_GetIcon");
1009 pImageList_GetImageCount
=GetProcAddress32(hComctl32
,"ImageList_GetImageCount");
1011 /* imports by ordinal, pray that it works*/
1012 pCOMCTL32_Alloc
=GetProcAddress32(hComctl32
, (LPCSTR
)71L);
1013 pCOMCTL32_Free
=GetProcAddress32(hComctl32
, (LPCSTR
)73L);
1014 pDPA_Create
=GetProcAddress32(hComctl32
, (LPCSTR
)328L);
1015 pDPA_Destroy
=GetProcAddress32(hComctl32
, (LPCSTR
)329L);
1016 pDPA_GetPtr
=GetProcAddress32(hComctl32
, (LPCSTR
)332L);
1017 pDPA_InsertPtr
=GetProcAddress32(hComctl32
, (LPCSTR
)334L);
1018 pDPA_Sort
=GetProcAddress32(hComctl32
, (LPCSTR
)338L);
1019 pDPA_Search
=GetProcAddress32(hComctl32
, (LPCSTR
)339L);
1021 FreeLibrary32(hComctl32
);
1024 { /* panic, imediately exit wine*/
1025 ERR(shell
,"P A N I C error getting functionpointers\n");
1029 bShell32IsInitialized
= TRUE
;