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.

1342 lines
58 KiB

  1. /*****************************************************************************\
  2. * *
  3. * shlwapi.h - Interface for the Windows light-weight utility APIs *
  4. * *
  5. * Version 1.0 *
  6. * *
  7. * Copyright (c) Microsoft Corporation. All rights reserved. *
  8. * *
  9. \*****************************************************************************/
  10. #ifndef _INC_SHLWAPI
  11. #define _INC_SHLWAPI
  12. #ifndef NOSHLWAPI
  13. #include <objbase.h>
  14. #include <shtypes.h>
  15. #ifndef _WINRESRC_
  16. #ifndef _WIN32_IE
  17. #define _WIN32_IE 0x0501
  18. #else
  19. #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
  20. #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
  21. #endif
  22. #endif
  23. #endif
  24. #ifdef UNIX
  25. typedef interface IInternetSecurityMgrSite IInternetSecurityMgrSite;
  26. typedef interface IInternetSecurityManager IInternetSecurityManager;
  27. typedef interface IInternetHostSecurityManager IInternetHostSecurityManager;
  28. #endif
  29. //
  30. // Define API decoration for direct importing of DLL references.
  31. //
  32. #ifndef WINSHLWAPI
  33. #if !defined(_SHLWAPI_)
  34. #define LWSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  35. #define LWSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  36. #define LWSTDAPIV EXTERN_C DECLSPEC_IMPORT HRESULT STDAPIVCALLTYPE
  37. #define LWSTDAPIV_(type) EXTERN_C DECLSPEC_IMPORT type STDAPIVCALLTYPE
  38. #else
  39. #define LWSTDAPI STDAPI
  40. #define LWSTDAPI_(type) STDAPI_(type)
  41. #define LWSTDAPIV STDAPIV
  42. #define LWSTDAPIV_(type) STDAPIV_(type)
  43. #endif
  44. #endif // WINSHLWAPI
  45. #ifdef _WIN32
  46. #include <pshpack8.h>
  47. #endif
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. //
  52. // Users of this header may define any number of these constants to avoid
  53. // the definitions of each functional group.
  54. //
  55. // NO_SHLWAPI_STRFCNS String functions
  56. // NO_SHLWAPI_PATH Path functions
  57. // NO_SHLWAPI_REG Registry functions
  58. // NO_SHLWAPI_STREAM Stream functions
  59. // NO_SHLWAPI_GDI GDI helper functions
  60. #ifndef NO_SHLWAPI_STRFCNS
  61. //
  62. //=============== String Routines ===================================
  63. //
  64. LWSTDAPI_(LPSTR) StrChrA(LPCSTR lpStart, WORD wMatch);
  65. LWSTDAPI_(LPWSTR) StrChrW(LPCWSTR lpStart, WCHAR wMatch);
  66. LWSTDAPI_(LPSTR) StrChrIA(LPCSTR lpStart, WORD wMatch);
  67. LWSTDAPI_(LPWSTR) StrChrIW(LPCWSTR lpStart, WCHAR wMatch);
  68. LWSTDAPI_(int) StrCmpNA(LPCSTR lpStr1, LPCSTR lpStr2, int nChar);
  69. LWSTDAPI_(int) StrCmpNW(LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar);
  70. LWSTDAPI_(int) StrCmpNIA(LPCSTR lpStr1, LPCSTR lpStr2, int nChar);
  71. LWSTDAPI_(int) StrCmpNIW(LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar);
  72. LWSTDAPI_(int) StrCSpnA(LPCSTR lpStr, LPCSTR lpSet);
  73. LWSTDAPI_(int) StrCSpnW(LPCWSTR lpStr, LPCWSTR lpSet);
  74. LWSTDAPI_(int) StrCSpnIA(LPCSTR lpStr, LPCSTR lpSet);
  75. LWSTDAPI_(int) StrCSpnIW(LPCWSTR lpStr, LPCWSTR lpSet);
  76. LWSTDAPI_(LPSTR) StrDupA(LPCSTR lpSrch);
  77. LWSTDAPI_(LPWSTR) StrDupW(LPCWSTR lpSrch);
  78. LWSTDAPI_(LPSTR) StrFormatByteSizeA(DWORD dw, LPSTR szBuf, UINT uiBufSize);
  79. LWSTDAPI_(LPSTR) StrFormatByteSize64A(LONGLONG qdw, LPSTR szBuf, UINT uiBufSize);
  80. LWSTDAPI_(LPWSTR) StrFormatByteSizeW(LONGLONG qdw, LPWSTR szBuf, UINT uiBufSize);
  81. LWSTDAPI_(LPWSTR) StrFormatKBSizeW(LONGLONG qdw, LPWSTR szBuf, UINT uiBufSize);
  82. LWSTDAPI_(LPSTR) StrFormatKBSizeA(LONGLONG qdw, LPSTR szBuf, UINT uiBufSize);
  83. LWSTDAPI_(int) StrFromTimeIntervalA(LPSTR pszOut, UINT cchMax, DWORD dwTimeMS, int digits);
  84. LWSTDAPI_(int) StrFromTimeIntervalW(LPWSTR pszOut, UINT cchMax, DWORD dwTimeMS, int digits);
  85. LWSTDAPI_(BOOL) StrIsIntlEqualA(BOOL fCaseSens, LPCSTR lpString1, LPCSTR lpString2, int nChar);
  86. LWSTDAPI_(BOOL) StrIsIntlEqualW(BOOL fCaseSens, LPCWSTR lpString1, LPCWSTR lpString2, int nChar);
  87. LWSTDAPI_(LPSTR) StrNCatA(LPSTR psz1, LPCSTR psz2, int cchMax);
  88. LWSTDAPI_(LPWSTR) StrNCatW(LPWSTR psz1, LPCWSTR psz2, int cchMax);
  89. LWSTDAPI_(LPSTR) StrPBrkA(LPCSTR psz, LPCSTR pszSet);
  90. LWSTDAPI_(LPWSTR) StrPBrkW(LPCWSTR psz, LPCWSTR pszSet);
  91. LWSTDAPI_(LPSTR) StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);
  92. LWSTDAPI_(LPWSTR) StrRChrW(LPCWSTR lpStart, LPCWSTR lpEnd, WCHAR wMatch);
  93. LWSTDAPI_(LPSTR) StrRChrIA(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);
  94. LWSTDAPI_(LPWSTR) StrRChrIW(LPCWSTR lpStart, LPCWSTR lpEnd, WCHAR wMatch);
  95. LWSTDAPI_(LPSTR) StrRStrIA(LPCSTR lpSource, LPCSTR lpLast, LPCSTR lpSrch);
  96. LWSTDAPI_(LPWSTR) StrRStrIW(LPCWSTR lpSource, LPCWSTR lpLast, LPCWSTR lpSrch);
  97. LWSTDAPI_(int) StrSpnA(LPCSTR psz, LPCSTR pszSet);
  98. LWSTDAPI_(int) StrSpnW(LPCWSTR psz, LPCWSTR pszSet);
  99. LWSTDAPI_(LPSTR) StrStrA(LPCSTR lpFirst, LPCSTR lpSrch);
  100. LWSTDAPI_(LPWSTR) StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch);
  101. LWSTDAPI_(LPSTR) StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch);
  102. LWSTDAPI_(LPWSTR) StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch);
  103. LWSTDAPI_(int) StrToIntA(LPCSTR lpSrc);
  104. LWSTDAPI_(int) StrToIntW(LPCWSTR lpSrc);
  105. LWSTDAPI_(BOOL) StrToIntExA(LPCSTR pszString, DWORD dwFlags, int * piRet);
  106. LWSTDAPI_(BOOL) StrToIntExW(LPCWSTR pszString, DWORD dwFlags, int * piRet);
  107. #if (_WIN32_IE >= 0x0600)
  108. LWSTDAPI_(BOOL) StrToInt64ExA(LPCSTR pszString, DWORD dwFlags, LONGLONG * pllRet);
  109. LWSTDAPI_(BOOL) StrToInt64ExW(LPCWSTR pszString, DWORD dwFlags, LONGLONG * pllRet);
  110. #endif
  111. LWSTDAPI_(BOOL) StrTrimA(LPSTR psz, LPCSTR pszTrimChars);
  112. LWSTDAPI_(BOOL) StrTrimW(LPWSTR psz, LPCWSTR pszTrimChars);
  113. LWSTDAPI_(LPWSTR) StrCatW(LPWSTR psz1, LPCWSTR psz2);
  114. LWSTDAPI_(int) StrCmpW(LPCWSTR psz1, LPCWSTR psz2);
  115. LWSTDAPI_(int) StrCmpIW(LPCWSTR psz1, LPCWSTR psz2);
  116. LWSTDAPI_(LPWSTR) StrCpyW(LPWSTR psz1, LPCWSTR psz2);
  117. LWSTDAPI_(LPWSTR) StrCpyNW(LPWSTR psz1, LPCWSTR psz2, int cchMax);
  118. LWSTDAPI_(LPWSTR) StrCatBuffW(LPWSTR pszDest, LPCWSTR pszSrc, int cchDestBuffSize);
  119. LWSTDAPI_(LPSTR) StrCatBuffA(LPSTR pszDest, LPCSTR pszSrc, int cchDestBuffSize);
  120. LWSTDAPI_(BOOL) ChrCmpIA(WORD w1, WORD w2);
  121. LWSTDAPI_(BOOL) ChrCmpIW(WCHAR w1, WCHAR w2);
  122. LWSTDAPI_(int) wvnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, va_list arglist);
  123. LWSTDAPI_(int) wvnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, va_list arglist);
  124. LWSTDAPIV_(int) wnsprintfA(LPSTR lpOut, int cchLimitIn, LPCSTR lpFmt, ...);
  125. LWSTDAPIV_(int) wnsprintfW(LPWSTR lpOut, int cchLimitIn, LPCWSTR lpFmt, ...);
  126. #define StrIntlEqNA( s1, s2, nChar) StrIsIntlEqualA( TRUE, s1, s2, nChar)
  127. #define StrIntlEqNW( s1, s2, nChar) StrIsIntlEqualW( TRUE, s1, s2, nChar)
  128. #define StrIntlEqNIA(s1, s2, nChar) StrIsIntlEqualA(FALSE, s1, s2, nChar)
  129. #define StrIntlEqNIW(s1, s2, nChar) StrIsIntlEqualW(FALSE, s1, s2, nChar)
  130. LWSTDAPI StrRetToStrA(STRRET *pstr, LPCITEMIDLIST pidl, LPSTR *ppsz);
  131. LWSTDAPI StrRetToStrW(STRRET *pstr, LPCITEMIDLIST pidl, LPWSTR *ppsz);
  132. #ifdef UNICODE
  133. #define StrRetToStr StrRetToStrW
  134. #else
  135. #define StrRetToStr StrRetToStrA
  136. #endif // !UNICODE
  137. LWSTDAPI StrRetToBufA(STRRET *pstr, LPCITEMIDLIST pidl, LPSTR pszBuf, UINT cchBuf);
  138. LWSTDAPI StrRetToBufW(STRRET *pstr, LPCITEMIDLIST pidl, LPWSTR pszBuf, UINT cchBuf);
  139. #ifdef UNICODE
  140. #define StrRetToBuf StrRetToBufW
  141. #else
  142. #define StrRetToBuf StrRetToBufA
  143. #endif // !UNICODE
  144. LWSTDAPI StrRetToBSTR(STRRET *pstr, LPCITEMIDLIST pidl, BSTR *pbstr);
  145. // helper to duplicate a string using the task allocator
  146. LWSTDAPI SHStrDupA(LPCSTR psz, WCHAR **ppwsz);
  147. LWSTDAPI SHStrDupW(LPCWSTR psz, WCHAR **ppwsz);
  148. #ifdef UNICODE
  149. #define SHStrDup SHStrDupW
  150. #else
  151. #define SHStrDup SHStrDupA
  152. #endif // !UNICODE
  153. LWSTDAPI_(int) StrCmpLogicalW(LPCWSTR psz1, LPCWSTR psz2);
  154. LWSTDAPI_(DWORD) StrCatChainW(LPWSTR pszDst, DWORD cchDst, DWORD ichAt, LPCWSTR pszSrc);
  155. LWSTDAPI SHLoadIndirectString(LPCWSTR pszSource, LPWSTR pszOutBuf, UINT cchOutBuf, void **ppvReserved);
  156. #ifdef UNICODE
  157. #define StrChr StrChrW
  158. #define StrRChr StrRChrW
  159. #define StrChrI StrChrIW
  160. #define StrRChrI StrRChrIW
  161. #define StrCmpN StrCmpNW
  162. #define StrCmpNI StrCmpNIW
  163. #define StrStr StrStrW
  164. #define StrStrI StrStrIW
  165. #define StrDup StrDupW
  166. #define StrRStrI StrRStrIW
  167. #define StrCSpn StrCSpnW
  168. #define StrCSpnI StrCSpnIW
  169. #define StrSpn StrSpnW
  170. #define StrToInt StrToIntW
  171. #define StrPBrk StrPBrkW
  172. #define StrToIntEx StrToIntExW
  173. #if (_WIN32_IE >= 0x0600)
  174. #define StrToInt64Ex StrToInt64ExW
  175. #endif
  176. #define StrFromTimeInterval StrFromTimeIntervalW
  177. #define StrIntlEqN StrIntlEqNW
  178. #define StrIntlEqNI StrIntlEqNIW
  179. #define StrFormatByteSize StrFormatByteSizeW
  180. #define StrFormatByteSize64 StrFormatByteSizeW
  181. #define StrFormatKBSize StrFormatKBSizeW
  182. #define StrNCat StrNCatW
  183. #define StrTrim StrTrimW
  184. #define StrCatBuff StrCatBuffW
  185. #define ChrCmpI ChrCmpIW
  186. #define wvnsprintf wvnsprintfW
  187. #define wnsprintf wnsprintfW
  188. #define StrIsIntlEqual StrIsIntlEqualW
  189. #else
  190. #define StrChr StrChrA
  191. #define StrRChr StrRChrA
  192. #define StrChrI StrChrIA
  193. #define StrRChrI StrRChrIA
  194. #define StrCmpN StrCmpNA
  195. #define StrCmpNI StrCmpNIA
  196. #define StrStr StrStrA
  197. #define StrStrI StrStrIA
  198. #define StrDup StrDupA
  199. #define StrRStrI StrRStrIA
  200. #define StrCSpn StrCSpnA
  201. #define StrCSpnI StrCSpnIA
  202. #define StrSpn StrSpnA
  203. #define StrToInt StrToIntA
  204. #define StrPBrk StrPBrkA
  205. #define StrToIntEx StrToIntExA
  206. #if (_WIN32_IE >= 0x0600)
  207. #define StrToInt64Ex StrToInt64ExA
  208. #endif
  209. #define StrFromTimeInterval StrFromTimeIntervalA
  210. #define StrIntlEqN StrIntlEqNA
  211. #define StrIntlEqNI StrIntlEqNIA
  212. #define StrFormatByteSize StrFormatByteSizeA
  213. #define StrFormatByteSize64 StrFormatByteSize64A
  214. #define StrFormatKBSize StrFormatKBSizeA
  215. #define StrNCat StrNCatA
  216. #define StrTrim StrTrimA
  217. #define StrCatBuff StrCatBuffA
  218. #define ChrCmpI ChrCmpIA
  219. #define wvnsprintf wvnsprintfA
  220. #define wnsprintf wnsprintfA
  221. #define StrIsIntlEqual StrIsIntlEqualA
  222. #endif
  223. // Backward compatible to NT's non-standard naming (strictly
  224. // for comctl32)
  225. //
  226. LWSTDAPI_(BOOL) IntlStrEqWorkerA(BOOL fCaseSens, LPCSTR lpString1, LPCSTR lpString2, int nChar);
  227. LWSTDAPI_(BOOL) IntlStrEqWorkerW(BOOL fCaseSens, LPCWSTR lpString1, LPCWSTR lpString2, int nChar);
  228. #define IntlStrEqNA( s1, s2, nChar) IntlStrEqWorkerA( TRUE, s1, s2, nChar)
  229. #define IntlStrEqNW( s1, s2, nChar) IntlStrEqWorkerW( TRUE, s1, s2, nChar)
  230. #define IntlStrEqNIA(s1, s2, nChar) IntlStrEqWorkerA(FALSE, s1, s2, nChar)
  231. #define IntlStrEqNIW(s1, s2, nChar) IntlStrEqWorkerW(FALSE, s1, s2, nChar)
  232. #ifdef UNICODE
  233. #define IntlStrEqN IntlStrEqNW
  234. #define IntlStrEqNI IntlStrEqNIW
  235. #else
  236. #define IntlStrEqN IntlStrEqNA
  237. #define IntlStrEqNI IntlStrEqNIA
  238. #endif
  239. #define SZ_CONTENTTYPE_HTMLA "text/html"
  240. #define SZ_CONTENTTYPE_HTMLW L"text/html"
  241. #define SZ_CONTENTTYPE_CDFA "application/x-cdf"
  242. #define SZ_CONTENTTYPE_CDFW L"application/x-cdf"
  243. #ifdef UNICODE
  244. #define SZ_CONTENTTYPE_HTML SZ_CONTENTTYPE_HTMLW
  245. #define SZ_CONTENTTYPE_CDF SZ_CONTENTTYPE_CDFW
  246. #else
  247. #define SZ_CONTENTTYPE_HTML SZ_CONTENTTYPE_HTMLA
  248. #define SZ_CONTENTTYPE_CDF SZ_CONTENTTYPE_CDFA
  249. #endif
  250. #define PathIsHTMLFileA(pszPath) PathIsContentTypeA(pszPath, SZ_CONTENTTYPE_HTMLA)
  251. #define PathIsHTMLFileW(pszPath) PathIsContentTypeW(pszPath, SZ_CONTENTTYPE_HTMLW)
  252. // Flags for StrToIntEx
  253. #define STIF_DEFAULT 0x00000000L
  254. #define STIF_SUPPORT_HEX 0x00000001L
  255. #define StrCatA lstrcatA
  256. #define StrCmpA lstrcmpA
  257. #define StrCmpIA lstrcmpiA
  258. #define StrCpyA lstrcpyA
  259. #define StrCpyNA lstrcpynA
  260. #define StrToLong StrToInt
  261. #define StrNCmp StrCmpN
  262. #define StrNCmpI StrCmpNI
  263. #define StrNCpy StrCpyN
  264. #define StrCatN StrNCat
  265. #ifdef UNICODE
  266. #define StrCat StrCatW
  267. #define StrCmp StrCmpW
  268. #define StrCmpI StrCmpIW
  269. #define StrCpy StrCpyW
  270. #define StrCpyN StrCpyNW
  271. #define StrCatBuff StrCatBuffW
  272. #else
  273. #define StrCat lstrcatA
  274. #define StrCmp lstrcmpA
  275. #define StrCmpI lstrcmpiA
  276. #define StrCpy lstrcpyA
  277. #define StrCpyN lstrcpynA
  278. #define StrCatBuff StrCatBuffA
  279. #endif
  280. #endif // NO_SHLWAPI_STRFCNS
  281. #ifndef NO_SHLWAPI_PATH
  282. //
  283. //=============== Path Routines ===================================
  284. //
  285. LWSTDAPI_(LPSTR) PathAddBackslashA(LPSTR pszPath);
  286. LWSTDAPI_(LPWSTR) PathAddBackslashW(LPWSTR pszPath);
  287. #ifdef UNICODE
  288. #define PathAddBackslash PathAddBackslashW
  289. #else
  290. #define PathAddBackslash PathAddBackslashA
  291. #endif // !UNICODE
  292. LWSTDAPI_(BOOL) PathAddExtensionA(LPSTR pszPath, LPCSTR pszExt);
  293. LWSTDAPI_(BOOL) PathAddExtensionW(LPWSTR pszPath, LPCWSTR pszExt);
  294. #ifdef UNICODE
  295. #define PathAddExtension PathAddExtensionW
  296. #else
  297. #define PathAddExtension PathAddExtensionA
  298. #endif // !UNICODE
  299. LWSTDAPI_(BOOL) PathAppendA(LPSTR pszPath, LPCSTR pMore);
  300. LWSTDAPI_(BOOL) PathAppendW(LPWSTR pszPath, LPCWSTR pMore);
  301. LWSTDAPI_(LPSTR) PathBuildRootA(LPSTR pszRoot, int iDrive);
  302. LWSTDAPI_(LPWSTR) PathBuildRootW(LPWSTR pszRoot, int iDrive);
  303. #ifdef UNICODE
  304. #define PathBuildRoot PathBuildRootW
  305. #else
  306. #define PathBuildRoot PathBuildRootA
  307. #endif // !UNICODE
  308. LWSTDAPI_(BOOL) PathCanonicalizeA(LPSTR pszBuf, LPCSTR pszPath);
  309. LWSTDAPI_(BOOL) PathCanonicalizeW(LPWSTR pszBuf, LPCWSTR pszPath);
  310. LWSTDAPI_(LPSTR) PathCombineA(LPSTR pszDest, LPCSTR pszDir, LPCSTR pszFile);
  311. LWSTDAPI_(LPWSTR) PathCombineW(LPWSTR pszDest, LPCWSTR pszDir, LPCWSTR pszFile);
  312. #ifdef UNICODE
  313. #define PathCombine PathCombineW
  314. #else
  315. #define PathCombine PathCombineA
  316. #endif // !UNICODE
  317. LWSTDAPI_(BOOL) PathCompactPathA(HDC hDC, LPSTR pszPath, UINT dx);
  318. LWSTDAPI_(BOOL) PathCompactPathW(HDC hDC, LPWSTR pszPath, UINT dx);
  319. LWSTDAPI_(BOOL) PathCompactPathExA(LPSTR pszOut, LPCSTR pszSrc, UINT cchMax, DWORD dwFlags);
  320. LWSTDAPI_(BOOL) PathCompactPathExW(LPWSTR pszOut, LPCWSTR pszSrc, UINT cchMax, DWORD dwFlags);
  321. LWSTDAPI_(int) PathCommonPrefixA(LPCSTR pszFile1, LPCSTR pszFile2, LPSTR achPath);
  322. LWSTDAPI_(int) PathCommonPrefixW(LPCWSTR pszFile1, LPCWSTR pszFile2, LPWSTR achPath);
  323. LWSTDAPI_(BOOL) PathFileExistsA(LPCSTR pszPath);
  324. LWSTDAPI_(BOOL) PathFileExistsW(LPCWSTR pszPath);
  325. #ifdef UNICODE
  326. #define PathFileExists PathFileExistsW
  327. #else
  328. #define PathFileExists PathFileExistsA
  329. #endif // !UNICODE
  330. LWSTDAPI_(LPSTR) PathFindExtensionA(LPCSTR pszPath);
  331. LWSTDAPI_(LPWSTR) PathFindExtensionW(LPCWSTR pszPath);
  332. #ifdef UNICODE
  333. #define PathFindExtension PathFindExtensionW
  334. #else
  335. #define PathFindExtension PathFindExtensionA
  336. #endif // !UNICODE
  337. LWSTDAPI_(LPSTR) PathFindFileNameA(LPCSTR pszPath);
  338. LWSTDAPI_(LPWSTR) PathFindFileNameW(LPCWSTR pszPath);
  339. #ifdef UNICODE
  340. #define PathFindFileName PathFindFileNameW
  341. #else
  342. #define PathFindFileName PathFindFileNameA
  343. #endif // !UNICODE
  344. LWSTDAPI_(LPSTR) PathFindNextComponentA(LPCSTR pszPath);
  345. LWSTDAPI_(LPWSTR) PathFindNextComponentW(LPCWSTR pszPath);
  346. #ifdef UNICODE
  347. #define PathFindNextComponent PathFindNextComponentW
  348. #else
  349. #define PathFindNextComponent PathFindNextComponentA
  350. #endif // !UNICODE
  351. LWSTDAPI_(BOOL) PathFindOnPathA(LPSTR pszPath, LPCSTR * ppszOtherDirs);
  352. LWSTDAPI_(BOOL) PathFindOnPathW(LPWSTR pszPath, LPCWSTR * ppszOtherDirs);
  353. LWSTDAPI_(LPSTR) PathGetArgsA(LPCSTR pszPath);
  354. LWSTDAPI_(LPWSTR) PathGetArgsW(LPCWSTR pszPath);
  355. #ifdef UNICODE
  356. #define PathGetArgs PathGetArgsW
  357. #else
  358. #define PathGetArgs PathGetArgsA
  359. #endif // !UNICODE
  360. LWSTDAPI_(LPCSTR) PathFindSuffixArrayA(LPCSTR pszPath, const LPCSTR *apszSuffix, int iArraySize);
  361. LWSTDAPI_(LPCWSTR) PathFindSuffixArrayW(LPCWSTR pszPath, const LPCWSTR *apszSuffix, int iArraySize);
  362. #ifdef UNICODE
  363. #define PathFindSuffixArray PathFindSuffixArrayW
  364. #else
  365. #define PathFindSuffixArray PathFindSuffixArrayA
  366. #endif // !UNICODE
  367. LWSTDAPI_(BOOL) PathIsLFNFileSpecA(LPCSTR lpName);
  368. LWSTDAPI_(BOOL) PathIsLFNFileSpecW(LPCWSTR lpName);
  369. #ifdef UNICODE
  370. #define PathIsLFNFileSpec PathIsLFNFileSpecW
  371. #else
  372. #define PathIsLFNFileSpec PathIsLFNFileSpecA
  373. #endif // !UNICODE
  374. LWSTDAPI_(UINT) PathGetCharTypeA(UCHAR ch);
  375. LWSTDAPI_(UINT) PathGetCharTypeW(WCHAR ch);
  376. // Return flags for PathGetCharType
  377. #define GCT_INVALID 0x0000
  378. #define GCT_LFNCHAR 0x0001
  379. #define GCT_SHORTCHAR 0x0002
  380. #define GCT_WILD 0x0004
  381. #define GCT_SEPARATOR 0x0008
  382. LWSTDAPI_(int) PathGetDriveNumberA(LPCSTR pszPath);
  383. LWSTDAPI_(int) PathGetDriveNumberW(LPCWSTR pszPath);
  384. #ifdef UNICODE
  385. #define PathGetDriveNumber PathGetDriveNumberW
  386. #else
  387. #define PathGetDriveNumber PathGetDriveNumberA
  388. #endif // !UNICODE
  389. LWSTDAPI_(BOOL) PathIsDirectoryA(LPCSTR pszPath);
  390. LWSTDAPI_(BOOL) PathIsDirectoryW(LPCWSTR pszPath);
  391. #ifdef UNICODE
  392. #define PathIsDirectory PathIsDirectoryW
  393. #else
  394. #define PathIsDirectory PathIsDirectoryA
  395. #endif // !UNICODE
  396. LWSTDAPI_(BOOL) PathIsDirectoryEmptyA(LPCSTR pszPath);
  397. LWSTDAPI_(BOOL) PathIsDirectoryEmptyW(LPCWSTR pszPath);
  398. #ifdef UNICODE
  399. #define PathIsDirectoryEmpty PathIsDirectoryEmptyW
  400. #else
  401. #define PathIsDirectoryEmpty PathIsDirectoryEmptyA
  402. #endif // !UNICODE
  403. LWSTDAPI_(BOOL) PathIsFileSpecA(LPCSTR pszPath);
  404. LWSTDAPI_(BOOL) PathIsFileSpecW(LPCWSTR pszPath);
  405. #ifdef UNICODE
  406. #define PathIsFileSpec PathIsFileSpecW
  407. #else
  408. #define PathIsFileSpec PathIsFileSpecA
  409. #endif // !UNICODE
  410. LWSTDAPI_(BOOL) PathIsPrefixA(LPCSTR pszPrefix, LPCSTR pszPath);
  411. LWSTDAPI_(BOOL) PathIsPrefixW(LPCWSTR pszPrefix, LPCWSTR pszPath);
  412. #ifdef UNICODE
  413. #define PathIsPrefix PathIsPrefixW
  414. #else
  415. #define PathIsPrefix PathIsPrefixA
  416. #endif // !UNICODE
  417. LWSTDAPI_(BOOL) PathIsRelativeA(LPCSTR pszPath);
  418. LWSTDAPI_(BOOL) PathIsRelativeW(LPCWSTR pszPath);
  419. #ifdef UNICODE
  420. #define PathIsRelative PathIsRelativeW
  421. #else
  422. #define PathIsRelative PathIsRelativeA
  423. #endif // !UNICODE
  424. LWSTDAPI_(BOOL) PathIsRootA(LPCSTR pszPath);
  425. LWSTDAPI_(BOOL) PathIsRootW(LPCWSTR pszPath);
  426. #ifdef UNICODE
  427. #define PathIsRoot PathIsRootW
  428. #else
  429. #define PathIsRoot PathIsRootA
  430. #endif // !UNICODE
  431. LWSTDAPI_(BOOL) PathIsSameRootA(LPCSTR pszPath1, LPCSTR pszPath2);
  432. LWSTDAPI_(BOOL) PathIsSameRootW(LPCWSTR pszPath1, LPCWSTR pszPath2);
  433. #ifdef UNICODE
  434. #define PathIsSameRoot PathIsSameRootW
  435. #else
  436. #define PathIsSameRoot PathIsSameRootA
  437. #endif // !UNICODE
  438. LWSTDAPI_(BOOL) PathIsUNCA(LPCSTR pszPath);
  439. LWSTDAPI_(BOOL) PathIsUNCW(LPCWSTR pszPath);
  440. #ifdef UNICODE
  441. #define PathIsUNC PathIsUNCW
  442. #else
  443. #define PathIsUNC PathIsUNCA
  444. #endif // !UNICODE
  445. LWSTDAPI_(BOOL) PathIsNetworkPathA(LPCSTR pszPath);
  446. LWSTDAPI_(BOOL) PathIsNetworkPathW(LPCWSTR pszPath);
  447. #ifdef UNICODE
  448. #define PathIsNetworkPath PathIsNetworkPathW
  449. #else
  450. #define PathIsNetworkPath PathIsNetworkPathA
  451. #endif // !UNICODE
  452. LWSTDAPI_(BOOL) PathIsUNCServerA(LPCSTR pszPath);
  453. LWSTDAPI_(BOOL) PathIsUNCServerW(LPCWSTR pszPath);
  454. #ifdef UNICODE
  455. #define PathIsUNCServer PathIsUNCServerW
  456. #else
  457. #define PathIsUNCServer PathIsUNCServerA
  458. #endif // !UNICODE
  459. LWSTDAPI_(BOOL) PathIsUNCServerShareA(LPCSTR pszPath);
  460. LWSTDAPI_(BOOL) PathIsUNCServerShareW(LPCWSTR pszPath);
  461. #ifdef UNICODE
  462. #define PathIsUNCServerShare PathIsUNCServerShareW
  463. #else
  464. #define PathIsUNCServerShare PathIsUNCServerShareA
  465. #endif // !UNICODE
  466. LWSTDAPI_(BOOL) PathIsContentTypeA(LPCSTR pszPath, LPCSTR pszContentType);
  467. LWSTDAPI_(BOOL) PathIsContentTypeW(LPCWSTR pszPath, LPCWSTR pszContentType);
  468. LWSTDAPI_(BOOL) PathIsURLA(LPCSTR pszPath);
  469. LWSTDAPI_(BOOL) PathIsURLW(LPCWSTR pszPath);
  470. #ifdef UNICODE
  471. #define PathIsURL PathIsURLW
  472. #else
  473. #define PathIsURL PathIsURLA
  474. #endif // !UNICODE
  475. LWSTDAPI_(BOOL) PathMakePrettyA(LPSTR pszPath);
  476. LWSTDAPI_(BOOL) PathMakePrettyW(LPWSTR pszPath);
  477. LWSTDAPI_(BOOL) PathMatchSpecA(LPCSTR pszFile, LPCSTR pszSpec);
  478. LWSTDAPI_(BOOL) PathMatchSpecW(LPCWSTR pszFile, LPCWSTR pszSpec);
  479. LWSTDAPI_(int) PathParseIconLocationA(LPSTR pszIconFile);
  480. LWSTDAPI_(int) PathParseIconLocationW(LPWSTR pszIconFile);
  481. LWSTDAPI_(void) PathQuoteSpacesA(LPSTR lpsz);
  482. LWSTDAPI_(void) PathQuoteSpacesW(LPWSTR lpsz);
  483. LWSTDAPI_(BOOL) PathRelativePathToA(LPSTR pszPath, LPCSTR pszFrom, DWORD dwAttrFrom, LPCSTR pszTo, DWORD dwAttrTo);
  484. LWSTDAPI_(BOOL) PathRelativePathToW(LPWSTR pszPath, LPCWSTR pszFrom, DWORD dwAttrFrom, LPCWSTR pszTo, DWORD dwAttrTo);
  485. LWSTDAPI_(void) PathRemoveArgsA(LPSTR pszPath);
  486. LWSTDAPI_(void) PathRemoveArgsW(LPWSTR pszPath);
  487. LWSTDAPI_(LPSTR) PathRemoveBackslashA(LPSTR pszPath);
  488. LWSTDAPI_(LPWSTR) PathRemoveBackslashW(LPWSTR pszPath);
  489. #ifdef UNICODE
  490. #define PathRemoveBackslash PathRemoveBackslashW
  491. #else
  492. #define PathRemoveBackslash PathRemoveBackslashA
  493. #endif // !UNICODE
  494. LWSTDAPI_(void) PathRemoveBlanksA(LPSTR pszPath);
  495. LWSTDAPI_(void) PathRemoveBlanksW(LPWSTR pszPath);
  496. LWSTDAPI_(void) PathRemoveExtensionA(LPSTR pszPath);
  497. LWSTDAPI_(void) PathRemoveExtensionW(LPWSTR pszPath);
  498. LWSTDAPI_(BOOL) PathRemoveFileSpecA(LPSTR pszPath);
  499. LWSTDAPI_(BOOL) PathRemoveFileSpecW(LPWSTR pszPath);
  500. LWSTDAPI_(BOOL) PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt);
  501. LWSTDAPI_(BOOL) PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt);
  502. LWSTDAPI_(BOOL) PathSearchAndQualifyA(LPCSTR pszPath, LPSTR pszBuf, UINT cchBuf);
  503. LWSTDAPI_(BOOL) PathSearchAndQualifyW(LPCWSTR pszPath, LPWSTR pszBuf, UINT cchBuf);
  504. LWSTDAPI_(void) PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath);
  505. LWSTDAPI_(void) PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath);
  506. LWSTDAPI_(LPSTR) PathSkipRootA(LPCSTR pszPath);
  507. LWSTDAPI_(LPWSTR) PathSkipRootW(LPCWSTR pszPath);
  508. #ifdef UNICODE
  509. #define PathSkipRoot PathSkipRootW
  510. #else
  511. #define PathSkipRoot PathSkipRootA
  512. #endif // !UNICODE
  513. LWSTDAPI_(void) PathStripPathA(LPSTR pszPath);
  514. LWSTDAPI_(void) PathStripPathW(LPWSTR pszPath);
  515. #ifdef UNICODE
  516. #define PathStripPath PathStripPathW
  517. #else
  518. #define PathStripPath PathStripPathA
  519. #endif // !UNICODE
  520. LWSTDAPI_(BOOL) PathStripToRootA(LPSTR pszPath);
  521. LWSTDAPI_(BOOL) PathStripToRootW(LPWSTR pszPath);
  522. #ifdef UNICODE
  523. #define PathStripToRoot PathStripToRootW
  524. #else
  525. #define PathStripToRoot PathStripToRootA
  526. #endif // !UNICODE
  527. LWSTDAPI_(void) PathUnquoteSpacesA(LPSTR lpsz);
  528. LWSTDAPI_(void) PathUnquoteSpacesW(LPWSTR lpsz);
  529. LWSTDAPI_(BOOL) PathMakeSystemFolderA(LPCSTR pszPath);
  530. LWSTDAPI_(BOOL) PathMakeSystemFolderW(LPCWSTR pszPath);
  531. #ifdef UNICODE
  532. #define PathMakeSystemFolder PathMakeSystemFolderW
  533. #else
  534. #define PathMakeSystemFolder PathMakeSystemFolderA
  535. #endif // !UNICODE
  536. LWSTDAPI_(BOOL) PathUnmakeSystemFolderA(LPCSTR pszPath);
  537. LWSTDAPI_(BOOL) PathUnmakeSystemFolderW(LPCWSTR pszPath);
  538. #ifdef UNICODE
  539. #define PathUnmakeSystemFolder PathUnmakeSystemFolderW
  540. #else
  541. #define PathUnmakeSystemFolder PathUnmakeSystemFolderA
  542. #endif // !UNICODE
  543. LWSTDAPI_(BOOL) PathIsSystemFolderA(LPCSTR pszPath, DWORD dwAttrb);
  544. LWSTDAPI_(BOOL) PathIsSystemFolderW(LPCWSTR pszPath, DWORD dwAttrb);
  545. #ifdef UNICODE
  546. #define PathIsSystemFolder PathIsSystemFolderW
  547. #else
  548. #define PathIsSystemFolder PathIsSystemFolderA
  549. #endif // !UNICODE
  550. LWSTDAPI_(void) PathUndecorateA(LPSTR pszPath);
  551. LWSTDAPI_(void) PathUndecorateW(LPWSTR pszPath);
  552. #ifdef UNICODE
  553. #define PathUndecorate PathUndecorateW
  554. #else
  555. #define PathUndecorate PathUndecorateA
  556. #endif // !UNICODE
  557. LWSTDAPI_(BOOL) PathUnExpandEnvStringsA(LPCSTR pszPath, LPSTR pszBuf, UINT cchBuf);
  558. LWSTDAPI_(BOOL) PathUnExpandEnvStringsW(LPCWSTR pszPath, LPWSTR pszBuf, UINT cchBuf);
  559. #ifdef UNICODE
  560. #define PathUnExpandEnvStrings PathUnExpandEnvStringsW
  561. #else
  562. #define PathUnExpandEnvStrings PathUnExpandEnvStringsA
  563. #endif // !UNICODE
  564. #ifdef UNICODE
  565. #define PathAppend PathAppendW
  566. #define PathCanonicalize PathCanonicalizeW
  567. #define PathCompactPath PathCompactPathW
  568. #define PathCompactPathEx PathCompactPathExW
  569. #define PathCommonPrefix PathCommonPrefixW
  570. #define PathFindOnPath PathFindOnPathW
  571. #define PathGetCharType PathGetCharTypeW
  572. #define PathIsContentType PathIsContentTypeW
  573. #define PathIsHTMLFile PathIsHTMLFileW
  574. #define PathMakePretty PathMakePrettyW
  575. #define PathMatchSpec PathMatchSpecW
  576. #define PathParseIconLocation PathParseIconLocationW
  577. #define PathQuoteSpaces PathQuoteSpacesW
  578. #define PathRelativePathTo PathRelativePathToW
  579. #define PathRemoveArgs PathRemoveArgsW
  580. #define PathRemoveBlanks PathRemoveBlanksW
  581. #define PathRemoveExtension PathRemoveExtensionW
  582. #define PathRemoveFileSpec PathRemoveFileSpecW
  583. #define PathRenameExtension PathRenameExtensionW
  584. #define PathSearchAndQualify PathSearchAndQualifyW
  585. #define PathSetDlgItemPath PathSetDlgItemPathW
  586. #define PathUnquoteSpaces PathUnquoteSpacesW
  587. #else
  588. #define PathAppend PathAppendA
  589. #define PathCanonicalize PathCanonicalizeA
  590. #define PathCompactPath PathCompactPathA
  591. #define PathCompactPathEx PathCompactPathExA
  592. #define PathCommonPrefix PathCommonPrefixA
  593. #define PathFindOnPath PathFindOnPathA
  594. #define PathGetCharType PathGetCharTypeA
  595. #define PathIsContentType PathIsContentTypeA
  596. #define PathIsHTMLFile PathIsHTMLFileA
  597. #define PathMakePretty PathMakePrettyA
  598. #define PathMatchSpec PathMatchSpecA
  599. #define PathParseIconLocation PathParseIconLocationA
  600. #define PathQuoteSpaces PathQuoteSpacesA
  601. #define PathRelativePathTo PathRelativePathToA
  602. #define PathRemoveArgs PathRemoveArgsA
  603. #define PathRemoveBlanks PathRemoveBlanksA
  604. #define PathRemoveExtension PathRemoveExtensionA
  605. #define PathRemoveFileSpec PathRemoveFileSpecA
  606. #define PathRenameExtension PathRenameExtensionA
  607. #define PathSearchAndQualify PathSearchAndQualifyA
  608. #define PathSetDlgItemPath PathSetDlgItemPathA
  609. #define PathUnquoteSpaces PathUnquoteSpacesA
  610. #endif
  611. typedef enum {
  612. URL_SCHEME_INVALID = -1,
  613. URL_SCHEME_UNKNOWN = 0,
  614. URL_SCHEME_FTP,
  615. URL_SCHEME_HTTP,
  616. URL_SCHEME_GOPHER,
  617. URL_SCHEME_MAILTO,
  618. URL_SCHEME_NEWS,
  619. URL_SCHEME_NNTP,
  620. URL_SCHEME_TELNET,
  621. URL_SCHEME_WAIS,
  622. URL_SCHEME_FILE,
  623. URL_SCHEME_MK,
  624. URL_SCHEME_HTTPS,
  625. URL_SCHEME_SHELL,
  626. URL_SCHEME_SNEWS,
  627. URL_SCHEME_LOCAL,
  628. URL_SCHEME_JAVASCRIPT,
  629. URL_SCHEME_VBSCRIPT,
  630. URL_SCHEME_ABOUT,
  631. URL_SCHEME_RES,
  632. URL_SCHEME_MSSHELLROOTED,
  633. URL_SCHEME_MSSHELLIDLIST,
  634. URL_SCHEME_MSHELP,
  635. URL_SCHEME_MAXVALUE
  636. } URL_SCHEME;
  637. typedef enum {
  638. URL_PART_NONE = 0,
  639. URL_PART_SCHEME = 1,
  640. URL_PART_HOSTNAME,
  641. URL_PART_USERNAME,
  642. URL_PART_PASSWORD,
  643. URL_PART_PORT,
  644. URL_PART_QUERY,
  645. } URL_PART;
  646. typedef enum {
  647. URLIS_URL,
  648. URLIS_OPAQUE,
  649. URLIS_NOHISTORY,
  650. URLIS_FILEURL,
  651. URLIS_APPLIABLE,
  652. URLIS_DIRECTORY,
  653. URLIS_HASQUERY,
  654. } URLIS;
  655. #define URL_UNESCAPE 0x10000000
  656. #define URL_ESCAPE_UNSAFE 0x20000000
  657. #define URL_PLUGGABLE_PROTOCOL 0x40000000
  658. #define URL_WININET_COMPATIBILITY 0x80000000
  659. #define URL_DONT_ESCAPE_EXTRA_INFO 0x02000000
  660. #define URL_DONT_UNESCAPE_EXTRA_INFO URL_DONT_ESCAPE_EXTRA_INFO
  661. #define URL_BROWSER_MODE URL_DONT_ESCAPE_EXTRA_INFO
  662. #define URL_ESCAPE_SPACES_ONLY 0x04000000
  663. #define URL_DONT_SIMPLIFY 0x08000000
  664. #define URL_NO_META URL_DONT_SIMPLIFY
  665. #define URL_UNESCAPE_INPLACE 0x00100000
  666. #define URL_CONVERT_IF_DOSPATH 0x00200000
  667. #define URL_UNESCAPE_HIGH_ANSI_ONLY 0x00400000
  668. #define URL_INTERNAL_PATH 0x00800000 // Will escape #'s in paths
  669. #define URL_FILE_USE_PATHURL 0x00010000
  670. #define URL_ESCAPE_PERCENT 0x00001000
  671. #define URL_ESCAPE_SEGMENT_ONLY 0x00002000 // Treat the entire URL param as one URL segment.
  672. #define URL_PARTFLAG_KEEPSCHEME 0x00000001
  673. #define URL_APPLY_DEFAULT 0x00000001
  674. #define URL_APPLY_GUESSSCHEME 0x00000002
  675. #define URL_APPLY_GUESSFILE 0x00000004
  676. #define URL_APPLY_FORCEAPPLY 0x00000008
  677. LWSTDAPI_(int) UrlCompareA(LPCSTR psz1, LPCSTR psz2, BOOL fIgnoreSlash);
  678. LWSTDAPI_(int) UrlCompareW(LPCWSTR psz1, LPCWSTR psz2, BOOL fIgnoreSlash);
  679. LWSTDAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative, LPSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags);
  680. LWSTDAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, LPWSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags);
  681. LWSTDAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags);
  682. LWSTDAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags);
  683. LWSTDAPI_(BOOL) UrlIsOpaqueA(LPCSTR pszURL);
  684. LWSTDAPI_(BOOL) UrlIsOpaqueW(LPCWSTR pszURL);
  685. LWSTDAPI_(BOOL) UrlIsNoHistoryA(LPCSTR pszURL);
  686. LWSTDAPI_(BOOL) UrlIsNoHistoryW(LPCWSTR pszURL);
  687. #define UrlIsFileUrlA(pszURL) UrlIsA(pszURL, URLIS_FILEURL)
  688. #define UrlIsFileUrlW(pszURL) UrlIsW(pszURL, URLIS_FILEURL)
  689. LWSTDAPI_(BOOL) UrlIsA(LPCSTR pszUrl, URLIS UrlIs);
  690. LWSTDAPI_(BOOL) UrlIsW(LPCWSTR pszUrl, URLIS UrlIs);
  691. LWSTDAPI_(LPCSTR) UrlGetLocationA(LPCSTR psz1);
  692. LWSTDAPI_(LPCWSTR) UrlGetLocationW(LPCWSTR psz1);
  693. LWSTDAPI UrlUnescapeA(LPSTR pszUrl, LPSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags);
  694. LWSTDAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags);
  695. LWSTDAPI UrlEscapeA(LPCSTR pszUrl, LPSTR pszEscaped, LPDWORD pcchEscaped, DWORD dwFlags);
  696. LWSTDAPI UrlEscapeW(LPCWSTR pszUrl, LPWSTR pszEscaped, LPDWORD pcchEscaped, DWORD dwFlags);
  697. LWSTDAPI UrlCreateFromPathA(LPCSTR pszPath, LPSTR pszUrl, LPDWORD pcchUrl, DWORD dwFlags);
  698. LWSTDAPI UrlCreateFromPathW(LPCWSTR pszPath, LPWSTR pszUrl, LPDWORD pcchUrl, DWORD dwFlags);
  699. LWSTDAPI PathCreateFromUrlA(LPCSTR pszUrl, LPSTR pszPath, LPDWORD pcchPath, DWORD dwFlags);
  700. LWSTDAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwFlags);
  701. LWSTDAPI UrlHashA(LPCSTR pszUrl, LPBYTE pbHash, DWORD cbHash);
  702. LWSTDAPI UrlHashW(LPCWSTR pszUrl, LPBYTE pbHash, DWORD cbHash);
  703. LWSTDAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwPart, DWORD dwFlags);
  704. LWSTDAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut, DWORD dwPart, DWORD dwFlags);
  705. LWSTDAPI UrlApplySchemeA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut, DWORD dwFlags);
  706. LWSTDAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwFlags);
  707. LWSTDAPI HashData(LPBYTE pbData, DWORD cbData, LPBYTE pbHash, DWORD cbHash);
  708. #ifdef UNICODE
  709. #define UrlCompare UrlCompareW
  710. #define UrlCombine UrlCombineW
  711. #define UrlCanonicalize UrlCanonicalizeW
  712. #define UrlIsOpaque UrlIsOpaqueW
  713. #define UrlIsFileUrl UrlIsFileUrlW
  714. #define UrlGetLocation UrlGetLocationW
  715. #define UrlUnescape UrlUnescapeW
  716. #define UrlEscape UrlEscapeW
  717. #define UrlCreateFromPath UrlCreateFromPathW
  718. #define PathCreateFromUrl PathCreateFromUrlW
  719. #define UrlHash UrlHashW
  720. #define UrlGetPart UrlGetPartW
  721. #define UrlApplyScheme UrlApplySchemeW
  722. #define UrlIs UrlIsW
  723. #else //!UNICODE
  724. #define UrlCompare UrlCompareA
  725. #define UrlCombine UrlCombineA
  726. #define UrlCanonicalize UrlCanonicalizeA
  727. #define UrlIsOpaque UrlIsOpaqueA
  728. #define UrlIsFileUrl UrlIsFileUrlA
  729. #define UrlGetLocation UrlGetLocationA
  730. #define UrlUnescape UrlUnescapeA
  731. #define UrlEscape UrlEscapeA
  732. #define UrlCreateFromPath UrlCreateFromPathA
  733. #define PathCreateFromUrl PathCreateFromUrlA
  734. #define UrlHash UrlHashA
  735. #define UrlGetPart UrlGetPartA
  736. #define UrlApplyScheme UrlApplySchemeA
  737. #define UrlIs UrlIsA
  738. #endif //UNICODE
  739. #define UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped) UrlCanonicalize(pszUrl, pszEscaped, pcchEscaped, URL_ESCAPE_SPACES_ONLY |URL_DONT_ESCAPE_EXTRA_INFO )
  740. #define UrlUnescapeInPlace(pszUrl, dwFlags) UrlUnescape(pszUrl, NULL, NULL, dwFlags | URL_UNESCAPE_INPLACE)
  741. #endif // NO_SHLWAPI_PATH
  742. #ifndef NO_SHLWAPI_REG
  743. //
  744. //=============== Registry Routines ===================================
  745. //
  746. // SHDeleteEmptyKey mimics RegDeleteKey as it behaves on NT.
  747. // SHDeleteKey mimics RegDeleteKey as it behaves on Win95.
  748. LWSTDAPI_(DWORD) SHDeleteEmptyKeyA(HKEY hkey, LPCSTR pszSubKey);
  749. LWSTDAPI_(DWORD) SHDeleteEmptyKeyW(HKEY hkey, LPCWSTR pszSubKey);
  750. #ifdef UNICODE
  751. #define SHDeleteEmptyKey SHDeleteEmptyKeyW
  752. #else
  753. #define SHDeleteEmptyKey SHDeleteEmptyKeyA
  754. #endif // !UNICODE
  755. LWSTDAPI_(DWORD) SHDeleteKeyA(HKEY hkey, LPCSTR pszSubKey);
  756. LWSTDAPI_(DWORD) SHDeleteKeyW(HKEY hkey, LPCWSTR pszSubKey);
  757. #ifdef UNICODE
  758. #define SHDeleteKey SHDeleteKeyW
  759. #else
  760. #define SHDeleteKey SHDeleteKeyA
  761. #endif // !UNICODE
  762. LWSTDAPI_(HKEY) SHRegDuplicateHKey(HKEY hkey);
  763. // These functions open the key, get/set/delete the value, then close
  764. // the key.
  765. LWSTDAPI_(DWORD) SHDeleteValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue);
  766. LWSTDAPI_(DWORD) SHDeleteValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue);
  767. #ifdef UNICODE
  768. #define SHDeleteValue SHDeleteValueW
  769. #else
  770. #define SHDeleteValue SHDeleteValueA
  771. #endif // !UNICODE
  772. LWSTDAPI_(DWORD) SHGetValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD *pdwType, void *pvData, DWORD *pcbData);
  773. LWSTDAPI_(DWORD) SHGetValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD *pdwType, void *pvData, DWORD *pcbData);
  774. #ifdef UNICODE
  775. #define SHGetValue SHGetValueW
  776. #else
  777. #define SHGetValue SHGetValueA
  778. #endif // !UNICODE
  779. LWSTDAPI_(DWORD) SHSetValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType, LPCVOID pvData, DWORD cbData);
  780. LWSTDAPI_(DWORD) SHSetValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwType, LPCVOID pvData, DWORD cbData);
  781. #ifdef UNICODE
  782. #define SHSetValue SHSetValueW
  783. #else
  784. #define SHSetValue SHSetValueA
  785. #endif // !UNICODE
  786. // These functions work just like RegQueryValueEx, except if the
  787. // data type is REG_EXPAND_SZ, then these will go ahead and expand
  788. // out the string. *pdwType will always be massaged to REG_SZ
  789. // if this happens. REG_SZ values are also guaranteed to be null
  790. // terminated.
  791. LWSTDAPI_(DWORD) SHQueryValueExA(HKEY hkey, LPCSTR pszValue, DWORD *pdwReserved, DWORD *pdwType, void *pvData, DWORD *pcbData);
  792. LWSTDAPI_(DWORD) SHQueryValueExW(HKEY hkey, LPCWSTR pszValue, DWORD *pdwReserved, DWORD *pdwType, void *pvData, DWORD *pcbData);
  793. #ifdef UNICODE
  794. #define SHQueryValueEx SHQueryValueExW
  795. #else
  796. #define SHQueryValueEx SHQueryValueExA
  797. #endif // !UNICODE
  798. // Enumeration functions support.
  799. LWSTDAPI_(LONG) SHEnumKeyExA(HKEY hkey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchName);
  800. LWSTDAPI_(LONG) SHEnumKeyExW(HKEY hkey, DWORD dwIndex, LPWSTR pszName, LPDWORD pcchName);
  801. LWSTDAPI_(LONG) SHEnumValueA(HKEY hkey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData);
  802. LWSTDAPI_(LONG) SHEnumValueW(HKEY hkey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData);
  803. LWSTDAPI_(LONG) SHQueryInfoKeyA(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen);
  804. LWSTDAPI_(LONG) SHQueryInfoKeyW(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen);
  805. // recursive key copy
  806. LWSTDAPI_(DWORD) SHCopyKeyA(HKEY hkeySrc, LPCSTR szSrcSubKey, HKEY hkeyDest, DWORD fReserved);
  807. LWSTDAPI_(DWORD) SHCopyKeyW(HKEY hkeySrc, LPCWSTR wszSrcSubKey, HKEY hkeyDest, DWORD fReserved);
  808. // Getting and setting file system paths with environment variables
  809. LWSTDAPI_(DWORD) SHRegGetPathA(HKEY hKey, LPCSTR pcszSubKey, LPCSTR pcszValue, LPSTR pszPath, DWORD dwFlags);
  810. LWSTDAPI_(DWORD) SHRegGetPathW(HKEY hKey, LPCWSTR pcszSubKey, LPCWSTR pcszValue, LPWSTR pszPath, DWORD dwFlags);
  811. LWSTDAPI_(DWORD) SHRegSetPathA(HKEY hKey, LPCSTR pcszSubKey, LPCSTR pcszValue, LPCSTR pcszPath, DWORD dwFlags);
  812. LWSTDAPI_(DWORD) SHRegSetPathW(HKEY hKey, LPCWSTR pcszSubKey, LPCWSTR pcszValue, LPCWSTR pcszPath, DWORD dwFlags);
  813. #ifdef UNICODE
  814. #define SHEnumKeyEx SHEnumKeyExW
  815. #define SHEnumValue SHEnumValueW
  816. #define SHQueryInfoKey SHQueryInfoKeyW
  817. #define SHCopyKey SHCopyKeyW
  818. #define SHRegGetPath SHRegGetPathW
  819. #define SHRegSetPath SHRegSetPathW
  820. #else
  821. #define SHEnumKeyEx SHEnumKeyExA
  822. #define SHEnumValue SHEnumValueA
  823. #define SHQueryInfoKey SHQueryInfoKeyA
  824. #define SHCopyKey SHCopyKeyA
  825. #define SHRegGetPath SHRegGetPathA
  826. #define SHRegSetPath SHRegSetPathA
  827. #endif
  828. //////////////////////////////////////////////
  829. // User Specific Registry Access Functions
  830. //////////////////////////////////////////////
  831. //
  832. // Type definitions.
  833. //
  834. typedef enum
  835. {
  836. SHREGDEL_DEFAULT = 0x00000000, // Delete's HKCU, or HKLM if HKCU is not found.
  837. SHREGDEL_HKCU = 0x00000001, // Delete HKCU only
  838. SHREGDEL_HKLM = 0x00000010, // Delete HKLM only.
  839. SHREGDEL_BOTH = 0x00000011, // Delete both HKCU and HKLM.
  840. } SHREGDEL_FLAGS;
  841. typedef enum
  842. {
  843. SHREGENUM_DEFAULT = 0x00000000, // Enumerates HKCU or HKLM if not found.
  844. SHREGENUM_HKCU = 0x00000001, // Enumerates HKCU only
  845. SHREGENUM_HKLM = 0x00000010, // Enumerates HKLM only.
  846. SHREGENUM_BOTH = 0x00000011, // Enumerates both HKCU and HKLM without duplicates.
  847. // This option is NYI.
  848. } SHREGENUM_FLAGS;
  849. #define SHREGSET_HKCU 0x00000001 // Write to HKCU if empty.
  850. #define SHREGSET_FORCE_HKCU 0x00000002 // Write to HKCU.
  851. #define SHREGSET_HKLM 0x00000004 // Write to HKLM if empty.
  852. #define SHREGSET_FORCE_HKLM 0x00000008 // Write to HKLM.
  853. #define SHREGSET_DEFAULT (SHREGSET_FORCE_HKCU | SHREGSET_HKLM) // Default is SHREGSET_FORCE_HKCU | SHREGSET_HKLM.
  854. typedef HANDLE HUSKEY; // HUSKEY is a Handle to a User Specific KEY.
  855. typedef HUSKEY *PHUSKEY;
  856. LWSTDAPI_(LONG) SHRegCreateUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, DWORD dwFlags);
  857. LWSTDAPI_(LONG) SHRegCreateUSKeyW(LPCWSTR pwzPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, DWORD dwFlags);
  858. LWSTDAPI_(LONG) SHRegOpenUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU);
  859. LWSTDAPI_(LONG) SHRegOpenUSKeyW(LPCWSTR pwzPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU);
  860. LWSTDAPI_(LONG) SHRegQueryUSValueA(HUSKEY hUSKey, LPCSTR pszValue, LPDWORD pdwType, void *pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  861. LWSTDAPI_(LONG) SHRegQueryUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, LPDWORD pdwType, void *pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  862. LWSTDAPI_(LONG) SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  863. LWSTDAPI_(LONG) SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  864. LWSTDAPI_(LONG) SHRegDeleteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags);
  865. LWSTDAPI_(LONG) SHRegDeleteEmptyUSKeyW(HUSKEY hUSKey, LPCWSTR pwzSubKey, SHREGDEL_FLAGS delRegFlags);
  866. LWSTDAPI_(LONG) SHRegDeleteEmptyUSKeyA(HUSKEY hUSKey, LPCSTR pszSubKey, SHREGDEL_FLAGS delRegFlags);
  867. LWSTDAPI_(LONG) SHRegDeleteUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, SHREGDEL_FLAGS delRegFlags);
  868. LWSTDAPI_(LONG) SHRegEnumUSKeyA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchName, SHREGENUM_FLAGS enumRegFlags);
  869. LWSTDAPI_(LONG) SHRegEnumUSKeyW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pwzName, LPDWORD pcchName, SHREGENUM_FLAGS enumRegFlags);
  870. LWSTDAPI_(LONG) SHRegEnumUSValueA(HUSKEY hUSkey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags);
  871. LWSTDAPI_(LONG) SHRegEnumUSValueW(HUSKEY hUSkey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags);
  872. LWSTDAPI_(LONG) SHRegQueryInfoUSKeyA(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags);
  873. LWSTDAPI_(LONG) SHRegQueryInfoUSKeyW(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags);
  874. LWSTDAPI_(LONG) SHRegCloseUSKey(HUSKEY hUSKey);
  875. // These calls are equal to an SHRegOpenUSKey, SHRegQueryUSValue, and then a SHRegCloseUSKey.
  876. LWSTDAPI_(LONG) SHRegGetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, LPDWORD pdwType, void * pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  877. LWSTDAPI_(LONG) SHRegGetUSValueW(LPCWSTR pwzSubKey, LPCWSTR pwzValue, LPDWORD pdwType, void * pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  878. LWSTDAPI_(LONG) SHRegSetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  879. LWSTDAPI_(LONG) SHRegSetUSValueW(LPCWSTR pwzSubKey, LPCWSTR pwzValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  880. LWSTDAPI_(int) SHRegGetIntW(HKEY hk, LPCWSTR pwzKey, int iDefault);
  881. #ifdef UNICODE
  882. #define SHRegCreateUSKey SHRegCreateUSKeyW
  883. #define SHRegOpenUSKey SHRegOpenUSKeyW
  884. #define SHRegQueryUSValue SHRegQueryUSValueW
  885. #define SHRegWriteUSValue SHRegWriteUSValueW
  886. #define SHRegDeleteUSValue SHRegDeleteUSValueW
  887. #define SHRegDeleteEmptyUSKey SHRegDeleteEmptyUSKeyW
  888. #define SHRegEnumUSKey SHRegEnumUSKeyW
  889. #define SHRegEnumUSValue SHRegEnumUSValueW
  890. #define SHRegQueryInfoUSKey SHRegQueryInfoUSKeyW
  891. #define SHRegGetUSValue SHRegGetUSValueW
  892. #define SHRegSetUSValue SHRegSetUSValueW
  893. #define SHRegGetInt SHRegGetIntW
  894. #else
  895. #define SHRegCreateUSKey SHRegCreateUSKeyA
  896. #define SHRegOpenUSKey SHRegOpenUSKeyA
  897. #define SHRegQueryUSValue SHRegQueryUSValueA
  898. #define SHRegWriteUSValue SHRegWriteUSValueA
  899. #define SHRegDeleteUSValue SHRegDeleteUSValueA
  900. #define SHRegDeleteEmptyUSKey SHRegDeleteEmptyUSKeyA
  901. #define SHRegEnumUSKey SHRegEnumUSKeyA
  902. #define SHRegEnumUSValue SHRegEnumUSValueA
  903. #define SHRegQueryInfoUSKey SHRegQueryInfoUSKeyA
  904. #define SHRegGetUSValue SHRegGetUSValueA
  905. #define SHRegSetUSValue SHRegSetUSValueA
  906. #endif
  907. LWSTDAPI_(BOOL) SHRegGetBoolUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault);
  908. LWSTDAPI_(BOOL) SHRegGetBoolUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault);
  909. #ifdef UNICODE
  910. #define SHRegGetBoolUSValue SHRegGetBoolUSValueW
  911. #else
  912. #define SHRegGetBoolUSValue SHRegGetBoolUSValueA
  913. #endif
  914. //
  915. // Association APIs
  916. //
  917. // these APIs are to assist in accessing the data in HKCR
  918. // getting the Command strings and exe paths
  919. // for different verbs and extensions are simplified this way
  920. //
  921. enum {
  922. ASSOCF_INIT_NOREMAPCLSID = 0x00000001, // do not remap clsids to progids
  923. ASSOCF_INIT_BYEXENAME = 0x00000002, // executable is being passed in
  924. ASSOCF_OPEN_BYEXENAME = 0x00000002, // executable is being passed in
  925. ASSOCF_INIT_DEFAULTTOSTAR = 0x00000004, // treat "*" as the BaseClass
  926. ASSOCF_INIT_DEFAULTTOFOLDER = 0x00000008, // treat "Folder" as the BaseClass
  927. ASSOCF_NOUSERSETTINGS = 0x00000010, // dont use HKCU
  928. ASSOCF_NOTRUNCATE = 0x00000020, // dont truncate the return string
  929. ASSOCF_VERIFY = 0x00000040, // verify data is accurate (DISK HITS)
  930. ASSOCF_REMAPRUNDLL = 0x00000080, // actually gets info about rundlls target if applicable
  931. ASSOCF_NOFIXUPS = 0x00000100, // attempt to fix errors if found
  932. ASSOCF_IGNOREBASECLASS = 0x00000200, // dont recurse into the baseclass
  933. };
  934. typedef DWORD ASSOCF;
  935. typedef enum {
  936. ASSOCSTR_COMMAND = 1, // shell\verb\command string
  937. ASSOCSTR_EXECUTABLE, // the executable part of command string
  938. ASSOCSTR_FRIENDLYDOCNAME, // friendly name of the document type
  939. ASSOCSTR_FRIENDLYAPPNAME, // friendly name of executable
  940. ASSOCSTR_NOOPEN, // noopen value
  941. ASSOCSTR_SHELLNEWVALUE, // query values under the shellnew key
  942. ASSOCSTR_DDECOMMAND, // template for DDE commands
  943. ASSOCSTR_DDEIFEXEC, // DDECOMMAND to use if just create a process
  944. ASSOCSTR_DDEAPPLICATION, // Application name in DDE broadcast
  945. ASSOCSTR_DDETOPIC, // Topic Name in DDE broadcast
  946. ASSOCSTR_INFOTIP, // info tip for an item, or list of properties to create info tip from
  947. ASSOCSTR_QUICKTIP, // same as ASSOCSTR_INFOTIP, except, this list contains only quickly retrievable properties
  948. ASSOCSTR_TILEINFO, // similar to ASSOCSTR_INFOTIP - lists important properties for tileview
  949. ASSOCSTR_CONTENTTYPE, // MIME Content type
  950. ASSOCSTR_DEFAULTICON, // Default icon source
  951. ASSOCSTR_SHELLEXTENSION, // Guid string pointing to the Shellex\Shellextensionhandler value.
  952. ASSOCSTR_MAX // last item in enum...
  953. } ASSOCSTR;
  954. typedef enum {
  955. ASSOCKEY_SHELLEXECCLASS = 1, // the key that should be passed to ShellExec(hkeyClass)
  956. ASSOCKEY_APP, // the "Application" key for the association
  957. ASSOCKEY_CLASS, // the progid or class key
  958. ASSOCKEY_BASECLASS, // the BaseClass key
  959. ASSOCKEY_MAX // last item in enum...
  960. } ASSOCKEY;
  961. typedef enum {
  962. ASSOCDATA_MSIDESCRIPTOR = 1, // Component Descriptor to pass to MSI APIs
  963. ASSOCDATA_NOACTIVATEHANDLER, // restrict attempts to activate window
  964. ASSOCDATA_QUERYCLASSSTORE, // should check with the NT Class Store
  965. ASSOCDATA_HASPERUSERASSOC, // defaults to user specified association
  966. ASSOCDATA_EDITFLAGS, // Edit flags.
  967. ASSOCDATA_VALUE, // use pszExtra as the Value name
  968. ASSOCDATA_MAX
  969. } ASSOCDATA;
  970. typedef enum {
  971. ASSOCENUM_NONE
  972. } ASSOCENUM;
  973. #undef INTERFACE
  974. #define INTERFACE IQueryAssociations
  975. DECLARE_INTERFACE_( IQueryAssociations, IUnknown )
  976. {
  977. // IUnknown methods
  978. STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  979. STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  980. STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  981. // IQueryAssociations methods
  982. STDMETHOD (Init)(THIS_ ASSOCF flags, LPCWSTR pszAssoc, HKEY hkProgid, HWND hwnd) PURE;
  983. STDMETHOD (GetString)(THIS_ ASSOCF flags, ASSOCSTR str, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut) PURE;
  984. STDMETHOD (GetKey)(THIS_ ASSOCF flags, ASSOCKEY key, LPCWSTR pszExtra, HKEY *phkeyOut) PURE;
  985. STDMETHOD (GetData)(THIS_ ASSOCF flags, ASSOCDATA data, LPCWSTR pszExtra, LPVOID pvOut, DWORD *pcbOut) PURE;
  986. STDMETHOD (GetEnum)(THIS_ ASSOCF flags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid, LPVOID *ppvOut) PURE;
  987. };
  988. LWSTDAPI AssocCreate(CLSID clsid, REFIID riid, LPVOID *ppv);
  989. // wrappers for the interface
  990. LWSTDAPI AssocQueryStringA(ASSOCF flags, ASSOCSTR str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut);
  991. // wrappers for the interface
  992. LWSTDAPI AssocQueryStringW(ASSOCF flags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut);
  993. #ifdef UNICODE
  994. #define AssocQueryString AssocQueryStringW
  995. #else
  996. #define AssocQueryString AssocQueryStringA
  997. #endif // !UNICODE
  998. LWSTDAPI AssocQueryStringByKeyA(ASSOCF flags, ASSOCSTR str, HKEY hkAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut);
  999. LWSTDAPI AssocQueryStringByKeyW(ASSOCF flags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut);
  1000. #ifdef UNICODE
  1001. #define AssocQueryStringByKey AssocQueryStringByKeyW
  1002. #else
  1003. #define AssocQueryStringByKey AssocQueryStringByKeyA
  1004. #endif // !UNICODE
  1005. LWSTDAPI AssocQueryKeyA(ASSOCF flags, ASSOCKEY key, LPCSTR pszAssoc, LPCSTR pszExtra, HKEY *phkeyOut);
  1006. LWSTDAPI AssocQueryKeyW(ASSOCF flags, ASSOCKEY key, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut);
  1007. #ifdef UNICODE
  1008. #define AssocQueryKey AssocQueryKeyW
  1009. #else
  1010. #define AssocQueryKey AssocQueryKeyA
  1011. #endif // !UNICODE
  1012. // AssocIsDangerous() checks a file type to determine whether it is "Dangerous"
  1013. // this maps to the IE download dialog's forcing a prompt to open or save.
  1014. // dangerous file types should be handled more carefully than other file types.
  1015. //
  1016. // Parameter: pszAssoc - type to check. may be an extension or progid. (".exe" or "exefile" would both be valid)
  1017. //
  1018. // Returns: TRUE if the file type is dangerous.
  1019. //
  1020. // NOTES:
  1021. //
  1022. // this API first checks a hardcoded list of known dangerous types.
  1023. // then it checks the editflags for the file type looking for the FTA_AlwaysUnsafe bit.
  1024. // then it checks Safer policies.
  1025. //
  1026. LWSTDAPI_(BOOL) AssocIsDangerous(LPCWSTR pszAssoc);
  1027. #endif // NO_SHLWAPI_REG
  1028. #ifndef NO_SHLWAPI_STREAM
  1029. //
  1030. //=============== Stream Routines ===================================
  1031. //
  1032. LWSTDAPI_(struct IStream *) SHOpenRegStreamA(HKEY hkey, LPCSTR pszSubkey, LPCSTR pszValue, DWORD grfMode);
  1033. LWSTDAPI_(struct IStream *) SHOpenRegStreamW(HKEY hkey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD grfMode);
  1034. #ifdef UNICODE
  1035. #define SHOpenRegStream SHOpenRegStreamW
  1036. #else
  1037. #define SHOpenRegStream SHOpenRegStreamA
  1038. #endif // !UNICODE
  1039. LWSTDAPI_(struct IStream *) SHOpenRegStream2A(HKEY hkey, LPCSTR pszSubkey, LPCSTR pszValue, DWORD grfMode);
  1040. LWSTDAPI_(struct IStream *) SHOpenRegStream2W(HKEY hkey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD grfMode);
  1041. #ifdef UNICODE
  1042. #define SHOpenRegStream2 SHOpenRegStream2W
  1043. #else
  1044. #define SHOpenRegStream2 SHOpenRegStream2A
  1045. #endif // !UNICODE
  1046. // New code always wants new implementation...
  1047. #undef SHOpenRegStream
  1048. #define SHOpenRegStream SHOpenRegStream2
  1049. LWSTDAPI SHCreateStreamOnFileA(LPCSTR pszFile, DWORD grfMode, struct IStream **ppstm);
  1050. LWSTDAPI SHCreateStreamOnFileW(LPCWSTR pszFile, DWORD grfMode, struct IStream **ppstm);
  1051. #ifdef UNICODE
  1052. #define SHCreateStreamOnFile SHCreateStreamOnFileW
  1053. #else
  1054. #define SHCreateStreamOnFile SHCreateStreamOnFileA
  1055. #endif // !UNICODE
  1056. #if (_WIN32_IE >= 0x0600)
  1057. LWSTDAPI SHCreateStreamOnFileEx(LPCWSTR pszFile, DWORD grfMode, DWORD dwAttributes, BOOL fCreate, struct IStream * pstmTemplate, struct IStream **ppstm);
  1058. #endif // (_WIN32_IE >= 0x0600)
  1059. #endif // NO_SHLWAPI_STREAM
  1060. #define SHGVSPB_PERUSER 0x00000001 // must have one of PERUSER or ALLUSERS
  1061. #define SHGVSPB_ALLUSERS 0x00000002
  1062. #define SHGVSPB_PERFOLDER 0x00000004 // must have one of PERFOLDER ALLFOLDERS or INHERIT
  1063. #define SHGVSPB_ALLFOLDERS 0x00000008
  1064. #define SHGVSPB_INHERIT 0x00000010
  1065. #define SHGVSPB_ROAM 0x00000020 // modifies the above
  1066. #define SHGVSPB_NOAUTODEFAULTS 0x80000000 // turns off read delegation to more general property bags
  1067. #define SHGVSPB_FOLDER (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER)
  1068. #define SHGVSPB_FOLDERNODEFAULTS (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER | SHGVSPB_NOAUTODEFAULTS)
  1069. #define SHGVSPB_USERDEFAULTS (SHGVSPB_PERUSER | SHGVSPB_ALLFOLDERS)
  1070. #define SHGVSPB_GLOBALDEAFAULTS (SHGVSPB_ALLUSERS | SHGVSPB_ALLFOLDERS)
  1071. LWSTDAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPCWSTR pszBagName, DWORD dwFlags, REFIID riid, void** ppv);
  1072. #if (_WIN32_IE >= 0x0500)
  1073. // SHAutoComplete
  1074. // hwndEdit - HWND of editbox, ComboBox or ComboBoxEx.
  1075. // dwFlags - Flags to indicate what to AutoAppend or AutoSuggest for the editbox.
  1076. //
  1077. // WARNING:
  1078. // Caller needs to have called CoInitialize() or OleInitialize()
  1079. // and cannot call CoUninit/OleUninit until after
  1080. // WM_DESTROY on hwndEdit.
  1081. //
  1082. // dwFlags values:
  1083. #define SHACF_DEFAULT 0x00000000 // Currently (SHACF_FILESYSTEM | SHACF_URLALL)
  1084. #define SHACF_FILESYSTEM 0x00000001 // This includes the File System as well as the rest of the shell (Desktop\My Computer\Control Panel\)
  1085. #define SHACF_URLALL (SHACF_URLHISTORY | SHACF_URLMRU)
  1086. #define SHACF_URLHISTORY 0x00000002 // URLs in the User's History
  1087. #define SHACF_URLMRU 0x00000004 // URLs in the User's Recently Used list.
  1088. #define SHACF_USETAB 0x00000008 // Use the tab to move thru the autocomplete possibilities instead of to the next dialog/window control.
  1089. #define SHACF_FILESYS_ONLY 0x00000010 // This includes the File System
  1090. #if (_WIN32_IE >= 0x0600)
  1091. #define SHACF_FILESYS_DIRS 0x00000020 // Same as SHACF_FILESYS_ONLY except it only includes directories, UNC servers, and UNC server shares.
  1092. #endif // (_WIN32_IE >= 0x0600)
  1093. #define SHACF_AUTOSUGGEST_FORCE_ON 0x10000000 // Ignore the registry default and force the feature on.
  1094. #define SHACF_AUTOSUGGEST_FORCE_OFF 0x20000000 // Ignore the registry default and force the feature off.
  1095. #define SHACF_AUTOAPPEND_FORCE_ON 0x40000000 // Ignore the registry default and force the feature on. (Also know as AutoComplete)
  1096. #define SHACF_AUTOAPPEND_FORCE_OFF 0x80000000 // Ignore the registry default and force the feature off. (Also know as AutoComplete)
  1097. LWSTDAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags);
  1098. LWSTDAPI SHSetThreadRef(IUnknown *punk);
  1099. LWSTDAPI SHGetThreadRef(IUnknown **ppunk);
  1100. LWSTDAPI_(BOOL) SHSkipJunction(struct IBindCtx* pbc, const CLSID *pclsid);
  1101. #endif // (_WIN32_IE >= 0x0500)
  1102. #define CTF_INSIST 0x00000001 // SHCreateThread() dwFlags - call pfnThreadProc synchronously if CreateThread() fails
  1103. #define CTF_THREAD_REF 0x00000002 // hold a reference to the creating thread
  1104. #define CTF_PROCESS_REF 0x00000004 // hold a reference to the creating process
  1105. #define CTF_COINIT 0x00000008 // init COM for the created thread
  1106. #define CTF_FREELIBANDEXIT 0x00000010 // hold a ref to the DLL and call FreeLibraryAndExitThread() when done
  1107. #define CTF_REF_COUNTED 0x00000020 // thread supports ref counting via SHGetThreadRef() or CTF_THREAD_REF so that child threads can keep this thread alive
  1108. #define CTF_WAIT_ALLOWCOM 0x00000040 // while waiting for pfnCallback, allow COM marshaling to the blocked calling thread
  1109. LWSTDAPI_(BOOL) SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, void *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback);
  1110. LWSTDAPI SHReleaseThreadRef(); // release a CTF_THREAD_REF reference earlier than the return of pfnThreadProc
  1111. #ifndef NO_SHLWAPI_GDI
  1112. //
  1113. //====== GDI helper functions ================================================
  1114. //
  1115. LWSTDAPI_(HPALETTE) SHCreateShellPalette(HDC hdc);
  1116. #if (_WIN32_IE >= 0x0500)
  1117. LWSTDAPI_(void) ColorRGBToHLS(COLORREF clrRGB, WORD* pwHue, WORD* pwLuminance, WORD* pwSaturation);
  1118. LWSTDAPI_(COLORREF) ColorHLSToRGB(WORD wHue, WORD wLuminance, WORD wSaturation);
  1119. LWSTDAPI_(COLORREF) ColorAdjustLuma(COLORREF clrRGB, int n, BOOL fScale);
  1120. #endif // _WIN32_IE >= 0x0500
  1121. #endif // NO_SHLWAPI_GDI
  1122. //
  1123. //====== DllGetVersion =======================================================
  1124. //
  1125. typedef struct _DLLVERSIONINFO
  1126. {
  1127. DWORD cbSize;
  1128. DWORD dwMajorVersion; // Major version
  1129. DWORD dwMinorVersion; // Minor version
  1130. DWORD dwBuildNumber; // Build number
  1131. DWORD dwPlatformID; // DLLVER_PLATFORM_*
  1132. } DLLVERSIONINFO;
  1133. // Platform IDs for DLLVERSIONINFO
  1134. #define DLLVER_PLATFORM_WINDOWS 0x00000001 // Windows 95
  1135. #define DLLVER_PLATFORM_NT 0x00000002 // Windows NT
  1136. #if (_WIN32_IE >= 0x0501)
  1137. typedef struct _DLLVERSIONINFO2
  1138. {
  1139. DLLVERSIONINFO info1;
  1140. DWORD dwFlags; // No flags currently defined
  1141. ULONGLONG ullVersion; // Encoded as:
  1142. // Major 0xFFFF 0000 0000 0000
  1143. // Minor 0x0000 FFFF 0000 0000
  1144. // Build 0x0000 0000 FFFF 0000
  1145. // QFE 0x0000 0000 0000 FFFF
  1146. } DLLVERSIONINFO2;
  1147. #define DLLVER_MAJOR_MASK 0xFFFF000000000000
  1148. #define DLLVER_MINOR_MASK 0x0000FFFF00000000
  1149. #define DLLVER_BUILD_MASK 0x00000000FFFF0000
  1150. #define DLLVER_QFE_MASK 0x000000000000FFFF
  1151. #endif
  1152. #define MAKEDLLVERULL(major, minor, build, qfe) \
  1153. (((ULONGLONG)(major) << 48) | \
  1154. ((ULONGLONG)(minor) << 32) | \
  1155. ((ULONGLONG)(build) << 16) | \
  1156. ((ULONGLONG)( qfe) << 0))
  1157. //
  1158. // The caller should always GetProcAddress("DllGetVersion"), not
  1159. // implicitly link to it.
  1160. //
  1161. typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
  1162. // DllInstall (to be implemented by self-installing DLLs)
  1163. STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine);
  1164. #ifdef __cplusplus
  1165. }
  1166. #endif
  1167. #ifdef _WIN32
  1168. #include <poppack.h>
  1169. #endif
  1170. #endif
  1171. #endif // _INC_SHLWAPI