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 56 WINE_DEFAULT_DEBUG_CHANNEL(explorernew); 57 58 #define ASSERT(cond) \ 59 do if (!(cond)) { \ 60 Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \ 61 } while (0) 62 63 extern HINSTANCE hExplorerInstance; 64 extern HANDLE hProcessHeap; 65 extern HKEY hkExplorer; 66 extern BOOL bExplorerIsShell; 67 68 /* 69 * explorer.c 70 */ 71 72 static inline 73 LONG 74 SetWindowStyle(IN HWND hWnd, 75 IN LONG dwStyleMask, 76 IN LONG dwStyle) 77 { 78 return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle); 79 } 80 81 static inline 82 LONG 83 SetWindowExStyle(IN HWND hWnd, 84 IN LONG dwStyleMask, 85 IN LONG dwStyle) 86 { 87 return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle); 88 } 89 90 HMENU 91 LoadPopupMenu(IN HINSTANCE hInstance, 92 IN LPCWSTR lpMenuName); 93 94 HMENU 95 FindSubMenu(IN HMENU hMenu, 96 IN UINT uItem, 97 IN BOOL fByPosition); 98 99 BOOL 100 GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer, 101 IN DWORD dwBufferSize); 102 103 BOOL 104 FormatMenuString(IN HMENU hMenu, 105 IN UINT uPosition, 106 IN UINT uFlags, 107 ...); 108 109 BOOL GetRegValue(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN BOOL bDefaultValue); 110 BOOL SetRegDword(IN LPCWSTR pszSubKey, IN LPCWSTR pszValueName, IN DWORD dwValue); 111 BOOL GetAdvancedBool(IN LPCWSTR pszValueName, IN BOOL bDefaultValue); 112 BOOL SetAdvancedDword(IN LPCWSTR pszValueName, IN DWORD dwValue); 113 114 /* 115 * rshell.c 116 */ 117 118 VOID InitRSHELL(VOID); 119 HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv); 120 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk); 121 BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop); 122 DWORD WINAPI _WinList_Init(void); 123 void WINAPI _ShellDDEInit(BOOL bInit); 124 HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv); 125 HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv); 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 136 extern const GUID IID_IShellDesktopTray; 137 138 #define INTERFACE ITrayWindow 139 DECLARE_INTERFACE_(ITrayWindow, IUnknown) 140 { 141 /*** IUnknown methods ***/ 142 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE; 143 STDMETHOD_(ULONG, AddRef) (THIS) PURE; 144 STDMETHOD_(ULONG, Release) (THIS) PURE; 145 /*** ITrayWindow methods ***/ 146 STDMETHOD_(HRESULT, Open) (THIS) PURE; 147 STDMETHOD_(HRESULT, Close) (THIS) PURE; 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 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 enum TrayIconsMode 188 { 189 TIM_Default, 190 TIM_NeverCompact, 191 TIM_AlwaysCompact, 192 TIM_Max = TIM_AlwaysCompact 193 }; 194 195 typedef struct _TW_STUCKRECTS2 196 { 197 DWORD cbSize; 198 LONG Unknown; 199 union 200 { 201 DWORD dwFlags; 202 struct 203 { 204 DWORD AutoHide : 1; 205 DWORD AlwaysOnTop : 1; 206 DWORD SmallIcons : 1; 207 DWORD HideClock : 1; 208 }; 209 }; 210 DWORD Position; 211 SIZE Size; 212 RECT Rect; 213 } TW_STRUCKRECTS2, *PTW_STUCKRECTS2; 214 215 struct TaskbarSettings 216 { 217 BOOL bLock; 218 BOOL bGroupButtons; 219 BOOL bShowSeconds; 220 BOOL bPreferDate; 221 BOOL bHideInactiveIcons; 222 BOOL bSmallIcons; 223 TrayIconsMode eCompactTrayIcons; 224 BOOL bShowDesktopButton; 225 TW_STRUCKRECTS2 sr; 226 227 BOOL Load(); 228 BOOL Save(); 229 inline BOOL UseCompactTrayIcons() 230 { 231 switch (eCompactTrayIcons) 232 { 233 case TIM_NeverCompact: 234 return FALSE; 235 case TIM_AlwaysCompact: 236 return TRUE; 237 default: 238 return bSmallIcons; 239 } 240 } 241 }; 242 243 extern TaskbarSettings g_TaskbarSettings; 244 245 /* 246 * shellservice.cpp 247 */ 248 HRESULT InitShellServices(HDPA * phdpa); 249 HRESULT ShutdownShellServices(HDPA hdpa); 250 251 /* 252 * startup.cpp 253 */ 254 255 BOOL DoStartStartupItems(ITrayWindow *Tray); 256 INT ProcessStartupItems(VOID); 257 BOOL DoFinishStartupItems(VOID); 258 259 /* 260 * trayprop.h 261 */ 262 263 VOID 264 DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar); 265 266 /* 267 * desktop.cpp 268 */ 269 HANDLE 270 DesktopCreateWindow(IN OUT ITrayWindow *Tray); 271 272 VOID 273 DesktopDestroyShellWindow(IN HANDLE hDesktop); 274 275 276 /* 277 * notifyiconscust.cpp 278 */ 279 VOID 280 ShowCustomizeNotifyIcons(HINSTANCE, HWND); 281 282 /* 283 * taskband.cpp 284 */ 285 286 extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */ 287 HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv); 288 289 /* 290 * tbsite.cpp 291 */ 292 293 #define INTERFACE ITrayBandSite 294 DECLARE_INTERFACE_(ITrayBandSite, IUnknown) 295 { 296 /*** IUnknown methods ***/ 297 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE; 298 STDMETHOD_(ULONG, AddRef) (THIS) PURE; 299 STDMETHOD_(ULONG, Release) (THIS) PURE; 300 /*** IBandSiteStreamCallback ***/ 301 STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE; 302 STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE; 303 /*** ITrayBandSite methods ***/ 304 STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE; 305 STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE; 306 STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE; 307 STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE; 308 }; 309 #undef INTERFACE 310 311 #if defined(COBJMACROS) 312 /*** IUnknown methods ***/ 313 #define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) 314 #define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p) 315 #define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p) 316 /*** IBandSiteStreamCallback methods ***/ 317 #define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c) 318 #define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b) 319 /*** ITrayBandSite methods ***/ 320 #define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a) 321 #define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e) 322 #define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f) 323 #define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a) 324 #endif 325 326 HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite); 327 328 /* 329 * startmnu.cpp 330 */ 331 332 HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu); 333 334 IMenuPopup* 335 CreateStartMenu(IN ITrayWindow *Tray, 336 OUT IMenuBand **ppMenuBand, 337 IN HBITMAP hbmBanner OPTIONAL, 338 IN BOOL bSmallIcons); 339 340 /* 341 * startmnucust.cpp 342 */ 343 VOID 344 ShowCustomizeClassic(HINSTANCE, HWND); 345 346 /* 347 * startmnusite.cpp 348 */ 349 350 HRESULT 351 CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv); 352 353 /* 354 * trayntfy.c 355 */ 356 357 /* TrayClockWnd */ 358 HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv); 359 360 /* TrayNotifyWnd */ 361 #define TNWM_GETMINIMUMSIZE (WM_USER + 0x100) 362 #define TNWM_CHANGETRAYPOS (WM_USER + 0x104) 363 364 #define NTNWM_REALIGN (0x1) 365 366 HRESULT CTrayNotifyWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv); 367 368 /* SysPagerWnd */ 369 HRESULT CSysPagerWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv); 370 371 /* 372 * taskswnd.c 373 */ 374 375 #define TSWM_UPDATETASKBARPOS (WM_USER + 2) 376 377 HRESULT CTaskSwitchWnd_CreateInstance(IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv); 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