• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Francois Gouget
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #ifndef __WINE_WINHTTP_H
20 #define __WINE_WINHTTP_H
21 
22 #define WINHTTPAPI
23 #define BOOLAPI WINHTTPAPI BOOL WINAPI
24 
25 
26 typedef LPVOID HINTERNET;
27 typedef HINTERNET *LPHINTERNET;
28 
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;
34 
35 #define INTERNET_SCHEME_HTTP            1
36 #define INTERNET_SCHEME_HTTPS           2
37 typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
38 
39 /* flags for WinHttpOpen */
40 #define WINHTTP_FLAG_ASYNC                  0x10000000
41 
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
50 
51 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY   0
52 #define WINHTTP_ACCESS_TYPE_NO_PROXY        1
53 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY     3
54 
55 #define WINHTTP_NO_PROXY_NAME               NULL
56 #define WINHTTP_NO_PROXY_BYPASS             NULL
57 
58 #define WINHTTP_NO_REFERER                  NULL
59 #define WINHTTP_DEFAULT_ACCEPT_TYPES        NULL
60 
61 #define WINHTTP_ERROR_BASE                  12000
62 
63 /* The original WINE winhttp.h didn't contain symbolic names for the
64  * error codes. However, the values of most of them are publicly
65  * documented at
66  * http://msdn.microsoft.com/en-us/library/aa383770(VS.85).aspx so
67  * we can add them here.
68  */
69 #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR 12178
70 #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT 12166
71 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN 12103
72 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND 12102
73 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN 12100
74 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND 12101
75 #define ERROR_WINHTTP_CANNOT_CONNECT 12029
76 #define ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW 12183
77 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED 12044
78 #define ERROR_WINHTTP_CONNECTION_ERROR 12030
79 #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS 12155
80 #define ERROR_WINHTTP_HEADER_COUNT_EXCEEDED 12181
81 #define ERROR_WINHTTP_HEADER_NOT_FOUND 12150
82 #define ERROR_WINHTTP_HEADER_SIZE_OVERFLOW 12182
83 #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE 12019
84 #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE 12018
85 #define ERROR_WINHTTP_INTERNAL_ERROR 12004
86 #define ERROR_WINHTTP_INVALID_OPTION 12009
87 #define ERROR_WINHTTP_INVALID_QUERY_REQUEST 12154
88 #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE 12152
89 #define ERROR_WINHTTP_INVALID_URL 12005
90 #define ERROR_WINHTTP_LOGIN_FAILURE 12015
91 #define ERROR_WINHTTP_NAME_NOT_RESOLVED 12007
92 #define ERROR_WINHTTP_NOT_INITIALIZED 12172
93 #define ERROR_WINHTTP_OPERATION_CANCELLED 12017
94 #define ERROR_WINHTTP_OPTION_NOT_SETTABLE 12011
95 #define ERROR_WINHTTP_OUT_OF_HANDLES 12001
96 #define ERROR_WINHTTP_REDIRECT_FAILED 12156
97 #define ERROR_WINHTTP_RESEND_REQUEST 12032
98 #define ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW 12184
99 #define ERROR_WINHTTP_SECURE_CERT_CN_INVALID 12038
100 #define ERROR_WINHTTP_SECURE_CERT_DATE_INVALID 12037
101 #define ERROR_WINHTTP_SECURE_CERT_REV_FAILED 12057
102 #define ERROR_WINHTTP_SECURE_CERT_REVOKED 12170
103 #define ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE 12179
104 #define ERROR_WINHTTP_SECURE_CHANNEL_ERROR 12157
105 #define ERROR_WINHTTP_SECURE_FAILURE 12175
106 #define ERROR_WINHTTP_SECURE_INVALID_CA 12045
107 #define ERROR_WINHTTP_SECURE_INVALID_CERT 12169
108 #define ERROR_WINHTTP_SHUTDOWN 12012
109 #define ERROR_WINHTTP_TIMEOUT 12002
110 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT 12167
111 #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME 12006
112 /* End of added error codes */
113 
114 #define ERROR_WINHTTP_AUTODETECTION_FAILED     (WINHTTP_ERROR_BASE + 180)
115 
116 typedef struct
117 {
118     DWORD   dwStructSize;
119     LPWSTR  lpszScheme;
120     DWORD   dwSchemeLength;
121     INTERNET_SCHEME nScheme;
122     LPWSTR  lpszHostName;
123     DWORD   dwHostNameLength;
124     INTERNET_PORT nPort;
125     LPWSTR  lpszUserName;
126     DWORD   dwUserNameLength;
127     LPWSTR  lpszPassword;
128     DWORD   dwPasswordLength;
129     LPWSTR  lpszUrlPath;
130     DWORD   dwUrlPathLength;
131     LPWSTR  lpszExtraInfo;
132     DWORD   dwExtraInfoLength;
133 } URL_COMPONENTS, *LPURL_COMPONENTS;
134 typedef URL_COMPONENTS URL_COMPONENTSW;
135 typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
136 
137 typedef struct
138 {
139     DWORD_PTR dwResult;
140     DWORD dwError;
141 } WINHTTP_ASYNC_RESULT, *LPWINHTTP_ASYNC_RESULT;
142 
143 typedef struct
144 {
145     FILETIME ftExpiry;
146     FILETIME ftStart;
147     LPWSTR lpszSubjectInfo;
148     LPWSTR lpszIssuerInfo;
149     LPWSTR lpszProtocolName;
150     LPWSTR lpszSignatureAlgName;
151     LPWSTR lpszEncryptionAlgName;
152     DWORD dwKeySize;
153 } WINHTTP_CERTIFICATE_INFO;
154 
155 typedef struct
156 {
157     DWORD dwAccessType;
158     LPCWSTR lpszProxy;
159     LPCWSTR lpszProxyBypass;
160 } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
161 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
162 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
163 
164 typedef struct
165 {
166     BOOL   fAutoDetect;
167     LPWSTR lpszAutoConfigUrl;
168     LPWSTR lpszProxy;
169     LPWSTR lpszProxyBypass;
170 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
171 
172 typedef VOID (CALLBACK *WINHTTP_STATUS_CALLBACK)(HINTERNET,DWORD_PTR,DWORD,LPVOID,DWORD);
173 
174 typedef struct
175 {
176     DWORD dwFlags;
177     DWORD dwAutoDetectFlags;
178     LPCWSTR lpszAutoConfigUrl;
179     LPVOID lpvReserved;
180     DWORD dwReserved;
181     BOOL fAutoLogonIfChallenged;
182 } WINHTTP_AUTOPROXY_OPTIONS;
183 
184 typedef struct
185 {
186     DWORD dwMajorVersion;
187     DWORD dwMinorVersion;
188 } HTTP_VERSION_INFO, *LPHTTP_VERSION_INFO;
189 
190 
191 #ifdef __cplusplus
192 extern "C" {
193 #endif
194 
195 BOOL        WINAPI WinHttpAddRequestHeaders(HINTERNET,LPCWSTR,DWORD,DWORD);
196 BOOL        WINAPI WinHttpDetectAutoProxyConfigUrl(DWORD,LPWSTR*);
197 BOOL        WINAPI WinHttpCheckPlatform(void);
198 BOOL        WINAPI WinHttpCloseHandle(HINTERNET);
199 HINTERNET   WINAPI WinHttpConnect(HINTERNET,LPCWSTR,INTERNET_PORT,DWORD);
200 BOOL        WINAPI WinHttpCrackUrl(LPCWSTR,DWORD,DWORD,LPURL_COMPONENTS);
201 BOOL        WINAPI WinHttpCreateUrl(LPURL_COMPONENTS,DWORD,LPWSTR,LPDWORD);
202 BOOL        WINAPI WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
203 BOOL        WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* config);
204 BOOL        WINAPI WinHttpGetProxyForUrl(HINTERNET,LPCWSTR,WINHTTP_AUTOPROXY_OPTIONS*,WINHTTP_PROXY_INFO*);
205 HINTERNET   WINAPI WinHttpOpen(LPCWSTR,DWORD,LPCWSTR,LPCWSTR,DWORD);
206 
207 /* The sixth parameter to WinHttpOpenRequest was wrong in the original
208  * WINE header. It should be LPCWSTR*, not LPCWSTR, as it points to an
209  * array of wide strings.
210  */
211 HINTERNET   WINAPI WinHttpOpenRequest(HINTERNET,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR*,DWORD);
212 BOOL        WINAPI WinHttpQueryAuthParams(HINTERNET,DWORD,LPVOID*);
213 BOOL        WINAPI WinHttpQueryAuthSchemes(HINTERNET,LPDWORD,LPDWORD,LPDWORD);
214 BOOL        WINAPI WinHttpQueryDataAvailable(HINTERNET,LPDWORD);
215 BOOL        WINAPI WinHttpQueryHeaders(HINTERNET,DWORD,LPCWSTR,LPVOID,LPDWORD,LPDWORD);
216 BOOL        WINAPI WinHttpReadData(HINTERNET,LPVOID,DWORD,LPDWORD);
217 BOOL        WINAPI WinHttpReceiveResponse(HINTERNET,LPVOID);
218 BOOL        WINAPI WinHttpSendRequest(HINTERNET,LPCWSTR,DWORD,LPVOID,DWORD,DWORD,DWORD_PTR);
219 BOOL        WINAPI WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
220 BOOL        WINAPI WinHttpSetCredentials(HINTERNET,DWORD,DWORD,LPCWSTR,LPCWSTR,LPVOID);
221 BOOL        WINAPI WinHttpSetOption(HINTERNET,DWORD,LPVOID,DWORD);
222 WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback(HINTERNET,WINHTTP_STATUS_CALLBACK,DWORD,DWORD_PTR);
223 BOOL        WINAPI WinHttpSetTimeouts(HINTERNET,int,int,int,int);
224 BOOL        WINAPI WinHttpTimeFromSystemTime(CONST SYSTEMTIME *,LPWSTR);
225 BOOL        WINAPI WinHttpTimeToSystemTime(LPCWSTR,SYSTEMTIME*);
226 BOOL        WINAPI WinHttpWriteData(HINTERNET,LPCVOID,DWORD,LPDWORD);
227 
228 /* Additional definitions, from the public domain <wininet.h> in mingw */
229 #define ICU_ESCAPE 0x80000000
230 #define ICU_DECODE 0x10000000
231 
232 /* A few constants I couldn't find publicly documented, so I looked up
233  * their value from the Windows SDK <winhttp.h>. Presumably this falls
234  * under fair use.
235  */
236 #define WINHTTP_QUERY_CONTENT_LENGTH 5
237 #define WINHTTP_QUERY_CONTENT_TYPE 1
238 #define WINHTTP_QUERY_LAST_MODIFIED 11
239 #define WINHTTP_QUERY_STATUS_CODE 19
240 #define WINHTTP_QUERY_STATUS_TEXT 20
241 
242 #define WINHTTP_QUERY_FLAG_SYSTEMTIME 0x40000000
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif  /* __WINE_WINHTTP_H */
249