Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3816 lines
128 KiB

  1. /*++
  2. Copyright (c) 1995-1999 Microsoft Corporation
  3. Module Name:
  4. wininet.h
  5. Abstract:
  6. Contains manifests, macros, types and prototypes for Microsoft Windows
  7. Internet Extensions
  8. --*/
  9. #if !defined(_WININET_)
  10. #define _WININET_
  11. /*
  12. * Set up Structure Packing to be 4 bytes
  13. * for all wininet structures
  14. */
  15. #if defined(_WIN64)
  16. #include <pshpack8.h>
  17. #else
  18. #include <pshpack4.h>
  19. #endif
  20. #if defined(__cplusplus)
  21. extern "C" {
  22. #endif
  23. #if !defined(_WINX32_)
  24. #define INTERNETAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  25. #define INTERNETAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  26. #define URLCACHEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  27. #define URLCACHEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  28. #else
  29. #define INTERNETAPI EXTERN_C HRESULT STDAPICALLTYPE
  30. #define INTERNETAPI_(type) EXTERN_C type STDAPICALLTYPE
  31. #define URLCACHEAPI EXTERN_C HRESULT STDAPICALLTYPE
  32. #define URLCACHEAPI_(type) EXTERN_C type STDAPICALLTYPE
  33. #endif
  34. #define BOOLAPI INTERNETAPI_(BOOL)
  35. //
  36. // internet types
  37. //
  38. typedef LPVOID HINTERNET;
  39. typedef HINTERNET * LPHINTERNET;
  40. typedef WORD INTERNET_PORT;
  41. typedef INTERNET_PORT * LPINTERNET_PORT;
  42. //
  43. // Internet APIs
  44. //
  45. //
  46. // manifests
  47. //
  48. #define INTERNET_INVALID_PORT_NUMBER 0 // use the protocol-specific default
  49. #define INTERNET_DEFAULT_FTP_PORT 21 // default for FTP servers
  50. #define INTERNET_DEFAULT_GOPHER_PORT 70 // " " gopher "
  51. #define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
  52. #define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
  53. #define INTERNET_DEFAULT_SOCKS_PORT 1080 // default for SOCKS firewall servers.
  54. //
  55. // maximum field lengths (arbitrary)
  56. //
  57. #define INTERNET_MAX_HOST_NAME_LENGTH 256
  58. #define INTERNET_MAX_USER_NAME_LENGTH 128
  59. #define INTERNET_MAX_PASSWORD_LENGTH 128
  60. #define INTERNET_MAX_PORT_NUMBER_LENGTH 5 // INTERNET_PORT is unsigned short
  61. #define INTERNET_MAX_PORT_NUMBER_VALUE 65535 // maximum unsigned short value
  62. #define INTERNET_MAX_PATH_LENGTH 2048
  63. #define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
  64. #define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH \
  65. + sizeof("://") \
  66. + INTERNET_MAX_PATH_LENGTH)
  67. //
  68. // values returned by InternetQueryOption() with INTERNET_OPTION_KEEP_CONNECTION:
  69. //
  70. #define INTERNET_KEEP_ALIVE_UNKNOWN ((DWORD)-1)
  71. #define INTERNET_KEEP_ALIVE_ENABLED 1
  72. #define INTERNET_KEEP_ALIVE_DISABLED 0
  73. //
  74. // flags returned by InternetQueryOption() with INTERNET_OPTION_REQUEST_FLAGS
  75. //
  76. #define INTERNET_REQFLAG_FROM_CACHE 0x00000001 // response came from cache
  77. #define INTERNET_REQFLAG_ASYNC 0x00000002 // request was made asynchronously
  78. #define INTERNET_REQFLAG_VIA_PROXY 0x00000004 // request was made via a proxy
  79. #define INTERNET_REQFLAG_NO_HEADERS 0x00000008 // orginal response contained no headers
  80. #define INTERNET_REQFLAG_PASSIVE 0x00000010 // FTP: passive-mode connection
  81. #define INTERNET_REQFLAG_CACHE_WRITE_DISABLED 0x00000040 // HTTPS: this request not cacheable
  82. #define INTERNET_REQFLAG_NET_TIMEOUT 0x00000080 // w/ _FROM_CACHE: net request timed out
  83. //
  84. // flags common to open functions (not InternetOpen()):
  85. //
  86. #define INTERNET_FLAG_RELOAD 0x80000000 // retrieve the original item
  87. //
  88. // flags for InternetOpenUrl():
  89. //
  90. #define INTERNET_FLAG_RAW_DATA 0x40000000 // FTP/gopher find: receive the item as raw (structured) data
  91. #define INTERNET_FLAG_EXISTING_CONNECT 0x20000000 // FTP: use existing InternetConnect handle for server if possible
  92. //
  93. // flags for InternetOpen():
  94. //
  95. #define INTERNET_FLAG_ASYNC 0x10000000 // this request is asynchronous (where supported)
  96. //
  97. // protocol-specific flags:
  98. //
  99. #define INTERNET_FLAG_PASSIVE 0x08000000 // used for FTP connections
  100. //
  101. // additional cache flags
  102. //
  103. #define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000 // don't write this item to the cache
  104. #define INTERNET_FLAG_DONT_CACHE INTERNET_FLAG_NO_CACHE_WRITE
  105. #define INTERNET_FLAG_MAKE_PERSISTENT 0x02000000 // make this item persistent in cache
  106. #define INTERNET_FLAG_FROM_CACHE 0x01000000 // use offline semantics
  107. #define INTERNET_FLAG_OFFLINE INTERNET_FLAG_FROM_CACHE
  108. //
  109. // additional flags
  110. //
  111. #define INTERNET_FLAG_SECURE 0x00800000 // use PCT/SSL if applicable (HTTP)
  112. #define INTERNET_FLAG_KEEP_CONNECTION 0x00400000 // use keep-alive semantics
  113. #define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000 // don't handle redirections automatically
  114. #define INTERNET_FLAG_READ_PREFETCH 0x00100000 // do background read prefetch
  115. #define INTERNET_FLAG_NO_COOKIES 0x00080000 // no automatic cookie handling
  116. #define INTERNET_FLAG_NO_AUTH 0x00040000 // no automatic authentication handling
  117. #define INTERNET_FLAG_RESTRICTED_ZONE 0x00020000 // apply restricted zone policies for cookies, auth
  118. #define INTERNET_FLAG_CACHE_IF_NET_FAIL 0x00010000 // return cache file if net request fails
  119. //
  120. // Security Ignore Flags, Allow HttpOpenRequest to overide
  121. // Secure Channel (SSL/PCT) failures of the following types.
  122. //
  123. #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000 // ex: https:// to http://
  124. #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000 // ex: http:// to https://
  125. #define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 // expired X509 Cert.
  126. #define INTERNET_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 // bad common name in X509 Cert.
  127. //
  128. // more caching flags
  129. //
  130. #define INTERNET_FLAG_RESYNCHRONIZE 0x00000800 // asking wininet to update an item if it is newer
  131. #define INTERNET_FLAG_HYPERLINK 0x00000400 // asking wininet to do hyperlinking semantic which works right for scripts
  132. #define INTERNET_FLAG_NO_UI 0x00000200 // no cookie popup
  133. #define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 // asking wininet to add "pragma: no-cache"
  134. #define INTERNET_FLAG_CACHE_ASYNC 0x00000080 // ok to perform lazy cache-write
  135. #define INTERNET_FLAG_FORMS_SUBMIT 0x00000040 // this is a forms submit
  136. #define INTERNET_FLAG_FWD_BACK 0x00000020 // fwd-back button op
  137. #define INTERNET_FLAG_NEED_FILE 0x00000010 // need a file for this request
  138. #define INTERNET_FLAG_MUST_CACHE_REQUEST INTERNET_FLAG_NEED_FILE
  139. //
  140. // flags for FTP
  141. //
  142. #define INTERNET_FLAG_TRANSFER_ASCII FTP_TRANSFER_TYPE_ASCII // 0x00000001
  143. #define INTERNET_FLAG_TRANSFER_BINARY FTP_TRANSFER_TYPE_BINARY // 0x00000002
  144. //
  145. // flags field masks
  146. //
  147. #define SECURITY_INTERNET_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID | \
  148. INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | \
  149. INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | \
  150. INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP )
  151. #define INTERNET_FLAGS_MASK (INTERNET_FLAG_RELOAD \
  152. | INTERNET_FLAG_RAW_DATA \
  153. | INTERNET_FLAG_EXISTING_CONNECT \
  154. | INTERNET_FLAG_ASYNC \
  155. | INTERNET_FLAG_PASSIVE \
  156. | INTERNET_FLAG_NO_CACHE_WRITE \
  157. | INTERNET_FLAG_MAKE_PERSISTENT \
  158. | INTERNET_FLAG_FROM_CACHE \
  159. | INTERNET_FLAG_SECURE \
  160. | INTERNET_FLAG_KEEP_CONNECTION \
  161. | INTERNET_FLAG_NO_AUTO_REDIRECT \
  162. | INTERNET_FLAG_READ_PREFETCH \
  163. | INTERNET_FLAG_NO_COOKIES \
  164. | INTERNET_FLAG_NO_AUTH \
  165. | INTERNET_FLAG_CACHE_IF_NET_FAIL \
  166. | SECURITY_INTERNET_MASK \
  167. | INTERNET_FLAG_RESYNCHRONIZE \
  168. | INTERNET_FLAG_HYPERLINK \
  169. | INTERNET_FLAG_NO_UI \
  170. | INTERNET_FLAG_PRAGMA_NOCACHE \
  171. | INTERNET_FLAG_CACHE_ASYNC \
  172. | INTERNET_FLAG_FORMS_SUBMIT \
  173. | INTERNET_FLAG_NEED_FILE \
  174. | INTERNET_FLAG_RESTRICTED_ZONE \
  175. | INTERNET_FLAG_TRANSFER_BINARY \
  176. | INTERNET_FLAG_TRANSFER_ASCII \
  177. | INTERNET_FLAG_FWD_BACK \
  178. | INTERNET_FLAG_BGUPDATE \
  179. )
  180. #define INTERNET_ERROR_MASK_INSERT_CDROM 0x1
  181. #define INTERNET_ERROR_MASK_COMBINED_SEC_CERT 0x2
  182. #define INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG 0X4
  183. #define INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY 0x8
  184. #define INTERNET_OPTIONS_MASK (~INTERNET_FLAGS_MASK)
  185. //
  186. // common per-API flags (new APIs)
  187. //
  188. #define WININET_API_FLAG_ASYNC 0x00000001 // force async operation
  189. #define WININET_API_FLAG_SYNC 0x00000004 // force sync operation
  190. #define WININET_API_FLAG_USE_CONTEXT 0x00000008 // use value supplied in dwContext (even if 0)
  191. //
  192. // INTERNET_NO_CALLBACK - if this value is presented as the dwContext parameter
  193. // then no call-backs will be made for that API
  194. //
  195. #define INTERNET_NO_CALLBACK 0
  196. //
  197. // structures/types
  198. //
  199. //
  200. // INTERNET_SCHEME - enumerated URL scheme type
  201. //
  202. typedef enum {
  203. INTERNET_SCHEME_PARTIAL = -2,
  204. INTERNET_SCHEME_UNKNOWN = -1,
  205. INTERNET_SCHEME_DEFAULT = 0,
  206. INTERNET_SCHEME_FTP,
  207. INTERNET_SCHEME_GOPHER,
  208. INTERNET_SCHEME_HTTP,
  209. INTERNET_SCHEME_HTTPS,
  210. INTERNET_SCHEME_FILE,
  211. INTERNET_SCHEME_NEWS,
  212. INTERNET_SCHEME_MAILTO,
  213. INTERNET_SCHEME_SOCKS,
  214. INTERNET_SCHEME_JAVASCRIPT,
  215. INTERNET_SCHEME_VBSCRIPT,
  216. INTERNET_SCHEME_RES,
  217. INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP,
  218. INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES
  219. } INTERNET_SCHEME, * LPINTERNET_SCHEME;
  220. //
  221. // INTERNET_ASYNC_RESULT - this structure is returned to the application via
  222. // the callback with INTERNET_STATUS_REQUEST_COMPLETE. It is not sufficient to
  223. // just return the result of the async operation. If the API failed then the
  224. // app cannot call GetLastError() because the thread context will be incorrect.
  225. // Both the value returned by the async API and any resultant error code are
  226. // made available. The app need not check dwError if dwResult indicates that
  227. // the API succeeded (in this case dwError will be ERROR_SUCCESS)
  228. //
  229. typedef struct {
  230. //
  231. // dwResult - the HINTERNET, DWORD or BOOL return code from an async API
  232. //
  233. DWORD_PTR dwResult;
  234. //
  235. // dwError - the error code if the API failed
  236. //
  237. DWORD dwError;
  238. } INTERNET_ASYNC_RESULT, * LPINTERNET_ASYNC_RESULT;
  239. //
  240. // INTERNET_DIAGNOSTIC_SOCKET_INFO - info about the socket in use
  241. //
  242. typedef struct {
  243. DWORD_PTR Socket;
  244. DWORD SourcePort;
  245. DWORD DestPort;
  246. DWORD Flags;
  247. } INTERNET_DIAGNOSTIC_SOCKET_INFO, * LPINTERNET_DIAGNOSTIC_SOCKET_INFO;
  248. //
  249. // INTERNET_DIAGNOSTIC_SOCKET_INFO.Flags definitions
  250. //
  251. #define IDSI_FLAG_KEEP_ALIVE 0x00000001 // set if from keep-alive pool
  252. #define IDSI_FLAG_SECURE 0x00000002 // set if secure connection
  253. #define IDSI_FLAG_PROXY 0x00000004 // set if using proxy
  254. #define IDSI_FLAG_TUNNEL 0x00000008 // set if tunnelling through proxy
  255. //
  256. // INTERNET_PROXY_INFO - structure supplied with INTERNET_OPTION_PROXY to get/
  257. // set proxy information on a InternetOpen() handle
  258. //
  259. typedef struct {
  260. //
  261. // dwAccessType - INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PROXY, or
  262. // INTERNET_OPEN_TYPE_PRECONFIG (set only)
  263. //
  264. DWORD dwAccessType;
  265. //
  266. // lpszProxy - proxy server list
  267. //
  268. LPCTSTR lpszProxy;
  269. //
  270. // lpszProxyBypass - proxy bypass list
  271. //
  272. LPCTSTR lpszProxyBypass;
  273. } INTERNET_PROXY_INFO, * LPINTERNET_PROXY_INFO;
  274. //
  275. // INTERNET_PER_CONN_OPTION_LIST - set per-connection options such as proxy
  276. // and autoconfig info
  277. //
  278. // Set and queried using Internet[Set|Query]Option with
  279. // INTERNET_OPTION_PER_CONNECTION_OPTION
  280. //
  281. typedef struct {
  282. DWORD dwOption; // option to be queried or set
  283. union {
  284. DWORD dwValue; // dword value for the option
  285. LPSTR pszValue; // pointer to string value for the option
  286. FILETIME ftValue; // file-time value for the option
  287. } Value;
  288. } INTERNET_PER_CONN_OPTIONA, * LPINTERNET_PER_CONN_OPTIONA;
  289. typedef struct {
  290. DWORD dwOption; // option to be queried or set
  291. union {
  292. DWORD dwValue; // dword value for the option
  293. LPWSTR pszValue; // pointer to string value for the option
  294. FILETIME ftValue; // file-time value for the option
  295. } Value;
  296. } INTERNET_PER_CONN_OPTIONW, * LPINTERNET_PER_CONN_OPTIONW;
  297. #ifdef UNICODE
  298. typedef INTERNET_PER_CONN_OPTIONW INTERNET_PER_CONN_OPTION;
  299. typedef LPINTERNET_PER_CONN_OPTIONW LPINTERNET_PER_CONN_OPTION;
  300. #else
  301. typedef INTERNET_PER_CONN_OPTIONA INTERNET_PER_CONN_OPTION;
  302. typedef LPINTERNET_PER_CONN_OPTIONA LPINTERNET_PER_CONN_OPTION;
  303. #endif // UNICODE
  304. typedef struct {
  305. DWORD dwSize; // size of the INTERNET_PER_CONN_OPTION_LIST struct
  306. LPSTR pszConnection; // connection name to set/query options
  307. DWORD dwOptionCount; // number of options to set/query
  308. DWORD dwOptionError; // on error, which option failed
  309. LPINTERNET_PER_CONN_OPTIONA pOptions;
  310. // array of options to set/query
  311. } INTERNET_PER_CONN_OPTION_LISTA, * LPINTERNET_PER_CONN_OPTION_LISTA;
  312. typedef struct {
  313. DWORD dwSize; // size of the INTERNET_PER_CONN_OPTION_LIST struct
  314. LPWSTR pszConnection; // connection name to set/query options
  315. DWORD dwOptionCount; // number of options to set/query
  316. DWORD dwOptionError; // on error, which option failed
  317. LPINTERNET_PER_CONN_OPTIONW pOptions;
  318. // array of options to set/query
  319. } INTERNET_PER_CONN_OPTION_LISTW, * LPINTERNET_PER_CONN_OPTION_LISTW;
  320. #ifdef UNICODE
  321. typedef INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LIST;
  322. typedef LPINTERNET_PER_CONN_OPTION_LISTW LPINTERNET_PER_CONN_OPTION_LIST;
  323. #else
  324. typedef INTERNET_PER_CONN_OPTION_LISTA INTERNET_PER_CONN_OPTION_LIST;
  325. typedef LPINTERNET_PER_CONN_OPTION_LISTA LPINTERNET_PER_CONN_OPTION_LIST;
  326. #endif // UNICODE
  327. //
  328. // Options used in INTERNET_PER_CONN_OPTON struct
  329. //
  330. #define INTERNET_PER_CONN_FLAGS 1
  331. #define INTERNET_PER_CONN_PROXY_SERVER 2
  332. #define INTERNET_PER_CONN_PROXY_BYPASS 3
  333. #define INTERNET_PER_CONN_AUTOCONFIG_URL 4
  334. #define INTERNET_PER_CONN_AUTODISCOVERY_FLAGS 5
  335. #define INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL 6
  336. #define INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS 7
  337. #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME 8
  338. #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL 9
  339. //
  340. // PER_CONN_FLAGS
  341. //
  342. #define PROXY_TYPE_DIRECT 0x00000001 // direct to net
  343. #define PROXY_TYPE_PROXY 0x00000002 // via named proxy
  344. #define PROXY_TYPE_AUTO_PROXY_URL 0x00000004 // autoproxy URL
  345. #define PROXY_TYPE_AUTO_DETECT 0x00000008 // use autoproxy detection
  346. //
  347. // PER_CONN_AUTODISCOVERY_FLAGS
  348. //
  349. #define AUTO_PROXY_FLAG_USER_SET 0x00000001 // user changed this setting
  350. #define AUTO_PROXY_FLAG_ALWAYS_DETECT 0x00000002 // force detection even when its not needed
  351. #define AUTO_PROXY_FLAG_DETECTION_RUN 0x00000004 // detection has been run
  352. #define AUTO_PROXY_FLAG_MIGRATED 0x00000008 // migration has just been done
  353. #define AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT 0x00000010 // don't cache result of host=proxy name
  354. #define AUTO_PROXY_FLAG_CACHE_INIT_RUN 0x00000020 // don't initalize and run unless URL expired
  355. #define AUTO_PROXY_FLAG_DETECTION_SUSPECT 0x00000040 // if we're on a LAN & Modem, with only one IP, bad?!?
  356. //
  357. // INTERNET_VERSION_INFO - version information returned via
  358. // InternetQueryOption(..., INTERNET_OPTION_VERSION, ...)
  359. //
  360. typedef struct {
  361. DWORD dwMajorVersion;
  362. DWORD dwMinorVersion;
  363. } INTERNET_VERSION_INFO, * LPINTERNET_VERSION_INFO;
  364. //
  365. // HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1)
  366. //
  367. typedef struct {
  368. DWORD dwMajorVersion;
  369. DWORD dwMinorVersion;
  370. } HTTP_VERSION_INFO, * LPHTTP_VERSION_INFO;
  371. //
  372. // INTERNET_CONNECTED_INFO - information used to set the global connected state
  373. //
  374. typedef struct {
  375. //
  376. // dwConnectedState - new connected/disconnected state.
  377. // See INTERNET_STATE_CONNECTED, etc.
  378. //
  379. DWORD dwConnectedState;
  380. //
  381. // dwFlags - flags controlling connected->disconnected (or disconnected->
  382. // connected) transition. See below
  383. //
  384. DWORD dwFlags;
  385. } INTERNET_CONNECTED_INFO, * LPINTERNET_CONNECTED_INFO;
  386. //
  387. // flags for INTERNET_CONNECTED_INFO dwFlags
  388. //
  389. //
  390. // ISO_FORCE_DISCONNECTED - if set when putting Wininet into disconnected mode,
  391. // all outstanding requests will be aborted with a cancelled error
  392. //
  393. #define ISO_FORCE_DISCONNECTED 0x00000001
  394. //
  395. // URL_COMPONENTS - the constituent parts of an URL. Used in InternetCrackUrl()
  396. // and InternetCreateUrl()
  397. //
  398. // For InternetCrackUrl(), if a pointer field and its corresponding length field
  399. // are both 0 then that component is not returned. If the pointer field is NULL
  400. // but the length field is not zero, then both the pointer and length fields are
  401. // returned if both pointer and corresponding length fields are non-zero then
  402. // the pointer field points to a buffer where the component is copied. The
  403. // component may be un-escaped, depending on dwFlags
  404. //
  405. // For InternetCreateUrl(), the pointer fields should be NULL if the component
  406. // is not required. If the corresponding length field is zero then the pointer
  407. // field is the address of a zero-terminated string. If the length field is not
  408. // zero then it is the string length of the corresponding pointer field
  409. //
  410. #pragma warning( disable : 4121 ) // disable alignment warning
  411. typedef struct {
  412. DWORD dwStructSize; // size of this structure. Used in version check
  413. LPSTR lpszScheme; // pointer to scheme name
  414. DWORD dwSchemeLength; // length of scheme name
  415. INTERNET_SCHEME nScheme; // enumerated scheme type (if known)
  416. LPSTR lpszHostName; // pointer to host name
  417. DWORD dwHostNameLength; // length of host name
  418. INTERNET_PORT nPort; // converted port number
  419. LPSTR lpszUserName; // pointer to user name
  420. DWORD dwUserNameLength; // length of user name
  421. LPSTR lpszPassword; // pointer to password
  422. DWORD dwPasswordLength; // length of password
  423. LPSTR lpszUrlPath; // pointer to URL-path
  424. DWORD dwUrlPathLength; // length of URL-path
  425. LPSTR lpszExtraInfo; // pointer to extra information (e.g. ?foo or #foo)
  426. DWORD dwExtraInfoLength; // length of extra information
  427. } URL_COMPONENTSA, * LPURL_COMPONENTSA;
  428. typedef struct {
  429. DWORD dwStructSize; // size of this structure. Used in version check
  430. LPWSTR lpszScheme; // pointer to scheme name
  431. DWORD dwSchemeLength; // length of scheme name
  432. INTERNET_SCHEME nScheme; // enumerated scheme type (if known)
  433. LPWSTR lpszHostName; // pointer to host name
  434. DWORD dwHostNameLength; // length of host name
  435. INTERNET_PORT nPort; // converted port number
  436. LPWSTR lpszUserName; // pointer to user name
  437. DWORD dwUserNameLength; // length of user name
  438. LPWSTR lpszPassword; // pointer to password
  439. DWORD dwPasswordLength; // length of password
  440. LPWSTR lpszUrlPath; // pointer to URL-path
  441. DWORD dwUrlPathLength; // length of URL-path
  442. LPWSTR lpszExtraInfo; // pointer to extra information (e.g. ?foo or #foo)
  443. DWORD dwExtraInfoLength; // length of extra information
  444. } URL_COMPONENTSW, * LPURL_COMPONENTSW;
  445. #ifdef UNICODE
  446. typedef URL_COMPONENTSW URL_COMPONENTS;
  447. typedef LPURL_COMPONENTSW LPURL_COMPONENTS;
  448. #else
  449. typedef URL_COMPONENTSA URL_COMPONENTS;
  450. typedef LPURL_COMPONENTSA LPURL_COMPONENTS;
  451. #endif // UNICODE
  452. #pragma warning( default : 4121 ) // restore alignment warning
  453. //
  454. // INTERNET_CERTIFICATE_INFO lpBuffer - contains the certificate returned from
  455. // the server
  456. //
  457. typedef struct {
  458. //
  459. // ftExpiry - date the certificate expires.
  460. //
  461. FILETIME ftExpiry;
  462. //
  463. // ftStart - date the certificate becomes valid.
  464. //
  465. FILETIME ftStart;
  466. //
  467. // lpszSubjectInfo - the name of organization, site, and server
  468. // the cert. was issued for.
  469. //
  470. LPTSTR lpszSubjectInfo;
  471. //
  472. // lpszIssuerInfo - the name of orgainzation, site, and server
  473. // the cert was issues by.
  474. //
  475. LPTSTR lpszIssuerInfo;
  476. //
  477. // lpszProtocolName - the name of the protocol used to provide the secure
  478. // connection.
  479. //
  480. LPTSTR lpszProtocolName;
  481. //
  482. // lpszSignatureAlgName - the name of the algorithm used for signing
  483. // the certificate.
  484. //
  485. LPTSTR lpszSignatureAlgName;
  486. //
  487. // lpszEncryptionAlgName - the name of the algorithm used for
  488. // doing encryption over the secure channel (SSL/PCT) connection.
  489. //
  490. LPTSTR lpszEncryptionAlgName;
  491. //
  492. // dwKeySize - size of the key.
  493. //
  494. DWORD dwKeySize;
  495. } INTERNET_CERTIFICATE_INFO, * LPINTERNET_CERTIFICATE_INFO;
  496. //
  497. // INTERNET_BUFFERS - combines headers and data. May be chained for e.g. file
  498. // upload or scatter/gather operations. For chunked read/write, lpcszHeader
  499. // contains the chunked-ext
  500. //
  501. typedef struct _INTERNET_BUFFERSA {
  502. DWORD dwStructSize; // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
  503. struct _INTERNET_BUFFERSA * Next; // chain of buffers
  504. LPCSTR lpcszHeader; // pointer to headers (may be NULL)
  505. DWORD dwHeadersLength; // length of headers if not NULL
  506. DWORD dwHeadersTotal; // size of headers if not enough buffer
  507. LPVOID lpvBuffer; // pointer to data buffer (may be NULL)
  508. DWORD dwBufferLength; // length of data buffer if not NULL
  509. DWORD dwBufferTotal; // total size of chunk, or content-length if not chunked
  510. DWORD dwOffsetLow; // used for read-ranges (only used in HttpSendRequest2)
  511. DWORD dwOffsetHigh;
  512. } INTERNET_BUFFERSA, * LPINTERNET_BUFFERSA;
  513. typedef struct _INTERNET_BUFFERSW {
  514. DWORD dwStructSize; // used for API versioning. Set to sizeof(INTERNET_BUFFERS)
  515. struct _INTERNET_BUFFERSW * Next; // chain of buffers
  516. LPCWSTR lpcszHeader; // pointer to headers (may be NULL)
  517. DWORD dwHeadersLength; // length of headers if not NULL
  518. DWORD dwHeadersTotal; // size of headers if not enough buffer
  519. LPVOID lpvBuffer; // pointer to data buffer (may be NULL)
  520. DWORD dwBufferLength; // length of data buffer if not NULL
  521. DWORD dwBufferTotal; // total size of chunk, or content-length if not chunked
  522. DWORD dwOffsetLow; // used for read-ranges (only used in HttpSendRequest2)
  523. DWORD dwOffsetHigh;
  524. } INTERNET_BUFFERSW, * LPINTERNET_BUFFERSW;
  525. #ifdef UNICODE
  526. typedef INTERNET_BUFFERSW INTERNET_BUFFERS;
  527. typedef LPINTERNET_BUFFERSW LPINTERNET_BUFFERS;
  528. #else
  529. typedef INTERNET_BUFFERSA INTERNET_BUFFERS;
  530. typedef LPINTERNET_BUFFERSA LPINTERNET_BUFFERS;
  531. #endif // UNICODE
  532. //
  533. // prototypes
  534. //
  535. BOOLAPI InternetTimeFromSystemTimeA(
  536. IN CONST SYSTEMTIME *pst, // input GMT time
  537. IN DWORD dwRFC, // RFC format
  538. OUT LPSTR lpszTime, // output string buffer
  539. IN DWORD cbTime // output buffer size
  540. );
  541. BOOLAPI InternetTimeFromSystemTimeW(
  542. IN CONST SYSTEMTIME *pst, // input GMT time
  543. IN DWORD dwRFC, // RFC format
  544. OUT LPWSTR lpszTime, // output string buffer
  545. IN DWORD cbTime // output buffer size
  546. );
  547. #ifdef UNICODE
  548. #define InternetTimeFromSystemTime InternetTimeFromSystemTimeW
  549. #else
  550. #ifdef _WINX32_
  551. #define InternetTimeFromSystemTime InternetTimeFromSystemTimeA
  552. #else
  553. BOOLAPI InternetTimeFromSystemTime(
  554. IN CONST SYSTEMTIME *pst, // input GMT time
  555. IN DWORD dwRFC, // RFC format
  556. OUT LPSTR lpszTime, // output string buffer
  557. IN DWORD cbTime // output buffer size
  558. );
  559. #endif // _WINX32_
  560. #endif // !UNICODE
  561. //
  562. // constants for InternetTimeFromSystemTime
  563. //
  564. #define INTERNET_RFC1123_FORMAT 0
  565. #define INTERNET_RFC1123_BUFSIZE 30
  566. BOOLAPI InternetTimeToSystemTimeA(
  567. IN LPCSTR lpszTime, // NULL terminated string
  568. OUT SYSTEMTIME *pst, // output in GMT time
  569. IN DWORD dwReserved
  570. );
  571. BOOLAPI InternetTimeToSystemTimeW(
  572. IN LPCWSTR lpszTime, // NULL terminated string
  573. OUT SYSTEMTIME *pst, // output in GMT time
  574. IN DWORD dwReserved
  575. );
  576. #ifdef UNICODE
  577. #define InternetTimeToSystemTime InternetTimeToSystemTimeW
  578. #else
  579. #ifdef _WINX32_
  580. #define InternetTimeToSystemTime InternetTimeToSystemTimeA
  581. #else
  582. BOOLAPI InternetTimeToSystemTime(
  583. IN LPCSTR lpszTime, // NULL terminated string
  584. OUT SYSTEMTIME *pst, // output in GMT time
  585. IN DWORD dwReserved
  586. );
  587. #endif // _WINX32_
  588. #endif // !UNICODE
  589. BOOLAPI InternetCrackUrlA(
  590. IN LPCSTR lpszUrl,
  591. IN DWORD dwUrlLength,
  592. IN DWORD dwFlags,
  593. IN OUT LPURL_COMPONENTSA lpUrlComponents
  594. );
  595. BOOLAPI InternetCrackUrlW(
  596. IN LPCWSTR lpszUrl,
  597. IN DWORD dwUrlLength,
  598. IN DWORD dwFlags,
  599. IN OUT LPURL_COMPONENTSW lpUrlComponents
  600. );
  601. #ifdef UNICODE
  602. #define InternetCrackUrl InternetCrackUrlW
  603. #else
  604. #define InternetCrackUrl InternetCrackUrlA
  605. #endif // !UNICODE
  606. BOOLAPI InternetCreateUrlA(
  607. IN LPURL_COMPONENTSA lpUrlComponents,
  608. IN DWORD dwFlags,
  609. OUT LPSTR lpszUrl,
  610. IN OUT LPDWORD lpdwUrlLength
  611. );
  612. BOOLAPI InternetCreateUrlW(
  613. IN LPURL_COMPONENTSW lpUrlComponents,
  614. IN DWORD dwFlags,
  615. OUT LPWSTR lpszUrl,
  616. IN OUT LPDWORD lpdwUrlLength
  617. );
  618. #ifdef UNICODE
  619. #define InternetCreateUrl InternetCreateUrlW
  620. #else
  621. #define InternetCreateUrl InternetCreateUrlA
  622. #endif // !UNICODE
  623. BOOLAPI InternetCanonicalizeUrlA(
  624. IN LPCSTR lpszUrl,
  625. OUT LPSTR lpszBuffer,
  626. IN OUT LPDWORD lpdwBufferLength,
  627. IN DWORD dwFlags
  628. );
  629. BOOLAPI InternetCanonicalizeUrlW(
  630. IN LPCWSTR lpszUrl,
  631. OUT LPWSTR lpszBuffer,
  632. IN OUT LPDWORD lpdwBufferLength,
  633. IN DWORD dwFlags
  634. );
  635. #ifdef UNICODE
  636. #define InternetCanonicalizeUrl InternetCanonicalizeUrlW
  637. #else
  638. #define InternetCanonicalizeUrl InternetCanonicalizeUrlA
  639. #endif // !UNICODE
  640. BOOLAPI InternetCombineUrlA(
  641. IN LPCSTR lpszBaseUrl,
  642. IN LPCSTR lpszRelativeUrl,
  643. OUT LPSTR lpszBuffer,
  644. IN OUT LPDWORD lpdwBufferLength,
  645. IN DWORD dwFlags
  646. );
  647. BOOLAPI InternetCombineUrlW(
  648. IN LPCWSTR lpszBaseUrl,
  649. IN LPCWSTR lpszRelativeUrl,
  650. OUT LPWSTR lpszBuffer,
  651. IN OUT LPDWORD lpdwBufferLength,
  652. IN DWORD dwFlags
  653. );
  654. #ifdef UNICODE
  655. #define InternetCombineUrl InternetCombineUrlW
  656. #else
  657. #define InternetCombineUrl InternetCombineUrlA
  658. #endif // !UNICODE
  659. //
  660. // flags for InternetCrackUrl() and InternetCreateUrl()
  661. //
  662. #define ICU_ESCAPE 0x80000000 // (un)escape URL characters
  663. #define ICU_USERNAME 0x40000000 // use internal username & password
  664. //
  665. // flags for InternetCanonicalizeUrl() and InternetCombineUrl()
  666. //
  667. #define ICU_NO_ENCODE 0x20000000 // Don't convert unsafe characters to escape sequence
  668. #define ICU_DECODE 0x10000000 // Convert %XX escape sequences to characters
  669. #define ICU_NO_META 0x08000000 // Don't convert .. etc. meta path sequences
  670. #define ICU_ENCODE_SPACES_ONLY 0x04000000 // Encode spaces only
  671. #define ICU_BROWSER_MODE 0x02000000 // Special encode/decode rules for browser
  672. #define ICU_ENCODE_PERCENT 0x00001000 // Encode any percent (ASCII25)
  673. // signs encountered, default is to not encode percent.
  674. INTERNETAPI_(HINTERNET) InternetOpenA(
  675. IN LPCSTR lpszAgent,
  676. IN DWORD dwAccessType,
  677. IN LPCSTR lpszProxy OPTIONAL,
  678. IN LPCSTR lpszProxyBypass OPTIONAL,
  679. IN DWORD dwFlags
  680. );
  681. INTERNETAPI_(HINTERNET) InternetOpenW(
  682. IN LPCWSTR lpszAgent,
  683. IN DWORD dwAccessType,
  684. IN LPCWSTR lpszProxy OPTIONAL,
  685. IN LPCWSTR lpszProxyBypass OPTIONAL,
  686. IN DWORD dwFlags
  687. );
  688. #ifdef UNICODE
  689. #define InternetOpen InternetOpenW
  690. #else
  691. #define InternetOpen InternetOpenA
  692. #endif // !UNICODE
  693. //
  694. // access types for InternetOpen()
  695. //
  696. #define INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
  697. #define INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
  698. #define INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
  699. #define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
  700. //
  701. // old names for access types
  702. //
  703. #define PRE_CONFIG_INTERNET_ACCESS INTERNET_OPEN_TYPE_PRECONFIG
  704. #define LOCAL_INTERNET_ACCESS INTERNET_OPEN_TYPE_DIRECT
  705. #define CERN_PROXY_INTERNET_ACCESS INTERNET_OPEN_TYPE_PROXY
  706. BOOLAPI InternetCloseHandle(
  707. IN HINTERNET hInternet
  708. );
  709. INTERNETAPI_(HINTERNET) InternetConnectA(
  710. IN HINTERNET hInternet,
  711. IN LPCSTR lpszServerName,
  712. IN INTERNET_PORT nServerPort,
  713. IN LPCSTR lpszUserName OPTIONAL,
  714. IN LPCSTR lpszPassword OPTIONAL,
  715. IN DWORD dwService,
  716. IN DWORD dwFlags,
  717. IN DWORD_PTR dwContext
  718. );
  719. INTERNETAPI_(HINTERNET) InternetConnectW(
  720. IN HINTERNET hInternet,
  721. IN LPCWSTR lpszServerName,
  722. IN INTERNET_PORT nServerPort,
  723. IN LPCWSTR lpszUserName OPTIONAL,
  724. IN LPCWSTR lpszPassword OPTIONAL,
  725. IN DWORD dwService,
  726. IN DWORD dwFlags,
  727. IN DWORD_PTR dwContext
  728. );
  729. #ifdef UNICODE
  730. #define InternetConnect InternetConnectW
  731. #else
  732. #define InternetConnect InternetConnectA
  733. #endif // !UNICODE
  734. //
  735. // service types for InternetConnect()
  736. //
  737. #define INTERNET_SERVICE_FTP 1
  738. #define INTERNET_SERVICE_GOPHER 2
  739. #define INTERNET_SERVICE_HTTP 3
  740. INTERNETAPI_(HINTERNET) InternetOpenUrlA(
  741. IN HINTERNET hInternet,
  742. IN LPCSTR lpszUrl,
  743. IN LPCSTR lpszHeaders OPTIONAL,
  744. IN DWORD dwHeadersLength,
  745. IN DWORD dwFlags,
  746. IN DWORD_PTR dwContext
  747. );
  748. INTERNETAPI_(HINTERNET) InternetOpenUrlW(
  749. IN HINTERNET hInternet,
  750. IN LPCWSTR lpszUrl,
  751. IN LPCWSTR lpszHeaders OPTIONAL,
  752. IN DWORD dwHeadersLength,
  753. IN DWORD dwFlags,
  754. IN DWORD_PTR dwContext
  755. );
  756. #ifdef UNICODE
  757. #define InternetOpenUrl InternetOpenUrlW
  758. #else
  759. #define InternetOpenUrl InternetOpenUrlA
  760. #endif // !UNICODE
  761. BOOLAPI InternetReadFile(
  762. IN HINTERNET hFile,
  763. IN LPVOID lpBuffer,
  764. IN DWORD dwNumberOfBytesToRead,
  765. OUT LPDWORD lpdwNumberOfBytesRead
  766. );
  767. INTERNETAPI_(BOOL) InternetReadFileExA(
  768. IN HINTERNET hFile,
  769. OUT LPINTERNET_BUFFERSA lpBuffersOut,
  770. IN DWORD dwFlags,
  771. IN DWORD_PTR dwContext
  772. );
  773. INTERNETAPI_(BOOL) InternetReadFileExW(
  774. IN HINTERNET hFile,
  775. OUT LPINTERNET_BUFFERSW lpBuffersOut,
  776. IN DWORD dwFlags,
  777. IN DWORD_PTR dwContext
  778. );
  779. #ifdef UNICODE
  780. #define InternetReadFileEx InternetReadFileExW
  781. #else
  782. #define InternetReadFileEx InternetReadFileExA
  783. #endif // !UNICODE
  784. //
  785. // flags for InternetReadFileEx()
  786. //
  787. #define IRF_ASYNC WININET_API_FLAG_ASYNC
  788. #define IRF_SYNC WININET_API_FLAG_SYNC
  789. #define IRF_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT
  790. #define IRF_NO_WAIT 0x00000008
  791. INTERNETAPI_(DWORD) InternetSetFilePointer(
  792. IN HINTERNET hFile,
  793. IN LONG lDistanceToMove,
  794. IN PVOID pReserved,
  795. IN DWORD dwMoveMethod,
  796. IN DWORD_PTR dwContext
  797. );
  798. BOOLAPI InternetWriteFile(
  799. IN HINTERNET hFile,
  800. IN LPCVOID lpBuffer,
  801. IN DWORD dwNumberOfBytesToWrite,
  802. OUT LPDWORD lpdwNumberOfBytesWritten
  803. );
  804. BOOLAPI InternetQueryDataAvailable(
  805. IN HINTERNET hFile,
  806. OUT LPDWORD lpdwNumberOfBytesAvailable OPTIONAL,
  807. IN DWORD dwFlags,
  808. IN DWORD_PTR dwContext
  809. );
  810. BOOLAPI InternetFindNextFileA(
  811. IN HINTERNET hFind,
  812. OUT LPVOID lpvFindData
  813. );
  814. BOOLAPI InternetFindNextFileW(
  815. IN HINTERNET hFind,
  816. OUT LPVOID lpvFindData
  817. );
  818. #ifdef UNICODE
  819. #define InternetFindNextFile InternetFindNextFileW
  820. #else
  821. #define InternetFindNextFile InternetFindNextFileA
  822. #endif // !UNICODE
  823. BOOLAPI InternetQueryOptionA(
  824. IN HINTERNET hInternet OPTIONAL,
  825. IN DWORD dwOption,
  826. OUT LPVOID lpBuffer OPTIONAL,
  827. IN OUT LPDWORD lpdwBufferLength
  828. );
  829. BOOLAPI InternetQueryOptionW(
  830. IN HINTERNET hInternet OPTIONAL,
  831. IN DWORD dwOption,
  832. OUT LPVOID lpBuffer OPTIONAL,
  833. IN OUT LPDWORD lpdwBufferLength
  834. );
  835. #ifdef UNICODE
  836. #define InternetQueryOption InternetQueryOptionW
  837. #else
  838. #define InternetQueryOption InternetQueryOptionA
  839. #endif // !UNICODE
  840. BOOLAPI InternetSetOptionA(
  841. IN HINTERNET hInternet OPTIONAL,
  842. IN DWORD dwOption,
  843. IN LPVOID lpBuffer,
  844. IN DWORD dwBufferLength
  845. );
  846. BOOLAPI InternetSetOptionW(
  847. IN HINTERNET hInternet OPTIONAL,
  848. IN DWORD dwOption,
  849. IN LPVOID lpBuffer,
  850. IN DWORD dwBufferLength
  851. );
  852. #ifdef UNICODE
  853. #define InternetSetOption InternetSetOptionW
  854. #else
  855. #define InternetSetOption InternetSetOptionA
  856. #endif // !UNICODE
  857. BOOLAPI InternetSetOptionExA(
  858. IN HINTERNET hInternet OPTIONAL,
  859. IN DWORD dwOption,
  860. IN LPVOID lpBuffer,
  861. IN DWORD dwBufferLength,
  862. IN DWORD dwFlags
  863. );
  864. BOOLAPI InternetSetOptionExW(
  865. IN HINTERNET hInternet OPTIONAL,
  866. IN DWORD dwOption,
  867. IN LPVOID lpBuffer,
  868. IN DWORD dwBufferLength,
  869. IN DWORD dwFlags
  870. );
  871. #ifdef UNICODE
  872. #define InternetSetOptionEx InternetSetOptionExW
  873. #else
  874. #define InternetSetOptionEx InternetSetOptionExA
  875. #endif // !UNICODE
  876. BOOLAPI InternetLockRequestFile(
  877. IN HINTERNET hInternet,
  878. OUT HANDLE * lphLockRequestInfo
  879. );
  880. BOOLAPI InternetUnlockRequestFile(
  881. IN HANDLE hLockRequestInfo
  882. );
  883. //
  884. // flags for InternetSetOptionEx()
  885. //
  886. #define ISO_GLOBAL 0x00000001 // modify option globally
  887. #define ISO_REGISTRY 0x00000002 // write option to registry (where applicable)
  888. #define ISO_VALID_FLAGS (ISO_GLOBAL | ISO_REGISTRY)
  889. //
  890. // options manifests for Internet{Query|Set}Option
  891. //
  892. #define INTERNET_OPTION_CALLBACK 1
  893. #define INTERNET_OPTION_CONNECT_TIMEOUT 2
  894. #define INTERNET_OPTION_CONNECT_RETRIES 3
  895. #define INTERNET_OPTION_CONNECT_BACKOFF 4
  896. #define INTERNET_OPTION_SEND_TIMEOUT 5
  897. #define INTERNET_OPTION_CONTROL_SEND_TIMEOUT INTERNET_OPTION_SEND_TIMEOUT
  898. #define INTERNET_OPTION_RECEIVE_TIMEOUT 6
  899. #define INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT INTERNET_OPTION_RECEIVE_TIMEOUT
  900. #define INTERNET_OPTION_DATA_SEND_TIMEOUT 7
  901. #define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8
  902. #define INTERNET_OPTION_HANDLE_TYPE 9
  903. #define INTERNET_OPTION_LISTEN_TIMEOUT 11
  904. #define INTERNET_OPTION_READ_BUFFER_SIZE 12
  905. #define INTERNET_OPTION_WRITE_BUFFER_SIZE 13
  906. #define INTERNET_OPTION_ASYNC_ID 15
  907. #define INTERNET_OPTION_ASYNC_PRIORITY 16
  908. #define INTERNET_OPTION_PARENT_HANDLE 21
  909. #define INTERNET_OPTION_KEEP_CONNECTION 22
  910. #define INTERNET_OPTION_REQUEST_FLAGS 23
  911. #define INTERNET_OPTION_EXTENDED_ERROR 24
  912. #define INTERNET_OPTION_OFFLINE_MODE 26
  913. #define INTERNET_OPTION_CACHE_STREAM_HANDLE 27
  914. #define INTERNET_OPTION_USERNAME 28
  915. #define INTERNET_OPTION_PASSWORD 29
  916. #define INTERNET_OPTION_ASYNC 30
  917. #define INTERNET_OPTION_SECURITY_FLAGS 31
  918. #define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT 32
  919. #define INTERNET_OPTION_DATAFILE_NAME 33
  920. #define INTERNET_OPTION_URL 34
  921. #define INTERNET_OPTION_SECURITY_CERTIFICATE 35
  922. #define INTERNET_OPTION_SECURITY_KEY_BITNESS 36
  923. #define INTERNET_OPTION_REFRESH 37
  924. #define INTERNET_OPTION_PROXY 38
  925. #define INTERNET_OPTION_SETTINGS_CHANGED 39
  926. #define INTERNET_OPTION_VERSION 40
  927. #define INTERNET_OPTION_USER_AGENT 41
  928. #define INTERNET_OPTION_END_BROWSER_SESSION 42
  929. #define INTERNET_OPTION_PROXY_USERNAME 43
  930. #define INTERNET_OPTION_PROXY_PASSWORD 44
  931. #define INTERNET_OPTION_CONTEXT_VALUE 45
  932. #define INTERNET_OPTION_CONNECT_LIMIT 46
  933. #define INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT 47
  934. #define INTERNET_OPTION_POLICY 48
  935. #define INTERNET_OPTION_DISCONNECTED_TIMEOUT 49
  936. #define INTERNET_OPTION_CONNECTED_STATE 50
  937. #define INTERNET_OPTION_IDLE_STATE 51
  938. #define INTERNET_OPTION_OFFLINE_SEMANTICS 52
  939. #define INTERNET_OPTION_SECONDARY_CACHE_KEY 53
  940. #define INTERNET_OPTION_CALLBACK_FILTER 54
  941. #define INTERNET_OPTION_CONNECT_TIME 55
  942. #define INTERNET_OPTION_SEND_THROUGHPUT 56
  943. #define INTERNET_OPTION_RECEIVE_THROUGHPUT 57
  944. #define INTERNET_OPTION_REQUEST_PRIORITY 58
  945. #define INTERNET_OPTION_HTTP_VERSION 59
  946. #define INTERNET_OPTION_RESET_URLCACHE_SESSION 60
  947. #define INTERNET_OPTION_ERROR_MASK 62
  948. #define INTERNET_OPTION_FROM_CACHE_TIMEOUT 63
  949. #define INTERNET_OPTION_BYPASS_EDITED_ENTRY 64
  950. #define INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO 67
  951. #define INTERNET_OPTION_CODEPAGE 68
  952. #define INTERNET_OPTION_CACHE_TIMESTAMPS 69
  953. #define INTERNET_OPTION_DISABLE_AUTODIAL 70
  954. #define INTERNET_OPTION_MAX_CONNS_PER_SERVER 73
  955. #define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER 74
  956. #define INTERNET_OPTION_PER_CONNECTION_OPTION 75
  957. #define INTERNET_OPTION_DIGEST_AUTH_UNLOAD 76
  958. #define INTERNET_OPTION_IGNORE_OFFLINE 77
  959. #define INTERNET_OPTION_IDENTITY 78
  960. #define INTERNET_OPTION_REMOVE_IDENTITY 79
  961. #define INTERNET_OPTION_ALTER_IDENTITY 80
  962. #define INTERNET_OPTION_SUPPRESS_BEHAVIOR 81
  963. #define INTERNET_OPTION_AUTODIAL_MODE 82
  964. #define INTERNET_OPTION_AUTODIAL_CONNECTION 83
  965. #define INTERNET_OPTION_CLIENT_CERT_CONTEXT 84
  966. #define INTERNET_OPTION_AUTH_FLAGS 85
  967. #define INTERNET_OPTION_COOKIES_3RD_PARTY 86
  968. #define INTERNET_OPTION_DISABLE_PASSPORT_AUTH 87
  969. #define INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY 88
  970. #define INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT 89
  971. #define INTERNET_OPTION_ENABLE_PASSPORT_AUTH 90
  972. #define INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS 91
  973. #define INTERNET_OPTION_ACTIVATE_WORKER_THREADS 92
  974. #define INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS 93
  975. #define INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH 94
  976. #define INTERNET_OPTION_PROXY_SETTINGS_CHANGED 95
  977. #define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK
  978. #define INTERNET_LAST_OPTION INTERNET_OPTION_PROXY_SETTINGS_CHANGED
  979. //
  980. // values for INTERNET_OPTION_PRIORITY
  981. //
  982. #define INTERNET_PRIORITY_FOREGROUND 1000
  983. //
  984. // handle types
  985. //
  986. #define INTERNET_HANDLE_TYPE_INTERNET 1
  987. #define INTERNET_HANDLE_TYPE_CONNECT_FTP 2
  988. #define INTERNET_HANDLE_TYPE_CONNECT_GOPHER 3
  989. #define INTERNET_HANDLE_TYPE_CONNECT_HTTP 4
  990. #define INTERNET_HANDLE_TYPE_FTP_FIND 5
  991. #define INTERNET_HANDLE_TYPE_FTP_FIND_HTML 6
  992. #define INTERNET_HANDLE_TYPE_FTP_FILE 7
  993. #define INTERNET_HANDLE_TYPE_FTP_FILE_HTML 8
  994. #define INTERNET_HANDLE_TYPE_GOPHER_FIND 9
  995. #define INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML 10
  996. #define INTERNET_HANDLE_TYPE_GOPHER_FILE 11
  997. #define INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML 12
  998. #define INTERNET_HANDLE_TYPE_HTTP_REQUEST 13
  999. #define INTERNET_HANDLE_TYPE_FILE_REQUEST 14
  1000. //
  1001. // values for INTERNET_OPTION_AUTH_FLAGS
  1002. //
  1003. #define AUTH_FLAG_DISABLE_NEGOTIATE 0x00000001
  1004. #define AUTH_FLAG_ENABLE_NEGOTIATE 0x00000002
  1005. //
  1006. // values for INTERNET_OPTION_SECURITY_FLAGS
  1007. //
  1008. // query only
  1009. #define SECURITY_FLAG_SECURE 0x00000001 // can query only
  1010. #define SECURITY_FLAG_STRENGTH_WEAK 0x10000000
  1011. #define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000
  1012. #define SECURITY_FLAG_STRENGTH_STRONG 0x20000000
  1013. #define SECURITY_FLAG_UNKNOWNBIT 0x80000000
  1014. #define SECURITY_FLAG_FORTEZZA 0x08000000
  1015. #define SECURITY_FLAG_NORMALBITNESS SECURITY_FLAG_STRENGTH_WEAK
  1016. // The following are unused
  1017. #define SECURITY_FLAG_SSL 0x00000002
  1018. #define SECURITY_FLAG_SSL3 0x00000004
  1019. #define SECURITY_FLAG_PCT 0x00000008
  1020. #define SECURITY_FLAG_PCT4 0x00000010
  1021. #define SECURITY_FLAG_IETFSSL4 0x00000020
  1022. // The following are for backwards compatability only.
  1023. #define SECURITY_FLAG_40BIT SECURITY_FLAG_STRENGTH_WEAK
  1024. #define SECURITY_FLAG_128BIT SECURITY_FLAG_STRENGTH_STRONG
  1025. #define SECURITY_FLAG_56BIT SECURITY_FLAG_STRENGTH_MEDIUM
  1026. // setable flags
  1027. #define SECURITY_FLAG_IGNORE_REVOCATION 0x00000080
  1028. #define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100
  1029. #define SECURITY_FLAG_IGNORE_WRONG_USAGE 0x00000200
  1030. #define SECURITY_FLAG_IGNORE_CERT_CN_INVALID INTERNET_FLAG_IGNORE_CERT_CN_INVALID
  1031. #define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
  1032. #define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
  1033. #define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
  1034. #define SECURITY_SET_MASK (SECURITY_FLAG_IGNORE_REVOCATION |\
  1035. SECURITY_FLAG_IGNORE_UNKNOWN_CA |\
  1036. SECURITY_FLAG_IGNORE_CERT_CN_INVALID |\
  1037. SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |\
  1038. SECURITY_FLAG_IGNORE_WRONG_USAGE)
  1039. // valid autodial modes
  1040. #define AUTODIAL_MODE_NEVER 1
  1041. #define AUTODIAL_MODE_ALWAYS 2
  1042. #define AUTODIAL_MODE_NO_NETWORK_PRESENT 4
  1043. BOOLAPI InternetGetLastResponseInfoA(
  1044. OUT LPDWORD lpdwError,
  1045. OUT LPSTR lpszBuffer OPTIONAL,
  1046. IN OUT LPDWORD lpdwBufferLength
  1047. );
  1048. BOOLAPI InternetGetLastResponseInfoW(
  1049. OUT LPDWORD lpdwError,
  1050. OUT LPWSTR lpszBuffer OPTIONAL,
  1051. IN OUT LPDWORD lpdwBufferLength
  1052. );
  1053. #ifdef UNICODE
  1054. #define InternetGetLastResponseInfo InternetGetLastResponseInfoW
  1055. #else
  1056. #define InternetGetLastResponseInfo InternetGetLastResponseInfoA
  1057. #endif // !UNICODE
  1058. //
  1059. // callback function for InternetSetStatusCallback
  1060. //
  1061. typedef
  1062. VOID
  1063. (CALLBACK * INTERNET_STATUS_CALLBACK)(
  1064. IN HINTERNET hInternet,
  1065. IN DWORD_PTR dwContext,
  1066. IN DWORD dwInternetStatus,
  1067. IN LPVOID lpvStatusInformation OPTIONAL,
  1068. IN DWORD dwStatusInformationLength
  1069. );
  1070. typedef INTERNET_STATUS_CALLBACK * LPINTERNET_STATUS_CALLBACK;
  1071. INTERNETAPI_(INTERNET_STATUS_CALLBACK) InternetSetStatusCallbackA(
  1072. IN HINTERNET hInternet,
  1073. IN INTERNET_STATUS_CALLBACK lpfnInternetCallback
  1074. );
  1075. INTERNETAPI_(INTERNET_STATUS_CALLBACK) InternetSetStatusCallbackW(
  1076. IN HINTERNET hInternet,
  1077. IN INTERNET_STATUS_CALLBACK lpfnInternetCallback
  1078. );
  1079. #ifdef UNICODE
  1080. #define InternetSetStatusCallback InternetSetStatusCallbackW
  1081. #else
  1082. #ifdef _WINX32_
  1083. #define InternetSetStatusCallback InternetSetStatusCallbackA
  1084. #else
  1085. INTERNETAPI_(INTERNET_STATUS_CALLBACK) InternetSetStatusCallback(
  1086. IN HINTERNET hInternet,
  1087. IN INTERNET_STATUS_CALLBACK lpfnInternetCallback
  1088. );
  1089. #endif // _WINX32_
  1090. #endif // !UNICODE
  1091. //
  1092. // status manifests for Internet status callback
  1093. //
  1094. #define INTERNET_STATUS_RESOLVING_NAME 10
  1095. #define INTERNET_STATUS_NAME_RESOLVED 11
  1096. #define INTERNET_STATUS_CONNECTING_TO_SERVER 20
  1097. #define INTERNET_STATUS_CONNECTED_TO_SERVER 21
  1098. #define INTERNET_STATUS_SENDING_REQUEST 30
  1099. #define INTERNET_STATUS_REQUEST_SENT 31
  1100. #define INTERNET_STATUS_RECEIVING_RESPONSE 40
  1101. #define INTERNET_STATUS_RESPONSE_RECEIVED 41
  1102. #define INTERNET_STATUS_CTL_RESPONSE_RECEIVED 42
  1103. #define INTERNET_STATUS_PREFETCH 43
  1104. #define INTERNET_STATUS_CLOSING_CONNECTION 50
  1105. #define INTERNET_STATUS_CONNECTION_CLOSED 51
  1106. #define INTERNET_STATUS_HANDLE_CREATED 60
  1107. #define INTERNET_STATUS_HANDLE_CLOSING 70
  1108. #define INTERNET_STATUS_DETECTING_PROXY 80
  1109. #define INTERNET_STATUS_REQUEST_COMPLETE 100
  1110. #define INTERNET_STATUS_REDIRECT 110
  1111. #define INTERNET_STATUS_INTERMEDIATE_RESPONSE 120
  1112. #define INTERNET_STATUS_USER_INPUT_REQUIRED 140
  1113. #define INTERNET_STATUS_STATE_CHANGE 200
  1114. #define INTERNET_STATUS_COOKIE_SENT 320
  1115. #define INTERNET_STATUS_COOKIE_RECEIVED 321
  1116. #define INTERNET_STATUS_PRIVACY_IMPACTED 324
  1117. #define INTERNET_STATUS_P3P_HEADER 325
  1118. #define INTERNET_STATUS_P3P_POLICYREF 326
  1119. #define INTERNET_STATUS_COOKIE_HISTORY 327
  1120. //
  1121. // the following can be indicated in a state change notification:
  1122. //
  1123. #define INTERNET_STATE_CONNECTED 0x00000001 // connected state (mutually exclusive with disconnected)
  1124. #define INTERNET_STATE_DISCONNECTED 0x00000002 // disconnected from network
  1125. #define INTERNET_STATE_DISCONNECTED_BY_USER 0x00000010 // disconnected by user request
  1126. #define INTERNET_STATE_IDLE 0x00000100 // no network requests being made (by Wininet)
  1127. #define INTERNET_STATE_BUSY 0x00000200 // network requests being made (by Wininet)
  1128. //
  1129. // the following values are used for cookie state:
  1130. //
  1131. typedef enum {
  1132. COOKIE_STATE_UNKNOWN = 0x0,
  1133. COOKIE_STATE_ACCEPT = 0x1,
  1134. COOKIE_STATE_PROMPT = 0x2,
  1135. COOKIE_STATE_LEASH = 0x3,
  1136. COOKIE_STATE_DOWNGRADE = 0x4,
  1137. COOKIE_STATE_REJECT = 0x5,
  1138. COOKIE_STATE_MAX = COOKIE_STATE_REJECT,
  1139. }
  1140. InternetCookieState;
  1141. typedef struct {
  1142. int cSession; // Session cookies received
  1143. int cPersistent; // Persistent cookies received
  1144. int cAccepted; // Number of cookies accepted
  1145. int cLeashed; // ... leashed
  1146. int cDowngraded; // ... converted to session-cookies
  1147. int cBlocked; // ... rejected
  1148. const char *pszLocation; // Optional: URL associated with reported cookie events
  1149. // This can be used to override request URL
  1150. }
  1151. IncomingCookieState;
  1152. typedef struct {
  1153. int cSent;
  1154. int cSuppressed;
  1155. const char *pszLocation; // Optional: URL associated with reported cookie events
  1156. // This can be used to override request URL
  1157. }
  1158. OutgoingCookieState;
  1159. typedef struct {
  1160. BOOL fAccepted;
  1161. BOOL fLeashed;
  1162. BOOL fDowngraded;
  1163. BOOL fRejected;
  1164. }
  1165. InternetCookieHistory;
  1166. typedef struct {
  1167. DWORD dwCookieState;
  1168. BOOL fAllowSession;
  1169. }
  1170. CookieDecision;
  1171. //
  1172. // if the following value is returned by InternetSetStatusCallback, then
  1173. // probably an invalid (non-code) address was supplied for the callback
  1174. //
  1175. #define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L))
  1176. //
  1177. // FTP
  1178. //
  1179. //
  1180. // manifests
  1181. //
  1182. #define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000
  1183. #define FTP_TRANSFER_TYPE_ASCII 0x00000001
  1184. #define FTP_TRANSFER_TYPE_BINARY 0x00000002
  1185. #define FTP_TRANSFER_TYPE_MASK (FTP_TRANSFER_TYPE_ASCII | FTP_TRANSFER_TYPE_BINARY)
  1186. //
  1187. // prototypes
  1188. //
  1189. INTERNETAPI_(HINTERNET) FtpFindFirstFileA(
  1190. IN HINTERNET hConnect,
  1191. IN LPCSTR lpszSearchFile OPTIONAL,
  1192. OUT LPWIN32_FIND_DATAA lpFindFileData OPTIONAL,
  1193. IN DWORD dwFlags,
  1194. IN DWORD_PTR dwContext
  1195. );
  1196. INTERNETAPI_(HINTERNET) FtpFindFirstFileW(
  1197. IN HINTERNET hConnect,
  1198. IN LPCWSTR lpszSearchFile OPTIONAL,
  1199. OUT LPWIN32_FIND_DATAW lpFindFileData OPTIONAL,
  1200. IN DWORD dwFlags,
  1201. IN DWORD_PTR dwContext
  1202. );
  1203. #ifdef UNICODE
  1204. #define FtpFindFirstFile FtpFindFirstFileW
  1205. #else
  1206. #define FtpFindFirstFile FtpFindFirstFileA
  1207. #endif // !UNICODE
  1208. BOOLAPI FtpGetFileA(
  1209. IN HINTERNET hConnect,
  1210. IN LPCSTR lpszRemoteFile,
  1211. IN LPCSTR lpszNewFile,
  1212. IN BOOL fFailIfExists,
  1213. IN DWORD dwFlagsAndAttributes,
  1214. IN DWORD dwFlags,
  1215. IN DWORD_PTR dwContext
  1216. );
  1217. BOOLAPI FtpGetFileW(
  1218. IN HINTERNET hConnect,
  1219. IN LPCWSTR lpszRemoteFile,
  1220. IN LPCWSTR lpszNewFile,
  1221. IN BOOL fFailIfExists,
  1222. IN DWORD dwFlagsAndAttributes,
  1223. IN DWORD dwFlags,
  1224. IN DWORD_PTR dwContext
  1225. );
  1226. #ifdef UNICODE
  1227. #define FtpGetFile FtpGetFileW
  1228. #else
  1229. #define FtpGetFile FtpGetFileA
  1230. #endif // !UNICODE
  1231. BOOLAPI FtpPutFileA(
  1232. IN HINTERNET hConnect,
  1233. IN LPCSTR lpszLocalFile,
  1234. IN LPCSTR lpszNewRemoteFile,
  1235. IN DWORD dwFlags,
  1236. IN DWORD_PTR dwContext
  1237. );
  1238. BOOLAPI FtpPutFileW(
  1239. IN HINTERNET hConnect,
  1240. IN LPCWSTR lpszLocalFile,
  1241. IN LPCWSTR lpszNewRemoteFile,
  1242. IN DWORD dwFlags,
  1243. IN DWORD_PTR dwContext
  1244. );
  1245. #ifdef UNICODE
  1246. #define FtpPutFile FtpPutFileW
  1247. #else
  1248. #define FtpPutFile FtpPutFileA
  1249. #endif // !UNICODE
  1250. BOOLAPI FtpGetFileEx(
  1251. IN HINTERNET hFtpSession,
  1252. IN LPCSTR lpszRemoteFile,
  1253. IN LPCWSTR lpszNewFile,
  1254. IN BOOL fFailIfExists,
  1255. IN DWORD dwFlagsAndAttributes,
  1256. IN DWORD dwFlags,
  1257. IN DWORD_PTR dwContext
  1258. );
  1259. BOOLAPI FtpPutFileEx(
  1260. IN HINTERNET hFtpSession,
  1261. IN LPCWSTR lpszLocalFile,
  1262. IN LPCSTR lpszNewRemoteFile,
  1263. IN DWORD dwFlags,
  1264. IN DWORD_PTR dwContext
  1265. );
  1266. BOOLAPI FtpDeleteFileA(
  1267. IN HINTERNET hConnect,
  1268. IN LPCSTR lpszFileName
  1269. );
  1270. BOOLAPI FtpDeleteFileW(
  1271. IN HINTERNET hConnect,
  1272. IN LPCWSTR lpszFileName
  1273. );
  1274. #ifdef UNICODE
  1275. #define FtpDeleteFile FtpDeleteFileW
  1276. #else
  1277. #define FtpDeleteFile FtpDeleteFileA
  1278. #endif // !UNICODE
  1279. BOOLAPI FtpRenameFileA(
  1280. IN HINTERNET hConnect,
  1281. IN LPCSTR lpszExisting,
  1282. IN LPCSTR lpszNew
  1283. );
  1284. BOOLAPI FtpRenameFileW(
  1285. IN HINTERNET hConnect,
  1286. IN LPCWSTR lpszExisting,
  1287. IN LPCWSTR lpszNew
  1288. );
  1289. #ifdef UNICODE
  1290. #define FtpRenameFile FtpRenameFileW
  1291. #else
  1292. #define FtpRenameFile FtpRenameFileA
  1293. #endif // !UNICODE
  1294. INTERNETAPI_(HINTERNET) FtpOpenFileA(
  1295. IN HINTERNET hConnect,
  1296. IN LPCSTR lpszFileName,
  1297. IN DWORD dwAccess,
  1298. IN DWORD dwFlags,
  1299. IN DWORD_PTR dwContext
  1300. );
  1301. INTERNETAPI_(HINTERNET) FtpOpenFileW(
  1302. IN HINTERNET hConnect,
  1303. IN LPCWSTR lpszFileName,
  1304. IN DWORD dwAccess,
  1305. IN DWORD dwFlags,
  1306. IN DWORD_PTR dwContext
  1307. );
  1308. #ifdef UNICODE
  1309. #define FtpOpenFile FtpOpenFileW
  1310. #else
  1311. #define FtpOpenFile FtpOpenFileA
  1312. #endif // !UNICODE
  1313. BOOLAPI FtpCreateDirectoryA(
  1314. IN HINTERNET hConnect,
  1315. IN LPCSTR lpszDirectory
  1316. );
  1317. BOOLAPI FtpCreateDirectoryW(
  1318. IN HINTERNET hConnect,
  1319. IN LPCWSTR lpszDirectory
  1320. );
  1321. #ifdef UNICODE
  1322. #define FtpCreateDirectory FtpCreateDirectoryW
  1323. #else
  1324. #define FtpCreateDirectory FtpCreateDirectoryA
  1325. #endif // !UNICODE
  1326. BOOLAPI FtpRemoveDirectoryA(
  1327. IN HINTERNET hConnect,
  1328. IN LPCSTR lpszDirectory
  1329. );
  1330. BOOLAPI FtpRemoveDirectoryW(
  1331. IN HINTERNET hConnect,
  1332. IN LPCWSTR lpszDirectory
  1333. );
  1334. #ifdef UNICODE
  1335. #define FtpRemoveDirectory FtpRemoveDirectoryW
  1336. #else
  1337. #define FtpRemoveDirectory FtpRemoveDirectoryA
  1338. #endif // !UNICODE
  1339. BOOLAPI FtpSetCurrentDirectoryA(
  1340. IN HINTERNET hConnect,
  1341. IN LPCSTR lpszDirectory
  1342. );
  1343. BOOLAPI FtpSetCurrentDirectoryW(
  1344. IN HINTERNET hConnect,
  1345. IN LPCWSTR lpszDirectory
  1346. );
  1347. #ifdef UNICODE
  1348. #define FtpSetCurrentDirectory FtpSetCurrentDirectoryW
  1349. #else
  1350. #define FtpSetCurrentDirectory FtpSetCurrentDirectoryA
  1351. #endif // !UNICODE
  1352. BOOLAPI FtpGetCurrentDirectoryA(
  1353. IN HINTERNET hConnect,
  1354. OUT LPSTR lpszCurrentDirectory,
  1355. IN OUT LPDWORD lpdwCurrentDirectory
  1356. );
  1357. BOOLAPI FtpGetCurrentDirectoryW(
  1358. IN HINTERNET hConnect,
  1359. OUT LPWSTR lpszCurrentDirectory,
  1360. IN OUT LPDWORD lpdwCurrentDirectory
  1361. );
  1362. #ifdef UNICODE
  1363. #define FtpGetCurrentDirectory FtpGetCurrentDirectoryW
  1364. #else
  1365. #define FtpGetCurrentDirectory FtpGetCurrentDirectoryA
  1366. #endif // !UNICODE
  1367. BOOLAPI FtpCommandA(
  1368. IN HINTERNET hConnect,
  1369. IN BOOL fExpectResponse,
  1370. IN DWORD dwFlags,
  1371. IN LPCSTR lpszCommand,
  1372. IN DWORD_PTR dwContext,
  1373. OUT HINTERNET *phFtpCommand OPTIONAL
  1374. );
  1375. BOOLAPI FtpCommandW(
  1376. IN HINTERNET hConnect,
  1377. IN BOOL fExpectResponse,
  1378. IN DWORD dwFlags,
  1379. IN LPCWSTR lpszCommand,
  1380. IN DWORD_PTR dwContext,
  1381. OUT HINTERNET *phFtpCommand OPTIONAL
  1382. );
  1383. #ifdef UNICODE
  1384. #define FtpCommand FtpCommandW
  1385. #else
  1386. #define FtpCommand FtpCommandA
  1387. #endif // !UNICODE
  1388. INTERNETAPI_(DWORD) FtpGetFileSize(
  1389. IN HINTERNET hFile,
  1390. OUT LPDWORD lpdwFileSizeHigh OPTIONAL
  1391. );
  1392. //
  1393. // Gopher
  1394. //
  1395. //
  1396. // manifests
  1397. //
  1398. //
  1399. // string field lengths (in characters, not bytes)
  1400. //
  1401. #define MAX_GOPHER_DISPLAY_TEXT 128
  1402. #define MAX_GOPHER_SELECTOR_TEXT 256
  1403. #define MAX_GOPHER_HOST_NAME INTERNET_MAX_HOST_NAME_LENGTH
  1404. #define MAX_GOPHER_LOCATOR_LENGTH (1 \
  1405. + MAX_GOPHER_DISPLAY_TEXT \
  1406. + 1 \
  1407. + MAX_GOPHER_SELECTOR_TEXT \
  1408. + 1 \
  1409. + MAX_GOPHER_HOST_NAME \
  1410. + 1 \
  1411. + INTERNET_MAX_PORT_NUMBER_LENGTH \
  1412. + 1 \
  1413. + 1 \
  1414. + 2 \
  1415. )
  1416. //
  1417. // structures/types
  1418. //
  1419. //
  1420. // GOPHER_FIND_DATA - returns the results of a GopherFindFirstFile()/
  1421. // InternetFindNextFile() request
  1422. //
  1423. typedef struct {
  1424. CHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1];
  1425. DWORD GopherType; // GOPHER_TYPE_, if known
  1426. DWORD SizeLow;
  1427. DWORD SizeHigh;
  1428. FILETIME LastModificationTime;
  1429. CHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1];
  1430. } GOPHER_FIND_DATAA, * LPGOPHER_FIND_DATAA;
  1431. typedef struct {
  1432. WCHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1];
  1433. DWORD GopherType; // GOPHER_TYPE_, if known
  1434. DWORD SizeLow;
  1435. DWORD SizeHigh;
  1436. FILETIME LastModificationTime;
  1437. WCHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1];
  1438. } GOPHER_FIND_DATAW, * LPGOPHER_FIND_DATAW;
  1439. #ifdef UNICODE
  1440. typedef GOPHER_FIND_DATAW GOPHER_FIND_DATA;
  1441. typedef LPGOPHER_FIND_DATAW LPGOPHER_FIND_DATA;
  1442. #else
  1443. typedef GOPHER_FIND_DATAA GOPHER_FIND_DATA;
  1444. typedef LPGOPHER_FIND_DATAA LPGOPHER_FIND_DATA;
  1445. #endif // UNICODE
  1446. //
  1447. // manifests for GopherType
  1448. //
  1449. #define GOPHER_TYPE_TEXT_FILE 0x00000001
  1450. #define GOPHER_TYPE_DIRECTORY 0x00000002
  1451. #define GOPHER_TYPE_CSO 0x00000004
  1452. #define GOPHER_TYPE_ERROR 0x00000008
  1453. #define GOPHER_TYPE_MAC_BINHEX 0x00000010
  1454. #define GOPHER_TYPE_DOS_ARCHIVE 0x00000020
  1455. #define GOPHER_TYPE_UNIX_UUENCODED 0x00000040
  1456. #define GOPHER_TYPE_INDEX_SERVER 0x00000080
  1457. #define GOPHER_TYPE_TELNET 0x00000100
  1458. #define GOPHER_TYPE_BINARY 0x00000200
  1459. #define GOPHER_TYPE_REDUNDANT 0x00000400
  1460. #define GOPHER_TYPE_TN3270 0x00000800
  1461. #define GOPHER_TYPE_GIF 0x00001000
  1462. #define GOPHER_TYPE_IMAGE 0x00002000
  1463. #define GOPHER_TYPE_BITMAP 0x00004000
  1464. #define GOPHER_TYPE_MOVIE 0x00008000
  1465. #define GOPHER_TYPE_SOUND 0x00010000
  1466. #define GOPHER_TYPE_HTML 0x00020000
  1467. #define GOPHER_TYPE_PDF 0x00040000
  1468. #define GOPHER_TYPE_CALENDAR 0x00080000
  1469. #define GOPHER_TYPE_INLINE 0x00100000
  1470. #define GOPHER_TYPE_UNKNOWN 0x20000000
  1471. #define GOPHER_TYPE_ASK 0x40000000
  1472. #define GOPHER_TYPE_GOPHER_PLUS 0x80000000
  1473. //
  1474. // gopher type macros
  1475. //
  1476. #define IS_GOPHER_FILE(type) (BOOL)(((type) & GOPHER_TYPE_FILE_MASK) ? TRUE : FALSE)
  1477. #define IS_GOPHER_DIRECTORY(type) (BOOL)(((type) & GOPHER_TYPE_DIRECTORY) ? TRUE : FALSE)
  1478. #define IS_GOPHER_PHONE_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_CSO) ? TRUE : FALSE)
  1479. #define IS_GOPHER_ERROR(type) (BOOL)(((type) & GOPHER_TYPE_ERROR) ? TRUE : FALSE)
  1480. #define IS_GOPHER_INDEX_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_INDEX_SERVER) ? TRUE : FALSE)
  1481. #define IS_GOPHER_TELNET_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TELNET) ? TRUE : FALSE)
  1482. #define IS_GOPHER_BACKUP_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_REDUNDANT) ? TRUE : FALSE)
  1483. #define IS_GOPHER_TN3270_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TN3270) ? TRUE : FALSE)
  1484. #define IS_GOPHER_ASK(type) (BOOL)(((type) & GOPHER_TYPE_ASK) ? TRUE : FALSE)
  1485. #define IS_GOPHER_PLUS(type) (BOOL)(((type) & GOPHER_TYPE_GOPHER_PLUS) ? TRUE : FALSE)
  1486. #define IS_GOPHER_TYPE_KNOWN(type) (BOOL)(((type) & GOPHER_TYPE_UNKNOWN) ? FALSE : TRUE)
  1487. //
  1488. // GOPHER_TYPE_FILE_MASK - use this to determine if a locator identifies a
  1489. // (known) file type
  1490. //
  1491. #define GOPHER_TYPE_FILE_MASK (GOPHER_TYPE_TEXT_FILE \
  1492. | GOPHER_TYPE_MAC_BINHEX \
  1493. | GOPHER_TYPE_DOS_ARCHIVE \
  1494. | GOPHER_TYPE_UNIX_UUENCODED \
  1495. | GOPHER_TYPE_BINARY \
  1496. | GOPHER_TYPE_GIF \
  1497. | GOPHER_TYPE_IMAGE \
  1498. | GOPHER_TYPE_BITMAP \
  1499. | GOPHER_TYPE_MOVIE \
  1500. | GOPHER_TYPE_SOUND \
  1501. | GOPHER_TYPE_HTML \
  1502. | GOPHER_TYPE_PDF \
  1503. | GOPHER_TYPE_CALENDAR \
  1504. | GOPHER_TYPE_INLINE \
  1505. )
  1506. //
  1507. // structured gopher attributes (as defined in gopher+ protocol document)
  1508. //
  1509. typedef struct {
  1510. LPCTSTR Comment;
  1511. LPCTSTR EmailAddress;
  1512. } GOPHER_ADMIN_ATTRIBUTE_TYPE, * LPGOPHER_ADMIN_ATTRIBUTE_TYPE;
  1513. typedef struct {
  1514. FILETIME DateAndTime;
  1515. } GOPHER_MOD_DATE_ATTRIBUTE_TYPE, * LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE;
  1516. typedef struct {
  1517. DWORD Ttl;
  1518. } GOPHER_TTL_ATTRIBUTE_TYPE, * LPGOPHER_TTL_ATTRIBUTE_TYPE;
  1519. typedef struct {
  1520. INT Score;
  1521. } GOPHER_SCORE_ATTRIBUTE_TYPE, * LPGOPHER_SCORE_ATTRIBUTE_TYPE;
  1522. typedef struct {
  1523. INT LowerBound;
  1524. INT UpperBound;
  1525. } GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE, * LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE;
  1526. typedef struct {
  1527. LPCTSTR Site;
  1528. } GOPHER_SITE_ATTRIBUTE_TYPE, * LPGOPHER_SITE_ATTRIBUTE_TYPE;
  1529. typedef struct {
  1530. LPCTSTR Organization;
  1531. } GOPHER_ORGANIZATION_ATTRIBUTE_TYPE, * LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE;
  1532. typedef struct {
  1533. LPCTSTR Location;
  1534. } GOPHER_LOCATION_ATTRIBUTE_TYPE, * LPGOPHER_LOCATION_ATTRIBUTE_TYPE;
  1535. typedef struct {
  1536. INT DegreesNorth;
  1537. INT MinutesNorth;
  1538. INT SecondsNorth;
  1539. INT DegreesEast;
  1540. INT MinutesEast;
  1541. INT SecondsEast;
  1542. } GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE, * LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE;
  1543. typedef struct {
  1544. INT Zone;
  1545. } GOPHER_TIMEZONE_ATTRIBUTE_TYPE, * LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE;
  1546. typedef struct {
  1547. LPCTSTR Provider;
  1548. } GOPHER_PROVIDER_ATTRIBUTE_TYPE, * LPGOPHER_PROVIDER_ATTRIBUTE_TYPE;
  1549. typedef struct {
  1550. LPCTSTR Version;
  1551. } GOPHER_VERSION_ATTRIBUTE_TYPE, * LPGOPHER_VERSION_ATTRIBUTE_TYPE;
  1552. typedef struct {
  1553. LPCTSTR ShortAbstract;
  1554. LPCTSTR AbstractFile;
  1555. } GOPHER_ABSTRACT_ATTRIBUTE_TYPE, * LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE;
  1556. typedef struct {
  1557. LPCTSTR ContentType;
  1558. LPCTSTR Language;
  1559. DWORD Size;
  1560. } GOPHER_VIEW_ATTRIBUTE_TYPE, * LPGOPHER_VIEW_ATTRIBUTE_TYPE;
  1561. typedef struct {
  1562. BOOL TreeWalk;
  1563. } GOPHER_VERONICA_ATTRIBUTE_TYPE, * LPGOPHER_VERONICA_ATTRIBUTE_TYPE;
  1564. typedef struct {
  1565. LPCTSTR QuestionType;
  1566. LPCTSTR QuestionText;
  1567. } GOPHER_ASK_ATTRIBUTE_TYPE, * LPGOPHER_ASK_ATTRIBUTE_TYPE;
  1568. //
  1569. // GOPHER_UNKNOWN_ATTRIBUTE_TYPE - this is returned if we retrieve an attribute
  1570. // that is not specified in the current gopher/gopher+ documentation. It is up
  1571. // to the application to parse the information
  1572. //
  1573. typedef struct {
  1574. LPCTSTR Text;
  1575. } GOPHER_UNKNOWN_ATTRIBUTE_TYPE, * LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE;
  1576. //
  1577. // GOPHER_ATTRIBUTE_TYPE - returned in the user's buffer when an enumerated
  1578. // GopherGetAttribute call is made
  1579. //
  1580. typedef struct {
  1581. DWORD CategoryId; // e.g. GOPHER_CATEGORY_ID_ADMIN
  1582. DWORD AttributeId; // e.g. GOPHER_ATTRIBUTE_ID_ADMIN
  1583. union {
  1584. GOPHER_ADMIN_ATTRIBUTE_TYPE Admin;
  1585. GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate;
  1586. GOPHER_TTL_ATTRIBUTE_TYPE Ttl;
  1587. GOPHER_SCORE_ATTRIBUTE_TYPE Score;
  1588. GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange;
  1589. GOPHER_SITE_ATTRIBUTE_TYPE Site;
  1590. GOPHER_ORGANIZATION_ATTRIBUTE_TYPE Organization;
  1591. GOPHER_LOCATION_ATTRIBUTE_TYPE Location;
  1592. GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation;
  1593. GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone;
  1594. GOPHER_PROVIDER_ATTRIBUTE_TYPE Provider;
  1595. GOPHER_VERSION_ATTRIBUTE_TYPE Version;
  1596. GOPHER_ABSTRACT_ATTRIBUTE_TYPE Abstract;
  1597. GOPHER_VIEW_ATTRIBUTE_TYPE View;
  1598. GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica;
  1599. GOPHER_ASK_ATTRIBUTE_TYPE Ask;
  1600. GOPHER_UNKNOWN_ATTRIBUTE_TYPE Unknown;
  1601. } AttributeType;
  1602. } GOPHER_ATTRIBUTE_TYPE, * LPGOPHER_ATTRIBUTE_TYPE;
  1603. #define MAX_GOPHER_CATEGORY_NAME 128 // arbitrary
  1604. #define MAX_GOPHER_ATTRIBUTE_NAME 128 // "
  1605. #define MIN_GOPHER_ATTRIBUTE_LENGTH 256 // "
  1606. //
  1607. // known gopher attribute categories. See below for ordinals
  1608. //
  1609. #define GOPHER_INFO_CATEGORY TEXT("+INFO")
  1610. #define GOPHER_ADMIN_CATEGORY TEXT("+ADMIN")
  1611. #define GOPHER_VIEWS_CATEGORY TEXT("+VIEWS")
  1612. #define GOPHER_ABSTRACT_CATEGORY TEXT("+ABSTRACT")
  1613. #define GOPHER_VERONICA_CATEGORY TEXT("+VERONICA")
  1614. //
  1615. // known gopher attributes. These are the attribute names as defined in the
  1616. // gopher+ protocol document
  1617. //
  1618. #define GOPHER_ADMIN_ATTRIBUTE TEXT("Admin")
  1619. #define GOPHER_MOD_DATE_ATTRIBUTE TEXT("Mod-Date")
  1620. #define GOPHER_TTL_ATTRIBUTE TEXT("TTL")
  1621. #define GOPHER_SCORE_ATTRIBUTE TEXT("Score")
  1622. #define GOPHER_RANGE_ATTRIBUTE TEXT("Score-range")
  1623. #define GOPHER_SITE_ATTRIBUTE TEXT("Site")
  1624. #define GOPHER_ORG_ATTRIBUTE TEXT("Org")
  1625. #define GOPHER_LOCATION_ATTRIBUTE TEXT("Loc")
  1626. #define GOPHER_GEOG_ATTRIBUTE TEXT("Geog")
  1627. #define GOPHER_TIMEZONE_ATTRIBUTE TEXT("TZ")
  1628. #define GOPHER_PROVIDER_ATTRIBUTE TEXT("Provider")
  1629. #define GOPHER_VERSION_ATTRIBUTE TEXT("Version")
  1630. #define GOPHER_ABSTRACT_ATTRIBUTE TEXT("Abstract")
  1631. #define GOPHER_VIEW_ATTRIBUTE TEXT("View")
  1632. #define GOPHER_TREEWALK_ATTRIBUTE TEXT("treewalk")
  1633. //
  1634. // identifiers for attribute strings
  1635. //
  1636. #define GOPHER_ATTRIBUTE_ID_BASE 0xabcccc00
  1637. #define GOPHER_CATEGORY_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 1)
  1638. #define GOPHER_CATEGORY_ID_INFO (GOPHER_ATTRIBUTE_ID_BASE + 2)
  1639. #define GOPHER_CATEGORY_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 3)
  1640. #define GOPHER_CATEGORY_ID_VIEWS (GOPHER_ATTRIBUTE_ID_BASE + 4)
  1641. #define GOPHER_CATEGORY_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 5)
  1642. #define GOPHER_CATEGORY_ID_VERONICA (GOPHER_ATTRIBUTE_ID_BASE + 6)
  1643. #define GOPHER_CATEGORY_ID_ASK (GOPHER_ATTRIBUTE_ID_BASE + 7)
  1644. #define GOPHER_CATEGORY_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 8)
  1645. #define GOPHER_ATTRIBUTE_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 9)
  1646. #define GOPHER_ATTRIBUTE_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 10)
  1647. #define GOPHER_ATTRIBUTE_ID_MOD_DATE (GOPHER_ATTRIBUTE_ID_BASE + 11)
  1648. #define GOPHER_ATTRIBUTE_ID_TTL (GOPHER_ATTRIBUTE_ID_BASE + 12)
  1649. #define GOPHER_ATTRIBUTE_ID_SCORE (GOPHER_ATTRIBUTE_ID_BASE + 13)
  1650. #define GOPHER_ATTRIBUTE_ID_RANGE (GOPHER_ATTRIBUTE_ID_BASE + 14)
  1651. #define GOPHER_ATTRIBUTE_ID_SITE (GOPHER_ATTRIBUTE_ID_BASE + 15)
  1652. #define GOPHER_ATTRIBUTE_ID_ORG (GOPHER_ATTRIBUTE_ID_BASE + 16)
  1653. #define GOPHER_ATTRIBUTE_ID_LOCATION (GOPHER_ATTRIBUTE_ID_BASE + 17)
  1654. #define GOPHER_ATTRIBUTE_ID_GEOG (GOPHER_ATTRIBUTE_ID_BASE + 18)
  1655. #define GOPHER_ATTRIBUTE_ID_TIMEZONE (GOPHER_ATTRIBUTE_ID_BASE + 19)
  1656. #define GOPHER_ATTRIBUTE_ID_PROVIDER (GOPHER_ATTRIBUTE_ID_BASE + 20)
  1657. #define GOPHER_ATTRIBUTE_ID_VERSION (GOPHER_ATTRIBUTE_ID_BASE + 21)
  1658. #define GOPHER_ATTRIBUTE_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 22)
  1659. #define GOPHER_ATTRIBUTE_ID_VIEW (GOPHER_ATTRIBUTE_ID_BASE + 23)
  1660. #define GOPHER_ATTRIBUTE_ID_TREEWALK (GOPHER_ATTRIBUTE_ID_BASE + 24)
  1661. #define GOPHER_ATTRIBUTE_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 25)
  1662. //
  1663. // prototypes
  1664. //
  1665. BOOLAPI GopherCreateLocatorA(
  1666. IN LPCSTR lpszHost,
  1667. IN INTERNET_PORT nServerPort,
  1668. IN LPCSTR lpszDisplayString OPTIONAL,
  1669. IN LPCSTR lpszSelectorString OPTIONAL,
  1670. IN DWORD dwGopherType,
  1671. OUT LPSTR lpszLocator OPTIONAL,
  1672. IN OUT LPDWORD lpdwBufferLength
  1673. );
  1674. BOOLAPI GopherCreateLocatorW(
  1675. IN LPCWSTR lpszHost,
  1676. IN INTERNET_PORT nServerPort,
  1677. IN LPCWSTR lpszDisplayString OPTIONAL,
  1678. IN LPCWSTR lpszSelectorString OPTIONAL,
  1679. IN DWORD dwGopherType,
  1680. OUT LPWSTR lpszLocator OPTIONAL,
  1681. IN OUT LPDWORD lpdwBufferLength
  1682. );
  1683. #ifdef UNICODE
  1684. #define GopherCreateLocator GopherCreateLocatorW
  1685. #else
  1686. #define GopherCreateLocator GopherCreateLocatorA
  1687. #endif // !UNICODE
  1688. BOOLAPI GopherGetLocatorTypeA(
  1689. IN LPCSTR lpszLocator,
  1690. OUT LPDWORD lpdwGopherType
  1691. );
  1692. BOOLAPI GopherGetLocatorTypeW(
  1693. IN LPCWSTR lpszLocator,
  1694. OUT LPDWORD lpdwGopherType
  1695. );
  1696. #ifdef UNICODE
  1697. #define GopherGetLocatorType GopherGetLocatorTypeW
  1698. #else
  1699. #define GopherGetLocatorType GopherGetLocatorTypeA
  1700. #endif // !UNICODE
  1701. INTERNETAPI_(HINTERNET) GopherFindFirstFileA(
  1702. IN HINTERNET hConnect,
  1703. IN LPCSTR lpszLocator OPTIONAL,
  1704. IN LPCSTR lpszSearchString OPTIONAL,
  1705. OUT LPGOPHER_FIND_DATAA lpFindData OPTIONAL,
  1706. IN DWORD dwFlags,
  1707. IN DWORD_PTR dwContext
  1708. );
  1709. INTERNETAPI_(HINTERNET) GopherFindFirstFileW(
  1710. IN HINTERNET hConnect,
  1711. IN LPCWSTR lpszLocator OPTIONAL,
  1712. IN LPCWSTR lpszSearchString OPTIONAL,
  1713. OUT LPGOPHER_FIND_DATAW lpFindData OPTIONAL,
  1714. IN DWORD dwFlags,
  1715. IN DWORD_PTR dwContext
  1716. );
  1717. #ifdef UNICODE
  1718. #define GopherFindFirstFile GopherFindFirstFileW
  1719. #else
  1720. #define GopherFindFirstFile GopherFindFirstFileA
  1721. #endif // !UNICODE
  1722. INTERNETAPI_(HINTERNET) GopherOpenFileA(
  1723. IN HINTERNET hConnect,
  1724. IN LPCSTR lpszLocator,
  1725. IN LPCSTR lpszView OPTIONAL,
  1726. IN DWORD dwFlags,
  1727. IN DWORD_PTR dwContext
  1728. );
  1729. INTERNETAPI_(HINTERNET) GopherOpenFileW(
  1730. IN HINTERNET hConnect,
  1731. IN LPCWSTR lpszLocator,
  1732. IN LPCWSTR lpszView OPTIONAL,
  1733. IN DWORD dwFlags,
  1734. IN DWORD_PTR dwContext
  1735. );
  1736. #ifdef UNICODE
  1737. #define GopherOpenFile GopherOpenFileW
  1738. #else
  1739. #define GopherOpenFile GopherOpenFileA
  1740. #endif // !UNICODE
  1741. typedef BOOL (CALLBACK * GOPHER_ATTRIBUTE_ENUMERATOR)(
  1742. LPGOPHER_ATTRIBUTE_TYPE lpAttributeInfo,
  1743. DWORD dwError
  1744. );
  1745. BOOLAPI GopherGetAttributeA(
  1746. IN HINTERNET hConnect,
  1747. IN LPCSTR lpszLocator,
  1748. IN LPCSTR lpszAttributeName OPTIONAL,
  1749. OUT LPBYTE lpBuffer,
  1750. IN DWORD dwBufferLength,
  1751. OUT LPDWORD lpdwCharactersReturned,
  1752. IN GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator OPTIONAL,
  1753. IN DWORD_PTR dwContext
  1754. );
  1755. BOOLAPI GopherGetAttributeW(
  1756. IN HINTERNET hConnect,
  1757. IN LPCWSTR lpszLocator,
  1758. IN LPCWSTR lpszAttributeName OPTIONAL,
  1759. OUT LPBYTE lpBuffer,
  1760. IN DWORD dwBufferLength,
  1761. OUT LPDWORD lpdwCharactersReturned,
  1762. IN GOPHER_ATTRIBUTE_ENUMERATOR lpfnEnumerator OPTIONAL,
  1763. IN DWORD_PTR dwContext
  1764. );
  1765. #ifdef UNICODE
  1766. #define GopherGetAttribute GopherGetAttributeW
  1767. #else
  1768. #define GopherGetAttribute GopherGetAttributeA
  1769. #endif // !UNICODE
  1770. //
  1771. // HTTP
  1772. //
  1773. //
  1774. // manifests
  1775. //
  1776. //
  1777. // the default major/minor HTTP version numbers
  1778. //
  1779. #define HTTP_MAJOR_VERSION 1
  1780. #define HTTP_MINOR_VERSION 0
  1781. #define HTTP_VERSIONA "HTTP/1.0"
  1782. #define HTTP_VERSIONW L"HTTP/1.0"
  1783. #ifdef UNICODE
  1784. #define HTTP_VERSION HTTP_VERSIONW
  1785. #else
  1786. #define HTTP_VERSION HTTP_VERSIONA
  1787. #endif
  1788. //
  1789. // HttpQueryInfo info levels. Generally, there is one info level
  1790. // for each potential RFC822/HTTP/MIME header that an HTTP server
  1791. // may send as part of a request response.
  1792. //
  1793. // The HTTP_QUERY_RAW_HEADERS info level is provided for clients
  1794. // that choose to perform their own header parsing.
  1795. //
  1796. #define HTTP_QUERY_MIME_VERSION 0
  1797. #define HTTP_QUERY_CONTENT_TYPE 1
  1798. #define HTTP_QUERY_CONTENT_TRANSFER_ENCODING 2
  1799. #define HTTP_QUERY_CONTENT_ID 3
  1800. #define HTTP_QUERY_CONTENT_DESCRIPTION 4
  1801. #define HTTP_QUERY_CONTENT_LENGTH 5
  1802. #define HTTP_QUERY_CONTENT_LANGUAGE 6
  1803. #define HTTP_QUERY_ALLOW 7
  1804. #define HTTP_QUERY_PUBLIC 8
  1805. #define HTTP_QUERY_DATE 9
  1806. #define HTTP_QUERY_EXPIRES 10
  1807. #define HTTP_QUERY_LAST_MODIFIED 11
  1808. #define HTTP_QUERY_MESSAGE_ID 12
  1809. #define HTTP_QUERY_URI 13
  1810. #define HTTP_QUERY_DERIVED_FROM 14
  1811. #define HTTP_QUERY_COST 15
  1812. #define HTTP_QUERY_LINK 16
  1813. #define HTTP_QUERY_PRAGMA 17
  1814. #define HTTP_QUERY_VERSION 18 // special: part of status line
  1815. #define HTTP_QUERY_STATUS_CODE 19 // special: part of status line
  1816. #define HTTP_QUERY_STATUS_TEXT 20 // special: part of status line
  1817. #define HTTP_QUERY_RAW_HEADERS 21 // special: all headers as ASCIIZ
  1818. #define HTTP_QUERY_RAW_HEADERS_CRLF 22 // special: all headers
  1819. #define HTTP_QUERY_CONNECTION 23
  1820. #define HTTP_QUERY_ACCEPT 24
  1821. #define HTTP_QUERY_ACCEPT_CHARSET 25
  1822. #define HTTP_QUERY_ACCEPT_ENCODING 26
  1823. #define HTTP_QUERY_ACCEPT_LANGUAGE 27
  1824. #define HTTP_QUERY_AUTHORIZATION 28
  1825. #define HTTP_QUERY_CONTENT_ENCODING 29
  1826. #define HTTP_QUERY_FORWARDED 30
  1827. #define HTTP_QUERY_FROM 31
  1828. #define HTTP_QUERY_IF_MODIFIED_SINCE 32
  1829. #define HTTP_QUERY_LOCATION 33
  1830. #define HTTP_QUERY_ORIG_URI 34
  1831. #define HTTP_QUERY_REFERER 35
  1832. #define HTTP_QUERY_RETRY_AFTER 36
  1833. #define HTTP_QUERY_SERVER 37
  1834. #define HTTP_QUERY_TITLE 38
  1835. #define HTTP_QUERY_USER_AGENT 39
  1836. #define HTTP_QUERY_WWW_AUTHENTICATE 40
  1837. #define HTTP_QUERY_PROXY_AUTHENTICATE 41
  1838. #define HTTP_QUERY_ACCEPT_RANGES 42
  1839. #define HTTP_QUERY_SET_COOKIE 43
  1840. #define HTTP_QUERY_COOKIE 44
  1841. #define HTTP_QUERY_REQUEST_METHOD 45 // special: GET/POST etc.
  1842. #define HTTP_QUERY_REFRESH 46
  1843. #define HTTP_QUERY_CONTENT_DISPOSITION 47
  1844. //
  1845. // HTTP 1.1 defined headers
  1846. //
  1847. #define HTTP_QUERY_AGE 48
  1848. #define HTTP_QUERY_CACHE_CONTROL 49
  1849. #define HTTP_QUERY_CONTENT_BASE 50
  1850. #define HTTP_QUERY_CONTENT_LOCATION 51
  1851. #define HTTP_QUERY_CONTENT_MD5 52
  1852. #define HTTP_QUERY_CONTENT_RANGE 53
  1853. #define HTTP_QUERY_ETAG 54
  1854. #define HTTP_QUERY_HOST 55
  1855. #define HTTP_QUERY_IF_MATCH 56
  1856. #define HTTP_QUERY_IF_NONE_MATCH 57
  1857. #define HTTP_QUERY_IF_RANGE 58
  1858. #define HTTP_QUERY_IF_UNMODIFIED_SINCE 59
  1859. #define HTTP_QUERY_MAX_FORWARDS 60
  1860. #define HTTP_QUERY_PROXY_AUTHORIZATION 61
  1861. #define HTTP_QUERY_RANGE 62
  1862. #define HTTP_QUERY_TRANSFER_ENCODING 63
  1863. #define HTTP_QUERY_UPGRADE 64
  1864. #define HTTP_QUERY_VARY 65
  1865. #define HTTP_QUERY_VIA 66
  1866. #define HTTP_QUERY_WARNING 67
  1867. #define HTTP_QUERY_EXPECT 68
  1868. #define HTTP_QUERY_PROXY_CONNECTION 69
  1869. #define HTTP_QUERY_UNLESS_MODIFIED_SINCE 70
  1870. #define HTTP_QUERY_ECHO_REQUEST 71
  1871. #define HTTP_QUERY_ECHO_REPLY 72
  1872. // These are the set of headers that should be added back to a request when
  1873. // re-doing a request after a RETRY_WITH response.
  1874. #define HTTP_QUERY_ECHO_HEADERS 73
  1875. #define HTTP_QUERY_ECHO_HEADERS_CRLF 74
  1876. #define HTTP_QUERY_PROXY_SUPPORT 75
  1877. #define HTTP_QUERY_AUTHENTICATION_INFO 76
  1878. #define HTTP_QUERY_PASSPORT_URLS 77
  1879. #define HTTP_QUERY_PASSPORT_CONFIG 78
  1880. #define HTTP_QUERY_MAX 78
  1881. //
  1882. // HTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel
  1883. // parameter of HttpQueryInfo() then the lpBuffer parameter contains the name
  1884. // of the header we are to query
  1885. //
  1886. #define HTTP_QUERY_CUSTOM 65535
  1887. //
  1888. // HTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel
  1889. // parameter of HttpQueryInfo() then the request headers will be queried for the
  1890. // request information
  1891. //
  1892. #define HTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000
  1893. //
  1894. // HTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter
  1895. // of HttpQueryInfo() AND the header being queried contains date information,
  1896. // e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure
  1897. // containing the date and time information converted from the header string
  1898. //
  1899. #define HTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
  1900. //
  1901. // HTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of
  1902. // HttpQueryInfo(), then the value of the header will be converted to a number
  1903. // before being returned to the caller, if applicable
  1904. //
  1905. #define HTTP_QUERY_FLAG_NUMBER 0x20000000
  1906. //
  1907. // HTTP_QUERY_FLAG_COALESCE - combine the values from several headers of the
  1908. // same name into the output buffer
  1909. //
  1910. #define HTTP_QUERY_FLAG_COALESCE 0x10000000
  1911. #define HTTP_QUERY_MODIFIER_FLAGS_MASK (HTTP_QUERY_FLAG_REQUEST_HEADERS \
  1912. | HTTP_QUERY_FLAG_SYSTEMTIME \
  1913. | HTTP_QUERY_FLAG_NUMBER \
  1914. | HTTP_QUERY_FLAG_COALESCE \
  1915. )
  1916. #define HTTP_QUERY_HEADER_MASK (~HTTP_QUERY_MODIFIER_FLAGS_MASK)
  1917. //
  1918. // HTTP Response Status Codes:
  1919. //
  1920. #define HTTP_STATUS_CONTINUE 100 // OK to continue with request
  1921. #define HTTP_STATUS_SWITCH_PROTOCOLS 101 // server has switched protocols in upgrade header
  1922. #define HTTP_STATUS_OK 200 // request completed
  1923. #define HTTP_STATUS_CREATED 201 // object created, reason = new URI
  1924. #define HTTP_STATUS_ACCEPTED 202 // async completion (TBS)
  1925. #define HTTP_STATUS_PARTIAL 203 // partial completion
  1926. #define HTTP_STATUS_NO_CONTENT 204 // no info to return
  1927. #define HTTP_STATUS_RESET_CONTENT 205 // request completed, but clear form
  1928. #define HTTP_STATUS_PARTIAL_CONTENT 206 // partial GET furfilled
  1929. #define HTTP_STATUS_AMBIGUOUS 300 // server couldn't decide what to return
  1930. #define HTTP_STATUS_MOVED 301 // object permanently moved
  1931. #define HTTP_STATUS_REDIRECT 302 // object temporarily moved
  1932. #define HTTP_STATUS_REDIRECT_METHOD 303 // redirection w/ new access method
  1933. #define HTTP_STATUS_NOT_MODIFIED 304 // if-modified-since was not modified
  1934. #define HTTP_STATUS_USE_PROXY 305 // redirection to proxy, location header specifies proxy to use
  1935. #define HTTP_STATUS_REDIRECT_KEEP_VERB 307 // HTTP/1.1: keep same verb
  1936. #define HTTP_STATUS_BAD_REQUEST 400 // invalid syntax
  1937. #define HTTP_STATUS_DENIED 401 // access denied
  1938. #define HTTP_STATUS_PAYMENT_REQ 402 // payment required
  1939. #define HTTP_STATUS_FORBIDDEN 403 // request forbidden
  1940. #define HTTP_STATUS_NOT_FOUND 404 // object not found
  1941. #define HTTP_STATUS_BAD_METHOD 405 // method is not allowed
  1942. #define HTTP_STATUS_NONE_ACCEPTABLE 406 // no response acceptable to client found
  1943. #define HTTP_STATUS_PROXY_AUTH_REQ 407 // proxy authentication required
  1944. #define HTTP_STATUS_REQUEST_TIMEOUT 408 // server timed out waiting for request
  1945. #define HTTP_STATUS_CONFLICT 409 // user should resubmit with more info
  1946. #define HTTP_STATUS_GONE 410 // the resource is no longer available
  1947. #define HTTP_STATUS_LENGTH_REQUIRED 411 // the server refused to accept request w/o a length
  1948. #define HTTP_STATUS_PRECOND_FAILED 412 // precondition given in request failed
  1949. #define HTTP_STATUS_REQUEST_TOO_LARGE 413 // request entity was too large
  1950. #define HTTP_STATUS_URI_TOO_LONG 414 // request URI too long
  1951. #define HTTP_STATUS_UNSUPPORTED_MEDIA 415 // unsupported media type
  1952. #define HTTP_STATUS_RETRY_WITH 449 // retry after doing the appropriate action.
  1953. #define HTTP_STATUS_SERVER_ERROR 500 // internal server error
  1954. #define HTTP_STATUS_NOT_SUPPORTED 501 // required not supported
  1955. #define HTTP_STATUS_BAD_GATEWAY 502 // error response received from gateway
  1956. #define HTTP_STATUS_SERVICE_UNAVAIL 503 // temporarily overloaded
  1957. #define HTTP_STATUS_GATEWAY_TIMEOUT 504 // timed out waiting for gateway
  1958. #define HTTP_STATUS_VERSION_NOT_SUP 505 // HTTP version not supported
  1959. #define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE
  1960. #define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP
  1961. //
  1962. // prototypes
  1963. //
  1964. INTERNETAPI_(HINTERNET) HttpOpenRequestA(
  1965. IN HINTERNET hConnect,
  1966. IN LPCSTR lpszVerb,
  1967. IN LPCSTR lpszObjectName,
  1968. IN LPCSTR lpszVersion,
  1969. IN LPCSTR lpszReferrer OPTIONAL,
  1970. IN LPCSTR FAR * lplpszAcceptTypes OPTIONAL,
  1971. IN DWORD dwFlags,
  1972. IN DWORD_PTR dwContext
  1973. );
  1974. INTERNETAPI_(HINTERNET) HttpOpenRequestW(
  1975. IN HINTERNET hConnect,
  1976. IN LPCWSTR lpszVerb,
  1977. IN LPCWSTR lpszObjectName,
  1978. IN LPCWSTR lpszVersion,
  1979. IN LPCWSTR lpszReferrer OPTIONAL,
  1980. IN LPCWSTR FAR * lplpszAcceptTypes OPTIONAL,
  1981. IN DWORD dwFlags,
  1982. IN DWORD_PTR dwContext
  1983. );
  1984. #ifdef UNICODE
  1985. #define HttpOpenRequest HttpOpenRequestW
  1986. #else
  1987. #define HttpOpenRequest HttpOpenRequestA
  1988. #endif // !UNICODE
  1989. BOOLAPI HttpAddRequestHeadersA(
  1990. IN HINTERNET hRequest,
  1991. IN LPCSTR lpszHeaders,
  1992. IN DWORD dwHeadersLength,
  1993. IN DWORD dwModifiers
  1994. );
  1995. BOOLAPI HttpAddRequestHeadersW(
  1996. IN HINTERNET hRequest,
  1997. IN LPCWSTR lpszHeaders,
  1998. IN DWORD dwHeadersLength,
  1999. IN DWORD dwModifiers
  2000. );
  2001. #ifdef UNICODE
  2002. #define HttpAddRequestHeaders HttpAddRequestHeadersW
  2003. #else
  2004. #define HttpAddRequestHeaders HttpAddRequestHeadersA
  2005. #endif // !UNICODE
  2006. //
  2007. // values for dwModifiers parameter of HttpAddRequestHeaders()
  2008. //
  2009. #define HTTP_ADDREQ_INDEX_MASK 0x0000FFFF
  2010. #define HTTP_ADDREQ_FLAGS_MASK 0xFFFF0000
  2011. //
  2012. // HTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't
  2013. // already exist
  2014. //
  2015. #define HTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000
  2016. //
  2017. // HTTP_ADDREQ_FLAG_ADD - if HTTP_ADDREQ_FLAG_REPLACE is set but the header is
  2018. // not found then if this flag is set, the header is added anyway, so long as
  2019. // there is a valid header-value
  2020. //
  2021. #define HTTP_ADDREQ_FLAG_ADD 0x20000000
  2022. //
  2023. // HTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g.
  2024. // "Accept: text/*" and "Accept: audio/*" with this flag results in a single
  2025. // header: "Accept: text/*, audio/*"
  2026. //
  2027. #define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000
  2028. #define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000
  2029. #define HTTP_ADDREQ_FLAG_COALESCE HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
  2030. //
  2031. // HTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can
  2032. // be supplied in the buffer. If the header to be replaced is not the first
  2033. // in a list of headers with the same name, then the relative index should be
  2034. // supplied in the low 8 bits of the dwModifiers parameter. If the header-value
  2035. // part is missing, then the header is removed
  2036. //
  2037. #define HTTP_ADDREQ_FLAG_REPLACE 0x80000000
  2038. BOOLAPI HttpSendRequestA(
  2039. IN HINTERNET hRequest,
  2040. IN LPCSTR lpszHeaders OPTIONAL,
  2041. IN DWORD dwHeadersLength,
  2042. IN LPVOID lpOptional OPTIONAL,
  2043. IN DWORD dwOptionalLength
  2044. );
  2045. BOOLAPI HttpSendRequestW(
  2046. IN HINTERNET hRequest,
  2047. IN LPCWSTR lpszHeaders OPTIONAL,
  2048. IN DWORD dwHeadersLength,
  2049. IN LPVOID lpOptional OPTIONAL,
  2050. IN DWORD dwOptionalLength
  2051. );
  2052. #ifdef UNICODE
  2053. #define HttpSendRequest HttpSendRequestW
  2054. #else
  2055. #define HttpSendRequest HttpSendRequestA
  2056. #endif // !UNICODE
  2057. INTERNETAPI_(BOOL) HttpSendRequestExA(
  2058. IN HINTERNET hRequest,
  2059. IN LPINTERNET_BUFFERSA lpBuffersIn OPTIONAL,
  2060. OUT LPINTERNET_BUFFERSA lpBuffersOut OPTIONAL,
  2061. IN DWORD dwFlags,
  2062. IN DWORD_PTR dwContext
  2063. );
  2064. INTERNETAPI_(BOOL) HttpSendRequestExW(
  2065. IN HINTERNET hRequest,
  2066. IN LPINTERNET_BUFFERSW lpBuffersIn OPTIONAL,
  2067. OUT LPINTERNET_BUFFERSW lpBuffersOut OPTIONAL,
  2068. IN DWORD dwFlags,
  2069. IN DWORD_PTR dwContext
  2070. );
  2071. #ifdef UNICODE
  2072. #define HttpSendRequestEx HttpSendRequestExW
  2073. #else
  2074. #define HttpSendRequestEx HttpSendRequestExA
  2075. #endif // !UNICODE
  2076. //
  2077. // flags for HttpSendRequestEx(), HttpEndRequest()
  2078. //
  2079. #define HSR_ASYNC WININET_API_FLAG_ASYNC // force async
  2080. #define HSR_SYNC WININET_API_FLAG_SYNC // force sync
  2081. #define HSR_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT // use dwContext value
  2082. #define HSR_INITIATE 0x00000008 // iterative operation (completed by HttpEndRequest)
  2083. #define HSR_DOWNLOAD 0x00000010 // download to file
  2084. #define HSR_CHUNKED 0x00000020 // operation is send of chunked data
  2085. INTERNETAPI_(BOOL) HttpEndRequestA(
  2086. IN HINTERNET hRequest,
  2087. OUT LPINTERNET_BUFFERSA lpBuffersOut OPTIONAL,
  2088. IN DWORD dwFlags,
  2089. IN DWORD_PTR dwContext
  2090. );
  2091. INTERNETAPI_(BOOL) HttpEndRequestW(
  2092. IN HINTERNET hRequest,
  2093. OUT LPINTERNET_BUFFERSW lpBuffersOut OPTIONAL,
  2094. IN DWORD dwFlags,
  2095. IN DWORD_PTR dwContext
  2096. );
  2097. #ifdef UNICODE
  2098. #define HttpEndRequest HttpEndRequestW
  2099. #else
  2100. #define HttpEndRequest HttpEndRequestA
  2101. #endif // !UNICODE
  2102. BOOLAPI HttpQueryInfoA(
  2103. IN HINTERNET hRequest,
  2104. IN DWORD dwInfoLevel,
  2105. IN OUT LPVOID lpBuffer OPTIONAL,
  2106. IN OUT LPDWORD lpdwBufferLength,
  2107. IN OUT LPDWORD lpdwIndex OPTIONAL
  2108. );
  2109. BOOLAPI HttpQueryInfoW(
  2110. IN HINTERNET hRequest,
  2111. IN DWORD dwInfoLevel,
  2112. IN OUT LPVOID lpBuffer OPTIONAL,
  2113. IN OUT LPDWORD lpdwBufferLength,
  2114. IN OUT LPDWORD lpdwIndex OPTIONAL
  2115. );
  2116. #ifdef UNICODE
  2117. #define HttpQueryInfo HttpQueryInfoW
  2118. #else
  2119. #define HttpQueryInfo HttpQueryInfoA
  2120. #endif // !UNICODE
  2121. //
  2122. // Cookie APIs
  2123. //
  2124. #define INTERNET_COOKIE_IS_SECURE 0x01
  2125. #define INTERNET_COOKIE_IS_SESSION 0x02
  2126. #define INTERNET_COOKIE_THIRD_PARTY 0x10
  2127. #define INTERNET_COOKIE_PROMPT_REQUIRED 0x20
  2128. #define INTERNET_COOKIE_EVALUATE_P3P 0x40
  2129. #define INTERNET_COOKIE_APPLY_P3P 0x80
  2130. #define INTERNET_COOKIE_P3P_ENABLED 0x100
  2131. #define INTERNET_COOKIE_IS_RESTRICTED 0x200
  2132. #define INTERNET_COOKIE_IE6 0x400
  2133. #define INTERNET_COOKIE_IS_LEGACY 0x800
  2134. BOOLAPI InternetSetCookieA(
  2135. IN LPCSTR lpszUrl,
  2136. IN LPCSTR lpszCookieName,
  2137. IN LPCSTR lpszCookieData
  2138. );
  2139. BOOLAPI InternetSetCookieW(
  2140. IN LPCWSTR lpszUrl,
  2141. IN LPCWSTR lpszCookieName,
  2142. IN LPCWSTR lpszCookieData
  2143. );
  2144. #ifdef UNICODE
  2145. #define InternetSetCookie InternetSetCookieW
  2146. #else
  2147. #define InternetSetCookie InternetSetCookieA
  2148. #endif // !UNICODE
  2149. BOOLAPI InternetGetCookieA(
  2150. IN LPCSTR lpszUrl,
  2151. IN LPCSTR lpszCookieName,
  2152. OUT LPSTR lpCookieData,
  2153. IN OUT LPDWORD lpdwSize
  2154. );
  2155. BOOLAPI InternetGetCookieW(
  2156. IN LPCWSTR lpszUrl,
  2157. IN LPCWSTR lpszCookieName,
  2158. OUT LPWSTR lpCookieData,
  2159. IN OUT LPDWORD lpdwSize
  2160. );
  2161. #ifdef UNICODE
  2162. #define InternetGetCookie InternetGetCookieW
  2163. #else
  2164. #define InternetGetCookie InternetGetCookieA
  2165. #endif // !UNICODE
  2166. INTERNETAPI_(DWORD) InternetSetCookieExA(
  2167. IN LPCSTR lpszUrl,
  2168. IN LPCSTR lpszCookieName,
  2169. IN LPCSTR lpszCookieData,
  2170. DWORD dwFlags,
  2171. DWORD_PTR dwReserved
  2172. );
  2173. INTERNETAPI_(DWORD) InternetSetCookieExW(
  2174. IN LPCWSTR lpszUrl,
  2175. IN LPCWSTR lpszCookieName,
  2176. IN LPCWSTR lpszCookieData,
  2177. DWORD dwFlags,
  2178. DWORD_PTR dwReserved
  2179. );
  2180. #ifdef UNICODE
  2181. #define InternetSetCookieEx InternetSetCookieExW
  2182. #else
  2183. #define InternetSetCookieEx InternetSetCookieExA
  2184. #endif // !UNICODE
  2185. BOOLAPI InternetGetCookieExA(
  2186. IN LPCSTR pchURL,
  2187. IN LPCSTR pchCookieName,
  2188. IN LPSTR pchCookieData OPTIONAL,
  2189. IN OUT LPDWORD pcchCookieData OPTIONAL,
  2190. IN DWORD dwFlags,
  2191. IN LPVOID lpReserved
  2192. );
  2193. BOOLAPI InternetGetCookieExW(
  2194. IN LPCWSTR pchURL,
  2195. IN LPCWSTR pchCookieName,
  2196. IN LPWSTR pchCookieData OPTIONAL,
  2197. IN OUT LPDWORD pcchCookieData OPTIONAL,
  2198. IN DWORD dwFlags,
  2199. IN LPVOID lpReserved
  2200. );
  2201. #ifdef UNICODE
  2202. #define InternetGetCookieEx InternetGetCookieExW
  2203. #else
  2204. #define InternetGetCookieEx InternetGetCookieExA
  2205. #endif // !UNICODE
  2206. //
  2207. // offline browsing
  2208. //
  2209. INTERNETAPI_(DWORD) InternetAttemptConnect(
  2210. IN DWORD dwReserved
  2211. );
  2212. BOOLAPI InternetCheckConnectionA(
  2213. IN LPCSTR lpszUrl,
  2214. IN DWORD dwFlags,
  2215. IN DWORD dwReserved
  2216. );
  2217. BOOLAPI InternetCheckConnectionW(
  2218. IN LPCWSTR lpszUrl,
  2219. IN DWORD dwFlags,
  2220. IN DWORD dwReserved
  2221. );
  2222. #ifdef UNICODE
  2223. #define InternetCheckConnection InternetCheckConnectionW
  2224. #else
  2225. #define InternetCheckConnection InternetCheckConnectionA
  2226. #endif // !UNICODE
  2227. #define FLAG_ICC_FORCE_CONNECTION 0x00000001
  2228. //
  2229. // Internet UI
  2230. //
  2231. //
  2232. // InternetErrorDlg - Provides UI for certain Errors.
  2233. //
  2234. #define FLAGS_ERROR_UI_FILTER_FOR_ERRORS 0x01
  2235. #define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS 0x02
  2236. #define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA 0x04
  2237. #define FLAGS_ERROR_UI_FLAGS_NO_UI 0x08
  2238. #define FLAGS_ERROR_UI_SERIALIZE_DIALOGS 0x10
  2239. //
  2240. // If SERIALIZE_DIALOGS flag set, client should implement thread-safe non-blocking callback...
  2241. //
  2242. DWORD InternetAuthNotifyCallback
  2243. (
  2244. DWORD_PTR dwContext, // as passed to InternetErrorDlg
  2245. DWORD dwReturn, // error code: success, resend, or cancel
  2246. LPVOID lpReserved // reserved: will be set to null
  2247. );
  2248. typedef DWORD (CALLBACK * PFN_AUTH_NOTIFY) (DWORD_PTR, DWORD, LPVOID);
  2249. //
  2250. // ... and last parameter of InternetErrorDlg should point to...
  2251. //
  2252. typedef struct
  2253. {
  2254. DWORD cbStruct; // size of this structure
  2255. DWORD dwOptions; // reserved: must set to 0
  2256. PFN_AUTH_NOTIFY pfnNotify; // notification callback to retry InternetErrorDlg
  2257. DWORD_PTR dwContext; // context to pass to to notification function
  2258. }
  2259. INTERNET_AUTH_NOTIFY_DATA;
  2260. INTERNETAPI_(BOOL) ResumeSuspendedDownload(
  2261. IN HINTERNET hRequest,
  2262. IN DWORD dwResultCode
  2263. );
  2264. INTERNETAPI_(DWORD) InternetErrorDlg(
  2265. IN HWND hWnd,
  2266. IN OUT HINTERNET hRequest,
  2267. IN DWORD dwError,
  2268. IN DWORD dwFlags,
  2269. IN OUT LPVOID * lppvData
  2270. );
  2271. INTERNETAPI_(DWORD) InternetConfirmZoneCrossingA(
  2272. IN HWND hWnd,
  2273. IN LPSTR szUrlPrev,
  2274. IN LPSTR szUrlNew,
  2275. IN BOOL bPost
  2276. );
  2277. INTERNETAPI_(DWORD) InternetConfirmZoneCrossingW(
  2278. IN HWND hWnd,
  2279. IN LPWSTR szUrlPrev,
  2280. IN LPWSTR szUrlNew,
  2281. IN BOOL bPost
  2282. );
  2283. #ifdef UNICODE
  2284. #define InternetConfirmZoneCrossing InternetConfirmZoneCrossingW
  2285. #else
  2286. #ifdef _WINX32_
  2287. #define InternetConfirmZoneCrossing InternetConfirmZoneCrossingA
  2288. #else
  2289. INTERNETAPI_(DWORD) InternetConfirmZoneCrossing(
  2290. IN HWND hWnd,
  2291. IN LPSTR szUrlPrev,
  2292. IN LPSTR szUrlNew,
  2293. IN BOOL bPost
  2294. );
  2295. #endif // _WINX32_
  2296. #endif // !UNICODE
  2297. //#if !defined(_WINERROR_)
  2298. //
  2299. // Internet API error returns
  2300. //
  2301. #define INTERNET_ERROR_BASE 12000
  2302. #define ERROR_INTERNET_OUT_OF_HANDLES (INTERNET_ERROR_BASE + 1)
  2303. #define ERROR_INTERNET_TIMEOUT (INTERNET_ERROR_BASE + 2)
  2304. #define ERROR_INTERNET_EXTENDED_ERROR (INTERNET_ERROR_BASE + 3)
  2305. #define ERROR_INTERNET_INTERNAL_ERROR (INTERNET_ERROR_BASE + 4)
  2306. #define ERROR_INTERNET_INVALID_URL (INTERNET_ERROR_BASE + 5)
  2307. #define ERROR_INTERNET_UNRECOGNIZED_SCHEME (INTERNET_ERROR_BASE + 6)
  2308. #define ERROR_INTERNET_NAME_NOT_RESOLVED (INTERNET_ERROR_BASE + 7)
  2309. #define ERROR_INTERNET_PROTOCOL_NOT_FOUND (INTERNET_ERROR_BASE + 8)
  2310. #define ERROR_INTERNET_INVALID_OPTION (INTERNET_ERROR_BASE + 9)
  2311. #define ERROR_INTERNET_BAD_OPTION_LENGTH (INTERNET_ERROR_BASE + 10)
  2312. #define ERROR_INTERNET_OPTION_NOT_SETTABLE (INTERNET_ERROR_BASE + 11)
  2313. #define ERROR_INTERNET_SHUTDOWN (INTERNET_ERROR_BASE + 12)
  2314. #define ERROR_INTERNET_INCORRECT_USER_NAME (INTERNET_ERROR_BASE + 13)
  2315. #define ERROR_INTERNET_INCORRECT_PASSWORD (INTERNET_ERROR_BASE + 14)
  2316. #define ERROR_INTERNET_LOGIN_FAILURE (INTERNET_ERROR_BASE + 15)
  2317. #define ERROR_INTERNET_INVALID_OPERATION (INTERNET_ERROR_BASE + 16)
  2318. #define ERROR_INTERNET_OPERATION_CANCELLED (INTERNET_ERROR_BASE + 17)
  2319. #define ERROR_INTERNET_INCORRECT_HANDLE_TYPE (INTERNET_ERROR_BASE + 18)
  2320. #define ERROR_INTERNET_INCORRECT_HANDLE_STATE (INTERNET_ERROR_BASE + 19)
  2321. #define ERROR_INTERNET_NOT_PROXY_REQUEST (INTERNET_ERROR_BASE + 20)
  2322. #define ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND (INTERNET_ERROR_BASE + 21)
  2323. #define ERROR_INTERNET_BAD_REGISTRY_PARAMETER (INTERNET_ERROR_BASE + 22)
  2324. #define ERROR_INTERNET_NO_DIRECT_ACCESS (INTERNET_ERROR_BASE + 23)
  2325. #define ERROR_INTERNET_NO_CONTEXT (INTERNET_ERROR_BASE + 24)
  2326. #define ERROR_INTERNET_NO_CALLBACK (INTERNET_ERROR_BASE + 25)
  2327. #define ERROR_INTERNET_REQUEST_PENDING (INTERNET_ERROR_BASE + 26)
  2328. #define ERROR_INTERNET_INCORRECT_FORMAT (INTERNET_ERROR_BASE + 27)
  2329. #define ERROR_INTERNET_ITEM_NOT_FOUND (INTERNET_ERROR_BASE + 28)
  2330. #define ERROR_INTERNET_CANNOT_CONNECT (INTERNET_ERROR_BASE + 29)
  2331. #define ERROR_INTERNET_CONNECTION_ABORTED (INTERNET_ERROR_BASE + 30)
  2332. #define ERROR_INTERNET_CONNECTION_RESET (INTERNET_ERROR_BASE + 31)
  2333. #define ERROR_INTERNET_FORCE_RETRY (INTERNET_ERROR_BASE + 32)
  2334. #define ERROR_INTERNET_INVALID_PROXY_REQUEST (INTERNET_ERROR_BASE + 33)
  2335. #define ERROR_INTERNET_NEED_UI (INTERNET_ERROR_BASE + 34)
  2336. #define ERROR_INTERNET_HANDLE_EXISTS (INTERNET_ERROR_BASE + 36)
  2337. #define ERROR_INTERNET_SEC_CERT_DATE_INVALID (INTERNET_ERROR_BASE + 37)
  2338. #define ERROR_INTERNET_SEC_CERT_CN_INVALID (INTERNET_ERROR_BASE + 38)
  2339. #define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR (INTERNET_ERROR_BASE + 39)
  2340. #define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR (INTERNET_ERROR_BASE + 40)
  2341. #define ERROR_INTERNET_MIXED_SECURITY (INTERNET_ERROR_BASE + 41)
  2342. #define ERROR_INTERNET_CHG_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 42)
  2343. #define ERROR_INTERNET_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 43)
  2344. #define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED (INTERNET_ERROR_BASE + 44)
  2345. #define ERROR_INTERNET_INVALID_CA (INTERNET_ERROR_BASE + 45)
  2346. #define ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP (INTERNET_ERROR_BASE + 46)
  2347. #define ERROR_INTERNET_ASYNC_THREAD_FAILED (INTERNET_ERROR_BASE + 47)
  2348. #define ERROR_INTERNET_REDIRECT_SCHEME_CHANGE (INTERNET_ERROR_BASE + 48)
  2349. #define ERROR_INTERNET_DIALOG_PENDING (INTERNET_ERROR_BASE + 49)
  2350. #define ERROR_INTERNET_RETRY_DIALOG (INTERNET_ERROR_BASE + 50)
  2351. #define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR (INTERNET_ERROR_BASE + 52)
  2352. #define ERROR_INTERNET_INSERT_CDROM (INTERNET_ERROR_BASE + 53)
  2353. #define ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED (INTERNET_ERROR_BASE + 54)
  2354. #define ERROR_INTERNET_SEC_CERT_ERRORS (INTERNET_ERROR_BASE + 55)
  2355. #define ERROR_INTERNET_SEC_CERT_NO_REV (INTERNET_ERROR_BASE + 56)
  2356. #define ERROR_INTERNET_SEC_CERT_REV_FAILED (INTERNET_ERROR_BASE + 57)
  2357. //
  2358. // FTP API errors
  2359. //
  2360. #define ERROR_FTP_TRANSFER_IN_PROGRESS (INTERNET_ERROR_BASE + 110)
  2361. #define ERROR_FTP_DROPPED (INTERNET_ERROR_BASE + 111)
  2362. #define ERROR_FTP_NO_PASSIVE_MODE (INTERNET_ERROR_BASE + 112)
  2363. //
  2364. // gopher API errors
  2365. //
  2366. #define ERROR_GOPHER_PROTOCOL_ERROR (INTERNET_ERROR_BASE + 130)
  2367. #define ERROR_GOPHER_NOT_FILE (INTERNET_ERROR_BASE + 131)
  2368. #define ERROR_GOPHER_DATA_ERROR (INTERNET_ERROR_BASE + 132)
  2369. #define ERROR_GOPHER_END_OF_DATA (INTERNET_ERROR_BASE + 133)
  2370. #define ERROR_GOPHER_INVALID_LOCATOR (INTERNET_ERROR_BASE + 134)
  2371. #define ERROR_GOPHER_INCORRECT_LOCATOR_TYPE (INTERNET_ERROR_BASE + 135)
  2372. #define ERROR_GOPHER_NOT_GOPHER_PLUS (INTERNET_ERROR_BASE + 136)
  2373. #define ERROR_GOPHER_ATTRIBUTE_NOT_FOUND (INTERNET_ERROR_BASE + 137)
  2374. #define ERROR_GOPHER_UNKNOWN_LOCATOR (INTERNET_ERROR_BASE + 138)
  2375. //
  2376. // HTTP API errors
  2377. //
  2378. #define ERROR_HTTP_HEADER_NOT_FOUND (INTERNET_ERROR_BASE + 150)
  2379. #define ERROR_HTTP_DOWNLEVEL_SERVER (INTERNET_ERROR_BASE + 151)
  2380. #define ERROR_HTTP_INVALID_SERVER_RESPONSE (INTERNET_ERROR_BASE + 152)
  2381. #define ERROR_HTTP_INVALID_HEADER (INTERNET_ERROR_BASE + 153)
  2382. #define ERROR_HTTP_INVALID_QUERY_REQUEST (INTERNET_ERROR_BASE + 154)
  2383. #define ERROR_HTTP_HEADER_ALREADY_EXISTS (INTERNET_ERROR_BASE + 155)
  2384. #define ERROR_HTTP_REDIRECT_FAILED (INTERNET_ERROR_BASE + 156)
  2385. #define ERROR_HTTP_NOT_REDIRECTED (INTERNET_ERROR_BASE + 160)
  2386. #define ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 161)
  2387. #define ERROR_HTTP_COOKIE_DECLINED (INTERNET_ERROR_BASE + 162)
  2388. #define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 168)
  2389. //
  2390. // additional Internet API error codes
  2391. //
  2392. #define ERROR_INTERNET_SECURITY_CHANNEL_ERROR (INTERNET_ERROR_BASE + 157)
  2393. #define ERROR_INTERNET_UNABLE_TO_CACHE_FILE (INTERNET_ERROR_BASE + 158)
  2394. #define ERROR_INTERNET_TCPIP_NOT_INSTALLED (INTERNET_ERROR_BASE + 159)
  2395. #define ERROR_INTERNET_DISCONNECTED (INTERNET_ERROR_BASE + 163)
  2396. #define ERROR_INTERNET_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 164)
  2397. #define ERROR_INTERNET_PROXY_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 165)
  2398. #define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT (INTERNET_ERROR_BASE + 166)
  2399. #define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT (INTERNET_ERROR_BASE + 167)
  2400. #define ERROR_INTERNET_SEC_INVALID_CERT (INTERNET_ERROR_BASE + 169)
  2401. #define ERROR_INTERNET_SEC_CERT_REVOKED (INTERNET_ERROR_BASE + 170)
  2402. // InternetAutodial specific errors
  2403. #define ERROR_INTERNET_FAILED_DUETOSECURITYCHECK (INTERNET_ERROR_BASE + 171)
  2404. #define ERROR_INTERNET_NOT_INITIALIZED (INTERNET_ERROR_BASE + 172)
  2405. #define ERROR_INTERNET_NEED_MSN_SSPI_PKG (INTERNET_ERROR_BASE + 173)
  2406. #define ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY (INTERNET_ERROR_BASE + 174)
  2407. #define INTERNET_ERROR_LAST ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY
  2408. //#endif // !defined(_WINERROR_)
  2409. //
  2410. // URLCACHE APIs
  2411. //
  2412. //
  2413. // datatype definitions.
  2414. //
  2415. //
  2416. // cache entry type flags.
  2417. //
  2418. #define NORMAL_CACHE_ENTRY 0x00000001
  2419. #define STICKY_CACHE_ENTRY 0x00000004
  2420. #define EDITED_CACHE_ENTRY 0x00000008
  2421. #define TRACK_OFFLINE_CACHE_ENTRY 0x00000010
  2422. #define TRACK_ONLINE_CACHE_ENTRY 0x00000020
  2423. #define SPARSE_CACHE_ENTRY 0x00010000
  2424. #define COOKIE_CACHE_ENTRY 0x00100000
  2425. #define URLHISTORY_CACHE_ENTRY 0x00200000
  2426. #define URLCACHE_FIND_DEFAULT_FILTER NORMAL_CACHE_ENTRY \
  2427. | COOKIE_CACHE_ENTRY \
  2428. | URLHISTORY_CACHE_ENTRY \
  2429. | TRACK_OFFLINE_CACHE_ENTRY \
  2430. | TRACK_ONLINE_CACHE_ENTRY \
  2431. | STICKY_CACHE_ENTRY
  2432. //
  2433. // INTERNET_CACHE_ENTRY_INFO -
  2434. //
  2435. #if _MSC_VER >= 1200
  2436. #pragma warning(push)
  2437. #endif
  2438. #pragma warning(disable:4201)
  2439. typedef struct _INTERNET_CACHE_ENTRY_INFOA {
  2440. DWORD dwStructSize; // version of cache system.
  2441. LPSTR lpszSourceUrlName; // embedded pointer to the URL name string.
  2442. LPSTR lpszLocalFileName; // embedded pointer to the local file name.
  2443. DWORD CacheEntryType; // cache type bit mask.
  2444. DWORD dwUseCount; // current users count of the cache entry.
  2445. DWORD dwHitRate; // num of times the cache entry was retrieved.
  2446. DWORD dwSizeLow; // low DWORD of the file size.
  2447. DWORD dwSizeHigh; // high DWORD of the file size.
  2448. FILETIME LastModifiedTime; // last modified time of the file in GMT format.
  2449. FILETIME ExpireTime; // expire time of the file in GMT format
  2450. FILETIME LastAccessTime; // last accessed time in GMT format
  2451. FILETIME LastSyncTime; // last time the URL was synchronized
  2452. // with the source
  2453. LPSTR lpHeaderInfo; // embedded pointer to the header info.
  2454. DWORD dwHeaderInfoSize; // size of the above header.
  2455. LPSTR lpszFileExtension; // File extension used to retrive the urldata as a file.
  2456. union { // Exemption delta from last access time.
  2457. DWORD dwReserved;
  2458. DWORD dwExemptDelta;
  2459. }; // Exemption delta from last access
  2460. } INTERNET_CACHE_ENTRY_INFOA, * LPINTERNET_CACHE_ENTRY_INFOA;
  2461. typedef struct _INTERNET_CACHE_ENTRY_INFOW {
  2462. DWORD dwStructSize; // version of cache system.
  2463. LPWSTR lpszSourceUrlName; // embedded pointer to the URL name string.
  2464. LPWSTR lpszLocalFileName; // embedded pointer to the local file name.
  2465. DWORD CacheEntryType; // cache type bit mask.
  2466. DWORD dwUseCount; // current users count of the cache entry.
  2467. DWORD dwHitRate; // num of times the cache entry was retrieved.
  2468. DWORD dwSizeLow; // low DWORD of the file size.
  2469. DWORD dwSizeHigh; // high DWORD of the file size.
  2470. FILETIME LastModifiedTime; // last modified time of the file in GMT format.
  2471. FILETIME ExpireTime; // expire time of the file in GMT format
  2472. FILETIME LastAccessTime; // last accessed time in GMT format
  2473. FILETIME LastSyncTime; // last time the URL was synchronized
  2474. // with the source
  2475. LPWSTR lpHeaderInfo; // embedded pointer to the header info.
  2476. DWORD dwHeaderInfoSize; // size of the above header.
  2477. LPWSTR lpszFileExtension; // File extension used to retrive the urldata as a file.
  2478. union { // Exemption delta from last access time.
  2479. DWORD dwReserved;
  2480. DWORD dwExemptDelta;
  2481. }; // Exemption delta from last access
  2482. } INTERNET_CACHE_ENTRY_INFOW, * LPINTERNET_CACHE_ENTRY_INFOW;
  2483. #ifdef UNICODE
  2484. typedef INTERNET_CACHE_ENTRY_INFOW INTERNET_CACHE_ENTRY_INFO;
  2485. typedef LPINTERNET_CACHE_ENTRY_INFOW LPINTERNET_CACHE_ENTRY_INFO;
  2486. #else
  2487. typedef INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFO;
  2488. typedef LPINTERNET_CACHE_ENTRY_INFOA LPINTERNET_CACHE_ENTRY_INFO;
  2489. #endif // UNICODE
  2490. #if _MSC_VER >= 1200
  2491. #pragma warning(pop)
  2492. #else
  2493. #pragma warning(default:4201)
  2494. #endif
  2495. typedef struct _INTERNET_CACHE_TIMESTAMPS {
  2496. FILETIME ftExpires;
  2497. FILETIME ftLastModified;
  2498. } INTERNET_CACHE_TIMESTAMPS, *LPINTERNET_CACHE_TIMESTAMPS;
  2499. //
  2500. // Cache Group
  2501. //
  2502. typedef LONGLONG GROUPID;
  2503. //
  2504. // Cache Group Flags
  2505. //
  2506. #define CACHEGROUP_ATTRIBUTE_GET_ALL 0xffffffff
  2507. #define CACHEGROUP_ATTRIBUTE_BASIC 0x00000001
  2508. #define CACHEGROUP_ATTRIBUTE_FLAG 0x00000002
  2509. #define CACHEGROUP_ATTRIBUTE_TYPE 0x00000004
  2510. #define CACHEGROUP_ATTRIBUTE_QUOTA 0x00000008
  2511. #define CACHEGROUP_ATTRIBUTE_GROUPNAME 0x00000010
  2512. #define CACHEGROUP_ATTRIBUTE_STORAGE 0x00000020
  2513. #define CACHEGROUP_FLAG_NONPURGEABLE 0x00000001
  2514. #define CACHEGROUP_FLAG_GIDONLY 0x00000004
  2515. #define CACHEGROUP_FLAG_FLUSHURL_ONDELETE 0x00000002
  2516. #define CACHEGROUP_SEARCH_ALL 0x00000000
  2517. #define CACHEGROUP_SEARCH_BYURL 0x00000001
  2518. #define CACHEGROUP_TYPE_INVALID 0x00000001
  2519. //
  2520. // updatable cache group fields
  2521. //
  2522. #define CACHEGROUP_READWRITE_MASK \
  2523. CACHEGROUP_ATTRIBUTE_TYPE \
  2524. | CACHEGROUP_ATTRIBUTE_QUOTA \
  2525. | CACHEGROUP_ATTRIBUTE_GROUPNAME \
  2526. | CACHEGROUP_ATTRIBUTE_STORAGE
  2527. //
  2528. // INTERNET_CACHE_GROUP_INFO
  2529. //
  2530. #define GROUPNAME_MAX_LENGTH 120
  2531. #define GROUP_OWNER_STORAGE_SIZE 4
  2532. typedef struct _INTERNET_CACHE_GROUP_INFOA {
  2533. DWORD dwGroupSize;
  2534. DWORD dwGroupFlags;
  2535. DWORD dwGroupType;
  2536. DWORD dwDiskUsage; // in KB
  2537. DWORD dwDiskQuota; // in KB
  2538. DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE];
  2539. CHAR szGroupName[GROUPNAME_MAX_LENGTH];
  2540. } INTERNET_CACHE_GROUP_INFOA, * LPINTERNET_CACHE_GROUP_INFOA;
  2541. typedef struct _INTERNET_CACHE_GROUP_INFOW {
  2542. DWORD dwGroupSize;
  2543. DWORD dwGroupFlags;
  2544. DWORD dwGroupType;
  2545. DWORD dwDiskUsage; // in KB
  2546. DWORD dwDiskQuota; // in KB
  2547. DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE];
  2548. WCHAR szGroupName[GROUPNAME_MAX_LENGTH];
  2549. } INTERNET_CACHE_GROUP_INFOW, * LPINTERNET_CACHE_GROUP_INFOW;
  2550. #ifdef UNICODE
  2551. typedef INTERNET_CACHE_GROUP_INFOW INTERNET_CACHE_GROUP_INFO;
  2552. typedef LPINTERNET_CACHE_GROUP_INFOW LPINTERNET_CACHE_GROUP_INFO;
  2553. #else
  2554. typedef INTERNET_CACHE_GROUP_INFOA INTERNET_CACHE_GROUP_INFO;
  2555. typedef LPINTERNET_CACHE_GROUP_INFOA LPINTERNET_CACHE_GROUP_INFO;
  2556. #endif // UNICODE
  2557. //
  2558. // Cache APIs
  2559. //
  2560. BOOLAPI CreateUrlCacheEntryA(
  2561. IN LPCSTR lpszUrlName,
  2562. IN DWORD dwExpectedFileSize,
  2563. IN LPCSTR lpszFileExtension,
  2564. OUT LPSTR lpszFileName,
  2565. IN DWORD dwReserved
  2566. );
  2567. BOOLAPI CreateUrlCacheEntryW(
  2568. IN LPCWSTR lpszUrlName,
  2569. IN DWORD dwExpectedFileSize,
  2570. IN LPCWSTR lpszFileExtension,
  2571. OUT LPWSTR lpszFileName,
  2572. IN DWORD dwReserved
  2573. );
  2574. #ifdef UNICODE
  2575. #define CreateUrlCacheEntry CreateUrlCacheEntryW
  2576. #else
  2577. #define CreateUrlCacheEntry CreateUrlCacheEntryA
  2578. #endif // !UNICODE
  2579. #ifndef USE_FIXED_COMMIT_URL_CACHE_ENTRY
  2580. // Temporary state of affairs until we reconcile our apis.
  2581. // Why are we doing this? HeaderInfo _should_ be string data.
  2582. // However, one group is passing binary data instead. For the
  2583. // unicode api, we've decided to disallow this, but this
  2584. // brings up an inconsistency between the u and a apis, which
  2585. // is undesirable.
  2586. // For Beta 1, we'll go with this behaviour, but in future releases
  2587. // we want to make these apis consistent.
  2588. BOOLAPI CommitUrlCacheEntryA(
  2589. IN LPCSTR lpszUrlName,
  2590. IN LPCSTR lpszLocalFileName,
  2591. IN FILETIME ExpireTime,
  2592. IN FILETIME LastModifiedTime,
  2593. IN DWORD CacheEntryType,
  2594. IN LPBYTE lpHeaderInfo,
  2595. IN DWORD dwHeaderSize,
  2596. IN LPCSTR lpszFileExtension,
  2597. IN LPCSTR lpszOriginalUrl
  2598. );
  2599. BOOLAPI CommitUrlCacheEntryW(
  2600. IN LPCWSTR lpszUrlName,
  2601. IN LPCWSTR lpszLocalFileName,
  2602. IN FILETIME ExpireTime,
  2603. IN FILETIME LastModifiedTime,
  2604. IN DWORD CacheEntryType,
  2605. IN LPWSTR lpHeaderInfo,
  2606. IN DWORD dwHeaderSize,
  2607. IN LPCWSTR lpszFileExtension,
  2608. IN LPCWSTR lpszOriginalUrl
  2609. );
  2610. #ifdef UNICODE
  2611. #define CommitUrlCacheEntry CommitUrlCacheEntryW
  2612. #else
  2613. #define CommitUrlCacheEntry CommitUrlCacheEntryA
  2614. #endif
  2615. #else
  2616. CommitUrlCacheEntryA(
  2617. IN LPCSTR lpszUrlName,
  2618. IN LPCSTR lpszLocalFileName,
  2619. IN FILETIME ExpireTime,
  2620. IN FILETIME LastModifiedTime,
  2621. IN DWORD CacheEntryType,
  2622. IN LPCSTR lpHeaderInfo,
  2623. IN DWORD dwHeaderSize,
  2624. IN LPCSTR lpszFileExtension,
  2625. IN LPCSTR lpszOriginalUrl
  2626. );
  2627. CommitUrlCacheEntryW(
  2628. IN LPCWSTR lpszUrlName,
  2629. IN LPCWSTR lpszLocalFileName,
  2630. IN FILETIME ExpireTime,
  2631. IN FILETIME LastModifiedTime,
  2632. IN DWORD CacheEntryType,
  2633. IN LPCWSTR lpHeaderInfo,
  2634. IN DWORD dwHeaderSize,
  2635. IN LPCWSTR lpszFileExtension,
  2636. IN LPCWSTR lpszOriginalUrl
  2637. );
  2638. #ifdef UNICODE
  2639. #define CommitUrlCacheEntry CommitUrlCacheEntryW
  2640. #else
  2641. #define CommitUrlCacheEntry CommitUrlCacheEntryA
  2642. #endif // !UNICODE
  2643. #endif
  2644. BOOLAPI RetrieveUrlCacheEntryFileA(
  2645. IN LPCSTR lpszUrlName,
  2646. OUT LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
  2647. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize,
  2648. IN DWORD dwReserved
  2649. );
  2650. BOOLAPI RetrieveUrlCacheEntryFileW(
  2651. IN LPCWSTR lpszUrlName,
  2652. OUT LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
  2653. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize,
  2654. IN DWORD dwReserved
  2655. );
  2656. #ifdef UNICODE
  2657. #define RetrieveUrlCacheEntryFile RetrieveUrlCacheEntryFileW
  2658. #else
  2659. #define RetrieveUrlCacheEntryFile RetrieveUrlCacheEntryFileA
  2660. #endif // !UNICODE
  2661. BOOLAPI UnlockUrlCacheEntryFileA(
  2662. IN LPCSTR lpszUrlName,
  2663. IN DWORD dwReserved
  2664. );
  2665. BOOLAPI UnlockUrlCacheEntryFileW(
  2666. IN LPCWSTR lpszUrlName,
  2667. IN DWORD dwReserved
  2668. );
  2669. #ifdef UNICODE
  2670. #define UnlockUrlCacheEntryFile UnlockUrlCacheEntryFileW
  2671. #else
  2672. #ifdef _WINX32_
  2673. #define UnlockUrlCacheEntryFile UnlockUrlCacheEntryFileA
  2674. #else
  2675. BOOLAPI UnlockUrlCacheEntryFile(
  2676. IN LPCSTR lpszUrlName,
  2677. IN DWORD dwReserved
  2678. );
  2679. #endif // _WINX32_
  2680. #endif // !UNICODE
  2681. INTERNETAPI_(HANDLE) RetrieveUrlCacheEntryStreamA(
  2682. IN LPCSTR lpszUrlName,
  2683. OUT LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
  2684. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize,
  2685. IN BOOL fRandomRead,
  2686. IN DWORD dwReserved
  2687. );
  2688. INTERNETAPI_(HANDLE) RetrieveUrlCacheEntryStreamW(
  2689. IN LPCWSTR lpszUrlName,
  2690. OUT LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
  2691. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize,
  2692. IN BOOL fRandomRead,
  2693. IN DWORD dwReserved
  2694. );
  2695. #ifdef UNICODE
  2696. #define RetrieveUrlCacheEntryStream RetrieveUrlCacheEntryStreamW
  2697. #else
  2698. #define RetrieveUrlCacheEntryStream RetrieveUrlCacheEntryStreamA
  2699. #endif // !UNICODE
  2700. BOOLAPI ReadUrlCacheEntryStream(
  2701. IN HANDLE hUrlCacheStream,
  2702. IN DWORD dwLocation,
  2703. IN OUT LPVOID lpBuffer,
  2704. IN OUT LPDWORD lpdwLen,
  2705. IN DWORD Reserved
  2706. );
  2707. BOOLAPI UnlockUrlCacheEntryStream(
  2708. IN HANDLE hUrlCacheStream,
  2709. IN DWORD Reserved
  2710. );
  2711. URLCACHEAPI_(BOOL) GetUrlCacheEntryInfoA(
  2712. IN LPCSTR lpszUrlName,
  2713. OUT LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
  2714. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize
  2715. );
  2716. URLCACHEAPI_(BOOL) GetUrlCacheEntryInfoW(
  2717. IN LPCWSTR lpszUrlName,
  2718. OUT LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
  2719. IN OUT LPDWORD lpdwCacheEntryInfoBufferSize
  2720. );
  2721. #ifdef UNICODE
  2722. #define GetUrlCacheEntryInfo GetUrlCacheEntryInfoW
  2723. #else
  2724. #define GetUrlCacheEntryInfo GetUrlCacheEntryInfoA
  2725. #endif // !UNICODE
  2726. URLCACHEAPI_(HANDLE) FindFirstUrlCacheGroup(
  2727. IN DWORD dwFlags,
  2728. IN DWORD dwFilter,
  2729. IN LPVOID lpSearchCondition,
  2730. IN DWORD dwSearchCondition,
  2731. OUT GROUPID* lpGroupId,
  2732. IN OUT LPVOID lpReserved
  2733. );
  2734. URLCACHEAPI_(BOOL) FindNextUrlCacheGroup(
  2735. IN HANDLE hFind,
  2736. OUT GROUPID* lpGroupId,
  2737. IN OUT LPVOID lpReserved
  2738. );
  2739. URLCACHEAPI_(BOOL) GetUrlCacheGroupAttributeA(
  2740. IN GROUPID gid,
  2741. IN DWORD dwFlags,
  2742. IN DWORD dwAttributes,
  2743. OUT LPINTERNET_CACHE_GROUP_INFOA lpGroupInfo,
  2744. IN OUT LPDWORD lpdwGroupInfo,
  2745. IN OUT LPVOID lpReserved
  2746. );
  2747. URLCACHEAPI_(BOOL) GetUrlCacheGroupAttributeW(
  2748. IN GROUPID gid,
  2749. IN DWORD dwFlags,
  2750. IN DWORD dwAttributes,
  2751. OUT LPINTERNET_CACHE_GROUP_INFOW lpGroupInfo,
  2752. IN OUT LPDWORD lpdwGroupInfo,
  2753. IN OUT LPVOID lpReserved
  2754. );
  2755. #ifdef UNICODE
  2756. #define GetUrlCacheGroupAttribute GetUrlCacheGroupAttributeW
  2757. #else
  2758. #define GetUrlCacheGroupAttribute GetUrlCacheGroupAttributeA
  2759. #endif // !UNICODE
  2760. URLCACHEAPI_(BOOL) SetUrlCacheGroupAttributeA(
  2761. IN GROUPID gid,
  2762. IN DWORD dwFlags,
  2763. IN DWORD dwAttributes,
  2764. IN LPINTERNET_CACHE_GROUP_INFOA lpGroupInfo,
  2765. IN OUT LPVOID lpReserved
  2766. );
  2767. URLCACHEAPI_(BOOL) SetUrlCacheGroupAttributeW(
  2768. IN GROUPID gid,
  2769. IN DWORD dwFlags,
  2770. IN DWORD dwAttributes,
  2771. IN LPINTERNET_CACHE_GROUP_INFOW lpGroupInfo,
  2772. IN OUT LPVOID lpReserved
  2773. );
  2774. #ifdef UNICODE
  2775. #define SetUrlCacheGroupAttribute SetUrlCacheGroupAttributeW
  2776. #else
  2777. #define SetUrlCacheGroupAttribute SetUrlCacheGroupAttributeA
  2778. #endif // !UNICODE
  2779. INTERNETAPI_(GROUPID) CreateUrlCacheGroup(
  2780. IN DWORD dwFlags,
  2781. IN LPVOID lpReserved
  2782. );
  2783. BOOLAPI DeleteUrlCacheGroup(
  2784. IN GROUPID GroupId,
  2785. IN DWORD dwFlags,
  2786. IN LPVOID lpReserved
  2787. );
  2788. BOOLAPI GetUrlCacheEntryInfoExA(
  2789. IN LPCSTR lpszUrl,
  2790. OUT LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
  2791. IN OUT LPDWORD lpdwCacheEntryInfoBufSize,
  2792. OUT LPSTR lpszReserved, // must pass null
  2793. IN OUT LPDWORD lpdwReserved, // must pass null
  2794. LPVOID lpReserved, // must pass null
  2795. DWORD dwFlags // reserved
  2796. );
  2797. BOOLAPI GetUrlCacheEntryInfoExW(
  2798. IN LPCWSTR lpszUrl,
  2799. OUT LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
  2800. IN OUT LPDWORD lpdwCacheEntryInfoBufSize,
  2801. OUT LPWSTR lpszReserved, // must pass null
  2802. IN OUT LPDWORD lpdwReserved, // must pass null
  2803. LPVOID lpReserved, // must pass null
  2804. DWORD dwFlags // reserved
  2805. );
  2806. #ifdef UNICODE
  2807. #define GetUrlCacheEntryInfoEx GetUrlCacheEntryInfoExW
  2808. #else
  2809. #define GetUrlCacheEntryInfoEx GetUrlCacheEntryInfoExA
  2810. #endif // !UNICODE
  2811. #define CACHE_ENTRY_ATTRIBUTE_FC 0x00000004
  2812. #define CACHE_ENTRY_HITRATE_FC 0x00000010
  2813. #define CACHE_ENTRY_MODTIME_FC 0x00000040
  2814. #define CACHE_ENTRY_EXPTIME_FC 0x00000080
  2815. #define CACHE_ENTRY_ACCTIME_FC 0x00000100
  2816. #define CACHE_ENTRY_SYNCTIME_FC 0x00000200
  2817. #define CACHE_ENTRY_HEADERINFO_FC 0x00000400
  2818. #define CACHE_ENTRY_EXEMPT_DELTA_FC 0x00000800
  2819. BOOLAPI SetUrlCacheEntryInfoA(
  2820. IN LPCSTR lpszUrlName,
  2821. IN LPINTERNET_CACHE_ENTRY_INFOA lpCacheEntryInfo,
  2822. IN DWORD dwFieldControl
  2823. );
  2824. BOOLAPI SetUrlCacheEntryInfoW(
  2825. IN LPCWSTR lpszUrlName,
  2826. IN LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo,
  2827. IN DWORD dwFieldControl
  2828. );
  2829. #ifdef UNICODE
  2830. #define SetUrlCacheEntryInfo SetUrlCacheEntryInfoW
  2831. #else
  2832. #define SetUrlCacheEntryInfo SetUrlCacheEntryInfoA
  2833. #endif // !UNICODE
  2834. //
  2835. // Cache Group Functions
  2836. //
  2837. INTERNETAPI_(GROUPID) CreateUrlCacheGroup(
  2838. IN DWORD dwFlags,
  2839. IN LPVOID lpReserved // must pass NULL
  2840. );
  2841. BOOLAPI DeleteUrlCacheGroup(
  2842. IN GROUPID GroupId,
  2843. IN DWORD dwFlags, // must pass 0
  2844. IN LPVOID lpReserved // must pass NULL
  2845. );
  2846. // Flags for SetUrlCacheEntryGroup
  2847. #define INTERNET_CACHE_GROUP_ADD 0
  2848. #define INTERNET_CACHE_GROUP_REMOVE 1
  2849. BOOLAPI SetUrlCacheEntryGroupA(
  2850. IN LPCSTR lpszUrlName,
  2851. IN DWORD dwFlags,
  2852. IN GROUPID GroupId,
  2853. IN LPBYTE pbGroupAttributes, // must pass NULL
  2854. IN DWORD cbGroupAttributes, // must pass 0
  2855. IN LPVOID lpReserved // must pass NULL
  2856. );
  2857. BOOLAPI SetUrlCacheEntryGroupW(
  2858. IN LPCWSTR lpszUrlName,
  2859. IN DWORD dwFlags,
  2860. IN GROUPID GroupId,
  2861. IN LPBYTE pbGroupAttributes, // must pass NULL
  2862. IN DWORD cbGroupAttributes, // must pass 0
  2863. IN LPVOID lpReserved // must pass NULL
  2864. );
  2865. #ifdef UNICODE
  2866. #define SetUrlCacheEntryGroup SetUrlCacheEntryGroupW
  2867. #else
  2868. #ifdef _WINX32_
  2869. #define SetUrlCacheEntryGroup SetUrlCacheEntryGroupA
  2870. #else
  2871. BOOLAPI SetUrlCacheEntryGroup(
  2872. IN LPCSTR lpszUrlName,
  2873. IN DWORD dwFlags,
  2874. IN GROUPID GroupId,
  2875. IN LPBYTE pbGroupAttributes, // must pass NULL
  2876. IN DWORD cbGroupAttributes, // must pass 0
  2877. IN LPVOID lpReserved // must pass NULL
  2878. );
  2879. #endif // _WINX32_
  2880. #endif // !UNICODE
  2881. INTERNETAPI_(HANDLE) FindFirstUrlCacheEntryExA(
  2882. IN LPCSTR lpszUrlSearchPattern,
  2883. IN DWORD dwFlags,
  2884. IN DWORD dwFilter,
  2885. IN GROUPID GroupId,
  2886. OUT LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo,
  2887. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize,
  2888. OUT LPVOID lpReserved, // must pass NULL
  2889. IN OUT LPDWORD pcbReserved2, // must pass NULL
  2890. IN LPVOID lpReserved3 // must pass NULL
  2891. );
  2892. INTERNETAPI_(HANDLE) FindFirstUrlCacheEntryExW(
  2893. IN LPCWSTR lpszUrlSearchPattern,
  2894. IN DWORD dwFlags,
  2895. IN DWORD dwFilter,
  2896. IN GROUPID GroupId,
  2897. OUT LPINTERNET_CACHE_ENTRY_INFOW lpFirstCacheEntryInfo,
  2898. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize,
  2899. OUT LPVOID lpReserved, // must pass NULL
  2900. IN OUT LPDWORD pcbReserved2, // must pass NULL
  2901. IN LPVOID lpReserved3 // must pass NULL
  2902. );
  2903. #ifdef UNICODE
  2904. #define FindFirstUrlCacheEntryEx FindFirstUrlCacheEntryExW
  2905. #else
  2906. #define FindFirstUrlCacheEntryEx FindFirstUrlCacheEntryExA
  2907. #endif // !UNICODE
  2908. BOOLAPI FindNextUrlCacheEntryExA(
  2909. IN HANDLE hEnumHandle,
  2910. OUT LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo,
  2911. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize,
  2912. OUT LPVOID lpReserved, // must pass NULL
  2913. IN OUT LPDWORD pcbReserved2, // must pass NULL
  2914. IN LPVOID lpReserved3 // must pass NULL
  2915. );
  2916. BOOLAPI FindNextUrlCacheEntryExW(
  2917. IN HANDLE hEnumHandle,
  2918. OUT LPINTERNET_CACHE_ENTRY_INFOW lpFirstCacheEntryInfo,
  2919. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize,
  2920. OUT LPVOID lpReserved, // must pass NULL
  2921. IN OUT LPDWORD pcbReserved2, // must pass NULL
  2922. IN LPVOID lpReserved3 // must pass NULL
  2923. );
  2924. #ifdef UNICODE
  2925. #define FindNextUrlCacheEntryEx FindNextUrlCacheEntryExW
  2926. #else
  2927. #define FindNextUrlCacheEntryEx FindNextUrlCacheEntryExA
  2928. #endif // !UNICODE
  2929. INTERNETAPI_(HANDLE) FindFirstUrlCacheEntryA(
  2930. IN LPCSTR lpszUrlSearchPattern,
  2931. OUT LPINTERNET_CACHE_ENTRY_INFOA lpFirstCacheEntryInfo,
  2932. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize
  2933. );
  2934. INTERNETAPI_(HANDLE) FindFirstUrlCacheEntryW(
  2935. IN LPCWSTR lpszUrlSearchPattern,
  2936. OUT LPINTERNET_CACHE_ENTRY_INFOW lpFirstCacheEntryInfo,
  2937. IN OUT LPDWORD lpdwFirstCacheEntryInfoBufferSize
  2938. );
  2939. #ifdef UNICODE
  2940. #define FindFirstUrlCacheEntry FindFirstUrlCacheEntryW
  2941. #else
  2942. #define FindFirstUrlCacheEntry FindFirstUrlCacheEntryA
  2943. #endif // !UNICODE
  2944. BOOLAPI FindNextUrlCacheEntryA(
  2945. IN HANDLE hEnumHandle,
  2946. OUT LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo,
  2947. IN OUT LPDWORD lpdwNextCacheEntryInfoBufferSize
  2948. );
  2949. BOOLAPI FindNextUrlCacheEntryW(
  2950. IN HANDLE hEnumHandle,
  2951. OUT LPINTERNET_CACHE_ENTRY_INFOW lpNextCacheEntryInfo,
  2952. IN OUT LPDWORD lpdwNextCacheEntryInfoBufferSize
  2953. );
  2954. #ifdef UNICODE
  2955. #define FindNextUrlCacheEntry FindNextUrlCacheEntryW
  2956. #else
  2957. #define FindNextUrlCacheEntry FindNextUrlCacheEntryA
  2958. #endif // !UNICODE
  2959. BOOLAPI FindCloseUrlCache(
  2960. IN HANDLE hEnumHandle
  2961. );
  2962. BOOLAPI DeleteUrlCacheEntryA(
  2963. IN LPCSTR lpszUrlName
  2964. );
  2965. BOOLAPI DeleteUrlCacheEntryW(
  2966. IN LPCWSTR lpszUrlName
  2967. );
  2968. #ifdef UNICODE
  2969. #define DeleteUrlCacheEntry DeleteUrlCacheEntryW
  2970. #else
  2971. #ifdef _WINX32_
  2972. #define DeleteUrlCacheEntry DeleteUrlCacheEntryA
  2973. #else
  2974. BOOLAPI DeleteUrlCacheEntry(
  2975. IN LPCSTR lpszUrlName
  2976. );
  2977. #endif // _WINX32_
  2978. #endif // !UNICODE
  2979. //
  2980. // Autodial APIs
  2981. //
  2982. INTERNETAPI_(DWORD) InternetDialA(
  2983. IN HWND hwndParent,
  2984. IN LPSTR lpszConnectoid,
  2985. IN DWORD dwFlags,
  2986. OUT DWORD_PTR *lpdwConnection,
  2987. IN DWORD dwReserved
  2988. );
  2989. INTERNETAPI_(DWORD) InternetDialW(
  2990. IN HWND hwndParent,
  2991. IN LPWSTR lpszConnectoid,
  2992. IN DWORD dwFlags,
  2993. OUT DWORD_PTR *lpdwConnection,
  2994. IN DWORD dwReserved
  2995. );
  2996. #ifdef UNICODE
  2997. #define InternetDial InternetDialW
  2998. #else
  2999. #ifdef _WINX32_
  3000. #define InternetDial InternetDialA
  3001. #else
  3002. INTERNETAPI_(DWORD) InternetDial(
  3003. IN HWND hwndParent,
  3004. IN LPSTR lpszConnectoid,
  3005. IN DWORD dwFlags,
  3006. OUT LPDWORD lpdwConnection,
  3007. IN DWORD dwReserved
  3008. );
  3009. #endif // _WINX32_
  3010. #endif // !UNICODE
  3011. // Flags for InternetDial - must not conflict with InternetAutodial flags
  3012. // as they are valid here also.
  3013. #define INTERNET_DIAL_FORCE_PROMPT 0x2000
  3014. #define INTERNET_DIAL_SHOW_OFFLINE 0x4000
  3015. #define INTERNET_DIAL_UNATTENDED 0x8000
  3016. INTERNETAPI_(DWORD) InternetHangUp(
  3017. IN DWORD_PTR dwConnection,
  3018. IN DWORD dwReserved);
  3019. #define INTERENT_GOONLINE_REFRESH 0x00000001
  3020. #define INTERENT_GOONLINE_MASK 0x00000001
  3021. INTERNETAPI_(BOOL) InternetGoOnlineA(
  3022. IN LPSTR lpszURL,
  3023. IN HWND hwndParent,
  3024. IN DWORD dwFlags
  3025. );
  3026. INTERNETAPI_(BOOL) InternetGoOnlineW(
  3027. IN LPWSTR lpszURL,
  3028. IN HWND hwndParent,
  3029. IN DWORD dwFlags
  3030. );
  3031. #ifdef UNICODE
  3032. #define InternetGoOnline InternetGoOnlineW
  3033. #else
  3034. #ifdef _WINX32_
  3035. #define InternetGoOnline InternetGoOnlineA
  3036. #else
  3037. INTERNETAPI_(BOOL) InternetGoOnline(
  3038. IN LPSTR lpszURL,
  3039. IN HWND hwndParent,
  3040. IN DWORD dwFlags
  3041. );
  3042. #endif // _WINX32_
  3043. #endif // !UNICODE
  3044. INTERNETAPI_(BOOL) InternetAutodial(
  3045. IN DWORD dwFlags,
  3046. IN HWND hwndParent);
  3047. // Flags for InternetAutodial
  3048. #define INTERNET_AUTODIAL_FORCE_ONLINE 1
  3049. #define INTERNET_AUTODIAL_FORCE_UNATTENDED 2
  3050. #define INTERNET_AUTODIAL_FAILIFSECURITYCHECK 4
  3051. #define INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT 8
  3052. #define INTERNET_AUTODIAL_FLAGS_MASK (INTERNET_AUTODIAL_FORCE_ONLINE | INTERNET_AUTODIAL_FORCE_UNATTENDED | INTERNET_AUTODIAL_FAILIFSECURITYCHECK | INTERNET_AUTODIAL_OVERRIDE_NET_PRESENT)
  3053. INTERNETAPI_(BOOL) InternetAutodialHangup(
  3054. IN DWORD dwReserved);
  3055. INTERNETAPI_(BOOL) InternetGetConnectedState(
  3056. OUT LPDWORD lpdwFlags,
  3057. IN DWORD dwReserved);
  3058. INTERNETAPI_(BOOL) InternetGetConnectedStateExA(
  3059. OUT LPDWORD lpdwFlags,
  3060. OUT LPSTR lpszConnectionName,
  3061. IN DWORD dwNameLen,
  3062. IN DWORD dwReserved
  3063. );
  3064. INTERNETAPI_(BOOL) InternetGetConnectedStateExW(
  3065. OUT LPDWORD lpdwFlags,
  3066. OUT LPWSTR lpszConnectionName,
  3067. IN DWORD dwNameLen,
  3068. IN DWORD dwReserved
  3069. );
  3070. #define PROXY_AUTO_DETECT_TYPE_DHCP 1
  3071. #define PROXY_AUTO_DETECT_TYPE_DNS_A 2
  3072. struct AutoProxyHelperFunctions;
  3073. typedef struct AutoProxyHelperVtbl
  3074. {
  3075. BOOL ( __stdcall *IsResolvable )(
  3076. LPSTR lpszHost);
  3077. DWORD ( __stdcall *GetIPAddress )(
  3078. LPSTR lpszIPAddress,
  3079. LPDWORD lpdwIPAddressSize);
  3080. DWORD ( __stdcall *ResolveHostName )(
  3081. LPSTR lpszHostName,
  3082. LPSTR lpszIPAddress,
  3083. LPDWORD lpdwIPAddressSize);
  3084. BOOL ( __stdcall *IsInNet )(
  3085. LPSTR lpszIPAddress,
  3086. LPSTR lpszDest,
  3087. LPSTR lpszMask);
  3088. }AutoProxyHelperVtbl;
  3089. typedef struct
  3090. {
  3091. DWORD dwStructSize; // Size of struct
  3092. LPSTR lpszScriptBuffer; // Buffer to Pass
  3093. DWORD dwScriptBufferSize; // Size of buffer above
  3094. } AUTO_PROXY_SCRIPT_BUFFER, *LPAUTO_PROXY_SCRIPT_BUFFER;
  3095. typedef struct AutoProxyHelperFunctions
  3096. {
  3097. const struct AutoProxyHelperVtbl * lpVtbl;
  3098. } AutoProxyHelperFunctions;
  3099. typedef BOOL ( CALLBACK *pfnInternetInitializeAutoProxyDll)(DWORD dwVersion,
  3100. LPSTR lpszDownloadedTempFile,
  3101. LPSTR lpszMime,
  3102. AutoProxyHelperFunctions* lpAutoProxyCallbacks,
  3103. LPAUTO_PROXY_SCRIPT_BUFFER lpAutoProxyScriptBuffer );
  3104. typedef BOOL (CALLBACK *pfnInternetDeInitializeAutoProxyDll)(LPSTR lpszMime,
  3105. DWORD dwReserved);
  3106. typedef BOOL (CALLBACK *pfnInternetGetProxyInfo)(LPCSTR lpszUrl,
  3107. DWORD dwUrlLength,
  3108. LPSTR lpszUrlHostName,
  3109. DWORD dwUrlHostNameLength,
  3110. LPSTR* lplpszProxyHostName,
  3111. LPDWORD lpdwProxyHostNameLength);
  3112. INTERNETAPI_(BOOL) InternetInitializeAutoProxyDll(
  3113. DWORD dwReserved
  3114. );
  3115. INTERNETAPI_(BOOL) DetectAutoProxyUrl(
  3116. IN OUT LPSTR lpszAutoProxyUrl,
  3117. IN DWORD dwAutoProxyUrlLength,
  3118. IN DWORD dwDetectFlags
  3119. );
  3120. INTERNETAPI_(BOOL) CreateMD5SSOHash (
  3121. IN PWSTR pszChallengeInfo,
  3122. IN PWSTR pwszRealm,
  3123. IN PWSTR pwszTarget,
  3124. OUT PBYTE pbHexHash
  3125. );
  3126. #ifdef UNICODE
  3127. #define InternetGetConnectedStateEx InternetGetConnectedStateExW
  3128. #else
  3129. #ifdef _WINX32_
  3130. #define InternetGetConnectedStateEx InternetGetConnectedStateExA
  3131. #else
  3132. INTERNETAPI_(BOOL) InternetGetConnectedStateEx(
  3133. OUT LPDWORD lpdwFlags,
  3134. IN LPSTR lpszConnectionName,
  3135. IN DWORD dwNameLen,
  3136. IN DWORD dwReserved
  3137. );
  3138. #endif // _WINX32_
  3139. #endif // !UNICODE
  3140. // Flags for InternetGetConnectedState and Ex
  3141. #define INTERNET_CONNECTION_MODEM 0x01
  3142. #define INTERNET_CONNECTION_LAN 0x02
  3143. #define INTERNET_CONNECTION_PROXY 0x04
  3144. #define INTERNET_CONNECTION_MODEM_BUSY 0x08 /* no longer used */
  3145. #define INTERNET_RAS_INSTALLED 0x10
  3146. #define INTERNET_CONNECTION_OFFLINE 0x20
  3147. #define INTERNET_CONNECTION_CONFIGURED 0x40
  3148. //
  3149. // Custom dial handler functions
  3150. //
  3151. // Custom dial handler prototype
  3152. typedef DWORD (CALLBACK * PFN_DIAL_HANDLER) (HWND, LPCSTR, DWORD, LPDWORD);
  3153. // Flags for custom dial handler
  3154. #define INTERNET_CUSTOMDIAL_CONNECT 0
  3155. #define INTERNET_CUSTOMDIAL_UNATTENDED 1
  3156. #define INTERNET_CUSTOMDIAL_DISCONNECT 2
  3157. #define INTERNET_CUSTOMDIAL_SHOWOFFLINE 4
  3158. // Custom dial handler supported functionality flags
  3159. #define INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED 1
  3160. #define INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE 2
  3161. #define INTERNET_CUSTOMDIAL_CAN_HANGUP 4
  3162. INTERNETAPI_(BOOL) InternetSetDialStateA(
  3163. IN LPCSTR lpszConnectoid,
  3164. IN DWORD dwState,
  3165. IN DWORD dwReserved
  3166. );
  3167. INTERNETAPI_(BOOL) InternetSetDialStateW(
  3168. IN LPCWSTR lpszConnectoid,
  3169. IN DWORD dwState,
  3170. IN DWORD dwReserved
  3171. );
  3172. #ifdef UNICODE
  3173. #define InternetSetDialState InternetSetDialStateW
  3174. #else
  3175. #ifdef _WINX32_
  3176. #define InternetSetDialState InternetSetDialStateA
  3177. #else
  3178. INTERNETAPI_(BOOL) InternetSetDialState(
  3179. IN LPCSTR lpszConnectoid,
  3180. IN DWORD dwState,
  3181. IN DWORD dwReserved
  3182. );
  3183. #endif // _WINX32_
  3184. #endif // !UNICODE
  3185. // States for InternetSetDialState
  3186. #define INTERNET_DIALSTATE_DISCONNECTED 1
  3187. INTERNETAPI_(BOOL) InternetSetPerSiteCookieDecisionA( IN LPCSTR pchHostName, DWORD dwDecision);
  3188. INTERNETAPI_(BOOL) InternetSetPerSiteCookieDecisionW( IN LPCWSTR pchHostName, DWORD dwDecision);
  3189. #ifdef UNICODE
  3190. #define InternetSetPerSiteCookieDecision InternetSetPerSiteCookieDecisionW
  3191. #else
  3192. #define InternetSetPerSiteCookieDecision InternetSetPerSiteCookieDecisionA
  3193. #endif // !UNICODE
  3194. INTERNETAPI_(BOOL) InternetGetPerSiteCookieDecisionA( IN LPCSTR pchHostName, unsigned long* pResult);
  3195. INTERNETAPI_(BOOL) InternetGetPerSiteCookieDecisionW( IN LPCWSTR pchHostName, unsigned long* pResult);
  3196. #ifdef UNICODE
  3197. #define InternetGetPerSiteCookieDecision InternetGetPerSiteCookieDecisionW
  3198. #else
  3199. #define InternetGetPerSiteCookieDecision InternetGetPerSiteCookieDecisionA
  3200. #endif // !UNICODE
  3201. INTERNETAPI_(BOOL) InternetClearAllPerSiteCookieDecisions();
  3202. INTERNETAPI_(BOOL) InternetEnumPerSiteCookieDecisionA(OUT LPSTR pszSiteName, IN OUT unsigned long *pcSiteNameSize, OUT unsigned long *pdwDecision, IN unsigned long dwIndex);
  3203. INTERNETAPI_(BOOL) InternetEnumPerSiteCookieDecisionW(OUT LPWSTR pszSiteName, IN OUT unsigned long *pcSiteNameSize, OUT unsigned long *pdwDecision, IN unsigned long dwIndex);
  3204. #ifdef UNICODE
  3205. #define InternetEnumPerSiteCookieDecision InternetEnumPerSiteCookieDecisionW
  3206. #else
  3207. #define InternetEnumPerSiteCookieDecision InternetEnumPerSiteCookieDecisionA
  3208. #endif // !UNICODE
  3209. #define INTERNET_IDENTITY_FLAG_PRIVATE_CACHE 0x01
  3210. #define INTERNET_IDENTITY_FLAG_SHARED_CACHE 0x02
  3211. #define INTERNET_IDENTITY_FLAG_CLEAR_DATA 0x04
  3212. #define INTERNET_IDENTITY_FLAG_CLEAR_COOKIES 0x08
  3213. #define INTERNET_IDENTITY_FLAG_CLEAR_HISTORY 0x10
  3214. #define INTERNET_IDENTITY_FLAG_CLEAR_CONTENT 0x20
  3215. #define INTERNET_SUPPRESS_RESET_ALL 0x00
  3216. #define INTERNET_SUPPRESS_COOKIE_POLICY 0x01
  3217. #define INTERNET_SUPPRESS_COOKIE_POLICY_RESET 0x02
  3218. //
  3219. // Privacy settings values and APIs
  3220. //
  3221. #define PRIVACY_TEMPLATE_NO_COOKIES 0
  3222. #define PRIVACY_TEMPLATE_HIGH 1
  3223. #define PRIVACY_TEMPLATE_MEDIUM_HIGH 2
  3224. #define PRIVACY_TEMPLATE_MEDIUM 3
  3225. #define PRIVACY_TEMPLATE_MEDIUM_LOW 4
  3226. #define PRIVACY_TEMPLATE_LOW 5
  3227. #define PRIVACY_TEMPLATE_CUSTOM 100
  3228. #define PRIVACY_TEMPLATE_ADVANCED 101
  3229. #define PRIVACY_TEMPLATE_MAX PRIVACY_TEMPLATE_LOW
  3230. #define PRIVACY_TYPE_FIRST_PARTY 0
  3231. #define PRIVACY_TYPE_THIRD_PARTY 1
  3232. INTERNETAPI_(DWORD)
  3233. PrivacySetZonePreferenceW(
  3234. DWORD dwZone,
  3235. DWORD dwType,
  3236. DWORD dwTemplate,
  3237. LPCWSTR pszPreference
  3238. );
  3239. INTERNETAPI_(DWORD)
  3240. PrivacyGetZonePreferenceW(
  3241. DWORD dwZone,
  3242. DWORD dwType,
  3243. LPDWORD pdwTemplate,
  3244. LPWSTR pszBuffer,
  3245. LPDWORD pdwBufferLength
  3246. );
  3247. #if defined(__cplusplus)
  3248. }
  3249. #endif
  3250. /*
  3251. * Return packing to whatever it was before we
  3252. * entered this file
  3253. */
  3254. #include <poppack.h>
  3255. #endif // !defined(_WININET_)