ReactOS 0.4.17-dev-1190-g4c812f4
internet.c
Go to the documentation of this file.
1#ifdef __REACTOS__
2#include "precomp.h"
3#else
4/*
5 * Wininet
6 *
7 * Copyright 1999 Corel Corporation
8 * Copyright 2002 CodeWeavers Inc.
9 * Copyright 2002 Jaco Greeff
10 * Copyright 2002 TransGaming Technologies Inc.
11 * Copyright 2004 Mike McCormack for CodeWeavers
12 *
13 * Ulrich Czekalla
14 * Aric Stewart
15 * David Hammerton
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 */
31
32#include "winsock2.h"
33#include "ws2ipdef.h"
34
35#include <string.h>
36#include <stdarg.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <ctype.h>
40#include <assert.h>
41#include <wchar.h>
42
43#include "windef.h"
44#include "winbase.h"
45#include "winreg.h"
46#include "winuser.h"
47#include "wininet.h"
48#include "winnls.h"
49#include "wine/debug.h"
50#include "winerror.h"
51#define NO_SHLWAPI_STREAM
52#include "shlwapi.h"
53#include "ws2tcpip.h"
54#include "winternl.h"
55#include "iphlpapi.h"
56#include "dhcpcsdk.h"
57
58#include "internet.h"
59#include "resource.h"
60#endif /* defined(__REACTOS__) */
61
63
64typedef struct
65{
69
72
75{
76 0, 0, &WININET_cs,
78 0, 0, { (DWORD_PTR)(__FILE__ ": WININET_cs") }
79};
80static CRITICAL_SECTION WININET_cs = { &WININET_cs_debug, -1, 0, 0, 0, 0 };
81
85
86typedef struct
87{
95
96#define CONNECTION_SETTINGS_VERSION 0x46
97typedef struct {
99 DWORD id;
100 DWORD flags;
101 BYTE data[1];
102 /* DWORD proxy_server_len; */
103 /* UTF8 proxy_server[proxy_server_len]; */
104 /* DWORD bypass_list_len; */
105 /* UTF8 bypass_list[bypass_list_len]; */
106 /* DWORD configuration_script_len; */
107 /* UTF8 configuration_script[configuration_script_len]; */
108 /* DWORD unk[8]; set to 0 */
110
112static ULONG connect_timeout = 60000;
113static ULONG send_timeout = 60000;
114static ULONG receive_timeout = 60000;
117
118
119static const WCHAR szInternetSettings[] =
120 L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
121
122static WCHAR *get_proxy_autoconfig_url(void);
123
125{
126 UINT_PTR handle = 0, num;
129 BOOL res = TRUE;
130
131 ret = calloc(1, size);
132 if(!ret)
133 return NULL;
134
135 list_init(&ret->children);
136
138
139 if(!handle_table_size) {
140 num = 16;
141 p = calloc(num, sizeof(handle_table[0]));
142 if(p) {
143 handle_table = p;
145 next_handle = 1;
146 }else {
147 res = FALSE;
148 }
149 }else if(next_handle == handle_table_size) {
151 p = realloc(handle_table, sizeof(handle_table[0]) * num);
152 if(p) {
154 handle_table = p;
156 }else {
157 res = FALSE;
158 }
159 }
160
161 if(res) {
164 ERR("handle isn't free but should be\n");
166 ret->valid_handle = TRUE;
167
169 next_handle++;
170 }
171
173
174 if(!res) {
175 free(ret);
176 return NULL;
177 }
178
179 ret->vtbl = vtbl;
180 ret->refs = 1;
181 ret->hInternet = (HINTERNET)handle;
182
183 if(parent) {
184 ret->lpfnStatusCB = parent->lpfnStatusCB;
185 ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
186 ret->connect_timeout = parent->connect_timeout;
187 ret->send_timeout = parent->send_timeout;
188 ret->receive_timeout = parent->receive_timeout;
189 ret->data_send_timeout = parent->data_send_timeout;
190 ret->data_receive_timeout = parent->data_receive_timeout;
191 } else {
192 ret->connect_timeout = connect_timeout;
193 ret->send_timeout = send_timeout;
194 ret->receive_timeout = receive_timeout;
195 ret->data_send_timeout = data_send_timeout;
196 ret->data_receive_timeout = data_receive_timeout;
197 }
198
199 return ret;
200}
201
203{
205 TRACE("%p -> refcount = %ld\n", info, refs );
206 return info;
207}
208
210{
212 UINT_PTR handle = (UINT_PTR) hinternet;
213
215
218
220
221 TRACE("handle %Id -> %p\n", handle, info);
222
223 return info;
224}
225
227{
229
230 if(!info->valid_handle)
231 return;
232 info->valid_handle = FALSE;
233
234 /* Free all children as native does */
236 {
237 TRACE("invalidating child handle %p for parent %p\n", child->hInternet, info);
239 }
240
242}
243
245{
247 TRACE( "object %p refcount = %ld\n", info, refs );
248 if( !refs )
249 {
251 if ( info->vtbl->CloseConnection )
252 {
253 TRACE( "closing connection %p\n", info);
254 info->vtbl->CloseConnection( info );
255 }
256 /* Don't send a callback if this is a session handle created with InternetOpenUrl */
257 if ((info->htype != WH_HHTTPSESSION && info->htype != WH_HFTPSESSION)
258 || !(info->dwInternalFlags & INET_OPENURL))
259 {
260 INTERNET_SendCallback(info, info->dwContext,
262 sizeof(HINTERNET));
263 }
264 TRACE( "destroying object %p\n", info);
265 if ( info->htype != WH_HINIT )
266 list_remove( &info->entry );
267 info->vtbl->Destroy( info );
268
269 if(info->hInternet) {
270 UINT_PTR handle = (UINT_PTR)info->hInternet;
271
273
275 if(next_handle > handle)
277
279 }
280
281 free(info);
282 }
283 return TRUE;
284}
285
286/***********************************************************************
287 * DllMain [Internal] Initializes the internal 'WININET.DLL'.
288 *
289 * PARAMS
290 * hinstDLL [I] handle to the DLL's instance
291 * fdwReason [I]
292 * lpvReserved [I] reserved, must be NULL
293 *
294 * RETURNS
295 * Success: TRUE
296 * Failure: FALSE
297 */
298
300{
301 TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
302
303 switch (fdwReason) {
305
307
309 return FALSE;
310
311 if(!init_urlcache())
312 {
314 return FALSE;
315 }
316
317 WININET_hModule = hinstDLL;
318 break;
319
321 break;
322
325 {
327 }
328 break;
329
331 if (lpvReserved) break;
335 free_cookie();
336
338 {
341 }
342 break;
343 }
344 return TRUE;
345}
346
347/***********************************************************************
348 * DllInstall (WININET.@)
349 */
351{
352 FIXME("(%x %s): stub\n", bInstall, debugstr_w(cmdline));
353 return S_OK;
354}
355
357{
358 int len = 0;
359
360 if (str)
361 {
362 len = wcslen( str );
363 len = WideCharToMultiByte( CP_UTF8, 0, str, len, settings ? (char*)settings->data + *pos + sizeof(len) : NULL,
364 settings ? size - *pos - sizeof(len) : 0, NULL, NULL );
365 }
366 if (settings)
367 memcpy(settings->data + *pos, &len, sizeof(len));
368 *pos += sizeof(len) + len;
369}
370
372{
374 DWORD size = 0, pos = 0;
375 LONG ret;
376
380 size += sizeof(DWORD) * 10; /* unknown fields */
381
383 if (!settings)
384 return ERROR_OUTOFMEMORY;
385
387 settings->flags = lpwpi->flags;
391
394 free(settings);
395 return ret;
396}
397
398/***********************************************************************
399 * INTERNET_SaveProxySettings
400 *
401 * Stores the proxy settings given by lpwai into the registry
402 *
403 * RETURNS
404 * ERROR_SUCCESS if no error, or error code on fail
405 */
407{
408 HKEY key, con;
409 DWORD val;
410 LONG ret;
411
413 return ret;
414
415 if ((ret = RegCreateKeyExW( key, L"Connections", 0, NULL, 0, KEY_WRITE, NULL, &con, NULL )))
416 {
417 RegCloseKey( key );
418 return ret;
419 }
420 ret = save_connection_settings( con, L"DefaultConnectionSettings", lpwpi );
421 RegCloseKey( con );
422 if (ret)
423 {
424 RegCloseKey( key );
425 return ret;
426 }
427
428 val = !!(lpwpi->flags & PROXY_TYPE_PROXY);
429 if ((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE*)&val, sizeof(DWORD))))
430 {
431 RegCloseKey( key );
432 return ret;
433 }
434
435 if (lpwpi->proxy)
436 {
437 if ((ret = RegSetValueExW( key, L"ProxyServer", 0, REG_SZ, (BYTE*)lpwpi->proxy,
438 sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
439 {
440 RegCloseKey( key );
441 return ret;
442 }
443 }
444 else
445 {
446 if ((ret = RegDeleteValueW( key, L"ProxyServer" )) && ret != ERROR_FILE_NOT_FOUND)
447 {
448 RegCloseKey( key );
449 return ret;
450 }
451 }
452
453 if (lpwpi->proxyBypass)
454 {
455 if ((ret = RegSetValueExW( key, L"ProxyOverride", 0, REG_SZ, (BYTE*)lpwpi->proxyBypass,
456 sizeof(WCHAR) * (lstrlenW(lpwpi->proxyBypass) + 1))))
457 {
458 RegCloseKey( key );
459 return ret;
460 }
461 }
462 else
463 {
464 if ((ret = RegDeleteValueW( key, L"ProxyOverride" )) && ret != ERROR_FILE_NOT_FOUND)
465 {
466 RegCloseKey( key );
467 return ret;
468 }
469 }
470
471 if (lpwpi->autoconf_url && lpwpi->flags & PROXY_TYPE_AUTO_PROXY_URL)
472 {
473 if ((ret = RegSetValueExW( key, L"AutoConfigURL", 0, REG_SZ, (BYTE*)lpwpi->autoconf_url,
474 sizeof(WCHAR) * (lstrlenW(lpwpi->autoconf_url) + 1))))
475 {
476 RegCloseKey( key );
477 return ret;
478 }
479 }
480 else
481 {
482 if ((ret = RegDeleteValueW( key, L"AutoConfigURL" )) && ret != ERROR_FILE_NOT_FOUND)
483 {
484 RegCloseKey( key );
485 return ret;
486 }
487 }
488
490 return ERROR_SUCCESS;
491}
492
493/***********************************************************************
494 * INTERNET_FindProxyForProtocol
495 *
496 * Searches the proxy string for a proxy of the given protocol.
497 * Returns the found proxy, or the default proxy if none of the given
498 * protocol is found.
499 *
500 * PARAMETERS
501 * szProxy [In] proxy string to search
502 * proto [In] protocol to search for, e.g. "http"
503 * foundProxy [Out] found proxy
504 * foundProxyLen [In/Out] length of foundProxy buffer, in WCHARs
505 *
506 * RETURNS
507 * TRUE if a proxy is found, FALSE if not. If foundProxy is too short,
508 * *foundProxyLen is set to the required size in WCHARs, including the
509 * NULL terminator, and the last error is set to ERROR_INSUFFICIENT_BUFFER.
510 */
512{
513 WCHAR *ret = NULL;
514 const WCHAR *ptr;
515
516 TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
517
518 /* First, look for the specified protocol (proto=scheme://host:port) */
519 for (ptr = szProxy; ptr && *ptr; )
520 {
522
523 if (!(end = wcschr(ptr, ' ')))
524 end = ptr + lstrlenW(ptr);
525 if ((equal = wcschr(ptr, '=')) && equal < end &&
526 equal - ptr == lstrlenW(proto) &&
528 {
529 ret = strndupW(equal + 1, end - equal - 1);
530 TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
531 return ret;
532 }
533 if (*end == ' ')
534 ptr = end + 1;
535 else
536 ptr = end;
537 }
538
539 /* It wasn't found: look for no protocol */
540 for (ptr = szProxy; ptr && *ptr; )
541 {
542 LPCWSTR end;
543
544 if (!(end = wcschr(ptr, ' ')))
545 end = ptr + lstrlenW(ptr);
546 if (!wcschr(ptr, '='))
547 {
548 ret = strndupW(ptr, end - ptr);
549 TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
550 return ret;
551 }
552 if (*end == ' ')
553 ptr = end + 1;
554 else
555 ptr = end;
556 }
557
558 return NULL;
559}
560
561/***********************************************************************
562 * InternetInitializeAutoProxyDll (WININET.@)
563 *
564 * Setup the internal proxy
565 *
566 * PARAMETERS
567 * dwReserved
568 *
569 * RETURNS
570 * FALSE on failure
571 *
572 */
574{
575 FIXME("STUB\n");
577 return FALSE;
578}
579
580/***********************************************************************
581 * DetectAutoProxyUrl (WININET.@)
582 *
583 * Auto detect the proxy url
584 *
585 * RETURNS
586 * FALSE on failure
587 *
588 */
590 DWORD dwAutoProxyUrlLength, DWORD dwDetectFlags)
591{
592 FIXME("STUB\n");
594 return FALSE;
595}
596
597static void FreeProxyInfo( proxyinfo_t *lpwpi )
598{
599 free(lpwpi->proxy);
600 free(lpwpi->proxyBypass);
601 free(lpwpi->proxyUsername);
602 free(lpwpi->proxyPassword);
603 free(lpwpi->autoconf_url);
604}
605
607
608static void free_global_proxy( void )
609{
612 memset( &global_proxy, 0, sizeof(global_proxy) );
614}
615
617{
618 URL_COMPONENTSW uc = {sizeof(uc)};
619
620 uc.dwHostNameLength = 1;
621 uc.dwUserNameLength = 1;
622 uc.dwPasswordLength = 1;
623
624 if (!InternetCrackUrlW( url, 0, 0, &uc )) return FALSE;
625 if (!uc.dwHostNameLength)
626 {
627 if (!(info->proxy = wcsdup( url ))) return FALSE;
628 info->proxyUsername = NULL;
629 info->proxyPassword = NULL;
630 return TRUE;
631 }
632 if (!(info->proxy = malloc( (uc.dwHostNameLength + 12) * sizeof(WCHAR) ))) return FALSE;
633 swprintf( info->proxy, uc.dwHostNameLength + 12, L"%.*s:%u", uc.dwHostNameLength, uc.lpszHostName, uc.nPort );
634
635 if (!uc.dwUserNameLength) info->proxyUsername = NULL;
636 else if (!(info->proxyUsername = strndupW( uc.lpszUserName, uc.dwUserNameLength )))
637 {
638 free( info->proxy );
639 return FALSE;
640 }
641 if (!uc.dwPasswordLength) info->proxyPassword = NULL;
642 else if (!(info->proxyPassword = strndupW( uc.lpszPassword, uc.dwPasswordLength )))
643 {
644 free( info->proxyUsername );
645 free( info->proxy );
646 return FALSE;
647 }
648 return TRUE;
649}
650
652{
653 const WCHAR *p, *end;
654 WCHAR *ret;
655
656 p = wcsstr( proxy, L"http=" );
657 if (p) p += 5;
658 else p = proxy;
659 end = wcschr( p, ';' );
660 if (!end) end = p + wcslen( p );
661
662 ret = malloc( (end - p + 1) * sizeof(WCHAR) );
663 memcpy(ret, p, (end - p) * sizeof(WCHAR) );
664 ret[end - p] = 0;
665 return ret;
666}
667
669{
670 int len, wlen;
671
672 *str = NULL;
673 if (*pos + sizeof(int) >= size)
674 return ERROR_SUCCESS;
675 memcpy( &len, settings->data + *pos, sizeof(int) );
676 *pos += sizeof(int);
677
678 if (*pos + len >= size)
679 {
680 *pos = size;
681 return ERROR_SUCCESS;
682 }
683 wlen = MultiByteToWideChar( CP_UTF8, 0, (const char *)settings->data + *pos, len, NULL, 0 );
684 if (wlen)
685 {
686 *str = malloc( (wlen + 1) * sizeof(WCHAR) );
687 if (!*str)
688 {
689 *pos = size;
690 return ERROR_OUTOFMEMORY;
691 }
692 MultiByteToWideChar( CP_UTF8, 0, (const char *)settings->data + *pos, len, *str, wlen );
693 (*str)[wlen] = 0;
694 *pos += len;
695 }
696 return ERROR_SUCCESS;
697}
698
700{
702 DWORD type, pos, size = 0;
703 LONG res;
704
706 (!res && !settings))
707 {
708 connection_settings *new_settings = realloc(settings, size);
709 if(!new_settings)
710 {
711 free( settings );
712 return ERROR_OUTOFMEMORY;
713 }
714 settings = new_settings;
715 }
716
717 memset(lpwpi, 0, sizeof(*lpwpi));
719 {
721 free( settings );
722 return ERROR_SUCCESS;
723 }
724
725 lpwpi->flags = settings->flags;
727 pos = 0;
729 if (!res)
731 if (!res)
733 free( settings );
734 if (res)
735 {
736 FreeProxyInfo( lpwpi );
737 return res;
738 }
739 return ERROR_SUCCESS;
740}
741
742/***********************************************************************
743 * INTERNET_LoadProxySettings
744 *
745 * Loads proxy information from the registry into lpwpi.
746 *
747 * The caller should call FreeProxyInfo when done with lpwpi.
748 *
749 * FIXME:
750 * The proxy may be specified in the form 'http=proxy.my.org'
751 * Presumably that means there can be ftp=ftpproxy.my.org too.
752 */
754{
755 DWORD type, len, val;
756 HKEY key, con;
757 LONG ret;
758
759 memset( lpwpi, 0, sizeof(*lpwpi) );
760
762 return ret;
763
764 if (!(ret = RegOpenKeyW( key, L"Connections", &con )))
765 {
766 load_connection_settings( con, L"DefaultConnectionSettings", lpwpi );
767 RegCloseKey( con );
768 }
769
770 len = sizeof(DWORD);
771 if (RegQueryValueExW( key, L"ProxyEnable", NULL, &type, (BYTE *)&val, &len ) || type != REG_DWORD)
772 {
773 val = !!(lpwpi->flags & PROXY_TYPE_PROXY);
774 if((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE *)&val, sizeof(DWORD) )))
775 {
776 RegCloseKey( key );
777 FreeProxyInfo( lpwpi );
778 return ret;
779 }
780 }
781 else if (val)
782 {
783 lpwpi->flags |= PROXY_TYPE_PROXY;
784 }
785 else
786 {
787 lpwpi->flags &= ~PROXY_TYPE_PROXY;
788 }
789
790 /* figure out how much memory the proxy setting takes */
791 if (!RegQueryValueExW( key, L"ProxyServer", NULL, &type, NULL, &len ) && len && (type == REG_SZ))
792 {
793 LPWSTR szProxy;
794
795 if (!(szProxy = malloc( len )))
796 {
797 RegCloseKey( key );
798 FreeProxyInfo( lpwpi );
799 return ERROR_OUTOFMEMORY;
800 }
801 RegQueryValueExW( key, L"ProxyServer", NULL, &type, (BYTE*)szProxy, &len );
802
803 free( lpwpi->proxy );
804 lpwpi->proxy = szProxy;
805 }
806
807 if (lpwpi->proxy)
808 {
809 TRACE("proxy (from registry%s) = %s\n", lpwpi->flags & PROXY_TYPE_PROXY ? "" : ", disabled",
810 debugstr_w(lpwpi->proxy));
811 }
812 else
813 {
814 TRACE("No proxy server settings in registry.\n");
815 }
816
817 if (!RegQueryValueExW( key, L"ProxyOverride", NULL, &type, NULL, &len ) && len && (type == REG_SZ))
818 {
819 LPWSTR szProxy;
820
821 if (!(szProxy = malloc( len )))
822 {
823 RegCloseKey( key );
824 FreeProxyInfo( lpwpi );
825 return ERROR_OUTOFMEMORY;
826 }
827 RegQueryValueExW( key, L"ProxyOverride", NULL, &type, (BYTE*)szProxy, &len );
828
829 free( lpwpi->proxyBypass );
830 lpwpi->proxyBypass = szProxy;
831 TRACE("http proxy bypass (from registry) = %s\n", debugstr_w(lpwpi->proxyBypass));
832 }
833 else
834 {
835 TRACE("No proxy bypass server settings in registry.\n");
836 }
837
838 if (!RegQueryValueExW( key, L"AutoConfigURL", NULL, &type, NULL, &len ) && len && (type == REG_SZ))
839 {
840 LPWSTR autoconf_url;
841
842 if (!(autoconf_url = malloc( len )))
843 {
844 RegCloseKey( key );
845 FreeProxyInfo( lpwpi );
846 return ERROR_OUTOFMEMORY;
847 }
848 RegQueryValueExW( key, L"AutoConfigURL", NULL, &type, (BYTE*)autoconf_url, &len );
849
851 free( lpwpi->autoconf_url );
852 lpwpi->autoconf_url = autoconf_url;
853 TRACE("AutoConfigURL = %s\n", debugstr_w(lpwpi->autoconf_url));
854 }
855
856 RegCloseKey( key );
857 return ERROR_SUCCESS;
858}
859
860static void init_global_proxy(void)
861{
862 const WCHAR *envproxy;
863
865 if (global_proxy.flags) goto done;
866
868 if (global_proxy.flags & PROXY_TYPE_PROXY || !(envproxy = _wgetenv( L"http_proxy" )))
869 goto done;
870
871 if (parse_proxy_url( &global_proxy, envproxy ))
872 {
874 global_proxy.proxyBypass = wcsdup(_wgetenv( L"no_proxy" ));
875 TRACE("http proxy (from environment) = %s\n", debugstr_w(global_proxy.proxy));
876 TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(global_proxy.proxyBypass));
877 }
878 else
879 {
880 WARN("failed to parse http_proxy value %s\n", debugstr_w(envproxy));
881 }
882
883done:
885}
886
887/***********************************************************************
888 * INTERNET_GetProxySettings
889 *
890 * Loads process-wide proxy settings into lpwpi.
891 */
893{
895
896 memset(lpwpi, 0, sizeof(*lpwpi));
898 lpwpi->flags = global_proxy.flags;
899 lpwpi->proxy = wcsdup( global_proxy.proxy );
904 return ERROR_SUCCESS;
905}
906
907/***********************************************************************
908 * INTERNET_ConfigureProxy
909 */
911{
912 proxyinfo_t wpi;
913
914 if (INTERNET_GetProxySettings( &wpi ))
915 return FALSE;
916
917 if (wpi.flags & PROXY_TYPE_PROXY)
918 {
919 TRACE("http proxy = %s bypass = %s\n", debugstr_w(wpi.proxy), debugstr_w(wpi.proxyBypass));
920
922 lpwai->proxy = get_http_proxy( wpi.proxy );
923 lpwai->proxyBypass = wpi.proxyBypass;
924 lpwai->proxyUsername = wpi.proxyUsername;
925 lpwai->proxyPassword = wpi.proxyPassword;
926 free( wpi.proxy );
927 return TRUE;
928 }
929
931 FreeProxyInfo(&wpi);
932 return FALSE;
933}
934
935/***********************************************************************
936 * dump_INTERNET_FLAGS
937 *
938 * Helper function to TRACE the internet flags.
939 *
940 * RETURNS
941 * None
942 *
943 */
945{
946#define FE(x) { x, #x }
947 static const wininet_flag_info flag[] = {
976 };
977#undef FE
978 unsigned int i;
979
980 for (i = 0; i < ARRAY_SIZE(flag); i++) {
981 if (flag[i].val & dwFlags) {
982 TRACE(" %s", flag[i].name);
983 dwFlags &= ~flag[i].val;
984 }
985 }
986 if (dwFlags)
987 TRACE(" Unknown flags (%08lx)\n", dwFlags);
988 else
989 TRACE("\n");
990}
991
992/***********************************************************************
993 * INTERNET_CloseHandle (internal)
994 *
995 * Close internet handle
996 *
997 */
999{
1000 appinfo_t *lpwai = (appinfo_t*)hdr;
1001
1002 TRACE("%p\n",lpwai);
1003
1004 free(lpwai->agent);
1005 free(lpwai->proxy);
1006 free(lpwai->proxyBypass);
1007 free(lpwai->proxyUsername);
1008 free(lpwai->proxyPassword);
1009}
1010
1012{
1013 DWORD len;
1014 void *tmp;
1015
1016 if (!value)
1017 return NULL;
1018
1019 len = (wcslen(value) + 1) * sizeof(WCHAR);
1020 if (!(tmp = GlobalAlloc(0, len)))
1021 return NULL;
1022
1023 return memcpy(tmp, value, len);
1024}
1025
1027{
1028 DWORD len;
1029 void *tmp;
1030
1031 if (!value)
1032 return NULL;
1033
1034 len = WideCharToMultiByte(CP_ACP, 0, value, -1, NULL, 0, NULL, NULL);
1035 if (!(tmp = GlobalAlloc(0, len)))
1036 return NULL;
1037
1038 WideCharToMultiByte(CP_ACP, 0, value, -1, tmp, len, NULL, NULL);
1039 return tmp;
1040}
1041
1043{
1044 appinfo_t *ai = (appinfo_t*)hdr;
1045
1046 switch(option) {
1048 TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
1049
1050 if (*size < sizeof(ULONG))
1052
1053 *size = sizeof(DWORD);
1055 return ERROR_SUCCESS;
1056
1058 DWORD bufsize;
1059
1060 TRACE("INTERNET_OPTION_USER_AGENT\n");
1061
1062 bufsize = *size;
1063
1064 if (unicode) {
1065 DWORD len = ai->agent ? lstrlenW(ai->agent) : 0;
1066
1067 *size = (len + 1) * sizeof(WCHAR);
1068 if(!buffer || bufsize < *size)
1070
1071 if (ai->agent)
1072 lstrcpyW(buffer, ai->agent);
1073 else
1074 *(WCHAR *)buffer = 0;
1075 /* If the buffer is copied, the returned length doesn't include
1076 * the NULL terminator.
1077 */
1078 *size = len;
1079 }else {
1080 if (ai->agent)
1081 *size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL);
1082 else
1083 *size = 1;
1084 if(!buffer || bufsize < *size)
1086
1087 if (ai->agent)
1089 else
1090 *(char *)buffer = 0;
1091 /* If the buffer is copied, the returned length doesn't include
1092 * the NULL terminator.
1093 */
1094 *size -= 1;
1095 }
1096
1097 return ERROR_SUCCESS;
1098 }
1099
1101 if(!size) return ERROR_INVALID_PARAMETER;
1102 if (unicode) {
1104 DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
1105 LPWSTR proxy, proxy_bypass;
1106
1107 if (ai->proxy)
1108 proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR);
1109 if (ai->proxyBypass)
1110 proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR);
1111 if (!pi || *size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired)
1112 {
1113 *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
1115 }
1117 proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired);
1118
1119 pi->dwAccessType = ai->accessType;
1120 pi->lpszProxy = NULL;
1121 pi->lpszProxyBypass = NULL;
1122 if (ai->proxy) {
1123 lstrcpyW(proxy, ai->proxy);
1124 pi->lpszProxy = proxy;
1125 }
1126
1127 if (ai->proxyBypass) {
1128 lstrcpyW(proxy_bypass, ai->proxyBypass);
1129 pi->lpszProxyBypass = proxy_bypass;
1130 }
1131
1132 *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
1133 return ERROR_SUCCESS;
1134 }else {
1136 DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
1137 LPSTR proxy, proxy_bypass;
1138
1139 if (ai->proxy)
1140 proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL);
1141 if (ai->proxyBypass)
1142 proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1,
1143 NULL, 0, NULL, NULL);
1144 if (!pi || *size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired)
1145 {
1146 *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
1148 }
1150 proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired);
1151
1152 pi->dwAccessType = ai->accessType;
1153 pi->lpszProxy = NULL;
1154 pi->lpszProxyBypass = NULL;
1155 if (ai->proxy) {
1156 WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL);
1157 pi->lpszProxy = proxy;
1158 }
1159
1160 if (ai->proxyBypass) {
1161 WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass,
1162 proxyBypassBytesRequired, NULL, NULL);
1163 pi->lpszProxyBypass = proxy_bypass;
1164 }
1165
1166 *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
1167 return ERROR_SUCCESS;
1168 }
1169
1174 WCHAR *url = NULL;
1175 int i;
1176
1177 if (*size < sizeof(INTERNET_PER_CONN_OPTION_LISTW))
1179
1181
1184
1185 for (i = 0; i < con->dwOptionCount; i++) {
1187 INTERNET_PER_CONN_OPTIONA *optionA = conA->pOptions + i;
1188
1189 switch (optionW->dwOption) {
1191 optionW->Value.dwValue = global_proxy.flags;
1192 break;
1193
1195 if (unicode)
1196 optionW->Value.pszValue = copy_optionW(global_proxy.proxy);
1197 else
1199 break;
1200
1202 if (unicode)
1203 optionW->Value.pszValue = copy_optionW(global_proxy.proxyBypass);
1204 else
1206 break;
1207
1209 if (unicode)
1210 optionW->Value.pszValue = copy_optionW(global_proxy.autoconf_url);
1211 else
1213 break;
1214
1216 optionW->Value.dwValue = AUTO_PROXY_FLAG_ALWAYS_DETECT;
1217 break;
1218
1220 if (unicode)
1221 optionW->Value.pszValue = copy_optionW(url);
1222 else
1223 optionA->Value.pszValue = copy_optionA(url);
1224 break;
1225
1229 FIXME("Unhandled dwOption %ld\n", optionW->dwOption);
1230 memset(&optionW->Value, 0, sizeof(optionW->Value));
1231 break;
1232
1233 default:
1234 FIXME("Unknown dwOption %ld\n", optionW->dwOption);
1236 break;
1237 }
1238 }
1239
1241 return res;
1242 }
1243 }
1244
1245 return INET_QueryOption(hdr, option, buffer, size, unicode);
1246}
1247
1249{
1250 appinfo_t *ai = (appinfo_t*)hdr;
1251
1252 switch(option) {
1254 free(ai->agent);
1255 if (!(ai->agent = wcsdup(buf))) return ERROR_OUTOFMEMORY;
1256 return ERROR_SUCCESS;
1258 FIXME("INTERNET_OPTION_REFRESH\n");
1259 return ERROR_SUCCESS;
1262 unsigned int i;
1263
1265 for (i = 0; i < con->dwOptionCount; i++) {
1267
1268 switch (option->dwOption) {
1271 global_proxy.proxy = wcsdup(option->Value.pszValue);
1272 break;
1273
1275 if(option->Value.dwValue & ~(PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT))
1276 FIXME("Unhandled flags: 0x%lx\n", option->Value.dwValue);
1277 global_proxy.flags = option->Value.dwValue;
1278 break;
1279
1282 global_proxy.proxyBypass = wcsdup(option->Value.pszValue);
1283 break;
1284
1287 global_proxy.autoconf_url = wcsdup(option->Value.pszValue);
1288 break;
1289
1295 FIXME("Unhandled dwOption %ld\n", option->dwOption);
1296 break;
1297
1298 default:
1299 FIXME("Unknown dwOption %ld\n", option->dwOption);
1301 break;
1302 }
1303 }
1305 return ERROR_SUCCESS;
1306 }
1307 }
1308
1309 return INET_SetOption(hdr, option, buf, size);
1310}
1311
1314 NULL,
1317 NULL,
1318 NULL,
1319 NULL,
1320 NULL
1321};
1322
1323
1324/***********************************************************************
1325 * InternetOpenW (WININET.@)
1326 *
1327 * Per-application initialization of wininet
1328 *
1329 * RETURNS
1330 * HINTERNET on success
1331 * NULL on failure
1332 *
1333 */
1335 LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
1336{
1337 appinfo_t *lpwai = NULL;
1338
1339#ifdef __REACTOS__
1340 init_winsock();
1341#endif
1342 if (TRACE_ON(wininet)) {
1343#define FE(x) { x, #x }
1344 static const wininet_flag_info access_type[] = {
1349 };
1350#undef FE
1351 DWORD i;
1352 const char *access_type_str = "Unknown";
1353
1354 TRACE("(%s, %li, %s, %s, %li)\n", debugstr_w(lpszAgent), dwAccessType,
1355 debugstr_w(lpszProxy), debugstr_w(lpszProxyBypass), dwFlags);
1356 for (i = 0; i < ARRAY_SIZE(access_type); i++) {
1357 if (access_type[i].val == dwAccessType) {
1358 access_type_str = access_type[i].name;
1359 break;
1360 }
1361 }
1362 TRACE(" access type : %s\n", access_type_str);
1363 TRACE(" flags :");
1365 }
1366
1367 /* Clear any error information */
1369
1370 if((dwAccessType == INTERNET_OPEN_TYPE_PROXY) && !lpszProxy) {
1372 return NULL;
1373 }
1374
1375 lpwai = alloc_object(NULL, &APPINFOVtbl, sizeof(appinfo_t));
1376 if (!lpwai) {
1378 return NULL;
1379 }
1380
1381 lpwai->hdr.htype = WH_HINIT;
1382 lpwai->hdr.dwFlags = dwFlags;
1383 lpwai->accessType = dwAccessType;
1384 lpwai->proxyUsername = NULL;
1385 lpwai->proxyPassword = NULL;
1386
1387 lpwai->agent = wcsdup(lpszAgent);
1388 if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG)
1389 INTERNET_ConfigureProxy( lpwai );
1390 else if(dwAccessType == INTERNET_OPEN_TYPE_PROXY) {
1391 lpwai->proxy = wcsdup(lpszProxy);
1392 lpwai->proxyBypass = wcsdup(lpszProxyBypass);
1393 }
1394
1395 TRACE("returning %p\n", lpwai);
1396
1397 return lpwai->hdr.hInternet;
1398}
1399
1400
1401/***********************************************************************
1402 * InternetOpenA (WININET.@)
1403 *
1404 * Per-application initialization of wininet
1405 *
1406 * RETURNS
1407 * HINTERNET on success
1408 * NULL on failure
1409 *
1410 */
1412 LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
1413{
1414 WCHAR *szAgent, *szProxy, *szBypass;
1415 HINTERNET rc;
1416
1417 TRACE("(%s, 0x%08lx, %s, %s, 0x%08lx)\n", debugstr_a(lpszAgent),
1418 dwAccessType, debugstr_a(lpszProxy), debugstr_a(lpszProxyBypass), dwFlags);
1419
1420 szAgent = strdupAtoW(lpszAgent);
1421 szProxy = strdupAtoW(lpszProxy);
1422 szBypass = strdupAtoW(lpszProxyBypass);
1423
1424 rc = InternetOpenW(szAgent, dwAccessType, szProxy, szBypass, dwFlags);
1425
1426 free(szAgent);
1427 free(szProxy);
1428 free(szBypass);
1429 return rc;
1430}
1431
1432/***********************************************************************
1433 * InternetGetLastResponseInfoA (WININET.@)
1434 *
1435 * Return last wininet error description on the calling thread
1436 *
1437 * RETURNS
1438 * TRUE on success of writing to buffer
1439 * FALSE on failure
1440 *
1441 */
1443 LPSTR lpszBuffer, LPDWORD lpdwBufferLength)
1444{
1446
1447 TRACE("(%p, %p, %p)\n", lpdwError, lpszBuffer, lpdwBufferLength);
1448
1449 if (!lpdwError || !lpdwBufferLength)
1450 {
1452 return FALSE;
1453 }
1454 if (lpwite)
1455 {
1456 if (lpszBuffer == NULL || *lpdwBufferLength < strlen(lpwite->response))
1457 {
1458 *lpdwBufferLength = strlen(lpwite->response);
1460 return FALSE;
1461 }
1462 *lpdwError = lpwite->dwError;
1463 if (*lpdwBufferLength)
1464 {
1465 memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
1466 lpszBuffer[*lpdwBufferLength - 1] = 0;
1467 *lpdwBufferLength = strlen(lpszBuffer);
1468 }
1469 }
1470 else
1471 {
1472 *lpdwError = 0;
1473 *lpdwBufferLength = 0;
1474 }
1475
1476 return TRUE;
1477}
1478
1479/***********************************************************************
1480 * InternetGetLastResponseInfoW (WININET.@)
1481 *
1482 * Return last wininet error description on the calling thread
1483 *
1484 * RETURNS
1485 * TRUE on success of writing to buffer
1486 * FALSE on failure
1487 *
1488 */
1490 LPWSTR lpszBuffer, LPDWORD lpdwBufferLength)
1491{
1493
1494 TRACE("(%p, %p, %p)\n", lpdwError, lpszBuffer, lpdwBufferLength);
1495
1496 if (!lpdwError || !lpdwBufferLength)
1497 {
1499 return FALSE;
1500 }
1501 if (lpwite)
1502 {
1503 int required_size = MultiByteToWideChar(CP_ACP, 0, lpwite->response, -1, NULL, 0) - 1;
1504 if (lpszBuffer == NULL || *lpdwBufferLength < required_size)
1505 {
1506 *lpdwBufferLength = required_size;
1508 return FALSE;
1509 }
1510 *lpdwError = lpwite->dwError;
1511 if (*lpdwBufferLength)
1512 *lpdwBufferLength = MultiByteToWideChar(CP_ACP, 0, lpwite->response, -1, lpszBuffer, *lpdwBufferLength);
1513 }
1514 else
1515 {
1516 *lpdwError = 0;
1517 *lpdwBufferLength = 0;
1518 }
1519
1520 return TRUE;
1521}
1522
1523/***********************************************************************
1524 * InternetGetConnectedState (WININET.@)
1525 *
1526 * Return connected state
1527 *
1528 * RETURNS
1529 * TRUE if connected
1530 * if lpdwStatus is not null, return the status (off line,
1531 * modem, lan...) in it.
1532 * FALSE if not connected
1533 */
1535{
1536 TRACE("(%p, 0x%08lx)\n", lpdwStatus, dwReserved);
1537
1538 return InternetGetConnectedStateExW(lpdwStatus, NULL, 0, dwReserved);
1539}
1540
1541
1542/***********************************************************************
1543 * InternetGetConnectedStateExW (WININET.@)
1544 *
1545 * Return connected state
1546 *
1547 * PARAMS
1548 *
1549 * lpdwStatus [O] Flags specifying the status of the internet connection.
1550 * lpszConnectionName [O] Pointer to buffer to receive the friendly name of the internet connection.
1551 * dwNameLen [I] Size of the buffer, in characters.
1552 * dwReserved [I] Reserved. Must be set to 0.
1553 *
1554 * RETURNS
1555 * TRUE if connected
1556 * if lpdwStatus is not null, return the status (off line,
1557 * modem, lan...) in it.
1558 * FALSE if not connected
1559 *
1560 * NOTES
1561 * If the system has no available network connections, an empty string is
1562 * stored in lpszConnectionName. If there is a LAN connection, a localized
1563 * "LAN Connection" string is stored. Presumably, if only a dial-up
1564 * connection is available then the name of the dial-up connection is
1565 * returned. Why any application, other than the "Internet Settings" CPL,
1566 * would want to use this function instead of the simpler InternetGetConnectedStateW
1567 * function is beyond me.
1568 */
1570 DWORD dwNameLen, DWORD dwReserved)
1571{
1572 IP_ADAPTER_ADDRESSES *buf = NULL, *aa;
1573 ULONG size = 0;
1574 DWORD status;
1575
1576 TRACE("(%p, %p, %ld, 0x%08lx)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
1577
1578 /* Must be zero */
1579 if(dwReserved)
1580 {
1582 return FALSE;
1583 }
1584
1585 for (;;)
1586 {
1587 ULONG flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER |
1588 GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_INCLUDE_GATEWAYS;
1589 ULONG errcode = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, buf, &size);
1590
1591 if (errcode == ERROR_SUCCESS)
1592 break;
1593 free(buf);
1597 {
1598 if (errcode != ERROR_NO_DATA)
1599 {
1601 return FALSE;
1602 }
1603 buf = NULL;
1604 break;
1605 }
1606 }
1607
1609 for (aa = buf; aa; aa = aa->Next)
1610 {
1611 /* Connected, but not necessarily to internet */
1612 if (aa->FirstUnicastAddress)
1614
1615 /* Connected to internet */
1616 if (aa->FirstGatewayAddress)
1617 {
1618 WARN("always returning LAN connection.\n");
1619 status &= ~INTERNET_CONNECTION_OFFLINE;
1621 break;
1622 }
1623 }
1624 free(buf);
1625
1626 if (lpdwStatus) *lpdwStatus = status;
1627
1628 /* When the buffer size is zero LoadStringW fills the buffer with a pointer to
1629 * the resource, avoid it as we must not change the buffer in this case */
1630 if (lpszConnectionName && dwNameLen)
1631 {
1632 *lpszConnectionName = '\0';
1634 LoadStringW(WININET_hModule, IDS_LANCONNECTION, lpszConnectionName, dwNameLen);
1635 }
1636
1638 {
1640 return FALSE;
1641 }
1642 return TRUE;
1643}
1644
1645
1646/***********************************************************************
1647 * InternetGetConnectedStateExA (WININET.@)
1648 */
1650 DWORD dwNameLen, DWORD dwReserved)
1651{
1652 LPWSTR lpwszConnectionName = NULL;
1653 BOOL rc;
1654
1655 TRACE("(%p, %p, %ld, 0x%08lx)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved);
1656
1657 if (lpszConnectionName && dwNameLen > 0)
1658 lpwszConnectionName = malloc(dwNameLen * sizeof(WCHAR));
1659
1660 rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen,
1661 dwReserved);
1662 if (rc && lpwszConnectionName)
1663 {
1664 WideCharToMultiByte(CP_ACP,0,lpwszConnectionName,-1,lpszConnectionName,
1665 dwNameLen, NULL, NULL);
1666 /* Yes, blindly truncate double-byte characters */
1667 lpszConnectionName[dwNameLen - 1] = '\0';
1668 }
1669
1670 free(lpwszConnectionName);
1671 return rc;
1672}
1673
1674
1675/***********************************************************************
1676 * InternetConnectW (WININET.@)
1677 *
1678 * Open a ftp, gopher or http session
1679 *
1680 * RETURNS
1681 * HINTERNET a session handle on success
1682 * NULL on failure
1683 *
1684 */
1686 LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
1687 LPCWSTR lpszUserName, LPCWSTR lpszPassword,
1688 DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
1689{
1690 appinfo_t *hIC;
1691 HINTERNET rc = NULL;
1693
1694 TRACE("(%p, %s, %u, %s, %p, %lu, %lx, %Ix)\n", hInternet, debugstr_w(lpszServerName),
1695 nServerPort, debugstr_w(lpszUserName), lpszPassword, dwService, dwFlags, dwContext);
1696
1697 if (!lpszServerName)
1698 {
1700 return NULL;
1701 }
1702
1703 hIC = (appinfo_t*)get_handle_object( hInternet );
1704 if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
1705 {
1707 goto lend;
1708 }
1709
1710 switch (dwService)
1711 {
1713 rc = FTP_Connect(hIC, lpszServerName, nServerPort,
1714 lpszUserName, lpszPassword, dwFlags, dwContext, 0);
1715 if(!rc)
1717 break;
1718
1720 res = HTTP_Connect(hIC, lpszServerName, nServerPort,
1721 lpszUserName, lpszPassword, dwFlags, dwContext, 0, &rc);
1722 break;
1723
1725 default:
1726 break;
1727 }
1728lend:
1729 if( hIC )
1730 WININET_Release( &hIC->hdr );
1731
1732 TRACE("returning %p\n", rc);
1734 return rc;
1735}
1736
1737
1738/***********************************************************************
1739 * InternetConnectA (WININET.@)
1740 *
1741 * Open a ftp, gopher or http session
1742 *
1743 * RETURNS
1744 * HINTERNET a session handle on success
1745 * NULL on failure
1746 *
1747 */
1749 LPCSTR lpszServerName, INTERNET_PORT nServerPort,
1750 LPCSTR lpszUserName, LPCSTR lpszPassword,
1751 DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
1752{
1753 HINTERNET rc = NULL;
1754 LPWSTR szServerName;
1755 LPWSTR szUserName;
1756 LPWSTR szPassword;
1757
1758 szServerName = strdupAtoW(lpszServerName);
1759 szUserName = strdupAtoW(lpszUserName);
1760 szPassword = strdupAtoW(lpszPassword);
1761
1762 rc = InternetConnectW(hInternet, szServerName, nServerPort,
1763 szUserName, szPassword, dwService, dwFlags, dwContext);
1764
1765 free(szServerName);
1766 free(szUserName);
1767 free(szPassword);
1768 return rc;
1769}
1770
1771
1772/***********************************************************************
1773 * InternetFindNextFileA (WININET.@)
1774 *
1775 * Continues a file search from a previous call to FindFirstFile
1776 *
1777 * RETURNS
1778 * TRUE on success
1779 * FALSE on failure
1780 *
1781 */
1783{
1784 BOOL ret;
1786
1787 ret = InternetFindNextFileW(hFind, lpvFindData?&fd:NULL);
1788 if(lpvFindData)
1790 return ret;
1791}
1792
1793/***********************************************************************
1794 * InternetFindNextFileW (WININET.@)
1795 *
1796 * Continues a file search from a previous call to FindFirstFile
1797 *
1798 * RETURNS
1799 * TRUE on success
1800 * FALSE on failure
1801 *
1802 */
1804{
1806 DWORD res;
1807
1808 TRACE("\n");
1809
1810 hdr = get_handle_object(hFind);
1811 if(!hdr) {
1812 WARN("Invalid handle\n");
1814 return FALSE;
1815 }
1816
1817 if(hdr->vtbl->FindNextFileW) {
1818 res = hdr->vtbl->FindNextFileW(hdr, lpvFindData);
1819 }else {
1820 WARN("Handle doesn't support NextFile\n");
1822 }
1823
1825
1826 if(res != ERROR_SUCCESS)
1828 return res == ERROR_SUCCESS;
1829}
1830
1831/***********************************************************************
1832 * InternetCloseHandle (WININET.@)
1833 *
1834 * Generic close handle function
1835 *
1836 * RETURNS
1837 * TRUE on success
1838 * FALSE on failure
1839 *
1840 */
1842{
1844
1845 TRACE("%p\n", hInternet);
1846
1847 obj = get_handle_object( hInternet );
1848 if (!obj) {
1850 return FALSE;
1851 }
1852
1855
1856 return TRUE;
1857}
1858
1859static BOOL set_url_component(WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len)
1860{
1861 TRACE("%s (%ld)\n", debugstr_wn(value, len), len);
1862
1863 if (!*component_length)
1864 return TRUE;
1865
1866 if (!*component) {
1867 *(const WCHAR**)component = value;
1868 *component_length = len;
1869 return TRUE;
1870 }
1871
1872 if (*component_length < len+1) {
1874 return FALSE;
1875 }
1876
1877 *component_length = len;
1878 if(len)
1879 memcpy(*component, value, len*sizeof(WCHAR));
1880 (*component)[len] = 0;
1881 return TRUE;
1882}
1883
1884static BOOL set_url_component_WtoA(const WCHAR *comp_w, DWORD length, const WCHAR *url_w, char **comp, DWORD *ret_length,
1885 const char *url_a)
1886{
1887 size_t size, ret_size = *ret_length;
1888
1889 if (!*ret_length)
1890 return TRUE;
1891 size = WideCharToMultiByte(CP_ACP, 0, comp_w, length, NULL, 0, NULL, NULL);
1892
1893 if (!*comp) {
1894 *comp = comp_w ? (char*)url_a + WideCharToMultiByte(CP_ACP, 0, url_w, comp_w-url_w, NULL, 0, NULL, NULL) : NULL;
1895 *ret_length = size;
1896 return TRUE;
1897 }
1898
1899 if (size+1 > ret_size) {
1901 *ret_length = size+1;
1902 return FALSE;
1903 }
1904
1905 *ret_length = size;
1906 WideCharToMultiByte(CP_ACP, 0, comp_w, length, *comp, ret_size-1, NULL, NULL);
1907 (*comp)[size] = 0;
1908 return TRUE;
1909}
1910
1911static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
1912{
1913 *len_w = len_a;
1914
1915 if(!comp_a) {
1916 *comp_w = NULL;
1917 return TRUE;
1918 }
1919
1920 if(!(*comp_w = *buf = malloc(len_a * sizeof(WCHAR)))) {
1922 return FALSE;
1923 }
1924
1925 return TRUE;
1926}
1927
1928/***********************************************************************
1929 * InternetCrackUrlA (WININET.@)
1930 *
1931 * See InternetCrackUrlW.
1932 */
1933BOOL WINAPI InternetCrackUrlA(const char *url, DWORD url_length, DWORD flags, URL_COMPONENTSA *ret_comp)
1934{
1935 WCHAR *host = NULL, *user = NULL, *pass = NULL, *path = NULL, *scheme = NULL, *extra = NULL;
1936 URL_COMPONENTSW comp;
1937 WCHAR *url_w = NULL;
1938 BOOL ret;
1939
1940 TRACE("(%s %lu %lx %p)\n", url_length ? debugstr_an(url, url_length) : debugstr_a(url), url_length, flags, ret_comp);
1941
1942 if (!url || !*url || !ret_comp || ret_comp->dwStructSize != sizeof(URL_COMPONENTSA)) {
1944 return FALSE;
1945 }
1946
1947 comp.dwStructSize = sizeof(comp);
1948
1950 &comp.lpszHostName, &comp.dwHostNameLength, &host)
1952 &comp.lpszUserName, &comp.dwUserNameLength, &user)
1954 &comp.lpszPassword, &comp.dwPasswordLength, &pass)
1955 && set_url_component_AtoW(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength,
1956 &comp.lpszUrlPath, &comp.dwUrlPathLength, &path)
1957 && set_url_component_AtoW(ret_comp->lpszScheme, ret_comp->dwSchemeLength,
1958 &comp.lpszScheme, &comp.dwSchemeLength, &scheme)
1960 &comp.lpszExtraInfo, &comp.dwExtraInfoLength, &extra);
1961
1962 if(ret && !(url_w = strndupAtoW(url, url_length ? url_length : -1, &url_length))) {
1964 ret = FALSE;
1965 }
1966
1967 if (ret && (ret = InternetCrackUrlW(url_w, url_length, flags, &comp))) {
1968 ret_comp->nScheme = comp.nScheme;
1969 ret_comp->nPort = comp.nPort;
1970
1972 &ret_comp->lpszHostName, &ret_comp->dwHostNameLength, url)
1974 &ret_comp->lpszUserName, &ret_comp->dwUserNameLength, url)
1976 &ret_comp->lpszPassword, &ret_comp->dwPasswordLength, url)
1978 &ret_comp->lpszUrlPath, &ret_comp->dwUrlPathLength, url)
1980 &ret_comp->lpszScheme, &ret_comp->dwSchemeLength, url)
1982 &ret_comp->lpszExtraInfo, &ret_comp->dwExtraInfoLength, url);
1983
1984 if(ret)
1985 TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(url),
1986 debugstr_an(ret_comp->lpszScheme, ret_comp->dwSchemeLength),
1987 debugstr_an(ret_comp->lpszHostName, ret_comp->dwHostNameLength),
1988 debugstr_an(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength),
1989 debugstr_an(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength));
1990 }
1991
1992 free(host);
1993 free(user);
1994 free(pass);
1995 free(path);
1996 free(scheme);
1997 free(extra);
1998 free(url_w);
1999 return ret;
2000}
2001
2002static const WCHAR *url_schemes[] =
2003{
2004 L"ftp",
2005 L"gopher",
2006 L"http",
2007 L"https",
2008 L"file",
2009 L"news",
2010 L"mailto",
2011 L"socks",
2012 L"javascript",
2013 L"vbscript",
2014 L"res"
2015};
2016
2017/***********************************************************************
2018 * GetInternetSchemeW (internal)
2019 *
2020 * Get scheme of url
2021 *
2022 * RETURNS
2023 * scheme on success
2024 * INTERNET_SCHEME_UNKNOWN on failure
2025 *
2026 */
2028{
2029 int i;
2030
2031 TRACE("%s %ld\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
2032
2033 if(lpszScheme==NULL)
2035
2036 for (i = 0; i < ARRAY_SIZE(url_schemes); i++)
2037 if (!wcsnicmp(lpszScheme, url_schemes[i], nMaxCmp))
2038 return INTERNET_SCHEME_FIRST + i;
2039
2041}
2042
2043/***********************************************************************
2044 * InternetCrackUrlW (WININET.@)
2045 *
2046 * Break up URL into its components
2047 *
2048 * RETURNS
2049 * TRUE on success
2050 * FALSE on failure
2051 */
2053{
2054 /*
2055 * RFC 1808
2056 * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
2057 *
2058 */
2059 LPCWSTR lpszParam = NULL;
2060 BOOL found_colon = FALSE;
2061 LPCWSTR lpszap;
2062 LPCWSTR lpszcp = NULL, lpszNetLoc;
2063
2064 TRACE("(%s %lu %lx %p)\n",
2065 lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : lstrlenW(lpszUrl)) : "(null)",
2066 dwUrlLength, dwFlags, lpUC);
2067
2068 if (!lpszUrl || !*lpszUrl || !lpUC)
2069 {
2071 return FALSE;
2072 }
2073
2074 if (!dwUrlLength)
2075 dwUrlLength = lstrlenW(lpszUrl);
2076 else {
2077 /* Windows stops at a null, regardless of what dwUrlLength says. */
2078 dwUrlLength = wcsnlen(lpszUrl, dwUrlLength);
2079 }
2080
2081 if (dwFlags & ICU_DECODE)
2082 {
2083 WCHAR *url_tmp, *buffer;
2084 DWORD len = dwUrlLength + 1;
2085 BOOL ret;
2086
2087 if (!(url_tmp = strndupW(lpszUrl, dwUrlLength)))
2088 {
2090 return FALSE;
2091 }
2092
2093 buffer = url_tmp;
2096 {
2097 buffer = malloc(len * sizeof(WCHAR));
2098 if (!buffer)
2099 {
2101 free(url_tmp);
2102 return FALSE;
2103 }
2105 }
2106 if (ret)
2108
2109 if (buffer != url_tmp) free(buffer);
2110 free(url_tmp);
2111 return ret;
2112 }
2113 lpszap = lpszUrl;
2114
2115 /* Determine if the URI is absolute. */
2116 while (lpszap - lpszUrl < dwUrlLength)
2117 {
2118 if (iswalnum(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-')
2119 {
2120 lpszap++;
2121 continue;
2122 }
2123 if (*lpszap == ':')
2124 {
2125 found_colon = TRUE;
2126 lpszcp = lpszap;
2127 }
2128 else
2129 {
2130 lpszcp = lpszUrl; /* Relative url */
2131 }
2132
2133 break;
2134 }
2135
2136 if(!found_colon){
2138 return FALSE;
2139 }
2140
2143
2144 /* Parse <params> */
2145 lpszParam = wmemchr(lpszap, '?', dwUrlLength - (lpszap - lpszUrl));
2146 if(!lpszParam)
2147 lpszParam = wmemchr(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
2148
2150 lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0))
2151 return FALSE;
2152
2153
2154 /* Get scheme first. */
2155 lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
2156 if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl))
2157 return FALSE;
2158
2159 /* Eat ':' in protocol. */
2160 lpszcp++;
2161
2162 /* double slash indicates the net_loc portion is present */
2163 if ((lpszcp[0] == '/') && (lpszcp[1] == '/'))
2164 {
2165 lpszcp += 2;
2166
2167 lpszNetLoc = wmemchr(lpszcp, '/', dwUrlLength - (lpszcp - lpszUrl));
2168 if (lpszParam)
2169 {
2170 if (lpszNetLoc)
2171 lpszNetLoc = min(lpszNetLoc, lpszParam);
2172 else
2173 lpszNetLoc = lpszParam;
2174 }
2175 else if (!lpszNetLoc)
2176 lpszNetLoc = lpszcp + dwUrlLength-(lpszcp-lpszUrl);
2177
2178 /* Parse net-loc */
2179 if (lpszNetLoc)
2180 {
2181 LPCWSTR lpszHost;
2182 LPCWSTR lpszPort;
2183
2184 /* [<user>[<:password>]@]<host>[:<port>] */
2185 /* First find the user and password if they exist */
2186
2187 lpszHost = wmemchr(lpszcp, '@', dwUrlLength - (lpszcp - lpszUrl));
2188 if (lpszHost == NULL || lpszHost > lpszNetLoc)
2189 {
2190 /* username and password not specified. */
2193 }
2194 else /* Parse out username and password */
2195 {
2196 LPCWSTR lpszUser = lpszcp;
2197 LPCWSTR lpszPasswd = lpszHost;
2198
2199 while (lpszcp < lpszHost)
2200 {
2201 if (*lpszcp == ':')
2202 lpszPasswd = lpszcp;
2203
2204 lpszcp++;
2205 }
2206
2207 if(!set_url_component(&lpUC->lpszUserName, &lpUC->dwUserNameLength, lpszUser, lpszPasswd - lpszUser))
2208 return FALSE;
2209
2210 if (lpszPasswd != lpszHost)
2211 lpszPasswd++;
2213 lpszPasswd == lpszHost ? NULL : lpszPasswd, lpszHost - lpszPasswd))
2214 return FALSE;
2215
2216 lpszcp++; /* Advance to beginning of host */
2217 }
2218
2219 /* Parse <host><:port> */
2220
2221 lpszHost = lpszcp;
2222 lpszPort = lpszNetLoc;
2223
2224 /* special case for res:// URLs: there is no port here, so the host is the
2225 entire string up to the first '/' */
2226 if(lpUC->nScheme==INTERNET_SCHEME_RES)
2227 {
2228 if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
2229 return FALSE;
2230 lpszcp=lpszNetLoc;
2231 }
2232 else
2233 {
2234 while (lpszcp < lpszNetLoc)
2235 {
2236 if (*lpszcp == ':')
2237 lpszPort = lpszcp;
2238
2239 lpszcp++;
2240 }
2241
2242 /* If the scheme is "file" and the host is just one letter, it's not a host */
2243 if(lpUC->nScheme==INTERNET_SCHEME_FILE && lpszPort <= lpszHost+1)
2244 {
2245 lpszcp=lpszHost;
2247 }
2248 else
2249 {
2250 if(!set_url_component(&lpUC->lpszHostName, &lpUC->dwHostNameLength, lpszHost, lpszPort - lpszHost))
2251 return FALSE;
2252 if (lpszPort != lpszNetLoc)
2253 lpUC->nPort = wcstol(++lpszPort, NULL, 10);
2254 else switch (lpUC->nScheme)
2255 {
2258 break;
2261 break;
2264 break;
2265 default:
2266 break;
2267 }
2268 }
2269 }
2270 }
2271 }
2272 else
2273 {
2277 }
2278
2279 /* Here lpszcp points to:
2280 *
2281 * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
2282 * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2283 */
2284 if (lpszcp != 0 && lpszcp - lpszUrl < dwUrlLength && (!lpszParam || lpszcp <= lpszParam))
2285 {
2286 DWORD len;
2287
2288 /* Only truncate the parameter list if it's already been saved
2289 * in lpUC->lpszExtraInfo.
2290 */
2291 if (lpszParam && lpUC->dwExtraInfoLength && lpUC->lpszExtraInfo)
2292 len = lpszParam - lpszcp;
2293 else
2294 {
2295 /* Leave the parameter list in lpszUrlPath. Strip off any trailing
2296 * newlines if necessary.
2297 */
2298 LPWSTR lpsznewline = wmemchr(lpszcp, '\n', dwUrlLength - (lpszcp - lpszUrl));
2299 if (lpsznewline != NULL)
2300 len = lpsznewline - lpszcp;
2301 else
2302 len = dwUrlLength-(lpszcp-lpszUrl);
2303 }
2304 if (lpUC->dwUrlPathLength && lpUC->lpszUrlPath &&
2306 {
2307 WCHAR tmppath[MAX_PATH];
2308 if (*lpszcp == '/')
2309 {
2310 len = MAX_PATH;
2311 PathCreateFromUrlW(lpszUrl, tmppath, &len, 0);
2312 }
2313 else
2314 {
2315 WCHAR *iter;
2316 memcpy(tmppath, lpszcp, len * sizeof(WCHAR));
2317 tmppath[len] = '\0';
2318
2319 iter = tmppath;
2320 while (*iter) {
2321 if (*iter == '/')
2322 *iter = '\\';
2323 ++iter;
2324 }
2325 }
2326 /* if ends in \. or \.. append a backslash */
2327 if (tmppath[len - 1] == '.' &&
2328 (tmppath[len - 2] == '\\' ||
2329 (tmppath[len - 2] == '.' && tmppath[len - 3] == '\\')))
2330 {
2331 if (len < MAX_PATH - 1)
2332 {
2333 tmppath[len] = '\\';
2334 tmppath[len+1] = '\0';
2335 ++len;
2336 }
2337 }
2338 if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, tmppath, len))
2339 return FALSE;
2340 }
2341 else if(!set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, len))
2342 return FALSE;
2343 }
2344 else
2345 {
2346 set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, 0);
2347 }
2348
2349 TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
2354
2355 return TRUE;
2356}
2357
2358/***********************************************************************
2359 * InternetAttemptConnect (WININET.@)
2360 *
2361 * Attempt to make a connection to the internet
2362 *
2363 * RETURNS
2364 * ERROR_SUCCESS on success
2365 * Error value on failure
2366 *
2367 */
2369{
2370 FIXME("Stub\n");
2371 return ERROR_SUCCESS;
2372}
2373
2374
2375/***********************************************************************
2376 * convert_url_canonicalization_flags
2377 *
2378 * Helper for InternetCanonicalizeUrl
2379 *
2380 * PARAMS
2381 * dwFlags [I] Flags suitable for InternetCanonicalizeUrl
2382 *
2383 * RETURNS
2384 * Flags suitable for UrlCanonicalize
2385 */
2387{
2389
2390 if (dwFlags & ICU_BROWSER_MODE) dwUrlFlags |= URL_BROWSER_MODE;
2391 if (dwFlags & ICU_DECODE) dwUrlFlags |= URL_UNESCAPE;
2392 if (dwFlags & ICU_ENCODE_PERCENT) dwUrlFlags |= URL_ESCAPE_PERCENT;
2394 /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
2395 if (dwFlags & ICU_NO_ENCODE) dwUrlFlags ^= URL_ESCAPE_UNSAFE;
2396 if (dwFlags & ICU_NO_META) dwUrlFlags |= URL_NO_META;
2397
2398 return dwUrlFlags;
2399}
2400
2401/***********************************************************************
2402 * InternetCanonicalizeUrlA (WININET.@)
2403 *
2404 * Escape unsafe characters and spaces
2405 *
2406 * RETURNS
2407 * TRUE on success
2408 * FALSE on failure
2409 *
2410 */
2413{
2414 HRESULT hr;
2415
2416 TRACE("(%s, %p, %p, 0x%08lx) buffer length: %ld\n", debugstr_a(lpszUrl), lpszBuffer,
2418
2420 hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2423
2424 return hr == S_OK;
2425}
2426
2427/***********************************************************************
2428 * InternetCanonicalizeUrlW (WININET.@)
2429 *
2430 * Escape unsafe characters and spaces
2431 *
2432 * RETURNS
2433 * TRUE on success
2434 * FALSE on failure
2435 *
2436 */
2439{
2440 HRESULT hr;
2441
2442 TRACE("(%s, %p, %p, 0x%08lx) buffer length: %ld\n", debugstr_w(lpszUrl), lpszBuffer,
2444
2446 hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2449
2450 return hr == S_OK;
2451}
2452
2453/* #################################################### */
2454
2457{
2459
2460 if (unicode) lpwh->dwInternalFlags |= INET_CALLBACKW;
2461 else lpwh->dwInternalFlags &= ~INET_CALLBACKW;
2462
2463 ret = lpwh->lpfnStatusCB;
2464 lpwh->lpfnStatusCB = callback;
2465
2466 return ret;
2467}
2468
2469/***********************************************************************
2470 * InternetSetStatusCallbackA (WININET.@)
2471 *
2472 * Sets up a callback function which is called as progress is made
2473 * during an operation.
2474 *
2475 * RETURNS
2476 * Previous callback or NULL on success
2477 * INTERNET_INVALID_STATUS_CALLBACK on failure
2478 *
2479 */
2481 HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
2482{
2484 object_header_t *lpwh;
2485
2486 TRACE("%p\n", hInternet);
2487
2488 if (!(lpwh = get_handle_object(hInternet)))
2490
2491 retVal = set_status_callback(lpwh, lpfnIntCB, FALSE);
2492
2493 WININET_Release( lpwh );
2494 return retVal;
2495}
2496
2497/***********************************************************************
2498 * InternetSetStatusCallbackW (WININET.@)
2499 *
2500 * Sets up a callback function which is called as progress is made
2501 * during an operation.
2502 *
2503 * RETURNS
2504 * Previous callback or NULL on success
2505 * INTERNET_INVALID_STATUS_CALLBACK on failure
2506 *
2507 */
2509 HINTERNET hInternet ,INTERNET_STATUS_CALLBACK lpfnIntCB)
2510{
2512 object_header_t *lpwh;
2513
2514 TRACE("%p\n", hInternet);
2515
2516 if (!(lpwh = get_handle_object(hInternet)))
2518
2519 retVal = set_status_callback(lpwh, lpfnIntCB, TRUE);
2520
2521 WININET_Release( lpwh );
2522 return retVal;
2523}
2524
2525/***********************************************************************
2526 * InternetSetFilePointer (WININET.@)
2527 *
2528 * Sets read position for an open internet file.
2529 *
2530 * RETURNS
2531 * Current position of the file on success
2532 * INVALID_SET_FILE_POINTER on failure
2533 */
2535 PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
2536{
2538 DWORD res;
2539
2540 TRACE("(%p %ld %p %ld %Ix)\n", hFile, lDistanceToMove, pReserved, dwMoveContext, dwContext);
2541
2543 if(!hdr) {
2546 }
2547
2548 if(hdr->vtbl->SetFilePointer) {
2549 res = hdr->vtbl->SetFilePointer(hdr, lDistanceToMove, dwMoveContext);
2550 }else {
2553 }
2554
2556 return res;
2557}
2558
2559/***********************************************************************
2560 * InternetWriteFile (WININET.@)
2561 *
2562 * Write data to an open internet file
2563 *
2564 * RETURNS
2565 * TRUE on success
2566 * FALSE on failure
2567 *
2568 */
2570 DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
2571{
2572 object_header_t *lpwh;
2573 BOOL res;
2574
2575 TRACE("(%p %p %ld %p)\n", hFile, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
2576
2577 lpwh = get_handle_object( hFile );
2578 if (!lpwh) {
2579 WARN("Invalid handle\n");
2581 return FALSE;
2582 }
2583
2584 if(lpwh->vtbl->WriteFile) {
2585 res = lpwh->vtbl->WriteFile(lpwh, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten);
2586 }else {
2587 WARN("No Writefile method.\n");
2589 }
2590
2591 WININET_Release( lpwh );
2592
2593 if(res != ERROR_SUCCESS)
2595 return res == ERROR_SUCCESS;
2596}
2597
2598
2599/***********************************************************************
2600 * InternetReadFile (WININET.@)
2601 *
2602 * Read data from an open internet file
2603 *
2604 * RETURNS
2605 * TRUE on success
2606 * FALSE on failure
2607 *
2608 */
2610 DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
2611{
2614
2615 TRACE("%p %p %ld %p\n", hFile, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead);
2616
2617 if (!lpBuffer || !pdwNumOfBytesRead)
2618 {
2620 if (pdwNumOfBytesRead) *pdwNumOfBytesRead = 0;
2621 return FALSE;
2622 }
2623
2625 if (!hdr) {
2627 return FALSE;
2628 }
2629
2630 if(hdr->vtbl->ReadFile) {
2631 res = hdr->vtbl->ReadFile(hdr, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead, 0, 0);
2632 if(res == ERROR_IO_PENDING)
2633 *pdwNumOfBytesRead = 0;
2634 }
2635
2637
2638 TRACE("-- %s (%lu) (bytes read: %ld)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE", res,
2639 pdwNumOfBytesRead ? *pdwNumOfBytesRead : -1);
2640
2642 return res == ERROR_SUCCESS;
2643}
2644
2645/***********************************************************************
2646 * InternetReadFileExA (WININET.@)
2647 *
2648 * Read data from an open internet file
2649 *
2650 * PARAMS
2651 * hFile [I] Handle returned by InternetOpenUrl or HttpOpenRequest.
2652 * lpBuffersOut [I/O] Buffer.
2653 * dwFlags [I] Flags. See notes.
2654 * dwContext [I] Context for callbacks.
2655 *
2656 * RETURNS
2657 * TRUE on success
2658 * FALSE on failure
2659 *
2660 * NOTES
2661 * The parameter dwFlags include zero or more of the following flags:
2662 *|IRF_ASYNC - Makes the call asynchronous.
2663 *|IRF_SYNC - Makes the call synchronous.
2664 *|IRF_USE_CONTEXT - Forces dwContext to be used.
2665 *|IRF_NO_WAIT - Don't block if the data is not available, just return what is available.
2666 *
2667 * However, in testing IRF_USE_CONTEXT seems to have no effect - dwContext isn't used.
2668 *
2669 * SEE
2670 * InternetOpenUrlA(), HttpOpenRequestA()
2671 */
2673 DWORD dwFlags, DWORD_PTR dwContext)
2674{
2677
2678 TRACE("(%p %p 0x%lx 0x%Ix)\n", hFile, lpBuffersOut, dwFlags, dwContext);
2679
2680 if (lpBuffersOut->dwStructSize != sizeof(*lpBuffersOut)) {
2682 return FALSE;
2683 }
2684
2686 if (!hdr) {
2688 return FALSE;
2689 }
2690
2691 if(hdr->vtbl->ReadFile)
2692 res = hdr->vtbl->ReadFile(hdr, lpBuffersOut->lpvBuffer, lpBuffersOut->dwBufferLength,
2693 &lpBuffersOut->dwBufferLength, dwFlags, dwContext);
2694
2696
2697 TRACE("-- %s (%lu, bytes read: %ld)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE",
2698 res, lpBuffersOut->dwBufferLength);
2699
2700 if(res != ERROR_SUCCESS)
2702 return res == ERROR_SUCCESS;
2703}
2704
2705/***********************************************************************
2706 * InternetReadFileExW (WININET.@)
2707 * SEE
2708 * InternetReadFileExA()
2709 */
2711 DWORD dwFlags, DWORD_PTR dwContext)
2712{
2715
2716 TRACE("(%p %p 0x%lx 0x%Ix)\n", hFile, lpBuffer, dwFlags, dwContext);
2717
2718 if (!lpBuffer || lpBuffer->dwStructSize != sizeof(*lpBuffer)) {
2720 return FALSE;
2721 }
2722
2724 if (!hdr) {
2726 return FALSE;
2727 }
2728
2729 if(hdr->vtbl->ReadFile)
2730 res = hdr->vtbl->ReadFile(hdr, lpBuffer->lpvBuffer, lpBuffer->dwBufferLength, &lpBuffer->dwBufferLength,
2731 dwFlags, dwContext);
2732
2734
2735 TRACE("-- %s (%lu, bytes read: %ld)\n", res == ERROR_SUCCESS ? "TRUE": "FALSE",
2736 res, lpBuffer->dwBufferLength);
2737
2738 if(res != ERROR_SUCCESS)
2740 return res == ERROR_SUCCESS;
2741}
2742
2743static IP_ADAPTER_ADDRESSES *get_adapters(void)
2744{
2745 ULONG err, size = 1024, flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
2746 GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME;
2747 IP_ADAPTER_ADDRESSES *tmp, *ret;
2748
2749 if (!(ret = malloc( size ))) return NULL;
2750 err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2751 while (err == ERROR_BUFFER_OVERFLOW)
2752 {
2753 if (!(tmp = realloc( ret, size ))) break;
2754 ret = tmp;
2755 err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2756 }
2757 if (err == ERROR_SUCCESS) return ret;
2758 free( ret );
2759 return NULL;
2760}
2761
2763{
2764 IP_ADAPTER_ADDRESSES *adapters, *ptr;
2765 DHCPCAPI_PARAMS_ARRAY send_params, recv_params;
2768 DWORD err, size;
2769 BYTE *tmp, *buf = NULL;
2770
2771 if (!(adapters = get_adapters())) return NULL;
2772
2773 memset( &send_params, 0, sizeof(send_params) );
2774 memset( &param, 0, sizeof(param) );
2775 param.OptionId = OPTION_MSFT_IE_PROXY;
2776 recv_params.nParams = 1;
2777 recv_params.Params = &param;
2778
2779 for (ptr = adapters; ptr; ptr = ptr->Next)
2780 {
2781 MultiByteToWideChar( CP_ACP, 0, ptr->AdapterName, -1, name, ARRAY_SIZE(name) );
2782 TRACE( "adapter '%s' type %lu dhcpv4 enabled %d\n", wine_dbgstr_w(name), ptr->IfType, ptr->Dhcpv4Enabled );
2783
2784 if (ptr->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2785 /* FIXME: also skip adapters where DHCP is disabled */
2786
2787 size = 256;
2788 if (!(buf = malloc( size ))) goto done;
2789 err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
2790 buf, &size, NULL );
2791 while (err == ERROR_MORE_DATA)
2792 {
2793 if (!(tmp = realloc( buf, size ))) goto done;
2794 buf = tmp;
2795 err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
2796 buf, &size, NULL );
2797 }
2798 if (err == ERROR_SUCCESS && param.nBytesData)
2799 {
2800 int len = MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, NULL, 0 );
2801 if ((ret = malloc( (len + 1) * sizeof(WCHAR) )))
2802 {
2803 MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, ret, len );
2804 ret[len] = 0;
2805 }
2806 TRACE("returning %s\n", debugstr_w(ret));
2807 break;
2808 }
2809 free( buf );
2810 buf = NULL;
2811 }
2812
2813done:
2814 free( buf );
2815 free( adapters );
2816 return ret;
2817}
2818
2819static char *get_computer_name( COMPUTER_NAME_FORMAT format )
2820{
2821 char *ret;
2822 DWORD size = 0;
2823
2825 if (GetLastError() != ERROR_MORE_DATA) return NULL;
2826 if (!(ret = malloc( size ))) return NULL;
2827 if (!GetComputerNameExA( format, ret, &size ))
2828 {
2829 free( ret );
2830 return NULL;
2831 }
2832 return ret;
2833}
2834
2835static BOOL is_domain_suffix( const char *domain, const char *suffix )
2836{
2837 int len_domain = strlen( domain ), len_suffix = strlen( suffix );
2838
2839 if (len_suffix > len_domain) return FALSE;
2840 if (!stricmp( domain + len_domain - len_suffix, suffix )) return TRUE;
2841 return FALSE;
2842}
2843
2844static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
2845{
2846 return getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
2847}
2848
2849static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
2850{
2851 char name[NI_MAXHOST];
2852 WCHAR *ret, *p;
2853 int len;
2854
2855 while (ai && ai->ai_family != AF_INET && ai->ai_family != AF_INET6) ai = ai->ai_next;
2856 if (!ai) return NULL;
2857
2858 if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
2859
2860 len = lstrlenW( L"http://" ) + strlen( hostname ) + lstrlenW( L"/wpad.dat" );
2861 if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
2862 lstrcpyW( p, L"http://" );
2863 p += lstrlenW( L"http://" );
2864 while (*hostname) { *p++ = *hostname++; }
2865 lstrcpyW( p, L"/wpad.dat" );
2866 return ret;
2867}
2868
2870{
2871 char *fqdn, *domain, *p;
2872 WCHAR *ret;
2873
2874 if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return NULL;
2875 if (!(domain = get_computer_name( ComputerNamePhysicalDnsDomain )))
2876 {
2877 free( fqdn );
2878 return NULL;
2879 }
2880 p = fqdn;
2881 while ((p = strchr( p, '.' )) && is_domain_suffix( p + 1, domain ))
2882 {
2883 char *name;
2884 struct addrinfo *ai, hints;
2885 int res;
2886
2887 if (!(name = malloc( sizeof("wpad") + strlen(p) )))
2888 {
2889 free( fqdn );
2890 free( domain );
2891 return NULL;
2892 }
2893 strcpy( name, "wpad" );
2894 strcat( name, p );
2895 memset( &hints, 0, sizeof(hints) );
2896 hints.ai_flags = AI_ALL | AI_DNS_ONLY;
2897 hints.ai_family = AF_UNSPEC;
2898 res = getaddrinfo( name, NULL, &hints, &ai );
2899 if (!res)
2900 {
2901 ret = build_wpad_url( name, ai );
2902 freeaddrinfo( ai );
2903 if (ret)
2904 {
2905 TRACE("returning %s\n", debugstr_w(ret));
2906 free( name );
2907 break;
2908 }
2909 }
2910 free( name );
2911 p++;
2912 }
2913 free( domain );
2914 free( fqdn );
2915 return ret;
2916}
2917
2919{
2922 return ret;
2923}
2924
2926{
2927 /* FIXME: This function currently handles more options than it should. Options requiring
2928 * proper handles should be moved to proper functions */
2929 switch(option) {
2931 if (*size < sizeof(HTTP_VERSION_INFO))
2933
2934 /*
2935 * Presently hardcoded to 1.1
2936 */
2937 ((HTTP_VERSION_INFO*)buffer)->dwMajorVersion = 1;
2938 ((HTTP_VERSION_INFO*)buffer)->dwMinorVersion = 1;
2939 *size = sizeof(HTTP_VERSION_INFO);
2940
2941 return ERROR_SUCCESS;
2942
2944 FIXME("INTERNET_OPTION_CONNECTED_STATE: semi-stub\n");
2945
2946 if (*size < sizeof(ULONG))
2948
2950 *size = sizeof(ULONG);
2951
2952 return ERROR_SUCCESS;
2953
2954 case INTERNET_OPTION_PROXY: {
2955 appinfo_t ai;
2956 BOOL ret;
2957
2958 TRACE("Getting global proxy info\n");
2959 memset(&ai, 0, sizeof(appinfo_t));
2961
2962 ret = APPINFO_QueryOption(&ai.hdr, INTERNET_OPTION_PROXY, buffer, size, unicode); /* FIXME */
2963 APPINFO_Destroy(&ai.hdr);
2964 return ret;
2965 }
2966
2968 TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
2969
2970 if (*size < sizeof(ULONG))
2972
2973 *(ULONG*)buffer = max_conns;
2974 *size = sizeof(ULONG);
2975
2976 return ERROR_SUCCESS;
2977
2979 TRACE("INTERNET_OPTION_MAX_CONNS_1_0_SERVER\n");
2980
2981 if (*size < sizeof(ULONG))
2983
2985 *size = sizeof(ULONG);
2986
2987 return ERROR_SUCCESS;
2988
2990 FIXME("INTERNET_OPTION_SECURITY_FLAGS: Stub\n");
2991 return ERROR_SUCCESS;
2992
2994 static const INTERNET_VERSION_INFO info = { 1, 2 };
2995
2996 TRACE("INTERNET_OPTION_VERSION\n");
2997
2998 if (*size < sizeof(INTERNET_VERSION_INFO))
3000
3001 memcpy(buffer, &info, sizeof(info));
3002 *size = sizeof(info);
3003
3004 return ERROR_SUCCESS;
3005 }
3006
3008 WCHAR *url = NULL;
3013 LONG ret;
3014
3016 return ret;
3017
3018 TRACE("INTERNET_OPTION_PER_CONNECTION_OPTION\n");
3019
3020 if (*size < sizeof(INTERNET_PER_CONN_OPTION_LISTW)) {
3021 FreeProxyInfo(&pi);
3023 }
3024
3025 if (pi.flags & PROXY_TYPE_AUTO_DETECT)
3027
3028 for (i = 0; i < con->dwOptionCount; i++) {
3030 INTERNET_PER_CONN_OPTIONA *optionA = conA->pOptions + i;
3031
3032 switch (optionW->dwOption) {
3034 optionW->Value.dwValue = pi.flags;
3035 break;
3036
3038 if (unicode)
3039 optionW->Value.pszValue = copy_optionW(pi.proxy);
3040 else
3041 optionA->Value.pszValue = copy_optionA(pi.proxy);
3042 break;
3043
3045 if (unicode)
3046 optionW->Value.pszValue = copy_optionW(pi.proxyBypass);
3047 else
3048 optionA->Value.pszValue = copy_optionA(pi.proxyBypass);
3049 break;
3050
3052 if (unicode)
3053 optionW->Value.pszValue = copy_optionW(pi.autoconf_url);
3054 else
3055 optionA->Value.pszValue = copy_optionA(pi.autoconf_url);
3056 break;
3057
3059 optionW->Value.dwValue = AUTO_PROXY_FLAG_ALWAYS_DETECT;
3060 break;
3061
3063 if (unicode)
3064 optionW->Value.pszValue = copy_optionW(url);
3065 else
3066 optionA->Value.pszValue = copy_optionA(url);
3067 break;
3068
3072 FIXME("Unhandled dwOption %ld\n", optionW->dwOption);
3073 memset(&optionW->Value, 0, sizeof(optionW->Value));
3074 break;
3075
3076#ifdef __REACTOS__
3078 WARN("Unhandled dwOption %d\n", optionW->dwOption);
3079 break;
3080
3081#endif
3082 default:
3083 FIXME("Unknown dwOption %ld\n", optionW->dwOption);
3085 break;
3086 }
3087 }
3088 free(url);
3089 FreeProxyInfo(&pi);
3090
3091 return res;
3092 }
3095 *size = 0;
3100 TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
3101
3102 if (*size < sizeof(ULONG))
3104
3106 *size = sizeof(ULONG);
3107
3108 return ERROR_SUCCESS;
3109
3111 TRACE("INTERNET_OPTION_SEND_TIMEOUT\n");
3112
3113 if (*size < sizeof(ULONG))
3115
3117 *size = sizeof(ULONG);
3118
3119 return ERROR_SUCCESS;
3120
3122 TRACE("INTERNET_OPTION_RECEIVE_TIMEOUT\n");
3123
3124 if (*size < sizeof(ULONG))
3126
3128 *size = sizeof(ULONG);
3129
3130 return ERROR_SUCCESS;
3131
3133 TRACE("INTERNET_OPTION_DATA_SEND_TIMEOUT\n");
3134
3135 if (*size < sizeof(ULONG))
3137
3139 *size = sizeof(ULONG);
3140
3141 return ERROR_SUCCESS;
3142
3144 TRACE("INTERNET_OPTION_DATA_RECEIVE_TIMEOUT\n");
3145
3146 if (*size < sizeof(ULONG))
3148
3150 *size = sizeof(ULONG);
3151
3152 return ERROR_SUCCESS;
3153 }
3154
3155 FIXME("Stub for %ld\n", option);
3157}
3158
3160{
3161 switch(option) {
3163 if (!size)
3165
3166 if (*size < sizeof(DWORD_PTR)) {
3167 *size = sizeof(DWORD_PTR);
3169 }
3170 if (!buffer)
3172
3173 *(DWORD_PTR *)buffer = hdr->dwContext;
3174 *size = sizeof(DWORD_PTR);
3175 return ERROR_SUCCESS;
3176
3178 WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
3179 *size = sizeof(DWORD);
3181
3184 WARN("Called on global option %lu\n", option);
3186
3188 TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
3189
3190 if (*size < sizeof(ULONG))
3192
3193 *(ULONG*)buffer = hdr->connect_timeout;
3194 *size = sizeof(ULONG);
3195
3196 return ERROR_SUCCESS;
3197
3199 TRACE("INTERNET_OPTION_SEND_TIMEOUT\n");
3200
3201 if (*size < sizeof(ULONG))
3203
3204 *size = sizeof(ULONG);
3205 *(ULONG *)buffer = hdr->send_timeout;
3206 return ERROR_SUCCESS;
3207
3209 TRACE("INTERNET_OPTION_RECEIVE_TIMEOUT\n");
3210
3211 if (*size < sizeof(ULONG))
3213
3214 *size = sizeof(ULONG);
3215 *(ULONG *)buffer = hdr->receive_timeout;
3216 return ERROR_SUCCESS;
3217
3219 TRACE("INTERNET_OPTION_DATA_SEND_TIMEOUT\n");
3220
3221 if (*size < sizeof(ULONG))
3223
3224 *size = sizeof(ULONG);
3225 *(ULONG *)buffer = hdr->data_send_timeout;
3226 return ERROR_SUCCESS;
3227
3229 TRACE("INTERNET_OPTION_DATA_RECEIVE_TIMEOUT\n");
3230
3231 if (*size < sizeof(ULONG))
3233
3234 *size = sizeof(ULONG);
3235 *(ULONG *)buffer = hdr->data_receive_timeout;
3236 return ERROR_SUCCESS;
3237 }
3238
3239 /* FIXME: we shouldn't call it here */
3240 return query_global_option(option, buffer, size, unicode);
3241}
3242
3243/***********************************************************************
3244 * InternetQueryOptionW (WININET.@)
3245 *
3246 * Queries an options on the specified handle
3247 *
3248 * RETURNS
3249 * TRUE on success
3250 * FALSE on failure
3251 *
3252 */
3255{
3258
3259 TRACE("%p %ld %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
3260
3261 if(hInternet) {
3262 hdr = get_handle_object(hInternet);
3263 if (hdr) {
3264 res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, TRUE);
3266 }
3267 }else {
3269 }
3270
3271 if(res != ERROR_SUCCESS)
3273 return res == ERROR_SUCCESS;
3274}
3275
3276/***********************************************************************
3277 * InternetQueryOptionA (WININET.@)
3278 *
3279 * Queries an options on the specified handle
3280 *
3281 * RETURNS
3282 * TRUE on success
3283 * FALSE on failure
3284 *
3285 */
3288{
3291
3292 TRACE("%p %ld %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength);
3293
3294 if(hInternet) {
3295 hdr = get_handle_object(hInternet);
3296 if (hdr) {
3297 res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, FALSE);
3299 }
3300 }else {
3302 }
3303
3304 if(res != ERROR_SUCCESS)
3306 return res == ERROR_SUCCESS;
3307}
3308
3310{
3311 switch(option) {
3313 FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
3315 return ERROR_SUCCESS;
3317 WARN("Not settable option %lu\n", option);
3321 WARN("Called on global option %lu\n", option);
3326 if (!buf || size != sizeof(ULONG)) return ERROR_INVALID_PARAMETER;
3327 hdr->connect_timeout = *(ULONG *)buf;
3328 return ERROR_SUCCESS;
3330 if (!buf || size != sizeof(ULONG)) return ERROR_INVALID_PARAMETER;
3331 hdr->send_timeout = *(ULONG *)buf;
3332 return ERROR_SUCCESS;
3334 if (!buf || size != sizeof(ULONG)) return ERROR_INVALID_PARAMETER;
3335 hdr->receive_timeout = *(ULONG *)buf;
3336 return ERROR_SUCCESS;
3338 if (!buf || size != sizeof(ULONG)) return ERROR_INVALID_PARAMETER;
3339 hdr->data_send_timeout = *(ULONG *)buf;
3340 return ERROR_SUCCESS;
3342 if (!buf || size != sizeof(ULONG)) return ERROR_INVALID_PARAMETER;
3343 hdr->data_receive_timeout = *(ULONG *)buf;
3344 return ERROR_SUCCESS;
3345 }
3346
3348}
3349
3351{
3352 switch(option) {
3354 WARN("Not global option %lu\n", option);
3356
3358 TRACE("INTERNET_OPTION_MAX_CONNS_PER_SERVER\n");
3359
3360 if(size != sizeof(max_conns))
3362 if(!*(ULONG*)buf)
3363 return ERROR_BAD_ARGUMENTS;
3364
3365 max_conns = *(ULONG*)buf;
3366 return ERROR_SUCCESS;
3367
3369 TRACE("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER\n");
3370
3371 if(size != sizeof(max_1_0_conns))
3373 if(!*(ULONG*)buf)
3374 return ERROR_BAD_ARGUMENTS;
3375
3376 max_1_0_conns = *(ULONG*)buf;
3377 return ERROR_SUCCESS;
3378
3380 TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
3381
3382 if(size != sizeof(connect_timeout))
3384 if(!*(ULONG*)buf)
3385 return ERROR_BAD_ARGUMENTS;
3386
3388 return ERROR_SUCCESS;
3389
3391 TRACE("INTERNET_OPTION_SEND_TIMEOUT\n");
3392
3393 if(size != sizeof(send_timeout))
3395 if(!*(ULONG*)buf)
3396 return ERROR_BAD_ARGUMENTS;
3397
3398 send_timeout = *(ULONG*)buf;
3399 return ERROR_SUCCESS;
3400
3402 TRACE("INTERNET_OPTION_RECEIVE_TIMEOUT\n");
3403
3404 if(size != sizeof(receive_timeout))
3406 if(!*(ULONG*)buf)
3407 return ERROR_BAD_ARGUMENTS;
3408
3410 return ERROR_SUCCESS;
3411
3413 TRACE("INTERNET_OPTION_DATA_SEND_TIMEOUT\n");
3414
3415 if(size != sizeof(data_send_timeout))
3417 if(!*(ULONG*)buf)
3418 return ERROR_BAD_ARGUMENTS;
3419
3421 return ERROR_SUCCESS;
3422
3424 TRACE("INTERNET_OPTION_DATA_RECEIVE_TIMEOUT\n");
3425
3426 if(size != sizeof(data_receive_timeout))
3428 if(!*(ULONG*)buf)
3429 return ERROR_BAD_ARGUMENTS;
3430
3432 return ERROR_SUCCESS;
3433
3435 FIXME("INTERNET_OPTION_SUPPRESS_BEHAVIOR stub\n");
3436
3437 if(size != sizeof(ULONG))
3439
3440 FIXME("%08lx\n", *(ULONG*)buf);
3441 return ERROR_SUCCESS;
3442 }
3443
3444 return INET_SetOption(NULL, option, buf, size);
3445}
3446
3447/***********************************************************************
3448 * InternetSetOptionW (WININET.@)
3449 *
3450 * Sets an options on the specified handle
3451 *
3452 * RETURNS
3453 * TRUE on success
3454 * FALSE on failure
3455 *
3456 */
3458 LPVOID lpBuffer, DWORD dwBufferLength)
3459{
3460 object_header_t *lpwhh;
3461 BOOL ret = TRUE;
3462 DWORD res;
3463
3464 TRACE("(%p %ld %p %ld)\n", hInternet, dwOption, lpBuffer, dwBufferLength);
3465
3466 lpwhh = (object_header_t*) get_handle_object( hInternet );
3467 if(lpwhh)
3468 res = lpwhh->vtbl->SetOption(lpwhh, dwOption, lpBuffer, dwBufferLength);
3469 else
3470 res = set_global_option(dwOption, lpBuffer, dwBufferLength);
3471
3473 if(lpwhh)
3474 WININET_Release(lpwhh);
3475
3476 if(res != ERROR_SUCCESS)
3478
3479 return res == ERROR_SUCCESS;
3480 }
3481
3482 switch (dwOption)
3483 {
3485 {
3487 FIXME("Option INTERNET_OPTION_HTTP_VERSION(%ld,%ld): STUB\n",pVersion->dwMajorVersion,pVersion->dwMinorVersion);
3488 }
3489 break;
3491 {
3492 if(!lpwhh) {
3494 return FALSE;
3499 ret = FALSE;
3500 } else if(dwBufferLength != sizeof(ULONG)) {
3502 ret = FALSE;
3503 } else {
3504 TRACE("INTERNET_OPTION_ERROR_MASK: %lx\n", *(ULONG*)lpBuffer);
3505 lpwhh->ErrorMask = *(ULONG*)lpBuffer;
3506 }
3507 }
3508 break;
3510 {
3512
3513 if (!lpBuffer || dwBufferLength < sizeof(INTERNET_PROXY_INFOW))
3514 {
3516 return FALSE;
3517 }
3518 if (!hInternet)
3519 {
3522 if (info->dwAccessType == INTERNET_OPEN_TYPE_PROXY)
3523 {
3525 global_proxy.proxy = wcsdup(info->lpszProxy);
3526 global_proxy.proxyBypass = wcsdup(info->lpszProxyBypass);
3527 }
3528 else
3529 {
3532 }
3534 }
3535 else
3536 {
3537 /* In general, each type of object should handle
3538 * INTERNET_OPTION_PROXY directly. This FIXME ensures it doesn't
3539 * get silently dropped.
3540 */
3541 FIXME("INTERNET_OPTION_PROXY unimplemented\n");
3543 ret = FALSE;
3544 }
3545 break;
3546 }
3548 {
3550 FIXME("Option INTERNET_OPTION_CODEPAGE (%ld): STUB\n", codepage);
3551 }
3552 break;
3554 {
3556 FIXME("Option INTERNET_OPTION_REQUEST_PRIORITY (%ld): STUB\n", priority);
3557 }
3558 break;
3560 FIXME("Option INTERNET_OPTION_RESET_URLCACHE_SESSION: STUB\n");
3561 break;
3563 FIXME("Option INTERNET_OPTION_END_BROWSER_SESSION: semi-stub\n");
3564 free_cookie();
3566 break;
3568 FIXME("Option INTERNET_OPTION_CONNECTED_STATE: STUB\n");
3569 break;
3571 TRACE("Option INTERNET_OPTION_DISABLE_PASSPORT_AUTH: harmless stub, since not enabled\n");
3572 break;
3574 FIXME("Option INTERNET_OPTION_IGNORE_OFFLINE: STUB\n");
3575 break;
3577 {
3578 ULONG retries = *(ULONG *)lpBuffer;
3579 FIXME("INTERNET_OPTION_CONNECT_RETRIES %ld\n", retries);
3580 break;
3581 }
3583 {
3584 if (!lpwhh)
3585 {
3587 return FALSE;
3588 }
3589 if (!lpBuffer || dwBufferLength != sizeof(DWORD_PTR))
3590 {
3592 ret = FALSE;
3593 }
3594 else
3595 lpwhh->dwContext = *(DWORD_PTR *)lpBuffer;
3596 break;
3597 }
3599 FIXME("Option INTERNET_OPTION_SECURITY_FLAGS; STUB\n");
3600 break;
3602 FIXME("Option INTERNET_OPTION_DISABLE_AUTODIAL; STUB\n");
3603 break;
3605 if (!lpwhh)
3606 {
3608 return FALSE;
3609 }
3610 if (!lpBuffer || dwBufferLength != sizeof(BOOL))
3611 {
3613 ret = FALSE;
3614 }
3615 else
3616 lpwhh->decoding = *(BOOL *)lpBuffer;
3617 break;
3619 FIXME("INTERNET_OPTION_COOKIES_3RD_PARTY; STUB\n");
3621 ret = FALSE;
3622 break;
3624 FIXME("INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY; STUB\n");
3626 ret = FALSE;
3627 break;
3629 FIXME("INTERNET_OPTION_CODEPAGE_PATH; STUB\n");
3631 ret = FALSE;
3632 break;
3634 FIXME("INTERNET_OPTION_CODEPAGE_EXTRA; STUB\n");
3636 ret = FALSE;
3637 break;
3639 FIXME("INTERNET_OPTION_IDN; STUB\n");
3641 ret = FALSE;
3642 break;
3645 ret = FALSE;
3646 break;
3649 LONG res;
3650 unsigned int i;
3652
3653 if (INTERNET_LoadProxySettings(&pi)) return FALSE;
3654
3655 for (i = 0; i < con->dwOptionCount; i++) {
3657
3658 switch (option->dwOption) {
3660 free(pi.proxy);
3661 pi.proxy = wcsdup(option->Value.pszValue);
3662 break;
3663
3665 if(option->Value.dwValue & ~(PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT))
3666 FIXME("Unhandled flags: 0x%lx\n", option->Value.dwValue);
3667 pi.flags = option->Value.dwValue;
3668 break;
3669
3671 free(pi.proxyBypass);
3672 pi.proxyBypass = wcsdup(option->Value.pszValue);
3673 break;
3674
3676 free(pi.autoconf_url);
3677 pi.autoconf_url = wcsdup(option->Value.pszValue);
3678 break;
3679
3685 FIXME("Unhandled dwOption %ld\n", option->dwOption);
3686 break;
3687
3688 default:
3689 FIXME("Unknown dwOption %ld\n", option->dwOption);
3691 break;
3692 }
3693 }
3694
3697
3698 FreeProxyInfo(&pi);
3699
3700 ret = (res == ERROR_SUCCESS);
3701 break;
3702 }
3703 default:
3704 FIXME("Option %ld STUB\n",dwOption);
3706 ret = FALSE;
3707 break;
3708 }
3709
3710 if(lpwhh)
3711 WININET_Release( lpwhh );
3712
3713 return ret;
3714}
3715
3716
3717/***********************************************************************
3718 * InternetSetOptionA (WININET.@)
3719 *
3720 * Sets an options on the specified handle.
3721 *
3722 * RETURNS
3723 * TRUE on success
3724 * FALSE on failure
3725 *
3726 */
3728 LPVOID lpBuffer, DWORD dwBufferLength)
3729{
3730 LPVOID wbuffer;
3731 DWORD wlen;
3732 BOOL r;
3733
3734 switch( dwOption )
3735 {
3737 {
3740 DWORD proxlen, prbylen;
3741 LPWSTR prox, prby;
3742
3743 proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0);
3744 prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0);
3745 wlen = sizeof(*piw) + proxlen + prbylen;
3746 wbuffer = malloc( wlen * sizeof(WCHAR) );
3747 piw = (LPINTERNET_PROXY_INFOW) wbuffer;
3748 piw->dwAccessType = pi->dwAccessType;
3749 prox = (LPWSTR) &piw[1];
3750 prby = &prox[proxlen+1];
3751 MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, prox, proxlen);
3752 MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, prby, prbylen);
3753 piw->lpszProxy = prox;
3754 piw->lpszProxyBypass = prby;
3755 }
3756 break;
3762 wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, NULL, 0 );
3763 if (!(wbuffer = malloc( wlen * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
3764 MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, wbuffer, wlen );
3765 break;
3767 unsigned int i;
3770 wlen = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
3771 wbuffer = malloc( wlen );
3772 listW = wbuffer;
3773
3774 listW->dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
3775 if (listA->pszConnection)
3776 {
3777 wlen = MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, NULL, 0 );
3778 listW->pszConnection = malloc( wlen * sizeof(WCHAR) );
3779 MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, listW->pszConnection, wlen );
3780 }
3781 else
3782 listW->pszConnection = NULL;
3783 listW->dwOptionCount = listA->dwOptionCount;
3784 listW->dwOptionError = listA->dwOptionError;
3785 listW->pOptions = malloc( sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount );
3786
3787 for (i = 0; i < listA->dwOptionCount; ++i) {
3788 INTERNET_PER_CONN_OPTIONA *optA = listA->pOptions + i;
3789 INTERNET_PER_CONN_OPTIONW *optW = listW->pOptions + i;
3790
3791 optW->dwOption = optA->dwOption;
3792
3793 switch (optA->dwOption) {
3799 if (optA->Value.pszValue)
3800 {
3801 wlen = MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, NULL, 0 );
3802 optW->Value.pszValue = malloc( wlen * sizeof(WCHAR) );
3803 MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, optW->Value.pszValue, wlen );
3804 }
3805 else
3806 optW->Value.pszValue = NULL;
3807 break;
3811 optW->Value.dwValue = optA->Value.dwValue;
3812 break;
3814 optW->Value.ftValue = optA->Value.ftValue;
3815 break;
3816 default:
3817 WARN("Unknown PER_CONN dwOption: %ld, guessing at conversion to Wide\n", optA->dwOption);
3818 optW->Value.dwValue = optA->Value.dwValue;
3819 break;
3820 }
3821 }
3822 }
3823 break;
3824 default:
3825 wbuffer = lpBuffer;
3826 wlen = dwBufferLength;
3827 }
3828
3829 r = InternetSetOptionW(hInternet,dwOption, wbuffer, wlen);
3830
3831 if( lpBuffer != wbuffer )
3832 {
3834 {
3836 unsigned int i;
3837 for (i = 0; i < list->dwOptionCount; ++i) {
3838 INTERNET_PER_CONN_OPTIONW *opt = list->pOptions + i;
3839 switch (opt->dwOption) {
3845 free( opt->Value.pszValue );
3846 break;
3847 default:
3848 break;
3849 }
3850 }
3851 free( list->pOptions );
3852 }
3853 free( wbuffer );
3854 }
3855
3856 return r;
3857}
3858
3859
3860/***********************************************************************
3861 * InternetSetOptionExA (WININET.@)
3862 */
3864 LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
3865{
3866 FIXME("Flags %08lx ignored\n", dwFlags);
3867 return InternetSetOptionA( hInternet, dwOption, lpBuffer, dwBufferLength );
3868}
3869
3870/***********************************************************************
3871 * InternetSetOptionExW (WININET.@)
3872 */
3874 LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
3875{
3876 FIXME("Flags %08lx ignored\n", dwFlags);
3877 if( dwFlags & ~ISO_VALID_FLAGS )
3878 {
3880 return FALSE;
3881 }
3882 return InternetSetOptionW( hInternet, dwOption, lpBuffer, dwBufferLength );
3883}
3884
3885static const WCHAR WININET_wkday[7][4] =
3886 { L"Sun", L"Mon", L"Tue", L"Wed",
3887 L"Thu", L"Fri", L"Sat"};
3888static const WCHAR WININET_month[12][4] =
3889 { L"Jan", L"Feb", L"Mar", L"Apr",
3890 L"May", L"Jun", L"Jul", L"Aug",
3891 L"Sep", L"Oct", L"Nov", L"Dec"};
3892
3893static inline BOOL is_time_digit(const WCHAR c)
3894{
3895 return c >= '0' && c <= '9';
3896}
3897
3898/***********************************************************************
3899 * InternetTimeFromSystemTimeA (WININET.@)
3900 */
3902{
3903 BOOL ret;
3905
3906 TRACE( "%p 0x%08lx %p 0x%08lx\n", time, format, string, size );
3907
3908 if (!time || !string || format != INTERNET_RFC1123_FORMAT)
3909 {
3911 return FALSE;
3912 }
3913
3914 if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
3915 {
3917 return FALSE;
3918 }
3919
3921 if (ret) WideCharToMultiByte( CP_ACP, 0, stringW, -1, string, size, NULL, NULL );
3922
3923 return ret;
3924}
3925
3926/***********************************************************************
3927 * InternetTimeFromSystemTimeW (WININET.@)
3928 */
3930{
3931 TRACE( "%p 0x%08lx %p 0x%08lx\n", time, format, string, size );
3932
3933 if (!time || !string || format != INTERNET_RFC1123_FORMAT)
3934 {
3936 return FALSE;
3937 }
3938
3939 if (size < INTERNET_RFC1123_BUFSIZE * sizeof(*string))
3940 {
3942 return FALSE;
3943 }
3944
3945 swprintf( string, size, L"%s, %02d %s %4d %02d:%02d:%02d GMT",
3946 WININET_wkday[time->wDayOfWeek],
3947 time->wDay,
3948 WININET_month[time->wMonth - 1],
3949 time->wYear,
3950 time->wHour,
3951 time->wMinute,
3952 time->wSecond );
3953
3954 return TRUE;
3955}
3956
3957/***********************************************************************
3958 * InternetTimeToSystemTimeA (WININET.@)
3959 */
3961{
3962 BOOL ret = FALSE;
3963 WCHAR *stringW;
3964
3965 TRACE( "%s %p 0x%08lx\n", debugstr_a(string), time, reserved );
3966
3967 stringW = strdupAtoW( string );
3968 if (stringW)
3969 {
3971 free( stringW );
3972 }
3973 return ret;
3974}
3975
3976/***********************************************************************
3977 * InternetTimeToSystemTimeW (WININET.@)
3978 */
3980{
3981 unsigned int i;
3982 const WCHAR *s = string;
3983 WCHAR *end;
3984
3985 TRACE( "%s %p 0x%08lx\n", debugstr_w(string), time, reserved );
3986
3987 if (!string || !time) return FALSE;
3988
3989 /* Windows does this too */
3991
3992 /* Convert an RFC1123 time such as 'Fri, 07 Jan 2005 12:06:35 GMT' into
3993 * a SYSTEMTIME structure.
3994 */
3995
3996 while (*s && !iswalpha(*s) && !is_time_digit(*s)) s++;
3997 if (*s == '\0') return TRUE;
3998 time->wDayOfWeek = 7;
3999
4000 if (iswalpha(*s))
4001 {
4002 if (s[1] == '\0' || s[2] == '\0') return TRUE;
4003 for (i = 0; i < 7; i++)
4004 {
4005 if (!wcsnicmp(WININET_wkday[i], s, 3))
4006 {
4007 time->wDayOfWeek = i;
4008 break;
4009 }
4010 }
4011 }
4012 else if (is_time_digit(*s))
4013 {
4014 time->wDayOfWeek = wcstol(s, &end, 10);
4015 s = end;
4016 }
4017 if (time->wDayOfWeek > 6) return TRUE;
4018
4019 while (*s && !is_time_digit(*s)) s++;
4020 time->wDay = wcstol( s, &end, 10 );
4021 s = end;
4022
4023 while (*s && !iswalpha(*s) && !is_time_digit(*s)) s++;
4024 if (*s == '\0') return TRUE;
4025 time->wMonth = 0;
4026
4027 if (iswalpha(*s))
4028 {
4029 if (s[1] == '\0' || s[2] == '\0') return TRUE;
4030 for (i = 0; i < 12; i++)
4031 {
4032 if (!wcsnicmp(WININET_month[i], s, 3))
4033 {
4034 time->wMonth = i + 1;
4035 break;
4036 }
4037 }
4038 }
4039 else if (is_time_digit(*s))
4040 {
4041 time->wMonth = wcstol(s, &end, 10);
4042 s = end;
4043 }
4044 if (time->wMonth == 0) return TRUE;
4045
4046 while (*s && !is_time_digit(*s)) s++;
4047 if (*s == '\0') return TRUE;
4048 time->wYear = wcstol( s, &end, 10 );
4049 s = end;
4050
4051 while (*s && !is_time_digit(*s)) s++;
4052 if (*s == '\0') return TRUE;
4053 time->wHour = wcstol( s, &end, 10 );
4054 s = end;
4055
4056 while (*s && !is_time_digit(*s)) s++;
4057 if (*s == '\0') return TRUE;
4058 time->wMinute = wcstol( s, &end, 10 );
4059 s = end;
4060
4061 while (*s && !is_time_digit(*s)) s++;
4062 if (*s == '\0') return TRUE;
4063 time->wSecond = wcstol( s, &end, 10 );
4064 s = end;
4065
4066 time->wMilliseconds = 0;
4067 return TRUE;
4068}
4069
4070/***********************************************************************
4071 * InternetCheckConnectionW (WININET.@)
4072 *
4073 * Pings a requested host to check internet connection
4074 *
4075 * RETURNS
4076 * TRUE on success and FALSE on failure. If a failure then
4077 * ERROR_NOT_CONNECTED is placed into GetLastError
4078 *
4079 */
4081{
4082/*
4083 * this is a kludge which runs the resident ping program and reads the output.
4084 *
4085 * Anyone have a better idea?
4086 */
4087
4088 BOOL rc = FALSE;
4089 static const CHAR ping[] = "ping -c 1 ";
4090 static const CHAR redirect[] = " >/dev/null 2>/dev/null";
4091 WCHAR *host;
4092 DWORD len, host_len;
4094 int status = -1;
4095
4096 FIXME("(%s %lx %lx)\n", debugstr_w(lpszUrl), dwFlags, dwReserved);
4097
4098 /*
4099 * Crack or set the Address
4100 */
4101 if (lpszUrl == NULL)
4102 {
4103 /*
4104 * According to the doc we are supposed to use the ip for the next
4105 * server in the WnInet internal server database. I have
4106 * no idea what that is or how to get it.
4107 *
4108 * So someone needs to implement this.
4109 */
4110 FIXME("Unimplemented with URL of NULL\n");
4111 return TRUE;
4112 }
4113 else
4114 {
4116
4118
4119 if (!InternetCrackUrlW(lpszUrl,0,0,&components))
4120 goto End;
4121
4122 host = components.lpszHostName;
4123 host_len = components.dwHostNameLength;
4124 port = components.nPort;
4125 TRACE("host name: %s port: %d\n",debugstr_wn(host, host_len), port);
4126 }
4127
4129 {
4130 struct sockaddr_storage saddr;
4131 int sa_len = sizeof(saddr);
4132 WCHAR *host_z;
4133 int fd;
4134 BOOL b;
4135
4136 host_z = strndupW(host, host_len);
4137 if (!host_z)
4138 return FALSE;
4139
4140 b = GetAddress(host_z, port, (struct sockaddr *)&saddr, &sa_len, NULL);
4141 free(host_z);
4142 if(!b)
4143 goto End;
4144 init_winsock();
4145 fd = socket(saddr.ss_family, SOCK_STREAM, 0);
4146 if (fd != -1)
4147 {
4148 if (connect(fd, (struct sockaddr *)&saddr, sa_len) == 0)
4149 rc = TRUE;
4150 closesocket(fd);
4151 }
4152 }
4153 else
4154 {
4155 /*
4156 * Build our ping command
4157 */
4158 char *command;
4159
4160 len = WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, NULL, 0, NULL, NULL);
4161 command = malloc(strlen(ping) + len + strlen(redirect) + 1);
4162 strcpy(command, ping);
4163 WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, command+sizeof(ping)-1, len, NULL, NULL);
4164 strcpy(command+sizeof(ping)-1+len, redirect);
4165
4166 TRACE("Ping command is : %s\n",command);
4167
4169 free(command);
4170
4171 TRACE("Ping returned a code of %i\n",status);
4172
4173 /* Ping return code of 0 indicates success */
4174 if (status == 0)
4175 rc = TRUE;
4176 }
4177
4178End:
4179 if (rc == FALSE)
4181
4182 return rc;
4183}
4184
4185
4186/***********************************************************************
4187 * InternetCheckConnectionA (WININET.@)
4188 *
4189 * Pings a requested host to check internet connection
4190 *
4191 * RETURNS
4192 * TRUE on success and FALSE on failure. If a failure then
4193 * ERROR_NOT_CONNECTED is placed into GetLastError
4194 *
4195 */
4197{
4198 WCHAR *url = NULL;
4199 BOOL rc;
4200
4201 if(lpszUrl) {
4202 url = strdupAtoW(lpszUrl);
4203 if(!url)
4204 return FALSE;
4205 }
4206
4208
4209 free(url);
4210 return rc;
4211}
4212
4213
4214/**********************************************************
4215 * INTERNET_InternetOpenUrlW (internal)
4216 *
4217 * Opens an URL
4218 *
4219 * RETURNS
4220 * handle of connection or NULL on failure
4221 */
4223 LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
4224{
4225 URL_COMPONENTSW urlComponents = { sizeof(urlComponents) };
4226 WCHAR *host, *user = NULL, *pass = NULL, *path;
4227 HINTERNET client = NULL, client1 = NULL;
4228 DWORD res;
4229
4230 TRACE("(%p, %s, %s, %08lx, %08lx, %08Ix)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
4231 dwHeadersLength, dwFlags, dwContext);
4232
4233 urlComponents.dwHostNameLength = 1;
4234 urlComponents.dwUserNameLength = 1;
4235 urlComponents.dwPasswordLength = 1;
4236 urlComponents.dwUrlPathLength = 1;
4237 urlComponents.dwExtraInfoLength = 1;
4238 if(!InternetCrackUrlW(lpszUrl, lstrlenW(lpszUrl), 0, &urlComponents))
4239 return NULL;
4240
4241 if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
4242 urlComponents.dwExtraInfoLength)
4243 {
4244 assert(urlComponents.lpszUrlPath + urlComponents.dwUrlPathLength == urlComponents.lpszExtraInfo);
4245 urlComponents.dwUrlPathLength += urlComponents.dwExtraInfoLength;
4246 }
4247
4248 host = strndupW(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
4249 path = strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength);
4250 if(urlComponents.dwUserNameLength)
4251 user = strndupW(urlComponents.lpszUserName, urlComponents.dwUserNameLength);
4252 if(urlComponents.dwPasswordLength)
4253 pass = strndupW(urlComponents.lpszPassword, urlComponents.dwPasswordLength);
4254
4255 switch(urlComponents.nScheme) {
4257 client = FTP_Connect(hIC, host, urlComponents.nPort,
4258 user, pass, dwFlags, dwContext, INET_OPENURL);
4259 if(client == NULL)
4260 break;
4261 client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
4262 if(client1 == NULL) {
4264 break;
4265 }
4266 break;
4267
4269 case INTERNET_SCHEME_HTTPS: {
4270 LPCWSTR accept[2] = { L"*/*", NULL };
4271
4273
4274 /* FIXME: should use pointers, not handles, as handles are not thread-safe */
4275 res = HTTP_Connect(hIC, host, urlComponents.nPort,
4276 user, pass, dwFlags, dwContext, INET_OPENURL, &client);
4277 if(res != ERROR_SUCCESS) {
4279 break;
4280 }
4281
4282 client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
4283 if(client1 == NULL) {
4285 break;
4286 }
4287 HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
4288 if (!HttpSendRequestW(client1, NULL, 0, NULL, 0) &&
4290 InternetCloseHandle(client1);
4291 client1 = NULL;
4292 break;
4293 }
4294 }
4296 /* gopher doesn't seem to be implemented in wine, but it's supposed
4297 * to be supported by InternetOpenUrlA. */
4298 default:
4300 break;
4301 }
4302
4303 TRACE(" %p <--\n", client1);
4304
4305 free(host);
4306 free(path);
4307 free(user);
4308 free(pass);
4309 return client1;
4310}
4311
4312/**********************************************************
4313 * InternetOpenUrlW (WININET.@)
4314 *
4315 * Opens an URL
4316 *
4317 * RETURNS
4318 * handle of connection or NULL on failure
4319 */
4320typedef struct {
4328
4330{
4332
4333 TRACE("%p\n", task->hdr.hdr);
4334
4335 INTERNET_InternetOpenUrlW((appinfo_t*)task->hdr.hdr, task->url, task->headers,
4336 task->headers_len, task->flags, task->context);
4337 free(task->url);
4338 free(task->headers);
4339}
4340
4342 LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
4343{
4344 HINTERNET ret = NULL;
4345 appinfo_t *hIC = NULL;
4346
4347 if (TRACE_ON(wininet)) {
4348 TRACE("(%p, %s, %s, %08lx, %08lx, %08Ix)\n", hInternet, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
4349 dwHeadersLength, dwFlags, dwContext);
4350 TRACE(" flags :");
4352 }
4353
4354 if (!lpszUrl)
4355 {
4357 goto lend;
4358 }
4359
4360 hIC = (appinfo_t*)get_handle_object( hInternet );
4361 if (NULL == hIC || hIC->hdr.htype != WH_HINIT) {
4363 goto lend;
4364 }
4365
4366 if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) {
4368
4370 task->url = wcsdup(lpszUrl);
4371 task->headers = wcsdup(lpszHeaders);
4372 task->headers_len = dwHeadersLength;
4373 task->flags = dwFlags;
4374 task->context = dwContext;
4375
4376 INTERNET_AsyncCall(&task->hdr);
4378 } else {
4379 ret = INTERNET_InternetOpenUrlW(hIC, lpszUrl, lpszHeaders, dwHeadersLength, dwFlags, dwContext);
4380 }
4381
4382 lend:
4383 if( hIC )
4384 WININET_Release( &hIC->hdr );
4385 TRACE(" %p <--\n", ret);
4386
4387 return ret;
4388}
4389
4390/**********************************************************
4391 * InternetOpenUrlA (WININET.@)
4392 *
4393 * Opens an URL
4394 *
4395 * RETURNS
4396 * handle of connection or NULL on failure
4397 */
4399 LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
4400{
4401 HINTERNET rc = NULL;
4402 LPWSTR szUrl = NULL;
4403 WCHAR *headers = NULL;
4404
4405 TRACE("\n");
4406
4407 if(lpszUrl) {
4408 szUrl = strdupAtoW(lpszUrl);
4409 if(!szUrl)
4410 return NULL;
4411 }
4412
4413 if(lpszHeaders) {
4414 headers = strndupAtoW(lpszHeaders, dwHeadersLength, &dwHeadersLength);
4415 if(!headers) {
4416 free(szUrl);
4417 return NULL;
4418 }
4419 }
4420
4421 rc = InternetOpenUrlW(hInternet, szUrl, headers, dwHeadersLength, dwFlags, dwContext);
4422
4423 free(szUrl);
4424 free(headers);
4425 return rc;
4426}
4427
4428
4430{
4431 WITHREADERROR *lpwite = malloc(sizeof(*lpwite));
4432
4433 if (lpwite)
4434 {
4435 lpwite->dwError = 0;
4436 lpwite->response[0] = '\0';
4437 }
4438
4439 if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
4440 {
4441 free(lpwite);
4442 return NULL;
4443 }
4444 return lpwite;
4445}
4446
4447
4448/***********************************************************************
4449 * INTERNET_SetLastError (internal)
4450 *
4451 * Set last thread specific error
4452 *
4453 * RETURNS
4454 *
4455 */
4457{
4459
4460 if (!lpwite)
4461 lpwite = INTERNET_AllocThreadError();
4462
4463 SetLastError(dwError);
4464 if(lpwite)
4465 lpwite->dwError = dwError;
4466}
4467
4468
4469/***********************************************************************
4470 * INTERNET_GetLastError (internal)
4471 *
4472 * Get last thread specific error
4473 *
4474 * RETURNS
4475 *
4476 */
4478{
4480 if (!lpwite) return 0;
4481 /* TlsGetValue clears last error, so set it again here */
4482 SetLastError(lpwite->dwError);
4483 return lpwite->dwError;
4484}
4485
4486
4487/***********************************************************************
4488 * INTERNET_WorkerThreadFunc (internal)
4489 *
4490 * Worker thread execution function
4491 *
4492 * RETURNS
4493 *
4494 */
4496{
4497 task_header_t *task = lpvParam;
4498
4499 TRACE("\n");
4500
4501 task->proc(task);
4502 WININET_Release(task->hdr);
4503 free(task);
4504
4506 {
4509 }
4510 return TRUE;
4511}
4512
4514{
4516
4517 task = malloc(size);
4518 if(!task)
4519 return NULL;
4520
4521 task->hdr = WININET_AddRef(hdr);
4522 task->proc = proc;
4523 return task;
4524}
4525
4526/***********************************************************************
4527 * INTERNET_AsyncCall (internal)
4528 *
4529 * Retrieves work request from queue
4530 *
4531 * RETURNS
4532 *
4533 */
4535{
4536 BOOL bSuccess;
4537
4538 TRACE("\n");
4539
4541 if (!bSuccess)
4542 {
4543 free(task);
4545 }
4546 return ERROR_SUCCESS;
4547}
4548
4549
4550/***********************************************************************
4551 * INTERNET_GetResponseBuffer (internal)
4552 *
4553 * RETURNS
4554 *
4555 */
4557{
4559 if (!lpwite)
4560 lpwite = INTERNET_AllocThreadError();
4561 TRACE("\n");
4562 return lpwite->response;
4563}
4564
4565/**********************************************************
4566 * InternetQueryDataAvailable (WININET.@)
4567 *
4568 * Determines how much data is available to be read.
4569 *
4570 * RETURNS
4571 * TRUE on success, FALSE if an error occurred. If
4572 * INTERNET_FLAG_ASYNC was specified in InternetOpen, and
4573 * no data is presently available, FALSE is returned with
4574 * the last error ERROR_IO_PENDING; a callback with status
4575 * INTERNET_STATUS_REQUEST_COMPLETE will be sent when more
4576 * data is available.
4577 */
4579 LPDWORD lpdwNumberOfBytesAvailable,
4580 DWORD dwFlags, DWORD_PTR dwContext)
4581{
4583 DWORD res;
4584
4585 TRACE("(%p %p %lx %Ix)\n", hFile, lpdwNumberOfBytesAvailable, dwFlags, dwContext);
4586
4588 if (!hdr) {
4590 return FALSE;
4591 }
4592
4593 if(hdr->vtbl->QueryDataAvailable) {
4594 res = hdr->vtbl->QueryDataAvailable(hdr, lpdwNumberOfBytesAvailable, dwFlags, dwContext);
4595 }else {
4596 WARN("wrong handle\n");
4598 }
4599
4601
4602 if(res != ERROR_SUCCESS)
4604 return res == ERROR_SUCCESS;
4605}
4606
4608{
4609 req_file_t *req_file;
4610
4611 req_file = calloc(1, sizeof(*req_file));
4612 if(!req_file)
4614
4615 req_file->ref = 1;
4616
4617 req_file->file_name = wcsdup(file_name);
4618 if(!req_file->file_name) {
4619 free(req_file);
4621 }
4622
4625 if(req_file->file_handle == INVALID_HANDLE_VALUE) {
4626 req_file_release(req_file);
4627 return GetLastError();
4628 }
4629
4630 *ret = req_file;
4631 return ERROR_SUCCESS;
4632}
4633
4635{
4636 if(InterlockedDecrement(&req_file->ref))
4637 return;
4638
4639 if(!req_file->is_committed)
4640 DeleteFileW(req_file->file_name);
4641 if(req_file->file_handle && req_file->file_handle != INVALID_HANDLE_VALUE)
4642 CloseHandle(req_file->file_handle);
4643 free(req_file->file_name);
4644 free(req_file->url);
4645 free(req_file);
4646}
4647
4648/***********************************************************************
4649 * InternetLockRequestFile (WININET.@)
4650 */
4652{
4653 req_file_t *req_file = NULL;
4655 DWORD res;
4656
4657 TRACE("(%p %p)\n", hInternet, lphLockReqHandle);
4658
4659 hdr = get_handle_object(hInternet);
4660 if (!hdr) {
4662 return FALSE;
4663 }
4664
4665 if(hdr->vtbl->LockRequestFile) {
4666 res = hdr->vtbl->LockRequestFile(hdr, &req_file);
4667 }else {
4668 WARN("wrong handle\n");
4670 }
4671
4673
4674 *lphLockReqHandle = req_file;
4675 if(res != ERROR_SUCCESS)
4677 return res == ERROR_SUCCESS;
4678}
4679
4681{
4682 TRACE("(%p)\n", hLockHandle);
4683
4684 req_file_release(hLockHandle);
4685 return TRUE;
4686}
4687
4688
4689/***********************************************************************
4690 * InternetAutodial (WININET.@)
4691 *
4692 * On windows this function is supposed to dial the default internet
4693 * connection. We don't want to have Wine dial out to the internet so
4694 * we return TRUE by default. It might be nice to check if we are connected.
4695 *
4696 * RETURNS
4697 * TRUE on success
4698 * FALSE on failure
4699 *
4700 */
4702{
4703 FIXME("STUB\n");
4704
4705 /* Tell that we are connected to the internet. */
4706 return TRUE;
4707}
4708
4709/***********************************************************************
4710 * InternetAutodialHangup (WININET.@)
4711 *
4712 * Hangs up a connection made with InternetAutodial
4713 *
4714 * PARAM
4715 * dwReserved
4716 * RETURNS
4717 * TRUE on success
4718 * FALSE on failure
4719 *
4720 */
4722{
4723 FIXME("STUB\n");
4724
4725 /* we didn't dial, we don't disconnect */
4726 return TRUE;
4727}
4728
4729/***********************************************************************
4730 * InternetCombineUrlA (WININET.@)
4731 *
4732 * Combine a base URL with a relative URL
4733 *
4734 * RETURNS
4735 * TRUE on success
4736 * FALSE on failure
4737 *
4738 */
4739
4740BOOL WINAPI InternetCombineUrlA(LPCSTR lpszBaseUrl, LPCSTR lpszRelativeUrl,
4741 LPSTR lpszBuffer, LPDWORD lpdwBufferLength,
4742 DWORD dwFlags)
4743{
4744 HRESULT hr=S_OK;
4745
4746 TRACE("(%s, %s, %p, %p, 0x%08lx)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4747
4748 /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4750 hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4751
4752 return (hr==S_OK);
4753}
4754
4755/***********************************************************************
4756 * InternetCombineUrlW (WININET.@)
4757 *
4758 * Combine a base URL with a relative URL
4759 *
4760 * RETURNS
4761 * TRUE on success
4762 * FALSE on failure
4763 *
4764 */
4765
4766BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl,
4767 LPWSTR lpszBuffer, LPDWORD lpdwBufferLength,
4768 DWORD dwFlags)
4769{
4770 HRESULT hr=S_OK;
4771
4772 TRACE("(%s, %s, %p, %p, 0x%08lx)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4773
4774 /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4776 hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4777
4778 return (hr==S_OK);
4779}
4780
4781/* max port num is 65535 => 5 digits */
4782#define MAX_WORD_DIGITS 5
4783
4784#define URL_GET_COMP_LENGTH(url, component) ((url)->dw##component##Length ? \
4785 (url)->dw##component##Length : lstrlenW((url)->lpsz##component))
4786#define URL_GET_COMP_LENGTHA(url, component) ((url)->dw##component##Length ? \
4787 (url)->dw##component##Length : strlen((url)->lpsz##component))
4788
4790{
4791 if ((nScheme == INTERNET_SCHEME_HTTP) &&
4792 (nPort == INTERNET_DEFAULT_HTTP_PORT))
4793 return TRUE;
4794 if ((nScheme == INTERNET_SCHEME_HTTPS) &&
4795 (nPort == INTERNET_DEFAULT_HTTPS_PORT))
4796 return TRUE;
4797 if ((nScheme == INTERNET_SCHEME_FTP) &&
4798 (nPort == INTERNET_DEFAULT_FTP_PORT))
4799 return TRUE;
4800 if ((nScheme == INTERNET_SCHEME_GOPHER) &&
4802 return TRUE;
4803
4804 if (nPort == INTERNET_INVALID_PORT_NUMBER)
4805 return TRUE;
4806
4807 return FALSE;
4808}
4809
4810/* opaque urls do not fit into the standard url hierarchy and don't have
4811 * two following slashes */
4813{
4814 return (nScheme != INTERNET_SCHEME_FTP) &&
4815 (nScheme != INTERNET_SCHEME_GOPHER) &&
4816 (nScheme != INTERNET_SCHEME_HTTP) &&
4817 (nScheme != INTERNET_SCHEME_HTTPS) &&
4818 (nScheme != INTERNET_SCHEME_FILE);
4819}
4820
4822{
4823 int index;
4825 return NULL;
4828 return NULL;
4829 return url_schemes[index];
4830}
4831
4832/* we can calculate using ansi strings because we're just
4833 * calculating string length, not size
4834 */
4836 LPDWORD lpdwUrlLength)
4837{
4838 INTERNET_SCHEME nScheme;
4839
4840 *lpdwUrlLength = 0;
4841
4842 if (lpUrlComponents->lpszScheme)
4843 {
4844 DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
4845 *lpdwUrlLength += dwLen;
4846 nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
4847 }
4848 else
4849 {
4851
4852 if (lpUrlComponents->nScheme == INTERNET_SCHEME_UNKNOWN)
4853 {
4855 return FALSE;
4856 }
4857
4858 nScheme = lpUrlComponents->nScheme;
4859
4860 if (nScheme == INTERNET_SCHEME_DEFAULT)
4861 nScheme = INTERNET_SCHEME_HTTP;
4863 *lpdwUrlLength += lstrlenW(scheme);
4864 }
4865
4866 (*lpdwUrlLength)++; /* ':' */
4867 if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
4868 *lpdwUrlLength += strlen("//");
4869
4870 if (lpUrlComponents->lpszUserName)
4871 {
4872 *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
4873 *lpdwUrlLength += strlen("@");
4874 }
4875 else
4876 {
4877 if (lpUrlComponents->lpszPassword)
4878 {
4880 return FALSE;
4881 }
4882 }
4883
4884 if (lpUrlComponents->lpszPassword)
4885 {
4886 *lpdwUrlLength += strlen(":");
4887 *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
4888 }
4889
4890 if (lpUrlComponents->lpszHostName)
4891 {
4892 *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
4893
4894 if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
4895 {
4897
4898 _ltow(lpUrlComponents->nPort, port, 10);
4899 *lpdwUrlLength += lstrlenW(port);
4900 *lpdwUrlLength += strlen(":");
4901 }
4902
4903 if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
4904 (*lpdwUrlLength)++; /* '/' */
4905 }
4906
4907 if (lpUrlComponents->lpszUrlPath)
4908 *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
4909
4910 if (lpUrlComponents->lpszExtraInfo)
4911 *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
4912
4913 return TRUE;
4914}
4915
4916static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPONENTSW urlCompW)
4917{
4918 INT len;
4919
4920 ZeroMemory(urlCompW, sizeof(URL_COMPONENTSW));
4921
4922 urlCompW->dwStructSize = sizeof(URL_COMPONENTSW);
4923 urlCompW->dwSchemeLength = lpUrlComponents->dwSchemeLength;
4924 urlCompW->nScheme = lpUrlComponents->nScheme;
4925 urlCompW->dwHostNameLength = lpUrlComponents->dwHostNameLength;
4926 urlCompW->nPort = lpUrlComponents->nPort;
4927 urlCompW->dwUserNameLength = lpUrlComponents->dwUserNameLength;
4928 urlCompW->dwPasswordLength = lpUrlComponents->dwPasswordLength;
4929 urlCompW->dwUrlPathLength = lpUrlComponents->dwUrlPathLength;
4930 urlCompW->dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength;
4931
4932 if (lpUrlComponents->lpszScheme)
4933 {
4934 len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
4935 urlCompW->lpszScheme = malloc(len * sizeof(WCHAR));
4936 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
4937 -1, urlCompW->lpszScheme, len);
4938 }
4939
4940 if (lpUrlComponents->lpszHostName)
4941 {
4942 len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
4943 urlCompW->lpszHostName = malloc(len * sizeof(WCHAR));
4944 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
4945 -1, urlCompW->lpszHostName, len);
4946 }
4947
4948 if (lpUrlComponents->lpszUserName)
4949 {
4950 len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
4951 urlCompW->lpszUserName = malloc(len * sizeof(WCHAR));
4952 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
4953 -1, urlCompW->lpszUserName, len);
4954 }
4955
4956 if (lpUrlComponents->lpszPassword)
4957 {
4958 len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
4959 urlCompW->lpszPassword = malloc(len * sizeof(WCHAR));
4960 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
4961 -1, urlCompW->lpszPassword, len);
4962 }
4963
4964 if (lpUrlComponents->lpszUrlPath)
4965 {
4966 len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
4967 urlCompW->lpszUrlPath = malloc(len * sizeof(WCHAR));
4968 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
4969 -1, urlCompW->lpszUrlPath, len);
4970 }
4971
4972 if (lpUrlComponents->lpszExtraInfo)
4973 {
4974 len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
4975 urlCompW->lpszExtraInfo = malloc(len * sizeof(WCHAR));
4976 MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
4977 -1, urlCompW->lpszExtraInfo, len);
4978 }
4979}
4980
4981/***********************************************************************
4982 * InternetCreateUrlA (WININET.@)
4983 *
4984 * See InternetCreateUrlW.
4985 */
4987 LPSTR lpszUrl, LPDWORD lpdwUrlLength)
4988{
4989 BOOL ret;
4990 LPWSTR urlW = NULL;
4991 URL_COMPONENTSW urlCompW;
4992
4993 TRACE("(%p,%ld,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
4994
4995 if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
4996 {
4998 return FALSE;
4999 }
5000
5001 convert_urlcomp_atow(lpUrlComponents, &urlCompW);
5002
5003 if (lpszUrl)
5004 urlW = malloc(*lpdwUrlLength * sizeof(WCHAR));
5005
5006 ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength);
5007
5009 *lpdwUrlLength /= sizeof(WCHAR);
5010
5011 /* on success, lpdwUrlLength points to the size of urlW in WCHARS
5012 * minus one, so add one to leave room for NULL terminator
5013 */
5014 if (ret)
5015 WideCharToMultiByte(CP_ACP, 0, urlW, -1, lpszUrl, *lpdwUrlLength + 1, NULL, NULL);
5016
5017 free(urlCompW.lpszScheme);
5018 free(urlCompW.lpszHostName);
5019 free(urlCompW.lpszUserName);
5020 free(urlCompW.lpszPassword);
5021 free(urlCompW.lpszUrlPath);
5022 free(urlCompW.lpszExtraInfo);
5023 free(urlW);
5024 return ret;
5025}
5026
5027/***********************************************************************
5028 * InternetCreateUrlW (WININET.@)
5029 *
5030 * Creates a URL from its component parts.
5031 *
5032 * PARAMS
5033 * lpUrlComponents [I] URL Components.
5034 * dwFlags [I] Flags. See notes.
5035 * lpszUrl [I] Buffer in which to store the created URL.
5036 * lpdwUrlLength [I/O] On input, the length of the buffer pointed to by
5037 * lpszUrl in characters. On output, the number of bytes
5038 * required to store the URL including terminator.
5039 *
5040 * NOTES
5041 *
5042 * The dwFlags parameter can be zero or more of the following:
5043 *|ICU_ESCAPE - Generates escape sequences for unsafe characters in the path and extra info of the URL.
5044 *
5045 * RETURNS
5046 * TRUE on success
5047 * FALSE on failure
5048 *
5049 */
5051 LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
5052{
5053 DWORD dwLen;
5054 INTERNET_SCHEME nScheme;
5055
5056 static const WCHAR slashSlashW[] = {'/','/'};
5057
5058 TRACE("(%p,%ld,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength);
5059
5060 if (!lpUrlComponents || lpUrlComponents->dwStructSize != sizeof(URL_COMPONENTSW) || !lpdwUrlLength)
5061 {
5063 return FALSE;
5064 }
5065
5066 if (!calc_url_length(lpUrlComponents, &dwLen))
5067 return FALSE;
5068
5069 if (!lpszUrl || *lpdwUrlLength < dwLen)
5070 {
5071 *lpdwUrlLength = (dwLen + 1) * sizeof(WCHAR);
5073 return FALSE;
5074 }
5075
5076 *lpdwUrlLength = dwLen;
5077 lpszUrl[0] = 0x00;
5078
5079 dwLen = 0;
5080
5081 if (lpUrlComponents->lpszScheme)
5082 {
5083 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
5084 memcpy(lpszUrl, lpUrlComponents->lpszScheme, dwLen * sizeof(WCHAR));
5085 lpszUrl += dwLen;
5086
5087 nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
5088 }
5089 else
5090 {
5092 nScheme = lpUrlComponents->nScheme;
5093
5094 if (nScheme == INTERNET_SCHEME_DEFAULT)
5095 nScheme = INTERNET_SCHEME_HTTP;
5096
5098 dwLen = lstrlenW(scheme);
5099 memcpy(lpszUrl, scheme, dwLen * sizeof(WCHAR));
5100 lpszUrl += dwLen;
5101 }
5102
5103 /* all schemes are followed by at least a colon */
5104 *lpszUrl = ':';
5105 lpszUrl++;
5106
5107 if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
5108 {
5109 memcpy(lpszUrl, slashSlashW, sizeof(slashSlashW));
5110 lpszUrl += ARRAY_SIZE(slashSlashW);
5111 }
5112
5113 if (lpUrlComponents->lpszUserName)
5114 {
5115 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
5116 memcpy(lpszUrl, lpUrlComponents->lpszUserName, dwLen * sizeof(WCHAR));
5117 lpszUrl += dwLen;
5118
5119 if (lpUrlComponents->lpszPassword)
5120 {
5121 *lpszUrl = ':';
5122 lpszUrl++;
5123
5124 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Password);
5125 memcpy(lpszUrl, lpUrlComponents->lpszPassword, dwLen * sizeof(WCHAR));
5126 lpszUrl += dwLen;
5127 }
5128
5129 *lpszUrl = '@';
5130 lpszUrl++;
5131 }
5132
5133 if (lpUrlComponents->lpszHostName)
5134 {
5135 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
5136 memcpy(lpszUrl, lpUrlComponents->lpszHostName, dwLen * sizeof(WCHAR));
5137 lpszUrl += dwLen;
5138
5139 if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
5140 {
5141 *lpszUrl++ = ':';
5142 _ltow(lpUrlComponents->nPort, lpszUrl, 10);
5143 lpszUrl += lstrlenW(lpszUrl);
5144 }
5145
5146 /* add slash between hostname and path if necessary */
5147 if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
5148 {
5149 *lpszUrl = '/';
5150 lpszUrl++;
5151 }
5152 }
5153
5154 if (lpUrlComponents->lpszUrlPath)
5155 {
5156 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
5157 memcpy(lpszUrl, lpUrlComponents->lpszUrlPath, dwLen * sizeof(WCHAR));
5158 lpszUrl += dwLen;
5159 }
5160
5161 if (lpUrlComponents->lpszExtraInfo)
5162 {
5163 dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
5164 memcpy(lpszUrl, lpUrlComponents->lpszExtraInfo, dwLen * sizeof(WCHAR));
5165 lpszUrl += dwLen;
5166 }
5167
5168 *lpszUrl = '\0';
5169
5170 return TRUE;
5171}
5172
5173/***********************************************************************
5174 * InternetConfirmZoneCrossingA (WININET.@)
5175 *
5176 */
5178{
5179 FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_a(szUrlPrev), debugstr_a(szUrlNew), bPost);
5180 return ERROR_SUCCESS;
5181}
5182
5183/***********************************************************************
5184 * InternetConfirmZoneCrossingW (WININET.@)
5185 *
5186 */
5188{
5189 FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_w(szUrlPrev), debugstr_w(szUrlNew), bPost);
5190 return ERROR_SUCCESS;
5191}
5192
5194
5195/***********************************************************************
5196 * PrivacySetZonePreferenceW (WININET.@)
5197 */
5199{
5200 FIXME( "%lx %lx %lx %s: stub\n", zone, type, template, debugstr_w(preference) );
5201
5202 zone_preference = template;
5203 return 0;
5204}
5205
5206/***********************************************************************
5207 * PrivacyGetZonePreferenceW (WININET.@)
5208 */
5210 LPWSTR preference, LPDWORD length )
5211{
5212 FIXME( "%lx %lx %p %p %p: stub\n", zone, type, template, preference, length );
5213
5214 if (template) *template = zone_preference;
5215 return 0;
5216}
5217
5218/***********************************************************************
5219 * InternetGetSecurityInfoByURLA (WININET.@)
5220 */
5222{
5223 WCHAR *url;
5224 BOOL res;
5225
5226 TRACE("(%s %p %p)\n", debugstr_a(lpszURL), ppCertChain, pdwSecureFlags);
5227
5228 url = strdupAtoW(lpszURL);
5229 if(!url)
5230 return FALSE;
5231
5232 res = InternetGetSecurityInfoByURLW(url, ppCertChain, pdwSecureFlags);
5233 free(url);
5234 return res;
5235}
5236
5237/***********************************************************************
5238 * InternetGetSecurityInfoByURLW (WININET.@)
5239 */
5241{
5242 URL_COMPONENTSW url = {sizeof(url)};
5244 BOOL res;
5245
5246 TRACE("(%s %p %p)\n", debugstr_w(lpszURL), ppCertChain, pdwSecureFlags);
5247
5248 if (!ppCertChain && !pdwSecureFlags) {
5250 return FALSE;
5251 }
5252
5253 url.dwHostNameLength = 1;
5254 res = InternetCrackUrlW(lpszURL, 0, 0, &url);
5255 if(!res || url.nScheme != INTERNET_SCHEME_HTTPS) {
5257 return FALSE;
5258 }
5259
5260 server = get_server(substr(url.lpszHostName, url.dwHostNameLength), url.nPort, TRUE, FALSE);
5261 if(!server) {
5263 return FALSE;
5264 }
5265
5266 if(server->cert_chain) {
5267 if(pdwSecureFlags)
5268 *pdwSecureFlags = server->security_flags & _SECURITY_ERROR_FLAGS_MASK;
5269
5270 if(ppCertChain && !(*ppCertChain = CertDuplicateCertificateChain(server->cert_chain)))
5271 res = FALSE;
5272 }else {
5274 res = FALSE;
5275 }
5276
5278 return res;
5279}
5280
5282 DWORD_PTR* lpdwConnection, DWORD dwReserved )
5283{
5284 FIXME("(%p, %p, 0x%08lx, %p, 0x%08lx) stub\n", hwndParent, lpszConnectoid, dwFlags,
5285 lpdwConnection, dwReserved);
5286 return ERROR_SUCCESS;
5287}
5288
5290 DWORD_PTR* lpdwConnection, DWORD dwReserved )
5291{
5292 FIXME("(%p, %p, 0x%08lx, %p, 0x%08lx) stub\n", hwndParent, lpszConnectoid, dwFlags,
5293 lpdwConnection, dwReserved);
5294 return ERROR_SUCCESS;
5295}
5296
5298{
5299 FIXME("(%s, %p, 0x%08lx) stub\n", debugstr_a(lpszURL), hwndParent, dwReserved);
5300 return TRUE;
5301}
5302
5304{
5305 FIXME("(%s, %p, 0x%08lx) stub\n", debugstr_w(lpszURL), hwndParent, dwReserved);
5306 return TRUE;
5307}
5308
5310{
5311 FIXME("(0x%08Ix, 0x%08lx) stub\n", dwConnection, dwReserved);
5312 return ERROR_SUCCESS;
5313}
5314
5315BOOL WINAPI CreateMD5SSOHash( PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pwszTarget,
5316 PBYTE pbHexHash )
5317{
5318 FIXME("(%s, %s, %s, %p) stub\n", debugstr_w(pszChallengeInfo), debugstr_w(pwszRealm),
5319 debugstr_w(pwszTarget), pbHexHash);
5320 return FALSE;
5321}
5322
5324{
5325 FIXME("(%p, 0x%08lx) stub\n", hInternet, dwError);
5326 return FALSE;
5327}
5328
5330{
5331 FIXME("(%p, %08Ix) stub\n", a, b);
5332 return FALSE;
5333}
5334
5336{
5337 FIXME("%p: stub\n", parent);
5338 return 0;
5339}
struct mke2fs_defaults settings[]
#define REG_SZ
Definition: layer.c:22
static DWORD const fdwReason
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
static nis_server * get_server(struct sockaddr_in *sin, char *host, nis_server *srv, eps, int maxep)
Definition: auth_time.c:143
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
void user(int argc, const char *argv[])
Definition: cmds.c:1350
char * hostname
Definition: ftp.c:88
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_init(struct list_entry *head)
Definition: list.h:51
__inline int valid_handle(HANDLE handle)
Definition: util.h:281
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:39
static HWND hwndParent
Definition: cryptui.c:299
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define E_INVALIDARG
Definition: ddrawi.h:101
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
DWORD task
Definition: delayimp.cpp:484
HRESULT hr
Definition: delayimp.cpp:582
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DHCPCAPI_REQUEST_SYNCHRONOUS
Definition: dhcpcsdk.h:129
#define OPTION_MSFT_IE_PROXY
Definition: dhcpcsdk.h:87
DWORD APIENTRY DhcpRequestParams(_In_ DWORD Flags, _In_ PVOID Reserved, _In_ LPWSTR AdapterName, _In_ LPDHCPCAPI_CLASSID ClassId, _In_ DHCPCAPI_PARAMS_ARRAY SendParams, _Inout_ DHCPCAPI_PARAMS_ARRAY RecdParams, _In_ LPBYTE Buffer, _Inout_ LPDWORD pSize, _In_ LPWSTR RequestIdStr)
Definition: dhcpcsvc.c:720
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
PCCERT_CHAIN_CONTEXT WINAPI CertDuplicateCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2944
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:61
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define CP_UNIXCP
Definition: compat.h:79
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define wcsnicmp
Definition: compat.h:14
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define GENERIC_READ
Definition: compat.h:135
#define TRACE_ON(x)
Definition: compat.h:75
#define stricmp(_String1, _String2)
Definition: compat.h:24
#define MAX_PATH
Definition: compat.h:34
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define DLL_THREAD_ATTACH
Definition: compat.h:132
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
HINTERNET connection
Definition: port.c:65
LONG refs
Definition: port.c:62
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1301
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1137
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1337
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1227
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:304
HRESULT WINAPI UrlCombineW(const WCHAR *baseW, const WCHAR *relativeW, WCHAR *combined, DWORD *combined_len, DWORD flags)
Definition: path.c:4948
HRESULT WINAPI PathCreateFromUrlW(const WCHAR *url, WCHAR *path, DWORD *pcchPath, DWORD dwReserved)
Definition: path.c:3049
HRESULT WINAPI UrlCanonicalizeA(const char *src_url, char *canonicalized, DWORD *canonicalized_len, DWORD flags)
Definition: path.c:3518
HRESULT WINAPI UrlCombineA(const char *base, const char *relative, char *combined, DWORD *combined_len, DWORD flags)
Definition: path.c:4908
HRESULT WINAPI UrlCanonicalizeW(const WCHAR *src_url, WCHAR *canonicalized, DWORD *canonicalized_len, DWORD flags)
Definition: path.c:4128
DWORD WINAPI DECLSPEC_HOTPATCH TlsAlloc(void)
Definition: thread.c:657
wchar_t *CDECL _wgetenv(const wchar_t *name)
Definition: environ.c:254
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP wchar_t *__cdecl _ltow(__msvcrt_long, wchar_t *, int)
Definition: string.c:2148
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2752
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2998
_ACRTIMP size_t __cdecl wcsnlen(const wchar_t *, size_t)
Definition: wcs.c:2925
_ACRTIMP int __cdecl system(const char *)
Definition: process.c:1297
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3291
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
static wchar_t * wcsdup(const wchar_t *str)
Definition: string.h:94
static wchar_t * wmemchr(const wchar_t *s, wchar_t c, size_t n)
Definition: wchar.h:48
USHORT port
Definition: uri.c:210
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName, DWORD fdwAccess, DWORD dwFlags, DWORD_PTR dwContext)
Definition: ftp.c:1486
HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags)
Definition: ftp.c:2430
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1280
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5710
void server_release(server_t *server)
Definition: http.c:148
DWORD HTTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_PORT serverPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags, HINTERNET *ret)
Definition: http.c:5910
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:229
void free_authorization_cache(void)
Definition: http.c:926
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:3569
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:3253
BOOL WINAPI InternetSetOptionExW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
Definition: internet.c:3873
static const WCHAR szInternetSettings[]
Definition: internet.c:119
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
Definition: internet.c:2386
DWORD WINAPI InternetHangUp(DWORD_PTR dwConnection, DWORD dwReserved)
Definition: internet.c:5309
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2569
static const WCHAR WININET_month[12][4]
Definition: internet.c:3888
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:3286
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
Definition: internet.c:4821
static ULONG send_timeout
Definition: internet.c:113
BOOL WINAPI InternetTimeToSystemTimeA(LPCSTR string, SYSTEMTIME *time, DWORD reserved)
Definition: internet.c:3960
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:244
BOOL WINAPI InternetCheckConnectionA(LPCSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
Definition: internet.c:4196
DWORD INTERNET_AsyncCall(task_header_t *task)
Definition: internet.c:4534
static UINT_PTR next_handle
Definition: internet.c:83
BOOL WINAPI ResumeSuspendedDownload(HINTERNET hInternet, DWORD dwError)
Definition: internet.c:5323
#define CONNECTION_SETTINGS_VERSION
Definition: internet.c:96
static WCHAR * copy_optionW(WCHAR *value)
Definition: internet.c:1011
BOOL WINAPI InternetTimeFromSystemTimeA(const SYSTEMTIME *time, DWORD format, LPSTR string, DWORD size)
Definition: internet.c:3901
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
Definition: internet.c:4651
static CRITICAL_SECTION_DEBUG WININET_cs_debug
Definition: internet.c:74
static BOOL set_url_component(WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len)
Definition: internet.c:1859
BOOL WINAPI InternetAutodialHangup(DWORD dwReserved)
Definition: internet.c:4721
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2710
static WCHAR * get_proxy_autoconfig_url(void)
Definition: internet.c:2918
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:202
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
Definition: internet.c:4680
static LONG INTERNET_LoadProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:753
static const WCHAR * url_schemes[]
Definition: internet.c:2002
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2411
DWORD WINAPI PrivacySetZonePreferenceW(DWORD zone, DWORD type, DWORD template, LPCWSTR preference)
Definition: internet.c:5198
BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl, DWORD dwAutoProxyUrlLength, DWORD dwDetectFlags)
Definition: internet.c:589
BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags, LPSTR lpszUrl, LPDWORD lpdwUrlLength)
Definition: internet.c:4986
DWORD WINAPI ShowClientAuthCerts(HWND parent)
Definition: internet.c:5335
DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove, PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
Definition: internet.c:2534
BOOL WINAPI InternetQueryFortezzaStatus(DWORD *a, DWORD_PTR b)
Definition: internet.c:5329
static DWORD g_dwTlsErrIndex
Definition: internet.c:70
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:2052
static WCHAR * build_wpad_url(const char *hostname, const struct addrinfo *ai)
Definition: internet.c:2849
DWORD create_req_file(const WCHAR *file_name, req_file_t **ret)
Definition: internet.c:4607
static int reverse_lookup(const struct addrinfo *ai, char *hostname, size_t len)
Definition: internet.c:2844
static BOOL parse_proxy_url(proxyinfo_t *info, const WCHAR *url)
Definition: internet.c:616
static BOOL INTERNET_ConfigureProxy(appinfo_t *lpwai)
Definition: internet.c:910
static void free_global_proxy(void)
Definition: internet.c:608
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
Definition: internet.c:2027
BOOL WINAPI InternetGoOnlineA(LPSTR lpszURL, HWND hwndParent, DWORD dwReserved)
Definition: internet.c:5297
BOOL WINAPI InternetCombineUrlA(LPCSTR lpszBaseUrl, LPCSTR lpszRelativeUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:4740
#define URL_GET_COMP_LENGTH(url, component)
Definition: internet.c:4784
DWORD INTERNET_GetLastError(void)
Definition: internet.c:4477
static ULONG max_conns
Definition: internet.c:111
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: internet.c:299
BOOL WINAPI InternetTimeFromSystemTimeW(const SYSTEMTIME *time, DWORD format, LPWSTR string, DWORD size)
Definition: internet.c:3929
BOOL WINAPI InternetFindNextFileW(HINTERNET hFind, LPVOID lpvFindData)
Definition: internet.c:1803
BOOL WINAPI InternetFindNextFileA(HINTERNET hFind, LPVOID lpvFindData)
Definition: internet.c:1782
LPSTR INTERNET_GetResponseBuffer(void)
Definition: internet.c:4556
static void invalidate_handle(object_header_t *info)
Definition: internet.c:226
BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2437
BOOL WINAPI InternetTimeToSystemTimeW(LPCWSTR string, SYSTEMTIME *time, DWORD reserved)
Definition: internet.c:3979
BOOL WINAPI InternetGetLastResponseInfoW(LPDWORD lpdwError, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:1489
static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:1042
#define URL_GET_COMP_LENGTHA(url, component)
Definition: internet.c:4786
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:2925
static ULONG max_1_0_conns
Definition: internet.c:111
static void dump_INTERNET_FLAGS(DWORD dwFlags)
Definition: internet.c:944
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
Definition: internet.c:2609
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:4456
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
Definition: internet.c:5050
static CRITICAL_SECTION WININET_cs
Definition: internet.c:73
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: internet.c:2819
BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
Definition: internet.c:5240
static proxyinfo_t global_proxy
Definition: internet.c:606
static ULONG data_send_timeout
Definition: internet.c:115
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1411
DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
Definition: internet.c:3309
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:4341
void req_file_release(req_file_t *req_file)
Definition: internet.c:4634
static ULONG data_receive_timeout
Definition: internet.c:116
static BOOL set_url_component_WtoA(const WCHAR *comp_w, DWORD length, const WCHAR *url_w, char **comp, DWORD *ret_length, const char *url_a)
Definition: internet.c:1884
HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
Definition: internet.c:350
BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:3727
static LONG load_connection_settings(HKEY key, const WCHAR *connection, proxyinfo_t *lpwpi)
Definition: internet.c:699
DWORD WINAPI InternetAttemptConnect(DWORD dwReserved)
Definition: internet.c:2368
BOOL WINAPI InternetGetSecurityInfoByURLA(LPSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
Definition: internet.c:5221
static object_header_t ** handle_table
Definition: internet.c:82
static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:4222
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:597
static INTERNET_STATUS_CALLBACK set_status_callback(object_header_t *lpwh, INTERNET_STATUS_CALLBACK callback, BOOL unicode)
Definition: internet.c:2455
WCHAR * INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto)
Definition: internet.c:511
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:4398
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2480
static BOOL is_time_digit(const WCHAR c)
Definition: internet.c:3893
BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2672
static LONG connection_settings_read(const connection_settings *settings, DWORD *pos, DWORD size, WCHAR **str)
Definition: internet.c:668
struct WITHREADERROR * LPWITHREADERROR
static DWORD zone_preference
Definition: internet.c:5193
static WCHAR * detect_proxy_autoconfig_url_dhcp(void)
Definition: internet.c:2762
static WCHAR * get_http_proxy(const WCHAR *proxy)
Definition: internet.c:651
void * alloc_async_task(object_header_t *hdr, async_task_proc_t proc, size_t size)
Definition: internet.c:4513
DWORD WINAPI InternetConfirmZoneCrossingW(HWND hWnd, LPWSTR szUrlPrev, LPWSTR szUrlNew, BOOL bPost)
Definition: internet.c:5187
static BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
Definition: internet.c:4812
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2508
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:209
BOOL WINAPI InternetAutodial(DWORD dwFlags, HWND hwndParent)
Definition: internet.c:4701
DWORD WINAPI PrivacyGetZonePreferenceW(DWORD zone, DWORD type, LPDWORD template, LPWSTR preference, LPDWORD length)
Definition: internet.c:5209
DWORD WINAPI InternetDialA(HWND hwndParent, LPSTR lpszConnectoid, DWORD dwFlags, DWORD_PTR *lpdwConnection, DWORD dwReserved)
Definition: internet.c:5281
static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPONENTSW urlCompW)
Definition: internet.c:4916
#define FE(x)
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1841
BOOL WINAPI CreateMD5SSOHash(PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pwszTarget, PBYTE pbHexHash)
Definition: internet.c:5315
BOOL WINAPI InternetCrackUrlA(const char *url, DWORD url_length, DWORD flags, URL_COMPONENTSA *ret_comp)
Definition: internet.c:1933
static void connection_settings_write(connection_settings *settings, DWORD *pos, DWORD size, const WCHAR *str)
Definition: internet.c:356
BOOL WINAPI InternetGetConnectedStateExW(LPDWORD lpdwStatus, LPWSTR lpszConnectionName, DWORD dwNameLen, DWORD dwReserved)
Definition: internet.c:1569
static LONG save_connection_settings(HKEY key, const WCHAR *connection, proxyinfo_t *lpwpi)
Definition: internet.c:371
static DWORD set_global_option(DWORD option, void *buf, DWORD size)
Definition: internet.c:3350
BOOL WINAPI InternetCheckConnectionW(LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
Definition: internet.c:4080
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:3159
static WCHAR * detect_proxy_autoconfig_url_dns(void)
Definition: internet.c:2869
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
Definition: internet.c:4789
BOOL WINAPI InternetCombineUrlW(LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:4766
BOOL WINAPI InternetGetConnectedState(LPDWORD lpdwStatus, DWORD dwReserved)
Definition: internet.c:1534
static IP_ADAPTER_ADDRESSES * get_adapters(void)
Definition: internet.c:2743
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:4578
BOOL WINAPI InternetGetLastResponseInfoA(LPDWORD lpdwError, LPSTR lpszBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:1442
static ULONG connect_timeout
Definition: internet.c:112
static void init_global_proxy(void)
Definition: internet.c:860
BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectionName, DWORD dwNameLen, DWORD dwReserved)
Definition: internet.c:1649
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1748
static BOOL is_domain_suffix(const char *domain, const char *suffix)
Definition: internet.c:2835
static char * copy_optionA(WCHAR *value)
Definition: internet.c:1026
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1685
static const WCHAR WININET_wkday[7][4]
Definition: internet.c:3885
static const object_vtbl_t APPINFOVtbl
Definition: internet.c:1312
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:4429
static ULONG receive_timeout
Definition: internet.c:114
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1334
static UINT_PTR handle_table_size
Definition: internet.c:84
void * alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size)
Definition: internet.c:124
static VOID APPINFO_Destroy(object_header_t *hdr)
Definition: internet.c:998
static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
Definition: internet.c:1911
static LONG INTERNET_GetProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:892
static LONG INTERNET_SaveProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:406
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:3457
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
Definition: internet.c:4495
BOOL WINAPI InternetGoOnlineW(LPWSTR lpszURL, HWND hwndParent, DWORD dwReserved)
Definition: internet.c:5303
BOOL WINAPI InternetInitializeAutoProxyDll(DWORD dwReserved)
Definition: internet.c:573
HMODULE WININET_hModule
Definition: internet.c:71
#define MAX_WORD_DIGITS
Definition: internet.c:4782
static DWORD APPINFO_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
Definition: internet.c:1248
static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents, LPDWORD lpdwUrlLength)
Definition: internet.c:4835
DWORD WINAPI InternetConfirmZoneCrossingA(HWND hWnd, LPSTR szUrlPrev, LPSTR szUrlNew, BOOL bPost)
Definition: internet.c:5177
static void AsyncInternetOpenUrlProc(task_header_t *hdr)
Definition: internet.c:4329
DWORD WINAPI InternetDialW(HWND hwndParent, LPWSTR lpszConnectoid, DWORD dwFlags, DWORD_PTR *lpdwConnection, DWORD dwReserved)
Definition: internet.c:5289
BOOL WINAPI InternetSetOptionExA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
Definition: internet.c:3863
#define IDS_LANCONNECTION
Definition: resource.h:38
void init_winsock(void)
Definition: dpnet_main.c:55
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
r reserved
Definition: btrfs.c:3006
#define SOCK_STREAM
Definition: tcpip.h:118
#define AF_INET
Definition: tcpip.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
int proxy
Definition: main.c:67
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum GLuint components
Definition: glext.h:9620
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLbitfield flags
Definition: glext.h:7161
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLuint GLuint num
Definition: glext.h:9618
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint id
Definition: glext.h:5910
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
static const WCHAR optionW[]
Definition: htmlelem.c:36
@ extra
Definition: id3.c:95
VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwStatusInfoLength)
static void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
Definition: internet.h:180
static substr_t substr(const WCHAR *str, size_t len)
Definition: internet.h:169
@ COLLECT_CONNECTIONS
Definition: internet.h:60
@ COLLECT_CLEANUP
Definition: internet.h:61
static WCHAR * strndupAtoW(const char *str, int len_a, DWORD *len_w)
Definition: internet.h:112
#define INET_OPENURL
Definition: internet.h:209
@ WH_HHTTPSESSION
Definition: internet.h:203
@ WH_HFTPSESSION
Definition: internet.h:201
@ WH_HINIT
Definition: internet.h:200
void NETCON_unload(void)
void free_urlcache(void)
Definition: urlcache.c:4124
#define _SECURITY_ERROR_FLAGS_MASK
Definition: internet.h:445
void(* async_task_proc_t)(task_header_t *)
Definition: internet.h:353
BOOL init_urlcache(void)
Definition: urlcache.c:4106
#define INET_CALLBACKW
Definition: internet.h:210
BOOL GetAddress(const WCHAR *, INTERNET_PORT, SOCKADDR *, int *, char *)
Definition: utility.c:47
#define S_OK
Definition: intsafe.h:52
#define GAA_FLAG_SKIP_FRIENDLY_NAME
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
Definition: compname.c:376
#define IF_TYPE_SOFTWARE_LOOPBACK
Definition: ipifcons.h:44
char hdr[14]
Definition: iptest.cpp:33
uint32_t entry
Definition: isohybrid.c:63
#define b
Definition: ke_i.h:79
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
static IN DWORD IN LPVOID lpvReserved
#define ZeroMemory
Definition: minwinbase.h:31
CONST void * LPCVOID
Definition: minwindef.h:164
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
char string[160]
Definition: util.h:11
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
static IPrintDialogCallback callback
Definition: printdlg.c:325
static const WCHAR url[]
Definition: encode.c:1384
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static const WCHAR stringW[]
Definition: reg.c:42
static void ULONG ULONG * ret_size
Definition: time.c:40
static LPCWSTR file_name
Definition: protocol.c:152
DWORD zone
Definition: sec_mgr.c:1728
static HWND child
Definition: cursoricon.c:298
static int priority
Definition: timer.c:163
#define min(a, b)
Definition: monoChain.cc:55
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ HANDLE hFile
Definition: mswsock.h:90
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define closesocket
Definition: ncftp.h:477
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
_Out_ PVOID pReserved
Definition: netsh.h:77
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define REG_BINARY
Definition: nt_native.h:1499
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
static HANDLE proc()
Definition: pdb.c:32
BYTE * PBYTE
Definition: pedump.c:66
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
#define MAX_ADAPTER_NAME_LENGTH
Definition: iptypes.h:16
#define URL_ESCAPE_UNSAFE
Definition: shlwapi.h:533
#define URL_NO_META
Definition: shlwapi.h:538
#define URL_WININET_COMPATIBILITY
Definition: shlwapi.h:535
#define URL_UNESCAPE
Definition: shlwapi.h:532
#define URL_ESCAPE_SPACES_ONLY
Definition: shlwapi.h:530
#define URL_BROWSER_MODE
Definition: shlwapi.h:540
#define URL_ESCAPE_PERCENT
Definition: shlwapi.h:521
#define err(...)
#define equal(x, y)
Definition: reader.cc:56
#define MAX_REPLY_LEN
Definition: request.c:2622
#define calloc
Definition: rosglue.h:14
const WCHAR * str
DWORD scheme
#define REG_DWORD
Definition: sdbapi.c:615
#define iswalnum(_c)
Definition: ctype.h:671
#define iswalpha(_c)
Definition: ctype.h:664
#define CP_UTF8
Definition: nls.h:20
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
int errcode
Definition: crtdefs.h:222
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
#define LoadStringW
Definition: utils.h:64
static int fd
Definition: io.c:51
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:37
vector< Header * > headers
Definition: sdkparse.cpp:39
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
#define TRACE(s)
Definition: solgame.cpp:4
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD dwMinorVersion
Definition: winhttp.h:681
DWORD dwMajorVersion
Definition: winhttp.h:680
LPCWSTR lpszProxyBypass
Definition: wininet.h:168
INTERNET_SCHEME nScheme
Definition: wininet.h:196
LPSTR lpszScheme
Definition: wininet.h:194
DWORD dwSchemeLength
Definition: wininet.h:195
DWORD dwExtraInfoLength
Definition: wininet.h:207
DWORD dwUrlPathLength
Definition: wininet.h:205
DWORD dwStructSize
Definition: wininet.h:193
DWORD dwUserNameLength
Definition: wininet.h:201
LPSTR lpszExtraInfo
Definition: wininet.h:206
DWORD dwPasswordLength
Definition: wininet.h:203
LPSTR lpszPassword
Definition: wininet.h:202
LPSTR lpszUserName
Definition: wininet.h:200
DWORD dwHostNameLength
Definition: wininet.h:198
LPSTR lpszHostName
Definition: wininet.h:197
LPSTR lpszUrlPath
Definition: wininet.h:204
INTERNET_PORT nPort
Definition: wininet.h:199
DWORD dwStructSize
Definition: wininet.h:211
DWORD dwUrlPathLength
Definition: wininet.h:223
DWORD dwExtraInfoLength
Definition: wininet.h:225
LPWSTR lpszPassword
Definition: wininet.h:220
LPWSTR lpszHostName
Definition: wininet.h:215
DWORD dwUserNameLength
Definition: wininet.h:219
DWORD dwHostNameLength
Definition: wininet.h:216
INTERNET_SCHEME nScheme
Definition: wininet.h:214
LPWSTR lpszScheme
Definition: wininet.h:212
LPWSTR lpszUserName
Definition: wininet.h:218
LPWSTR lpszUrlPath
Definition: wininet.h:222
LPWSTR lpszExtraInfo
Definition: wininet.h:224
DWORD dwPasswordLength
Definition: wininet.h:221
INTERNET_PORT nPort
Definition: wininet.h:217
DWORD dwSchemeLength
Definition: wininet.h:213
INTERNET_PORT nPort
Definition: winhttp.h:543
LPWSTR lpszScheme
Definition: winhttp.h:538
LPWSTR lpszUserName
Definition: winhttp.h:544
LPWSTR lpszExtraInfo
Definition: winhttp.h:550
DWORD dwPasswordLength
Definition: winhttp.h:547
LPWSTR lpszUrlPath
Definition: winhttp.h:548
DWORD dwHostNameLength
Definition: winhttp.h:542
DWORD dwExtraInfoLength
Definition: winhttp.h:551
DWORD dwUrlPathLength
Definition: winhttp.h:549
LPWSTR lpszHostName
Definition: winhttp.h:541
LPWSTR lpszPassword
Definition: winhttp.h:546
INTERNET_SCHEME nScheme
Definition: winhttp.h:540
DWORD dwStructSize
Definition: winhttp.h:537
DWORD dwUserNameLength
Definition: winhttp.h:545
DWORD dwSchemeLength
Definition: winhttp.h:539
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:67
DWORD dwError
Definition: internet.c:66
LPDHCPCAPI_PARAMS Params
Definition: dhcpcsdk.h:111
DWORD dwStructSize
Definition: wininet.h:259
DWORD dwBufferLength
Definition: wininet.h:265
LPVOID lpvBuffer
Definition: wininet.h:264
union _INTERNET_PER_CONN_OPTIONA::@4112 Value
union _INTERNET_PER_CONN_OPTIONW::@4113 Value
LPINTERNET_PER_CONN_OPTIONA pOptions
Definition: wininet.h:364
LPINTERNET_PER_CONN_OPTIONW pOptions
Definition: wininet.h:372
WH_TYPE htype
Definition: internet.h:240
HINTERNET hInternet
Definition: internet.h:242
DWORD dwInternalFlags
Definition: internet.h:253
const object_vtbl_t * vtbl
Definition: internet.h:241
DWORD_PTR dwContext
Definition: internet.h:250
INTERNET_STATUS_CALLBACK lpfnStatusCB
Definition: internet.h:256
size_t ai_addrlen
Definition: ws2def.h:675
struct sockaddr * ai_addr
Definition: ws2def.h:677
struct addrinfo * ai_next
Definition: ws2def.h:678
int ai_family
Definition: ws2def.h:672
LPWSTR proxy
Definition: internet.h:265
LPWSTR proxyBypass
Definition: internet.h:266
DWORD accessType
Definition: internet.h:269
LPWSTR agent
Definition: internet.h:264
LPWSTR proxyPassword
Definition: internet.h:268
object_header_t hdr
Definition: internet.h:263
LPWSTR proxyUsername
Definition: internet.h:267
Definition: cookie.c:42
Definition: txthost.c:37
Definition: copy.c:22
Definition: name.c:39
DWORD(* SetOption)(object_header_t *, DWORD, void *, DWORD)
Definition: internet.h:227
DWORD(* WriteFile)(object_header_t *, const void *, DWORD, DWORD *)
Definition: internet.h:230
WCHAR * headers
Definition: internet.c:4323
DWORD headers_len
Definition: internet.c:4324
task_header_t hdr
Definition: internet.c:4321
DWORD_PTR context
Definition: internet.c:4326
Definition: getopt.h:109
LPWSTR proxyPassword
Definition: internet.c:92
LPWSTR autoconf_url
Definition: internet.c:93
DWORD flags
Definition: internet.c:88
LPWSTR proxyUsername
Definition: internet.c:91
LPWSTR proxy
Definition: internet.c:89
LPWSTR proxyBypass
Definition: internet.c:90
LONG ref
Definition: internet.h:214
WCHAR * file_name
Definition: internet.h:216
WCHAR * url
Definition: internet.h:217
BOOL is_committed
Definition: internet.h:218
HANDLE file_handle
Definition: internet.h:215
ADDRESS_FAMILY ss_family
Definition: ws2def.h:406
Definition: ps.c:97
const char * name
Definition: internet.h:436
PSYMCRYPT_PARALLEL_HASH_OPERATION next
@ Password
Definition: telnetd.h:67
#define DWORD_PTR
Definition: treelist.c:76
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
uint32_t * LPDWORD
Definition: typedefs.h:59
char * LPSTR
Definition: typedefs.h:51
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
pass
Definition: typegen.h:25
Definition: pdh_main.c:64
static WCHAR * strndupW(LPCWSTR str, int len)
Definition: urlmon_main.h:236
static rfbScreenInfoPtr server
Definition: vnc.c:74
int codepage
Definition: win_iconv.c:156
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:529
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2442
#define WINAPI
Definition: msvc.h:6
#define swprintf
Definition: winemm.h:209
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307
#define ERROR_NO_DATA
Definition: winerror.h:406
#define E_POINTER
Definition: winerror.h:3480
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:354
#define ERROR_NOT_CONNECTED
Definition: winerror.h:1566
WORD INTERNET_PORT
Definition: winhttp.h:43
LPVOID HINTERNET
Definition: winhttp.h:37
#define INTERNET_SCHEME_FTP
Definition: winhttp.h:49
#define ICU_NO_META
Definition: winhttp.h:354
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:1018
#define ICU_ENCODE_SPACES_ONLY
Definition: winhttp.h:355
#define ICU_DECODE
Definition: winhttp.h:353
#define INTERNET_SCHEME_HTTP
Definition: winhttp.h:47
#define ICU_BROWSER_MODE
Definition: winhttp.h:356
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:41
#define ICU_NO_ENCODE
Definition: winhttp.h:352
#define INTERNET_SCHEME_HTTPS
Definition: winhttp.h:48
#define ICU_ENCODE_PERCENT
Definition: winhttp.h:357
#define INTERNET_DEFAULT_HTTPS_PORT
Definition: winhttp.h:42
void free_cookie(void)
Definition: cookie.c:1269
#define AUTO_PROXY_FLAG_ALWAYS_DETECT
Definition: wininet.h:352
#define INTERNET_OPTION_CONNECTED_STATE
Definition: wininet.h:744
#define INTERNET_FLAG_FROM_CACHE
Definition: wininet.h:69
#define INTERNET_DEFAULT_FTP_PORT
Definition: wininet.h:38
#define INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS
Definition: wininet.h:340
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define INTERNET_ERROR_MASK_COMBINED_SEC_CERT
Definition: wininet.h:125
#define INTERNET_OPTION_CODEPAGE
Definition: wininet.h:760
#define INTERNET_FLAG_NO_AUTO_REDIRECT
Definition: wininet.h:73
#define INTERNET_OPTION_SECURITY_FLAGS
Definition: wininet.h:725
#define INTERNET_OPTION_PROXY_PASSWORD
Definition: wininet.h:738
#define PROXY_TYPE_AUTO_PROXY_URL
Definition: wininet.h:348
#define INTERNET_CONNECTION_MODEM
Definition: wininet.h:2538
#define INTERNET_FLAG_RELOAD
Definition: wininet.h:61
#define INTERNET_FLAG_RESYNCHRONIZE
Definition: wininet.h:82
#define INTERNET_PER_CONN_FLAGS
Definition: wininet.h:334
#define INTERNET_OPTION_PROXY_USERNAME
Definition: wininet.h:737
#define INTERNET_PER_CONN_AUTODISCOVERY_FLAGS
Definition: wininet.h:338
#define INTERNET_FLAG_RAW_DATA
Definition: wininet.h:62
#define INTERNET_FLAG_TRANSFER_ASCII
Definition: wininet.h:90
#define INTERNET_FLAG_ASYNC
Definition: wininet.h:64
#define INTERNET_OPTION_DATA_SEND_TIMEOUT
Definition: wininet.h:708
#define INTERNET_FLAG_NO_COOKIES
Definition: wininet.h:75
#define INTERNET_RFC1123_FORMAT
Definition: wininet.h:407
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735
#define INTERNET_CONNECTION_OFFLINE
Definition: wininet.h:2543
#define INTERNET_SERVICE_FTP
Definition: wininet.h:560
VOID(CALLBACK * INTERNET_STATUS_CALLBACK)(_In_ HINTERNET, _In_opt_ DWORD_PTR, _In_ DWORD, _In_opt_ LPVOID, _In_ DWORD)
Definition: wininet.h:859
#define ERROR_INTERNET_ASYNC_THREAD_FAILED
Definition: wininet.h:2035
#define ERROR_INTERNET_ITEM_NOT_FOUND
Definition: wininet.h:2017
#define INTERNET_OPTION_CONNECT_RETRIES
Definition: wininet.h:702
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define INTERNET_ERROR_MASK_INSERT_CDROM
Definition: wininet.h:124
#define INTERNET_OPTION_IGNORE_OFFLINE
Definition: wininet.h:767
#define INTERNET_OPTION_PASSWORD
Definition: wininet.h:723
#define PROXY_TYPE_DIRECT
Definition: wininet.h:346
#define INTERNET_OPTION_IDN
Definition: wininet.h:792
#define INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY
Definition: wininet.h:127
struct _INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LISTW
#define INTERNET_OPTION_CONNECT_TIMEOUT
Definition: wininet.h:701
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
#define ERROR_INTERNET_OPTION_NOT_SETTABLE
Definition: wininet.h:2000
#define INTERNET_FLAG_NEED_FILE
Definition: wininet.h:88
#define INTERNET_CONNECTION_LAN
Definition: wininet.h:2539
#define INTERNET_PER_CONN_AUTOCONFIG_URL
Definition: wininet.h:337
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
#define INTERNET_FLAG_TRANSFER_BINARY
Definition: wininet.h:91
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY
Definition: wininet.h:524
#define INTERNET_FLAG_CACHE_ASYNC
Definition: wininet.h:86
#define INTERNET_FLAG_SECURE
Definition: wininet.h:71
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
#define INTERNET_HANDLE_TYPE_INTERNET
Definition: wininet.h:802
#define INTERNET_FLAG_HYPERLINK
Definition: wininet.h:83
#define INTERNET_FLAG_NO_UI
Definition: wininet.h:84
#define INTERNET_FLAG_MAKE_PERSISTENT
Definition: wininet.h:68
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
#define INTERNET_PER_CONN_PROXY_SERVER
Definition: wininet.h:335
#define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT
Definition: wininet.h:709
INTERNET_SCHEME
Definition: wininet.h:135
@ INTERNET_SCHEME_FILE
Definition: wininet.h:143
@ INTERNET_SCHEME_RES
Definition: wininet.h:149
@ INTERNET_SCHEME_FIRST
Definition: wininet.h:150
@ INTERNET_SCHEME_DEFAULT
Definition: wininet.h:138
@ INTERNET_SCHEME_UNKNOWN
Definition: wininet.h:137
@ INTERNET_SCHEME_GOPHER
Definition: wininet.h:140
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define FLAG_ICC_FORCE_CONNECTION
Definition: wininet.h:1904
#define INTERNET_OPTION_PROXY
Definition: wininet.h:732
#define INTERNET_RFC1123_BUFSIZE
Definition: wininet.h:408
#define INTERNET_PER_CONN_FLAGS_UI
Definition: wininet.h:343
#define INTERNET_OPTION_COOKIES_3RD_PARTY
Definition: wininet.h:776
#define INTERNET_OPTION_CODEPAGE_PATH
Definition: wininet.h:790
#define INTERNET_PER_CONN_PROXY_BYPASS
Definition: wininet.h:336
#define INTERNET_CONNECTION_PROXY
Definition: wininet.h:2540
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005
#define INTERNET_OPTION_RESET_URLCACHE_SESSION
Definition: wininet.h:754
#define INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL
Definition: wininet.h:339
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define INTERNET_OPTION_PER_CONNECTION_OPTION
Definition: wininet.h:765
#define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL
Definition: wininet.h:342
#define INTERNET_INVALID_PORT_NUMBER
Definition: wininet.h:36
#define INTERNET_FLAG_READ_PREFETCH
Definition: wininet.h:74
#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
Definition: wininet.h:80
#define INTERNET_OPTION_DISABLE_PASSPORT_AUTH
Definition: wininet.h:777
#define INTERNET_FLAG_CACHE_IF_NET_FAIL
Definition: wininet.h:77
#define INTERNET_OPTION_SEND_TIMEOUT
Definition: wininet.h:704
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define INTERNET_DEFAULT_GOPHER_PORT
Definition: wininet.h:39
#define INTERNET_OPTION_DISABLE_AUTODIAL
Definition: wininet.h:762
#define INTERNET_OPTION_VERSION
Definition: wininet.h:734
#define INTERNET_STATE_CONNECTED
Definition: wininet.h:909
#define INTERNET_OPTION_RECEIVE_TIMEOUT
Definition: wininet.h:706
#define INTERNET_OPTION_ERROR_MASK
Definition: wininet.h:755
#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID
Definition: wininet.h:81
#define INTERNET_OPTION_CODEPAGE_EXTRA
Definition: wininet.h:791
#define ERROR_INTERNET_INVALID_OPTION
Definition: wininet.h:1998
#define INTERNET_OPTION_SUPPRESS_BEHAVIOR
Definition: wininet.h:771
#define INTERNET_RAS_INSTALLED
Definition: wininet.h:2542
#define INTERNET_OPTION_POLICY
Definition: wininet.h:742
#define INTERNET_OPTION_HTTP_VERSION
Definition: wininet.h:753
#define INTERNET_OPTION_CONTEXT_VALUE
Definition: wininet.h:739
#define INTERNET_OPTION_HANDLE_TYPE
Definition: wininet.h:710
#define INTERNET_FLAG_FORMS_SUBMIT
Definition: wininet.h:87
#define ISO_VALID_FLAGS
Definition: wininet.h:699
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define INTERNET_INVALID_STATUS_CALLBACK
Definition: wininet.h:915
#define INTERNET_OPTION_REFRESH
Definition: wininet.h:731
#define ERROR_INTERNET_BAD_OPTION_LENGTH
Definition: wininet.h:1999
#define INTERNET_FLAG_EXISTING_CONNECT
Definition: wininet.h:63
#define PROXY_TYPE_PROXY
Definition: wininet.h:347
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
Definition: wininet.h:78
#define INTERNET_OPTION_USERNAME
Definition: wininet.h:722
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
Definition: wininet.h:79
#define INTERNET_OPTION_HTTP_DECODING
Definition: wininet.h:758
#define INTERNET_OPTION_SETTINGS_CHANGED
Definition: wininet.h:733
#define INTERNET_OPTION_REQUEST_PRIORITY
Definition: wininet.h:752
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME
Definition: wininet.h:1995
#define INTERNET_OPTION_END_BROWSER_SESSION
Definition: wininet.h:736
#define INTERNET_OPTION_CALLBACK
Definition: wininet.h:700
#define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME
Definition: wininet.h:341
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
#define INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY
Definition: wininet.h:778
#define INTERNET_FLAG_NO_AUTH
Definition: wininet.h:76
#define INTERNET_OPTION_REQUEST_FLAGS
Definition: wininet.h:718
#define PROXY_TYPE_AUTO_DETECT
Definition: wininet.h:349
#define INTERNET_SERVICE_GOPHER
Definition: wininet.h:561
#define INTERNET_PROXY_INFOA
Definition: wininet_test.h:55
#define LPINTERNET_PROXY_INFOA
Definition: wininet_test.h:82
#define LPINTERNET_PROXY_INFOW
Definition: wininet_test.h:83
#define INTERNET_PROXY_INFOW
Definition: wininet_test.h:56
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1105
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define AF_INET6
Definition: winsock.h:363
#define AF_UNSPEC
Definition: winsock.h:338
#define AI_ALL
Definition: ws2def.h:298
#define AI_DNS_ONLY
Definition: ws2def.h:312
#define NI_MAXHOST
Definition: ws2def.h:365
#define getaddrinfo
Definition: wspiapi.h:44
#define getnameinfo
Definition: wspiapi.h:45
#define freeaddrinfo
Definition: wspiapi.h:46
unsigned char BYTE
Definition: xxhash.c:193