ReactOS 0.4.16-dev-136-g52192f1
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#define OEMRESOURCE
21
22#include <windef.h>
23#include <winbase.h>
24#include <winreg.h>
25#include <wingdi.h>
26#include <winnls.h>
27#include <wincon.h>
28#include <atlbase.h>
29#include <atlcom.h>
30#include <atlwin.h>
31#include <atlstr.h>
32#include <atlcoll.h>
33#include <atlsimpcoll.h>
34#include <shellapi.h>
35#include <shlobj.h>
36#include <shlwapi.h>
37#include <uxtheme.h>
38#include <process.h>
39#include <strsafe.h>
40
41#include <undocuser.h>
42#include <shlwapi_undoc.h>
43#include <shlobj_undoc.h>
44#include <shlguid_undoc.h>
45#include <undocshell.h>
46
47#include <ui/rosctrls.h>
48#include <ui/rosdlgs.h>
49#include <shellutils.h>
50
51#include "tmschema.h"
52#include "resource.h"
53
54#include <wine/debug.h>
55
57
58#define ASSERT(cond) \
59 do if (!(cond)) { \
60 Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
61 } while (0)
62
64extern HANDLE hProcessHeap;
65extern HKEY hkExplorer;
67
68/*
69 * explorer.c
70 */
71
72static inline
73LONG
75 IN LONG dwStyleMask,
76 IN LONG dwStyle)
77{
78 return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
79}
80
81static inline
82LONG
84 IN LONG dwStyleMask,
85 IN LONG dwStyle)
86{
87 return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
88}
89
92 IN LPCWSTR lpMenuName);
93
95FindSubMenu(IN HMENU hMenu,
96 IN UINT uItem,
97 IN BOOL fByPosition);
98
99BOOL
101 IN DWORD dwBufferSize);
102
103BOOL
105 IN UINT uPosition,
106 IN UINT uFlags,
107 ...);
108
109BOOL GetRegValue(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN BOOL bDefaultValue);
110BOOL SetRegDword(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN DWORD dwValue);
111BOOL GetAdvancedBool(IN LPCWSTR pszValueName, IN BOOL bDefaultValue);
112BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue);
113
114/*
115 * rshell.c
116 */
117
120HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
123void WINAPI _ShellDDEInit(BOOL bInit);
126
127/*
128 * traywnd.c
129 */
130
131#define TWM_GETTASKSWITCH (WM_USER + 236)
132#define TWM_OPENSTARTMENU (WM_USER + 260)
133#define TWM_SETTINGSCHANGED (WM_USER + 300)
134#define TWM_PULSE (WM_USER + 400)
135
136extern const GUID IID_IShellDesktopTray;
137
138#define INTERFACE ITrayWindow
140{
141 /*** IUnknown methods ***/
145 /*** ITrayWindow methods ***/
148 STDMETHOD_(HWND, GetHWND) (THIS) PURE;
149 STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
150 STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
151 STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
152 STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
153 STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
154 STDMETHOD_(BOOL, IsTaskWnd) (THIS_ HWND hWnd) PURE;
155};
156#undef INTERFACE
157
158#if defined(COBJMACROS)
159/*** IUnknown methods ***/
160#define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
161#define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p)
162#define ITrayWindow_Release(p) (p)->lpVtbl->Release(p)
163/*** ITrayWindow methods ***/
164#define ITrayWindow_Open(p) (p)->lpVtbl->Open(p)
165#define ITrayWindow_Close(p) (p)->lpVtbl->Close(p)
166#define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
167#define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
168#define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
169#define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
170#define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
171#define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)
172#define ITrayWindow_IsTaskWnd(p,a) (p)->lpVtbl->IsTaskWnd(p,a)
173#endif
174
175HRESULT CreateTrayWindow(ITrayWindow ** ppTray);
176
177VOID
178TrayProcessMessages(IN OUT ITrayWindow *Tray);
179
180VOID
181TrayMessageLoop(IN OUT ITrayWindow *Tray);
182
183/*
184 * settings.c
185 */
186
188{
194
195typedef struct _TW_STUCKRECTS2
196{
199 union
200 {
202 struct
203 {
206 DWORD SmSmallIcons : 1; // Start menu Small Icons
208 };
209 };
214
216{
226
227 BOOL Load();
228 BOOL Save();
230 {
231 switch (eCompactTrayIcons)
232 {
233 case TIM_NeverCompact:
234 return FALSE;
236 return TRUE;
237 default:
238 return bSmallIcons;
239 }
240 }
241};
242
244
245/*
246 * shellservice.cpp
247 */
250
251/*
252 * startup.cpp
253 */
254
257BOOL DoStartStartupItems(ITrayWindow *Tray);
261
262/*
263 * trayprop.h
264 */
265
266VOID
267DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar);
268
269/*
270 * desktop.cpp
271 */
272HANDLE
273DesktopCreateWindow(IN OUT ITrayWindow *Tray);
274
275VOID
277
278
279/*
280 * notifyiconscust.cpp
281 */
282VOID
284
285/*
286 * taskband.cpp
287 */
288
289extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */
290HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
291
292/*
293 * tbsite.cpp
294 */
295
296#define INTERFACE ITrayBandSite
298{
299 /*** IUnknown methods ***/
303 /*** IBandSiteStreamCallback ***/
304 STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
305 STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
306 /*** ITrayBandSite methods ***/
307 STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE;
308 STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE;
309 STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE;
311};
312#undef INTERFACE
313
314#if defined(COBJMACROS)
315/*** IUnknown methods ***/
316#define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
317#define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p)
318#define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p)
319/*** IBandSiteStreamCallback methods ***/
320#define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c)
321#define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b)
322/*** ITrayBandSite methods ***/
323#define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a)
324#define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e)
325#define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f)
326#define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a)
327#endif
328
329HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite);
330
331/*
332 * startctxmnu.cpp
333 */
334HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
335
336/*
337 * startmnu.cpp
338 */
340CreateStartMenu(IN ITrayWindow *Tray,
341 OUT IMenuBand **ppMenuBand,
342 IN HBITMAP hbmBanner OPTIONAL,
343 IN BOOL bSmallIcons);
345UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup,
346 IN HBITMAP hbmBanner OPTIONAL,
347 IN BOOL bSmallIcons,
348 IN BOOL bRefresh);
349
350/*
351 * startmnucust.cpp
352 */
353VOID
355
356/*
357* startmnusite.cpp
358*/
360CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv);
361
362/*
363 * trayntfy.c
364 */
365
366/* TrayClockWnd */
368
369/* TrayNotifyWnd */
370#define TNWM_GETMINIMUMSIZE (WM_USER + 0x100)
371#define TNWM_CHANGETRAYPOS (WM_USER + 0x104)
372#define TNWM_GETSHOWDESKTOPBUTTON (WM_USER + 0x7601)
373
374#define NTNWM_REALIGN (0x1)
375
377
378/* SysPagerWnd */
380
381#include "traydeskbtn.h"
382
383/*
384 * taskswnd.c
385 */
386
387#define TSWM_UPDATETASKBARPOS (WM_USER + 2)
388
390
392Tray_OnStartMenuDismissed(ITrayWindow* Tray);
393
395IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2);
396
397#endif /* _EXPLORER_PRECOMP__H_ */
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:345
const GUID IID_IShellDesktopTray
Definition: traywnd.cpp:192
HMENU FindSubMenu(IN HMENU hMenu, IN UINT uItem, IN BOOL fByPosition)
Definition: util.cpp:55
VOID DesktopDestroyShellWindow(IN HANDLE hDesktop)
Definition: desktop.cpp:203
HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayclock.cpp:779
BOOL FormatMenuString(IN HMENU hMenu, IN UINT uPosition, IN UINT uFlags,...)
Definition: util.cpp:106
BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue)
Definition: util.cpp:161
HRESULT CSysPagerWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: syspager.cpp:1611
struct _TW_STUCKRECTS2 TW_STRUCKRECTS2
HRESULT UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons, IN BOOL bRefresh)
Definition: startmnu.cpp:24
VOID TrayMessageLoop(IN OUT ITrayWindow *Tray)
BOOL GetAdvancedBool(IN LPCWSTR pszValueName, IN BOOL bDefaultValue)
Definition: util.cpp:156
HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: rshell.cpp:186
HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow *TrayWnd, IN HWND hWndOwner, IContextMenu **ppCtxMenu)
HRESULT CTaskSwitchWnd_CreateInstance(IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv)
Definition: taskswnd.cpp:2026
HMENU LoadPopupMenu(IN HINSTANCE hInstance, IN LPCWSTR lpMenuName)
Definition: util.cpp:33
VOID TrayProcessMessages(IN OUT ITrayWindow *Tray)
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
Definition: rshell.cpp:81
IMenuPopup * CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons)
Definition: startmnu.cpp:50
HRESULT CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID &riid, PVOID *ppv)
HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:167
static VOID DoFinishStartupItems()
Definition: precomp.h:260
VOID ReleaseStartupMutex()
Definition: startup.cpp:513
TrayIconsMode
Definition: precomp.h:188
@ TIM_AlwaysCompact
Definition: precomp.h:191
@ TIM_NeverCompact
Definition: precomp.h:190
@ TIM_Max
Definition: precomp.h:192
@ TIM_Default
Definition: precomp.h:189
HRESULT Tray_OnStartMenuDismissed(ITrayWindow *Tray)
Definition: traywnd.cpp:3711
void WINAPI _ShellDDEInit(BOOL bInit)
Definition: rshell.cpp:139
DWORD WINAPI _WinList_Init(void)
Definition: rshell.cpp:110
HRESULT CreateTrayWindow(ITrayWindow **ppTray)
Definition: traywnd.cpp:3696
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
VOID ShowCustomizeClassic(HINSTANCE, HWND)
HANDLE DesktopCreateWindow(IN OUT ITrayWindow *Tray)
Definition: desktop.cpp:188
BOOL GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer, IN DWORD dwBufferSize)
Definition: util.cpp:73
VOID ProcessRunOnceItems()
Definition: startup.cpp:588
HRESULT CTrayNotifyWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayntfy.cpp:548
struct _TW_STUCKRECTS2 * PTW_STUCKRECTS2
HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand *pTaskBand, OUT ITrayBandSite **pBandSite)
Definition: tbsite.cpp:715
BOOL bExplorerIsShell
Definition: explorer.cpp:27
HRESULT IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2)
Definition: util.cpp:11
BOOL SetRegDword(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN DWORD dwValue)
Definition: util.cpp:148
BOOL GetRegValue(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN BOOL bDefaultValue)
static INT ProcessStartupItems()
Definition: precomp.h:259
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
Definition: rshell.cpp:52
const GUID CLSID_ITaskBand
Definition: taskband.cpp:27
VOID InitRSHELL(VOID)
Definition: rshell.cpp:27
VOID ShowCustomizeNotifyIcons(HINSTANCE, HWND)
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
HRESULT InitShellServices(HDPA *phdpa)
BOOL DoStartStartupItems(ITrayWindow *Tray)
Definition: startup.cpp:549
HKEY hkExplorer
Definition: explorer.cpp:26
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv)
Definition: taskband.cpp:346
HRESULT ShutdownShellServices(HDPA hdpa)
HANDLE hProcessHeap
Definition: kbswitch.c:37
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:32
#define DECLARE_INTERFACE_(i, b)
Definition: basetyps.h:78
#define PURE
Definition: basetyps.h:64
#define THIS_
Definition: basetyps.h:65
#define THIS
Definition: basetyps.h:66
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
_In_ BOOLEAN Release
Definition: cdrom.h:920
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static HWND hwndParent
Definition: cryptui.c:300
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT uFlags
Definition: api.c:59
LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT mask, UINT flags)
Definition: ordinal.c:1130
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define Open
Definition: syshdrs.h:62
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
#define SetWindowExStyle(h, val)
Definition: utility.h:154
static HBITMAP
Definition: button.c:44
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
static LPUNKNOWN
Definition: ndr_ole.c:49
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
@ Close
Definition: sacdrv.h:268
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
BOOL bGroupButtons
Definition: precomp.h:218
BOOL bShowDesktopButton
Definition: precomp.h:224
BOOL bHideInactiveIcons
Definition: precomp.h:221
TW_STRUCKRECTS2 sr
Definition: precomp.h:225
BOOL bShowSeconds
Definition: precomp.h:219
TrayIconsMode eCompactTrayIcons
Definition: precomp.h:223
BOOL UseCompactTrayIcons()
Definition: precomp.h:229
BOOL bPreferDate
Definition: precomp.h:220
BOOL bSmallIcons
Definition: precomp.h:222
Definition: dpa.c:49
DWORD AutoHide
Definition: precomp.h:204
DWORD HideClock
Definition: precomp.h:207
DWORD AlwaysOnTop
Definition: precomp.h:205
DWORD dwFlags
Definition: precomp.h:201
DWORD SmSmallIcons
Definition: precomp.h:206
DWORD Position
Definition: precomp.h:210
DWORD cbSize
Definition: precomp.h:197
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
static HMENU hmenu
Definition: win.c:66
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
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
#define GWL_STYLE
Definition: winuser.h:855
#define GWL_EXSTYLE
Definition: winuser.h:854
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185