ReactOS 0.4.16-dev-816-g135a9a9
precomp.h
Go to the documentation of this file.
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#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
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"
91#include "folders/CNetFolder.h"
95#include "folders/CRecycleBin.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"
108#include "shellmenu/CMenuSite.h"
110#include "shellmenu/shellmenu.h"
111#include "CUserNotification.h"
114#include "utils.h"
115
116#include <wine/debug.h>
117#include <wine/unicode.h>
118
121extern const GUID CLSID_StartMenu;
122extern const GUID CLSID_MenuBandSite;
123extern const GUID CLSID_OpenWith;
124extern const GUID CLSID_UnixFolder;
125extern const GUID CLSID_UnixDosFolder;
128
129#define VERBKEY_CCHMAX 64 // Note: 63+\0 seems to be the limit on XP
130
131#define MAX_PROPERTY_SHEET_PAGE 32
132
133extern inline
134BOOL
137{
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
149static inline HRESULT
151{
152 if (!hPage)
153 return E_FAIL;
154 if (pfnAddPage(hPage, lParam))
155 return S_OK;
157 return E_FAIL;
158}
159
160template<class T> static UINT CALLBACK
162{
163 if (uMsg == PSPCB_RELEASE)
164 ((T*)(pPSP->lParam))->Release();
165 return TRUE;
166}
167
178
181UINT
183UINT
185#define SHELL_ExecuteControlPanelCPL(hwnd, cpl) SHRunControlPanel((cpl), (hwnd))
186
187#define CmicFlagsToSeeFlags(flags) ((flags) & SEE_CMIC_COMMON_FLAGS)
189{
193}
194
195
196// CStubWindow32 --- The owner window of file property sheets.
197// This window hides taskbar button of property sheet.
198#define CSTUBWINDOW32_CLASSNAME _T("StubWindow32")
199class CStubWindow32 : public CWindowImpl<CStubWindow32>
200{
202public:
204 enum {
207 };
208 static LPCWSTR GetTypePropName() { return L"StubType"; }
210
212 {
213 if (HICON hIco = (HICON)SendMessage(WM_SETICON, ICON_BIG, NULL))
214 DestroyIcon(hIco);
216 return 0;
217 }
218
222};
223
225
228 _In_ LPCITEMIDLIST pidl,
229 _In_ HANDLE hToken,
230 _Out_ LPITEMIDLIST *ppidlAlias,
232
238
241
244 _In_ IShellFolder *psf,
245 _In_ LPCITEMIDLIST pidl,
247 _Out_ LPWSTR pszBuf,
248 _In_ UINT cchBuf);
249
253 _In_ LPCITEMIDLIST pidl,
255 _Out_ void **ppvObj);
256
259 _In_opt_ IShellFolder *pShellFolder,
260 _In_ LPCITEMIDLIST pidl,
261 _In_opt_ IBindCtx *pBindCtx,
263 _Out_ void **ppvObj);
264
269 _In_ REFIID riid, _Out_ void **ppvObj);
270
271DWORD
275
278 _In_ LPCITEMIDLIST pidl,
280 _Out_opt_ LPWSTR pszText,
281 _In_ UINT cchBuf,
282 _Inout_opt_ DWORD *pdwAttributes);
283
285
288 _In_ IBindCtx *pBindCtx,
289 _In_ LPOLESTR pszKey,
290 _In_opt_ IUnknown *punk,
291 _Out_ LPBC *ppbc);
292
298
302
306 _In_ PCWSTR pszCommandName,
310 _In_ IExecuteCommand *pEC,
311 _In_ PCWSTR pszCommandName,
313 _In_opt_ IShellItemArray *pSIA,
314 _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
315 _In_opt_ IUnknown *pSite);
318 _In_ IExecuteCommand *pEC,
319 _In_ PCWSTR pszCommandName,
321 _In_ IDataObject *pDO,
322 _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
323 _In_opt_ IUnknown *pSite);
324
334 UINT Attributes, HRESULT hr, void *CallerData);
335int SHELL32_FileOperation(LPSHFILEOPSTRUCTW lpFileOp, FILEOPCALLBACK Callback, void *CallerData);
336
337#endif /* _PRECOMP_H__ */
PRTL_UNICODE_STRING_BUFFER Path
UINT cchMax
Type
Definition: Type.h:7
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define EXTERN_C
Definition: basetyps.h:12
_In_ BOOLEAN Release
Definition: cdrom.h:920
HWND m_hWnd
Definition: atlwin.h:273
HRESULT CreateStub(UINT Type, LPCWSTR Path, const POINT *pPt)
Definition: utils.cpp:113
static LPCWSTR GetTypePropName()
Definition: precomp.h:208
static HWND FindStubWindow(UINT Type, LPCWSTR Path)
Definition: utils.cpp:100
@ TYPE_PROPERTYSHEET
Definition: precomp.h:206
@ TYPE_FORMATDRIVE
Definition: precomp.h:205
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: precomp.h:211
WPARAM wParam
Definition: combotst.c:138
struct @1647 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define CALLBACK
Definition: compat.h:35
enum _FILEOPCALLBACKEVENT FILEOPCALLBACKEVENT
PIDLIST_ABSOLUTE SHELL_CIDA_ILCloneFull(_In_ const CIDA *pCIDA, _In_ UINT Index)
EXTERN_C HRESULT WINAPI SHMultiFileProperties(IDataObject *pDataObject, DWORD dwFlags)
Definition: stubs.cpp:101
HRESULT Shell_DisplayNameOf(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_ LPWSTR pszBuf, _In_ UINT cchBuf)
Definition: utils.cpp:406
DWORD SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
Definition: utils.cpp:422
const GUID CLSID_UnixDosFolder
const GUID CLSID_MenuBandSite
const GUID CLSID_OpenWith
EXTERN_C INT Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch)
Definition: shellpath.c:1859
UINT MapVerbToDfmCmd(_In_ LPCSTR verba)
HRESULT SHGetNameAndFlagsW(_In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_opt_ LPWSTR pszText, _In_ UINT cchBuf, _Inout_opt_ DWORD *pdwAttributes)
Definition: utils.cpp:477
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:278
static UINT SeeFlagsToCmicFlags(UINT flags)
Definition: precomp.h:188
#define MAX_PROPERTY_SHEET_PAGE
Definition: precomp.h:131
#define CSTUBWINDOW32_CLASSNAME
Definition: precomp.h:198
static UINT CALLBACK PropSheetPageLifetimeCallback(HWND hWnd, UINT uMsg, PROPSHEETPAGEW *pPSP)
Definition: precomp.h:161
BOOL BindCtx_ContainsObject(_In_ IBindCtx *pBindCtx, _In_ LPCWSTR pszName)
Definition: utils.cpp:270
const GUID SHELL32_AdvtShortcutProduct
_FILEOPCALLBACKEVENT
Definition: precomp.h:325
@ FOCE_POSTDELETEITEM
Definition: precomp.h:331
@ FOCE_PREMOVEITEM
Definition: precomp.h:328
@ FOCE_STARTOPERATIONS
Definition: precomp.h:326
@ FOCE_FINISHOPERATIONS
Definition: precomp.h:327
@ FOCE_POSTMOVEITEM
Definition: precomp.h:329
@ FOCE_PREDELETEITEM
Definition: precomp.h:330
HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
Definition: utils.cpp:303
BOOL PathIsValidElement(_In_ LPCWSTR pszPath)
Definition: utils.cpp:158
const GUID CLSID_UnixFolder
EXTERN_C HRESULT InvokeIExecuteCommand(_In_ IExecuteCommand *pEC, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB, _In_opt_ IShellItemArray *pSIA, _In_opt_ LPCMINVOKECOMMANDINFOEX pICI, _In_opt_ IUnknown *pSite)
Definition: utils.cpp:1664
HRESULT SHELL_CloneDataObject(_In_ IDataObject *pDO, _Out_ IDataObject **ppDO)
BOOL Shell_FailForceReturn(_In_ HRESULT hr)
Definition: utils.cpp:320
EXTERN_C HRESULT SHBindToObject(_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:370
EXTERN_C HRESULT IUnknown_InitializeCommand(_In_ IUnknown *pUnk, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB)
Definition: utils.cpp:1651
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync(IDataObject *pDO)
Definition: item_prop.cpp:146
const GUID CLSID_FontsFolderShortcut
UINT GetDfmCmd(_In_ IContextMenu *pCM, _In_ LPCSTR verba)
Definition: utils.cpp:1733
static HRESULT AddPropSheetPage(HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: precomp.h:150
int SHELL32_FileOperation(LPSHFILEOPSTRUCTW lpFileOp, FILEOPCALLBACK Callback, void *CallerData)
Definition: shlfileop.cpp:2020
EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem(_In_opt_ HWND hWnd, _In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:380
EXTERN_C HRESULT BindCtx_RegisterObjectParam(_In_ IBindCtx *pBindCtx, _In_ LPOLESTR pszKey, _In_opt_ IUnknown *punk, _Out_ LPBC *ppbc)
Definition: utils.cpp:571
void PostCabinetMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: view.cpp:880
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:525
const GUID CLSID_AdminFolderShortcut
HRESULT SHELL_ShowItemIDListProperties(LPCITEMIDLIST pidl)
Definition: item_prop.cpp:182
EXTERN_C HRESULT InvokeIExecuteCommandWithDataObject(_In_ IExecuteCommand *pEC, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB, _In_ IDataObject *pDO, _In_opt_ LPCMINVOKECOMMANDINFOEX pICI, _In_opt_ IUnknown *pSite)
Definition: utils.cpp:1705
EXTERN_C HWND BindCtx_GetUIWindow(_In_ IBindCtx *pBindCtx)
Definition: utils.cpp:511
HRESULT SHELL32_ShowShellExtensionProperties(const CLSID *pClsid, IDataObject *pDO)
Definition: item_prop.cpp:173
const GUID CLSID_StartMenu
HRESULT SHBindToObjectEx(_In_opt_ IShellFolder *pShellFolder, _In_ LPCITEMIDLIST pidl, _In_opt_ IBindCtx *pBindCtx, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:337
HRESULT Shell_TranslateIDListAlias(_In_ LPCITEMIDLIST pidl, _In_ HANDLE hToken, _Out_ LPITEMIDLIST *ppidlAlias, _In_ DWORD dwFlags)
Definition: utils.cpp:261
PIDLIST_ABSOLUTE SHELL_DataObject_ILCloneFullItem(_In_ IDataObject *pDO, _In_ UINT Index)
BOOL SHSkipJunctionBinding(_In_ IBindCtx *pbc, _In_ CLSID *pclsid)
Definition: utils.cpp:291
HRESULT SHELL_GetIDListTarget(_In_ LPCITEMIDLIST pidl, _Out_ PIDLIST_ABSOLUTE *ppidl)
Definition: utils.cpp:456
BOOL PathIsDotOrDotDotW(_In_ LPCWSTR pszPath)
Definition: utils.cpp:146
HRESULT SHILAppend(_Inout_ LPITEMIDLIST pidl, _Inout_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:193
HRESULT(CALLBACK * FILEOPCALLBACK)(FILEOPCALLBACKEVENT Event, LPCWSTR Source, LPCWSTR Destination, UINT Attributes, HRESULT hr, void *CallerData)
Definition: precomp.h:333
HRESULT SHELL32_ShowPropertiesDialog(IDataObject *pdtobj)
Definition: shlfolder.cpp:508
HRESULT SHELL32_GetDllFromRundll32CommandLine(LPCWSTR pszCmd, LPWSTR pszOut, SIZE_T cchMax)
const GUID SHELL32_AdvtShortcutComponent
BOOL CALLBACK AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
Definition: precomp.h:136
HRESULT SHCoInitializeAnyApartment(VOID)
Definition: utils.cpp:468
BOOL PathIsDosDevice(_In_ LPCWSTR pszName)
Definition: utils.cpp:172
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
FxContextHeader * pHeader
Definition: handleapi.cpp:604
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define END_MSG_MAP()
Definition: atlwin.h:1917
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:2004
#define T
Definition: mbstring.h:31
static HICON
Definition: imagelist.c:80
static LPOLESTR
Definition: stg_prop.c:27
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3028
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define L(x)
Definition: ntvdm.h:50
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define PSPCB_RELEASE
Definition: prsht.h:37
#define REFIID
Definition: guiddef.h:118
#define SEE_MASK_CLASSNAME
Definition: shellapi.h:25
#define SEE_MASK_HASTITLE
Definition: shellapi.h:52
#define SEE_MASK_HASLINKNAME
Definition: shellapi.h:49
#define SEE_CMIC_COMMON_FLAGS
Definition: shellutils.h:626
HRESULT hr
Definition: shlfolder.c:183
LPARAM LPFNSVADDPROPSHEETPAGE
Definition: shobjidl.idl:117
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
Definition: shlobj.h:572
LPARAM lParam
Definition: prsht.h:227
#define ICON_BIG
Definition: tnclass.cpp:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
DWORD dwAttributes
Definition: vdmdbg.h:34
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define COLOR_WINDOWTEXT
Definition: winuser.h:924
#define SendMessage
Definition: winuser.h:5855
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2139
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185