Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9 KiB

  1. #ifndef FASSOC_H
  2. #define FASSOC_H
  3. STDAPI RevertLegacyVerb(LPCWSTR pszExt, LPCWSTR pszVerb);
  4. STDAPI RevertLegacyClass(LPCWSTR pszExt);
  5. STDAPI OpenHandlerKeyForExtension(LPCWSTR pszExt, LPCWSTR pszHandler, HKEY *phk);
  6. STDAPI SHAssocEnumHandlers(LPCTSTR pszExtra, IEnumAssocHandlers **ppEnumHandler);
  7. STDAPI CTaskEnumHKCR_Create(IRunnableTask **pptask);
  8. STDAPI GetHandlerForBinary(LPCWSTR pszPath, LPWSTR pszHandler, DWORD cchHandler);
  9. typedef enum
  10. {
  11. UASET_CLEAR = 0,
  12. UASET_APPLICATION,
  13. UASET_PROGID,
  14. } UASET;
  15. STDAPI UserAssocSet(UASET set, LPCWSTR pszExt, LPCWSTR pszSet);
  16. // helper class for using IAssocHandler
  17. // consumed by both fsassoc.cpp and openwith.cpp
  18. class CAppInfo
  19. {
  20. public:
  21. CAppInfo(IAssocHandler *pah)
  22. : _pah(pah), _iIcon(-1)
  23. {
  24. _pah->AddRef();
  25. }
  26. ~CAppInfo()
  27. {
  28. if (_pszName)
  29. CoTaskMemFree(_pszName);
  30. if (_pszUIName)
  31. CoTaskMemFree(_pszUIName);
  32. _pah->Release();
  33. }
  34. BOOL Init()
  35. {
  36. return SUCCEEDED(_pah->GetName(&_pszName))
  37. && SUCCEEDED(_pah->GetUIName(&_pszUIName))
  38. && -1 != IconIndex();
  39. }
  40. IAssocHandler *Handler() { return _pah; }
  41. LPCWSTR Name() { return _pszName;}
  42. LPCWSTR UIName() { return _pszUIName;}
  43. int IconIndex()
  44. {
  45. CSmartCoTaskMem<WCHAR> pszIcon;
  46. int iIndex;
  47. if (_iIcon == -1 && SUCCEEDED(_pah->GetIconLocation(&pszIcon, &iIndex)))
  48. {
  49. _iIcon = Shell_GetCachedImageIndex(pszIcon, iIndex, 0);
  50. if (-1 == _iIcon)
  51. {
  52. _iIcon = Shell_GetCachedImageIndex(c_szShell32Dll, II_APPLICATION, 0);
  53. }
  54. }
  55. return _iIcon;
  56. }
  57. protected:
  58. IAssocHandler *_pah;
  59. LPWSTR _pszName;
  60. LPWSTR _pszUIName;
  61. int _iIcon;
  62. };
  63. #endif //FASSOC_H