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.

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