home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / shlwapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  55.5 KB  |  1,282 lines

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