ReactOS  0.4.14-dev-593-g1793dcc
session.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Hans Leidekker for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include "config.h"
20 #include <stdarg.h>
21 #include <stdlib.h>
22 
23 #ifdef HAVE_CORESERVICES_CORESERVICES_H
24 #define GetCurrentThread MacGetCurrentThread
25 #define LoadResource MacLoadResource
26 #include <CoreServices/CoreServices.h>
27 #undef GetCurrentThread
28 #undef LoadResource
29 #endif
30 
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winsock2.h"
34 #include "ws2ipdef.h"
35 #include "ws2tcpip.h"
36 #include "winhttp.h"
37 #include "winreg.h"
38 #include "wine/winternl.h"
39 #define COBJMACROS
40 #include "ole2.h"
41 #include "dispex.h"
42 #include "activscp.h"
43 
44 #include "wine/debug.h"
45 #include "winhttp_private.h"
46 
48 
49 #define DEFAULT_RESOLVE_TIMEOUT 0
50 #define DEFAULT_CONNECT_TIMEOUT 20000
51 #define DEFAULT_SEND_TIMEOUT 30000
52 #define DEFAULT_RECEIVE_TIMEOUT 30000
53 #define DEFAULT_RECEIVE_RESPONSE_TIMEOUT ~0u
54 
55 void send_callback( struct object_header *hdr, DWORD status, void *info, DWORD buflen )
56 {
57  if (hdr->callback && (hdr->notify_mask & status))
58  {
59  TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen);
60  hdr->callback( hdr->handle, hdr->context, status, info, buflen );
61  TRACE("returning from 0x%08x callback\n", status);
62  }
63 }
64 
65 /***********************************************************************
66  * WinHttpCheckPlatform (winhttp.@)
67  */
69 {
70  TRACE("\n");
71  return TRUE;
72 }
73 
74 /***********************************************************************
75  * session_destroy (internal)
76  */
77 static void session_destroy( struct object_header *hdr )
78 {
79  struct session *session = (struct session *)hdr;
80 
81  TRACE("%p\n", session);
82 
85 
86  session->cs.DebugInfo->Spare[0] = 0;
93  heap_free( session );
94 }
95 
96 static BOOL session_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
97 {
98  struct session *session = (struct session *)hdr;
99 
100  switch (option)
101  {
103  {
104  if (!buffer || *buflen < sizeof(DWORD))
105  {
106  *buflen = sizeof(DWORD);
108  return FALSE;
109  }
110 
111  *(DWORD *)buffer = hdr->redirect_policy;
112  *buflen = sizeof(DWORD);
113  return TRUE;
114  }
117  *buflen = sizeof(DWORD);
118  return TRUE;
119 
122  *buflen = sizeof(DWORD);
123  return TRUE;
124 
127  *buflen = sizeof(DWORD);
128  return TRUE;
129 
132  *buflen = sizeof(DWORD);
133  return TRUE;
134 
137  *buflen = sizeof(DWORD);
138  return TRUE;
139 
140  default:
141  FIXME("unimplemented option %u\n", option);
143  return FALSE;
144  }
145 }
146 
147 static BOOL session_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
148 {
149  struct session *session = (struct session *)hdr;
150 
151  switch (option)
152  {
154  {
156 
157  FIXME("%u %s %s\n", pi->dwAccessType, debugstr_w(pi->lpszProxy), debugstr_w(pi->lpszProxyBypass));
158  return TRUE;
159  }
161  {
162  DWORD policy;
163 
164  if (buflen != sizeof(policy))
165  {
167  return FALSE;
168  }
169 
170  policy = *(DWORD *)buffer;
171  TRACE("0x%x\n", policy);
172  hdr->redirect_policy = policy;
173  return TRUE;
174  }
176  {
177  if (buflen != sizeof(session->secure_protocols))
178  {
180  return FALSE;
181  }
185  TRACE("0x%x\n", session->secure_protocols);
186  return TRUE;
187  }
190  return FALSE;
191 
194  return TRUE;
195 
198  return TRUE;
199 
202  return TRUE;
203 
206  return TRUE;
207 
210  return TRUE;
211 
214  return TRUE;
215 
217  TRACE("WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: %p\n", *(HANDLE *)buffer);
219  return TRUE;
220 
222  FIXME("WINHTTP_OPTION_MAX_CONNS_PER_SERVER: %d\n", *(DWORD *)buffer);
223  return TRUE;
224 
226  FIXME("WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: %d\n", *(DWORD *)buffer);
227  return TRUE;
228 
229  default:
230  FIXME("unimplemented option %u\n", option);
232  return FALSE;
233  }
234 }
235 
236 static const struct object_vtbl session_vtbl =
237 {
241 };
242 
243 /***********************************************************************
244  * WinHttpOpen (winhttp.@)
245  */
247 {
248  struct session *session;
250 
251  TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
252 
253  if (!(session = heap_alloc_zero( sizeof(struct session) ))) return NULL;
254 
256  session->hdr.vtbl = &session_vtbl;
257  session->hdr.flags = flags;
258  session->hdr.refs = 1;
260  list_init( &session->hdr.children );
268  session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": session.cs");
269 
270  if (agent && !(session->agent = strdupW( agent ))) goto end;
272  {
274 
276  session->access = info.dwAccessType;
277  if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
278  {
279  GlobalFree( (LPWSTR)info.lpszProxy );
280  GlobalFree( (LPWSTR)info.lpszProxyBypass );
281  goto end;
282  }
283  if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
284  {
285  GlobalFree( (LPWSTR)info.lpszProxy );
286  GlobalFree( (LPWSTR)info.lpszProxyBypass );
287  goto end;
288  }
289  }
291  {
292  session->access = access;
293  if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end;
294  if (bypass && !(session->proxy_bypass = strdupW( bypass ))) goto end;
295  }
296 
297  if (!(handle = alloc_handle( &session->hdr ))) goto end;
298  session->hdr.handle = handle;
299 
300 end:
302  TRACE("returning %p\n", handle);
304  return handle;
305 }
306 
307 /***********************************************************************
308  * connect_destroy (internal)
309  */
310 static void connect_destroy( struct object_header *hdr )
311 {
312  struct connect *connect = (struct connect *)hdr;
313 
314  TRACE("%p\n", connect);
315 
316  release_object( &connect->session->hdr );
317 
322  heap_free( connect );
323 }
324 
325 static BOOL connect_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
326 {
327  struct connect *connect = (struct connect *)hdr;
328 
329  switch (option)
330  {
332  {
333  if (!buffer || *buflen < sizeof(HINTERNET))
334  {
335  *buflen = sizeof(HINTERNET);
337  return FALSE;
338  }
339 
340  *(HINTERNET *)buffer = ((struct object_header *)connect->session)->handle;
341  *buflen = sizeof(HINTERNET);
342  return TRUE;
343  }
345  *(DWORD *)buffer = connect->session->resolve_timeout;
346  *buflen = sizeof(DWORD);
347  return TRUE;
348 
350  *(DWORD *)buffer = connect->session->connect_timeout;
351  *buflen = sizeof(DWORD);
352  return TRUE;
353 
355  *(DWORD *)buffer = connect->session->send_timeout;
356  *buflen = sizeof(DWORD);
357  return TRUE;
358 
360  *(DWORD *)buffer = connect->session->receive_timeout;
361  *buflen = sizeof(DWORD);
362  return TRUE;
363 
365  *(DWORD *)buffer = connect->session->receive_response_timeout;
366  *buflen = sizeof(DWORD);
367  return TRUE;
368 
369  default:
370  FIXME("unimplemented option %u\n", option);
372  return FALSE;
373  }
374 }
375 
376 static const struct object_vtbl connect_vtbl =
377 {
380  NULL
381 };
382 
384 {
385  static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 };
386  BOOL ret = FALSE;
387 
388  if (!strcmpiW( domain, localW ) && !strchrW( server, '.' ))
389  ret = TRUE;
390  else if (*domain == '*')
391  {
392  if (domain[1] == '.')
393  {
394  LPCWSTR dot;
395 
396  /* For a hostname to match a wildcard, the last domain must match
397  * the wildcard exactly. E.g. if the wildcard is *.a.b, and the
398  * hostname is www.foo.a.b, it matches, but a.b does not.
399  */
400  dot = strchrW( server, '.' );
401  if (dot)
402  {
403  int len = strlenW( dot + 1 );
404 
405  if (len > strlenW( domain + 2 ))
406  {
407  LPCWSTR ptr;
408 
409  /* The server's domain is longer than the wildcard, so it
410  * could be a subdomain. Compare the last portion of the
411  * server's domain.
412  */
413  ptr = dot + len + 1 - strlenW( domain + 2 );
414  if (!strcmpiW( ptr, domain + 2 ))
415  {
416  /* This is only a match if the preceding character is
417  * a '.', i.e. that it is a matching domain. E.g.
418  * if domain is '*.b.c' and server is 'www.ab.c' they
419  * do not match.
420  */
421  ret = *(ptr - 1) == '.';
422  }
423  }
424  else
425  ret = !strcmpiW( dot + 1, domain + 2 );
426  }
427  }
428  }
429  else
430  ret = !strcmpiW( server, domain );
431  return ret;
432 }
433 
434 /* Matches INTERNET_MAX_HOST_NAME_LENGTH in wininet.h, also RFC 1035 */
435 #define MAX_HOST_NAME_LENGTH 256
436 
438 {
439  LPCWSTR ptr;
440  BOOL ret = FALSE;
441 
442  if (!session->proxy_bypass) return FALSE;
444  do {
445  LPCWSTR tmp = ptr;
446 
447  ptr = strchrW( ptr, ';' );
448  if (!ptr)
449  ptr = strchrW( tmp, ' ' );
450  if (ptr)
451  {
452  if (ptr - tmp < MAX_HOST_NAME_LENGTH)
453  {
455 
456  memcpy( domain, tmp, (ptr - tmp) * sizeof(WCHAR) );
457  domain[ptr - tmp] = 0;
459  }
460  ptr += 1;
461  }
462  else if (*tmp)
463  ret = domain_matches( server, tmp );
464  } while (ptr && !ret);
465  return ret;
466 }
467 
469 {
470  struct session *session = connect->session;
471  BOOL ret = TRUE;
472 
474  {
475  LPCWSTR colon;
476 
477  if ((colon = strchrW( session->proxy_server, ':' )))
478  {
480  session->proxy_server, colon - session->proxy_server - 1 ))
481  {
484  if (!(connect->servername = heap_alloc(
485  (colon - session->proxy_server + 1) * sizeof(WCHAR) )))
486  {
487  ret = FALSE;
488  goto end;
489  }
491  (colon - session->proxy_server) * sizeof(WCHAR) );
492  connect->servername[colon - session->proxy_server] = 0;
493  if (*(colon + 1))
494  connect->serverport = atoiW( colon + 1 );
495  else
497  }
498  }
499  else
500  {
503  {
507  {
508  ret = FALSE;
509  goto end;
510  }
512  }
513  }
514  }
515  else if (server)
516  {
519  if (!(connect->servername = strdupW( server )))
520  {
521  ret = FALSE;
522  goto end;
523  }
525  }
526 end:
527  return ret;
528 }
529 
530 /***********************************************************************
531  * WinHttpConnect (winhttp.@)
532  */
534 {
535  struct connect *connect;
536  struct session *session;
537  HINTERNET hconnect = NULL;
538 
539  TRACE("%p, %s, %u, %x\n", hsession, debugstr_w(server), port, reserved);
540 
541  if (!server)
542  {
544  return NULL;
545  }
546  if (!(session = (struct session *)grab_object( hsession )))
547  {
549  return NULL;
550  }
552  {
555  return NULL;
556  }
557  if (!(connect = heap_alloc_zero( sizeof(struct connect) )))
558  {
560  return NULL;
561  }
563  connect->hdr.vtbl = &connect_vtbl;
564  connect->hdr.refs = 1;
565  connect->hdr.flags = session->hdr.flags;
566  connect->hdr.callback = session->hdr.callback;
567  connect->hdr.notify_mask = session->hdr.notify_mask;
568  connect->hdr.context = session->hdr.context;
569  connect->hdr.redirect_policy = session->hdr.redirect_policy;
570  list_init( &connect->hdr.children );
571 
574  list_add_head( &session->hdr.children, &connect->hdr.entry );
575 
576  if (!(connect->hostname = strdupW( server ))) goto end;
577  connect->hostport = port;
579 
580  if (!(hconnect = alloc_handle( &connect->hdr ))) goto end;
581  connect->hdr.handle = hconnect;
582 
583  send_callback( &session->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hconnect, sizeof(hconnect) );
584 
585 end:
588  TRACE("returning %p\n", hconnect);
589  if (hconnect) SetLastError( ERROR_SUCCESS );
590  return hconnect;
591 }
592 
593 /***********************************************************************
594  * request_destroy (internal)
595  */
596 static void request_destroy( struct object_header *hdr )
597 {
598  struct request *request = (struct request *)hdr;
599  unsigned int i, j;
600 
601  TRACE("%p\n", request);
602 
603 #ifdef __REACTOS__
604  if (request->task_thread)
605 #else
607 #endif
608  {
609  /* Signal to the task proc to quit. It will call this again when it does. */
610 #ifdef __REACTOS__
611  HANDLE thread = request->task_thread;
612  request->task_thread = 0;
614  CloseHandle( thread );
615 #else
618 #endif
619  return;
620  }
621  release_object( &request->connect->hdr );
622 
626 
629 
630  heap_free( request->verb );
631  heap_free( request->path );
635  for (i = 0; i < request->num_headers; i++)
636  {
637  heap_free( request->headers[i].field );
638  heap_free( request->headers[i].value );
639  }
641  for (i = 0; i < TARGET_MAX; i++)
642  {
643  for (j = 0; j < SCHEME_MAX; j++)
644  {
645  heap_free( request->creds[i][j].username );
646  heap_free( request->creds[i][j].password );
647  }
648  }
649  heap_free( request );
650 }
651 
652 static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen )
653 {
654  int len = 0;
655  if (str) len = strlenW( str );
656  if (buffer && *buflen > len)
657  {
658  if (str) memcpy( buffer, str, len * sizeof(WCHAR) );
659  buffer[len] = 0;
660  }
661  *buflen = len * sizeof(WCHAR);
662 }
663 
665 {
666  WCHAR *ret;
668 
670  if ((ret = LocalAlloc( 0, size * sizeof(WCHAR) )))
672 
673  return ret;
674 }
675 
676 static BOOL copy_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
677 {
678  switch (addr->sa_family)
679  {
680  case AF_INET:
681  {
682  struct sockaddr_in *addr_in = (struct sockaddr_in *)addr_storage;
683 
684  memcpy( addr_in, addr, sizeof(*addr_in) );
685  memset( addr_in + 1, 0, sizeof(*addr_storage) - sizeof(*addr_in) );
686  return TRUE;
687  }
688  case AF_INET6:
689  {
690  struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr_storage;
691 
692  memcpy( addr_in6, addr, sizeof(*addr_in6) );
693  memset( addr_in6 + 1, 0, sizeof(*addr_storage) - sizeof(*addr_in6) );
694  return TRUE;
695  }
696  default:
697  ERR("unhandled family %u\n", addr->sa_family);
698  return FALSE;
699  }
700 }
701 
702 static BOOL request_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
703 {
704  struct request *request = (struct request *)hdr;
705 
706  switch (option)
707  {
709  {
710  DWORD flags;
711  int bits;
712 
713  if (!buffer || *buflen < sizeof(flags))
714  {
715  *buflen = sizeof(flags);
717  return FALSE;
718  }
719 
721  if (request->netconn)
722  {
724  if (bits >= 128)
726  else if (bits >= 56)
728  else
730  }
731  *(DWORD *)buffer = flags;
732  *buflen = sizeof(flags);
733  return TRUE;
734  }
736  {
737  const CERT_CONTEXT *cert;
738 
739  if (!buffer || *buflen < sizeof(cert))
740  {
741  *buflen = sizeof(cert);
743  return FALSE;
744  }
745 
748  *buflen = sizeof(cert);
749  return TRUE;
750  }
752  {
754  const CRYPT_OID_INFO *oidInfo;
756 
757  FIXME("partial stub\n");
758 
759  if (!buffer || *buflen < sizeof(*ci))
760  {
761  *buflen = sizeof(*ci);
763  return FALSE;
764  }
765  if (!cert) return FALSE;
766 
767  ci->ftExpiry = cert->pCertInfo->NotAfter;
768  ci->ftStart = cert->pCertInfo->NotBefore;
769  ci->lpszSubjectInfo = blob_to_str( cert->dwCertEncodingType, &cert->pCertInfo->Subject );
770  ci->lpszIssuerInfo = blob_to_str( cert->dwCertEncodingType, &cert->pCertInfo->Issuer );
771  ci->lpszProtocolName = NULL;
772  oidInfo = CryptFindOIDInfo( CRYPT_OID_INFO_OID_KEY, cert->pCertInfo->SignatureAlgorithm.pszObjId, 0 );
773  if (oidInfo)
774  ci->lpszSignatureAlgName = (LPWSTR)oidInfo->pwszName;
775  else
779 
780  *buflen = sizeof(*ci);
781  return TRUE;
782  }
784  {
785  if (!buffer || *buflen < sizeof(DWORD))
786  {
787  *buflen = sizeof(DWORD);
789  return FALSE;
790  }
791 
793  *buflen = sizeof(DWORD);
794  return TRUE;
795  }
797  {
798  WINHTTP_CONNECTION_INFO *info = buffer;
799  struct sockaddr local;
800  socklen_t len = sizeof(local);
801  const struct sockaddr *remote = (const struct sockaddr *)&request->connect->sockaddr;
802 
803  if (!buffer || *buflen < sizeof(*info))
804  {
805  *buflen = sizeof(*info);
807  return FALSE;
808  }
809  if (!request->netconn)
810  {
812  return FALSE;
813  }
814  if (getsockname( request->netconn->socket, &local, &len )) return FALSE;
815  if (!copy_sockaddr( &local, &info->LocalAddress )) return FALSE;
816  if (!copy_sockaddr( remote, &info->RemoteAddress )) return FALSE;
817  info->cbSize = sizeof(*info);
818  return TRUE;
819  }
822  *buflen = sizeof(DWORD);
823  return TRUE;
824 
827  *buflen = sizeof(DWORD);
828  return TRUE;
829 
832  *buflen = sizeof(DWORD);
833  return TRUE;
834 
837  *buflen = sizeof(DWORD);
838  return TRUE;
839 
842  *buflen = sizeof(DWORD);
843  return TRUE;
844 
846  str_to_buffer( buffer, request->connect->username, buflen );
847  return TRUE;
848 
850  str_to_buffer( buffer, request->connect->password, buflen );
851  return TRUE;
852 
854  str_to_buffer( buffer, request->connect->session->proxy_username, buflen );
855  return TRUE;
856 
858  str_to_buffer( buffer, request->connect->session->proxy_password, buflen );
859  return TRUE;
860 
861  default:
862  FIXME("unimplemented option %u\n", option);
864  return FALSE;
865  }
866 }
867 
868 static WCHAR *buffer_to_str( WCHAR *buffer, DWORD buflen )
869 {
870  WCHAR *ret;
871  if ((ret = heap_alloc( (buflen + 1) * sizeof(WCHAR))))
872  {
873  memcpy( ret, buffer, buflen * sizeof(WCHAR) );
874  ret[buflen] = 0;
875  return ret;
876  }
878  return NULL;
879 }
880 
881 static BOOL request_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
882 {
883  struct request *request = (struct request *)hdr;
884 
885  switch (option)
886  {
888  {
890 
891  FIXME("%u %s %s\n", pi->dwAccessType, debugstr_w(pi->lpszProxy), debugstr_w(pi->lpszProxyBypass));
892  return TRUE;
893  }
895  {
896  DWORD disable;
897 
898  if (buflen != sizeof(DWORD))
899  {
901  return FALSE;
902  }
903 
904  disable = *(DWORD *)buffer;
905  TRACE("0x%x\n", disable);
906  hdr->disable_flags |= disable;
907  return TRUE;
908  }
910  {
911  DWORD policy;
912 
913  if (buflen != sizeof(DWORD))
914  {
916  return FALSE;
917  }
918 
919  policy = *(DWORD *)buffer;
920  TRACE("0x%x\n", policy);
921  hdr->logon_policy = policy;
922  return TRUE;
923  }
925  {
926  DWORD policy;
927 
928  if (buflen != sizeof(DWORD))
929  {
931  return FALSE;
932  }
933 
934  policy = *(DWORD *)buffer;
935  TRACE("0x%x\n", policy);
936  hdr->redirect_policy = policy;
937  return TRUE;
938  }
940  {
941  DWORD flags;
946 
947  if (buflen < sizeof(DWORD))
948  {
950  return FALSE;
951  }
952  flags = *(DWORD *)buffer;
953  TRACE("0x%x\n", flags);
954  if (flags && (flags & ~accepted))
955  {
957  return FALSE;
958  }
960  return TRUE;
961  }
964  return TRUE;
965 
968  return TRUE;
969 
972  return TRUE;
973 
976  return TRUE;
977 
980  return TRUE;
981 
983  {
984  struct connect *connect = request->connect;
985 
987  if (!(connect->username = buffer_to_str( buffer, buflen ))) return FALSE;
988  return TRUE;
989  }
991  {
992  struct connect *connect = request->connect;
993 
995  if (!(connect->password = buffer_to_str( buffer, buflen ))) return FALSE;
996  return TRUE;
997  }
999  {
1000  struct session *session = request->connect->session;
1001 
1003  if (!(session->proxy_username = buffer_to_str( buffer, buflen ))) return FALSE;
1004  return TRUE;
1005  }
1007  {
1008  struct session *session = request->connect->session;
1009 
1011  if (!(session->proxy_password = buffer_to_str( buffer, buflen ))) return FALSE;
1012  return TRUE;
1013  }
1015  {
1016  const CERT_CONTEXT *cert;
1017 
1018  if (!(hdr->flags & WINHTTP_FLAG_SECURE))
1019  {
1021  return FALSE;
1022  }
1023  if (!buffer)
1024  {
1027  }
1028  else if (buflen >= sizeof(cert))
1029  {
1030  if (!(cert = CertDuplicateCertificateContext( buffer ))) return FALSE;
1033  }
1034  else
1035  {
1037  return FALSE;
1038  }
1039 
1041  {
1044  }
1045 
1046  return TRUE;
1047  }
1049  if(buflen == sizeof( DWORD ) && *(DWORD *)buffer == WINHTTP_ENABLE_SSL_REVOCATION)
1050  {
1053  return TRUE;
1054  }
1055  else
1056  {
1058  return FALSE;
1059  }
1060 
1062  FIXME("WINHTTP_OPTION_CONNECT_RETRIES\n");
1063  return TRUE;
1064 
1065  default:
1066  FIXME("unimplemented option %u\n", option);
1068  return FALSE;
1069  }
1070 }
1071 
1072 static const struct object_vtbl request_vtbl =
1073 {
1077 };
1078 
1080 {
1081  static const WCHAR acceptW[] = {'A','c','c','e','p','t',0};
1083 
1084  if (!types) return TRUE;
1085  while (*types)
1086  {
1087  if (!process_header( request, acceptW, *types, flags, TRUE )) return FALSE;
1088  types++;
1089  }
1090  return TRUE;
1091 }
1092 
1093 static WCHAR *get_request_path( const WCHAR *object )
1094 {
1095  int len = object ? strlenW(object) : 0;
1096  WCHAR *p, *ret;
1097 
1098  if (!object || object[0] != '/') len++;
1099  if (!(p = ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
1100  if (!object || object[0] != '/') *p++ = '/';
1101  if (object) strcpyW( p, object );
1102  ret[len] = 0;
1103  return ret;
1104 }
1105 
1106 /***********************************************************************
1107  * WinHttpOpenRequest (winhttp.@)
1108  */
1110  LPCWSTR referrer, LPCWSTR *types, DWORD flags )
1111 {
1112  struct request *request;
1113  struct connect *connect;
1114  HINTERNET hrequest = NULL;
1115 
1116  TRACE("%p, %s, %s, %s, %s, %p, 0x%08x\n", hconnect, debugstr_w(verb), debugstr_w(object),
1117  debugstr_w(version), debugstr_w(referrer), types, flags);
1118 
1119  if (types && TRACE_ON(winhttp))
1120  {
1121  const WCHAR **iter;
1122  TRACE("accept types:\n");
1123  for (iter = types; *iter; iter++) TRACE(" %s\n", debugstr_w(*iter));
1124  }
1125 
1126  if (!(connect = (struct connect *)grab_object( hconnect )))
1127  {
1129  return NULL;
1130  }
1132  {
1133  release_object( &connect->hdr );
1135  return NULL;
1136  }
1137  if (!(request = heap_alloc_zero( sizeof(struct request) )))
1138  {
1139  release_object( &connect->hdr );
1140  return NULL;
1141  }
1143  request->hdr.vtbl = &request_vtbl;
1144  request->hdr.refs = 1;
1145  request->hdr.flags = flags;
1146  request->hdr.callback = connect->hdr.callback;
1147  request->hdr.notify_mask = connect->hdr.notify_mask;
1148  request->hdr.context = connect->hdr.context;
1149  request->hdr.redirect_policy = connect->hdr.redirect_policy;
1150  list_init( &request->hdr.children );
1152 
1153  addref_object( &connect->hdr );
1154  request->connect = connect;
1155  list_add_head( &connect->hdr.children, &request->hdr.entry );
1156 
1157  request->resolve_timeout = connect->session->resolve_timeout;
1158  request->connect_timeout = connect->session->connect_timeout;
1159  request->send_timeout = connect->session->send_timeout;
1160  request->receive_timeout = connect->session->receive_timeout;
1161  request->receive_response_timeout = connect->session->receive_response_timeout;
1162 
1163  if (!verb || !verb[0]) verb = getW;
1164  if (!(request->verb = strdupW( verb ))) goto end;
1165  if (!(request->path = get_request_path( object ))) goto end;
1166 
1167  if (!version || !version[0]) version = http1_1;
1168  if (!(request->version = strdupW( version ))) goto end;
1169  if (!(add_accept_types_header( request, types ))) goto end;
1170 
1171  if (!(hrequest = alloc_handle( &request->hdr ))) goto end;
1172  request->hdr.handle = hrequest;
1173 
1174  send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hrequest, sizeof(hrequest) );
1175 
1176 end:
1177  release_object( &request->hdr );
1178  release_object( &connect->hdr );
1179  TRACE("returning %p\n", hrequest);
1180  if (hrequest) SetLastError( ERROR_SUCCESS );
1181  return hrequest;
1182 }
1183 
1184 /***********************************************************************
1185  * WinHttpCloseHandle (winhttp.@)
1186  */
1188 {
1189  struct object_header *hdr;
1190 
1191  TRACE("%p\n", handle);
1192 
1193  if (!(hdr = grab_object( handle )))
1194  {
1196  return FALSE;
1197  }
1198  release_object( hdr );
1199  free_handle( handle );
1201  return TRUE;
1202 }
1203 
1204 static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
1205 {
1206  BOOL ret = FALSE;
1207 
1208  if (!buflen)
1209  {
1211  return FALSE;
1212  }
1213 
1214  switch (option)
1215  {
1217  {
1218  if (!buffer || *buflen < sizeof(DWORD_PTR))
1219  {
1220  *buflen = sizeof(DWORD_PTR);
1222  return FALSE;
1223  }
1224 
1225  *(DWORD_PTR *)buffer = hdr->context;
1226  *buflen = sizeof(DWORD_PTR);
1227  return TRUE;
1228  }
1229  default:
1230  if (hdr->vtbl->query_option) ret = hdr->vtbl->query_option( hdr, option, buffer, buflen );
1231  else
1232  {
1233  FIXME("unimplemented option %u\n", option);
1235  return FALSE;
1236  }
1237  break;
1238  }
1239  return ret;
1240 }
1241 
1242 /***********************************************************************
1243  * WinHttpQueryOption (winhttp.@)
1244  */
1246 {
1247  BOOL ret = FALSE;
1248  struct object_header *hdr;
1249 
1250  TRACE("%p, %u, %p, %p\n", handle, option, buffer, buflen);
1251 
1252  if (!(hdr = grab_object( handle )))
1253  {
1255  return FALSE;
1256  }
1257 
1258  ret = query_option( hdr, option, buffer, buflen );
1259 
1260  release_object( hdr );
1261  if (ret) SetLastError( ERROR_SUCCESS );
1262  return ret;
1263 }
1264 
1265 static BOOL set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
1266 {
1267  BOOL ret = TRUE;
1268 
1269  if (!buffer && buflen)
1270  {
1272  return FALSE;
1273  }
1274 
1275  switch (option)
1276  {
1278  {
1279  if (buflen != sizeof(DWORD_PTR))
1280  {
1282  return FALSE;
1283  }
1284 
1285  hdr->context = *(DWORD_PTR *)buffer;
1286  return TRUE;
1287  }
1288  default:
1289  if (hdr->vtbl->set_option) ret = hdr->vtbl->set_option( hdr, option, buffer, buflen );
1290  else
1291  {
1292  FIXME("unimplemented option %u\n", option);
1294  return FALSE;
1295  }
1296  break;
1297  }
1298  return ret;
1299 }
1300 
1301 /***********************************************************************
1302  * WinHttpSetOption (winhttp.@)
1303  */
1305 {
1306  BOOL ret = FALSE;
1307  struct object_header *hdr;
1308 
1309  TRACE("%p, %u, %p, %u\n", handle, option, buffer, buflen);
1310 
1311  if (!(hdr = grab_object( handle )))
1312  {
1314  return FALSE;
1315  }
1316 
1317  ret = set_option( hdr, option, buffer, buflen );
1318 
1319  release_object( hdr );
1320  if (ret) SetLastError( ERROR_SUCCESS );
1321  return ret;
1322 }
1323 
1324 static char *get_computer_name( COMPUTER_NAME_FORMAT format )
1325 {
1326  char *ret;
1327  DWORD size = 0;
1328 
1330  if (GetLastError() != ERROR_MORE_DATA) return NULL;
1331  if (!(ret = heap_alloc( size ))) return NULL;
1332  if (!GetComputerNameExA( format, ret, &size ))
1333  {
1334  heap_free( ret );
1335  return NULL;
1336  }
1337  return ret;
1338 }
1339 
1340 static BOOL is_domain_suffix( const char *domain, const char *suffix )
1341 {
1342  int len_domain = strlen( domain ), len_suffix = strlen( suffix );
1343 
1344  if (len_suffix > len_domain) return FALSE;
1345  if (!_strnicmp( domain + len_domain - len_suffix, suffix, -1 )) return TRUE;
1346  return FALSE;
1347 }
1348 
1349 static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
1350 {
1351  return getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
1352 }
1353 
1354 static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
1355 {
1356  static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0};
1357  static const WCHAR wpadW[] = {'/','w','p','a','d','.','d','a','t',0};
1358  char name[NI_MAXHOST];
1359  WCHAR *ret, *p;
1360  int len;
1361 
1362  while (ai && ai->ai_family != AF_INET && ai->ai_family != AF_INET6) ai = ai->ai_next;
1363  if (!ai) return NULL;
1364 
1365  if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
1366 
1367  len = strlenW( httpW ) + strlen( hostname ) + strlenW( wpadW );
1368  if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
1369  strcpyW( p, httpW );
1370  p += strlenW( httpW );
1371  while (*hostname) { *p++ = *hostname++; }
1372  strcpyW( p, wpadW );
1373  return ret;
1374 }
1375 
1377 {
1378 #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
1379  CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
1380  const void *ref;
1381  BOOL ret = FALSE;
1382 
1383  if (!settings) return FALSE;
1384 
1385  if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
1386  {
1387  CFRelease( settings );
1388  return FALSE;
1389  }
1390  if (CFStringGetCString( ref, buf, buflen, kCFStringEncodingASCII ))
1391  {
1392  TRACE( "returning %s\n", debugstr_a(buf) );
1393  ret = TRUE;
1394  }
1395  CFRelease( settings );
1396  return ret;
1397 #else
1398  static BOOL first = TRUE;
1399  if (first)
1400  {
1401  FIXME( "no support on this platform\n" );
1402  first = FALSE;
1403  }
1404  else
1405  TRACE( "no support on this platform\n" );
1406  return FALSE;
1407 #endif
1408 }
1409 
1410 #define INTERNET_MAX_URL_LENGTH 2084
1411 
1412 /***********************************************************************
1413  * WinHttpDetectAutoProxyConfigUrl (winhttp.@)
1414  */
1416 {
1417  BOOL ret = FALSE;
1418  char system_url[INTERNET_MAX_URL_LENGTH + 1];
1419 
1420  TRACE("0x%08x, %p\n", flags, url);
1421 
1422  if (!flags || !url)
1423  {
1425  return FALSE;
1426  }
1427  if (get_system_proxy_autoconfig_url( system_url, sizeof(system_url) ))
1428  {
1429  WCHAR *urlW;
1430 
1431  if (!(urlW = strdupAW( system_url ))) return FALSE;
1432  *url = urlW;
1434  return TRUE;
1435  }
1437  {
1438  static int fixme_shown;
1439  if (!fixme_shown++) FIXME("discovery via DHCP not supported\n");
1440  }
1442  {
1443  char *fqdn, *domain, *p;
1444 
1445  if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return FALSE;
1446  if (!(domain = get_computer_name( ComputerNamePhysicalDnsDomain )))
1447  {
1448  heap_free( fqdn );
1449  return FALSE;
1450  }
1451  p = fqdn;
1452  while ((p = strchr( p, '.' )) && is_domain_suffix( p + 1, domain ))
1453  {
1454  struct addrinfo *ai;
1455  char *name;
1456  int res;
1457 
1458  if (!(name = heap_alloc( sizeof("wpad") + strlen(p) )))
1459  {
1460  heap_free( fqdn );
1461  heap_free( domain );
1462  return FALSE;
1463  }
1464  strcpy( name, "wpad" );
1465  strcat( name, p );
1466  res = getaddrinfo( name, NULL, NULL, &ai );
1467  if (!res)
1468  {
1469  *url = build_wpad_url( name, ai );
1470  freeaddrinfo( ai );
1471  if (*url)
1472  {
1473  TRACE("returning %s\n", debugstr_w(*url));
1474  heap_free( name );
1475  ret = TRUE;
1476  break;
1477  }
1478  }
1479  heap_free( name );
1480  p++;
1481  }
1482  heap_free( domain );
1483  heap_free( fqdn );
1484  }
1485  if (!ret)
1486  {
1488  *url = NULL;
1489  }
1490  else SetLastError( ERROR_SUCCESS );
1491  return ret;
1492 }
1493 
1494 static const WCHAR Connections[] = {
1495  'S','o','f','t','w','a','r','e','\\',
1496  'M','i','c','r','o','s','o','f','t','\\',
1497  'W','i','n','d','o','w','s','\\',
1498  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1499  'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\',
1500  'C','o','n','n','e','c','t','i','o','n','s',0 };
1501 static const WCHAR WinHttpSettings[] = {
1502  'W','i','n','H','t','t','p','S','e','t','t','i','n','g','s',0 };
1503 static const DWORD WINHTTP_SETTINGS_MAGIC = 0x18;
1504 static const DWORD WININET_SETTINGS_MAGIC = 0x46;
1505 static const DWORD PROXY_TYPE_DIRECT = 1;
1506 static const DWORD PROXY_TYPE_PROXY = 2;
1507 static const DWORD PROXY_USE_PAC_SCRIPT = 4;
1509 
1511 {
1513  DWORD unknown; /* always zero? */
1514  DWORD flags; /* one or more of PROXY_* */
1515 };
1516 
1517 static inline void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst)
1518 {
1519  const BYTE *begin;
1520 
1521  for (begin = src; src - begin < len; src++, dst++)
1522  *dst = *src;
1523  *dst = 0;
1524 }
1525 
1526 /***********************************************************************
1527  * WinHttpGetDefaultProxyConfiguration (winhttp.@)
1528  */
1530 {
1531  LONG l;
1532  HKEY key;
1533  BOOL got_from_reg = FALSE, direct = TRUE;
1534  char *envproxy;
1535 
1536  TRACE("%p\n", info);
1537 
1539  if (!l)
1540  {
1541  DWORD type, size = 0;
1542 
1544  if (!l && type == REG_BINARY &&
1545  size >= sizeof(struct connection_settings_header) + 2 * sizeof(DWORD))
1546  {
1547  BYTE *buf = heap_alloc( size );
1548 
1549  if (buf)
1550  {
1552  (struct connection_settings_header *)buf;
1553  DWORD *len = (DWORD *)(hdr + 1);
1554 
1556  &size );
1557  if (!l && hdr->magic == WINHTTP_SETTINGS_MAGIC &&
1558  hdr->unknown == 0)
1559  {
1560  if (hdr->flags & PROXY_TYPE_PROXY)
1561  {
1562  BOOL sane = FALSE;
1563  LPWSTR proxy = NULL;
1564  LPWSTR proxy_bypass = NULL;
1565 
1566  /* Sanity-check length of proxy string */
1567  if ((BYTE *)len - buf + *len <= size)
1568  {
1569  sane = TRUE;
1570  proxy = GlobalAlloc( 0, (*len + 1) * sizeof(WCHAR) );
1571  if (proxy)
1572  copy_char_to_wchar_sz( (BYTE *)(len + 1), *len, proxy );
1573  len = (DWORD *)((BYTE *)(len + 1) + *len);
1574  }
1575  if (sane)
1576  {
1577  /* Sanity-check length of proxy bypass string */
1578  if ((BYTE *)len - buf + *len <= size)
1579  {
1580  proxy_bypass = GlobalAlloc( 0, (*len + 1) * sizeof(WCHAR) );
1581  if (proxy_bypass)
1582  copy_char_to_wchar_sz( (BYTE *)(len + 1), *len, proxy_bypass );
1583  }
1584  else
1585  {
1586  sane = FALSE;
1587  GlobalFree( proxy );
1588  proxy = NULL;
1589  }
1590  }
1591  info->lpszProxy = proxy;
1592  info->lpszProxyBypass = proxy_bypass;
1593  if (sane)
1594  {
1595  got_from_reg = TRUE;
1596  direct = FALSE;
1597  info->dwAccessType =
1599  TRACE("http proxy (from registry) = %s, bypass = %s\n",
1600  debugstr_w(info->lpszProxy),
1601  debugstr_w(info->lpszProxyBypass));
1602  }
1603  }
1604  }
1605  heap_free( buf );
1606  }
1607  }
1608  RegCloseKey( key );
1609  }
1610  if (!got_from_reg && (envproxy = getenv( "http_proxy" )))
1611  {
1612  char *colon, *http_proxy = NULL;
1613 
1614  if (!(colon = strchr( envproxy, ':' ))) http_proxy = envproxy;
1615  else
1616  {
1617  if (*(colon + 1) == '/' && *(colon + 2) == '/')
1618  {
1619  /* It's a scheme, check that it's http */
1620  if (!strncmp( envproxy, "http://", 7 )) http_proxy = envproxy + 7;
1621  else WARN("unsupported scheme in $http_proxy: %s\n", envproxy);
1622  }
1623  else http_proxy = envproxy;
1624  }
1625 
1626  if (http_proxy && http_proxy[0])
1627  {
1628  WCHAR *http_proxyW;
1629  int len;
1630 
1631  len = MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, NULL, 0 );
1632  if ((http_proxyW = GlobalAlloc( 0, len * sizeof(WCHAR))))
1633  {
1634  MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, http_proxyW, len );
1635  direct = FALSE;
1636  info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
1637  info->lpszProxy = http_proxyW;
1638  info->lpszProxyBypass = NULL;
1639  TRACE("http proxy (from environment) = %s\n", debugstr_w(info->lpszProxy));
1640  }
1641  }
1642  }
1643  if (direct)
1644  {
1645  info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
1646  info->lpszProxy = NULL;
1647  info->lpszProxyBypass = NULL;
1648  }
1650  return TRUE;
1651 }
1652 
1653 /***********************************************************************
1654  * WinHttpGetIEProxyConfigForCurrentUser (winhttp.@)
1655  */
1657 {
1658  static const WCHAR settingsW[] =
1659  {'D','e','f','a','u','l','t','C','o','n','n','e','c','t','i','o','n','S','e','t','t','i','n','g','s',0};
1660  HKEY hkey = NULL;
1662  DWORD type, offset, len, size = 0;
1663  BOOL ret = FALSE;
1664 
1665  TRACE("%p\n", config);
1666 
1667  if (!config)
1668  {
1670  return FALSE;
1671  }
1672  memset( config, 0, sizeof(*config) );
1673  config->fAutoDetect = TRUE;
1674 
1675  if (RegOpenKeyExW( HKEY_CURRENT_USER, Connections, 0, KEY_READ, &hkey ) ||
1676  RegQueryValueExW( hkey, settingsW, NULL, &type, NULL, &size ) ||
1677  type != REG_BINARY || size < sizeof(struct connection_settings_header))
1678  {
1679  ret = TRUE;
1680  goto done;
1681  }
1682  if (!(hdr = heap_alloc( size ))) goto done;
1683  if (RegQueryValueExW( hkey, settingsW, NULL, &type, (BYTE *)hdr, &size ) ||
1684  hdr->magic != WININET_SETTINGS_MAGIC)
1685  {
1686  ret = TRUE;
1687  goto done;
1688  }
1689 
1690  config->fAutoDetect = (hdr->flags & PROXY_AUTODETECT_SETTINGS) != 0;
1691  offset = sizeof(*hdr);
1692  if (offset + sizeof(DWORD) > size) goto done;
1693  len = *(DWORD *)((char *)hdr + offset);
1694  offset += sizeof(DWORD);
1695  if (len && hdr->flags & PROXY_TYPE_PROXY)
1696  {
1697  if (!(config->lpszProxy = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1698  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszProxy );
1699  }
1700  offset += len;
1701  if (offset + sizeof(DWORD) > size) goto done;
1702  len = *(DWORD *)((char *)hdr + offset);
1703  offset += sizeof(DWORD);
1704  if (len && (hdr->flags & PROXY_TYPE_PROXY))
1705  {
1706  if (!(config->lpszProxyBypass = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1707  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszProxyBypass );
1708  }
1709  offset += len;
1710  if (offset + sizeof(DWORD) > size) goto done;
1711  len = *(DWORD *)((char *)hdr + offset);
1712  offset += sizeof(DWORD);
1713  if (len && (hdr->flags & PROXY_USE_PAC_SCRIPT))
1714  {
1715  if (!(config->lpszAutoConfigUrl = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1716  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszAutoConfigUrl );
1717  }
1718  ret = TRUE;
1719 
1720 done:
1721  RegCloseKey( hkey );
1722  heap_free( hdr );
1723  if (!ret)
1724  {
1725  GlobalFree( config->lpszAutoConfigUrl );
1726  config->lpszAutoConfigUrl = NULL;
1727  GlobalFree( config->lpszProxy );
1728  config->lpszProxy = NULL;
1729  GlobalFree( config->lpszProxyBypass );
1730  config->lpszProxyBypass = NULL;
1731  }
1732  else SetLastError( ERROR_SUCCESS );
1733  return ret;
1734 }
1735 
1737 {
1738  const char *p;
1739  WCHAR *q;
1740  int len;
1741 
1742  info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
1743  info->lpszProxy = NULL;
1744  info->lpszProxyBypass = NULL;
1745 
1746  TRACE("%s\n", debugstr_a( result ));
1747 
1748  p = result;
1749  while (*p == ' ') p++;
1750  len = strlen( p );
1751  if (len >= 5 && !_strnicmp( p, "PROXY", sizeof("PROXY") - 1 ))
1752  {
1753  p += 5;
1754  while (*p == ' ') p++;
1755  if (!*p || *p == ';') return TRUE;
1756  if (!(info->lpszProxy = q = strdupAW( p ))) return FALSE;
1757  info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
1758  for (; *q; q++)
1759  {
1760  if (*q == ' ' || *q == ';')
1761  {
1762  *q = 0;
1763  break;
1764  }
1765  }
1766  }
1767  return TRUE;
1768 }
1769 
1770 static char *download_script( const WCHAR *url, DWORD *out_size )
1771 {
1772  static const WCHAR typeW[] = {'*','/','*',0};
1773  static const WCHAR *acceptW[] = {typeW, NULL};
1774  HINTERNET ses, con = NULL, req = NULL;
1775  WCHAR *hostname;
1776  URL_COMPONENTSW uc;
1777  DWORD status, size = sizeof(status), offset, to_read, bytes_read, flags = 0;
1778  char *tmp, *buffer = NULL;
1779 
1780  *out_size = 0;
1781 
1782  memset( &uc, 0, sizeof(uc) );
1783  uc.dwStructSize = sizeof(uc);
1784  uc.dwHostNameLength = -1;
1785  uc.dwUrlPathLength = -1;
1786  if (!WinHttpCrackUrl( url, 0, 0, &uc )) return NULL;
1787  if (!(hostname = heap_alloc( (uc.dwHostNameLength + 1) * sizeof(WCHAR) ))) return NULL;
1788  memcpy( hostname, uc.lpszHostName, uc.dwHostNameLength * sizeof(WCHAR) );
1789  hostname[uc.dwHostNameLength] = 0;
1790 
1791  if (!(ses = WinHttpOpen( NULL, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ))) goto done;
1792  if (!(con = WinHttpConnect( ses, hostname, uc.nPort, 0 ))) goto done;
1794  if (!(req = WinHttpOpenRequest( con, NULL, uc.lpszUrlPath, NULL, NULL, acceptW, flags ))) goto done;
1795  if (!WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 )) goto done;
1796 
1797  if (!(WinHttpReceiveResponse( req, 0 ))) goto done;
1799  &size, NULL ) || status != HTTP_STATUS_OK) goto done;
1800 
1801  size = 4096;
1802  if (!(buffer = heap_alloc( size ))) goto done;
1803  to_read = size;
1804  offset = 0;
1805  for (;;)
1806  {
1807  if (!WinHttpReadData( req, buffer + offset, to_read, &bytes_read )) goto done;
1808  if (!bytes_read) break;
1809  to_read -= bytes_read;
1810  offset += bytes_read;
1811  *out_size += bytes_read;
1812  if (!to_read)
1813  {
1814  to_read = size;
1815  size *= 2;
1816  if (!(tmp = heap_realloc( buffer, size ))) goto done;
1817  buffer = tmp;
1818  }
1819  }
1820 
1821 done:
1822  WinHttpCloseHandle( req );
1823  WinHttpCloseHandle( con );
1824  WinHttpCloseHandle( ses );
1825  heap_free( hostname );
1827  return buffer;
1828 }
1829 
1831 {
1835 };
1836 
1840 
1842 {
1843  BOOL ret;
1844  char *result, *urlA;
1845  DWORD len_result;
1847  URL_COMPONENTSW uc;
1848 
1849  buffer.dwStructSize = sizeof(buffer);
1850  buffer.lpszScriptBuffer = script;
1851  buffer.dwScriptBufferSize = size;
1852 
1853  if (!(urlA = strdupWA( url ))) return FALSE;
1855  {
1856  heap_free( urlA );
1857  return FALSE;
1858  }
1859 
1860  memset( &uc, 0, sizeof(uc) );
1861  uc.dwStructSize = sizeof(uc);
1862  uc.dwHostNameLength = -1;
1863 
1864  if (WinHttpCrackUrl( url, 0, 0, &uc ))
1865  {
1866  char *hostnameA = strdupWA_sized( uc.lpszHostName, uc.dwHostNameLength );
1867 
1868  if ((ret = InternetGetProxyInfo( urlA, strlen(urlA),
1869  hostnameA, strlen(hostnameA), &result, &len_result )))
1870  {
1872  heap_free( result );
1873  }
1874 
1875  heap_free( hostnameA );
1876  }
1877  heap_free( urlA );
1879 }
1880 
1881 /***********************************************************************
1882  * WinHttpGetProxyForUrl (winhttp.@)
1883  */
1886 {
1887  WCHAR *detected_pac_url = NULL;
1888  const WCHAR *pac_url;
1889  struct session *session;
1890  char *script;
1891  DWORD size;
1892  BOOL ret = FALSE;
1893 
1894  TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info);
1895 
1896  if (!(session = (struct session *)grab_object( hsession )))
1897  {
1899  return FALSE;
1900  }
1902  {
1903  release_object( &session->hdr );
1905  return FALSE;
1906  }
1907  if (!url || !options || !info ||
1909  ((options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT) && !options->dwAutoDetectFlags) ||
1910  ((options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT) &&
1911  (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL)))
1912  {
1913  release_object( &session->hdr );
1915  return FALSE;
1916  }
1917  if (options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT &&
1918  !WinHttpDetectAutoProxyConfigUrl( options->dwAutoDetectFlags, &detected_pac_url ))
1919  goto done;
1920 
1921  if (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL) pac_url = options->lpszAutoConfigUrl;
1922  else pac_url = detected_pac_url;
1923 
1924  if ((script = download_script( pac_url, &size )))
1925  {
1926  ret = run_script( script, size, url, info );
1927  heap_free( script );
1928  }
1929 
1930 done:
1931  GlobalFree( detected_pac_url );
1932  release_object( &session->hdr );
1933  if (ret) SetLastError( ERROR_SUCCESS );
1934  return ret;
1935 }
1936 
1937 /***********************************************************************
1938  * WinHttpSetDefaultProxyConfiguration (winhttp.@)
1939  */
1941 {
1942  LONG l;
1943  HKEY key;
1944  BOOL ret = FALSE;
1945  const WCHAR *src;
1946 
1947  TRACE("%p\n", info);
1948 
1949  if (!info)
1950  {
1952  return FALSE;
1953  }
1954  switch (info->dwAccessType)
1955  {
1957  break;
1959  if (!info->lpszProxy)
1960  {
1962  return FALSE;
1963  }
1964  /* Only ASCII characters are allowed */
1965  for (src = info->lpszProxy; *src; src++)
1966  if (*src > 0x7f)
1967  {
1969  return FALSE;
1970  }
1971  if (info->lpszProxyBypass)
1972  {
1973  for (src = info->lpszProxyBypass; *src; src++)
1974  if (*src > 0x7f)
1975  {
1977  return FALSE;
1978  }
1979  }
1980  break;
1981  default:
1983  return FALSE;
1984  }
1985 
1987  KEY_WRITE, NULL, &key, NULL );
1988  if (!l)
1989  {
1990  DWORD size = sizeof(struct connection_settings_header) + 2 * sizeof(DWORD);
1991  BYTE *buf;
1992 
1993  if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
1994  {
1995  size += strlenW( info->lpszProxy );
1996  if (info->lpszProxyBypass)
1997  size += strlenW( info->lpszProxyBypass );
1998  }
1999  buf = heap_alloc( size );
2000  if (buf)
2001  {
2003  (struct connection_settings_header *)buf;
2004  DWORD *len = (DWORD *)(hdr + 1);
2005 
2006  hdr->magic = WINHTTP_SETTINGS_MAGIC;
2007  hdr->unknown = 0;
2008  if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
2009  {
2010  BYTE *dst;
2011 
2012  hdr->flags = PROXY_TYPE_PROXY;
2013  *len++ = strlenW( info->lpszProxy );
2014  for (dst = (BYTE *)len, src = info->lpszProxy; *src;
2015  src++, dst++)
2016  *dst = *src;
2017  len = (DWORD *)dst;
2018  if (info->lpszProxyBypass)
2019  {
2020  *len++ = strlenW( info->lpszProxyBypass );
2021  for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src;
2022  src++, dst++)
2023  *dst = *src;
2024  }
2025  else
2026  *len++ = 0;
2027  }
2028  else
2029  {
2030  hdr->flags = PROXY_TYPE_DIRECT;
2031  *len++ = 0;
2032  *len++ = 0;
2033  }
2035  if (!l)
2036  ret = TRUE;
2037  heap_free( buf );
2038  }
2039  RegCloseKey( key );
2040  }
2041  if (ret) SetLastError( ERROR_SUCCESS );
2042  return ret;
2043 }
2044 
2045 /***********************************************************************
2046  * WinHttpSetStatusCallback (winhttp.@)
2047  */
2050 {
2051  struct object_header *hdr;
2053 
2054  TRACE("%p, %p, 0x%08x, 0x%lx\n", handle, callback, flags, reserved);
2055 
2056  if (!(hdr = grab_object( handle )))
2057  {
2060  }
2061  ret = hdr->callback;
2062  hdr->callback = callback;
2063  hdr->notify_mask = flags;
2064 
2065  release_object( hdr );
2067  return ret;
2068 }
2069 
2070 /***********************************************************************
2071  * WinHttpSetTimeouts (winhttp.@)
2072  */
2073 BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int send, int receive )
2074 {
2075  BOOL ret = TRUE;
2076  struct object_header *hdr;
2077 
2078  TRACE("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive);
2079 
2080  if (resolve < -1 || connect < -1 || send < -1 || receive < -1)
2081  {
2083  return FALSE;
2084  }
2085 
2086  if (!(hdr = grab_object( handle )))
2087  {
2089  return FALSE;
2090  }
2091 
2092  switch(hdr->type)
2093  {
2095  {
2096  struct request *request = (struct request *)hdr;
2098 
2099  if (resolve < 0) resolve = 0;
2100  request->resolve_timeout = resolve;
2101 
2102  if (send < 0) send = 0;
2104 
2105  if (receive < 0) receive = 0;
2106  request->receive_timeout = receive;
2107 
2108  if (request->netconn)
2109  {
2111  if (netconn_set_timeout( request->netconn, FALSE, receive )) ret = FALSE;
2112  }
2113  break;
2114  }
2116  {
2117  struct session *session = (struct session *)hdr;
2119 
2120  if (resolve < 0) resolve = 0;
2121  session->resolve_timeout = resolve;
2122 
2123  if (send < 0) send = 0;
2125 
2126  if (receive < 0) receive = 0;
2127  session->receive_timeout = receive;
2128  break;
2129  }
2130  default:
2132  ret = FALSE;
2133  }
2134  release_object( hdr );
2135  if (ret) SetLastError( ERROR_SUCCESS );
2136  return ret;
2137 }
2138 
2139 static const WCHAR wkday[7][4] =
2140  {{'S','u','n', 0}, {'M','o','n', 0}, {'T','u','e', 0}, {'W','e','d', 0},
2141  {'T','h','u', 0}, {'F','r','i', 0}, {'S','a','t', 0}};
2142 static const WCHAR month[12][4] =
2143  {{'J','a','n', 0}, {'F','e','b', 0}, {'M','a','r', 0}, {'A','p','r', 0},
2144  {'M','a','y', 0}, {'J','u','n', 0}, {'J','u','l', 0}, {'A','u','g', 0},
2145  {'S','e','p', 0}, {'O','c','t', 0}, {'N','o','v', 0}, {'D','e','c', 0}};
2146 
2147 /***********************************************************************
2148  * WinHttpTimeFromSystemTime (WININET.@)
2149  */
2151 {
2152  static const WCHAR format[] =
2153  {'%','s',',',' ','%','0','2','d',' ','%','s',' ','%','4','d',' ','%','0',
2154  '2','d',':','%','0','2','d',':','%','0','2','d',' ','G','M','T', 0};
2155 
2156  TRACE("%p, %p\n", time, string);
2157 
2158  if (!time || !string)
2159  {
2161  return FALSE;
2162  }
2163 
2164  sprintfW( string, format,
2165  wkday[time->wDayOfWeek],
2166  time->wDay,
2167  month[time->wMonth - 1],
2168  time->wYear,
2169  time->wHour,
2170  time->wMinute,
2171  time->wSecond );
2172 
2174  return TRUE;
2175 }
2176 
2177 /***********************************************************************
2178  * WinHttpTimeToSystemTime (WININET.@)
2179  */
2181 {
2182  unsigned int i;
2183  const WCHAR *s = string;
2184  WCHAR *end;
2185 
2186  TRACE("%s, %p\n", debugstr_w(string), time);
2187 
2188  if (!string || !time)
2189  {
2191  return FALSE;
2192  }
2193 
2194  /* Windows does this too */
2195  GetSystemTime( time );
2196 
2197  /* Convert an RFC1123 time such as 'Fri, 07 Jan 2005 12:06:35 GMT' into
2198  * a SYSTEMTIME structure.
2199  */
2200 
2202 
2203  while (*s && !isalphaW( *s )) s++;
2204  if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
2205  time->wDayOfWeek = 7;
2206 
2207  for (i = 0; i < 7; i++)
2208  {
2209  if (toupperW( wkday[i][0] ) == toupperW( s[0] ) &&
2210  toupperW( wkday[i][1] ) == toupperW( s[1] ) &&
2211  toupperW( wkday[i][2] ) == toupperW( s[2] ) )
2212  {
2213  time->wDayOfWeek = i;
2214  break;
2215  }
2216  }
2217 
2218  if (time->wDayOfWeek > 6) return TRUE;
2219  while (*s && !isdigitW( *s )) s++;
2220  time->wDay = strtolW( s, &end, 10 );
2221  s = end;
2222 
2223  while (*s && !isalphaW( *s )) s++;
2224  if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
2225  time->wMonth = 0;
2226 
2227  for (i = 0; i < 12; i++)
2228  {
2229  if (toupperW( month[i][0]) == toupperW( s[0] ) &&
2230  toupperW( month[i][1]) == toupperW( s[1] ) &&
2231  toupperW( month[i][2]) == toupperW( s[2] ) )
2232  {
2233  time->wMonth = i + 1;
2234  break;
2235  }
2236  }
2237  if (time->wMonth == 0) return TRUE;
2238 
2239  while (*s && !isdigitW( *s )) s++;
2240  if (*s == '\0') return TRUE;
2241  time->wYear = strtolW( s, &end, 10 );
2242  s = end;
2243 
2244  while (*s && !isdigitW( *s )) s++;
2245  if (*s == '\0') return TRUE;
2246  time->wHour = strtolW( s, &end, 10 );
2247  s = end;
2248 
2249  while (*s && !isdigitW( *s )) s++;
2250  if (*s == '\0') return TRUE;
2251  time->wMinute = strtolW( s, &end, 10 );
2252  s = end;
2253 
2254  while (*s && !isdigitW( *s )) s++;
2255  if (*s == '\0') return TRUE;
2256  time->wSecond = strtolW( s, &end, 10 );
2257 
2258  time->wMilliseconds = 0;
2259  return TRUE;
2260 }
HINTERNET WINAPI WinHttpConnect(HINTERNET hsession, LPCWSTR server, INTERNET_PORT port, DWORD reserved)
Definition: session.c:533
VOID(CALLBACK * WINHTTP_STATUS_CALLBACK)(_In_ HINTERNET, _In_ DWORD_PTR, _In_ DWORD, _In_ LPVOID, _In_ DWORD)
Definition: winhttp.h:520
#define WINHTTP_ACCESS_TYPE_NAMED_PROXY
Definition: winhttp.h:64
#define WINHTTP_INVALID_STATUS_CALLBACK
Definition: winhttp.h:422
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct mke2fs_defaults settings[]
#define WINHTTP_HANDLE_TYPE_REQUEST
Definition: winhttp.h:432
#define WINHTTP_OPTION_PROXY_PASSWORD
Definition: winhttp.h:148
int receive_timeout
#define WINHTTP_OPTION_CLIENT_CERT_CONTEXT
Definition: winhttp.h:113
static BOOL copy_sockaddr(const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage)
Definition: session.c:676
BOOL WINAPI WinHttpQueryOption(HINTERNET handle, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:1245
#define WINHTTP_OPTION_RECEIVE_TIMEOUT
Definition: winhttp.h:99
WCHAR * proxy_username
#define SECURITY_FLAG_STRENGTH_MEDIUM
Definition: winhttp.h:287
LPVOID HINTERNET
Definition: winhttp.h:32
#define WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
Definition: winhttp.h:158
struct connect * connect
#define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT
Definition: winhttp.h:100
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define CloseHandle
Definition: compat.h:406
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
Definition: winhttp.h:281
char hdr[14]
Definition: iptest.cpp:33
#define SECURITY_FLAG_STRENGTH_STRONG
Definition: winhttp.h:288
BOOL WINAPI WinHttpCloseHandle(HINTERNET handle)
Definition: session.c:1187
Definition: dir.h:83
static BOOL alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle)
Definition: handle.c:183
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define freeaddrinfo
Definition: wspiapi.h:46
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WCHAR * proxy_password
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
#define WINHTTP_OPTION_PASSWORD
Definition: winhttp.h:146
CredHandle cred_handle
#define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT
Definition: winhttp.h:107
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: image.c:133
#define WINHTTP_ACCESS_TYPE_NO_PROXY
Definition: winhttp.h:63
DWORD dwStructSize
Definition: wininet.h:211
#define WINHTTP_ADDREQ_FLAG_ADD
Definition: winhttp.h:84
#define WINHTTP_OPTION_SEND_TIMEOUT
Definition: winhttp.h:98
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
static BOOL session_query_option(struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen)
Definition: session.c:96
struct object_header * grab_object(HINTERNET hinternet)
Definition: handle.c:56
DWORD WINAPI CertNameToStrW(DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:702
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define WINHTTP_OPTION_SECURE_PROTOCOLS
Definition: winhttp.h:127
#define WINHTTP_OPTION_PROXY
Definition: winhttp.h:110
static const WCHAR Connections[]
Definition: session.c:1494
WCHAR * proxy_server
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
const CERT_CONTEXT * client_cert
#define WINHTTP_AUTO_DETECT_TYPE_DHCP
Definition: winhttp.h:527
const GLint * first
Definition: glext.h:5794
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define strtolW(s, e, b)
Definition: unicode.h:33
static BOOL connect_query_option(struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen)
Definition: session.c:325
GLintptr offset
Definition: glext.h:5920
static WCHAR * strdupAW(const char *src, int len)
Definition: main.c:76
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
WCHAR * version
static WCHAR * buffer_to_str(WCHAR *buffer, DWORD buflen)
Definition: session.c:868
struct session * session
static const WCHAR typeW[]
Definition: name.c:51
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
#define WINHTTP_QUERY_STATUS_CODE
Definition: winhttp.h:317
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
BOOL check_revocation
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
BOOL process_header(struct request *request, const WCHAR *field, const WCHAR *value, DWORD flags, BOOL request_only)
Definition: request.c:430
#define WINHTTP_OPTION_PROXY_USERNAME
Definition: winhttp.h:147
#define ERROR_WINHTTP_AUTODETECTION_FAILED
Definition: winhttp.h:228
#define WINHTTP_OPTION_USERNAME
Definition: winhttp.h:145
GLuint GLuint end
Definition: gl.h:1545
static BOOL query_option(struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen)
Definition: session.c:1204
BOOL cred_handle_initialized
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
Definition: compname.c:370
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
Definition: winhttp.h:283
int receive_timeout
__u16 time
Definition: mkdosfs.c:366
static const WCHAR wkday[7][4]
Definition: session.c:2139
static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
Definition: session.c:383
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINHTTP_OPTION_PARENT_HANDLE
Definition: winhttp.h:104
#define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
Definition: winhttp.h:85
char * LPSTR
Definition: xmlstorage.h:182
static WCHAR * build_wpad_url(const char *hostname, const struct addrinfo *ai)
Definition: session.c:1354
#define NO_ERROR
Definition: dderror.h:5
LPWSTR lpszHostName
Definition: wininet.h:215
#define WINHTTP_OPTION_SERVER_CERT_CONTEXT
Definition: winhttp.h:121
static const DWORD WININET_SETTINGS_MAGIC
Definition: session.c:1504
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
#define DWORD
Definition: nt_native.h:44
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
Definition: send.c:47
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD netconn_set_timeout(struct netconn *netconn, BOOL send, int value)
Definition: net.c:590
#define WINHTTP_AUTOPROXY_AUTO_DETECT
Definition: winhttp.h:530
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:1091
static const struct object_vtbl request_vtbl
Definition: session.c:1072
#define WINHTTP_OPTION_MAX_CONNS_PER_SERVER
Definition: winhttp.h:118
struct _test_info info[]
Definition: SetCursorPos.c:19
Definition: cookie.c:41
char * hostname
Definition: ftp.c:88
WORD INTERNET_PORT
Definition: winhttp.h:38
static const WCHAR getW[]
Definition: object.c:50
static struct list oidInfo
Definition: oid.c:1206
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
BOOL WINAPI WinHttpQueryHeaders(HINTERNET hrequest, DWORD level, LPCWSTR name, LPVOID buffer, LPDWORD buflen, LPDWORD index)
Definition: request.c:856
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
BOOL WINAPI WinHttpTimeToSystemTime(LPCWSTR string, SYSTEMTIME *time)
Definition: session.c:2180
#define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
Definition: winhttp.h:62
BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR, DWORD)
Definition: main.c:111
INTERNET_PORT nPort
Definition: wininet.h:217
BOOL set_server_for_hostname(struct connect *connect, const WCHAR *server, INTERNET_PORT port)
Definition: session.c:468
unsigned int BOOL
Definition: ntddk_ex.h:94
int resolve_timeout
long LONG
Definition: pedump.c:60
static WCHAR * blob_to_str(DWORD encoding, CERT_NAME_BLOB *blob)
Definition: session.c:664
int send_timeout
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI WinHttpReceiveResponse(HINTERNET hrequest, LPVOID reserved)
Definition: request.c:2924
GLenum GLint ref
Definition: glext.h:6028
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
#define FIXME(fmt,...)
Definition: debug.h:110
WCHAR * username
static PVOID ptr
Definition: dispmode.c:27
r reserved
Definition: btrfs.c:2865
int connect_timeout
const WCHAR * str
char path[256]
Definition: tftpd.h:94
DWORD passport_flags
WCHAR * status_text
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:66
Definition: getopt.h:108
#define AF_INET6
Definition: winsock.h:369
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1410
#define WINHTTP_OPTION_REDIRECT_POLICY
Definition: winhttp.h:131
script
Definition: msipriv.h:374
#define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
Definition: winhttp.h:199
static BYTE cert[]
Definition: msg.c:1437
BOOL WINAPI WinHttpDetectAutoProxyConfigUrl(DWORD flags, LPWSTR *url)
Definition: session.c:1415
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
const char * LPCSTR
Definition: xmlstorage.h:183
void destroy_cookies(struct session *session)
Definition: cookie.c:120
struct list task_queue
static clock_t begin
Definition: xmllint.c:466
LPWSTR lpszEncryptionAlgName
Definition: winhttp.h:498
#define WINHTTP_FLAG_SECURE
Definition: winhttp.h:60
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 GLint GLint j
Definition: glfuncs.h:250
#define WINHTTP_AUTO_DETECT_TYPE_DNS_A
Definition: winhttp.h:528
#define WINHTTP_HANDLE_TYPE_SESSION
Definition: winhttp.h:430
static BOOL add_accept_types_header(struct request *request, const WCHAR **types)
Definition: session.c:1079
r l[0]
Definition: byte_order.h:167
BOOL WINAPI WinHttpCrackUrl(LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc)
Definition: url.c:179
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141
static void request_destroy(struct object_header *hdr)
Definition: session.c:596
#define KEY_WRITE
Definition: nt_native.h:1031
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:4895
INTERNET_PORT serverport
#define WINHTTP_OPTION_AUTOLOGON_POLICY
Definition: winhttp.h:120
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:327
BOOL WINAPI WinHttpGetProxyForUrl(HINTERNET hsession, LPCWSTR url, WINHTTP_AUTOPROXY_OPTIONS *options, WINHTTP_PROXY_INFO *info)
Definition: session.c:1884
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static void str_to_buffer(WCHAR *buffer, const WCHAR *str, LPDWORD buflen)
Definition: session.c:652
static char * strdupWA_sized(const WCHAR *src, DWORD size)
WCHAR * password
BOOL WINAPI InternetInitializeAutoProxyDll(DWORD, LPSTR, LPSTR, void *, struct AUTO_PROXY_SCRIPT_BUFFER *)
WCHAR * raw_headers
#define WINHTTP_OPTION_ENABLE_FEATURE
Definition: winhttp.h:122
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define CP_UNIXCP
Definition: compat.h:69
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: cmds.c:130
#define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: winhttp.h:119
CRITICAL_SECTION cs
BOOL WINAPI WinHttpSetTimeouts(HINTERNET handle, int resolve, int connect, int send, int receive)
Definition: session.c:2073
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct object_header hdr
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define WINHTTP_CALLBACK_STATUS_HANDLE_CREATED
Definition: winhttp.h:390
static const DWORD PROXY_USE_PAC_SCRIPT
Definition: session.c:1507
#define debugstr_a
Definition: kernel32.h:31
static refpint_t pi[]
Definition: server.c:96
#define WINHTTP_QUERY_FLAG_NUMBER
Definition: winhttp.h:377
WCHAR * proxy_bypass
static const WCHAR url[]
Definition: encode.c:1432
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
const CERT_CONTEXT * server_cert
struct request::@580 creds[TARGET_MAX][SCHEME_MAX]
INTERNET_SCHEME nScheme
Definition: wininet.h:214
ULONG to_read
Definition: btrfs.c:4136
#define WINAPI
Definition: msvc.h:6
DWORD access
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
WCHAR * agent
BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *config)
Definition: session.c:1656
#define WINHTTP_HANDLE_TYPE_CONNECT
Definition: winhttp.h:431
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINHTTP_OPTION_CONTEXT_VALUE
Definition: winhttp.h:112
static WCHAR * get_request_path(const WCHAR *object)
Definition: session.c:1093
#define HTTP_STATUS_OK
Definition: winhttp.h:240
#define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE
Definition: winhttp.h:284
int socklen_t
Definition: tcp.c:35
WCHAR * hostname
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define SetLastError(x)
Definition: compat.h:417
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
Definition: session.c:437
struct authinfo * proxy_authinfo
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:866
static const DWORD PROXY_AUTODETECT_SETTINGS
Definition: session.c:1508
GLbitfield flags
Definition: glext.h:7161
#define NI_MAXHOST
Definition: ws2def.h:359
static BOOL is_domain_suffix(const char *domain, const char *suffix)
Definition: session.c:1340
DWORD dwHostNameLength
Definition: wininet.h:216
static void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst)
Definition: session.c:1517
WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback(HINTERNET handle, WINHTTP_STATUS_CALLBACK callback, DWORD flags, DWORD_PTR reserved)
Definition: session.c:2048
static HANDLE thread
Definition: service.c:33
int ret
static BOOL request_query_option(struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen)
Definition: session.c:702
static BOOL run_script(char *script, DWORD size, const WCHAR *url, WINHTTP_PROXY_INFO *info)
Definition: session.c:1841
GLenum const GLvoid * addr
Definition: glext.h:9621
static const struct object_vtbl session_vtbl
Definition: session.c:236
#define DEFAULT_SEND_TIMEOUT
Definition: session.c:51
struct header * headers
static char * download_script(const WCHAR *url, DWORD *out_size)
Definition: session.c:1770
LPWSTR lpszUrlPath
Definition: wininet.h:222
HKEY key
Definition: reg.c:42
static BOOL get_system_proxy_autoconfig_url(char *buf, DWORD buflen)
Definition: session.c:1376
struct list cookie_cache
BOOL free_handle(HINTERNET hinternet)
Definition: handle.c:123
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
HANDLE unload_event
static void destroy_authinfo(struct authinfo *info)
GLenum src
Definition: glext.h:6340
#define DEFAULT_CONNECT_TIMEOUT
Definition: session.c:50
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1702
static BOOL set_option(struct object_header *hdr, DWORD option, void *buffer, DWORD buflen)
Definition: session.c:1265
BOOL WINAPI WinHttpSetOption(HINTERNET handle, DWORD option, LPVOID buffer, DWORD buflen)
Definition: session.c:1304
#define WINHTTP_OPTION_CONNECTION_INFO
Definition: winhttp.h:136
#define ERROR_MORE_DATA
Definition: dderror.h:13
ed encoding
Definition: write.c:2839
char string[160]
Definition: util.h:11
static BOOL parse_script_result(const char *result, WINHTTP_PROXY_INFO *info)
Definition: session.c:1736
WCHAR * verb
static BOOL session_set_option(struct object_header *hdr, DWORD option, void *buffer, DWORD buflen)
Definition: session.c:147
#define strcmpiW(s1, s2)
Definition: unicode.h:39
DWORD dwUrlPathLength
Definition: wininet.h:223
#define local
Definition: zutil.h:30
#define ERR(fmt,...)
Definition: debug.h:109
#define DEFAULT_RESOLVE_TIMEOUT
Definition: session.c:49
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
Definition: winhttp.h:282
static BOOL request_set_option(struct object_header *hdr, DWORD option, void *buffer, DWORD buflen)
Definition: session.c:881
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
INTERNET_PORT hostport
static char * strdupWA(const WCHAR *src)
Definition: main.c:91
void send_callback(struct object_header *hdr, DWORD status, void *info, DWORD buflen)
Definition: session.c:55
BOOL WINAPI WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *info)
Definition: session.c:1940
BOOL WINAPI WinHttpTimeFromSystemTime(const SYSTEMTIME *time, LPWSTR string)
Definition: session.c:2150
#define WINHTTP_OPTION_SECURITY_FLAGS
Definition: winhttp.h:106
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
int receive_response_timeout
GLenum GLenum dst
Definition: glext.h:6340
#define sprintfW
Definition: unicode.h:58
#define getnameinfo
Definition: wspiapi.h:45
static const WCHAR http1_1[]
#define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT
Definition: winhttp.h:221
static const WCHAR WinHttpSettings[]
Definition: session.c:1501
static void session_destroy(struct object_header *hdr)
Definition: session.c:77
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
struct object_header hdr
struct netconn * netconn
#define WINHTTP_OPTION_RESOLVE_TIMEOUT
Definition: winhttp.h:95
int receive_response_timeout
PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:360
#define MultiByteToWideChar
Definition: compat.h:100
struct authinfo * authinfo
Definition: tftpd.h:85
static const DWORD PROXY_TYPE_PROXY
Definition: session.c:1506
char * strchr(const char *String, int ch)
Definition: utclib.c:501
BOOL WINAPI WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *info)
Definition: session.c:1529
static const DWORD PROXY_TYPE_DIRECT
Definition: session.c:1505
BOOL WINAPI InternetGetProxyInfo(LPCSTR, DWORD, LPSTR, DWORD, LPSTR *, LPDWORD)
struct addrinfo * ai_next
Definition: ws2def.h:672
int connect_timeout
int send_timeout
HINTERNET WINAPI WinHttpOpen(LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWSTR bypass, DWORD flags)
Definition: session.c:246
Definition: name.c:38
BOOL WINAPI WinHttpCheckPlatform(void)
Definition: session.c:68
GLuint res
Definition: glext.h:9613
int disable
Definition: msacm.c:1365
#define CERT_SIMPLE_NAME_STR
Definition: wincrypt.h:3484
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
uint32_t * LPDWORD
Definition: typedefs.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define WINHTTP_OPTION_SECURITY_KEY_BITNESS
Definition: winhttp.h:109
int netconn_get_cipher_strength(struct netconn *conn)
Definition: net.c:762
static int reverse_lookup(const struct addrinfo *ai, char *hostname, size_t len)
Definition: session.c:1349
#define AF_INET
Definition: tcpip.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define DEFAULT_RECEIVE_RESPONSE_TIMEOUT
Definition: session.c:53
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: session.c:1324
#define WINHTTP_OPTION_CONNECT_RETRIES
Definition: winhttp.h:97
#define WINHTTP_ENABLE_SSL_REVOCATION
Definition: winhttp.h:172
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
struct object_header hdr
size_t ai_addrlen
Definition: ws2def.h:669
static const DWORD WINHTTP_SETTINGS_MAGIC
Definition: session.c:1503
#define INTERNET_DEFAULT_PORT
Definition: winhttp.h:35
#define MAX_HOST_NAME_LENGTH
Definition: session.c:435
#define ERROR_WINHTTP_INCORRECT_HANDLE_STATE
Definition: winhttp.h:200
WINE_UNICODE_INLINE int isalphaW(WCHAR wc)
Definition: unicode.h:195
DWORD num_headers
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * servername
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
static const WCHAR httpW[]
Definition: assoc.c:94
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DEFAULT_RECEIVE_TIMEOUT
Definition: session.c:52
#define WINHTTP_OPTION_CONNECT_TIMEOUT
Definition: winhttp.h:96
int resolve_timeout
HINTERNET WINAPI WinHttpOpenRequest(HINTERNET hconnect, LPCWSTR verb, LPCWSTR object, LPCWSTR version, LPCWSTR referrer, LPCWSTR *types, DWORD flags)
Definition: session.c:1109
#define WINHTTP_AUTOPROXY_CONFIG_URL
Definition: winhttp.h:531
static void connect_destroy(struct object_header *hdr)
Definition: session.c:310
USHORT port
Definition: uri.c:228
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define TRACE_ON(x)
Definition: compat.h:65
DWORD secure_protocols
struct object_header * addref_object(struct object_header *hdr)
Definition: handle.c:49
DWORD security_flags
BOOL WINAPI WinHttpSendRequest(HINTERNET hrequest, LPCWSTR headers, DWORD headers_len, LPVOID optional, DWORD optional_len, DWORD total_len, DWORD_PTR context)
Definition: request.c:2350
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
#define ERROR_WINHTTP_INVALID_OPTION
Definition: winhttp.h:194
struct sockaddr * ai_addr
Definition: ws2def.h:671
#define SECURITY_FLAG_STRENGTH_WEAK
Definition: winhttp.h:286
static const WCHAR month[12][4]
Definition: session.c:2142
BOOL WINAPI WinHttpReadData(HINTERNET hrequest, LPVOID buffer, DWORD to_read, LPDWORD read)
Definition: request.c:3053
#define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT
Definition: winhttp.h:141
static void accepted(enum accept_stat, struct rpc_err *)
Definition: rpc_prot.c:280
static const struct object_vtbl connect_vtbl
Definition: session.c:376
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
HANDLE task_cancel
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:859
BOOL task_proc_running
Definition: path.c:41
#define WINHTTP_OPTION_DISABLE_FEATURE
Definition: winhttp.h:116
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH
Definition: winhttp.h:126
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define getaddrinfo
Definition: wspiapi.h:44
void release_object(struct object_header *hdr)
Definition: handle.c:72
Definition: ps.c:97
GLuint const GLchar * name
Definition: glext.h:6031
int ai_family
Definition: ws2def.h:666