Source code of Windows XP (NT5)
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.

276 lines
6.8 KiB

  1. /*
  2. * urlprop.h - URL properties class implementation description.
  3. */
  4. #ifndef _URLPROP_H_
  5. #define _URLPROP_H_
  6. #include "propstg.h"
  7. #ifdef __cplusplus
  8. // URL Property object
  9. class URLProp : public IPropertyStorage
  10. {
  11. private:
  12. ULONG m_cRef;
  13. CLSID m_clsid;
  14. FMTID m_fmtid;
  15. DWORD m_grfFlags;
  16. // private methods
  17. protected:
  18. HPROPSTG m_hstg;
  19. FILETIME m_ftModified;
  20. FILETIME m_ftCreated;
  21. FILETIME m_ftAccessed;
  22. public:
  23. URLProp(void);
  24. virtual ~URLProp(void);
  25. // IUnknown methods
  26. virtual STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppvObj);
  27. virtual STDMETHODIMP_(ULONG) AddRef(void);
  28. virtual STDMETHODIMP_(ULONG) Release(void);
  29. // IPropertyStorage methods
  30. virtual STDMETHODIMP ReadMultiple(ULONG cpspec, const PROPSPEC rgpspec[], PROPVARIANT rgvar[]);
  31. virtual STDMETHODIMP WriteMultiple(ULONG cpspec, const PROPSPEC rgpspec[], const PROPVARIANT rgvar[], PROPID propidNameFirst);
  32. virtual STDMETHODIMP DeleteMultiple(ULONG cpspec, const PROPSPEC rgpspec[]);
  33. virtual STDMETHODIMP ReadPropertyNames(ULONG cpropid, const PROPID rgpropid[], LPOLESTR rglpwstrName[]);
  34. virtual STDMETHODIMP WritePropertyNames(ULONG cpropid, const PROPID rgpropid[], const LPOLESTR rglpwstrName[]);
  35. virtual STDMETHODIMP DeletePropertyNames(ULONG cpropid, const PROPID rgpropid[]);
  36. virtual STDMETHODIMP SetClass(REFCLSID clsid);
  37. virtual STDMETHODIMP Commit(DWORD grfCommitFlags);
  38. virtual STDMETHODIMP Revert(void);
  39. virtual STDMETHODIMP Enum(IEnumSTATPROPSTG** ppenm);
  40. virtual STDMETHODIMP Stat(STATPROPSETSTG* pstatpsstg);
  41. virtual STDMETHODIMP SetTimes(const FILETIME* pmtime, const FILETIME* pctime, const FILETIME* patime);
  42. // other methods
  43. virtual STDMETHODIMP Init(void);
  44. STDMETHODIMP GetProp(PROPID pid, LPTSTR pszBuf, int cchBuf);
  45. STDMETHODIMP GetProp(PROPID pid, int * piVal);
  46. STDMETHODIMP GetProp(PROPID pid, LPDWORD pdwVal);
  47. STDMETHODIMP GetProp(PROPID pid, WORD * pwVal);
  48. STDMETHODIMP GetProp(PROPID pid, IStream **ppStream);
  49. STDMETHODIMP SetProp(PROPID pid, LPCTSTR psz);
  50. STDMETHODIMP SetProp(PROPID pid, int iVal);
  51. STDMETHODIMP SetProp(PROPID pid, DWORD dwVal);
  52. STDMETHODIMP SetProp(PROPID pid, WORD wVal);
  53. STDMETHODIMP SetProp(PROPID pid, IStream *pStream);
  54. STDMETHODIMP IsDirty(void);
  55. #ifdef DEBUG
  56. virtual STDMETHODIMP_(void) Dump(void);
  57. friend BOOL IsValidPCURLProp(const URLProp *pcurlprop);
  58. #endif
  59. };
  60. typedef URLProp * PURLProp;
  61. typedef const URLProp CURLProp;
  62. typedef const URLProp * PCURLProp;
  63. // Internet Shortcut Property object
  64. class IntshcutProp : public URLProp
  65. {
  66. typedef URLProp super;
  67. private:
  68. TCHAR m_szFile[MAX_PATH];
  69. // private methods
  70. STDMETHODIMP LoadFromFile(LPCTSTR pszFile);
  71. public:
  72. IntshcutProp(void);
  73. ~IntshcutProp(void);
  74. // IPropertyStorage methods
  75. virtual STDMETHODIMP Commit(DWORD grfCommitFlags);
  76. // other methods
  77. STDMETHODIMP Init(void);
  78. STDMETHODIMP InitFromFile(LPCTSTR pszFile);
  79. STDMETHODIMP SetFileName(LPCTSTR pszFile);
  80. STDMETHODIMP SetURLProp(LPCTSTR pszURL, DWORD dwFlags);
  81. STDMETHODIMP SetIDListProp(LPCITEMIDLIST pcidl);
  82. STDMETHODIMP SetProp(PROPID pid, LPCTSTR psz);
  83. STDMETHODIMP SetProp(PROPID pid, int iVal) { return super::SetProp(pid, iVal); }
  84. STDMETHODIMP SetProp(PROPID pid, DWORD dwVal) { return super::SetProp(pid, dwVal); }
  85. STDMETHODIMP SetProp(PROPID pid, WORD wVal) { return super::SetProp(pid, wVal); }
  86. STDMETHODIMP SetProp(PROPID pid, IStream *pStream) { return super::SetProp(pid, pStream); }
  87. #ifdef DEBUG
  88. virtual STDMETHODIMP_(void) Dump(void);
  89. friend BOOL IsValidPCIntshcutProp(const IntshcutProp *pcisprop);
  90. #endif
  91. };
  92. typedef IntshcutProp * PIntshcutProp;
  93. typedef const IntshcutProp CIntshcutProp;
  94. typedef const IntshcutProp * PCIntshcutProp;
  95. class Intshcut;
  96. // Internet Site Property object
  97. class IntsiteProp : public URLProp
  98. {
  99. private:
  100. TCHAR m_szURL[INTERNET_MAX_URL_LENGTH];
  101. Intshcut * m_pintshcut;
  102. BOOL m_fPrivate;
  103. // private methods
  104. STDMETHODIMP LoadFromDB(LPCTSTR pszURL);
  105. public:
  106. IntsiteProp(void);
  107. ~IntsiteProp(void);
  108. // IPropertyStorage methods
  109. virtual STDMETHODIMP Commit(DWORD grfCommitFlags);
  110. // other methods
  111. STDMETHODIMP Init(void);
  112. STDMETHODIMP InitFromDB(LPCTSTR pszURL, Intshcut * pintshcut, BOOL fPrivObj);
  113. #ifdef DEBUG
  114. virtual STDMETHODIMP_(void) Dump(void);
  115. friend BOOL IsValidPCIntsiteProp(const IntsiteProp *pcisprop);
  116. #endif
  117. };
  118. typedef IntsiteProp * PIntsiteProp;
  119. typedef const IntsiteProp CIntsiteProp;
  120. typedef const IntsiteProp * PCIntsiteProp;
  121. DWORD
  122. SchemeTypeFromURL(
  123. LPCTSTR pszURL);
  124. #endif // __cplusplus
  125. //
  126. // Prototypes for all modules
  127. //
  128. #ifdef __cplusplus
  129. extern "C" {
  130. #endif
  131. typedef const PARSEDURL CPARSEDURL;
  132. typedef const PARSEDURL * PCPARSEDURL;
  133. STDAPI
  134. CIntshcutProp_CreateInstance(
  135. IN LPUNKNOWN punkOuter,
  136. IN REFIID riid,
  137. OUT LPVOID * ppvOut);
  138. STDAPI
  139. CIntsiteProp_CreateInstance(
  140. IN LPUNKNOWN punkOuter,
  141. IN REFIID riid,
  142. OUT LPVOID * ppvOut);
  143. // Worker routines for updating the ini file corresponding to a shortcut
  144. HRESULT
  145. ReadStringFromFile(IN LPCTSTR pszFile,
  146. IN LPCTSTR pszSectionName,
  147. IN LPCTSTR pszName,
  148. OUT LPWSTR * ppwsz,
  149. IN CHAR * pszBuf);
  150. HRESULT
  151. ReadBStrFromFile(IN LPCTSTR pszFile,
  152. IN LPCTSTR pszSectionName,
  153. IN LPCTSTR pszName,
  154. OUT BSTR * pBstr);
  155. HRESULT
  156. ReadUnsignedFromFile(
  157. IN LPCTSTR pszFile,
  158. IN LPCTSTR pszSectionName,
  159. IN LPCTSTR pszName,
  160. OUT LPDWORD pdwVal);
  161. HRESULT
  162. WriteGenericString(
  163. IN LPCTSTR pszFile,
  164. IN LPCTSTR pszSectionName,
  165. IN LPCTSTR pszName,
  166. IN LPCWSTR pwsz);
  167. HRESULT
  168. WriteSignedToFile(
  169. IN LPCTSTR pszFile,
  170. IN LPCTSTR pszSectionName,
  171. IN LPCTSTR pszName,
  172. IN int nVal);
  173. HRESULT
  174. WriteUnsignedToFile(
  175. IN LPCTSTR pszFile,
  176. IN LPCTSTR pszSectionName,
  177. IN LPCTSTR pszName,
  178. IN DWORD nVal);
  179. HRESULT
  180. ReadURLFromFile(
  181. IN LPCTSTR pszFile,
  182. IN LPCTSTR pszSectionName,
  183. OUT LPTSTR * ppsz);
  184. HRESULT
  185. ReadBinaryFromFile(
  186. IN LPCTSTR pszFile,
  187. IN LPCTSTR pszSectionName,
  188. IN LPCTSTR pszName,
  189. IN LPVOID pvData,
  190. IN DWORD cbData);
  191. HRESULT
  192. WriteBinaryToFile(
  193. IN LPCTSTR pszFile,
  194. IN LPCTSTR pszSectionName,
  195. IN LPCTSTR pszName,
  196. IN LPVOID pvData,
  197. IN DWORD cbSize);
  198. #define DeletePrivateProfileString(pszSection, pszKey, pszFile) \
  199. WritePrivateProfileString(pszSection, pszKey, NULL, pszFile)
  200. #define SHDeleteIniString(pszSection, pszKey, pszFile) \
  201. SHSetIniString(pszSection, pszKey, NULL, pszFile)
  202. #ifdef __cplusplus
  203. }; // extern "C"
  204. #endif
  205. #endif // _URLPROP_H_