2 * Copyright (C) 2007 Francois Gouget
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_WINHTTP_H
20 #define __WINE_WINHTTP_H
23 #define BOOLAPI WINHTTPAPI BOOL WINAPI
26 typedef LPVOID HINTERNET
;
27 typedef HINTERNET
*LPHINTERNET
;
29 #define INTERNET_DEFAULT_PORT 0
30 #define INTERNET_DEFAULT_HTTP_PORT 80
31 #define INTERNET_DEFAULT_HTTPS_PORT 443
32 typedef WORD INTERNET_PORT
;
33 typedef INTERNET_PORT
*LPINTERNET_PORT
;
35 #define INTERNET_SCHEME_HTTP 1
36 #define INTERNET_SCHEME_HTTPS 2
37 typedef int INTERNET_SCHEME
, *LPINTERNET_SCHEME
;
39 /* flags for WinHttpOpen */
40 #define WINHTTP_FLAG_ASYNC 0x10000000
42 /* flags for WinHttpOpenRequest */
43 #define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004
44 #define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008
45 #define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040
46 #define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080
47 #define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100
48 #define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
49 #define WINHTTP_FLAG_SECURE 0x00800000
51 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0
52 #define WINHTTP_ACCESS_TYPE_NO_PROXY 1
53 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3
55 #define WINHTTP_NO_PROXY_NAME NULL
56 #define WINHTTP_NO_PROXY_BYPASS NULL
58 #define WINHTTP_NO_REFERER NULL
59 #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
61 #define WINHTTP_ERROR_BASE 12000
63 #define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180)
65 /* flags for WinHttp{Set/Query}Options */
66 #define WINHTTP_FIRST_OPTION WINHTTP_OPTION_CALLBACK
67 #define WINHTTP_OPTION_CALLBACK 1
68 #define WINHTTP_OPTION_RESOLVE_TIMEOUT 2
69 #define WINHTTP_OPTION_CONNECT_TIMEOUT 3
70 #define WINHTTP_OPTION_CONNECT_RETRIES 4
71 #define WINHTTP_OPTION_SEND_TIMEOUT 5
72 #define WINHTTP_OPTION_RECEIVE_TIMEOUT 6
73 #define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT 7
74 #define WINHTTP_OPTION_HANDLE_TYPE 9
75 #define WINHTTP_OPTION_READ_BUFFER_SIZE 12
76 #define WINHTTP_OPTION_WRITE_BUFFER_SIZE 13
77 #define WINHTTP_OPTION_PARENT_HANDLE 21
78 #define WINHTTP_OPTION_EXTENDED_ERROR 24
79 #define WINHTTP_OPTION_SECURITY_FLAGS 31
80 #define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT 32
81 #define WINHTTP_OPTION_URL 34
82 #define WINHTTP_OPTION_SECURITY_KEY_BITNESS 36
83 #define WINHTTP_OPTION_PROXY 38
84 #define WINHTTP_OPTION_USER_AGENT 41
85 #define WINHTTP_OPTION_CONTEXT_VALUE 45
86 #define WINHTTP_OPTION_CLIENT_CERT_CONTEXT 47
87 #define WINHTTP_OPTION_REQUEST_PRIORITY 58
88 #define WINHTTP_OPTION_HTTP_VERSION 59
89 #define WINHTTP_OPTION_DISABLE_FEATURE 63
90 #define WINHTTP_OPTION_CODEPAGE 68
91 #define WINHTTP_OPTION_MAX_CONNS_PER_SERVER 73
92 #define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER 74
93 #define WINHTTP_OPTION_AUTOLOGON_POLICY 77
94 #define WINHTTP_OPTION_SERVER_CERT_CONTEXT 78
95 #define WINHTTP_OPTION_ENABLE_FEATURE 79
96 #define WINHTTP_OPTION_WORKER_THREAD_COUNT 80
97 #define WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT 81
98 #define WINHTTP_OPTION_PASSPORT_COBRANDING_URL 82
99 #define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH 83
100 #define WINHTTP_OPTION_SECURE_PROTOCOLS 84
101 #define WINHTTP_OPTION_ENABLETRACING 85
102 #define WINHTTP_OPTION_PASSPORT_SIGN_OUT 86
103 #define WINHTTP_OPTION_PASSPORT_RETURN_URL 87
104 #define WINHTTP_OPTION_REDIRECT_POLICY 88
105 #define WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS 89
106 #define WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE 90
107 #define WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE 91
108 #define WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE 92
109 #define WINHTTP_OPTION_CONNECTION_INFO 93
110 #define WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST 94
111 #define WINHTTP_OPTION_SPN 96
112 #define WINHTTP_OPTION_GLOBAL_PROXY_CREDS 97
113 #define WINHTTP_OPTION_GLOBAL_SERVER_CREDS 98
114 #define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT 99
115 #define WINHTTP_OPTION_REJECT_USERPWD_IN_URL 100
116 #define WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS 101
117 #define WINHTTP_LAST_OPTION WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS
118 #define WINHTTP_OPTION_USERNAME 0x1000
119 #define WINHTTP_OPTION_PASSWORD 0x1001
120 #define WINHTTP_OPTION_PROXY_USERNAME 0x1002
121 #define WINHTTP_OPTION_PROXY_PASSWORD 0x1003
123 /* Options for WinHttpOpenRequest */
124 #define WINHTTP_NO_REFERER NULL
125 #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
127 /* Options for WinHttpSendRequest */
128 #define WINHTTP_NO_ADDITIONAL_HEADERS NULL
129 #define WINHTTP_NO_REQUEST_DATA NULL
131 /* WinHTTP error codes */
132 #define WINHTTP_ERROR_BASE 12000
133 #define ERROR_WINHTTP_OUT_OF_HANDLES (WINHTTP_ERROR_BASE + 1)
134 #define ERROR_WINHTTP_TIMEOUT (WINHTTP_ERROR_BASE + 2)
135 #define ERROR_WINHTTP_INTERNAL_ERROR (WINHTTP_ERROR_BASE + 4)
136 #define ERROR_WINHTTP_INVALID_URL (WINHTTP_ERROR_BASE + 5)
137 #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME (WINHTTP_ERROR_BASE + 6)
138 #define ERROR_WINHTTP_NAME_NOT_RESOLVED (WINHTTP_ERROR_BASE + 7)
139 #define ERROR_WINHTTP_INVALID_OPTION (WINHTTP_ERROR_BASE + 9)
140 #define ERROR_WINHTTP_OPTION_NOT_SETTABLE (WINHTTP_ERROR_BASE + 11)
141 #define ERROR_WINHTTP_SHUTDOWN (WINHTTP_ERROR_BASE + 12)
142 #define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15)
143 #define ERROR_WINHTTP_OPERATION_CANCELLED (WINHTTP_ERROR_BASE + 17)
144 #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE (WINHTTP_ERROR_BASE + 18)
145 #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE (WINHTTP_ERROR_BASE + 19)
146 #define ERROR_WINHTTP_CANNOT_CONNECT (WINHTTP_ERROR_BASE + 29)
147 #define ERROR_WINHTTP_CONNECTION_ERROR (WINHTTP_ERROR_BASE + 30)
148 #define ERROR_WINHTTP_RESEND_REQUEST (WINHTTP_ERROR_BASE + 32)
149 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED (WINHTTP_ERROR_BASE + 44)
150 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN (WINHTTP_ERROR_BASE + 100)
151 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND (WINHTTP_ERROR_BASE + 101)
152 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND (WINHTTP_ERROR_BASE + 102)
153 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN (WINHTTP_ERROR_BASE + 103)
154 #define ERROR_WINHTTP_HEADER_NOT_FOUND (WINHTTP_ERROR_BASE + 150)
155 #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE (WINHTTP_ERROR_BASE + 152)
156 #define ERROR_WINHTTP_INVALID_HEADER (WINHTTP_ERROR_BASE + 153)
157 #define ERROR_WINHTTP_INVALID_QUERY_REQUEST (WINHTTP_ERROR_BASE + 154)
158 #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS (WINHTTP_ERROR_BASE + 155)
159 #define ERROR_WINHTTP_REDIRECT_FAILED (WINHTTP_ERROR_BASE + 156)
160 #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT (WINHTTP_ERROR_BASE + 166)
161 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (WINHTTP_ERROR_BASE + 167)
162 #define ERROR_WINHTTP_NOT_INITIALIZED (WINHTTP_ERROR_BASE + 172)
163 #define ERROR_WINHTTP_SECURE_FAILURE (WINHTTP_ERROR_BASE + 175)
164 #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR (WINHTTP_ERROR_BASE + 178)
170 DWORD dwSchemeLength
;
171 INTERNET_SCHEME nScheme
;
173 DWORD dwHostNameLength
;
176 DWORD dwUserNameLength
;
178 DWORD dwPasswordLength
;
180 DWORD dwUrlPathLength
;
181 LPWSTR lpszExtraInfo
;
182 DWORD dwExtraInfoLength
;
183 } URL_COMPONENTS
, *LPURL_COMPONENTS
;
184 typedef URL_COMPONENTS URL_COMPONENTSW
;
185 typedef LPURL_COMPONENTS LPURL_COMPONENTSW
;
191 } WINHTTP_ASYNC_RESULT
, *LPWINHTTP_ASYNC_RESULT
;
197 LPWSTR lpszSubjectInfo
;
198 LPWSTR lpszIssuerInfo
;
199 LPWSTR lpszProtocolName
;
200 LPWSTR lpszSignatureAlgName
;
201 LPWSTR lpszEncryptionAlgName
;
203 } WINHTTP_CERTIFICATE_INFO
;
209 LPCWSTR lpszProxyBypass
;
210 } WINHTTP_PROXY_INFO
, *LPWINHTTP_PROXY_INFO
;
211 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW
;
212 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW
;
217 LPWSTR lpszAutoConfigUrl
;
219 LPWSTR lpszProxyBypass
;
220 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
;
222 typedef VOID (CALLBACK
*WINHTTP_STATUS_CALLBACK
)(HINTERNET
,DWORD_PTR
,DWORD
,LPVOID
,DWORD
);
227 DWORD dwAutoDetectFlags
;
228 LPCWSTR lpszAutoConfigUrl
;
231 BOOL fAutoLogonIfChallenged
;
232 } WINHTTP_AUTOPROXY_OPTIONS
;
236 DWORD dwMajorVersion
;
237 DWORD dwMinorVersion
;
238 } HTTP_VERSION_INFO
, *LPHTTP_VERSION_INFO
;
245 BOOL WINAPI
WinHttpAddRequestHeaders(HINTERNET
,LPCWSTR
,DWORD
,DWORD
);
246 BOOL WINAPI
WinHttpDetectAutoProxyConfigUrl(DWORD
,LPWSTR
*);
247 BOOL WINAPI
WinHttpCheckPlatform(void);
248 BOOL WINAPI
WinHttpCloseHandle(HINTERNET
);
249 HINTERNET WINAPI
WinHttpConnect(HINTERNET
,LPCWSTR
,INTERNET_PORT
,DWORD
);
250 BOOL WINAPI
WinHttpCrackUrl(LPCWSTR
,DWORD
,DWORD
,LPURL_COMPONENTS
);
251 BOOL WINAPI
WinHttpCreateUrl(LPURL_COMPONENTS
,DWORD
,LPWSTR
,LPDWORD
);
252 BOOL WINAPI
WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO
*);
253 BOOL WINAPI
WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
* config
);
254 BOOL WINAPI
WinHttpGetProxyForUrl(HINTERNET
,LPCWSTR
,WINHTTP_AUTOPROXY_OPTIONS
*,WINHTTP_PROXY_INFO
*);
255 HINTERNET WINAPI
WinHttpOpen(LPCWSTR
,DWORD
,LPCWSTR
,LPCWSTR
,DWORD
);
256 HINTERNET WINAPI
WinHttpOpenRequest(HINTERNET
,LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
,DWORD
);
257 BOOL WINAPI
WinHttpQueryAuthParams(HINTERNET
,DWORD
,LPVOID
*);
258 BOOL WINAPI
WinHttpQueryAuthSchemes(HINTERNET
,LPDWORD
,LPDWORD
,LPDWORD
);
259 BOOL WINAPI
WinHttpQueryDataAvailable(HINTERNET
,LPDWORD
);
260 BOOL WINAPI
WinHttpQueryHeaders(HINTERNET
,DWORD
,LPCWSTR
,LPVOID
,LPDWORD
,LPDWORD
);
261 BOOL WINAPI
WinHttpReadData(HINTERNET
,LPVOID
,DWORD
,LPDWORD
);
262 BOOL WINAPI
WinHttpReceiveResponse(HINTERNET
,LPVOID
);
263 BOOL WINAPI
WinHttpSendRequest(HINTERNET
,LPCWSTR
,DWORD
,LPVOID
,DWORD
,DWORD
,DWORD_PTR
);
264 BOOL WINAPI
WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO
*);
265 BOOL WINAPI
WinHttpSetCredentials(HINTERNET
,DWORD
,DWORD
,LPCWSTR
,LPCWSTR
,LPVOID
);
266 BOOL WINAPI
WinHttpSetOption(HINTERNET
,DWORD
,LPVOID
,DWORD
);
267 WINHTTP_STATUS_CALLBACK WINAPI
WinHttpSetStatusCallback(HINTERNET
,WINHTTP_STATUS_CALLBACK
,DWORD
,DWORD_PTR
);
268 BOOL WINAPI
WinHttpSetTimeouts(HINTERNET
,int,int,int,int);
269 BOOL WINAPI
WinHttpTimeFromSystemTime(CONST SYSTEMTIME
*,LPWSTR
);
270 BOOL WINAPI
WinHttpTimeToSystemTime(LPCWSTR
,SYSTEMTIME
*);
271 BOOL WINAPI
WinHttpWriteData(HINTERNET
,LPCVOID
,DWORD
,LPDWORD
);
277 #endif /* __WINE_WINHTTP_H */