ReactOS  0.4.15-dev-985-gd905dd5
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 487 of file CStartMenu.cpp.

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 }
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:475
#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:2034
static HRESULT GetProgramsFolder(IShellFolder **ppsfStartMenu)
Definition: CStartMenu.cpp:480
#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:2830
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#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 CSIDL_PROGRAMS
Definition: shlobj.h:2014
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().