ReactOS 0.4.17-dev-444-g71ee754
evalcmd.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

HRESULT _PathCopyExeAndTrimWhiteSpaces (PWSTR pszBuff, size_t cchBuff, PCWSTR pszSrc, size_t cchSrc)
 
HRESULT _PathFindInFolder (_In_ INT csidl, _In_ PCWSTR pszSrc, _Out_ PWSTR pszPath, _In_ UINT cchPath)
 
HRESULT _PathFindInSystem (_Inout_ PWSTR pszPath, _In_ UINT cchPath)
 
HRESULT WINAPI AssocCreateElement (_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppvObj)
 

Function Documentation

◆ _PathCopyExeAndTrimWhiteSpaces()

HRESULT _PathCopyExeAndTrimWhiteSpaces ( PWSTR  pszBuff,
size_t  cchBuff,
PCWSTR  pszSrc,
size_t  cchSrc 
)

Definition at line 53 of file evalcmd.cpp.

54{
55 HRESULT hr = StringCchCopyNW(pszBuff, cchBuff, pszSrc, cchSrc);
56 if (SUCCEEDED(hr))
57 StrTrimW(pszBuff, L" \t");
58 return hr;
59}
HRESULT hr
Definition: delayimp.cpp:582
BOOL WINAPI StrTrimW(WCHAR *str, const WCHAR *trim)
Definition: string.c:804
#define L(x)
Definition: resources.c:13
#define SUCCEEDED(hr)
Definition: intsafe.h:50
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
_In_ DWORD _In_ int cchSrc
Definition: winnls.h:1275

Referenced by _ExeFromCmd(), and SHEvaluateSystemCommandTemplate().

◆ _PathFindInFolder()

HRESULT _PathFindInFolder ( _In_ INT  csidl,
_In_ PCWSTR  pszSrc,
_Out_ PWSTR  pszPath,
_In_ UINT  cchPath 
)

Definition at line 148 of file evalcmd.cpp.

149{
150 WCHAR szDir[MAX_PATH];
151 HRESULT hr = SHGetFolderPathW(0, csidl, 0, 0, szDir);
152 if (FAILED(hr))
153 return hr;
154
155 hr = PathCchCombineEx(pszPath, cchPath, szDir, pszSrc, PATHCCH_NONE);
156 if (FAILED(hr))
157 return hr;
158
159 return _PathExeExists(pszPath);
160}
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags)
Definition: path.c:674
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2716
static HRESULT _PathExeExists(_In_ PCWSTR pszPath)
Definition: evalcmd.cpp:132
#define FAILED(hr)
Definition: intsafe.h:51
@ PATHCCH_NONE
Definition: pathcch.h:39
short WCHAR
Definition: pedump.c:58

Referenced by _PathFindInSystem().

◆ _PathFindInSystem()

HRESULT _PathFindInSystem ( _Inout_ PWSTR  pszPath,
_In_ UINT  cchPath 
)

Definition at line 162 of file evalcmd.cpp.

163{
166 if (FAILED(hr))
168 if (FAILED(hr))
169 return hr;
170 return StringCchCopyW(pszPath, cchPath, szPath);
171}
EXTERN_C HRESULT _PathFindInFolder(_In_ INT csidl, _In_ PCWSTR pszSrc, _Out_ PWSTR pszPath, _In_ UINT cchPath)
Definition: evalcmd.cpp:148
LPCWSTR szPath
Definition: env.c:37
#define CSIDL_SYSTEM
Definition: shlobj.h:2226
#define CSIDL_WINDOWS
Definition: shlobj.h:2225
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149

Referenced by _ExeFromCmd(), and SHEvaluateSystemCommandTemplate().

◆ AssocCreateElement()

HRESULT WINAPI AssocCreateElement ( _In_ REFCLSID  rclsid,
_In_ REFIID  riid,
_Outptr_ PVOID ppvObj 
)

Definition at line 1635 of file elements.cpp.

1636{
1637 IAssociationElementOld* pElement;
1638 if (rclsid == CLSID_AssocShellElement)
1639 {
1640 auto pNewElement = new(std::nothrow) CAssocShellElement();
1641 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1642 }
1643 else if (rclsid == CLSID_AssocApplicationElement)
1644 {
1645 auto pNewElement = new(std::nothrow) CAssocApplicationElement();
1646 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1647 }
1648 else if (rclsid == CLSID_AssocProgidElement)
1649 {
1650 auto pNewElement = new(std::nothrow) CAssocProgidElement();
1651 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1652 }
1653 else if (rclsid == CLSID_AssocClsidElement)
1654 {
1655 auto pNewElement = new(std::nothrow) CAssocClsidElement();
1656 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1657 }
1658 else if (rclsid == CLSID_AssocSystemElement)
1659 {
1660 auto pNewElement = new(std::nothrow) CAssocSystemExtElement();
1661 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1662 }
1663 else if (rclsid == CLSID_AssocFolderElement)
1664 {
1665 auto pNewElement = new(std::nothrow) CAssocFolderElement();
1666 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1667 }
1668 else if (rclsid == CLSID_AssocStarElement)
1669 {
1670 auto pNewElement = new(std::nothrow) CAssocStarElement();
1671 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1672 }
1673 else if (rclsid == CLSID_AssocPerceivedElement)
1674 {
1675 auto pNewElement = new(std::nothrow) CAssocPerceivedElement();
1676 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1677 }
1678 else if (rclsid == CLSID_AssocClientElement)
1679 {
1680 auto pNewElement = new(std::nothrow) CAssocClientElement();
1681 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1682 }
1683 else
1684 {
1685 ERR("rclsid: %s\n", wine_dbgstr_guid(&rclsid));
1686 *ppvObj = NULL;
1688 }
1689
1690 if (!pElement)
1691 {
1692 ERR("E_OUTOFMEMORY\n");
1693 return E_OUTOFMEMORY;
1694 }
1695
1696 HRESULT hr = pElement->QueryInterface(riid, ppvObj);
1697 pElement->Release();
1698 return hr;
1699}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:171
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772