ReactOS 0.4.17-dev-672-gf9943c7
elements.cpp File Reference
#include <windef.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <undocshell.h>
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <shlwapi_undoc.h>
#include <pathcch.h>
#include <strsafe.h>
#include <shellutils.h>
#include <new>
#include "evalcmd.h"
#include "elements.h"
#include "resource.h"
#include <wine/debug.h>
Include dependency graph for elements.cpp:

Go to the source code of this file.

Classes

struct  QUERYKEYVAL
 
class  CAssocElement
 
class  CAssocShellElement
 
class  CAssocShellVerbElement
 
class  CAssocApplicationElement
 
class  CAssocProgidElement
 
class  CAssocClsidElement
 
class  CAssocSystemExtElement
 
class  CAssocFolderElement
 
class  CAssocStarElement
 
class  CAssocPerceivedElement
 
class  CAssocClientElement
 

Typedefs

typedef HRESULT(CALLBACKQUERY_CALLBACK) (IQuerySourceOld *, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)
 
typedef struct QUERYKEYVAL QUERYKEYVAL
 
typedef struct QUERYKEYVALPQUERYKEYVAL
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (evalcmd)
 
 C_ASSERT (SHELL32_CAssocElement_Version==_WIN32_WINNT_WINXP)
 
static const QUERYKEYVAL_FindKeyVal (ASSOCQUERY query, const QUERYKEYVAL *pItems, UINT cItems)
 
static HRESULT SHAllocMUI (PWSTR *ppwsz)
 
static HRESULT _SHAllocLoadString (HINSTANCE hInstance, UINT uID, PWSTR *ppwsz)
 
static HRESULT QSOpen2 (IQuerySourceOld *pSource, PCWSTR key, PCWSTR pszSrc, BOOL bCreate, IQuerySourceOld **ppSource)
 
static HRESULT _GetFileTypeName (PWSTR lpsz, PWSTR *ppwsz)
 
static LSTATUS _RegQueryString (HKEY hKey, PCWSTR lpSubKey, PWSTR lpData, LONG cchData)
 
static LSTATUS _RegSetVolatileString (HKEY hKey, PCWSTR lpSubKey, PCWSTR lpString)
 
static HRESULT CALLBACK _QuerySourceDirect (IQuerySourceOld *pSource, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)
 
static HRESULT CALLBACK _QuerySourceDword (IQuerySourceOld *pSource, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)
 
static HRESULT CALLBACK _QuerySourceExists (IQuerySourceOld *pSource, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)
 
static HRESULT CALLBACK _QuerySourceString (IQuerySourceOld *pSource, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)
 
static HRESULT _QuerySourceCreateFromKey (HKEY hKey, PCWSTR lpSubKey, BOOL bCreate, IQuerySourceOld **ppSource)
 
static HRESULT _QuerySourceCreateFromKey2 (HKEY hKey, PCWSTR key1, PCWSTR key2, IQuerySourceOld **ppSource)
 
static HRESULT _AssocOpenRegKey (HKEY hKey, PCWSTR lpSubKey, PHKEY phkResult, BOOL bCreate)
 
static HKEY _OpenProgidKey (PCWSTR psz)
 
static void _MakeApplicationsKey (PCWSTR pszPath, PWSTR pszDest, UINT cchDest)
 
static BOOL _ParamIsApp (PCWSTR psz)
 
static HRESULT _PathFileExists (PCWSTR lpFileName)
 
static HRESULT _ExeFromCmd (PCWSTR pszCmdTemplate, PWSTR *ppszApplication)
 
 STDMETHODIMP_ (ULONG) CAssocElement
 
EXTERN_C HRESULT WINAPI AssocCreateElement (_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppvObj)
 

Variables

static const QUERYKEYVAL g_perceivedKeyVals []
 
static const QUERYKEYVAL g_shellKeyVals []
 
static const QUERYKEYVAL g_shellVerbKeyVals []
 
static const QUERYKEYVAL g_shellAppKeyVals []
 
static const QUERYKEYVAL g_progidKeyVals [2]
 

Typedef Documentation

◆ PQUERYKEYVAL

◆ QUERY_CALLBACK

typedef HRESULT(CALLBACK * QUERY_CALLBACK) (IQuerySourceOld *, ASSOCQUERY query, PCWSTR keyName, PCWSTR valueName, PVOID pValue)

Definition at line 27 of file elements.cpp.

◆ QUERYKEYVAL

Function Documentation

◆ _AssocOpenRegKey()

static HRESULT _AssocOpenRegKey ( HKEY  hKey,
PCWSTR  lpSubKey,
PHKEY  phkResult,
BOOL  bCreate 
)
static

Definition at line 229 of file elements.cpp.

230{
231 *phkResult = NULL;
232 if (!hKey)
234
236 if ( bCreate )
237 error = RegCreateKeyExW(hKey, lpSubKey, 0, NULL, 0, MAXIMUM_ALLOWED, NULL,
238 phkResult, NULL);
239 else
240 error = RegOpenKeyExW(hKey, lpSubKey, 0, MAXIMUM_ALLOWED, phkResult);
241
242 if (error == ERROR_SUCCESS)
243 return S_OK;
244
246}
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
FxAutoRegKey hKey
#define S_OK
Definition: intsafe.h:52
#define error(str)
Definition: mkdosfs.c:1605
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1536
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_NO_ASSOCIATION
Definition: winerror.h:1001

Referenced by _OpenProgidKey().

◆ _ExeFromCmd()

static HRESULT _ExeFromCmd ( PCWSTR  pszCmdTemplate,
PWSTR ppszApplication 
)
static

Definition at line 312 of file elements.cpp.

313{
314 if (_ParamIsApp(pszCmdTemplate))
315 return SHStrDupW(L"%1", ppszApplication);
316
317 PWSTR pszParameters = NULL;
318 HRESULT hr = SHEvaluateSystemCommandTemplate(pszCmdTemplate, ppszApplication,
319 NULL, &pszParameters);
321 return hr;
322
323 if (hr != S_OK || StrCmpIW(PathFindFileNameW(*ppszApplication), L"rundll32.exe") != 0)
324 {
325 CoTaskMemFree(pszParameters);
326 return hr;
327 }
328
329 CoTaskMemFree(*ppszApplication);
330 *ppszApplication = NULL;
331
332 PWSTR pchComma = StrChrW(pszParameters, L',');
333 if (!pchComma)
334 {
336 CoTaskMemFree(pszParameters);
337 return hr;
338 }
339
340 WCHAR szExe[MAX_PATH];
341 hr = _PathCopyExeAndTrimWhiteSpaces(szExe, _countof(szExe), pszParameters,
342 pchComma - pszParameters);
344 {
345 CoTaskMemFree(pszParameters);
346 return hr;
347 }
348
349 PathUnquoteSpacesW(szExe);
350
351 PathCchAddExtension(szExe, _countof(szExe), L".dll");
352
353 if (PathIsAbsolute(szExe))
354 {
355 hr = _PathFileExists(szExe);
356 }
357 else if (PathIsFileSpecW(szExe))
358 {
359 hr = _PathFindInSystem(szExe, _countof(szExe));
360 }
361 else
362 {
363 CoTaskMemFree(pszParameters);
365 }
366
367 if (SUCCEEDED(hr))
368 hr = SHStrDupW(szExe, ppszApplication);
369
370 CoTaskMemFree(pszParameters);
371 return hr;
372}
HRESULT hr
Definition: delayimp.cpp:582
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:464
#define MAX_PATH
Definition: compat.h:34
void WINAPI PathUnquoteSpacesW(WCHAR *path)
Definition: path.c:1982
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1677
HRESULT WINAPI PathCchAddExtension(WCHAR *path, SIZE_T size, const WCHAR *extension)
Definition: path.c:542
BOOL WINAPI PathIsFileSpecW(const WCHAR *path)
Definition: path.c:1818
int WINAPI StrCmpIW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:464
HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
Definition: main.c:1692
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:33
#define L(x)
Definition: resources.c:13
static BOOL _ParamIsApp(PCWSTR psz)
Definition: elements.cpp:299
static HRESULT _PathFileExists(PCWSTR lpFileName)
Definition: elements.cpp:304
EXTERN_C HRESULT _PathCopyExeAndTrimWhiteSpaces(PWSTR pszBuff, size_t cchBuff, PCWSTR pszSrc, size_t cchSrc)
Definition: evalcmd.cpp:53
EXTERN_C HRESULT _PathFindInSystem(_Inout_ PWSTR pszPath, _In_ UINT cchPath)
Definition: evalcmd.cpp:162
EXTERN_C HRESULT WINAPI SHEvaluateSystemCommandTemplate(_In_ PCWSTR pszCmdTemplate, _Outptr_ PWSTR *ppszApplication, _Outptr_opt_ PWSTR *ppszCommandLine, _Outptr_opt_ PWSTR *ppszParameters)
Definition: evalcmd.cpp:182
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
short WCHAR
Definition: pedump.c:58
static BOOL PathIsAbsolute(_In_ PCWSTR pszPath)
#define _countof(array)
Definition: sndvol32.h:70
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by CAssocClientElement::_CreateRepairedNetscapeRegistration(), and CAssocShellVerbElement::QueryString().

◆ _FindKeyVal()

static const QUERYKEYVAL * _FindKeyVal ( ASSOCQUERY  query,
const QUERYKEYVAL pItems,
UINT  cItems 
)
static

Definition at line 76 of file elements.cpp.

77{
78 for (UINT iItem = 0; iItem < cItems; ++iItem)
79 {
80 if (pItems[iItem].query == query)
81 return &pItems[iItem];
82 }
83 return NULL;
84}
unsigned int UINT
Definition: sysinfo.c:13
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM * pItems
Definition: usp10.c:62

Referenced by CAssocElement::_QueryKeyValAny().

◆ _GetFileTypeName()

static HRESULT _GetFileTypeName ( PWSTR  lpsz,
PWSTR ppwsz 
)
static

Definition at line 118 of file elements.cpp.

119{
120 WCHAR szDest[MAX_PATH], szBuff[128];
121 HINSTANCE hSHLWAPI = GetModuleHandleW(L"shlwapi.dll");
122
123 if (!lpsz || *lpsz != '.' || !lpsz[1])
124 return _SHAllocLoadString(hSHLWAPI, IDS_FILE, ppwsz);
125
126 CharUpperW(lpsz);
127 LoadStringW(hSHLWAPI, IDS_ANY_FILE, szBuff, _countof(szBuff));
128 StringCchPrintfW(szDest, _countof(szDest), szBuff, lpsz + 1);
129 return SHStrDupW(szDest, ppwsz);
130}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1249
#define IDS_ANY_FILE
Definition: resource.h:5
#define IDS_FILE
Definition: resource.h:6
static HRESULT _SHAllocLoadString(HINSTANCE hInstance, UINT uID, PWSTR *ppwsz)
Definition: elements.cpp:99
#define LoadStringW
Definition: utils.h:64
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530

Referenced by CAssocStarElement::QueryString().

◆ _MakeApplicationsKey()

static void _MakeApplicationsKey ( PCWSTR  pszPath,
PWSTR  pszDest,
UINT  cchDest 
)
inlinestatic

Definition at line 290 of file elements.cpp.

291{
292 HRESULT hr = PathCchCombineEx(pszDest, cchDest, L"Applications", pszPath, PATHCCH_NONE);
294 return;
295
296 PathCchAddExtension(pszDest, cchDest, L".exe");
297}
HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags)
Definition: path.c:674
@ PATHCCH_NONE
Definition: pathcch.h:39
_In_ INT cchDest
Definition: shlwapi.h:1161

Referenced by CAssocApplicationElement::_InitSource().

◆ _OpenProgidKey()

static HKEY _OpenProgidKey ( PCWSTR  psz)
static

Definition at line 248 of file elements.cpp.

249{
250 HKEY hKeyBase;
253 return NULL;
254
255 WCHAR szData[64];
256 DWORD cbData = sizeof(szData);
257 if (StrCmpIW(L"Excel.Sheet.8", psz) == 0)
258 return hKeyBase;
259
260 LSTATUS error = SHGetValueW(hKeyBase, L"CurVer", NULL, NULL, szData, &cbData);
261 if (error || cbData <= 2)
262 return hKeyBase;
263
264 HKEY hKeyCurVer;
265 hr = _AssocOpenRegKey(HKEY_CLASSES_ROOT, szData, &hKeyCurVer, FALSE);
267 return hKeyBase;
268
269 HKEY hKeyShell;
270 hr = _AssocOpenRegKey(hKeyCurVer, L"shell", &hKeyShell, FALSE);
272 {
273 hr = _AssocOpenRegKey(hKeyBase, L"shell", &hKeyShell, FALSE);
275 {
276 RegCloseKey(hKeyBase);
277 return hKeyCurVer;
278 }
279
280 RegCloseKey(hKeyShell);
281 RegCloseKey(hKeyCurVer);
282 return hKeyBase;
283 }
284
285 RegCloseKey(hKeyShell);
286 RegCloseKey(hKeyBase);
287 return hKeyCurVer;
288}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define FALSE
Definition: types.h:117
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222
static HRESULT _AssocOpenRegKey(HKEY hKey, PCWSTR lpSubKey, PHKEY phkResult, BOOL bCreate)
Definition: elements.cpp:229
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CAssocProgidElement::_InitSource().

◆ _ParamIsApp()

static BOOL _ParamIsApp ( PCWSTR  psz)
inlinestatic

Definition at line 299 of file elements.cpp.

300{
301 return !StrCmpNW(psz, L"%1", 2) || !StrCmpNW(psz, L"\"%1\"", 4);
302}
INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:500

Referenced by _ExeFromCmd().

◆ _PathFileExists()

static HRESULT _PathFileExists ( PCWSTR  lpFileName)
static

Definition at line 304 of file elements.cpp.

305{
306 DWORD attrs;
309 return S_OK;
310}
BOOL WINAPI PathFileExistsAndAttributesW(LPCWSTR lpszPath, DWORD *dwAttr)
Definition: path.c:747
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
_In_ LPCSTR lpFileName
Definition: winbase.h:2800

Referenced by _ExeFromCmd().

◆ _QuerySourceCreateFromKey()

static HRESULT _QuerySourceCreateFromKey ( HKEY  hKey,
PCWSTR  lpSubKey,
BOOL  bCreate,
IQuerySourceOld **  ppSource 
)
inlinestatic

Definition at line 205 of file elements.cpp.

206{
207 return QuerySourceCreateFromKey(hKey, lpSubKey, bCreate,
208 IID_PPV_ARG(IQuerySourceOld, ppSource));
209}
EXTERN_C HRESULT WINAPI QuerySourceCreateFromKey(_In_ HKEY hKey, _In_opt_ PCWSTR lpSubKey, _In_ BOOL bCreate, _In_ REFIID riid, _Outptr_ PVOID *ppv)
Definition: querysrc.cpp:577
#define IID_PPV_ARG(Itype, ppType)

Referenced by CAssocClientElement::_FixNetscapeRegistration(), CAssocShellElement::_InitSource(), CAssocProgidElement::_InitSource(), and _QuerySourceCreateFromKey2().

◆ _QuerySourceCreateFromKey2()

static HRESULT _QuerySourceCreateFromKey2 ( HKEY  hKey,
PCWSTR  key1,
PCWSTR  key2,
IQuerySourceOld **  ppSource 
)
static

Definition at line 212 of file elements.cpp.

217{
218 WCHAR szBuff[MAX_PATH];
219
220 if (key1)
221 PathCchCombineEx(szBuff, _countof(szBuff), key1, key2, PATHCCH_NONE);
222 else
223 StringCchCopyW(szBuff, _countof(szBuff), key2);
224
225 return _QuerySourceCreateFromKey(hKey, szBuff, FALSE, ppSource);
226}
static HRESULT _QuerySourceCreateFromKey(HKEY hKey, PCWSTR lpSubKey, BOOL bCreate, IQuerySourceOld **ppSource)
Definition: elements.cpp:205
GLuint64EXT GLuint GLuint GLenum GLenum GLuint GLuint GLenum GLuint GLuint key1
Definition: glext.h:10608
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149

Referenced by CAssocClsidElement::_InitSource(), CAssocSystemExtElement::_InitSource(), CAssocPerceivedElement::_InitSource(), and CAssocClientElement::_InitSourceFromKey().

◆ _QuerySourceDirect()

static HRESULT CALLBACK _QuerySourceDirect ( IQuerySourceOld *  pSource,
ASSOCQUERY  query,
PCWSTR  keyName,
PCWSTR  valueName,
PVOID  pValue 
)
static

Definition at line 158 of file elements.cpp.

164{
165 return pSource->QueryValueDirect(keyName, valueName, (FLAGGED_BYTE_BLOB**)pValue);
166}
PWCHAR pValue

Referenced by CAssocElement::QueryDirect().

◆ _QuerySourceDword()

static HRESULT CALLBACK _QuerySourceDword ( IQuerySourceOld *  pSource,
ASSOCQUERY  query,
PCWSTR  keyName,
PCWSTR  valueName,
PVOID  pValue 
)
static

Definition at line 169 of file elements.cpp.

175{
176 return pSource->QueryValueDword(keyName, valueName, (PDWORD)pValue);
177}
DWORD * PDWORD
Definition: pedump.c:68

Referenced by CAssocElement::QueryDword().

◆ _QuerySourceExists()

static HRESULT CALLBACK _QuerySourceExists ( IQuerySourceOld *  pSource,
ASSOCQUERY  query,
PCWSTR  keyName,
PCWSTR  valueName,
PVOID  pValue 
)
static

Definition at line 180 of file elements.cpp.

186{
187 return pSource->QueryValueExists(keyName, valueName);
188}

Referenced by CAssocElement::QueryExists().

◆ _QuerySourceString()

static HRESULT CALLBACK _QuerySourceString ( IQuerySourceOld *  pSource,
ASSOCQUERY  query,
PCWSTR  keyName,
PCWSTR  valueName,
PVOID  pValue 
)
static

Definition at line 191 of file elements.cpp.

197{
198 HRESULT hr = pSource->QueryValueString(keyName, valueName, static_cast<PWSTR*>(pValue));
200 return hr;
201 return SHAllocMUI(static_cast<PWSTR*>(pValue));
202}
static HRESULT SHAllocMUI(PWSTR *ppwsz)
Definition: elements.cpp:86
#define ASSOCQUERY_INDIRECT
Definition: shlobj_undoc.h:39

Referenced by CAssocElement::QueryString(), and CAssocProgidElement::QueryString().

◆ _RegQueryString()

static LSTATUS _RegQueryString ( HKEY  hKey,
PCWSTR  lpSubKey,
PWSTR  lpData,
LONG  cchData 
)
inlinestatic

Definition at line 133 of file elements.cpp.

134{
135 LONG cbData = cchData * sizeof(WCHAR);
136 return RegQueryValueW(hKey, lpSubKey, lpData, &cbData);
137}
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
long LONG
Definition: pedump.c:60

Referenced by CAssocClientElement::_CreateRepairedNetscapeRegistration().

◆ _RegSetVolatileString()

static LSTATUS _RegSetVolatileString ( HKEY  hKey,
PCWSTR  lpSubKey,
PCWSTR  lpString 
)
static

Definition at line 140 of file elements.cpp.

141{
143 if (lpSubKey && *lpSubKey)
145 NULL, &hKey, NULL);
146 else
148 if (error)
149 return error;
150
151 INT cch = lstrlenW(lpString);
152 error = RegSetValueExW(hKey, NULL, 0, REG_SZ, (PBYTE)lpString, (cch + 1) * sizeof(WCHAR));
154 return error;
155}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define lstrlenW
Definition: compat.h:750
#define REG_SZ
Definition: layer.c:22
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1063
BYTE * PBYTE
Definition: pedump.c:66
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
int32_t INT
Definition: typedefs.h:58

Referenced by CAssocClientElement::_CreateRepairedNetscapeRegistration().

◆ _SHAllocLoadString()

static HRESULT _SHAllocLoadString ( HINSTANCE  hInstance,
UINT  uID,
PWSTR ppwsz 
)
inlinestatic

Definition at line 99 of file elements.cpp.

100{
101 WCHAR szBuff[MAX_PATH];
102 LoadStringW(hInstance, uID, szBuff, _countof(szBuff));
103 return SHStrDupW(szBuff, ppwsz);
104}
HINSTANCE hInstance
Definition: charmap.c:19
_In_ UINT uID
Definition: shlwapi.h:156

Referenced by _GetFileTypeName(), and CAssocFolderElement::QueryString().

◆ AssocCreateElement()

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

Definition at line 1612 of file elements.cpp.

1613{
1614 IAssociationElementOld* pElement;
1615 if (rclsid == CLSID_AssocShellElement)
1616 {
1617 auto pNewElement = new(std::nothrow) CAssocShellElement();
1618 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1619 }
1620 else if (rclsid == CLSID_AssocApplicationElement)
1621 {
1622 auto pNewElement = new(std::nothrow) CAssocApplicationElement();
1623 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1624 }
1625 else if (rclsid == CLSID_AssocProgidElement)
1626 {
1627 auto pNewElement = new(std::nothrow) CAssocProgidElement();
1628 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1629 }
1630 else if (rclsid == CLSID_AssocClsidElement)
1631 {
1632 auto pNewElement = new(std::nothrow) CAssocClsidElement();
1633 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1634 }
1635 else if (rclsid == CLSID_AssocSystemElement)
1636 {
1637 auto pNewElement = new(std::nothrow) CAssocSystemExtElement();
1638 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1639 }
1640 else if (rclsid == CLSID_AssocFolderElement)
1641 {
1642 auto pNewElement = new(std::nothrow) CAssocFolderElement();
1643 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1644 }
1645 else if (rclsid == CLSID_AssocStarElement)
1646 {
1647 auto pNewElement = new(std::nothrow) CAssocStarElement();
1648 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1649 }
1650 else if (rclsid == CLSID_AssocPerceivedElement)
1651 {
1652 auto pNewElement = new(std::nothrow) CAssocPerceivedElement();
1653 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1654 }
1655 else if (rclsid == CLSID_AssocClientElement)
1656 {
1657 auto pNewElement = new(std::nothrow) CAssocClientElement();
1658 pElement = static_cast<IAssociationElementOld*>(pNewElement);
1659 }
1660 else
1661 {
1662 ERR("rclsid: %s\n", wine_dbgstr_guid(&rclsid));
1663 *ppvObj = NULL;
1665 }
1666
1667 if (!pElement)
1668 {
1669 ERR("E_OUTOFMEMORY\n");
1670 return E_OUTOFMEMORY;
1671 }
1672
1673 HRESULT hr = pElement->QueryInterface(riid, ppvObj);
1674 pElement->Release();
1675 return hr;
1676}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
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

Referenced by CAssocShellVerbElement::_GetAppDelegate(), AssocCreate(), and SH32_AssocCreateElement().

◆ C_ASSERT()

◆ QSOpen2()

static HRESULT QSOpen2 ( IQuerySourceOld *  pSource,
PCWSTR  key,
PCWSTR  pszSrc,
BOOL  bCreate,
IQuerySourceOld **  ppSource 
)
static

Definition at line 106 of file elements.cpp.

112{
113 WCHAR szDest[MAX_PATH];
114 PathCchCombineEx(szDest, _countof(szDest), key, pszSrc, PATHCCH_NONE);
115 return pSource->OpenSource(szDest, bCreate, ppSource);
116}
Definition: copy.c:22

Referenced by CAssocShellElement::_GetVerbDelegate().

◆ SHAllocMUI()

static HRESULT SHAllocMUI ( PWSTR ppwsz)
static

Definition at line 86 of file elements.cpp.

87{
88 WCHAR szOutBuf[1024];
89 HRESULT hr = SHLoadIndirectString(*ppwsz, szOutBuf, _countof(szOutBuf), NULL);
90 CoTaskMemFree(*ppwsz);
92 {
93 *ppwsz = NULL;
94 return hr;
95 }
96 return SHStrDupW(szOutBuf, ppwsz);
97}
HRESULT WINAPI SHLoadIndirectString(const WCHAR *src, WCHAR *dst, UINT dst_len, void **reserved)
Definition: string.c:1499

Referenced by _QuerySourceString().

◆ STDMETHODIMP_()

STDMETHODIMP_ ( ULONG  )

Definition at line 710 of file elements.cpp.

711{
712 return InterlockedIncrement(&m_cRefs);
713}
#define InterlockedIncrement
Definition: armddk.h:53

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( evalcmd  )

Variable Documentation

◆ g_perceivedKeyVals

const QUERYKEYVAL g_perceivedKeyVals[]
static
Initial value:
=
{
{ ASSOCQUERY_FRIENDLYAPPNAME, NULL, L"FriendlyTypeName" },
{ ASSOCQUERY_DEFAULTICON, L"DefaultIcon", NULL },
}
#define ASSOCQUERY_FRIENDLYAPPNAME
Definition: elements.h:23
#define ASSOCQUERY_DEFAULTICON
Definition: elements.h:17

Definition at line 37 of file elements.cpp.

Referenced by CAssocPerceivedElement::_GetQueryKeyVal().

◆ g_progidKeyVals

const QUERYKEYVAL g_progidKeyVals[2]
static
Initial value:
=
{
{ ASSOCQUERY_SHELLEX, L"ShellEx\\%s", NULL },
{ ASSOCQUERY_CONTENT_TYPE, NULL, L"Content Type" },
}
#define ASSOCQUERY_CONTENT_TYPE
Definition: elements.h:33
#define ASSOCQUERY_SHELLEX
Definition: elements.h:20

Definition at line 69 of file elements.cpp.

Referenced by CAssocProgidElement::QueryString().

◆ g_shellAppKeyVals

const QUERYKEYVAL g_shellAppKeyVals[]
static
Initial value:
=
{
{ ASSOCQUERY_APPKEY_FRIENDLYAPPNAME, NULL, L"FriendlyAppName" },
}
#define ASSOCQUERY_APPKEY_FRIENDLYAPPNAME
Definition: elements.h:32

Definition at line 64 of file elements.cpp.

Referenced by CAssocApplicationElement::_GetQueryKeyVal().

◆ g_shellKeyVals

const QUERYKEYVAL g_shellKeyVals[]
static
Initial value:
=
{
{ ASSOCQUERY_FRIENDLYAPPNAME, NULL, L"FriendlyTypeName" },
{ ASSOCQUERY_DEFAULTICON, L"DefaultIcon", NULL },
{ ASSOCQUERY_CLSID, L"Clsid", NULL },
{ ASSOCQUERY_PROGID, L"Progid", NULL },
{ ASSOCQUERY_SHELLEX, L"ShellEx\\%s", NULL },
}
#define ASSOCQUERY_CLSID
Definition: elements.h:18
#define ASSOCQUERY_PROGID
Definition: elements.h:19

Definition at line 43 of file elements.cpp.

Referenced by CAssocShellElement::_GetQueryKeyVal(), and CAssocPerceivedElement::_GetQueryKeyVal().

◆ g_shellVerbKeyVals

const QUERYKEYVAL g_shellVerbKeyVals[]
static
Initial value:
=
{
{ ASSOCQUERY_COMMAND, L"command", NULL },
{ ASSOCQUERY_DDEEXEC, L"ddeexec", NULL },
{ ASSOCQUERY_DDEEXEC_IFEXEC, L"ddeexec\\ifexec", NULL },
{ ASSOCQUERY_DDEEXEC_APPLICATION, L"ddeexec\\application", NULL },
{ ASSOCQUERY_DDEEXEC_TOPIC, L"ddeexec\\topic", NULL },
{ ASSOCQUERY_NOACTIVATEHANDLER, L"ddeexec", L"NoActivateHandler" },
{ ASSOCQUERY_COMMAND_COMMAND, L"command", L"command" },
{ ASSOCQUERY_VERB_FRIENDLYAPPNAME, NULL, L"FriendlyAppName" },
}
#define ASSOCQUERY_COMMAND_COMMAND
Definition: elements.h:22
#define ASSOCQUERY_DDEEXEC
Definition: elements.h:26
#define ASSOCQUERY_DDEEXEC_TOPIC
Definition: elements.h:29
#define ASSOCQUERY_VERB_FRIENDLYAPPNAME
Definition: elements.h:24
#define ASSOCQUERY_DDEEXEC_IFEXEC
Definition: elements.h:27
#define ASSOCQUERY_DDEEXEC_APPLICATION
Definition: elements.h:28
#define ASSOCQUERY_NOACTIVATEHANDLER
Definition: elements.h:21
#define ASSOCQUERY_COMMAND
Definition: elements.h:25

Definition at line 52 of file elements.cpp.

Referenced by CAssocShellVerbElement::_GetQueryKeyVal().