ReactOS  0.4.15-dev-5452-g3c95c95
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 <ui/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 852 of file CMenuDeskBar.cpp.

853 {
854  return ShellObjectCreator<CMenuDeskBar>(riid, ppv);
855 }
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 360 of file CMenuSite.cpp.

361 {
362  return ShellObjectCreator<CMenuSite>(riid, ppv);
363 }
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 490 of file CStartMenu.cpp.

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 }
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:478
#define WARN(fmt,...)
Definition: debug.h:112
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:2047
static HRESULT GetProgramsFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:483
#define StrRetToBuf
Definition: shlwapi.h:1769
const WCHAR * str
#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:3194
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define CMenuBand_CreateInstance
Definition: shellmenu.h:81
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
FxPnpStateCallbackInfo * pCallback
#define CSIDL_PROGRAMS
Definition: shlobj.h:2027
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Variable Documentation

◆ shell32_hInstance

HINSTANCE shell32_hInstance

Definition at line 361 of file shell32.cpp.

Referenced by if().