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