ReactOS  0.4.14-dev-77-gd9e7c48
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 #include <stdio.h>
13 #include <tchar.h>
14 
15 #define WIN32_NO_STATUS
16 #define _INC_WINDOWS
17 #define COM_NO_WINDOWS_H
18 
19 #define COBJMACROS
20 
21 #include <windef.h>
22 #include <winbase.h>
23 #include <winreg.h>
24 #include <wingdi.h>
25 #include <winnls.h>
26 #include <wincon.h>
27 #include <atlbase.h>
28 #include <atlcom.h>
29 #include <atlwin.h>
30 #include <atlstr.h>
31 #include <atlcoll.h>
32 #include <atlsimpcoll.h>
33 #include <shellapi.h>
34 #include <shlobj.h>
35 #include <shlwapi.h>
36 #include <uxtheme.h>
37 #include <process.h>
38 #include <strsafe.h>
39 
40 #include <undocuser.h>
41 #include <shlwapi_undoc.h>
42 #include <shlobj_undoc.h>
43 #include <shlguid_undoc.h>
44 #include <undocshell.h>
45 
46 #include <rosctrls.h>
47 #include <rosdlgs.h>
48 #include <shellutils.h>
49 
50 #include "tmschema.h"
51 #include "resource.h"
52 
53 #include <wine/debug.h>
54 
55 WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
56 
57 #define ASSERT(cond) \
58  do if (!(cond)) { \
59  Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
60  } while (0)
61 
63 extern HANDLE hProcessHeap;
64 extern HKEY hkExplorer;
65 extern BOOL bExplorerIsShell;
66 
67 /*
68  * explorer.c
69  */
70 
71 static inline
72 LONG
74  IN LONG dwStyleMask,
75  IN LONG dwStyle)
76 {
77  return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
78 }
79 
80 static inline
81 LONG
83  IN LONG dwStyleMask,
84  IN LONG dwStyle)
85 {
86  return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
87 }
88 
89 HMENU
91  IN LPCWSTR lpMenuName);
92 
93 HMENU
94 FindSubMenu(IN HMENU hMenu,
95  IN UINT uItem,
96  IN BOOL fByPosition);
97 
98 BOOL
100  IN DWORD dwBufferSize);
101 
102 BOOL
104  IN UINT uPosition,
105  IN UINT uFlags,
106  ...);
107 
108 BOOL
110  IN LPCWSTR lpSubKey,
111  IN LPCWSTR lpValue);
112 
113 /*
114  * rshell.c
115  */
116 
119 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
122 void WINAPI _ShellDDEInit(BOOL bInit);
125 
126 /*
127  * traywnd.c
128  */
129 
130 #define TWM_GETTASKSWITCH (WM_USER + 236)
131 #define TWM_OPENSTARTMENU (WM_USER + 260)
132 #define TWM_SETTINGSCHANGED (WM_USER + 300)
133 
134 extern const GUID IID_IShellDesktopTray;
135 
136 #define INTERFACE ITrayWindow
138 {
139  /*** IUnknown methods ***/
143  /*** ITrayWindow methods ***/
146  STDMETHOD_(HWND, GetHWND) (THIS) PURE;
147  STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
148  STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
149  STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
150  STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
151  STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
152 };
153 #undef INTERFACE
154 
155 #if defined(COBJMACROS)
156 /*** IUnknown methods ***/
157 #define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
158 #define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p)
159 #define ITrayWindow_Release(p) (p)->lpVtbl->Release(p)
160 /*** ITrayWindow methods ***/
161 #define ITrayWindow_Open(p) (p)->lpVtbl->Open(p)
162 #define ITrayWindow_Close(p) (p)->lpVtbl->Close(p)
163 #define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
164 #define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
165 #define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
166 #define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
167 #define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
168 #define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)
169 #endif
170 
171 HRESULT CreateTrayWindow(ITrayWindow ** ppTray);
172 
173 VOID
174 TrayProcessMessages(IN OUT ITrayWindow *Tray);
175 
176 VOID
177 TrayMessageLoop(IN OUT ITrayWindow *Tray);
178 
179 /*
180  * settings.c
181  */
182 
183 typedef struct _TW_STUCKRECTS2
184 {
187  union
188  {
190  struct
191  {
196  };
197  };
202 
204 {
210 
211  BOOL Load();
212  BOOL Save();
213 };
214 
216 
217 /*
218  * shellservice.cpp
219  */
222 
223 /*
224  * startup.cpp
225  */
226 
227 BOOL DoStartStartupItems(ITrayWindow *Tray);
230 
231 /*
232  * trayprop.h
233  */
234 
235 VOID
236 DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar);
237 
238 /*
239  * desktop.cpp
240  */
241 HANDLE
242 DesktopCreateWindow(IN OUT ITrayWindow *Tray);
243 
244 VOID
246 
247 
248 /*
249  * notifyiconscust.cpp
250  */
251 VOID
253 
254 /*
255  * taskband.cpp
256  */
257 
258 extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */
259 HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
260 
261 /*
262  * tbsite.cpp
263  */
264 
265 #define INTERFACE ITrayBandSite
267 {
268  /*** IUnknown methods ***/
272  /*** IBandSiteStreamCallback ***/
273  STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
274  STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
275  /*** ITrayBandSite methods ***/
276  STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE;
277  STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE;
278  STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE;
279  STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE;
280 };
281 #undef INTERFACE
282 
283 #if defined(COBJMACROS)
284 /*** IUnknown methods ***/
285 #define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
286 #define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p)
287 #define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p)
288 /*** IBandSiteStreamCallback methods ***/
289 #define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c)
290 #define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b)
291 /*** ITrayBandSite methods ***/
292 #define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a)
293 #define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e)
294 #define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f)
295 #define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a)
296 #endif
297 
298 HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite);
299 
300 /*
301  * startmnu.cpp
302  */
303 
304 HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
305 
306 IMenuPopup*
307 CreateStartMenu(IN ITrayWindow *Tray,
308  OUT IMenuBand **ppMenuBand,
309  IN HBITMAP hbmBanner OPTIONAL,
310  IN BOOL bSmallIcons);
311 
312 /*
313  * startmnucust.cpp
314  */
315 VOID
317 
318 /*
319 * startmnusite.cpp
320 */
321 
322 HRESULT
323 CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv);
324 
325 /*
326  * trayntfy.c
327  */
328 
329 /* TrayClockWnd */
331 
332 /* TrayNotifyWnd */
333 #define TNWM_GETMINIMUMSIZE (WM_USER + 0x100)
334 #define TNWM_CHANGETRAYPOS (WM_USER + 0x104)
335 
336 #define NTNWM_REALIGN (0x1)
337 
339 
340 /* SysPagerWnd */
342 
343 /*
344  * taskswnd.c
345  */
346 
347 #define TSWM_UPDATETASKBARPOS (WM_USER + 2)
348 
350 
351 HRESULT
352 Tray_OnStartMenuDismissed(ITrayWindow* Tray);
353 
354 HRESULT
355 IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2);
356 
357 #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:38
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:195
INT ProcessStartupItems(VOID)
Definition: startup.cpp:336
#define THIS_
Definition: basetyps.h:65
static HMENU hmenu
Definition: win.c:66
_In_ BOOLEAN Release
Definition: classpnp.h:929
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
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:73
#define GWL_EXSTYLE
Definition: winuser.h:845
struct _TW_STUCKRECTS2 * PTW_STUCKRECTS2
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:60
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
BOOL bShowSeconds
Definition: precomp.h:207
int32_t INT
Definition: typedefs.h:56
TW_STRUCKRECTS2 sr
Definition: precomp.h:209
WPARAM wParam
Definition: combotst.c:138
VOID TrayMessageLoop(IN OUT ITrayWindow *Tray)
HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayclock.cpp:750
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:198
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
Definition: rshell.cpp:81
LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT mask, UINT flags)
Definition: ordinal.c:1077
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:194
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:192
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:193
WINE_DEFAULT_DEBUG_CHANNEL(cmd)
static LONG SetWindowExStyle(IN HWND hWnd, IN LONG dwStyleMask, IN LONG dwStyle)
Definition: precomp.h:82
BOOL bHideInactiveIcons
Definition: precomp.h:208
const GUID CLSID_ITaskBand
Definition: taskband.cpp:27
LONG HRESULT
Definition: typedefs.h:77
HRESULT CreateTrayWindow(ITrayWindow **ppTray)
Definition: traywnd.cpp:3390
#define WINAPI
Definition: msvc.h:8
BOOL bGroupButtons
Definition: precomp.h:206
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:189
HRESULT CSysPagerWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: syspager.cpp:1578
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:1990
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
DECLARE_INTERFACE_(ITrayWindow, IUnknown)
Definition: precomp.h:137
#define GWL_STYLE
Definition: winuser.h:846
HMENU LoadPopupMenu(IN HINSTANCE hInstance, IN LPCWSTR lpMenuName)
Definition: util.cpp:33
Definition: sacdrv.h:267
DWORD cbSize
Definition: precomp.h:185
#define PURE
Definition: basetyps.h:64
unsigned int UINT
Definition: ndis.h:50
HRESULT Tray_OnStartMenuDismissed(ITrayWindow *Tray)
Definition: traywnd.cpp:3405
const GUID IID_IShellDesktopTray
Definition: traywnd.cpp:135
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
BOOL DoFinishStartupItems(VOID)
Definition: startup.cpp:389
#define OUT
Definition: typedefs.h:39
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:400
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