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.

195 lines
8.2 KiB

  1. #include "offline.h"
  2. HRESULT SubscriptionItemFromCookie(BOOL fCreateNew, const SUBSCRIPTIONCOOKIE UNALIGNED *pCookie,
  3. ISubscriptionItem **ppSubscriptionItem);
  4. HRESULT AddUpdateSubscription(SUBSCRIPTIONCOOKIE UNALIGNED *pCookie,
  5. SUBSCRIPTIONITEMINFO *psii,
  6. LPCWSTR pwszURL,
  7. ULONG nProps,
  8. const LPWSTR rgwszName[],
  9. VARIANT rgValue[]);
  10. BOOL ItemKeyNameFromCookie(const SUBSCRIPTIONCOOKIE *pCookie,
  11. TCHAR *pszKeyName,
  12. DWORD cchKeyName);
  13. BOOL OpenItemKey(const SUBSCRIPTIONCOOKIE *pCookie, BOOL fCreate, REGSAM samDesired, HKEY *phkey);
  14. HRESULT GetInfoFromDataObject(IDataObject *pido,
  15. TCHAR *pszPath, DWORD cchPath,
  16. TCHAR *pszFriendlyName, DWORD cchFriendlyName,
  17. TCHAR *pszURL, DWORD cchURL,
  18. INIT_SRC_ENUM *peInitSrc);
  19. HRESULT DoGetItemFromURL(LPCTSTR pszURL, ISubscriptionItem **ppSubscriptionItem);
  20. HRESULT DoGetItemFromURLW(LPCWSTR pwszURL, ISubscriptionItem **ppSubscriptionItem);
  21. HRESULT DoAbortItems(
  22. /* [in] */ DWORD dwNumCookies,
  23. /* [size_is][in] */ const SUBSCRIPTIONCOOKIE *pCookies);
  24. HRESULT DoCreateSubscriptionItem(
  25. /* [in] */ const SUBSCRIPTIONITEMINFO *pSubscriptionItemInfo,
  26. /* [out] */ SUBSCRIPTIONCOOKIE *pNewCookie,
  27. /* [out] */ ISubscriptionItem **ppSubscriptionItem);
  28. HRESULT DoCloneSubscriptionItem(
  29. /* [in] */ ISubscriptionItem *pSubscriptionItem,
  30. /* [out] */ SUBSCRIPTIONCOOKIE *pNewCookie,
  31. /* [out] */ ISubscriptionItem **ppSubscriptionItem);
  32. HRESULT DoDeleteSubscriptionItem(
  33. /* [in] */ const SUBSCRIPTIONCOOKIE UNALIGNED *pCookie,
  34. /* [in] */ BOOL fAbortItem);
  35. //
  36. // Subscription manager
  37. //
  38. class CSubscriptionMgr : public IShellPropSheetExt,
  39. public IShellExtInit,
  40. public ISubscriptionMgr2,
  41. public ISubscriptionMgrPriv
  42. {
  43. friend INT_PTR CALLBACK SummarizeDesktopSubscriptionDlgProc(HWND, UINT, WPARAM, LPARAM);
  44. friend POOEBuf Summary_GetBuf(HWND hdlg);
  45. protected:
  46. long m_cRef;
  47. LPMYPIDL _pidl;
  48. SUBSCRIPTIONCOOKIE m_cookie;
  49. TCHAR m_pszURL[INTERNET_MAX_URL_LENGTH];
  50. TCHAR m_pszFriendly[MAX_PATH];
  51. TCHAR m_pszPath[MAX_PATH];
  52. POOEBuf m_pBuf;
  53. IUnknown * m_pUIHelper;
  54. UINT m_nPages;
  55. INIT_SRC_ENUM m_eInitSrc;
  56. SUBSCRIPTIONTYPE m_oldType;
  57. private:
  58. ~CSubscriptionMgr();
  59. public:
  60. CSubscriptionMgr();
  61. // IUnknown members
  62. STDMETHODIMP QueryInterface(REFIID, void **);
  63. STDMETHODIMP_(ULONG) AddRef(void);
  64. STDMETHODIMP_(ULONG) Release(void);
  65. // IShellExtInit members
  66. STDMETHODIMP Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT lpdobj, HKEY hkeyProgID);
  67. // IShellPropSheetExt
  68. STDMETHODIMP AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  69. STDMETHODIMP ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplacePage, LPARAM lParam);
  70. // ISubscriptionMgr
  71. STDMETHODIMP DeleteSubscription(LPCWSTR pURL, HWND hwnd);
  72. STDMETHODIMP IsSubscribed(LPCWSTR pURL, BOOL *);
  73. STDMETHODIMP GetDefaultInfo(SUBSCRIPTIONTYPE subType, SUBSCRIPTIONINFO *pInfo);
  74. STDMETHODIMP GetSubscriptionInfo(LPCWSTR pwszURL,
  75. SUBSCRIPTIONINFO *pInfo);
  76. STDMETHODIMP ShowSubscriptionProperties(LPCWSTR pURL, HWND hwnd);
  77. STDMETHODIMP CreateSubscription(HWND hwnd,
  78. LPCWSTR pwszURL,
  79. LPCWSTR pwszFriendlyName,
  80. DWORD dwFlags,
  81. SUBSCRIPTIONTYPE subsType,
  82. SUBSCRIPTIONINFO *pInfo);
  83. STDMETHODIMP UpdateSubscription(LPCWSTR pwszURL);
  84. STDMETHODIMP UpdateAll();
  85. // ISubscriptionMgr2
  86. STDMETHODIMP GetItemFromURL(LPCWSTR pwszURL,
  87. ISubscriptionItem **ppSubscriptionItem);
  88. STDMETHODIMP GetItemFromCookie(const SUBSCRIPTIONCOOKIE *pSubscriptionCookie,
  89. ISubscriptionItem **ppSubscriptionItem);
  90. STDMETHODIMP GetSubscriptionRunState(DWORD dwNumCookies,
  91. const SUBSCRIPTIONCOOKIE *pCookies,
  92. DWORD *pdwRunState);
  93. STDMETHODIMP EnumSubscriptions(DWORD dwFlags,
  94. IEnumSubscription **ppEnumSubscriptions);
  95. STDMETHODIMP UpdateItems(DWORD dwFlags,
  96. DWORD dwNumCookies,
  97. const SUBSCRIPTIONCOOKIE *pCookies);
  98. STDMETHODIMP AbortItems(DWORD dwNumCookies,
  99. const SUBSCRIPTIONCOOKIE *pCookies);
  100. STDMETHODIMP AbortAll();
  101. // ISubscriptionMgrPriv
  102. STDMETHODIMP CreateSubscriptionItem(const SUBSCRIPTIONITEMINFO *pSubscriptionItemInfo,
  103. SUBSCRIPTIONCOOKIE *pNewCookie,
  104. ISubscriptionItem **ppSubscriptionItem);
  105. STDMETHODIMP CloneSubscriptionItem(ISubscriptionItem *pSubscriptionItem,
  106. SUBSCRIPTIONCOOKIE *pNewCookie,
  107. ISubscriptionItem **ppSubscriptionItem);
  108. STDMETHODIMP DeleteSubscriptionItem(const SUBSCRIPTIONCOOKIE *pCookie);
  109. STDMETHODIMP RemovePages(HWND hdlg);
  110. STDMETHODIMP SaveSubscription();
  111. STDMETHODIMP URLChange(LPCWSTR pwszNewURL);
  112. HRESULT CountSubscriptions(SUBSCRIPTIONTYPE subType, PDWORD pdwCount);
  113. protected:
  114. void ChangeSubscriptionValues(OOEBuf *pCurrent, SUBSCRIPTIONINFO *pNew);
  115. // HRESULT ResyncData(HWND);
  116. BOOL IsValidSubscriptionInfo(SUBSCRIPTIONTYPE subType, SUBSCRIPTIONINFO *pSI);
  117. //helpers for CreateSubscription -- not exported via ISubscriptionMgr
  118. STDMETHODIMP CreateSubscriptionNoSummary(HWND hwnd,
  119. LPCWSTR pwszURL,
  120. LPCWSTR pwszFriendlyName,
  121. DWORD dwFlags,
  122. SUBSCRIPTIONTYPE subsType,
  123. SUBSCRIPTIONINFO *pInfo);
  124. STDMETHODIMP CreateDesktopSubscription(HWND hwnd,
  125. LPCWSTR pwszURL,
  126. LPCWSTR pwszFriendlyName,
  127. DWORD dwFlags,
  128. SUBSCRIPTIONTYPE subsType,
  129. SUBSCRIPTIONINFO *pInfo);
  130. };
  131. class CEnumSubscription : public IEnumSubscription
  132. {
  133. public:
  134. CEnumSubscription();
  135. HRESULT Initialize(DWORD dwFlags);
  136. HRESULT CopyRange(ULONG nStart, ULONG nCount, SUBSCRIPTIONCOOKIE *pCookies, ULONG *pnCopied);
  137. // IUnknown members
  138. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  139. STDMETHODIMP_(ULONG) AddRef();
  140. STDMETHODIMP_(ULONG) Release();
  141. // IEnumSubscription
  142. STDMETHODIMP Next(
  143. /* [in] */ ULONG celt,
  144. /* [length_is][size_is][out] */ SUBSCRIPTIONCOOKIE *rgelt,
  145. /* [out] */ ULONG *pceltFetched);
  146. STDMETHODIMP Skip(
  147. /* [in] */ ULONG celt);
  148. STDMETHODIMP Reset( void);
  149. STDMETHODIMP Clone(
  150. /* [out] */ IEnumSubscription **ppenum);
  151. STDMETHODIMP GetCount(
  152. /* [out] */ ULONG *pnCount);
  153. private:
  154. ~CEnumSubscription();
  155. ULONG m_nCurrent;
  156. ULONG m_nCount;
  157. ULONG m_cRef;
  158. SUBSCRIPTIONCOOKIE *m_pCookies;
  159. };