ReactOS  0.4.13-dev-235-g7373cb3
shellmenu.h File Reference
#include <stdio.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winnls.h>
#include <wincon.h>
#include <shellapi.h>
#include <shlobj.h>
#include <shlobj_undoc.h>
#include <shlwapi.h>
#include <shlguid_undoc.h>
#include <uxtheme.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <undocshell.h>
#include <undocuser.h>
#include <shellutils.h>
#include <rosctrls.h>
#include "../shresdef.h"
#include <wine/debug.h>
Include dependency graph for shellmenu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define COBJMACROS
 
#define DEBUG_CCOMOBJECT_CREATION   1
 
#define DEBUG_CCOMOBJECT_DESTRUCTION   1
 
#define DEBUG_CCOMOBJECT_REFCOUNTING   1
 
#define USE_SYSTEM_MENUDESKBAR   0
 
#define USE_SYSTEM_MENUSITE   0
 
#define USE_SYSTEM_MENUBAND   0
 
#define USE_SYSTEM_MERGED_FOLDERS   0
 
#define MERGE_FOLDERS   1
 
#define CMenuDeskBar_CreateInstance   RSHELL_CMenuDeskBar_CreateInstance
 
#define CMenuBand_CreateInstance   RSHELL_CMenuBand_CreateInstance
 
#define CMenuSite_CreateInstance   RSHELL_CMenuSite_CreateInstance
 
#define CMergedFolder_CreateInstance   RSHELL_CMergedFolder_CreateInstance
 

Functions

HRESULT WINAPI RSHELL_CStartMenu_CreateInstance (REFIID riid, void **ppv)
 
HRESULT WINAPI RSHELL_CMenuDeskBar_CreateInstance (REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI RSHELL_CMenuSite_CreateInstance (REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI RSHELL_CMenuBand_CreateInstance (REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance (REFIID riid, LPVOID *ppv)
 

Variables

HINSTANCE shell32_hInstance
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 24 of file shellmenu.h.

◆ CMenuBand_CreateInstance

#define CMenuBand_CreateInstance   RSHELL_CMenuBand_CreateInstance

Definition at line 81 of file shellmenu.h.

◆ CMenuDeskBar_CreateInstance

#define CMenuDeskBar_CreateInstance   RSHELL_CMenuDeskBar_CreateInstance

Definition at line 75 of file shellmenu.h.

◆ CMenuSite_CreateInstance

#define CMenuSite_CreateInstance   RSHELL_CMenuSite_CreateInstance

Definition at line 87 of file shellmenu.h.

◆ CMergedFolder_CreateInstance

#define CMergedFolder_CreateInstance   RSHELL_CMergedFolder_CreateInstance

Definition at line 93 of file shellmenu.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file shellmenu.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 25 of file shellmenu.h.

◆ DEBUG_CCOMOBJECT_CREATION

#define DEBUG_CCOMOBJECT_CREATION   1

Definition at line 30 of file shellmenu.h.

◆ DEBUG_CCOMOBJECT_DESTRUCTION

#define DEBUG_CCOMOBJECT_DESTRUCTION   1

Definition at line 31 of file shellmenu.h.

◆ DEBUG_CCOMOBJECT_REFCOUNTING

#define DEBUG_CCOMOBJECT_REFCOUNTING   1

Definition at line 32 of file shellmenu.h.

◆ MERGE_FOLDERS

#define MERGE_FOLDERS   1

Definition at line 70 of file shellmenu.h.

◆ USE_SYSTEM_MENUBAND

#define USE_SYSTEM_MENUBAND   0

Definition at line 67 of file shellmenu.h.

◆ USE_SYSTEM_MENUDESKBAR

#define USE_SYSTEM_MENUDESKBAR   0

Definition at line 65 of file shellmenu.h.

◆ USE_SYSTEM_MENUSITE

#define USE_SYSTEM_MENUSITE   0

Definition at line 66 of file shellmenu.h.

◆ USE_SYSTEM_MERGED_FOLDERS

#define USE_SYSTEM_MERGED_FOLDERS   0

Definition at line 68 of file shellmenu.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 23 of file shellmenu.h.

Function Documentation

◆ RSHELL_CMenuBand_CreateInstance()

HRESULT WINAPI RSHELL_CMenuBand_CreateInstance ( REFIID  riid,
LPVOID ppv 
)

Definition at line 1313 of file CMenuBand.cpp.

1314 {
1315  return ShellObjectCreator<CMenuBand>(riid, ppv);
1316 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ RSHELL_CMenuDeskBar_CreateInstance()

HRESULT WINAPI RSHELL_CMenuDeskBar_CreateInstance ( REFIID  riid,
LPVOID ppv 
)

Definition at line 851 of file CMenuDeskBar.cpp.

852 {
853  return ShellObjectCreator<CMenuDeskBar>(riid, ppv);
854 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ RSHELL_CMenuSite_CreateInstance()

HRESULT WINAPI RSHELL_CMenuSite_CreateInstance ( REFIID  riid,
LPVOID ppv 
)

Definition at line 359 of file CMenuSite.cpp.

360 {
361  return ShellObjectCreator<CMenuSite>(riid, ppv);
362 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ RSHELL_CMergedFolder_CreateInstance()

HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance ( REFIID  riid,
LPVOID ppv 
)

Definition at line 813 of file CMergedFolder.cpp.

814 {
815  return ShellObjectCreator<CMergedFolder>(riid, ppv);
816 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ RSHELL_CStartMenu_CreateInstance()

HRESULT WINAPI RSHELL_CStartMenu_CreateInstance ( REFIID  riid,
void **  ppv 
)

Definition at line 418 of file CStartMenu.cpp.

419 {
420  CComPtr<IShellMenu> pShellMenu;
421  CComPtr<IBandSite> pBandSite;
422  CComPtr<IDeskBar> pDeskBar;
423 
424  HRESULT hr;
425  IShellFolder * psf;
426 
427  LPITEMIDLIST pidlProgramsAbsolute;
428  LPITEMIDLIST pidlPrograms;
429  CComPtr<IShellFolder> psfPrograms;
430 
432  if (FAILED_UNEXPECTEDLY(hr))
433  return hr;
434 
436  if (FAILED_UNEXPECTEDLY(hr))
437  return hr;
438 
440  if (FAILED_UNEXPECTEDLY(hr))
441  return hr;
442 
443  CComObject<CShellMenuCallback> *pCallback;
444  hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
445  if (FAILED_UNEXPECTEDLY(hr))
446  return hr;
447 
448  pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
449  pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
450 
451  pShellMenu->Initialize(pCallback, (UINT) -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
452  if (FAILED_UNEXPECTEDLY(hr))
453  return hr;
454 
455  hr = GetStartMenuFolder(&psf);
456  if (FAILED_UNEXPECTEDLY(hr))
457  return hr;
458 
459  /* psf is a merged folder, so now we want to get the pidl of the programs item from the merged folder */
460  {
461  hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAMS, &pidlProgramsAbsolute);
462  if (FAILED_UNEXPECTEDLY(hr))
463  {
464  WARN("USER Programs folder not found.");
465  hr = SHGetSpecialFolderLocation(NULL, CSIDL_COMMON_PROGRAMS, &pidlProgramsAbsolute);
466  if (FAILED_UNEXPECTEDLY(hr))
467  return hr;
468  }
469 
470  LPCITEMIDLIST pcidlPrograms;
471  CComPtr<IShellFolder> psfParent;
472  STRRET str;
473  TCHAR szDisplayName[MAX_PATH];
474 
475  hr = SHBindToParent(pidlProgramsAbsolute, IID_PPV_ARG(IShellFolder, &psfParent), &pcidlPrograms);
476  if (FAILED_UNEXPECTEDLY(hr))
477  return hr;
478 
479  hr = psfParent->GetDisplayNameOf(pcidlPrograms, SHGDN_FORPARSING | SHGDN_INFOLDER, &str);
480  if (FAILED_UNEXPECTEDLY(hr))
481  return hr;
482 
483  StrRetToBuf(&str, pcidlPrograms, szDisplayName, _countof(szDisplayName));
484  ILFree(pidlProgramsAbsolute);
485 
486  /* We got the display name from the fs folder and we parse it with the merged folder here */
487  hr = psf->ParseDisplayName(NULL, NULL, szDisplayName, NULL, &pidlPrograms, NULL);
488  if (FAILED_UNEXPECTEDLY(hr))
489  return hr;
490  }
491 
492  hr = GetProgramsFolder(&psfPrograms);
493  if (FAILED_UNEXPECTEDLY(hr))
494  return hr;
495 
496  hr = pCallback->_SetProgramsFolder(psfPrograms, pidlPrograms);
497  if (FAILED_UNEXPECTEDLY(hr))
498  return hr;
499 
500  hr = pShellMenu->SetShellFolder(psf, NULL, NULL, 0);
501  if (FAILED_UNEXPECTEDLY(hr))
502  return hr;
503 
504  hr = pDeskBar->SetClient(pBandSite);
505  if (FAILED_UNEXPECTEDLY(hr))
506  return hr;
507 
508  hr = pBandSite->AddBand(pShellMenu);
509  if (FAILED_UNEXPECTEDLY(hr))
510  return hr;
511 
512  return pDeskBar->QueryInterface(riid, ppv);
513 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
HRESULT ParseDisplayName([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
REFIID riid
Definition: precomp.h:44
static HRESULT GetStartMenuFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:406
#define _countof(array)
Definition: fontsub.cpp:30
#define WARN(fmt,...)
Definition: debug.h:111
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CMenuDeskBar_CreateInstance
Definition: shellmenu.h:75
#define IID_PPV_ARG(Itype, ppType)
#define CSIDL_COMMON_PROGRAMS
Definition: shlobj.h:2025
static HRESULT GetProgramsFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:411
#define StrRetToBuf
Definition: shlwapi.h:1769
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define CMenuSite_CreateInstance
Definition: shellmenu.h:87
char TCHAR
Definition: xmlstorage.h:189
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2687
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:35
#define MAX_PATH
Definition: compat.h:26
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define CMenuBand_CreateInstance
Definition: shellmenu.h:81
unsigned int UINT
Definition: ndis.h:50
#define CSIDL_PROGRAMS
Definition: shlobj.h:2005
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Variable Documentation

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 358 of file shell32.cpp.

Referenced by if().