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 <shellapi.h> 32 #include <shlobj.h> 33 #include <shlwapi.h> 34 #include <uxtheme.h> 35 #include <strsafe.h> 36 37 #include <undocuser.h> 38 #include <shlwapi_undoc.h> 39 #include <shlobj_undoc.h> 40 #include <shlguid_undoc.h> 41 #include <undocshell.h> 42 43 #include <rosctrls.h> 44 #include <rosdlgs.h> 45 #include <shellutils.h> 46 47 #include "tmschema.h" 48 #include "resource.h" 49 50 #include <wine/debug.h> 51 52 WINE_DEFAULT_DEBUG_CHANNEL(explorernew); 53 54 #define ASSERT(cond) \ 55 do if (!(cond)) { \ 56 Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \ 57 } while (0) 58 59 extern HINSTANCE hExplorerInstance; 60 extern HANDLE hProcessHeap; 61 extern HKEY hkExplorer; 62 63 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) 64 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) 65 66 /* 67 * explorer.c 68 */ 69 70 static inline 71 LONG 72 SetWindowStyle(IN HWND hWnd, 73 IN LONG dwStyleMask, 74 IN LONG dwStyle) 75 { 76 return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle); 77 } 78 79 static inline 80 LONG 81 SetWindowExStyle(IN HWND hWnd, 82 IN LONG dwStyleMask, 83 IN LONG dwStyle) 84 { 85 return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle); 86 } 87 88 HMENU 89 LoadPopupMenu(IN HINSTANCE hInstance, 90 IN LPCWSTR lpMenuName); 91 92 HMENU 93 FindSubMenu(IN HMENU hMenu, 94 IN UINT uItem, 95 IN BOOL fByPosition); 96 97 BOOL 98 GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer, 99 IN DWORD dwBufferSize); 100 101 BOOL 102 FormatMenuString(IN HMENU hMenu, 103 IN UINT uPosition, 104 IN UINT uFlags, 105 ...); 106 107 BOOL 108 GetExplorerRegValueSet(IN HKEY hKey, 109 IN LPCWSTR lpSubKey, 110 IN LPCWSTR lpValue); 111 112 /* 113 * rshell.c 114 */ 115 116 VOID InitRSHELL(VOID); 117 HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv); 118 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk); 119 BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop); 120 DWORD WINAPI _WinList_Init(void); 121 void WINAPI _ShellDDEInit(BOOL bInit); 122 HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv); 123 HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv); 124 125 /* 126 * traywnd.c 127 */ 128 129 #define TWM_OPENSTARTMENU (WM_USER + 260) 130 #define TWM_SETTINGSCHANGED (WM_USER + 300) 131 132 extern const GUID IID_IShellDesktopTray; 133 134 #define INTERFACE ITrayWindow 135 DECLARE_INTERFACE_(ITrayWindow, IUnknown) 136 { 137 /*** IUnknown methods ***/ 138 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE; 139 STDMETHOD_(ULONG, AddRef) (THIS) PURE; 140 STDMETHOD_(ULONG, Release) (THIS) PURE; 141 /*** ITrayWindow methods ***/ 142 STDMETHOD_(HRESULT, Open) (THIS) PURE; 143 STDMETHOD_(HRESULT, Close) (THIS) PURE; 144 STDMETHOD_(HWND, GetHWND) (THIS) PURE; 145 STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE; 146 STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE; 147 STDMETHOD_(HWND, DisplayProperties) (THIS) PURE; 148 STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE; 149 STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE; 150 }; 151 #undef INTERFACE 152 153 #if defined(COBJMACROS) 154 /*** IUnknown methods ***/ 155 #define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) 156 #define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p) 157 #define ITrayWindow_Release(p) (p)->lpVtbl->Release(p) 158 /*** ITrayWindow methods ***/ 159 #define ITrayWindow_Open(p) (p)->lpVtbl->Open(p) 160 #define ITrayWindow_Close(p) (p)->lpVtbl->Close(p) 161 #define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p) 162 #define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a) 163 #define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p) 164 #define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p) 165 #define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a) 166 #define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a) 167 #endif 168 169 BOOL 170 RegisterTrayWindowClass(VOID); 171 172 VOID 173 UnregisterTrayWindowClass(VOID); 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 { 189 DWORD cbSize; 190 LONG Unknown; 191 union 192 { 193 DWORD dwFlags; 194 struct 195 { 196 DWORD AutoHide : 1; 197 DWORD AlwaysOnTop : 1; 198 DWORD SmallIcons : 1; 199 DWORD HideClock : 1; 200 }; 201 }; 202 DWORD Position; 203 SIZE Size; 204 RECT Rect; 205 } TW_STRUCKRECTS2, *PTW_STUCKRECTS2; 206 207 struct TaskbarSettings 208 { 209 BOOL bLock; 210 BOOL bGroupButtons; 211 BOOL bShowSeconds; 212 BOOL bHideInactiveIcons; 213 TW_STRUCKRECTS2 sr; 214 215 BOOL Load(); 216 BOOL Save(); 217 }; 218 219 extern TaskbarSettings g_TaskbarSettings; 220 221 /* 222 * shellservice.cpp 223 */ 224 HRESULT InitShellServices(HDPA * phdpa); 225 HRESULT ShutdownShellServices(HDPA hdpa); 226 227 /* 228 * startup.cpp 229 */ 230 231 int 232 ProcessStartupItems(VOID); 233 234 /* 235 * trayprop.h 236 */ 237 238 VOID 239 DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar); 240 241 /* 242 * desktop.cpp 243 */ 244 HANDLE 245 DesktopCreateWindow(IN OUT ITrayWindow *Tray); 246 247 VOID 248 DesktopDestroyShellWindow(IN HANDLE hDesktop); 249 250 251 /* 252 * notifyiconscust.cpp 253 */ 254 VOID 255 ShowCustomizeNotifyIcons(HINSTANCE, HWND); 256 257 /* 258 * taskband.cpp 259 */ 260 261 extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */ 262 HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv); 263 264 /* 265 * tbsite.cpp 266 */ 267 268 #define INTERFACE ITrayBandSite 269 DECLARE_INTERFACE_(ITrayBandSite, IUnknown) 270 { 271 /*** IUnknown methods ***/ 272 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE; 273 STDMETHOD_(ULONG, AddRef) (THIS) PURE; 274 STDMETHOD_(ULONG, Release) (THIS) PURE; 275 /*** IBandSiteStreamCallback ***/ 276 STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE; 277 STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE; 278 /*** ITrayBandSite methods ***/ 279 STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE; 280 STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE; 281 STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE; 282 STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE; 283 }; 284 #undef INTERFACE 285 286 #if defined(COBJMACROS) 287 /*** IUnknown methods ***/ 288 #define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) 289 #define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p) 290 #define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p) 291 /*** IBandSiteStreamCallback methods ***/ 292 #define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c) 293 #define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b) 294 /*** ITrayBandSite methods ***/ 295 #define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a) 296 #define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e) 297 #define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f) 298 #define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a) 299 #endif 300 301 HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite); 302 303 /* 304 * startmnu.cpp 305 */ 306 307 HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu); 308 309 IMenuPopup* 310 CreateStartMenu(IN ITrayWindow *Tray, 311 OUT IMenuBand **ppMenuBand, 312 IN HBITMAP hbmBanner OPTIONAL, 313 IN BOOL bSmallIcons); 314 315 /* 316 * startmnucust.cpp 317 */ 318 VOID 319 ShowCustomizeClassic(HINSTANCE, HWND); 320 321 /* 322 * startmnusite.cpp 323 */ 324 325 HRESULT 326 CreateStartMenuSite(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv); 327 328 /* 329 * trayntfy.c 330 */ 331 332 /* TrayClockWnd */ 333 #define TCWM_GETMINIMUMSIZE (WM_USER + 0x100) 334 #define TCWM_UPDATETIME (WM_USER + 0x101) 335 336 /* TrayNotifyWnd */ 337 #define TNWM_GETMINIMUMSIZE (WM_USER + 0x100) 338 #define TNWM_UPDATETIME (WM_USER + 0x101) 339 #define TNWM_SHOWCLOCK (WM_USER + 0x102) 340 #define TNWM_SHOWTRAY (WM_USER + 0x103) 341 #define TNWM_CHANGETRAYPOS (WM_USER + 0x104) 342 343 #define NTNWM_REALIGN (0x1) 344 345 class CTrayNotifyWnd; 346 347 BOOL 348 RegisterTrayNotifyWndClass(VOID); 349 350 VOID 351 UnregisterTrayNotifyWndClass(VOID); 352 353 HWND 354 CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, CTrayNotifyWnd** ppTrayNotify); 355 356 BOOL 357 TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, IN LPARAM lParam); 358 359 BOOL 360 TrayNotify_GetClockRect(CTrayNotifyWnd* pTrayNotify, OUT PRECT rcClock); 361 362 /* 363 * taskswnd.c 364 */ 365 366 #define TSWM_ENABLEGROUPING (WM_USER + 1) 367 #define TSWM_UPDATETASKBARPOS (WM_USER + 2) 368 369 BOOL 370 RegisterTaskSwitchWndClass(VOID); 371 372 VOID 373 UnregisterTaskSwitchWndClass(VOID); 374 375 HWND 376 CreateTaskSwitchWnd(IN HWND hWndParent, 377 IN OUT ITrayWindow *Tray); 378 379 HRESULT 380 Tray_OnStartMenuDismissed(ITrayWindow* Tray); 381 382 HRESULT 383 IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2); 384 385 #endif /* _EXPLORER_PRECOMP__H_ */ 386