ReactOS  0.4.15-dev-2535-gcf6c191
internet.c File Reference
#include "winsock2.h"
#include "ws2ipdef.h"
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <wchar.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "wininet.h"
#include "winnls.h"
#include "wine/debug.h"
#include "winerror.h"
#include "shlwapi.h"
#include "ws2tcpip.h"
#include "winternl.h"
#include "iphlpapi.h"
#include "dhcpcsdk.h"
#include "wine/exception.h"
#include "internet.h"
#include "resource.h"
Include dependency graph for internet.c:

Go to the source code of this file.

Classes

struct  WITHREADERROR
 
struct  proxyinfo_t
 
struct  open_url_task_t
 

Macros

#define NO_SHLWAPI_STREAM
 
#define FE(x)   { x, #x }
 
#define FE(x)   { x, #x }
 
#define MAX_WORD_DIGITS   5
 
#define URL_GET_COMP_LENGTH(url, component)
 
#define URL_GET_COMP_LENGTHA(url, component)
 

Typedefs

typedef struct WITHREADERRORLPWITHREADERROR
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wininet)
 
voidalloc_object (object_header_t *parent, const object_vtbl_t *vtbl, size_t size)
 
object_header_tWININET_AddRef (object_header_t *info)
 
object_header_tget_handle_object (HINTERNET hinternet)
 
static void invalidate_handle (object_header_t *info)
 
BOOL WININET_Release (object_header_t *info)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
HRESULT WINAPI DllInstall (BOOL bInstall, LPCWSTR cmdline)
 
static LONG INTERNET_SaveProxySettings (proxyinfo_t *lpwpi)
 
WCHARINTERNET_FindProxyForProtocol (LPCWSTR szProxy, LPCWSTR proto)
 
BOOL WINAPI InternetInitializeAutoProxyDll (DWORD dwReserved)
 
BOOL WINAPI DetectAutoProxyUrl (LPSTR lpszAutoProxyUrl, DWORD dwAutoProxyUrlLength, DWORD dwDetectFlags)
 
static void FreeProxyInfo (proxyinfo_t *lpwpi)
 
static void free_global_proxy (void)
 
static BOOL parse_proxy_url (proxyinfo_t *info, const WCHAR *url)
 
static LONG INTERNET_LoadProxySettings (proxyinfo_t *lpwpi)
 
static BOOL INTERNET_ConfigureProxy (appinfo_t *lpwai)
 
static void dump_INTERNET_FLAGS (DWORD dwFlags)
 
static VOID APPINFO_Destroy (object_header_t *hdr)
 
static DWORD APPINFO_QueryOption (object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
 
static DWORD APPINFO_SetOption (object_header_t *hdr, DWORD option, void *buf, DWORD size)
 
HINTERNET WINAPI InternetOpenW (LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
 
HINTERNET WINAPI InternetOpenA (LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
 
BOOL WINAPI InternetGetLastResponseInfoA (LPDWORD lpdwError, LPSTR lpszBuffer, LPDWORD lpdwBufferLength)
 
BOOL WINAPI InternetGetLastResponseInfoW (LPDWORD lpdwError, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength)
 
BOOL WINAPI InternetGetConnectedState (LPDWORD lpdwStatus, DWORD dwReserved)
 
BOOL WINAPI InternetGetConnectedStateExW (LPDWORD lpdwStatus, LPWSTR lpszConnectionName, DWORD dwNameLen, DWORD dwReserved)
 
BOOL WINAPI InternetGetConnectedStateExA (LPDWORD lpdwStatus, LPSTR lpszConnectionName, DWORD dwNameLen, DWORD dwReserved)
 
HINTERNET WINAPI InternetConnectW (HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
 
HINTERNET WINAPI InternetConnectA (HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
 
BOOL WINAPI InternetFindNextFileA (HINTERNET hFind, LPVOID lpvFindData)
 
BOOL WINAPI InternetFindNextFileW (HINTERNET hFind, LPVOID lpvFindData)
 
BOOL WINAPI InternetCloseHandle (HINTERNET hInternet)
 
static BOOL set_url_component (WCHAR **component, DWORD *component_length, const WCHAR *value, DWORD len)
 
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)
 
static BOOL set_url_component_AtoW (const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
 
BOOL WINAPI InternetCrackUrlA (const char *url, DWORD url_length, DWORD flags, URL_COMPONENTSA *ret_comp)
 
static INTERNET_SCHEME GetInternetSchemeW (LPCWSTR lpszScheme, DWORD nMaxCmp)
 
BOOL WINAPI InternetCrackUrlW (const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
 
DWORD WINAPI InternetAttemptConnect (DWORD dwReserved)
 
static DWORD convert_url_canonicalization_flags (DWORD dwFlags)
 
BOOL WINAPI InternetCanonicalizeUrlA (LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
 
BOOL WINAPI InternetCanonicalizeUrlW (LPCWSTR lpszUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
 
static INTERNET_STATUS_CALLBACK set_status_callback (object_header_t *lpwh, INTERNET_STATUS_CALLBACK callback, BOOL unicode)
 
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA (HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
 
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW (HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
 
DWORD WINAPI InternetSetFilePointer (HINTERNET hFile, LONG lDistanceToMove, PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
 
BOOL WINAPI InternetWriteFile (HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
 
BOOL WINAPI InternetReadFile (HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
 
BOOL WINAPI InternetReadFileExA (HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
 
BOOL WINAPI InternetReadFileExW (HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
 
static IP_ADAPTER_ADDRESSES * get_adapters (void)
 
static WCHARdetect_proxy_autoconfig_url_dhcp (void)
 
static charget_computer_name (COMPUTER_NAME_FORMAT format)
 
static BOOL is_domain_suffix (const char *domain, const char *suffix)
 
static int reverse_lookup (const struct addrinfo *ai, char *hostname, size_t len)
 
static WCHARbuild_wpad_url (const char *hostname, const struct addrinfo *ai)
 
static WCHARdetect_proxy_autoconfig_url_dns (void)
 
static WCHARget_proxy_autoconfig_url (void)
 
static DWORD query_global_option (DWORD option, void *buffer, DWORD *size, BOOL unicode)
 
DWORD INET_QueryOption (object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
 
BOOL WINAPI InternetQueryOptionW (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
 
BOOL WINAPI InternetQueryOptionA (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
 
DWORD INET_SetOption (object_header_t *hdr, DWORD option, void *buf, DWORD size)
 
static DWORD set_global_option (DWORD option, void *buf, DWORD size)
 
BOOL WINAPI InternetSetOptionW (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
 
BOOL WINAPI InternetSetOptionA (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
 
BOOL WINAPI InternetSetOptionExA (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
 
BOOL WINAPI InternetSetOptionExW (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength, DWORD dwFlags)
 
BOOL WINAPI InternetTimeFromSystemTimeA (const SYSTEMTIME *time, DWORD format, LPSTR string, DWORD size)
 
BOOL WINAPI InternetTimeFromSystemTimeW (const SYSTEMTIME *time, DWORD format, LPWSTR string, DWORD size)
 
BOOL WINAPI InternetTimeToSystemTimeA (LPCSTR string, SYSTEMTIME *time, DWORD reserved)
 
BOOL WINAPI InternetTimeToSystemTimeW (LPCWSTR string, SYSTEMTIME *time, DWORD reserved)
 
BOOL WINAPI InternetCheckConnectionW (LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
 
BOOL WINAPI InternetCheckConnectionA (LPCSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
 
static HINTERNET INTERNET_InternetOpenUrlW (appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
 
static void AsyncInternetOpenUrlProc (task_header_t *hdr)
 
HINTERNET WINAPI InternetOpenUrlW (HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
 
HINTERNET WINAPI InternetOpenUrlA (HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
 
static LPWITHREADERROR INTERNET_AllocThreadError (void)
 
void INTERNET_SetLastError (DWORD dwError)
 
DWORD INTERNET_GetLastError (void)
 
static DWORD CALLBACK INTERNET_WorkerThreadFunc (LPVOID lpvParam)
 
voidalloc_async_task (object_header_t *hdr, async_task_proc_t proc, size_t size)
 
DWORD INTERNET_AsyncCall (task_header_t *task)
 
LPSTR INTERNET_GetResponseBuffer (void)
 
BOOL WINAPI InternetQueryDataAvailable (HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
 
DWORD create_req_file (const WCHAR *file_name, req_file_t **ret)
 
void req_file_release (req_file_t *req_file)
 
BOOL WINAPI InternetLockRequestFile (HINTERNET hInternet, HANDLE *lphLockReqHandle)
 
BOOL WINAPI InternetUnlockRequestFile (HANDLE hLockHandle)
 
BOOL WINAPI InternetAutodial (DWORD dwFlags, HWND hwndParent)
 
BOOL WINAPI InternetAutodialHangup (DWORD dwReserved)
 
BOOL WINAPI InternetCombineUrlA (LPCSTR lpszBaseUrl, LPCSTR lpszRelativeUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
 
BOOL WINAPI InternetCombineUrlW (LPCWSTR lpszBaseUrl, LPCWSTR lpszRelativeUrl, LPWSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
 
static BOOL url_uses_default_port (INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
 
static BOOL scheme_is_opaque (INTERNET_SCHEME nScheme)
 
static LPCWSTR INTERNET_GetSchemeString (INTERNET_SCHEME scheme)
 
static BOOL calc_url_length (LPURL_COMPONENTSW lpUrlComponents, LPDWORD lpdwUrlLength)
 
static void convert_urlcomp_atow (LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPONENTSW urlCompW)
 
BOOL WINAPI InternetCreateUrlA (LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags, LPSTR lpszUrl, LPDWORD lpdwUrlLength)
 
BOOL WINAPI InternetCreateUrlW (LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
 
DWORD WINAPI InternetConfirmZoneCrossingA (HWND hWnd, LPSTR szUrlPrev, LPSTR szUrlNew, BOOL bPost)
 
DWORD WINAPI InternetConfirmZoneCrossingW (HWND hWnd, LPWSTR szUrlPrev, LPWSTR szUrlNew, BOOL bPost)
 
DWORD WINAPI PrivacySetZonePreferenceW (DWORD zone, DWORD type, DWORD template, LPCWSTR preference)
 
DWORD WINAPI PrivacyGetZonePreferenceW (DWORD zone, DWORD type, LPDWORD template, LPWSTR preference, LPDWORD length)
 
BOOL WINAPI InternetGetSecurityInfoByURLA (LPSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
 
BOOL WINAPI InternetGetSecurityInfoByURLW (LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT *ppCertChain, DWORD *pdwSecureFlags)
 
DWORD WINAPI InternetDialA (HWND hwndParent, LPSTR lpszConnectoid, DWORD dwFlags, DWORD_PTR *lpdwConnection, DWORD dwReserved)
 
DWORD WINAPI InternetDialW (HWND hwndParent, LPWSTR lpszConnectoid, DWORD dwFlags, DWORD_PTR *lpdwConnection, DWORD dwReserved)
 
BOOL WINAPI InternetGoOnlineA (LPSTR lpszURL, HWND hwndParent, DWORD dwReserved)
 
BOOL WINAPI InternetGoOnlineW (LPWSTR lpszURL, HWND hwndParent, DWORD dwReserved)
 
DWORD WINAPI InternetHangUp (DWORD_PTR dwConnection, DWORD dwReserved)
 
BOOL WINAPI CreateMD5SSOHash (PWSTR pszChallengeInfo, PWSTR pwszRealm, PWSTR pwszTarget, PBYTE pbHexHash)
 
BOOL WINAPI ResumeSuspendedDownload (HINTERNET hInternet, DWORD dwError)
 
BOOL WINAPI InternetQueryFortezzaStatus (DWORD *a, DWORD_PTR b)
 
DWORD WINAPI ShowClientAuthCerts (HWND parent)
 

Variables

static DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES
 
HMODULE WININET_hModule
 
static CRITICAL_SECTION WININET_cs = { &WININET_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG WININET_cs_debug
 
static object_header_t ** handle_table
 
static UINT_PTR next_handle
 
static UINT_PTR handle_table_size
 
static ULONG max_conns = 2
 
static ULONG max_1_0_conns = 4
 
static ULONG connect_timeout = 60000
 
static const WCHAR szInternetSettings []
 
static proxyinfo_tglobal_proxy
 
static const object_vtbl_t APPINFOVtbl
 
static const WCHARurl_schemes []
 
static const WCHAR WININET_wkday [7][4]
 
static const WCHAR WININET_month [12][4]
 
static DWORD zone_preference = 3
 

Macro Definition Documentation

◆ FE [1/2]

#define FE (   x)    { x, #x }

◆ FE [2/2]

#define FE (   x)    { x, #x }

◆ MAX_WORD_DIGITS

#define MAX_WORD_DIGITS   5

Definition at line 4163 of file internet.c.

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 51 of file internet.c.

◆ URL_GET_COMP_LENGTH

#define URL_GET_COMP_LENGTH (   url,
  component 
)
Value:
((url)->dw##component##Length ? \
(url)->dw##component##Length : lstrlenW((url)->lpsz##component))
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define lstrlenW
Definition: compat.h:609
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
static const WCHAR url[]
Definition: encode.c:1432

Definition at line 4165 of file internet.c.

◆ URL_GET_COMP_LENGTHA

#define URL_GET_COMP_LENGTHA (   url,
  component 
)
Value:
((url)->dw##component##Length ? \
(url)->dw##component##Length : strlen((url)->lpsz##component))
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
static const WCHAR url[]
Definition: encode.c:1432

Definition at line 4167 of file internet.c.

Typedef Documentation

◆ LPWITHREADERROR

Function Documentation

◆ alloc_async_task()

void* alloc_async_task ( object_header_t hdr,
async_task_proc_t  proc,
size_t  size 
)

Definition at line 3894 of file internet.c.

3895 {
3896  task_header_t *task;
3897 
3898  task = heap_alloc(size);
3899  if(!task)
3900  return NULL;
3901 
3902  task->hdr = WININET_AddRef(hdr);
3903  task->proc = proc;
3904  return task;
3905 }
char hdr[14]
Definition: iptest.cpp:33
static HANDLE proc()
Definition: pdb.c:32
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:169
GLsizeiptr size
Definition: glext.h:5919
object_header_t * hdr
Definition: internet.h:390
async_task_proc_t proc
Definition: internet.h:389
#define NULL
Definition: types.h:112

Referenced by async_read(), FtpCreateDirectoryW(), FtpDeleteFileW(), FTPFILE_QueryDataAvailable(), FtpFindFirstFileW(), FTPFINDNEXT_FindNextFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpEndRequestW(), HttpSendRequestExW(), HttpSendRequestW(), and InternetOpenUrlW().

◆ alloc_object()

void* alloc_object ( object_header_t parent,
const object_vtbl_t vtbl,
size_t  size 
)

Definition at line 103 of file internet.c.

104 {
105  UINT_PTR handle = 0, num;
107  object_header_t **p;
108  BOOL res = TRUE;
109 
110  ret = heap_alloc_zero(size);
111  if(!ret)
112  return NULL;
113 
114  list_init(&ret->children);
115 
117 
118  if(!handle_table_size) {
119  num = 16;
120  p = heap_alloc_zero(sizeof(handle_table[0]) * num);
121  if(p) {
122  handle_table = p;
124  next_handle = 1;
125  }else {
126  res = FALSE;
127  }
128  }else if(next_handle == handle_table_size) {
129  num = handle_table_size * 2;
130  p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num);
131  if(p) {
132  handle_table = p;
134  }else {
135  res = FALSE;
136  }
137  }
138 
139  if(res) {
141  if(handle_table[handle])
142  ERR("handle isn't free but should be\n");
144  ret->valid_handle = TRUE;
145 
147  next_handle++;
148  }
149 
151 
152  if(!res) {
153  heap_free(ret);
154  return NULL;
155  }
156 
157  ret->vtbl = vtbl;
158  ret->refs = 1;
159  ret->hInternet = (HINTERNET)handle;
160 
161  if(parent) {
162  ret->lpfnStatusCB = parent->lpfnStatusCB;
163  ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
164  }
165 
166  return ret;
167 }
LPVOID HINTERNET
Definition: winhttp.h:32
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define INET_CALLBACKW
Definition: internet.h:244
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static UINT_PTR next_handle
Definition: internet.c:85
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2944
static UINT_PTR handle_table_size
Definition: internet.c:86
static CRITICAL_SECTION WININET_cs
Definition: internet.c:75
GLuint GLuint num
Definition: glext.h:9618
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FTP_Connect(), FTP_FtpOpenFileW(), FTP_ReceiveFileList(), HTTP_Connect(), HTTP_HttpOpenRequestW(), and InternetOpenW().

◆ APPINFO_Destroy()

static VOID APPINFO_Destroy ( object_header_t hdr)
static

Definition at line 775 of file internet.c.

776 {
777  appinfo_t *lpwai = (appinfo_t*)hdr;
778 
779  TRACE("%p\n",lpwai);
780 
781  heap_free(lpwai->agent);
782  heap_free(lpwai->proxy);
783  heap_free(lpwai->proxyBypass);
784  heap_free(lpwai->proxyUsername);
785  heap_free(lpwai->proxyPassword);
786 }
char hdr[14]
Definition: iptest.cpp:33
LPWSTR proxyUsername
Definition: internet.h:295
LPWSTR proxyPassword
Definition: internet.h:296
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR proxy
Definition: internet.h:293
LPWSTR agent
Definition: internet.h:292
LPWSTR proxyBypass
Definition: internet.h:294
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by query_global_option().

◆ APPINFO_QueryOption()

static DWORD APPINFO_QueryOption ( object_header_t hdr,
DWORD  option,
void buffer,
DWORD size,
BOOL  unicode 
)
static

Definition at line 788 of file internet.c.

789 {
790  appinfo_t *ai = (appinfo_t*)hdr;
791 
792  switch(option) {
794  TRACE("INTERNET_OPTION_HANDLE_TYPE\n");
795 
796  if (*size < sizeof(ULONG))
798 
799  *size = sizeof(DWORD);
801  return ERROR_SUCCESS;
802 
804  DWORD bufsize;
805 
806  TRACE("INTERNET_OPTION_USER_AGENT\n");
807 
808  bufsize = *size;
809 
810  if (unicode) {
811  DWORD len = ai->agent ? lstrlenW(ai->agent) : 0;
812 
813  *size = (len + 1) * sizeof(WCHAR);
814  if(!buffer || bufsize < *size)
816 
817  if (ai->agent)
818  lstrcpyW(buffer, ai->agent);
819  else
820  *(WCHAR *)buffer = 0;
821  /* If the buffer is copied, the returned length doesn't include
822  * the NULL terminator.
823  */
824  *size = len;
825  }else {
826  if (ai->agent)
827  *size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL);
828  else
829  *size = 1;
830  if(!buffer || bufsize < *size)
832 
833  if (ai->agent)
834  WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, buffer, *size, NULL, NULL);
835  else
836  *(char *)buffer = 0;
837  /* If the buffer is copied, the returned length doesn't include
838  * the NULL terminator.
839  */
840  *size -= 1;
841  }
842 
843  return ERROR_SUCCESS;
844  }
845 
847  if(!size) return ERROR_INVALID_PARAMETER;
848  if (unicode) {
850  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
851  LPWSTR proxy, proxy_bypass;
852 
853  if (ai->proxy)
854  proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR);
855  if (ai->proxyBypass)
856  proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR);
857  if (!pi || *size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired)
858  {
859  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
861  }
863  proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired);
864 
865  pi->dwAccessType = ai->accessType;
866  pi->lpszProxy = NULL;
867  pi->lpszProxyBypass = NULL;
868  if (ai->proxy) {
869  lstrcpyW(proxy, ai->proxy);
870  pi->lpszProxy = proxy;
871  }
872 
873  if (ai->proxyBypass) {
874  lstrcpyW(proxy_bypass, ai->proxyBypass);
875  pi->lpszProxyBypass = proxy_bypass;
876  }
877 
878  *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired;
879  return ERROR_SUCCESS;
880  }else {
882  DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
883  LPSTR proxy, proxy_bypass;
884 
885  if (ai->proxy)
886  proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL);
887  if (ai->proxyBypass)
888  proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1,
889  NULL, 0, NULL, NULL);
890  if (!pi || *size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired)
891  {
892  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
894  }
895  proxy = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA));
896  proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired);
897 
898  pi->dwAccessType = ai->accessType;
899  pi->lpszProxy = NULL;
900  pi->lpszProxyBypass = NULL;
901  if (ai->proxy) {
902  WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL);
903  pi->lpszProxy = proxy;
904  }
905 
906  if (ai->proxyBypass) {
907  WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass,
908  proxyBypassBytesRequired, NULL, NULL);
909  pi->lpszProxyBypass = proxy_bypass;
910  }
911 
912  *size = sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired;
913  return ERROR_SUCCESS;
914  }
915 
917  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
918 
919  if (*size < sizeof(ULONG))
921 
922  *(ULONG*)buffer = ai->connect_timeout;
923  *size = sizeof(ULONG);
924 
925  return ERROR_SUCCESS;
926  }
927 
928  return INET_QueryOption(hdr, option, buffer, size, unicode);
929 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
int proxy
Definition: main.c:67
char hdr[14]
Definition: iptest.cpp:33
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
static LPWSTR
Definition: internet.c:39
GLuint buffer
Definition: glext.h:5915
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:609
#define INTERNET_OPTION_PROXY
Definition: wininet.h:732
static DWORD
Definition: internet.c:34
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD accessType
Definition: internet.h:297
Definition: getopt.h:108
DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:2654
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static LPSTR
Definition: internet.c:38
#define INTERNET_OPTION_HANDLE_TYPE
Definition: wininet.h:710
__wchar_t WCHAR
Definition: xmlstorage.h:180
static refpint_t pi[]
Definition: server.c:96
unsigned long DWORD
Definition: ntddk_ex.h:95
LPWSTR proxy
Definition: internet.h:293
DWORD connect_timeout
Definition: internet.h:298
GLenum GLsizei len
Definition: glext.h:6722
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define INTERNET_PROXY_INFOW
Definition: wininet_test.h:56
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define INTERNET_PROXY_INFOA
Definition: wininet_test.h:55
#define INTERNET_HANDLE_TYPE_INTERNET
Definition: wininet.h:802
#define INTERNET_OPTION_CONNECT_TIMEOUT
Definition: wininet.h:701
LPWSTR agent
Definition: internet.h:292
LPWSTR proxyBypass
Definition: internet.h:294
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by query_global_option().

◆ APPINFO_SetOption()

static DWORD APPINFO_SetOption ( object_header_t hdr,
DWORD  option,
void buf,
DWORD  size 
)
static

Definition at line 931 of file internet.c.

932 {
933  appinfo_t *ai = (appinfo_t*)hdr;
934 
935  switch(option) {
937  TRACE("INTERNET_OPTION_CONNECT_TIMEOUT\n");
938 
939  if(size != sizeof(connect_timeout))
941  if(!*(ULONG*)buf)
942  return ERROR_BAD_ARGUMENTS;
943 
944  ai->connect_timeout = *(ULONG*)buf;
945  return ERROR_SUCCESS;
947  heap_free(ai->agent);
948  if (!(ai->agent = heap_strdupW(buf))) return ERROR_OUTOFMEMORY;
949  return ERROR_SUCCESS;
951  FIXME("INTERNET_OPTION_REFRESH\n");
952  return ERROR_SUCCESS;
953  }
954 
955  return INET_SetOption(hdr, option, buf, size);
956 }
char hdr[14]
Definition: iptest.cpp:33
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD INET_SetOption(object_header_t *hdr, DWORD option, void *buf, DWORD size)
Definition: internet.c:2753
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:232
#define ERROR_INTERNET_BAD_OPTION_LENGTH
Definition: wininet.h:1999
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: getopt.h:108
#define INTERNET_OPTION_REFRESH
Definition: wininet.h:731
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
static ULONG connect_timeout
Definition: internet.c:98
DWORD connect_timeout
Definition: internet.h:298
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735
unsigned int ULONG
Definition: retypes.h:1
#define INTERNET_OPTION_CONNECT_TIMEOUT
Definition: wininet.h:701
LPWSTR agent
Definition: internet.h:292
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ AsyncInternetOpenUrlProc()

static void AsyncInternetOpenUrlProc ( task_header_t hdr)
static

Definition at line 3710 of file internet.c.

3711 {
3713 
3714  TRACE("%p\n", task->hdr.hdr);
3715 
3716  INTERNET_InternetOpenUrlW((appinfo_t*)task->hdr.hdr, task->url, task->headers,
3717  task->headers_len, task->flags, task->context);
3718  heap_free(task->url);
3719  heap_free(task->headers);
3720 }
char hdr[14]
Definition: iptest.cpp:33
DWORD headers_len
Definition: internet.c:3705
WCHAR * headers
Definition: internet.c:3704
#define TRACE(s)
Definition: solgame.cpp:4
object_header_t * hdr
Definition: internet.h:390
task_header_t hdr
Definition: internet.c:3702
static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3603
DWORD_PTR context
Definition: internet.c:3707
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by InternetOpenUrlW().

◆ build_wpad_url()

static WCHAR* build_wpad_url ( const char hostname,
const struct addrinfo ai 
)
static

Definition at line 2385 of file internet.c.

2386 {
2387  char name[NI_MAXHOST];
2388  WCHAR *ret, *p;
2389  int len;
2390 
2391  while (ai && ai->ai_family != AF_INET && ai->ai_family != AF_INET6) ai = ai->ai_next;
2392  if (!ai) return NULL;
2393 
2394  if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
2395 
2396  len = lstrlenW( L"http://" ) + strlen( hostname ) + lstrlenW( L"/wpad.dat" );
2397  if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
2398  lstrcpyW( p, L"http://" );
2399  p += lstrlenW( L"http://" );
2400  while (*hostname) { *p++ = *hostname++; }
2401  lstrcpyW( p, L"/wpad.dat" );
2402  return ret;
2403 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define lstrlenW
Definition: compat.h:609
char * hostname
Definition: ftp.c:88
#define AF_INET6
Definition: winsock.h:369
static int reverse_lookup(const struct addrinfo *ai, char *hostname, size_t len)
Definition: internet.c:2380
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NI_MAXHOST
Definition: ws2def.h:359
int ret
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
struct addrinfo * ai_next
Definition: ws2def.h:672
Definition: name.c:38
#define AF_INET
Definition: tcpip.h:117
GLfloat GLfloat p
Definition: glext.h:8902
GLuint const GLchar * name
Definition: glext.h:6031
int ai_family
Definition: ws2def.h:666

Referenced by detect_proxy_autoconfig_url_dns().

◆ calc_url_length()

static BOOL calc_url_length ( LPURL_COMPONENTSW  lpUrlComponents,
LPDWORD  lpdwUrlLength 
)
static

Definition at line 4216 of file internet.c.

4218 {
4219  INTERNET_SCHEME nScheme;
4220 
4221  *lpdwUrlLength = 0;
4222 
4223  if (lpUrlComponents->lpszScheme)
4224  {
4225  DWORD dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, Scheme);
4226  *lpdwUrlLength += dwLen;
4227  nScheme = GetInternetSchemeW(lpUrlComponents->lpszScheme, dwLen);
4228  }
4229  else
4230  {
4231  LPCWSTR scheme;
4232 
4233  nScheme = lpUrlComponents->nScheme;
4234 
4235  if (nScheme == INTERNET_SCHEME_DEFAULT)
4236  nScheme = INTERNET_SCHEME_HTTP;
4237  scheme = INTERNET_GetSchemeString(nScheme);
4238  *lpdwUrlLength += lstrlenW(scheme);
4239  }
4240 
4241  (*lpdwUrlLength)++; /* ':' */
4242  if (!scheme_is_opaque(nScheme) || lpUrlComponents->lpszHostName)
4243  *lpdwUrlLength += strlen("//");
4244 
4245  if (lpUrlComponents->lpszUserName)
4246  {
4247  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UserName);
4248  *lpdwUrlLength += strlen("@");
4249  }
4250  else
4251  {
4252  if (lpUrlComponents->lpszPassword)
4253  {
4255  return FALSE;
4256  }
4257  }
4258 
4259  if (lpUrlComponents->lpszPassword)
4260  {
4261  *lpdwUrlLength += strlen(":");
4262  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, Password);
4263  }
4264 
4265  if (lpUrlComponents->lpszHostName)
4266  {
4267  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, HostName);
4268 
4269  if (!url_uses_default_port(nScheme, lpUrlComponents->nPort))
4270  {
4271  WCHAR port[MAX_WORD_DIGITS + 1];
4272 
4273  _ltow(lpUrlComponents->nPort, port, 10);
4274  *lpdwUrlLength += lstrlenW(port);
4275  *lpdwUrlLength += strlen(":");
4276  }
4277 
4278  if (lpUrlComponents->lpszUrlPath && *lpUrlComponents->lpszUrlPath != '/')
4279  (*lpdwUrlLength)++; /* '/' */
4280  }
4281 
4282  if (lpUrlComponents->lpszUrlPath)
4283  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
4284 
4285  if (lpUrlComponents->lpszExtraInfo)
4286  *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
4287 
4288  return TRUE;
4289 }
_CRTIMP wchar_t *__cdecl _ltow(_In_ long _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
static BOOL url_uses_default_port(INTERNET_SCHEME nScheme, INTERNET_PORT nPort)
Definition: internet.c:4170
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LPWSTR lpszExtraInfo
Definition: winhttp.h:478
LPWSTR lpszUrlPath
Definition: winhttp.h:476
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3837
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
DWORD scheme
#define lstrlenW
Definition: compat.h:609
#define FALSE
Definition: types.h:117
static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
Definition: internet.c:1600
INTERNET_SCHEME nScheme
Definition: winhttp.h:468
__wchar_t WCHAR
Definition: xmlstorage.h:180
INTERNET_SCHEME
Definition: wininet.h:135
unsigned long DWORD
Definition: ntddk_ex.h:95
INTERNET_PORT nPort
Definition: winhttp.h:471
#define MAX_WORD_DIGITS
Definition: internet.c:4163
LPWSTR lpszUserName
Definition: winhttp.h:472
LPWSTR lpszHostName
Definition: winhttp.h:469
LPWSTR lpszPassword
Definition: winhttp.h:474
#define URL_GET_COMP_LENGTH(url, component)
Definition: internet.c:4165
USHORT port
Definition: uri.c:228
LPWSTR lpszScheme
Definition: winhttp.h:466
static BOOL scheme_is_opaque(INTERNET_SCHEME nScheme)
Definition: internet.c:4193
static LPCWSTR INTERNET_GetSchemeString(INTERNET_SCHEME scheme)
Definition: internet.c:4202

Referenced by InternetCreateUrlW().

◆ convert_url_canonicalization_flags()

static DWORD convert_url_canonicalization_flags ( DWORD  dwFlags)
static

Definition at line 1953 of file internet.c.

1954 {
1956 
1957  if (dwFlags & ICU_BROWSER_MODE) dwUrlFlags |= URL_BROWSER_MODE;
1958  if (dwFlags & ICU_DECODE) dwUrlFlags |= URL_UNESCAPE;
1959  if (dwFlags & ICU_ENCODE_PERCENT) dwUrlFlags |= URL_ESCAPE_PERCENT;
1961  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
1962  if (dwFlags & ICU_NO_ENCODE) dwUrlFlags ^= URL_ESCAPE_UNSAFE;
1963  if (dwFlags & ICU_NO_META) dwUrlFlags |= URL_NO_META;
1964 
1965  return dwUrlFlags;
1966 }
#define URL_BROWSER_MODE
Definition: shlwapi.h:1219
#define ICU_ENCODE_PERCENT
Definition: winhttp.h:295
#define ICU_BROWSER_MODE
Definition: winhttp.h:294
#define ICU_NO_META
Definition: winhttp.h:292
#define URL_WININET_COMPATIBILITY
Definition: shlwapi.h:1209
#define ICU_ENCODE_SPACES_ONLY
Definition: winhttp.h:293
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ICU_NO_ENCODE
Definition: winhttp.h:290
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define URL_ESCAPE_PERCENT
Definition: shlwapi.h:1230
#define URL_ESCAPE_UNSAFE
Definition: shlwapi.h:1211
#define URL_UNESCAPE
Definition: shlwapi.h:1212
#define URL_NO_META
Definition: shlwapi.h:1215
#define ICU_DECODE
Definition: winhttp.h:291
#define URL_ESCAPE_SPACES_ONLY
Definition: shlwapi.h:1216

Referenced by InternetCanonicalizeUrlA(), and InternetCanonicalizeUrlW().

◆ convert_urlcomp_atow()

static void convert_urlcomp_atow ( LPURL_COMPONENTSA  lpUrlComponents,
LPURL_COMPONENTSW  urlCompW 
)
static

Definition at line 4291 of file internet.c.

4292 {
4293  INT len;
4294 
4295  ZeroMemory(urlCompW, sizeof(URL_COMPONENTSW));
4296 
4297  urlCompW->dwStructSize = sizeof(URL_COMPONENTSW);
4298  urlCompW->dwSchemeLength = lpUrlComponents->dwSchemeLength;
4299  urlCompW->nScheme = lpUrlComponents->nScheme;
4300  urlCompW->dwHostNameLength = lpUrlComponents->dwHostNameLength;
4301  urlCompW->nPort = lpUrlComponents->nPort;
4302  urlCompW->dwUserNameLength = lpUrlComponents->dwUserNameLength;
4303  urlCompW->dwPasswordLength = lpUrlComponents->dwPasswordLength;
4304  urlCompW->dwUrlPathLength = lpUrlComponents->dwUrlPathLength;
4305  urlCompW->dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength;
4306 
4307  if (lpUrlComponents->lpszScheme)
4308  {
4309  len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1;
4310  urlCompW->lpszScheme = heap_alloc(len * sizeof(WCHAR));
4311  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme,
4312  -1, urlCompW->lpszScheme, len);
4313  }
4314 
4315  if (lpUrlComponents->lpszHostName)
4316  {
4317  len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1;
4318  urlCompW->lpszHostName = heap_alloc(len * sizeof(WCHAR));
4319  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName,
4320  -1, urlCompW->lpszHostName, len);
4321  }
4322 
4323  if (lpUrlComponents->lpszUserName)
4324  {
4325  len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1;
4326  urlCompW->lpszUserName = heap_alloc(len * sizeof(WCHAR));
4327  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName,
4328  -1, urlCompW->lpszUserName, len);
4329  }
4330 
4331  if (lpUrlComponents->lpszPassword)
4332  {
4333  len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1;
4334  urlCompW->lpszPassword = heap_alloc(len * sizeof(WCHAR));
4335  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword,
4336  -1, urlCompW->lpszPassword, len);
4337  }
4338 
4339  if (lpUrlComponents->lpszUrlPath)
4340  {
4341  len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1;
4342  urlCompW->lpszUrlPath = heap_alloc(len * sizeof(WCHAR));
4343  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath,
4344  -1, urlCompW->lpszUrlPath, len);
4345  }
4346 
4347  if (lpUrlComponents->lpszExtraInfo)
4348  {
4349  len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1;
4350  urlCompW->lpszExtraInfo = heap_alloc(len * sizeof(WCHAR));
4351  MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo,
4352  -1, urlCompW->lpszExtraInfo, len);
4353  }
4354 }
LPWSTR lpszExtraInfo
Definition: winhttp.h:478
DWORD dwHostNameLength
Definition: winhttp.h:470
LPWSTR lpszUrlPath
Definition: winhttp.h:476
LPSTR lpszUserName
Definition: wininet.h:200
LPSTR lpszPassword
Definition: wininet.h:202
#define URL_GET_COMP_LENGTHA(url, component)
Definition: internet.c:4167
LPSTR lpszExtraInfo
Definition: wininet.h:206
LPSTR lpszScheme
Definition: wininet.h:194
DWORD dwUrlPathLength
Definition: wininet.h:205
DWORD dwUserNameLength
Definition: winhttp.h:473
#define CP_ACP
Definition: compat.h:109
LPSTR lpszUrlPath
Definition: wininet.h:204
DWORD dwUrlPathLength
Definition: winhttp.h:477
#define ZeroMemory
Definition: winbase.h:1664
int32_t INT
Definition: typedefs.h:58
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD dwPasswordLength
Definition: wininet.h:203
DWORD dwSchemeLength
Definition: winhttp.h:467
DWORD dwSchemeLength
Definition: wininet.h:195
DWORD dwUserNameLength
Definition: wininet.h:201
INTERNET_SCHEME nScheme
Definition: winhttp.h:468
DWORD dwHostNameLength
Definition: wininet.h:198
DWORD dwExtraInfoLength
Definition: winhttp.h:479
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD dwStructSize
Definition: winhttp.h:465
INTERNET_PORT nPort
Definition: winhttp.h:471
DWORD dwExtraInfoLength
Definition: wininet.h:207
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR lpszUserName
Definition: winhttp.h:472
LPWSTR lpszHostName
Definition: winhttp.h:469
LPWSTR lpszPassword
Definition: winhttp.h:474
INTERNET_PORT nPort
Definition: wininet.h:199
#define MultiByteToWideChar
Definition: compat.h:110
INTERNET_SCHEME nScheme
Definition: wininet.h:196
DWORD dwPasswordLength
Definition: winhttp.h:475
URL_COMPONENTS URL_COMPONENTSW
Definition: winhttp.h:481
LPSTR lpszHostName
Definition: wininet.h:197
LPWSTR lpszScheme
Definition: winhttp.h:466

Referenced by InternetCreateUrlA().

◆ create_req_file()

DWORD create_req_file ( const WCHAR file_name,
req_file_t **  ret 
)

Definition at line 3988 of file internet.c.

3989 {
3990  req_file_t *req_file;
3991 
3992  req_file = heap_alloc_zero(sizeof(*req_file));
3993  if(!req_file)
3994  return ERROR_NOT_ENOUGH_MEMORY;
3995 
3996  req_file->ref = 1;
3997 
3998  req_file->file_name = heap_strdupW(file_name);
3999  if(!req_file->file_name) {
4000  heap_free(req_file);
4001  return ERROR_NOT_ENOUGH_MEMORY;
4002  }
4003 
4006  if(req_file->file_handle == INVALID_HANDLE_VALUE) {
4007  req_file_release(req_file);
4008  return GetLastError();
4009  }
4010 
4011  *ret = req_file;
4012  return ERROR_SUCCESS;
4013 }
void req_file_release(req_file_t *req_file)
Definition: internet.c:4015
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG ref
Definition: internet.h:248
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:136
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
HANDLE file_handle
Definition: internet.h:249
#define OPEN_EXISTING
Definition: compat.h:634
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define GENERIC_READ
Definition: compat.h:135
#define NULL
Definition: types.h:112
static LPCWSTR file_name
Definition: protocol.c:147
#define CreateFileW
Definition: compat.h:600
WCHAR * file_name
Definition: internet.h:250
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_cache_entry().

◆ CreateMD5SSOHash()

BOOL WINAPI CreateMD5SSOHash ( PWSTR  pszChallengeInfo,
PWSTR  pwszRealm,
PWSTR  pwszTarget,
PBYTE  pbHexHash 
)

Definition at line 4690 of file internet.c.

4692 {
4693  FIXME("(%s, %s, %s, %p) stub\n", debugstr_w(pszChallengeInfo), debugstr_w(pwszRealm),
4694  debugstr_w(pwszTarget), pbHexHash);
4695  return FALSE;
4696 }
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

◆ detect_proxy_autoconfig_url_dhcp()

static WCHAR* detect_proxy_autoconfig_url_dhcp ( void  )
static

Definition at line 2300 of file internet.c.

2301 {
2302  IP_ADAPTER_ADDRESSES *adapters, *ptr;
2303  DHCPCAPI_PARAMS_ARRAY send_params, recv_params;
2306  DWORD err, size;
2307  BYTE *tmp, *buf = NULL;
2308 
2309  if (!(adapters = get_adapters())) return NULL;
2310 
2311  memset( &send_params, 0, sizeof(send_params) );
2312  memset( &param, 0, sizeof(param) );
2313  param.OptionId = OPTION_MSFT_IE_PROXY;
2314  recv_params.nParams = 1;
2315  recv_params.Params = &param;
2316 
2317  for (ptr = adapters; ptr; ptr = ptr->Next)
2318  {
2319  MultiByteToWideChar( CP_ACP, 0, ptr->AdapterName, -1, name, ARRAY_SIZE(name) );
2320  TRACE( "adapter '%s' type %u dhcpv4 enabled %d\n", wine_dbgstr_w(name), ptr->IfType, ptr->Dhcpv4Enabled );
2321 
2322  if (ptr->IfType == IF_TYPE_SOFTWARE_LOOPBACK) continue;
2323  /* FIXME: also skip adapters where DHCP is disabled */
2324 
2325  size = 256;
2326  if (!(buf = heap_alloc( size ))) goto done;
2327  err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
2328  buf, &size, NULL );
2329  while (err == ERROR_MORE_DATA)
2330  {
2331  if (!(tmp = heap_realloc( buf, size ))) goto done;
2332  buf = tmp;
2333  err = DhcpRequestParams( DHCPCAPI_REQUEST_SYNCHRONOUS, NULL, name, NULL, send_params, recv_params,
2334  buf, &size, NULL );
2335  }
2336  if (err == ERROR_SUCCESS && param.nBytesData)
2337  {
2338  int len = MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, NULL, 0 );
2339  if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
2340  {
2341  MultiByteToWideChar( CP_ACP, 0, (const char *)param.Data, param.nBytesData, ret, len );
2342  ret[len] = 0;
2343  }
2344  TRACE("returning %s\n", debugstr_w(ret));
2345  break;
2346  }
2347  }
2348 
2349 done:
2350  heap_free( buf );
2351  heap_free( adapters );
2352  return ret;
2353 }
#define ERROR_SUCCESS
Definition: deptool.c:10
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define CP_ACP
Definition: compat.h:109
#define DHCPCAPI_REQUEST_SYNCHRONOUS
Definition: dhcpcsdk.h:115
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define OPTION_MSFT_IE_PROXY
Definition: dhcpcsdk.h:87
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
#define IF_TYPE_SOFTWARE_LOOPBACK
Definition: ipifcons.h:44
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
static IP_ADAPTER_ADDRESSES * get_adapters(void)
Definition: internet.c:2281
int ret
#define MAX_ADAPTER_NAME_LENGTH
Definition: iptypes.h:27
GLenum GLsizei len
Definition: glext.h:6722
#define err(...)
#define ERROR_MORE_DATA
Definition: dderror.h:13
unsigned char BYTE
Definition: xxhash.c:193
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
LPDHCPCAPI_PARAMS Params
Definition: dhcpcsdk.h:104
Definition: name.c:38
#define memset(x, y, z)
Definition: compat.h:39
DWORD APIENTRY DhcpRequestParams(DWORD Flags, PVOID Reserved, LPWSTR AdapterName, LPDHCPCAPI_CLASSID ClassId, DHCPCAPI_PARAMS_ARRAY SendParams, DHCPCAPI_PARAMS_ARRAY RecdParams, LPBYTE Buffer, LPDWORD pSize, LPWSTR RequestIdStr)
Definition: dhcpcsvc.c:259
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by get_proxy_autoconfig_url().

◆ detect_proxy_autoconfig_url_dns()

static WCHAR* detect_proxy_autoconfig_url_dns ( void  )
static

Definition at line 2405 of file internet.c.

2406 {
2407  char *fqdn, *domain, *p;
2408  WCHAR *ret = NULL;
2409 
2410  if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return NULL;
2411  if (!(domain = get_computer_name( ComputerNamePhysicalDnsDomain )))
2412  {
2413  heap_free( fqdn );
2414  return NULL;
2415  }
2416  p = fqdn;
2417  while ((p = strchr( p, '.' )) && is_domain_suffix( p + 1, domain ))
2418  {
2419  char *name;
2420  struct addrinfo *ai;
2421  int res;
2422 
2423  if (!(name = heap_alloc( sizeof("wpad") + strlen(p) )))
2424  {
2425  heap_free( fqdn );
2426  heap_free( domain );
2427  return NULL;
2428  }
2429  strcpy( name, "wpad" );
2430  strcat( name, p );
2431  res = getaddrinfo( name, NULL, NULL, &ai );
2432  if (!res)
2433  {
2434  ret = build_wpad_url( name, ai );
2435  freeaddrinfo( ai );
2436  if (ret)
2437  {
2438  TRACE("returning %s\n", debugstr_w(ret));
2439  heap_free( name );
2440  break;
2441  }
2442  }
2443  heap_free( name );
2444  p++;
2445  }
2446  heap_free( domain );
2447  heap_free( fqdn );
2448  return ret;
2449 }
#define freeaddrinfo
Definition: wspiapi.h:46
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
static BOOL is_domain_suffix(const char *domain, const char *suffix)
Definition: internet.c:2371
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
Definition: cookie.c:41
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static WCHAR * build_wpad_url(const char *hostname, const struct addrinfo *ai)
Definition: internet.c:2385
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define NULL
Definition: types.h:112
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: internet.c:2355
Definition: name.c:38
GLuint res
Definition: glext.h:9613
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define getaddrinfo
Definition: wspiapi.h:44
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by get_proxy_autoconfig_url().

◆ DetectAutoProxyUrl()

BOOL WINAPI DetectAutoProxyUrl ( LPSTR  lpszAutoProxyUrl,
DWORD  dwAutoProxyUrlLength,
DWORD  dwDetectFlags 
)

Definition at line 462 of file internet.c.

464 {
465  FIXME("STUB\n");
467  return FALSE;
468 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:611
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 317 of file internet.c.

318 {
319  FIXME("(%x %s): stub\n", bInstall, debugstr_w(cmdline));
320  return S_OK;
321 }
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:51

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 266 of file internet.c.

267 {
268  TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
269 
270  switch (fdwReason) {
271  case DLL_PROCESS_ATTACH:
272 
274 
276  return FALSE;
277 
278  if(!init_urlcache())
279  {
281  return FALSE;
282  }
283 
284  WININET_hModule = hinstDLL;
285  break;
286 
287  case DLL_THREAD_ATTACH:
288  break;
289 
290  case DLL_THREAD_DETACH:
292  {
294  }
295  break;
296 
297  case DLL_PROCESS_DETACH:
298  if (lpvReserved) break;
300  NETCON_unload();
301  free_urlcache();
302  free_cookie();
303 
305  {
308  }
309  break;
310  }
311  return TRUE;
312 }
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:132
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_THREAD_DETACH
Definition: compat.h:133
static IN DWORD IN LPVOID lpvReserved
void free_urlcache(void) DECLSPEC_HIDDEN
Definition: urlcache.c:4130
#define FALSE
Definition: types.h:117
HMODULE WININET_hModule
Definition: internet.c:73
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define TRACE(s)
Definition: solgame.cpp:4
BOOL init_urlcache(void) DECLSPEC_HIDDEN
Definition: urlcache.c:4112
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1154
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:235
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1088
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:546
static void free_cookie(struct cookie *cookie)
Definition: cookie.c:90
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
void NETCON_unload(void) DECLSPEC_HIDDEN
static DWORD g_dwTlsErrIndex
Definition: internet.c:72
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ dump_INTERNET_FLAGS()

static void dump_INTERNET_FLAGS ( DWORD  dwFlags)
static

Definition at line 721 of file internet.c.

722 {
723 #define FE(x) { x, #x }
724  static const wininet_flag_info flag[] = {
753  };
754 #undef FE
755  unsigned int i;
756 
757  for (i = 0; i < ARRAY_SIZE(flag); i++) {
758  if (flag[i].val & dwFlags) {
759  TRACE(" %s", flag[i].name);
760  dwFlags &= ~flag[i].val;
761  }
762  }
763  if (dwFlags)
764  TRACE(" Unknown flags (%08x)\n", dwFlags);
765  else
766  TRACE("\n");
767 }
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
#define INTERNET_FLAG_NEED_FILE
Definition: wininet.h:88
#define INTERNET_FLAG_CACHE_ASYNC
Definition: wininet.h:86
#define INTERNET_FLAG_TRANSFER_BINARY
Definition: wininet.h:91
#define INTERNET_FLAG_SECURE
Definition: wininet.h:71
#define INTERNET_FLAG_HYPERLINK
Definition: wininet.h:83
#define INTERNET_FLAG_RELOAD
Definition: wininet.h:61
#define INTERNET_FLAG_RESYNCHRONIZE
Definition: wininet.h:82
#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID
Definition: wininet.h:81
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
Definition: wininet.h:79
#define INTERNET_FLAG_EXISTING_CONNECT
Definition: wininet.h:63
#define INTERNET_FLAG_RAW_DATA
Definition: wininet.h:62
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
#define INTERNET_FLAG_NO_AUTO_REDIRECT
Definition: wininet.h:73
#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP
Definition: wininet.h:78
#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
Definition: wininet.h:80
#define INTERNET_FLAG_FROM_CACHE
Definition: wininet.h:69
#define INTERNET_FLAG_NO_AUTH
Definition: wininet.h:76
#define INTERNET_FLAG_ASYNC
Definition: wininet.h:64
#define INTERNET_FLAG_TRANSFER_ASCII
Definition: wininet.h:90
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
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define INTERNET_FLAG_MAKE_PERSISTENT
Definition: wininet.h:68
#define FE(x)
#define INTERNET_FLAG_PASSIVE
Definition: wininet.h:65
#define INTERNET_FLAG_NO_UI
Definition: wininet.h:84
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
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
#define ARRAY_SIZE(a)
Definition: main.h:24
#define INTERNET_FLAG_CACHE_IF_NET_FAIL
Definition: wininet.h:77
#define INTERNET_FLAG_NO_COOKIES
Definition: wininet.h:75
Definition: name.c:38
#define INTERNET_FLAG_FORMS_SUBMIT
Definition: wininet.h:87
#define INTERNET_FLAG_READ_PREFETCH
Definition: wininet.h:74
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72

Referenced by InternetOpenUrlW(), and InternetOpenW().

◆ free_global_proxy()

static void free_global_proxy ( void  )
static

Definition at line 480 of file internet.c.

481 {
483  if (global_proxy)
484  {
487  }
489 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static proxyinfo_t * global_proxy
Definition: internet.c:478
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:470
static CRITICAL_SECTION WININET_cs
Definition: internet.c:75
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by InternetSetOptionW().

◆ FreeProxyInfo()

static void FreeProxyInfo ( proxyinfo_t lpwpi)
static

Definition at line 470 of file internet.c.

471 {
472  heap_free(lpwpi->proxy);
473  heap_free(lpwpi->proxyBypass);
474  heap_free(lpwpi->proxyUsername);
475  heap_free(lpwpi->proxyPassword);
476 }
LPWSTR proxyBypass
Definition: internet.c:92
LPWSTR proxyPassword
Definition: internet.c:94
LPWSTR proxyUsername
Definition: internet.c:93
LPWSTR proxy
Definition: internet.c:91
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by free_global_proxy(), INTERNET_ConfigureProxy(), INTERNET_LoadProxySettings(), InternetSetOptionW(), and query_global_option().

◆ get_adapters()

static IP_ADAPTER_ADDRESSES* get_adapters ( void  )
static

Definition at line 2281 of file internet.c.

2282 {
2283  ULONG err, size = 1024, flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
2284  GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_SKIP_FRIENDLY_NAME;
2285  IP_ADAPTER_ADDRESSES *tmp, *ret;
2286 
2287  if (!(ret = heap_alloc( size ))) return NULL;
2288  err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2289  while (err == ERROR_BUFFER_OVERFLOW)
2290  {
2291  if (!(tmp = heap_realloc( ret, size ))) break;
2292  ret = tmp;
2293  err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2294  }
2295  if (err == ERROR_SUCCESS) return ret;
2296  heap_free( ret );
2297  return NULL;
2298 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define GAA_FLAG_SKIP_FRIENDLY_NAME
#define AF_UNSPEC
Definition: winsock.h:344
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
int ret
#define err(...)
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by detect_proxy_autoconfig_url_dhcp().

◆ get_computer_name()

static char* get_computer_name ( COMPUTER_NAME_FORMAT  format)
static

Definition at line 2355 of file internet.c.

2356 {
2357  char *ret;
2358  DWORD size = 0;
2359 
2361  if (GetLastError() != ERROR_MORE_DATA) return NULL;
2362  if (!(ret = heap_alloc( size ))) return NULL;
2363  if (!GetComputerNameExA( format, ret, &size ))
2364  {
2365  heap_free( ret );
2366  return NULL;
2367  }
2368  return ret;
2369 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
Definition: compname.c:376
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define NULL
Definition: types.h:112
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by detect_proxy_autoconfig_url_dns().

◆ get_handle_object()

object_header_t* get_handle_object ( HINTERNET  hinternet)

Definition at line 176 of file internet.c.

177 {
179  UINT_PTR handle = (UINT_PTR) hinternet;
180 
182 
185 
187 
188  TRACE("handle %ld -> %p\n", handle, info);
189 
190  return info;
191 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__inline int valid_handle(HANDLE handle)
Definition: util.h:281
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:169
#define TRACE(s)
Definition: solgame.cpp:4
static UINT_PTR handle_table_size
Definition: internet.c:86
static CRITICAL_SECTION WININET_cs
Definition: internet.c:75
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
struct _test_info info[]
Definition: SetCursorPos.c:19
#define NULL
Definition: types.h:112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by FtpCommandW(), FtpCreateDirectoryW(), FtpDeleteFileW(), FtpFindFirstFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpAddRequestHeadersW(), HttpEndRequestW(), HttpOpenRequestW(), HttpQueryInfoW(), HttpSendRequestExW(), HttpSendRequestW(), InternetCloseHandle(), InternetConnectW(), InternetErrorDlg(), InternetFindNextFileW(), InternetLockRequestFile(), InternetOpenUrlW(), InternetQueryDataAvailable(), InternetQueryOptionA(), InternetQueryOptionW(), InternetReadFile(), InternetReadFileExA(), InternetReadFileExW(), InternetSetOptionW(), InternetSetStatusCallbackA(), InternetSetStatusCallbackW(), and InternetWriteFile().

◆ get_proxy_autoconfig_url()

static WCHAR* get_proxy_autoconfig_url ( void  )
static

Definition at line 2451 of file internet.c.

2452 {
2455  return ret;
2456 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static WCHAR * detect_proxy_autoconfig_url_dns(void)
Definition: internet.c:2405
static WCHAR * detect_proxy_autoconfig_url_dhcp(void)
Definition: internet.c:2300

Referenced by query_global_option().

◆ GetInternetSchemeW()

static INTERNET_SCHEME GetInternetSchemeW ( LPCWSTR  lpszScheme,
DWORD  nMaxCmp 
)
static

Definition at line 1600 of file internet.c.

1601 {
1602  int i;
1603 
1604  TRACE("%s %d\n",debugstr_wn(lpszScheme, nMaxCmp), nMaxCmp);
1605 
1606  if(lpszScheme==NULL)
1607  return INTERNET_SCHEME_UNKNOWN;
1608 
1609  for (i = 0; i < ARRAY_SIZE(url_schemes); i++)
1610  if (!wcsnicmp(lpszScheme, url_schemes[i], nMaxCmp))
1611  return INTERNET_SCHEME_FIRST + i;
1612 
1613  return INTERNET_SCHEME_UNKNOWN;
1614 }
#define TRACE(s)
Definition: solgame.cpp:4
#define wcsnicmp
Definition: compat.h:14
#define debugstr_wn
Definition: kernel32.h:33
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
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
static const WCHAR * url_schemes[]
Definition: internet.c:1575

Referenced by calc_url_length(), InternetCrackUrlW(), and InternetCreateUrlW().

◆ INET_QueryOption()

DWORD INET_QueryOption ( object_header_t hdr,
DWORD  option,
void buffer,
DWORD size,
BOOL  unicode 
)

Definition at line 2654 of file internet.c.

2655 {
2656  switch(option) {
2658  if (!size)
2659  return ERROR_INVALID_PARAMETER;
2660 
2661  if (*size < sizeof(DWORD_PTR)) {
2662  *size = sizeof(DWORD_PTR);
2664  }
2665  if (!buffer)
2666  return ERROR_INVALID_PARAMETER;
2667 
2668  *(DWORD_PTR *)buffer = hdr->dwContext;
2669  *size = sizeof(DWORD_PTR);
2670  return ERROR_SUCCESS;
2671 
2673  WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
2674  *size = sizeof(DWORD);
2676 
2679  WARN("Called on global option %u\n", option);
2681  }
2682 
2683  /* FIXME: we shouldn't call it here */
2684  return query_global_option(option, buffer, size, unicode);
2685 }
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
char hdr[14]
Definition: iptest.cpp:33
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define WARN(fmt,...)
Definition: debug.h:112
GLuint buffer
Definition: glext.h:5915
static DWORD
Definition: internet.c:34
Definition: getopt.h:108
#define INTERNET_OPTION_REQUEST_FLAGS
Definition: wininet.h:718
GLsizeiptr size
Definition: glext.h:5919
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:2458
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005
#define INTERNET_OPTION_CONTEXT_VALUE
Definition: wininet.h:739
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by APPINFO_QueryOption(), FTPFILE_QueryOption(), FTPFINDNEXT_QueryOption(), FTPSESSION_QueryOption(), and HTTPSESSION_QueryOption().

◆ INET_SetOption()

DWORD INET_SetOption ( object_header_t hdr,
DWORD  option,
void buf,
DWORD  size 
)

Definition at line 2753 of file internet.c.

2754 {
2755  switch(option) {
2757  FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
2759  return ERROR_SUCCESS;
2761  WARN("Not settable option %u\n", option);
2765  WARN("Called on global option %u\n", option);
2769  }
2770 
2772 }
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define ERROR_INTERNET_OPTION_NOT_SETTABLE
Definition: wininet.h:2000
#define WARN(fmt,...)
Definition: debug.h:112
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: getopt.h:108
#define INTERNET_OPTION_CALLBACK
Definition: wininet.h:700
#define INTERNET_OPTION_REFRESH
Definition: wininet.h:731
#define INTERNET_OPTION_SETTINGS_CHANGED
Definition: wininet.h:733
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:235
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764
#define ERROR_INTERNET_INVALID_OPTION
Definition: wininet.h:1998
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005

Referenced by APPINFO_SetOption(), HTTPREQ_SetOption(), HTTPSESSION_SetOption(), and set_global_option().

◆ INTERNET_AllocThreadError()

static LPWITHREADERROR INTERNET_AllocThreadError ( void  )
static

Definition at line 3810 of file internet.c.

3811 {
3812  LPWITHREADERROR lpwite = heap_alloc(sizeof(*lpwite));
3813 
3814  if (lpwite)
3815  {
3816  lpwite->dwError = 0;
3817  lpwite->response[0] = '\0';
3818  }
3819 
3820  if (!TlsSetValue(g_dwTlsErrIndex, lpwite))
3821  {
3822  heap_free(lpwite);
3823  return NULL;
3824  }
3825  return lpwite;
3826 }
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:69
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
DWORD dwError
Definition: internet.c:68
#define NULL
Definition: types.h:112
static DWORD g_dwTlsErrIndex
Definition: internet.c:72
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by INTERNET_GetResponseBuffer(), and INTERNET_SetLastError().

◆ INTERNET_AsyncCall()

DWORD INTERNET_AsyncCall ( task_header_t task)

Definition at line 3915 of file internet.c.

3916 {
3917  BOOL bSuccess;
3918 
3919  TRACE("\n");
3920 
3922  if (!bSuccess)
3923  {
3924  heap_free(task);
3926  }
3927  return ERROR_SUCCESS;
3928 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
Definition: internet.c:3876
static BOOLEAN bSuccess
Definition: drive.cpp:432
#define ERROR_INTERNET_ASYNC_THREAD_FAILED
Definition: wininet.h:2035
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1077
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1064
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by async_read(), FtpCreateDirectoryW(), FtpDeleteFileW(), FTPFILE_QueryDataAvailable(), FtpFindFirstFileW(), FTPFINDNEXT_FindNextFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpEndRequestW(), HttpSendRequestExW(), HttpSendRequestW(), and InternetOpenUrlW().

◆ INTERNET_ConfigureProxy()

static BOOL INTERNET_ConfigureProxy ( appinfo_t lpwai)
static

Definition at line 688 of file internet.c.

689 {
690  proxyinfo_t wpi;
691 
692  if (INTERNET_LoadProxySettings( &wpi ))
693  return FALSE;
694 
695  if (wpi.proxyEnabled)
696  {
697  TRACE("http proxy = %s bypass = %s\n", debugstr_w(wpi.proxy), debugstr_w(wpi.proxyBypass));
698 
700  lpwai->proxy = wpi.proxy;
701  lpwai->proxyBypass = wpi.proxyBypass;
702  lpwai->proxyUsername = wpi.proxyUsername;
703  lpwai->proxyPassword = wpi.proxyPassword;
704  return TRUE;
705  }
706 
708  FreeProxyInfo(&wpi);
709  return FALSE;
710 }
#define TRUE
Definition: types.h:120
LPWSTR proxyBypass
Definition: internet.c:92
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
DWORD proxyEnabled
Definition: internet.c:90
LPWSTR proxyPassword
Definition: internet.c:94
LPWSTR proxyUsername
Definition: internet.h:295
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
DWORD accessType
Definition: internet.h:297
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:470
LPWSTR proxyUsername
Definition: internet.c:93
LPWSTR proxyPassword
Definition: internet.h:296
#define TRACE(s)
Definition: solgame.cpp:4
static LONG INTERNET_LoadProxySettings(proxyinfo_t *lpwpi)
Definition: internet.c:538
LPWSTR proxy
Definition: internet.h:293
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
LPWSTR proxy
Definition: internet.c:91
LPWSTR proxyBypass
Definition: internet.h:294

Referenced by InternetOpenW(), and query_global_option().

◆ INTERNET_FindProxyForProtocol()

WCHAR* INTERNET_FindProxyForProtocol ( LPCWSTR  szProxy,
LPCWSTR  proto 
)

Definition at line 384 of file internet.c.

385 {
386  WCHAR *ret = NULL;
387  const WCHAR *ptr;
388 
389  TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
390 
391  /* First, look for the specified protocol (proto=scheme://host:port) */
392  for (ptr = szProxy; ptr && *ptr; )
393  {
394  LPCWSTR end, equal;
395 
396  if (!(end = wcschr(ptr, ' ')))
397  end = ptr + lstrlenW(ptr);
398  if ((equal = wcschr(ptr, '=')) && equal < end &&
399  equal - ptr == lstrlenW(proto) &&
401  {
402  ret = heap_strndupW(equal + 1, end - equal - 1);
403  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
404  return ret;
405  }
406  if (*end == ' ')
407  ptr = end + 1;
408  else
409  ptr = end;
410  }
411 
412  /* It wasn't found: look for no protocol */
413  for (ptr = szProxy; ptr && *ptr; )
414  {
415  LPCWSTR end;
416 
417  if (!(end = wcschr(ptr, ' ')))
418  end = ptr + lstrlenW(ptr);
419  if (!wcschr(ptr, '='))
420  {
421  ret = heap_strndupW(ptr, end - ptr);
422  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
423  return ret;
424  }
425  if (*end == ' ')
426  ptr = end + 1;
427  else
428  ptr = end;
429  }
430 
431  return NULL;
432 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define equal(x, y)
Definition: reader.cc:56
#define lstrlenW
Definition: compat.h:609
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint GLuint end
Definition: gl.h:1545
int ret
#define wcsnicmp
Definition: compat.h:14
#define NULL
Definition: types.h:112

Referenced by HTTP_DealWithProxy().

◆ INTERNET_GetLastError()

DWORD INTERNET_GetLastError ( void  )

Definition at line 3858 of file internet.c.

3859 {
3861  if (!lpwite) return 0;
3862  /* TlsGetValue clears last error, so set it again here */
3863  SetLastError(lpwite->dwError);
3864  return lpwite->dwError;
3865 }
DWORD dwError
Definition: internet.c:68
#define SetLastError(x)
Definition: compat.h:611
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:72

Referenced by FTP_FtpCreateDirectoryW(), FTP_FtpDeleteFileW(), FTP_FtpFindFirstFileW(), FTP_FtpGetFileW(), FTP_FtpOpenFileW(), FTP_FtpPutFileW(), FTP_FtpRemoveDirectoryW(), FTP_FtpRenameFileW(), FTP_ReceiveRequestData(), HTTP_HandleRedirect(), and InternetConnectW().

◆ INTERNET_GetResponseBuffer()

LPSTR INTERNET_GetResponseBuffer ( void  )

Definition at line 3937 of file internet.c.

3938 {
3940  if (!lpwite)
3941  lpwite = INTERNET_AllocThreadError();
3942  TRACE("\n");
3943  return lpwite->response;
3944 }
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:69
#define TRACE(s)
Definition: solgame.cpp:4
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3810
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:72

Referenced by FTP_DoPassive(), FTP_FtpGetCurrentDirectoryW(), FTP_GetNextLine(), and FTP_ReceiveResponse().

◆ INTERNET_GetSchemeString()

static LPCWSTR INTERNET_GetSchemeString ( INTERNET_SCHEME  scheme)
static

Definition at line 4202 of file internet.c.

4203 {
4204  int index;
4206  return NULL;
4208  if (index >= ARRAY_SIZE(url_schemes))
4209  return NULL;
4210  return url_schemes[index];
4211 }
DWORD scheme
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112
static const WCHAR * url_schemes[]
Definition: internet.c:1575

Referenced by calc_url_length(), and InternetCreateUrlW().

◆ INTERNET_InternetOpenUrlW()

static HINTERNET INTERNET_InternetOpenUrlW ( appinfo_t hIC,
LPCWSTR  lpszUrl,
LPCWSTR  lpszHeaders,
DWORD  dwHeadersLength,
DWORD  dwFlags,
DWORD_PTR  dwContext 
)
static

Definition at line 3603 of file internet.c.

3605 {
3606  URL_COMPONENTSW urlComponents = { sizeof(urlComponents) };
3607  WCHAR *host, *user = NULL, *pass = NULL, *path;
3608  HINTERNET client = NULL, client1 = NULL;
3609  DWORD res;
3610 
3611  TRACE("(%p, %s, %s, %08x, %08x, %08lx)\n", hIC, debugstr_w(lpszUrl), debugstr_w(lpszHeaders),
3612  dwHeadersLength, dwFlags, dwContext);
3613 
3614  urlComponents.dwHostNameLength = 1;
3615  urlComponents.dwUserNameLength = 1;
3616  urlComponents.dwPasswordLength = 1;
3617  urlComponents.dwUrlPathLength = 1;
3618  urlComponents.dwExtraInfoLength = 1;
3619  if(!InternetCrackUrlW(lpszUrl, lstrlenW(lpszUrl), 0, &urlComponents))
3620  return NULL;
3621 
3622  if ((urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
3623  urlComponents.dwExtraInfoLength)
3624  {
3625  assert(urlComponents.lpszUrlPath + urlComponents.dwUrlPathLength == urlComponents.lpszExtraInfo);
3626  urlComponents.dwUrlPathLength += urlComponents.dwExtraInfoLength;
3627  }
3628 
3629  host = heap_strndupW(urlComponents.lpszHostName, urlComponents.dwHostNameLength);
3630  path = heap_strndupW(urlComponents.lpszUrlPath, urlComponents.dwUrlPathLength);
3631  if(urlComponents.dwUserNameLength)
3632  user = heap_strndupW(urlComponents.lpszUserName, urlComponents.dwUserNameLength);
3633  if(urlComponents.dwPasswordLength)
3634  pass = heap_strndupW(urlComponents.lpszPassword, urlComponents.dwPasswordLength);
3635 
3636  switch(urlComponents.nScheme) {
3637  case INTERNET_SCHEME_FTP:
3638  client = FTP_Connect(hIC, host, urlComponents.nPort,
3639  user, pass, dwFlags, dwContext, INET_OPENURL);
3640  if(client == NULL)
3641  break;
3642  client1 = FtpOpenFileW(client, path, GENERIC_READ, dwFlags, dwContext);
3643  if(client1 == NULL) {
3645  break;
3646  }
3647  break;
3648 
3649  case INTERNET_SCHEME_HTTP:
3650  case INTERNET_SCHEME_HTTPS: {
3651  LPCWSTR accept[2] = { L"*/*", NULL };
3652 
3653  if (urlComponents.nScheme == INTERNET_SCHEME_HTTPS) dwFlags |= INTERNET_FLAG_SECURE;
3654 
3655  /* FIXME: should use pointers, not handles, as handles are not thread-safe */
3656  res = HTTP_Connect(hIC, host, urlComponents.nPort,
3657  user, pass, dwFlags, dwContext, INET_OPENURL, &client);
3658  if(res != ERROR_SUCCESS) {
3660  break;
3661  }
3662 
3663  client1 = HttpOpenRequestW(client, NULL, path, NULL, NULL, accept, dwFlags, dwContext);
3664  if(client1 == NULL) {
3666  break;
3667  }
3668  HttpAddRequestHeadersW(client1, lpszHeaders, dwHeadersLength, HTTP_ADDREQ_FLAG_ADD);
3669  if (!HttpSendRequestW(client1, NULL, 0, NULL, 0) &&
3671  InternetCloseHandle(client1);
3672  client1 = NULL;
3673  break;
3674  }
3675  }
3677  /* gopher doesn't seem to be implemented in wine, but it's supposed
3678  * to be supported by InternetOpenUrlA. */
3679  default:
3681  break;
3682  }
3683 
3684  TRACE(" %p <--\n", client1);
3685 
3686  heap_free(host);
3687  heap_free(path);
3688  heap_free(user);
3689  heap_free(pass);
3690  return client1;
3691 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
#define ERROR_SUCCESS
Definition: deptool.c:10
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3837
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLsizei const GLchar ** path
Definition: glext.h:7234
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME
Definition: wininet.h:1995
HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName, DWORD fdwAccess, DWORD dwFlags, DWORD_PTR dwContext)
Definition: ftp.c:1485
#define INTERNET_FLAG_SECURE
Definition: wininet.h:71
char * host
Definition: whois.c:55
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD dwUserNameLength
Definition: wininet.h:219
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1414
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define lstrlenW
Definition: compat.h:609
LPWSTR lpszHostName
Definition: wininet.h:215
LPWSTR lpszExtraInfo
Definition: wininet.h:224
pass
Definition: typegen.h:24
INTERNET_PORT nPort
Definition: wininet.h:217
#define debugstr_w
Definition: kernel32.h:32
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5595
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:5836
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
INTERNET_SCHEME nScheme
Definition: wininet.h:214
static FILE * client
Definition: client.c:41
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
DWORD dwPasswordLength
Definition: wininet.h:221
DWORD dwHostNameLength
Definition: wininet.h:216
LPWSTR lpszUserName
Definition: wininet.h:218
static const WCHAR L[]
Definition: oid.c:1250
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LPWSTR lpszUrlPath
Definition: wininet.h:222
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1297
#define GENERIC_READ
Definition: compat.h:135
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
DWORD dwUrlPathLength
Definition: wininet.h:223
#define INET_OPENURL
Definition: internet.h:243
#define NULL
Definition: types.h:112
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
GLuint res
Definition: glext.h:9613
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:3469
void user(int argc, const char *argv[])
Definition: cmds.c:1350
LPWSTR lpszPassword
Definition: wininet.h:220
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
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:2428
DWORD dwExtraInfoLength
Definition: wininet.h:225

Referenced by AsyncInternetOpenUrlProc(), and InternetOpenUrlW().

◆ INTERNET_LoadProxySettings()

static LONG INTERNET_LoadProxySettings ( proxyinfo_t lpwpi)
static

Definition at line 538 of file internet.c.

539 {
540  HKEY key;
541  DWORD type, len;
542  const WCHAR *envproxy;
543  LONG ret;
544 
545  memset( lpwpi, 0, sizeof(*lpwpi) );
546 
548  if (global_proxy)
549  {
551  lpwpi->proxy = heap_strdupW( global_proxy->proxy );
553  }
555 
557  {
558  FreeProxyInfo( lpwpi );
559  return ret;
560  }
561 
562  len = sizeof(DWORD);
563  if (RegQueryValueExW( key, L"ProxyEnable", NULL, &type, (BYTE *)&lpwpi->proxyEnabled, &len ) || type != REG_DWORD)
564  {
565  lpwpi->proxyEnabled = 0;
566  if((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE *)&lpwpi->proxyEnabled, sizeof(DWORD) )))
567  {
568  FreeProxyInfo( lpwpi );
569  RegCloseKey( key );
570  return ret;
571  }
572  }
573 
574  if (!(envproxy = _wgetenv( L"http_proxy" )) || lpwpi->proxyEnabled)
575  {
576  /* figure out how much memory the proxy setting takes */
577  if (!RegQueryValueExW( key, L"ProxyServer", NULL, &type, NULL, &len ) && len && (type == REG_SZ))
578  {
579  LPWSTR szProxy, p;
580 
581  if (!(szProxy = heap_alloc(len)))
582  {
583  RegCloseKey( key );
584  FreeProxyInfo( lpwpi );
585  return ERROR_OUTOFMEMORY;
586  }
587  RegQueryValueExW( key, L"ProxyServer", NULL, &type, (BYTE*)szProxy, &len );
588 
589  /* find the http proxy, and strip away everything else */
590  p = wcsstr( szProxy, L"http=" );
591  if (p)
592  {
593  p += lstrlenW( L"http=" );
594  lstrcpyW( szProxy, p );
595  }
596  p = wcschr( szProxy, ';' );
597  if (p) *p = 0;
598 
599  FreeProxyInfo( lpwpi );
600  lpwpi->proxy = szProxy;
601  lpwpi->proxyBypass = NULL;
602 
603  TRACE("http proxy (from registry) = %s\n", debugstr_w(lpwpi->proxy));
604  }
605  else
606  {
607  TRACE("No proxy server settings in registry.\n");
608  FreeProxyInfo( lpwpi );
609  lpwpi->proxy = NULL;
610  lpwpi->proxyBypass = NULL;
611  }
612  }
613  else if (envproxy)
614  {
615  FreeProxyInfo( lpwpi );
616  if (parse_proxy_url( lpwpi, envproxy ))
617  {
618  TRACE("http proxy (from environment) = %s\n", debugstr_w(lpwpi->proxy));
619  lpwpi->proxyEnabled = 1;
620  lpwpi->proxyBypass = NULL;
621  }
622  else
623  {
624  WARN("failed to parse http_proxy value %s\n", debugstr_w(envproxy));
625  lpwpi->proxyEnabled = 0;
626  lpwpi->proxy = NULL;
627  lpwpi->proxyBypass = NULL;
628  }
629  }
630 
631  if (lpwpi->proxyEnabled)
632  {
633  TRACE("Proxy is enabled.\n");
634 
635  if (!(envproxy = _wgetenv( L"no_proxy" )))
636  {
637  /* figure out how much memory the proxy setting takes */
638  if (!RegQueryValueExW( key, L"ProxyOverride", NULL, &type, NULL, &len ) && len && (type == REG_SZ))
639  {
640  LPWSTR szProxy;
641 
642  if (!(szProxy = heap_alloc(len)))
643  {
644  RegCloseKey( key );
645  return ERROR_OUTOFMEMORY;
646  }
647  RegQueryValueExW( key, L"ProxyOverride", NULL, &type, (BYTE*)szProxy, &len );
648 
649  heap_free( lpwpi->proxyBypass );
650  lpwpi->proxyBypass = szProxy;
651 
652  TRACE("http proxy bypass (from registry) = %s\n", debugstr_w(lpwpi->proxyBypass));
653  }
654  else
655  {
656  heap_free( lpwpi->proxyBypass );
657  lpwpi->proxyBypass = NULL;
658 
659  TRACE("No proxy bypass server settings in registry.\n");
660  }
661  }
662  else
663  {
664  WCHAR *envproxyW;
665 
666  if (!(envproxyW = heap_alloc(lstrlenW(envproxy) * sizeof(WCHAR))))
667  {
668  RegCloseKey( key );
669  return ERROR_OUTOFMEMORY;
670  }
671  lstrcpyW( envproxyW, envproxy );
672 
673  heap_free( lpwpi->proxyBypass );
674  lpwpi->proxyBypass = envproxyW;
675 
676  TRACE("http proxy bypass (from environment) = %s\n", debugstr_w(lpwpi->proxyBypass));
677  }
678  }
679  else TRACE("Proxy is disabled.\n");
680 
681  RegCloseKey( key );
682  return ERROR_SUCCESS;
683 }
#define ERROR_SUCCESS
Definition: deptool.c:10
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static BOOL parse_proxy_url(proxyinfo_t *info, const WCHAR *url)
Definition: internet.c:491
LPWSTR proxyBypass
Definition: internet.c:92
#define WARN(fmt,...)
Definition: debug.h:112
DWORD proxyEnabled
Definition: internet.c:90
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:609
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static DWORD
Definition: internet.c:34
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
static proxyinfo_t * global_proxy
Definition: internet.c:478
static void FreeProxyInfo(proxyinfo_t *lpwpi)
Definition: internet.c:470
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
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static CRITICAL_SECTION WININET_cs
Definition: internet.c:75
static const WCHAR szInternetSettings[]
Definition: internet.c:100
int ret
static const WCHAR L[]
Definition: oid.c:1250
HKEY key
Definition: reg.c:42
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: xxhash.c:193
LPWSTR proxy
Definition: internet.c:91
#define lstrcpyW
Definition: compat.h:608
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP wchar_t *__cdecl _wgetenv(_In_z_ const wchar_t *_VarName)
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
Definition: path.c:41
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define REG_SZ
Definition: layer.c:22

Referenced by INTERNET_ConfigureProxy(), InternetSetOptionW(), and query_global_option().

◆ INTERNET_SaveProxySettings()

static LONG INTERNET_SaveProxySettings ( proxyinfo_t lpwpi)
static

Definition at line 331 of file internet.c.

332 {
333  HKEY key;
334  LONG ret;
335 
337  return ret;
338 
339  if ((ret = RegSetValueExW( key, L"ProxyEnable", 0, REG_DWORD, (BYTE*)&lpwpi->proxyEnabled, sizeof(DWORD))))
340  {
341  RegCloseKey( key );
342  return ret;
343  }
344 
345  if (lpwpi->proxy)
346  {
347  if ((ret = RegSetValueExW( key, L"ProxyServer", 0, REG_SZ, (BYTE*)lpwpi->proxy, sizeof(WCHAR) * (lstrlenW(lpwpi->proxy) + 1))))
348  {
349  RegCloseKey( key );
350  return ret;
351  }
352  }
353  else
354  {
355  if ((ret = RegDeleteValueW( key, L"ProxyServer" )) && ret != ERROR_FILE_NOT_FOUND)
356  {
357  RegCloseKey( key );
358  return ret;
359  }
360  }
361 
362  RegCloseKey(key);
363  return ERROR_SUCCESS;
364 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
DWORD proxyEnabled
Definition: internet.c:90
#define lstrlenW
Definition: compat.h:609
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR szInternetSettings[]
Definition: internet.c:100
int ret
static const WCHAR L[]
Definition: oid.c:1250
HKEY key
Definition: reg.c:42
unsigned char BYTE
Definition: xxhash.c:193
LPWSTR proxy
Definition: internet.c:91
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
#define REG_DWORD
Definition: sdbapi.c:596
Definition: path.c:41
#define REG_SZ
Definition: layer.c:22

Referenced by InternetSetOptionW().

◆ INTERNET_SetLastError()

void INTERNET_SetLastError ( DWORD  dwError)

Definition at line 3837 of file internet.c.

3838 {
3840 
3841  if (!lpwite)
3842  lpwite = INTERNET_AllocThreadError();
3843 
3844  SetLastError(dwError);
3845  if(lpwite)
3846  lpwite->dwError = dwError;
3847 }
DWORD dwError
Definition: internet.c:68
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3810
#define SetLastError(x)
Definition: compat.h:611
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:72

Referenced by calc_url_length(), FTP_Connect(), FTP_FtpCreateDirectoryW(), FTP_FtpDeleteFileW(), FTP_FtpFindFirstFileW(), FTP_FtpGetCurrentDirectoryW(), FTP_FtpGetFileW(), FTP_FtpOpenFileW(), FTP_FtpPutFileW(), FTP_FtpRemoveDirectoryW(), FTP_FtpRenameFileW(), FTP_FtpSetCurrentDirectoryW(), FTP_GetNextLine(), FTP_ParseDirectory(), FTP_RetrieveFileData(), FTP_SendCommandA(), FTP_SetResponseError(), FtpCommandA(), FtpCommandW(), FtpCreateDirectoryW(), FtpDeleteFileW(), FtpFindFirstFileW(), FtpGetCurrentDirectoryA(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), GetUrlCacheConfigInfoA(), GetUrlCacheConfigInfoW(), INTERNET_InternetOpenUrlW(), InternetCheckConnectionW(), InternetCreateUrlW(), InternetOpenW(), InternetReadFile(), InternetReadFileExA(), InternetReadFileExW(), and res_to_le().

◆ INTERNET_WorkerThreadFunc()

static DWORD CALLBACK INTERNET_WorkerThreadFunc ( LPVOID  lpvParam)
static

Definition at line 3876 of file internet.c.

3877 {
3878  task_header_t *task = lpvParam;
3879 
3880  TRACE("\n");
3881 
3882  task->proc(task);
3883  WININET_Release(task->hdr);
3884  heap_free(task);
3885 
3887  {
3890  }
3891  return TRUE;
3892 }
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1264
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
object_header_t * hdr
Definition: internet.h:390
#define TLS_OUT_OF_INDEXES
Definition: winbase.h:546
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:211
async_task_proc_t proc
Definition: internet.h:389
#define NULL
Definition: types.h:112
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:72
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by INTERNET_AsyncCall().

◆ InternetAttemptConnect()

DWORD WINAPI InternetAttemptConnect ( DWORD  dwReserved)

Definition at line 1935 of file internet.c.

1936 {
1937  FIXME("Stub\n");
1938  return ERROR_SUCCESS;
1939 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FIXME(fmt,...)
Definition: debug.h:111

◆ InternetAutodial()

BOOL WINAPI InternetAutodial ( DWORD  dwFlags,
HWND  hwndParent 
)

Definition at line 4082 of file internet.c.

4083 {
4084  FIXME("STUB\n");
4085 
4086  /* Tell that we are connected to the internet. */
4087  return TRUE;
4088 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:111

◆ InternetAutodialHangup()

BOOL WINAPI InternetAutodialHangup ( DWORD  dwReserved)

Definition at line 4102 of file internet.c.

4103 {
4104  FIXME("STUB\n");
4105 
4106  /* we didn't dial, we don't disconnect */
4107  return TRUE;
4108 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:111

◆ InternetCanonicalizeUrlA()

BOOL WINAPI InternetCanonicalizeUrlA ( LPCSTR  lpszUrl,
LPSTR  lpszBuffer,
LPDWORD  lpdwBufferLength,
DWORD  dwFlags 
)

Definition at line 1978 of file internet.c.

1980 {
1981  HRESULT hr;
1982 
1983  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_a(lpszUrl), lpszBuffer,
1985 
1987  hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
1990 
1991  return hr == S_OK;
1992 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
Definition: internet.c:1953
HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags)
Definition: url.c:247
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675
#define E_POINTER
Definition: winerror.h:2365
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by InternetCanonicalizeUrl_test(), InternetOpenUrlA_test(), and test_InternetCanonicalizeUrlA().

◆ InternetCanonicalizeUrlW()

BOOL WINAPI InternetCanonicalizeUrlW ( LPCWSTR  lpszUrl,
LPWSTR  lpszBuffer,
LPDWORD  lpdwBufferLength,
DWORD  dwFlags 
)

Definition at line 2004 of file internet.c.

2006 {
2007  HRESULT hr;
2008 
2009  TRACE("(%s, %p, %p, 0x%08x) buffer length: %d\n", debugstr_w(lpszUrl), lpszBuffer,
2011 
2013  hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwFlags);
2016 
2017  return hr == S_OK;
2018 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HRESULT hr
Definition: shlfolder.c:183
static DWORD convert_url_canonicalization_flags(DWORD dwFlags)
Definition: internet.c:1953
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags)
Definition: url.c:282
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define S_OK
Definition: intsafe.h:51
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675
#define E_POINTER
Definition: winerror.h:2365
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by InternetCrackUrlW(), and CDownloadManager::UpdateProgress().

◆ InternetCheckConnectionA()

BOOL WINAPI InternetCheckConnectionA ( LPCSTR  lpszUrl,
DWORD  dwFlags,
DWORD  dwReserved 
)

Definition at line 3577 of file internet.c.

3578 {
3579  WCHAR *url = NULL;
3580  BOOL rc;
3581 
3582  if(lpszUrl) {
3583  url = heap_strdupAtoW(lpszUrl);
3584  if(!url)
3585  return FALSE;
3586  }
3587 
3589 
3590  heap_free(url);
3591  return rc;
3592 }
#define FALSE
Definition: types.h:117
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR * heap_strdupAtoW(const char *str)
Definition: appwiz.h:80
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR url[]
Definition: encode.c:1432
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WINAPI InternetCheckConnectionW(LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwReserved)
Definition: internet.c:3461
#define NULL
Definition: types.h:112
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InternetCheckConnectionW()

BOOL WINAPI InternetCheckConnectionW ( LPCWSTR  lpszUrl,
DWORD  dwFlags,
DWORD  dwReserved 
)

Definition at line 3461 of file internet.c.

3462 {
3463 /*
3464  * this is a kludge which runs the resident ping program and reads the output.
3465  *
3466  * Anyone have a better idea?
3467  */
3468 
3469  BOOL rc = FALSE;
3470  static const CHAR ping[] = "ping -c 1 ";
3471  static const CHAR redirect[] = " >/dev/null 2>/dev/null";
3472  WCHAR *host;
3473  DWORD len, host_len;
3475  int status = -1;
3476 
3477  FIXME("(%s %x %x)\n", debugstr_w(lpszUrl), dwFlags, dwReserved);
3478 
3479  /*
3480  * Crack or set the Address
3481  */
3482  if (lpszUrl == NULL)
3483  {
3484  /*
3485  * According to the doc we are supposed to use the ip for the next
3486  * server in the WnInet internal server database. I have
3487  * no idea what that is or how to get it.
3488  *
3489  * So someone needs to implement this.
3490  */
3491  FIXME("Unimplemented with URL of NULL\n");
3492  return TRUE;
3493  }
3494  else
3495  {
3497 
3499 
3500  if (!InternetCrackUrlW(lpszUrl,0,0,&components))
3501  goto End;
3502 
3503  host = components.lpszHostName;
3504  host_len = components.dwHostNameLength;
3505  port = components.nPort;
3506  TRACE("host name: %s port: %d\n",debugstr_wn(host, host_len), port);
3507  }
3508 
3510  {
3511  struct sockaddr_storage saddr;
3512  int sa_len = sizeof(saddr);
3513  WCHAR *host_z;
3514  int fd;
3515  BOOL b;
3516 
3517  host_z = heap_strndupW(host, host_len);
3518  if (!host_z)
3519  return FALSE;
3520 
3521  b = GetAddress(host_z, port, (struct sockaddr *)&saddr, &sa_len, NULL);
3522  heap_free(host_z);
3523  if(!b)
3524  goto End;
3525  init_winsock();
3526  fd = socket(saddr.ss_family, SOCK_STREAM, 0);
3527  if (fd != -1)
3528  {
3529  if (connect(fd, (struct sockaddr *)&saddr, sa_len) == 0)
3530  rc = TRUE;
3531  closesocket(fd);
3532  }
3533  }
3534  else
3535  {
3536  /*
3537  * Build our ping command
3538  */
3539  char *command;
3540 
3541  len = WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, NULL, 0, NULL, NULL);
3542  command = heap_alloc(strlen(ping)+len+strlen(redirect)+1);
3543  strcpy(command, ping);
3544  WideCharToMultiByte(CP_UNIXCP, 0, host, host_len, command+sizeof(ping)-1, len, NULL, NULL);
3545  strcpy(command+sizeof(ping)-1+len, redirect);
3546 
3547  TRACE("Ping command is : %s\n",command);
3548 
3549  status = system(command);
3550  heap_free( command );
3551 
3552  TRACE("Ping returned a code of %i\n",status);
3553 
3554  /* Ping return code of 0 indicates success */
3555  if (status == 0)
3556  rc = TRUE;
3557  }
3558 
3559 End:
3560  if (rc == FALSE)
3562 
3563  return rc;
3564 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3837
#define WideCharToMultiByte
Definition: compat.h:111
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
char * host
Definition: whois.c:55
static int fd
Definition: io.c:51
#define closesocket
Definition: ncftp.h:477
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WORD INTERNET_PORT
Definition: winhttp.h:38
#define FALSE
Definition: types.h:117
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL GetAddress(const WCHAR *, INTERNET_PORT, SOCKADDR *, int *, char *) DECLSPEC_HIDDEN
Definition: utility.c:133
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
int __cdecl system(_In_opt_z_ const char *_Command)
#define ERROR_NOT_CONNECTED
Definition: winerror.h:1201
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
#define CP_UNIXCP
Definition: compat.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwHostNameLength
Definition: wininet.h:216
GLenum GLenum GLuint components
Definition: glext.h:9620
#define FLAG_ICC_FORCE_CONNECTION
Definition: wininet.h:1904
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_wn
Definition: kernel32.h:33
#define NULL
Definition: types.h:112
int command(const char *fmt,...)
Definition: ftp.c:266
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define SOCK_STREAM
Definition: tcpip.h:118
USHORT port
Definition: uri.c:228
void init_winsock(void) DECLSPEC_HIDDEN
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: ps.c:97

Referenced by InternetCheckConnectionA().

◆ InternetCloseHandle()

BOOL WINAPI InternetCloseHandle ( HINTERNET  hInternet)

Definition at line 1414 of file internet.c.

1415 {
1417 
1418  TRACE("%p\n", hInternet);
1419 
1420  obj = get_handle_object( hInternet );
1421  if (!obj) {
1423  return FALSE;
1424  }
1425 
1428 
1429  return TRUE;
1430 }
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static void invalidate_handle(object_header_t *info)
Definition: internet.c:193
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:611
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:211
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:176

Referenced by _close_request(), AsyncInetCancel(), AsyncInetCleanUp(), AsyncInetFree(), can_do_https(), close_async_handle(), CRYPT_Connect(), get_internet_session(), HTTP_RetrieveEncodedObjectW(), HttpHeaders_test(), HttpSendRequestEx_test(), INTERNET_InternetOpenUrlW(), InternetLockRequestFile_test(), InternetOpenRequest_test(), InternetOpenUrlA_test(), InternetReadFile_chunked_test(), process_detach(), protocol_close_connection(), rpcrt4_ncacn_http_close(), START_TEST(), test_accept_encoding(), test_async_HttpSendRequestEx(), test_basic_auth_credentials_cached_manual(), test_basic_auth_credentials_different(), test_basic_auth_credentials_end_session(), test_basic_auth_credentials_manual(), test_basic_auth_credentials_reuse(), test_basic_authentication(), test_bogus_accept_types_array(), test_cache_control_verb(), test_cache_read_gzipped(), test_cert_string(), test_concurrent_header_access(), test_connect(), test_connection_header(), test_cookie_header(), test_default_service_port(), test_find_first_file(), test_header_handling_order(), test_header_override(), test_http_cache(), test_HttpSendRequestW(), test_InternetCloseHandle(), test_InternetErrorDlg(), test_InternetQueryOptionA(), test_InternetSetOption(), test_no_cache(), test_null(), test_open_url_async(), test_openfile(), test_options(), test_proxy_direct(), test_secure_connection(), test_status_callbacks(), test_user_agent_header(), CDownloadManager::ThreadFunc(), and CWebService::~CWebService().

◆ InternetCombineUrlA()

BOOL WINAPI InternetCombineUrlA ( LPCSTR  lpszBaseUrl,
LPCSTR  lpszRelativeUrl,
LPSTR  lpszBuffer,
LPDWORD  lpdwBufferLength,
DWORD  dwFlags 
)

Definition at line 4121 of file internet.c.

4124 {
4125  HRESULT hr=S_OK;
4126 
4127  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_a(lpszBaseUrl), debugstr_a(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4128 
4129  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4131  hr=UrlCombineA(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4132 
4133  return (hr==S_OK);
4134 }
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
#define ICU_NO_ENCODE
Definition: winhttp.h:290
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative, LPSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags)
Definition: url.c:614
#define S_OK
Definition: intsafe.h:51
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

◆ InternetCombineUrlW()

BOOL WINAPI InternetCombineUrlW ( LPCWSTR  lpszBaseUrl,
LPCWSTR  lpszRelativeUrl,
LPWSTR  lpszBuffer,
LPDWORD  lpdwBufferLength,
DWORD  dwFlags 
)

Definition at line 4147 of file internet.c.

4150 {
4151  HRESULT hr=S_OK;
4152 
4153  TRACE("(%s, %s, %p, %p, 0x%08x)\n", debugstr_w(lpszBaseUrl), debugstr_w(lpszRelativeUrl), lpszBuffer, lpdwBufferLength, dwFlags);
4154 
4155  /* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
4157  hr=UrlCombineW(lpszBaseUrl,lpszRelativeUrl,lpszBuffer,lpdwBufferLength,dwFlags);
4158 
4159  return (hr==S_OK);
4160 }
HRESULT hr
Definition: shlfolder.c:183
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define ICU_NO_ENCODE
Definition: winhttp.h:290
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, LPWSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags)
Definition: url.c:662
#define S_OK
Definition: intsafe.h:51
_In_ _In_opt_ _Out_writes_bytes_to_opt_ lpdwBufferLength _Inout_ LPDWORD lpdwBufferLength
Definition: winhttp.h:675

Referenced by get_redirect_url().

◆ InternetConfirmZoneCrossingA()

DWORD WINAPI InternetConfirmZoneCrossingA ( HWND  hWnd,
LPSTR  szUrlPrev,
LPSTR  szUrlNew,
BOOL  bPost 
)

Definition at line 4552 of file internet.c.

4553 {
4554  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_a(szUrlPrev), debugstr_a(szUrlNew), bPost);
4555  return ERROR_SUCCESS;
4556 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31

◆ InternetConfirmZoneCrossingW()

DWORD WINAPI InternetConfirmZoneCrossingW ( HWND  hWnd,
LPWSTR  szUrlPrev,
LPWSTR  szUrlNew,
BOOL  bPost 
)

Definition at line 4562 of file internet.c.

4563 {
4564  FIXME("(%p, %s, %s, %x) stub\n", hWnd, debugstr_w(szUrlPrev), debugstr_w(szUrlNew), bPost);
4565  return ERROR_SUCCESS;
4566 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111

◆ InternetConnectA()

HINTERNET WINAPI InternetConnectA ( HINTERNET  hInternet,
LPCSTR  lpszServerName,
INTERNET_PORT  nServerPort,
LPCSTR  lpszUserName,
LPCSTR  lpszPassword,
DWORD  dwService,
DWORD  dwFlags,
DWORD_PTR  dwContext 
)

Definition at line 1321 of file internet.c.

1325 {
1326  HINTERNET rc = NULL;
1327  LPWSTR szServerName;
1328  LPWSTR szUserName;
1329  LPWSTR szPassword;
1330 
1331  szServerName = heap_strdupAtoW(lpszServerName);
1332  szUserName = heap_strdupAtoW(lpszUserName);
1333  szPassword = heap_strdupAtoW(lpszPassword);
1334 
1335  rc = InternetConnectW(hInternet, szServerName, nServerPort,
1336  szUserName, szPassword, dwService, dwFlags, dwContext);
1337 
1338  heap_free(szServerName);
1339  heap_free(szUserName);
1340  heap_free(szPassword);
1341  return rc;
1342 }
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2690
static WCHAR * heap_strdupAtoW(const char *str)
Definition: appwiz.h:80
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1258
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by _open_simple_request(), can_do_https(), HttpHeaders_test(), HttpSendRequestEx_test(), InternetOpenRequest_test(), InternetReadFile_chunked_test(), InternetReadFile_test(), InternetReadFileExA_test(), open_socket_request(), START_TEST(), test_accept_encoding(), test_async_HttpSendRequestEx(), test_async_read(), test_basic_auth_credentials_cached_manual(), test_basic_auth_credentials_different(), test_basic_auth_credentials_end_session(), test_basic_auth_credentials_manual(), test_basic_auth_credentials_reuse(), test_basic_authentication(), test_bogus_accept_types_array(), test_cache_control_verb(), test_cache_read(), test_cache_read_gzipped(), test_cert_string(), test_concurrent_header_access(), test_conn_close(), test_connect(), test_connection_closing(), test_connection_header(), test_cookie_header(), test_default_service_port(), test_header_handling_order(), test_header_override(), test_http_cache(), test_HttpSendRequestW(), test_InternetCloseHandle(), test_InternetErrorDlg(), test_InternetQueryOptionA(), test_InternetSetOption(), test_no_cache(), test_no_content(), test_options(), test_proxy_direct(), test_secure_connection(), test_security_flags(), test_status_callbacks(), test_successive_HttpSendRequest(), and test_user_agent_header().

◆ InternetConnectW()

HINTERNET WINAPI InternetConnectW ( HINTERNET  hInternet,
LPCWSTR  lpszServerName,
INTERNET_PORT  nServerPort,
LPCWSTR  lpszUserName,
LPCWSTR  lpszPassword,
DWORD  dwService,
DWORD  dwFlags,
DWORD_PTR  dwContext 
)

Definition at line 1258 of file internet.c.

1262 {
1263  appinfo_t *hIC;
1264  HINTERNET rc = NULL;
1266 
1267  TRACE("(%p, %s, %u, %s, %p, %u, %x, %lx)\n", hInternet, debugstr_w(lpszServerName),
1268  nServerPort, debugstr_w(lpszUserName), lpszPassword, dwService, dwFlags, dwContext);
1269 
1270  if (!lpszServerName)
1271  {
1273  return NULL;
1274  }
1275 
1276  hIC = (appinfo_t*)get_handle_object( hInternet );
1277  if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
1278  {
1280  goto lend;
1281  }
1282 
1283  switch (dwService)
1284  {
1285  case INTERNET_SERVICE_FTP:
1286  rc = FTP_Connect(hIC, lpszServerName, nServerPort,
1287  lpszUserName, lpszPassword, dwFlags, dwContext, 0);
1288  if(!rc)
1290  break;
1291 
1292  case INTERNET_SERVICE_HTTP:
1293  res = HTTP_Connect(hIC, lpszServerName, nServerPort,
1294  lpszUserName, lpszPassword, dwFlags, dwContext, 0, &rc);
1295  break;
1296 
1298  default:
1299  break;
1300  }
1301 lend:
1302  if( hIC )
1303  WININET_Release( &hIC->hdr );
1304 
1305  TRACE("returning %p\n", rc);
1306  SetLastError(res);
1307  return rc;
1308 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2690
#define INTERNET_SERVICE_GOPHER
Definition: wininet.h:561
#define debugstr_w
Definition: kernel32.h:32
DWORD INTERNET_GetLastError(void)
Definition: internet.c:3858
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:5836
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
#define INTERNET_SERVICE_FTP
Definition: wininet.h:560
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:211
object_header_t hdr
Definition: internet.h:291
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
WH_TYPE htype
Definition: internet.h:273
object_header_t * get_handle_object(HINTERNET hinternet)
Definition: internet.c:176
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:2428

Referenced by CRYPT_Connect(), CWebService::CWebService(), HttpProtocol_open_request(), InternetConnectA(), rpcrt4_http_internet_connect(), test_null(), and test_secure_connection().

◆ InternetCrackUrlA()

BOOL WINAPI InternetCrackUrlA ( const char url,
DWORD  url_length,
DWORD  flags,
URL_COMPONENTSA ret_comp 
)

Definition at line 1506 of file internet.c.

1507 {
1508  WCHAR *host = NULL, *user = NULL, *pass = NULL, *path = NULL, *scheme = NULL, *extra = NULL;
1509  URL_COMPONENTSW comp;
1510  WCHAR *url_w = NULL;
1511  BOOL ret;
1512 
1513  TRACE("(%s %u %x %p)\n", url_length ? debugstr_an(url, url_length) : debugstr_a(url), url_length, flags, ret_comp);
1514 
1515  if (!url || !*url || !ret_comp || ret_comp->dwStructSize != sizeof(URL_COMPONENTSA)) {
1517  return FALSE;
1518  }
1519 
1520  comp.dwStructSize = sizeof(comp);
1521 
1523  &comp.lpszHostName, &comp.dwHostNameLength, &host)
1524  && set_url_component_AtoW(ret_comp->lpszUserName, ret_comp->dwUserNameLength,
1525  &comp.lpszUserName, &comp.dwUserNameLength, &user)
1526  && set_url_component_AtoW(ret_comp->lpszPassword, ret_comp->dwPasswordLength,
1527  &comp.lpszPassword, &comp.dwPasswordLength, &pass)
1528  && set_url_component_AtoW(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength,
1529  &comp.lpszUrlPath, &comp.dwUrlPathLength, &path)
1530  && set_url_component_AtoW(ret_comp->lpszScheme, ret_comp->dwSchemeLength,
1531  &comp.lpszScheme, &comp.dwSchemeLength, &scheme)
1532  && set_url_component_AtoW(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength,
1533  &comp.lpszExtraInfo, &comp.dwExtraInfoLength, &extra);
1534 
1535  if(ret && !(url_w = heap_strndupAtoW(url, url_length ? url_length : -1, &url_length))) {
1537  ret = FALSE;
1538  }
1539 
1540  if (ret && (ret = InternetCrackUrlW(url_w, url_length, flags, &comp))) {
1541  ret_comp->nScheme = comp.nScheme;
1542  ret_comp->nPort = comp.nPort;
1543 
1545  &ret_comp->lpszHostName, &ret_comp->dwHostNameLength, url)
1547  &ret_comp->lpszUserName, &ret_comp->dwUserNameLength, url)
1549  &ret_comp->lpszPassword, &ret_comp->dwPasswordLength, url)
1550  && set_url_component_WtoA(comp.lpszUrlPath, comp.dwUrlPathLength, url_w,
1551  &ret_comp->lpszUrlPath, &ret_comp->dwUrlPathLength, url)
1552  && set_url_component_WtoA(comp.lpszScheme, comp.dwSchemeLength, url_w,
1553  &ret_comp->lpszScheme, &ret_comp->dwSchemeLength, url)
1555  &ret_comp->lpszExtraInfo, &ret_comp->dwExtraInfoLength, url);
1556 
1557  if(ret)
1558  TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_a(url),
1559  debugstr_an(ret_comp->lpszScheme, ret_comp->dwSchemeLength),
1560  debugstr_an(ret_comp->lpszHostName, ret_comp->dwHostNameLength),
1561  debugstr_an(ret_comp->lpszUrlPath, ret_comp->dwUrlPathLength),
1562  debugstr_an(ret_comp->lpszExtraInfo, ret_comp->dwExtraInfoLength));
1563  }
1564 
1565  heap_free(host);
1566  heap_free(user);
1567  heap_free(pass);
1568  heap_free(path);
1569  heap_free(scheme);
1570  heap_free(extra);
1571  heap_free(url_w);
1572  return ret;
1573 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LPSTR lpszUserName
Definition: wininet.h:200
LPSTR lpszPassword
Definition: wininet.h:202
LPSTR lpszExtraInfo
Definition: wininet.h:206
LPSTR lpszScheme
Definition: wininet.h:194
DWORD dwUrlPathLength
Definition: wininet.h:205
DWORD dwStructSize
Definition: wininet.h:211
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:1457
char * host
Definition: whois.c:55
LPSTR lpszUrlPath
Definition: wininet.h:204
DWORD scheme
DWORD dwUserNameLength
Definition: wininet.h:219
LPWSTR lpszHostName
Definition: wininet.h:215
LPWSTR lpszExtraInfo
Definition: wininet.h:224
DWORD dwPasswordLength
Definition: wininet.h:203
pass
Definition: typegen.h:24
DWORD dwSchemeLength
Definition: wininet.h:213
#define FALSE
Definition: types.h:117
DWORD dwSchemeLength
Definition: wininet.h:195
INTERNET_PORT nPort
Definition: wininet.h:217
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD dwUserNameLength
Definition: wininet.h:201
DWORD dwHostNameLength
Definition: wininet.h:198
#define TRACE(s)
Definition: solgame.cpp:4
Definition: id3.c:95
LPWSTR lpszScheme
Definition: wininet.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR url[]
Definition: encode.c:1432
INTERNET_SCHEME nScheme
Definition: wininet.h:214
#define SetLastError(x)
Definition: compat.h:611
GLbitfield flags
Definition: glext.h:7161
DWORD dwPasswordLength
Definition: wininet.h:221
DWORD dwHostNameLength
Definition: wininet.h:216
int ret
LPWSTR lpszUserName
Definition: wininet.h:218
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
LPWSTR lpszUrlPath
Definition: wininet.h:222
DWORD dwExtraInfoLength
Definition: wininet.h:207
DWORD dwUrlPathLength
Definition: wininet.h:223
INTERNET_PORT nPort
Definition: wininet.h:199
#define NULL
Definition: types.h:112
INTERNET_SCHEME nScheme
Definition: wininet.h:196
BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwFlags, URL_COMPONENTSW *lpUC)
Definition: internet.c:1625
static BOOL set_url_component_AtoW(const char *comp_a, DWORD len_a, WCHAR **comp_w, DWORD *len_w, WCHAR **buf)
Definition: internet.c:1484
static WCHAR * heap_strndupAtoW(const char *str, int len_a, DWORD *len_w)
Definition: internet.h:149
DWORD dwStructSize
Definition: wininet.h:193
void user(int argc, const char *argv[])
Definition: cmds.c:1350
LPSTR lpszHostName
Definition: wininet.h:197
LPWSTR lpszPassword
Definition: wininet.h:220
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
DWORD dwExtraInfoLength
Definition: wininet.h:225

Referenced by InternetCrackUrl_test(), test_crack_url(), test_long_url(), urlcache_decode_url(), and urlcache_entry_create().

◆ InternetCrackUrlW()

BOOL WINAPI InternetCrackUrlW ( const WCHAR lpszUrl,
DWORD  dwUrlLength,
DWORD  dwFlags,
URL_COMPONENTSW lpUC 
)

Definition at line 1625 of file internet.c.

1626 {
1627  /*
1628  * RFC 1808
1629  * <protocol>:[//<net_loc>][/path][;<params>][?<query>][#<fragment>]
1630  *
1631  */
1632  LPCWSTR lpszParam = NULL;
1633  BOOL found_colon = FALSE;
1634  LPCWSTR lpszap;
1635  LPCWSTR lpszcp = NULL, lpszNetLoc;
1636 
1637  TRACE("(%s %u %x %p)\n",
1638  lpszUrl ? debugstr_wn(lpszUrl, dwUrlLength ? dwUrlLength : lstrlenW(lpszUrl)) : "(null)",
1639  dwUrlLength, dwFlags, lpUC);
1640 
1641  if (!lpszUrl || !*lpszUrl || !lpUC)
1642  {
1644  return FALSE;
1645  }
1646  if (!dwUrlLength) dwUrlLength = lstrlenW(lpszUrl);
1647 
1648  if (dwFlags & ICU_DECODE)
1649  {
1650  WCHAR *url_tmp, *buffer;
1651  DWORD len = dwUrlLength + 1;
1652  BOOL ret;
1653 
1654  if (!(url_tmp = heap_strndupW(lpszUrl, dwUrlLength)))
1655  {
1657  return FALSE;
1658  }
1659 
1660  buffer = url_tmp;
1663  {
1664  buffer = heap_alloc(len * sizeof(WCHAR));
1665  if (!buffer)
1666  {
1668  heap_free(url_tmp);
1669  return FALSE;
1670  }
1672  }
1673  if (ret)
1675 
1676  if (buffer != url_tmp) heap_free(buffer);
1677  heap_free(url_tmp);
1678  return ret;
1679  }
1680  lpszap = lpszUrl;
1681 
1682  /* Determine if the URI is absolute. */
1683  while (lpszap - lpszUrl < dwUrlLength)
1684  {
1685  if (iswalnum(*lpszap) || *lpszap == '+' || *lpszap == '.' || *lpszap == '-')
1686  {
1687  lpszap++;
1688  continue;
1689  }
1690  if (*lpszap == ':')
1691  {
1692  found_colon = TRUE;
1693  lpszcp = lpszap;
1694  }
1695  else
1696  {
1697  lpszcp = lpszUrl; /* Relative url */
1698  }
1699 
1700  break;
1701  }
1702 
1703  if(!found_colon){
1705  return FALSE;
1706  }
1707 
1710 
1711  /* Parse <params> */
1712  lpszParam = wmemchr(lpszap, '?', dwUrlLength - (lpszap - lpszUrl));
1713  if(!lpszParam)
1714  lpszParam = wmemchr(lpszap, '#', dwUrlLength - (lpszap - lpszUrl));
1715 
1717  lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0))
1718  return FALSE;
1719 
1720 
1721  /* Get scheme first. */
1722  lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
1723  if(!set_url_component(&lpUC->lpszScheme, &lpUC->dwSchemeLength, lpszUrl, lpszcp - lpszUrl))
1724  return FALSE;