ReactOS 0.4.16-dev-1007-g2e85425
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 <emptyvc.h>
27#include <ndk/rtlfuncs.h>
28#include <fmifs/fmifs.h>
29#include <tchar.h>
30#include <strsafe.h>
31#include <atlbase.h>
32#include <atlcom.h>
33#include <atlwin.h>
34#include <atlstr.h>
35#include <atlsimpcoll.h>
36#include <atlcoll.h>
37#include <powrprof.h>
38#include <winnetwk.h>
39#include <objsafe.h>
40#include <regstr.h>
41
42#include <comctl32_undoc.h>
43#include <shlguid_undoc.h>
44#include <shlobj_undoc.h>
45
46#include <shlwapi_undoc.h>
48
49#include <shellapi.h>
50#undef ShellExecute
51#include <undocshell.h>
52
53/*
54 * For versions < Vista+, redefine ShellMessageBoxW to ShellMessageBoxWrapW
55 * (this is needed to avoid a linker error). On Vista+ onwards, shell32.ShellMessageBoxW
56 * redirects to shlwapi.ShellMessageBoxW so the #define should not be needed.
57 *
58 * However our shell32 is built with _WIN32_WINNT set to 0x600 (Vista+),
59 * yet its exports (especially regarding ShellMessageBoxA/W) are Win2003
60 * compatible. So the #define is still needed, and the check be disabled.
61 */
62// #if (_WIN32_WINNT < 0x0600)
63#define ShellMessageBoxW ShellMessageBoxWrapW
64// #endif
65
66#include <browseui_undoc.h>
67
68#include <shellutils.h>
69
71#include "wine/pidl.h"
72#include "debughlp.h"
73#include "wine/shell32_main.h"
74#include "shresdef.h"
75#include "wine/cpanel.h"
76#include "CActiveDesktop.h"
77#include "CEnumIDListBase.h"
78#include "shfldr.h"
79#include "CShellItem.h"
80#include "CShellLink.h"
81#include "CFolderItemVerbs.h"
82#include "CFolderItems.h"
83#include "CFolder.h"
84#include "CShellDispatch.h"
85#include "CDropTargetHelper.h"
86#include "CFolderOptions.h"
87#include "folders/CFSFolder.h"
92#include "folders/CNetFolder.h"
96#include "folders/CRecycleBin.h"
99#include "COpenWithMenu.h"
100#include "CNewMenu.h"
101#include "CSendToMenu.h"
102#include "CCopyMoveToMenu.h"
103#include "CCopyAsPathMenu.h"
104#include "dialogs/filedefext.h"
105#include "dialogs/drvdefext.h"
106#include "CQueryAssociations.h"
107#include "shellmenu/CMenuBand.h"
109#include "shellmenu/CMenuSite.h"
111#include "shellmenu/shellmenu.h"
112#include "CUserNotification.h"
115#include "utils.h"
116
117#include <wine/debug.h>
118#include <wine/unicode.h>
119
122extern const GUID CLSID_StartMenu;
123extern const GUID CLSID_MenuBandSite;
124extern const GUID CLSID_OpenWith;
125extern const GUID CLSID_UnixFolder;
126extern const GUID CLSID_UnixDosFolder;
129
130#define VERBKEY_CCHMAX 64 // Note: 63+\0 seems to be the limit on XP
131
132#define MAX_PROPERTY_SHEET_PAGE 32
133
134extern inline
135BOOL
138{
140
141 if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
142 {
143 pHeader->phpage[pHeader->nPages++] = hPage;
144 return TRUE;
145 }
146
147 return FALSE;
148}
149
150static inline HRESULT
152{
153 if (!hPage)
154 return E_FAIL;
155 if (pfnAddPage(hPage, lParam))
156 return S_OK;
158 return E_FAIL;
159}
160
161template<class T> static UINT CALLBACK
163{
164 if (uMsg == PSPCB_RELEASE)
165 ((T*)(pPSP->lParam))->Release();
166 return TRUE;
167}
168
181
184UINT
186UINT
188#define SHELL_ExecuteControlPanelCPL(hwnd, cpl) SHRunControlPanel((cpl), (hwnd))
189
190#define CmicFlagsToSeeFlags(flags) ((flags) & SEE_CMIC_COMMON_FLAGS)
192{
196}
197
198
199// CStubWindow32 --- The owner window of file property sheets.
200// This window hides taskbar button of property sheet.
201#define CSTUBWINDOW32_CLASSNAME _T("StubWindow32")
202class CStubWindow32 : public CWindowImpl<CStubWindow32>
203{
205public:
207 enum {
210 };
211 static LPCWSTR GetTypePropName() { return L"StubType"; }
213
215 {
216 if (HICON hIco = (HICON)SendMessage(WM_SETICON, ICON_BIG, NULL))
217 DestroyIcon(hIco);
219 return 0;
220 }
221
225};
226
228
231 _In_ LPCITEMIDLIST pidl,
232 _In_ HANDLE hToken,
233 _Out_ LPITEMIDLIST *ppidlAlias,
235
241
244
248 _In_ LPCITEMIDLIST pidl,
250 _Out_ void **ppvObj);
251
254 _In_opt_ IShellFolder *pShellFolder,
255 _In_ LPCITEMIDLIST pidl,
256 _In_opt_ IBindCtx *pBindCtx,
258 _Out_ void **ppvObj);
259
264 _In_ REFIID riid, _Out_ void **ppvObj);
265
266DWORD
270
273 _In_ LPCITEMIDLIST pidl,
275 _Out_opt_ LPWSTR pszText,
276 _In_ UINT cchBuf,
277 _Inout_opt_ DWORD *pdwAttributes);
278
280
283 _In_ IBindCtx *pBindCtx,
284 _In_ LPOLESTR pszKey,
285 _In_opt_ IUnknown *punk,
286 _Out_ LPBC *ppbc);
287
293
298
302 _In_ PCWSTR pszCommandName,
306 _In_ IExecuteCommand *pEC,
307 _In_ PCWSTR pszCommandName,
309 _In_opt_ IShellItemArray *pSIA,
310 _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
311 _In_opt_ IUnknown *pSite);
314 _In_ IExecuteCommand *pEC,
315 _In_ PCWSTR pszCommandName,
317 _In_ IDataObject *pDO,
318 _In_opt_ LPCMINVOKECOMMANDINFOEX pICI,
319 _In_opt_ IUnknown *pSite);
320
336 UINT Attributes, HRESULT hr, void *CallerData);
337int SHELL32_FileOperation(LPSHFILEOPSTRUCTW lpFileOp, FILEOPCALLBACK Callback, void *CallerData);
339
340#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:211
@ TYPE_PROPERTYSHEET
Definition: precomp.h:209
@ TYPE_FORMATDRIVE
Definition: precomp.h:208
static HWND FindStubWindow(UINT Type, LPCWSTR Path)
Definition: utils.cpp:100
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: precomp.h:214
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1672 Msg[]
#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:92
HRESULT DataObject_GetHIDACount(IDataObject *pdo)
DWORD SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
Definition: utils.cpp:425
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:2010
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:480
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:278
static UINT SeeFlagsToCmicFlags(UINT flags)
Definition: precomp.h:191
HRESULT SHELL32_ShowFilesystemItemsPropertiesDialogAsync(HWND hOwner, IDataObject *pDO)
Definition: item_prop.cpp:184
#define MAX_PROPERTY_SHEET_PAGE
Definition: precomp.h:132
#define CSTUBWINDOW32_CLASSNAME
Definition: precomp.h:201
static UINT CALLBACK PropSheetPageLifetimeCallback(HWND hWnd, UINT uMsg, PROPSHEETPAGEW *pPSP)
Definition: precomp.h:162
BOOL BindCtx_ContainsObject(_In_ IBindCtx *pBindCtx, _In_ LPCWSTR pszName)
Definition: utils.cpp:270
const GUID SHELL32_AdvtShortcutProduct
_FILEOPCALLBACKEVENT
Definition: precomp.h:321
@ FOCE_PRERENAMEITEM
Definition: precomp.h:330
@ FOCE_POSTDELETEITEM
Definition: precomp.h:329
@ FOCE_PREMOVEITEM
Definition: precomp.h:324
@ FOCE_STARTOPERATIONS
Definition: precomp.h:322
@ FOCE_PRENEWITEM
Definition: precomp.h:332
@ FOCE_FINISHOPERATIONS
Definition: precomp.h:323
@ FOCE_POSTRENAMEITEM
Definition: precomp.h:331
@ FOCE_POSTNEWITEM
Definition: precomp.h:333
@ FOCE_POSTMOVEITEM
Definition: precomp.h:325
@ FOCE_PRECOPYITEM
Definition: precomp.h:326
@ FOCE_PREDELETEITEM
Definition: precomp.h:328
@ FOCE_POSTCOPYITEM
Definition: precomp.h:327
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:1667
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:1654
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync(IDataObject *pDO)
Definition: item_prop.cpp:157
const GUID CLSID_FontsFolderShortcut
UINT GetDfmCmd(_In_ IContextMenu *pCM, _In_ LPCSTR verba)
Definition: utils.cpp:1736
static HRESULT AddPropSheetPage(HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: precomp.h:151
int SHELL32_FileOperation(LPSHFILEOPSTRUCTW lpFileOp, FILEOPCALLBACK Callback, void *CallerData)
Definition: shlfileop.cpp:2093
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:574
HRESULT SHELL_SingleFileOperation(HWND hWnd, UINT Op, PCWSTR Src, PCWSTR Dest, UINT Flags, PWSTR *ppNewName)
Definition: shlfileop.cpp:2446
void PostCabinetMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: view.cpp:880
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:528
const GUID CLSID_AdminFolderShortcut
HRESULT SHELL_ShowItemIDListProperties(LPCITEMIDLIST pidl)
Definition: item_prop.cpp:205
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:1708
EXTERN_C HWND BindCtx_GetUIWindow(_In_ IBindCtx *pBindCtx)
Definition: utils.cpp:514
HRESULT SHELL32_ShowShellExtensionProperties(const CLSID *pClsid, IDataObject *pDO)
Definition: item_prop.cpp:196
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:459
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:335
HRESULT SHELL32_ShowPropertiesDialog(IDataObject *pdtobj)
Definition: shlfolder.cpp:520
HRESULT SHELL32_GetDllFromRundll32CommandLine(LPCWSTR pszCmd, LPWSTR pszOut, SIZE_T cchMax)
const GUID SHELL32_AdvtShortcutComponent
BOOL CALLBACK AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
Definition: precomp.h:137
HRESULT SHCoInitializeAnyApartment(VOID)
Definition: utils.cpp:471
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:3043
#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:628
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:580
LPARAM lParam
Definition: prsht.h:227
#define ICON_BIG
Definition: tnclass.cpp:51
uint16_t * PWSTR
Definition: typedefs.h:56
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:932
#define SendMessage
Definition: winuser.h:5863
#define WM_DESTROY
Definition: winuser.h:1620
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185