zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

winhttp.h (45833B) - Raw


      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 #ifdef _WIN64
     23 #pragma pack(push,8)
     24 #else
     25 #pragma pack(push,4)
     26 #endif
     27 
     28 #ifdef _WINHTTP_INTERNAL_
     29 # define WINHTTPAPI
     30 #else
     31 # define WINHTTPAPI DECLSPEC_IMPORT
     32 #endif
     33 
     34 #define BOOLAPI WINHTTPAPI WINBOOL WINAPI
     35 
     36 
     37 typedef LPVOID HINTERNET;
     38 typedef HINTERNET *LPHINTERNET;
     39 
     40 #define INTERNET_DEFAULT_PORT           0
     41 #define INTERNET_DEFAULT_HTTP_PORT      80
     42 #define INTERNET_DEFAULT_HTTPS_PORT     443
     43 typedef WORD INTERNET_PORT;
     44 typedef INTERNET_PORT *LPINTERNET_PORT;
     45 
     46 /* Yes, these values contradict wininet.h */
     47 #define INTERNET_SCHEME_HTTP            1
     48 #define INTERNET_SCHEME_HTTPS           2
     49 #define INTERNET_SCHEME_FTP             3
     50 #define INTERNET_SCHEME_SOCKS           4
     51 typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME;
     52 
     53 #define ICU_ESCAPE  0x80000000
     54 #define ICU_ESCAPE_AUTHORITY 0x00002000
     55 #define ICU_REJECT_USERPWD   0x00004000
     56 
     57 /* flags for WinHttpOpen */
     58 #define WINHTTP_FLAG_ASYNC                  0x10000000
     59 
     60 /* flags for WinHttpOpenRequest */
     61 #define WINHTTP_FLAG_ESCAPE_PERCENT         0x00000004
     62 #define WINHTTP_FLAG_NULL_CODEPAGE          0x00000008
     63 #define WINHTTP_FLAG_ESCAPE_DISABLE         0x00000040
     64 #define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY   0x00000080
     65 #define WINHTTP_FLAG_BYPASS_PROXY_CACHE     0x00000100
     66 #define WINHTTP_FLAG_REFRESH                WINHTTP_FLAG_BYPASS_PROXY_CACHE
     67 #define WINHTTP_FLAG_SECURE                 0x00800000
     68 
     69 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY   0
     70 #define WINHTTP_ACCESS_TYPE_NO_PROXY        1
     71 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY     3
     72 #define WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY 4
     73 
     74 #define WINHTTP_NO_PROXY_NAME               NULL
     75 #define WINHTTP_NO_PROXY_BYPASS             NULL
     76 
     77 #define WINHTTP_NO_CLIENT_CERT_CONTEXT      NULL
     78 
     79 #define WINHTTP_NO_REFERER                  NULL
     80 #define WINHTTP_DEFAULT_ACCEPT_TYPES        NULL
     81 
     82 #define WINHTTP_NO_ADDITIONAL_HEADERS       NULL
     83 #define WINHTTP_NO_REQUEST_DATA             NULL
     84 
     85 #define WINHTTP_HEADER_NAME_BY_INDEX        NULL
     86 #define WINHTTP_NO_OUTPUT_BUFFER            NULL
     87 #define WINHTTP_NO_HEADER_INDEX             NULL
     88 
     89 #define WINHTTP_ADDREQ_INDEX_MASK                    0x0000FFFF
     90 #define WINHTTP_ADDREQ_FLAGS_MASK                    0xFFFF0000
     91 #define WINHTTP_ADDREQ_FLAG_ADD_IF_NEW               0x10000000
     92 #define WINHTTP_ADDREQ_FLAG_ADD                      0x20000000
     93 #define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA      0x40000000
     94 #define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON  0x01000000
     95 #define WINHTTP_ADDREQ_FLAG_COALESCE                 WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
     96 #define WINHTTP_ADDREQ_FLAG_REPLACE                  0x80000000
     97 
     98 #define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH 0
     99 
    100 /* flags for WinHttp{Set/Query}Options */
    101 #define WINHTTP_FIRST_OPTION                         WINHTTP_OPTION_CALLBACK
    102 #define WINHTTP_OPTION_CALLBACK                       1
    103 #define WINHTTP_OPTION_RESOLVE_TIMEOUT                2
    104 #define WINHTTP_OPTION_CONNECT_TIMEOUT                3
    105 #define WINHTTP_OPTION_CONNECT_RETRIES                4
    106 #define WINHTTP_OPTION_SEND_TIMEOUT                   5
    107 #define WINHTTP_OPTION_RECEIVE_TIMEOUT                6
    108 #define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT       7
    109 #define WINHTTP_OPTION_HANDLE_TYPE                    9
    110 #define WINHTTP_OPTION_READ_BUFFER_SIZE              12
    111 #define WINHTTP_OPTION_WRITE_BUFFER_SIZE             13
    112 #define WINHTTP_OPTION_PARENT_HANDLE                 21
    113 #define WINHTTP_OPTION_EXTENDED_ERROR                24
    114 #define WINHTTP_OPTION_SECURITY_FLAGS                31
    115 #define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT   32
    116 #define WINHTTP_OPTION_URL                           34
    117 #define WINHTTP_OPTION_SECURITY_KEY_BITNESS          36
    118 #define WINHTTP_OPTION_PROXY                         38
    119 #define WINHTTP_OPTION_PROXY_RESULT_ENTRY            39
    120 #define WINHTTP_OPTION_USER_AGENT                    41
    121 #define WINHTTP_OPTION_CONTEXT_VALUE                 45
    122 #define WINHTTP_OPTION_CLIENT_CERT_CONTEXT           47
    123 #define WINHTTP_OPTION_REQUEST_PRIORITY              58
    124 #define WINHTTP_OPTION_HTTP_VERSION                  59
    125 #define WINHTTP_OPTION_DISABLE_FEATURE               63
    126 #define WINHTTP_OPTION_CODEPAGE                      68
    127 #define WINHTTP_OPTION_MAX_CONNS_PER_SERVER          73
    128 #define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER      74
    129 #define WINHTTP_OPTION_AUTOLOGON_POLICY              77
    130 #define WINHTTP_OPTION_SERVER_CERT_CONTEXT           78
    131 #define WINHTTP_OPTION_ENABLE_FEATURE                79
    132 #define WINHTTP_OPTION_WORKER_THREAD_COUNT           80
    133 #define WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT      81
    134 #define WINHTTP_OPTION_PASSPORT_COBRANDING_URL       82
    135 #define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH       83
    136 #define WINHTTP_OPTION_SECURE_PROTOCOLS              84
    137 #define WINHTTP_OPTION_ENABLETRACING                 85
    138 #define WINHTTP_OPTION_PASSPORT_SIGN_OUT             86
    139 #define WINHTTP_OPTION_PASSPORT_RETURN_URL           87
    140 #define WINHTTP_OPTION_REDIRECT_POLICY               88
    141 #define WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS  89
    142 #define WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE      90
    143 #define WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE      91
    144 #define WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE       92
    145 #define WINHTTP_OPTION_CONNECTION_INFO               93
    146 #define WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST       94
    147 #define WINHTTP_OPTION_SPN                           96
    148 #define WINHTTP_OPTION_GLOBAL_PROXY_CREDS            97
    149 #define WINHTTP_OPTION_GLOBAL_SERVER_CREDS           98
    150 #define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT           99
    151 #define WINHTTP_OPTION_REJECT_USERPWD_IN_URL         100
    152 #define WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS 101
    153 #define WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE   103
    154 #define WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE        104
    155 #define WINHTTP_OPTION_SERVER_SPN_USED                  106
    156 #define WINHTTP_OPTION_PROXY_SPN_USED                   107
    157 #define WINHTTP_OPTION_SERVER_CBT                       108
    158 #define WINHTTP_OPTION_UNSAFE_HEADER_PARSING            110
    159 #define WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS   111
    160 #define WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET            114
    161 #define WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT         115
    162 #define WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL    116
    163 #define WINHTTP_OPTION_DECOMPRESSION                    118
    164 #define WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE   122
    165 #define WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE      123
    166 #define WINHTTP_OPTION_TCP_PRIORITY_HINT                128
    167 #define WINHTTP_OPTION_CONNECTION_FILTER                131
    168 #define WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL             133
    169 #define WINHTTP_OPTION_HTTP_PROTOCOL_USED               134
    170 #define WINHTTP_OPTION_KDC_PROXY_SETTINGS               136
    171 #define WINHTTP_OPTION_ENCODE_EXTRA                     138
    172 #define WINHTTP_OPTION_DISABLE_STREAM_QUEUE             139
    173 #define WINHTTP_OPTION_IPV6_FAST_FALLBACK               140
    174 #define WINHTTP_OPTION_CONNECTION_STATS_V0              141
    175 #define WINHTTP_OPTION_REQUEST_TIMES                    142
    176 #define WINHTTP_OPTION_EXPIRE_CONNECTION                143
    177 #define WINHTTP_OPTION_DISABLE_SECURE_PROTOCOL_FALLBACK 144
    178 #define WINHTTP_OPTION_HTTP_PROTOCOL_REQUIRED           145
    179 #define WINHTTP_OPTION_REQUEST_STATS                    146
    180 #define WINHTTP_OPTION_SERVER_CERT_CHAIN_CONTEXT        147
    181 #define WINHTTP_OPTION_CONNECTION_STATS_V1              150
    182 #define WINHTTP_OPTION_SECURITY_INFO                    151
    183 #define WINHTTP_OPTION_TCP_KEEPALIVE                    152
    184 #define WINHTTP_OPTION_TCP_FAST_OPEN                    153
    185 #define WINHTTP_OPTION_TCP_FALSE_START                  154
    186 #define WINHTTP_OPTION_IGNORE_CERT_REVOCATION_OFFLINE   155
    187 #define WINHTTP_OPTION_TLS_PROTOCOL_INSECURE_FALLBACK   158
    188 #define WINHTTP_OPTION_STREAM_ERROR_CODE                159
    189 #define WINHTTP_OPTION_REQUIRE_STREAM_END               160
    190 #define WINHTTP_OPTION_ENABLE_HTTP2_PLUS_CLIENT_CERT    161
    191 #define WINHTTP_OPTION_FAILED_CONNECTION_RETRIES        162
    192 #define WINHTTP_OPTION_HTTP2_KEEPALIVE                  164
    193 #define WINHTTP_OPTION_RESOLUTION_HOSTNAME              165
    194 #define WINHTTP_OPTION_SET_TOKEN_BINDING                166
    195 #define WINHTTP_OPTION_TOKEN_BINDING_PUBLIC_KEY         167
    196 #define WINHTTP_OPTION_REFERER_TOKEN_BINDING_HOSTNAME   168
    197 #define WINHTTP_OPTION_HTTP2_PLUS_TRANSFER_ENCODING     169
    198 #define WINHTTP_OPTION_RESOLVER_CACHE_CONFIG            170
    199 #define WINHTTP_OPTION_DISABLE_CERT_CHAIN_BUILDING      171
    200 #define WINHTTP_OPTION_BACKGROUND_CONNECTIONS           172
    201 #define WINHTTP_OPTION_FIRST_AVAILABLE_CONNECTION       173
    202 #define WINHTTP_OPTION_TCP_PRIORITY_STATUS              177
    203 #define WINHTTP_OPTION_CONNECTION_GUID                  178
    204 #define WINHTTP_OPTION_MATCH_CONNECTION_GUID            179
    205 #define WINHTTP_OPTION_HTTP2_RECEIVE_WINDOW             183
    206 #define WINHTTP_OPTION_FEATURE_SUPPORTED                184
    207 #define WINHTTP_OPTION_QUIC_STATS                       185
    208 #define WINHTTP_OPTION_HTTP3_KEEPALIVE                  188
    209 #define WINHTTP_OPTION_HTTP3_HANDSHAKE_TIMEOUT          189
    210 #define WINHTTP_OPTION_HTTP3_INITIAL_RTT                190
    211 #define WINHTTP_OPTION_HTTP3_STREAM_ERROR_CODE          191
    212 #define WINHTTP_OPTION_REQUEST_ANNOTATION               192
    213 #define WINHTTP_OPTION_DISABLE_PROXY_AUTH_SCHEMES       193
    214 #define WINHTTP_OPTION_REVERT_IMPERSONATION_SERVER_CERT 194
    215 #define WINHTTP_OPTION_DISABLE_GLOBAL_POOLING           195
    216 #define WINHTTP_OPTION_USE_SESSION_SCH_CRED             196
    217 #define WINHTTP_OPTION_QUIC_STATS_V2                    200
    218 #define WINHTTP_OPTION_QUIC_STREAM_STATS                202
    219 #define WINHTTP_OPTION_USE_LOOKASIDE                    203
    220 #define WINHTTP_OPTION_ERROR_LOG_GUID                   204
    221 #define WINHTTP_OPTION_ENABLE_FAST_FORWARDING           205
    222 #define WINHTTP_OPTION_FAST_FORWARDING_RESPONSE_DATA    206
    223 #define WINHTTP_OPTION_UPGRADE_TO_PROTOCOL              207
    224 #define WINHTTP_OPTION_CONNECTION_STATS_V2              208
    225 #define WINHTTP_OPTION_FAST_FORWARDING_RESPONSE_STATUS  209
    226 
    227 #define WINHTTP_LAST_OPTION                          WINHTTP_OPTION_FAST_FORWARDING_RESPONSE_STATUS
    228 #define WINHTTP_OPTION_USERNAME                      0x1000
    229 #define WINHTTP_OPTION_PASSWORD                      0x1001
    230 #define WINHTTP_OPTION_PROXY_USERNAME                0x1002
    231 #define WINHTTP_OPTION_PROXY_PASSWORD                0x1003
    232 
    233 #define WINHTTP_CONNS_PER_SERVER_UNLIMITED 0xFFFFFFFF
    234 
    235 #define WINHTTP_DECOMPRESSION_FLAG_GZIP     0x00000001
    236 #define WINHTTP_DECOMPRESSION_FLAG_DEFLATE  0x00000002
    237 
    238 #define WINHTTP_DECOMPRESSION_FLAG_ALL ( WINHTTP_DECOMPRESSION_FLAG_GZIP | WINHTTP_DECOMPRESSION_FLAG_DEFLATE )
    239 
    240 #define WINHTTP_PROTOCOL_FLAG_HTTP2 0x1
    241 #define WINHTTP_PROTOCOL_FLAG_HTTP3 0x2
    242 #define WINHTTP_PROTOCOL_MASK (WINHTTP_PROTOCOL_FLAG_HTTP2 | WINHTTP_PROTOCOL_FLAG_HTTP3)
    243 
    244 #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM   0
    245 #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW      1
    246 #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH     2
    247 #define WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT  WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM
    248 
    249 #define WINHTTP_OPTION_REDIRECT_POLICY_NEVER                        0
    250 #define WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP       1
    251 #define WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS                       2
    252 #define WINHTTP_OPTION_REDIRECT_POLICY_LAST            WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS
    253 #define WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT         WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
    254 
    255 #define WINHTTP_DISABLE_PASSPORT_AUTH    0x00000000
    256 #define WINHTTP_ENABLE_PASSPORT_AUTH     0x10000000
    257 #define WINHTTP_DISABLE_PASSPORT_KEYRING 0x20000000
    258 #define WINHTTP_ENABLE_PASSPORT_KEYRING  0x40000000
    259 
    260 #define WINHTTP_DISABLE_COOKIES                   0x00000001
    261 #define WINHTTP_DISABLE_REDIRECTS                 0x00000002
    262 #define WINHTTP_DISABLE_AUTHENTICATION            0x00000004
    263 #define WINHTTP_DISABLE_KEEP_ALIVE                0x00000008
    264 #define WINHTTP_ENABLE_SSL_REVOCATION             0x00000001
    265 #define WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION   0x00000002
    266 #define WINHTTP_DISABLE_SPN_SERVER_PORT           0x00000000
    267 #define WINHTTP_ENABLE_SPN_SERVER_PORT            0x00000001
    268 #define WINHTTP_OPTION_SPN_MASK                   WINHTTP_ENABLE_SPN_SERVER_PORT
    269 
    270 /* Options for WinHttpOpenRequest */
    271 #define WINHTTP_NO_REFERER             NULL
    272 #define WINHTTP_DEFAULT_ACCEPT_TYPES   NULL
    273 
    274 /* Options for WinHttpSendRequest */
    275 #define WINHTTP_NO_ADDITIONAL_HEADERS   NULL
    276 #define WINHTTP_NO_REQUEST_DATA         NULL
    277 
    278 /* WinHTTP error codes */
    279 #define WINHTTP_ERROR_BASE                                  12000
    280 #define ERROR_WINHTTP_OUT_OF_HANDLES                        (WINHTTP_ERROR_BASE + 1)
    281 #define ERROR_WINHTTP_TIMEOUT                               (WINHTTP_ERROR_BASE + 2)
    282 #define ERROR_WINHTTP_INTERNAL_ERROR                        (WINHTTP_ERROR_BASE + 4)
    283 #define ERROR_WINHTTP_INVALID_URL                           (WINHTTP_ERROR_BASE + 5)
    284 #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME                   (WINHTTP_ERROR_BASE + 6)
    285 #define ERROR_WINHTTP_NAME_NOT_RESOLVED                     (WINHTTP_ERROR_BASE + 7)
    286 #define ERROR_WINHTTP_INVALID_OPTION                        (WINHTTP_ERROR_BASE + 9)
    287 #define ERROR_WINHTTP_OPTION_NOT_SETTABLE                   (WINHTTP_ERROR_BASE + 11)
    288 #define ERROR_WINHTTP_SHUTDOWN                              (WINHTTP_ERROR_BASE + 12)
    289 #define ERROR_WINHTTP_LOGIN_FAILURE                         (WINHTTP_ERROR_BASE + 15)
    290 #define ERROR_WINHTTP_OPERATION_CANCELLED                   (WINHTTP_ERROR_BASE + 17)
    291 #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE                 (WINHTTP_ERROR_BASE + 18)
    292 #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE                (WINHTTP_ERROR_BASE + 19)
    293 #define ERROR_WINHTTP_CANNOT_CONNECT                        (WINHTTP_ERROR_BASE + 29)
    294 #define ERROR_WINHTTP_CONNECTION_ERROR                      (WINHTTP_ERROR_BASE + 30)
    295 #define ERROR_WINHTTP_RESEND_REQUEST                        (WINHTTP_ERROR_BASE + 32)
    296 #define ERROR_WINHTTP_SECURE_CERT_DATE_INVALID              (WINHTTP_ERROR_BASE + 37)
    297 #define ERROR_WINHTTP_SECURE_CERT_CN_INVALID                (WINHTTP_ERROR_BASE + 38)
    298 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED               (WINHTTP_ERROR_BASE + 44)
    299 #define ERROR_WINHTTP_SECURE_INVALID_CA                     (WINHTTP_ERROR_BASE + 45)
    300 #define ERROR_WINHTTP_SECURE_CERT_REV_FAILED                (WINHTTP_ERROR_BASE + 57)
    301 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN               (WINHTTP_ERROR_BASE + 100)
    302 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND               (WINHTTP_ERROR_BASE + 101)
    303 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND                (WINHTTP_ERROR_BASE + 102)
    304 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN                (WINHTTP_ERROR_BASE + 103)
    305 #define ERROR_WINHTTP_HEADER_NOT_FOUND                      (WINHTTP_ERROR_BASE + 150)
    306 #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE               (WINHTTP_ERROR_BASE + 152)
    307 #define ERROR_WINHTTP_INVALID_HEADER                        (WINHTTP_ERROR_BASE + 153)
    308 #define ERROR_WINHTTP_INVALID_QUERY_REQUEST                 (WINHTTP_ERROR_BASE + 154)
    309 #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS                 (WINHTTP_ERROR_BASE + 155)
    310 #define ERROR_WINHTTP_REDIRECT_FAILED                       (WINHTTP_ERROR_BASE + 156)
    311 #define ERROR_WINHTTP_SECURE_CHANNEL_ERROR                  (WINHTTP_ERROR_BASE + 157)
    312 #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT                 (WINHTTP_ERROR_BASE + 166)
    313 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT             (WINHTTP_ERROR_BASE + 167)
    314 #define ERROR_WINHTTP_SECURE_INVALID_CERT                   (WINHTTP_ERROR_BASE + 169)
    315 #define ERROR_WINHTTP_SECURE_CERT_REVOKED                   (WINHTTP_ERROR_BASE + 170)
    316 #define ERROR_WINHTTP_NOT_INITIALIZED                       (WINHTTP_ERROR_BASE + 172)
    317 #define ERROR_WINHTTP_SECURE_FAILURE                        (WINHTTP_ERROR_BASE + 175)
    318 #define ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE                 (WINHTTP_ERROR_BASE + 176)
    319 #define ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR                (WINHTTP_ERROR_BASE + 177)
    320 #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR              (WINHTTP_ERROR_BASE + 178)
    321 #define ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE               (WINHTTP_ERROR_BASE + 179)
    322 #define ERROR_WINHTTP_AUTODETECTION_FAILED                  (WINHTTP_ERROR_BASE + 180)
    323 #define ERROR_WINHTTP_HEADER_COUNT_EXCEEDED                 (WINHTTP_ERROR_BASE + 181)
    324 #define ERROR_WINHTTP_HEADER_SIZE_OVERFLOW                  (WINHTTP_ERROR_BASE + 182)
    325 #define ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW (WINHTTP_ERROR_BASE + 183)
    326 #define ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW               (WINHTTP_ERROR_BASE + 184)
    327 #define ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY            (WINHTTP_ERROR_BASE + 185)
    328 #define ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY     (WINHTTP_ERROR_BASE + 186)
    329 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED_PROXY         (WINHTTP_ERROR_BASE + 187)
    330 #define ERROR_WINHTTP_SECURE_FAILURE_PROXY                  (WINHTTP_ERROR_BASE + 188)
    331 #define ERROR_WINHTTP_RESERVED_189                          (WINHTTP_ERROR_BASE + 189)
    332 #define ERROR_WINHTTP_HTTP_PROTOCOL_MISMATCH                (WINHTTP_ERROR_BASE + 190)
    333 #define WINHTTP_ERROR_LAST                                  (WINHTTP_ERROR_BASE + 188)
    334 
    335 #define WINHTTP_RESET_STATE                     0x00000001
    336 #define WINHTTP_RESET_SWPAD_CURRENT_NETWORK     0x00000002
    337 #define WINHTTP_RESET_SWPAD_ALL                 0x00000004
    338 #define WINHTTP_RESET_SCRIPT_CACHE              0x00000008
    339 #define WINHTTP_RESET_ALL                       0x0000FFFF
    340 #define WINHTTP_RESET_NOTIFY_NETWORK_CHANGED    0x00010000
    341 #define WINHTTP_RESET_OUT_OF_PROC               0x00020000
    342 #define WINHTTP_RESET_DISCARD_RESOLVERS         0x00040000
    343 
    344 /* WinHttp status codes */
    345 #define HTTP_STATUS_CONTINUE            100
    346 #define HTTP_STATUS_SWITCH_PROTOCOLS    101
    347 #define HTTP_STATUS_OK                  200
    348 #define HTTP_STATUS_CREATED             201
    349 #define HTTP_STATUS_ACCEPTED            202
    350 #define HTTP_STATUS_PARTIAL             203
    351 #define HTTP_STATUS_NO_CONTENT          204
    352 #define HTTP_STATUS_RESET_CONTENT       205
    353 #define HTTP_STATUS_PARTIAL_CONTENT     206
    354 #define HTTP_STATUS_WEBDAV_MULTI_STATUS 207
    355 #define HTTP_STATUS_AMBIGUOUS           300
    356 #define HTTP_STATUS_MOVED               301
    357 #define HTTP_STATUS_REDIRECT            302
    358 #define HTTP_STATUS_REDIRECT_METHOD     303
    359 #define HTTP_STATUS_NOT_MODIFIED        304
    360 #define HTTP_STATUS_USE_PROXY           305
    361 #define HTTP_STATUS_REDIRECT_KEEP_VERB  307
    362 #define HTTP_STATUS_PERMANENT_REDIRECT  308
    363 #define HTTP_STATUS_BAD_REQUEST         400
    364 #define HTTP_STATUS_DENIED              401
    365 #define HTTP_STATUS_PAYMENT_REQ         402
    366 #define HTTP_STATUS_FORBIDDEN           403
    367 #define HTTP_STATUS_NOT_FOUND           404
    368 #define HTTP_STATUS_BAD_METHOD          405
    369 #define HTTP_STATUS_NONE_ACCEPTABLE     406
    370 #define HTTP_STATUS_PROXY_AUTH_REQ      407
    371 #define HTTP_STATUS_REQUEST_TIMEOUT     408
    372 #define HTTP_STATUS_CONFLICT            409
    373 #define HTTP_STATUS_GONE                410
    374 #define HTTP_STATUS_LENGTH_REQUIRED     411
    375 #define HTTP_STATUS_PRECOND_FAILED      412
    376 #define HTTP_STATUS_REQUEST_TOO_LARGE   413
    377 #define HTTP_STATUS_URI_TOO_LONG        414
    378 #define HTTP_STATUS_UNSUPPORTED_MEDIA   415
    379 #define HTTP_STATUS_RETRY_WITH          449
    380 #define HTTP_STATUS_SERVER_ERROR        500
    381 #define HTTP_STATUS_NOT_SUPPORTED       501
    382 #define HTTP_STATUS_BAD_GATEWAY         502
    383 #define HTTP_STATUS_SERVICE_UNAVAIL     503
    384 #define HTTP_STATUS_GATEWAY_TIMEOUT     504
    385 #define HTTP_STATUS_VERSION_NOT_SUP     505
    386 #define HTTP_STATUS_FIRST               HTTP_STATUS_CONTINUE
    387 #define HTTP_STATUS_LAST                HTTP_STATUS_VERSION_NOT_SUP
    388 
    389 #define SECURITY_FLAG_IGNORE_UNKNOWN_CA         0x00000100
    390 #define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID  0x00002000
    391 #define SECURITY_FLAG_IGNORE_CERT_CN_INVALID    0x00001000
    392 #define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE   0x00000200
    393 #define SECURITY_FLAG_SECURE                    0x00000001
    394 #define SECURITY_FLAG_STRENGTH_WEAK             0x10000000
    395 #define SECURITY_FLAG_STRENGTH_MEDIUM           0x40000000
    396 #define SECURITY_FLAG_STRENGTH_STRONG           0x20000000
    397 
    398 #define ICU_NO_ENCODE          0x20000000
    399 #define ICU_DECODE             0x10000000
    400 #define ICU_NO_META            0x08000000
    401 #define ICU_ENCODE_SPACES_ONLY 0x04000000
    402 #define ICU_BROWSER_MODE       0x02000000
    403 #define ICU_ENCODE_PERCENT     0x00001000
    404 
    405 /* Query flags */
    406 #define WINHTTP_QUERY_MIME_VERSION                 0
    407 #define WINHTTP_QUERY_CONTENT_TYPE                 1
    408 #define WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING    2
    409 #define WINHTTP_QUERY_CONTENT_ID                   3
    410 #define WINHTTP_QUERY_CONTENT_DESCRIPTION          4
    411 #define WINHTTP_QUERY_CONTENT_LENGTH               5
    412 #define WINHTTP_QUERY_CONTENT_LANGUAGE             6
    413 #define WINHTTP_QUERY_ALLOW                        7
    414 #define WINHTTP_QUERY_PUBLIC                       8
    415 #define WINHTTP_QUERY_DATE                         9
    416 #define WINHTTP_QUERY_EXPIRES                      10
    417 #define WINHTTP_QUERY_LAST_MODIFIED                11
    418 #define WINHTTP_QUERY_MESSAGE_ID                   12
    419 #define WINHTTP_QUERY_URI                          13
    420 #define WINHTTP_QUERY_DERIVED_FROM                 14
    421 #define WINHTTP_QUERY_COST                         15
    422 #define WINHTTP_QUERY_LINK                         16
    423 #define WINHTTP_QUERY_PRAGMA                       17
    424 #define WINHTTP_QUERY_VERSION                      18
    425 #define WINHTTP_QUERY_STATUS_CODE                  19
    426 #define WINHTTP_QUERY_STATUS_TEXT                  20
    427 #define WINHTTP_QUERY_RAW_HEADERS                  21
    428 #define WINHTTP_QUERY_RAW_HEADERS_CRLF             22
    429 #define WINHTTP_QUERY_CONNECTION                   23
    430 #define WINHTTP_QUERY_ACCEPT                       24
    431 #define WINHTTP_QUERY_ACCEPT_CHARSET               25
    432 #define WINHTTP_QUERY_ACCEPT_ENCODING              26
    433 #define WINHTTP_QUERY_ACCEPT_LANGUAGE              27
    434 #define WINHTTP_QUERY_AUTHORIZATION                28
    435 #define WINHTTP_QUERY_CONTENT_ENCODING             29
    436 #define WINHTTP_QUERY_FORWARDED                    30
    437 #define WINHTTP_QUERY_FROM                         31
    438 #define WINHTTP_QUERY_IF_MODIFIED_SINCE            32
    439 #define WINHTTP_QUERY_LOCATION                     33
    440 #define WINHTTP_QUERY_ORIG_URI                     34
    441 #define WINHTTP_QUERY_REFERER                      35
    442 #define WINHTTP_QUERY_RETRY_AFTER                  36
    443 #define WINHTTP_QUERY_SERVER                       37
    444 #define WINHTTP_QUERY_TITLE                        38
    445 #define WINHTTP_QUERY_USER_AGENT                   39
    446 #define WINHTTP_QUERY_WWW_AUTHENTICATE             40
    447 #define WINHTTP_QUERY_PROXY_AUTHENTICATE           41
    448 #define WINHTTP_QUERY_ACCEPT_RANGES                42
    449 #define WINHTTP_QUERY_SET_COOKIE                   43
    450 #define WINHTTP_QUERY_COOKIE                       44
    451 #define WINHTTP_QUERY_REQUEST_METHOD               45
    452 #define WINHTTP_QUERY_REFRESH                      46
    453 #define WINHTTP_QUERY_CONTENT_DISPOSITION          47
    454 #define WINHTTP_QUERY_AGE                          48
    455 #define WINHTTP_QUERY_CACHE_CONTROL                49
    456 #define WINHTTP_QUERY_CONTENT_BASE                 50
    457 #define WINHTTP_QUERY_CONTENT_LOCATION             51
    458 #define WINHTTP_QUERY_CONTENT_MD5                  52
    459 #define WINHTTP_QUERY_CONTENT_RANGE                53
    460 #define WINHTTP_QUERY_ETAG                         54
    461 #define WINHTTP_QUERY_HOST                         55
    462 #define WINHTTP_QUERY_IF_MATCH                     56
    463 #define WINHTTP_QUERY_IF_NONE_MATCH                57
    464 #define WINHTTP_QUERY_IF_RANGE                     58
    465 #define WINHTTP_QUERY_IF_UNMODIFIED_SINCE          59
    466 #define WINHTTP_QUERY_MAX_FORWARDS                 60
    467 #define WINHTTP_QUERY_PROXY_AUTHORIZATION          61
    468 #define WINHTTP_QUERY_RANGE                        62
    469 #define WINHTTP_QUERY_TRANSFER_ENCODING            63
    470 #define WINHTTP_QUERY_UPGRADE                      64
    471 #define WINHTTP_QUERY_VARY                         65
    472 #define WINHTTP_QUERY_VIA                          66
    473 #define WINHTTP_QUERY_WARNING                      67
    474 #define WINHTTP_QUERY_EXPECT                       68
    475 #define WINHTTP_QUERY_PROXY_CONNECTION             69
    476 #define WINHTTP_QUERY_UNLESS_MODIFIED_SINCE        70
    477 #define WINHTTP_QUERY_PROXY_SUPPORT                75
    478 #define WINHTTP_QUERY_AUTHENTICATION_INFO          76
    479 #define WINHTTP_QUERY_PASSPORT_URLS                77
    480 #define WINHTTP_QUERY_PASSPORT_CONFIG              78
    481 #define WINHTTP_QUERY_MAX                          78
    482 #define WINHTTP_QUERY_CUSTOM                       65535
    483 #define WINHTTP_QUERY_FLAG_REQUEST_HEADERS         0x80000000
    484 #define WINHTTP_QUERY_FLAG_SYSTEMTIME              0x40000000
    485 #define WINHTTP_QUERY_FLAG_NUMBER                  0x20000000
    486 #define WINHTTP_QUERY_FLAG_NUMBER64                0x08000000
    487 
    488 /* Callback options */
    489 #define WINHTTP_CALLBACK_STATUS_RESOLVING_NAME          0x00000001
    490 #define WINHTTP_CALLBACK_STATUS_NAME_RESOLVED           0x00000002
    491 #define WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER    0x00000004
    492 #define WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER     0x00000008
    493 #define WINHTTP_CALLBACK_STATUS_SENDING_REQUEST         0x00000010
    494 #define WINHTTP_CALLBACK_STATUS_REQUEST_SENT            0x00000020
    495 #define WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE      0x00000040
    496 #define WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED       0x00000080
    497 #define WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION      0x00000100
    498 #define WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED       0x00000200
    499 #define WINHTTP_CALLBACK_STATUS_HANDLE_CREATED          0x00000400
    500 #define WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING          0x00000800
    501 #define WINHTTP_CALLBACK_STATUS_DETECTING_PROXY         0x00001000
    502 #define WINHTTP_CALLBACK_STATUS_REDIRECT                0x00004000
    503 #define WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE   0x00008000
    504 #define WINHTTP_CALLBACK_STATUS_SECURE_FAILURE          0x00010000
    505 #define WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE       0x00020000
    506 #define WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE          0x00040000
    507 #define WINHTTP_CALLBACK_STATUS_READ_COMPLETE           0x00080000
    508 #define WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE          0x00100000
    509 #define WINHTTP_CALLBACK_STATUS_REQUEST_ERROR           0x00200000
    510 #define WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE    0x00400000
    511 #define WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE 0x01000000
    512 #define WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE          0x02000000
    513 #define WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE       0x04000000
    514 #define WINHTTP_CALLBACK_STATUS_SETTINGS_WRITE_COMPLETE 0x10000000
    515 #define WINHTTP_CALLBACK_STATUS_SETTINGS_READ_COMPLETE  0x20000000
    516 #define WINHTTP_CALLBACK_FLAG_RESOLVE_NAME              (WINHTTP_CALLBACK_STATUS_RESOLVING_NAME | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED)
    517 #define WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER         (WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER)
    518 #define WINHTTP_CALLBACK_FLAG_SEND_REQUEST              (WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT)
    519 #define WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE          (WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED)
    520 #define WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION          (WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED)
    521 #define WINHTTP_CALLBACK_FLAG_HANDLES                   (WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING)
    522 #define WINHTTP_CALLBACK_FLAG_DETECTING_PROXY           WINHTTP_CALLBACK_STATUS_DETECTING_PROXY
    523 #define WINHTTP_CALLBACK_FLAG_REDIRECT                  WINHTTP_CALLBACK_STATUS_REDIRECT
    524 #define WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE     WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE
    525 #define WINHTTP_CALLBACK_FLAG_SECURE_FAILURE            WINHTTP_CALLBACK_STATUS_SECURE_FAILURE
    526 #define WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE      WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE
    527 #define WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE         WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE
    528 #define WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE            WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
    529 #define WINHTTP_CALLBACK_FLAG_READ_COMPLETE             WINHTTP_CALLBACK_STATUS_READ_COMPLETE
    530 #define WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE            WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE
    531 #define WINHTTP_CALLBACK_FLAG_REQUEST_ERROR             WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
    532 #define WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE   WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE
    533 #define WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS           (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE \
    534                                                         | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE | WINHTTP_CALLBACK_STATUS_READ_COMPLETE          \
    535                                                         | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR \
    536                                                         | WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE)
    537 #define WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS         0xffffffff
    538 #define WINHTTP_INVALID_STATUS_CALLBACK                 ((WINHTTP_STATUS_CALLBACK)(-1))
    539 
    540 #define API_RECEIVE_RESPONSE          (1)
    541 #define API_QUERY_DATA_AVAILABLE      (2)
    542 #define API_READ_DATA                 (3)
    543 #define API_WRITE_DATA                (4)
    544 #define API_SEND_REQUEST              (5)
    545 #define API_GET_PROXY_FOR_URL         (6)
    546 
    547 #define WINHTTP_HANDLE_TYPE_SESSION                  1
    548 #define WINHTTP_HANDLE_TYPE_CONNECT                  2
    549 #define WINHTTP_HANDLE_TYPE_REQUEST                  3
    550 
    551 #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED         0x00000001
    552 #define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT            0x00000002
    553 #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED            0x00000004
    554 #define WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA              0x00000008
    555 #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID         0x00000010
    556 #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID       0x00000020
    557 #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE        0x00000040
    558 #define WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR  0x80000000
    559 
    560 #define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2   0x00000008
    561 #define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3   0x00000020
    562 #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1   0x00000080
    563 #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 0x00000200
    564 #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 0x00000800
    565 #define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3 0x00002000
    566 #define WINHTTP_FLAG_SECURE_PROTOCOL_ALL    (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 |\
    567                                              WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 |\
    568                                              WINHTTP_FLAG_SECURE_PROTOCOL_TLS1)
    569 
    570 #define WINHTTP_AUTH_SCHEME_BASIC      0x00000001
    571 #define WINHTTP_AUTH_SCHEME_NTLM       0x00000002
    572 #define WINHTTP_AUTH_SCHEME_PASSPORT   0x00000004
    573 #define WINHTTP_AUTH_SCHEME_DIGEST     0x00000008
    574 #define WINHTTP_AUTH_SCHEME_NEGOTIATE  0x00000010
    575 
    576 #define WINHTTP_AUTH_TARGET_SERVER     0x00000000
    577 #define WINHTTP_AUTH_TARGET_PROXY      0x00000001
    578 
    579 #define WINHTTP_TIME_FORMAT_BUFSIZE    62
    580 
    581 typedef struct
    582 {
    583     DWORD   dwStructSize;
    584     LPWSTR  lpszScheme;
    585     DWORD   dwSchemeLength;
    586     INTERNET_SCHEME nScheme;
    587     LPWSTR  lpszHostName;
    588     DWORD   dwHostNameLength;
    589     INTERNET_PORT nPort;
    590     LPWSTR  lpszUserName;
    591     DWORD   dwUserNameLength;
    592     LPWSTR  lpszPassword;
    593     DWORD   dwPasswordLength;
    594     LPWSTR  lpszUrlPath;
    595     DWORD   dwUrlPathLength;
    596     LPWSTR  lpszExtraInfo;
    597     DWORD   dwExtraInfoLength;
    598 } URL_COMPONENTS, *LPURL_COMPONENTS;
    599 typedef URL_COMPONENTS URL_COMPONENTSW;
    600 typedef LPURL_COMPONENTS LPURL_COMPONENTSW;
    601 
    602 typedef struct
    603 {
    604     DWORD_PTR dwResult;
    605     DWORD dwError;
    606 } WINHTTP_ASYNC_RESULT, *LPWINHTTP_ASYNC_RESULT;
    607 
    608 typedef struct
    609 {
    610     FILETIME ftExpiry;
    611     FILETIME ftStart;
    612     LPWSTR lpszSubjectInfo;
    613     LPWSTR lpszIssuerInfo;
    614     LPWSTR lpszProtocolName;
    615     LPWSTR lpszSignatureAlgName;
    616     LPWSTR lpszEncryptionAlgName;
    617     DWORD dwKeySize;
    618 } WINHTTP_CERTIFICATE_INFO;
    619 
    620 typedef struct
    621 {
    622     DWORD dwAccessType;
    623     LPWSTR lpszProxy;
    624     LPWSTR lpszProxyBypass;
    625 } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
    626 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
    627 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;
    628 
    629 typedef struct
    630 {
    631     WINBOOL   fAutoDetect;
    632     LPWSTR lpszAutoConfigUrl;
    633     LPWSTR lpszProxy;
    634     LPWSTR lpszProxyBypass;
    635 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG;
    636 
    637 typedef VOID (CALLBACK *WINHTTP_STATUS_CALLBACK)(HINTERNET,DWORD_PTR,DWORD,LPVOID,DWORD);
    638 typedef WINHTTP_STATUS_CALLBACK * LPWINHTTP_STATUS_CALLBACK;
    639 
    640 #define WINHTTP_AUTO_DETECT_TYPE_DHCP   0x00000001
    641 #define WINHTTP_AUTO_DETECT_TYPE_DNS_A  0x00000002
    642 
    643 #define WINHTTP_AUTOPROXY_AUTO_DETECT           0x00000001
    644 #define WINHTTP_AUTOPROXY_CONFIG_URL            0x00000002
    645 #define WINHTTP_AUTOPROXY_HOST_KEEPCASE         0x00000004
    646 #define WINHTTP_AUTOPROXY_HOST_LOWERCASE        0x00000008
    647 #define WINHTTP_AUTOPROXY_ALLOW_AUTOCONFIG      0x00000100
    648 #define WINHTTP_AUTOPROXY_ALLOW_STATIC          0x00000200
    649 #define WINHTTP_AUTOPROXY_ALLOW_CM              0x00000400
    650 #define WINHTTP_AUTOPROXY_RUN_INPROCESS         0x00010000
    651 #define WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY   0x00020000
    652 #define WINHTTP_AUTOPROXY_NO_DIRECTACCESS       0x00040000
    653 #define WINHTTP_AUTOPROXY_NO_CACHE_CLIENT       0x00080000
    654 #define WINHTTP_AUTOPROXY_NO_CACHE_SVC          0x00100000
    655 #define WINHTTP_AUTOPROXY_SORT_RESULTS          0x00400000
    656 
    657 typedef struct
    658 {
    659     DWORD dwFlags;
    660     DWORD dwAutoDetectFlags;
    661     LPCWSTR lpszAutoConfigUrl;
    662     LPVOID lpvReserved;
    663     DWORD dwReserved;
    664     WINBOOL fAutoLogonIfChallenged;
    665 } WINHTTP_AUTOPROXY_OPTIONS;
    666 
    667 typedef struct _WINHTTP_PROXY_RESULT_ENTRY
    668 {
    669     WINBOOL         fProxy;
    670     WINBOOL         fBypass;
    671     INTERNET_SCHEME ProxyScheme;
    672     PWSTR           pwszProxy;
    673     INTERNET_PORT   ProxyPort;
    674 } WINHTTP_PROXY_RESULT_ENTRY;
    675 
    676 typedef struct _WINHTTP_PROXY_RESULT
    677 {
    678     DWORD cEntries;
    679     WINHTTP_PROXY_RESULT_ENTRY *pEntries;
    680 } WINHTTP_PROXY_RESULT;
    681 
    682 typedef struct _WINHTTP_PROXY_RESULT_EX
    683 {
    684     DWORD cEntries;
    685     WINHTTP_PROXY_RESULT_ENTRY *pEntries;
    686     HANDLE hProxyDetectionHandle;
    687     DWORD dwProxyInterfaceAffinity;
    688 } WINHTTP_PROXY_RESULT_EX;
    689 
    690 #define NETWORKING_KEY_BUFSIZE 128
    691 
    692 typedef struct _WinHttpProxyNetworkKey
    693 {
    694     unsigned char pbBuffer[NETWORKING_KEY_BUFSIZE];
    695 } WINHTTP_PROXY_NETWORKING_KEY, *PWINHTTP_PROXY_NETWORKING_KEY;
    696 
    697 typedef struct _WINHTTP_PROXY_SETTINGS
    698 {
    699     DWORD dwStructSize;
    700     DWORD dwFlags;
    701     DWORD dwCurrentSettingsVersion;
    702     PWSTR pwszConnectionName;
    703     PWSTR pwszProxy;
    704     PWSTR pwszProxyBypass;
    705     PWSTR pwszAutoconfigUrl;
    706     PWSTR pwszAutoconfigSecondaryUrl;
    707     DWORD dwAutoDiscoveryFlags;
    708     PWSTR pwszLastKnownGoodAutoConfigUrl;
    709     DWORD dwAutoconfigReloadDelayMins;
    710     FILETIME ftLastKnownDetectTime;
    711     DWORD dwDetectedInterfaceIpCount;
    712     PDWORD pdwDetectedInterfaceIp;
    713     DWORD cNetworkKeys;
    714     PWINHTTP_PROXY_NETWORKING_KEY pNetworkKeys;
    715 } WINHTTP_PROXY_SETTINGS, *PWINHTTP_PROXY_SETTINGS;
    716 
    717 typedef struct
    718 {
    719     DWORD dwMajorVersion;
    720     DWORD dwMinorVersion;
    721 } HTTP_VERSION_INFO, *LPHTTP_VERSION_INFO;
    722 
    723 #ifdef _WS2DEF_
    724 typedef struct
    725 {
    726     DWORD cbSize;
    727     SOCKADDR_STORAGE LocalAddress;
    728     SOCKADDR_STORAGE RemoteAddress;
    729 } WINHTTP_CONNECTION_INFO;
    730 #endif
    731 
    732 typedef enum _WINHTTP_REQUEST_TIME_ENTRY
    733 {
    734     WinHttpProxyDetectionStart = 0,
    735     WinHttpProxyDetectionEnd,
    736     WinHttpConnectionAcquireStart,
    737     WinHttpConnectionAcquireWaitEnd,
    738     WinHttpConnectionAcquireEnd,
    739     WinHttpNameResolutionStart,
    740     WinHttpNameResolutionEnd,
    741     WinHttpConnectionEstablishmentStart,
    742     WinHttpConnectionEstablishmentEnd,
    743     WinHttpTlsHandshakeClientLeg1Start,
    744     WinHttpTlsHandshakeClientLeg1End,
    745     WinHttpTlsHandshakeClientLeg2Start,
    746     WinHttpTlsHandshakeClientLeg2End,
    747     WinHttpTlsHandshakeClientLeg3Start,
    748     WinHttpTlsHandshakeClientLeg3End,
    749     WinHttpStreamWaitStart,
    750     WinHttpStreamWaitEnd,
    751     WinHttpSendRequestStart,
    752     WinHttpSendRequestHeadersCompressionStart,
    753     WinHttpSendRequestHeadersCompressionEnd,
    754     WinHttpSendRequestHeadersEnd,
    755     WinHttpSendRequestEnd,
    756     WinHttpReceiveResponseStart,
    757     WinHttpReceiveResponseHeadersDecompressionStart,
    758     WinHttpReceiveResponseHeadersDecompressionEnd,
    759     WinHttpReceiveResponseHeadersEnd,
    760     WinHttpReceiveResponseBodyDecompressionDelta,
    761     WinHttpReceiveResponseEnd,
    762     WinHttpProxyTunnelStart,
    763     WinHttpProxyTunnelEnd,
    764     WinHttpProxyTlsHandshakeClientLeg1Start,
    765     WinHttpProxyTlsHandshakeClientLeg1End,
    766     WinHttpProxyTlsHandshakeClientLeg2Start,
    767     WinHttpProxyTlsHandshakeClientLeg2End,
    768     WinHttpProxyTlsHandshakeClientLeg3Start,
    769     WinHttpProxyTlsHandshakeClientLeg3End,
    770     WinHttpRequestTimeLast,
    771     WinHttpRequestTimeMax = 64
    772 } WINHTTP_REQUEST_TIME_ENTRY;
    773 
    774 typedef struct _WINHTTP_REQUEST_TIMES
    775 {
    776     ULONG cTimes;
    777     ULONGLONG rgullTimes[WinHttpRequestTimeMax];
    778 } WINHTTP_REQUEST_TIMES, *PWINHTTP_REQUEST_TIMES;
    779 
    780 typedef enum _WINHTTP_REQUEST_STAT_ENTRY
    781 {
    782     WinHttpConnectFailureCount = 0,
    783     WinHttpProxyFailureCount,
    784     WinHttpTlsHandshakeClientLeg1Size,
    785     WinHttpTlsHandshakeServerLeg1Size,
    786     WinHttpTlsHandshakeClientLeg2Size,
    787     WinHttpTlsHandshakeServerLeg2Size,
    788     WinHttpRequestHeadersSize,
    789     WinHttpRequestHeadersCompressedSize,
    790     WinHttpResponseHeadersSize,
    791     WinHttpResponseHeadersCompressedSize,
    792     WinHttpResponseBodySize,
    793     WinHttpResponseBodyCompressedSize,
    794     WinHttpProxyTlsHandshakeClientLeg1Size,
    795     WinHttpProxyTlsHandshakeServerLeg1Size,
    796     WinHttpProxyTlsHandshakeClientLeg2Size,
    797     WinHttpProxyTlsHandshakeServerLeg2Size,
    798     WinHttpRequestStatLast,
    799     WinHttpRequestStatMax = 32
    800 } WINHTTP_REQUEST_STAT_ENTRY;
    801 
    802 #define WINHTTP_REQUEST_STAT_FLAG_TCP_FAST_OPEN                 0x00000001
    803 #define WINHTTP_REQUEST_STAT_FLAG_TLS_SESSION_RESUMPTION        0x00000002
    804 #define WINHTTP_REQUEST_STAT_FLAG_TLS_FALSE_START               0x00000004
    805 #define WINHTTP_REQUEST_STAT_FLAG_PROXY_TLS_SESSION_RESUMPTION  0x00000008
    806 #define WINHTTP_REQUEST_STAT_FLAG_PROXY_TLS_FALSE_START         0x00000010
    807 #define WINHTTP_REQUEST_STAT_FLAG_FIRST_REQUEST                 0x00000020
    808 
    809 typedef struct _WINHTTP_REQUEST_STATS
    810 {
    811     ULONGLONG ullFlags;
    812     ULONG ulIndex;
    813     ULONG cStats;
    814     ULONGLONG rgullStats[WinHttpRequestStatMax];
    815 } WINHTTP_REQUEST_STATS, *PWINHTTP_REQUEST_STATS;
    816 
    817 typedef enum _WINHTTP_WEB_SOCKET_OPERATION
    818 {
    819     WINHTTP_WEB_SOCKET_SEND_OPERATION     = 0,
    820     WINHTTP_WEB_SOCKET_RECEIVE_OPERATION  = 1,
    821     WINHTTP_WEB_SOCKET_CLOSE_OPERATION    = 2,
    822     WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3
    823 } WINHTTP_WEB_SOCKET_OPERATION;
    824 
    825 typedef enum _WINHTTP_WEB_SOCKET_BUFFER_TYPE
    826 {
    827     WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE  = 0,
    828     WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1,
    829     WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE    = 2,
    830     WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE   = 3,
    831     WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE           = 4
    832 } WINHTTP_WEB_SOCKET_BUFFER_TYPE;
    833 
    834 typedef enum _WINHTTP_WEB_SOCKET_CLOSE_STATUS
    835 {
    836     WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS                = 1000,
    837     WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS    = 1001,
    838     WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS         = 1002,
    839     WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS      = 1003,
    840     WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS                  = 1005,
    841     WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS                = 1006,
    842     WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS        = 1007,
    843     WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS       = 1008,
    844     WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS        = 1009,
    845     WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010,
    846     WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS           = 1011,
    847     WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015
    848 } WINHTTP_WEB_SOCKET_CLOSE_STATUS;
    849 
    850 typedef struct _WINHTTP_WEB_SOCKET_ASYNC_RESULT
    851 {
    852     WINHTTP_ASYNC_RESULT AsyncResult;
    853     WINHTTP_WEB_SOCKET_OPERATION Operation;
    854 } WINHTTP_WEB_SOCKET_ASYNC_RESULT;
    855 
    856 typedef struct _WINHTTP_WEB_SOCKET_STATUS
    857 {
    858     DWORD dwBytesTransferred;
    859     WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType;
    860 } WINHTTP_WEB_SOCKET_STATUS;
    861 
    862 #define WINHTTP_WEB_SOCKET_MAX_CLOSE_REASON_LENGTH   123
    863 #define WINHTTP_WEB_SOCKET_MIN_KEEPALIVE_VALUE     15000
    864 
    865 #ifdef __SCHANNEL_H__
    866 
    867 typedef struct _WINHTTP_SECURITY_INFO
    868 {
    869     SecPkgContext_ConnectionInfo ConnectionInfo;
    870     SecPkgContext_CipherInfo CipherInfo;
    871 } WINHTTP_SECURITY_INFO, *PWINHTTP_SECURITY_INFO;
    872 
    873 #endif
    874 
    875 #ifdef __cplusplus
    876 extern "C" {
    877 #endif
    878 
    879 WINHTTPAPI WINBOOL     WINAPI WinHttpAddRequestHeaders(HINTERNET,LPCWSTR,DWORD,DWORD);
    880 WINHTTPAPI WINBOOL     WINAPI WinHttpDetectAutoProxyConfigUrl(DWORD,LPWSTR*);
    881 WINHTTPAPI WINBOOL     WINAPI WinHttpCheckPlatform(void);
    882 WINHTTPAPI WINBOOL     WINAPI WinHttpCloseHandle(HINTERNET);
    883 WINHTTPAPI HINTERNET   WINAPI WinHttpConnect(HINTERNET,LPCWSTR,INTERNET_PORT,DWORD);
    884 WINHTTPAPI WINBOOL     WINAPI WinHttpCrackUrl(LPCWSTR,DWORD,DWORD,LPURL_COMPONENTS);
    885 WINHTTPAPI DWORD       WINAPI WinHttpCreateProxyResolver(HINTERNET,HINTERNET*);
    886 WINHTTPAPI WINBOOL     WINAPI WinHttpCreateUrl(LPURL_COMPONENTS,DWORD,LPWSTR,LPDWORD);
    887 WINHTTPAPI VOID        WINAPI WinHttpFreeProxyResult(WINHTTP_PROXY_RESULT*);
    888 WINHTTPAPI VOID        WINAPI WinHttpFreeProxyResultEx(WINHTTP_PROXY_RESULT_EX*);
    889 WINHTTPAPI VOID        WINAPI WinHttpFreeProxySettings(WINHTTP_PROXY_SETTINGS*);
    890 WINHTTPAPI WINBOOL     WINAPI WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
    891 WINHTTPAPI WINBOOL     WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG*);
    892 WINHTTPAPI WINBOOL     WINAPI WinHttpGetProxyForUrl(HINTERNET,LPCWSTR,WINHTTP_AUTOPROXY_OPTIONS*,WINHTTP_PROXY_INFO*);
    893 WINHTTPAPI DWORD       WINAPI WinHttpGetProxyForUrlEx(HINTERNET,PCWSTR,WINHTTP_AUTOPROXY_OPTIONS*,DWORD_PTR);
    894 WINHTTPAPI DWORD       WINAPI WinHttpGetProxyForUrlEx2(HINTERNET,PCWSTR,WINHTTP_AUTOPROXY_OPTIONS*,DWORD,BYTE*,DWORD_PTR);
    895 WINHTTPAPI DWORD       WINAPI WinHttpGetProxyResult(HINTERNET,WINHTTP_PROXY_RESULT*);
    896 WINHTTPAPI DWORD       WINAPI WinHttpGetProxyResultEx(HINTERNET,WINHTTP_PROXY_RESULT_EX*);
    897 WINHTTPAPI DWORD       WINAPI WinHttpGetProxySettingsVersion(HINTERNET,DWORD*);
    898 WINHTTPAPI DWORD       WINAPI WinHttpIsHostInProxyBypassList(const WINHTTP_PROXY_INFO*,PCWSTR,INTERNET_SCHEME,INTERNET_PORT,WINBOOL*);
    899 WINHTTPAPI HINTERNET   WINAPI WinHttpOpen(LPCWSTR,DWORD,LPCWSTR,LPCWSTR,DWORD);
    900 WINHTTPAPI HINTERNET   WINAPI WinHttpOpenRequest(HINTERNET,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR*,DWORD);
    901 WINHTTPAPI WINBOOL     WINAPI WinHttpQueryAuthParams(HINTERNET,DWORD,LPVOID*);
    902 WINHTTPAPI WINBOOL     WINAPI WinHttpQueryAuthSchemes(HINTERNET,LPDWORD,LPDWORD,LPDWORD);
    903 WINHTTPAPI WINBOOL     WINAPI WinHttpQueryDataAvailable(HINTERNET,LPDWORD);
    904 WINHTTPAPI WINBOOL     WINAPI WinHttpQueryHeaders(HINTERNET,DWORD,LPCWSTR,LPVOID,LPDWORD,LPDWORD);
    905 WINHTTPAPI WINBOOL     WINAPI WinHttpQueryOption(HINTERNET,DWORD,LPVOID,LPDWORD);
    906 WINHTTPAPI WINBOOL     WINAPI WinHttpReadData(HINTERNET,LPVOID,DWORD,LPDWORD);
    907 WINHTTPAPI DWORD       WINAPI WinHttpReadProxySettings(HINTERNET,PCWSTR,WINBOOL,WINBOOL,DWORD*,WINBOOL*,WINHTTP_PROXY_SETTINGS*);
    908 WINHTTPAPI WINBOOL     WINAPI WinHttpReceiveResponse(HINTERNET,LPVOID);
    909 WINHTTPAPI DWORD       WINAPI WinHttpResetAutoProxy(HINTERNET,DWORD);
    910 WINHTTPAPI WINBOOL     WINAPI WinHttpSendRequest(HINTERNET,LPCWSTR,DWORD,LPVOID,DWORD,DWORD,DWORD_PTR);
    911 WINHTTPAPI WINBOOL     WINAPI WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO*);
    912 WINHTTPAPI WINBOOL     WINAPI WinHttpSetCredentials(HINTERNET,DWORD,DWORD,LPCWSTR,LPCWSTR,LPVOID);
    913 WINHTTPAPI WINBOOL     WINAPI WinHttpSetOption(HINTERNET,DWORD,LPVOID,DWORD);
    914 WINHTTPAPI WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback(HINTERNET,WINHTTP_STATUS_CALLBACK,DWORD,DWORD_PTR);
    915 WINHTTPAPI WINBOOL     WINAPI WinHttpSetTimeouts(HINTERNET,int,int,int,int);
    916 WINHTTPAPI WINBOOL     WINAPI WinHttpTimeFromSystemTime(const SYSTEMTIME *,LPWSTR);
    917 WINHTTPAPI WINBOOL     WINAPI WinHttpTimeToSystemTime(LPCWSTR,SYSTEMTIME*);
    918 WINHTTPAPI DWORD       WINAPI WinHttpWebSocketClose(HINTERNET,USHORT,void *,DWORD);
    919 WINHTTPAPI HINTERNET   WINAPI WinHttpWebSocketCompleteUpgrade(HINTERNET,DWORD_PTR);
    920 WINHTTPAPI DWORD       WINAPI WinHttpWebSocketQueryCloseStatus(HINTERNET,USHORT*,void*,DWORD,DWORD*);
    921 WINHTTPAPI DWORD       WINAPI WinHttpWebSocketReceive(HINTERNET,void*,DWORD,DWORD*,WINHTTP_WEB_SOCKET_BUFFER_TYPE*);
    922 WINHTTPAPI DWORD       WINAPI WinHttpWebSocketSend(HINTERNET,WINHTTP_WEB_SOCKET_BUFFER_TYPE,void*,DWORD);
    923 WINHTTPAPI DWORD       WINAPI WinHttpWebSocketShutdown(HINTERNET,USHORT,void*,DWORD);
    924 WINHTTPAPI WINBOOL     WINAPI WinHttpWriteData(HINTERNET,LPCVOID,DWORD,LPDWORD);
    925 WINHTTPAPI DWORD       WINAPI WinHttpWriteProxySettings(HINTERNET,WINBOOL,WINHTTP_PROXY_SETTINGS*);
    926 
    927 #ifdef __cplusplus
    928 }
    929 #endif
    930 
    931 #pragma pack(pop)
    932 
    933 #endif  /* __WINE_WINHTTP_H */