ReactOS 0.4.15-dev-8393-g61b7fb9
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

#define HARDCODED_NATIVE_GDIPLUS   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_GDIPLUS)

Definition at line 235 of file assoc.c.

◆ HARDCODED_NATIVE_WMSDK

#define HARDCODED_NATIVE_WMSDK   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_WMSDK)

Definition at line 234 of file assoc.c.

◆ HARDCODED_NATIVE_ZIPFLDR

#define HARDCODED_NATIVE_ZIPFLDR   (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_ZIPFOLDER)

Definition at line 236 of file assoc.c.

◆ SHLWAPI_DEF_ASSOCF

#define SHLWAPI_DEF_ASSOCF
Value:
@ ASSOCF_INIT_DEFAULTTOSTAR
Definition: shlwapi.h:585
@ ASSOCF_INIT_DEFAULTTOFOLDER
Definition: shlwapi.h:586
@ ASSOCF_INIT_BYEXENAME
Definition: shlwapi.h:583

Definition at line 45 of file assoc.c.

◆ SOFTCODED_NATIVESUPPORT

#define SOFTCODED_NATIVESUPPORT   (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)

Definition at line 237 of file assoc.c.

Function Documentation

◆ AssocCreate()

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

Definition at line 98 of file assoc.c.

99{
100 TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
101 lpInterface);
102
103 if (!lpInterface)
104 return E_INVALIDARG;
105
106 *(DWORD*)lpInterface = 0;
107
108 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations))
110
111 return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface );
112}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
unsigned long DWORD
Definition: ntddk_ex.h:95
#define debugstr_guid
Definition: kernel32.h:35
REFCLSID clsid
Definition: msctf.c:82
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define TRACE(s)
Definition: solgame.cpp:4
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

Referenced by AssocQ(), AssocQueryKeyW(), AssocQueryStringByKeyW(), AssocQueryStringW(), and CCommonFolder< TSelf, TItemId, TExtractIcon >::GetUIObjectOf().

◆ AssocFindByBuiltinExtension()

static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension ( LPCWSTR  pszExt)
static

Definition at line 251 of file assoc.c.

252{
253 UINT n;
254 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
255 {
256 PCWSTR Ext = known_types[n].Extensions;
257 while (Ext && *Ext)
258 {
259 if (!StrCmpIW(Ext, pszExt))
260 return &known_types[n];
261 Ext += (strlenW(Ext) + 1);
262 }
263 }
264 return NULL;
265}
static const struct AssocPerceivedInfo known_types[]
Definition: assoc.c:239
int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:353
GLdouble n
Definition: glext.h:7729
static struct proto Ext[]
Definition: mkg3states.c:87
unsigned int UINT
Definition: ndis.h:50
#define strlenW(s)
Definition: unicode.h:34
const uint16_t * PCWSTR
Definition: typedefs.h:57

Referenced by AssocGetPerceivedType().

◆ AssocFindByType()

static const struct AssocPerceivedInfo * AssocFindByType ( LPCWSTR  pszType)
static

Definition at line 267 of file assoc.c.

268{
269 UINT n;
270 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
271 {
272 if (known_types[n].Type)
273 {
274 if (!StrCmpIW(known_types[n].Type, pszType))
275 return &known_types[n];
276 }
277 }
278 return NULL;
279}
Type
Definition: Type.h:7

Referenced by AssocGetPerceivedType().

◆ AssocGetPerceivedType()

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

Definition at line 304 of file assoc.c.

306{
307 static const WCHAR PerceivedTypeKey[] = {'P','e','r','c','e','i','v','e','d','T','y','p','e',0};
308 static const WCHAR SystemFileAssociationsKey[] = {'S','y','s','t','e','m','F','i','l','e',
309 'A','s','s','o','c','i','a','t','i','o','n','s','\\','%','s',0};
310 const struct AssocPerceivedInfo *Info;
311
312 TRACE("(%s,%p,%p,%p)\n", debugstr_w(lpszExt), lpType, lpFlag, lppszType);
313
315 if (Info)
316 {
317 *lpType = Info->Perceived;
318 *lpFlag = Info->FlagHardcoded;
319 }
320 else
321 {
322 WCHAR Buffer[100] = { 0 };
323 DWORD Size = sizeof(Buffer);
324 if (RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
326 {
328 }
329 if (!Info)
330 {
331 WCHAR KeyName[MAX_PATH] = { 0 };
332 snprintfW(KeyName, MAX_PATH, SystemFileAssociationsKey, lpszExt);
333 Size = sizeof(Buffer);
334 if (RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
336 {
338 }
339 }
340 if (Info)
341 {
342 *lpType = Info->Perceived;
343 *lpFlag = Info->FlagSoftcoded;
344 }
345 }
346
347 if (Info)
348 {
349 if (lppszType && Info->Type)
350 {
351 return SHStrDupW(Info->Type, lppszType);
352 }
353 return Info->Type ? S_OK : E_FAIL;
354 }
355 else
356 {
358 *lpFlag = 0;
359 }
361}
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
#define RRF_RT_REG_SZ
Definition: driver.c:575
static const struct AssocPerceivedInfo * AssocFindByType(LPCWSTR pszType)
Definition: assoc.c:267
static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension(LPCWSTR pszExt)
Definition: assoc.c:251
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2012
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define snprintfW
Definition: unicode.h:66
@ 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:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ AssocIsDangerous()

BOOL WINAPI AssocIsDangerous ( LPCWSTR  lpszAssoc)

Definition at line 625 of file assoc.c.

626{
627 FIXME("%s\n", debugstr_w(lpszAssoc));
628 return FALSE;
629}
#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 406 of file assoc.c.

408{
409 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
410 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
411 HRESULT hRet = E_OUTOFMEMORY;
412
413 TRACE("(0x%x,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc),
414 debugstr_a(pszExtra), phkeyOut);
415
416 if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
417 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
418 {
419 hRet = AssocQueryKeyW(cfFlags, assockey, lpszAssocW, lpszExtraW, phkeyOut);
420 }
421
422 if (lpszAssocW != szAssocW)
423 HeapFree(GetProcessHeap(), 0, lpszAssocW);
424
425 if (lpszExtraW != szExtraW)
426 HeapFree(GetProcessHeap(), 0, lpszExtraW);
427
428 return hRet;
429}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR *lpszOut)
Definition: assoc.c:54
HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:368
#define debugstr_a
Definition: kernel32.h:31

◆ AssocQueryKeyW()

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

Definition at line 368 of file assoc.c.

370{
371 HRESULT hRet;
372 IQueryAssociations* lpAssoc;
373
374 TRACE("(0x%x,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
375 debugstr_w(pszExtra), phkeyOut);
376
377 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
378 if (FAILED(hRet)) return hRet;
379
380 cfFlags &= SHLWAPI_DEF_ASSOCF;
381 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
382
383 if (SUCCEEDED(hRet))
384 hRet = IQueryAssociations_GetKey(lpAssoc, cfFlags, assockey, pszExtra, phkeyOut);
385
387 return hRet;
388}
#define SHLWAPI_DEF_ASSOCF
Definition: assoc.c:45
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:98
#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:671
#define IQueryAssociations_Release(p)
Definition: shlwapi.h:668
#define IQueryAssociations_Init(p, a, b, c, d)
Definition: shlwapi.h:669

Referenced by AssocQueryKeyA().

◆ AssocQueryStringA()

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

Definition at line 479 of file assoc.c.

481{
482 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
483 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
484 HRESULT hRet = E_OUTOFMEMORY;
485
486 TRACE("(0x%x,0x%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc),
487 debugstr_a(pszExtra), pszOut, pcchOut);
488
489 if (!pcchOut)
490 hRet = E_UNEXPECTED;
491 else if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
492 SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
493 {
494 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
495 DWORD dwLenOut = *pcchOut;
496
497 if (dwLenOut >= MAX_PATH)
498 lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
499 (dwLenOut + 1) * sizeof(WCHAR));
500 else
501 dwLenOut = sizeof(szReturnW) / sizeof(szReturnW[0]);
502
503 if (!lpszReturnW)
504 hRet = E_OUTOFMEMORY;
505 else
506 {
507 hRet = AssocQueryStringW(cfFlags, str, lpszAssocW, lpszExtraW,
508 lpszReturnW, &dwLenOut);
509
510 if (SUCCEEDED(hRet))
511 dwLenOut = WideCharToMultiByte(CP_ACP, 0, lpszReturnW, -1,
512 pszOut, *pcchOut, NULL, NULL);
513
514 *pcchOut = dwLenOut;
515 if (lpszReturnW != szReturnW)
516 HeapFree(GetProcessHeap(), 0, lpszReturnW);
517 }
518 }
519
520 if (lpszAssocW != szAssocW)
521 HeapFree(GetProcessHeap(), 0, lpszAssocW);
522 if (lpszExtraW != szExtraW)
523 HeapFree(GetProcessHeap(), 0, lpszExtraW);
524 return hRet;
525}
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:436
const WCHAR * str
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by TEST_AssocQueryStringA().

◆ AssocQueryStringByKeyA()

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

Definition at line 573 of file assoc.c.

576{
577 WCHAR szExtraW[MAX_PATH], *lpszExtraW = szExtraW;
578 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
579 HRESULT hRet = E_OUTOFMEMORY;
580
581 TRACE("(0x%x,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
582 debugstr_a(pszExtra), pszOut, pcchOut);
583
584 if (!pcchOut)
585 hRet = E_INVALIDARG;
586 else if (SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
587 {
588 DWORD dwLenOut = *pcchOut;
589 if (dwLenOut >= MAX_PATH)
590 lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
591 (dwLenOut + 1) * sizeof(WCHAR));
592
593 if (lpszReturnW)
594 {
595 hRet = AssocQueryStringByKeyW(cfFlags, str, hkAssoc, lpszExtraW,
596 lpszReturnW, &dwLenOut);
597
598 if (SUCCEEDED(hRet))
599 WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
600 *pcchOut = dwLenOut;
601
602 if (lpszReturnW != szReturnW)
603 HeapFree(GetProcessHeap(), 0, lpszReturnW);
604 }
605 }
606
607 if (lpszExtraW != szExtraW)
608 HeapFree(GetProcessHeap(), 0, lpszExtraW);
609 return hRet;
610}
HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:532

◆ AssocQueryStringByKeyW()

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

Definition at line 532 of file assoc.c.

535{
536 HRESULT hRet;
537 IQueryAssociations* lpAssoc;
538
539 TRACE("(0x%x,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
540 debugstr_w(pszExtra), pszOut, pcchOut);
541
542 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
543 if (FAILED(hRet)) return hRet;
544
545 cfFlags &= SHLWAPI_DEF_ASSOCF;
546 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
547
548 if (SUCCEEDED(hRet))
549 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
550 pszOut, pcchOut);
551
553 return hRet;
554}
#define IQueryAssociations_GetString(p, a, b, c, d, e)
Definition: shlwapi.h:670

Referenced by AssocQueryStringByKeyA().

◆ AssocQueryStringW()

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

Definition at line 436 of file assoc.c.

438{
439 HRESULT hRet;
440 IQueryAssociations* lpAssoc;
441
442 TRACE("(0x%x,%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc),
443 debugstr_w(pszExtra), pszOut, pcchOut);
444
445 if (!pcchOut)
446 return E_UNEXPECTED;
447
448 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
449 if (FAILED(hRet)) return hRet;
450
451 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF,
452 pszAssoc, NULL, NULL);
453
454 if (SUCCEEDED(hRet))
455 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
456 pszOut, pcchOut);
457
459 return hRet;
460}

Referenced by AssocQueryStringA(), FileTypesDlg_InsertToLV(), FileTypesDlg_UpdateAppInfo(), FindExecutableW(), ShellExecCmdLine(), and TEST_AssocQueryStringW().

◆ SHLWAPI_ParamAToW()

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

Definition at line 54 of file assoc.c.

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

◆ compressed_exts

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

Definition at line 191 of file assoc.c.

◆ document_exts

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

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

◆ known_types

const struct AssocPerceivedInfo known_types[]
static
Initial value:
= {
{ NULL, PERCEIVED_TYPE_UNSPECIFIED, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, unspecified_exts },
{ type_text, PERCEIVED_TYPE_TEXT, PERCEIVEDFLAG_HARDCODED, SOFTCODED_NATIVESUPPORT, NULL },
{ type_document, PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, document_exts },
{ type_system, PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, system_exts },
{ type_application, PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, application_exts },
}
#define HARDCODED_NATIVE_ZIPFLDR
Definition: assoc.c:236
#define SOFTCODED_NATIVESUPPORT
Definition: assoc.c:237
static const WCHAR system_exts[]
Definition: assoc.c:205
const WCHAR type_compressed[]
Definition: assoc.c:229
static const WCHAR document_exts[]
Definition: assoc.c:196
const WCHAR type_document[]
Definition: assoc.c:230
const WCHAR type_video[]
Definition: assoc.c:228
const WCHAR type_image[]
Definition: assoc.c:226
static const WCHAR audio_exts[]
Definition: assoc.c:148
const WCHAR type_system[]
Definition: assoc.c:231
const WCHAR type_text[]
Definition: assoc.c:225
#define HARDCODED_NATIVE_WMSDK
Definition: assoc.c:234
const WCHAR type_application[]
Definition: assoc.c:232
static const WCHAR application_exts[]
Definition: assoc.c:210
static const WCHAR image_exts[]
Definition: assoc.c:130
#define HARDCODED_NATIVE_GDIPLUS
Definition: assoc.c:235
static const WCHAR video_exts[]
Definition: assoc.c:168
static const WCHAR compressed_exts[]
Definition: assoc.c:191
static const WCHAR unspecified_exts[]
Definition: assoc.c:124
const WCHAR type_audio[]
Definition: assoc.c:227
@ 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 239 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 205 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 232 of file assoc.c.

◆ type_audio

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

Definition at line 227 of file assoc.c.

◆ type_compressed

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

Definition at line 229 of file assoc.c.

◆ type_document

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

Definition at line 230 of file assoc.c.

◆ type_image

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

Definition at line 226 of file assoc.c.

◆ type_system

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

Definition at line 231 of file assoc.c.

◆ type_text

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

Definition at line 225 of file assoc.c.

◆ type_video

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

Definition at line 228 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 124 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 168 of file assoc.c.