1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_wininet.d)
9  */
10 module core.sys.windows.wininet;
11 version (Windows):
12 
13 version (ANSI) {} else version = Unicode;
14 pragma(lib, "wininet");
15 
16 // FIXME: check types and grouping of constants
17 
18 import core.sys.windows.winbase, core.sys.windows.windef;
19 
20 // From Winineti.h
21 enum {
22     INTERNET_FLAG_BGUPDATE         = 0x00000008,
23 }
24 
25 enum {
26     INTERNET_INVALID_PORT_NUMBER =    0,
27     INTERNET_DEFAULT_FTP_PORT    =   21,
28     INTERNET_DEFAULT_GOPHER_PORT =   70,
29     INTERNET_DEFAULT_HTTP_PORT   =   80,
30     INTERNET_DEFAULT_HTTPS_PORT  =  443,
31     INTERNET_DEFAULT_SOCKS_PORT  = 1080
32 }
33 
34 enum size_t
35     MAX_CACHE_ENTRY_INFO_SIZE       =  4096,
36     INTERNET_MAX_HOST_NAME_LENGTH   =   256,
37     INTERNET_MAX_USER_NAME_LENGTH   =   128,
38     INTERNET_MAX_PASSWORD_LENGTH    =   128,
39     INTERNET_MAX_PORT_NUMBER_LENGTH =     5,
40     INTERNET_MAX_PORT_NUMBER_VALUE  = 65535,
41     INTERNET_MAX_PATH_LENGTH        =  2048,
42     INTERNET_MAX_SCHEME_LENGTH      =    32,
43     INTERNET_MAX_URL_LENGTH         = INTERNET_MAX_SCHEME_LENGTH
44                                       + "://".length
45                                       + INTERNET_MAX_PATH_LENGTH;
46 
47 enum : DWORD {
48     INTERNET_KEEP_ALIVE_UNKNOWN  = DWORD.max,
49     INTERNET_KEEP_ALIVE_DISABLED = 0,
50     INTERNET_KEEP_ALIVE_ENABLED
51 }
52 
53 enum {
54     INTERNET_REQFLAG_FROM_CACHE           = 0x00000001,
55     INTERNET_REQFLAG_ASYNC                = 0x00000002,
56     INTERNET_REQFLAG_VIA_PROXY            = 0x00000004,
57     INTERNET_REQFLAG_NO_HEADERS           = 0x00000008,
58     INTERNET_REQFLAG_PASSIVE              = 0x00000010,
59     INTERNET_REQFLAG_CACHE_WRITE_DISABLED = 0x00000040,
60     INTERNET_REQFLAG_NET_TIMEOUT          = 0x00000080,
61 }
62 
63 enum {
64     INTERNET_FLAG_IDN_DIRECT = 0x00000001,
65     INTERNET_FLAG_IDN_PROXY  = 0x00000002
66 }
67 
68 enum DWORD
69     INTERNET_FLAG_RELOAD                   = 0x80000000,
70     INTERNET_FLAG_RAW_DATA                 = 0x40000000,
71     INTERNET_FLAG_EXISTING_CONNECT         = 0x20000000,
72     INTERNET_FLAG_ASYNC                    = 0x10000000,
73     INTERNET_FLAG_PASSIVE                  = 0x08000000,
74     INTERNET_FLAG_NO_CACHE_WRITE           = 0x04000000,
75     INTERNET_FLAG_DONT_CACHE               = INTERNET_FLAG_NO_CACHE_WRITE,
76     INTERNET_FLAG_MAKE_PERSISTENT          = 0x02000000,
77     INTERNET_FLAG_FROM_CACHE               = 0x01000000,
78     INTERNET_FLAG_OFFLINE                  = INTERNET_FLAG_FROM_CACHE,
79     INTERNET_FLAG_SECURE                   = 0x00800000,
80     INTERNET_FLAG_KEEP_CONNECTION          = 0x00400000,
81     INTERNET_FLAG_NO_AUTO_REDIRECT         = 0x00200000,
82     INTERNET_FLAG_READ_PREFETCH            = 0x00100000,
83     INTERNET_FLAG_NO_COOKIES               = 0x00080000,
84     INTERNET_FLAG_NO_AUTH                  = 0x00040000,
85     INTERNET_FLAG_RESTRICTED_ZONE          = 0x00020000,
86     INTERNET_FLAG_CACHE_IF_NET_FAIL        = 0x00010000,
87     INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP  = 0x00008000,
88     INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS = 0x00004000,
89     INTERNET_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000,
90     INTERNET_FLAG_IGNORE_CERT_CN_INVALID   = 0x00001000,
91     INTERNET_FLAG_RESYNCHRONIZE            = 0x00000800,
92     INTERNET_FLAG_HYPERLINK                = 0x00000400,
93     INTERNET_FLAG_NO_UI                    = 0x00000200,
94     INTERNET_FLAG_PRAGMA_NOCACHE           = 0x00000100,
95     INTERNET_FLAG_CACHE_ASYNC              = 0x00000080,
96     INTERNET_FLAG_FORMS_SUBMIT             = 0x00000040,
97     INTERNET_FLAG_FWD_BACK                 = 0x00000020,
98     INTERNET_FLAG_NEED_FILE                = 0x00000010,
99     INTERNET_FLAG_MUST_CACHE_REQUEST       = INTERNET_FLAG_NEED_FILE,
100     INTERNET_FLAG_TRANSFER_ASCII           = FTP_TRANSFER_TYPE_ASCII,
101     INTERNET_FLAG_TRANSFER_BINARY          = FTP_TRANSFER_TYPE_BINARY,
102 
103     SECURITY_INTERNET_MASK                 = INTERNET_FLAG_IGNORE_CERT_CN_INVALID   |
104                                              INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
105                                              INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS |
106                                              INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP,
107 
108     SECURITY_SET_MASK                      = SECURITY_INTERNET_MASK,
109 
110     INTERNET_FLAGS_MASK                    = INTERNET_FLAG_RELOAD
111                                             | INTERNET_FLAG_RAW_DATA
112                                             | INTERNET_FLAG_EXISTING_CONNECT
113                                             | INTERNET_FLAG_ASYNC
114                                             | INTERNET_FLAG_PASSIVE
115                                             | INTERNET_FLAG_NO_CACHE_WRITE
116                                             | INTERNET_FLAG_MAKE_PERSISTENT
117                                             | INTERNET_FLAG_FROM_CACHE
118                                             | INTERNET_FLAG_SECURE
119                                             | INTERNET_FLAG_KEEP_CONNECTION
120                                             | INTERNET_FLAG_NO_AUTO_REDIRECT
121                                             | INTERNET_FLAG_READ_PREFETCH
122                                             | INTERNET_FLAG_NO_COOKIES
123                                             | INTERNET_FLAG_NO_AUTH
124                                             | INTERNET_FLAG_CACHE_IF_NET_FAIL
125                                             | SECURITY_INTERNET_MASK
126                                             | INTERNET_FLAG_RESYNCHRONIZE
127                                             | INTERNET_FLAG_HYPERLINK
128                                             | INTERNET_FLAG_NO_UI
129                                             | INTERNET_FLAG_PRAGMA_NOCACHE
130                                             | INTERNET_FLAG_CACHE_ASYNC
131                                             | INTERNET_FLAG_FORMS_SUBMIT
132                                             | INTERNET_FLAG_NEED_FILE
133                                             | INTERNET_FLAG_RESTRICTED_ZONE
134                                             | INTERNET_FLAG_TRANSFER_BINARY
135                                             | INTERNET_FLAG_TRANSFER_ASCII
136                                             | INTERNET_FLAG_FWD_BACK
137                                             | INTERNET_FLAG_BGUPDATE,
138 
139     INTERNET_ERROR_MASK_INSERT_CDROM                      = 0x1,
140     INTERNET_ERROR_MASK_COMBINED_SEC_CERT                 = 0x2,
141     INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG                 = 0X4,
142     INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY = 0x8,
143 
144     INTERNET_OPTIONS_MASK                  = ~INTERNET_FLAGS_MASK;
145 
146 enum INTERNET_NO_CALLBACK = 0;
147 enum INTERNET_RFC1123_FORMAT = 0;
148 enum size_t INTERNET_RFC1123_BUFSIZE = 30;
149 
150 enum DWORD
151     ICU_ESCAPE             = 0x80000000,
152     ICU_USERNAME           = 0x40000000,
153     ICU_NO_ENCODE          = 0x20000000,
154     ICU_DECODE             = 0x10000000,
155     ICU_NO_META            = 0x08000000,
156     ICU_ENCODE_SPACES_ONLY = 0x04000000,
157     ICU_BROWSER_MODE       = 0x02000000;
158 
159 enum {
160     INTERNET_OPEN_TYPE_PRECONFIG = 0,
161     INTERNET_OPEN_TYPE_DIRECT    = 1,
162     INTERNET_OPEN_TYPE_PROXY     = 3,
163     PRE_CONFIG_INTERNET_ACCESS   = INTERNET_OPEN_TYPE_PRECONFIG,
164     LOCAL_INTERNET_ACCESS        = INTERNET_OPEN_TYPE_DIRECT,
165     GATEWAY_INTERNET_ACCESS      = 2,
166     CERN_PROXY_INTERNET_ACCESS   = INTERNET_OPEN_TYPE_PROXY,
167 }
168 
169 enum ISO_GLOBAL      = 1;
170 enum ISO_REGISTRY    = 2;
171 enum ISO_VALID_FLAGS = ISO_GLOBAL | ISO_REGISTRY;
172 
173 enum {
174     INTERNET_OPTION_CALLBACK                    =  1,
175     INTERNET_OPTION_CONNECT_TIMEOUT,
176     INTERNET_OPTION_CONNECT_RETRIES,
177     INTERNET_OPTION_CONNECT_BACKOFF,
178     INTERNET_OPTION_SEND_TIMEOUT,
179     INTERNET_OPTION_CONTROL_SEND_TIMEOUT        = INTERNET_OPTION_SEND_TIMEOUT,
180     INTERNET_OPTION_RECEIVE_TIMEOUT,
181     INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT  = INTERNET_OPTION_RECEIVE_TIMEOUT,
182     INTERNET_OPTION_DATA_SEND_TIMEOUT,
183     INTERNET_OPTION_DATA_RECEIVE_TIMEOUT,
184     INTERNET_OPTION_HANDLE_TYPE                 = 9,
185     INTERNET_OPTION_LISTEN_TIMEOUT              = 11,
186     INTERNET_OPTION_READ_BUFFER_SIZE,
187     INTERNET_OPTION_WRITE_BUFFER_SIZE,       // = 13
188     INTERNET_OPTION_ASYNC_ID                    = 15,
189     INTERNET_OPTION_ASYNC_PRIORITY,          // = 16
190     INTERNET_OPTION_PARENT_HANDLE               = 21,
191     INTERNET_OPTION_KEEP_CONNECTION,
192     INTERNET_OPTION_REQUEST_FLAGS,
193     INTERNET_OPTION_EXTENDED_ERROR,          // = 24
194     INTERNET_OPTION_OFFLINE_MODE                = 26,
195     INTERNET_OPTION_CACHE_STREAM_HANDLE,
196     INTERNET_OPTION_USERNAME,
197     INTERNET_OPTION_PASSWORD,
198     INTERNET_OPTION_ASYNC,
199     INTERNET_OPTION_SECURITY_FLAGS,
200     INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
201     INTERNET_OPTION_DATAFILE_NAME,
202     INTERNET_OPTION_URL,
203     INTERNET_OPTION_SECURITY_CERTIFICATE,
204     INTERNET_OPTION_SECURITY_KEY_BITNESS,
205     INTERNET_OPTION_REFRESH,
206     INTERNET_OPTION_PROXY,
207     INTERNET_OPTION_SETTINGS_CHANGED,
208     INTERNET_OPTION_VERSION,
209     INTERNET_OPTION_USER_AGENT,
210     INTERNET_OPTION_END_BROWSER_SESSION,
211     INTERNET_OPTION_PROXY_USERNAME,
212     INTERNET_OPTION_PROXY_PASSWORD,          // = 44
213     INTERNET_OPTION_CONTEXT_VALUE          = 45,
214     INTERNET_OPTION_CONNECT_LIMIT          = 46,
215     INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT= 47,
216     INTERNET_OPTION_POLICY                 = 48,
217     INTERNET_OPTION_DISCONNECTED_TIMEOUT   = 49,
218     INTERNET_OPTION_CONNECTED_STATE        = 50,
219     INTERNET_OPTION_IDLE_STATE             = 51,
220     INTERNET_OPTION_OFFLINE_SEMANTICS      = 52,
221     INTERNET_OPTION_SECONDARY_CACHE_KEY    = 53,
222     INTERNET_OPTION_CALLBACK_FILTER        = 54,
223     INTERNET_OPTION_CONNECT_TIME           = 55,
224     INTERNET_OPTION_SEND_THROUGHPUT        = 56,
225     INTERNET_OPTION_RECEIVE_THROUGHPUT     = 57,
226     INTERNET_OPTION_REQUEST_PRIORITY       = 58,
227     INTERNET_OPTION_HTTP_VERSION           = 59,
228     INTERNET_OPTION_RESET_URLCACHE_SESSION = 60,
229     INTERNET_OPTION_ERROR_MASK             = 62,
230     INTERNET_OPTION_FROM_CACHE_TIMEOUT     = 63,
231     INTERNET_OPTION_BYPASS_EDITED_ENTRY    = 64,
232     INTERNET_OPTION_HTTP_DECODING          = 65,
233     INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO = 67,
234     INTERNET_OPTION_CODEPAGE               = 68,
235     INTERNET_OPTION_CACHE_TIMESTAMPS       = 69,
236     INTERNET_OPTION_DISABLE_AUTODIAL       = 70,
237     INTERNET_OPTION_MAX_CONNS_PER_SERVER    = 73,
238     INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER= 74,
239     INTERNET_OPTION_PER_CONNECTION_OPTION  = 75,
240     INTERNET_OPTION_DIGEST_AUTH_UNLOAD            = 76,
241     INTERNET_OPTION_IGNORE_OFFLINE          = 77,
242     INTERNET_OPTION_IDENTITY                = 78,
243     INTERNET_OPTION_REMOVE_IDENTITY         = 79,
244     INTERNET_OPTION_ALTER_IDENTITY          = 80,
245     INTERNET_OPTION_SUPPRESS_BEHAVIOR       = 81,
246     INTERNET_OPTION_AUTODIAL_MODE           = 82,
247     INTERNET_OPTION_AUTODIAL_CONNECTION     = 83,
248     INTERNET_OPTION_CLIENT_CERT_CONTEXT     = 84,
249     INTERNET_OPTION_AUTH_FLAGS              = 85,
250     INTERNET_OPTION_COOKIES_3RD_PARTY       = 86,
251     INTERNET_OPTION_DISABLE_PASSPORT_AUTH   = 87,
252     INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY        = 88,
253     INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT = 89,
254     INTERNET_OPTION_ENABLE_PASSPORT_AUTH    = 90,
255     INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS      = 91,
256     INTERNET_OPTION_ACTIVATE_WORKER_THREADS                = 92,
257     INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS         = 93,
258     INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH              = 94,
259     INTERNET_OPTION_PROXY_SETTINGS_CHANGED                 = 95,
260     INTERNET_OPTION_DATAFILE_EXT                           = 96,
261     INTERNET_OPTION_CODEPAGE_PATH               = 100,
262     INTERNET_OPTION_CODEPAGE_EXTRA              = 101,
263     INTERNET_OPTION_IDN                         = 102,
264     INTERNET_OPTION_MAX_CONNS_PER_PROXY         = 103,
265     INTERNET_OPTION_SUPPRESS_SERVER_AUTH        = 104,
266     INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT   = 105,
267     INTERNET_OPTION_ENABLE_REDIRECT_CACHE_READ  = 122,
268     INTERNET_OPTION_COMPRESSED_CONTENT_LENGTH   = 147,
269     INTERNET_OPTION_ENABLE_HTTP_PROTOCOL        = 148,
270     INTERNET_OPTION_HTTP_PROTOCOL_USED          = 149,
271     INTERNET_OPTION_ENCODE_EXTRA                = 155,
272     INTERNET_OPTION_HSTS                        = 157,
273     INTERNET_OPTION_ENTERPRISE_CONTEXT          = 159,
274     INTERNET_OPTION_CONNECTION_FILTER           = 162,
275     INTERNET_OPTION_REFERER_TOKEN_BINDING_HOSTNAME         = 163,
276     INTERNET_OPTION_TOKEN_BINDING_PUBLIC_KEY    = 181,
277     INTERNET_OPTION_COOKIES_SAME_SITE_LEVEL     = 187,
278     INTERNET_FIRST_OPTION                  = INTERNET_OPTION_CALLBACK,
279     INTERNET_LAST_OPTION                   = INTERNET_OPTION_COOKIES_SAME_SITE_LEVEL,
280 }
281 
282 enum INTERNET_PRIORITY_FOREGROUND = 1000;
283 
284 enum {
285     INTERNET_HANDLE_TYPE_INTERNET = 1,
286     INTERNET_HANDLE_TYPE_CONNECT_FTP,
287     INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
288     INTERNET_HANDLE_TYPE_CONNECT_HTTP,
289     INTERNET_HANDLE_TYPE_FTP_FIND,
290     INTERNET_HANDLE_TYPE_FTP_FIND_HTML,
291     INTERNET_HANDLE_TYPE_FTP_FILE,
292     INTERNET_HANDLE_TYPE_FTP_FILE_HTML,
293     INTERNET_HANDLE_TYPE_GOPHER_FIND,
294     INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML,
295     INTERNET_HANDLE_TYPE_GOPHER_FILE,
296     INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML,
297     INTERNET_HANDLE_TYPE_HTTP_REQUEST
298 }
299 
300 enum DWORD
301     SECURITY_FLAG_SECURE                   = 0x00000001,
302     SECURITY_FLAG_SSL                      = 0x00000002,
303     SECURITY_FLAG_SSL3                     = 0x00000004,
304     SECURITY_FLAG_PCT                      = 0x00000008,
305     SECURITY_FLAG_PCT4                     = 0x00000010,
306     SECURITY_FLAG_IETFSSL4                 = 0x00000020,
307     SECURITY_FLAG_IGNORE_REVOCATION        = 0x00000080,
308     SECURITY_FLAG_IGNORE_UNKNOWN_CA        = 0x00000100,
309     SECURITY_FLAG_IGNORE_WRONG_USAGE       = 0x00000200,
310     SECURITY_FLAG_40BIT                    = 0x10000000,
311     SECURITY_FLAG_128BIT                   = 0x20000000,
312     SECURITY_FLAG_56BIT                    = 0x40000000,
313     SECURITY_FLAG_UNKNOWNBIT               = 0x80000000,
314     SECURITY_FLAG_NORMALBITNESS            = SECURITY_FLAG_40BIT,
315     SECURITY_FLAG_IGNORE_CERT_CN_INVALID   = INTERNET_FLAG_IGNORE_CERT_CN_INVALID,
316     SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID,
317     SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS,
318     SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP  = INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP;
319 
320 enum {
321     INTERNET_SERVICE_FTP = 1,
322     INTERNET_SERVICE_GOPHER,
323     INTERNET_SERVICE_HTTP
324 }
325 
326 enum {
327     INTERNET_STATUS_RESOLVING_NAME        =  10,
328     INTERNET_STATUS_NAME_RESOLVED         =  11,
329     INTERNET_STATUS_CONNECTING_TO_SERVER  =  20,
330     INTERNET_STATUS_CONNECTED_TO_SERVER   =  21,
331     INTERNET_STATUS_SENDING_REQUEST       =  30,
332     INTERNET_STATUS_REQUEST_SENT          =  31,
333     INTERNET_STATUS_RECEIVING_RESPONSE    =  40,
334     INTERNET_STATUS_RESPONSE_RECEIVED     =  41,
335     INTERNET_STATUS_CTL_RESPONSE_RECEIVED =  42,
336     INTERNET_STATUS_PREFETCH              =  43,
337     INTERNET_STATUS_CLOSING_CONNECTION    =  50,
338     INTERNET_STATUS_CONNECTION_CLOSED     =  51,
339     INTERNET_STATUS_HANDLE_CREATED        =  60,
340     INTERNET_STATUS_HANDLE_CLOSING        =  70,
341     INTERNET_STATUS_REQUEST_COMPLETE      = 100,
342     INTERNET_STATUS_REDIRECT              = 110
343 }
344 
345 enum {
346     FTP_TRANSFER_TYPE_UNKNOWN = 0,
347     FTP_TRANSFER_TYPE_ASCII   = 1,
348     FTP_TRANSFER_TYPE_BINARY  = 2,
349     FTP_TRANSFER_TYPE_MASK    = 3
350 }
351 
352 enum size_t
353     MAX_GOPHER_DISPLAY_TEXT   = 128,
354     MAX_GOPHER_SELECTOR_TEXT  = 256,
355     MAX_GOPHER_HOST_NAME      = INTERNET_MAX_HOST_NAME_LENGTH,
356     MAX_GOPHER_LOCATOR_LENGTH
357       = 1 + MAX_GOPHER_DISPLAY_TEXT + 1 + MAX_GOPHER_SELECTOR_TEXT + 1
358         + MAX_GOPHER_HOST_NAME + 1 + INTERNET_MAX_PORT_NUMBER_LENGTH + 4;
359 
360 enum DWORD
361     GOPHER_TYPE_TEXT_FILE      = 0x00000001,
362     GOPHER_TYPE_DIRECTORY      = 0x00000002,
363     GOPHER_TYPE_CSO            = 0x00000004,
364     GOPHER_TYPE_ERROR          = 0x00000008,
365     GOPHER_TYPE_MAC_BINHEX     = 0x00000010,
366     GOPHER_TYPE_DOS_ARCHIVE    = 0x00000020,
367     GOPHER_TYPE_UNIX_UUENCODED = 0x00000040,
368     GOPHER_TYPE_INDEX_SERVER   = 0x00000080,
369     GOPHER_TYPE_TELNET         = 0x00000100,
370     GOPHER_TYPE_BINARY         = 0x00000200,
371     GOPHER_TYPE_REDUNDANT      = 0x00000400,
372     GOPHER_TYPE_TN3270         = 0x00000800,
373     GOPHER_TYPE_GIF            = 0x00001000,
374     GOPHER_TYPE_IMAGE          = 0x00002000,
375     GOPHER_TYPE_BITMAP         = 0x00004000,
376     GOPHER_TYPE_MOVIE          = 0x00008000,
377     GOPHER_TYPE_SOUND          = 0x00010000,
378     GOPHER_TYPE_HTML           = 0x00020000,
379     GOPHER_TYPE_PDF            = 0x00040000,
380     GOPHER_TYPE_CALENDAR       = 0x00080000,
381     GOPHER_TYPE_INLINE         = 0x00100000,
382     GOPHER_TYPE_UNKNOWN        = 0x20000000,
383     GOPHER_TYPE_ASK            = 0x40000000,
384     GOPHER_TYPE_GOPHER_PLUS    = 0x80000000,
385     GOPHER_TYPE_FILE_MASK      = 0x001FF271;
386 
387 BOOL IS_GOPHER_FILE(DWORD t) {
388     return !!(t & GOPHER_TYPE_FILE_MASK);
389 }
390 
391 BOOL IS_GOPHER_DIRECTORY(DWORD t) {
392     return !!(t & GOPHER_TYPE_DIRECTORY);
393 }
394 
395 BOOL IS_GOPHER_PHONE_SERVER(DWORD t) {
396     return !!(t & GOPHER_TYPE_CSO);
397 }
398 
399 BOOL IS_GOPHER_ERROR(DWORD t) {
400     return !!(t & GOPHER_TYPE_ERROR);
401 }
402 
403 BOOL IS_GOPHER_INDEX_SERVER(DWORD t) {
404     return !!(t & GOPHER_TYPE_INDEX_SERVER);
405 }
406 
407 BOOL IS_GOPHER_TELNET_SESSION(DWORD t) {
408     return !!(t & GOPHER_TYPE_TELNET);
409 }
410 
411 BOOL IS_GOPHER_BACKUP_SERVER(DWORD t) {
412     return !!(t & GOPHER_TYPE_REDUNDANT);
413 }
414 
415 BOOL IS_GOPHER_TN3270_SESSION(DWORD t) {
416     return !!(t & GOPHER_TYPE_TN3270);
417 }
418 
419 BOOL IS_GOPHER_ASK(DWORD t) {
420     return !!(t & GOPHER_TYPE_ASK);
421 }
422 
423 BOOL IS_GOPHER_PLUS(DWORD t) {
424     return !!(t & GOPHER_TYPE_GOPHER_PLUS);
425 }
426 
427 BOOL IS_GOPHER_TYPE_KNOWN(DWORD t) {
428     return !(t & GOPHER_TYPE_UNKNOWN);
429 }
430 
431 enum size_t
432     MAX_GOPHER_CATEGORY_NAME    = 128,
433     MAX_GOPHER_ATTRIBUTE_NAME   = 128,
434     MIN_GOPHER_ATTRIBUTE_LENGTH = 256;
435 
436 const TCHAR[]
437     GOPHER_INFO_CATEGORY      = "+INFO",
438     GOPHER_ADMIN_CATEGORY     = "+ADMIN",
439     GOPHER_VIEWS_CATEGORY     = "+VIEWS",
440     GOPHER_ABSTRACT_CATEGORY  = "+ABSTRACT",
441     GOPHER_VERONICA_CATEGORY  = "+VERONICA",
442     GOPHER_ADMIN_ATTRIBUTE    = "Admin",
443     GOPHER_MOD_DATE_ATTRIBUTE = "Mod-Date",
444     GOPHER_TTL_ATTRIBUTE      = "TTL",
445     GOPHER_SCORE_ATTRIBUTE    = "Score",
446     GOPHER_RANGE_ATTRIBUTE    = "Score-range",
447     GOPHER_SITE_ATTRIBUTE     = "Site",
448     GOPHER_ORG_ATTRIBUTE      = "Org",
449     GOPHER_LOCATION_ATTRIBUTE = "Loc",
450     GOPHER_GEOG_ATTRIBUTE     = "Geog",
451     GOPHER_TIMEZONE_ATTRIBUTE = "TZ",
452     GOPHER_PROVIDER_ATTRIBUTE = "Provider",
453     GOPHER_VERSION_ATTRIBUTE  = "Version",
454     GOPHER_ABSTRACT_ATTRIBUTE = "Abstract",
455     GOPHER_VIEW_ATTRIBUTE     = "View",
456     GOPHER_TREEWALK_ATTRIBUTE = "treewalk";
457 
458 enum : DWORD {
459     GOPHER_ATTRIBUTE_ID_BASE = 0xABCCCC00,
460     GOPHER_CATEGORY_ID_ALL,
461     GOPHER_CATEGORY_ID_INFO,
462     GOPHER_CATEGORY_ID_ADMIN,
463     GOPHER_CATEGORY_ID_VIEWS,
464     GOPHER_CATEGORY_ID_ABSTRACT,
465     GOPHER_CATEGORY_ID_VERONICA,
466     GOPHER_CATEGORY_ID_ASK,
467     GOPHER_CATEGORY_ID_UNKNOWN,
468     GOPHER_ATTRIBUTE_ID_ALL,
469     GOPHER_ATTRIBUTE_ID_ADMIN,
470     GOPHER_ATTRIBUTE_ID_MOD_DATE,
471     GOPHER_ATTRIBUTE_ID_TTL,
472     GOPHER_ATTRIBUTE_ID_SCORE,
473     GOPHER_ATTRIBUTE_ID_RANGE,
474     GOPHER_ATTRIBUTE_ID_SITE,
475     GOPHER_ATTRIBUTE_ID_ORG,
476     GOPHER_ATTRIBUTE_ID_LOCATION,
477     GOPHER_ATTRIBUTE_ID_GEOG,
478     GOPHER_ATTRIBUTE_ID_TIMEZONE,
479     GOPHER_ATTRIBUTE_ID_PROVIDER,
480     GOPHER_ATTRIBUTE_ID_VERSION,
481     GOPHER_ATTRIBUTE_ID_ABSTRACT,
482     GOPHER_ATTRIBUTE_ID_VIEW,
483     GOPHER_ATTRIBUTE_ID_TREEWALK,
484     GOPHER_ATTRIBUTE_ID_UNKNOWN
485 }
486 
487 enum HTTP_MAJOR_VERSION   = 1;
488 enum HTTP_MINOR_VERSION   = 0;
489 const TCHAR[] HTTP_VERSION = "HTTP/1.0";
490 
491 enum : DWORD {
492     HTTP_QUERY_MIME_VERSION,
493     HTTP_QUERY_CONTENT_TYPE,
494     HTTP_QUERY_CONTENT_TRANSFER_ENCODING,
495     HTTP_QUERY_CONTENT_ID,
496     HTTP_QUERY_CONTENT_DESCRIPTION,
497     HTTP_QUERY_CONTENT_LENGTH,
498     HTTP_QUERY_CONTENT_LANGUAGE,
499     HTTP_QUERY_ALLOW,
500     HTTP_QUERY_PUBLIC,
501     HTTP_QUERY_DATE,
502     HTTP_QUERY_EXPIRES,
503     HTTP_QUERY_LAST_MODIFIED,
504     HTTP_QUERY_MESSAGE_ID,
505     HTTP_QUERY_URI,
506     HTTP_QUERY_DERIVED_FROM,
507     HTTP_QUERY_COST,
508     HTTP_QUERY_LINK,
509     HTTP_QUERY_PRAGMA,
510     HTTP_QUERY_VERSION,
511     HTTP_QUERY_STATUS_CODE,
512     HTTP_QUERY_STATUS_TEXT,
513     HTTP_QUERY_RAW_HEADERS,
514     HTTP_QUERY_RAW_HEADERS_CRLF,
515     HTTP_QUERY_CONNECTION,
516     HTTP_QUERY_ACCEPT,
517     HTTP_QUERY_ACCEPT_CHARSET,
518     HTTP_QUERY_ACCEPT_ENCODING,
519     HTTP_QUERY_ACCEPT_LANGUAGE,
520     HTTP_QUERY_AUTHORIZATION,
521     HTTP_QUERY_CONTENT_ENCODING,
522     HTTP_QUERY_FORWARDED,
523     HTTP_QUERY_FROM,
524     HTTP_QUERY_IF_MODIFIED_SINCE,
525     HTTP_QUERY_LOCATION,
526     HTTP_QUERY_ORIG_URI,
527     HTTP_QUERY_REFERER,
528     HTTP_QUERY_RETRY_AFTER,
529     HTTP_QUERY_SERVER,
530     HTTP_QUERY_TITLE,
531     HTTP_QUERY_USER_AGENT,
532     HTTP_QUERY_WWW_AUTHENTICATE,
533     HTTP_QUERY_PROXY_AUTHENTICATE,
534     HTTP_QUERY_ACCEPT_RANGES,
535     HTTP_QUERY_SET_COOKIE,
536     HTTP_QUERY_COOKIE,
537     HTTP_QUERY_REQUEST_METHOD,
538     HTTP_QUERY_MAX    = 45,
539     HTTP_QUERY_CUSTOM = 65535
540 }
541 
542 enum DWORD
543     HTTP_QUERY_FLAG_REQUEST_HEADERS = 0x80000000,
544     HTTP_QUERY_FLAG_SYSTEMTIME      = 0x40000000,
545     HTTP_QUERY_FLAG_NUMBER          = 0x20000000,
546     HTTP_QUERY_FLAG_COALESCE        = 0x10000000,
547     HTTP_QUERY_MODIFIER_FLAGS_MASK  = 0xF0000000,
548     HTTP_QUERY_HEADER_MASK          = ~HTTP_QUERY_MODIFIER_FLAGS_MASK;
549 
550 enum {
551     HTTP_STATUS_OK                 = 200,
552     HTTP_STATUS_CREATED,
553     HTTP_STATUS_ACCEPTED,
554     HTTP_STATUS_PARTIAL,
555     HTTP_STATUS_NO_CONTENT,     // = 204
556     HTTP_STATUS_AMBIGUOUS          = 300,
557     HTTP_STATUS_MOVED,
558     HTTP_STATUS_REDIRECT,
559     HTTP_STATUS_REDIRECT_METHOD,
560     HTTP_STATUS_NOT_MODIFIED,   // = 304
561     HTTP_STATUS_BAD_REQUEST        = 400,
562     HTTP_STATUS_DENIED,
563     HTTP_STATUS_PAYMENT_REQ,
564     HTTP_STATUS_FORBIDDEN,
565     HTTP_STATUS_NOT_FOUND,
566     HTTP_STATUS_BAD_METHOD,
567     HTTP_STATUS_NONE_ACCEPTABLE,
568     HTTP_STATUS_PROXY_AUTH_REQ,
569     HTTP_STATUS_REQUEST_TIMEOUT,
570     HTTP_STATUS_CONFLICT,
571     HTTP_STATUS_GONE,
572     HTTP_STATUS_AUTH_REFUSED,   // = 411
573     HTTP_STATUS_SERVER_ERROR       = 500,
574     HTTP_STATUS_NOT_SUPPORTED,
575     HTTP_STATUS_BAD_GATEWAY,
576     HTTP_STATUS_SERVICE_UNAVAIL,
577     HTTP_STATUS_GATEWAY_TIMEOUT // = 504
578 }
579 
580 enum {
581     INTERNET_PREFETCH_PROGRESS,
582     INTERNET_PREFETCH_COMPLETE,
583     INTERNET_PREFETCH_ABORTED
584 }
585 
586 enum FLAGS_ERROR_UI_FILTER_FOR_ERRORS    = 0x01;
587 enum FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS = 0x02;
588 enum FLAGS_ERROR_UI_FLAGS_GENERATE_DATA  = 0x04;
589 enum FLAGS_ERROR_UI_FLAGS_NO_UI          = 0x08;
590 
591 enum DWORD
592     HTTP_ADDREQ_INDEX_MASK                   = 0x0000FFFF,
593     HTTP_ADDREQ_FLAGS_MASK                   = 0xFFFF0000,
594     HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = 0x01000000,
595     HTTP_ADDREQ_FLAG_ADD_IF_NEW              = 0x10000000,
596     HTTP_ADDREQ_FLAG_ADD                     = 0x20000000,
597     HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA     = 0x40000000,
598     HTTP_ADDREQ_FLAG_COALESCE          = HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA,
599     HTTP_ADDREQ_FLAG_REPLACE                 = 0x80000000;
600 
601 enum {
602     INTERNET_ERROR_BASE                       = 12000,
603     ERROR_INTERNET_OUT_OF_HANDLES,
604     ERROR_INTERNET_TIMEOUT,
605     ERROR_INTERNET_EXTENDED_ERROR,
606     ERROR_INTERNET_INTERNAL_ERROR,
607     ERROR_INTERNET_INVALID_URL,
608     ERROR_INTERNET_UNRECOGNIZED_SCHEME,
609     ERROR_INTERNET_NAME_NOT_RESOLVED,
610     ERROR_INTERNET_PROTOCOL_NOT_FOUND,
611     ERROR_INTERNET_INVALID_OPTION,
612     ERROR_INTERNET_BAD_OPTION_LENGTH,
613     ERROR_INTERNET_OPTION_NOT_SETTABLE,
614     ERROR_INTERNET_SHUTDOWN,
615     ERROR_INTERNET_INCORRECT_USER_NAME,
616     ERROR_INTERNET_INCORRECT_PASSWORD,
617     ERROR_INTERNET_LOGIN_FAILURE,
618     ERROR_INTERNET_INVALID_OPERATION,
619     ERROR_INTERNET_OPERATION_CANCELLED,
620     ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
621     ERROR_INTERNET_INCORRECT_HANDLE_STATE,
622     ERROR_INTERNET_NOT_PROXY_REQUEST,
623     ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND,
624     ERROR_INTERNET_BAD_REGISTRY_PARAMETER,
625     ERROR_INTERNET_NO_DIRECT_ACCESS,
626     ERROR_INTERNET_NO_CONTEXT,
627     ERROR_INTERNET_NO_CALLBACK,
628     ERROR_INTERNET_REQUEST_PENDING,
629     ERROR_INTERNET_INCORRECT_FORMAT,
630     ERROR_INTERNET_ITEM_NOT_FOUND,
631     ERROR_INTERNET_CANNOT_CONNECT,
632     ERROR_INTERNET_CONNECTION_ABORTED,
633     ERROR_INTERNET_CONNECTION_RESET,
634     ERROR_INTERNET_FORCE_RETRY,
635     ERROR_INTERNET_INVALID_PROXY_REQUEST,
636     ERROR_INTERNET_NEED_UI,                // = INTERNET_ERROR_BASE +  34
637     ERROR_INTERNET_HANDLE_EXISTS              = INTERNET_ERROR_BASE +  36,
638     ERROR_INTERNET_SEC_CERT_DATE_INVALID,
639     ERROR_INTERNET_SEC_CERT_CN_INVALID,
640     ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR,
641     ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR,
642     ERROR_INTERNET_MIXED_SECURITY,
643     ERROR_INTERNET_CHG_POST_IS_NON_SECURE,
644     ERROR_INTERNET_POST_IS_NON_SECURE,
645     ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED,
646     ERROR_INTERNET_INVALID_CA,
647     ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP,
648     ERROR_INTERNET_ASYNC_THREAD_FAILED,
649     ERROR_INTERNET_REDIRECT_SCHEME_CHANGE, // = INTERNET_ERROR_BASE +  48
650 
651     ERROR_FTP_TRANSFER_IN_PROGRESS            = INTERNET_ERROR_BASE + 110,
652     ERROR_FTP_DROPPED,                     // = INTERNET_ERROR_BASE + 111
653     ERROR_GOPHER_PROTOCOL_ERROR               = INTERNET_ERROR_BASE + 130,
654     ERROR_GOPHER_NOT_FILE,
655     ERROR_GOPHER_DATA_ERROR,
656     ERROR_GOPHER_END_OF_DATA,
657     ERROR_GOPHER_INVALID_LOCATOR,
658     ERROR_GOPHER_INCORRECT_LOCATOR_TYPE,
659     ERROR_GOPHER_NOT_GOPHER_PLUS,
660     ERROR_GOPHER_ATTRIBUTE_NOT_FOUND,
661     ERROR_GOPHER_UNKNOWN_LOCATOR,          // = INTERNET_ERROR_BASE + 138,
662     ERROR_HTTP_HEADER_NOT_FOUND               = INTERNET_ERROR_BASE + 150,
663     ERROR_HTTP_DOWNLEVEL_SERVER,
664     ERROR_HTTP_INVALID_SERVER_RESPONSE,
665     ERROR_HTTP_INVALID_HEADER,
666     ERROR_HTTP_INVALID_QUERY_REQUEST,
667     ERROR_HTTP_HEADER_ALREADY_EXISTS,
668     ERROR_HTTP_REDIRECT_FAILED,
669     ERROR_INTERNET_SECURITY_CHANNEL_ERROR,
670     ERROR_INTERNET_UNABLE_TO_CACHE_FILE,
671     ERROR_INTERNET_TCPIP_NOT_INSTALLED,
672     ERROR_HTTP_NOT_REDIRECTED,             // = INTERNET_ERROR_BASE + 160
673     // why?
674     INTERNET_ERROR_LAST                  = ERROR_INTERNET_TCPIP_NOT_INSTALLED
675 }
676 
677 
678 enum NORMAL_CACHE_ENTRY     = 0x000001;
679 enum STABLE_CACHE_ENTRY     = 0x000002;
680 enum STICKY_CACHE_ENTRY     = 0x000004;
681 enum SPARSE_CACHE_ENTRY     = 0x010000;
682 enum OCX_CACHE_ENTRY        = 0x020000;
683 enum COOKIE_CACHE_ENTRY     = 0x100000;
684 enum URLHISTORY_CACHE_ENTRY = 0x200000;
685 
686 enum CACHE_ENTRY_ATTRIBUTE_FC  = 0x0004;
687 enum CACHE_ENTRY_HITRATE_FC    = 0x0010;
688 enum CACHE_ENTRY_MODTIME_FC    = 0x0040;
689 enum CACHE_ENTRY_EXPTIME_FC    = 0x0080;
690 enum CACHE_ENTRY_ACCTIME_FC    = 0x0100;
691 enum CACHE_ENTRY_SYNCTIME_FC   = 0x0200;
692 enum CACHE_ENTRY_HEADERINFO_FC = 0x0400;
693 
694 enum {
695     WININET_API_FLAG_ASYNC       = 1,
696     WININET_API_FLAG_SYNC        = 4,
697     WININET_API_FLAG_USE_CONTEXT = 8
698 }
699 
700 // FIXME: how should these really be grouped?
701 enum {
702     IRF_ASYNC       = WININET_API_FLAG_ASYNC,
703     IRF_SYNC        = WININET_API_FLAG_SYNC,
704     IRF_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT,
705 }
706 enum IRF_NO_WAIT = 8;
707 
708 enum {
709     HSR_ASYNC = WININET_API_FLAG_ASYNC,
710     HSR_SYNC = WININET_API_FLAG_SYNC,
711     HSR_USE_CONTEXT = WININET_API_FLAG_USE_CONTEXT,
712 }
713 
714 enum HSR_INITIATE =  8;
715 enum HSR_DOWNLOAD = 16;
716 enum HSR_CHUNKED  = 32;
717 
718 enum INTERNET_DIAL_UNATTENDED              = 0x8000;
719 enum INTERNET_DIALSTATE_DISCONNECTED       = 1;
720 enum INTERENT_GOONLINE_REFRESH             = 1;
721 enum INTERENT_GOONLINE_MASK                = 1;
722 enum INTERNET_AUTODIAL_FORCE_ONLINE        = 1;
723 enum INTERNET_AUTODIAL_FORCE_UNATTENDED    = 2;
724 enum INTERNET_AUTODIAL_FAILIFSECURITYCHECK = 4;
725 enum INTERNET_CONNECTION_MODEM             = 0x01;
726 enum INTERNET_CONNECTION_LAN               = 0x02;
727 enum INTERNET_CONNECTION_PROXY             = 0x04;
728 enum INTERNET_CONNECTION_MODEM_BUSY        = 0x08;
729 enum INTERNET_RAS_INSTALLED                = 0x10;
730 enum INTERNET_CONNECTION_OFFLINE           = 0x20;
731 enum INTERNET_CONNECTION_CONFIGURED        = 0x40;
732 
733 enum {
734     CACHEGROUP_SEARCH_ALL   = 0,
735     CACHEGROUP_SEARCH_BYURL = 1
736 }
737 
738 enum {
739     INTERNET_CACHE_GROUP_ADD    = 0,
740     INTERNET_CACHE_GROUP_REMOVE = 1
741 }
742 
743 mixin DECLARE_HANDLE!("HINTERNET"); // doesn't work - bug
744 /*struct HINTERNET {
745     HANDLE h;
746     alias h this;
747 }*/
748 alias HINTERNET* LPHINTERNET;
749 
750 alias LONGLONG GROUPID;
751 alias WORD INTERNET_PORT;
752 alias WORD* LPINTERNET_PORT;
753 
754 enum INTERNET_SCHEME {
755     INTERNET_SCHEME_PARTIAL = -2,
756     INTERNET_SCHEME_UNKNOWN,
757     INTERNET_SCHEME_DEFAULT,
758     INTERNET_SCHEME_FTP,
759     INTERNET_SCHEME_GOPHER,
760     INTERNET_SCHEME_HTTP,
761     INTERNET_SCHEME_HTTPS,
762     INTERNET_SCHEME_FILE,
763     INTERNET_SCHEME_NEWS,
764     INTERNET_SCHEME_MAILTO,
765     INTERNET_SCHEME_SOCKS,
766     INTERNET_SCHEME_JAVASCRIPT,
767     INTERNET_SCHEME_VBSCRIPT,
768     INTERNET_SCHEME_RES,
769     INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP,
770     INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES
771 }
772 alias INTERNET_SCHEME* LPINTERNET_SCHEME;
773 
774 struct INTERNET_ASYNC_RESULT {
775     DWORD_PTR dwResult;
776     DWORD dwError;
777 }
778 alias INTERNET_ASYNC_RESULT* LPINTERNET_ASYNC_RESULT;
779 
780 struct INTERNET_DIAGNOSTIC_SOCKET_INFO {
781     DWORD_PTR Socket;
782     DWORD     SourcePort;
783     DWORD     DestPort;
784     DWORD     Flags;
785 }
786 alias INTERNET_DIAGNOSTIC_SOCKET_INFO* LPINTERNET_DIAGNOSTIC_SOCKET_INFO;
787 
788 struct INTERNET_PREFETCH_STATUS {
789     DWORD dwStatus;
790     DWORD dwSize;
791 }
792 alias INTERNET_PREFETCH_STATUS* LPINTERNET_PREFETCH_STATUS;
793 
794 struct INTERNET_PROXY_INFO {
795     DWORD dwAccessType;
796     LPCTSTR lpszProxy;
797     LPCTSTR lpszProxyBypass;
798 }
799 alias INTERNET_PROXY_INFO* LPINTERNET_PROXY_INFO;
800 
801 struct INTERNET_PER_CONN_OPTIONA {
802     DWORD   dwOption;
803     union {
804         DWORD    dwValue;
805         LPSTR    pszValue;
806         FILETIME ftValue;
807     }
808 }
809 alias INTERNET_PER_CONN_OPTIONA* LPINTERNET_PER_CONN_OPTIONA;
810 
811 struct INTERNET_PER_CONN_OPTIONW {
812     DWORD   dwOption;
813     union {
814         DWORD    dwValue;
815         LPWSTR   pszValue;
816         FILETIME ftValue;
817     }
818 }
819 alias INTERNET_PER_CONN_OPTIONW* LPINTERNET_PER_CONN_OPTIONW;
820 
821 struct INTERNET_PER_CONN_OPTION_LISTA {
822     DWORD   dwSize;
823     LPSTR   pszConnection;
824     DWORD   dwOptionCount;
825     DWORD   dwOptionError;
826     LPINTERNET_PER_CONN_OPTIONA  pOptions;
827 }
828 alias INTERNET_PER_CONN_OPTION_LISTA* LPINTERNET_PER_CONN_OPTION_LISTA;
829 
830 struct INTERNET_PER_CONN_OPTION_LISTW {
831     DWORD   dwSize;
832     LPWSTR  pszConnection;
833     DWORD   dwOptionCount;
834     DWORD   dwOptionError;
835     LPINTERNET_PER_CONN_OPTIONW  pOptions;
836 }
837 alias INTERNET_PER_CONN_OPTION_LISTW* LPINTERNET_PER_CONN_OPTION_LISTW;
838 
839 enum {
840     INTERNET_PER_CONN_FLAGS                        = 1,
841     INTERNET_PER_CONN_PROXY_SERVER                 = 2,
842     INTERNET_PER_CONN_PROXY_BYPASS                 = 3,
843     INTERNET_PER_CONN_AUTOCONFIG_URL               = 4,
844     INTERNET_PER_CONN_AUTODISCOVERY_FLAGS          = 5,
845     INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL     = 6,
846     INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS = 7,
847     INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME  = 8,
848     INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL   = 9,
849     INTERNET_PER_CONN_FLAGS_UI                     = 10,
850 }
851 
852 enum {
853     PROXY_TYPE_DIRECT                              = 0x00000001,
854     PROXY_TYPE_PROXY                               = 0x00000002,
855     PROXY_TYPE_AUTO_PROXY_URL                      = 0x00000004,
856     PROXY_TYPE_AUTO_DETECT                         = 0x00000008,
857 }
858 
859 enum {
860     AUTO_PROXY_FLAG_USER_SET                       = 0x00000001,
861     AUTO_PROXY_FLAG_ALWAYS_DETECT                  = 0x00000002,
862     AUTO_PROXY_FLAG_DETECTION_RUN                  = 0x00000004,
863     AUTO_PROXY_FLAG_MIGRATED                       = 0x00000008,
864     AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT        = 0x00000010,
865     AUTO_PROXY_FLAG_CACHE_INIT_RUN                 = 0x00000020,
866     AUTO_PROXY_FLAG_DETECTION_SUSPECT              = 0x00000040,
867 }
868 
869 struct INTERNET_VERSION_INFO {
870     DWORD dwMajorVersion;
871     DWORD dwMinorVersion;
872 }
873 alias INTERNET_VERSION_INFO* LPINTERNET_VERSION_INFO;
874 
875 struct URL_COMPONENTSA {
876     DWORD           dwStructSize = URL_COMPONENTSA.sizeof;
877     LPSTR           lpszScheme;
878     DWORD           dwSchemeLength;
879     INTERNET_SCHEME nScheme;
880     LPSTR           lpszHostName;
881     DWORD           dwHostNameLength;
882     INTERNET_PORT   nPort;
883     LPSTR           lpszUserName;
884     DWORD           dwUserNameLength;
885     LPSTR           lpszPassword;
886     DWORD           dwPasswordLength;
887     LPSTR           lpszUrlPath;
888     DWORD           dwUrlPathLength;
889     LPSTR           lpszExtraInfo;
890     DWORD           dwExtraInfoLength;
891 }
892 alias URL_COMPONENTSA* LPURL_COMPONENTSA;
893 
894 struct URL_COMPONENTSW {
895     DWORD  dwStructSize = URL_COMPONENTSW.sizeof;
896     LPWSTR lpszScheme;
897     DWORD  dwSchemeLength;
898     INTERNET_SCHEME nScheme;
899     LPWSTR lpszHostName;
900     DWORD  dwHostNameLength;
901     INTERNET_PORT nPort;
902     LPWSTR lpszUserName;
903     DWORD  dwUserNameLength;
904     LPWSTR lpszPassword;
905     DWORD  dwPasswordLength;
906     LPWSTR lpszUrlPath;
907     DWORD  dwUrlPathLength;
908     LPWSTR lpszExtraInfo;
909     DWORD  dwExtraInfoLength;
910 }
911 alias URL_COMPONENTSW* LPURL_COMPONENTSW;
912 
913 struct INTERNET_CERTIFICATE_INFO {
914     FILETIME ftExpiry;
915     FILETIME ftStart;
916     LPTSTR   lpszSubjectInfo;
917     LPTSTR   lpszIssuerInfo;
918     LPTSTR   lpszProtocolName;
919     LPTSTR   lpszSignatureAlgName;
920     LPTSTR   lpszEncryptionAlgName;
921     DWORD    dwKeySize;
922 }
923 alias INTERNET_CERTIFICATE_INFO* LPINTERNET_CERTIFICATE_INFO;
924 
925 extern (Windows) alias void function(HINTERNET, DWORD_PTR, DWORD, PVOID, DWORD)
926   INTERNET_STATUS_CALLBACK;
927 alias INTERNET_STATUS_CALLBACK* LPINTERNET_STATUS_CALLBACK;
928 
929 enum INTERNET_INVALID_STATUS_CALLBACK
930   = cast(INTERNET_STATUS_CALLBACK) -1;
931 
932 struct GOPHER_FIND_DATAA {
933     CHAR[MAX_GOPHER_DISPLAY_TEXT+1] DisplayString = 0;
934     DWORD    GopherType;
935     DWORD    SizeLow;
936     DWORD    SizeHigh;
937     FILETIME LastModificationTime;
938     CHAR[MAX_GOPHER_LOCATOR_LENGTH+1] Locator = 0;
939 }
940 alias GOPHER_FIND_DATAA* LPGOPHER_FIND_DATAA;
941 
942 struct GOPHER_FIND_DATAW {
943     WCHAR[MAX_GOPHER_DISPLAY_TEXT+1] DisplayString = 0;
944     DWORD    GopherType;
945     DWORD    SizeLow;
946     DWORD    SizeHigh;
947     FILETIME LastModificationTime;
948     WCHAR[MAX_GOPHER_LOCATOR_LENGTH+1] Locator = 0;
949 }
950 alias GOPHER_FIND_DATAW* LPGOPHER_FIND_DATAW;
951 
952 struct GOPHER_ADMIN_ATTRIBUTE_TYPE {
953     LPCTSTR Comment;
954     LPCTSTR EmailAddress;
955 }
956 alias GOPHER_ADMIN_ATTRIBUTE_TYPE* LPGOPHER_ADMIN_ATTRIBUTE_TYPE;
957 
958 struct GOPHER_MOD_DATE_ATTRIBUTE_TYPE {
959     FILETIME DateAndTime;
960 }
961 alias GOPHER_MOD_DATE_ATTRIBUTE_TYPE* LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE;
962 
963 struct GOPHER_TTL_ATTRIBUTE_TYPE {
964     DWORD Ttl;
965 }
966 alias GOPHER_TTL_ATTRIBUTE_TYPE* LPGOPHER_TTL_ATTRIBUTE_TYPE;
967 
968 struct GOPHER_SCORE_ATTRIBUTE_TYPE {
969     INT Score;
970 }
971 alias GOPHER_SCORE_ATTRIBUTE_TYPE* LPGOPHER_SCORE_ATTRIBUTE_TYPE;
972 
973 struct GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE {
974     INT LowerBound;
975     INT UpperBound;
976 }
977 alias GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE* LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE;
978 
979 struct GOPHER_SITE_ATTRIBUTE_TYPE {
980     LPCTSTR Site;
981 }
982 alias GOPHER_SITE_ATTRIBUTE_TYPE* LPGOPHER_SITE_ATTRIBUTE_TYPE;
983 
984 struct GOPHER_ORGANIZATION_ATTRIBUTE_TYPE {
985     LPCTSTR Organization;
986 }
987 alias GOPHER_ORGANIZATION_ATTRIBUTE_TYPE* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE;
988 
989 struct GOPHER_LOCATION_ATTRIBUTE_TYPE {
990     LPCTSTR Location;
991 }
992 alias GOPHER_LOCATION_ATTRIBUTE_TYPE* LPGOPHER_LOCATION_ATTRIBUTE_TYPE;
993 
994 struct GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE {
995     INT DegreesNorth;
996     INT MinutesNorth;
997     INT SecondsNorth;
998     INT DegreesEast;
999     INT MinutesEast;
1000     INT SecondsEast;
1001 }
1002 alias GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE*
1003   LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE;
1004 
1005 struct GOPHER_TIMEZONE_ATTRIBUTE_TYPE {
1006     INT Zone;
1007 }
1008 alias GOPHER_TIMEZONE_ATTRIBUTE_TYPE* LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE;
1009 
1010 struct GOPHER_PROVIDER_ATTRIBUTE_TYPE {
1011     LPCTSTR Provider;
1012 }
1013 alias GOPHER_PROVIDER_ATTRIBUTE_TYPE* LPGOPHER_PROVIDER_ATTRIBUTE_TYPE;
1014 
1015 struct GOPHER_VERSION_ATTRIBUTE_TYPE {
1016     LPCTSTR Version;
1017 }
1018 alias GOPHER_VERSION_ATTRIBUTE_TYPE* LPGOPHER_VERSION_ATTRIBUTE_TYPE;
1019 
1020 struct GOPHER_ABSTRACT_ATTRIBUTE_TYPE {
1021     LPCTSTR ShortAbstract;
1022     LPCTSTR AbstractFile;
1023 }
1024 alias GOPHER_ABSTRACT_ATTRIBUTE_TYPE* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE;
1025 
1026 struct GOPHER_VIEW_ATTRIBUTE_TYPE {
1027     LPCTSTR ContentType;
1028     LPCTSTR Language;
1029     DWORD   Size;
1030 }
1031 alias GOPHER_VIEW_ATTRIBUTE_TYPE* LPGOPHER_VIEW_ATTRIBUTE_TYPE;
1032 
1033 struct GOPHER_VERONICA_ATTRIBUTE_TYPE {
1034     BOOL TreeWalk;
1035 }
1036 alias GOPHER_VERONICA_ATTRIBUTE_TYPE* LPGOPHER_VERONICA_ATTRIBUTE_TYPE;
1037 
1038 struct GOPHER_ASK_ATTRIBUTE_TYPE {
1039     LPCTSTR QuestionType;
1040     LPCTSTR QuestionText;
1041 }
1042 alias GOPHER_ASK_ATTRIBUTE_TYPE* LPGOPHER_ASK_ATTRIBUTE_TYPE;
1043 
1044 struct GOPHER_UNKNOWN_ATTRIBUTE_TYPE {
1045     LPCTSTR Text;
1046 }
1047 alias GOPHER_UNKNOWN_ATTRIBUTE_TYPE* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE;
1048 
1049 struct GOPHER_ATTRIBUTE_TYPE {
1050     DWORD CategoryId;
1051     DWORD AttributeId;
1052     union {
1053         GOPHER_ADMIN_ATTRIBUTE_TYPE                 Admin;
1054         GOPHER_MOD_DATE_ATTRIBUTE_TYPE              ModDate;
1055         GOPHER_TTL_ATTRIBUTE_TYPE                   Ttl;
1056         GOPHER_SCORE_ATTRIBUTE_TYPE                 Score;
1057         GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE           ScoreRange;
1058         GOPHER_SITE_ATTRIBUTE_TYPE                  Site;
1059         GOPHER_ORGANIZATION_ATTRIBUTE_TYPE          Organization;
1060         GOPHER_LOCATION_ATTRIBUTE_TYPE              Location;
1061         GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation;
1062         GOPHER_TIMEZONE_ATTRIBUTE_TYPE              TimeZone;
1063         GOPHER_PROVIDER_ATTRIBUTE_TYPE              Provider;
1064         GOPHER_VERSION_ATTRIBUTE_TYPE               Version;
1065         GOPHER_ABSTRACT_ATTRIBUTE_TYPE              Abstract;
1066         GOPHER_VIEW_ATTRIBUTE_TYPE                  View;
1067         GOPHER_VERONICA_ATTRIBUTE_TYPE              Veronica;
1068         GOPHER_ASK_ATTRIBUTE_TYPE                   Ask;
1069         GOPHER_UNKNOWN_ATTRIBUTE_TYPE               Unknown;
1070     } /+AttributeType;+/
1071 }
1072 alias GOPHER_ATTRIBUTE_TYPE* LPGOPHER_ATTRIBUTE_TYPE;
1073 
1074 extern (Windows)
1075 alias BOOL function(LPGOPHER_ATTRIBUTE_TYPE, DWORD)
1076   GOPHER_ATTRIBUTE_ENUMERATOR;
1077 
1078 struct INTERNET_CACHE_ENTRY_INFOA {
1079     DWORD    dwStructSize = INTERNET_CACHE_ENTRY_INFOA.sizeof;
1080     LPSTR    lpszSourceUrlName;
1081     LPSTR    lpszLocalFileName;
1082     DWORD    CacheEntryType;
1083     DWORD    dwUseCount;
1084     DWORD    dwHitRate;
1085     DWORD    dwSizeLow;
1086     DWORD    dwSizeHigh;
1087     FILETIME LastModifiedTime;
1088     FILETIME ExpireTime;
1089     FILETIME LastAccessTime;
1090     FILETIME LastSyncTime;
1091     PBYTE    lpHeaderInfo;
1092     DWORD    dwHeaderInfoSize;
1093     LPSTR    lpszFileExtension;
1094     DWORD    dwReserved;
1095 }
1096 alias INTERNET_CACHE_ENTRY_INFOA* LPINTERNET_CACHE_ENTRY_INFOA;
1097 
1098 struct INTERNET_CACHE_ENTRY_INFOW {
1099     DWORD    dwStructSize = INTERNET_CACHE_ENTRY_INFOW.sizeof;
1100     LPWSTR   lpszSourceUrlName;
1101     LPWSTR   lpszLocalFileName;
1102     DWORD    CacheEntryType;
1103     DWORD    dwUseCount;
1104     DWORD    dwHitRate;
1105     DWORD    dwSizeLow;
1106     DWORD    dwSizeHigh;
1107     FILETIME LastModifiedTime;
1108     FILETIME ExpireTime;
1109     FILETIME LastAccessTime;
1110     FILETIME LastSyncTime;
1111     PBYTE    lpHeaderInfo;
1112     DWORD    dwHeaderInfoSize;
1113     LPWSTR   lpszFileExtension;
1114     DWORD    dwReserved;
1115 }
1116 alias INTERNET_CACHE_ENTRY_INFOW* LPINTERNET_CACHE_ENTRY_INFOW;
1117 
1118 struct INTERNET_BUFFERSA {
1119     DWORD              dwStructSize = INTERNET_BUFFERSA.sizeof;
1120     INTERNET_BUFFERSA* Next;
1121     LPCSTR             lpcszHeader;
1122     DWORD              dwHeadersLength;
1123     DWORD              dwHeadersTotal;
1124     LPVOID             lpvBuffer;
1125     DWORD              dwBufferLength;
1126     DWORD              dwBufferTotal;
1127     DWORD              dwOffsetLow;
1128     DWORD              dwOffsetHigh;
1129 }
1130 alias INTERNET_BUFFERSA* LPINTERNET_BUFFERSA;
1131 
1132 struct INTERNET_BUFFERSW {
1133     DWORD              dwStructSize = INTERNET_BUFFERSW.sizeof;
1134     INTERNET_BUFFERSW* Next;
1135     LPCWSTR            lpcszHeader;
1136     DWORD              dwHeadersLength;
1137     DWORD              dwHeadersTotal;
1138     LPVOID             lpvBuffer;
1139     DWORD              dwBufferLength;
1140     DWORD              dwBufferTotal;
1141     DWORD              dwOffsetLow;
1142     DWORD              dwOffsetHigh;
1143 }
1144 alias INTERNET_BUFFERSW* LPINTERNET_BUFFERSW;
1145 
1146 enum size_t
1147     GROUP_OWNER_STORAGE_SIZE =   4,
1148     GROUPNAME_MAX_LENGTH     = 120;
1149 
1150 struct INTERNET_CACHE_GROUP_INFOA {
1151     DWORD dwGroupSize;
1152     DWORD dwGroupFlags;
1153     DWORD dwGroupType;
1154     DWORD dwDiskUsage;
1155     DWORD dwDiskQuota;
1156     DWORD[GROUP_OWNER_STORAGE_SIZE] dwOwnerStorage;
1157     CHAR[GROUPNAME_MAX_LENGTH]      szGroupName = 0;
1158 }
1159 alias INTERNET_CACHE_GROUP_INFOA* LPINTERNET_CACHE_GROUP_INFOA;
1160 
1161 struct INTERNET_CACHE_GROUP_INFOW {
1162     DWORD dwGroupSize;
1163     DWORD dwGroupFlags;
1164     DWORD dwGroupType;
1165     DWORD dwDiskUsage;
1166     DWORD dwDiskQuota;
1167     DWORD[GROUP_OWNER_STORAGE_SIZE] dwOwnerStorage;
1168     WCHAR[GROUPNAME_MAX_LENGTH]     szGroupName = 0;
1169 }
1170 alias INTERNET_CACHE_GROUP_INFOW* LPINTERNET_CACHE_GROUP_INFOW;
1171 
1172 extern (Windows) {
1173     BOOL InternetTimeFromSystemTime(SYSTEMTIME*, DWORD, LPSTR, DWORD);
1174     BOOL InternetTimeToSystemTime(LPCSTR, SYSTEMTIME*, DWORD);
1175     BOOL InternetDebugGetLocalTime(SYSTEMTIME*, PDWORD);
1176     BOOL InternetCrackUrlA(LPCSTR, DWORD, DWORD, LPURL_COMPONENTSA);
1177     BOOL InternetCrackUrlW(LPCWSTR, DWORD, DWORD, LPURL_COMPONENTSW);
1178     BOOL InternetCreateUrlA(LPURL_COMPONENTSA, DWORD, LPSTR, PDWORD);
1179     BOOL InternetCreateUrlW(LPURL_COMPONENTSW, DWORD, LPWSTR, PDWORD);
1180     BOOL InternetCanonicalizeUrlA(LPCSTR, LPSTR, PDWORD, DWORD);
1181     BOOL InternetCanonicalizeUrlW(LPCWSTR, LPWSTR, PDWORD, DWORD);
1182     BOOL InternetCheckConnectionA(LPCSTR, DWORD, DWORD);
1183     BOOL InternetCheckConnectionW(LPCWSTR, DWORD, DWORD);
1184     BOOL InternetCombineUrlA(LPCSTR, LPCSTR, LPSTR, PDWORD, DWORD);
1185     BOOL InternetCombineUrlW(LPCWSTR, LPCWSTR, LPWSTR, PDWORD, DWORD);
1186     HINTERNET InternetOpenA(LPCSTR, DWORD, LPCSTR, LPCSTR, DWORD);
1187     HINTERNET InternetOpenW(LPCWSTR, DWORD, LPCWSTR, LPCWSTR, DWORD);
1188     BOOL InternetCloseHandle(HINTERNET);
1189     HINTERNET InternetConnectA(HINTERNET, LPCSTR, INTERNET_PORT, LPCSTR,
1190       LPCSTR, DWORD, DWORD, DWORD_PTR);
1191     HINTERNET InternetConnectW(HINTERNET, LPCWSTR, INTERNET_PORT, LPCWSTR,
1192       LPCWSTR, DWORD, DWORD, DWORD_PTR);
1193     HINTERNET InternetOpenUrlA(HINTERNET, LPCSTR, LPCSTR, DWORD, DWORD,
1194       DWORD_PTR);
1195     HINTERNET InternetOpenUrlW(HINTERNET, LPCWSTR, LPCWSTR, DWORD, DWORD,
1196       DWORD_PTR);
1197     BOOL InternetReadFile(HINTERNET, PVOID, DWORD, PDWORD);
1198     DWORD InternetSetFilePointer(HINTERNET, LONG, PVOID, DWORD, DWORD_PTR);
1199     BOOL InternetWriteFile(HINTERNET, LPCVOID, DWORD, PDWORD);
1200     BOOL InternetQueryDataAvailable(HINTERNET, PDWORD, DWORD, DWORD_PTR);
1201     BOOL InternetFindNextFileA(HINTERNET, PVOID);
1202     BOOL InternetFindNextFileW(HINTERNET, PVOID);
1203     BOOL InternetQueryOptionA(HINTERNET, DWORD, PVOID, PDWORD);
1204     BOOL InternetQueryOptionW(HINTERNET, DWORD, PVOID, PDWORD);
1205     BOOL InternetSetOptionA(HINTERNET, DWORD, PVOID, DWORD);
1206     BOOL InternetSetOptionW(HINTERNET, DWORD, PVOID, DWORD);
1207     BOOL InternetSetOptionExA(HINTERNET, DWORD, PVOID, DWORD, DWORD);
1208     BOOL InternetSetOptionExW(HINTERNET, DWORD, PVOID, DWORD, DWORD);
1209     BOOL InternetGetLastResponseInfoA(PDWORD, LPSTR, PDWORD);
1210     BOOL InternetGetLastResponseInfoW(PDWORD, LPWSTR, PDWORD);
1211     INTERNET_STATUS_CALLBACK InternetSetStatusCallback(HINTERNET,
1212       INTERNET_STATUS_CALLBACK);
1213     DWORD FtpGetFileSize(HINTERNET, LPDWORD);
1214     HINTERNET FtpFindFirstFileA(HINTERNET, LPCSTR, LPWIN32_FIND_DATAA, DWORD,
1215       DWORD_PTR);
1216     HINTERNET FtpFindFirstFileW(HINTERNET, LPCWSTR, LPWIN32_FIND_DATAW, DWORD,
1217       DWORD_PTR);
1218     BOOL FtpGetFileA(HINTERNET, LPCSTR, LPCSTR, BOOL, DWORD, DWORD, DWORD_PTR);
1219     BOOL FtpGetFileW(HINTERNET, LPCWSTR, LPCWSTR, BOOL, DWORD, DWORD, DWORD_PTR);
1220     BOOL FtpPutFileA(HINTERNET, LPCSTR, LPCSTR, DWORD, DWORD_PTR);
1221     BOOL FtpPutFileW(HINTERNET, LPCWSTR, LPCWSTR, DWORD, DWORD_PTR);
1222     BOOL FtpDeleteFileA(HINTERNET, LPCSTR);
1223     BOOL FtpDeleteFileW(HINTERNET, LPCWSTR);
1224     BOOL FtpRenameFileA(HINTERNET, LPCSTR, LPCSTR);
1225     BOOL FtpRenameFileW(HINTERNET, LPCWSTR, LPCWSTR);
1226     HINTERNET FtpOpenFileA(HINTERNET, LPCSTR, DWORD, DWORD, DWORD_PTR);
1227     HINTERNET FtpOpenFileW(HINTERNET, LPCWSTR, DWORD, DWORD, DWORD_PTR);
1228     BOOL FtpCreateDirectoryA(HINTERNET, LPCSTR);
1229     BOOL FtpCreateDirectoryW(HINTERNET, LPCWSTR);
1230     BOOL FtpRemoveDirectoryA(HINTERNET, LPCSTR);
1231     BOOL FtpRemoveDirectoryW(HINTERNET, LPCWSTR);
1232     BOOL FtpSetCurrentDirectoryA(HINTERNET, LPCSTR);
1233     BOOL FtpSetCurrentDirectoryW(HINTERNET, LPCWSTR);
1234     BOOL FtpGetCurrentDirectoryA(HINTERNET, LPSTR, PDWORD);
1235     BOOL FtpGetCurrentDirectoryW(HINTERNET, LPWSTR, PDWORD);
1236     BOOL FtpCommandA(HINTERNET, BOOL, DWORD, LPCSTR, DWORD_PTR, HINTERNET*);
1237     BOOL FtpCommandW(HINTERNET, BOOL, DWORD, LPCWSTR, DWORD_PTR, HINTERNET*);
1238     BOOL GopherCreateLocatorA(LPCSTR, INTERNET_PORT, LPCSTR, LPCSTR, DWORD,
1239       LPSTR, PDWORD);
1240     BOOL GopherCreateLocatorW(LPCWSTR, INTERNET_PORT, LPCWSTR, LPCWSTR, DWORD,
1241       LPWSTR, PDWORD);
1242     BOOL GopherGetLocatorTypeA(LPCSTR, PDWORD);
1243     BOOL GopherGetLocatorTypeW(LPCWSTR, PDWORD);
1244     HINTERNET GopherFindFirstFileA(HINTERNET, LPCSTR, LPCSTR,
1245       LPGOPHER_FIND_DATAA, DWORD, DWORD_PTR);
1246     HINTERNET GopherFindFirstFileW(HINTERNET, LPCWSTR, LPCWSTR,
1247       LPGOPHER_FIND_DATAW, DWORD, DWORD_PTR);
1248     HINTERNET GopherOpenFileA(HINTERNET, LPCSTR, LPCSTR, DWORD, DWORD_PTR);
1249     HINTERNET GopherOpenFileW(HINTERNET, LPCWSTR, LPCWSTR, DWORD, DWORD_PTR);
1250     BOOL GopherGetAttributeA(HINTERNET, LPCSTR, LPCSTR, LPBYTE, DWORD,
1251       PDWORD, GOPHER_ATTRIBUTE_ENUMERATOR, DWORD_PTR);
1252     BOOL GopherGetAttributeW(HINTERNET, LPCWSTR, LPCWSTR, LPBYTE, DWORD,
1253       PDWORD, GOPHER_ATTRIBUTE_ENUMERATOR, DWORD_PTR);
1254     HINTERNET HttpOpenRequestA(HINTERNET, LPCSTR, LPCSTR, LPCSTR, LPCSTR,
1255       LPCSTR*, DWORD, DWORD_PTR);
1256     HINTERNET HttpOpenRequestW(HINTERNET, LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR,
1257       LPCWSTR*, DWORD, DWORD_PTR);
1258     BOOL HttpAddRequestHeadersA(HINTERNET, LPCSTR, DWORD, DWORD);
1259     BOOL HttpAddRequestHeadersW(HINTERNET, LPCWSTR, DWORD, DWORD);
1260     BOOL HttpSendRequestA(HINTERNET, LPCSTR, DWORD, PVOID, DWORD);
1261     BOOL HttpSendRequestW(HINTERNET, LPCWSTR, DWORD, PVOID, DWORD);
1262     BOOL HttpQueryInfoA(HINTERNET, DWORD, PVOID, PDWORD, PDWORD);
1263     BOOL HttpQueryInfoW(HINTERNET, DWORD, PVOID, PDWORD, PDWORD);
1264     BOOL InternetSetCookieA(LPCSTR, LPCSTR, LPCSTR);
1265     BOOL InternetSetCookieW(LPCWSTR, LPCWSTR, LPCWSTR);
1266     BOOL InternetGetCookieA(LPCSTR, LPCSTR, LPSTR, PDWORD);
1267     BOOL InternetGetCookieW(LPCWSTR, LPCWSTR, LPWSTR, PDWORD);
1268     DWORD InternetAttemptConnect(DWORD);
1269     DWORD InternetErrorDlg(HWND, HINTERNET, DWORD, DWORD, PVOID*);
1270     DWORD InternetConfirmZoneCrossing(HWND, LPSTR, LPSTR, BOOL);
1271     BOOL CreateUrlCacheEntryA(LPCSTR, DWORD, LPCSTR, LPSTR, DWORD);
1272     BOOL CreateUrlCacheEntryW(LPCWSTR, DWORD, LPCWSTR, LPWSTR, DWORD);
1273     BOOL CommitUrlCacheEntryA(LPCSTR, LPCSTR, FILETIME, FILETIME, DWORD,
1274       LPBYTE, DWORD, LPCSTR, DWORD);
1275     BOOL CommitUrlCacheEntryW(LPCWSTR, LPCWSTR, FILETIME, FILETIME, DWORD,
1276       LPBYTE, DWORD, LPCWSTR, DWORD);
1277     BOOL RetrieveUrlCacheEntryFileA(LPCSTR, LPINTERNET_CACHE_ENTRY_INFOA,
1278       PDWORD, DWORD);
1279     BOOL RetrieveUrlCacheEntryFileW(LPCWSTR, LPINTERNET_CACHE_ENTRY_INFOW,
1280       PDWORD, DWORD);
1281     BOOL UnlockUrlCacheEntryFile(LPCSTR, DWORD);
1282     HANDLE RetrieveUrlCacheEntryStreamA(LPCSTR, LPINTERNET_CACHE_ENTRY_INFOA,
1283       PDWORD, BOOL, DWORD);
1284     HANDLE RetrieveUrlCacheEntryStreamW(LPCWSTR, LPINTERNET_CACHE_ENTRY_INFOW,
1285       PDWORD, BOOL, DWORD);
1286     BOOL ReadUrlCacheEntryStream(HANDLE, DWORD, PVOID, PDWORD, DWORD);
1287     BOOL UnlockUrlCacheEntryStream(HANDLE, DWORD);
1288     BOOL GetUrlCacheEntryInfoA(LPCSTR, LPINTERNET_CACHE_ENTRY_INFOA, PDWORD);
1289     BOOL GetUrlCacheEntryInfoW(LPCWSTR, LPINTERNET_CACHE_ENTRY_INFOW, PDWORD);
1290     BOOL SetUrlCacheEntryInfoA(LPCSTR, LPINTERNET_CACHE_ENTRY_INFOA, DWORD);
1291     BOOL SetUrlCacheEntryInfoW(LPCWSTR, LPINTERNET_CACHE_ENTRY_INFOW, DWORD);
1292     HANDLE FindFirstUrlCacheEntryA(LPCSTR, LPINTERNET_CACHE_ENTRY_INFOA,
1293       PDWORD);
1294     HANDLE FindFirstUrlCacheEntryW(LPCWSTR, LPINTERNET_CACHE_ENTRY_INFOW,
1295       PDWORD);
1296     BOOL FindNextUrlCacheEntryA(HANDLE, LPINTERNET_CACHE_ENTRY_INFOA, PDWORD);
1297     BOOL FindNextUrlCacheEntryW(HANDLE, LPINTERNET_CACHE_ENTRY_INFOW, PDWORD);
1298     BOOL FindCloseUrlCache(HANDLE);
1299     BOOL DeleteUrlCacheEntry(LPCSTR);
1300     DWORD AuthenticateUser(PVOID*, LPSTR, LPSTR, DWORD, LPSTR, DWORD, LPSTR,
1301       LPSTR);
1302     BOOL HttpSendRequestExA(HINTERNET, LPINTERNET_BUFFERSA,
1303       LPINTERNET_BUFFERSA, DWORD, DWORD_PTR);
1304     BOOL HttpSendRequestExW(HINTERNET, LPINTERNET_BUFFERSW,
1305       LPINTERNET_BUFFERSW, DWORD, DWORD_PTR);
1306     BOOL HttpEndRequestA(HINTERNET, LPINTERNET_BUFFERSA, DWORD, DWORD_PTR);
1307     BOOL HttpEndRequestW(HINTERNET, LPINTERNET_BUFFERSW, DWORD, DWORD_PTR);
1308     DWORD InternetDial(HWND, LPTSTR, DWORD, LPDWORD, DWORD);
1309     DWORD InternetHangUp(DWORD_PTR, DWORD);
1310     BOOL InternetGoOnline(LPTSTR, HWND, DWORD);
1311     BOOL InternetAutodial(DWORD, DWORD);
1312     BOOL InternetAutodialHangup(DWORD);
1313     BOOL InternetGetConnectedState(LPDWORD, DWORD);
1314     BOOL InternetSetDialState(LPCTSTR, DWORD, DWORD);
1315     BOOL InternetReadFileExA(HINTERNET, LPINTERNET_BUFFERSA, DWORD, DWORD_PTR);
1316     BOOL InternetReadFileExW(HINTERNET, LPINTERNET_BUFFERSW, DWORD, DWORD_PTR);
1317     GROUPID CreateUrlCacheGroup(DWORD, LPVOID);
1318     BOOL DeleteUrlCacheGroup(GROUPID, DWORD, LPVOID);
1319     HANDLE FindFirstUrlCacheGroup(DWORD, DWORD, LPVOID, DWORD, GROUPID*,
1320       LPVOID);
1321     BOOL FindNextUrlCacheGroup(HANDLE, GROUPID*, LPVOID);
1322     BOOL GetUrlCacheGroupAttributeA(GROUPID, DWORD, DWORD,
1323       LPINTERNET_CACHE_GROUP_INFOA, LPDWORD, LPVOID);
1324     BOOL GetUrlCacheGroupAttributeW(GROUPID, DWORD, DWORD,
1325       LPINTERNET_CACHE_GROUP_INFOW, LPDWORD, LPVOID);
1326     BOOL SetUrlCacheGroupAttributeA(GROUPID, DWORD, DWORD,
1327       LPINTERNET_CACHE_GROUP_INFOA, LPVOID);
1328     BOOL SetUrlCacheGroupAttributeW(GROUPID, DWORD, DWORD,
1329       LPINTERNET_CACHE_GROUP_INFOW, LPVOID);
1330 }
1331 
1332 version (Unicode) {
1333     alias INTERNET_PER_CONN_OPTIONW INTERNET_PER_CONN_OPTION;
1334     alias LPINTERNET_PER_CONN_OPTIONW LPINTERNET_PER_CONN_OPTION;
1335     alias INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LIST;
1336     alias LPINTERNET_PER_CONN_OPTION_LISTW LPINTERNET_PER_CONN_OPTION_LIST;
1337     alias URL_COMPONENTSW URL_COMPONENTS;
1338     alias LPURL_COMPONENTSW LPURL_COMPONENTS;
1339     alias GOPHER_FIND_DATAW GOPHER_FIND_DATA;
1340     alias LPGOPHER_FIND_DATAW LPGOPHER_FIND_DATA;
1341     alias INTERNET_CACHE_ENTRY_INFOW INTERNET_CACHE_ENTRY_INFO;
1342     alias LPINTERNET_CACHE_ENTRY_INFOW LPINTERNET_CACHE_ENTRY_INFO;
1343     alias INTERNET_BUFFERSW INTERNET_BUFFERS;
1344     alias INTERNET_CACHE_GROUP_INFOW INTERNET_CACHE_GROUP_INFO;
1345     alias LPINTERNET_CACHE_GROUP_INFOW LPINTERNET_CACHE_GROUP_INFO;
1346     alias InternetCrackUrlW InternetCrackUrl;
1347     alias InternetCreateUrlW InternetCreateUrl;
1348     alias InternetCanonicalizeUrlW InternetCanonicalizeUrl;
1349     alias InternetCheckConnectionW InternetCheckConnection;
1350     alias InternetCombineUrlW InternetCombineUrl;
1351     alias InternetOpenW InternetOpen;
1352     alias InternetConnectW InternetConnect;
1353     alias InternetOpenUrlW InternetOpenUrl;
1354     alias InternetFindNextFileW InternetFindNextFile;
1355     alias InternetQueryOptionW InternetQueryOption;
1356     alias InternetSetOptionW InternetSetOption;
1357     alias InternetSetOptionExW InternetSetOptionEx;
1358     alias InternetGetLastResponseInfoW InternetGetLastResponseInfo;
1359     alias InternetReadFileExW InternetReadFileEx;
1360     alias FtpFindFirstFileW FtpFindFirstFile;
1361     alias FtpGetFileW FtpGetFile;
1362     alias FtpPutFileW FtpPutFile;
1363     alias FtpDeleteFileW FtpDeleteFile;
1364     alias FtpRenameFileW FtpRenameFile;
1365     alias FtpOpenFileW FtpOpenFile;
1366     alias FtpCreateDirectoryW FtpCreateDirectory;
1367     alias FtpRemoveDirectoryW FtpRemoveDirectory;
1368     alias FtpSetCurrentDirectoryW FtpSetCurrentDirectory;
1369     alias FtpGetCurrentDirectoryW FtpGetCurrentDirectory;
1370     alias FtpCommandW FtpCommand;
1371     alias GopherGetLocatorTypeW GopherGetLocatorType;
1372     alias GopherCreateLocatorW GopherCreateLocator;
1373     alias GopherFindFirstFileW GopherFindFirstFile;
1374     alias GopherOpenFileW GopherOpenFile;
1375     alias GopherGetAttributeW GopherGetAttribute;
1376     alias HttpSendRequestW HttpSendRequest;
1377     alias HttpOpenRequestW HttpOpenRequest;
1378     alias HttpAddRequestHeadersW HttpAddRequestHeaders;
1379     alias HttpQueryInfoW HttpQueryInfo;
1380     alias InternetSetCookieW InternetSetCookie;
1381     alias InternetGetCookieW InternetGetCookie;
1382     alias CreateUrlCacheEntryW CreateUrlCacheEntry;
1383     alias RetrieveUrlCacheEntryStreamW RetrieveUrlCacheEntryStream;
1384     alias FindNextUrlCacheEntryW FindNextUrlCacheEntry;
1385     alias CommitUrlCacheEntryW CommitUrlCacheEntry;
1386     alias GetUrlCacheEntryInfoW GetUrlCacheEntryInfo;
1387     alias SetUrlCacheEntryInfoW SetUrlCacheEntryInfo;
1388     alias FindFirstUrlCacheEntryW FindFirstUrlCacheEntry;
1389     alias RetrieveUrlCacheEntryFileW RetrieveUrlCacheEntryFile;
1390     alias HttpSendRequestExW HttpSendRequestEx;
1391     alias HttpEndRequestW HttpEndRequest;
1392     alias GetUrlCacheGroupAttributeW GetUrlCacheGroupAttribute;
1393     alias SetUrlCacheGroupAttributeW SetUrlCacheGroupAttribute;
1394 } else {
1395     alias INTERNET_PER_CONN_OPTIONA INTERNET_PER_CONN_OPTION;
1396     alias LPINTERNET_PER_CONN_OPTIONA LPINTERNET_PER_CONN_OPTION;
1397     alias INTERNET_PER_CONN_OPTION_LISTA INTERNET_PER_CONN_OPTION_LIST;
1398     alias LPINTERNET_PER_CONN_OPTION_LISTA LPINTERNET_PER_CONN_OPTION_LIST;
1399     alias URL_COMPONENTSA URL_COMPONENTS;
1400     alias LPURL_COMPONENTSA LPURL_COMPONENTS;
1401     alias GOPHER_FIND_DATAA GOPHER_FIND_DATA;
1402     alias LPGOPHER_FIND_DATAA LPGOPHER_FIND_DATA;
1403     alias INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFO;
1404     alias LPINTERNET_CACHE_ENTRY_INFOA LPINTERNET_CACHE_ENTRY_INFO;
1405     alias INTERNET_BUFFERSA INTERNET_BUFFERS;
1406     alias INTERNET_CACHE_GROUP_INFOA INTERNET_CACHE_GROUP_INFO;
1407     alias LPINTERNET_CACHE_GROUP_INFOA LPINTERNET_CACHE_GROUP_INFO;
1408     alias GopherGetAttributeA GopherGetAttribute;
1409     alias InternetCrackUrlA InternetCrackUrl;
1410     alias InternetCreateUrlA InternetCreateUrl;
1411     alias InternetCanonicalizeUrlA InternetCanonicalizeUrl;
1412     alias InternetCheckConnectionA InternetCheckConnection;
1413     alias InternetCombineUrlA InternetCombineUrl;
1414     alias InternetOpenA InternetOpen;
1415     alias InternetConnectA InternetConnect;
1416     alias InternetOpenUrlA InternetOpenUrl;
1417     alias InternetFindNextFileA InternetFindNextFile;
1418     alias InternetQueryOptionA InternetQueryOption;
1419     alias InternetSetOptionA InternetSetOption;
1420     alias InternetSetOptionExA InternetSetOptionEx;
1421     alias InternetGetLastResponseInfoA InternetGetLastResponseInfo;
1422     alias InternetReadFileExA InternetReadFileEx;
1423     alias FtpFindFirstFileA FtpFindFirstFile;
1424     alias FtpGetFileA FtpGetFile;
1425     alias FtpPutFileA FtpPutFile;
1426     alias FtpDeleteFileA FtpDeleteFile;
1427     alias FtpRenameFileA FtpRenameFile;
1428     alias FtpOpenFileA FtpOpenFile;
1429     alias FtpCreateDirectoryA FtpCreateDirectory;
1430     alias FtpRemoveDirectoryA FtpRemoveDirectory;
1431     alias FtpSetCurrentDirectoryA FtpSetCurrentDirectory;
1432     alias FtpGetCurrentDirectoryA FtpGetCurrentDirectory;
1433     alias FtpCommandA FtpCommand;
1434     alias GopherGetLocatorTypeA GopherGetLocatorType;
1435     alias GopherCreateLocatorA GopherCreateLocator;
1436     alias GopherFindFirstFileA GopherFindFirstFile;
1437     alias GopherOpenFileA GopherOpenFile;
1438     alias HttpSendRequestA HttpSendRequest;
1439     alias HttpOpenRequestA HttpOpenRequest;
1440     alias HttpAddRequestHeadersA HttpAddRequestHeaders;
1441     alias HttpQueryInfoA HttpQueryInfo;
1442     alias InternetSetCookieA InternetSetCookie;
1443     alias InternetGetCookieA InternetGetCookie;
1444     alias CreateUrlCacheEntryA CreateUrlCacheEntry;
1445     alias RetrieveUrlCacheEntryStreamA RetrieveUrlCacheEntryStream;
1446     alias FindNextUrlCacheEntryA FindNextUrlCacheEntry;
1447     alias CommitUrlCacheEntryA CommitUrlCacheEntry;
1448     alias GetUrlCacheEntryInfoA GetUrlCacheEntryInfo;
1449     alias SetUrlCacheEntryInfoA SetUrlCacheEntryInfo;
1450     alias FindFirstUrlCacheEntryA FindFirstUrlCacheEntry;
1451     alias RetrieveUrlCacheEntryFileA RetrieveUrlCacheEntryFile;
1452     alias HttpSendRequestExA HttpSendRequestEx;
1453     alias HttpEndRequestA HttpEndRequest;
1454     alias GetUrlCacheGroupAttributeA GetUrlCacheGroupAttribute;
1455     alias SetUrlCacheGroupAttributeA SetUrlCacheGroupAttribute;
1456 }
1457 
1458 alias INTERNET_BUFFERS* LPINTERNET_BUFFERS;