ReactOS  0.4.15-dev-5492-g47f3a4e
CStartMenu.cpp
Go to the documentation of this file.
1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2014 Giannis Adamopoulos
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 #include "shellmenu.h"
21 
22 #include "CMergedFolder.h"
23 
24 WINE_DEFAULT_DEBUG_CHANNEL(CStartMenu);
25 
26 //#define TEST_TRACKPOPUPMENU_SUBMENUS
27 
28 
29 /* NOTE: The following constants *MUST NOT* be changed because
30  they're hardcoded and need to be the exact values
31  in order to get the start menu to work! */
32 #define IDM_RUN 401
33 #define IDM_LOGOFF 402
34 #define IDM_UNDOCKCOMPUTER 410
35 #define IDM_TASKBARANDSTARTMENU 413
36 #define IDM_LASTSTARTMENU_SEPARATOR 450
37 #define IDM_DOCUMENTS 501
38 #define IDM_HELPANDSUPPORT 503
39 #define IDM_PROGRAMS 504
40 #define IDM_CONTROLPANEL 505
41 #define IDM_SHUTDOWN 506
42 #define IDM_FAVORITES 507
43 #define IDM_SETTINGS 508
44 #define IDM_PRINTERSANDFAXES 510
45 #define IDM_SEARCH 520
46 #define IDM_SYNCHRONIZE 553
47 #define IDM_NETWORKCONNECTIONS 557
48 #define IDM_DISCONNECT 5000
49 #define IDM_SECURITY 5001
50 
51 /*
52  * TODO:
53  * 1. append the start menu contents from all users
54  * 2. implement the context menu for start menu entries (programs, control panel, network connetions, printers)
55  * 3. filter out programs folder from the shell folder part of the start menu
56  * 4. showing the programs start menu is SLOW compared to windows. this needs some investigation
57  */
58 
60  public CComObjectRootEx<CComMultiThreadModelNoCS>,
61  public IShellMenuCallback
62 {
63 private:
65  CComPtr<IShellMenu> m_pShellMenu;
66  CComPtr<IBandSite> m_pBandSite;
67  CComPtr<IDeskBar> m_pDeskBar;
68  CComPtr<ITrayPriv> m_pTrayPriv;
69  CComPtr<IShellFolder> m_psfPrograms;
70 
72 
74  {
75  HMENU hmenu;
76  HRESULT hr;
77 
78  if (m_pTrayPriv.p)
79  return S_OK;
80 
83  return hr;
84 
87  return hr;
88 
89  hr = m_pTrayPriv->AppendMenu(&hmenu);
91  return hr;
92 
93  hr = m_pShellMenu->SetMenu(hmenu, NULL, SMSET_BOTTOM);
95  {
97  return hr;
98  }
99 
100  return hr;
101  }
102 
104  {
105  int iconIndex = 0;
106 
107  switch (psmd->uId)
108  {
109  // Smaller "24x24" icons used for the start menu
110  // The bitmaps are still 32x32, but the image is centered
111  case IDM_FAVORITES: iconIndex = -IDI_SHELL_FAVOTITES; break;
112  case IDM_SEARCH: iconIndex = -IDI_SHELL_SEARCH1; break;
113  case IDM_HELPANDSUPPORT: iconIndex = -IDI_SHELL_HELP2; break;
114  case IDM_LOGOFF: iconIndex = -IDI_SHELL_LOGOFF1; break;
115  case IDM_PROGRAMS: iconIndex = -IDI_SHELL_PROGRAMS_FOLDER1; break;
116  case IDM_DOCUMENTS: iconIndex = -IDI_SHELL_RECENT_DOCUMENTS1; break;
117  case IDM_RUN: iconIndex = -IDI_SHELL_RUN1; break;
118  case IDM_SHUTDOWN: iconIndex = -IDI_SHELL_SHUTDOWN1; break;
119  case IDM_SETTINGS: iconIndex = -IDI_SHELL_CONTROL_PANEL1; break;
120  case IDM_MYDOCUMENTS: iconIndex = -IDI_SHELL_MY_DOCUMENTS; break;
121  case IDM_MYPICTURES: iconIndex = -IDI_SHELL_MY_PICTURES; break;
122 
123  case IDM_CONTROLPANEL: iconIndex = -IDI_SHELL_CONTROL_PANEL; break;
124  case IDM_NETWORKCONNECTIONS: iconIndex = -IDI_SHELL_NETWORK_CONNECTIONS2; break;
125  case IDM_PRINTERSANDFAXES: iconIndex = -IDI_SHELL_PRINTER2; break;
126  case IDM_TASKBARANDSTARTMENU: iconIndex = -IDI_SHELL_TSKBAR_STARTMENU; break;
127  //case IDM_SECURITY: iconIndex = -21; break;
128  //case IDM_SYNCHRONIZE: iconIndex = -21; break;
129  //case IDM_DISCONNECT: iconIndex = -21; break;
130  //case IDM_UNDOCKCOMPUTER: iconIndex = -21; break;
131  default:
132  return S_FALSE;
133  }
134 
135  if (iconIndex)
136  {
137  if ((psminfo->dwMask & SMIM_TYPE) != 0)
138  psminfo->dwType = SMIT_STRING;
139  if ((psminfo->dwMask & SMIM_ICON) != 0)
140  psminfo->iIcon = Shell_GetCachedImageIndex(L"shell32.dll", iconIndex, FALSE);
141  if ((psminfo->dwMask & SMIM_FLAGS) != 0)
142  psminfo->dwFlags |= SMIF_ICON;
143 #ifdef TEST_TRACKPOPUPMENU_SUBMENUS
144  if ((psminfo->dwMask & SMIM_FLAGS) != 0)
145  psminfo->dwFlags |= SMIF_TRACKPOPUP;
146 #endif
147  }
148  else
149  {
150  if ((psminfo->dwMask & SMIM_TYPE) != 0)
151  psminfo->dwType = SMIT_SEPARATOR;
152  }
153  return S_OK;
154  }
155 
156  void InsertRecentItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand) const
157  {
159  if (!SHGetSpecialFolderPathW(NULL, szPath, csidl, FALSE))
160  {
161  ERR("SHGetSpecialFolderPathW failed\n");
162  return;
163  }
164 
165  LPWSTR pszText = PathFindFileNameW(szPath);
166  if (bExpand)
167  {
168  MENUITEMINFOW mii = { sizeof(mii), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU };
169  mii.fType = MFT_STRING;
170  mii.wID = nID;
171  mii.hSubMenu = ::CreatePopupMenu();
172  mii.dwTypeData = pszText;
173  mii.cch = lstrlenW(pszText);
174  InsertMenuItemW(hMenu, GetMenuItemCount(hMenu), TRUE, &mii);
175  }
176  else
177  {
178  AppendMenuW(hMenu, MF_STRING | MF_ENABLED, nID, pszText);
179  }
180  }
181 
182  HMENU CreateRecentMenu(BOOL bExpandMyDocuments, BOOL bExpandMyPictures) const
183  {
184  HMENU hMenu = ::CreateMenu();
185  InsertRecentItem(hMenu, IDM_MYDOCUMENTS, CSIDL_MYDOCUMENTS, bExpandMyDocuments);
186  InsertRecentItem(hMenu, IDM_MYPICTURES, CSIDL_MYPICTURES, bExpandMyPictures);
187  AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL);
188  return hMenu;
189  }
190 
191  HRESULT OnGetSubMenu(LPSMDATA psmd, REFIID iid, void ** pv)
192  {
193  HRESULT hr;
194  int csidl = 0;
195  IShellMenu *pShellMenu;
196 
198  if (FAILED_UNEXPECTEDLY(hr))
199  return hr;
200 
201  hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
202  if (FAILED_UNEXPECTEDLY(hr))
203  return hr;
204 
205  switch (psmd->uId)
206  {
207  case IDM_PROGRAMS: csidl = CSIDL_PROGRAMS; break;
208  case IDM_FAVORITES: csidl = CSIDL_FAVORITES; break;
209  case IDM_DOCUMENTS: csidl = CSIDL_RECENT; break;
210  case IDM_MYDOCUMENTS: csidl = CSIDL_MYDOCUMENTS; break;
211  case IDM_MYPICTURES: csidl = CSIDL_MYPICTURES; break;
212  }
213 
214  if (csidl)
215  {
216  IShellFolder *psfStartMenu;
217  DWORD dwFlags = SMSET_TOP;
218 
219  if (csidl == CSIDL_PROGRAMS && m_psfPrograms)
220  {
221  psfStartMenu = m_psfPrograms;
222  }
223  else
224  {
225  if (csidl == CSIDL_RECENT)
226  {
227  BOOL bExpandMyDocuments = FALSE; /* FIXME: Get value from registry */
228  BOOL bExpandMyPictures = FALSE; /* FIXME: Get value from registry */
229  HMENU hMenu = CreateRecentMenu(bExpandMyDocuments, bExpandMyPictures);
230  if (hMenu == NULL)
231  ERR("CreateRecentMenu failed\n");
232 
233  hr = pShellMenu->SetMenu(hMenu, NULL, SMSET_BOTTOM);
234  if (FAILED_UNEXPECTEDLY(hr))
235  return hr;
236 
237  dwFlags = SMSET_BOTTOM;
238  }
239 
240  LPITEMIDLIST pidlStartMenu;
241  IShellFolder *psfDestop;
242  hr = SHGetFolderLocation(NULL, csidl, 0, 0, &pidlStartMenu);
243  if (FAILED_UNEXPECTEDLY(hr))
244  return hr;
245 
246  hr = SHGetDesktopFolder(&psfDestop);
247  if (FAILED_UNEXPECTEDLY(hr))
248  return hr;
249 
250  hr = psfDestop->BindToObject(pidlStartMenu, NULL, IID_PPV_ARG(IShellFolder, &psfStartMenu));
251  if (FAILED_UNEXPECTEDLY(hr))
252  return hr;
253  }
254 
255  hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, dwFlags);
256  if (FAILED_UNEXPECTEDLY(hr))
257  return hr;
258  }
259  else
260  {
261  MENUITEMINFO mii;
262  mii.cbSize = sizeof(mii);
263  mii.fMask = MIIM_SUBMENU;
264  if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii))
265  {
266  hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM);
267  if (FAILED_UNEXPECTEDLY(hr))
268  return hr;
269  }
270  }
271  return pShellMenu->QueryInterface(iid, pv);
272  }
273 
274  HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void ** pv)
275  {
276  if (psmd->uId == IDM_PROGRAMS ||
277  psmd->uId == IDM_CONTROLPANEL ||
278  psmd->uId == IDM_NETWORKCONNECTIONS ||
279  psmd->uId == IDM_PRINTERSANDFAXES)
280  {
281  //UNIMPLEMENTED
282  }
283 
284  return S_FALSE;
285  }
286 
287  HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void ** pv)
288  {
289  if (IsEqualIID(iid, IID_IShellMenu))
290  return OnGetSubMenu(psmd, iid, pv);
291  else if (IsEqualIID(iid, IID_IContextMenu))
292  return OnGetContextMenu(psmd, iid, pv);
293 
294  return S_FALSE;
295  }
296 
298  {
300 
301  // HACK: Because our ShellExecute can't handle CLSID components in paths, we can't launch the paths using the "open" verb.
302  // FIXME: Change this back to using the path as the filename and the "open" verb, once ShellExecute can handle CLSID path components.
303 
304  if (psmd->uId == IDM_CONTROLPANEL)
305  ShellExecuteW(NULL, NULL, L"explorer.exe", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}", NULL, SW_SHOWNORMAL);
306  else if (psmd->uId == IDM_NETWORKCONNECTIONS)
307  ShellExecuteW(NULL, NULL, L"explorer.exe", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}", NULL, SW_SHOWNORMAL);
308  else if (psmd->uId == IDM_PRINTERSANDFAXES)
309  ShellExecuteW(NULL, NULL, L"explorer.exe", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}", NULL, SW_SHOWNORMAL);
310  else if (psmd->uId == IDM_MYDOCUMENTS)
311  {
314  else
315  ERR("SHGetSpecialFolderPathW failed\n");
316  }
317  else if (psmd->uId == IDM_MYPICTURES)
318  {
321  else
322  ERR("SHGetSpecialFolderPathW failed\n");
323  }
324  else
326 
327  return S_OK;
328  }
329 
330 public:
331 
335  COM_INTERFACE_ENTRY_IID(IID_IShellMenuCallback, IShellMenuCallback)
336  END_COM_MAP()
337 
339  IShellMenu* pShellMenu,
340  IBandSite* pBandSite,
341  IDeskBar* pDeskBar)
342  {
343  m_pShellMenu = pShellMenu;
344  m_pBandSite = pBandSite;
345  m_pDeskBar = pDeskBar;
346  }
347 
349  {
350  }
351 
353  {
354  m_psfPrograms = psf;
355  m_pidlPrograms = pidl;
356  return S_OK;
357  }
358 
360  LPSMDATA psmd,
361  UINT uMsg,
362  WPARAM wParam,
363  LPARAM lParam)
364  {
365  switch (uMsg)
366  {
367  case SMC_INITMENU:
368  return OnInitMenu();
369  case SMC_GETINFO:
370  return OnGetInfo(psmd, reinterpret_cast<SMINFO*>(lParam));
371  case SMC_GETOBJECT:
372  return OnGetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
373  case SMC_EXEC:
374  return OnExec(psmd);
375  case SMC_SFEXEC:
376  m_pTrayPriv->Execute(psmd->psf, psmd->pidlItem);
377  break;
378  case 0x10000000: // _FilterPIDL from CMenuSFToolbar
379  if (psmd->psf->CompareIDs(0, psmd->pidlItem, m_pidlPrograms) == 0)
380  return S_OK;
381  return S_FALSE;
382  }
383 
384  return S_FALSE;
385  }
386 };
387 
389 {
390  HRESULT hr;
391  CComPtr<IShellFolder> psfDesktop;
392 
393  *ppsfResult = NULL;
394 
395  hr = SHGetDesktopFolder(&psfDesktop);
396  if (FAILED(hr))
397  return hr;
398 
399  hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, ppsfResult));
400 
401  return hr;
402 }
403 
404 static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder ** ppsfStartMenu)
405 {
406  HRESULT hr;
407  LPITEMIDLIST pidlUserStartMenu;
408  LPITEMIDLIST pidlCommonStartMenu;
409  CComPtr<IShellFolder> psfUserStartMenu;
410  CComPtr<IShellFolder> psfCommonStartMenu;
411  CComPtr<IAugmentedShellFolder> pasf;
412 
413  *ppsfStartMenu = NULL;
414 
415  hr = SHGetSpecialFolderLocation(NULL, folder1, &pidlUserStartMenu);
416  if (FAILED(hr))
417  {
418  WARN("Failed to get the USER start menu folder. Trying to run with just the COMMON one.\n");
419 
420  hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu);
421  if (FAILED_UNEXPECTEDLY(hr))
422  return hr;
423 
424  TRACE("COMMON start menu obtained.\n");
425  hr = BindToDesktop(pidlCommonStartMenu, ppsfStartMenu);
426  ILFree(pidlCommonStartMenu);
427  return hr;
428  }
429 #if MERGE_FOLDERS
430  hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu);
431  if (FAILED_UNEXPECTEDLY(hr))
432 #else
433  else
434 #endif
435  {
436  WARN("Failed to get the COMMON start menu folder. Will use only the USER contents.\n");
437  hr = BindToDesktop(pidlUserStartMenu, ppsfStartMenu);
438  ILFree(pidlUserStartMenu);
439  return hr;
440  }
441 
442  TRACE("Both COMMON and USER statr menu folders obtained, merging them...\n");
443 
444  hr = BindToDesktop(pidlUserStartMenu, &psfUserStartMenu);
445  if (FAILED_UNEXPECTEDLY(hr))
446  return hr;
447 
448  hr = BindToDesktop(pidlCommonStartMenu, &psfCommonStartMenu);
449  if (FAILED_UNEXPECTEDLY(hr))
450  return hr;
451 
452  hr = CMergedFolder_CreateInstance(IID_PPV_ARG(IAugmentedShellFolder, &pasf));
453  if (FAILED_UNEXPECTEDLY(hr))
454  {
455  *ppsfStartMenu = psfUserStartMenu.Detach();
456  ILFree(pidlCommonStartMenu);
457  ILFree(pidlUserStartMenu);
458  return hr;
459  }
460 
461  hr = pasf->AddNameSpace(NULL, psfUserStartMenu, pidlUserStartMenu, 0xFF00);
462  if (FAILED_UNEXPECTEDLY(hr))
463  return hr;
464 
465  hr = pasf->AddNameSpace(NULL, psfCommonStartMenu, pidlCommonStartMenu, 0);
466  if (FAILED_UNEXPECTEDLY(hr))
467  return hr;
468 
469  hr = pasf->QueryInterface(IID_PPV_ARG(IShellFolder, ppsfStartMenu));
470  pasf.Release();
471 
472  ILFree(pidlCommonStartMenu);
473  ILFree(pidlUserStartMenu);
474 
475  return hr;
476 }
477 
478 static HRESULT GetStartMenuFolder(IShellFolder ** ppsfStartMenu)
479 {
481 }
482 
483 static HRESULT GetProgramsFolder(IShellFolder ** ppsfStartMenu)
484 {
485  return GetMergedFolder(CSIDL_PROGRAMS, CSIDL_COMMON_PROGRAMS, ppsfStartMenu);
486 }
487 
488 extern "C"
491 {
492  CComPtr<IShellMenu> pShellMenu;
493  CComPtr<IBandSite> pBandSite;
494  CComPtr<IDeskBar> pDeskBar;
495 
496  HRESULT hr;
497  IShellFolder * psf;
498 
499  LPITEMIDLIST pidlProgramsAbsolute;
500  LPITEMIDLIST pidlPrograms;
501  CComPtr<IShellFolder> psfPrograms;
502 
504  if (FAILED_UNEXPECTEDLY(hr))
505  return hr;
506 
508  if (FAILED_UNEXPECTEDLY(hr))
509  return hr;
510 
512  if (FAILED_UNEXPECTEDLY(hr))
513  return hr;
514 
515  CComObject<CShellMenuCallback> *pCallback;
516  hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
517  if (FAILED_UNEXPECTEDLY(hr))
518  return hr;
519 
520  pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
521  pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
522 
523  hr = pShellMenu->Initialize(pCallback, (UINT) -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
524  if (FAILED_UNEXPECTEDLY(hr))
525  return hr;
526 
527  hr = GetStartMenuFolder(&psf);
528  if (FAILED_UNEXPECTEDLY(hr))
529  return hr;
530 
531  /* psf is a merged folder, so now we want to get the pidl of the programs item from the merged folder */
532  {
533  hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidlProgramsAbsolute);
534  if (FAILED_UNEXPECTEDLY(hr))
535  {
536  WARN("USER Programs folder not found.\n");
537  hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS, &pidlProgramsAbsolute);
538  if (FAILED_UNEXPECTEDLY(hr))
539  return hr;
540  }
541 
542  LPCITEMIDLIST pcidlPrograms;
543  CComPtr<IShellFolder> psfParent;
544  STRRET str;
545  TCHAR szDisplayName[MAX_PATH];
546 
547  hr = SHBindToParent(pidlProgramsAbsolute, IID_PPV_ARG(IShellFolder, &psfParent), &pcidlPrograms);
548  if (FAILED_UNEXPECTEDLY(hr))
549  return hr;
550 
551  hr = psfParent->GetDisplayNameOf(pcidlPrograms, SHGDN_FORPARSING | SHGDN_INFOLDER, &str);
552  if (FAILED_UNEXPECTEDLY(hr))
553  return hr;
554 
555  StrRetToBuf(&str, pcidlPrograms, szDisplayName, _countof(szDisplayName));
556  ILFree(pidlProgramsAbsolute);
557 
558  /* We got the display name from the fs folder and we parse it with the merged folder here */
559  hr = psf->ParseDisplayName(NULL, NULL, szDisplayName, NULL, &pidlPrograms, NULL);
560  if (FAILED_UNEXPECTEDLY(hr))
561  return hr;
562  }
563 
564  hr = GetProgramsFolder(&psfPrograms);
565  if (FAILED_UNEXPECTEDLY(hr))
566  return hr;
567 
568  hr = pCallback->_SetProgramsFolder(psfPrograms, pidlPrograms);
569  if (FAILED_UNEXPECTEDLY(hr))
570  return hr;
571 
572  hr = pShellMenu->SetShellFolder(psf, NULL, NULL, SMSET_TOP);
573  if (FAILED_UNEXPECTEDLY(hr))
574  return hr;
575 
576  hr = pDeskBar->SetClient(pBandSite);
577  if (FAILED_UNEXPECTEDLY(hr))
578  return hr;
579 
580  hr = pBandSite->AddBand(pShellMenu);
581  if (FAILED_UNEXPECTEDLY(hr))
582  return hr;
583 
584  return pDeskBar->QueryInterface(riid, ppv);
585 }
#define IDM_CONTROLPANEL
Definition: CStartMenu.cpp:40
HMENU WINAPI CreateMenu(void)
Definition: menu.c:837
PUITEMID_CHILD pidlItem
Definition: shobjidl.idl:2631
#define IDM_SHUTDOWN
Definition: CStartMenu.cpp:41
#define MFT_STRING
Definition: winuser.h:741
HRESULT STDMETHODCALLTYPE CallbackSM(LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CStartMenu.cpp:359
#define REFIID
Definition: guiddef.h:118
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define IDM_MYDOCUMENTS
Definition: shresdef.h:852
#define IDM_SEARCH
Definition: CStartMenu.cpp:45
HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
Definition: ordinal.c:2593
void Initialize(IShellMenu *pShellMenu, IBandSite *pBandSite, IDeskBar *pDeskBar)
Definition: CStartMenu.cpp:338
HRESULT hr
Definition: shlfolder.c:183
static HMENU hmenu
Definition: win.c:66
HRESULT ParseDisplayName([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
#define IDI_SHELL_HELP2
Definition: shresdef.h:740
#define CSIDL_MYPICTURES
Definition: shlobj.h:2063
#define IDI_SHELL_CONTROL_PANEL
Definition: shresdef.h:551
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
static HRESULT GetStartMenuFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:478
#define WARN(fmt,...)
Definition: debug.h:112
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
CComPtr< IBandSite > m_pBandSite
Definition: CStartMenu.cpp:66
#define MF_STRING
Definition: winuser.h:138
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IDM_TASKBARANDSTARTMENU
Definition: CStartMenu.cpp:35
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
LPWSTR dwTypeData
Definition: winuser.h:3259
#define IDI_SHELL_PRINTER2
Definition: shresdef.h:584
UINT_PTR WPARAM
Definition: windef.h:207
#define CMenuDeskBar_CreateInstance
Definition: shellmenu.h:75
#define lstrlenW
Definition: compat.h:750
#define IID_PPV_ARG(Itype, ppType)
#define IDI_SHELL_RECENT_DOCUMENTS1
Definition: shresdef.h:743
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
int32_t INT
Definition: typedefs.h:58
HRESULT _SetProgramsFolder(IShellFolder *psf, LPITEMIDLIST pidl)
Definition: CStartMenu.cpp:352
WPARAM wParam
Definition: combotst.c:138
#define IDI_SHELL_CONTROL_PANEL1
Definition: shresdef.h:746
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2047
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2037
#define CSIDL_RECENT
Definition: shlobj.h:2033
HRESULT CompareIDs([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
#define IDM_RUN
Definition: CStartMenu.cpp:32
#define MIIM_SUBMENU
Definition: winuser.h:718
#define L(x)
Definition: ntvdm.h:50
HRESULT WINAPI RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition: CStartMenu.cpp:490
static HRESULT GetProgramsFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:483
#define IDM_SETTINGS
Definition: CStartMenu.cpp:43
#define FALSE
Definition: types.h:117
#define CSIDL_FAVORITES
Definition: shlobj.h:2031
HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:274
unsigned int BOOL
Definition: ntddk_ex.h:94
#define StrRetToBuf
Definition: shlwapi.h:1769
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
#define CMenuSite_CreateInstance
Definition: shellmenu.h:87
#define IDI_SHELL_TSKBAR_STARTMENU
Definition: shresdef.h:569
CComPtr< IShellFolder > m_psfPrograms
Definition: CStartMenu.cpp:69
#define MF_SEPARATOR
Definition: winuser.h:137
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LONG_PTR LPARAM
Definition: windef.h:208
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2046
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define SMC_EXEC
Definition: undocshell.h:644
#define CMergedFolder_CreateInstance
Definition: shellmenu.h:93
HRESULT OnGetSubMenu(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:191
void InsertRecentItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand) const
Definition: CStartMenu.cpp:156
#define IDI_SHELL_PROGRAMS_FOLDER1
Definition: shresdef.h:742
#define MIIM_ID
Definition: winuser.h:717
IShellFolder * psf
Definition: shobjidl.idl:2632
#define IDI_SHELL_SHUTDOWN1
Definition: shresdef.h:745
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
char TCHAR
Definition: xmlstorage.h:189
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
#define IDM_DOCUMENTS
Definition: CStartMenu.cpp:37
HRESULT SetMenu([in] HMENU hmenu, [in] HWND hwnd, [in] DWORD dwFlags)
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define IDM_PROGRAMS
Definition: CStartMenu.cpp:39
__wchar_t WCHAR
Definition: xmlstorage.h:180
EXTERN_C INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex, UINT bSimulateDoc)
Definition: iconcache.cpp:855
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3194
#define IDM_MYPICTURES
Definition: shresdef.h:853
#define IDM_NETWORKCONNECTIONS
Definition: CStartMenu.cpp:47
LONG HRESULT
Definition: typedefs.h:79
#define IDM_FAVORITES
Definition: CStartMenu.cpp:42
#define _countof(array)
Definition: sndvol32.h:68
#define MF_ENABLED
Definition: winuser.h:128
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
#define IDI_SHELL_SEARCH1
Definition: shresdef.h:739
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
CComPtr< ITrayPriv > m_pTrayPriv
Definition: CStartMenu.cpp:68
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT Initialize([in] IShellMenuCallback *psmc, [in] UINT uId, [in] UINT uIdAncestor, [in] DWORD dwFlags)
HRESULT OnExec(LPSMDATA psmd)
Definition: CStartMenu.cpp:297
CComPtr< IShellMenu > m_pShellMenu
Definition: CStartMenu.cpp:65
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MIIM_TYPE
Definition: winuser.h:720
HRESULT OnInitMenu()
Definition: CStartMenu.cpp:73
#define WM_COMMAND
Definition: winuser.h:1730
#define IDI_SHELL_NETWORK_CONNECTIONS2
Definition: shresdef.h:677
CComPtr< IDeskBar > m_pDeskBar
Definition: CStartMenu.cpp:67
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define IDM_PRINTERSANDFAXES
Definition: CStartMenu.cpp:44
HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder **ppsfResult)
Definition: CStartMenu.cpp:388
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define SW_SHOWNORMAL
Definition: winuser.h:764
HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:287
#define IDI_SHELL_MY_DOCUMENTS
Definition: shresdef.h:655
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3061
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define CMenuBand_CreateInstance
Definition: shellmenu.h:81
LPCWSTR szPath
Definition: env.c:37
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
#define IDM_LOGOFF
Definition: CStartMenu.cpp:33
#define IDI_SHELL_MY_PICTURES
Definition: shresdef.h:656
static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:404
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
HRESULT SetShellFolder([in] IShellFolder *psf, [in] PCIDLIST_ABSOLUTE pidlFolder, [in] HKEY hKey, [in] DWORD dwFlags)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
FxPnpStateCallbackInfo * pCallback
#define IDM_HELPANDSUPPORT
Definition: CStartMenu.cpp:38
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:640
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define CSIDL_PERSONAL
Definition: shlobj.h:2030
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CSIDL_STARTMENU
Definition: shlobj.h:2036
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2346
LPITEMIDLIST m_pidlPrograms
Definition: CStartMenu.cpp:71
#define IDI_SHELL_FAVOTITES
Definition: shresdef.h:738
#define IDI_SHELL_RUN1
Definition: shresdef.h:744
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3093
#define END_COM_MAP()
Definition: atlcom.h:553
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WINE_DEFAULT_DEBUG_CHANNEL(CStartMenu)
#define CSIDL_PROGRAMS
Definition: shlobj.h:2027
#define IDI_SHELL_LOGOFF1
Definition: shresdef.h:741
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
SMDM_TOOLBAR struct tagSMINFO SMINFO
LPARAM lParam
Definition: combotst.c:139
HMENU hmenu
Definition: shobjidl.idl:2624
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT OnGetInfo(LPSMDATA psmd, SMINFO *psminfo)
Definition: CStartMenu.cpp:103
HMENU CreateRecentMenu(BOOL bExpandMyDocuments, BOOL bExpandMyPictures) const
Definition: CStartMenu.cpp:182