5 * 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
23 #include "undocshell.h"
24 #include "wine/winuser16.h"
28 #include "shell32_main.h"
30 #include "debugtools.h"
32 DEFAULT_DEBUG_CHANNEL(shell
);
35 /*************************************************************************
36 * CommandLineToArgvW [SHELL32.@]
38 * We must interpret the quotes in the command line to rebuild the argv
40 * - arguments are separated by spaces or tabs
41 * - quotes serve as optional argument delimiters
43 * - escaped quotes must be converted back to '"'
45 * - an odd number of '\'s followed by '"' correspond to half that number
46 * of '\' followed by a '"' (extension of the above)
49 * - an even number of '\'s followed by a '"' correspond to half that number
50 * of '\', plus a regular quote serving as an argument delimiter (which
51 * means it does not appear in the result)
52 * 'a\\"b c"' -> 'a\b c'
53 * 'a\\\\"b c"' -> 'a\\b c'
54 * - '\' that are not followed by a '"' are copied literally
64 LPWSTR
* WINAPI
CommandLineToArgvW(LPCWSTR lpCmdline
, int* numargs
)
72 /* FIXME: same thing if we only have spaces */
74 /* Return the path to the executable */
77 argv
=HeapAlloc(GetProcessHeap(), 0, 2*sizeof(LPWSTR
));
82 argv
[0]=HeapReAlloc(GetProcessHeap(), 0, argv
[0], size
);
83 } while (GetModuleFileNameW((HMODULE
)0, argv
[0], size
) == 0);
91 /* to get a writeable copy */
92 cmdline
= HeapAlloc(GetProcessHeap(), 0, (strlenW(lpCmdline
)+1) * sizeof(WCHAR
));
95 strcpyW(cmdline
, lpCmdline
);
101 if (*s
==0 || ((*s
==0x0009 || *s
==0x0020) && !in_quotes
)) {
104 /* skip the remaining spaces */
105 while (*s
==0x0009 || *s
==0x0020) {
112 } else if (*s
==0x005c) {
113 /* '\', count them */
115 } else if ((*s
==0x0022) && ((bcount
& 1)==0)) {
117 in_quotes
=!in_quotes
;
120 /* a regular character */
125 argv
=HeapAlloc(GetProcessHeap(), 0, (argc
+1)*sizeof(LPWSTR
));
132 if ((*s
==0x0009 || *s
==0x0020) && !in_quotes
) {
133 /* Close the argument and copy it */
137 /* skip the remaining spaces */
140 } while (*s
==0x0009 || *s
==0x0020);
142 /* Start with a new argument */
145 } else if (*s
==0x005c) {
149 } else if (*s
==0x0022) {
151 if ((bcount
& 1)==0) {
152 /* Preceeded by an even number of '\', this is half that
153 * number of '\', plus a quote which we erase.
156 in_quotes
=!in_quotes
;
159 /* Preceeded by an odd number of '\', this is half that
160 * number of '\' followed by a '"'
168 /* a regular character */
181 HeapFree(GetProcessHeap(), 0, cmdline
);
185 /*************************************************************************
186 * SHGetFileInfoA [SHELL32.@]
190 DWORD WINAPI
SHGetFileInfoA(LPCSTR path
,DWORD dwFileAttributes
,
191 SHFILEINFOA
*psfi
, UINT sizeofpsfi
,
194 char szLoaction
[MAX_PATH
];
196 DWORD ret
= TRUE
, dwAttributes
= 0;
197 IShellFolder
* psfParent
= NULL
;
198 IExtractIconA
* pei
= NULL
;
199 LPITEMIDLIST pidlLast
= NULL
, pidl
= NULL
;
202 TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
203 (flags
& SHGFI_PIDL
)? "pidl" : path
, dwFileAttributes
, psfi
, psfi
->dwAttributes
, sizeofpsfi
, flags
);
205 if ((flags
& SHGFI_USEFILEATTRIBUTES
) && (flags
& (SHGFI_ATTRIBUTES
|SHGFI_EXETYPE
|SHGFI_PIDL
)))
208 /* windows initializes this values regardless of the flags */
209 psfi
->szDisplayName
[0] = '\0';
210 psfi
->szTypeName
[0] = '\0';
213 if (flags
& SHGFI_EXETYPE
) {
217 IMAGE_DOS_HEADER mz_header
;
222 if (flags
!= SHGFI_EXETYPE
) return 0;
224 status
= GetBinaryTypeA (path
, &BinaryType
);
225 if (!status
) return 0;
226 if ((BinaryType
== SCS_DOS_BINARY
)
227 || (BinaryType
== SCS_PIF_BINARY
)) return 0x4d5a;
229 hfile
= CreateFileA( path
, GENERIC_READ
, FILE_SHARE_READ
,
230 NULL
, OPEN_EXISTING
, 0, 0 );
231 if ( hfile
== INVALID_HANDLE_VALUE
) return 0;
233 /* The next section is adapted from MODULE_GetBinaryType, as we need
234 * to examine the image header to get OS and version information. We
235 * know from calling GetBinaryTypeA that the image is valid and either
236 * an NE or PE, so much error handling can be omitted.
237 * Seek to the start of the file and read the header information.
240 SetFilePointer( hfile
, 0, NULL
, SEEK_SET
);
241 ReadFile( hfile
, &mz_header
, sizeof(mz_header
), &len
, NULL
);
243 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
244 ReadFile( hfile
, magic
, sizeof(magic
), &len
, NULL
);
245 if ( *(DWORD
*)magic
== IMAGE_NT_SIGNATURE
)
247 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
248 ReadFile( hfile
, &nt
, sizeof(nt
), &len
, NULL
);
249 CloseHandle( hfile
);
250 if (nt
.OptionalHeader
.Subsystem
== IMAGE_SUBSYSTEM_WINDOWS_GUI
) {
251 return IMAGE_NT_SIGNATURE
252 | (nt
.OptionalHeader
.MajorSubsystemVersion
<< 24)
253 | (nt
.OptionalHeader
.MinorSubsystemVersion
<< 16);
255 return IMAGE_NT_SIGNATURE
;
257 else if ( *(WORD
*)magic
== IMAGE_OS2_SIGNATURE
)
260 SetFilePointer( hfile
, mz_header
.e_lfanew
, NULL
, SEEK_SET
);
261 ReadFile( hfile
, &ne
, sizeof(ne
), &len
, NULL
);
262 CloseHandle( hfile
);
263 if (ne
.ne_exetyp
== 2) return IMAGE_OS2_SIGNATURE
264 | (ne
.ne_expver
<< 16);
267 CloseHandle( hfile
);
272 /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
273 the pidl functions fail on not existing file names */
274 if (flags
& SHGFI_PIDL
)
276 pidl
= (LPCITEMIDLIST
) path
;
279 ERR("pidl is null!\n");
283 else if (!(flags
& SHGFI_USEFILEATTRIBUTES
))
285 hr
= SHILCreateFromPathA ( path
, &pidl
, &dwAttributes
);
286 /* note: the attributes in ISF::ParseDisplayName are not implemented */
289 /* get the parent shellfolder */
292 hr
= SHBindToParent( pidl
, &IID_IShellFolder
, (LPVOID
*)&psfParent
, &pidlLast
);
295 /* get the attributes of the child */
296 if (SUCCEEDED(hr
) && (flags
& SHGFI_ATTRIBUTES
))
298 if (!(flags
& SHGFI_ATTR_SPECIFIED
))
300 psfi
->dwAttributes
= 0xffffffff;
302 IShellFolder_GetAttributesOf(psfParent
, 1 , &pidlLast
, &(psfi
->dwAttributes
));
305 /* get the displayname */
306 if (SUCCEEDED(hr
) && (flags
& SHGFI_DISPLAYNAME
))
308 if (flags
& SHGFI_USEFILEATTRIBUTES
)
310 strcpy (psfi
->szDisplayName
, PathFindFileNameA(path
));
315 hr
= IShellFolder_GetDisplayNameOf(psfParent
, pidlLast
, SHGDN_INFOLDER
, &str
);
316 StrRetToStrNA (psfi
->szDisplayName
, MAX_PATH
, &str
, pidlLast
);
320 /* get the type name */
321 if (SUCCEEDED(hr
) && (flags
& SHGFI_TYPENAME
))
323 _ILGetFileType(pidlLast
, psfi
->szTypeName
, 80);
327 if (flags
& SHGFI_LINKOVERLAY
)
328 FIXME("set icon to link, stub\n");
330 if (flags
& SHGFI_SELECTED
)
331 FIXME("set icon to selected, stub\n");
333 if (flags
& SHGFI_SHELLICONSIZE
)
334 FIXME("set icon to shell size, stub\n");
336 /* get the iconlocation */
337 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICONLOCATION
))
340 hr
= IShellFolder_GetUIObjectOf(psfParent
, 0, 1, &pidlLast
, &IID_IExtractIconA
, &uDummy
, (LPVOID
*)&pei
);
344 hr
= IExtractIconA_GetIconLocation(pei
, (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0,szLoaction
, MAX_PATH
, &iIndex
, &uFlags
);
345 /* fixme what to do with the index? */
347 if(uFlags
!= GIL_NOTFILENAME
)
348 strcpy (psfi
->szDisplayName
, szLoaction
);
352 IExtractIconA_Release(pei
);
356 /* get icon index (or load icon)*/
357 if (SUCCEEDED(hr
) && (flags
& (SHGFI_ICON
| SHGFI_SYSICONINDEX
)))
359 if (flags
& SHGFI_USEFILEATTRIBUTES
)
361 char sTemp
[MAX_PATH
];
365 lstrcpynA(sTemp
, path
, MAX_PATH
);
366 szExt
= (LPSTR
) PathFindExtensionA(sTemp
);
367 if( szExt
&& HCR_MapTypeToValue(szExt
, sTemp
, MAX_PATH
, TRUE
)
368 && HCR_GetDefaultIcon(sTemp
, sTemp
, MAX_PATH
, &dwNr
))
370 if (!strcmp("%1",sTemp
)) /* icon is in the file */
374 /* FIXME: if sTemp contains a valid filename, get the icon
375 from there, index is in dwNr
379 else /* default icon */
386 if (!(PidlToSicIndex(psfParent
, pidlLast
, (flags
& SHGFI_LARGEICON
),
387 (flags
& SHGFI_OPENICON
)? GIL_OPENICON
: 0, &(psfi
->iIcon
))))
394 ret
= (DWORD
) ((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
: ShellSmallIconList
);
399 if (SUCCEEDED(hr
) && (flags
& SHGFI_ICON
))
400 psfi
->hIcon
= ImageList_GetIcon((flags
& SHGFI_LARGEICON
) ? ShellBigIconList
:ShellSmallIconList
, psfi
->iIcon
, ILD_NORMAL
);
402 if (flags
& (SHGFI_UNKNOWN1
| SHGFI_UNKNOWN2
| SHGFI_UNKNOWN3
))
403 FIXME("unknown attribute!\n");
406 IShellFolder_Release(psfParent
);
411 if(pidlLast
) SHFree(pidlLast
);
413 TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
414 psfi
->hIcon
, psfi
->iIcon
, psfi
->dwAttributes
, psfi
->szDisplayName
, psfi
->szTypeName
, ret
);
419 /*************************************************************************
420 * SHGetFileInfoW [SHELL32.@]
423 DWORD WINAPI
SHGetFileInfoW(LPCWSTR path
,DWORD dwFileAttributes
,
424 SHFILEINFOW
*psfi
, UINT sizeofpsfi
,
430 SHFILEINFOA temppsfi
;
432 len
= WideCharToMultiByte(CP_ACP
, 0, path
, -1, NULL
, 0, NULL
, NULL
);
433 temppath
= HeapAlloc(GetProcessHeap(), 0, len
);
434 WideCharToMultiByte(CP_ACP
, 0, path
, -1, temppath
, len
, NULL
, NULL
);
436 WideCharToMultiByte(CP_ACP
, 0, psfi
->szDisplayName
, -1, temppsfi
.szDisplayName
,
437 sizeof(temppsfi
.szDisplayName
), NULL
, NULL
);
438 WideCharToMultiByte(CP_ACP
, 0, psfi
->szTypeName
, -1, temppsfi
.szTypeName
,
439 sizeof(temppsfi
.szTypeName
), NULL
, NULL
);
441 ret
= SHGetFileInfoA(temppath
, dwFileAttributes
, &temppsfi
, sizeof(temppsfi
), flags
);
443 HeapFree(GetProcessHeap(), 0, temppath
);
448 /*************************************************************************
449 * SHGetFileInfo [SHELL32.@]
451 DWORD WINAPI
SHGetFileInfoAW(
453 DWORD dwFileAttributes
,
458 if(SHELL_OsIsUnicode())
459 return SHGetFileInfoW(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
460 return SHGetFileInfoA(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
463 /*************************************************************************
464 * DuplicateIcon [SHELL32.@]
466 HICON WINAPI
DuplicateIcon( HINSTANCE hInstance
, HICON hIcon
)
471 TRACE("(%04x, %04x)\n", hInstance
, hIcon
);
473 if(GetIconInfo(hIcon
, &IconInfo
))
475 hDupIcon
= CreateIconIndirect(&IconInfo
);
477 /* clean up hbmMask and hbmColor */
478 DeleteObject(IconInfo
.hbmMask
);
479 DeleteObject(IconInfo
.hbmColor
);
486 /*************************************************************************
487 * ExtractIconA [SHELL32.@]
490 * if the filename is not a file return 1
492 HICON WINAPI
ExtractIconA( HINSTANCE hInstance
, LPCSTR lpszExeFileName
,
494 { HGLOBAL16 handle
= InternalExtractIcon16(hInstance
,lpszExeFileName
,nIconIndex
, 1);
498 HICON16
* ptr
= (HICON16
*)GlobalLock16(handle
);
499 HICON16 hIcon
= *ptr
;
501 GlobalFree16(handle
);
507 /*************************************************************************
508 * ExtractIconW [SHELL32.@]
511 * is the filename is not a file return 1
513 HICON WINAPI
ExtractIconW( HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
519 exefn
= HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName
);
520 ret
= ExtractIconA(hInstance
,exefn
,nIconIndex
);
522 HeapFree(GetProcessHeap(),0,exefn
);
526 /*************************************************************************
527 * FindExecutableA [SHELL32.@]
529 HINSTANCE WINAPI
FindExecutableA( LPCSTR lpFile
, LPCSTR lpDirectory
,
532 HINSTANCE retval
=31; /* default - 'No association was found' */
535 TRACE("File %s, Dir %s\n",
536 (lpFile
!= NULL
?lpFile
:"-"),
537 (lpDirectory
!= NULL
?lpDirectory
:"-"));
539 lpResult
[0]='\0'; /* Start off with an empty return string */
541 /* trap NULL parameters on entry */
542 if (( lpFile
== NULL
) || ( lpResult
== NULL
))
543 { /* FIXME - should throw a warning, perhaps! */
544 return 2; /* File not found. Close enough, I guess. */
548 { GetCurrentDirectoryA( sizeof(old_dir
), old_dir
);
549 SetCurrentDirectoryA( lpDirectory
);
552 retval
= SHELL_FindExecutable( lpFile
, "open", lpResult
);
554 TRACE("returning %s\n", lpResult
);
556 SetCurrentDirectoryA( old_dir
);
560 /*************************************************************************
561 * FindExecutableW [SHELL32.@]
563 HINSTANCE WINAPI
FindExecutableW(LPCWSTR lpFile
, LPCWSTR lpDirectory
,
566 FIXME("(%p,%p,%p): stub\n", lpFile
, lpDirectory
, lpResult
);
567 return 31; /* default - 'No association was found' */
576 #define IDC_STATIC_TEXT 100
577 #define IDC_LISTBOX 99
578 #define IDC_WINE_TEXT 98
580 #define DROP_FIELD_TOP (-15)
581 #define DROP_FIELD_HEIGHT 15
583 static HICON hIconTitleFont
;
585 static BOOL
__get_dropline( HWND hWnd
, LPRECT lprect
)
586 { HWND hWndCtl
= GetDlgItem(hWnd
, IDC_WINE_TEXT
);
588 { GetWindowRect( hWndCtl
, lprect
);
589 MapWindowPoints( 0, hWnd
, (LPPOINT
)lprect
, 2 );
590 lprect
->bottom
= (lprect
->top
+= DROP_FIELD_TOP
);
596 /*************************************************************************
597 * SHAppBarMessage [SHELL32.@]
599 UINT WINAPI
SHAppBarMessage(DWORD msg
, PAPPBARDATA data
)
601 int width
=data
->rc
.right
- data
->rc
.left
;
602 int height
=data
->rc
.bottom
- data
->rc
.top
;
606 return ABS_ALWAYSONTOP
| ABS_AUTOHIDE
;
607 case ABM_GETTASKBARPOS
:
608 GetWindowRect(data
->hWnd
, &rec
);
612 SetActiveWindow(data
->hWnd
);
614 case ABM_GETAUTOHIDEBAR
:
615 data
->hWnd
=GetActiveWindow();
618 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
619 width
,height
,SWP_SHOWWINDOW
);
622 GetWindowRect(data
->hWnd
, &(data
->rc
));
625 FIXME("ABM_REMOVE broken\n");
626 /* FIXME: this is wrong; should it be DestroyWindow instead? */
627 /*CloseHandle(data->hWnd);*/
629 case ABM_SETAUTOHIDEBAR
:
630 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
+1000,rec
.top
,
631 width
,height
,SWP_SHOWWINDOW
);
634 data
->uEdge
=(ABE_RIGHT
| ABE_LEFT
);
635 SetWindowPos(data
->hWnd
,HWND_TOP
,data
->rc
.left
,data
->rc
.top
,
636 width
,height
,SWP_SHOWWINDOW
);
638 case ABM_WINDOWPOSCHANGED
:
639 SetWindowPos(data
->hWnd
,HWND_TOP
,rec
.left
,rec
.top
,
640 width
,height
,SWP_SHOWWINDOW
);
646 /*************************************************************************
647 * SHHelpShortcuts_RunDLL [SHELL32.@]
650 DWORD WINAPI
SHHelpShortcuts_RunDLL (DWORD dwArg1
, DWORD dwArg2
, DWORD dwArg3
, DWORD dwArg4
)
651 { FIXME("(%lx, %lx, %lx, %lx) empty stub!\n",
652 dwArg1
, dwArg2
, dwArg3
, dwArg4
);
657 /*************************************************************************
658 * SHLoadInProc [SHELL32.@]
659 * Create an instance of specified object class from within
660 * the shell process and release it immediately
663 DWORD WINAPI
SHLoadInProc (REFCLSID rclsid
)
665 IUnknown
* pUnk
= NULL
;
666 TRACE("%s\n", debugstr_guid(rclsid
));
668 CoCreateInstance(rclsid
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IUnknown
,(LPVOID
*)pUnk
);
671 IUnknown_Release(pUnk
);
674 return DISP_E_MEMBERNOTFOUND
;
677 /*************************************************************************
678 * ShellExecuteA [SHELL32.290]
680 HINSTANCE WINAPI
ShellExecuteA( HWND hWnd
, LPCSTR lpOperation
,
681 LPCSTR lpFile
, LPCSTR lpParameters
,
682 LPCSTR lpDirectory
, INT iShowCmd
)
684 return ShellExecute16( hWnd
, lpOperation
, lpFile
, lpParameters
,
685 lpDirectory
, iShowCmd
);
688 /*************************************************************************
689 * ShellExecuteW [SHELL32.294]
691 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
692 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
699 LPCWSTR lpParameters
,
707 /*************************************************************************
708 * AboutDlgProc (internal)
710 BOOL WINAPI
AboutDlgProc( HWND hWnd
, UINT msg
, WPARAM wParam
,
713 char Template
[512], AppTitle
[512];
718 { case WM_INITDIALOG
:
719 { ABOUT_INFO
*info
= (ABOUT_INFO
*)lParam
;
721 { const char* const *pstr
= SHELL_People
;
722 SendDlgItemMessageA(hWnd
, stc1
, STM_SETICON
,info
->hIcon
, 0);
723 GetWindowTextA( hWnd
, Template
, sizeof(Template
) );
724 sprintf( AppTitle
, Template
, info
->szApp
);
725 SetWindowTextA( hWnd
, AppTitle
);
726 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
),
727 info
->szOtherStuff
);
728 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
729 SendMessageA( hWndCtl
, WM_SETREDRAW
, 0, 0 );
733 SystemParametersInfoA( SPI_GETICONTITLELOGFONT
, 0, &logFont
, 0 );
734 hIconTitleFont
= CreateFontIndirectA( &logFont
);
736 SendMessageA( hWndCtl
, WM_SETFONT
, hIconTitleFont
, 0 );
738 { SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)*pstr
);
741 SendMessageA( hWndCtl
, WM_SETREDRAW
, 1, 0 );
749 HDC hDC
= BeginPaint( hWnd
, &ps
);
751 if( __get_dropline( hWnd
, &rect
) ) {
752 SelectObject( hDC
, GetStockObject( BLACK_PEN
) );
753 MoveToEx( hDC
, rect
.left
, rect
.top
, NULL
);
754 LineTo( hDC
, rect
.right
, rect
.bottom
);
756 EndPaint( hWnd
, &ps
);
760 #if 0 /* FIXME: should use DoDragDrop */
761 case WM_LBTRACKPOINT
:
762 hWndCtl
= GetDlgItem(hWnd
, IDC_LISTBOX
);
763 if( (INT16
)GetKeyState( VK_CONTROL
) < 0 )
764 { if( DragDetect( hWndCtl
, *((LPPOINT
)&lParam
) ) )
765 { INT idx
= SendMessageA( hWndCtl
, LB_GETCURSEL
, 0, 0 );
767 { INT length
= SendMessageA( hWndCtl
, LB_GETTEXTLEN
, (WPARAM
)idx
, 0 );
768 HGLOBAL16 hMemObj
= GlobalAlloc16( GMEM_MOVEABLE
, length
+ 1 );
769 char* pstr
= (char*)GlobalLock16( hMemObj
);
772 { HCURSOR hCursor
= LoadCursorA( 0, MAKEINTRESOURCEA(OCR_DRAGOBJECT
) );
773 SendMessageA( hWndCtl
, LB_GETTEXT
, (WPARAM
)idx
, (LPARAM
)pstr
);
774 SendMessageA( hWndCtl
, LB_DELETESTRING
, (WPARAM
)idx
, 0 );
775 UpdateWindow( hWndCtl
);
776 if( !DragObject16((HWND16
)hWnd
, (HWND16
)hWnd
, DRAGOBJ_DATA
, 0, (WORD
)hMemObj
, hCursor
) )
777 SendMessageA( hWndCtl
, LB_ADDSTRING
, (WPARAM
)-1, (LPARAM
)pstr
);
780 GlobalFree16( hMemObj
);
787 case WM_QUERYDROPOBJECT
:
789 { LPDRAGINFO16 lpDragInfo
= MapSL((SEGPTR
)lParam
);
790 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
)
792 if( __get_dropline( hWnd
, &rect
) )
794 pt
.x
=lpDragInfo
->pt
.x
;
795 pt
.x
=lpDragInfo
->pt
.y
;
796 rect
.bottom
+= DROP_FIELD_HEIGHT
;
797 if( PtInRect( &rect
, pt
) )
798 { SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
808 { LPDRAGINFO16 lpDragInfo
= MapSL((SEGPTR
)lParam
);
809 if( lpDragInfo
&& lpDragInfo
->wFlags
== DRAGOBJ_DATA
&& lpDragInfo
->hList
)
810 { char* pstr
= (char*)GlobalLock16( (HGLOBAL16
)(lpDragInfo
->hList
) );
812 { static char __appendix_str
[] = " with";
814 hWndCtl
= GetDlgItem( hWnd
, IDC_WINE_TEXT
);
815 SendMessageA( hWndCtl
, WM_GETTEXT
, 512, (LPARAM
)Template
);
816 if( !strncmp( Template
, "WINE", 4 ) )
817 SetWindowTextA( GetDlgItem(hWnd
, IDC_STATIC_TEXT
), Template
);
819 { char* pch
= Template
+ strlen(Template
) - strlen(__appendix_str
);
821 SendMessageA( GetDlgItem(hWnd
, IDC_LISTBOX
), LB_ADDSTRING
,
822 (WPARAM
)-1, (LPARAM
)Template
);
825 strcpy( Template
, pstr
);
826 strcat( Template
, __appendix_str
);
827 SetWindowTextA( hWndCtl
, Template
);
828 SetWindowLongA( hWnd
, DWL_MSGRESULT
, 1 );
837 { EndDialog(hWnd
, TRUE
);
842 EndDialog(hWnd
, TRUE
);
850 /*************************************************************************
851 * ShellAboutA [SHELL32.288]
853 BOOL WINAPI
ShellAboutA( HWND hWnd
, LPCSTR szApp
, LPCSTR szOtherStuff
,
860 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
862 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
866 info
.szOtherStuff
= szOtherStuff
;
868 if (!hIcon
) info
.hIcon
= LoadIconA( 0, IDI_WINLOGOA
);
869 return DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
870 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
874 /*************************************************************************
875 * ShellAboutW [SHELL32.289]
877 BOOL WINAPI
ShellAboutW( HWND hWnd
, LPCWSTR szApp
, LPCWSTR szOtherStuff
,
886 if(!(hRes
= FindResourceA(shell32_hInstance
, "SHELL_ABOUT_MSGBOX", RT_DIALOGA
)))
888 if(!(template = (LPVOID
)LoadResource(shell32_hInstance
, hRes
)))
891 info
.szApp
= HEAP_strdupWtoA( GetProcessHeap(), 0, szApp
);
892 info
.szOtherStuff
= HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff
);
894 if (!hIcon
) info
.hIcon
= LoadIconA( 0, IDI_WINLOGOA
);
895 ret
= DialogBoxIndirectParamA( GetWindowLongA( hWnd
, GWL_HINSTANCE
),
896 template, hWnd
, AboutDlgProc
, (LPARAM
)&info
);
897 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szApp
);
898 HeapFree( GetProcessHeap(), 0, (LPSTR
)info
.szOtherStuff
);
902 /*************************************************************************
903 * FreeIconList (SHELL32.@)
905 void WINAPI
FreeIconList( DWORD dw
)
906 { FIXME("(%lx): stub\n",dw
);
909 /***********************************************************************
910 * DllGetVersion [SHELL32.@]
912 * Retrieves version information of the 'SHELL32.DLL'
915 * pdvi [O] pointer to version information structure.
919 * Failure: E_INVALIDARG
922 * Returns version of a shell32.dll from IE4.01 SP1.
925 HRESULT WINAPI
SHELL32_DllGetVersion (DLLVERSIONINFO
*pdvi
)
927 if (pdvi
->cbSize
!= sizeof(DLLVERSIONINFO
))
929 WARN("wrong DLLVERSIONINFO size from app\n");
933 pdvi
->dwMajorVersion
= 4;
934 pdvi
->dwMinorVersion
= 72;
935 pdvi
->dwBuildNumber
= 3110;
936 pdvi
->dwPlatformID
= 1;
938 TRACE("%lu.%lu.%lu.%lu\n",
939 pdvi
->dwMajorVersion
, pdvi
->dwMinorVersion
,
940 pdvi
->dwBuildNumber
, pdvi
->dwPlatformID
);
944 /*************************************************************************
945 * global variables of the shell32.dll
946 * all are once per process
949 void WINAPI (*pDLLInitComctl
)(LPVOID
);
951 LPVOID
WINAPI (*pCOMCTL32_Alloc
) (INT
);
952 BOOL
WINAPI (*pCOMCTL32_Free
) (LPVOID
);
954 HDPA
WINAPI (*pDPA_Create
) (INT
);
955 INT
WINAPI (*pDPA_InsertPtr
) (const HDPA
, INT
, LPVOID
);
956 BOOL
WINAPI (*pDPA_Sort
) (const HDPA
, PFNDPACOMPARE
, LPARAM
);
957 LPVOID
WINAPI (*pDPA_GetPtr
) (const HDPA
, INT
);
958 BOOL
WINAPI (*pDPA_Destroy
) (const HDPA
);
959 INT
WINAPI (*pDPA_Search
) (const HDPA
, LPVOID
, INT
, PFNDPACOMPARE
, LPARAM
, UINT
);
960 LPVOID
WINAPI (*pDPA_DeletePtr
) (const HDPA hdpa
, INT i
);
961 HANDLE
WINAPI (*pCreateMRUListA
) (LPVOID lpcml
);
962 DWORD
WINAPI (*pFreeMRUListA
) (HANDLE hMRUList
);
963 INT
WINAPI (*pAddMRUData
) (HANDLE hList
, LPCVOID lpData
, DWORD cbData
);
964 INT
WINAPI (*pFindMRUData
) (HANDLE hList
, LPCVOID lpData
, DWORD cbData
, LPINT lpRegNum
);
965 INT
WINAPI (*pEnumMRUListA
) (HANDLE hList
, INT nItemPos
, LPVOID lpBuffer
, DWORD nBufferSize
);
967 static HINSTANCE hComctl32
;
969 LONG shell32_ObjCount
= 0;
970 HINSTANCE shell32_hInstance
= 0;
971 HIMAGELIST ShellSmallIconList
= 0;
972 HIMAGELIST ShellBigIconList
= 0;
975 /*************************************************************************
979 * calling oleinitialize here breaks sone apps.
982 BOOL WINAPI
Shell32LibMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
984 TRACE("0x%x 0x%lx %p\n", hinstDLL
, fdwReason
, fImpLoad
);
988 case DLL_PROCESS_ATTACH
:
989 shell32_hInstance
= hinstDLL
;
990 hComctl32
= GetModuleHandleA("COMCTL32.DLL");
991 DisableThreadLibraryCalls(shell32_hInstance
);
995 ERR("P A N I C SHELL32 loading failed\n");
1000 pDLLInitComctl
=(void*)GetProcAddress(hComctl32
,"InitCommonControlsEx");
1001 pCOMCTL32_Alloc
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)71L);
1002 pCOMCTL32_Free
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)73L);
1003 pDPA_Create
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)328L);
1004 pDPA_Destroy
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)329L);
1005 pDPA_GetPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)332L);
1006 pDPA_InsertPtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)334L);
1007 pDPA_DeletePtr
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)336L);
1008 pDPA_Sort
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)338L);
1009 pDPA_Search
=(void*)GetProcAddress(hComctl32
, (LPCSTR
)339L);
1010 pCreateMRUListA
=(void*)GetProcAddress(hComctl32
, "CreateMRUListA");
1011 pFreeMRUListA
=(void*)GetProcAddress(hComctl32
, "FreeMRUList");
1012 pAddMRUData
=(void*)GetProcAddress(hComctl32
, "AddMRUData");
1013 pFindMRUData
=(void*)GetProcAddress(hComctl32
, "FindMRUData");
1014 pEnumMRUListA
=(void*)GetProcAddress(hComctl32
, "EnumMRUListA");
1016 /* initialize the common controls */
1019 pDLLInitComctl(NULL
);
1024 InitChangeNotifications();
1025 SHInitRestricted(NULL
, NULL
);
1028 case DLL_THREAD_ATTACH
:
1031 case DLL_THREAD_DETACH
:
1034 case DLL_PROCESS_DETACH
:
1035 shell32_hInstance
= 0;
1039 IShellFolder_Release(pdesktopfolder
);
1040 pdesktopfolder
= NULL
;
1044 FreeChangeNotifications();
1046 /* this one is here to check if AddRef/Release is balanced */
1047 if (shell32_ObjCount
)
1049 WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount
);
1056 /*************************************************************************
1057 * DllInstall [SHELL32.@]
1061 * BOOL bInstall - TRUE for install, FALSE for uninstall
1062 * LPCWSTR pszCmdLine - command line (unused by shell32?)
1065 HRESULT WINAPI
SHELL32_DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
1067 FIXME("(%s, %s): stub!\n", bInstall
? "TRUE":"FALSE", debugstr_w(cmdline
));
1069 return S_OK
; /* indicate success */
1072 /***********************************************************************
1073 * DllCanUnloadNow (SHELL32.@)
1075 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void)
1077 FIXME("(void): stub\n");