ReactOS 0.4.17-dev-470-gf9e3448
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 255 of file assoc.c.

◆ HARDCODED_NATIVE_WMSDK

Definition at line 254 of file assoc.c.

◆ HARDCODED_NATIVE_ZIPFLDR

Definition at line 256 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 257 of file assoc.c.

Function Documentation

◆ AssocCreate()

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

Definition at line 104 of file assoc.c.

105{
106 TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
107 lpInterface);
108
109 if (!lpInterface)
110 return E_INVALIDARG;
111
112#ifdef __REACTOS__
113 *(PVOID*)lpInterface = NULL;
114#else
115 *(DWORD*)lpInterface = 0;
116#endif
117
118#ifdef __REACTOS__
119 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations) &&
120 !IsEqualGUID(&clsid, &IID_IQueryAssociations))
121 {
123 return AssocCreateElement(&clsid, refiid, lpInterface);
125 }
126#else
127 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations))
129#endif
130
131 return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface );
132}
#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:1635
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(), and MyAssocCreateElement().

◆ AssocFindByBuiltinExtension()

static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension ( LPCWSTR  pszExt)
static

Definition at line 271 of file assoc.c.

272{
273 UINT n;
274 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
275 {
276 PCWSTR Ext = known_types[n].Extensions;
277 while (Ext && *Ext)
278 {
279 if (!StrCmpIW(Ext, pszExt))
280 return &known_types[n];
281 Ext += (strlenW(Ext) + 1);
282 }
283 }
284 return NULL;
285}
int WINAPI StrCmpIW(const WCHAR *str, const WCHAR *comp)
Definition: string.c:464
static const struct AssocPerceivedInfo known_types[]
Definition: assoc.c:259
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 287 of file assoc.c.

288{
289 UINT n;
290 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
291 {
292 if (known_types[n].Type)
293 {
294 if (!StrCmpIW(known_types[n].Type, pszType))
295 return &known_types[n];
296 }
297 }
298 return NULL;
299}
Type
Definition: Type.h:7

Referenced by AssocGetPerceivedType().

◆ AssocGetPerceivedType()

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

Definition at line 324 of file assoc.c.

326{
327 static const WCHAR PerceivedTypeKey[] = {'P','e','r','c','e','i','v','e','d','T','y','p','e',0};
328 static const WCHAR SystemFileAssociationsKey[] = {'S','y','s','t','e','m','F','i','l','e',
329 'A','s','s','o','c','i','a','t','i','o','n','s','\\','%','s',0};
330 const struct AssocPerceivedInfo *Info;
331
332 TRACE("(%s,%p,%p,%p)\n", debugstr_w(lpszExt), lpType, lpFlag, lppszType);
333
335 if (Info)
336 {
337 *lpType = Info->Perceived;
338 *lpFlag = Info->FlagHardcoded;
339 }
340 else
341 {
342 WCHAR Buffer[100] = { 0 };
343 DWORD Size = sizeof(Buffer);
344 if (RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
346 {
348 }
349 if (!Info)
350 {
351 WCHAR KeyName[MAX_PATH] = { 0 };
352 snprintfW(KeyName, MAX_PATH, SystemFileAssociationsKey, lpszExt);
353 Size = sizeof(Buffer);
354 if (RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
356 {
358 }
359 }
360 if (Info)
361 {
362 *lpType = Info->Perceived;
363 *lpFlag = Info->FlagSoftcoded;
364 }
365 }
366
367 if (Info)
368 {
369 if (lppszType && Info->Type)
370 {
371 return SHStrDupW(Info->Type, lppszType);
372 }
373 return Info->Type ? S_OK : E_FAIL;
374 }
375 else
376 {
378 *lpFlag = 0;
379 }
381}
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:287
static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension(LPCWSTR pszExt)
Definition: assoc.c:271
#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 651 of file assoc.c.

652{
653 FIXME("%s\n", debugstr_w(lpszAssoc));
654 return FALSE;
655}
#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 430 of file assoc.c.

432{
433 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
434 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
435 HRESULT hRet = E_OUTOFMEMORY;
436
437 TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc),
438 debugstr_a(pszExtra), phkeyOut);
439
440 if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
441 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
442 {
443 hRet = AssocQueryKeyW(cfFlags, assockey, lpszAssocW, lpszExtraW, phkeyOut);
444 }
445
446 if (lpszAssocW != szAssocW)
447 free(lpszAssocW);
448
449 if (lpszExtraW != szExtraW)
450 free(lpszExtraW);
451
452 return hRet;
453}
#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:59
HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:388
#define debugstr_a
Definition: kernel32.h:31

◆ AssocQueryKeyW()

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

Definition at line 388 of file assoc.c.

390{
391 HRESULT hRet;
392 IQueryAssociations* lpAssoc;
393
394 TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
395 debugstr_w(pszExtra), phkeyOut);
396
397 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
398 if (FAILED(hRet)) return hRet;
399
400#ifdef __REACTOS__
401 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, pszAssoc, NULL, NULL);
402#else
403 cfFlags &= SHLWAPI_DEF_ASSOCF;
404 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
405#endif
406
407 if (SUCCEEDED(hRet))
408 hRet = IQueryAssociations_GetKey(lpAssoc, cfFlags, assockey, pszExtra, phkeyOut);
409
411 return hRet;
412}
#define SHLWAPI_DEF_ASSOCF
Definition: assoc.c:46
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:104
#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(), TEST_AssocF_Flags(), TEST_AssocKeys(), TEST_ByExeName(), 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 503 of file assoc.c.

505{
506 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
507 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
508 HRESULT hRet = E_OUTOFMEMORY;
509
510 TRACE("(0x%lx,0x%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc),
511 debugstr_a(pszExtra), pszOut, pcchOut);
512
513 if (!pcchOut)
514 hRet = E_UNEXPECTED;
515 else if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
516 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
517 {
518 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
519 DWORD dwLenOut = *pcchOut;
520
521 if (dwLenOut >= MAX_PATH)
522 lpszReturnW = malloc((dwLenOut + 1) * sizeof(WCHAR));
523 else
524 dwLenOut = ARRAY_SIZE(szReturnW);
525
526 if (!lpszReturnW)
527 hRet = E_OUTOFMEMORY;
528 else
529 {
530 hRet = AssocQueryStringW(cfFlags, str, lpszAssocW, lpszExtraW,
531 lpszReturnW, &dwLenOut);
532
533 if (SUCCEEDED(hRet))
534 dwLenOut = WideCharToMultiByte(CP_ACP, 0, lpszReturnW, -1,
535 pszOut, *pcchOut, NULL, NULL);
536
537 *pcchOut = dwLenOut;
538 if (lpszReturnW != szReturnW)
539 free(lpszReturnW);
540 }
541 }
542
543 if (lpszAssocW != szAssocW)
544 free(lpszAssocW);
545 if (lpszExtraW != szExtraW)
546 free(lpszExtraW);
547 return hRet;
548}
#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
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:460
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 600 of file assoc.c.

603{
604 WCHAR szExtraW[MAX_PATH], *lpszExtraW = szExtraW;
605 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
606 HRESULT hRet = E_OUTOFMEMORY;
607
608 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
609 debugstr_a(pszExtra), pszOut, pcchOut);
610
611 if (!pcchOut)
612 hRet = E_INVALIDARG;
613 else if (SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
614 {
615 DWORD dwLenOut = *pcchOut;
616 if (dwLenOut >= MAX_PATH)
617 lpszReturnW = malloc((dwLenOut + 1) * sizeof(WCHAR));
618
619 if (lpszReturnW)
620 {
621 hRet = AssocQueryStringByKeyW(cfFlags, str, hkAssoc, lpszExtraW,
622 lpszReturnW, &dwLenOut);
623
624 if (SUCCEEDED(hRet))
625 WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
626 *pcchOut = dwLenOut;
627
628 if (lpszReturnW != szReturnW)
629 free(lpszReturnW);
630 }
631 }
632
633 if (lpszExtraW != szExtraW)
634 free(lpszExtraW);
635 return hRet;
636}
HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:555

◆ AssocQueryStringByKeyW()

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

Definition at line 555 of file assoc.c.

558{
559 HRESULT hRet;
560 IQueryAssociations* lpAssoc;
561
562 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
563 debugstr_w(pszExtra), pszOut, pcchOut);
564
565 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
566 if (FAILED(hRet)) return hRet;
567
568#ifdef __REACTOS__
569 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, 0, hkAssoc, NULL);
570#else
571 cfFlags &= SHLWAPI_DEF_ASSOCF;
572 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
573#endif
574
575 if (SUCCEEDED(hRet))
576 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
577 pszOut, pcchOut);
578
580 return hRet;
581}
#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 460 of file assoc.c.

462{
463 HRESULT hRet;
464 IQueryAssociations* lpAssoc;
465
466 TRACE("(0x%lx,%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc),
467 debugstr_w(pszExtra), pszOut, pcchOut);
468
469 if (!pcchOut)
470 return E_UNEXPECTED;
471
472 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
473 if (FAILED(hRet)) return hRet;
474
475 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF,
476 pszAssoc, NULL, NULL);
477
478 if (SUCCEEDED(hRet))
479 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
480 pszOut, pcchOut);
481
483 return hRet;
484}

Referenced by 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 59 of file assoc.c.

61{
62 if (lpszParam)
63 {
64 DWORD dwStrLen = MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, NULL, 0);
65
66 if (dwStrLen < dwLen)
67 {
68 *lpszOut = lpszBuff; /* Use Buffer, it is big enough */
69 }
70 else
71 {
72 /* Create a new buffer big enough for the string */
73 *lpszOut = malloc(dwStrLen * sizeof(WCHAR));
74 if (!*lpszOut)
75 return FALSE;
76 }
77 MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, *lpszOut, dwStrLen);
78 }
79 else
80 *lpszOut = NULL;
81 return TRUE;
82}
#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 230 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 168 of file assoc.c.

◆ compressed_exts

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

Definition at line 211 of file assoc.c.

◆ document_exts

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

Definition at line 216 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 150 of file assoc.c.

◆ known_types

const struct AssocPerceivedInfo known_types[]
static
Initial value:
= {
}
#define HARDCODED_NATIVE_ZIPFLDR
Definition: assoc.c:256
#define SOFTCODED_NATIVESUPPORT
Definition: assoc.c:257
static const WCHAR system_exts[]
Definition: assoc.c:225
const WCHAR type_compressed[]
Definition: assoc.c:249
static const WCHAR document_exts[]
Definition: assoc.c:216
const WCHAR type_document[]
Definition: assoc.c:250
const WCHAR type_video[]
Definition: assoc.c:248
const WCHAR type_image[]
Definition: assoc.c:246
static const WCHAR audio_exts[]
Definition: assoc.c:168
const WCHAR type_system[]
Definition: assoc.c:251
const WCHAR type_text[]
Definition: assoc.c:245
#define HARDCODED_NATIVE_WMSDK
Definition: assoc.c:254
const WCHAR type_application[]
Definition: assoc.c:252
static const WCHAR application_exts[]
Definition: assoc.c:230
static const WCHAR image_exts[]
Definition: assoc.c:150
#define HARDCODED_NATIVE_GDIPLUS
Definition: assoc.c:255
static const WCHAR video_exts[]
Definition: assoc.c:188
static const WCHAR compressed_exts[]
Definition: assoc.c:211
static const WCHAR unspecified_exts[]
Definition: assoc.c:144
const WCHAR type_audio[]
Definition: assoc.c:247
#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 259 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 225 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 252 of file assoc.c.

◆ type_audio

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

Definition at line 247 of file assoc.c.

◆ type_compressed

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

Definition at line 249 of file assoc.c.

◆ type_document

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

Definition at line 250 of file assoc.c.

◆ type_image

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

Definition at line 246 of file assoc.c.

◆ type_system

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

Definition at line 251 of file assoc.c.

◆ type_text

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

Definition at line 245 of file assoc.c.

◆ type_video

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

Definition at line 248 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 144 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 188 of file assoc.c.