xref: /reactos/dll/win32/shell32/precomp.h (revision 43d07fe6)
1 #ifndef _PRECOMP_H__
2 #define _PRECOMP_H__
3 
4 #include <stdarg.h>
5 #include <assert.h>
6 
7 #define COBJMACROS
8 #define WIN32_NO_STATUS
9 #define _INC_WINDOWS
10 #define COM_NO_WINDOWS_H
11 #define NTOS_MODE_USER
12 
13 #include <windef.h>
14 #include <winbase.h>
15 #include <winreg.h>
16 #include <winuser.h>
17 #include <wincon.h>
18 #include <commdlg.h>
19 #include <ddeml.h>
20 #include <userenv.h>
21 
22 #include <shlwapi.h>
23 #include <wininet.h>
24 #include <shlobj.h>
25 #include <shobjidl.h>
26 #include <ndk/rtlfuncs.h>
27 #include <fmifs/fmifs.h>
28 #include <tchar.h>
29 #include <strsafe.h>
30 #include <atlbase.h>
31 #include <atlcom.h>
32 #include <atlwin.h>
33 #include <atlstr.h>
34 #include <atlsimpcoll.h>
35 #include <atlcoll.h>
36 #include <powrprof.h>
37 #include <winnetwk.h>
38 #include <objsafe.h>
39 #include <regstr.h>
40 
41 #include <comctl32_undoc.h>
42 #include <shlguid_undoc.h>
43 #include <shlobj_undoc.h>
44 
45 #define SHLWAPI_ISHELLFOLDER_HELPERS
46 #include <shlwapi_undoc.h>
47 
48 #include <shellapi.h>
49 #undef ShellExecute
50 #include <undocshell.h>
51 
52 /*
53  * For versions < Vista+, redefine ShellMessageBoxW to ShellMessageBoxWrapW
54  * (this is needed to avoid a linker error). On Vista+ onwards, shell32.ShellMessageBoxW
55  * redirects to shlwapi.ShellMessageBoxW so the #define should not be needed.
56  *
57  * However our shell32 is built with _WIN32_WINNT set to 0x600 (Vista+),
58  * yet its exports (especially regarding ShellMessageBoxA/W) are Win2003
59  * compatible. So the #define is still needed, and the check be disabled.
60  */
61 // #if (_WIN32_WINNT < 0x0600)
62 #define ShellMessageBoxW ShellMessageBoxWrapW
63 // #endif
64 
65 #include <browseui_undoc.h>
66 
67 #include <shellutils.h>
68 
69 #include "shellrecyclebin/recyclebin.h"
70 #include "wine/pidl.h"
71 #include "debughlp.h"
72 #include "wine/shell32_main.h"
73 #include "shresdef.h"
74 #include "wine/cpanel.h"
75 #include "CActiveDesktop.h"
76 #include "CEnumIDListBase.h"
77 #include "shfldr.h"
78 #include "CShellItem.h"
79 #include "CShellLink.h"
80 #include "CFolderItemVerbs.h"
81 #include "CFolderItems.h"
82 #include "CFolder.h"
83 #include "CShellDispatch.h"
84 #include "CDropTargetHelper.h"
85 #include "CFolderOptions.h"
86 #include "folders/CFSFolder.h"
87 #include "folders/CDrivesFolder.h"
88 #include "folders/CDesktopFolder.h"
89 #include "folders/CControlPanelFolder.h"
90 #include "folders/CMyDocsFolder.h"
91 #include "folders/CNetFolder.h"
92 #include "folders/CFontsFolder.h"
93 #include "folders/CPrinterFolder.h"
94 #include "folders/CAdminToolsFolder.h"
95 #include "folders/CRecycleBin.h"
96 #include "droptargets/CexeDropHandler.h"
97 #include "droptargets/CFSDropTarget.h"
98 #include "COpenWithMenu.h"
99 #include "CNewMenu.h"
100 #include "CSendToMenu.h"
101 #include "CCopyMoveToMenu.h"
102 #include "CCopyAsPathMenu.h"
103 #include "dialogs/filedefext.h"
104 #include "dialogs/drvdefext.h"
105 #include "CQueryAssociations.h"
106 #include "shellmenu/CMenuBand.h"
107 #include "shellmenu/CMenuDeskBar.h"
108 #include "shellmenu/CMenuSite.h"
109 #include "shellmenu/CMergedFolder.h"
110 #include "shellmenu/shellmenu.h"
111 #include "CUserNotification.h"
112 #include "dialogs/folder_options.h"
113 #include "shelldesktop/CChangeNotifyServer.h"
114 #include "utils.h"
115 
116 #include <wine/debug.h>
117 #include <wine/unicode.h>
118 
119 extern const GUID CLSID_AdminFolderShortcut;
120 extern const GUID CLSID_FontsFolderShortcut;
121 extern const GUID CLSID_StartMenu;
122 extern const GUID CLSID_MenuBandSite;
123 extern const GUID CLSID_OpenWith;
124 extern const GUID CLSID_UnixFolder;
125 extern const GUID CLSID_UnixDosFolder;
126 extern const GUID SHELL32_AdvtShortcutProduct;
127 extern const GUID SHELL32_AdvtShortcutComponent;
128 
129 #define MAX_PROPERTY_SHEET_PAGE 32
130 
131 #define VERBKEY_CCHMAX 64 // Note: 63+\0 seems to be the limit on XP
132 
133 extern inline
134 BOOL
135 CALLBACK
AddPropSheetPageCallback(HPROPSHEETPAGE hPage,LPARAM lParam)136 AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
137 {
138     PROPSHEETHEADERW *pHeader = (PROPSHEETHEADERW *)lParam;
139 
140     if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
141     {
142         pHeader->phpage[pHeader->nPages++] = hPage;
143         return TRUE;
144     }
145 
146     return FALSE;
147 }
148 
149 HRESULT
150 SHELL32_ShowPropertiesDialog(IDataObject *pdtobj);
151 HRESULT
152 SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg);
153 UINT
154 MapVerbToDfmCmd(_In_ LPCSTR verba);
155 UINT
156 GetDfmCmd(_In_ IContextMenu *pCM, _In_ LPCSTR verba);
157 #define SHELL_ExecuteControlPanelCPL(hwnd, cpl) SHRunControlPanel((cpl), (hwnd))
158 
159 #define CmicFlagsToSeeFlags(flags)  ((flags) & SEE_CMIC_COMMON_FLAGS)
SeeFlagsToCmicFlags(UINT flags)160 static inline UINT SeeFlagsToCmicFlags(UINT flags)
161 {
162     if (flags & SEE_MASK_CLASSNAME)
163         flags &= ~(SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE);
164     return flags & SEE_CMIC_COMMON_FLAGS;
165 }
166 
167 
168 // CStubWindow32 --- The owner window of file property sheets.
169 // This window hides taskbar button of property sheet.
170 class CStubWindow32 : public CWindowImpl<CStubWindow32>
171 {
172 public:
173     DECLARE_WND_CLASS_EX(_T("StubWindow32"), 0, COLOR_WINDOWTEXT)
174 
175     BEGIN_MSG_MAP(CStubWindow32)
176     END_MSG_MAP()
177 };
178 
179 void PostCabinetMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
180 
181 HRESULT
182 Shell_TranslateIDListAlias(
183     _In_ LPCITEMIDLIST pidl,
184     _In_ HANDLE hToken,
185     _Out_ LPITEMIDLIST *ppidlAlias,
186     _In_ DWORD dwFlags);
187 
188 BOOL BindCtx_ContainsObject(_In_ IBindCtx *pBindCtx, _In_ LPCWSTR pszName);
189 DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault);
190 BOOL SHSkipJunctionBinding(_In_ IBindCtx *pbc, _In_ CLSID *pclsid);
191 HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData);
192 BOOL Shell_FailForceReturn(_In_ HRESULT hr);
193 
194 EXTERN_C INT
195 Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch);
196 
197 HRESULT
198 Shell_DisplayNameOf(
199     _In_ IShellFolder *psf,
200     _In_ LPCITEMIDLIST pidl,
201     _In_ DWORD dwFlags,
202     _Out_ LPWSTR pszBuf,
203     _In_ UINT cchBuf);
204 
205 EXTERN_C
206 HRESULT SHBindToObject(
207     _In_opt_ IShellFolder *psf,
208     _In_ LPCITEMIDLIST pidl,
209     _In_ REFIID riid,
210     _Out_ void **ppvObj);
211 
212 HRESULT
213 SHBindToObjectEx(
214     _In_opt_ IShellFolder *pShellFolder,
215     _In_ LPCITEMIDLIST pidl,
216     _In_opt_ IBindCtx *pBindCtx,
217     _In_ REFIID riid,
218     _Out_ void **ppvObj);
219 
220 DWORD
221 SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes);
222 HRESULT SHCoInitializeAnyApartment(VOID);
223 
224 HRESULT
225 SHGetNameAndFlagsW(
226     _In_ LPCITEMIDLIST pidl,
227     _In_ DWORD dwFlags,
228     _Out_opt_ LPWSTR pszText,
229     _In_ UINT cchBuf,
230     _Inout_opt_ DWORD *pdwAttributes);
231 
232 EXTERN_C HWND BindCtx_GetUIWindow(_In_ IBindCtx *pBindCtx);
233 
234 EXTERN_C HRESULT
235 BindCtx_RegisterObjectParam(
236     _In_ IBindCtx *pBindCtx,
237     _In_ LPOLESTR pszKey,
238     _In_opt_ IUnknown *punk,
239     _Out_ LPBC *ppbc);
240 
241 BOOL PathIsDotOrDotDotW(_In_ LPCWSTR pszPath);
242 BOOL PathIsValidElement(_In_ LPCWSTR pszPath);
243 BOOL PathIsDosDevice(_In_ LPCWSTR pszName);
244 HRESULT SHILAppend(_Inout_ LPITEMIDLIST pidl, _Inout_ LPITEMIDLIST *ppidl);
245 
246 PIDLIST_ABSOLUTE SHELL_CIDA_ILCloneFull(_In_ const CIDA *pCIDA, _In_ UINT Index);
247 PIDLIST_ABSOLUTE SHELL_DataObject_ILCloneFullItem(_In_ IDataObject *pDO, _In_ UINT Index);
248 
249 EXTERN_C HRESULT
250 IUnknown_InitializeCommand(
251     _In_ IUnknown *pUnk,
252     _In_ PCWSTR pszCommandName,
253     _In_opt_ IPropertyBag *pPB);
254 EXTERN_C HRESULT
255 InvokeIExecuteCommand(
256     _In_ IExecuteCommand *pEC,
257     _In_ PCWSTR pszCommandName,
258     _In_opt_ IPropertyBag *pPB,
259     _In_opt_ IShellItemArray *pSIA,
260     _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
261     _In_opt_ IUnknown *pSite);
262 EXTERN_C HRESULT
263 InvokeIExecuteCommandWithDataObject(
264     _In_ IExecuteCommand *pEC,
265     _In_ PCWSTR pszCommandName,
266     _In_opt_ IPropertyBag *pPB,
267     _In_ IDataObject *pDO,
268     _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
269     _In_opt_ IUnknown *pSite);
270 
271 #endif /* _PRECOMP_H__ */
272