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.

401 lines
17 KiB

  1. // Stuff removed from public header file...
  2. #define INTERNET_DEFAULT_SOCKS_PORT 1080 // default for SOCKS firewall servers.
  3. // maximum field lengths (arbitrary)
  4. // NOTE: if these are put back in the public header, rename them to WINHTTP_.
  5. #define INTERNET_MAX_HOST_NAME_LENGTH 256
  6. #define INTERNET_MAX_USER_NAME_LENGTH 128
  7. #define INTERNET_MAX_PASSWORD_LENGTH 128
  8. #define INTERNET_MAX_REALM_LENGTH 128
  9. #define INTERNET_MAX_PORT_NUMBER_LENGTH 5 // INTERNET_PORT is unsigned short
  10. #define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
  11. // This is a bogus limit we should get rid of.
  12. #define INTERNET_MAX_PATH_LENGTH 2048
  13. #define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH \
  14. + sizeof("://") \
  15. + INTERNET_MAX_PATH_LENGTH)
  16. // INTERNET_DIAGNOSTIC_SOCKET_INFO - info about the socket in use
  17. // (diagnostic purposes only, hence internal)
  18. typedef struct {
  19. DWORD_PTR Socket;
  20. DWORD SourcePort;
  21. DWORD DestPort;
  22. DWORD Flags;
  23. } INTERNET_DIAGNOSTIC_SOCKET_INFO, * LPINTERNET_DIAGNOSTIC_SOCKET_INFO;
  24. //
  25. // INTERNET_DIAGNOSTIC_SOCKET_INFO.Flags definitions
  26. //
  27. #define IDSI_FLAG_KEEP_ALIVE 0x00000001 // set if from keep-alive pool
  28. #define IDSI_FLAG_SECURE 0x00000002 // set if secure connection
  29. #define IDSI_FLAG_PROXY 0x00000004 // set if using proxy
  30. #define IDSI_FLAG_TUNNEL 0x00000008 // set if tunnelling through proxy
  31. #ifdef __WINCRYPT_H__
  32. #ifdef ALGIDDEF
  33. //
  34. // INTERNET_SECURITY_INFO - contains information about certificate
  35. // and encryption settings for a connection.
  36. //
  37. #define INTERNET_SECURITY_INFO_DEFINED
  38. typedef WINHTTP_CERTIFICATE_INFO INTERNET_CERTIFICATE_INFO;
  39. typedef WINHTTP_CERTIFICATE_INFO* LPINTERNET_CERTIFICATE_INFO;
  40. typedef struct {
  41. //
  42. // dwSize - Size of INTERNET_SECURITY_INFO structure.
  43. //
  44. DWORD dwSize;
  45. //
  46. // pCertificate - Cert context pointing to leaf of certificate chain.
  47. //
  48. PCCERT_CONTEXT pCertificate;
  49. //
  50. // Start SecPkgContext_ConnectionInfo
  51. // The following members must match those
  52. // of the SecPkgContext_ConnectionInfo
  53. // sspi structure (schnlsp.h)
  54. //
  55. //
  56. // dwProtocol - Protocol that this connection was made with
  57. // (PCT, SSL2, SSL3, etc)
  58. //
  59. DWORD dwProtocol;
  60. //
  61. // aiCipher - Cipher that this connection as made with
  62. //
  63. ALG_ID aiCipher;
  64. //
  65. // dwCipherStrength - Strength (in bits) that this connection
  66. // was made with;
  67. //
  68. DWORD dwCipherStrength;
  69. //
  70. // aiHash - Hash that this connection as made with
  71. //
  72. ALG_ID aiHash;
  73. //
  74. // dwHashStrength - Strength (in bits) that this connection
  75. // was made with;
  76. //
  77. DWORD dwHashStrength;
  78. //
  79. // aiExch - Key Exchange type that this connection as made with
  80. //
  81. ALG_ID aiExch;
  82. //
  83. // dwExchStrength - Strength (in bits) that this connection
  84. // was made with;
  85. //
  86. DWORD dwExchStrength;
  87. } INTERNET_SECURITY_INFO, * LPINTERNET_SECURITY_INFO;
  88. typedef struct {
  89. //
  90. // dwSize - size of INTERNET_SECURITY_CONNECTION_INFO
  91. //
  92. DWORD dwSize;
  93. // fSecure - Is this a secure connection.
  94. BOOL fSecure;
  95. //
  96. // dwProtocol - Protocol that this connection was made with
  97. // (PCT, SSL2, SSL3, etc)
  98. //
  99. DWORD dwProtocol;
  100. //
  101. // aiCipher - Cipher that this connection as made with
  102. //
  103. ALG_ID aiCipher;
  104. //
  105. // dwCipherStrength - Strength (in bits) that this connection
  106. // was made with;
  107. //
  108. DWORD dwCipherStrength;
  109. //
  110. // aiHash - Hash that this connection as made with
  111. //
  112. ALG_ID aiHash;
  113. //
  114. // dwHashStrength - Strength (in bits) that this connection
  115. // was made with;
  116. //
  117. DWORD dwHashStrength;
  118. //
  119. // aiExch - Key Exchange type that this connection as made with
  120. //
  121. ALG_ID aiExch;
  122. //
  123. // dwExchStrength - Strength (in bits) that this connection
  124. // was made with;
  125. //
  126. DWORD dwExchStrength;
  127. } INTERNET_SECURITY_CONNECTION_INFO , * LPINTERNET_SECURITY_CONNECTION_INFO;
  128. #endif // ALGIDDEF
  129. #endif // __WINCRYPT_H__
  130. BOOLAPI
  131. InternetDebugGetLocalTime(
  132. OUT SYSTEMTIME * pstLocalTime,
  133. OUT DWORD * pdwReserved
  134. );
  135. #define INTERNET_SERVICE_HTTP 3
  136. // flags for InternetReadFileEx()
  137. #define IRF_NO_WAIT 0x00000008
  138. BOOLAPI
  139. InternetGetLastResponseInfo(
  140. OUT LPDWORD lpdwError,
  141. OUT LPWSTR lpszBuffer OPTIONAL,
  142. IN OUT LPDWORD lpdwBufferLength
  143. );
  144. #ifdef UNICODE
  145. #define InternetGetLastResponseInfo InternetGetLastResponseInfoW
  146. #endif // !UNICODE
  147. typedef struct _INTERNET_COOKIE {
  148. DWORD cbSize;
  149. LPSTR pszName;
  150. LPSTR pszData;
  151. LPSTR pszDomain;
  152. LPSTR pszPath;
  153. FILETIME *pftExpires;
  154. DWORD dwFlags;
  155. LPSTR pszUrl;
  156. } INTERNET_COOKIE, *PINTERNET_COOKIE;
  157. #define INTERNET_COOKIE_IS_SECURE 0x01
  158. #define INTERNET_COOKIE_IS_SESSION 0x02
  159. //
  160. // internal error codes that are used to communicate specific information inside
  161. // of Wininet but which are meaningless at the interface
  162. //
  163. #define INTERNET_INTERNAL_ERROR_BASE (WINHTTP_ERROR_BASE + 900)
  164. //
  165. // INTERNET_PER_CONN_OPTION_LIST - set per-connection options such as proxy
  166. // and autoconfig info
  167. //
  168. // Set and queried using WinHttp[Set|Query]Option with
  169. // INTERNET_OPTION_PER_CONNECTION_OPTION
  170. //
  171. typedef struct
  172. {
  173. DWORD dwOption; // option to be queried or set
  174. union
  175. {
  176. DWORD dwValue; // dword value for the option
  177. LPWSTR pszValue; // pointer to string value for the option
  178. FILETIME ftValue; // file-time value for the option
  179. } Value;
  180. } INTERNET_PER_CONN_OPTIONW, * LPINTERNET_PER_CONN_OPTIONW;
  181. #ifdef UNICODE
  182. typedef INTERNET_PER_CONN_OPTIONW INTERNET_PER_CONN_OPTION;
  183. typedef LPINTERNET_PER_CONN_OPTIONW LPINTERNET_PER_CONN_OPTION;
  184. #endif // UNICODE
  185. typedef struct
  186. {
  187. DWORD dwSize; // size of the INTERNET_PER_CONN_OPTION_LIST struct
  188. LPWSTR pszConnection; // connection name to set/query options
  189. DWORD dwOptionCount; // number of options to set/query
  190. DWORD dwOptionError; // on error, which option failed
  191. LPINTERNET_PER_CONN_OPTIONW pOptions;
  192. // array of options to set/query
  193. } INTERNET_PER_CONN_OPTION_LISTW, * LPINTERNET_PER_CONN_OPTION_LISTW;
  194. #ifdef UNICODE
  195. typedef INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LIST;
  196. typedef LPINTERNET_PER_CONN_OPTION_LISTW LPINTERNET_PER_CONN_OPTION_LIST;
  197. #endif // UNICODE
  198. //
  199. // Options used in INTERNET_PER_CONN_OPTON struct
  200. //
  201. #define INTERNET_PER_CONN_FLAGS 1
  202. #define INTERNET_PER_CONN_PROXY_SERVER 2
  203. #define INTERNET_PER_CONN_PROXY_BYPASS 3
  204. #define INTERNET_PER_CONN_AUTOCONFIG_URL 4
  205. #define INTERNET_PER_CONN_AUTODISCOVERY_FLAGS 5
  206. #define INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL 6
  207. #define INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS 7
  208. #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME 8
  209. #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL 9
  210. //
  211. // PER_CONN_FLAGS
  212. //
  213. #define PROXY_TYPE_DIRECT 0x00000001 // direct to net
  214. #define PROXY_TYPE_PROXY 0x00000002 // via named proxy
  215. #define PROXY_TYPE_AUTO_PROXY_URL 0x00000004 // autoproxy URL
  216. #define PROXY_TYPE_AUTO_DETECT 0x00000008 // use autoproxy detection
  217. #define INTERNET_OPEN_TYPE_DIRECT WINHTTP_ACCESS_TYPE_NO_PROXY
  218. #define INTERNET_OPEN_TYPE_PROXY WINHTTP_ACCESS_TYPE_NAMED_PROXY
  219. #define INTERNET_OPEN_TYPE_PRECONFIG WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
  220. #define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
  221. typedef HTTP_VERSION_INFO INTERNET_VERSION_INFO;
  222. typedef HTTP_VERSION_INFO* LPINTERNET_VERSION_INFO;
  223. #define ERROR_HTTP_HEADER_NOT_FOUND ERROR_WINHTTP_HEADER_NOT_FOUND
  224. #define ERROR_HTTP_INVALID_SERVER_RESPONSE ERROR_WINHTTP_INVALID_SERVER_RESPONSE
  225. #define ERROR_HTTP_INVALID_QUERY_REQUEST ERROR_WINHTTP_INVALID_QUERY_REQUEST
  226. #define ERROR_HTTP_HEADER_ALREADY_EXISTS ERROR_WINHTTP_HEADER_ALREADY_EXISTS
  227. #define ERROR_HTTP_REDIRECT_FAILED ERROR_WINHTTP_REDIRECT_FAILED
  228. #define ERROR_HTTP_NOT_REDIRECTED ERROR_WINHTTP_NOT_REDIRECTED
  229. #define INTERNET_INVALID_PORT_NUMBER INTERNET_DEFAULT_PORT // use the protocol-specific default
  230. #define HTTP_ADDREQ_INDEX_MASK WINHTTP_ADDREQ_INDEX_MASK
  231. #define HTTP_ADDREQ_FLAGS_MASK WINHTTP_ADDREQ_FLAGS_MASK
  232. #define HTTP_ADDREQ_FLAG_ADD_IF_NEW WINHTTP_ADDREQ_FLAG_ADD_IF_NEW
  233. #define HTTP_ADDREQ_FLAG_ADD WINHTTP_ADDREQ_FLAG_ADD
  234. #define HTTP_ADDREQ_FLAG_REPLACE WINHTTP_ADDREQ_FLAG_REPLACE
  235. #define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
  236. #define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON
  237. #define HTTP_ADDREQ_FLAG_COALESCE WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
  238. #define HTTP_QUERY_MIME_VERSION WINHTTP_QUERY_MIME_VERSION
  239. #define HTTP_QUERY_CONTENT_TYPE WINHTTP_QUERY_CONTENT_TYPE
  240. #define HTTP_QUERY_CONTENT_TRANSFER_ENCODING WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING
  241. #define HTTP_QUERY_CONTENT_ID WINHTTP_QUERY_CONTENT_ID
  242. #define HTTP_QUERY_CONTENT_DESCRIPTION WINHTTP_QUERY_CONTENT_DESCRIPTION
  243. #define HTTP_QUERY_CONTENT_LENGTH WINHTTP_QUERY_CONTENT_LENGTH
  244. #define HTTP_QUERY_CONTENT_LANGUAGE WINHTTP_QUERY_CONTENT_LANGUAGE
  245. #define HTTP_QUERY_ALLOW WINHTTP_QUERY_ALLOW
  246. #define HTTP_QUERY_PUBLIC WINHTTP_QUERY_PUBLIC
  247. #define HTTP_QUERY_DATE WINHTTP_QUERY_DATE
  248. #define HTTP_QUERY_EXPIRES WINHTTP_QUERY_EXPIRES
  249. #define HTTP_QUERY_LAST_MODIFIED WINHTTP_QUERY_LAST_MODIFIED
  250. #define HTTP_QUERY_MESSAGE_ID WINHTTP_QUERY_MESSAGE_ID
  251. #define HTTP_QUERY_URI WINHTTP_QUERY_URI
  252. #define HTTP_QUERY_DERIVED_FROM WINHTTP_QUERY_DERIVED_FROM
  253. #define HTTP_QUERY_COST WINHTTP_QUERY_COST
  254. #define HTTP_QUERY_LINK WINHTTP_QUERY_LINK
  255. #define HTTP_QUERY_PRAGMA WINHTTP_QUERY_PRAGMA
  256. #define HTTP_QUERY_VERSION WINHTTP_QUERY_VERSION
  257. #define HTTP_QUERY_STATUS_CODE WINHTTP_QUERY_STATUS_CODE
  258. #define HTTP_QUERY_STATUS_TEXT WINHTTP_QUERY_STATUS_TEXT
  259. #define HTTP_QUERY_RAW_HEADERS WINHTTP_QUERY_RAW_HEADERS
  260. #define HTTP_QUERY_RAW_HEADERS_CRLF WINHTTP_QUERY_RAW_HEADERS_CRLF
  261. #define HTTP_QUERY_CONNECTION WINHTTP_QUERY_CONNECTION
  262. #define HTTP_QUERY_ACCEPT WINHTTP_QUERY_ACCEPT
  263. #define HTTP_QUERY_ACCEPT_CHARSET WINHTTP_QUERY_ACCEPT_CHARSET
  264. #define HTTP_QUERY_ACCEPT_ENCODING WINHTTP_QUERY_ACCEPT_ENCODING
  265. #define HTTP_QUERY_ACCEPT_LANGUAGE WINHTTP_QUERY_ACCEPT_LANGUAGE
  266. #define HTTP_QUERY_AUTHORIZATION WINHTTP_QUERY_AUTHORIZATION
  267. #define HTTP_QUERY_CONTENT_ENCODING WINHTTP_QUERY_CONTENT_ENCODING
  268. #define HTTP_QUERY_FORWARDED WINHTTP_QUERY_FORWARDED
  269. #define HTTP_QUERY_FROM WINHTTP_QUERY_FROM
  270. #define HTTP_QUERY_IF_MODIFIED_SINCE WINHTTP_QUERY_IF_MODIFIED_SINCE
  271. #define HTTP_QUERY_LOCATION WINHTTP_QUERY_LOCATION
  272. #define HTTP_QUERY_ORIG_URI WINHTTP_QUERY_ORIG_URI
  273. #define HTTP_QUERY_REFERER WINHTTP_QUERY_REFERER
  274. #define HTTP_QUERY_RETRY_AFTER WINHTTP_QUERY_RETRY_AFTER
  275. #define HTTP_QUERY_SERVER WINHTTP_QUERY_SERVER
  276. #define HTTP_QUERY_TITLE WINHTTP_QUERY_TITLE
  277. #define HTTP_QUERY_USER_AGENT WINHTTP_QUERY_USER_AGENT
  278. #define HTTP_QUERY_WWW_AUTHENTICATE WINHTTP_QUERY_WWW_AUTHENTICATE
  279. #define HTTP_QUERY_PROXY_AUTHENTICATE WINHTTP_QUERY_PROXY_AUTHENTICATE
  280. #define HTTP_QUERY_ACCEPT_RANGES WINHTTP_QUERY_ACCEPT_RANGES
  281. #define HTTP_QUERY_SET_COOKIE WINHTTP_QUERY_SET_COOKIE
  282. #define HTTP_QUERY_COOKIE WINHTTP_QUERY_COOKIE
  283. #define HTTP_QUERY_REQUEST_METHOD WINHTTP_QUERY_REQUEST_METHOD
  284. #define HTTP_QUERY_REFRESH WINHTTP_QUERY_REFRESH
  285. #define HTTP_QUERY_CONTENT_DISPOSITION WINHTTP_QUERY_CONTENT_DISPOSITION
  286. #define HTTP_QUERY_AGE WINHTTP_QUERY_AGE
  287. #define HTTP_QUERY_CACHE_CONTROL WINHTTP_QUERY_CACHE_CONTROL
  288. #define HTTP_QUERY_CONTENT_BASE WINHTTP_QUERY_CONTENT_BASE
  289. #define HTTP_QUERY_CONTENT_LOCATION WINHTTP_QUERY_CONTENT_LOCATION
  290. #define HTTP_QUERY_CONTENT_MD5 WINHTTP_QUERY_CONTENT_MD5
  291. #define HTTP_QUERY_CONTENT_RANGE WINHTTP_QUERY_CONTENT_RANGE
  292. #define HTTP_QUERY_ETAG WINHTTP_QUERY_ETAG
  293. #define HTTP_QUERY_HOST WINHTTP_QUERY_HOST
  294. #define HTTP_QUERY_IF_MATCH WINHTTP_QUERY_IF_MATCH
  295. #define HTTP_QUERY_IF_NONE_MATCH WINHTTP_QUERY_IF_NONE_MATCH
  296. #define HTTP_QUERY_IF_RANGE WINHTTP_QUERY_IF_RANGE
  297. #define HTTP_QUERY_IF_UNMODIFIED_SINCE WINHTTP_QUERY_IF_UNMODIFIED_SINCE
  298. #define HTTP_QUERY_MAX_FORWARDS WINHTTP_QUERY_MAX_FORWARDS
  299. #define HTTP_QUERY_PROXY_AUTHORIZATION WINHTTP_QUERY_PROXY_AUTHORIZATION
  300. #define HTTP_QUERY_RANGE WINHTTP_QUERY_RANGE
  301. #define HTTP_QUERY_TRANSFER_ENCODING WINHTTP_QUERY_TRANSFER_ENCODING
  302. #define HTTP_QUERY_UPGRADE WINHTTP_QUERY_UPGRADE
  303. #define HTTP_QUERY_VARY WINHTTP_QUERY_VARY
  304. #define HTTP_QUERY_VIA WINHTTP_QUERY_VIA
  305. #define HTTP_QUERY_WARNING WINHTTP_QUERY_WARNING
  306. #define HTTP_QUERY_EXPECT WINHTTP_QUERY_EXPECT
  307. #define HTTP_QUERY_PROXY_CONNECTION WINHTTP_QUERY_PROXY_CONNECTION
  308. #define HTTP_QUERY_UNLESS_MODIFIED_SINCE WINHTTP_QUERY_UNLESS_MODIFIED_SINCE
  309. #define HTTP_QUERY_ECHO_REQUEST WINHTTP_QUERY_ECHO_REQUEST
  310. #define HTTP_QUERY_ECHO_REPLY WINHTTP_QUERY_ECHO_REPLY
  311. #define HTTP_QUERY_ECHO_HEADERS WINHTTP_QUERY_ECHO_HEADERS
  312. #define HTTP_QUERY_ECHO_HEADERS_CRLF WINHTTP_QUERY_ECHO_HEADERS_CRLF
  313. #define HTTP_QUERY_PROXY_SUPPORT WINHTTP_QUERY_PROXY_SUPPORT
  314. #define HTTP_QUERY_AUTHENTICATION_INFO WINHTTP_QUERY_AUTHENTICATION_INFO
  315. #define HTTP_QUERY_MAX WINHTTP_QUERY_MAX
  316. #define HTTP_QUERY_CUSTOM WINHTTP_QUERY_CUSTOM
  317. #define HTTP_QUERY_FLAG_REQUEST_HEADERS WINHTTP_QUERY_FLAG_REQUEST_HEADERS
  318. #define HTTP_QUERY_FLAG_SYSTEMTIME WINHTTP_QUERY_FLAG_SYSTEMTIME
  319. #define HTTP_QUERY_FLAG_NUMBER WINHTTP_QUERY_FLAG_NUMBER
  320. #define ERROR_WINHTTP_FORCE_RETRY ERROR_WINHTTP_RESEND_REQUEST