msxml3: Implement comment node.
[wine] / dlls / shell32 / shell32_main.h
1 /*
2  *      internal Shell32 Library definitions
3  *
4  * Copyright 1998 Marcus Meissner
5  * Copyright 1998 Juergen Schmied (jsch)  *  <juergen.schmied@metronet.de>
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef __WINE_SHELL_MAIN_H
23 #define __WINE_SHELL_MAIN_H
24
25 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winnls.h"
32 #include "commctrl.h"
33 #include "objbase.h"
34 #include "docobj.h"
35 #include "undocshell.h"
36 #include "shlobj.h"
37 #include "shellapi.h"
38 #include "wine/windef16.h"
39 #include "wine/unicode.h"
40
41 /*******************************************
42 *  global SHELL32.DLL variables
43 */
44 extern HMODULE  huser32;
45 extern HINSTANCE shell32_hInstance;
46 extern HIMAGELIST       ShellSmallIconList;
47 extern HIMAGELIST       ShellBigIconList;
48
49 BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
50
51 /* Iconcache */
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, DWORD dwFlags );
57
58 /* Classes Root */
59 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG 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, int* picon_idx);
62 BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, int* picon_idx);
63 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
64
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, LONG len, BOOL bPrependDot);
67 BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx);
68 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
69
70 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
71
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);
75
76 /****************************************************************************
77  * Class constructors
78  */
79 LPDATAOBJECT    IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST myPidl, LPCITEMIDLIST * apidl, UINT cidl);
80 LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []);
81
82 LPCLASSFACTORY  IClassFactory_Constructor(REFCLSID);
83 IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount);
84 IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
85 LPSHELLVIEW     IShellView_Constructor(LPSHELLFOLDER);
86
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 UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
96 HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
97 HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
98 HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
99 HRESULT WINAPI ShellFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
100 extern HRESULT CPanel_GetIconLocationW(LPITEMIDLIST, LPWSTR, UINT, int*);
101 HRESULT WINAPI CPanel_ExtractIconA(LPITEMIDLIST pidl, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
102 HRESULT WINAPI CPanel_ExtractIconW(LPITEMIDLIST pidl, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize);
103
104 HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
105
106 LPEXTRACTICONA  IExtractIconA_Constructor(LPCITEMIDLIST);
107 LPEXTRACTICONW  IExtractIconW_Constructor(LPCITEMIDLIST);
108
109 /* menu merging */
110 #define MM_ADDSEPARATOR         0x00000001L
111 #define MM_SUBMENUSHAVEIDS      0x00000002L
112 HRESULT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags);
113
114 /* initialisation for FORMATETC */
115 #define InitFormatEtc(fe, cf, med) \
116         {\
117         (fe).cfFormat=cf;\
118         (fe).dwAspect=DVASPECT_CONTENT;\
119         (fe).ptd=NULL;\
120         (fe).tymed=med;\
121         (fe).lindex=-1;\
122         };
123
124 #define KeyStateToDropEffect(kst)\
125     ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
126     (((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
127     DROPEFFECT_MOVE))
128
129 /* Systray */
130 BOOL SYSTRAY_Init(void);
131
132
133 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
134 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
135 HGLOBAL RenderSHELLIDLISTOFFSET (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
136 HGLOBAL RenderFILECONTENTS (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
137 HGLOBAL RenderFILEDESCRIPTOR (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
138 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
139 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
140 HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags);
141
142 /* Change Notification */
143 void InitChangeNotifications(void);
144 void FreeChangeNotifications(void);
145
146 /* file operation */
147 #define ASK_DELETE_FILE           1
148 #define ASK_DELETE_FOLDER         2
149 #define ASK_DELETE_MULTIPLE_ITEM  3
150 #define ASK_CREATE_FOLDER         4
151 #define ASK_OVERWRITE_FILE        5
152
153 BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI);
154 BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI);
155 BOOL SHELL_ConfirmDialog(int nKindOfDialog, LPCSTR szDir);
156
157 /* 16-bit functions */
158 void        WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b);
159 UINT16      WINAPI DragQueryFile16(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength);
160 void        WINAPI DragFinish16(HDROP16 h);
161 BOOL16      WINAPI DragQueryPoint16(HDROP16 hDrop, POINT16 *p);
162 HINSTANCE16 WINAPI ShellExecute16(HWND16,LPCSTR,LPCSTR,LPCSTR,LPCSTR,INT16);
163 HICON16     WINAPI ExtractIcon16(HINSTANCE16,LPCSTR,UINT16);
164 HICON16     WINAPI ExtractAssociatedIcon16(HINSTANCE16,LPSTR,LPWORD);
165 HICON16     WINAPI ExtractIconEx16 ( LPCSTR, INT16, HICON16 *, HICON16 *, UINT16 );
166 HINSTANCE16 WINAPI FindExecutable16(LPCSTR,LPCSTR,LPSTR);
167 HGLOBAL16   WINAPI InternalExtractIcon16(HINSTANCE16,LPCSTR,UINT16,WORD);
168 BOOL16      WINAPI ShellAbout16(HWND16,LPCSTR,LPCSTR,HICON16);
169 BOOL16      WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
170
171 void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition,
172                         UINT wID, UINT fType, LPCSTR dwTypeData, UINT fState);
173
174 inline static BOOL SHELL_OsIsUnicode(void)
175 {
176     /* if high-bit of version is 0, we are emulating NT */
177     return !(GetVersion() & 0x80000000);
178 }
179
180 #define __SHFreeAndNil(ptr) \
181         {\
182           SHFree(*ptr); \
183           *ptr = NULL; \
184         };
185 inline static void __SHCloneStrA(char ** target,const char * source)
186 {
187         *target = SHAlloc(strlen(source)+1);
188         strcpy(*target, source);
189 }
190
191 inline static void __SHCloneStrWtoA(char ** target, const WCHAR * source)
192 {
193         int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
194         *target = SHAlloc(len);
195         WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
196 }
197
198 inline static void __SHCloneStrW(WCHAR ** target, const WCHAR * source)
199 {
200         *target = SHAlloc( (strlenW(source)+1) * sizeof(WCHAR) );
201         strcpyW(*target, source);
202 }
203
204 inline static WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
205 {
206         int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
207         *target = SHAlloc(len*sizeof(WCHAR));
208         MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
209         return *target;
210 }
211
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))
217
218 typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
219                             LPSHELLEXECUTEINFOW sei, LPSHELLEXECUTEINFOW sei_out);
220
221 BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc);
222
223 UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation,
224                           LPWSTR lpResult, int resultLen, LPWSTR key, WCHAR **env, LPITEMIDLIST pidl, LPCWSTR args);
225
226 extern WCHAR swShell32Name[MAX_PATH];
227
228 BOOL UNIXFS_is_rooted_at_desktop(void);
229 extern const GUID CLSID_UnixFolder;
230 extern const GUID CLSID_UnixDosFolder;
231
232 /* Default shell folder value registration */
233 HRESULT SHELL_RegisterShellFolders(void);
234
235 /* Detect Shell Links */
236 BOOL SHELL_IsShortcut(LPCITEMIDLIST);
237
238 #endif