ReactOS 0.4.16-dev-847-g386fccd
precomp.h File Reference
#include <stdarg.h>
#include <assert.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <wincon.h>
#include <commdlg.h>
#include <ddeml.h>
#include <userenv.h>
#include <shlwapi.h>
#include <wininet.h>
#include <shlobj.h>
#include <shobjidl.h>
#include <ndk/rtlfuncs.h>
#include <fmifs/fmifs.h>
#include <tchar.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atlstr.h>
#include <atlsimpcoll.h>
#include <atlcoll.h>
#include <powrprof.h>
#include <winnetwk.h>
#include <objsafe.h>
#include <regstr.h>
#include <comctl32_undoc.h>
#include <shlguid_undoc.h>
#include <shlobj_undoc.h>
#include <shlwapi_undoc.h>
#include <ishellfolder_helpers.h>
#include <shellapi.h>
#include <undocshell.h>
#include <browseui_undoc.h>
#include <shellutils.h>
#include "shellrecyclebin/recyclebin.h"
#include "wine/pidl.h"
#include "debughlp.h"
#include "wine/shell32_main.h"
#include "shresdef.h"
#include "wine/cpanel.h"
#include "CActiveDesktop.h"
#include "CEnumIDListBase.h"
#include "shfldr.h"
#include "CShellItem.h"
#include "CShellLink.h"
#include "CFolderItemVerbs.h"
#include "CFolderItems.h"
#include "CFolder.h"
#include "CShellDispatch.h"
#include "CDropTargetHelper.h"
#include "CFolderOptions.h"
#include "folders/CFSFolder.h"
#include "folders/CDrivesFolder.h"
#include "folders/CDesktopFolder.h"
#include "folders/CControlPanelFolder.h"
#include "folders/CMyDocsFolder.h"
#include "folders/CNetFolder.h"
#include "folders/CFontsFolder.h"
#include "folders/CPrinterFolder.h"
#include "folders/CAdminToolsFolder.h"
#include "folders/CRecycleBin.h"
#include "droptargets/CexeDropHandler.h"
#include "droptargets/CFSDropTarget.h"
#include "COpenWithMenu.h"
#include "CNewMenu.h"
#include "CSendToMenu.h"
#include "CCopyMoveToMenu.h"
#include "CCopyAsPathMenu.h"
#include "dialogs/filedefext.h"
#include "dialogs/drvdefext.h"
#include "CQueryAssociations.h"
#include "shellmenu/CMenuBand.h"
#include "shellmenu/CMenuDeskBar.h"
#include "shellmenu/CMenuSite.h"
#include "shellmenu/CMergedFolder.h"
#include "shellmenu/shellmenu.h"
#include "CUserNotification.h"
#include "dialogs/folder_options.h"
#include "shelldesktop/CChangeNotifyServer.h"
#include "utils.h"
#include <wine/debug.h>
#include <wine/unicode.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CStubWindow32
 

Macros

#define COBJMACROS
 
#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define ShellMessageBoxW   ShellMessageBoxWrapW
 
#define VERBKEY_CCHMAX   64
 
#define MAX_PROPERTY_SHEET_PAGE   32
 
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl)   SHRunControlPanel((cpl), (hwnd))
 
#define CmicFlagsToSeeFlags(flags)   ((flags) & SEE_CMIC_COMMON_FLAGS)
 
#define CSTUBWINDOW32_CLASSNAME   _T("StubWindow32")
 

Typedefs

typedef enum _FILEOPCALLBACKEVENT FILEOPCALLBACKEVENT
 
typedef HRESULT(CALLBACKFILEOPCALLBACK) (FILEOPCALLBACKEVENT Event, LPCWSTR Source, LPCWSTR Destination, UINT Attributes, HRESULT hr, void *CallerData)
 

Enumerations

enum  _FILEOPCALLBACKEVENT {
  FOCE_STARTOPERATIONS , FOCE_FINISHOPERATIONS , FOCE_PREMOVEITEM , FOCE_POSTMOVEITEM ,
  FOCE_PREDELETEITEM , FOCE_POSTDELETEITEM
}
 

Functions

BOOL CALLBACK AddPropSheetPageCallback (HPROPSHEETPAGE hPage, LPARAM lParam)
 
static HRESULT AddPropSheetPage (HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
 
template<class T >
static UINT CALLBACK PropSheetPageLifetimeCallback (HWND hWnd, UINT uMsg, PROPSHEETPAGEW *pPSP)
 
EXTERN_C HRESULT WINAPI SHMultiFileProperties (IDataObject *pDataObject, DWORD dwFlags)
 
HRESULT SHELL32_ShowPropertiesDialog (IDataObject *pdtobj)
 
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync (IDataObject *pDO)
 
HRESULT SHELL32_ShowFilesystemItemsPropertiesDialogAsync (HWND hOwner, IDataObject *pDO)
 
HRESULT SHELL32_ShowShellExtensionProperties (const CLSID *pClsid, IDataObject *pDO)
 
HRESULT SHELL_ShowItemIDListProperties (LPCITEMIDLIST pidl)
 
HRESULT SHELL32_DefaultContextMenuCallBack (IShellFolder *psf, IDataObject *pdo, UINT msg)
 
UINT MapVerbToDfmCmd (_In_ LPCSTR verba)
 
UINT GetDfmCmd (_In_ IContextMenu *pCM, _In_ LPCSTR verba)
 
static UINT SeeFlagsToCmicFlags (UINT flags)
 
void PostCabinetMessage (UINT Msg, WPARAM wParam, LPARAM lParam)
 
HRESULT Shell_TranslateIDListAlias (_In_ LPCITEMIDLIST pidl, _In_ HANDLE hToken, _Out_ LPITEMIDLIST *ppidlAlias, _In_ DWORD dwFlags)
 
BOOL BindCtx_ContainsObject (_In_ IBindCtx *pBindCtx, _In_ LPCWSTR pszName)
 
DWORD BindCtx_GetMode (_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
 
BOOL SHSkipJunctionBinding (_In_ IBindCtx *pbc, _In_ CLSID *pclsid)
 
HRESULT SHIsFileSysBindCtx (_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
 
BOOL Shell_FailForceReturn (_In_ HRESULT hr)
 
EXTERN_C INT Shell_ParseSpecialFolder (_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ INT *pcch)
 
HRESULT Shell_DisplayNameOf (_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_ LPWSTR pszBuf, _In_ UINT cchBuf)
 
EXTERN_C HRESULT SHBindToObject (_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ REFIID riid, _Out_ void **ppvObj)
 
HRESULT SHBindToObjectEx (_In_opt_ IShellFolder *pShellFolder, _In_ LPCITEMIDLIST pidl, _In_opt_ IBindCtx *pBindCtx, _In_ REFIID riid, _Out_ void **ppvObj)
 
EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem (_In_opt_ HWND hWnd, _In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppvObj)
 
DWORD SHGetAttributes (_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
 
HRESULT SHELL_GetIDListTarget (_In_ LPCITEMIDLIST pidl, _Out_ PIDLIST_ABSOLUTE *ppidl)
 
HRESULT SHCoInitializeAnyApartment (VOID)
 
HRESULT SHGetNameAndFlagsW (_In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_opt_ LPWSTR pszText, _In_ UINT cchBuf, _Inout_opt_ DWORD *pdwAttributes)
 
EXTERN_C HWND BindCtx_GetUIWindow (_In_ IBindCtx *pBindCtx)
 
EXTERN_C HRESULT BindCtx_RegisterObjectParam (_In_ IBindCtx *pBindCtx, _In_ LPOLESTR pszKey, _In_opt_ IUnknown *punk, _Out_ LPBC *ppbc)
 
BOOL PathIsDotOrDotDotW (_In_ LPCWSTR pszPath)
 
BOOL PathIsValidElement (_In_ LPCWSTR pszPath)
 
BOOL PathIsDosDevice (_In_ LPCWSTR pszName)
 
HRESULT SHELL32_GetDllFromRundll32CommandLine (LPCWSTR pszCmd, LPWSTR pszOut, SIZE_T cchMax)
 
HRESULT SHILAppend (_Inout_ LPITEMIDLIST pidl, _Inout_ LPITEMIDLIST *ppidl)
 
HRESULT DataObject_GetHIDACount (IDataObject *pdo)
 
PIDLIST_ABSOLUTE SHELL_CIDA_ILCloneFull (_In_ const CIDA *pCIDA, _In_ UINT Index)
 
PIDLIST_ABSOLUTE SHELL_DataObject_ILCloneFullItem (_In_ IDataObject *pDO, _In_ UINT Index)
 
HRESULT SHELL_CloneDataObject (_In_ IDataObject *pDO, _Out_ IDataObject **ppDO)
 
EXTERN_C HRESULT IUnknown_InitializeCommand (_In_ IUnknown *pUnk, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB)
 
EXTERN_C HRESULT InvokeIExecuteCommand (_In_ IExecuteCommand *pEC, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB, _In_opt_ IShellItemArray *pSIA, _In_opt_ LPCMINVOKECOMMANDINFOEX pICI, _In_opt_ IUnknown *pSite)
 
EXTERN_C HRESULT InvokeIExecuteCommandWithDataObject (_In_ IExecuteCommand *pEC, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB, _In_ IDataObject *pDO, _In_opt_ LPCMINVOKECOMMANDINFOEX pICI, _In_opt_ IUnknown *pSite)
 
int SHELL32_FileOperation (LPSHFILEOPSTRUCTW lpFileOp, FILEOPCALLBACK Callback, void *CallerData)
 

Variables

const GUID CLSID_AdminFolderShortcut
 
const GUID CLSID_FontsFolderShortcut
 
const GUID CLSID_StartMenu
 
const GUID CLSID_MenuBandSite
 
const GUID CLSID_OpenWith
 
const GUID CLSID_UnixFolder
 
const GUID CLSID_UnixDosFolder
 
const GUID SHELL32_AdvtShortcutProduct
 
const GUID SHELL32_AdvtShortcutComponent
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 9 of file precomp.h.

◆ CmicFlagsToSeeFlags

#define CmicFlagsToSeeFlags (   flags)    ((flags) & SEE_CMIC_COMMON_FLAGS)

Definition at line 189 of file precomp.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 7 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 10 of file precomp.h.

◆ CSTUBWINDOW32_CLASSNAME

#define CSTUBWINDOW32_CLASSNAME   _T("StubWindow32")

Definition at line 200 of file precomp.h.

◆ MAX_PROPERTY_SHEET_PAGE

#define MAX_PROPERTY_SHEET_PAGE   32

Definition at line 131 of file precomp.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 11 of file precomp.h.

◆ SHELL_ExecuteControlPanelCPL

#define SHELL_ExecuteControlPanelCPL (   hwnd,
  cpl 
)    SHRunControlPanel((cpl), (hwnd))

Definition at line 187 of file precomp.h.

◆ ShellMessageBoxW

#define ShellMessageBoxW   ShellMessageBoxWrapW

Definition at line 62 of file precomp.h.

◆ VERBKEY_CCHMAX

#define VERBKEY_CCHMAX   64

Definition at line 129 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file precomp.h.

Typedef Documentation

◆ FILEOPCALLBACK

Definition at line 336 of file precomp.h.

◆ FILEOPCALLBACKEVENT

Enumeration Type Documentation

◆ _FILEOPCALLBACKEVENT

Enumerator
FOCE_STARTOPERATIONS 
FOCE_FINISHOPERATIONS 
FOCE_PREMOVEITEM 
FOCE_POSTMOVEITEM 
FOCE_PREDELETEITEM 
FOCE_POSTDELETEITEM 

Definition at line 328 of file precomp.h.

328 {
enum _FILEOPCALLBACKEVENT FILEOPCALLBACKEVENT
@ FOCE_POSTDELETEITEM
Definition: precomp.h:334
@ FOCE_PREMOVEITEM
Definition: precomp.h:331
@ FOCE_STARTOPERATIONS
Definition: precomp.h:329
@ FOCE_FINISHOPERATIONS
Definition: precomp.h:330
@ FOCE_POSTMOVEITEM
Definition: precomp.h:332
@ FOCE_PREDELETEITEM
Definition: precomp.h:333

Function Documentation

◆ AddPropSheetPage()

static HRESULT AddPropSheetPage ( HPROPSHEETPAGE  hPage,
LPFNSVADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
inlinestatic

Definition at line 150 of file precomp.h.

151{
152 if (!hPage)
153 return E_FAIL;
154 if (pfnAddPage(hPage, lParam))
155 return S_OK;
157 return E_FAIL;
158}
LPARAM lParam
Definition: combotst.c:139
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define S_OK
Definition: intsafe.h:52

Referenced by CDrvDefExt::AddMainPage(), CShellLink::AddPages(), CFileDefExt::AddPages(), CFolderOptions::AddPages(), and RecycleBin_AddPropSheetPages().

◆ AddPropSheetPageCallback()

BOOL CALLBACK AddPropSheetPageCallback ( HPROPSHEETPAGE  hPage,
LPARAM  lParam 
)
inline

Definition at line 136 of file precomp.h.

137{
139
140 if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
141 {
142 pHeader->phpage[pHeader->nPages++] = hPage;
143 return TRUE;
144 }
145
146 return FALSE;
147}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PROPERTY_SHEET_PAGE
Definition: precomp.h:131
FxContextHeader * pHeader
Definition: handleapi.cpp:604

Referenced by AddPropSheetHandlerPages().

◆ BindCtx_ContainsObject()

BOOL BindCtx_ContainsObject ( _In_ IBindCtx pBindCtx,
_In_ LPCWSTR  pszName 
)

Definition at line 270 of file utils.cpp.

271{
273 if (!pBindCtx || FAILED(pBindCtx->GetObjectParam(const_cast<LPWSTR>(pszName), &punk)))
274 return FALSE;
275 return TRUE;
276}
#define FAILED(hr)
Definition: intsafe.h:51
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CDesktopFolder::_ParseDisplayNameByParent(), CDesktopFolder::ParseDisplayName(), and CDesktopFolder::ShellUrlParseDisplayName().

◆ BindCtx_GetMode()

DWORD BindCtx_GetMode ( _In_ IBindCtx pbc,
_In_ DWORD  dwDefault 
)

Definition at line 278 of file utils.cpp.

279{
280 if (!pbc)
281 return dwDefault;
282
283 BIND_OPTS BindOpts = { sizeof(BindOpts) };
284 HRESULT hr = pbc->GetBindOptions(&BindOpts);
285 if (FAILED(hr))
286 return dwDefault;
287
288 return BindOpts.grfMode;
289}
HRESULT hr
Definition: shlfolder.c:183

Referenced by CDrivesFolder::ParseDisplayName(), CFSFolder::ParseDisplayName(), and CRegFolder::ParseDisplayName().

◆ BindCtx_GetUIWindow()

EXTERN_C HWND BindCtx_GetUIWindow ( _In_ IBindCtx pBindCtx)

Definition at line 511 of file utils.cpp.

512{
513 HWND hWnd = NULL;
514
516 if (pBindCtx && SUCCEEDED(pBindCtx->GetObjectParam((LPWSTR)L"UI During Binding", &punk)))
517 IUnknown_GetWindow(punk, &hWnd);
518
519 return hWnd;
520}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1336
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define L(x)
Definition: ntvdm.h:50

◆ BindCtx_RegisterObjectParam()

EXTERN_C HRESULT BindCtx_RegisterObjectParam ( _In_ IBindCtx pBindCtx,
_In_ LPOLESTR  pszKey,
_In_opt_ IUnknown punk,
_Out_ LPBC ppbc 
)

Definition at line 571 of file utils.cpp.

576{
577 HRESULT hr = S_OK;
579
580 *ppbc = pBindCtx;
581
582 if (pBindCtx)
583 {
584 pBindCtx->AddRef();
585 }
586 else
587 {
588 hr = CreateBindCtx(0, ppbc);
589 if (FAILED(hr))
590 return hr;
591 }
592
593 if (!punk)
594 punk = pUnknown = new CDummyOleWindow();
595
596 hr = (*ppbc)->RegisterObjectParam(pszKey, punk);
597
598 if (pUnknown)
599 pUnknown->Release();
600
601 if (FAILED(hr))
602 {
603 (*ppbc)->Release();
604 *ppbc = NULL;
605 }
606
607 return hr;
608}
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
ULONG Release()
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556

◆ DataObject_GetHIDACount()

HRESULT DataObject_GetHIDACount ( IDataObject pdo)

Definition at line 101 of file shldataobject.cpp.

102{
103 if (!pdo)
104 return E_INVALIDARG;
105 CDataObjectHIDA cida(pdo);
106 HRESULT hr = cida.hr();
107 return SUCCEEDED(hr) ? cida->cidl : hr;
108}
#define E_INVALIDARG
Definition: ddrawi.h:101

Referenced by SHELL32_ShowFilesystemItemsPropertiesDialogAsync(), SHELL_GetCaptionFromDataObject(), and SHMultiFileProperties().

◆ GetDfmCmd()

UINT GetDfmCmd ( _In_ IContextMenu pCM,
_In_ LPCSTR  verba 
)

Definition at line 1733 of file utils.cpp.

1734{
1735 CHAR buf[MAX_PATH];
1736 if (IS_INTRESOURCE(verba))
1737 {
1738 if (FAILED(GetCommandStringA(pCM, LOWORD(verba), GCS_VERB, buf, _countof(buf))))
1739 return 0;
1740 verba = buf;
1741 }
1742 return MapVerbToDfmCmd(verba); // Returns DFM_CMD_* or 0
1743}
UINT MapVerbToDfmCmd(_In_ LPCSTR verba)
#define MAX_PATH
Definition: compat.h:34
static HRESULT GetCommandStringA(_In_ IContextMenu *pCM, _In_ UINT_PTR Id, _In_ UINT GCS, _Out_writes_(cchMax) LPSTR Buf, _In_ UINT cchMax)
Definition: utils.cpp:1719
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define LOWORD(l)
Definition: pedump.c:82
#define _countof(array)
Definition: sndvol32.h:70
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
char CHAR
Definition: xmlstorage.h:175

Referenced by BrFolder_OnContextMenu().

◆ InvokeIExecuteCommand()

EXTERN_C HRESULT InvokeIExecuteCommand ( _In_ IExecuteCommand *  pEC,
_In_ PCWSTR  pszCommandName,
_In_opt_ IPropertyBag pPB,
_In_opt_ IShellItemArray *  pSIA,
_In_opt_ LPCMINVOKECOMMANDINFOEX  pICI,
_In_opt_ IUnknown pSite 
)

Definition at line 1664 of file utils.cpp.

1671{
1672 if (!pEC)
1673 return E_INVALIDARG;
1674
1675 if (pSite)
1676 IUnknown_SetSite(pEC, pSite);
1677 IUnknown_InitializeCommand(pEC, pszCommandName, pPB);
1678
1680 if (pSIA && SUCCEEDED(pEC->QueryInterface(IID_PPV_ARG(IObjectWithSelection, &pOWS))))
1681 pOWS->SetSelection(pSIA);
1682
1683 DWORD dwKeyState = 0, fMask = pICI ? pICI->fMask : 0;
1684 pEC->SetNoShowUI((fMask & CMIC_MASK_FLAG_NO_UI) != 0);
1685 pEC->SetShowWindow(pICI ? pICI->nShow : SW_SHOW);
1686 if (fMask & CMIC_MASK_SHIFT_DOWN)
1687 dwKeyState |= MK_SHIFT;
1688 if (fMask & CMIC_MASK_CONTROL_DOWN)
1689 dwKeyState |= MK_CONTROL;
1690 pEC->SetKeyState(dwKeyState);
1691 if ((fMask & CMIC_MASK_UNICODE) && pICI->lpDirectoryW)
1692 pEC->SetDirectory(pICI->lpDirectoryW);
1693 if ((fMask & CMIC_MASK_UNICODE) && pICI->lpParametersW)
1694 pEC->SetParameters(pICI->lpParametersW);
1695 if (fMask & CMIC_MASK_PTINVOKE)
1696 pEC->SetPosition(pICI->ptInvoke);
1697
1698 HRESULT hr = pEC->Execute();
1699 if (pSite)
1700 IUnknown_SetSite(pEC, NULL);
1701 return hr;
1702}
EXTERN_C HRESULT IUnknown_InitializeCommand(_In_ IUnknown *pUnk, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB)
Definition: utils.cpp:1651
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1411
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MK_SHIFT
Definition: winuser.h:2372
#define MK_CONTROL
Definition: winuser.h:2373
#define SW_SHOW
Definition: winuser.h:778
#define IID_PPV_ARG(Itype, ppType)

Referenced by InvokeIExecuteCommandWithDataObject().

◆ InvokeIExecuteCommandWithDataObject()

EXTERN_C HRESULT InvokeIExecuteCommandWithDataObject ( _In_ IExecuteCommand *  pEC,
_In_ PCWSTR  pszCommandName,
_In_opt_ IPropertyBag pPB,
_In_ IDataObject pDO,
_In_opt_ LPCMINVOKECOMMANDINFOEX  pICI,
_In_opt_ IUnknown pSite 
)

Definition at line 1705 of file utils.cpp.

1712{
1714 HRESULT hr = SHCreateShellItemArrayFromDataObject(pDO, IID_PPV_ARG(IShellItemArray, &pSIA));
1715 return SUCCEEDED(hr) ? InvokeIExecuteCommand(pEC, pszCommandName, pPB, pSIA, pICI, pSite) : hr;
1716}
EXTERN_C HRESULT WINAPI SHCreateShellItemArrayFromDataObject(_In_ IDataObject *pdo, _In_ REFIID riid, _Out_ void **ppv)
Definition: CShellItem.cpp:429
EXTERN_C HRESULT InvokeIExecuteCommand(_In_ IExecuteCommand *pEC, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB, _In_opt_ IShellItemArray *pSIA, _In_opt_ LPCMINVOKECOMMANDINFOEX pICI, _In_opt_ IUnknown *pSite)
Definition: utils.cpp:1664

Referenced by CDefaultContextMenu::InvokeRegVerb().

◆ IUnknown_InitializeCommand()

EXTERN_C HRESULT IUnknown_InitializeCommand ( _In_ IUnknown pUnk,
_In_ PCWSTR  pszCommandName,
_In_opt_ IPropertyBag pPB 
)

Definition at line 1651 of file utils.cpp.

1655{
1656 HRESULT hr;
1658 if (SUCCEEDED(hr = pUnk->QueryInterface(IID_PPV_ARG(IInitializeCommand, &pIC))))
1659 hr = pIC->Initialize(pszCommandName, pPB);
1660 return hr;
1661}
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
nsresult QueryInterface(nsIIDRef riid, void **result)

Referenced by InvokeIExecuteCommand(), and CDefaultContextMenu::InvokeRegVerb().

◆ MapVerbToDfmCmd()

UINT MapVerbToDfmCmd ( _In_ LPCSTR  verba)

Definition at line 77 of file CDefaultContextMenu.cpp.

78{
79 for (UINT i = 0; i < _countof(g_StaticInvokeCmdMap); ++i)
80 {
81 if (!lstrcmpiA(g_StaticInvokeCmdMap[i].szStringVerb, verba))
82 return (int)g_StaticInvokeCmdMap[i].DfmCmd;
83 }
84 return 0;
85}
static const struct _StaticInvokeCommandMap_ g_StaticInvokeCmdMap[]
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

Referenced by GetDfmCmd().

◆ PathIsDosDevice()

BOOL PathIsDosDevice ( _In_ LPCWSTR  pszName)

Definition at line 172 of file utils.cpp.

173{
177
178 if (lstrcmpiW(szPath, L"NUL") == 0 || lstrcmpiW(szPath, L"PRN") == 0 ||
179 lstrcmpiW(szPath, L"CON") == 0 || lstrcmpiW(szPath, L"AUX") == 0)
180 {
181 return TRUE;
182 }
183
184 if (_wcsnicmp(szPath, L"LPT", 3) == 0 || _wcsnicmp(szPath, L"COM", 3) == 0)
185 {
186 if ((L'0' <= szPath[3] && szPath[3] <= L'9') && szPath[4] == UNICODE_NULL)
187 return TRUE;
188 }
189
190 return FALSE;
191}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
Definition: path.c:823
LPCWSTR szPath
Definition: env.c:37
#define UNICODE_NULL
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CFSFolder::_CreateIDListFromName().

◆ PathIsDotOrDotDotW()

BOOL PathIsDotOrDotDotW ( _In_ LPCWSTR  pszPath)

Definition at line 146 of file utils.cpp.

147{
148 if (pszPath[0] != L'.')
149 return FALSE;
150 return !pszPath[1] || (pszPath[1] == L'.' && !pszPath[2]);
151}

Referenced by PathIsValidElement().

◆ PathIsValidElement()

BOOL PathIsValidElement ( _In_ LPCWSTR  pszPath)

Definition at line 158 of file utils.cpp.

159{
160 if (!*pszPath || PathIsDotOrDotDotW(pszPath))
161 return FALSE;
162
163 for (LPCWSTR pch = pszPath; *pch; ++pch)
164 {
166 return FALSE;
167 }
168
169 return TRUE;
170}
#define PATH_VALID_ELEMENT
Definition: utils.cpp:153
BOOL PathIsDotOrDotDotW(_In_ LPCWSTR pszPath)
Definition: utils.cpp:146
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:4409
#define pch(ap)
Definition: match.c:418
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by Shell_NextElement().

◆ PostCabinetMessage()

void PostCabinetMessage ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 880 of file view.cpp.

881{
882 MSG data;
883 data.message = Msg;
884 data.wParam = wParam;
885 data.lParam = lParam;
887}
WPARAM wParam
Definition: combotst.c:138
struct @1666 Msg[]
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
static BOOL CALLBACK PostCabinetMessageCallback(HWND hWnd, LPARAM param)
Definition: view.cpp:863
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by GeneralDlg_OnApply(), and ViewDlg_Apply().

◆ PropSheetPageLifetimeCallback()

template<class T >
static UINT CALLBACK PropSheetPageLifetimeCallback ( HWND  hWnd,
UINT  uMsg,
PROPSHEETPAGEW pPSP 
)
static

Definition at line 161 of file precomp.h.

162{
163 if (uMsg == PSPCB_RELEASE)
164 ((T*)(pPSP->lParam))->Release();
165 return TRUE;
166}
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define T
Definition: mbstring.h:31
#define PSPCB_RELEASE
Definition: prsht.h:37
LPARAM lParam
Definition: prsht.h:227

◆ SeeFlagsToCmicFlags()

static UINT SeeFlagsToCmicFlags ( UINT  flags)
inlinestatic

Definition at line 190 of file precomp.h.

191{
195}
GLbitfield flags
Definition: glext.h:7161
#define SEE_MASK_CLASSNAME
Definition: shellapi.h:25
#define SEE_MASK_HASTITLE
Definition: shellapi.h:52
#define SEE_MASK_HASLINKNAME
Definition: shellapi.h:49
#define SEE_CMIC_COMMON_FLAGS
Definition: shellutils.h:628

Referenced by ShellExecute_ContextMenuVerb().

◆ SHBindToObject()

EXTERN_C HRESULT SHBindToObject ( _In_opt_ IShellFolder psf,
_In_ LPCITEMIDLIST  pidl,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 370 of file utils.cpp.

375{
376 return SHBindToObjectEx(psf, pidl, NULL, riid, ppvObj);
377}
HRESULT SHBindToObjectEx(_In_opt_ IShellFolder *pShellFolder, _In_ LPCITEMIDLIST pidl, _In_opt_ IBindCtx *pBindCtx, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:337
REFIID riid
Definition: atlbase.h:39

Referenced by _BindToObject(), CDesktopFolder::_ParseDisplayNameByParent(), BrFolder_InitTreeView(), CRegItemContextMenu_CreateInstance(), FileOpCallback(), SHELL_GetIDListTarget(), Shell_ParsePrinterName(), and CDesktopFolder::ShellUrlParseDisplayName().

◆ SHBindToObjectEx()

HRESULT SHBindToObjectEx ( _In_opt_ IShellFolder pShellFolder,
_In_ LPCITEMIDLIST  pidl,
_In_opt_ IBindCtx pBindCtx,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 337 of file utils.cpp.

343{
344 CComPtr<IShellFolder> psfDesktop;
345
346 *ppvObj = NULL;
347
348 if (!pShellFolder)
349 {
350 SHGetDesktopFolder(&psfDesktop);
351 if (!psfDesktop)
352 return E_FAIL;
353
354 pShellFolder = psfDesktop;
355 }
356
357 HRESULT hr;
358 if (_ILIsDesktop(pidl))
359 hr = pShellFolder->QueryInterface(riid, ppvObj);
360 else
361 hr = pShellFolder->BindToObject(pidl, pBindCtx, riid, ppvObj);
362
363 if (SUCCEEDED(hr) && !*ppvObj)
364 hr = E_FAIL;
365
366 return hr;
367}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by SHBindToObject().

◆ SHCoInitializeAnyApartment()

HRESULT SHCoInitializeAnyApartment ( VOID  )

Definition at line 468 of file utils.cpp.

469{
471 if (FAILED(hr))
473 return hr;
474}
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:280

Referenced by ShellExecuteExW(), and SHGetNameAndFlagsW().

◆ SHELL32_DefaultContextMenuCallBack()

HRESULT SHELL32_DefaultContextMenuCallBack ( IShellFolder psf,
IDataObject pdo,
UINT  msg 
)

Definition at line 528 of file shlfolder.cpp.

529{
530 switch (msg)
531 {
533 return S_OK; // Yes, I want verbs
535 return S_FALSE; // Do it for me please
537 return S_FALSE; // Supposedly "required for Windows 7 to pick a default"
538 }
539 return E_NOTIMPL;
540}
#define msg(x)
Definition: auth_time.c:54
#define E_NOTIMPL
Definition: ddrawi.h:99
#define DFM_GETDEFSTATICID
Definition: precomp.h:47
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
#define S_FALSE
Definition: winerror.h:2357

Referenced by CDesktopFolder::CallBack(), CDrivesFolder::CallBack(), CFSFolder::CallBack(), CNetFolderBackgroundMenuCB(), DrivesContextMenuCallback(), NetFolderMenuCallback(), and RegFolderContextMenuCallback().

◆ SHELL32_FileOperation()

int SHELL32_FileOperation ( LPSHFILEOPSTRUCTW  lpFileOp,
FILEOPCALLBACK  Callback,
void CallerData 
)

Definition at line 2020 of file shlfileop.cpp.

2021{
2023 FILE_LIST flFrom, flTo;
2024 int ret = 0;
2025
2026 if (!lpFileOp)
2028
2030 if (FAILED(ret))
2031 return ret;
2032
2033 lpFileOp->fAnyOperationsAborted = FALSE;
2034 check_flags(lpFileOp->fFlags);
2035
2036 ZeroMemory(&flFrom, sizeof(FILE_LIST));
2037 ZeroMemory(&flTo, sizeof(FILE_LIST));
2038
2039 if ((ret = parse_file_list(&flFrom, lpFileOp->pFrom)))
2040 return ret;
2041
2042 if (lpFileOp->wFunc != FO_DELETE)
2043 parse_file_list(&flTo, lpFileOp->pTo);
2044
2045 ZeroMemory(&op, sizeof(op));
2046 op.req = lpFileOp;
2047 op.totalSize.QuadPart = 0ull;
2048 op.completedSize.QuadPart = 0ull;
2049 op.bManyItems = (flFrom.dwNumFiles > 1);
2050 op.Callback = Callback;
2051 op.CallerCallbackData = CallerData;
2052
2053 ret = validate_operation(lpFileOp, &flFrom, &flTo);
2054 if (ret)
2055 goto cleanup;
2056
2057 if (lpFileOp->wFunc != FO_RENAME && !(lpFileOp->fFlags & FOF_SILENT)) {
2058 ret = CoCreateInstance(CLSID_ProgressDialog,
2059 NULL,
2060 CLSCTX_INPROC_SERVER,
2061 IID_PPV_ARG(IProgressDialog, &op.progress));
2062 if (FAILED(ret))
2063 goto cleanup;
2064
2065 op.progress->StartProgressDialog(op.req->hwnd, NULL, PROGDLG_NORMAL & PROGDLG_AUTOTIME, NULL);
2067 _FileOpCountManager(&op, &flFrom);
2068 }
2069
2071
2072 switch (lpFileOp->wFunc)
2073 {
2074 case FO_COPY:
2075 ret = copy_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
2076 break;
2077 case FO_DELETE:
2078 ret = delete_files(&op, &flFrom);
2079 break;
2080 case FO_MOVE:
2081 ret = move_files(&op, op.req->fFlags & FOF_MULTIDESTFILES, &flFrom, &flTo);
2082 break;
2083 case FO_RENAME:
2084 ret = rename_files(&op, &flFrom, &flTo);
2085 break;
2086 default:
2088 break;
2089 }
2090
2091 if (op.progress) {
2092 op.progress->StopProgressDialog();
2093 op.progress->Release();
2094 }
2095
2096cleanup:
2097 destroy_file_list(&flFrom);
2098
2099 if (lpFileOp->wFunc != FO_DELETE)
2100 destroy_file_list(&flTo);
2101 else if (lpFileOp->fFlags & FOF_ALLOWUNDO)
2103
2104 if (ret == ERROR_CANCELLED)
2105 lpFileOp->fAnyOperationsAborted = TRUE;
2106
2108
2110
2111 return ret;
2112}
EXTERN_C HRESULT WINAPI SHUpdateRecycleBinIcon(void)
UINT op
Definition: effect.c:236
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static void cleanup(void)
Definition: main.c:1335
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define FO_RENAME
Definition: shellapi.h:140
#define FOF_MULTIDESTFILES
Definition: shellapi.h:142
#define FOF_ALLOWUNDO
Definition: shellapi.h:148
#define FO_DELETE
Definition: shellapi.h:139
#define FO_COPY
Definition: shellapi.h:138
#define FO_MOVE
Definition: shellapi.h:137
#define FOF_SILENT
Definition: shellapi.h:144
static HRESULT rename_files(FILE_OPERATION *op, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1888
static HRESULT copy_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1465
static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
Definition: shlfileop.cpp:1239
static void destroy_file_list(FILE_LIST *flList)
Definition: shlfileop.cpp:1309
static DWORD validate_operation(LPSHFILEOPSTRUCTW lpFileOp, FILE_LIST *flFrom, FILE_LIST *flTo)
Definition: shlfileop.cpp:1927
static HRESULT FileOpCallback(FILE_OPERATION *op, FILEOPCALLBACKEVENT Event, LPCWSTR Source, LPCWSTR Destination, UINT Attributes, HRESULT hrOp=S_OK)
Definition: shlfileop.cpp:366
static void _SetOperationTitle(FILE_OPERATION *op)
Definition: shlfileop.cpp:495
static HRESULT delete_files(FILE_OPERATION *op, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:1614
DWORD WINAPI _FileOpCountManager(FILE_OPERATION *op, const FILE_LIST *flFrom)
Definition: shlfileop.cpp:2361
static DWORD move_files(FILE_OPERATION *op, BOOL multiDest, const FILE_LIST *flFrom, const FILE_LIST *flTo)
Definition: shlfileop.cpp:1792
static void check_flags(FILEOP_FLAGS fFlags)
Definition: shlfileop.cpp:1914
#define PROGDLG_AUTOTIME
Definition: shlobj.h:974
#define PROGDLG_NORMAL
Definition: shlobj.h:972
DWORD dwNumFiles
Definition: shlfileop.cpp:69
LPCWSTR pFrom
Definition: shellapi.h:358
BOOL fAnyOperationsAborted
Definition: shellapi.h:361
FILEOP_FLAGS fFlags
Definition: shellapi.h:360
int ret
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
#define ZeroMemory
Definition: winbase.h:1737
#define ERROR_CANCELLED
Definition: winerror.h:726
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by CRecycleBinItemContextMenu::InvokeCommand(), and SHFileOperationW().

◆ SHELL32_GetDllFromRundll32CommandLine()

HRESULT SHELL32_GetDllFromRundll32CommandLine ( LPCWSTR  pszCmd,
LPWSTR  pszOut,
SIZE_T  cchMax 
)

Definition at line 51 of file COpenWithMenu.cpp.

52{
53 WCHAR szDll[MAX_PATH + 100];
54 if (!PathGetAppFromCommandLine(pszCmd, szDll, _countof(szDll)))
56
57 PWSTR pszName = PathFindFileNameW(szDll);
58 if (_wcsicmp(pszName, L"rundll32") && _wcsicmp(pszName, L"rundll32.exe"))
59 return E_UNEXPECTED;
60
61 PCWSTR pszDllStart = pszCmd + (pszName - szDll) + lstrlenW(pszName);
62
63 if (*pszDllStart == '\"')
64 ++pszDllStart; // Skip possible end quote of ..\rundll32.exe" foo.dll,func
65 while (*pszDllStart <= ' ' && *pszDllStart)
66 ++pszDllStart;
67 if (PathGetAppFromCommandLine(pszDllStart, szDll, _countof(szDll)))
68 {
69 BOOL quoted = *pszDllStart == '\"';
70 PWSTR pszComma = szDll + lstrlenW(szDll);
71 while (!quoted && pszComma > szDll && *pszComma != ',' && *pszComma != '\\' && *pszComma != '/')
72 --pszComma;
73 SIZE_T cch = pszComma - szDll;
74 if (cch <= cchMax && (quoted || *pszComma == ','))
75 {
76 *pszComma = UNICODE_NULL;
77 lstrcpynW(pszOut, szDll, cchMax);
78 return S_OK;
79 }
80 }
82}
static SIZE_T PathGetAppFromCommandLine(LPCWSTR pszIn, LPWSTR pszOut, SIZE_T cchMax)
UINT cchMax
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by COpenWithList::GetPathFromCmd(), and CFileDefExt::InitOpensWithField().

◆ SHELL32_ShowFilesystemItemPropertiesDialogAsync()

HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync ( IDataObject pDO)

Definition at line 157 of file item_prop.cpp.

158{
159 CDataObjectHIDA cida(pDO);
160 HRESULT hr = cida.hr();
162 return hr;
163
164 const CLSID *pClsid = NULL;
166 LPCWSTR InitString = NULL;
167
168 if (cida->cidl && _ILIsDrive(HIDA_GetPIDLItem(cida, 0)))
169 {
170 pClsid = &CLSID_ShellDrvDefExt;
172 InitString = L"Drive";
173 }
174 else
175 {
176 pClsid = &CLSID_ShellFileDefExt;
178 }
180 return Dialog.ShowAsync(pClsid, pDO, InitFunc, InitString);
181}
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
static void CALLBACK FSFolderItemPropDialogInitCallback(LPCWSTR InitString, IDataObject *pDO, HKEY *hKeys, UINT *cKeys)
Definition: item_prop.cpp:130
static void CALLBACK ClassPropDialogInitCallback(LPCWSTR InitString, IDataObject *pDO, HKEY *hKeys, UINT *cKeys)
Definition: item_prop.cpp:150
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2118
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:641
Definition: window.h:372
void(CALLBACK * PFNINITIALIZE)(LPCWSTR InitString, IDataObject *pDO, HKEY *hKeys, UINT *cKeys)
Definition: item_prop.cpp:29

Referenced by DrivesContextMenuCallback(), and SHELL32_ShowFilesystemItemsPropertiesDialogAsync().

◆ SHELL32_ShowFilesystemItemsPropertiesDialogAsync()

HRESULT SHELL32_ShowFilesystemItemsPropertiesDialogAsync ( HWND  hOwner,
IDataObject pDO 
)

Definition at line 184 of file item_prop.cpp.

185{
186 if (DataObject_GetHIDACount(pDO) == 1)
188
189 ERR("SHMultiFileProperties is not implemented yet\n");
191 SHELL_ErrorBox(hOwner, hr);
192 return hr; // TODO: return SHMultiFileProperties(pDO, 0);
193}
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
HRESULT DataObject_GetHIDACount(IDataObject *pdo)
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync(IDataObject *pDO)
Definition: item_prop.cpp:157
#define SHELL_ErrorBox
Definition: shellutils.h:126

Referenced by SHELL32_ShowPropertiesDialog().

◆ SHELL32_ShowPropertiesDialog()

HRESULT SHELL32_ShowPropertiesDialog ( IDataObject pdtobj)

Definition at line 520 of file shlfolder.cpp.

521{
522 if (!pdtobj)
523 return E_INVALIDARG;
525}
HRESULT SHELL32_ShowFilesystemItemsPropertiesDialogAsync(HWND hOwner, IDataObject *pDO)
Definition: item_prop.cpp:184

Referenced by CDefaultContextMenu::DoProperties(), and SHMultiFileProperties().

◆ SHELL32_ShowShellExtensionProperties()

HRESULT SHELL32_ShowShellExtensionProperties ( const CLSID pClsid,
IDataObject pDO 
)

Definition at line 196 of file item_prop.cpp.

197{
198 WCHAR ClassBuf[6 + 38 + 1] = L"CLSID\\";
199 StringFromGUID2(*pClsid, ClassBuf + 6, 38 + 1);
201 return Dialog.ShowAsync(NULL, pDO, ClassPropDialogInitCallback, ClassBuf);
202}
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434

Referenced by RegFolderContextMenuCallback().

◆ SHELL_CIDA_ILCloneFull()

PIDLIST_ABSOLUTE SHELL_CIDA_ILCloneFull ( _In_ const CIDA pCIDA,
_In_ UINT  Index 
)

Definition at line 110 of file shldataobject.cpp.

111{
112 if (Index < pCIDA->cidl)
113 return ILCombine(HIDA_GetPIDLFolder(pCIDA), HIDA_GetPIDLItem(pCIDA, Index));
114 return NULL;
115}
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:816
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:636
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by DoGetFileTitle(), CCopyMoveToMenu::DoRealFileOp(), and SHELL_DataObject_ILCloneFullItem().

◆ SHELL_CloneDataObject()

HRESULT SHELL_CloneDataObject ( _In_ IDataObject pDO,
_Out_ IDataObject **  ppDO 
)

Definition at line 125 of file shldataobject.cpp.

126{
127 *ppDO = NULL;
128 CDataObjectHIDA cida(pDO);
129 HRESULT hr = cida.hr();
130 if (SUCCEEDED(hr))
131 {
132 CCidaChildArrayHelper items(cida);
133 if (FAILED(hr = items.hr()))
134 return hr;
135 hr = SHCreateFileDataObject(HIDA_GetPIDLFolder(cida), cida->cidl, items.GetItems(), NULL, ppDO);
136 if (SUCCEEDED(hr))
137 {
138 POINT pt;
139 if (SUCCEEDED(DataObject_GetOffset(pDO, &pt)))
140 DataObject_SetOffset(*ppDO, &pt);
141 }
142 }
143 return hr;
144}
HRESULT WINAPI SHCreateFileDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IDataObject *pDataInner, IDataObject **ppDataObj)
#define pt(x, y)
Definition: drawing.c:79
static TCHAR * items[]
Definition: page1.c:45

Referenced by ShellPropSheetDialog::ShowPropertiesThread().

◆ SHELL_DataObject_ILCloneFullItem()

PIDLIST_ABSOLUTE SHELL_DataObject_ILCloneFullItem ( _In_ IDataObject pDO,
_In_ UINT  Index 
)

Definition at line 117 of file shldataobject.cpp.

118{
119 if (!pDO)
120 return NULL;
121 CDataObjectHIDA cida(pDO);
122 return SUCCEEDED(cida.hr()) ? SHELL_CIDA_ILCloneFull(cida, Index) : NULL;
123}
PIDLIST_ABSOLUTE SHELL_CIDA_ILCloneFull(_In_ const CIDA *pCIDA, _In_ UINT Index)

Referenced by CCopyMoveToMenu::Initialize(), SHELL32_PropertySheet(), and SHELL_GetCaptionFromDataObject().

◆ Shell_DisplayNameOf()

HRESULT Shell_DisplayNameOf ( _In_ IShellFolder psf,
_In_ LPCITEMIDLIST  pidl,
_In_ DWORD  dwFlags,
_Out_ LPWSTR  pszBuf,
_In_ UINT  cchBuf 
)

Definition at line 406 of file utils.cpp.

412{
413 *pszBuf = UNICODE_NULL;
414 STRRET sr;
415 HRESULT hr = psf->GetDisplayNameOf(pidl, dwFlags, &sr);
416 if (FAILED(hr))
417 return hr;
418 return StrRetToBufW(&sr, pidl, pszBuf, cchBuf);
419}
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by CFSDropTarget::_DoDrop(), and SHGetNameAndFlagsW().

◆ Shell_FailForceReturn()

BOOL Shell_FailForceReturn ( _In_ HRESULT  hr)

Definition at line 320 of file utils.cpp.

321{
323
324 switch (code)
325 {
328 case ERROR_CANCELLED:
329 return TRUE;
330
331 default:
333 }
334}
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
Definition: inflate.c:139
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define ERROR_BAD_NET_NAME
Definition: winerror.h:159

Referenced by CDesktopFolder::ParseDisplayName(), and CDesktopFolder::ShellUrlParseDisplayName().

◆ SHELL_GetIDListTarget()

HRESULT SHELL_GetIDListTarget ( _In_ LPCITEMIDLIST  pidl,
_Out_ PIDLIST_ABSOLUTE ppidl 
)

Definition at line 456 of file utils.cpp.

457{
458 IShellLink *pSL;
459 HRESULT hr = SHBindToObject(NULL, pidl, IID_PPV_ARG(IShellLink, &pSL));
460 if (SUCCEEDED(hr))
461 {
462 hr = pSL->GetIDList(ppidl); // Note: Returns S_FALSE if no target pidl
463 pSL->Release();
464 }
465 return hr;
466}
EXTERN_C HRESULT SHBindToObject(_In_opt_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:370

Referenced by SHBrowseForFolderW().

◆ SHELL_GetUIObjectOfAbsoluteItem()

EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem ( _In_opt_ HWND  hWnd,
_In_ PCIDLIST_ABSOLUTE  pidl,
_In_ REFIID  riid,
_Out_ void **  ppvObj 
)

Definition at line 380 of file utils.cpp.

384{
385 if (!ppvObj)
386 return E_INVALIDARG;
387 *ppvObj = NULL;
388 IShellFolder *psf;
389 PCUITEMID_CHILD pidlChild;
390 HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlChild);
391 if (SUCCEEDED(hr))
392 {
393 hr = psf->GetUIObjectOf(hWnd, 1, &pidlChild, riid, NULL, ppvObj);
394 psf->Release();
395 if (SUCCEEDED(hr))
396 {
397 if (*ppvObj)
398 return hr;
399 hr = E_FAIL;
400 }
401 }
402 return hr;
403}
HRESULT GetUIObjectOf([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1462
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70

Referenced by CShellLink::DragEnter(), CSendToMenu::GetUIObjectFromPidl(), CFolderItemVerbs::Init(), SHELL_PidlGetIconLocationW(), and shellex_get_dataobj().

◆ Shell_ParseSpecialFolder()

EXTERN_C INT Shell_ParseSpecialFolder ( _In_ LPCWSTR  pszStart,
_Out_ LPWSTR ppch,
_Out_ INT pcch 
)

Definition at line 2038 of file shellpath.c.

2039{
2040 LPCWSTR pszPath, pchBackslash;
2042
2043 pchBackslash = StrChrW(pszStart, L'\\');
2044 if (pchBackslash)
2045 {
2046 *ppch = (LPWSTR)(pchBackslash + 1);
2047 *pcch = (pchBackslash - pszStart) + 1;
2048 StrCpyNW(szPath, pszStart, min(*pcch, _countof(szPath)));
2049 pszPath = szPath;
2050 }
2051 else
2052 {
2053 *ppch = NULL;
2054 *pcch = lstrlenW(pszStart);
2055 pszPath = pszStart;
2056 }
2057
2058 return SHGetSpecialFolderID(pszPath);
2059}
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:464
INT SHGetSpecialFolderID(_In_ LPCWSTR pszName)
Definition: shellpath.c:2024
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
#define min(a, b)
Definition: monoChain.cc:55

Referenced by CDesktopFolder::ShellUrlParseDisplayName().

◆ SHELL_ShowItemIDListProperties()

HRESULT SHELL_ShowItemIDListProperties ( LPCITEMIDLIST  pidl)

Definition at line 205 of file item_prop.cpp.

206{
207 assert(pidl);
208
209 CComHeapPtr<ITEMIDLIST> alloc;
210 if (IS_INTRESOURCE(pidl))
211 {
212 HRESULT hr = SHGetSpecialFolderLocation(NULL, LOWORD(pidl), const_cast<LPITEMIDLIST*>(&pidl));
213 if (FAILED(hr))
214 return hr;
215 alloc.Attach(const_cast<LPITEMIDLIST>(pidl));
216 }
217 SHELLEXECUTEINFOA sei = {
218 sizeof(sei), SEE_MASK_INVOKEIDLIST | SEE_MASK_ASYNCOK, NULL, "properties",
219 NULL, NULL, NULL, SW_SHOWNORMAL, NULL, const_cast<LPITEMIDLIST>(pidl)
220 };
222}
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3436
#define assert(x)
Definition: debug.h:53
#define HResultFromWin32
Definition: loader.cpp:14
#define alloc
Definition: rosglue.h:13
#define SEE_MASK_ASYNCOK
Definition: shellapi.h:54
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExA(LPSHELLEXECUTEINFOA sei)
Definition: shlexec.cpp:2394
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SW_SHOWNORMAL
Definition: winuser.h:773

Referenced by CFSFolder::CallBack(), and CRecycleBin::InvokeCommand().

◆ Shell_TranslateIDListAlias()

HRESULT Shell_TranslateIDListAlias ( _In_ LPCITEMIDLIST  pidl,
_In_ HANDLE  hToken,
_Out_ LPITEMIDLIST ppidlAlias,
_In_ DWORD  dwFlags 
)

Definition at line 261 of file utils.cpp.

266{
267 return E_FAIL; //FIXME
268}

Referenced by CDesktopFolder::ParseDisplayName().

◆ SHGetAttributes()

DWORD SHGetAttributes ( _In_ IShellFolder psf,
_In_ LPCITEMIDLIST  pidl,
_In_ DWORD  dwAttributes 
)

Definition at line 422 of file utils.cpp.

423{
424 LPCITEMIDLIST pidlLast = pidl;
425 IShellFolder *release = NULL;
426
427 if (!psf)
428 {
429 SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
430 if (!psf)
431 return 0;
432 release = psf;
433 }
434
435 DWORD oldAttrs = dwAttributes;
436 if (FAILED(psf->GetAttributesOf(1, &pidlLast, &dwAttributes)))
437 dwAttributes = 0;
438 else
439 dwAttributes &= oldAttrs;
440
441 if ((dwAttributes & SFGAO_FOLDER) &&
442 (dwAttributes & SFGAO_STREAM) &&
443 !(dwAttributes & SFGAO_STORAGEANCESTOR) &&
444 (oldAttrs & SFGAO_STORAGEANCESTOR) &&
445 (SHGetObjectCompatFlags(psf, NULL) & 0x200))
446 {
447 dwAttributes &= ~(SFGAO_STREAM | SFGAO_STORAGEANCESTOR);
448 dwAttributes |= SFGAO_STORAGEANCESTOR;
449 }
450
451 if (release)
452 release->Release();
453 return dwAttributes;
454}
DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
Definition: ordinal.c:6315
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD dwAttributes
Definition: vdmdbg.h:34

Referenced by CFSDropTarget::_DoDrop(), BrFolder_InsertItem(), CRegItemContextMenu_CreateInstance(), and SHGetNameAndFlagsW().

◆ SHGetNameAndFlagsW()

HRESULT SHGetNameAndFlagsW ( _In_ LPCITEMIDLIST  pidl,
_In_ DWORD  dwFlags,
_Out_opt_ LPWSTR  pszText,
_In_ UINT  cchBuf,
_Inout_opt_ DWORD pdwAttributes 
)

Definition at line 477 of file utils.cpp.

483{
484 if (pszText)
485 *pszText = UNICODE_NULL;
486
488
489 CComPtr<IShellFolder> psfFolder;
490 LPCITEMIDLIST ppidlLast;
491 HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfFolder), &ppidlLast);
492 if (SUCCEEDED(hr))
493 {
494 if (pszText)
495 hr = Shell_DisplayNameOf(psfFolder, ppidlLast, dwFlags, pszText, cchBuf);
496
497 if (SUCCEEDED(hr))
498 {
499 if (pdwAttributes)
500 *pdwAttributes = SHGetAttributes(psfFolder, ppidlLast, *pdwAttributes);
501 }
502 }
503
504 if (SUCCEEDED(hrCoInit))
506
507 return hr;
508}
HRESULT Shell_DisplayNameOf(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_ LPWSTR pszBuf, _In_ UINT cchBuf)
Definition: utils.cpp:406
DWORD SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
Definition: utils.cpp:422
HRESULT SHCoInitializeAnyApartment(VOID)
Definition: utils.cpp:468

Referenced by CDrvDefExt::AddMainPage(), DoGetFileTitle(), CShellLink::OnInitDialog(), SHELL_execute(), SHELL_GetCaptionFromDataObject(), and CDesktopFolder::ShellUrlParseDisplayName().

◆ SHILAppend()

HRESULT SHILAppend ( _Inout_ LPITEMIDLIST  pidl,
_Inout_ LPITEMIDLIST ppidl 
)

Definition at line 193 of file utils.cpp.

194{
195 LPITEMIDLIST pidlOld = *ppidl;
196 if (!pidlOld)
197 {
198 *ppidl = pidl;
199 return S_OK;
200 }
201
202 HRESULT hr = SHILCombine(*ppidl, pidl, ppidl);
203 ILFree(pidlOld);
204 ILFree(pidl);
205 return hr;
206}
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1044

Referenced by CFSFolder::_ParseSimple(), BrFolder_Treeview_Rename(), and CFSFolder::ParseDisplayName().

◆ SHIsFileSysBindCtx()

HRESULT SHIsFileSysBindCtx ( _In_ IBindCtx pBindCtx,
_Out_opt_ WIN32_FIND_DATAW pFindData 
)

Definition at line 303 of file utils.cpp.

304{
307
308 if (!pBindCtx || FAILED(pBindCtx->GetObjectParam((LPWSTR)STR_FILE_SYS_BIND_DATA, &punk)))
309 return S_FALSE;
310
311 if (FAILED(punk->QueryInterface(IID_PPV_ARG(IFileSystemBindData, &pBindData))))
312 return S_FALSE;
313
314 if (pFindData)
315 pBindData->GetFindData(pFindData);
316
317 return S_OK;
318}

Referenced by CDesktopFolder::ParseDisplayName(), CDrivesFolder::ParseDisplayName(), and CFSFolder::ParseDisplayName().

◆ SHMultiFileProperties()

EXTERN_C HRESULT WINAPI SHMultiFileProperties ( IDataObject pDataObject,
DWORD  dwFlags 
)

Definition at line 92 of file stubs.cpp.

93{
94 FIXME("SHMultiFileProperties() stub\n");
95
96 // Temporary workaround to display a property sheet if possible
97 if (DataObject_GetHIDACount(pDataObject) == 1)
98 return SHELL32_ShowPropertiesDialog(pDataObject);
99
100 if (pDataObject)
101 {
102 HWND hWnd;
103 if (FAILED(IUnknown_GetWindow(pDataObject, &hWnd))) // Will probably not work but we have no other option
104 hWnd = NULL;
106 }
107
108 return E_FAIL;
109}
#define FIXME(fmt,...)
Definition: precomp.h:53
HRESULT SHELL32_ShowPropertiesDialog(IDataObject *pdtobj)
Definition: shlfolder.cpp:520

◆ SHSkipJunctionBinding()

BOOL SHSkipJunctionBinding ( _In_ IBindCtx pbc,
_In_ CLSID pclsid 
)

Definition at line 291 of file utils.cpp.

292{
293 if (!pbc)
294 return FALSE;
295
296 BIND_OPTS BindOps = { sizeof(BindOps) };
297 if (SUCCEEDED(pbc->GetBindOptions(&BindOps)) && BindOps.grfFlags == OLECONTF_LINKS)
298 return TRUE;
299
300 return pclsid && SHSkipJunction(pbc, pclsid);
301}
BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
Definition: ordinal.c:4595

Referenced by CDesktopFolder::_ParseDisplayNameByParent().

Variable Documentation

◆ CLSID_AdminFolderShortcut

◆ CLSID_FontsFolderShortcut

const GUID CLSID_FontsFolderShortcut
extern

◆ CLSID_MenuBandSite

◆ CLSID_OpenWith

const GUID CLSID_OpenWith
extern

◆ CLSID_StartMenu

◆ CLSID_UnixDosFolder

const GUID CLSID_UnixDosFolder
extern

Referenced by test_FolderShortcut().

◆ CLSID_UnixFolder

const GUID CLSID_UnixFolder
extern

◆ SHELL32_AdvtShortcutComponent

const GUID SHELL32_AdvtShortcutComponent
extern

◆ SHELL32_AdvtShortcutProduct

const GUID SHELL32_AdvtShortcutProduct
extern