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.

157 lines
4.7 KiB

  1. #pragma once
  2. #ifndef _SHCUT_DLL_H
  3. #define _SHCUT_DLL_H
  4. #include <objbase.h>
  5. #include <windows.h>
  6. #include <shlobj.h>
  7. #include "refcount.hpp"
  8. #include "fusenet.h"
  9. // Shortcut flags
  10. typedef enum _fusshcutflags
  11. {
  12. FUSSHCUT_FL_NOTDIRTY = 0x0000,
  13. FUSSHCUT_FL_DIRTY = 0x0001,
  14. ALL_FUSSHCUT_FLAGS //= FUSSHCUT_FL_DIRTY
  15. }
  16. FUSSHCUTFLAGS;
  17. #define DEFAULTSHOWCMD SW_NORMAL
  18. // BUGBUG?: revise length restrictions
  19. #define DISPLAYNAMESTRINGLENGTH 26
  20. #define TYPESTRINGLENGTH 20
  21. #define MAX_URL_LENGTH 2084 // same as INTERNET_MAX_URL_LENGTH+1 from wininet.h
  22. // Clases and interfaces
  23. class CFusionShortcutClassFactory : public IClassFactory
  24. {
  25. public:
  26. CFusionShortcutClassFactory ();
  27. // IUnknown Methods
  28. STDMETHOD_ (ULONG, AddRef) ();
  29. STDMETHOD_ (ULONG, Release) ();
  30. STDMETHOD (QueryInterface) (REFIID, void **);
  31. // IClassFactory Moethods
  32. STDMETHOD (LockServer) (BOOL);
  33. STDMETHOD (CreateInstance) (IUnknown*,REFIID,void**);
  34. protected:
  35. long _cRef;
  36. };
  37. // Shortcut Shell extension
  38. class CFusionShortcut : public RefCount,
  39. public IExtractIcon,
  40. public IPersistFile,
  41. public IShellExtInit,
  42. public IShellLink,
  43. public IShellPropSheetExt,
  44. public IQueryInfo
  45. {
  46. public:
  47. CFusionShortcut(void);
  48. ~CFusionShortcut(void);
  49. // IUnknown methods
  50. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppvObj);
  51. ULONG STDMETHODCALLTYPE AddRef(void);
  52. ULONG STDMETHODCALLTYPE Release(void);
  53. // IExtractIcon methods
  54. HRESULT STDMETHODCALLTYPE GetIconLocation(UINT uFlags, LPWSTR pwzIconFile, UINT ucchMax, PINT pniIcon, PUINT puFlags);
  55. HRESULT STDMETHODCALLTYPE Extract(LPCWSTR pcwzFile, UINT uIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT ucIconSize);
  56. // IPersist method
  57. HRESULT STDMETHODCALLTYPE GetClassID(CLSID* pclsid);
  58. // IPersistFile methods
  59. HRESULT STDMETHODCALLTYPE IsDirty(void);
  60. HRESULT STDMETHODCALLTYPE Save(LPCOLESTR pcwszFileName, BOOL bRemember);
  61. HRESULT STDMETHODCALLTYPE SaveCompleted(LPCOLESTR pcwszFileName);
  62. HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pcwszFileName, DWORD dwMode);
  63. HRESULT STDMETHODCALLTYPE GetCurFile(LPOLESTR *ppwszFileName);
  64. // IShellExtInit method
  65. HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pcidlFolder, IDataObject* pidobj, HKEY hkeyProgID);
  66. // IShellLink methods
  67. HRESULT STDMETHODCALLTYPE SetPath(LPCWSTR pcwzPath);
  68. HRESULT STDMETHODCALLTYPE GetPath(LPWSTR pwzFile, int ncFileBufLen, PWIN32_FIND_DATA pwfd, DWORD dwFlags);
  69. HRESULT STDMETHODCALLTYPE SetRelativePath(LPCWSTR pcwzRelativePath, DWORD dwReserved);
  70. HRESULT STDMETHODCALLTYPE SetIDList(LPCITEMIDLIST pcidl);
  71. HRESULT STDMETHODCALLTYPE GetIDList(LPITEMIDLIST *ppidl);
  72. HRESULT STDMETHODCALLTYPE SetDescription(LPCWSTR pcwzDescription);
  73. HRESULT STDMETHODCALLTYPE GetDescription(LPWSTR pwzDescription, int ncDesciptionBufLen);
  74. HRESULT STDMETHODCALLTYPE SetArguments(LPCWSTR pcwzArgs);
  75. HRESULT STDMETHODCALLTYPE GetArguments(LPWSTR pwzArgs, int ncArgsBufLen);
  76. HRESULT STDMETHODCALLTYPE SetWorkingDirectory(LPCWSTR pcwzWorkingDirectory);
  77. HRESULT STDMETHODCALLTYPE GetWorkingDirectory(LPWSTR pwzWorkingDirectory, int ncbLen);
  78. HRESULT STDMETHODCALLTYPE SetHotkey(WORD wHotkey);
  79. HRESULT STDMETHODCALLTYPE GetHotkey(PWORD pwHotkey);
  80. HRESULT STDMETHODCALLTYPE SetShowCmd(int nShowCmd);
  81. HRESULT STDMETHODCALLTYPE GetShowCmd(PINT pnShowCmd);
  82. HRESULT STDMETHODCALLTYPE SetIconLocation(LPCWSTR pcwzIconFile, int niIcon);
  83. HRESULT STDMETHODCALLTYPE GetIconLocation(LPWSTR pwzIconFile, int ncbLen, PINT pniIcon);
  84. HRESULT STDMETHODCALLTYPE Resolve(HWND hwnd, DWORD dwFlags);
  85. // IShellPropSheetExt methods
  86. HRESULT STDMETHODCALLTYPE AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam);
  87. HRESULT STDMETHODCALLTYPE ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplaceWith, LPARAM lParam);
  88. // IQueryInfo methods
  89. HRESULT STDMETHODCALLTYPE GetInfoFlags(DWORD *pdwFlags);
  90. HRESULT STDMETHODCALLTYPE GetInfoTip(DWORD dwFlags, LPWSTR *ppwszTip);
  91. // other get/set methods (used by prop sheet)
  92. HRESULT STDMETHODCALLTYPE SetCodebase(LPCWSTR pcwzCodebase);
  93. HRESULT STDMETHODCALLTYPE GetCodebase(LPWSTR pwzCodebase, int ncbLen);
  94. // other methods
  95. HRESULT STDMETHODCALLTYPE GetAssemblyIdentity(LPASSEMBLY_IDENTITY* ppAsmId);
  96. HRESULT STDMETHODCALLTYPE GetCurFile(LPWSTR pwzFile, UINT ucbLen);
  97. HRESULT STDMETHODCALLTYPE Dirty(BOOL bDirty);
  98. private:
  99. DWORD m_dwFlags;
  100. LPWSTR m_pwzShortcutFile;
  101. LPWSTR m_pwzPath;
  102. LPWSTR m_pwzDesc;
  103. LPWSTR m_pwzIconFile;
  104. int m_niIcon;
  105. LPWSTR m_pwzWorkingDirectory;
  106. int m_nShowCmd;
  107. WORD m_wHotkey;
  108. LPWSTR m_pwzCodebase;
  109. LPASSEMBLY_IDENTITY m_pIdentity;
  110. };
  111. extern const GUID CLSID_FusionShortcut;
  112. #endif // _SHCUT_DLL_H