~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/shlwapi/assoc.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * IQueryAssociations object and 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 
 22 #include "windef.h"
 23 #include "winbase.h"
 24 #include "winnls.h"
 25 #include "winreg.h"
 26 #include "objbase.h"
 27 #include "shlguid.h"
 28 #include "shlwapi.h"
 29 #include "wine/debug.h"
 30 
 31 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 32 
 33 /**************************************************************************
 34  *  IQueryAssociations {SHLWAPI}
 35  *
 36  * DESCRIPTION
 37  *  This object provides a layer of abstraction over the system registry in
 38  *  order to simplify the process of parsing associations between files.
 39  *  Associations in this context means the registry entries that link (for
 40  *  example) the extension of a file with its description, list of
 41  *  applications to open the file with, and actions that can be performed on it
 42  *  (the shell displays such information in the context menu of explorer
 43  *  when you right-click on a file).
 44  *
 45  * HELPERS
 46  * You can use this object transparently by calling the helper functions
 47  * AssocQueryKeyA(), AssocQueryStringA() and AssocQueryStringByKeyA(). These
 48  * create an IQueryAssociations object, perform the requested actions
 49  * and then dispose of the object. Alternatively, you can create an instance
 50  * of the object using AssocCreate() and call the following methods on it:
 51  *
 52  * METHODS
 53  */
 54 
 55 /* Default IQueryAssociations::Init() flags */
 56 #define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME|ASSOCF_INIT_DEFAULTTOSTAR| \
 57                             ASSOCF_INIT_DEFAULTTOFOLDER)
 58 
 59 typedef struct
 60 {
 61   const IQueryAssociationsVtbl *lpVtbl;
 62   LONG ref;
 63   HKEY hkeySource;
 64   HKEY hkeyProgID;
 65 } IQueryAssociationsImpl;
 66 
 67 static const IQueryAssociationsVtbl IQueryAssociations_vtbl;
 68 
 69 /**************************************************************************
 70  *  IQueryAssociations_Constructor [internal]
 71  *
 72  * Construct a new IQueryAssociations object.
 73  */
 74 static IQueryAssociations* IQueryAssociations_Constructor(void)
 75 {
 76   IQueryAssociationsImpl* iface;
 77 
 78   iface = HeapAlloc(GetProcessHeap(),0,sizeof(IQueryAssociationsImpl));
 79   iface->lpVtbl = &IQueryAssociations_vtbl;
 80   iface->ref = 1;
 81   iface->hkeySource = NULL;
 82   iface->hkeyProgID = NULL;
 83 
 84   TRACE("Returning IQueryAssociations* %p\n", iface);
 85   return (IQueryAssociations*)iface;
 86 }
 87 
 88 /*************************************************************************
 89  * SHLWAPI_ParamAToW
 90  *
 91  * Internal helper function: Convert ASCII parameter to Unicode.
 92  */
 93 static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen,
 94                               LPWSTR* lpszOut)
 95 {
 96   if (lpszParam)
 97   {
 98     DWORD dwStrLen = MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, NULL, 0);
 99 
100     if (dwStrLen < dwLen)
101     {
102       *lpszOut = lpszBuff; /* Use Buffer, it is big enough */
103     }
104     else
105     {
106       /* Create a new buffer big enough for the string */
107       *lpszOut = HeapAlloc(GetProcessHeap(), 0,
108                                    dwStrLen * sizeof(WCHAR));
109       if (!*lpszOut)
110         return FALSE;
111     }
112     MultiByteToWideChar(CP_ACP, 0, lpszParam, -1, *lpszOut, dwStrLen);
113   }
114   else
115     *lpszOut = NULL;
116   return TRUE;
117 }
118 
119 /*************************************************************************
120  * AssocCreate  [SHLWAPI.@]
121  *
122  * Create a new IQueryAssociations object.
123  *
124  * PARAMS
125  *  clsid       [I] CLSID of object
126  *  refiid      [I] REFIID of interface
127  *  lpInterface [O] Destination for the created IQueryAssociations object
128  *
129  * RETURNS
130  *  Success: S_OK. lpInterface contains the new object.
131  *  Failure: An HRESULT error code indicating the error.
132  *
133  * NOTES
134  *  refiid must be equal to IID_IQueryAssociations, or this function will fail.
135  */
136 HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
137 {
138   HRESULT hRet;
139   IQueryAssociations* lpAssoc;
140 
141   TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
142         lpInterface);
143 
144   if (!lpInterface)
145     return E_INVALIDARG;
146 
147   *(DWORD*)lpInterface = 0;
148 
149   if (!IsEqualGUID(&clsid, &IID_IQueryAssociations))
150     return E_NOTIMPL;
151 
152   lpAssoc = IQueryAssociations_Constructor();
153 
154   if (!lpAssoc)
155     return E_OUTOFMEMORY;
156 
157   hRet = IQueryAssociations_QueryInterface(lpAssoc, refiid, lpInterface);
158   IQueryAssociations_Release(lpAssoc);
159   return hRet;
160 }
161 
162 /*************************************************************************
163  * AssocQueryKeyW  [SHLWAPI.@]
164  *
165  * See AssocQueryKeyA.
166  */
167 HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAssoc,
168                               LPCWSTR pszExtra, HKEY *phkeyOut)
169 {
170   HRESULT hRet;
171   IQueryAssociations* lpAssoc;
172 
173   TRACE("(0x%8x,0x%8x,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
174         debugstr_w(pszExtra), phkeyOut);
175 
176   lpAssoc = IQueryAssociations_Constructor();
177 
178   if (!lpAssoc)
179     return E_OUTOFMEMORY;
180 
181   cfFlags &= SHLWAPI_DEF_ASSOCF;
182   hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
183 
184   if (SUCCEEDED(hRet))
185     hRet = IQueryAssociations_GetKey(lpAssoc, cfFlags, assockey, pszExtra, phkeyOut);
186 
187   IQueryAssociations_Release(lpAssoc);
188   return hRet;
189 }
190 
191 /*************************************************************************
192  * AssocQueryKeyA  [SHLWAPI.@]
193  *
194  * Get a file association key from the registry.
195  *
196  * PARAMS
197  *  cfFlags  [I] ASSOCF_ flags from "shlwapi.h"
198  *  assockey [I] Type of key to get
199  *  pszAssoc [I] Key name to search below
200  *  pszExtra [I] Extra information about the key location
201  *  phkeyOut [O] Destination for the association key
202  *
203  * RETURNS
204  *  Success: S_OK. phkeyOut contains the key.
205  *  Failure: An HRESULT error code indicating the error.
206  */
207 HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc,
208                               LPCSTR pszExtra, HKEY *phkeyOut)
209 {
210   WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
211   WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
212   HRESULT hRet = E_OUTOFMEMORY;
213 
214   TRACE("(0x%8x,0x%8x,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc),
215         debugstr_a(pszExtra), phkeyOut);
216 
217   if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
218       SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
219   {
220     hRet = AssocQueryKeyW(cfFlags, assockey, lpszAssocW, lpszExtraW, phkeyOut);
221   }
222 
223   if (lpszAssocW != szAssocW)
224     HeapFree(GetProcessHeap(), 0, lpszAssocW);
225 
226   if (lpszExtraW != szExtraW)
227     HeapFree(GetProcessHeap(), 0, lpszExtraW);
228 
229   return hRet;
230 }
231 
232 /*************************************************************************
233  * AssocQueryStringW  [SHLWAPI.@]
234  *
235  * See AssocQueryStringA.
236  */
237 HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc,
238                                  LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut)
239 {
240   HRESULT hRet;
241   IQueryAssociations* lpAssoc;
242 
243   TRACE("(0x%8x,0x%8x,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc),
244         debugstr_w(pszExtra), pszOut, pcchOut);
245 
246   if (!pcchOut)
247     return E_INVALIDARG;
248 
249   lpAssoc = IQueryAssociations_Constructor();
250 
251   if (!lpAssoc)
252     return E_OUTOFMEMORY;
253 
254   hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF,
255                                  pszAssoc, NULL, NULL);
256 
257   if (SUCCEEDED(hRet))
258     hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
259                                         pszOut, pcchOut);
260 
261   IQueryAssociations_Release(lpAssoc);
262   return hRet;
263 }
264 
265 /*************************************************************************
266  * AssocQueryStringA  [SHLWAPI.@]
267  *
268  * Get a file association string from the registry.
269  *
270  * PARAMS
271  *  cfFlags  [I] ASSOCF_ flags from "shlwapi.h"
272  *  str      [I] Type of string to get (ASSOCSTR enum from "shlwapi.h")
273  *  pszAssoc [I] Key name to search below
274  *  pszExtra [I] Extra information about the string location
275  *  pszOut   [O] Destination for the association string
276  *  pcchOut  [O] Length of pszOut
277  *
278  * RETURNS
279  *  Success: S_OK. pszOut contains the string, pcchOut contains its length.
280  *  Failure: An HRESULT error code indicating the error.
281  */
282 HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
283                                  LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut)
284 {
285   WCHAR szAssocW[MAX_PATH], *lpszAssocW = NULL;
286   WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL;
287   HRESULT hRet = E_OUTOFMEMORY;
288 
289   TRACE("(0x%8x,0x%8x,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc),
290         debugstr_a(pszExtra), pszOut, pcchOut);
291 
292   if (!pcchOut)
293     hRet = E_INVALIDARG;
294   else if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) &&
295            SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
296   {
297     WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
298     DWORD dwLenOut = *pcchOut;
299 
300     if (dwLenOut >= MAX_PATH)
301       lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
302                                       (dwLenOut + 1) * sizeof(WCHAR));
303 
304     if (!lpszReturnW)
305       hRet = E_OUTOFMEMORY;
306     else
307     {
308       hRet = AssocQueryStringW(cfFlags, str, lpszAssocW, lpszExtraW,
309                                lpszReturnW, &dwLenOut);
310 
311       if (SUCCEEDED(hRet))
312         WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
313       *pcchOut = dwLenOut;
314 
315       if (lpszReturnW != szReturnW)
316         HeapFree(GetProcessHeap(), 0, lpszReturnW);
317     }
318   }
319 
320   if (lpszAssocW != szAssocW)
321     HeapFree(GetProcessHeap(), 0, lpszAssocW);
322   if (lpszExtraW != szExtraW)
323     HeapFree(GetProcessHeap(), 0, lpszExtraW);
324   return hRet;
325 }
326 
327 /*************************************************************************
328  * AssocQueryStringByKeyW  [SHLWAPI.@]
329  *
330  * See AssocQueryStringByKeyA.
331  */
332 HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc,
333                                       LPCWSTR pszExtra, LPWSTR pszOut,
334                                       DWORD *pcchOut)
335 {
336   HRESULT hRet;
337   IQueryAssociations* lpAssoc;
338 
339   TRACE("(0x%8x,0x%8x,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
340         debugstr_w(pszExtra), pszOut, pcchOut);
341 
342   lpAssoc = IQueryAssociations_Constructor();
343 
344   if (!lpAssoc)
345     return E_OUTOFMEMORY;
346 
347   cfFlags &= SHLWAPI_DEF_ASSOCF;
348   hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
349 
350   if (SUCCEEDED(hRet))
351     hRet = IQueryAssociations_GetString(lpAssoc, cfFlags, str, pszExtra,
352                                         pszOut, pcchOut);
353 
354   IQueryAssociations_Release(lpAssoc);
355   return hRet;
356 }
357 
358 /*************************************************************************
359  * AssocQueryStringByKeyA  [SHLWAPI.@]
360  *
361  * Get a file association string from the registry, given a starting key.
362  *
363  * PARAMS
364  *  cfFlags  [I] ASSOCF_ flags from "shlwapi.h"
365  *  str      [I] Type of string to get
366  *  hkAssoc  [I] Key to search below
367  *  pszExtra [I] Extra information about the string location
368  *  pszOut   [O] Destination for the association string
369  *  pcchOut  [O] Length of pszOut
370  *
371  * RETURNS
372  *  Success: S_OK. pszOut contains the string, pcchOut contains its length.
373  *  Failure: An HRESULT error code indicating the error.
374  */
375 HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc,
376                                       LPCSTR pszExtra, LPSTR pszOut,
377                                       DWORD *pcchOut)
378 {
379   WCHAR szExtraW[MAX_PATH], *lpszExtraW = szExtraW;
380   WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW;
381   HRESULT hRet = E_OUTOFMEMORY;
382 
383   TRACE("(0x%8x,0x%8x,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
384         debugstr_a(pszExtra), pszOut, pcchOut);
385 
386   if (!pcchOut)
387     hRet = E_INVALIDARG;
388   else if (SHLWAPI_ParamAToW(pszExtra, szExtraW, MAX_PATH, &lpszExtraW))
389   {
390     DWORD dwLenOut = *pcchOut;
391     if (dwLenOut >= MAX_PATH)
392       lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
393                                       (dwLenOut + 1) * sizeof(WCHAR));
394 
395     if (lpszReturnW)
396     {
397       hRet = AssocQueryStringByKeyW(cfFlags, str, hkAssoc, lpszExtraW,
398                                     lpszReturnW, &dwLenOut);
399 
400       if (SUCCEEDED(hRet))
401         WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
402       *pcchOut = dwLenOut;
403 
404       if (lpszReturnW != szReturnW)
405         HeapFree(GetProcessHeap(), 0, lpszReturnW);
406     }
407   }
408 
409   if (lpszExtraW != szExtraW)
410     HeapFree(GetProcessHeap(), 0, lpszExtraW);
411   return hRet;
412 }
413 
414 
415 /**************************************************************************
416  *  AssocIsDangerous  (SHLWAPI.@)
417  *  
418  * Determine if a file association is dangerous (potentially malware).
419  *
420  * PARAMS
421  *  lpszAssoc [I] Name of file or file extension to check.
422  *
423  * RETURNS
424  *  TRUE, if lpszAssoc may potentially be malware (executable),
425  *  FALSE, Otherwise.
426  */
427 BOOL WINAPI AssocIsDangerous(LPCWSTR lpszAssoc)
428 {
429     FIXME("%s\n", debugstr_w(lpszAssoc));
430     return FALSE;
431 }
432 
433 /**************************************************************************
434  *  IQueryAssociations_QueryInterface {SHLWAPI}
435  *
436  * See IUnknown_QueryInterface.
437  */
438 static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
439   IQueryAssociations* iface,
440   REFIID riid,
441   LPVOID *ppvObj)
442 {
443   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
444 
445   TRACE("(%p,%s,%p)\n",This, debugstr_guid(riid), ppvObj);
446 
447   *ppvObj = NULL;
448 
449   if (IsEqualIID(riid, &IID_IUnknown) ||
450       IsEqualIID(riid, &IID_IQueryAssociations))
451   {
452     *ppvObj = (IQueryAssociations*)This;
453 
454     IQueryAssociations_AddRef((IQueryAssociations*)*ppvObj);
455     TRACE("Returning IQueryAssociations (%p)\n", *ppvObj);
456     return S_OK;
457   }
458   TRACE("Returning E_NOINTERFACE\n");
459   return E_NOINTERFACE;
460 }
461 
462 /**************************************************************************
463  *  IQueryAssociations_AddRef {SHLWAPI}
464  *
465  * See IUnknown_AddRef.
466  */
467 static ULONG WINAPI IQueryAssociations_fnAddRef(IQueryAssociations *iface)
468 {
469   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
470   ULONG refCount = InterlockedIncrement(&This->ref);
471   
472   TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
473 
474   return refCount;
475 }
476 
477 /**************************************************************************
478  *  IQueryAssociations_Release {SHLWAPI}
479  *
480  * See IUnknown_Release.
481  */
482 static ULONG WINAPI IQueryAssociations_fnRelease(IQueryAssociations *iface)
483 {
484   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
485   ULONG refCount = InterlockedDecrement(&This->ref);
486 
487   TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
488 
489   if (!refCount)
490   {
491     TRACE("Destroying IQueryAssociations (%p)\n", This);
492     HeapFree(GetProcessHeap(), 0, This);
493   }
494   
495   return refCount;
496 }
497 
498 /**************************************************************************
499  *  IQueryAssociations_Init {SHLWAPI}
500  *
501  * Initialise an IQueryAssociations object.
502  *
503  * PARAMS
504  *  iface      [I] IQueryAssociations interface to initialise
505  *  cfFlags    [I] ASSOCF_ flags from "shlwapi.h"
506  *  pszAssoc   [I] String for the root key name, or NULL if hkeyProgid is given
507  *  hkeyProgid [I] Handle for the root key, or NULL if pszAssoc is given
508  *  hWnd       [I] Reserved, must be NULL.
509  *
510  * RETURNS
511  *  Success: S_OK. iface is initialised with the parameters given.
512  *  Failure: An HRESULT error code indicating the error.
513  */
514 static HRESULT WINAPI IQueryAssociations_fnInit(
515   IQueryAssociations *iface,
516   ASSOCF cfFlags,
517   LPCWSTR pszAssoc,
518   HKEY hkeyProgid,
519   HWND hWnd)
520 {
521     static const WCHAR szProgID[] = {'P','r','o','g','I','D',0};
522     IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
523     HRESULT hr;
524 
525     TRACE("(%p)->(%d,%s,%p,%p)\n", iface,
526                                     cfFlags,
527                                     debugstr_w(pszAssoc),
528                                     hkeyProgid,
529                                     hWnd);
530     if (hWnd != NULL)
531         FIXME("hwnd != NULL not supported\n");
532     if (cfFlags != 0)
533         FIXME("unsupported flags: %x\n", cfFlags);
534     if (pszAssoc != NULL)
535     {
536         hr = RegOpenKeyExW(HKEY_CLASSES_ROOT,
537                            pszAssoc,
538                            0,
539                            KEY_READ,
540                            &This->hkeySource);
541         if (FAILED(hr))
542             return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION);
543         /* if this is not a prog id */
544         if ((*pszAssoc == '.') || (*pszAssoc == '{'))
545         {
546             hr = RegOpenKeyExW(This->hkeySource,
547                                szProgID,
548                                0,
549                                KEY_READ,
550                                &This->hkeyProgID);
551             if (FAILED(hr))
552                 FIXME("Don't know what to return\n");
553         }
554         else
555             This->hkeyProgID = This->hkeySource;
556         return S_OK;
557     }
558     else if (hkeyProgid != NULL)
559     {
560         This->hkeyProgID = hkeyProgid;
561         return S_OK;
562     }
563     else
564         return E_FAIL;
565 }
566 
567 /**************************************************************************
568  *  IQueryAssociations_GetString {SHLWAPI}
569  *
570  * Get a file association string from the registry.
571  *
572  * PARAMS
573  *  iface    [I]   IQueryAssociations interface to query
574  *  cfFlags  [I]   ASSOCF_ flags from "shlwapi.h"
575  *  str      [I]   Type of string to get (ASSOCSTR enum from "shlwapi.h")
576  *  pszExtra [I]   Extra information about the string location
577  *  pszOut   [O]   Destination for the association string
578  *  pcchOut  [I/O] Length of pszOut
579  *
580  * RETURNS
581  *  Success: S_OK. pszOut contains the string, pcchOut contains its length.
582  *  Failure: An HRESULT error code indicating the error.
583  */
584 static HRESULT WINAPI IQueryAssociations_fnGetString(
585   IQueryAssociations *iface,
586   ASSOCF cfFlags,
587   ASSOCSTR str,
588   LPCWSTR pszExtra,
589   LPWSTR pszOut,
590   DWORD *pcchOut)
591 {
592   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
593 
594   FIXME("(%p,0x%8x,0x%8x,%s,%p,%p)-stub!\n", This, cfFlags, str,
595         debugstr_w(pszExtra), pszOut, pcchOut);
596   return E_NOTIMPL;
597 }
598 
599 /**************************************************************************
600  *  IQueryAssociations_GetKey {SHLWAPI}
601  *
602  * Get a file association key from the registry.
603  *
604  * PARAMS
605  *  iface    [I] IQueryAssociations interface to query
606  *  cfFlags  [I] ASSOCF_ flags from "shlwapi.h"
607  *  assockey [I] Type of key to get (ASSOCKEY enum from "shlwapi.h")
608  *  pszExtra [I] Extra information about the key location
609  *  phkeyOut [O] Destination for the association key
610  *
611  * RETURNS
612  *  Success: S_OK. phkeyOut contains a handle to the key.
613  *  Failure: An HRESULT error code indicating the error.
614  */
615 static HRESULT WINAPI IQueryAssociations_fnGetKey(
616   IQueryAssociations *iface,
617   ASSOCF cfFlags,
618   ASSOCKEY assockey,
619   LPCWSTR pszExtra,
620   HKEY *phkeyOut)
621 {
622   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
623 
624   FIXME("(%p,0x%8x,0x%8x,%s,%p)-stub!\n", This, cfFlags, assockey,
625         debugstr_w(pszExtra), phkeyOut);
626   return E_NOTIMPL;
627 }
628 
629 /**************************************************************************
630  *  IQueryAssociations_GetData {SHLWAPI}
631  *
632  * Get the data for a file association key from the registry.
633  *
634  * PARAMS
635  *  iface     [I]   IQueryAssociations interface to query
636  *  cfFlags   [I]   ASSOCF_ flags from "shlwapi.h"
637  *  assocdata [I]   Type of data to get (ASSOCDATA enum from "shlwapi.h")
638  *  pszExtra  [I]   Extra information about the data location
639  *  pvOut     [O]   Destination for the association key
640  *  pcbOut    [I/O] Size of pvOut
641  *
642  * RETURNS
643  *  Success: S_OK. pszOut contains the data, pcbOut contains its length.
644  *  Failure: An HRESULT error code indicating the error.
645  */
646 static HRESULT WINAPI IQueryAssociations_fnGetData(
647   IQueryAssociations *iface,
648   ASSOCF cfFlags,
649   ASSOCDATA assocdata,
650   LPCWSTR pszExtra,
651   LPVOID pvOut,
652   DWORD *pcbOut)
653 {
654   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
655 
656   FIXME("(%p,0x%8x,0x%8x,%s,%p,%p)-stub!\n", This, cfFlags, assocdata,
657         debugstr_w(pszExtra), pvOut, pcbOut);
658   return E_NOTIMPL;
659 }
660 
661 /**************************************************************************
662  *  IQueryAssociations_GetEnum {SHLWAPI}
663  *
664  * Not yet implemented in native Win32.
665  *
666  * PARAMS
667  *  iface     [I] IQueryAssociations interface to query
668  *  cfFlags   [I] ASSOCF_ flags from "shlwapi.h"
669  *  assocenum [I] Type of enum to get (ASSOCENUM enum from "shlwapi.h")
670  *  pszExtra  [I] Extra information about the enum location
671  *  riid      [I] REFIID to look for
672  *  ppvOut    [O] Destination for the interface.
673  *
674  * RETURNS
675  *  Success: S_OK.
676  *  Failure: An HRESULT error code indicating the error.
677  *
678  * NOTES
679  *  Presumably this function returns an enumerator object.
680  */
681 static HRESULT WINAPI IQueryAssociations_fnGetEnum(
682   IQueryAssociations *iface,
683   ASSOCF cfFlags,
684   ASSOCENUM assocenum,
685   LPCWSTR pszExtra,
686   REFIID riid,
687   LPVOID *ppvOut)
688 {
689   IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
690 
691   FIXME("(%p,0x%8x,0x%8x,%s,%s,%p)-stub!\n", This, cfFlags, assocenum,
692         debugstr_w(pszExtra), debugstr_guid(riid), ppvOut);
693   return E_NOTIMPL;
694 }
695 
696 static const IQueryAssociationsVtbl IQueryAssociations_vtbl =
697 {
698   IQueryAssociations_fnQueryInterface,
699   IQueryAssociations_fnAddRef,
700   IQueryAssociations_fnRelease,
701   IQueryAssociations_fnInit,
702   IQueryAssociations_fnGetString,
703   IQueryAssociations_fnGetKey,
704   IQueryAssociations_fnGetData,
705   IQueryAssociations_fnGetEnum
706 };
707 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.