ReactOS 0.4.17-dev-357-ga8f14ff
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#include "wine/unicode.h"
32#include "wine/debug.h"
33
35
36/* Default IQueryAssociations::Init() flags */
37#ifdef __REACTOS__
38#define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME | ASSOCF_INIT_DEFAULTTOSTAR | \
39 ASSOCF_INIT_DEFAULTTOFOLDER | ASSOCF_INIT_NOREMAPCLSID | \
40 ASSOCF_INIT_IGNOREUNKNOWN)
41#else
42#define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME|ASSOCF_INIT_DEFAULTTOSTAR| \
43 ASSOCF_INIT_DEFAULTTOFOLDER)
44#endif
45
46/*************************************************************************
47 * SHLWAPI_ParamAToW
48 *
49 * Internal helper function: Convert ANSI parameter to Unicode.
50 */
51static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen,
52 LPWSTR* lpszOut)
53{
54 if (lpszParam)
55 {
56 DWORD dwStrLen = MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, NULL, 0);
57
58 if (dwStrLen < dwLen)
59 {
60 *lpszOut = lpszBuff; /* Use Buffer, it is big enough */
61 }
62 else
63 {
64 /* Create a new buffer big enough for the string */
65 *lpszOut = malloc(dwStrLen * sizeof(WCHAR));
66 if (!*lpszOut)
67 return FALSE;
68 }
69 MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, *lpszOut, dwStrLen);
70 }
71 else
72 *lpszOut = NULL;
73 return TRUE;
74}
75
76/*************************************************************************
77 * AssocCreate [SHLWAPI.@]
78 *
79 * Create a new IQueryAssociations object.
80 *
81 * PARAMS
82 * clsid [I] CLSID of object
83 * refiid [I] REFIID of interface
84 * lpInterface [O] Destination for the created IQueryAssociations object
85 *
86 * RETURNS
87 * Success: S_OK. lpInterface contains the new object.
88 * Failure: An HRESULT error code indicating the error.
89 *
90 * NOTES
91 * clsid must be equal to CLSID_QueryAssociations and
92 * refiid must be equal to IID_IQueryAssociations, IID_IUnknown or this function will fail
93 */
94HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
95{
96 TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
97 lpInterface);
98
99 if (!lpInterface)
100 return E_INVALIDARG;
101
102 *(DWORD*)lpInterface = 0;
103
104 if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations))
106
107 return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface );
108}
109
110
112{
118};
119
120static const WCHAR unspecified_exts[] = {
121 '.','l','n','k',0,
122 '.','s','e','a','r','c','h','-','m','s',0,
123 0
124};
125
126static const WCHAR image_exts[] = {
127 '.','b','m','p',0,
128 '.','d','i','b',0,
129 '.','e','m','f',0,
130 '.','g','i','f',0,
131 '.','i','c','o',0,
132 '.','j','f','i','f',0,
133 '.','j','p','e',0,
134 '.','j','p','e','g',0,
135 '.','j','p','g',0,
136 '.','p','n','g',0,
137 '.','r','l','e',0,
138 '.','t','i','f',0,
139 '.','t','i','f','f',0,
140 '.','w','m','f',0,
141 0
142};
143
144static const WCHAR audio_exts[] = {
145 '.','a','i','f',0,
146 '.','a','i','f','c',0,
147 '.','a','i','f','f',0,
148 '.','a','u',0,
149 '.','m','3','u',0,
150 '.','m','i','d',0,
151 '.','m','i','d','i',0,
152#if _WIN32_WINNT > 0x602
153 '.','m','p','2',0,
154#endif
155 '.','m','p','3',0,
156 '.','r','m','i',0,
157 '.','s','n','d',0,
158 '.','w','a','v',0,
159 '.','w','a','x',0,
160 '.','w','m','a',0,
161 0
162};
163
164static const WCHAR video_exts[] = {
165 '.','a','s','f',0,
166 '.','a','s','x',0,
167 '.','a','v','i',0,
168 '.','d','v','r','-','m','s',0,
169 '.','I','V','F',0,
170 '.','m','1','v',0,
171#if _WIN32_WINNT <= 0x602
172 '.','m','p','2',0,
173#endif
174 '.','m','p','2','v',0,
175 '.','m','p','a',0,
176 '.','m','p','e',0,
177 '.','m','p','e','g',0,
178 '.','m','p','g',0,
179 '.','m','p','v','2',0,
180 '.','w','m',0,
181 '.','w','m','v',0,
182 '.','w','m','x',0,
183 '.','w','v','x',0,
184 0
185};
186
187static const WCHAR compressed_exts[] = {
188 '.','z','i','p',0,
189 0
190};
191
192static const WCHAR document_exts[] = {
193#if _WIN32_WINNT >= 0x600
194 '.','h','t','m',0,
195 '.','h','t','m','l',0,
196#endif
197 '.','m','h','t',0,
198 0
199};
200
201static const WCHAR system_exts[] = {
202 '.','c','p','l',0,
203 0
204};
205
206static const WCHAR application_exts[] = {
207 '.','b','a','s',0,
208 '.','b','a','t',0,
209 '.','c','m','d',0,
210 '.','c','o','m',0,
211 '.','e','x','e',0,
212 '.','h','t','a',0,
213 '.','m','s','i',0,
214 '.','p','i','f',0,
215 '.','r','e','g',0,
216 '.','s','c','r',0,
217 '.','v','b',0,
218 0
219};
220
221const WCHAR type_text[] = {'t','e','x','t',0};
222const WCHAR type_image[] = {'i','m','a','g','e',0};
223const WCHAR type_audio[] = {'a','u','d','i','o',0};
224const WCHAR type_video[] = {'v','i','d','e','o',0};
225const WCHAR type_compressed[] = {'c','o','m','p','r','e','s','s','e','d',0};
226const WCHAR type_document[] = {'d','o','c','u','m','e','n','t',0};
227const WCHAR type_system[] = {'s','y','s','t','e','m',0};
228const WCHAR type_application[] = {'a','p','p','l','i','c','a','t','i','o','n',0};
229
230#define HARDCODED_NATIVE_WMSDK (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_WMSDK)
231#define HARDCODED_NATIVE_GDIPLUS (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_GDIPLUS)
232#define HARDCODED_NATIVE_ZIPFLDR (PERCEIVEDFLAG_HARDCODED | PERCEIVEDFLAG_NATIVESUPPORT | PERCEIVEDFLAG_ZIPFOLDER)
233#define SOFTCODED_NATIVESUPPORT (PERCEIVEDFLAG_SOFTCODED | PERCEIVEDFLAG_NATIVESUPPORT)
234
235static const struct AssocPerceivedInfo known_types[] = {
236 { NULL, PERCEIVED_TYPE_UNSPECIFIED, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, unspecified_exts },
237 { type_text, PERCEIVED_TYPE_TEXT, PERCEIVEDFLAG_HARDCODED, SOFTCODED_NATIVESUPPORT, NULL },
242 { type_document, PERCEIVED_TYPE_DOCUMENT, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, document_exts },
243 { type_system, PERCEIVED_TYPE_SYSTEM, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, system_exts },
244 { type_application, PERCEIVED_TYPE_APPLICATION, PERCEIVEDFLAG_HARDCODED, PERCEIVEDFLAG_SOFTCODED, application_exts },
245};
246
248{
249 UINT n;
250 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
251 {
252 PCWSTR Ext = known_types[n].Extensions;
253 while (Ext && *Ext)
254 {
255 if (!StrCmpIW(Ext, pszExt))
256 return &known_types[n];
257 Ext += (strlenW(Ext) + 1);
258 }
259 }
260 return NULL;
261}
262
263static const struct AssocPerceivedInfo* AssocFindByType(LPCWSTR pszType)
264{
265 UINT n;
266 for (n = 0; n < sizeof(known_types) / sizeof(known_types[0]); ++n)
267 {
268 if (known_types[n].Type)
269 {
270 if (!StrCmpIW(known_types[n].Type, pszType))
271 return &known_types[n];
272 }
273 }
274 return NULL;
275}
276
277
278/*************************************************************************
279 * AssocGetPerceivedType [SHLWAPI.@]
280 *
281 * Detect the type of a file by inspecting its extension
282 *
283 * PARAMS
284 * lpszExt [I] File extension to evaluate.
285 * lpType [O] Pointer to perceived type
286 * lpFlag [O] Pointer to perceived type flag
287 * lppszType [O] Address to pointer for perceived type text
288 *
289 * RETURNS
290 * Success: S_OK. lpType and lpFlag contain the perceived type and
291 * its information. If lppszType is not NULL, it will point
292 * to a string with perceived type text.
293 * Failure: An HRESULT error code indicating the error.
294 *
295 * NOTES
296 * lppszType is optional and it can be NULL.
297 * if lpType or lpFlag are NULL, the function will crash.
298 * if lpszExt is NULL, an error is returned.
299 */
301 INT *lpFlag, LPWSTR *lppszType)
302{
303 static const WCHAR PerceivedTypeKey[] = {'P','e','r','c','e','i','v','e','d','T','y','p','e',0};
304 static const WCHAR SystemFileAssociationsKey[] = {'S','y','s','t','e','m','F','i','l','e',
305 'A','s','s','o','c','i','a','t','i','o','n','s','\\','%','s',0};
306 const struct AssocPerceivedInfo *Info;
307
308 TRACE("(%s,%p,%p,%p)\n", debugstr_w(lpszExt), lpType, lpFlag, lppszType);
309
311 if (Info)
312 {
313 *lpType = Info->Perceived;
314 *lpFlag = Info->FlagHardcoded;
315 }
316 else
317 {
318 WCHAR Buffer[100] = { 0 };
319 DWORD Size = sizeof(Buffer);
320 if (RegGetValueW(HKEY_CLASSES_ROOT, lpszExt, PerceivedTypeKey,
322 {
324 }
325 if (!Info)
326 {
327 WCHAR KeyName[MAX_PATH] = { 0 };
328 snprintfW(KeyName, MAX_PATH, SystemFileAssociationsKey, lpszExt);
329 Size = sizeof(Buffer);
330 if (RegGetValueW(HKEY_CLASSES_ROOT, KeyName, PerceivedTypeKey,
332 {
334 }
335 }
336 if (Info)
337 {
338 *lpType = Info->Perceived;
339 *lpFlag = Info->FlagSoftcoded;
340 }
341 }
342
343 if (Info)
344 {
345 if (lppszType && Info->Type)
346 {
347 return SHStrDupW(Info->Type, lppszType);
348 }
349 return Info->Type ? S_OK : E_FAIL;
350 }
351 else
352 {
354 *lpFlag = 0;
355 }
357}
358
359/*************************************************************************
360 * AssocQueryKeyW [SHLWAPI.@]
361 *
362 * See AssocQueryKeyA.
363 */
365 LPCWSTR pszExtra, HKEY *phkeyOut)
366{
367 HRESULT hRet;
368 IQueryAssociations* lpAssoc;
369
370 TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
371 debugstr_w(pszExtra), phkeyOut);
372
373 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
374 if (FAILED(hRet)) return hRet;
375
376#ifdef __REACTOS__
377 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, pszAssoc, NULL, NULL);
378#else
379 cfFlags &= SHLWAPI_DEF_ASSOCF;
380 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
381#endif
382
383 if (SUCCEEDED(hRet))
384 hRet = IQueryAssociations_GetKey(lpAssoc, cfFlags, assockey, pszExtra, phkeyOut);
385
387 return hRet;
388}
389
390/*************************************************************************
391 * AssocQueryKeyA [SHLWAPI.@]
392 *
393 * Get a file association key from the registry.
394 *
395 * PARAMS
396 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
397 * assockey [I] Type of key to get
398 * pszAssoc [I] Key name to search below
399 * pszExtra [I] Extra information about the key location
400 * phkeyOut [O] Destination for the association key
401 *
402 * RETURNS
403 * Success: S_OK. phkeyOut contains the key.
404 * Failure: An HRESULT error code indicating the error.
405 */
406HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc,
407 LPCSTR pszExtra, HKEY *phkeyOut)
408{
409 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
410 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
411 HRESULT hRet = E_OUTOFMEMORY;
412
413 TRACE("(0x%lx,%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 free(lpszAssocW);
424
425 if (lpszExtraW != szExtraW)
426 free(lpszExtraW);
427
428 return hRet;
429}
430
431/*************************************************************************
432 * AssocQueryStringW [SHLWAPI.@]
433 *
434 * See AssocQueryStringA.
435 */
437 LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
438{
439 HRESULT hRet;
440 IQueryAssociations* lpAssoc;
441
442 TRACE("(0x%lx,%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}
461
462/*************************************************************************
463 * AssocQueryStringA [SHLWAPI.@]
464 *
465 * Get a file association string from the registry.
466 *
467 * PARAMS
468 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
469 * str [I] Type of string to get (ASSOCSTR enum from "shlwapi.h")
470 * pszAssoc [I] Key name to search below
471 * pszExtra [I] Extra information about the string location
472 * pszOut [O] Destination for the association string
473 * pcchOut [O] Length of pszOut
474 *
475 * RETURNS
476 * Success: S_OK. pszOut contains the string, pcchOut contains its length.
477 * Failure: An HRESULT error code indicating the error.
478 */
480 LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
481{
482 WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
483 WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
484 HRESULT hRet = E_OUTOFMEMORY;
485
486 TRACE("(0x%lx,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 = malloc((dwLenOut + 1) * sizeof(WCHAR));
499 else
500 dwLenOut = ARRAY_SIZE(szReturnW);
501
502 if (!lpszReturnW)
503 hRet = E_OUTOFMEMORY;
504 else
505 {
506 hRet = AssocQueryStringW(cfFlags, str, lpszAssocW, lpszExtraW,
507 lpszReturnW, &dwLenOut);
508
509 if (SUCCEEDED(hRet))
510 dwLenOut = WideCharToMultiByte(CP_ACP, 0, lpszReturnW, -1,
511 pszOut, *pcchOut, NULL, NULL);
512
513 *pcchOut = dwLenOut;
514 if (lpszReturnW != szReturnW)
515 free(lpszReturnW);
516 }
517 }
518
519 if (lpszAssocW != szAssocW)
520 free(lpszAssocW);
521 if (lpszExtraW != szExtraW)
522 free(lpszExtraW);
523 return hRet;
524}
525
526/*************************************************************************
527 * AssocQueryStringByKeyW [SHLWAPI.@]
528 *
529 * See AssocQueryStringByKeyA.
530 */
532 LPCWSTR pszExtra, LPWSTR pszOut,
533 DWORD *pcchOut)
534{
535 HRESULT hRet;
536 IQueryAssociations* lpAssoc;
537
538 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
539 debugstr_w(pszExtra), pszOut, pcchOut);
540
541 hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
542 if (FAILED(hRet)) return hRet;
543
544#ifdef __REACTOS__
545 hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF, 0, hkAssoc, NULL);
546#else
547 cfFlags &= SHLWAPI_DEF_ASSOCF;
548 hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
549#endif
550
551 if (SUCCEEDED(hRet))
552 hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
553 pszOut, pcchOut);
554
556 return hRet;
557}
558
559/*************************************************************************
560 * AssocQueryStringByKeyA [SHLWAPI.@]
561 *
562 * Get a file association string from the registry, given a starting key.
563 *
564 * PARAMS
565 * cfFlags [I] ASSOCF_ flags from "shlwapi.h"
566 * str [I] Type of string to get
567 * hkAssoc [I] Key to search below
568 * pszExtra [I] Extra information about the string location
569 * pszOut [O] Destination for the association string
570 * pcchOut [O] Length of pszOut
571 *
572 * RETURNS
573 * Success: S_OK. pszOut contains the string, pcchOut contains its length.
574 * Failure: An HRESULT error code indicating the error.
575 */
577 LPCSTR pszExtra, LPSTR pszOut,
578 DWORD *pcchOut)
579{
580 WCHAR szExtraW[MAX_PATH], *lpszExtraW = szExtraW;
581 WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
582 HRESULT hRet = E_OUTOFMEMORY;
583
584 TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
585 debugstr_a(pszExtra), pszOut, pcchOut);
586
587 if (!pcchOut)
588 hRet = E_INVALIDARG;
589 else if (SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
590 {
591 DWORD dwLenOut = *pcchOut;
592 if (dwLenOut >= MAX_PATH)
593 lpszReturnW = malloc((dwLenOut + 1) * sizeof(WCHAR));
594
595 if (lpszReturnW)
596 {
597 hRet = AssocQueryStringByKeyW(cfFlags, str, hkAssoc, lpszExtraW,
598 lpszReturnW, &dwLenOut);
599
600 if (SUCCEEDED(hRet))
601 WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
602 *pcchOut = dwLenOut;
603
604 if (lpszReturnW != szReturnW)
605 free(lpszReturnW);
606 }
607 }
608
609 if (lpszExtraW != szExtraW)
610 free(lpszExtraW);
611 return hRet;
612}
613
614
615/**************************************************************************
616 * AssocIsDangerous (SHLWAPI.@)
617 *
618 * Determine if a file association is dangerous (potentially malware).
619 *
620 * PARAMS
621 * lpszAssoc [I] Name of file or file extension to check.
622 *
623 * RETURNS
624 * TRUE, if lpszAssoc may potentially be malware (executable),
625 * FALSE, Otherwise.
626 */
628{
629 FIXME("%s\n", debugstr_w(lpszAssoc));
630 return FALSE;
631}
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
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:627
static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR *lpszOut)
Definition: assoc.c:51
#define SHLWAPI_DEF_ASSOCF
Definition: assoc.c:42
#define HARDCODED_NATIVE_ZIPFLDR
Definition: assoc.c:232
#define SOFTCODED_NATIVESUPPORT
Definition: assoc.c:233
static const WCHAR system_exts[]
Definition: assoc.c:201
HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:364
HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc, LPCSTR pszExtra, HKEY *phkeyOut)
Definition: assoc.c:406
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:94
const WCHAR type_compressed[]
Definition: assoc.c:225
HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:479
static const WCHAR document_exts[]
Definition: assoc.c:192
const WCHAR type_document[]
Definition: assoc.c:226
const WCHAR type_video[]
Definition: assoc.c:224
const WCHAR type_image[]
Definition: assoc.c:222
HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:531
static const WCHAR audio_exts[]
Definition: assoc.c:144
HRESULT WINAPI AssocGetPerceivedType(LPCWSTR lpszExt, PERCEIVED *lpType, INT *lpFlag, LPWSTR *lppszType)
Definition: assoc.c:300
const WCHAR type_system[]
Definition: assoc.c:227
static const struct AssocPerceivedInfo known_types[]
Definition: assoc.c:235
static const struct AssocPerceivedInfo * AssocFindByType(LPCWSTR pszType)
Definition: assoc.c:263
const WCHAR type_text[]
Definition: assoc.c:221
HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:436
#define HARDCODED_NATIVE_WMSDK
Definition: assoc.c:230
HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
Definition: assoc.c:576
const WCHAR type_application[]
Definition: assoc.c:228
static const struct AssocPerceivedInfo * AssocFindByBuiltinExtension(LPCWSTR pszExt)
Definition: assoc.c:247
static const WCHAR application_exts[]
Definition: assoc.c:206
static const WCHAR image_exts[]
Definition: assoc.c:126
#define HARDCODED_NATIVE_GDIPLUS
Definition: assoc.c:231
static const WCHAR video_exts[]
Definition: assoc.c:164
static const WCHAR compressed_exts[]
Definition: assoc.c:187
static const WCHAR unspecified_exts[]
Definition: assoc.c:120
const WCHAR type_audio[]
Definition: assoc.c:223
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble n
Definition: glext.h:7729
#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
unsigned int UINT
Definition: ndis.h: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 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
const WCHAR * str
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:114
PCWSTR Extensions
Definition: assoc.c:117
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
_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