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.

201 lines
6.1 KiB

  1. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  2. //
  3. // persist.h
  4. //
  5. // The definitions for cdf IPersistFile and IPersistFolder interfaces. This
  6. // class is used as a base class by the CCdfView and CIconHandler.
  7. //
  8. // History:
  9. //
  10. // 4/23/97 edwardp Created.
  11. //
  12. ////////////////////////////////////////////////////////////////////////////////
  13. //
  14. // Check for previous includes of this file.
  15. //
  16. #ifndef _PERSIST_H_
  17. #define _PERSIST_H_
  18. //
  19. // Function prototypes.
  20. //
  21. HRESULT ClearGleamFlag(LPCTSTR pszURL, LPCTSTR pszPath);
  22. HRESULT URLGetLocalFileName(LPCTSTR pszURL,
  23. LPTSTR szLocalFile,
  24. int cch,
  25. FILETIME* pftLastMod);
  26. HRESULT URLGetLastModTime(LPCTSTR pszURL, FILETIME* pftLastMod);
  27. //
  28. // Data types.
  29. //
  30. typedef enum _tagINITTYPE
  31. {
  32. IT_UNKNOWN = 0,
  33. IT_FILE,
  34. IT_INI,
  35. IT_SHORTCUT
  36. } INITTYPE;
  37. //
  38. // Parse flags.
  39. //
  40. #define PARSE_LOCAL 0x00000001
  41. #define PARSE_NET 0x00000002
  42. #define PARSE_REPARSE 0x00000004
  43. #define PARSE_REMOVEGLEAM 0x00000008
  44. //
  45. // Strings used by initialization helper functions.
  46. //
  47. #define TSTR_INI_FILE TEXT(FILENAME_SEPARATOR_STR)##TEXT("desktop.ini") // Must include leading \.
  48. #define TSTR_INI_SECTION TEXT("Channel")
  49. #define TSTR_INI_URL TEXT("CDFURL")
  50. #define TSTR_INI_LOGO TEXT("Logo")
  51. #define TSTR_INI_WIDELOGO TEXT("WideLogo")
  52. #define TSTR_INI_ICON TEXT("Icon")
  53. //
  54. // Function protoypes
  55. //
  56. #define WM_NAVIGATE (WM_USER+1)
  57. #define WM_NAVIGATE_PANE (WM_USER+2)
  58. LRESULT CALLBACK NavigateWndProc(HWND hwnd, UINT msg, WPARAM wParam,
  59. LPARAM lParam);
  60. //
  61. // Class definition for CPersist
  62. //
  63. class CPersist : public IPersistFile,
  64. public IPersistFolder,
  65. public IPersistMoniker,
  66. public IOleObject
  67. {
  68. //
  69. // Methods.
  70. //
  71. public:
  72. // Constructor and destructor.
  73. CPersist(void);
  74. CPersist(BOOL bCdfParsed);
  75. ~CPersist(void);
  76. //IUnknown - Pure virtual functions.
  77. // IUnknown
  78. virtual STDMETHODIMP QueryInterface(REFIID, void **) PURE;
  79. virtual STDMETHODIMP_(ULONG) AddRef(void) PURE;
  80. virtual STDMETHODIMP_(ULONG) Release(void) PURE;
  81. //IPersist - Shared by IPersistFile and IPersistFolder.
  82. STDMETHODIMP GetClassID(LPCLSID lpClassID);
  83. //IPersistFile
  84. STDMETHODIMP IsDirty(void);
  85. STDMETHODIMP Load(LPCOLESTR pszFileName, DWORD dwMode);
  86. STDMETHODIMP Save(LPCOLESTR pszFileName, BOOL fRemember);
  87. STDMETHODIMP SaveCompleted(LPCOLESTR pszFileName);
  88. STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName);
  89. // IPersistFolder
  90. virtual STDMETHODIMP Initialize(LPCITEMIDLIST pidl);
  91. // IPersistMoniker
  92. //STDMETHODIMP IsDirty(void);
  93. STDMETHODIMP Load(BOOL fFullyAvailable, IMoniker* pIMoniker,
  94. IBindCtx* pIBindCtx, DWORD grfMode);
  95. STDMETHODIMP Save(IMoniker* pIMoniker, IBindCtx* pIBindCtx, BOOL fRemember);
  96. STDMETHODIMP SaveCompleted(IMoniker* pIMoniker, IBindCtx* pIBindCtx);
  97. STDMETHODIMP GetCurMoniker(IMoniker** ppIMoniker);
  98. // IOleObject.
  99. STDMETHODIMP SetClientSite(IOleClientSite *pClientSite);
  100. STDMETHODIMP GetClientSite(IOleClientSite **ppClientSite);
  101. STDMETHODIMP SetHostNames(LPCOLESTR szContainerApp,
  102. LPCOLESTR szContainerObj);
  103. STDMETHODIMP Close(DWORD dwSaveOption);
  104. STDMETHODIMP SetMoniker(DWORD dwWhichMoniker, IMoniker *pmk);
  105. STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
  106. IMoniker **ppmk);
  107. STDMETHODIMP InitFromData(IDataObject *pDataObject, BOOL fCreation,
  108. DWORD dwReserved);
  109. STDMETHODIMP GetClipboardData(DWORD dwReserved,IDataObject **ppDataObject);
  110. STDMETHODIMP DoVerb(LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
  111. LONG lindex,HWND hwndParent,LPCRECT lprcPosRect);
  112. STDMETHODIMP EnumVerbs(IEnumOLEVERB **ppEnumOleVerb);
  113. STDMETHODIMP Update(void);
  114. STDMETHODIMP IsUpToDate(void);
  115. STDMETHODIMP GetUserClassID(CLSID *pClsid);
  116. STDMETHODIMP GetUserType(DWORD dwFormOfType, LPOLESTR *pszUserType);
  117. STDMETHODIMP SetExtent(DWORD dwDrawAspect, SIZEL *psizel);
  118. STDMETHODIMP GetExtent(DWORD dwDrawAspect, SIZEL *psizel);
  119. STDMETHODIMP Advise(IAdviseSink *pAdvSink, DWORD *pdwConnection);
  120. STDMETHODIMP Unadvise(DWORD dwConnection);
  121. STDMETHODIMP EnumAdvise(IEnumSTATDATA **ppenumAdvise);
  122. STDMETHODIMP GetMiscStatus(DWORD dwAspect, DWORD *pdwStatus);
  123. STDMETHODIMP SetColorScheme(LOGPALETTE *pLogpal);
  124. //protected:
  125. //Helper functions derived classes can call.
  126. HRESULT ParseCdf(HWND hwndOwner, IXMLDocument** ppIXMLDocument,
  127. DWORD dwParseFlags);
  128. BSTR ReadFromIni(LPCTSTR pszKey);
  129. BOOL IsUnreadCdf(void);
  130. BOOL IsRecentlyChangedURL(LPCTSTR pszURL);
  131. private:
  132. // Internal helper functions.
  133. HRESULT Parse(LPTSTR szURL, IXMLDocument** ppIXMLDocument);
  134. INITTYPE GetInitType(LPTSTR szPath);
  135. BOOL ReadFromIni(LPCTSTR pszKey, LPTSTR szOut, int cch);
  136. HRESULT InitializeFromURL(LPTSTR szURL, IXMLDocument** ppIXMLDocument,
  137. DWORD dwParseFlags);
  138. HRESULT OpenChannel(LPCWSTR pszSubscribedURL);
  139. HWND CreateNavigationWorkerWindow(HWND hwndParent,
  140. IWebBrowser2* pIWebBrowser2);
  141. void QuickCheckInitType( void );
  142. //
  143. // Member variables.
  144. //
  145. protected:
  146. BOOL m_bCdfParsed;
  147. TCHAR m_szPath[INTERNET_MAX_URL_LENGTH];
  148. LPOLESTR m_polestrURL;
  149. IWebBrowser2* m_pIWebBrowser2;
  150. HWND m_hwnd;
  151. IXMLDocument* m_pIXMLDocument;
  152. BOOL m_fPendingNavigation;
  153. INITTYPE m_rgInitType;
  154. #ifdef IMP_CLIENTSITE
  155. IOleClientSite* m_pOleClientSite;
  156. #endif
  157. };
  158. #endif // _PERSIST_H_