5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
10 #include "wine/winuser16.h"
16 #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( HWND 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
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
99 SHFILEINFOA
*psfi
, UINT 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 SHGetPathFromIDListA (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
);
125 psfi
->dwAttributes
= SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANLINK
;
127 psfi
->dwAttributes
= SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
128 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANRENAME
| SFGAO_CANLINK
;
130 psfi
->dwAttributes
= SFGAO_HASSUBFOLDER
| SFGAO_FOLDER
| SFGAO_CAPABILITYMASK
;
132 psfi
->dwAttributes
= SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_FILESYSANCESTOR
|
133 SFGAO_DROPTARGET
| SFGAO_HASPROPSHEET
| SFGAO_CANLINK
;
135 psfi
->dwAttributes
= SFGAO_HASSUBFOLDER
| SFGAO_FILESYSTEM
| SFGAO_FOLDER
| SFGAO_CAPABILITYMASK
;
137 psfi
->dwAttributes
= SFGAO_FILESYSTEM
| SFGAO_CAPABILITYMASK
;
142 { psfi
->dwAttributes
=SFGAO_FILESYSTEM
;
145 FIXME(shell
,"file attributes, stub\n");
148 if (flags
& SHGFI_DISPLAYNAME
)
149 { if (flags
& SHGFI_PIDL
)
150 { strcpy(psfi
->szDisplayName
,szTemp
);
153 { strcpy(psfi
->szDisplayName
,path
);
155 TRACE(shell
,"displayname=%s\n", psfi
->szDisplayName
);
159 if (flags
& SHGFI_TYPENAME
)
160 { FIXME(shell
,"get the file type, stub\n");
161 strcpy(psfi
->szTypeName
,"FIXME: Type");
165 if (flags
& SHGFI_ICONLOCATION
)
166 { FIXME(shell
,"location of icon, stub\n");
167 strcpy(psfi
->szDisplayName
,"");
171 if (flags
& SHGFI_EXETYPE
)
172 FIXME(shell
,"type of executable, stub\n");
174 if (flags
& SHGFI_LINKOVERLAY
)
175 FIXME(shell
,"set icon to link, stub\n");
177 if (flags
& SHGFI_OPENICON
)
178 FIXME(shell
,"set to open icon, stub\n");
180 if (flags
& SHGFI_SELECTED
)
181 FIXME(shell
,"set icon to selected, stub\n");
183 if (flags
& SHGFI_SHELLICONSIZE
)
184 FIXME(shell
,"set icon to shell size, stub\n");
186 if (flags
& SHGFI_USEFILEATTRIBUTES
)
187 FIXME(shell
,"use the dwFileAttributes, stub\n");
189 if (flags
& SHGFI_ICON
)
190 { FIXME(shell
,"icon handle\n");
191 if (flags
& SHGFI_SMALLICON
)
192 { TRACE(shell
,"set to small icon\n");
193 psfi
->hIcon
=pImageList_GetIcon(ShellSmallIconList
,32,ILD_NORMAL
);
194 ret
= (DWORD
) ShellSmallIconList
;
197 { TRACE(shell
,"set to big icon\n");
198 psfi
->hIcon
=pImageList_GetIcon(ShellBigIconList
,32,ILD_NORMAL
);
199 ret
= (DWORD
) ShellBigIconList
;
203 if (flags
& SHGFI_SYSICONINDEX
)
205 { pPidlTemp
= ILCreateFromPath (szTemp
);
207 psfi
->iIcon
= SHMapPIDLToSystemImageListIndex (NULL
, pPidlTemp
, 0);
208 TRACE(shell
,"-- SYSICONINDEX %i\n", psfi
->iIcon
);
210 if (flags
& SHGFI_SMALLICON
)
211 { TRACE(shell
,"set to small icon\n");
212 ret
= (DWORD
) ShellSmallIconList
;
215 { TRACE(shell
,"set to big icon\n");
216 ret
= (DWORD
) ShellBigIconList
;
223 /*************************************************************************
224 * SHGetFileInfo32W [SHELL32.255]
230 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
231 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
233 { FIXME(shell
,"(%s,0x%lx,%p,0x%x,0x%x)\n",
234 debugstr_w(path
),dwFileAttributes
,psfi
,sizeofpsfi
,flags
);
238 /*************************************************************************
239 * ExtractIcon32A (SHELL32.133)
241 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
243 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
247 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
248 HICON16 hIcon
= *ptr
;
250 GlobalFree16(handle
);
256 /*************************************************************************
257 * ExtractIcon32W (SHELL32.180)
259 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
265 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
266 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
268 HeapFree(GetProcessHeap(),0,exefn
);
272 /*************************************************************************
273 * FindExecutable32A (SHELL32.184)
275 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
277 { HINSTANCE retval
=31; /* default - 'No association was found' */
280 TRACE(shell
, "File %s, Dir %s\n",
281 (lpFile
!= NULL
?lpFile
:"-"),
282 (lpDirectory
!= NULL
?lpDirectory
:"-"));
284 lpResult
[0]='\0'; /* Start off with an empty return string */
286 /* trap NULL parameters on entry */
287 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
288 { /* FIXME - should throw a warning, perhaps! */
289 return 2; /* File not found. Close enough, I guess. */
293 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
294 SetCurrentDirectoryA( lpDirectory
);
297 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
299 TRACE(shell
, "returning %s\n", lpResult
);
301 SetCurrentDirectoryA( old_dir
);
305 /*************************************************************************
306 * FindExecutable32W (SHELL32.219)
308 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
311 FIXME(shell
, "(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
312 return 31; /* default - 'No association was found' */
321 #define IDC_STATIC_TEXT 100
322 #define IDC_LISTBOX 99
323 #define IDC_WINE_TEXT 98
325 #define DROP_FIELD_TOP (-15)
326 #define DROP_FIELD_HEIGHT 15
328 extern HICON hIconTitleFont
;
330 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
331 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
333 { GetWindowRect( hWndCtl
, lprect
);
334 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
335 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
341 /*************************************************************************
342 * SHAppBarMessage32 [SHELL32.207]
344 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
345 { FIXME(shell
,"(0x%08lx,%p): stub\n", msg
, data
);
349 case ABM_GETAUTOHIDEBAR
:
351 case ABM_GETTASKBARPOS
:
355 case ABM_SETAUTOHIDEBAR
:
357 case ABM_WINDOWPOSCHANGED
:
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
);
385 if (pdesktopfolder
) {
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
= IClassFactory_CreateInstance(lpclf
,NULL
,(REFIID
)&IID_IShellFolder
, (void*)&pdesktopfolder
);
393 IClassFactory_Release(lpclf
);
397 if (pdesktopfolder
) {
398 *shellfolder
= pdesktopfolder
;
399 pdesktopfolder
->lpvtbl
->fnAddRef(pdesktopfolder
);
404 TRACE(shell
,"-- %p->(%p)\n",shellfolder
, *shellfolder
);
408 /*************************************************************************
409 * SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
411 BOOL WINAPI
SHGetPathFromIDListAW(LPCITEMIDLIST pidl
,LPSTR pszPath
)
412 { TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
413 return SHGetPathFromIDListA(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(HWND hwndOwner
, INT 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
=RegCreateKeyExA(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 (RegQueryValueExA(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
545 { GetWindowsDirectoryA(npath
,MAX_PATH
);
546 PathAddBackslashA(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 CreateDirectoryA(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 CreateDirectoryA(npath
,NULL
);
593 strcat (npath
,"\\Startup");
595 case CSIDL_TEMPLATES
:
596 strcat (npath
,"Templates");
600 return E_OUTOFMEMORY
;
602 if (RegSetValueExA(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 CreateDirectoryA(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 LocalToWideChar(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 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
662 LPCSTR lpFile
, LPCSTR lpParameters
,
663 LPCSTR lpDirectory
, INT 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");
688 /*************************************************************************
689 * AboutDlgProc32 (not an exported API function)
691 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
694 char Template
[512], AppTitle
[512];
699 { case WM_INITDIALOG
:
700 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
702 { const char* const *pstr
= SHELL_People
;
703 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
704 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
705 sprintf( AppTitle
, Template
, info
->szApp
);
706 SetWindowTextA( hWnd
, AppTitle
);
707 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
708 info
->szOtherStuff
);
709 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
710 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
711 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
713 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
716 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
724 HDC hDC
= BeginPaint( hWnd
, &ps
);
726 if( __get_dropline( hWnd
, &rect
) ) {
727 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
728 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
729 LineTo( hDC
, rect
.right
, rect
.bottom
);
731 EndPaint( hWnd
, &ps
);
735 case WM_LBTRACKPOINT
:
736 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
737 if( (INT16
)GetKeyState16( VK_CONTROL
) < 0 )
738 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
739 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
741 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
742 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
743 char* pstr
= (char*)GlobalLock16( hMemObj
);
746 { HCURSOR16 hCursor
= LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT
) );
747 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
748 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
749 UpdateWindow( hWndCtl
);
750 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
751 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
754 GlobalFree16( hMemObj
);
760 case WM_QUERYDROPOBJECT
:
762 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
763 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
765 if( __get_dropline( hWnd
, &rect
) )
767 pt
.x
=lpDragInfo
->pt
.x
;
768 pt
.x
=lpDragInfo
->pt
.y
;
769 rect
.bottom
+= DROP_FIELD_HEIGHT
;
770 if( PtInRect( &rect
, pt
) )
771 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
781 { LPDRAGINFO lpDragInfo
= (LPDRAGINFO
)PTR_SEG_TO_LIN((SEGPTR
)lParam
);
782 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
783 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
785 { static char __appendix_str
[] = " with";
787 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
788 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
789 if( !lstrncmpA( Template
, "WINE", 4 ) )
790 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
792 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
794 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
795 (WPARAM
)-1, (LPARAM
)Template
);
798 lstrcpyA( Template
, pstr
);
799 lstrcatA( Template
, __appendix_str
);
800 SetWindowTextA( hWndCtl
, Template
);
801 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
810 { EndDialog(hWnd
, TRUE
);
819 /*************************************************************************
820 * ShellAbout32A (SHELL32.243)
822 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
827 info
.szOtherStuff
= szOtherStuff
;
829 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
830 return DialogBoxIndirectParamA( WIN_GetWindowInstance( hWnd
),
831 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
832 hWnd
, AboutDlgProc
, (LPARAM
)&info
);
836 /*************************************************************************
837 * ShellAbout32W (SHELL32.244)
839 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
846 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
847 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
849 if (!hIcon
) info
.hIcon
= LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON
) );
850 ret
= DialogBoxIndirectParamA( WIN_GetWindowInstance( hWnd
),
851 SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX
),
852 hWnd
, AboutDlgProc
, (LPARAM
)&info
);
853 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
854 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
858 /*************************************************************************
859 * Shell_NotifyIcon [SHELL32.296]
861 * This function is supposed to deal with the systray.
862 * Any ideas on how this is to be implimented?
864 BOOL WINAPI
Shell_NotifyIcon( DWORD dwMessage
, PNOTIFYICONDATA pnid
)
869 /*************************************************************************
870 * Shell_NotifyIcon [SHELL32.297]
872 * This function is supposed to deal with the systray.
873 * Any ideas on how this is to be implimented?
875 BOOL WINAPI
Shell_NotifyIconA(DWORD dwMessage
, PNOTIFYICONDATA pnid
)
880 /*************************************************************************
883 void WINAPI
FreeIconList( DWORD dw
)
884 { FIXME(shell
, "(%lx): stub\n",dw
);
887 /*************************************************************************
888 * SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
895 * path from a passed PIDL.
901 * fnGetDisplayNameOf can return different types of OLEString
903 DWORD WINAPI
SHGetPathFromIDListA (LPCITEMIDLIST pidl
,LPSTR pszPath
)
905 LPSHELLFOLDER shellfolder
;
906 CHAR buffer
[MAX_PATH
],tpath
[MAX_PATH
];
907 DWORD type
,tpathlen
=MAX_PATH
,dwdisp
;
910 TRACE(shell
,"(pidl=%p,%p)\n",pidl
,pszPath
);
913 { strcpy(buffer
,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
915 if (RegCreateKeyExA(HKEY_CURRENT_USER
,buffer
,0,NULL
,REG_OPTION_NON_VOLATILE
,KEY_WRITE
,NULL
,&key
,&dwdisp
))
916 { return E_OUTOFMEMORY
;
919 strcpy (buffer
,"Desktop"); /*registry name*/
920 if ( RegQueryValueExA(key
,buffer
,NULL
,&type
,(LPBYTE
)tpath
,&tpathlen
))
921 { GetWindowsDirectoryA(tpath
,MAX_PATH
);
922 PathAddBackslashA(tpath
);
923 strcat (tpath
,"Desktop"); /*folder name*/
924 RegSetValueExA(key
,buffer
,0,REG_SZ
,(LPBYTE
)tpath
,tpathlen
);
925 CreateDirectoryA(tpath
,NULL
);
928 strcpy(pszPath
,tpath
);
931 { if (SHGetDesktopFolder(&shellfolder
)==S_OK
)
932 { shellfolder
->lpvtbl
->fnGetDisplayNameOf(shellfolder
,pidl
,SHGDN_FORPARSING
,&lpName
);
933 shellfolder
->lpvtbl
->fnRelease(shellfolder
);
935 /*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
936 strcpy(pszPath
,lpName
.u
.cStr
);
937 /* fixme free the olestring*/
939 TRACE(shell
,"-- (%s)\n",pszPath
);
942 /*************************************************************************
943 * SHGetPathFromIDList32W [SHELL32.262]
945 DWORD WINAPI
SHGetPathFromIDListW (LPCITEMIDLIST pidl
,LPWSTR pszPath
)
946 { char sTemp
[MAX_PATH
];
948 TRACE (shell
,"(pidl=%p)\n", pidl
);
950 SHGetPathFromIDListA (pidl
, sTemp
);
951 lstrcpyAtoW(pszPath
, sTemp
);
953 TRACE(shell
,"-- (%s)\n",debugstr_w(pszPath
));
958 /*************************************************************************
959 * global variables of the shell32.dll
962 void (WINAPI
* pDLLInitComctl
)(LPVOID
);
963 INT (WINAPI
* pImageList_AddIcon
) (HIMAGELIST himl
, HICON hIcon
);
964 INT (WINAPI
* pImageList_ReplaceIcon
) (HIMAGELIST
, INT
, HICON
);
965 HIMAGELIST (WINAPI
* pImageList_Create
) (INT
,INT
,UINT
,INT
,INT
);
966 HICON (WINAPI
* pImageList_GetIcon
) (HIMAGELIST
, INT
, UINT
);
967 INT (WINAPI
* pImageList_GetImageCount
)(HIMAGELIST
);
969 LPVOID (WINAPI
* pCOMCTL32_Alloc
) (INT
);
970 BOOL (WINAPI
* pCOMCTL32_Free
) (LPVOID
);
972 HDPA (WINAPI
* pDPA_Create
) (INT
);
973 INT (WINAPI
* pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
974 BOOL (WINAPI
* pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
975 LPVOID (WINAPI
* pDPA_GetPtr
) (const HDPA
, INT
);
976 BOOL (WINAPI
* pDPA_Destroy
) (const HDPA
);
977 INT (WINAPI
*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
980 HICON (WINAPI
*pLookupIconIdFromDirectoryEx
)(LPBYTE dir
, BOOL bIcon
, INT width
, INT height
, UINT cFlag
);
981 HICON (WINAPI
*pCreateIconFromResourceEx
)(LPBYTE bits
,UINT cbSize
, BOOL bIcon
, DWORD dwVersion
, INT width
, INT height
,UINT cFlag
);
983 static BOOL bShell32IsInitialized
= 0;
984 static HINSTANCE hComctl32
;
985 static INT shell32_RefCount
= 0;
987 INT shell32_ObjCount
= 0;
988 HINSTANCE shell32_hInstance
;
989 /*************************************************************************
994 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
997 TRACE(shell
,"0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
999 shell32_hInstance
= hinstDLL
;
1002 { case DLL_PROCESS_ATTACH
:
1003 if (!bShell32IsInitialized
)
1004 { hComctl32
= LoadLibraryA("COMCTL32.DLL");
1005 hUser32
= GetModuleHandleA("USER32");
1006 if (hComctl32
&& hUser32
)
1007 { pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
1009 { pDLLInitComctl(NULL
);
1011 pImageList_Create
=(void*)GetProcAddress(hComctl32
,"ImageList_Create");
1012 pImageList_AddIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_AddIcon");
1013 pImageList_ReplaceIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_ReplaceIcon");
1014 pImageList_GetIcon
=(void*)GetProcAddress(hComctl32
,"ImageList_GetIcon");
1015 pImageList_GetImageCount
=(void*)GetProcAddress(hComctl32
,"ImageList_GetImageCount");
1017 /* imports by ordinal, pray that it works*/
1018 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
1019 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
1020 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
1021 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
1022 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
1023 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
1024 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
1025 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
1027 pLookupIconIdFromDirectoryEx
=(void*)GetProcAddress(hUser32
,"LookupIconIdFromDirectoryEx");
1028 pCreateIconFromResourceEx
=(void*)GetProcAddress(hUser32
,"CreateIconFromResourceEx");
1031 { ERR(shell
,"P A N I C SHELL32 loading failed\n");
1035 bShell32IsInitialized
= TRUE
;
1040 case DLL_THREAD_ATTACH
:
1044 case DLL_THREAD_DETACH
:
1048 case DLL_PROCESS_DETACH
:
1050 if ( !shell32_RefCount
)
1051 { FreeLibrary(hComctl32
);
1052 bShell32IsInitialized
= FALSE
;
1055 { pdesktopfolder
->lpvtbl
->fnRelease(pdesktopfolder
);
1058 /* this one is here ot check if AddRef/Release is balanced */
1059 if (shell32_ObjCount
)
1060 { FIXME(shell
,"%u objects left\n", shell32_ObjCount
);
1063 TRACE(shell
, "refcount=%u objcount=%u \n", shell32_RefCount
, shell32_ObjCount
);