ReactOS 0.4.17-dev-683-g0dafdc5
assoc.c File Reference
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winreg.h"
#include "objbase.h"
#include "shlguid.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
Include dependency graph for assoc.c:

Go to the source code of this file.

Classes

struct  AssocPerceivedInfo
 

Macros

#define SHLWAPI_DEF_ASSOCF
 
#define HARDCODED_NATIVE_WMSDK   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_WMSDK)
 
#define HARDCODED_NATIVE_GDIPLUS   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_GDIPLUS)
 
#define HARDCODED_NATIVE_ZIPFLDR   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_ZIPFOLDER)
 
#define SOFTCODED_NATIVESUPPORT   (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static BOOL SHLWAPI_ParamAToW (LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR *lpszOut)
 
HRESULT WINAPI AssocCreate (CLSID clsid, REFIID refiid, void **lpInterface)
 
static const struct AssocPerceivedInfoAssocFindByBuiltinExtension (LPCWSTR pszExt)
 
static const struct AssocPerceivedInfoAssocFindByType (LPCWSTR pszType)
 
HRESULT WINAPI AssocGetPerceivedType (LPCWSTR lpszExt, PERCEIVED *lpType, INT *lpFlag, LPWSTR *lppszType)
 
HRESULT WINAPI AssocQueryKeyW (ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
 
HRESULT WINAPI AssocQueryKeyA (ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc, LPCSTR pszExtra, HKEY *phkeyOut)
 
HRESULT WINAPI AssocQueryStringW (ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
 
HRESULT WINAPI AssocQueryStringA (ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
 
HRESULT WINAPI AssocQueryStringByKeyW (ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
 
HRESULT WINAPI AssocQueryStringByKeyA (ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
 
BOOL WINAPI AssocIsDangerous (LPCWSTR lpszAssoc)
 

Variables

static const WCHAR unspecified_exts []
 
static const WCHAR image_exts []
 
static const WCHAR audio_exts []
 
static const WCHAR video_exts []
 
static const WCHAR compressed_exts []
 
static const WCHAR document_exts []
 
static const WCHAR system_exts []
 
static const WCHAR application_exts []
 
const WCHAR type_text [] = {'t','e','x','t',0}
 
const WCHAR type_image [] = {'i','m','a','g','e',0}
 
const WCHAR type_audio [] = {'a','u','d','i','o',0}
 
const WCHAR type_video [] = {'v','i','d','e','o',0}
 
const WCHAR type_compressed [] = {'c','o','m','p','r','e','s','s','e','d',0}
 
const WCHAR type_document [] = {'d','o','c','u','m','e','n','t',0}
 
const WCHAR type_system [] = {'s','y','s','t','e','m',0}
 
const WCHAR type_application [] = {'a','p','p','l','i','c','a','t','i','o','n',0}
 
static const struct AssocPerceivedInfo known_types []
 

Macro Definition Documentation

◆ HARDCODED_NATIVE_GDIPLUS

Definition at line 364 of file assoc.c.

◆ HARDCODED_NATIVE_WMSDK

Definition at line 363 of file assoc.c.

◆ HARDCODED_NATIVE_ZIPFLDR

Definition at line 365 of file assoc.c.

◆ SHLWAPI_DEF_ASSOCF

#define SHLWAPI_DEF_ASSOCF
Value:
@ ASSOCF_INIT_DEFAULTTOSTAR
Definition: shlwapi.h:862
@ ASSOCF_INIT_DEFAULTTOFOLDER
Definition: shlwapi.h:863
@ ASSOCF_INIT_BYEXENAME
Definition: shlwapi.h:860

Definition at line 46 of file assoc.c.

◆ SOFTCODED_NATIVESUPPORT

#define SOFTCODED_NATIVESUPPORT   (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)

Definition at line 366 of file assoc.c.

Function Documentation

◆ AssocCreate()

HRESULT WINAPI AssocCreate ( CLSID  clsid,
REFIID  refiid,
void **  lpInterface 
)

Definition at line 213 of file assoc.c.

214{
215 TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
216 lpInterface);
217
218 if (!lpInterface)
219 return E_INVALIDARG;
220
221#ifdef __REACTOS__
222 *(PVOID*)lpInterface = NULL;
223#else
224 *(DWORD*)lpInterface = 0;
225#endif
226
227#ifdef __REACTOS__
228 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations) &&
229 !IsEqualGUID(&clsid, &IID_IQueryAssociations))
230 {
232 return AssocCreateElement(&clsid, refiid, lpInterface);
234 }
235#else
236 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations))
238#endif
239
240 return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface );
241}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: shellole.c:197
EXTERN_C ULONG WINAPI GetProcessOsVersion(void)
Definition: utils.cpp:1257
EXTERN_C HRESULT WINAPI AssocCreateElement(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppvObj)
Definition: elements.cpp:1612
unsigned long DWORD
Definition: ntddk_ex.h:95
#define debugstr_guid
Definition: kernel32.h:35
const CLSID * clsid
Definition: msctf.cpp:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define TRACE(s)
Definition: solgame.cpp:4
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772

Referenced by CPrinterFolder::_AssocCreate(), AssocQ(), AssocQueryKeyW(), AssocQueryStringByKeyW(), AssocQueryStringW(), CCommonFolder< TSelf, TItemId, TExtractIcon >::GetUIObjectOf(), Init(), InitTest(), MyAssocCreateElement(), and SH32_AssocCreateElement().

◆ AssocFindByBuiltinExtension()

static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension ( LPCWSTR  pszExt)
static

Definition at line 380 of file assoc.c.

381{
382 UINT n;
383 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
384 {
385 PCWSTR Ext = known_types[n].Extensions;
386 while (Ext && *Ext)
387 {
388 if (!StrCmpIW(Ext, pszExt))
389 return &known_types[n];
390 Ext += (strlenW(Ext) + 1);
391 }
392 }
393 return NULL;
394}
int WINAPI StrCmpIW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:464
static const struct AssocPerceivedInfo known_types[]
Definition: assoc.c:368
GLdouble n
Definition: glext.h:7729
unsigned int UINT
Definition: sysinfo.c:13
static struct proto Ext[]
Definition: mkg3states.c:72
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define strlenW(s)
Definition: unicode.h:28

Referenced by AssocGetPerceivedType().

◆ AssocFindByType()

static const struct AssocPerceivedInfo * AssocFindByType ( LPCWSTR  pszType)
static

Definition at line 396 of file assoc.c.

397{
398 UINT n;
399 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
400 {
401 if (known_types[n].Type)
402 {
403 if (!StrCmpIW(known_types[n].Type, pszType))
404 return &known_types[n];
405 }
406 }
407 return NULL;
408}
Type
Definition: Type.h:7

Referenced by AssocGetPerceivedType().

◆ AssocGetPerceivedType()

HRESULT WINAPI AssocGetPerceivedType ( LPCWSTR  lpszExt,
PERCEIVED lpType,
INT lpFlag,
LPWSTR lppszType 
)

Definition at line 433 of file assoc.c.

435{
436 static const WCHAR PerceivedTypeKey[] = {'P','e','r','c','e','i','v','e','d','T','y','p','e',0};
437 static const WCHAR SystemFileAssociationsKey[] = {'S','y','s','t','e','m','F','i','l','e',
438 'A','s','s','o','c','i','a','t','i','o','n','s','\\','%','s',0};
439 const struct AssocPerceivedInfo *Info;
440
441 TRACE("(%s,%p,%p,%p)\n", debugstr_w(lpszExt), lpType, lpFlag, lppszType);
442
444 if (Info)
445 {
446 *lpType = Info->Perceived;
447 *lpFlag = Info->FlagHardcoded;
448 }
449 else
450 {
451 WCHAR Buffer[100] = { 0 };
452 DWORD Size = sizeof(Buffer);
453 if (RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
455 {
457 }
458 if (!Info)
459 {
460 WCHAR KeyName[MAX_PATH] = { 0 };
461 snprintfW(KeyName, MAX_PATH, SystemFileAssociationsKey, lpszExt);
462 Size = sizeof(Buffer);
463 if (RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
465 {
467 }
468 }
469 if (Info)
470 {
471 *lpType = Info->Perceived;
472 *lpFlag = Info->FlagSoftcoded;
473 }
474 }
475
476 if (Info)
477 {
478 if (lppszType && Info->Type)
479 {
480 return SHStrDupW(Info->Type, lppszType);
481 }
482 return Info->Type ? S_OK : E_FAIL;
483 }
484 else
485 {
487 *lpFlag = 0;
488 }
490}
Definition: bufpool.h:45
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
Definition: main.c:1692
static const struct AssocPerceivedInfo * AssocFindByType(LPCWSTR pszType)
Definition: assoc.c:396
static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension(LPCWSTR pszExt)
Definition: assoc.c:380
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
short WCHAR
Definition: pedump.c:58
@ PERCEIVED_TYPE_UNSPECIFIED
Definition: shtypes.idl:170
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2705
#define snprintfW
Definition: unicode.h:60
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define RRF_RT_REG_SZ
Definition: winreg.h:58
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by CAssocPerceivedElement::_InitSource().

◆ AssocIsDangerous()

BOOL WINAPI AssocIsDangerous ( LPCWSTR  lpszAssoc)

Definition at line 776 of file assoc.c.

777{
778 FIXME("%s\n", debugstr_w(lpszAssoc));
779 return FALSE;
780}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define FALSE
Definition: types.h:117

◆ AssocQueryKeyA()

HRESULT WINAPI AssocQueryKeyA ( ASSOCF  cfFlags,
ASSOCKEY  assockey,
LPCSTR  pszAssoc,
LPCSTR  pszExtra,
HKEY phkeyOut 
)

Definition at line 539 of file assoc.c.

541{
542 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
543 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
544 HRESULT hRet = E_OUTOFMEMORY;
545
546 TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc),
547 debugstr_a(pszExtra), phkeyOut);
548
549 if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
550 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
551 {
552 hRet = AssocQueryKeyW(cfFlags, assockey, lpszAssocW, lpszExtraW, phkeyOut);
553 }
554
555 if (lpszAssocW != szAssocW)
556 free(lpszAssocW);
557
558 if (lpszExtraW != szExtraW)
559 free(lpszExtraW);
560
561 return hRet;
562}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define free
Definition: debug_ros.c:5
static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR *lpszOut)
Definition: assoc.c:164
HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:497
#define debugstr_a
Definition: kernel32.h:31

◆ AssocQueryKeyW()

HRESULT WINAPI AssocQueryKeyW ( ASSOCF  cfFlags,
ASSOCKEY  assockey,
LPCWSTR  pszAssoc,
LPCWSTR  pszExtra,
HKEY phkeyOut 
)

Definition at line 497 of file assoc.c.

499{
500 HRESULT hRet;
501 IQueryAssociations* lpAssoc;
502
503 TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
504 debugstr_w(pszExtra), phkeyOut);
505
506 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
507 if (FAILED(hRet)) return hRet;
508
509#ifdef __REACTOS__
510 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, pszAssoc, NULL, NULL);
511#else
512 cfFlags &= SHLWAPI_DEF_ASSOCF;
513 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
514#endif
515
516 if (SUCCEEDED(hRet))
517 hRet = IQueryAssociations_GetKey(lpAssoc, cfFlags, assockey, pszExtra, phkeyOut);
518
520 return hRet;
521}
#define SHLWAPI_DEF_ASSOCF
Definition: assoc.c:46
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:213
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define IQueryAssociations_GetKey(p, a, b, c, d)
Definition: shlwapi.h:990
#define IQueryAssociations_Release(p)
Definition: shlwapi.h:987
#define IQueryAssociations_Init(p, a, b, c, d)
Definition: shlwapi.h:988

Referenced by AssocQueryKeyA(), GetAqkPath(), TEST_AssocF_Flags(), TEST_AssocKeys(), TEST_InvalidArgs(), TEST_PszAssoc(), and TEST_ShellExecClass().

◆ AssocQueryStringA()

HRESULT WINAPI AssocQueryStringA ( ASSOCF  cfFlags,
ASSOCSTR  str,
LPCSTR  pszAssoc,
LPCSTR  pszExtra,
LPSTR  pszOut,
DWORD pcchOut 
)

Definition at line 612 of file assoc.c.

614{
615 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
616 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
617 HRESULT hRet = E_OUTOFMEMORY;
618
619 TRACE("(0x%lx,0x%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc),
620 debugstr_a(pszExtra), pszOut, pcchOut);
621
622 if (!pcchOut)
623 hRet = E_UNEXPECTED;
624 else if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
625 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
626 {
627 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
628#ifdef __REACTOS__
629 DWORD dwLenOut = IS_INTRESOURCE(pcchOut) && LOBYTE(GetVersion()) < 6 ? PtrToUlong(pcchOut) : *pcchOut;
630#else
631 DWORD dwLenOut = *pcchOut;
632#endif
633
634 if (dwLenOut >= MAX_PATH)
635 lpszReturnW = malloc((dwLenOut + 1) * sizeof(WCHAR));
636 else
637 dwLenOut = ARRAY_SIZE(szReturnW);
638
639 if (!lpszReturnW)
640 hRet = E_OUTOFMEMORY;
641 else
642 {
643 hRet = AssocQueryStringW(cfFlags, str, lpszAssocW, lpszExtraW,
644 lpszReturnW, &dwLenOut);
645
646 if (SUCCEEDED(hRet))
647 dwLenOut = WideCharToMultiByte(CP_ACP, 0, lpszReturnW, -1,
648 pszOut, *pcchOut, NULL, NULL);
649
650#ifdef __REACTOS__
651 if (IS_INTRESOURCE(pcchOut))
652 pcchOut = &dwLenOut;
653#endif
654 *pcchOut = dwLenOut;
655 if (lpszReturnW != szReturnW)
656 free(lpszReturnW);
657 }
658 }
659
660 if (lpszAssocW != szAssocW)
661 free(lpszAssocW);
662 if (lpszExtraW != szExtraW)
663 free(lpszExtraW);
664 return hRet;
665}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define malloc
Definition: debug_ros.c:4
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define IS_INTRESOURCE(x)
Definition: loader.c:613
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:569
#define PtrToUlong(u)
Definition: config.h:107
#define LOBYTE(W)
Definition: jmemdos.c:487
const WCHAR * str
#define E_UNEXPECTED
Definition: winerror.h:3528

Referenced by TEST_AssocQueryStringA(), and TEST_TrickyPointers().

◆ AssocQueryStringByKeyA()

HRESULT WINAPI AssocQueryStringByKeyA ( ASSOCF  cfFlags,
ASSOCSTR  str,
HKEY  hkAssoc,
LPCSTR  pszExtra,
LPSTR  pszOut,
DWORD pcchOut 
)

Definition at line 717 of file assoc.c.

720{
721 WCHAR szExtraW[MAX_PATH], *lpszExtraW = szExtraW;
722 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
723 HRESULT hRet = E_OUTOFMEMORY;
724
725 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
726 debugstr_a(pszExtra), pszOut, pcchOut);
727
728 if (!pcchOut)
729 hRet = E_INVALIDARG;
730 else if (SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
731 {
732#ifdef __REACTOS__
733 DWORD dwLenOut = IS_INTRESOURCE(pcchOut) && LOBYTE(GetVersion()) < 6 ? PtrToUlong(pcchOut) : *pcchOut;
734#else
735 DWORD dwLenOut = *pcchOut;
736#endif
737 if (dwLenOut >= MAX_PATH)
738 lpszReturnW = malloc((dwLenOut + 1) * sizeof(WCHAR));
739
740 if (lpszReturnW)
741 {
742 hRet = AssocQueryStringByKeyW(cfFlags, str, hkAssoc, lpszExtraW,
743 lpszReturnW, &dwLenOut);
744
745 if (SUCCEEDED(hRet))
746 WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
747#ifdef __REACTOS__
748 if (IS_INTRESOURCE(pcchOut))
749 pcchOut = &dwLenOut;
750#endif
751 *pcchOut = dwLenOut;
752
753 if (lpszReturnW != szReturnW)
754 free(lpszReturnW);
755 }
756 }
757
758 if (lpszExtraW != szExtraW)
759 free(lpszExtraW);
760 return hRet;
761}
HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:672

◆ AssocQueryStringByKeyW()

HRESULT WINAPI AssocQueryStringByKeyW ( ASSOCF  cfFlags,
ASSOCSTR  str,
HKEY  hkAssoc,
LPCWSTR  pszExtra,
LPWSTR  pszOut,
DWORD pcchOut 
)

Definition at line 672 of file assoc.c.

675{
676 HRESULT hRet;
677 IQueryAssociations* lpAssoc;
678
679 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
680 debugstr_w(pszExtra), pszOut, pcchOut);
681
682 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
683 if (FAILED(hRet)) return hRet;
684
685#ifdef __REACTOS__
686 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, 0, hkAssoc, NULL);
687#else
688 cfFlags &= SHLWAPI_DEF_ASSOCF;
689 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
690#endif
691
692 if (SUCCEEDED(hRet))
693 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
694 pszOut, pcchOut);
695
697 return hRet;
698}
#define IQueryAssociations_GetString(p, a, b, c, d, e)
Definition: shlwapi.h:989

Referenced by AssocQueryStringByKeyA(), and SH32_InvokeOpenWith().

◆ AssocQueryStringW()

HRESULT WINAPI AssocQueryStringW ( ASSOCF  cfFlags,
ASSOCSTR  str,
LPCWSTR  pszAssoc,
LPCWSTR  pszExtra,
LPWSTR  pszOut,
DWORD pcchOut 
)

Definition at line 569 of file assoc.c.

571{
572 HRESULT hRet;
573 IQueryAssociations* lpAssoc;
574
575 TRACE("(0x%lx,%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc),
576 debugstr_w(pszExtra), pszOut, pcchOut);
577
578 if (!pcchOut)
579 return E_UNEXPECTED;
580
581 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
582 if (FAILED(hRet)) return hRet;
583
584 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF,
585 pszAssoc, NULL, NULL);
586
587 if (SUCCEEDED(hRet))
588 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
589 pszOut, pcchOut);
590
592 return hRet;
593}

Referenced by AQS(), AssocQueryStringA(), FindExecutableW(), GetProgramPath(), IsSelfShellVerb(), OpensWithExplorer(), ShellExecCmdLine(), TEST_AssocQueryStringW(), and TEST_TrickyPointers().

◆ SHLWAPI_ParamAToW()

static BOOL SHLWAPI_ParamAToW ( LPCSTR  lpszParam,
LPWSTR  lpszBuff,
DWORD  dwLen,
LPWSTR lpszOut 
)
static

Definition at line 164 of file assoc.c.

166{
167#ifdef __REACTOS__
168 if (!lpszParam && LOBYTE(GetVersion()) < 6)
169 lpszParam = ""; // NT5 incorrectly converts NULL to L""
170#endif
171 if (lpszParam)
172 {
173 DWORD dwStrLen = MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, NULL, 0);
174
175 if (dwStrLen < dwLen)
176 {
177 *lpszOut = lpszBuff; /* Use Buffer, it is big enough */
178 }
179 else
180 {
181 /* Create a new buffer big enough for the string */
182 *lpszOut = malloc(dwStrLen * sizeof(WCHAR));
183 if (!*lpszOut)
184 return FALSE;
185 }
186 MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, *lpszOut, dwStrLen);
187 }
188 else
189 *lpszOut = NULL;
190 return TRUE;
191}
#define TRUE
Definition: types.h:120
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by AssocQueryKeyA(), AssocQueryStringA(), and AssocQueryStringByKeyA().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ application_exts

const WCHAR application_exts[]
static
Initial value:
= {
'.','b','a','s',0,
'.','b','a','t',0,
'.','c','m','d',0,
'.','c','o','m',0,
'.','e','x','e',0,
'.','h','t','a',0,
'.','m','s','i',0,
'.','p','i','f',0,
'.','r','e','g',0,
'.','s','c','r',0,
'.','v','b',0,
0
}

Definition at line 339 of file assoc.c.

◆ audio_exts

const WCHAR audio_exts[]
static
Initial value:
= {
'.','a','i','f',0,
'.','a','i','f','c',0,
'.','a','i','f','f',0,
'.','a','u',0,
'.','m','3','u',0,
'.','m','i','d',0,
'.','m','i','d','i',0,
'.','m','p','3',0,
'.','r','m','i',0,
'.','s','n','d',0,
'.','w','a','v',0,
'.','w','a','x',0,
'.','w','m','a',0,
0
}

Definition at line 277 of file assoc.c.

◆ compressed_exts

const WCHAR compressed_exts[]
static
Initial value:
= {
'.','z','i','p',0,
0
}

Definition at line 320 of file assoc.c.

◆ document_exts

const WCHAR document_exts[]
static
Initial value:
= {
'.','m','h','t',0,
0
}

Definition at line 325 of file assoc.c.

◆ image_exts

const WCHAR image_exts[]
static
Initial value:
= {
'.','b','m','p',0,
'.','d','i','b',0,
'.','e','m','f',0,
'.','g','i','f',0,
'.','i','c','o',0,
'.','j','f','i','f',0,
'.','j','p','e',0,
'.','j','p','e','g',0,
'.','j','p','g',0,
'.','p','n','g',0,
'.','r','l','e',0,
'.','t','i','f',0,
'.','t','i','f','f',0,
'.','w','m','f',0,
0
}

Definition at line 259 of file assoc.c.

◆ known_types

const struct AssocPerceivedInfo known_types[]
static
Initial value:
= {
}
#define HARDCODED_NATIVE_ZIPFLDR
Definition: assoc.c:365
#define SOFTCODED_NATIVESUPPORT
Definition: assoc.c:366
static const WCHAR system_exts[]
Definition: assoc.c:334
const WCHAR type_compressed[]
Definition: assoc.c:358
static const WCHAR document_exts[]
Definition: assoc.c:325
const WCHAR type_document[]
Definition: assoc.c:359
const WCHAR type_video[]
Definition: assoc.c:357
const WCHAR type_image[]
Definition: assoc.c:355
static const WCHAR audio_exts[]
Definition: assoc.c:277
const WCHAR type_system[]
Definition: assoc.c:360
const WCHAR type_text[]
Definition: assoc.c:354
#define HARDCODED_NATIVE_WMSDK
Definition: assoc.c:363
const WCHAR type_application[]
Definition: assoc.c:361
static const WCHAR application_exts[]
Definition: assoc.c:339
static const WCHAR image_exts[]
Definition: assoc.c:259
#define HARDCODED_NATIVE_GDIPLUS
Definition: assoc.c:364
static const WCHAR video_exts[]
Definition: assoc.c:297
static const WCHAR compressed_exts[]
Definition: assoc.c:320
static const WCHAR unspecified_exts[]
Definition: assoc.c:253
const WCHAR type_audio[]
Definition: assoc.c:356
#define PERCEIVEDFLAG_HARDCODED
Definition: shtypes.idl:187
#define PERCEIVEDFLAG_SOFTCODED
Definition: shtypes.idl:186
@ PERCEIVED_TYPE_TEXT
Definition: shtypes.idl:173
@ PERCEIVED_TYPE_COMPRESSED
Definition: shtypes.idl:177
@ PERCEIVED_TYPE_SYSTEM
Definition: shtypes.idl:179
@ PERCEIVED_TYPE_DOCUMENT
Definition: shtypes.idl:178
@ PERCEIVED_TYPE_VIDEO
Definition: shtypes.idl:176
@ PERCEIVED_TYPE_IMAGE
Definition: shtypes.idl:174
@ PERCEIVED_TYPE_AUDIO
Definition: shtypes.idl:175
@ PERCEIVED_TYPE_APPLICATION
Definition: shtypes.idl:180

Definition at line 368 of file assoc.c.

Referenced by AssocFindByBuiltinExtension(), and AssocFindByType().

◆ system_exts

const WCHAR system_exts[]
static
Initial value:
= {
'.','c','p','l',0,
0
}

Definition at line 334 of file assoc.c.

◆ type_application

const WCHAR type_application[] = {'a','p','p','l','i','c','a','t','i','o','n',0}

Definition at line 361 of file assoc.c.

◆ type_audio

const WCHAR type_audio[] = {'a','u','d','i','o',0}

Definition at line 356 of file assoc.c.

◆ type_compressed

const WCHAR type_compressed[] = {'c','o','m','p','r','e','s','s','e','d',0}

Definition at line 358 of file assoc.c.

◆ type_document

const WCHAR type_document[] = {'d','o','c','u','m','e','n','t',0}

Definition at line 359 of file assoc.c.

◆ type_image

const WCHAR type_image[] = {'i','m','a','g','e',0}

Definition at line 355 of file assoc.c.

◆ type_system

const WCHAR type_system[] = {'s','y','s','t','e','m',0}

Definition at line 360 of file assoc.c.

◆ type_text

const WCHAR type_text[] = {'t','e','x','t',0}

Definition at line 354 of file assoc.c.

◆ type_video

const WCHAR type_video[] = {'v','i','d','e','o',0}

Definition at line 357 of file assoc.c.

◆ unspecified_exts

const WCHAR unspecified_exts[]
static
Initial value:
= {
'.','l','n','k',0,
'.','s','e','a','r','c','h','-','m','s',0,
0
}

Definition at line 253 of file assoc.c.

◆ video_exts

const WCHAR video_exts[]
static
Initial value:
= {
'.','a','s','f',0,
'.','a','s','x',0,
'.','a','v','i',0,
'.','d','v','r','-','m','s',0,
'.','I','V','F',0,
'.','m','1','v',0,
'.','m','p','2',0,
'.','m','p','2','v',0,
'.','m','p','a',0,
'.','m','p','e',0,
'.','m','p','e','g',0,
'.','m','p','g',0,
'.','m','p','v','2',0,
'.','w','m',0,
'.','w','m','v',0,
'.','w','m','x',0,
'.','w','v','x',0,
0
}

Definition at line 297 of file assoc.c.