ReactOS  0.4.15-dev-4570-g4f8bbd1
precomp.h
Go to the documentation of this file.
1 #ifndef _EXPLORER_PRECOMP__H_
2 #define _EXPLORER_PRECOMP__H_
3 
4 #define WIN7_COMPAT_MODE 0
5 #define WIN7_DEBUG_MODE 0
6 
7 #if WIN7_DEBUG_MODE && !WIN7_COMPAT_MODE
8 #undef WIN7_COMPAT_MODE
9 #define WIN7_COMPAT_MODE 1
10 #endif
11 
12 #if DBG && !defined(_DEBUG)
13  #define _DEBUG // CORE-17505
14 #endif
15 
16 #include <stdio.h>
17 #include <tchar.h>
18 
19 #define WIN32_NO_STATUS
20 #define _INC_WINDOWS
21 #define COM_NO_WINDOWS_H
22 
23 #define COBJMACROS
24 
25 #include <windef.h>
26 #include <winbase.h>
27 #include <winreg.h>
28 #include <wingdi.h>
29 #include <winnls.h>
30 #include <wincon.h>
31 #include <atlbase.h>
32 #include <atlcom.h>
33 #include <atlwin.h>
34 #include <atlstr.h>
35 #include <atlcoll.h>
36 #include <atlsimpcoll.h>
37 #include <shellapi.h>
38 #include <shlobj.h>
39 #include <shlwapi.h>
40 #include <uxtheme.h>
41 #include <process.h>
42 #include <strsafe.h>
43 
44 #include <undocuser.h>
45 #include <shlwapi_undoc.h>
46 #include <shlobj_undoc.h>
47 #include <shlguid_undoc.h>
48 #include <undocshell.h>
49 
50 #include <ui/rosctrls.h>
51 #include <ui/rosdlgs.h>
52 #include <shellutils.h>
53 
54 #include "tmschema.h"
55 #include "resource.h"
56 
57 #include <wine/debug.h>
58 
59 WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
60 
61 #define ASSERT(cond) \
62  do if (!(cond)) { \
63  Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
64  } while (0)
65 
67 extern HANDLE hProcessHeap;
68 extern HKEY hkExplorer;
69 extern BOOL bExplorerIsShell;
70 
71 /*
72  * explorer.c
73  */
74 
75 static inline
76 LONG
78  IN LONG dwStyleMask,
79  IN LONG dwStyle)
80 {
81  return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
82 }
83 
84 static inline
85 LONG
87  IN LONG dwStyleMask,
88  IN LONG dwStyle)
89 {
90  return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
91 }
92 
93 HMENU
95  IN LPCWSTR lpMenuName);
96 
97 HMENU
98 FindSubMenu(IN HMENU hMenu,
99  IN UINT uItem,
100  IN BOOL fByPosition);
101 
102 BOOL
104  IN DWORD dwBufferSize);
105 
106 BOOL
108  IN UINT uPosition,
109  IN UINT uFlags,
110  ...);
111 
112 BOOL
114  IN LPCWSTR lpSubKey,
115  IN LPCWSTR lpValue);
116 
117 /*
118  * rshell.c
119  */
120 
123 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
126 void WINAPI _ShellDDEInit(BOOL bInit);
129 
130 /*
131  * traywnd.c
132  */
133 
134 #define TWM_GETTASKSWITCH (WM_USER + 236)
135 #define TWM_OPENSTARTMENU (WM_USER + 260)
136 #define TWM_SETTINGSCHANGED (WM_USER + 300)
137 
138 extern const GUID IID_IShellDesktopTray;
139 
140 #define INTERFACE ITrayWindow
142 {
143  /*** IUnknown methods ***/
147  /*** ITrayWindow methods ***/
150  STDMETHOD_(HWND, GetHWND) (THIS) PURE;
151  STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
152  STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
153  STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
154  STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
155  STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
156 };
157 #undef INTERFACE
158 
159 #if defined(COBJMACROS)
160 /*** IUnknown methods ***/
161 #define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
162 #define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p)
163 #define ITrayWindow_Release(p) (p)->lpVtbl->Release(p)
164 /*** ITrayWindow methods ***/
165 #define ITrayWindow_Open(p) (p)->lpVtbl->Open(p)
166 #define ITrayWindow_Close(p) (p)->lpVtbl->Close(p)
167 #define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
168 #define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
169 #define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
170 #define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
171 #define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
172 #define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)
173 #endif
174 
175 HRESULT CreateTrayWindow(ITrayWindow ** ppTray);
176 
177 VOID
178 TrayProcessMessages(IN OUT ITrayWindow *Tray);
179 
180 VOID
181 TrayMessageLoop(IN OUT ITrayWindow *Tray);
182 
183 /*
184  * settings.c
185  */
186 
187 typedef struct _TW_STUCKRECTS2
188 {
191  union
192  {
194  struct
195  {
200  };
201  };
206 
208 {
214 
215  BOOL Load();
216  BOOL Save();
217 };
218 
220 
221 /*
222  * shellservice.cpp
223  */
226 
227 /*
228  * startup.cpp
229  */
230 
231 BOOL DoStartStartupItems(ITrayWindow *Tray);
234 
235 /*
236  * trayprop.h
237  */
238 
239 VOID
240 DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar);
241 
242 /*
243  * desktop.cpp
244  */
245 HANDLE
246 DesktopCreateWindow(IN OUT ITrayWindow *Tray);
247 
248 VOID
250 
251 
252 /*
253  * notifyiconscust.cpp
254  */
255 VOID
257 
258 /*
259  * taskband.cpp
260  */
261 
262 extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */
263 HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
264 
265 /*
266  * tbsite.cpp
267  */
268 
269 #define INTERFACE ITrayBandSite
271 {
272  /*** IUnknown methods ***/
276  /*** IBandSiteStreamCallback ***/
277  STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
278  STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
279  /*** ITrayBandSite methods ***/
280  STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE;
281  STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE;
282  STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE;
283  STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE;
284 };
285 #undef INTERFACE
286 
287 #if defined(COBJMACROS)
288 /*** IUnknown methods ***/
289 #define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
290 #define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p)
291 #define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p)
292 /*** IBandSiteStreamCallback methods ***/
293 #define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c)
294 #define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b)
295 /*** ITrayBandSite methods ***/
296 #define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a)
297 #define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e)
298 #define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f)
299 #define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a)
300 #endif
301 
302 HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite);
303 
304 /*
305  * startmnu.cpp
306  */
307 
308 HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
309 
310 IMenuPopup*
311 CreateStartMenu(IN ITrayWindow *Tray,
312  OUT IMenuBand **ppMenuBand,
313  IN HBITMAP hbmBanner OPTIONAL,
314  IN BOOL bSmallIcons);
315 
316 /*
317  * startmnucust.cpp
318  */
319 VOID
321 
322 /*
323 * startmnusite.cpp
324 */
325 
326 HRESULT
327 CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv);
328 
329 /*
330  * trayntfy.c
331  */
332 
333 /* TrayClockWnd */
335 
336 /* TrayNotifyWnd */
337 #define TNWM_GETMINIMUMSIZE (WM_USER + 0x100)
338 #define TNWM_CHANGETRAYPOS (WM_USER + 0x104)
339 
340 #define NTNWM_REALIGN (0x1)
341 
343 
344 /* SysPagerWnd */
346 
347 /*
348  * taskswnd.c
349  */
350 
351 #define TSWM_UPDATETASKBARPOS (WM_USER + 2)
352 
354 
355 HRESULT
356 Tray_OnStartMenuDismissed(ITrayWindow* Tray);
357 
358 HRESULT
359 IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2);
360 
361 #endif /* _EXPLORER_PRECOMP__H_ */
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:32
BOOL GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer, IN DWORD dwBufferSize)
Definition: util.cpp:73
HKEY hkExplorer
Definition: explorer.cpp:26
HINSTANCE hInstance
Definition: charmap.c:20
#define IN
Definition: typedefs.h:39
BOOL FormatMenuString(IN HMENU hMenu, IN UINT uPosition, IN UINT uFlags,...)
Definition: util.cpp:106
#define REFIID
Definition: guiddef.h:118
DWORD HideClock
Definition: precomp.h:199
INT ProcessStartupItems(VOID)
Definition: startup.cpp:453
#define THIS_
Definition: basetyps.h:65
static HMENU hmenu
Definition: win.c:66
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define THIS
Definition: basetyps.h:66
HRESULT ShutdownShellServices(HDPA hdpa)
REFIID riid
Definition: precomp.h:44
HANDLE hProcessHeap
Definition: kbswitch.c:25
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
VOID ShowCustomizeNotifyIcons(HINSTANCE, HWND)
VOID TrayProcessMessages(IN OUT ITrayWindow *Tray)
HWND hWnd
Definition: settings.c:17
REFIID LPVOID * ppv
Definition: atlbase.h:39
IMenuPopup * CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons)
Definition: startmnu.cpp:44
static LONG SetWindowStyle(IN HWND hWnd, IN LONG dwStyleMask, IN LONG dwStyle)
Definition: precomp.h:77
#define GWL_EXSTYLE
Definition: winuser.h:845
struct _TW_STUCKRECTS2 * PTW_STUCKRECTS2
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:59
BOOL bShowSeconds
Definition: precomp.h:211
int32_t INT
Definition: typedefs.h:58
TW_STRUCKRECTS2 sr
Definition: precomp.h:213
WPARAM wParam
Definition: combotst.c:138
VOID TrayMessageLoop(IN OUT ITrayWindow *Tray)
HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayclock.cpp:764
HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow *TrayWnd, IN HWND hWndOwner, IContextMenu **ppCtxMenu)
VOID ShowCustomizeClassic(HINSTANCE, HWND)
VOID InitRSHELL(VOID)
Definition: rshell.cpp:27
#define Open
Definition: syshdrs.h:62
DWORD Position
Definition: precomp.h:202
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
Definition: rshell.cpp:81
LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT mask, UINT flags)
Definition: ordinal.c:1123
BOOL bExplorerIsShell
Definition: explorer.cpp:27
HRESULT CTrayNotifyWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayntfy.cpp:372
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:291
DWORD SmallIcons
Definition: precomp.h:198
VOID DesktopDestroyShellWindow(IN HANDLE hDesktop)
Definition: desktop.cpp:133
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static LPUNKNOWN
Definition: ndr_ole.c:49
DWORD AutoHide
Definition: precomp.h:196
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
static HWND hwndParent
Definition: cryptui.c:300
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: rshell.cpp:186
BOOL GetExplorerRegValueSet(IN HKEY hKey, IN LPCWSTR lpSubKey, IN LPCWSTR lpValue)
Definition: util.cpp:144
DWORD AlwaysOnTop
Definition: precomp.h:197
WINE_DEFAULT_DEBUG_CHANNEL(cmd)
static LONG SetWindowExStyle(IN HWND hWnd, IN LONG dwStyleMask, IN LONG dwStyle)
Definition: precomp.h:86
BOOL bHideInactiveIcons
Definition: precomp.h:212
const GUID CLSID_ITaskBand
Definition: taskband.cpp:27
LONG HRESULT
Definition: typedefs.h:79
HRESULT CreateTrayWindow(ITrayWindow **ppTray)
Definition: traywnd.cpp:3409
#define WINAPI
Definition: msvc.h:6
BOOL bGroupButtons
Definition: precomp.h:210
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand *pTaskBand, OUT ITrayBandSite **pBandSite)
Definition: tbsite.cpp:715
void WINAPI _ShellDDEInit(BOOL bInit)
Definition: rshell.cpp:139
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
Definition: rshell.cpp:52
HRESULT IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2)
Definition: util.cpp:11
DWORD dwFlags
Definition: precomp.h:193
HRESULT CSysPagerWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: syspager.cpp:1584
HANDLE DesktopCreateWindow(IN OUT ITrayWindow *Tray)
Definition: desktop.cpp:118
HRESULT InitShellServices(HDPA *phdpa)
REFIID LPVOID * ppvObject
Definition: precomp.h:44
HRESULT CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID &riid, PVOID *ppv)
HRESULT CTaskSwitchWnd_CreateInstance(IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv)
Definition: taskswnd.cpp:2007
DECLARE_INTERFACE_(ITrayWindow, IUnknown)
Definition: precomp.h:141
#define GWL_STYLE
Definition: winuser.h:846
HMENU LoadPopupMenu(IN HINSTANCE hInstance, IN LPCWSTR lpMenuName)
Definition: util.cpp:33
_In_ BOOLEAN Release
Definition: cdrom.h:920
Definition: sacdrv.h:268
FxAutoRegKey hKey
DWORD cbSize
Definition: precomp.h:189
#define PURE
Definition: basetyps.h:64
unsigned int UINT
Definition: ndis.h:50
HRESULT Tray_OnStartMenuDismissed(ITrayWindow *Tray)
Definition: traywnd.cpp:3424
const GUID IID_IShellDesktopTray
Definition: traywnd.cpp:137
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
BOOL DoFinishStartupItems(VOID)
Definition: startup.cpp:508
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
unsigned int ULONG
Definition: retypes.h:1
struct _TW_STUCKRECTS2 TW_STRUCKRECTS2
static HBITMAP
Definition: button.c:44
DWORD WINAPI _WinList_Init(void)
Definition: rshell.cpp:110
HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:167
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
BOOL DoStartStartupItems(ITrayWindow *Tray)
Definition: startup.cpp:519
LPARAM lParam
Definition: combotst.c:139
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv)
Definition: taskband.cpp:346
HMENU FindSubMenu(IN HMENU hMenu, IN UINT uItem, IN BOOL fByPosition)
Definition: util.cpp:55
Definition: dpa.c:48
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68