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
34 #include "undocshell.h"
37 #include "wine/windef16.h"
38 #include "wine/unicode.h"
40 /*******************************************
41 * global SHELL32.DLL variables
43 extern HMODULE huser32
;
44 extern HINSTANCE shell32_hInstance
;
45 extern HIMAGELIST ShellSmallIconList
;
46 extern HIMAGELIST ShellBigIconList
;
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
, LPCITEMIDLIST pidl
, BOOL bBigIcon
, UINT uFlags
, int * pIndex
);
56 INT
SIC_GetIconIndex (LPCWSTR sSourceFile
, INT dwSourceIndex
);
59 BOOL
HCR_MapTypeToValueW(LPCWSTR szExtension
, LPWSTR szFileType
, DWORD len
, BOOL bPrependDot
);
60 BOOL
HCR_GetExecuteCommandW( HKEY hkeyClass
, 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_GetDefaultIconA(LPCSTR szClass
, LPSTR szDest
, DWORD len
, LPDWORD dwNr
);
68 BOOL
HCR_GetClassNameA(REFIID riid
, LPSTR szDest
, DWORD len
);
70 BOOL
HCR_GetFolderAttributes(REFIID riid
, LPDWORD szDest
);
72 INT_PTR CALLBACK
AboutDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
73 DWORD WINAPI
ParseFieldA(LPCSTR src
, DWORD nField
, LPSTR dst
, DWORD len
);
74 DWORD WINAPI
ParseFieldW(LPCWSTR src
, DWORD nField
, LPWSTR dst
, DWORD len
);
76 /****************************************************************************
79 LPDATAOBJECT
IDataObject_Constructor(HWND hwndOwner
, LPCITEMIDLIST myPidl
, LPCITEMIDLIST
* apidl
, UINT cidl
);
80 LPENUMFORMATETC
IEnumFORMATETC_Constructor(UINT
, const FORMATETC
[]);
82 LPCLASSFACTORY
IClassFactory_Constructor(REFCLSID
);
83 IContextMenu2
* ISvItemCm_Constructor(LPSHELLFOLDER pSFParent
, LPCITEMIDLIST pidl
, LPCITEMIDLIST
*aPidls
, UINT uItemCount
);
84 IContextMenu2
* ISvBgCm_Constructor(LPSHELLFOLDER pSFParent
);
85 LPSHELLVIEW
IShellView_Constructor(LPSHELLFOLDER
);
87 HRESULT WINAPI
IFSFolder_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
88 HRESULT WINAPI
IShellLink_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
89 HRESULT WINAPI
IShellLink_ConstructFromFile(IUnknown
* pUnkOuter
, REFIID riid
, LPCITEMIDLIST pidl
, LPVOID
* ppv
);
90 HRESULT WINAPI
ISF_Desktop_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
91 HRESULT WINAPI
ISF_MyComputer_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
92 HRESULT WINAPI
IDropTargetHelper_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
93 HRESULT WINAPI
IFileSystemBindData_Constructor(const WIN32_FIND_DATAW
*pfd
, LPBC
*ppV
);
94 HRESULT WINAPI
IControlPanel_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
);
95 HRESULT WINAPI
CPanel_GetIconLocationA(LPITEMIDLIST pidl
, LPSTR szIconFile
, UINT cchMax
, int* piIndex
);
96 HRESULT WINAPI
CPanel_GetIconLocationW(LPITEMIDLIST pidl
, LPWSTR szIconFile
, UINT cchMax
, int* piIndex
);
97 HRESULT WINAPI
CPanel_ExtractIconA(LPITEMIDLIST pidl
, LPCSTR pszFile
, UINT nIconIndex
, HICON
*phiconLarge
, HICON
*phiconSmall
, UINT nIconSize
);
98 HRESULT WINAPI
CPanel_ExtractIconW(LPITEMIDLIST pidl
, LPCWSTR pszFile
, UINT nIconIndex
, HICON
*phiconLarge
, HICON
*phiconSmall
, UINT nIconSize
);
100 /* kind of enumidlist */
102 #define EIDL_MYCOMP 1
104 #define EIDL_CPANEL 3
106 LPENUMIDLIST
IEnumIDList_Constructor(LPCSTR
,DWORD
,DWORD
);
108 LPEXTRACTICONA
IExtractIconA_Constructor(LPCITEMIDLIST
);
109 LPEXTRACTICONW
IExtractIconW_Constructor(LPCITEMIDLIST
);
110 HRESULT
CreateStreamOnFile (LPCWSTR pszFilename
, DWORD grfMode
, IStream
** ppstm
);
112 /* FIXME: rename the functions when the shell32.dll has it's own exports namespace */
113 HRESULT WINAPI
SHELL32_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
* ppv
);
114 HRESULT WINAPI
SHELL32_DllCanUnloadNow(void);
118 #define MM_ADDSEPARATOR 0x00000001L
119 #define MM_SUBMENUSHAVEIDS 0x00000002L
120 HRESULT WINAPI
Shell_MergeMenus (HMENU hmDst
, HMENU hmSrc
, UINT uInsert
, UINT uIDAdjust
, UINT uIDAdjustMax
, ULONG uFlags
);
122 /* initialisation for FORMATETC */
123 #define InitFormatEtc(fe, cf, med) \
126 (fe).dwAspect=DVASPECT_CONTENT;\
132 #define KeyStateToDropEffect(kst)\
133 (((kst) & MK_CONTROL) ?\
134 (((kst) & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY):\
138 BOOL
SYSTRAY_Init(void);
141 extern HINSTANCE hShellOle32
;
143 extern HRESULT (WINAPI
*pOleInitialize
)(LPVOID reserved
);
144 extern void (WINAPI
*pOleUninitialize
)(void);
145 extern HRESULT (WINAPI
*pRegisterDragDrop
)(HWND hwnd
, IDropTarget
* pDropTarget
);
146 extern HRESULT (WINAPI
*pRevokeDragDrop
)(HWND hwnd
);
147 extern HRESULT (WINAPI
*pDoDragDrop
)(LPDATAOBJECT
,LPDROPSOURCE
,DWORD
,DWORD
*);
148 extern void (WINAPI
*pReleaseStgMedium
)(STGMEDIUM
* pmedium
);
149 extern HRESULT (WINAPI
*pOleSetClipboard
)(IDataObject
* pDataObj
);
150 extern HRESULT (WINAPI
*pOleGetClipboard
)(IDataObject
** ppDataObj
);
151 extern HRESULT (WINAPI
*pCoCreateInstance
)(REFCLSID rclsid
, LPUNKNOWN pUnkOuter
, DWORD dwClsContext
, REFIID iid
, LPVOID
*ppv
);
153 BOOL
GetShellOle(void);
155 HGLOBAL
RenderHDROP(LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
156 HGLOBAL
RenderSHELLIDLIST (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
157 HGLOBAL
RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
158 HGLOBAL
RenderFILECONTENTS (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
159 HGLOBAL
RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
160 HGLOBAL
RenderFILENAMEA (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
161 HGLOBAL
RenderFILENAMEW (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
);
162 HGLOBAL
RenderPREFEREDDROPEFFECT (DWORD dwFlags
);
164 /* Change Notification */
165 void InitChangeNotifications(void);
166 void FreeChangeNotifications(void);
169 #define ASK_DELETE_FILE 1
170 #define ASK_DELETE_FOLDER 2
171 #define ASK_DELETE_MULTIPLE_ITEM 3
172 #define ASK_CREATE_FOLDER 4
173 #define ASK_OVERWRITE_FILE 5
175 BOOL
SHELL_DeleteDirectoryA(LPCSTR pszDir
, BOOL bShowUI
);
176 BOOL
SHELL_DeleteFileA(LPCSTR pszFile
, BOOL bShowUI
);
177 BOOL
SHELL_ConfirmDialog(int nKindOfDialog
, LPCSTR szDir
);
179 /* 16-bit functions */
180 void WINAPI
DragAcceptFiles16(HWND16 hWnd
, BOOL16 b
);
181 UINT16 WINAPI
DragQueryFile16(HDROP16 hDrop
, WORD wFile
, LPSTR lpszFile
, WORD wLength
);
182 void WINAPI
DragFinish16(HDROP16 h
);
183 BOOL16 WINAPI
DragQueryPoint16(HDROP16 hDrop
, POINT16
*p
);
184 HINSTANCE16 WINAPI
ShellExecute16(HWND16
,LPCSTR
,LPCSTR
,LPCSTR
,LPCSTR
,INT16
);
185 HICON16 WINAPI
ExtractIcon16(HINSTANCE16
,LPCSTR
,UINT16
);
186 HICON16 WINAPI
ExtractAssociatedIcon16(HINSTANCE16
,LPSTR
,LPWORD
);
187 HICON16 WINAPI
ExtractIconEx16 ( LPCSTR
, INT16
, HICON16
*, HICON16
*, UINT16
);
188 HINSTANCE16 WINAPI
FindExecutable16(LPCSTR
,LPCSTR
,LPSTR
);
189 HGLOBAL16 WINAPI
InternalExtractIcon16(HINSTANCE16
,LPCSTR
,UINT16
,WORD
);
190 BOOL16 WINAPI
ShellAbout16(HWND16
,LPCSTR
,LPCSTR
,HICON16
);
191 BOOL16 WINAPI
AboutDlgProc16(HWND16
,UINT16
,WPARAM16
,LPARAM
);
193 inline static BOOL
SHELL_OsIsUnicode(void)
195 /* if high-bit of version is 0, we are emulating NT */
196 return !(GetVersion() & 0x80000000);
199 #define __SHFreeAndNil(ptr) \
204 inline static void __SHCloneStrA(char ** target
,const char * source
)
206 *target
= SHAlloc(strlen(source
)+1);
207 strcpy(*target
, source
);
210 inline static void __SHCloneStrWtoA(char ** target
, const WCHAR
* source
)
212 int len
= WideCharToMultiByte(CP_ACP
, 0, source
, -1, NULL
, 0, NULL
, NULL
);
213 *target
= SHAlloc(len
);
214 WideCharToMultiByte(CP_ACP
, 0, source
, -1, *target
, len
, NULL
, NULL
);
217 inline static void __SHCloneStrW(WCHAR
** target
, const WCHAR
* source
)
219 *target
= SHAlloc( (strlenW(source
)+1) * sizeof(WCHAR
) );
220 strcpyW(*target
, source
);
223 inline static WCHAR
* __SHCloneStrAtoW(WCHAR
** target
, const char * source
)
225 int len
= MultiByteToWideChar(CP_ACP
, 0, source
, -1, NULL
, 0);
226 *target
= SHAlloc(len
*sizeof(WCHAR
));
227 MultiByteToWideChar(CP_ACP
, 0, source
, -1, *target
, len
);
231 /* handle conversions */
232 #define HICON_16(h32) (LOWORD(h32))
233 #define HICON_32(h16) ((HICON)(ULONG_PTR)(h16))
234 #define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16))
235 #define HINSTANCE_16(h32) (LOWORD(h32))
237 typedef UINT (*SHELL_ExecuteW32
)(const WCHAR
*lpCmd
, void *env
, BOOL shWait
,
238 LPSHELLEXECUTEINFOW sei
, LPSHELLEXECUTEINFOW sei_out
);
240 BOOL WINAPI
ShellExecuteExW32(LPSHELLEXECUTEINFOW sei
, SHELL_ExecuteW32 execfunc
);
242 UINT
SHELL_FindExecutable(LPCWSTR lpPath
, LPCWSTR lpFile
, LPCWSTR lpOperation
,
243 LPWSTR lpResult
, int resultLen
, LPWSTR key
, void **env
, LPITEMIDLIST pidl
, LPCWSTR args
);
245 extern WCHAR swShell32Name
[MAX_PATH
];