ReactOS  0.4.15-dev-494-g1d8c567
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->AppendMenuW(&hmenu);
91  return hr;
92 
93  hr = m_pShellMenu->SetMenu(hmenu, NULL, SMSET_BOTTOM);
95  return hr;
96 
97  return hr;
98  }
99 
101  {
102  int iconIndex = 0;
103 
104  switch (psmd->uId)
105  {
106  // Smaller "24x24" icons used for the start menu
107  // The bitmaps are still 32x32, but the image is centered
108  case IDM_FAVORITES: iconIndex = -IDI_SHELL_FAVOTITES; break;
109  case IDM_SEARCH: iconIndex = -IDI_SHELL_SEARCH1; break;
110  case IDM_HELPANDSUPPORT: iconIndex = -IDI_SHELL_HELP2; break;
111  case IDM_LOGOFF: iconIndex = -IDI_SHELL_LOGOFF1; break;
112  case IDM_PROGRAMS: iconIndex = -IDI_SHELL_PROGRAMS_FOLDER1; break;
113  case IDM_DOCUMENTS: iconIndex = -IDI_SHELL_RECENT_DOCUMENTS1; break;
114  case IDM_RUN: iconIndex = -IDI_SHELL_RUN1; break;
115  case IDM_SHUTDOWN: iconIndex = -IDI_SHELL_SHUTDOWN1; break;
116  case IDM_SETTINGS: iconIndex = -IDI_SHELL_CONTROL_PANEL1; break;
117  case IDM_MYDOCUMENTS: iconIndex = -IDI_SHELL_MY_DOCUMENTS; break;
118  case IDM_MYPICTURES: iconIndex = -IDI_SHELL_MY_PICTURES; break;
119 
120  case IDM_CONTROLPANEL: iconIndex = -IDI_SHELL_CONTROL_PANEL; break;
121  case IDM_NETWORKCONNECTIONS: iconIndex = -IDI_SHELL_NETWORK_CONNECTIONS2; break;
122  case IDM_PRINTERSANDFAXES: iconIndex = -IDI_SHELL_PRINTER2; break;
123  case IDM_TASKBARANDSTARTMENU: iconIndex = -IDI_SHELL_TSKBAR_STARTMENU; break;
124  //case IDM_SECURITY: iconIndex = -21; break;
125  //case IDM_SYNCHRONIZE: iconIndex = -21; break;
126  //case IDM_DISCONNECT: iconIndex = -21; break;
127  //case IDM_UNDOCKCOMPUTER: iconIndex = -21; break;
128  default:
129  return S_FALSE;
130  }
131 
132  if (iconIndex)
133  {
134  if ((psminfo->dwMask & SMIM_TYPE) != 0)
135  psminfo->dwType = SMIT_STRING;
136  if ((psminfo->dwMask & SMIM_ICON) != 0)
137  psminfo->iIcon = Shell_GetCachedImageIndex(L"shell32.dll", iconIndex, FALSE);
138  if ((psminfo->dwMask & SMIM_FLAGS) != 0)
139  psminfo->dwFlags |= SMIF_ICON;
140 #ifdef TEST_TRACKPOPUPMENU_SUBMENUS
141  if ((psminfo->dwMask & SMIM_FLAGS) != 0)
142  psminfo->dwFlags |= SMIF_TRACKPOPUP;
143 #endif
144  }
145  else
146  {
147  if ((psminfo->dwMask & SMIM_TYPE) != 0)
148  psminfo->dwType = SMIT_SEPARATOR;
149  }
150  return S_OK;
151  }
152 
153  void InsertRecentItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand) const
154  {
156  if (!SHGetSpecialFolderPathW(NULL, szPath, csidl, FALSE))
157  {
158  ERR("SHGetSpecialFolderPathW failed\n");
159  return;
160  }
161 
162  LPWSTR pszText = PathFindFileNameW(szPath);
163  if (bExpand)
164  {
165  MENUITEMINFOW mii = { sizeof(mii), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU };
166  mii.fType = MFT_STRING;
167  mii.wID = nID;
168  mii.hSubMenu = ::CreatePopupMenu();
169  mii.dwTypeData = pszText;
170  mii.cch = lstrlenW(pszText);
171  InsertMenuItemW(hMenu, GetMenuItemCount(hMenu), TRUE, &mii);
172  }
173  else
174  {
175  AppendMenuW(hMenu, MF_STRING | MF_ENABLED, nID, pszText);
176  }
177  }
178 
179  HMENU CreateRecentMenu(BOOL bExpandMyDocuments, BOOL bExpandMyPictures) const
180  {
181  HMENU hMenu = ::CreateMenu();
182  InsertRecentItem(hMenu, IDM_MYDOCUMENTS, CSIDL_MYDOCUMENTS, bExpandMyDocuments);
183  InsertRecentItem(hMenu, IDM_MYPICTURES, CSIDL_MYPICTURES, bExpandMyPictures);
184  AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL);
185  return hMenu;
186  }
187 
188  HRESULT OnGetSubMenu(LPSMDATA psmd, REFIID iid, void ** pv)
189  {
190  HRESULT hr;
191  int csidl = 0;
192  IShellMenu *pShellMenu;
193 
195  if (FAILED_UNEXPECTEDLY(hr))
196  return hr;
197 
198  hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
199  if (FAILED_UNEXPECTEDLY(hr))
200  return hr;
201 
202  switch (psmd->uId)
203  {
204  case IDM_PROGRAMS: csidl = CSIDL_PROGRAMS; break;
205  case IDM_FAVORITES: csidl = CSIDL_FAVORITES; break;
206  case IDM_DOCUMENTS: csidl = CSIDL_RECENT; break;
207  case IDM_MYDOCUMENTS: csidl = CSIDL_MYDOCUMENTS; break;
208  case IDM_MYPICTURES: csidl = CSIDL_MYPICTURES; break;
209  }
210 
211  if (csidl)
212  {
213  IShellFolder *psfStartMenu;
214  DWORD dwFlags = SMSET_TOP;
215 
216  if (csidl == CSIDL_PROGRAMS && m_psfPrograms)
217  {
218  psfStartMenu = m_psfPrograms;
219  }
220  else
221  {
222  if (csidl == CSIDL_RECENT)
223  {
224  BOOL bExpandMyDocuments = FALSE; /* FIXME: Get value from registry */
225  BOOL bExpandMyPictures = FALSE; /* FIXME: Get value from registry */
226  HMENU hMenu = CreateRecentMenu(bExpandMyDocuments, bExpandMyPictures);
227  if (hMenu == NULL)
228  ERR("CreateRecentMenu failed\n");
229 
230  hr = pShellMenu->SetMenu(hMenu, NULL, SMSET_BOTTOM);
231  if (FAILED_UNEXPECTEDLY(hr))
232  return hr;
233 
234  dwFlags = SMSET_BOTTOM;
235  }
236 
237  LPITEMIDLIST pidlStartMenu;
238  IShellFolder *psfDestop;
239  hr = SHGetFolderLocation(NULL, csidl, 0, 0, &pidlStartMenu);
240  if (FAILED_UNEXPECTEDLY(hr))
241  return hr;
242 
243  hr = SHGetDesktopFolder(&psfDestop);
244  if (FAILED_UNEXPECTEDLY(hr))
245  return hr;
246 
247  hr = psfDestop->BindToObject(pidlStartMenu, NULL, IID_PPV_ARG(IShellFolder, &psfStartMenu));
248  if (FAILED_UNEXPECTEDLY(hr))
249  return hr;
250  }
251 
252  hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, dwFlags);
253  if (FAILED_UNEXPECTEDLY(hr))
254  return hr;
255  }
256  else
257  {
258  MENUITEMINFO mii;
259  mii.cbSize = sizeof(mii);
260  mii.fMask = MIIM_SUBMENU;
261  if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii))
262  {
263  hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM);
264  if (FAILED_UNEXPECTEDLY(hr))
265  return hr;
266  }
267  }
268  return pShellMenu->QueryInterface(iid, pv);
269  }
270 
271  HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void ** pv)
272  {
273  if (psmd->uId == IDM_PROGRAMS ||
274  psmd->uId == IDM_CONTROLPANEL ||
275  psmd->uId == IDM_NETWORKCONNECTIONS ||
276  psmd->uId == IDM_PRINTERSANDFAXES)
277  {
278  //UNIMPLEMENTED
279  }
280 
281  return S_FALSE;
282  }
283 
284  HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void ** pv)
285  {
286  if (IsEqualIID(iid, IID_IShellMenu))
287  return OnGetSubMenu(psmd, iid, pv);
288  else if (IsEqualIID(iid, IID_IContextMenu))
289  return OnGetContextMenu(psmd, iid, pv);
290 
291  return S_FALSE;
292  }
293 
295  {
297 
298  // HACK: Because our ShellExecute can't handle CLSID components in paths, we can't launch the paths using the "open" verb.
299  // FIXME: Change this back to using the path as the filename and the "open" verb, once ShellExecute can handle CLSID path components.
300 
301  if (psmd->uId == IDM_CONTROLPANEL)
302  ShellExecuteW(NULL, NULL, L"explorer.exe", L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}", NULL, SW_SHOWNORMAL);
303  else if (psmd->uId == IDM_NETWORKCONNECTIONS)
304  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);
305  else if (psmd->uId == IDM_PRINTERSANDFAXES)
306  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);
307  else if (psmd->uId == IDM_MYDOCUMENTS)
308  {
311  else
312  ERR("SHGetSpecialFolderPathW failed\n");
313  }
314  else if (psmd->uId == IDM_MYPICTURES)
315  {
318  else
319  ERR("SHGetSpecialFolderPathW failed\n");
320  }
321  else
323 
324  return S_OK;
325  }
326 
327 public:
328 
332  COM_INTERFACE_ENTRY_IID(IID_IShellMenuCallback, IShellMenuCallback)
333  END_COM_MAP()
334 
336  IShellMenu* pShellMenu,
337  IBandSite* pBandSite,
338  IDeskBar* pDeskBar)
339  {
340  m_pShellMenu = pShellMenu;
341  m_pBandSite = pBandSite;
342  m_pDeskBar = pDeskBar;
343  }
344 
346  {
347  }
348 
350  {
351  m_psfPrograms = psf;
352  m_pidlPrograms = pidl;
353  return S_OK;
354  }
355 
357  LPSMDATA psmd,
358  UINT uMsg,
359  WPARAM wParam,
360  LPARAM lParam)
361  {
362  switch (uMsg)
363  {
364  case SMC_INITMENU:
365  return OnInitMenu();
366  case SMC_GETINFO:
367  return OnGetInfo(psmd, reinterpret_cast<SMINFO*>(lParam));
368  case SMC_GETOBJECT:
369  return OnGetObject(psmd, *reinterpret_cast<IID *>(wParam), reinterpret_cast<void **>(lParam));
370  case SMC_EXEC:
371  return OnExec(psmd);
372  case SMC_SFEXEC:
373  m_pTrayPriv->Execute(psmd->psf, psmd->pidlItem);
374  break;
375  case 0x10000000: // _FilterPIDL from CMenuSFToolbar
376  if (psmd->psf->CompareIDs(0, psmd->pidlItem, m_pidlPrograms) == 0)
377  return S_OK;
378  return S_FALSE;
379  }
380 
381  return S_FALSE;
382  }
383 };
384 
386 {
387  HRESULT hr;
388  CComPtr<IShellFolder> psfDesktop;
389 
390  *ppsfResult = NULL;
391 
392  hr = SHGetDesktopFolder(&psfDesktop);
393  if (FAILED(hr))
394  return hr;
395 
396  hr = psfDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, ppsfResult));
397 
398  return hr;
399 }
400 
401 static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder ** ppsfStartMenu)
402 {
403  HRESULT hr;
404  LPITEMIDLIST pidlUserStartMenu;
405  LPITEMIDLIST pidlCommonStartMenu;
406  CComPtr<IShellFolder> psfUserStartMenu;
407  CComPtr<IShellFolder> psfCommonStartMenu;
408  CComPtr<IAugmentedShellFolder> pasf;
409 
410  *ppsfStartMenu = NULL;
411 
412  hr = SHGetSpecialFolderLocation(NULL, folder1, &pidlUserStartMenu);
413  if (FAILED(hr))
414  {
415  WARN("Failed to get the USER start menu folder. Trying to run with just the COMMON one.\n");
416 
417  hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu);
418  if (FAILED_UNEXPECTEDLY(hr))
419  return hr;
420 
421  TRACE("COMMON start menu obtained.\n");
422  hr = BindToDesktop(pidlCommonStartMenu, ppsfStartMenu);
423  ILFree(pidlCommonStartMenu);
424  return hr;
425  }
426 #if MERGE_FOLDERS
427  hr = SHGetSpecialFolderLocation(NULL, folder2, &pidlCommonStartMenu);
428  if (FAILED_UNEXPECTEDLY(hr))
429 #else
430  else
431 #endif
432  {
433  WARN("Failed to get the COMMON start menu folder. Will use only the USER contents.\n");
434  hr = BindToDesktop(pidlUserStartMenu, ppsfStartMenu);
435  ILFree(pidlUserStartMenu);
436  return hr;
437  }
438 
439  TRACE("Both COMMON and USER statr menu folders obtained, merging them...\n");
440 
441  hr = BindToDesktop(pidlUserStartMenu, &psfUserStartMenu);
442  if (FAILED_UNEXPECTEDLY(hr))
443  return hr;
444 
445  hr = BindToDesktop(pidlCommonStartMenu, &psfCommonStartMenu);
446  if (FAILED_UNEXPECTEDLY(hr))
447  return hr;
448 
449  hr = CMergedFolder_CreateInstance(IID_PPV_ARG(IAugmentedShellFolder, &pasf));
450  if (FAILED_UNEXPECTEDLY(hr))
451  {
452  *ppsfStartMenu = psfUserStartMenu.Detach();
453  ILFree(pidlCommonStartMenu);
454  ILFree(pidlUserStartMenu);
455  return hr;
456  }
457 
458  hr = pasf->AddNameSpace(NULL, psfUserStartMenu, pidlUserStartMenu, 0xFF00);
459  if (FAILED_UNEXPECTEDLY(hr))
460  return hr;
461 
462  hr = pasf->AddNameSpace(NULL, psfCommonStartMenu, pidlCommonStartMenu, 0);
463  if (FAILED_UNEXPECTEDLY(hr))
464  return hr;
465 
466  hr = pasf->QueryInterface(IID_PPV_ARG(IShellFolder, ppsfStartMenu));
467  pasf.Release();
468 
469  ILFree(pidlCommonStartMenu);
470  ILFree(pidlUserStartMenu);
471 
472  return hr;
473 }
474 
475 static HRESULT GetStartMenuFolder(IShellFolder ** ppsfStartMenu)
476 {
478 }
479 
480 static HRESULT GetProgramsFolder(IShellFolder ** ppsfStartMenu)
481 {
482  return GetMergedFolder(CSIDL_PROGRAMS, CSIDL_COMMON_PROGRAMS, ppsfStartMenu);
483 }
484 
485 extern "C"
488 {
489  CComPtr<IShellMenu> pShellMenu;
490  CComPtr<IBandSite> pBandSite;
491  CComPtr<IDeskBar> pDeskBar;
492 
493  HRESULT hr;
494  IShellFolder * psf;
495 
496  LPITEMIDLIST pidlProgramsAbsolute;
497  LPITEMIDLIST pidlPrograms;
498  CComPtr<IShellFolder> psfPrograms;
499 
501  if (FAILED_UNEXPECTEDLY(hr))
502  return hr;
503 
505  if (FAILED_UNEXPECTEDLY(hr))
506  return hr;
507 
509  if (FAILED_UNEXPECTEDLY(hr))
510  return hr;
511 
512  CComObject<CShellMenuCallback> *pCallback;
513  hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
514  if (FAILED_UNEXPECTEDLY(hr))
515  return hr;
516 
517  pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
518  pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
519 
520  pShellMenu->Initialize(pCallback, (UINT) -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
521  if (FAILED_UNEXPECTEDLY(hr))
522  return hr;
523 
524  hr = GetStartMenuFolder(&psf);
525  if (FAILED_UNEXPECTEDLY(hr))
526  return hr;
527 
528  /* psf is a merged folder, so now we want to get the pidl of the programs item from the merged folder */
529  {
530  hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidlProgramsAbsolute);
531  if (FAILED_UNEXPECTEDLY(hr))
532  {
533  WARN("USER Programs folder not found.");
534  hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS, &pidlProgramsAbsolute);
535  if (FAILED_UNEXPECTEDLY(hr))
536  return hr;
537  }
538 
539  LPCITEMIDLIST pcidlPrograms;
540  CComPtr<IShellFolder> psfParent;
541  STRRET str;
542  TCHAR szDisplayName[MAX_PATH];
543 
544  hr = SHBindToParent(pidlProgramsAbsolute, IID_PPV_ARG(IShellFolder, &psfParent), &pcidlPrograms);
545  if (FAILED_UNEXPECTEDLY(hr))
546  return hr;
547 
548  hr = psfParent->GetDisplayNameOf(pcidlPrograms, SHGDN_FORPARSING | SHGDN_INFOLDER, &str);
549  if (FAILED_UNEXPECTEDLY(hr))
550  return hr;
551 
552  StrRetToBuf(&str, pcidlPrograms, szDisplayName, _countof(szDisplayName));
553  ILFree(pidlProgramsAbsolute);
554 
555  /* We got the display name from the fs folder and we parse it with the merged folder here */
556  hr = psf->ParseDisplayName(NULL, NULL, szDisplayName, NULL, &pidlPrograms, NULL);
557  if (FAILED_UNEXPECTEDLY(hr))
558  return hr;
559  }
560 
561  hr = GetProgramsFolder(&psfPrograms);
562  if (FAILED_UNEXPECTEDLY(hr))
563  return hr;
564 
565  hr = pCallback->_SetProgramsFolder(psfPrograms, pidlPrograms);
566  if (FAILED_UNEXPECTEDLY(hr))
567  return hr;
568 
569  hr = pShellMenu->SetShellFolder(psf, NULL, NULL, SMSET_TOP);
570  if (FAILED_UNEXPECTEDLY(hr))
571  return hr;
572 
573  hr = pDeskBar->SetClient(pBandSite);
574  if (FAILED_UNEXPECTEDLY(hr))
575  return hr;
576 
577  hr = pBandSite->AddBand(pShellMenu);
578  if (FAILED_UNEXPECTEDLY(hr))
579  return hr;
580 
581  return pDeskBar->QueryInterface(riid, ppv);
582 }
#define IDM_CONTROLPANEL
Definition: CStartMenu.cpp:40
HMENU WINAPI CreateMenu(void)
Definition: menu.c:837
PUITEMID_CHILD pidlItem
Definition: shobjidl.idl:2629
#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:356
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define IDM_MYDOCUMENTS
Definition: shresdef.h:798
#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:335
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:689
#define CSIDL_MYPICTURES
Definition: shlobj.h:2050
#define IDI_SHELL_CONTROL_PANEL
Definition: shresdef.h:500
REFIID riid
Definition: precomp.h:44
static HRESULT GetStartMenuFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:475
#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:611
LPWSTR dwTypeData
Definition: winuser.h:3244
#define IDI_SHELL_PRINTER2
Definition: shresdef.h:533
UINT_PTR WPARAM
Definition: windef.h:207
#define CMenuDeskBar_CreateInstance
Definition: shellmenu.h:75
#define lstrlenW
Definition: compat.h:416
#define IID_PPV_ARG(Itype, ppType)
#define IDI_SHELL_RECENT_DOCUMENTS1
Definition: shresdef.h:692
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
int32_t INT
Definition: typedefs.h:57
HRESULT _SetProgramsFolder(IShellFolder *psf, LPITEMIDLIST pidl)
Definition: CStartMenu.cpp:349
WPARAM wParam
Definition: combotst.c:138
#define IDI_SHELL_CONTROL_PANEL1
Definition: shresdef.h:695
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2034
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define CSIDL_MYDOCUMENTS
Definition: shlobj.h:2024
#define CSIDL_RECENT
Definition: shlobj.h:2020
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
HRESULT WINAPI RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition: CStartMenu.cpp:487
static HRESULT GetProgramsFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:480
#define IDM_SETTINGS
Definition: CStartMenu.cpp:43
#define CSIDL_FAVORITES
Definition: shlobj.h:2018
HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:271
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
smooth NULL
Definition: ftsmooth.c:416
#define CMenuSite_CreateInstance
Definition: shellmenu.h:87
#define IDI_SHELL_TSKBAR_STARTMENU
Definition: shresdef.h:518
CComPtr< IShellFolder > m_psfPrograms
Definition: CStartMenu.cpp:69
#define MF_SEPARATOR
Definition: winuser.h:137
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:389
LONG_PTR LPARAM
Definition: windef.h:208
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2033
HRESULT BindToObject([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
#define SMC_EXEC
Definition: undocshell.h:625
#define CMergedFolder_CreateInstance
Definition: shellmenu.h:93
HRESULT OnGetSubMenu(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:188
void InsertRecentItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand) const
Definition: CStartMenu.cpp:153
#define IDI_SHELL_PROGRAMS_FOLDER1
Definition: shresdef.h:691
#define MIIM_ID
Definition: winuser.h:717
IShellFolder * psf
Definition: shobjidl.idl:2630
#define IDI_SHELL_SHUTDOWN1
Definition: shresdef.h:694
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
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:861
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
#define IDM_MYPICTURES
Definition: shresdef.h:799
#define IDM_NETWORKCONNECTIONS
Definition: CStartMenu.cpp:47
LONG HRESULT
Definition: typedefs.h:78
#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:71
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
#define IDI_SHELL_SEARCH1
Definition: shresdef.h:688
#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:294
CComPtr< IShellMenu > m_pShellMenu
Definition: CStartMenu.cpp:65
static const WCHAR L[]
Definition: oid.c:1250
_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:1722
#define IDI_SHELL_NETWORK_CONNECTIONS2
Definition: shresdef.h:626
CComPtr< IDeskBar > m_pDeskBar
Definition: CStartMenu.cpp:67
#define IDM_PRINTERSANDFAXES
Definition: CStartMenu.cpp:44
HRESULT BindToDesktop(LPCITEMIDLIST pidl, IShellFolder **ppsfResult)
Definition: CStartMenu.cpp:385
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
#define SW_SHOWNORMAL
Definition: winuser.h:764
HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void **pv)
Definition: CStartMenu.cpp:284
#define IDI_SHELL_MY_DOCUMENTS
Definition: shresdef.h:604
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2709
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1331
#define CMenuBand_CreateInstance
Definition: shellmenu.h:81
LPCWSTR szPath
Definition: env.c:35
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
#define IDM_LOGOFF
Definition: CStartMenu.cpp:33
#define IDI_SHELL_MY_PICTURES
Definition: shresdef.h:605
static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:401
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 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:639
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define CSIDL_PERSONAL
Definition: shlobj.h:2017
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CSIDL_STARTMENU
Definition: shlobj.h:2023
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2274
LPITEMIDLIST m_pidlPrograms
Definition: CStartMenu.cpp:71
#define IDI_SHELL_FAVOTITES
Definition: shresdef.h:687
#define IDI_SHELL_RUN1
Definition: shresdef.h:693
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2741
#define END_COM_MAP()
Definition: atlcom.h:552
WCHAR * LPWSTR
Definition: xmlstorage.h:184
WINE_DEFAULT_DEBUG_CHANNEL(CStartMenu)
#define CSIDL_PROGRAMS
Definition: shlobj.h:2014
#define IDI_SHELL_LOGOFF1
Definition: shresdef.h:690
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:2622
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT OnGetInfo(LPSMDATA psmd, SMINFO *psminfo)
Definition: CStartMenu.cpp:100
HMENU CreateRecentMenu(BOOL bExpandMyDocuments, BOOL bExpandMyPictures) const
Definition: CStartMenu.cpp:179