13#if NTDDI_VERSION < NTDDI_WIN10_RS1
14#define ASSOCF_PER_MACHINE_ONLY 0x00008000
27#if DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA
48 REFIID riidQS = Major > 5 ? IID_IQuerySource : IID_IQuerySourceOld;
58#if DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA
69#if SHELL32_CAssocElement_Version >= _WIN32_WINNT_VISTA
79 return pAE->QueryString(
Query, pszExtra, ppszValue);
92 hr = pOWRKO->GetKey(phKey);
93#if DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA
119 if (!DotExt[0] || (!DotExt[1] && DotExt[0] ==
'.'))
175 const SIZE_T cchPrefix =
sizeof(
"shell\\") - 1;
244 PCWSTR pszSourcePath = pszSource;
246 if (*pszSource ==
L'{')
321 if (
FAILED(ShellObjectCreator(pQA)))
387 TRACE(
"(%p)->(%d,%s,%p,%p)\n",
this,
399 FIXME(
"hwnd != NULL not supported\n");
401 if (cfFlags & ~HANDLEDINITFLAGS)
402 FIXME(
"unsupported flags: %#x\n", cfFlags & ~HANDLEDINITFLAGS);
404 if (pszAssoc !=
NULL)
419 else if (*pszAssoc ==
L'{')
449 else if (hkeyProgid !=
NULL)
490 TRACE(
"(%p)->(0x%08x, %u, %s, %p, %p)\n",
this,
flags,
str,
debugstr_w(pszExtra), pszOut, pcchOut);
491 if (
flags & unimplemented_flags)
493 FIXME(
"%08x: unimplemented flags\n",
flags & unimplemented_flags);
571 goto get_friendly_name_fail;
580 goto get_friendly_name_fail;
586 for (
i = 0;
i < flen /
sizeof(
DWORD);
i++)
588 sprintfW(fileDescW,
L"\\StringFileInfo\\%04x%04x\\FileDescription",
601 get_friendly_name_fail:
611 hr = SHELL_RegGetStringAlloc(this->
hkeySource,
NULL,
L"Content Type", pszResult);
620 hr = SHELL_RegGetStringAlloc(
hKey,
L"DefaultIcon",
NULL, pszResult);
666 FIXME(
"assocstr %d unimplemented!\n",
str);
719 pAssocElement = &CLSID_AssocApplicationElement;
734 FIXME(
"(%p,0x%8x,0x%8x,%s,%p)\n",
this, cfFlags, assockey,
debugstr_w(pszExtra), phkeyOut);
743 if (pAssocElement && pszSetString)
748 if (
FAILED(pPS2->SetString(pszSetString)))
776 TRACE(
"(%p,0x%8x,0x%8x,%s,%p,%p)\n",
this, cfFlags, assocdata,
784 if (cfFlags & ~HANDLEDFLAGS)
785 FIXME(
"Unsupported flags: %x\n", cfFlags & ~HANDLEDFLAGS);
807 FIXME(
"Unsupported ASSOCDATA value: %d\n", assocdata);
812 hr =
m_pBaseClass->GetData(cfFlags, assocdata, pszExtra, pvOut, pcbOut);
899 PWSTR pszCommand, pszStart, pszEnd, pszBuf, pszFree;
917 pszFree = pszCommand;
921 WCHAR save = *pszEnd;
933 if (pszCommand[0] ==
'"')
935 pszStart = pszCommand + 1;
936 pszEnd =
strchrW(pszStart,
'"');
945 pszStart = pszCommand;
946 for (pszEnd = pszStart; (pszEnd =
strchrW(pszEnd,
' ')); pszEnd++)
976 outlen = &lenNoReturn;
1009 outlen = &lenNoReturn;
1016 if (*outlen > 0)
out[0] = 0;
static HRESULT AssocCreateElementInternal(REFCLSID rclsid, IQuerySource *pQS, REFIID riid, PVOID *ppv)
static HRESULT OpenClassWithShellExecKey(ASSOCF fA, HKEY hClass, LPCWSTR pszVerb, HKEY *phKey)
static HRESULT GetKeyFromObjectWithQuerySource(T &Obj, HKEY *phKey)
static HRESULT GetClassKeyName(ASSOCF fA, PCWSTR pszSource, HKEY hSource, LPWSTR pszClass, UINT cchMax)
static HRESULT SH32_QueryAssocElementString(_In_ REFCLSID rclsid, _In_ UINT Query, _In_ HKEY hKey, _In_opt_ PCWSTR pszSubKey, _In_ PCWSTR pszExtra, _Out_ PWSTR *ppszValue)
static HRESULT OpenShellVerbKey(HKEY hClass, LPCWSTR pszVerb, HKEY *phKey)
static HRESULT SHRegDuplicateHKey(HKEY hKey, HKEY *phKey)
static HRESULT SH32_AssocCreateElementOnKey(_In_ REFCLSID rclsid, _In_ HKEY hKey, _In_opt_ PCWSTR pszSubKey, _In_ REFIID riid, _Outptr_ PVOID *ppv)
EXTERN_C HRESULT SHELL32_AssocGetFileDescription(PCWSTR Name, PWSTR Buf, UINT cchBuf)
static HRESULT GetExtensionDefaultDescription(PCWSTR DotExt, PWSTR Buf, UINT cchBuf)
EXTERN_C HRESULT SHELL32_AssocGetFSDirectoryDescription(PWSTR Buf, UINT cchBuf)
static HRESULT SHELL32_AssocGetExtensionDescription(PCWSTR DotExt, PWSTR Buf, UINT cchBuf)
static HRESULT AssocCreateElementOnKeyInternal(_In_ REFCLSID rclsid, _In_ HKEY hKey, _In_opt_ PCWSTR pszSubKey, _In_ REFIID riid, _Outptr_ PVOID *ppv, _In_ BYTE Major)
static HRESULT SH32_AssocCreateElement(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppv)
static HRESULT OpenClassKey(ASSOCF fA, PCWSTR pszSource, HKEY hCR, HKEY hSource, HKEY *phKey)
#define shell32_hInstance
static adns_initflags initflags
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void shell(int argc, const char *argv[])
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
#define STDMETHODCALLTYPE
#define RegCloseKey(hKey)
CComPtr< CQueryAssociations > m_pBaseClass
HRESULT GetValue(HKEY hkey, const WCHAR *name, void **data, DWORD *data_size)
HRESULT OpenDdeKey(ASSOCF flags, LPCWSTR pszExtra, RegKeyRef &KeyRef)
HRESULT ReturnString(ASSOCF flags, LPWSTR out, DWORD *outlen, LPCWSTR data, DWORD datalen)
HKEY GetClassHandle() const
HRESULT ReturnRegData(ASSOCF flags, HKEY hKey, PCWSTR pszName, void *pvOut, DWORD *pcbOut)
HRESULT OpenShellVerbKey(ASSOCF flags, LPCWSTR pszVerb, LPCWSTR pszSubKey, RegKeyRef &KeyRef)
HRESULT GetCommand(const WCHAR *extra, WCHAR **command)
CQueryAssociations * TryBaseClass(ASSOCF flags)
HRESULT ReturnData(void *out, DWORD *outlen, const void *data, DWORD datalen)
HRESULT GetExecutable(LPCWSTR pszExtra, LPWSTR path, DWORD pathlen, DWORD *len)
STDMETHOD() GetEnum(ASSOCF cfFlags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetString(ASSOCF flags, ASSOCSTR str, LPCWSTR pwszExtra, LPWSTR pwszOut, DWORD *pcchOut) override
STDMETHOD() Init(ASSOCF flags, LPCWSTR pwszAssoc, HKEY hkProgid, HWND hwnd) override
bool EmulateWin2000() const
HRESULT ReturnAndFreeString(ASSOCF flags, LPWSTR out, DWORD *outlen, LPWSTR data, DWORD datalen)
STDMETHOD() GetData(ASSOCF flags, ASSOCDATA data, LPCWSTR pwszExtra, void *pvOut, DWORD *pcbOut) override
STDMETHOD() GetKey(ASSOCF flags, ASSOCKEY key, LPCWSTR pwszExtra, HKEY *phkeyOut) override
HRESULT DuplicateHKey(HKEY hKey, HKEY *phKey)
#define ERROR_INSUFFICIENT_BUFFER
LONG RegLoadMUIStringW(IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
#define HeapFree(x, y, z)
static const WCHAR *const ext[]
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
#define IS_INTRESOURCE(x)
void WINAPI PathRemoveExtensionW(WCHAR *path)
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
void WINAPI PathStripPathW(WCHAR *path)
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
WCHAR *WINAPI PathGetArgsW(const WCHAR *path)
BOOL WINAPI StrTrimW(WCHAR *str, const WCHAR *trim)
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
static const struct win_class_data classes[]
DWORD WINAPI SHQueryValueExW(HKEY hkey, const WCHAR *name, DWORD *reserved, DWORD *type, void *buff, DWORD *buff_len)
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey)
BOOL RegKeyExists(HKEY hKey, LPCWSTR Path)
static BOOL RegValueExists(HKEY hKey, LPCWSTR Name)
void WINAPI SHFree(LPVOID pv)
LPVOID WINAPI SHAlloc(SIZE_T len)
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
EXTERN_C HRESULT WINAPI AssocCreateElement(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppvObj)
#define ASSOCQUERY_COMMAND
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
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
int const JOCTET unsigned int datalen
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
#define LOCALE_USER_DEFAULT
@ ASSOCDATA_NOACTIVATEHANDLER
@ ASSOCDATA_QUERYCLASSSTORE
@ ASSOCSTR_SHELLEXTENSION
@ ASSOCSTR_FRIENDLYDOCNAME
@ ASSOCSTR_FRIENDLYAPPNAME
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
@ ASSOCF_INIT_DEFAULTTOSTAR
@ ASSOCF_PER_MACHINE_ONLY
@ ASSOCF_INIT_DEFAULTTOFOLDER
@ ASSOCF_INIT_NOREMAPCLSID
@ ASSOCF_INIT_IGNOREUNKNOWN
@ ASSOCKEY_SHELLEXECCLASS
_In_opt_ LPCSTR pszSubKey
EXTERN_C HRESULT WINAPI QuerySourceCreateFromKey(_In_ HKEY hKey, _In_opt_ PCWSTR lpSubKey, _In_ BOOL bCreate, _In_ REFIID riid, _Outptr_ PVOID *ppv)
BOOL HCR_GetDefaultVerbW(HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len)
HRESULT HCR_GetProgIdKeyOfExtension(PCWSTR szExtension, PHKEY phKey, BOOL AllowFallback)
static HRESULT SHELL_RegGetString(HKEY hKey, PCWSTR pszPath, PCWSTR pszName, PWSTR pszOut, DWORD cchMax)
#define IID_IObjectWithQuerySourceOld
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
void Attach(HKEY hNewKey)
HRESULT Initialize(ASSOCF fA, PCWSTR pszSource)
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
DWORD WINAPI GetLastError(void)
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
#define ERROR_NO_ASSOCIATION
#define HKEY_LOCAL_MACHINE
#define HKEY_CLASSES_ROOT
#define IID_PPV_ARG(Itype, ppType)