2 * internal Shell32 Library definitions
4 * Copyright 1998 Marcus Meissner
5 * Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
27 #include "undocshell.h"
28 #include "wine/obj_shellfolder.h"
29 #include "wine/obj_contextmenu.h"
30 #include "wine/obj_shellview.h"
31 #include "wine/obj_shelllink.h"
32 #include "wine/obj_extracticon.h"
33 #include "wine/windef16.h"
35 /*******************************************
36 * global SHELL32.DLL variables
38 extern HMODULE huser32
;
39 extern HINSTANCE shell32_hInstance
;
40 extern HIMAGELIST ShellSmallIconList
;
41 extern HIMAGELIST ShellBigIconList
;
44 /*******************************************
45 * pointer to functions dynamically loaded
47 extern void (WINAPI
*pDLLInitComctl
)(LPVOID
);
49 BOOL WINAPI
Shell_GetImageList(HIMAGELIST
* lpBigList
, HIMAGELIST
* lpSmallList
);
52 #define INVALID_INDEX -1
53 BOOL
SIC_Initialize(void);
54 void SIC_Destroy(void);
55 BOOL
PidlToSicIndex (IShellFolder
* sh
, LPITEMIDLIST pidl
, BOOL bBigIcon
, UINT uFlags
, UINT
* pIndex
);
56 INT
SIC_GetIconIndex (LPCSTR sSourceFile
, INT dwSourceIndex
);
59 BOOL
HCR_MapTypeToValueW(LPCWSTR szExtension
, LPWSTR szFileType
, DWORD len
, BOOL bPrependDot
);
60 BOOL
HCR_GetExecuteCommandW(LPCWSTR szClass
, LPCWSTR szVerb
, LPWSTR szDest
, DWORD len
);
61 BOOL
HCR_GetDefaultIconW(LPCWSTR szClass
, LPWSTR szDest
, DWORD len
, LPDWORD dwNr
);
62 BOOL
HCR_GetDefaultIconFromGUIDW(REFIID riid
, LPWSTR szDest
, DWORD len
, LPDWORD dwNr
);
63 BOOL
HCR_GetClassNameW(REFIID riid
, LPWSTR szDest
, DWORD len
);
65 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
66 BOOL
HCR_MapTypeToValueA(LPCSTR szExtension
, LPSTR szFileType
, DWORD len
, BOOL bPrependDot
);
67 BOOL
HCR_GetExecuteCommandA(LPCSTR szClass
, LPCSTR szVerb
, LPSTR szDest
, DWORD len
);
68 BOOL
HCR_GetDefaultIconA(LPCSTR szClass
, LPSTR szDest
, DWORD len
, LPDWORD dwNr
);
69 BOOL
HCR_GetClassNameA(REFIID riid
, LPSTR szDest
, DWORD len
);
71 BOOL
HCR_GetExecuteCommandEx ( HKEY hkeyClass
, LPCSTR szClass
, LPCSTR szVerb
, LPSTR szDest
, DWORD len
);
72 BOOL
HCR_GetFolderAttributes(REFIID riid
, LPDWORD szDest
);
74 INT_PTR CALLBACK
AboutDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
75 DWORD WINAPI
ParseFieldA(LPCSTR src
, DWORD nField
, LPSTR dst
, DWORD len
);
76 DWORD WINAPI
ParseFieldW(LPCWSTR src
, DWORD nField
, LPWSTR dst
, DWORD len
);
78 /****************************************************************************
81 LPDATAOBJECT
IDataObject_Constructor(HWND hwndOwner
, LPITEMIDLIST myPidl
, LPITEMIDLIST
* apidl
, UINT cidl
);
82 LPENUMFORMATETC
IEnumFORMATETC_Constructor(UINT
, const FORMATETC
[]);
84 LPCLASSFACTORY
IClassFactory_Constructor(REFCLSID
);
85 IContextMenu
* ISvItemCm_Constructor(LPSHELLFOLDER pSFParent
, LPCITEMIDLIST pidl
, LPCITEMIDLIST
*aPidls
, UINT uItemCount
);
86 IContextMenu
* ISvBgCm_Constructor(LPSHELLFOLDER pSFParent
);
87 LPSHELLVIEW
IShellView_Constructor(LPSHELLFOLDER
);
89 HRESULT WINAPI
IFSFolder_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
90 HRESULT WINAPI
IShellLink_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
91 HRESULT WINAPI
ISF_Desktop_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
92 HRESULT WINAPI
ISF_MyComputer_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
93 HRESULT WINAPI
IDropTargetHelper_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
95 /* kind of enumidlist */
100 LPENUMIDLIST
IEnumIDList_Constructor(LPCSTR
,DWORD
,DWORD
);
102 LPEXTRACTICONA
IExtractIconA_Constructor(LPITEMIDLIST
);
103 LPEXTRACTICONW
IExtractIconW_Constructor(LPITEMIDLIST
);
104 HRESULT
CreateStreamOnFile (LPCSTR pszFilename
, IStream
** ppstm
);
106 /* FIXME: rename the functions when the shell32.dll has it's own exports namespace */
107 HRESULT WINAPI
SHELL32_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
);
108 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void);
110 /* FIXME: move away */
111 #define ResultFromShort(i) MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))
114 #define MM_ADDSEPARATOR 0x00000001L
115 #define MM_SUBMENUSHAVEIDS 0x00000002L
116 HRESULT WINAPI
Shell_MergeMenus (HMENU hmDst
, HMENU hmSrc
, UINT uInsert
, UINT uIDAdjust
, UINT uIDAdjustMax
, ULONG uFlags
);
118 /* initialisation for FORMATETC */
119 #define InitFormatEtc(fe, cf, med) \
122 (fe).dwAspect=DVASPECT_CONTENT;\
128 #define KeyStateToDropEffect(kst)\
129 (((kst) & MK_CONTROL) ?\
130 (((kst) & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY):\
134 BOOL
SYSTRAY_Init(void);
137 extern HINSTANCE hShellOle32
;
139 extern HRESULT (WINAPI
*pOleInitialize
)(LPVOID reserved
);
140 extern void (WINAPI
*pOleUninitialize
)(void);
141 extern HRESULT (WINAPI
*pRegisterDragDrop
)(HWND hwnd
, IDropTarget
* pDropTarget
);
142 extern HRESULT (WINAPI
*pRevokeDragDrop
)(HWND hwnd
);
143 extern HRESULT (WINAPI
*pDoDragDrop
)(LPDATAOBJECT
,LPDROPSOURCE
,DWORD
,DWORD
*);
144 extern void (WINAPI
*pReleaseStgMedium
)(STGMEDIUM
* pmedium
);
145 extern HRESULT (WINAPI
*pOleSetClipboard
)(IDataObject
* pDataObj
);
146 extern HRESULT (WINAPI
*pOleGetClipboard
)(IDataObject
** ppDataObj
);
147 extern HRESULT (WINAPI
*pCoCreateInstance
)(REFCLSID rclsid
, LPUNKNOWN pUnkOuter
, DWORD dwClsContext
, REFIID iid
, LPVOID
*ppv
);
149 BOOL
GetShellOle(void);
151 HGLOBAL
RenderHDROP(LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
152 HGLOBAL
RenderSHELLIDLIST (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
153 HGLOBAL
RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
154 HGLOBAL
RenderFILECONTENTS (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
155 HGLOBAL
RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
156 HGLOBAL
RenderFILENAME (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
157 HGLOBAL
RenderPREFEREDDROPEFFECT (DWORD dwFlags
);
159 /* Change Notification */
160 void InitChangeNotifications(void);
161 void FreeChangeNotifications(void);
164 #define ASK_DELETE_FILE 1
165 #define ASK_DELETE_FOLDER 2
166 #define ASK_DELETE_MULTIPLE_ITEM 3
167 #define ASK_CREATE_FOLDER 4
168 #define ASK_OVERWRITE_FILE 5
170 BOOL
SHELL_DeleteDirectoryA(LPCSTR pszDir
, BOOL bShowUI
);
171 BOOL
SHELL_DeleteFileA(LPCSTR pszFile
, BOOL bShowUI
);
172 BOOL
SHELL_ConfirmDialog(int nKindOfDialog
, LPCSTR szDir
);
174 /* 16-bit functions */
175 void WINAPI
DragAcceptFiles16(HWND16 hWnd
, BOOL16 b
);
176 UINT16 WINAPI
DragQueryFile16(HDROP16 hDrop
, WORD wFile
, LPSTR lpszFile
, WORD wLength
);
177 void WINAPI
DragFinish16(HDROP16 h
);
178 BOOL16 WINAPI
DragQueryPoint16(HDROP16 hDrop
, POINT16
*p
);
179 HINSTANCE16 WINAPI
ShellExecute16(HWND16
,LPCSTR
,LPCSTR
,LPCSTR
,LPCSTR
,INT16
);
180 HICON16 WINAPI
ExtractIcon16(HINSTANCE16
,LPCSTR
,UINT16
);
181 HICON16 WINAPI
ExtractAssociatedIcon16(HINSTANCE16
,LPSTR
,LPWORD
);
182 HICON16 WINAPI
ExtractIconEx16 ( LPCSTR
, INT16
, HICON16
*, HICON16
*, UINT16
);
183 HINSTANCE16 WINAPI
FindExecutable16(LPCSTR
,LPCSTR
,LPSTR
);
184 HGLOBAL16 WINAPI
InternalExtractIcon16(HINSTANCE16
,LPCSTR
,UINT16
,WORD
);
185 BOOL16 WINAPI
ShellAbout16(HWND16
,LPCSTR
,LPCSTR
,HICON16
);
186 BOOL16 WINAPI
AboutDlgProc16(HWND16
,UINT16
,WPARAM16
,LPARAM
);
188 inline static BOOL
SHELL_OsIsUnicode(void)
190 /* if high-bit of version is 0, we are emulating NT */
191 return !(GetVersion() & 0x80000000);
194 #define __SHFreeAndNil(ptr) \
199 inline static void __SHCloneStrA(char ** target
,const char * source
)
201 *target
= SHAlloc(strlen(source
)+1); \
202 strcpy(*target
, source
); \
205 inline static void __SHCloneStrWtoA(char ** target
, const WCHAR
* source
)
207 int len
= WideCharToMultiByte(CP_ACP
, 0, source
, -1, NULL
, 0, NULL
, NULL
);
208 *target
= SHAlloc(len
);
209 WideCharToMultiByte(CP_ACP
, 0, source
, -1, *target
, len
, NULL
, NULL
);
212 /* handle conversions */
213 #define HICON_16(h32) (LOWORD(h32))
214 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
215 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
216 #define HINSTANCE_16(h32) (LOWORD(h32))
218 typedef UINT (*SHELL_ExecuteA1632
)(char *lpCmd
, LPSHELLEXECUTEINFOA sei
, BOOL shWait
);
219 BOOL WINAPI
ShellExecuteExA32 (LPSHELLEXECUTEINFOA sei
, SHELL_ExecuteA1632 execfunc
);