ReactOS 0.4.17-dev-470-gf9e3448
assoc.c
Go to the documentation of this file.
1/*
2 * IQueryAssociations helper functions
3 *
4 * Copyright 2002 Jon Griffiths
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20#include <stdarg.h>
21#include <assert.h>
22
23#include "windef.h"
24#include "winbase.h"
25#include "winnls.h"
26#include "winreg.h"
27#include "objbase.h"
28#include "shlguid.h"
29#include "shlobj.h"
30#include "shlwapi.h"
31#ifdef __REACTOS__
32#include "shlwapi_undoc.h"
33#include "evalcmd.h"
34#endif
35#include "wine/unicode.h"
36#include "wine/debug.h"
37
39
40/* Default IQueryAssociations::Init() flags */
41#ifdef __REACTOS__
42#define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME | ASSOCF_INIT_DEFAULTTOSTAR | \
43 ASSOCF_INIT_DEFAULTTOFOLDER | ASSOCF_INIT_NOREMAPCLSID | \
44 ASSOCF_INIT_IGNOREUNKNOWN)
45#else
46#define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME|ASSOCF_INIT_DEFAULTTOSTAR| \
47 ASSOCF_INIT_DEFAULTTOFOLDER)
48#endif
49
50#ifdef __REACTOS__
51EXTERN_C ULONG WINAPI GetProcessOsVersion(void); // FIXME: Move or delete
52#endif
53
54/*************************************************************************
55 * SHLWAPI_ParamAToW
56 *
57 * Internal helper function: Convert ANSI parameter to Unicode.
58 */
59static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen,
60 LPWSTR* lpszOut)
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}
83
84/*************************************************************************
85 * AssocCreate [SHLWAPI.@]
86 *
87 * Create a new IQueryAssociations object.
88 *
89 * PARAMS
90 * clsid [I] CLSID of object
91 * refiid [I] REFIID of interface
92 * lpInterface [O] Destination for the created IQueryAssociations object
93 *
94 * RETURNS
95 * Success: S_OK. lpInterface contains the new object.
96 * Failure: An HRESULT error code indicating the error.
97 *
98#ifndef __REACTOS__ // WRONG NOTES!
99 * NOTES
100 * clsid must be equal to CLSID_QueryAssociations and
101 * refiid must be equal to IID_IQueryAssociations, IID_IUnknown or this function will fail
102#endif
103 */
104HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
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}
133
134
136{
142};
143
144static const WCHAR unspecified_exts[] = {
145 '.','l','n','k',0,
146 '.','s','e','a','r','c','h','-','m','s',0,
147 0
148};
149
150static const WCHAR image_exts[] = {
151 '.','b','m','p',0,
152 '.','d','i','b',0,
153 '.','e','m','f',0,
154 '.','g','i','f',0,
155 '.','i','c','o',0,
156 '.','j','f','i','f',0,
157 '.','j','p','e',0,
158 '.','j','p','e','g',0,
159 '.','j','p','g',0,
160 '.','p','n','g',0,
161 '.','r','l','e',0,
162 '.','t','i','f',0,
163 '.','t','i','f','f',0,
164 '.','w','m','f',0,
165 0
166};
167
168static const WCHAR audio_exts[] = {
169 '.','a','i','f',0,
170 '.','a','i','f','c',0,
171 '.','a','i','f','f',0,
172 '.','a','u',0,
173 '.','m','3','u',0,
174 '.','m','i','d',0,
175 '.','m','i','d','i',0,
176#if _WIN32_WINNT > 0x602
177 '.','m','p','2',0,
178#endif
179 '.','m','p','3',0,
180 '.','r','m','i',0,
181 '.','s','n','d',0,
182 '.','w','a','v',0,
183 '.','w','a','x',0,
184 '.','w','m','a',0,
185 0
186};
187
188static const WCHAR video_exts[] = {
189 '.','a','s','f',0,
190 '.','a','s','x',0,
191 '.','a','v','i',0,
192 '.','d','v','r','-','m','s',0,
193 '.','I','V','F',0,
194 '.','m','1','v',0,
195#if _WIN32_WINNT <= 0x602
196 '.','m','p','2',0,
197#endif
198 '.','m','p','2','v',0,
199 '.','m','p','a',0,
200 '.','m','p','e',0,
201 '.','m','p','e','g',0,
202 '.','m','p','g',0,
203 '.','m','p','v','2',0,
204 '.','w','m',0,
205 '.','w','m','v',0,
206 '.','w','m','x',0,
207 '.','w','v','x',0,
208 0
209};
210
211static const WCHAR compressed_exts[] = {
212 '.','z','i','p',0,
213 0
214};
215
216static const WCHAR document_exts[] = {
217#if _WIN32_WINNT >= 0x600
218 '.','h','t','m',0,
219 '.','h','t','m','l',0,
220#endif
221 '.','m','h','t',0,
222 0
223};
224
225static const WCHAR system_exts[] = {
226 '.','c','p','l',0,
227 0
228};
229
230static const WCHAR application_exts[] = {
231 '.','b','a','s',0,
232 '.','b','a','t',0,
233 '.','c','m','d',0,
234 '.','c','o','m',0,
235 '.','e','x','e',0,
236 '.','h','t','a',0,
237 '.','m','s','i',0,
238 '.','p','i','f',0,
239 '.','r','e','g',0,
240 '.','s','c','r',0,
241 '.','v','b',0,
242 0
243};
244
245const WCHAR type_text[] = {'t','e','x','t',0};
246const WCHAR type_image[] = {'i','m','a','g','e',0};
247const WCHAR type_audio[] = {'a','u','d','i','o',0};
248const WCHAR type_video[] = {'v','i','d','e','o',0};
249const WCHAR type_compressed[] = {'c','o','m','p','r','e','s','s','e','d',0};
250const WCHAR type_document[] = {'d','o','c','u','m','e','n','t',0};
251const WCHAR type_system[] = {'s','y','s','t','e','m',0};
252const WCHAR type_application[] = {'a','p','p','l','i','c','a','t','i','o','n',0};
253
254#define HARDCODED_NATIVE_WMSDK (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_WMSDK)
255#define HARDCODED_NATIVE_GDIPLUS (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_GDIPLUS)
256#define HARDCODED_NATIVE_ZIPFLDR (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_ZIPFOLDER)
257#define SOFTCODED_NATIVESUPPORT (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)
258
259static const struct AssocPerceivedInfo known_types[] = {
269};
270
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}
286
287static const struct AssocPerceivedInfo* AssocFindByType(LPCWSTR pszType)
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}
300
301
302/*************************************************************************
303 * AssocGetPerceivedType [SHLWAPI.@]
304 *
305 * Detect the type of a file by inspecting its extension
306 *
307 * PARAMS
308 * lpszExt [I] File extension to evaluate.
309 * lpType [O] Pointer to perceived type
310 * lpFlag [O] Pointer to perceived type flag
311 * lppszType [O] Address to pointer for perceived type text
312 *
313 * RETURNS
314 * Success: S_OK. lpType and lpFlag contain the perceived type and
315 * its information. If lppszType is not NULL, it will point
316 * to a string with perceived type text.
317 * Failure: An HRESULT error code indicating the error.
318 *
319 * NOTES
320 * lppszType is optional and it can be NULL.
321 * if lpType or lpFlag are NULL, the function will crash.
322 * if lpszExt is NULL, an error is returned.
323 */
325 INT *lpFlag, LPWSTR *lppszType)
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}
382
383/*************************************************************************
384 * AssocQueryKeyW [SHLWAPI.@]
385 *
386 * See AssocQueryKeyA.
387 */
389 LPCWSTR pszExtra, HKEY *phkeyOut)
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}
413
414/*************************************************************************
415 * AssocQueryKeyA [SHLWAPI.@]
416 *
417 * Get a file association key from the registry.
418 *
419 * PARAMS
420 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
421 * assockey [I] Type of key to get
422 * pszAssoc [I] Key name to search below
423 * pszExtra [I] Extra information about the key location
424 * phkeyOut [O] Destination for the association key
425 *
426 * RETURNS
427 * Success: S_OK. phkeyOut contains the key.
428 * Failure: An HRESULT error code indicating the error.
429 */
430HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc,
431 LPCSTR pszExtra, HKEY *phkeyOut)
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}
454
455/*************************************************************************
456 * AssocQueryStringW [SHLWAPI.@]
457 *
458 * See AssocQueryStringA.
459 */
461 LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
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}
485
486/*************************************************************************
487 * AssocQueryStringA [SHLWAPI.@]
488 *
489 * Get a file association string from the registry.
490 *
491 * PARAMS
492 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
493 * str [I] Type of string to get (ASSOCSTR enum from "shlwapi.h")
494 * pszAssoc [I] Key name to search below
495 * pszExtra [I] Extra information about the string location
496 * pszOut [O] Destination for the association string
497 * pcchOut [O] Length of pszOut
498 *
499 * RETURNS
500 * Success: S_OK. pszOut contains the string, pcchOut contains its length.
501 * Failure: An HRESULT error code indicating the error.
502 */
504 LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
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}
549
550/*************************************************************************
551 * AssocQueryStringByKeyW [SHLWAPI.@]
552 *
553 * See AssocQueryStringByKeyA.
554 */
556 LPCWSTR pszExtra, LPWSTR pszOut,
557 DWORD *pcchOut)
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}
582
583/*************************************************************************
584 * AssocQueryStringByKeyA [SHLWAPI.@]
585 *
586 * Get a file association string from the registry, given a starting key.
587 *
588 * PARAMS
589 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
590 * str [I] Type of string to get
591 * hkAssoc [I] Key to search below
592 * pszExtra [I] Extra information about the string location
593 * pszOut [O] Destination for the association string
594 * pcchOut [O] Length of pszOut
595 *
596 * RETURNS
597 * Success: S_OK. pszOut contains the string, pcchOut contains its length.
598 * Failure: An HRESULT error code indicating the error.
599 */
601 LPCSTR pszExtra, LPSTR pszOut,
602 DWORD *pcchOut)
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}
637
638
639/**************************************************************************
640 * AssocIsDangerous (SHLWAPI.@)
641 *
642 * Determine if a file association is dangerous (potentially malware).
643 *
644 * PARAMS
645 * lpszAssoc [I] Name of file or file extension to check.
646 *
647 * RETURNS
648 * TRUE, if lpszAssoc may potentially be malware (executable),
649 * FALSE, Otherwise.
650 */
652{
653 FIXME("%s\n", debugstr_w(lpszAssoc));
654 return FALSE;
655}
Type
Definition: Type.h:7
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define EXTERN_C
Definition: basetyps.h:12
Definition: bufpool.h:45
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
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
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppv)
Definition: shellole.c:197
BOOL WINAPI AssocIsDangerous(LPCWSTR lpszAssoc)
Definition: assoc.c:651
static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR *lpszOut)
Definition: assoc.c:59
#define SHLWAPI_DEF_ASSOCF
Definition: assoc.c:46
#define HARDCODED_NATIVE_ZIPFLDR
Definition: assoc.c:256
#define SOFTCODED_NATIVESUPPORT
Definition: assoc.c:257
static const WCHAR system_exts[]
Definition: assoc.c:225
HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:388
HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc, LPCSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:430
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:104
const WCHAR type_compressed[]
Definition: assoc.c:249
HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:503
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
HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:555
static const WCHAR audio_exts[]
Definition: assoc.c:168
HRESULT WINAPI AssocGetPerceivedType(LPCWSTR lpszExt, PERCEIVED *lpType, INT *lpFlag, LPWSTR *lppszType)
Definition: assoc.c:324
const WCHAR type_system[]
Definition: assoc.c:251
static const struct AssocPerceivedInfo known_types[]
Definition: assoc.c:259
static const struct AssocPerceivedInfo * AssocFindByType(LPCWSTR pszType)
Definition: assoc.c:287
const WCHAR type_text[]
Definition: assoc.c:245
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:460
#define HARDCODED_NATIVE_WMSDK
Definition: assoc.c:254
HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:600
const WCHAR type_application[]
Definition: assoc.c:252
static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension(LPCWSTR pszExt)
Definition: assoc.c:271
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
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 int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble n
Definition: glext.h:7729
unsigned int UINT
Definition: sysinfo.c:13
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static struct proto Ext[]
Definition: mkg3states.c:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
const CLSID * clsid
Definition: msctf.cpp:50
short WCHAR
Definition: pedump.c:58
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IQueryAssociations_GetKey(p, a, b, c, d)
Definition: shlwapi.h:990
ASSOCSTR
Definition: shlwapi.h:885
#define PERCEIVEDFLAG_HARDCODED
Definition: shtypes.idl:187
#define IQueryAssociations_Release(p)
Definition: shlwapi.h:987
#define IQueryAssociations_Init(p, a, b, c, d)
Definition: shlwapi.h:988
ASSOCKEY
Definition: shlwapi.h:918
DWORD ASSOCF
Definition: shlwapi.h:967
#define IQueryAssociations_GetString(p, a, b, c, d, e)
Definition: shlwapi.h:989
#define PERCEIVEDFLAG_SOFTCODED
Definition: shtypes.idl:186
const WCHAR * str
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
enum tagPERCEIVED PERCEIVED
@ 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_UNSPECIFIED
Definition: shtypes.idl:170
@ 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
#define TRACE(s)
Definition: solgame.cpp:4
PERCEIVED Perceived
Definition: assoc.c:138
PCWSTR Extensions
Definition: assoc.c:141
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint16_t * LPWSTR
Definition: typedefs.h:56
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_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 WINAPI
Definition: msvc.h:6
#define strlenW(s)
Definition: unicode.h:28
#define snprintfW
Definition: unicode.h:60
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define E_UNEXPECTED
Definition: winerror.h:3528
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772
#define RRF_RT_REG_SZ
Definition: winreg.h:58
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10