ReactOS 0.4.15-dev-8222-g9164419
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 <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 <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 SHLWAPI_ISHELLFOLDER_HELPERS
 
#define ShellMessageBoxW   ShellMessageBoxWrapW
 
#define MAX_PROPERTY_SHEET_PAGE   32
 
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl)   SHRunControlPanel((cpl), (hwnd))
 

Functions

BOOL CALLBACK AddPropSheetPageCallback (HPROPSHEETPAGE hPage, LPARAM lParam)
 
HRESULT SHELL32_ShowPropertiesDialog (IDataObject *pdtobj)
 
HRESULT SHELL32_DefaultContextMenuCallBack (IShellFolder *psf, IDataObject *pdo, UINT msg)
 
UINT MapVerbToDfmCmd (_In_ LPCSTR verba)
 
UINT GetDfmCmd (_In_ IContextMenu *pCM, _In_ LPCSTR verba)
 
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)
 
DWORD SHGetAttributes (_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
 
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 SHILAppend (_Inout_ LPITEMIDLIST pidl, _Inout_ LPITEMIDLIST *ppidl)
 
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)
 

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.

◆ 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.

◆ MAX_PROPERTY_SHEET_PAGE

#define MAX_PROPERTY_SHEET_PAGE   32

Definition at line 128 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 154 of file precomp.h.

◆ ShellMessageBoxW

#define ShellMessageBoxW   ShellMessageBoxWrapW

Definition at line 62 of file precomp.h.

◆ SHLWAPI_ISHELLFOLDER_HELPERS

#define SHLWAPI_ISHELLFOLDER_HELPERS

Definition at line 45 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file precomp.h.

Function Documentation

◆ AddPropSheetPageCallback()

BOOL CALLBACK AddPropSheetPageCallback ( HPROPSHEETPAGE  hPage,
LPARAM  lParam 
)
inline

Definition at line 133 of file precomp.h.

134{
136
137 if (pHeader->nPages < MAX_PROPERTY_SHEET_PAGE)
138 {
139 pHeader->phpage[pHeader->nPages++] = hPage;
140 return TRUE;
141 }
142
143 return FALSE;
144}
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define MAX_PROPERTY_SHEET_PAGE
Definition: precomp.h:128
FxContextHeader * pHeader
Definition: handleapi.cpp:604

Referenced by LoadPropSheetHandlers(), SH_ShowDriveProperties(), and SH_ShowPropertiesDialog().

◆ BindCtx_ContainsObject()

BOOL BindCtx_ContainsObject ( _In_ IBindCtx pBindCtx,
_In_ LPCWSTR  pszName 
)

Definition at line 120 of file utils.cpp.

121{
123 if (!pBindCtx || FAILED(pBindCtx->GetObjectParam(const_cast<LPWSTR>(pszName), &punk)))
124 return FALSE;
125 return TRUE;
126}
#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 128 of file utils.cpp.

129{
130 if (!pbc)
131 return dwDefault;
132
133 BIND_OPTS BindOpts = { sizeof(BindOpts) };
134 HRESULT hr = pbc->GetBindOptions(&BindOpts);
135 if (FAILED(hr))
136 return dwDefault;
137
138 return BindOpts.grfMode;
139}
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 323 of file utils.cpp.

324{
325 HWND hWnd = NULL;
326
328 if (pBindCtx && SUCCEEDED(pBindCtx->GetObjectParam((LPWSTR)L"UI During Binding", &punk)))
329 IUnknown_GetWindow(punk, &hWnd);
330
331 return hWnd;
332}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1332
#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 383 of file utils.cpp.

388{
389 HRESULT hr = S_OK;
391
392 *ppbc = pBindCtx;
393
394 if (pBindCtx)
395 {
396 pBindCtx->AddRef();
397 }
398 else
399 {
400 hr = CreateBindCtx(0, ppbc);
401 if (FAILED(hr))
402 return hr;
403 }
404
405 if (!punk)
406 punk = pUnknown = new CDummyOleWindow();
407
408 hr = (*ppbc)->RegisterObjectParam(pszKey, punk);
409
410 if (pUnknown)
411 pUnknown->Release();
412
413 if (FAILED(hr))
414 {
415 (*ppbc)->Release();
416 *ppbc = NULL;
417 }
418
419 return hr;
420}
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
ULONG Release()
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556

◆ GetDfmCmd()

UINT GetDfmCmd ( _In_ IContextMenu pCM,
_In_ LPCSTR  verba 
)

Definition at line 1376 of file utils.cpp.

1377{
1378 CHAR buf[MAX_PATH];
1379 if (IS_INTRESOURCE(verba))
1380 {
1381 if (FAILED(GetCommandStringA(pCM, LOWORD(verba), GCS_VERB, buf, _countof(buf))))
1382 return 0;
1383 verba = buf;
1384 }
1385 return MapVerbToDfmCmd(verba); // Returns DFM_CMD_* or 0
1386}
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:1362
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 1307 of file utils.cpp.

1314{
1315 if (!pEC)
1316 return E_INVALIDARG;
1317
1318 if (pSite)
1319 IUnknown_SetSite(pEC, pSite);
1320 IUnknown_InitializeCommand(pEC, pszCommandName, pPB);
1321
1323 if (pSIA && SUCCEEDED(pEC->QueryInterface(IID_PPV_ARG(IObjectWithSelection, &pOWS))))
1324 pOWS->SetSelection(pSIA);
1325
1326 DWORD dwKeyState = 0, fMask = pICI ? pICI->fMask : 0;
1327 pEC->SetNoShowUI((fMask & CMIC_MASK_FLAG_NO_UI) != 0);
1328 pEC->SetShowWindow(pICI ? pICI->nShow : SW_SHOW);
1329 if (fMask & CMIC_MASK_SHIFT_DOWN)
1330 dwKeyState |= MK_SHIFT;
1331 if (fMask & CMIC_MASK_CONTROL_DOWN)
1332 dwKeyState |= MK_CONTROL;
1333 pEC->SetKeyState(dwKeyState);
1334 if ((fMask & CMIC_MASK_UNICODE) && pICI->lpDirectoryW)
1335 pEC->SetDirectory(pICI->lpDirectoryW);
1336 if ((fMask & CMIC_MASK_UNICODE) && pICI->lpParametersW)
1337 pEC->SetParameters(pICI->lpParametersW);
1338 if (fMask & CMIC_MASK_PTINVOKE)
1339 pEC->SetPosition(pICI->ptInvoke);
1340
1341 HRESULT hr = pEC->Execute();
1342 if (pSite)
1343 IUnknown_SetSite(pEC, NULL);
1344 return hr;
1345}
#define E_INVALIDARG
Definition: ddrawi.h:101
EXTERN_C HRESULT IUnknown_InitializeCommand(_In_ IUnknown *pUnk, _In_ PCWSTR pszCommandName, _In_opt_ IPropertyBag *pPB)
Definition: utils.cpp:1294
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1407
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MK_SHIFT
Definition: winuser.h:2369
#define MK_CONTROL
Definition: winuser.h:2370
#define SW_SHOW
Definition: winuser.h:775
#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 1348 of file utils.cpp.

1355{
1357 HRESULT hr = SHCreateShellItemArrayFromDataObject(pDO, IID_PPV_ARG(IShellItemArray, &pSIA));
1358 return SUCCEEDED(hr) ? InvokeIExecuteCommand(pEC, pszCommandName, pPB, pSIA, pICI, pSite) : hr;
1359}
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:1307

Referenced by CDefaultContextMenu::InvokeRegVerb().

◆ IUnknown_InitializeCommand()

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

Definition at line 1294 of file utils.cpp.

1298{
1299 HRESULT hr;
1301 if (SUCCEEDED(hr = pUnk->QueryInterface(IID_PPV_ARG(IInitializeCommand, &pIC))))
1302 hr = pIC->Initialize(pszCommandName, pPB);
1303 return hr;
1304}
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 83 of file CDefaultContextMenu.cpp.

84{
85 for (UINT i = 0; i < _countof(g_StaticInvokeCmdMap); ++i)
86 {
87 if (!lstrcmpiA(g_StaticInvokeCmdMap[i].szStringVerb, verba))
88 return (int)g_StaticInvokeCmdMap[i].DfmCmd;
89 }
90 return 0;
91}
static const struct _StaticInvokeCommandMap_ g_StaticInvokeCmdMap[]
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
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 52 of file utils.cpp.

53{
57
58 if (lstrcmpiW(szPath, L"NUL") == 0 || lstrcmpiW(szPath, L"PRN") == 0 ||
59 lstrcmpiW(szPath, L"CON") == 0 || lstrcmpiW(szPath, L"AUX") == 0)
60 {
61 return TRUE;
62 }
63
64 if (_wcsnicmp(szPath, L"LPT", 3) == 0 || _wcsnicmp(szPath, L"COM", 3) == 0)
65 {
66 if ((L'0' <= szPath[3] && szPath[3] <= L'9') && szPath[4] == UNICODE_NULL)
67 return TRUE;
68 }
69
70 return FALSE;
71}
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
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 26 of file utils.cpp.

27{
28 if (pszPath[0] != L'.')
29 return FALSE;
30 return !pszPath[1] || (pszPath[1] == L'.' && !pszPath[2]);
31}

Referenced by PathIsValidElement().

◆ PathIsValidElement()

BOOL PathIsValidElement ( _In_ LPCWSTR  pszPath)

Definition at line 38 of file utils.cpp.

39{
40 if (!*pszPath || PathIsDotOrDotDotW(pszPath))
41 return FALSE;
42
43 for (LPCWSTR pch = pszPath; *pch; ++pch)
44 {
46 return FALSE;
47 }
48
49 return TRUE;
50}
#define PATH_VALID_ELEMENT
Definition: utils.cpp:33
BOOL PathIsDotOrDotDotW(_In_ LPCWSTR pszPath)
Definition: utils.cpp:26
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD class)
Definition: path.c:4419
#define pch(ap)
Definition: match.c:418
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by Shell_NextElement().

◆ SHBindToObject()

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

Definition at line 220 of file utils.cpp.

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

Referenced by CDesktopFolder::_ParseDisplayNameByParent(), CGuidItemContextMenu_CreateInstance(), 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 187 of file utils.cpp.

193{
194 CComPtr<IShellFolder> psfDesktop;
195
196 *ppvObj = NULL;
197
198 if (!pShellFolder)
199 {
200 SHGetDesktopFolder(&psfDesktop);
201 if (!psfDesktop)
202 return E_FAIL;
203
204 pShellFolder = psfDesktop;
205 }
206
207 HRESULT hr;
208 if (_ILIsDesktop(pidl))
209 hr = pShellFolder->QueryInterface(riid, ppvObj);
210 else
211 hr = pShellFolder->BindToObject(pidl, pBindCtx, riid, ppvObj);
212
213 if (SUCCEEDED(hr) && !*ppvObj)
214 hr = E_FAIL;
215
216 return hr;
217}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

Referenced by SHBindToObject().

◆ SHCoInitializeAnyApartment()

HRESULT SHCoInitializeAnyApartment ( VOID  )

Definition at line 280 of file utils.cpp.

281{
283 if (FAILED(hr))
285 return hr;
286}
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 515 of file shlfolder.cpp.

516{
517 switch (msg)
518 {
520 return S_OK; // Yes, I want verbs
522 return S_FALSE; // Do it for me please
524 return S_FALSE; // Supposedly "required for Windows 7 to pick a default"
525 }
526 return E_NOTIMPL;
527}
#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(), DrivesContextMenuCallback(), NetFolderMenuCallback(), and RegFolderContextMenuCallback().

◆ SHELL32_ShowPropertiesDialog()

HRESULT SHELL32_ShowPropertiesDialog ( IDataObject pdtobj)

Definition at line 497 of file shlfolder.cpp.

498{
499 if (!pdtobj)
500 return E_INVALIDARG;
501
502 pdtobj->AddRef();
504 {
505 pdtobj->Release();
507 }
508 else
509 {
510 return S_OK;
511 }
512}
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
ULONG AddRef()
HRESULT HResultFromWin32(DWORD hr)
Definition: shellutils.h:70
static DWORD WINAPI _ShowPropertiesDialogThread(LPVOID lpParameter)
Definition: shlfolder.cpp:465
#define CTF_COINIT
Definition: shlwapi.h:1936
#define CTF_INSIST
Definition: shlwapi.h:1933
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CDefaultContextMenu::DoProperties().

◆ Shell_DisplayNameOf()

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

Definition at line 230 of file utils.cpp.

236{
237 *pszBuf = UNICODE_NULL;
238 STRRET sr;
239 HRESULT hr = psf->GetDisplayNameOf(pidl, dwFlags, &sr);
240 if (FAILED(hr))
241 return hr;
242 return StrRetToBufW(&sr, pidl, pszBuf, cchBuf);
243}
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 SHGetNameAndFlagsW().

◆ Shell_FailForceReturn()

BOOL Shell_FailForceReturn ( _In_ HRESULT  hr)

Definition at line 170 of file utils.cpp.

171{
173
174 switch (code)
175 {
178 case ERROR_CANCELLED:
179 return TRUE;
180
181 default:
183 }
184}
#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 ERROR_CANCELLED
Definition: winerror.h:726
#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_ParseSpecialFolder()

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

Definition at line 1859 of file shellpath.c.

1860{
1861 LPCWSTR pszPath, pchBackslash;
1863
1864 pchBackslash = StrChrW(pszStart, L'\\');
1865 if (pchBackslash)
1866 {
1867 *ppch = (LPWSTR)(pchBackslash + 1);
1868 *pcch = (pchBackslash - pszStart) + 1;
1869 StrCpyNW(szPath, pszStart, max(*pcch, _countof(szPath)));
1870 pszPath = szPath;
1871 }
1872 else
1873 {
1874 *ppch = NULL;
1875 *pcch = lstrlenW(pszStart);
1876 pszPath = pszStart;
1877 }
1878
1879 return SHGetSpecialFolderID(pszPath);
1880}
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
#define lstrlenW
Definition: compat.h:750
INT SHGetSpecialFolderID(_In_ LPCWSTR pszName)
Definition: shellpath.c:1845
LPWSTR WINAPI StrCpyNW(LPWSTR dst, LPCWSTR src, int count)
Definition: string.c:536
#define max(a, b)
Definition: svc.c:63

Referenced by CDesktopFolder::ShellUrlParseDisplayName().

◆ Shell_TranslateIDListAlias()

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

Definition at line 111 of file utils.cpp.

116{
117 return E_FAIL; //FIXME
118}

Referenced by CDesktopFolder::ParseDisplayName().

◆ SHGetAttributes()

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

Definition at line 246 of file utils.cpp.

247{
248 LPCITEMIDLIST pidlLast = pidl;
249 IShellFolder *release = NULL;
250
251 if (!psf)
252 {
253 SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psf), &pidlLast);
254 if (!psf)
255 return 0;
256 release = psf;
257 }
258
259 DWORD oldAttrs = dwAttributes;
260 if (FAILED(psf->GetAttributesOf(1, &pidlLast, &dwAttributes)))
261 dwAttributes = 0;
262 else
263 dwAttributes &= oldAttrs;
264
265 if ((dwAttributes & SFGAO_FOLDER) &&
266 (dwAttributes & SFGAO_STREAM) &&
267 !(dwAttributes & SFGAO_STORAGEANCESTOR) &&
268 (oldAttrs & SFGAO_STORAGEANCESTOR) &&
269 (SHGetObjectCompatFlags(psf, NULL) & 0x200))
270 {
271 dwAttributes &= ~(SFGAO_STREAM | SFGAO_STORAGEANCESTOR);
272 dwAttributes |= SFGAO_STORAGEANCESTOR;
273 }
274
275 if (release)
276 release->Release();
277 return dwAttributes;
278}
DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
Definition: ordinal.c:6278
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1350
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD dwAttributes
Definition: vdmdbg.h:34

Referenced by CGuidItemContextMenu_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 289 of file utils.cpp.

295{
296 if (pszText)
297 *pszText = UNICODE_NULL;
298
300
301 CComPtr<IShellFolder> psfFolder;
302 LPCITEMIDLIST ppidlLast;
303 HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &psfFolder), &ppidlLast);
304 if (SUCCEEDED(hr))
305 {
306 if (pszText)
307 hr = Shell_DisplayNameOf(psfFolder, ppidlLast, dwFlags, pszText, cchBuf);
308
309 if (SUCCEEDED(hr))
310 {
311 if (pdwAttributes)
312 *pdwAttributes = SHGetAttributes(psfFolder, ppidlLast, *pdwAttributes);
313 }
314 }
315
316 if (SUCCEEDED(hrCoInit))
318
319 return hr;
320}
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT Shell_DisplayNameOf(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_ LPWSTR pszBuf, _In_ UINT cchBuf)
Definition: utils.cpp:230
DWORD SHGetAttributes(_In_ IShellFolder *psf, _In_ LPCITEMIDLIST pidl, _In_ DWORD dwAttributes)
Definition: utils.cpp:246
HRESULT SHCoInitializeAnyApartment(VOID)
Definition: utils.cpp:280

Referenced by CDesktopFolder::ShellUrlParseDisplayName().

◆ SHILAppend()

HRESULT SHILAppend ( _Inout_ LPITEMIDLIST  pidl,
_Inout_ LPITEMIDLIST ppidl 
)

Definition at line 73 of file utils.cpp.

74{
75 LPITEMIDLIST pidlOld = *ppidl;
76 if (!pidlOld)
77 {
78 *ppidl = pidl;
79 return S_OK;
80 }
81
82 HRESULT hr = SHILCombine(*ppidl, pidl, ppidl);
83 ILFree(pidlOld);
84 ILFree(pidl);
85 return hr;
86}
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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 153 of file utils.cpp.

154{
157
158 if (!pBindCtx || FAILED(pBindCtx->GetObjectParam((LPWSTR)STR_FILE_SYS_BIND_DATA, &punk)))
159 return S_FALSE;
160
161 if (FAILED(punk->QueryInterface(IID_PPV_ARG(IFileSystemBindData, &pBindData))))
162 return S_FALSE;
163
164 if (pFindData)
165 pBindData->GetFindData(pFindData);
166
167 return S_OK;
168}

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

◆ SHSkipJunctionBinding()

BOOL SHSkipJunctionBinding ( _In_ IBindCtx pbc,
_In_ CLSID pclsid 
)

Definition at line 141 of file utils.cpp.

142{
143 if (!pbc)
144 return FALSE;
145
146 BIND_OPTS BindOps = { sizeof(BindOps) };
147 if (SUCCEEDED(pbc->GetBindOptions(&BindOps)) && BindOps.grfFlags == OLECONTF_LINKS)
148 return TRUE;
149
150 return pclsid && SHSkipJunction(pbc, pclsid);
151}
BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
Definition: ordinal.c:4558

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