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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
35 #include "undocshell.h"
38 #include "wine/heap.h"
39 #include "wine/unicode.h"
40 #include "wine/list.h"
42 /*******************************************
43 * global SHELL32.DLL variables
45 extern HMODULE huser32 DECLSPEC_HIDDEN
;
46 extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN
;
48 extern CLSID CLSID_ShellImageDataFactory
;
51 #define INVALID_INDEX -1
52 void SIC_Destroy(void) DECLSPEC_HIDDEN
;
53 BOOL
PidlToSicIndex (IShellFolder
* sh
, LPCITEMIDLIST pidl
, BOOL bBigIcon
, UINT uFlags
, int * pIndex
) DECLSPEC_HIDDEN
;
54 INT
SIC_GetIconIndex (LPCWSTR sSourceFile
, INT dwSourceIndex
, DWORD dwFlags
) DECLSPEC_HIDDEN
;
55 HRESULT
SIC_get_location( int list_idx
, WCHAR
*file
, DWORD
*size
, int *res_idx
) DECLSPEC_HIDDEN
;
58 BOOL
HCR_MapTypeToValueW(LPCWSTR szExtension
, LPWSTR szFileType
, LONG len
, BOOL bPrependDot
) DECLSPEC_HIDDEN
;
59 BOOL
HCR_GetDefaultVerbW( HKEY hkeyClass
, LPCWSTR szVerb
, LPWSTR szDest
, DWORD len
) DECLSPEC_HIDDEN
;
60 BOOL
HCR_GetExecuteCommandW( HKEY hkeyClass
, LPCWSTR szClass
, LPCWSTR szVerb
, LPWSTR szDest
, DWORD len
) DECLSPEC_HIDDEN
;
61 BOOL
HCR_GetDefaultIconW(LPCWSTR szClass
, LPWSTR szDest
, DWORD len
, int* picon_idx
) DECLSPEC_HIDDEN
;
62 BOOL
HCR_GetClassNameW(REFIID riid
, LPWSTR szDest
, DWORD len
) DECLSPEC_HIDDEN
;
64 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
65 BOOL
HCR_MapTypeToValueA(LPCSTR szExtension
, LPSTR szFileType
, LONG len
, BOOL bPrependDot
) DECLSPEC_HIDDEN
;
66 BOOL
HCR_GetDefaultIconA(LPCSTR szClass
, LPSTR szDest
, DWORD len
, int* picon_idx
) DECLSPEC_HIDDEN
;
67 BOOL
HCR_GetClassNameA(REFIID riid
, LPSTR szDest
, DWORD len
) DECLSPEC_HIDDEN
;
69 BOOL
HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder
, LPDWORD dwAttributes
) DECLSPEC_HIDDEN
;
71 DWORD WINAPI
ParseFieldA(LPCSTR src
, DWORD nField
, LPSTR dst
, DWORD len
) DECLSPEC_HIDDEN
;
72 DWORD WINAPI
ParseFieldW(LPCWSTR src
, DWORD nField
, LPWSTR dst
, DWORD len
) DECLSPEC_HIDDEN
;
74 BOOL WINAPI
GUIDFromStringW(LPCWSTR
, LPGUID
) DECLSPEC_HIDDEN
;
76 /****************************************************************************
79 LPDATAOBJECT
IDataObject_Constructor(HWND hwndOwner
, LPCITEMIDLIST myPidl
, LPCITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
80 LPENUMFORMATETC
IEnumFORMATETC_Constructor(UINT
, const FORMATETC
[]) DECLSPEC_HIDDEN
;
82 LPCLASSFACTORY
IClassFactory_Constructor(REFCLSID
) DECLSPEC_HIDDEN
;
83 HRESULT
ItemMenu_Constructor(IShellFolder
*, LPCITEMIDLIST
, const LPCITEMIDLIST
*, UINT
, REFIID
, void**) DECLSPEC_HIDDEN
;
84 HRESULT
BackgroundMenu_Constructor(IShellFolder
*, BOOL
, REFIID
, void**) DECLSPEC_HIDDEN
;
85 LPSHELLVIEW
IShellView_Constructor(LPSHELLFOLDER
) DECLSPEC_HIDDEN
;
87 HRESULT WINAPI
IFSFolder_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
88 HRESULT WINAPI
IShellDispatch_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
89 HRESULT WINAPI
IShellItem_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
90 HRESULT WINAPI
IShellLink_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
91 HRESULT WINAPI
ISF_Desktop_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
92 HRESULT WINAPI
ISF_MyComputer_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
93 HRESULT WINAPI
ISF_NetworkPlaces_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
94 HRESULT WINAPI
Printers_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
95 HRESULT WINAPI
IDropTargetHelper_Constructor (IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
96 HRESULT WINAPI
IFileSystemBindData_Constructor(const WIN32_FIND_DATAW
*pfd
, LPBC
*ppV
) DECLSPEC_HIDDEN
;
97 HRESULT WINAPI
IControlPanel_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
98 HRESULT WINAPI
UnixFolder_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
99 HRESULT WINAPI
UnixDosFolder_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
100 HRESULT WINAPI
FolderShortcut_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
101 HRESULT WINAPI
MyDocuments_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
102 HRESULT WINAPI
RecycleBin_Constructor(IUnknown
* pUnkOuter
, REFIID riif
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
103 HRESULT WINAPI
QueryAssociations_Constructor(IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppOutput
) DECLSPEC_HIDDEN
;
104 HRESULT WINAPI
ExplorerBrowser_Constructor(IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
105 HRESULT WINAPI
KnownFolderManager_Constructor(IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
106 HRESULT WINAPI
IFileOperation_Constructor(IUnknown
*outer
, REFIID riid
, void **out
) DECLSPEC_HIDDEN
;
107 extern HRESULT
CPanel_GetIconLocationW(LPCITEMIDLIST
, LPWSTR
, UINT
, int*) DECLSPEC_HIDDEN
;
108 HRESULT WINAPI
CPanel_ExtractIconA(LPITEMIDLIST pidl
, LPCSTR pszFile
, UINT nIconIndex
, HICON
*phiconLarge
, HICON
*phiconSmall
, UINT nIconSize
) DECLSPEC_HIDDEN
;
109 HRESULT WINAPI
CPanel_ExtractIconW(LPITEMIDLIST pidl
, LPCWSTR pszFile
, UINT nIconIndex
, HICON
*phiconLarge
, HICON
*phiconSmall
, UINT nIconSize
) DECLSPEC_HIDDEN
;
111 HRESULT WINAPI
IAutoComplete_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
) DECLSPEC_HIDDEN
;
112 HRESULT WINAPI
ApplicationAssociationRegistration_Constructor(IUnknown
*outer
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
114 HRESULT WINAPI
ApplicationDestinations_Constructor(IUnknown
*outer
, REFIID riid
, LPVOID
*ppv
) DECLSPEC_HIDDEN
;
116 HRESULT
IShellLink_ConstructFromFile(IUnknown
* pUnkOuter
, REFIID riid
, LPCITEMIDLIST pidl
, IUnknown
**ppv
) DECLSPEC_HIDDEN
;
118 LPEXTRACTICONA
IExtractIconA_Constructor(LPCITEMIDLIST
) DECLSPEC_HIDDEN
;
119 LPEXTRACTICONW
IExtractIconW_Constructor(LPCITEMIDLIST
) DECLSPEC_HIDDEN
;
121 HRESULT WINAPI
CustomDestinationList_Constructor(IUnknown
*outer
, REFIID riid
, void **obj
) DECLSPEC_HIDDEN
;
123 /* initialisation for FORMATETC */
124 #define InitFormatEtc(fe, cf, med) \
127 (fe).dwAspect=DVASPECT_CONTENT;\
133 #define KeyStateToDropEffect(kst)\
134 ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
135 (((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
139 HGLOBAL
RenderHDROP(LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
140 HGLOBAL
RenderSHELLIDLIST (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
141 HGLOBAL
RenderFILENAMEA (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
142 HGLOBAL
RenderFILENAMEW (LPITEMIDLIST pidlRoot
, LPITEMIDLIST
* apidl
, UINT cidl
) DECLSPEC_HIDDEN
;
144 /* Change Notification */
145 void InitChangeNotifications(void) DECLSPEC_HIDDEN
;
146 void FreeChangeNotifications(void) DECLSPEC_HIDDEN
;
149 #define ASK_DELETE_FILE 1
150 #define ASK_DELETE_FOLDER 2
151 #define ASK_DELETE_MULTIPLE_ITEM 3
152 #define ASK_CREATE_FOLDER 4
153 #define ASK_OVERWRITE_FILE 5
154 #define ASK_DELETE_SELECTED 6
155 #define ASK_TRASH_FILE 7
156 #define ASK_TRASH_FOLDER 8
157 #define ASK_TRASH_MULTIPLE_ITEM 9
158 #define ASK_CANT_TRASH_ITEM 10
159 #define ASK_OVERWRITE_FOLDER 11
161 BOOL
SHELL_ConfirmYesNoW(HWND hWnd
, int nKindOfDialog
, LPCWSTR szDir
) DECLSPEC_HIDDEN
;
163 static inline BOOL
SHELL_OsIsUnicode(void)
165 /* if high-bit of version is 0, we are emulating NT */
166 return !(GetVersion() & 0x80000000);
169 static inline WCHAR
* __SHCloneStrAtoW(WCHAR
** target
, const char * source
)
171 int len
= MultiByteToWideChar(CP_ACP
, 0, source
, -1, NULL
, 0);
172 *target
= SHAlloc(len
*sizeof(WCHAR
));
173 MultiByteToWideChar(CP_ACP
, 0, source
, -1, *target
, len
);
178 extern WCHAR swShell32Name
[MAX_PATH
] DECLSPEC_HIDDEN
;
180 BOOL
UNIXFS_is_rooted_at_desktop(void) DECLSPEC_HIDDEN
;
181 extern const GUID CLSID_UnixFolder DECLSPEC_HIDDEN
;
182 extern const GUID CLSID_UnixDosFolder DECLSPEC_HIDDEN
;
184 extern BOOL
run_winemenubuilder( const WCHAR
*args
) DECLSPEC_HIDDEN
;
186 /* Default shell folder value registration */
187 HRESULT
SHELL_RegisterShellFolders(void) DECLSPEC_HIDDEN
;
189 /* Detect Shell Links */
190 BOOL
SHELL_IsShortcut(LPCITEMIDLIST
) DECLSPEC_HIDDEN
;
193 /* IEnumIDList stuff */
194 struct pidl_enum_entry
202 IEnumIDList IEnumIDList_iface
;
205 struct list
*current
;
208 /* Creates an IEnumIDList; add LPITEMIDLISTs to it with AddToEnumList. */
209 IEnumIDListImpl
*IEnumIDList_Constructor(void) DECLSPEC_HIDDEN
;
210 BOOL
AddToEnumList(IEnumIDListImpl
*list
, LPITEMIDLIST pidl
) DECLSPEC_HIDDEN
;
212 /* Enumerates the folders and/or files (depending on dwFlags) in lpszPath and
213 * adds them to the already-created list.
215 BOOL
CreateFolderEnumList(IEnumIDListImpl
*list
, LPCWSTR lpszPath
, DWORD dwFlags
) DECLSPEC_HIDDEN
;
220 IShellFolderViewDual3_tid
,
230 HRESULT
get_typeinfo(enum tid_t
, ITypeInfo
**) DECLSPEC_HIDDEN
;
231 void release_typelib(void) DECLSPEC_HIDDEN
;
232 void release_desktop_folder(void) DECLSPEC_HIDDEN
;
234 static inline WCHAR
*strdupW(const WCHAR
*src
)
237 if (!src
) return NULL
;
238 dest
= heap_alloc((lstrlenW(src
) + 1) * sizeof(*dest
));
244 static inline WCHAR
*strndupW(const WCHAR
*src
, DWORD len
)
247 if (!src
) return NULL
;
248 dest
= heap_alloc((len
+ 1) * sizeof(*dest
));
251 memcpy(dest
, src
, len
* sizeof(WCHAR
));
257 static inline WCHAR
*strdupAtoW(const char *str
)
262 if (!str
) return NULL
;
264 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
265 ret
= heap_alloc(len
* sizeof(WCHAR
));
267 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);