Shlwapi.h 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  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. #if (_WIN32_IE >= 0x0602)
  787. //
  788. // SRRF - Shell Registry Routine Flags (for SHRegGetValue)
  789. //
  790. typedef DWORD SRRF;
  791. #define SRRF_RT_REG_NONE 0x00000001 // restrict type to REG_NONE (other data types will not return ERROR_SUCCESS)
  792. #define SRRF_RT_REG_SZ 0x00000002 // restrict type to REG_SZ (other data types will not return ERROR_SUCCESS)
  793. #define SRRF_RT_REG_EXPAND_SZ 0x00000004 // restrict type to REG_EXPAND_SZ (other data types will not return ERROR_SUCCESS)
  794. #define SRRF_RT_REG_BINARY 0x00000008 // restrict type to REG_BINARY (other data types will not return ERROR_SUCCESS)
  795. #define SRRF_RT_REG_DWORD 0x00000010 // restrict type to REG_DWORD (other data types will not return ERROR_SUCCESS)
  796. #define SRRF_RT_REG_MULTI_SZ 0x00000020 // restrict type to REG_MULTI_SZ (other data types will not return ERROR_SUCCESS)
  797. #define SRRF_RT_REG_QWORD 0x00000040 // restrict type to REG_QWORD (other data types will not return ERROR_SUCCESS)
  798. #define SRRF_RT_DWORD (SRRF_RT_REG_BINARY | SRRF_RT_REG_DWORD) // restrict type to *32-bit* SRRF_RT_REG_BINARY or SRRF_RT_REG_DWORD (other data types will not return ERROR_SUCCESS)
  799. #define SRRF_RT_QWORD (SRRF_RT_REG_BINARY | SRRF_RT_REG_QWORD) // restrict type to *64-bit* SRRF_RT_REG_BINARY or SRRF_RT_REG_DWORD (other data types will not return ERROR_SUCCESS)
  800. #define SRRF_RT_ANY 0x0000ffff // no type restriction
  801. #define SRRF_RM_ANY 0x00000000 // no mode restriction (default is to allow any mode)
  802. #define SRRF_RM_NORMAL 0x00010000 // restrict system startup mode to "normal boot" (other startup modes will not return ERROR_SUCCESS)
  803. #define SRRF_RM_SAFE 0x00020000 // restrict system startup mode to "safe mode" (other startup modes will not return ERROR_SUCCESS)
  804. #define SRRF_RM_SAFENETWORK 0x00040000 // restrict system startup mode to "safe mode with networking" (other startup modes will not return ERROR_SUCCESS)
  805. #define SRRF_NOEXPAND 0x10000000 // do not automatically expand environment strings if value is of type REG_EXPAND_SZ
  806. #define SRRF_ZEROONFAILURE 0x20000000 // if pvData is not NULL, set content to all zeros on failure
  807. // Function:
  808. //
  809. // SHRegGetValue()
  810. //
  811. // Purpose:
  812. //
  813. // Gets a registry value. SHRegGetValue() provides the following benefits:
  814. //
  815. // - data type checking
  816. // - boot mode checking
  817. // - auto-expansion of REG_EXPAND_SZ data
  818. // - guaranteed NULL termination of REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ data
  819. //
  820. // Parameters:
  821. //
  822. // hkey - handle to a currently open key.
  823. //
  824. // pszSubKey - pointer to a null-terminated string specifying the relative
  825. // path from hkey to one of its subkeys from which the data is
  826. // to be retrieved. this will be opened with KEY_READ sam.
  827. //
  828. // Note1: pszSubKey can be NULL or "". In either of these two
  829. // cases, the data is retrieved from the hkey itself.
  830. // Note2: *** PERF ***
  831. // If pszSubKey is not NULL or "", the subkey will be
  832. // automatically be opened and closed by this routine
  833. // in order to obtain the data. If you are retrieving
  834. // multiple values from the same subkey, it is better
  835. // for perf to open the subkey via RegOpenKeyEx() prior
  836. // to calling this method, and using this opened key as
  837. // hkey with pszSubKey set to NULL.
  838. //
  839. // pszValue - pointer to a null-terminated string specifying the name of
  840. // the value to query for data
  841. //
  842. // Note1: pszValue can be NULL or "". In either of these two
  843. // cases, the data is retrieved from the unnamed or
  844. // default value.
  845. //
  846. // dwFlags - bitwise or of SRRF_ flags, which cannot be 0: at least one
  847. // type restriction must be specified (SRRF_RT_...), or if any
  848. // type is desired then SRRF_RT_ANY can be specified
  849. //
  850. // Note1: SRRF_RT_ANY will allow any data type to be returned.
  851. // Note2: The following two type restrictions have special
  852. // handling semantics:
  853. //
  854. // SRRF_RT_DWORD == SRRF_RT_REG_BINARY | SRRF_RT_REG_DWORD
  855. // SRRF_RT_QWORD == SRRF_RT_REG_BINARY | SRRF_RT_REG_QWORD
  856. //
  857. // If either of these are specified, with no other type
  858. // restrictions, then in the prior case the restriction
  859. // will limit "valid" returned data to either REG_DWORD
  860. // or 32-bit REG_BINARY data, and in the latter case
  861. // the restriction will limit "valid" returned data to
  862. // either REG_QWORD or 64-bit REG_BINARY.
  863. //
  864. // pdwType - pointer to a dword which receives a code indicating the
  865. // type of data stored in the specified value
  866. //
  867. // Note1: pdwType can be NULL if no type information is wanted
  868. // Note2: If pdwType is not NULL, and the SRRF_NOEXPAND flag
  869. // has not been set, data types of REG_EXPAND_SZ will
  870. // be returned as REG_SZ since they are automatically
  871. // expanded in this method.
  872. //
  873. // pvData - pointer to a buffer that receives the value's data
  874. //
  875. // Note1: pvData can be NULL if the data is not required.
  876. // pvData is usually NULL if doing either a simple
  877. // existence test, or if interested in the size only.
  878. // Note2: *** PERF ***
  879. // Reference 'perf' note for pcbData.
  880. //
  881. // pcbData - when pvData is NULL:
  882. // optional pointer to a dword that receives a size in bytes
  883. // which would be sufficient to hold the registry data (note
  884. // this size is not guaranteed to be exact, merely sufficient)
  885. // when pvData is not NULL:
  886. // required pointer to a dword that specifies the size in
  887. // bytes of the buffer pointed to by the pvData parameter
  888. // and receives a size in bytes of:
  889. // a) the number of bytes read into pvData on ERROR_SUCCESS
  890. // (note this size is guaranteed to be exact)
  891. // b) the number of bytes which would be sufficient to hold
  892. // the registry data on ERROR_MORE_DATA -- pvData was of
  893. // insufficient size (note this size is not guaranteed to
  894. // be exact, merely sufficient)
  895. //
  896. // Note1: pcbData can be NULL only if pvData is NULL.
  897. // Note2: *** PERF ***
  898. // The potential for an 'extra' call to the registry to
  899. // read (or re-read) in the data exists when the data
  900. // type is REG_EXPAND_SZ and the SRRF_NOEXPAND flag has
  901. // not been set. The following conditions will result
  902. // in this 'extra' read operation:
  903. // i) when pvData is NULL and pcbData is not NULL
  904. // we must read in the data from the registry
  905. // anyway in order to obtain the string and perform
  906. // an expand on it to obtain and return the total
  907. // required size in pcbData
  908. // ii) when pvData is not NULL but is of insufficient
  909. // size we must re-read in the data from the
  910. // registry in order to obtain the entire string
  911. // and perform an expand on it to obtain and return
  912. // the total required size in pcbData
  913. //
  914. // Remarks:
  915. //
  916. // The key identified by hkey must have been opened with KEY_QUERY_VALUE
  917. // access. If pszSubKey is not NULL or "", it must be able to be opened
  918. // with KEY_QUERY_VALUE access in the current calling context.
  919. //
  920. // If the data type is REG_SZ, REG_EXPAND_SZ or REG_MULTI_SZ then any
  921. // returned data is guaranteed to take into account proper null termination.
  922. // For example: if pcbData is not NULL, its returned size will include the
  923. // bytes for a null terminator if pvData is not NULL, its returned data
  924. // will be properly null terminated.
  925. //
  926. // If the data type is REG_EXPAND_SZ, then unless the SRRF_NOEXPAND flag
  927. // is set the data will be automatically expanded prior to being returned.
  928. // For example: if pdwType is not NULL, its returned type will be changed
  929. // to REG_SZ, if pcbData is not NULL, its returned size will include the
  930. // bytes for a properly expanded string. if pvData is not NULL, its
  931. // returned data will be the expanded version of the string.
  932. //
  933. // Reference MSDN documentation for RegQueryValueEx() for more information
  934. // of the behaviour when pdwType, pvData, and/or pcbData are equal to NULL.
  935. //
  936. // Return Values:
  937. //
  938. // If the function succeeds, the return value is ERROR_SUCCESS and all out
  939. // parameters requested (pdwType, pvData, pcbData) are valid.
  940. //
  941. // If the function fails due to insufficient space in a provided non-NULL
  942. // pvData, the return value is ERROR_MORE_DATA and only pdwType and pcbData
  943. // can contain valid data. The content of pvData in this case is undefined.
  944. //
  945. // Examples:
  946. //
  947. // 1) read REG_SZ (or REG_EXPAND_SZ as REG_SZ) "string" data from the (default) value of an open hkey
  948. //
  949. // TCHAR szData[128]
  950. // DWORD cbData = sizeof(pszData)
  951. // if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, NULL, SRRF_RT_REG_SZ, NULL, szData, &cbData))
  952. // {
  953. // // use sz (successful read)
  954. // }
  955. //
  956. // 2) read REG_SZ (or REG_EXPAND_SZ as REG_SZ) "string" data of unknown size from the "MyValue" value of an open hkey
  957. //
  958. // DWORD cbData
  959. // if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_REG_SZ, NULL, NULL, &cbData))
  960. // {
  961. // TCHAR *pszData = new TCHAR[cbData/sizeof(TCHAR)]
  962. // if (pszData)
  963. // {
  964. // if (ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_REG_SZ, NULL, pszData, &cbData))
  965. // {
  966. // // use pszData (successful read)
  967. // }
  968. // delete[] pszData
  969. // }
  970. // }
  971. //
  972. // 3) read "dword" data from the "MyValue" value of the "MySubKey" subkey of an open hkey
  973. //
  974. // DWORD dwData
  975. // DWORD cbData = sizeof(dwData)
  976. // if (ERROR_SUCCESS == SHRegGetValue(hkey, TEXT("MySubKey"), TEXT("MyValue"), SRRF_RT_REG_DWORD, NULL, &dwData, &cbData))
  977. // {
  978. // // use dwData (successful read)
  979. // }
  980. //
  981. // 4) read "dword" data from the "MyValue" value of the "MySubKey" subkey of an open hkey (32-bit binary data also ok)
  982. //
  983. // DWORD dwData
  984. // DWORD cbData = sizeof(dwData)
  985. // if (ERROR_SUCCESS == SHRegGetValue(hkey, TEXT("MySubKey"), TEXT("MyValue"), SRRF_RT_DWORD, NULL, &dwData, &cbData))
  986. // {
  987. // // use dwData (successful read)
  988. // }
  989. //
  990. // 5) determine existence of "MyValue" value of an open hkey
  991. //
  992. // BOOL bExists = ERROR_SUCCESS == SHRegGetValue(hkey, NULL, TEXT("MyValue"), SRRF_RT_ANY, NULL, NULL, NULL)
  993. LWSTDAPI_(LONG) SHRegGetValueA(HKEY hkey, LPCSTR pszSubKey, LPCSTR pszValue, SRRF dwFlags, DWORD *pdwType, void *pvData, DWORD *pcbData);
  994. LWSTDAPI_(LONG) SHRegGetValueW(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, SRRF dwFlags, DWORD *pdwType, void *pvData, DWORD *pcbData);
  995. #ifdef UNICODE
  996. #define SHRegGetValue SHRegGetValueW
  997. #else
  998. #define SHRegGetValue SHRegGetValueA
  999. #endif // !UNICODE
  1000. #endif // (_WIN32_IE >= 0x0602)
  1001. // These functions behave just like RegQueryValueEx(), except if the data
  1002. // type is REG_SZ, REG_EXPAND_SZ or REG_MULTI_SZ then the string is
  1003. // guaranteed to be properly null terminated.
  1004. //
  1005. // Additionally, if the data type is REG_EXPAND_SZ these functions will
  1006. // go ahead and expand out the string, and "massage" the returned *pdwType
  1007. // to be REG_SZ.
  1008. LWSTDAPI_(DWORD) SHQueryValueExA(HKEY hkey, LPCSTR pszValue, DWORD *pdwReserved, DWORD *pdwType, void *pvData, DWORD *pcbData);
  1009. LWSTDAPI_(DWORD) SHQueryValueExW(HKEY hkey, LPCWSTR pszValue, DWORD *pdwReserved, DWORD *pdwType, void *pvData, DWORD *pcbData);
  1010. #ifdef UNICODE
  1011. #define SHQueryValueEx SHQueryValueExW
  1012. #else
  1013. #define SHQueryValueEx SHQueryValueExA
  1014. #endif // !UNICODE
  1015. // Enumeration functions support.
  1016. LWSTDAPI_(LONG) SHEnumKeyExA(HKEY hkey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchName);
  1017. LWSTDAPI_(LONG) SHEnumKeyExW(HKEY hkey, DWORD dwIndex, LPWSTR pszName, LPDWORD pcchName);
  1018. LWSTDAPI_(LONG) SHEnumValueA(HKEY hkey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData);
  1019. LWSTDAPI_(LONG) SHEnumValueW(HKEY hkey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData);
  1020. LWSTDAPI_(LONG) SHQueryInfoKeyA(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen);
  1021. LWSTDAPI_(LONG) SHQueryInfoKeyW(HKEY hkey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen);
  1022. // recursive key copy
  1023. LWSTDAPI_(DWORD) SHCopyKeyA(HKEY hkeySrc, LPCSTR szSrcSubKey, HKEY hkeyDest, DWORD fReserved);
  1024. LWSTDAPI_(DWORD) SHCopyKeyW(HKEY hkeySrc, LPCWSTR wszSrcSubKey, HKEY hkeyDest, DWORD fReserved);
  1025. // Getting and setting file system paths with environment variables
  1026. LWSTDAPI_(DWORD) SHRegGetPathA(HKEY hKey, LPCSTR pcszSubKey, LPCSTR pcszValue, LPSTR pszPath, DWORD dwFlags);
  1027. LWSTDAPI_(DWORD) SHRegGetPathW(HKEY hKey, LPCWSTR pcszSubKey, LPCWSTR pcszValue, LPWSTR pszPath, DWORD dwFlags);
  1028. LWSTDAPI_(DWORD) SHRegSetPathA(HKEY hKey, LPCSTR pcszSubKey, LPCSTR pcszValue, LPCSTR pcszPath, DWORD dwFlags);
  1029. LWSTDAPI_(DWORD) SHRegSetPathW(HKEY hKey, LPCWSTR pcszSubKey, LPCWSTR pcszValue, LPCWSTR pcszPath, DWORD dwFlags);
  1030. #ifdef UNICODE
  1031. #define SHEnumKeyEx SHEnumKeyExW
  1032. #define SHEnumValue SHEnumValueW
  1033. #define SHQueryInfoKey SHQueryInfoKeyW
  1034. #define SHCopyKey SHCopyKeyW
  1035. #define SHRegGetPath SHRegGetPathW
  1036. #define SHRegSetPath SHRegSetPathW
  1037. #else
  1038. #define SHEnumKeyEx SHEnumKeyExA
  1039. #define SHEnumValue SHEnumValueA
  1040. #define SHQueryInfoKey SHQueryInfoKeyA
  1041. #define SHCopyKey SHCopyKeyA
  1042. #define SHRegGetPath SHRegGetPathA
  1043. #define SHRegSetPath SHRegSetPathA
  1044. #endif
  1045. //////////////////////////////////////////////
  1046. // User Specific Registry Access Functions
  1047. //////////////////////////////////////////////
  1048. //
  1049. // Type definitions.
  1050. //
  1051. typedef enum
  1052. {
  1053. SHREGDEL_DEFAULT = 0x00000000, // Delete's HKCU, or HKLM if HKCU is not found.
  1054. SHREGDEL_HKCU = 0x00000001, // Delete HKCU only
  1055. SHREGDEL_HKLM = 0x00000010, // Delete HKLM only.
  1056. SHREGDEL_BOTH = 0x00000011, // Delete both HKCU and HKLM.
  1057. } SHREGDEL_FLAGS;
  1058. typedef enum
  1059. {
  1060. SHREGENUM_DEFAULT = 0x00000000, // Enumerates HKCU or HKLM if not found.
  1061. SHREGENUM_HKCU = 0x00000001, // Enumerates HKCU only
  1062. SHREGENUM_HKLM = 0x00000010, // Enumerates HKLM only.
  1063. SHREGENUM_BOTH = 0x00000011, // Enumerates both HKCU and HKLM without duplicates.
  1064. // This option is NYI.
  1065. } SHREGENUM_FLAGS;
  1066. #define SHREGSET_HKCU 0x00000001 // Write to HKCU if empty.
  1067. #define SHREGSET_FORCE_HKCU 0x00000002 // Write to HKCU.
  1068. #define SHREGSET_HKLM 0x00000004 // Write to HKLM if empty.
  1069. #define SHREGSET_FORCE_HKLM 0x00000008 // Write to HKLM.
  1070. #define SHREGSET_DEFAULT (SHREGSET_FORCE_HKCU | SHREGSET_HKLM) // Default is SHREGSET_FORCE_HKCU | SHREGSET_HKLM.
  1071. typedef HANDLE HUSKEY; // HUSKEY is a Handle to a User Specific KEY.
  1072. typedef HUSKEY *PHUSKEY;
  1073. LWSTDAPI_(LONG) SHRegCreateUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, DWORD dwFlags);
  1074. LWSTDAPI_(LONG) SHRegCreateUSKeyW(LPCWSTR pwzPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, DWORD dwFlags);
  1075. LWSTDAPI_(LONG) SHRegOpenUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU);
  1076. LWSTDAPI_(LONG) SHRegOpenUSKeyW(LPCWSTR pwzPath, REGSAM samDesired, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU);
  1077. LWSTDAPI_(LONG) SHRegQueryUSValueA(HUSKEY hUSKey, LPCSTR pszValue, LPDWORD pdwType, void *pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  1078. LWSTDAPI_(LONG) SHRegQueryUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, LPDWORD pdwType, void *pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  1079. LWSTDAPI_(LONG) SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  1080. LWSTDAPI_(LONG) SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  1081. LWSTDAPI_(LONG) SHRegDeleteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, SHREGDEL_FLAGS delRegFlags);
  1082. LWSTDAPI_(LONG) SHRegDeleteEmptyUSKeyW(HUSKEY hUSKey, LPCWSTR pwzSubKey, SHREGDEL_FLAGS delRegFlags);
  1083. LWSTDAPI_(LONG) SHRegDeleteEmptyUSKeyA(HUSKEY hUSKey, LPCSTR pszSubKey, SHREGDEL_FLAGS delRegFlags);
  1084. LWSTDAPI_(LONG) SHRegDeleteUSValueW(HUSKEY hUSKey, LPCWSTR pwzValue, SHREGDEL_FLAGS delRegFlags);
  1085. LWSTDAPI_(LONG) SHRegEnumUSKeyA(HUSKEY hUSKey, DWORD dwIndex, LPSTR pszName, LPDWORD pcchName, SHREGENUM_FLAGS enumRegFlags);
  1086. LWSTDAPI_(LONG) SHRegEnumUSKeyW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pwzName, LPDWORD pcchName, SHREGENUM_FLAGS enumRegFlags);
  1087. LWSTDAPI_(LONG) SHRegEnumUSValueA(HUSKEY hUSkey, DWORD dwIndex, LPSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags);
  1088. LWSTDAPI_(LONG) SHRegEnumUSValueW(HUSKEY hUSkey, DWORD dwIndex, LPWSTR pszValueName, LPDWORD pcchValueName, LPDWORD pdwType, void *pvData, LPDWORD pcbData, SHREGENUM_FLAGS enumRegFlags);
  1089. LWSTDAPI_(LONG) SHRegQueryInfoUSKeyA(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags);
  1090. LWSTDAPI_(LONG) SHRegQueryInfoUSKeyW(HUSKEY hUSKey, LPDWORD pcSubKeys, LPDWORD pcchMaxSubKeyLen, LPDWORD pcValues, LPDWORD pcchMaxValueNameLen, SHREGENUM_FLAGS enumRegFlags);
  1091. LWSTDAPI_(LONG) SHRegCloseUSKey(HUSKEY hUSKey);
  1092. // These calls are equal to an SHRegOpenUSKey, SHRegQueryUSValue, and then a SHRegCloseUSKey.
  1093. LWSTDAPI_(LONG) SHRegGetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, LPDWORD pdwType, void * pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  1094. LWSTDAPI_(LONG) SHRegGetUSValueW(LPCWSTR pwzSubKey, LPCWSTR pwzValue, LPDWORD pdwType, void * pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, void *pvDefaultData, DWORD dwDefaultDataSize);
  1095. LWSTDAPI_(LONG) SHRegSetUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  1096. LWSTDAPI_(LONG) SHRegSetUSValueW(LPCWSTR pwzSubKey, LPCWSTR pwzValue, DWORD dwType, const void *pvData, DWORD cbData, DWORD dwFlags);
  1097. LWSTDAPI_(int) SHRegGetIntW(HKEY hk, LPCWSTR pwzKey, int iDefault);
  1098. #ifdef UNICODE
  1099. #define SHRegCreateUSKey SHRegCreateUSKeyW
  1100. #define SHRegOpenUSKey SHRegOpenUSKeyW
  1101. #define SHRegQueryUSValue SHRegQueryUSValueW
  1102. #define SHRegWriteUSValue SHRegWriteUSValueW
  1103. #define SHRegDeleteUSValue SHRegDeleteUSValueW
  1104. #define SHRegDeleteEmptyUSKey SHRegDeleteEmptyUSKeyW
  1105. #define SHRegEnumUSKey SHRegEnumUSKeyW
  1106. #define SHRegEnumUSValue SHRegEnumUSValueW
  1107. #define SHRegQueryInfoUSKey SHRegQueryInfoUSKeyW
  1108. #define SHRegGetUSValue SHRegGetUSValueW
  1109. #define SHRegSetUSValue SHRegSetUSValueW
  1110. #define SHRegGetInt SHRegGetIntW
  1111. #else
  1112. #define SHRegCreateUSKey SHRegCreateUSKeyA
  1113. #define SHRegOpenUSKey SHRegOpenUSKeyA
  1114. #define SHRegQueryUSValue SHRegQueryUSValueA
  1115. #define SHRegWriteUSValue SHRegWriteUSValueA
  1116. #define SHRegDeleteUSValue SHRegDeleteUSValueA
  1117. #define SHRegDeleteEmptyUSKey SHRegDeleteEmptyUSKeyA
  1118. #define SHRegEnumUSKey SHRegEnumUSKeyA
  1119. #define SHRegEnumUSValue SHRegEnumUSValueA
  1120. #define SHRegQueryInfoUSKey SHRegQueryInfoUSKeyA
  1121. #define SHRegGetUSValue SHRegGetUSValueA
  1122. #define SHRegSetUSValue SHRegSetUSValueA
  1123. #endif
  1124. LWSTDAPI_(BOOL) SHRegGetBoolUSValueA(LPCSTR pszSubKey, LPCSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault);
  1125. LWSTDAPI_(BOOL) SHRegGetBoolUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault);
  1126. #ifdef UNICODE
  1127. #define SHRegGetBoolUSValue SHRegGetBoolUSValueW
  1128. #else
  1129. #define SHRegGetBoolUSValue SHRegGetBoolUSValueA
  1130. #endif
  1131. //
  1132. // Association APIs
  1133. //
  1134. // these APIs are to assist in accessing the data in HKCR
  1135. // getting the Command strings and exe paths
  1136. // for different verbs and extensions are simplified this way
  1137. //
  1138. enum {
  1139. ASSOCF_INIT_NOREMAPCLSID = 0x00000001, // do not remap clsids to progids
  1140. ASSOCF_INIT_BYEXENAME = 0x00000002, // executable is being passed in
  1141. ASSOCF_OPEN_BYEXENAME = 0x00000002, // executable is being passed in
  1142. ASSOCF_INIT_DEFAULTTOSTAR = 0x00000004, // treat "*" as the BaseClass
  1143. ASSOCF_INIT_DEFAULTTOFOLDER = 0x00000008, // treat "Folder" as the BaseClass
  1144. ASSOCF_NOUSERSETTINGS = 0x00000010, // dont use HKCU
  1145. ASSOCF_NOTRUNCATE = 0x00000020, // dont truncate the return string
  1146. ASSOCF_VERIFY = 0x00000040, // verify data is accurate (DISK HITS)
  1147. ASSOCF_REMAPRUNDLL = 0x00000080, // actually gets info about rundlls target if applicable
  1148. ASSOCF_NOFIXUPS = 0x00000100, // attempt to fix errors if found
  1149. ASSOCF_IGNOREBASECLASS = 0x00000200, // dont recurse into the baseclass
  1150. };
  1151. typedef DWORD ASSOCF;
  1152. typedef enum {
  1153. ASSOCSTR_COMMAND = 1, // shell\verb\command string
  1154. ASSOCSTR_EXECUTABLE, // the executable part of command string
  1155. ASSOCSTR_FRIENDLYDOCNAME, // friendly name of the document type
  1156. ASSOCSTR_FRIENDLYAPPNAME, // friendly name of executable
  1157. ASSOCSTR_NOOPEN, // noopen value
  1158. ASSOCSTR_SHELLNEWVALUE, // query values under the shellnew key
  1159. ASSOCSTR_DDECOMMAND, // template for DDE commands
  1160. ASSOCSTR_DDEIFEXEC, // DDECOMMAND to use if just create a process
  1161. ASSOCSTR_DDEAPPLICATION, // Application name in DDE broadcast
  1162. ASSOCSTR_DDETOPIC, // Topic Name in DDE broadcast
  1163. ASSOCSTR_INFOTIP, // info tip for an item, or list of properties to create info tip from
  1164. ASSOCSTR_QUICKTIP, // same as ASSOCSTR_INFOTIP, except, this list contains only quickly retrievable properties
  1165. ASSOCSTR_TILEINFO, // similar to ASSOCSTR_INFOTIP - lists important properties for tileview
  1166. ASSOCSTR_CONTENTTYPE, // MIME Content type
  1167. ASSOCSTR_DEFAULTICON, // Default icon source
  1168. ASSOCSTR_SHELLEXTENSION, // Guid string pointing to the Shellex\Shellextensionhandler value.
  1169. ASSOCSTR_MAX // last item in enum...
  1170. } ASSOCSTR;
  1171. typedef enum {
  1172. ASSOCKEY_SHELLEXECCLASS = 1, // the key that should be passed to ShellExec(hkeyClass)
  1173. ASSOCKEY_APP, // the "Application" key for the association
  1174. ASSOCKEY_CLASS, // the progid or class key
  1175. ASSOCKEY_BASECLASS, // the BaseClass key
  1176. ASSOCKEY_MAX // last item in enum...
  1177. } ASSOCKEY;
  1178. typedef enum {
  1179. ASSOCDATA_MSIDESCRIPTOR = 1, // Component Descriptor to pass to MSI APIs
  1180. ASSOCDATA_NOACTIVATEHANDLER, // restrict attempts to activate window
  1181. ASSOCDATA_QUERYCLASSSTORE, // should check with the NT Class Store
  1182. ASSOCDATA_HASPERUSERASSOC, // defaults to user specified association
  1183. ASSOCDATA_EDITFLAGS, // Edit flags.
  1184. ASSOCDATA_VALUE, // use pszExtra as the Value name
  1185. ASSOCDATA_MAX
  1186. } ASSOCDATA;
  1187. typedef enum {
  1188. ASSOCENUM_NONE
  1189. } ASSOCENUM;
  1190. #undef INTERFACE
  1191. #define INTERFACE IQueryAssociations
  1192. DECLARE_INTERFACE_( IQueryAssociations, IUnknown )
  1193. {
  1194. // IUnknown methods
  1195. STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  1196. STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  1197. STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  1198. // IQueryAssociations methods
  1199. STDMETHOD (Init)(THIS_ ASSOCF flags, LPCWSTR pszAssoc, HKEY hkProgid, HWND hwnd) PURE;
  1200. STDMETHOD (GetString)(THIS_ ASSOCF flags, ASSOCSTR str, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut) PURE;
  1201. STDMETHOD (GetKey)(THIS_ ASSOCF flags, ASSOCKEY key, LPCWSTR pszExtra, HKEY *phkeyOut) PURE;
  1202. STDMETHOD (GetData)(THIS_ ASSOCF flags, ASSOCDATA data, LPCWSTR pszExtra, LPVOID pvOut, DWORD *pcbOut) PURE;
  1203. STDMETHOD (GetEnum)(THIS_ ASSOCF flags, ASSOCENUM assocenum, LPCWSTR pszExtra, REFIID riid, LPVOID *ppvOut) PURE;
  1204. };
  1205. LWSTDAPI AssocCreate(CLSID clsid, REFIID riid, LPVOID *ppv);
  1206. // wrappers for the interface
  1207. LWSTDAPI AssocQueryStringA(ASSOCF flags, ASSOCSTR str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut);
  1208. // wrappers for the interface
  1209. LWSTDAPI AssocQueryStringW(ASSOCF flags, ASSOCSTR str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut);
  1210. #ifdef UNICODE
  1211. #define AssocQueryString AssocQueryStringW
  1212. #else
  1213. #define AssocQueryString AssocQueryStringA
  1214. #endif // !UNICODE
  1215. LWSTDAPI AssocQueryStringByKeyA(ASSOCF flags, ASSOCSTR str, HKEY hkAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut);
  1216. LWSTDAPI AssocQueryStringByKeyW(ASSOCF flags, ASSOCSTR str, HKEY hkAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut);
  1217. #ifdef UNICODE
  1218. #define AssocQueryStringByKey AssocQueryStringByKeyW
  1219. #else
  1220. #define AssocQueryStringByKey AssocQueryStringByKeyA
  1221. #endif // !UNICODE
  1222. LWSTDAPI AssocQueryKeyA(ASSOCF flags, ASSOCKEY key, LPCSTR pszAssoc, LPCSTR pszExtra, HKEY *phkeyOut);
  1223. LWSTDAPI AssocQueryKeyW(ASSOCF flags, ASSOCKEY key, LPCWSTR pszAssoc, LPCWSTR pszExtra, HKEY *phkeyOut);
  1224. #ifdef UNICODE
  1225. #define AssocQueryKey AssocQueryKeyW
  1226. #else
  1227. #define AssocQueryKey AssocQueryKeyA
  1228. #endif // !UNICODE
  1229. #if (_WIN32_IE >= 0x0601)
  1230. // AssocIsDangerous() checks a file type to determine whether it is "Dangerous"
  1231. // this maps to the IE download dialog's forcing a prompt to open or save.
  1232. // dangerous file types should be handled more carefully than other file types.
  1233. //
  1234. // Parameter: pszAssoc - type to check. may be an extension or progid. (".exe" or "exefile" would both be valid)
  1235. //
  1236. // Returns: TRUE if the file type is dangerous.
  1237. //
  1238. // NOTES:
  1239. //
  1240. // this API first checks a hardcoded list of known dangerous types.
  1241. // then it checks the editflags for the file type looking for the FTA_AlwaysUnsafe bit.
  1242. // then it checks Safer policies.
  1243. //
  1244. LWSTDAPI_(BOOL) AssocIsDangerous(LPCWSTR pszAssoc);
  1245. #endif // (_WIN32_IE >= 0x0601)
  1246. #if (_WIN32_IE >= 0x0603)
  1247. // PERCEIVED types:
  1248. typedef enum {
  1249. PERCEIVED_TYPE_CUSTOM = -3,
  1250. PERCEIVED_TYPE_UNSPECIFIED = -2,
  1251. PERCEIVED_TYPE_FOLDER = -1,
  1252. PERCEIVED_TYPE_UNKNOWN = 0,
  1253. PERCEIVED_TYPE_TEXT,
  1254. PERCEIVED_TYPE_IMAGE,
  1255. PERCEIVED_TYPE_AUDIO,
  1256. PERCEIVED_TYPE_VIDEO,
  1257. PERCEIVED_TYPE_COMPRESSED,
  1258. PERCEIVED_TYPE_DOCUMENT,
  1259. PERCEIVED_TYPE_SYSTEM,
  1260. PERCEIVED_TYPE_APPLICATION
  1261. } PERCEIVED;
  1262. #define PERCEIVEDFLAG_UNDEFINED 0x0000
  1263. #define PERCEIVEDFLAG_SOFTCODED 0x0001
  1264. #define PERCEIVEDFLAG_HARDCODED 0x0002
  1265. #define PERCEIVEDFLAG_NATIVESUPPORT 0x0004
  1266. #define PERCEIVEDFLAG_GDIPLUS 0x0010
  1267. #define PERCEIVEDFLAG_WMSDK 0x0020
  1268. #define PERCEIVEDFLAG_ZIPFOLDER 0x0040
  1269. typedef DWORD PERCEIVEDFLAG;
  1270. LWSTDAPI AssocGetPerceivedType(__in LPCWSTR pszExt, __out PERCEIVED *ptype, __out PERCEIVEDFLAG *pflag, __out __opt LPWSTR *ppszType);
  1271. #endif // (_WIN32_IE >= 0x0603)
  1272. #endif // NO_SHLWAPI_REG
  1273. #ifndef NO_SHLWAPI_STREAM
  1274. //
  1275. //=============== Stream Routines ===================================
  1276. //
  1277. LWSTDAPI_(struct IStream *) SHOpenRegStreamA(HKEY hkey, LPCSTR pszSubkey, LPCSTR pszValue, DWORD grfMode);
  1278. LWSTDAPI_(struct IStream *) SHOpenRegStreamW(HKEY hkey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD grfMode);
  1279. #ifdef UNICODE
  1280. #define SHOpenRegStream SHOpenRegStreamW
  1281. #else
  1282. #define SHOpenRegStream SHOpenRegStreamA
  1283. #endif // !UNICODE
  1284. LWSTDAPI_(struct IStream *) SHOpenRegStream2A(HKEY hkey, LPCSTR pszSubkey, LPCSTR pszValue, DWORD grfMode);
  1285. LWSTDAPI_(struct IStream *) SHOpenRegStream2W(HKEY hkey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD grfMode);
  1286. #ifdef UNICODE
  1287. #define SHOpenRegStream2 SHOpenRegStream2W
  1288. #else
  1289. #define SHOpenRegStream2 SHOpenRegStream2A
  1290. #endif // !UNICODE
  1291. // New code always wants new implementation...
  1292. #undef SHOpenRegStream
  1293. #define SHOpenRegStream SHOpenRegStream2
  1294. LWSTDAPI SHCreateStreamOnFileA(LPCSTR pszFile, DWORD grfMode, struct IStream **ppstm);
  1295. LWSTDAPI SHCreateStreamOnFileW(LPCWSTR pszFile, DWORD grfMode, struct IStream **ppstm);
  1296. #ifdef UNICODE
  1297. #define SHCreateStreamOnFile SHCreateStreamOnFileW
  1298. #else
  1299. #define SHCreateStreamOnFile SHCreateStreamOnFileA
  1300. #endif // !UNICODE
  1301. #if (_WIN32_IE >= 0x0600)
  1302. LWSTDAPI SHCreateStreamOnFileEx(LPCWSTR pszFile, DWORD grfMode, DWORD dwAttributes, BOOL fCreate, struct IStream * pstmTemplate, struct IStream **ppstm);
  1303. #endif // (_WIN32_IE >= 0x0600)
  1304. #endif // NO_SHLWAPI_STREAM
  1305. #ifndef NO_SHLWAPI_HTTP
  1306. //
  1307. //=============== HTTP helper Routines ===================================
  1308. //
  1309. #if (_WIN32_IE >= 0x0603)
  1310. LWSTDAPI GetAcceptLanguagesA(LPSTR psz, DWORD* pcch);
  1311. LWSTDAPI GetAcceptLanguagesW(LPWSTR psz, DWORD* pcch);
  1312. #ifdef UNICODE
  1313. #define GetAcceptLanguages GetAcceptLanguagesW
  1314. #else
  1315. #define GetAcceptLanguages GetAcceptLanguagesA
  1316. #endif // !UNICODE
  1317. #endif // (_WIN32_IE >= 0x0603)
  1318. #endif // NO_SHLWAPI_HTTP
  1319. #if (_WIN32_IE >= 0x0601)
  1320. #define SHGVSPB_PERUSER 0x00000001 // must have one of PERUSER or ALLUSERS
  1321. #define SHGVSPB_ALLUSERS 0x00000002
  1322. #define SHGVSPB_PERFOLDER 0x00000004 // must have one of PERFOLDER ALLFOLDERS or INHERIT
  1323. #define SHGVSPB_ALLFOLDERS 0x00000008
  1324. #define SHGVSPB_INHERIT 0x00000010
  1325. #define SHGVSPB_ROAM 0x00000020 // modifies the above
  1326. #define SHGVSPB_NOAUTODEFAULTS 0x80000000 // turns off read delegation to more general property bags
  1327. #define SHGVSPB_FOLDER (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER)
  1328. #define SHGVSPB_FOLDERNODEFAULTS (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER | SHGVSPB_NOAUTODEFAULTS)
  1329. #define SHGVSPB_USERDEFAULTS (SHGVSPB_PERUSER | SHGVSPB_ALLFOLDERS)
  1330. #define SHGVSPB_GLOBALDEAFAULTS (SHGVSPB_ALLUSERS | SHGVSPB_ALLFOLDERS)
  1331. LWSTDAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPCWSTR pszBagName, DWORD dwFlags, REFIID riid, void** ppv);
  1332. #endif // (_WIN32_IE >= 0x0601)
  1333. // Shared memory apis
  1334. #if (_WIN32_IE >= 0x0603)
  1335. LWSTDAPI_(HANDLE) SHAllocShared(const void *pvData, DWORD dwSize, DWORD dwProcessId);
  1336. LWSTDAPI_(BOOL) SHFreeShared(HANDLE hData,DWORD dwProcessId);
  1337. LWSTDAPI_(void *) SHLockShared(HANDLE hData, DWORD dwProcessId);
  1338. LWSTDAPI_(BOOL) SHUnlockShared(void *pvData);
  1339. #endif // _WIN32_IE >= 0x0603
  1340. #if (_WIN32_IE >= 0x0500)
  1341. // SHAutoComplete
  1342. // hwndEdit - HWND of editbox, ComboBox or ComboBoxEx.
  1343. // dwFlags - Flags to indicate what to AutoAppend or AutoSuggest for the editbox.
  1344. //
  1345. // WARNING:
  1346. // Caller needs to have called CoInitialize() or OleInitialize()
  1347. // and cannot call CoUninit/OleUninit until after
  1348. // WM_DESTROY on hwndEdit.
  1349. //
  1350. // dwFlags values:
  1351. #define SHACF_DEFAULT 0x00000000 // Currently (SHACF_FILESYSTEM | SHACF_URLALL)
  1352. #define SHACF_FILESYSTEM 0x00000001 // This includes the File System as well as the rest of the shell (Desktop\My Computer\Control Panel\)
  1353. #define SHACF_URLALL (SHACF_URLHISTORY | SHACF_URLMRU)
  1354. #define SHACF_URLHISTORY 0x00000002 // URLs in the User's History
  1355. #define SHACF_URLMRU 0x00000004 // URLs in the User's Recently Used list.
  1356. #define SHACF_USETAB 0x00000008 // Use the tab to move thru the autocomplete possibilities instead of to the next dialog/window control.
  1357. #define SHACF_FILESYS_ONLY 0x00000010 // This includes the File System
  1358. #if (_WIN32_IE >= 0x0600)
  1359. #define SHACF_FILESYS_DIRS 0x00000020 // Same as SHACF_FILESYS_ONLY except it only includes directories, UNC servers, and UNC server shares.
  1360. #endif // (_WIN32_IE >= 0x0600)
  1361. #define SHACF_AUTOSUGGEST_FORCE_ON 0x10000000 // Ignore the registry default and force the feature on.
  1362. #define SHACF_AUTOSUGGEST_FORCE_OFF 0x20000000 // Ignore the registry default and force the feature off.
  1363. #define SHACF_AUTOAPPEND_FORCE_ON 0x40000000 // Ignore the registry default and force the feature on. (Also know as AutoComplete)
  1364. #define SHACF_AUTOAPPEND_FORCE_OFF 0x80000000 // Ignore the registry default and force the feature off. (Also know as AutoComplete)
  1365. LWSTDAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags);
  1366. LWSTDAPI SHSetThreadRef(IUnknown *punk);
  1367. LWSTDAPI SHGetThreadRef(IUnknown **ppunk);
  1368. LWSTDAPI_(BOOL) SHSkipJunction(struct IBindCtx* pbc, const CLSID *pclsid);
  1369. #endif // (_WIN32_IE >= 0x0500)
  1370. #if (_WIN32_IE >= 0x0603)
  1371. LWSTDAPI SHCreateThreadRef(LONG *pcRef, IUnknown **ppunk);
  1372. #endif // (_WIN32_IE >= 0x0603)
  1373. #define CTF_INSIST 0x00000001 // SHCreateThread() dwFlags - call pfnThreadProc synchronously if CreateThread() fails
  1374. #define CTF_THREAD_REF 0x00000002 // hold a reference to the creating thread
  1375. #define CTF_PROCESS_REF 0x00000004 // hold a reference to the creating process
  1376. #define CTF_COINIT 0x00000008 // init COM for the created thread
  1377. #define CTF_FREELIBANDEXIT 0x00000010 // hold a ref to the DLL and call FreeLibraryAndExitThread() when done
  1378. #define CTF_REF_COUNTED 0x00000020 // thread supports ref counting via SHGetThreadRef() or CTF_THREAD_REF so that child threads can keep this thread alive
  1379. #define CTF_WAIT_ALLOWCOM 0x00000040 // while waiting for pfnCallback, allow COM marshaling to the blocked calling thread
  1380. LWSTDAPI_(BOOL) SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, void *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback);
  1381. LWSTDAPI SHReleaseThreadRef(); // release a CTF_THREAD_REF reference earlier than the return of pfnThreadProc
  1382. #ifndef NO_SHLWAPI_GDI
  1383. //
  1384. //====== GDI helper functions ================================================
  1385. //
  1386. LWSTDAPI_(HPALETTE) SHCreateShellPalette(HDC hdc);
  1387. #if (_WIN32_IE >= 0x0500)
  1388. LWSTDAPI_(void) ColorRGBToHLS(COLORREF clrRGB, WORD* pwHue, WORD* pwLuminance, WORD* pwSaturation);
  1389. LWSTDAPI_(COLORREF) ColorHLSToRGB(WORD wHue, WORD wLuminance, WORD wSaturation);
  1390. LWSTDAPI_(COLORREF) ColorAdjustLuma(COLORREF clrRGB, int n, BOOL fScale);
  1391. #endif // _WIN32_IE >= 0x0500
  1392. #endif // NO_SHLWAPI_GDI
  1393. //
  1394. //====== DllGetVersion =======================================================
  1395. //
  1396. typedef struct _DLLVERSIONINFO
  1397. {
  1398. DWORD cbSize;
  1399. DWORD dwMajorVersion; // Major version
  1400. DWORD dwMinorVersion; // Minor version
  1401. DWORD dwBuildNumber; // Build number
  1402. DWORD dwPlatformID; // DLLVER_PLATFORM_*
  1403. } DLLVERSIONINFO;
  1404. // Platform IDs for DLLVERSIONINFO
  1405. #define DLLVER_PLATFORM_WINDOWS 0x00000001 // Windows 95
  1406. #define DLLVER_PLATFORM_NT 0x00000002 // Windows NT
  1407. #if (_WIN32_IE >= 0x0501)
  1408. typedef struct _DLLVERSIONINFO2
  1409. {
  1410. DLLVERSIONINFO info1;
  1411. DWORD dwFlags; // No flags currently defined
  1412. ULONGLONG ullVersion; // Encoded as:
  1413. // Major 0xFFFF 0000 0000 0000
  1414. // Minor 0x0000 FFFF 0000 0000
  1415. // Build 0x0000 0000 FFFF 0000
  1416. // QFE 0x0000 0000 0000 FFFF
  1417. } DLLVERSIONINFO2;
  1418. #define DLLVER_MAJOR_MASK 0xFFFF000000000000
  1419. #define DLLVER_MINOR_MASK 0x0000FFFF00000000
  1420. #define DLLVER_BUILD_MASK 0x00000000FFFF0000
  1421. #define DLLVER_QFE_MASK 0x000000000000FFFF
  1422. #endif
  1423. #define MAKEDLLVERULL(major, minor, build, qfe) \
  1424. (((ULONGLONG)(major) << 48) | \
  1425. ((ULONGLONG)(minor) << 32) | \
  1426. ((ULONGLONG)(build) << 16) | \
  1427. ((ULONGLONG)( qfe) << 0))
  1428. //
  1429. // The caller should always GetProcAddress("DllGetVersion"), not
  1430. // implicitly link to it.
  1431. //
  1432. typedef HRESULT (CALLBACK* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
  1433. // DllInstall (to be implemented by self-installing DLLs)
  1434. STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine);
  1435. #if (_WIN32_IE >= 0x0602)
  1436. // Function to see if Internet Explorer Enhanced Security Configuration is active for the current user
  1437. LWSTDAPI_(BOOL) IsInternetESCEnabled();
  1438. #endif // (_WIN32_IE >= 0x0602)
  1439. #ifdef __cplusplus
  1440. }
  1441. #endif
  1442. #ifdef _WIN32
  1443. #include <poppack.h>
  1444. #endif
  1445. #endif
  1446. #endif // _INC_SHLWAPI