wined3d: Check the writemask before activating the oC0 optimization.
[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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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/unicode.h"
39
40 /*******************************************
41 *  global SHELL32.DLL variables
42 */
43 extern HMODULE  huser32;
44 extern HINSTANCE shell32_hInstance;
45 extern HIMAGELIST       ShellSmallIconList;
46 extern HIMAGELIST       ShellBigIconList;
47
48 /* Iconcache */
49 #define INVALID_INDEX -1
50 BOOL SIC_Initialize(void);
51 void SIC_Destroy(void);
52 BOOL PidlToSicIndex (IShellFolder * sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int * pIndex);
53 INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags );
54
55 /* Classes Root */
56 BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot);
57 BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
58 BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
59 BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx);
60 BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
61
62 /* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
63 BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot);
64 BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx);
65 BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
66
67 BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
68
69 DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
70 DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len);
71
72 /****************************************************************************
73  * Class constructors
74  */
75 LPDATAOBJECT    IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST myPidl, LPCITEMIDLIST * apidl, UINT cidl);
76 LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT, const FORMATETC []);
77
78 LPCLASSFACTORY  IClassFactory_Constructor(REFCLSID);
79 IContextMenu2 * ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *aPidls, UINT uItemCount);
80 IContextMenu2 * ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
81 LPSHELLVIEW     IShellView_Constructor(LPSHELLFOLDER);
82
83 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
84 HRESULT WINAPI IShellItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
85 HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
86 HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv);
87 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
88 HRESULT WINAPI ISF_MyComputer_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
89 HRESULT WINAPI ISF_NetworkPlaces_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
90 HRESULT WINAPI Printers_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
91 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
92 HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *pfd, LPBC *ppV);
93 HRESULT WINAPI IControlPanel_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
94 HRESULT WINAPI UnixFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
95 HRESULT WINAPI UnixDosFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
96 HRESULT WINAPI FolderShortcut_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
97 HRESULT WINAPI MyDocuments_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *ppv);
98 HRESULT WINAPI RecycleBin_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv);
99 HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput);
100 extern HRESULT CPanel_GetIconLocationW(LPCITEMIDLIST, 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 /* initialisation for FORMATETC */
110 #define InitFormatEtc(fe, cf, med) \
111         {\
112         (fe).cfFormat=cf;\
113         (fe).dwAspect=DVASPECT_CONTENT;\
114         (fe).ptd=NULL;\
115         (fe).tymed=med;\
116         (fe).lindex=-1;\
117         };
118
119 #define KeyStateToDropEffect(kst)\
120     ((((kst)&(MK_CONTROL|MK_SHIFT))==(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_LINK :\
121     (((kst)&(MK_CONTROL|MK_SHIFT)) ? DROPEFFECT_COPY :\
122     DROPEFFECT_MOVE))
123
124
125 HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
126 HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
127 HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
128 HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl);
129
130 /* Change Notification */
131 void InitChangeNotifications(void);
132 void FreeChangeNotifications(void);
133
134 /* file operation */
135 #define ASK_DELETE_FILE           1
136 #define ASK_DELETE_FOLDER         2
137 #define ASK_DELETE_MULTIPLE_ITEM  3
138 #define ASK_CREATE_FOLDER         4
139 #define ASK_OVERWRITE_FILE        5
140 #define ASK_DELETE_SELECTED       6
141 #define ASK_TRASH_FILE            7
142 #define ASK_TRASH_FOLDER          8
143 #define ASK_TRASH_MULTIPLE_ITEM   9
144 #define ASK_CANT_TRASH_ITEM      10
145 #define ASK_OVERWRITE_FOLDER     11
146
147 BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);
148
149 static inline BOOL SHELL_OsIsUnicode(void)
150 {
151     /* if high-bit of version is 0, we are emulating NT */
152     return !(GetVersion() & 0x80000000);
153 }
154
155 #define __SHFreeAndNil(ptr) \
156         {\
157           SHFree(*ptr); \
158           *ptr = NULL; \
159         };
160 static inline void __SHCloneStrA(char ** target,const char * source)
161 {
162         *target = SHAlloc(strlen(source)+1);
163         strcpy(*target, source);
164 }
165
166 static inline void __SHCloneStrWtoA(char ** target, const WCHAR * source)
167 {
168         int len = WideCharToMultiByte(CP_ACP, 0, source, -1, NULL, 0, NULL, NULL);
169         *target = SHAlloc(len);
170         WideCharToMultiByte(CP_ACP, 0, source, -1, *target, len, NULL, NULL);
171 }
172
173 static inline void __SHCloneStrW(WCHAR ** target, const WCHAR * source)
174 {
175         *target = SHAlloc( (lstrlenW(source)+1) * sizeof(WCHAR) );
176         lstrcpyW(*target, source);
177 }
178
179 static inline WCHAR * __SHCloneStrAtoW(WCHAR ** target, const char * source)
180 {
181         int len = MultiByteToWideChar(CP_ACP, 0, source, -1, NULL, 0);
182         *target = SHAlloc(len*sizeof(WCHAR));
183         MultiByteToWideChar(CP_ACP, 0, source, -1, *target, len);
184         return *target;
185 }
186
187
188 extern WCHAR swShell32Name[MAX_PATH];
189
190 BOOL UNIXFS_is_rooted_at_desktop(void);
191 extern const GUID CLSID_UnixFolder;
192 extern const GUID CLSID_UnixDosFolder;
193
194 extern BOOL run_winemenubuilder( const WCHAR *args );
195
196 /* Default shell folder value registration */
197 HRESULT SHELL_RegisterShellFolders(void);
198
199 /* Detect Shell Links */
200 BOOL SHELL_IsShortcut(LPCITEMIDLIST);
201
202 #endif